@redocly/openapi-docs 3.0.0-alpha.80 → 3.0.0-alpha.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console.redocly-openapi-docs.min.js +109 -108
- package/dist/oauth2-redirect.js +5 -5
- package/dist/redocly-openapi-docs.min.js +1179 -1173
- package/lib/components/DropdownOrLabel/DropdownOrLabel.d.ts +1 -1
- package/lib/components/Endpoint/ServerList.js +1 -1
- package/lib/components/Fields/FieldDetails.js +1 -1
- package/lib/components/SeeMore/SeeMore.js +1 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +2 -1
- package/lib/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +2 -1
- package/lib/components/Tabs/Tab.d.ts +2 -2
- package/lib/components/Tabs/TabList.d.ts +2 -2
- package/lib/components/Tabs/TabPanel.d.ts +2 -2
- package/lib/components/common/CheckboxList.js +1 -1
- package/lib/components/common/TextField.js +1 -1
- package/lib/components/common/perfect-scrollbar.d.ts +1 -1
- package/lib/components/rightPanel/Console/Console.js +1 -1
- package/lib/components/rightPanel/RequestBody/Body.js +1 -1
- package/lib/hooks/useRouter.d.ts +3 -1
- package/lib/setupTests.d.ts +1 -2
- package/lib/setupTests.js +1 -1
- package/lib/standalone.d.ts +1 -1
- package/lib/standalone.js +1 -1
- package/lib-esm/components/DropdownOrLabel/DropdownOrLabel.d.ts +1 -1
- package/lib-esm/components/Endpoint/ServerList.js +1 -1
- package/lib-esm/components/Fields/FieldDetails.js +1 -1
- package/lib-esm/components/SeeMore/SeeMore.js +1 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +2 -1
- package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +2 -1
- package/lib-esm/components/Tabs/Tab.d.ts +2 -2
- package/lib-esm/components/Tabs/TabList.d.ts +2 -2
- package/lib-esm/components/Tabs/TabPanel.d.ts +2 -2
- package/lib-esm/components/common/CheckboxList.js +1 -1
- package/lib-esm/components/common/TextField.js +1 -1
- package/lib-esm/components/common/perfect-scrollbar.d.ts +1 -1
- package/lib-esm/components/rightPanel/Console/Console.js +1 -1
- package/lib-esm/components/rightPanel/RequestBody/Body.js +1 -1
- package/lib-esm/hooks/useRouter.d.ts +3 -1
- package/lib-esm/setupTests.d.ts +1 -2
- package/lib-esm/setupTests.js +1 -1
- package/lib-esm/standalone.d.ts +1 -1
- package/lib-esm/standalone.js +1 -1
- package/package.json +18 -22
|
@@ -2,79 +2,79 @@
|
|
|
2
2
|
* Redocly OpenAPI Docs
|
|
3
3
|
* (c) Copyright 2018 Redocly LLC, all rights reserved.
|
|
4
4
|
* -------------------------------------------------------------
|
|
5
|
-
* Version: "3.0.0-alpha.
|
|
5
|
+
* Version: "3.0.0-alpha.81"
|
|
6
6
|
*/(this.webpackChunkRedoclyOpenAPIDocs=this.webpackChunkRedoclyOpenAPIDocs||[]).push([[290],{26179:(v,C)=>{"use strict";/*!
|
|
7
7
|
* cookie
|
|
8
8
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
9
9
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
10
10
|
* MIT Licensed
|
|
11
|
-
*/C.parse=b,C.serialize=x;var f=Object.prototype.toString,g=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(D,L){if(typeof D!="string")throw new TypeError("argument str must be a string");for(var H={},J=L||{},q=J.decode||k,X=0;X<D.length;){var G=D.indexOf("=",X);if(G===-1)break;var te=D.indexOf(";",X);if(te===-1)te=D.length;else if(te<G){X=D.lastIndexOf(";",G-1)+1;continue}var oe=D.slice(X,G).trim();if(H[oe]===void 0){var R=D.slice(G+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),H[oe]=N(R,q)}X=te+1}return H}function x(D,L,H){var J=H||{},q=J.encode||O;if(typeof q!="function")throw new TypeError("option encode is invalid");if(!g.test(D))throw new TypeError("argument name is invalid");var X=q(L);if(X&&!g.test(X))throw new TypeError("argument val is invalid");var G=D+"="+X;if(J.maxAge!=null){var te=J.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");G+="; Max-Age="+Math.floor(te)}if(J.domain){if(!g.test(J.domain))throw new TypeError("option domain is invalid");G+="; Domain="+J.domain}if(J.path){if(!g.test(J.path))throw new TypeError("option path is invalid");G+="; Path="+J.path}if(J.expires){var oe=J.expires;if(!P(oe)||isNaN(oe.valueOf()))throw new TypeError("option expires is invalid");G+="; Expires="+oe.toUTCString()}if(J.httpOnly&&(G+="; HttpOnly"),J.secure&&(G+="; Secure"),J.priority){var R=typeof J.priority=="string"?J.priority.toLowerCase():J.priority;switch(R){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(J.sameSite){var ee=typeof J.sameSite=="string"?J.sameSite.toLowerCase():J.sameSite;switch(ee){case!0:G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"strict":G+="; SameSite=Strict";break;case"none":G+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return G}function k(D){return D.indexOf("%")!==-1?decodeURIComponent(D):D}function O(D){return encodeURIComponent(D)}function P(D){return f.call(D)==="[object Date]"||D instanceof Date}function N(D,L){try{return L(D)}catch{return D}}},97529:(v,C,f)=>{var g=f(44928);v.exports=g},75342:(v,C,f)=>{var g=f(26087);v.exports=g},64218:(v,C,f)=>{var g=f(11783);v.exports=g},95050:(v,C,f)=>{var g=f(88462);v.exports=g},84779:(v,C,f)=>{var g=f(83531);v.exports=g},17190:(v,C,f)=>{var g=f(19941);v.exports=g},96589:(v,C,f)=>{var g=f(25081);v.exports=g},32276:(v,C,f)=>{var g=f(22145);v.exports=g},15064:(v,C,f)=>{var g=f(93690);v.exports=g},31986:(v,C,f)=>{var g=f(8429);f(42319),v.exports=g},69635:(v,C,f)=>{var g=f(13099);v.exports=g},3529:(v,C,f)=>{var g=f(44931);v.exports=g},85373:(v,C,f)=>{f(17802);var g=f(70291);v.exports=g("Array").filter},94537:(v,C,f)=>{f(64009);var g=f(70291);v.exports=g("Array").forEach},27794:(v,C,f)=>{f(32449);var g=f(70291);v.exports=g("Array").indexOf},55794:(v,C,f)=>{var g=f(15166),b=f(85373),x=Array.prototype;v.exports=function(k){var O=k.filter;return k===x||g(x,k)&&O===x.filter?b:O}},85838:(v,C,f)=>{var g=f(15166),b=f(27794),x=Array.prototype;v.exports=function(k){var O=k.indexOf;return k===x||g(x,k)&&O===x.indexOf?b:O}},95617:(v,C,f)=>{f(28135);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.defineProperties(O,P)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,P,N){return b.defineProperty(O,P,N)};b.defineProperty.sham&&(x.sham=!0)},59123:(v,C,f)=>{f(51964);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.getOwnPropertyDescriptor(O,P)};b.getOwnPropertyDescriptor.sham&&(x.sham=!0)},63332:(v,C,f)=>{f(723);var g=f(59921);v.exports=g.Object.getOwnPropertyDescriptors},83606:(v,C,f)=>{f(68030);var g=f(59921);v.exports=g.Object.getOwnPropertySymbols},90660:(v,C,f)=>{f(38339);var g=f(59921);v.exports=g.Object.keys},49198:(v,C,f)=>{f(69825),f(97829),f(68030),f(95353),f(63906),f(39542),f(47882),f(84911),f(88725),f(47954),f(67703),f(2220),f(48990),f(50240),f(99921),f(3502),f(80220),f(23870),f(5828),f(5708);var g=f(59921);v.exports=g.Symbol},15413:(v,C,f)=>{f(44390),f(97829),f(27626),f(84911);var g=f(39378);v.exports=g.f("iterator")},4793:(v,C,f)=>{f(91667),f(99921);var g=f(39378);v.exports=g.f("toPrimitive")},24018:(v,C,f)=>{v.exports=f(11226)},27411:(v,C,f)=>{v.exports=f(39743)},79155:(v,C,f)=>{v.exports=f(17018)},13375:(v,C,f)=>{v.exports=f(45057)},95442:(v,C,f)=>{v.exports=f(97947)},55334:(v,C,f)=>{v.exports=f(26452)},48261:(v,C,f)=>{v.exports=f(4477)},92864:(v,C,f)=>{v.exports=f(74013)},27923:(v,C,f)=>{v.exports=f(17685)},89225:(v,C,f)=>{v.exports=f(2371)},95281:(v,C,f)=>{v.exports=f(89061)},55468:(v,C,f)=>{v.exports=f(51553)},11226:(v,C,f)=>{var g=f(97529);v.exports=g},39743:(v,C,f)=>{var g=f(75342);v.exports=g},17018:(v,C,f)=>{var g=f(64218);v.exports=g},45057:(v,C,f)=>{var g=f(95050);v.exports=g},97947:(v,C,f)=>{var g=f(84779);v.exports=g},26452:(v,C,f)=>{var g=f(17190);v.exports=g},4477:(v,C,f)=>{var g=f(96589);v.exports=g},74013:(v,C,f)=>{var g=f(32276);v.exports=g},17685:(v,C,f)=>{var g=f(15064);v.exports=g},2371:(v,C,f)=>{var g=f(31986);f(45987),f(58052),f(90181),f(25129),f(90397),f(18097),f(82793),f(52100),f(99742),v.exports=g},89061:(v,C,f)=>{var g=f(69635);v.exports=g},51553:(v,C,f)=>{var g=f(3529);v.exports=g},81970:(v,C,f)=>{var g=f(43152),b=f(18342),x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not a function")}},72185:(v,C,f)=>{var g=f(43152),b=String,x=TypeError;v.exports=function(k){if(typeof k=="object"||g(k))return k;throw x("Can't set "+b(k)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,f)=>{var g=f(92548),b=String,x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not an object")}},24782:(v,C,f)=>{"use strict";var g=f(93935).forEach,b=f(10454),x=b("forEach");v.exports=x?[].forEach:function(O){return g(this,O,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,f)=>{var g=f(88966),b=f(13249),x=f(53387),k=function(O){return function(P,N,D){var L=g(P),H=x(L),J=b(D,H),q;if(O&&N!=N){for(;H>J;)if(q=L[J++],q!=q)return!0}else for(;H>J;J++)if((O||J in L)&&L[J]===N)return O||J||0;return!O&&-1}};v.exports={includes:k(!0),indexOf:k(!1)}},93935:(v,C,f)=>{var g=f(7416),b=f(90406),x=f(38622),k=f(53254),O=f(53387),P=f(69573),N=b([].push),D=function(L){var H=L==1,J=L==2,q=L==3,X=L==4,G=L==6,te=L==7,oe=L==5||G;return function(R,ee,z,ne){for(var ie=k(R),ae=x(ie),ue=g(ee,z),V=O(ae),K=0,le=ne||P,ge=H?le(R,V):J||te?le(R,0):void 0,me,ve;V>K;K++)if((oe||K in ae)&&(me=ae[K],ve=ue(me,K,ie),L))if(H)ge[K]=ve;else if(ve)switch(L){case 3:return!0;case 5:return me;case 6:return K;case 2:N(ge,me)}else switch(L){case 4:return!1;case 7:N(ge,me)}return G?-1:q||X?X:ge}};v.exports={forEach:D(0),map:D(1),filter:D(2),some:D(3),every:D(4),find:D(5),findIndex:D(6),filterReject:D(7)}},36844:(v,C,f)=>{var g=f(31982),b=f(33538),x=f(32438),k=b("species");v.exports=function(O){return x>=51||!g(function(){var P=[],N=P.constructor={};return N[k]=function(){return{foo:1}},P[O](Boolean).foo!==1})}},10454:(v,C,f)=>{"use strict";var g=f(31982);v.exports=function(b,x){var k=[][b];return!!k&&g(function(){k.call(null,x||function(){return 1},1)})}},67932:(v,C,f)=>{var g=f(13249),b=f(53387),x=f(53437),k=Array,O=Math.max;v.exports=function(P,N,D){for(var L=b(P),H=g(N,L),J=g(D===void 0?L:D,L),q=k(O(J-H,0)),X=0;H<J;H++,X++)x(q,X,P[H]);return q.length=X,q}},53160:(v,C,f)=>{var g=f(90406);v.exports=g([].slice)},76562:(v,C,f)=>{var g=f(93053),b=f(43455),x=f(92548),k=f(33538),O=k("species"),P=Array;v.exports=function(N){var D;return g(N)&&(D=N.constructor,b(D)&&(D===P||g(D.prototype))?D=void 0:x(D)&&(D=D[O],D===null&&(D=void 0))),D===void 0?P:D}},69573:(v,C,f)=>{var g=f(76562);v.exports=function(b,x){return new(g(b))(x===0?0:x)}},58310:(v,C,f)=>{var g=f(90406),b=g({}.toString),x=g("".slice);v.exports=function(k){return x(b(k),8,-1)}},82059:(v,C,f)=>{var g=f(48448),b=f(43152),x=f(58310),k=f(33538),O=k("toStringTag"),P=Object,N=x(function(){return arguments}())=="Arguments",D=function(L,H){try{return L[H]}catch{}};v.exports=g?x:function(L){var H,J,q;return L===void 0?"Undefined":L===null?"Null":typeof(J=D(H=P(L),O))=="string"?J:N?x(H):(q=x(H))=="Object"&&b(H.callee)?"Arguments":q}},74838:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,f){return{value:C,done:f}}},20410:(v,C,f)=>{var g=f(56049),b=f(36133),x=f(54686);v.exports=g?function(k,O,P){return b.f(k,O,x(1,P))}:function(k,O,P){return k[O]=P,k}},54686:v=>{v.exports=function(C,f){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:f}}},53437:(v,C,f)=>{"use strict";var g=f(5135),b=f(36133),x=f(54686);v.exports=function(k,O,P){var N=g(O);N in k?b.f(k,N,x(0,P)):k[N]=P}},37912:(v,C,f)=>{var g=f(36133);v.exports=function(b,x,k){return g.f(b,x,k)}},27519:(v,C,f)=>{var g=f(20410);v.exports=function(b,x,k,O){return O&&O.enumerable?b[x]=k:g(b,x,k),b}},9267:(v,C,f)=>{var g=f(62447),b=Object.defineProperty;v.exports=function(x,k){try{b(g,x,{value:k,configurable:!0,writable:!0})}catch{g[x]=k}return k}},56049:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,f=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:f}},45511:(v,C,f)=>{var g=f(62447),b=f(92548),x=g.document,k=b(x)&&b(x.createElement);v.exports=function(O){return k?x.createElement(O):{}}},11452:v=>{var C=TypeError,f=9007199254740991;v.exports=function(g){if(g>f)throw C("Maximum allowed index exceeded");return g}},81595:v=>{v.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},90740:v=>{v.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},32438:(v,C,f)=>{var g=f(62447),b=f(90740),x=g.process,k=g.Deno,O=x&&x.versions||k&&k.version,P=O&&O.v8,N,D;P&&(N=P.split("."),D=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!D&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(D=+N[1]))),v.exports=D},70291:(v,C,f)=>{var g=f(59921);v.exports=function(b){return g[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,f)=>{"use strict";var g=f(62447),b=f(82768),x=f(57953),k=f(43152),O=f(80016).f,P=f(51585),N=f(59921),D=f(7416),L=f(20410),H=f(18768),J=function(q){var X=function(G,te,oe){if(this instanceof X){switch(arguments.length){case 0:return new q;case 1:return new q(G);case 2:return new q(G,te)}return new q(G,te,oe)}return b(q,this,arguments)};return X.prototype=q.prototype,X};v.exports=function(q,X){var G=q.target,te=q.global,oe=q.stat,R=q.proto,ee=te?g:oe?g[G]:(g[G]||{}).prototype,z=te?N:N[G]||L(N,G,{})[G],ne=z.prototype,ie,ae,ue,V,K,le,ge,me,ve;for(V in X)ie=P(te?V:G+(oe?".":"#")+V,q.forced),ae=!ie&&ee&&H(ee,V),le=z[V],ae&&(q.dontCallGetSet?(ve=O(ee,V),ge=ve&&ve.value):ge=ee[V]),K=ae&&ge?ge:X[V],!(ae&&typeof le==typeof K)&&(q.bind&&ae?me=D(K,g):q.wrap&&ae?me=J(K):R&&k(K)?me=x(K):me=K,(q.sham||K&&K.sham||le&&le.sham)&&L(me,"sham",!0),L(z,V,me),R&&(ue=G+"Prototype",H(N,ue)||L(N,ue,{}),L(N[ue],V,K),q.real&&ne&&(ie||!ne[V])&&L(ne,V,K)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,P){return b(O),P===void 0?O:x?k(O,P):function(){return O.apply(P,arguments)}}},97966:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,f)=>{var g=f(97966),b=Function.prototype.call;v.exports=g?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,f)=>{var g=f(56049),b=f(18768),x=Function.prototype,k=g&&Object.getOwnPropertyDescriptor,O=b(x,"name"),P=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:P,CONFIGURABLE:N}},54518:(v,C,f)=>{var g=f(90406),b=f(81970);v.exports=function(x,k,O){try{return g(b(Object.getOwnPropertyDescriptor(x,k)[O]))}catch{}}},57953:(v,C,f)=>{var g=f(58310),b=f(90406);v.exports=function(x){if(g(x)==="Function")return b(x)}},90406:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.call,k=g&&b.bind.bind(x,x);v.exports=g?k:function(O){return function(){return x.apply(O,arguments)}}},97080:(v,C,f)=>{var g=f(59921),b=f(62447),x=f(43152),k=function(O){return x(O)?O:void 0};v.exports=function(O,P){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][P]||b[O]&&b[O][P]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),P=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var D=N.length,L=[],H=0;H<D;H++){var J=N[H];typeof J=="string"?P(L,J):(typeof J=="number"||k(J)=="Number"||k(J)=="String")&&P(L,O(J))}var q=L.length,X=!0;return function(G,te){if(X)return X=!1,te;if(b(this))return te;for(var oe=0;oe<q;oe++)if(L[oe]===G)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,P){return x(b(O),P)}},13477:v=>{v.exports={}},19552:(v,C,f)=>{var g=f(97080);v.exports=g("document","documentElement")},11314:(v,C,f)=>{var g=f(56049),b=f(31982),x=f(45511);v.exports=!g&&!b(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(58310),k=Object,O=g("".split);v.exports=b(function(){return!k("z").propertyIsEnumerable(0)})?function(P){return x(P)=="String"?O(P,""):k(P)}:k},41524:(v,C,f)=>{var g=f(90406),b=f(43152),x=f(70716),k=g(Function.toString);b(x.inspectSource)||(x.inspectSource=function(O){return k(O)}),v.exports=x.inspectSource},44083:(v,C,f)=>{var g=f(57761),b=f(62447),x=f(92548),k=f(20410),O=f(18768),P=f(70716),N=f(4580),D=f(13477),L="Object already initialized",H=b.TypeError,J=b.WeakMap,q,X,G,te=function(z){return G(z)?X(z):q(z,{})},oe=function(z){return function(ne){var ie;if(!x(ne)||(ie=X(ne)).type!==z)throw H("Incompatible receiver, "+z+" required");return ie}};if(g||P.state){var R=P.state||(P.state=new J);R.get=R.get,R.has=R.has,R.set=R.set,q=function(z,ne){if(R.has(z))throw H(L);return ne.facade=z,R.set(z,ne),ne},X=function(z){return R.get(z)||{}},G=function(z){return R.has(z)}}else{var ee=N("state");D[ee]=!0,q=function(z,ne){if(O(z,ee))throw H(L);return ne.facade=z,k(z,ee,ne),ne},X=function(z){return O(z,ee)?z[ee]:{}},G=function(z){return O(z,ee)}}v.exports={set:q,get:X,has:G,enforce:te,getterFor:oe}},93053:(v,C,f)=>{var g=f(58310);v.exports=Array.isArray||function(x){return g(x)=="Array"}},43152:(v,C,f)=>{var g=f(51647),b=g.all;v.exports=g.IS_HTMLDDA?function(x){return typeof x=="function"||x===b}:function(x){return typeof x=="function"}},43455:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(43152),k=f(82059),O=f(97080),P=f(41524),N=function(){},D=[],L=O("Reflect","construct"),H=/^\s*(?:class|function)\b/,J=g(H.exec),q=!H.exec(N),X=function(oe){if(!x(oe))return!1;try{return L(N,D,oe),!0}catch{return!1}},G=function(oe){if(!x(oe))return!1;switch(k(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return q||!!J(H,P(oe))}catch{return!0}};G.sham=!0,v.exports=!L||b(function(){var te;return X(X.call)||!X(Object)||!X(function(){te=!0})||te})?G:X},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(L,H){var J=P[O(L)];return J==D?!0:J==N?!1:b(H)?g(H):!!H},O=k.normalize=function(L){return String(L).replace(x,".").toLowerCase()},P=k.data={},N=k.NATIVE="N",D=k.POLYFILL="P";v.exports=k},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,f)=>{var g=f(43152),b=f(51647),x=b.all;v.exports=b.IS_HTMLDDA?function(k){return typeof k=="object"?k!==null:g(k)||k===x}:function(k){return typeof k=="object"?k!==null:g(k)}},39839:v=>{v.exports=!0},28609:(v,C,f)=>{var g=f(97080),b=f(43152),x=f(15166),k=f(27237),O=Object;v.exports=k?function(P){return typeof P=="symbol"}:function(P){var N=g("Symbol");return b(N)&&x(N.prototype,O(P))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),P=function(){return this};v.exports=function(N,D,L,H){var J=D+" Iterator";return N.prototype=b(g,{next:x(+!H,L)}),k(N,J,!1,!0),O[J]=P,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),P=f(41709),N=f(90851),D=f(70738),L=f(98889),H=f(20410),J=f(27519),q=f(33538),X=f(94609),G=f(98488),te=k.PROPER,oe=k.CONFIGURABLE,R=G.IteratorPrototype,ee=G.BUGGY_SAFARI_ITERATORS,z=q("iterator"),ne="keys",ie="values",ae="entries",ue=function(){return this};v.exports=function(V,K,le,ge,me,ve,We){P(le,K,ge);var je=function(Tt){if(Tt===me&&Ot)return Ot;if(!ee&&Tt in lt)return lt[Tt];switch(Tt){case ne:return function(){return new le(this,Tt)};case ie:return function(){return new le(this,Tt)};case ae:return function(){return new le(this,Tt)}}return function(){return new le(this)}},Ke=K+" Iterator",Le=!1,lt=V.prototype,Rt=lt[z]||lt["@@iterator"]||me&<[me],Ot=!ee&&Rt||je(me),rr=K=="Array"&<.entries||Rt,Xe,Et,wt;if(rr&&(Xe=N(rr.call(new V)),Xe!==Object.prototype&&Xe.next&&(!x&&N(Xe)!==R&&(D?D(Xe,R):O(Xe[z])||J(Xe,z,ue)),L(Xe,Ke,!0,!0),x&&(X[Ke]=ue))),te&&me==ie&&Rt&&Rt.name!==ie&&(!x&&oe?H(lt,"name",ie):(Le=!0,Ot=function(){return b(Rt,this)})),me)if(Et={values:je(ie),keys:ve?Ot:je(ne),entries:je(ae)},We)for(wt in Et)(ee||Le||!(wt in lt))&&J(lt,wt,Et[wt]);else g({target:K,proto:!0,forced:ee||Le},Et);return(!x||We)&<[z]!==Ot&&J(lt,z,Ot,{name:me}),X[K]=Ot,Et}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),P=f(27519),N=f(33538),D=f(39839),L=N("iterator"),H=!1,J,q,X;[].keys&&(X=[].keys(),"next"in X?(q=O(O(X)),q!==Object.prototype&&(J=q)):H=!0);var G=!x(J)||g(function(){var te={};return J[L].call(te)!==te});G?J={}:D&&(J=k(J)),b(J[L])||P(J,L,function(){return this}),v.exports={IteratorPrototype:J,BUGGY_SAFARI_ITERATORS:H}},94609:v=>{v.exports={}},53387:(v,C,f)=>{var g=f(62567);v.exports=function(b){return g(b.length)}},99295:v=>{var C=Math.ceil,f=Math.floor;v.exports=Math.trunc||function(b){var x=+b;return(x>0?f:C)(x)}},73270:(v,C,f)=>{var g=f(35970),b=f(98911),x=f(11792),k=f(13477),O=f(19552),P=f(45511),N=f(4580),D=">",L="<",H="prototype",J="script",q=N("IE_PROTO"),X=function(){},G=function(z){return L+J+D+z+L+"/"+J+D},te=function(z){z.write(G("")),z.close();var ne=z.parentWindow.Object;return z=null,ne},oe=function(){var z=P("iframe"),ne="java"+J+":",ie;return z.style.display="none",O.appendChild(z),z.src=String(ne),ie=z.contentWindow.document,ie.open(),ie.write(G("document.F=Object")),ie.close(),ie.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):oe():te(R);for(var z=x.length;z--;)delete ee[H][x[z]];return ee()};k[q]=!0,v.exports=Object.create||function(ne,ie){var ae;return ne!==null?(X[H]=g(ne),ae=new X,X[H]=null,ae[q]=ne):ae=ee(),ie===void 0?ae:b.f(ae,ie)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),P=f(16619);C.f=g&&!b?Object.defineProperties:function(D,L){k(D);for(var H=O(L),J=P(L),q=J.length,X=0,G;q>X;)x.f(D,G=J[X++],H[G]);return D}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),P=TypeError,N=Object.defineProperty,D=Object.getOwnPropertyDescriptor,L="enumerable",H="configurable",J="writable";C.f=g?x?function(X,G,te){if(k(X),G=O(G),k(te),typeof X=="function"&&G==="prototype"&&"value"in te&&J in te&&!te[J]){var oe=D(X,G);oe&&oe[J]&&(X[G]=te.value,te={configurable:H in te?te[H]:oe[H],enumerable:L in te?te[L]:oe[L],writable:!1})}return N(X,G,te)}:N:function(X,G,te){if(k(X),G=O(G),k(te),b)try{return N(X,G,te)}catch{}if("get"in te||"set"in te)throw P("Accessors not supported");return"value"in te&&(X[G]=te.value),X}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),P=f(5135),N=f(18768),D=f(11314),L=Object.getOwnPropertyDescriptor;C.f=g?L:function(J,q){if(J=O(J),q=P(q),D)try{return L(J,q)}catch{}if(N(J,q))return k(!b(x.f,J,q),J[q])}},53515:(v,C,f)=>{var g=f(58310),b=f(88966),x=f(51203).f,k=f(67932),O=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],P=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(D){return O&&g(D)=="Window"?P(D):x(b(D))}},51203:(v,C,f)=>{var g=f(4541),b=f(11792),x=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(O){return g(O,x)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,f)=>{var g=f(18768),b=f(43152),x=f(53254),k=f(4580),O=f(74838),P=k("IE_PROTO"),N=Object,D=N.prototype;v.exports=O?N.getPrototypeOf:function(L){var H=x(L);if(g(H,P))return H[P];var J=H.constructor;return b(J)&&H instanceof J?J.prototype:H instanceof N?D:null}},15166:(v,C,f)=>{var g=f(90406);v.exports=g({}.isPrototypeOf)},4541:(v,C,f)=>{var g=f(90406),b=f(18768),x=f(88966),k=f(66322).indexOf,O=f(13477),P=g([].push);v.exports=function(N,D){var L=x(N),H=0,J=[],q;for(q in L)!b(O,q)&&b(L,q)&&P(J,q);for(;D.length>H;)b(L,q=D[H++])&&(~k(J,q)||P(J,q));return J}},16619:(v,C,f)=>{var g=f(4541),b=f(11792);v.exports=Object.keys||function(k){return g(k,b)}},16457:(v,C)=>{"use strict";var f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b=g&&!f.call({1:2},1);C.f=b?function(k){var O=g(this,k);return!!O&&O.enumerable}:f},70738:(v,C,f)=>{var g=f(54518),b=f(35970),x=f(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var k=!1,O={},P;try{P=g(Object.prototype,"__proto__","set"),P(O,[]),k=O instanceof Array}catch{}return function(D,L){return b(D),x(L),k?P(D,L):D.__proto__=L,D}}():void 0)},68399:(v,C,f)=>{"use strict";var g=f(48448),b=f(82059);v.exports=g?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,f)=>{var g=f(12461),b=f(43152),x=f(92548),k=TypeError;v.exports=function(O,P){var N,D;if(P==="string"&&b(N=O.toString)&&!x(D=g(N,O))||b(N=O.valueOf)&&!x(D=g(N,O))||P!=="string"&&b(N=O.toString)&&!x(D=g(N,O)))return D;throw k("Can't convert object to primitive value")}},47813:(v,C,f)=>{var g=f(97080),b=f(90406),x=f(51203),k=f(97620),O=f(35970),P=b([].concat);v.exports=g("Reflect","ownKeys")||function(D){var L=x.f(O(D)),H=k.f;return H?P(L,H(D)):L}},59921:v=>{v.exports={}},31251:(v,C,f)=>{var g=f(71365),b=TypeError;v.exports=function(x){if(g(x))throw b("Can't call method on "+x);return x}},98889:(v,C,f)=>{var g=f(48448),b=f(36133).f,x=f(20410),k=f(18768),O=f(68399),P=f(33538),N=P("toStringTag");v.exports=function(D,L,H,J){if(D){var q=H?D:D.prototype;k(q,N)||b(q,N,{configurable:!0,value:L}),J&&!g&&x(q,"toString",O)}}},4580:(v,C,f)=>{var g=f(95976),b=f(91248),x=g("keys");v.exports=function(k){return x[k]||(x[k]=b(k))}},70716:(v,C,f)=>{var g=f(62447),b=f(9267),x="__core-js_shared__",k=g[x]||b(x,{});v.exports=k},95976:(v,C,f)=>{var g=f(39839),b=f(70716);(v.exports=function(x,k){return b[x]||(b[x]=k!==void 0?k:{})})("versions",[]).push({version:"3.29.1",mode:g?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},18143:(v,C,f)=>{var g=f(90406),b=f(32041),x=f(46025),k=f(31251),O=g("".charAt),P=g("".charCodeAt),N=g("".slice),D=function(L){return function(H,J){var q=x(k(H)),X=b(J),G=q.length,te,oe;return X<0||X>=G?L?"":void 0:(te=P(q,X),te<55296||te>56319||X+1===G||(oe=P(q,X+1))<56320||oe>57343?L?O(q,X):te:L?N(q,X,X+2):(te-55296<<10)+(oe-56320)+65536)}};v.exports={codeAt:D(!1),charAt:D(!0)}},71775:(v,C,f)=>{var g=f(32438),b=f(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var x=Symbol();return!String(x)||!(Object(x)instanceof Symbol)||!Symbol.sham&&g&&g<41})},95679:(v,C,f)=>{var g=f(12461),b=f(97080),x=f(33538),k=f(27519);v.exports=function(){var O=b("Symbol"),P=O&&O.prototype,N=P&&P.valueOf,D=x("toPrimitive");P&&!P[D]&&k(P,D,function(L){return g(N,this)},{arity:1})}},82294:(v,C,f)=>{var g=f(71775);v.exports=g&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,f)=>{var g=f(32041),b=Math.max,x=Math.min;v.exports=function(k,O){var P=g(k);return P<0?b(P+O,0):x(P,O)}},88966:(v,C,f)=>{var g=f(38622),b=f(31251);v.exports=function(x){return g(b(x))}},32041:(v,C,f)=>{var g=f(99295);v.exports=function(b){var x=+b;return x!==x||x===0?0:g(x)}},62567:(v,C,f)=>{var g=f(32041),b=Math.min;v.exports=function(x){return x>0?b(g(x),9007199254740991):0}},53254:(v,C,f)=>{var g=f(31251),b=Object;v.exports=function(x){return b(g(x))}},37505:(v,C,f)=>{var g=f(12461),b=f(92548),x=f(28609),k=f(27529),O=f(96380),P=f(33538),N=TypeError,D=P("toPrimitive");v.exports=function(L,H){if(!b(L)||x(L))return L;var J=k(L,D),q;if(J){if(H===void 0&&(H="default"),q=g(J,L,H),!b(q)||x(q))return q;throw N("Can't convert object to primitive value")}return H===void 0&&(H="number"),O(L,H)}},5135:(v,C,f)=>{var g=f(37505),b=f(28609);v.exports=function(x){var k=g(x,"string");return b(k)?k:k+""}},48448:(v,C,f)=>{var g=f(33538),b=g("toStringTag"),x={};x[b]="z",v.exports=String(x)==="[object z]"},46025:(v,C,f)=>{var g=f(82059),b=String;v.exports=function(x){if(g(x)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(x)}},18342:v=>{var C=String;v.exports=function(f){try{return C(f)}catch{return"Object"}}},91248:(v,C,f)=>{var g=f(90406),b=0,x=Math.random(),k=g(1 .toString);v.exports=function(O){return"Symbol("+(O===void 0?"":O)+")_"+k(++b+x,36)}},27237:(v,C,f)=>{var g=f(71775);v.exports=g&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,f)=>{var g=f(56049),b=f(31982);v.exports=g&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,f)=>{var g=f(62447),b=f(43152),x=g.WeakMap;v.exports=b(x)&&/native code/.test(String(x))},64832:(v,C,f)=>{var g=f(59921),b=f(18768),x=f(39378),k=f(36133).f;v.exports=function(O){var P=g.Symbol||(g.Symbol={});b(P,O)||k(P,O,{value:x.f(O)})}},39378:(v,C,f)=>{var g=f(33538);C.f=g},33538:(v,C,f)=>{var g=f(62447),b=f(95976),x=f(18768),k=f(91248),O=f(71775),P=f(27237),N=g.Symbol,D=b("wks"),L=P?N.for||N:N&&N.withoutSetter||k;v.exports=function(H){return x(D,H)||(D[H]=O&&x(N,H)?N[H]:L("Symbol."+H)),D[H]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),P=f(53387),N=f(11452),D=f(53437),L=f(69573),H=f(36844),J=f(33538),q=f(32438),X=J("isConcatSpreadable"),G=q>=51||!b(function(){var R=[];return R[X]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[X];return ee!==void 0?!!ee:x(R)},oe=!G||!H("concat");g({target:"Array",proto:!0,arity:1,forced:oe},{concat:function(ee){var z=O(this),ne=L(z,0),ie=0,ae,ue,V,K,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?z:arguments[ae],te(le))for(K=P(le),N(ie+K),ue=0;ue<K;ue++,ie++)ue in le&&D(ne,ie,le[ue]);else N(ie+1),D(ne,ie++,le);return ne.length=ie,ne}})},17802:(v,C,f)=>{"use strict";var g=f(30080),b=f(93935).filter,x=f(36844),k=x("filter");g({target:"Array",proto:!0,forced:!k},{filter:function(P){return b(this,P,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,f)=>{"use strict";var g=f(30080),b=f(24782);g({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,f)=>{"use strict";var g=f(30080),b=f(57953),x=f(66322).indexOf,k=f(10454),O=b([].indexOf),P=!!O&&1/O([1],1,-0)<0,N=P||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(L){var H=arguments.length>1?arguments[1]:void 0;return P?O(this,L,H)||0:x(this,L,H)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,P=f(78107),N=f(10248),D=f(39839),L=f(56049),H="Array Iterator",J=k.set,q=k.getterFor(H);v.exports=P(Array,"Array",function(G,te){J(this,{type:H,target:g(G),index:0,kind:te})},function(){var G=q(this),te=G.target,oe=G.kind,R=G.index++;return!te||R>=te.length?(G.target=void 0,N(void 0,!0)):oe=="keys"?N(R,!1):oe=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var X=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!D&&L&&X.name!=="values")try{O(X,"name",{value:"values"})}catch{}},91667:()=>{},9754:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),P=f(31982),N=f(43152),D=f(28609),L=f(53160),H=f(82850),J=f(71775),q=String,X=b("JSON","stringify"),G=O(/./.exec),te=O("".charAt),oe=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),z=/[\uD800-\uDFFF]/g,ne=/^[\uD800-\uDBFF]$/,ie=/^[\uDC00-\uDFFF]$/,ae=!J||P(function(){var le=b("Symbol")();return X([le])!="[null]"||X({a:le})!="{}"||X(Object(le))!="{}"}),ue=P(function(){return X("\uDF06\uD834")!=='"\\udf06\\ud834"'||X("\uDEAD")!=='"\\udead"'}),V=function(le,ge){var me=L(arguments),ve=H(ge);if(!(!N(ve)&&(le===void 0||D(le))))return me[1]=function(We,je){if(N(ve)&&(je=k(ve,this,q(We),je)),!D(je))return je},x(X,null,me)},K=function(le,ge,me){var ve=te(me,ge-1),We=te(me,ge+1);return G(ne,le)&&!G(ie,We)||G(ie,le)&&!G(ne,ve)?"\\u"+ee(oe(le,0),16):le};X&&g({target:"JSON",stat:!0,arity:3,forced:ae||ue},{stringify:function(ge,me,ve){var We=L(arguments),je=x(ae?V:X,null,We);return ue&&typeof je=="string"?R(je,z,K):je}})},23870:(v,C,f)=>{var g=f(62447),b=f(98889);b(g.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(98911).f;g({target:"Object",stat:!0,forced:Object.defineProperties!==x,sham:!b},{defineProperties:x})},70829:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(36133).f;g({target:"Object",stat:!0,forced:Object.defineProperty!==x,sham:!b},{defineProperty:x})},51964:(v,C,f)=>{var g=f(30080),b=f(31982),x=f(88966),k=f(80016).f,O=f(56049),P=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:P,sham:!O},{getOwnPropertyDescriptor:function(D,L){return k(x(D),L)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),P=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(D){for(var L=k(D),H=O.f,J=x(L),q={},X=0,G,te;J.length>X;)te=H(L,G=J[X++]),te!==void 0&&P(q,G,te);return q}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),P=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:P},{getOwnPropertySymbols:function(D){var L=k.f;return L?L(O(D)):[]}})},38339:(v,C,f)=>{var g=f(30080),b=f(53254),x=f(16619),k=f(31982),O=k(function(){x(1)});g({target:"Object",stat:!0,forced:O},{keys:function(N){return x(b(N))}})},97829:()=>{},5708:()=>{},27626:(v,C,f)=>{"use strict";var g=f(18143).charAt,b=f(46025),x=f(44083),k=f(78107),O=f(10248),P="String Iterator",N=x.set,D=x.getterFor(P);k(String,"String",function(L){N(this,{type:P,string:b(L),index:0})},function(){var H=D(this),J=H.string,q=H.index,X;return q>=J.length?O(void 0,!0):(X=g(J,q),H.index+=X.length,O(X,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),P=f(56049),N=f(71775),D=f(31982),L=f(18768),H=f(15166),J=f(35970),q=f(88966),X=f(5135),G=f(46025),te=f(54686),oe=f(73270),R=f(16619),ee=f(51203),z=f(53515),ne=f(97620),ie=f(80016),ae=f(36133),ue=f(98911),V=f(16457),K=f(27519),le=f(37912),ge=f(95976),me=f(4580),ve=f(13477),We=f(91248),je=f(33538),Ke=f(39378),Le=f(64832),lt=f(95679),Rt=f(98889),Ot=f(44083),rr=f(93935).forEach,Xe=me("hidden"),Et="Symbol",wt="prototype",Tt=Ot.set,hr=Ot.getterFor(Et),De=Object[wt],St=b.Symbol,Ht=St&&St[wt],pt=b.TypeError,Ir=b.QObject,dr=ie.f,Wr=ae.f,Ri=z.f,Dr=V.f,pr=k([].push),gr=ge("symbols"),Jr=ge("op-symbols"),gt=ge("wks"),Dn=!Ir||!Ir[wt]||!Ir[wt].findChild,fi=P&&D(function(){return oe(Wr({},"a",{get:function(){return Wr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Ne){var Te=dr(De,Ce);Te&&delete De[Ce],Wr(Ze,Ce,Ne),Te&&Ze!==De&&Wr(De,Ce,Te)}:Wr,xn=function(Ze,Ce){var Ne=gr[Ze]=oe(Ht);return Tt(Ne,{type:Et,tag:Ze,description:Ce}),P||(Ne.description=Ce),Ne},wn=function(Ce,Ne,Te){Ce===De&&wn(Jr,Ne,Te),J(Ce);var $=X(Ne);return J(Te),L(gr,$)?(Te.enumerable?(L(Ce,Xe)&&Ce[Xe][$]&&(Ce[Xe][$]=!1),Te=oe(Te,{enumerable:te(0,!1)})):(L(Ce,Xe)||Wr(Ce,Xe,te(1,{})),Ce[Xe][$]=!0),fi(Ce,$,Te)):Wr(Ce,$,Te)},Nn=function(Ce,Ne){J(Ce);var Te=q(Ne),$=R(Te).concat(di(Te));return rr($,function(Z){(!P||x(Rn,Te,Z))&&wn(Ce,Z,Te[Z])}),Ce},hi=function(Ce,Ne){return Ne===void 0?oe(Ce):Nn(oe(Ce),Ne)},Rn=function(Ce){var Ne=X(Ce),Te=x(Dr,this,Ne);return this===De&&L(gr,Ne)&&!L(Jr,Ne)?!1:Te||!L(this,Ne)||!L(gr,Ne)||L(this,Xe)&&this[Xe][Ne]?Te:!0},$r=function(Ce,Ne){var Te=q(Ce),$=X(Ne);if(!(Te===De&&L(gr,$)&&!L(Jr,$))){var Z=dr(Te,$);return Z&&L(gr,$)&&!(L(Te,Xe)&&Te[Xe][$])&&(Z.enumerable=!0),Z}},Ln=function(Ce){var Ne=Ri(q(Ce)),Te=[];return rr(Ne,function($){!L(gr,$)&&!L(ve,$)&&pr(Te,$)}),Te},di=function(Ze){var Ce=Ze===De,Ne=Ri(Ce?Jr:q(Ze)),Te=[];return rr(Ne,function($){L(gr,$)&&(!Ce||L(De,$))&&pr(Te,gr[$])}),Te};N||(St=function(){if(H(Ht,this))throw pt("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:G(arguments[0]),Ne=We(Ce),Te=function($){this===De&&x(Te,Jr,$),L(this,Xe)&&L(this[Xe],Ne)&&(this[Xe][Ne]=!1),fi(this,Ne,te(1,$))};return P&&Dn&&fi(De,Ne,{configurable:!0,set:Te}),xn(Ne,Ce)},Ht=St[wt],K(Ht,"toString",function(){return hr(this).tag}),K(St,"withoutSetter",function(Ze){return xn(We(Ze),Ze)}),V.f=Rn,ae.f=wn,ue.f=Nn,ie.f=$r,ee.f=z.f=Ln,ne.f=di,Ke.f=function(Ze){return xn(je(Ze),Ze)},P&&(le(Ht,"description",{configurable:!0,get:function(){return hr(this).description}}),O||K(De,"propertyIsEnumerable",Rn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:St}),rr(R(gt),function(Ze){Le(Ze)}),g({target:Et,stat:!0,forced:!N},{useSetter:function(){Dn=!0},useSimple:function(){Dn=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!P},{create:hi,defineProperty:wn,defineProperties:Nn,getOwnPropertyDescriptor:$r}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Ln}),lt(),Rt(St,Et),ve[Xe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),P=f(82294),N=O("string-to-symbol-registry"),D=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{for:function(L){var H=k(L);if(x(N,H))return N[H];var J=b("Symbol")(H);return N[H]=J,D[J]=H,J}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(9754),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),P=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{keyFor:function(L){if(!x(L))throw TypeError(k(L)+" is not a symbol");if(b(N,L))return N[L]}})},47954:(v,C,f)=>{var g=f(64832);g("matchAll")},88725:(v,C,f)=>{var g=f(64832);g("match")},67703:(v,C,f)=>{var g=f(64832);g("replace")},2220:(v,C,f)=>{var g=f(64832);g("search")},48990:(v,C,f)=>{var g=f(64832);g("species")},50240:(v,C,f)=>{var g=f(64832);g("split")},99921:(v,C,f)=>{var g=f(64832),b=f(95679);g("toPrimitive"),b()},3502:(v,C,f)=>{var g=f(97080),b=f(64832),x=f(98889);b("toStringTag"),x(g("Symbol"),"Symbol")},80220:(v,C,f)=>{var g=f(64832);g("unscopables")},45987:(v,C,f)=>{var g=f(64832);g("asyncDispose")},42319:(v,C,f)=>{var g=f(64832);g("dispose")},58052:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(90406),k=b("Symbol"),O=k.keyFor,P=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(D){try{return O(P(D))!==void 0}catch{return!1}}})},90181:(v,C,f)=>{for(var g=f(30080),b=f(95976),x=f(97080),k=f(90406),O=f(28609),P=f(33538),N=x("Symbol"),D=N.isWellKnown,L=x("Object","getOwnPropertyNames"),H=k(N.prototype.valueOf),J=b("wks"),q=0,X=L(N),G=X.length;q<G;q++)try{var te=X[q];O(N[te])&&P(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(D&&D(R))return!0;try{for(var ee=H(R),z=0,ne=L(J),ie=ne.length;z<ie;z++)if(J[ne[z]]==ee)return!0}catch{}return!1}})},25129:(v,C,f)=>{var g=f(64832);g("matcher")},90397:(v,C,f)=>{var g=f(64832);g("metadataKey")},82793:(v,C,f)=>{var g=f(64832);g("metadata")},18097:(v,C,f)=>{var g=f(64832);g("observable")},52100:(v,C,f)=>{var g=f(64832);g("patternMatch")},99742:(v,C,f)=>{var g=f(64832);g("replaceAll")},48713:(v,C,f)=>{f(44390);var g=f(81595),b=f(62447),x=f(82059),k=f(20410),O=f(94609),P=f(33538),N=P("toStringTag");for(var D in g){var L=b[D],H=L&&L.prototype;H&&x(H)!==N&&k(H,N,D),O[D]=O.Array}},41544:(v,C,f)=>{var g=f(94537);v.exports=g},44928:(v,C,f)=>{var g=f(55794);v.exports=g},26087:(v,C,f)=>{f(48713);var g=f(82059),b=f(18768),x=f(15166),k=f(41544),O=Array.prototype,P={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var D=N.forEach;return N===O||x(O,N)&&D===O.forEach||b(P,g(N))?k:D}},11783:(v,C,f)=>{var g=f(85838);v.exports=g},88462:(v,C,f)=>{var g=f(95617);v.exports=g},83531:(v,C,f)=>{var g=f(11906);v.exports=g},19941:(v,C,f)=>{var g=f(59123);v.exports=g},25081:(v,C,f)=>{var g=f(63332);v.exports=g},22145:(v,C,f)=>{var g=f(83606);v.exports=g},93690:(v,C,f)=>{var g=f(90660);v.exports=g},8429:(v,C,f)=>{var g=f(49198);f(48713),v.exports=g},13099:(v,C,f)=>{var g=f(15413);f(48713),v.exports=g},44931:(v,C,f)=>{var g=f(4793);v.exports=g},81933:function(){(function(v){var C=function(f){var g={searchParams:"URLSearchParams"in v,iterable:"Symbol"in v&&"iterator"in Symbol,blob:"FileReader"in v&&"Blob"in v&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in v,arrayBuffer:"ArrayBuffer"in v};function b(V){return V&&DataView.prototype.isPrototypeOf(V)}if(g.arrayBuffer)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(V){return V&&x.indexOf(Object.prototype.toString.call(V))>-1};function O(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(V))throw new TypeError("Invalid character in header field name");return V.toLowerCase()}function P(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var K={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(K[Symbol.iterator]=function(){return K}),K}function D(V){this.map={},V instanceof D?V.forEach(function(K,le){this.append(le,K)},this):Array.isArray(V)?V.forEach(function(K){this.append(K[0],K[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(K){this.append(K,V[K])},this)}D.prototype.append=function(V,K){V=O(V),K=P(K);var le=this.map[V];this.map[V]=le?le+", "+K:K},D.prototype.delete=function(V){delete this.map[O(V)]},D.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},D.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},D.prototype.set=function(V,K){this.map[O(V)]=P(K)},D.prototype.forEach=function(V,K){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(K,this.map[le],le,this)},D.prototype.keys=function(){var V=[];return this.forEach(function(K,le){V.push(le)}),N(V)},D.prototype.values=function(){var V=[];return this.forEach(function(K){V.push(K)}),N(V)},D.prototype.entries=function(){var V=[];return this.forEach(function(K,le){V.push([le,K])}),N(V)},g.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function L(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function H(V){return new Promise(function(K,le){V.onload=function(){K(V.result)},V.onerror=function(){le(V.error)}})}function J(V){var K=new FileReader,le=H(K);return K.readAsArrayBuffer(V),le}function q(V){var K=new FileReader,le=H(K);return K.readAsText(V),le}function X(V){for(var K=new Uint8Array(V),le=new Array(K.length),ge=0;ge<K.length;ge++)le[ge]=String.fromCharCode(K[ge]);return le.join("")}function G(V){if(V.slice)return V.slice(0);var K=new Uint8Array(V.byteLength);return K.set(new Uint8Array(V)),K.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=G(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=G(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?L(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(J)}),this.text=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(X(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var oe=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var K=V.toUpperCase();return oe.indexOf(K)>-1?K:V}function ee(V,K){K=K||{};var le=K.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,K.headers||(this.headers=new D(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new D(K.headers)),this.method=R(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function z(V){var K=new FormData;return V.trim().split("&").forEach(function(le){if(le){var ge=le.split("="),me=ge.shift().replace(/\+/g," "),ve=ge.join("=").replace(/\+/g," ");K.append(decodeURIComponent(me),decodeURIComponent(ve))}}),K}function ne(V){var K=new D,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(ge){var me=ge.split(":"),ve=me.shift().trim();if(ve){var We=me.join(":").trim();K.append(ve,We)}}),K}te.call(ee.prototype);function ie(V,K){K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"OK",this.headers=new D(K.headers),this.url=K.url||"",this._initBody(V)}te.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},ie.error=function(){var V=new ie(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ie.redirect=function(V,K){if(ae.indexOf(K)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:K,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(K,le){this.message=K,this.name=le;var ge=Error(K);this.stack=ge.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ue(V,K){return new Promise(function(le,ge){var me=new ee(V,K);if(me.signal&&me.signal.aborted)return ge(new f.DOMException("Aborted","AbortError"));var ve=new XMLHttpRequest;function We(){ve.abort()}ve.onload=function(){var je={status:ve.status,statusText:ve.statusText,headers:ne(ve.getAllResponseHeaders()||"")};je.url="responseURL"in ve?ve.responseURL:je.headers.get("X-Request-URL");var Ke="response"in ve?ve.response:ve.responseText;le(new ie(Ke,je))},ve.onerror=function(){ge(new TypeError("Network request failed"))},ve.ontimeout=function(){ge(new TypeError("Network request failed"))},ve.onabort=function(){ge(new f.DOMException("Aborted","AbortError"))},ve.open(me.method,me.url,!0),me.credentials==="include"?ve.withCredentials=!0:me.credentials==="omit"&&(ve.withCredentials=!1),"responseType"in ve&&g.blob&&(ve.responseType="blob"),me.headers.forEach(function(je,Ke){ve.setRequestHeader(Ke,je)}),me.signal&&(me.signal.addEventListener("abort",We),ve.onreadystatechange=function(){ve.readyState===4&&me.signal.removeEventListener("abort",We)}),ve.send(typeof me._bodyInit>"u"?null:me._bodyInit)})}return ue.polyfill=!0,v.fetch||(v.fetch=ue,v.Headers=D,v.Request=ee,v.Response=ie),f.Headers=D,f.Request=ee,f.Response=ie,f.fetch=ue,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},17847:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>HI});var g={};f.r(g),f.d(g,{cookie:()=>Wx,header:()=>Vx,path:()=>Bx,query:()=>Fx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),P=f(10017),N=f(86351),D=f(86751),L=f(12953),H=f(55839),J=f(23422);function q(t){return q=typeof H=="function"&&typeof J=="symbol"?function(e){return typeof e}:function(e){return e&&typeof H=="function"&&e.constructor===H&&e!==H.prototype?"symbol":typeof e},q(t)}var X=f(47319);function G(t,e){if(q(t)!=="object"||t===null)return t;var r=t[X];if(r!==void 0){var n=r.call(t,e||"default");if(q(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function te(t){var e=G(t,"string");return q(e)==="symbol"?e:String(e)}function oe(t,e,r){return e=te(e),e in t?L(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t,e){var r=b(t);if(x){var n=x(t);e&&(n=k(n).call(n,function(i){return O(t,i).enumerable})),r.push.apply(r,n)}return r}function ee(t){for(var e=1;e<arguments.length;e++){var r,n,i=arguments[e]!=null?arguments[e]:{};e%2?P(r=R(Object(i),!0)).call(r,function(s){oe(t,s,i[s])}):N?D(t,N(i)):P(n=R(Object(i))).call(n,function(s){L(t,s,O(i,s))})}return t}var z=f(34961);function ne(t,e){if(t==null)return{};var r={},n=b(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(z(e).call(e,i)>=0)&&(r[i]=t[i]);return r}function ie(t,e){if(t==null)return{};var r=ne(t,e),n,i;if(x){var s=x(t);for(i=0;i<s.length;i++)n=s[i],!(z(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var ae=f(13546),ue=f.n(ae),V=f(51121),K=f(26179);/*!
|
|
11
|
+
*/C.parse=b,C.serialize=x;var f=Object.prototype.toString,g=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(D,L){if(typeof D!="string")throw new TypeError("argument str must be a string");for(var H={},J=L||{},q=J.decode||k,Z=0;Z<D.length;){var K=D.indexOf("=",Z);if(K===-1)break;var te=D.indexOf(";",Z);if(te===-1)te=D.length;else if(te<K){Z=D.lastIndexOf(";",K-1)+1;continue}var oe=D.slice(Z,K).trim();if(H[oe]===void 0){var R=D.slice(K+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),H[oe]=N(R,q)}Z=te+1}return H}function x(D,L,H){var J=H||{},q=J.encode||O;if(typeof q!="function")throw new TypeError("option encode is invalid");if(!g.test(D))throw new TypeError("argument name is invalid");var Z=q(L);if(Z&&!g.test(Z))throw new TypeError("argument val is invalid");var K=D+"="+Z;if(J.maxAge!=null){var te=J.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");K+="; Max-Age="+Math.floor(te)}if(J.domain){if(!g.test(J.domain))throw new TypeError("option domain is invalid");K+="; Domain="+J.domain}if(J.path){if(!g.test(J.path))throw new TypeError("option path is invalid");K+="; Path="+J.path}if(J.expires){var oe=J.expires;if(!P(oe)||isNaN(oe.valueOf()))throw new TypeError("option expires is invalid");K+="; Expires="+oe.toUTCString()}if(J.httpOnly&&(K+="; HttpOnly"),J.secure&&(K+="; Secure"),J.priority){var R=typeof J.priority=="string"?J.priority.toLowerCase():J.priority;switch(R){case"low":K+="; Priority=Low";break;case"medium":K+="; Priority=Medium";break;case"high":K+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(J.sameSite){var ee=typeof J.sameSite=="string"?J.sameSite.toLowerCase():J.sameSite;switch(ee){case!0:K+="; SameSite=Strict";break;case"lax":K+="; SameSite=Lax";break;case"strict":K+="; SameSite=Strict";break;case"none":K+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return K}function k(D){return D.indexOf("%")!==-1?decodeURIComponent(D):D}function O(D){return encodeURIComponent(D)}function P(D){return f.call(D)==="[object Date]"||D instanceof Date}function N(D,L){try{return L(D)}catch{return D}}},97529:(v,C,f)=>{var g=f(44928);v.exports=g},75342:(v,C,f)=>{var g=f(26087);v.exports=g},64218:(v,C,f)=>{var g=f(11783);v.exports=g},95050:(v,C,f)=>{var g=f(88462);v.exports=g},84779:(v,C,f)=>{var g=f(83531);v.exports=g},17190:(v,C,f)=>{var g=f(19941);v.exports=g},96589:(v,C,f)=>{var g=f(25081);v.exports=g},32276:(v,C,f)=>{var g=f(22145);v.exports=g},15064:(v,C,f)=>{var g=f(93690);v.exports=g},31986:(v,C,f)=>{var g=f(8429);f(42319),v.exports=g},69635:(v,C,f)=>{var g=f(13099);v.exports=g},3529:(v,C,f)=>{var g=f(44931);v.exports=g},85373:(v,C,f)=>{f(17802);var g=f(70291);v.exports=g("Array").filter},94537:(v,C,f)=>{f(64009);var g=f(70291);v.exports=g("Array").forEach},27794:(v,C,f)=>{f(32449);var g=f(70291);v.exports=g("Array").indexOf},55794:(v,C,f)=>{var g=f(15166),b=f(85373),x=Array.prototype;v.exports=function(k){var O=k.filter;return k===x||g(x,k)&&O===x.filter?b:O}},85838:(v,C,f)=>{var g=f(15166),b=f(27794),x=Array.prototype;v.exports=function(k){var O=k.indexOf;return k===x||g(x,k)&&O===x.indexOf?b:O}},95617:(v,C,f)=>{f(28135);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.defineProperties(O,P)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,P,N){return b.defineProperty(O,P,N)};b.defineProperty.sham&&(x.sham=!0)},59123:(v,C,f)=>{f(51964);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.getOwnPropertyDescriptor(O,P)};b.getOwnPropertyDescriptor.sham&&(x.sham=!0)},63332:(v,C,f)=>{f(723);var g=f(59921);v.exports=g.Object.getOwnPropertyDescriptors},83606:(v,C,f)=>{f(68030);var g=f(59921);v.exports=g.Object.getOwnPropertySymbols},90660:(v,C,f)=>{f(38339);var g=f(59921);v.exports=g.Object.keys},49198:(v,C,f)=>{f(69825),f(97829),f(68030),f(95353),f(63906),f(39542),f(47882),f(84911),f(88725),f(47954),f(67703),f(2220),f(48990),f(50240),f(99921),f(3502),f(80220),f(23870),f(5828),f(5708);var g=f(59921);v.exports=g.Symbol},15413:(v,C,f)=>{f(44390),f(97829),f(27626),f(84911);var g=f(39378);v.exports=g.f("iterator")},4793:(v,C,f)=>{f(91667),f(99921);var g=f(39378);v.exports=g.f("toPrimitive")},24018:(v,C,f)=>{v.exports=f(11226)},27411:(v,C,f)=>{v.exports=f(39743)},79155:(v,C,f)=>{v.exports=f(17018)},13375:(v,C,f)=>{v.exports=f(45057)},95442:(v,C,f)=>{v.exports=f(97947)},55334:(v,C,f)=>{v.exports=f(26452)},48261:(v,C,f)=>{v.exports=f(4477)},92864:(v,C,f)=>{v.exports=f(74013)},27923:(v,C,f)=>{v.exports=f(17685)},89225:(v,C,f)=>{v.exports=f(2371)},95281:(v,C,f)=>{v.exports=f(89061)},55468:(v,C,f)=>{v.exports=f(51553)},11226:(v,C,f)=>{var g=f(97529);v.exports=g},39743:(v,C,f)=>{var g=f(75342);v.exports=g},17018:(v,C,f)=>{var g=f(64218);v.exports=g},45057:(v,C,f)=>{var g=f(95050);v.exports=g},97947:(v,C,f)=>{var g=f(84779);v.exports=g},26452:(v,C,f)=>{var g=f(17190);v.exports=g},4477:(v,C,f)=>{var g=f(96589);v.exports=g},74013:(v,C,f)=>{var g=f(32276);v.exports=g},17685:(v,C,f)=>{var g=f(15064);v.exports=g},2371:(v,C,f)=>{var g=f(31986);f(45987),f(58052),f(90181),f(25129),f(90397),f(18097),f(82793),f(52100),f(99742),v.exports=g},89061:(v,C,f)=>{var g=f(69635);v.exports=g},51553:(v,C,f)=>{var g=f(3529);v.exports=g},81970:(v,C,f)=>{var g=f(43152),b=f(18342),x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not a function")}},72185:(v,C,f)=>{var g=f(43152),b=String,x=TypeError;v.exports=function(k){if(typeof k=="object"||g(k))return k;throw x("Can't set "+b(k)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,f)=>{var g=f(92548),b=String,x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not an object")}},24782:(v,C,f)=>{"use strict";var g=f(93935).forEach,b=f(10454),x=b("forEach");v.exports=x?[].forEach:function(O){return g(this,O,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,f)=>{var g=f(88966),b=f(13249),x=f(53387),k=function(O){return function(P,N,D){var L=g(P),H=x(L),J=b(D,H),q;if(O&&N!=N){for(;H>J;)if(q=L[J++],q!=q)return!0}else for(;H>J;J++)if((O||J in L)&&L[J]===N)return O||J||0;return!O&&-1}};v.exports={includes:k(!0),indexOf:k(!1)}},93935:(v,C,f)=>{var g=f(7416),b=f(90406),x=f(38622),k=f(53254),O=f(53387),P=f(69573),N=b([].push),D=function(L){var H=L==1,J=L==2,q=L==3,Z=L==4,K=L==6,te=L==7,oe=L==5||K;return function(R,ee,z,ne){for(var ie=k(R),ae=x(ie),ue=g(ee,z),V=O(ae),Y=0,le=ne||P,ge=H?le(R,V):J||te?le(R,0):void 0,me,ve;V>Y;Y++)if((oe||Y in ae)&&(me=ae[Y],ve=ue(me,Y,ie),L))if(H)ge[Y]=ve;else if(ve)switch(L){case 3:return!0;case 5:return me;case 6:return Y;case 2:N(ge,me)}else switch(L){case 4:return!1;case 7:N(ge,me)}return K?-1:q||Z?Z:ge}};v.exports={forEach:D(0),map:D(1),filter:D(2),some:D(3),every:D(4),find:D(5),findIndex:D(6),filterReject:D(7)}},36844:(v,C,f)=>{var g=f(31982),b=f(33538),x=f(32438),k=b("species");v.exports=function(O){return x>=51||!g(function(){var P=[],N=P.constructor={};return N[k]=function(){return{foo:1}},P[O](Boolean).foo!==1})}},10454:(v,C,f)=>{"use strict";var g=f(31982);v.exports=function(b,x){var k=[][b];return!!k&&g(function(){k.call(null,x||function(){return 1},1)})}},67932:(v,C,f)=>{var g=f(13249),b=f(53387),x=f(53437),k=Array,O=Math.max;v.exports=function(P,N,D){for(var L=b(P),H=g(N,L),J=g(D===void 0?L:D,L),q=k(O(J-H,0)),Z=0;H<J;H++,Z++)x(q,Z,P[H]);return q.length=Z,q}},53160:(v,C,f)=>{var g=f(90406);v.exports=g([].slice)},76562:(v,C,f)=>{var g=f(93053),b=f(43455),x=f(92548),k=f(33538),O=k("species"),P=Array;v.exports=function(N){var D;return g(N)&&(D=N.constructor,b(D)&&(D===P||g(D.prototype))?D=void 0:x(D)&&(D=D[O],D===null&&(D=void 0))),D===void 0?P:D}},69573:(v,C,f)=>{var g=f(76562);v.exports=function(b,x){return new(g(b))(x===0?0:x)}},58310:(v,C,f)=>{var g=f(90406),b=g({}.toString),x=g("".slice);v.exports=function(k){return x(b(k),8,-1)}},82059:(v,C,f)=>{var g=f(48448),b=f(43152),x=f(58310),k=f(33538),O=k("toStringTag"),P=Object,N=x(function(){return arguments}())=="Arguments",D=function(L,H){try{return L[H]}catch{}};v.exports=g?x:function(L){var H,J,q;return L===void 0?"Undefined":L===null?"Null":typeof(J=D(H=P(L),O))=="string"?J:N?x(H):(q=x(H))=="Object"&&b(H.callee)?"Arguments":q}},74838:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,f){return{value:C,done:f}}},20410:(v,C,f)=>{var g=f(56049),b=f(36133),x=f(54686);v.exports=g?function(k,O,P){return b.f(k,O,x(1,P))}:function(k,O,P){return k[O]=P,k}},54686:v=>{v.exports=function(C,f){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:f}}},53437:(v,C,f)=>{"use strict";var g=f(5135),b=f(36133),x=f(54686);v.exports=function(k,O,P){var N=g(O);N in k?b.f(k,N,x(0,P)):k[N]=P}},37912:(v,C,f)=>{var g=f(36133);v.exports=function(b,x,k){return g.f(b,x,k)}},27519:(v,C,f)=>{var g=f(20410);v.exports=function(b,x,k,O){return O&&O.enumerable?b[x]=k:g(b,x,k),b}},9267:(v,C,f)=>{var g=f(62447),b=Object.defineProperty;v.exports=function(x,k){try{b(g,x,{value:k,configurable:!0,writable:!0})}catch{g[x]=k}return k}},56049:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,f=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:f}},45511:(v,C,f)=>{var g=f(62447),b=f(92548),x=g.document,k=b(x)&&b(x.createElement);v.exports=function(O){return k?x.createElement(O):{}}},11452:v=>{var C=TypeError,f=9007199254740991;v.exports=function(g){if(g>f)throw C("Maximum allowed index exceeded");return g}},81595:v=>{v.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},90740:v=>{v.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},32438:(v,C,f)=>{var g=f(62447),b=f(90740),x=g.process,k=g.Deno,O=x&&x.versions||k&&k.version,P=O&&O.v8,N,D;P&&(N=P.split("."),D=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!D&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(D=+N[1]))),v.exports=D},70291:(v,C,f)=>{var g=f(59921);v.exports=function(b){return g[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,f)=>{"use strict";var g=f(62447),b=f(82768),x=f(57953),k=f(43152),O=f(80016).f,P=f(51585),N=f(59921),D=f(7416),L=f(20410),H=f(18768),J=function(q){var Z=function(K,te,oe){if(this instanceof Z){switch(arguments.length){case 0:return new q;case 1:return new q(K);case 2:return new q(K,te)}return new q(K,te,oe)}return b(q,this,arguments)};return Z.prototype=q.prototype,Z};v.exports=function(q,Z){var K=q.target,te=q.global,oe=q.stat,R=q.proto,ee=te?g:oe?g[K]:(g[K]||{}).prototype,z=te?N:N[K]||L(N,K,{})[K],ne=z.prototype,ie,ae,ue,V,Y,le,ge,me,ve;for(V in Z)ie=P(te?V:K+(oe?".":"#")+V,q.forced),ae=!ie&&ee&&H(ee,V),le=z[V],ae&&(q.dontCallGetSet?(ve=O(ee,V),ge=ve&&ve.value):ge=ee[V]),Y=ae&&ge?ge:Z[V],!(ae&&typeof le==typeof Y)&&(q.bind&&ae?me=D(Y,g):q.wrap&&ae?me=J(Y):R&&k(Y)?me=x(Y):me=Y,(q.sham||Y&&Y.sham||le&&le.sham)&&L(me,"sham",!0),L(z,V,me),R&&(ue=K+"Prototype",H(N,ue)||L(N,ue,{}),L(N[ue],V,Y),q.real&&ne&&(ie||!ne[V])&&L(ne,V,Y)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,P){return b(O),P===void 0?O:x?k(O,P):function(){return O.apply(P,arguments)}}},97966:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,f)=>{var g=f(97966),b=Function.prototype.call;v.exports=g?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,f)=>{var g=f(56049),b=f(18768),x=Function.prototype,k=g&&Object.getOwnPropertyDescriptor,O=b(x,"name"),P=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:P,CONFIGURABLE:N}},54518:(v,C,f)=>{var g=f(90406),b=f(81970);v.exports=function(x,k,O){try{return g(b(Object.getOwnPropertyDescriptor(x,k)[O]))}catch{}}},57953:(v,C,f)=>{var g=f(58310),b=f(90406);v.exports=function(x){if(g(x)==="Function")return b(x)}},90406:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.call,k=g&&b.bind.bind(x,x);v.exports=g?k:function(O){return function(){return x.apply(O,arguments)}}},97080:(v,C,f)=>{var g=f(59921),b=f(62447),x=f(43152),k=function(O){return x(O)?O:void 0};v.exports=function(O,P){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][P]||b[O]&&b[O][P]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),P=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var D=N.length,L=[],H=0;H<D;H++){var J=N[H];typeof J=="string"?P(L,J):(typeof J=="number"||k(J)=="Number"||k(J)=="String")&&P(L,O(J))}var q=L.length,Z=!0;return function(K,te){if(Z)return Z=!1,te;if(b(this))return te;for(var oe=0;oe<q;oe++)if(L[oe]===K)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,P){return x(b(O),P)}},13477:v=>{v.exports={}},19552:(v,C,f)=>{var g=f(97080);v.exports=g("document","documentElement")},11314:(v,C,f)=>{var g=f(56049),b=f(31982),x=f(45511);v.exports=!g&&!b(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(58310),k=Object,O=g("".split);v.exports=b(function(){return!k("z").propertyIsEnumerable(0)})?function(P){return x(P)=="String"?O(P,""):k(P)}:k},41524:(v,C,f)=>{var g=f(90406),b=f(43152),x=f(70716),k=g(Function.toString);b(x.inspectSource)||(x.inspectSource=function(O){return k(O)}),v.exports=x.inspectSource},44083:(v,C,f)=>{var g=f(57761),b=f(62447),x=f(92548),k=f(20410),O=f(18768),P=f(70716),N=f(4580),D=f(13477),L="Object already initialized",H=b.TypeError,J=b.WeakMap,q,Z,K,te=function(z){return K(z)?Z(z):q(z,{})},oe=function(z){return function(ne){var ie;if(!x(ne)||(ie=Z(ne)).type!==z)throw H("Incompatible receiver, "+z+" required");return ie}};if(g||P.state){var R=P.state||(P.state=new J);R.get=R.get,R.has=R.has,R.set=R.set,q=function(z,ne){if(R.has(z))throw H(L);return ne.facade=z,R.set(z,ne),ne},Z=function(z){return R.get(z)||{}},K=function(z){return R.has(z)}}else{var ee=N("state");D[ee]=!0,q=function(z,ne){if(O(z,ee))throw H(L);return ne.facade=z,k(z,ee,ne),ne},Z=function(z){return O(z,ee)?z[ee]:{}},K=function(z){return O(z,ee)}}v.exports={set:q,get:Z,has:K,enforce:te,getterFor:oe}},93053:(v,C,f)=>{var g=f(58310);v.exports=Array.isArray||function(x){return g(x)=="Array"}},43152:(v,C,f)=>{var g=f(51647),b=g.all;v.exports=g.IS_HTMLDDA?function(x){return typeof x=="function"||x===b}:function(x){return typeof x=="function"}},43455:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(43152),k=f(82059),O=f(97080),P=f(41524),N=function(){},D=[],L=O("Reflect","construct"),H=/^\s*(?:class|function)\b/,J=g(H.exec),q=!H.exec(N),Z=function(oe){if(!x(oe))return!1;try{return L(N,D,oe),!0}catch{return!1}},K=function(oe){if(!x(oe))return!1;switch(k(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return q||!!J(H,P(oe))}catch{return!0}};K.sham=!0,v.exports=!L||b(function(){var te;return Z(Z.call)||!Z(Object)||!Z(function(){te=!0})||te})?K:Z},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(L,H){var J=P[O(L)];return J==D?!0:J==N?!1:b(H)?g(H):!!H},O=k.normalize=function(L){return String(L).replace(x,".").toLowerCase()},P=k.data={},N=k.NATIVE="N",D=k.POLYFILL="P";v.exports=k},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,f)=>{var g=f(43152),b=f(51647),x=b.all;v.exports=b.IS_HTMLDDA?function(k){return typeof k=="object"?k!==null:g(k)||k===x}:function(k){return typeof k=="object"?k!==null:g(k)}},39839:v=>{v.exports=!0},28609:(v,C,f)=>{var g=f(97080),b=f(43152),x=f(15166),k=f(27237),O=Object;v.exports=k?function(P){return typeof P=="symbol"}:function(P){var N=g("Symbol");return b(N)&&x(N.prototype,O(P))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),P=function(){return this};v.exports=function(N,D,L,H){var J=D+" Iterator";return N.prototype=b(g,{next:x(+!H,L)}),k(N,J,!1,!0),O[J]=P,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),P=f(41709),N=f(90851),D=f(70738),L=f(98889),H=f(20410),J=f(27519),q=f(33538),Z=f(94609),K=f(98488),te=k.PROPER,oe=k.CONFIGURABLE,R=K.IteratorPrototype,ee=K.BUGGY_SAFARI_ITERATORS,z=q("iterator"),ne="keys",ie="values",ae="entries",ue=function(){return this};v.exports=function(V,Y,le,ge,me,ve,We){P(le,Y,ge);var je=function(Tt){if(Tt===me&&Ot)return Ot;if(!ee&&Tt in lt)return lt[Tt];switch(Tt){case ne:return function(){return new le(this,Tt)};case ie:return function(){return new le(this,Tt)};case ae:return function(){return new le(this,Tt)}}return function(){return new le(this)}},Ke=Y+" Iterator",Le=!1,lt=V.prototype,Rt=lt[z]||lt["@@iterator"]||me&<[me],Ot=!ee&&Rt||je(me),rr=Y=="Array"&<.entries||Rt,Qe,Et,wt;if(rr&&(Qe=N(rr.call(new V)),Qe!==Object.prototype&&Qe.next&&(!x&&N(Qe)!==R&&(D?D(Qe,R):O(Qe[z])||J(Qe,z,ue)),L(Qe,Ke,!0,!0),x&&(Z[Ke]=ue))),te&&me==ie&&Rt&&Rt.name!==ie&&(!x&&oe?H(lt,"name",ie):(Le=!0,Ot=function(){return b(Rt,this)})),me)if(Et={values:je(ie),keys:ve?Ot:je(ne),entries:je(ae)},We)for(wt in Et)(ee||Le||!(wt in lt))&&J(lt,wt,Et[wt]);else g({target:Y,proto:!0,forced:ee||Le},Et);return(!x||We)&<[z]!==Ot&&J(lt,z,Ot,{name:me}),Z[Y]=Ot,Et}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),P=f(27519),N=f(33538),D=f(39839),L=N("iterator"),H=!1,J,q,Z;[].keys&&(Z=[].keys(),"next"in Z?(q=O(O(Z)),q!==Object.prototype&&(J=q)):H=!0);var K=!x(J)||g(function(){var te={};return J[L].call(te)!==te});K?J={}:D&&(J=k(J)),b(J[L])||P(J,L,function(){return this}),v.exports={IteratorPrototype:J,BUGGY_SAFARI_ITERATORS:H}},94609:v=>{v.exports={}},53387:(v,C,f)=>{var g=f(62567);v.exports=function(b){return g(b.length)}},99295:v=>{var C=Math.ceil,f=Math.floor;v.exports=Math.trunc||function(b){var x=+b;return(x>0?f:C)(x)}},73270:(v,C,f)=>{var g=f(35970),b=f(98911),x=f(11792),k=f(13477),O=f(19552),P=f(45511),N=f(4580),D=">",L="<",H="prototype",J="script",q=N("IE_PROTO"),Z=function(){},K=function(z){return L+J+D+z+L+"/"+J+D},te=function(z){z.write(K("")),z.close();var ne=z.parentWindow.Object;return z=null,ne},oe=function(){var z=P("iframe"),ne="java"+J+":",ie;return z.style.display="none",O.appendChild(z),z.src=String(ne),ie=z.contentWindow.document,ie.open(),ie.write(K("document.F=Object")),ie.close(),ie.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):oe():te(R);for(var z=x.length;z--;)delete ee[H][x[z]];return ee()};k[q]=!0,v.exports=Object.create||function(ne,ie){var ae;return ne!==null?(Z[H]=g(ne),ae=new Z,Z[H]=null,ae[q]=ne):ae=ee(),ie===void 0?ae:b.f(ae,ie)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),P=f(16619);C.f=g&&!b?Object.defineProperties:function(D,L){k(D);for(var H=O(L),J=P(L),q=J.length,Z=0,K;q>Z;)x.f(D,K=J[Z++],H[K]);return D}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),P=TypeError,N=Object.defineProperty,D=Object.getOwnPropertyDescriptor,L="enumerable",H="configurable",J="writable";C.f=g?x?function(Z,K,te){if(k(Z),K=O(K),k(te),typeof Z=="function"&&K==="prototype"&&"value"in te&&J in te&&!te[J]){var oe=D(Z,K);oe&&oe[J]&&(Z[K]=te.value,te={configurable:H in te?te[H]:oe[H],enumerable:L in te?te[L]:oe[L],writable:!1})}return N(Z,K,te)}:N:function(Z,K,te){if(k(Z),K=O(K),k(te),b)try{return N(Z,K,te)}catch{}if("get"in te||"set"in te)throw P("Accessors not supported");return"value"in te&&(Z[K]=te.value),Z}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),P=f(5135),N=f(18768),D=f(11314),L=Object.getOwnPropertyDescriptor;C.f=g?L:function(J,q){if(J=O(J),q=P(q),D)try{return L(J,q)}catch{}if(N(J,q))return k(!b(x.f,J,q),J[q])}},53515:(v,C,f)=>{var g=f(58310),b=f(88966),x=f(51203).f,k=f(67932),O=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],P=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(D){return O&&g(D)=="Window"?P(D):x(b(D))}},51203:(v,C,f)=>{var g=f(4541),b=f(11792),x=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(O){return g(O,x)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,f)=>{var g=f(18768),b=f(43152),x=f(53254),k=f(4580),O=f(74838),P=k("IE_PROTO"),N=Object,D=N.prototype;v.exports=O?N.getPrototypeOf:function(L){var H=x(L);if(g(H,P))return H[P];var J=H.constructor;return b(J)&&H instanceof J?J.prototype:H instanceof N?D:null}},15166:(v,C,f)=>{var g=f(90406);v.exports=g({}.isPrototypeOf)},4541:(v,C,f)=>{var g=f(90406),b=f(18768),x=f(88966),k=f(66322).indexOf,O=f(13477),P=g([].push);v.exports=function(N,D){var L=x(N),H=0,J=[],q;for(q in L)!b(O,q)&&b(L,q)&&P(J,q);for(;D.length>H;)b(L,q=D[H++])&&(~k(J,q)||P(J,q));return J}},16619:(v,C,f)=>{var g=f(4541),b=f(11792);v.exports=Object.keys||function(k){return g(k,b)}},16457:(v,C)=>{"use strict";var f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b=g&&!f.call({1:2},1);C.f=b?function(k){var O=g(this,k);return!!O&&O.enumerable}:f},70738:(v,C,f)=>{var g=f(54518),b=f(35970),x=f(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var k=!1,O={},P;try{P=g(Object.prototype,"__proto__","set"),P(O,[]),k=O instanceof Array}catch{}return function(D,L){return b(D),x(L),k?P(D,L):D.__proto__=L,D}}():void 0)},68399:(v,C,f)=>{"use strict";var g=f(48448),b=f(82059);v.exports=g?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,f)=>{var g=f(12461),b=f(43152),x=f(92548),k=TypeError;v.exports=function(O,P){var N,D;if(P==="string"&&b(N=O.toString)&&!x(D=g(N,O))||b(N=O.valueOf)&&!x(D=g(N,O))||P!=="string"&&b(N=O.toString)&&!x(D=g(N,O)))return D;throw k("Can't convert object to primitive value")}},47813:(v,C,f)=>{var g=f(97080),b=f(90406),x=f(51203),k=f(97620),O=f(35970),P=b([].concat);v.exports=g("Reflect","ownKeys")||function(D){var L=x.f(O(D)),H=k.f;return H?P(L,H(D)):L}},59921:v=>{v.exports={}},31251:(v,C,f)=>{var g=f(71365),b=TypeError;v.exports=function(x){if(g(x))throw b("Can't call method on "+x);return x}},98889:(v,C,f)=>{var g=f(48448),b=f(36133).f,x=f(20410),k=f(18768),O=f(68399),P=f(33538),N=P("toStringTag");v.exports=function(D,L,H,J){if(D){var q=H?D:D.prototype;k(q,N)||b(q,N,{configurable:!0,value:L}),J&&!g&&x(q,"toString",O)}}},4580:(v,C,f)=>{var g=f(95976),b=f(91248),x=g("keys");v.exports=function(k){return x[k]||(x[k]=b(k))}},70716:(v,C,f)=>{var g=f(62447),b=f(9267),x="__core-js_shared__",k=g[x]||b(x,{});v.exports=k},95976:(v,C,f)=>{var g=f(39839),b=f(70716);(v.exports=function(x,k){return b[x]||(b[x]=k!==void 0?k:{})})("versions",[]).push({version:"3.29.1",mode:g?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},18143:(v,C,f)=>{var g=f(90406),b=f(32041),x=f(46025),k=f(31251),O=g("".charAt),P=g("".charCodeAt),N=g("".slice),D=function(L){return function(H,J){var q=x(k(H)),Z=b(J),K=q.length,te,oe;return Z<0||Z>=K?L?"":void 0:(te=P(q,Z),te<55296||te>56319||Z+1===K||(oe=P(q,Z+1))<56320||oe>57343?L?O(q,Z):te:L?N(q,Z,Z+2):(te-55296<<10)+(oe-56320)+65536)}};v.exports={codeAt:D(!1),charAt:D(!0)}},71775:(v,C,f)=>{var g=f(32438),b=f(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var x=Symbol();return!String(x)||!(Object(x)instanceof Symbol)||!Symbol.sham&&g&&g<41})},95679:(v,C,f)=>{var g=f(12461),b=f(97080),x=f(33538),k=f(27519);v.exports=function(){var O=b("Symbol"),P=O&&O.prototype,N=P&&P.valueOf,D=x("toPrimitive");P&&!P[D]&&k(P,D,function(L){return g(N,this)},{arity:1})}},82294:(v,C,f)=>{var g=f(71775);v.exports=g&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,f)=>{var g=f(32041),b=Math.max,x=Math.min;v.exports=function(k,O){var P=g(k);return P<0?b(P+O,0):x(P,O)}},88966:(v,C,f)=>{var g=f(38622),b=f(31251);v.exports=function(x){return g(b(x))}},32041:(v,C,f)=>{var g=f(99295);v.exports=function(b){var x=+b;return x!==x||x===0?0:g(x)}},62567:(v,C,f)=>{var g=f(32041),b=Math.min;v.exports=function(x){return x>0?b(g(x),9007199254740991):0}},53254:(v,C,f)=>{var g=f(31251),b=Object;v.exports=function(x){return b(g(x))}},37505:(v,C,f)=>{var g=f(12461),b=f(92548),x=f(28609),k=f(27529),O=f(96380),P=f(33538),N=TypeError,D=P("toPrimitive");v.exports=function(L,H){if(!b(L)||x(L))return L;var J=k(L,D),q;if(J){if(H===void 0&&(H="default"),q=g(J,L,H),!b(q)||x(q))return q;throw N("Can't convert object to primitive value")}return H===void 0&&(H="number"),O(L,H)}},5135:(v,C,f)=>{var g=f(37505),b=f(28609);v.exports=function(x){var k=g(x,"string");return b(k)?k:k+""}},48448:(v,C,f)=>{var g=f(33538),b=g("toStringTag"),x={};x[b]="z",v.exports=String(x)==="[object z]"},46025:(v,C,f)=>{var g=f(82059),b=String;v.exports=function(x){if(g(x)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(x)}},18342:v=>{var C=String;v.exports=function(f){try{return C(f)}catch{return"Object"}}},91248:(v,C,f)=>{var g=f(90406),b=0,x=Math.random(),k=g(1 .toString);v.exports=function(O){return"Symbol("+(O===void 0?"":O)+")_"+k(++b+x,36)}},27237:(v,C,f)=>{var g=f(71775);v.exports=g&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,f)=>{var g=f(56049),b=f(31982);v.exports=g&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,f)=>{var g=f(62447),b=f(43152),x=g.WeakMap;v.exports=b(x)&&/native code/.test(String(x))},64832:(v,C,f)=>{var g=f(59921),b=f(18768),x=f(39378),k=f(36133).f;v.exports=function(O){var P=g.Symbol||(g.Symbol={});b(P,O)||k(P,O,{value:x.f(O)})}},39378:(v,C,f)=>{var g=f(33538);C.f=g},33538:(v,C,f)=>{var g=f(62447),b=f(95976),x=f(18768),k=f(91248),O=f(71775),P=f(27237),N=g.Symbol,D=b("wks"),L=P?N.for||N:N&&N.withoutSetter||k;v.exports=function(H){return x(D,H)||(D[H]=O&&x(N,H)?N[H]:L("Symbol."+H)),D[H]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),P=f(53387),N=f(11452),D=f(53437),L=f(69573),H=f(36844),J=f(33538),q=f(32438),Z=J("isConcatSpreadable"),K=q>=51||!b(function(){var R=[];return R[Z]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[Z];return ee!==void 0?!!ee:x(R)},oe=!K||!H("concat");g({target:"Array",proto:!0,arity:1,forced:oe},{concat:function(ee){var z=O(this),ne=L(z,0),ie=0,ae,ue,V,Y,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?z:arguments[ae],te(le))for(Y=P(le),N(ie+Y),ue=0;ue<Y;ue++,ie++)ue in le&&D(ne,ie,le[ue]);else N(ie+1),D(ne,ie++,le);return ne.length=ie,ne}})},17802:(v,C,f)=>{"use strict";var g=f(30080),b=f(93935).filter,x=f(36844),k=x("filter");g({target:"Array",proto:!0,forced:!k},{filter:function(P){return b(this,P,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,f)=>{"use strict";var g=f(30080),b=f(24782);g({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,f)=>{"use strict";var g=f(30080),b=f(57953),x=f(66322).indexOf,k=f(10454),O=b([].indexOf),P=!!O&&1/O([1],1,-0)<0,N=P||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(L){var H=arguments.length>1?arguments[1]:void 0;return P?O(this,L,H)||0:x(this,L,H)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,P=f(78107),N=f(10248),D=f(39839),L=f(56049),H="Array Iterator",J=k.set,q=k.getterFor(H);v.exports=P(Array,"Array",function(K,te){J(this,{type:H,target:g(K),index:0,kind:te})},function(){var K=q(this),te=K.target,oe=K.kind,R=K.index++;return!te||R>=te.length?(K.target=void 0,N(void 0,!0)):oe=="keys"?N(R,!1):oe=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var Z=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!D&&L&&Z.name!=="values")try{O(Z,"name",{value:"values"})}catch{}},91667:()=>{},39306:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),P=f(31982),N=f(43152),D=f(28609),L=f(53160),H=f(82850),J=f(71775),q=String,Z=b("JSON","stringify"),K=O(/./.exec),te=O("".charAt),oe=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),z=/[\uD800-\uDFFF]/g,ne=/^[\uD800-\uDBFF]$/,ie=/^[\uDC00-\uDFFF]$/,ae=!J||P(function(){var le=b("Symbol")();return Z([le])!="[null]"||Z({a:le})!="{}"||Z(Object(le))!="{}"}),ue=P(function(){return Z("\uDF06\uD834")!=='"\\udf06\\ud834"'||Z("\uDEAD")!=='"\\udead"'}),V=function(le,ge){var me=L(arguments),ve=H(ge);if(!(!N(ve)&&(le===void 0||D(le))))return me[1]=function(We,je){if(N(ve)&&(je=k(ve,this,q(We),je)),!D(je))return je},x(Z,null,me)},Y=function(le,ge,me){var ve=te(me,ge-1),We=te(me,ge+1);return K(ne,le)&&!K(ie,We)||K(ie,le)&&!K(ne,ve)?"\\u"+ee(oe(le,0),16):le};Z&&g({target:"JSON",stat:!0,arity:3,forced:ae||ue},{stringify:function(ge,me,ve){var We=L(arguments),je=x(ae?V:Z,null,We);return ue&&typeof je=="string"?R(je,z,Y):je}})},23870:(v,C,f)=>{var g=f(62447),b=f(98889);b(g.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(98911).f;g({target:"Object",stat:!0,forced:Object.defineProperties!==x,sham:!b},{defineProperties:x})},70829:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(36133).f;g({target:"Object",stat:!0,forced:Object.defineProperty!==x,sham:!b},{defineProperty:x})},51964:(v,C,f)=>{var g=f(30080),b=f(31982),x=f(88966),k=f(80016).f,O=f(56049),P=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:P,sham:!O},{getOwnPropertyDescriptor:function(D,L){return k(x(D),L)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),P=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(D){for(var L=k(D),H=O.f,J=x(L),q={},Z=0,K,te;J.length>Z;)te=H(L,K=J[Z++]),te!==void 0&&P(q,K,te);return q}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),P=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:P},{getOwnPropertySymbols:function(D){var L=k.f;return L?L(O(D)):[]}})},38339:(v,C,f)=>{var g=f(30080),b=f(53254),x=f(16619),k=f(31982),O=k(function(){x(1)});g({target:"Object",stat:!0,forced:O},{keys:function(N){return x(b(N))}})},97829:()=>{},5708:()=>{},27626:(v,C,f)=>{"use strict";var g=f(18143).charAt,b=f(46025),x=f(44083),k=f(78107),O=f(10248),P="String Iterator",N=x.set,D=x.getterFor(P);k(String,"String",function(L){N(this,{type:P,string:b(L),index:0})},function(){var H=D(this),J=H.string,q=H.index,Z;return q>=J.length?O(void 0,!0):(Z=g(J,q),H.index+=Z.length,O(Z,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),P=f(56049),N=f(71775),D=f(31982),L=f(18768),H=f(15166),J=f(35970),q=f(88966),Z=f(5135),K=f(46025),te=f(54686),oe=f(73270),R=f(16619),ee=f(51203),z=f(53515),ne=f(97620),ie=f(80016),ae=f(36133),ue=f(98911),V=f(16457),Y=f(27519),le=f(37912),ge=f(95976),me=f(4580),ve=f(13477),We=f(91248),je=f(33538),Ke=f(39378),Le=f(64832),lt=f(95679),Rt=f(98889),Ot=f(44083),rr=f(93935).forEach,Qe=me("hidden"),Et="Symbol",wt="prototype",Tt=Ot.set,hr=Ot.getterFor(Et),De=Object[wt],St=b.Symbol,zt=St&&St[wt],pt=b.TypeError,Ir=b.QObject,dr=ie.f,Wr=ae.f,Ri=z.f,Dr=V.f,pr=k([].push),gr=ge("symbols"),Jr=ge("op-symbols"),gt=ge("wks"),Dn=!Ir||!Ir[wt]||!Ir[wt].findChild,fi=P&&D(function(){return oe(Wr({},"a",{get:function(){return Wr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Ne){var Te=dr(De,Ce);Te&&delete De[Ce],Wr(Ze,Ce,Ne),Te&&Ze!==De&&Wr(De,Ce,Te)}:Wr,xn=function(Ze,Ce){var Ne=gr[Ze]=oe(zt);return Tt(Ne,{type:Et,tag:Ze,description:Ce}),P||(Ne.description=Ce),Ne},wn=function(Ce,Ne,Te){Ce===De&&wn(Jr,Ne,Te),J(Ce);var $=Z(Ne);return J(Te),L(gr,$)?(Te.enumerable?(L(Ce,Qe)&&Ce[Qe][$]&&(Ce[Qe][$]=!1),Te=oe(Te,{enumerable:te(0,!1)})):(L(Ce,Qe)||Wr(Ce,Qe,te(1,{})),Ce[Qe][$]=!0),fi(Ce,$,Te)):Wr(Ce,$,Te)},Nn=function(Ce,Ne){J(Ce);var Te=q(Ne),$=R(Te).concat(di(Te));return rr($,function(_){(!P||x(Rn,Te,_))&&wn(Ce,_,Te[_])}),Ce},hi=function(Ce,Ne){return Ne===void 0?oe(Ce):Nn(oe(Ce),Ne)},Rn=function(Ce){var Ne=Z(Ce),Te=x(Dr,this,Ne);return this===De&&L(gr,Ne)&&!L(Jr,Ne)?!1:Te||!L(this,Ne)||!L(gr,Ne)||L(this,Qe)&&this[Qe][Ne]?Te:!0},$r=function(Ce,Ne){var Te=q(Ce),$=Z(Ne);if(!(Te===De&&L(gr,$)&&!L(Jr,$))){var _=dr(Te,$);return _&&L(gr,$)&&!(L(Te,Qe)&&Te[Qe][$])&&(_.enumerable=!0),_}},Ln=function(Ce){var Ne=Ri(q(Ce)),Te=[];return rr(Ne,function($){!L(gr,$)&&!L(ve,$)&&pr(Te,$)}),Te},di=function(Ze){var Ce=Ze===De,Ne=Ri(Ce?Jr:q(Ze)),Te=[];return rr(Ne,function($){L(gr,$)&&(!Ce||L(De,$))&&pr(Te,gr[$])}),Te};N||(St=function(){if(H(zt,this))throw pt("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:K(arguments[0]),Ne=We(Ce),Te=function($){this===De&&x(Te,Jr,$),L(this,Qe)&&L(this[Qe],Ne)&&(this[Qe][Ne]=!1),fi(this,Ne,te(1,$))};return P&&Dn&&fi(De,Ne,{configurable:!0,set:Te}),xn(Ne,Ce)},zt=St[wt],Y(zt,"toString",function(){return hr(this).tag}),Y(St,"withoutSetter",function(Ze){return xn(We(Ze),Ze)}),V.f=Rn,ae.f=wn,ue.f=Nn,ie.f=$r,ee.f=z.f=Ln,ne.f=di,Ke.f=function(Ze){return xn(je(Ze),Ze)},P&&(le(zt,"description",{configurable:!0,get:function(){return hr(this).description}}),O||Y(De,"propertyIsEnumerable",Rn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:St}),rr(R(gt),function(Ze){Le(Ze)}),g({target:Et,stat:!0,forced:!N},{useSetter:function(){Dn=!0},useSimple:function(){Dn=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!P},{create:hi,defineProperty:wn,defineProperties:Nn,getOwnPropertyDescriptor:$r}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Ln}),lt(),Rt(St,Et),ve[Qe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),P=f(82294),N=O("string-to-symbol-registry"),D=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{for:function(L){var H=k(L);if(x(N,H))return N[H];var J=b("Symbol")(H);return N[H]=J,D[J]=H,J}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(39306),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),P=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{keyFor:function(L){if(!x(L))throw TypeError(k(L)+" is not a symbol");if(b(N,L))return N[L]}})},47954:(v,C,f)=>{var g=f(64832);g("matchAll")},88725:(v,C,f)=>{var g=f(64832);g("match")},67703:(v,C,f)=>{var g=f(64832);g("replace")},2220:(v,C,f)=>{var g=f(64832);g("search")},48990:(v,C,f)=>{var g=f(64832);g("species")},50240:(v,C,f)=>{var g=f(64832);g("split")},99921:(v,C,f)=>{var g=f(64832),b=f(95679);g("toPrimitive"),b()},3502:(v,C,f)=>{var g=f(97080),b=f(64832),x=f(98889);b("toStringTag"),x(g("Symbol"),"Symbol")},80220:(v,C,f)=>{var g=f(64832);g("unscopables")},45987:(v,C,f)=>{var g=f(64832);g("asyncDispose")},42319:(v,C,f)=>{var g=f(64832);g("dispose")},58052:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(90406),k=b("Symbol"),O=k.keyFor,P=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(D){try{return O(P(D))!==void 0}catch{return!1}}})},90181:(v,C,f)=>{for(var g=f(30080),b=f(95976),x=f(97080),k=f(90406),O=f(28609),P=f(33538),N=x("Symbol"),D=N.isWellKnown,L=x("Object","getOwnPropertyNames"),H=k(N.prototype.valueOf),J=b("wks"),q=0,Z=L(N),K=Z.length;q<K;q++)try{var te=Z[q];O(N[te])&&P(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(D&&D(R))return!0;try{for(var ee=H(R),z=0,ne=L(J),ie=ne.length;z<ie;z++)if(J[ne[z]]==ee)return!0}catch{}return!1}})},25129:(v,C,f)=>{var g=f(64832);g("matcher")},90397:(v,C,f)=>{var g=f(64832);g("metadataKey")},82793:(v,C,f)=>{var g=f(64832);g("metadata")},18097:(v,C,f)=>{var g=f(64832);g("observable")},52100:(v,C,f)=>{var g=f(64832);g("patternMatch")},99742:(v,C,f)=>{var g=f(64832);g("replaceAll")},48713:(v,C,f)=>{f(44390);var g=f(81595),b=f(62447),x=f(82059),k=f(20410),O=f(94609),P=f(33538),N=P("toStringTag");for(var D in g){var L=b[D],H=L&&L.prototype;H&&x(H)!==N&&k(H,N,D),O[D]=O.Array}},41544:(v,C,f)=>{var g=f(94537);v.exports=g},44928:(v,C,f)=>{var g=f(55794);v.exports=g},26087:(v,C,f)=>{f(48713);var g=f(82059),b=f(18768),x=f(15166),k=f(41544),O=Array.prototype,P={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var D=N.forEach;return N===O||x(O,N)&&D===O.forEach||b(P,g(N))?k:D}},11783:(v,C,f)=>{var g=f(85838);v.exports=g},88462:(v,C,f)=>{var g=f(95617);v.exports=g},83531:(v,C,f)=>{var g=f(11906);v.exports=g},19941:(v,C,f)=>{var g=f(59123);v.exports=g},25081:(v,C,f)=>{var g=f(63332);v.exports=g},22145:(v,C,f)=>{var g=f(83606);v.exports=g},93690:(v,C,f)=>{var g=f(90660);v.exports=g},8429:(v,C,f)=>{var g=f(49198);f(48713),v.exports=g},13099:(v,C,f)=>{var g=f(15413);f(48713),v.exports=g},44931:(v,C,f)=>{var g=f(4793);v.exports=g},81933:function(){(function(v){var C=function(f){var g={searchParams:"URLSearchParams"in v,iterable:"Symbol"in v&&"iterator"in Symbol,blob:"FileReader"in v&&"Blob"in v&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in v,arrayBuffer:"ArrayBuffer"in v};function b(V){return V&&DataView.prototype.isPrototypeOf(V)}if(g.arrayBuffer)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(V){return V&&x.indexOf(Object.prototype.toString.call(V))>-1};function O(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(V))throw new TypeError("Invalid character in header field name");return V.toLowerCase()}function P(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var Y={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(Y[Symbol.iterator]=function(){return Y}),Y}function D(V){this.map={},V instanceof D?V.forEach(function(Y,le){this.append(le,Y)},this):Array.isArray(V)?V.forEach(function(Y){this.append(Y[0],Y[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(Y){this.append(Y,V[Y])},this)}D.prototype.append=function(V,Y){V=O(V),Y=P(Y);var le=this.map[V];this.map[V]=le?le+", "+Y:Y},D.prototype.delete=function(V){delete this.map[O(V)]},D.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},D.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},D.prototype.set=function(V,Y){this.map[O(V)]=P(Y)},D.prototype.forEach=function(V,Y){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(Y,this.map[le],le,this)},D.prototype.keys=function(){var V=[];return this.forEach(function(Y,le){V.push(le)}),N(V)},D.prototype.values=function(){var V=[];return this.forEach(function(Y){V.push(Y)}),N(V)},D.prototype.entries=function(){var V=[];return this.forEach(function(Y,le){V.push([le,Y])}),N(V)},g.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function L(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function H(V){return new Promise(function(Y,le){V.onload=function(){Y(V.result)},V.onerror=function(){le(V.error)}})}function J(V){var Y=new FileReader,le=H(Y);return Y.readAsArrayBuffer(V),le}function q(V){var Y=new FileReader,le=H(Y);return Y.readAsText(V),le}function Z(V){for(var Y=new Uint8Array(V),le=new Array(Y.length),ge=0;ge<Y.length;ge++)le[ge]=String.fromCharCode(Y[ge]);return le.join("")}function K(V){if(V.slice)return V.slice(0);var Y=new Uint8Array(V.byteLength);return Y.set(new Uint8Array(V)),Y.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=K(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=K(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?L(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(J)}),this.text=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Z(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var oe=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var Y=V.toUpperCase();return oe.indexOf(Y)>-1?Y:V}function ee(V,Y){Y=Y||{};var le=Y.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,Y.headers||(this.headers=new D(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=Y.credentials||this.credentials||"same-origin",(Y.headers||!this.headers)&&(this.headers=new D(Y.headers)),this.method=R(Y.method||this.method||"GET"),this.mode=Y.mode||this.mode||null,this.signal=Y.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function z(V){var Y=new FormData;return V.trim().split("&").forEach(function(le){if(le){var ge=le.split("="),me=ge.shift().replace(/\+/g," "),ve=ge.join("=").replace(/\+/g," ");Y.append(decodeURIComponent(me),decodeURIComponent(ve))}}),Y}function ne(V){var Y=new D,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(ge){var me=ge.split(":"),ve=me.shift().trim();if(ve){var We=me.join(":").trim();Y.append(ve,We)}}),Y}te.call(ee.prototype);function ie(V,Y){Y||(Y={}),this.type="default",this.status=Y.status===void 0?200:Y.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in Y?Y.statusText:"OK",this.headers=new D(Y.headers),this.url=Y.url||"",this._initBody(V)}te.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},ie.error=function(){var V=new ie(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ie.redirect=function(V,Y){if(ae.indexOf(Y)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:Y,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(Y,le){this.message=Y,this.name=le;var ge=Error(Y);this.stack=ge.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ue(V,Y){return new Promise(function(le,ge){var me=new ee(V,Y);if(me.signal&&me.signal.aborted)return ge(new f.DOMException("Aborted","AbortError"));var ve=new XMLHttpRequest;function We(){ve.abort()}ve.onload=function(){var je={status:ve.status,statusText:ve.statusText,headers:ne(ve.getAllResponseHeaders()||"")};je.url="responseURL"in ve?ve.responseURL:je.headers.get("X-Request-URL");var Ke="response"in ve?ve.response:ve.responseText;le(new ie(Ke,je))},ve.onerror=function(){ge(new TypeError("Network request failed"))},ve.ontimeout=function(){ge(new TypeError("Network request failed"))},ve.onabort=function(){ge(new f.DOMException("Aborted","AbortError"))},ve.open(me.method,me.url,!0),me.credentials==="include"?ve.withCredentials=!0:me.credentials==="omit"&&(ve.withCredentials=!1),"responseType"in ve&&g.blob&&(ve.responseType="blob"),me.headers.forEach(function(je,Ke){ve.setRequestHeader(Ke,je)}),me.signal&&(me.signal.addEventListener("abort",We),ve.onreadystatechange=function(){ve.readyState===4&&me.signal.removeEventListener("abort",We)}),ve.send(typeof me._bodyInit>"u"?null:me._bodyInit)})}return ue.polyfill=!0,v.fetch||(v.fetch=ue,v.Headers=D,v.Request=ee,v.Response=ie),f.Headers=D,f.Request=ee,f.Response=ie,f.fetch=ue,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},45192:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>UI});var g={};f.r(g),f.d(g,{cookie:()=>Hx,header:()=>$x,path:()=>jx,query:()=>Vx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),P=f(10017),N=f(86351),D=f(86751),L=f(12953),H=f(55839),J=f(23422);function q(r){return q=typeof H=="function"&&typeof J=="symbol"?function(e){return typeof e}:function(e){return e&&typeof H=="function"&&e.constructor===H&&e!==H.prototype?"symbol":typeof e},q(r)}var Z=f(47319);function K(r,e){if(q(r)!=="object"||r===null)return r;var t=r[Z];if(t!==void 0){var n=t.call(r,e||"default");if(q(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function te(r){var e=K(r,"string");return q(e)==="symbol"?e:String(e)}function oe(r,e,t){return e=te(e),e in r?L(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function R(r,e){var t=b(r);if(x){var n=x(r);e&&(n=k(n).call(n,function(i){return O(r,i).enumerable})),t.push.apply(t,n)}return t}function ee(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?P(t=R(Object(i),!0)).call(t,function(s){oe(r,s,i[s])}):N?D(r,N(i)):P(n=R(Object(i))).call(n,function(s){L(r,s,O(i,s))})}return r}var z=f(34961);function ne(r,e){if(r==null)return{};var t={},n=b(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(z(e).call(e,i)>=0)&&(t[i]=r[i]);return t}function ie(r,e){if(r==null)return{};var t=ne(r,e),n,i;if(x){var s=x(r);for(i=0;i<s.length;i++)n=s[i],!(z(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}var ae=f(13546),ue=f.n(ae),V=f(51121),Y=f(26179);/*!
|
|
12
12
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
13
13
|
*
|
|
14
14
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
15
15
|
* Released under the MIT License.
|
|
16
|
-
*/function le(
|
|
16
|
+
*/function le(r){return Object.prototype.toString.call(r)==="[object Object]"}function ge(r){var e,t;return le(r)===!1?!1:(e=r.constructor,e===void 0?!0:(t=e.prototype,!(le(t)===!1||t.hasOwnProperty("isPrototypeOf")===!1)))}var me=f(81933),ve=f(67905),We=f.n(ve);/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function je(r){return typeof r>"u"||r===null}function Ke(r){return typeof r=="object"&&r!==null}function Le(r){return Array.isArray(r)?r:je(r)?[]:[r]}function lt(r,e){var t,n,i,s;if(e)for(s=Object.keys(e),t=0,n=s.length;t<n;t+=1)i=s[t],r[i]=e[i];return r}function Rt(r,e){var t="",n;for(n=0;n<e;n+=1)t+=r;return t}function Ot(r){return r===0&&Number.NEGATIVE_INFINITY===1/r}var rr=je,Qe=Ke,Et=Le,wt=Rt,Tt=Ot,hr=lt,De={isNothing:rr,isObject:Qe,toArray:Et,repeat:wt,isNegativeZero:Tt,extend:hr};function St(r,e){var t="",n=r.reason||"(unknown reason)";return r.mark?(r.mark.name&&(t+='in "'+r.mark.name+'" '),t+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!e&&r.mark.snippet&&(t+=`
|
|
17
17
|
|
|
18
|
-
`+
|
|
19
|
-
`+a;for(c=Ir(
|
|
18
|
+
`+r.mark.snippet),n+" "+t):n}function zt(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=St(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}zt.prototype=Object.create(Error.prototype),zt.prototype.constructor=zt,zt.prototype.toString=function(e){return this.name+": "+St(this,e)};var pt=zt;function Ir(r,e,t,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),t-n>a&&(o=" ...",t=n+a-o.length),{str:s+r.slice(e,t).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function dr(r,e){return De.repeat(" ",e-r.length)+r}function Wr(r,e){if(e=Object.create(e||null),!r.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var t=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=t.exec(r.buffer);)i.push(s.index),n.push(s.index+s[0].length),r.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",l,c,u=Math.min(r.line+e.linesAfter,i.length).toString().length,h=e.maxLength-(e.indent+u+3);for(l=1;l<=e.linesBefore&&!(o-l<0);l++)c=Ir(r.buffer,n[o-l],i[o-l],r.position-(n[o]-n[o-l]),h),a=De.repeat(" ",e.indent)+dr((r.line-l+1).toString(),u)+" | "+c.str+`
|
|
19
|
+
`+a;for(c=Ir(r.buffer,n[o],i[o],r.position,h),a+=De.repeat(" ",e.indent)+dr((r.line+1).toString(),u)+" | "+c.str+`
|
|
20
20
|
`,a+=De.repeat("-",e.indent+u+3+c.pos)+`^
|
|
21
|
-
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Ir(
|
|
22
|
-
`;return a.replace(/\n$/,"")}var Ri=Wr,Dr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],pr=["scalar","sequence","mapping"];function gr(
|
|
23
|
-
\r`;function
|
|
24
|
-
`:
|
|
25
|
-
`,e-1))}function
|
|
26
|
-
`,s?1+l:l):i===
|
|
27
|
-
`);break}for(n?gi(h)?(c=!0,
|
|
28
|
-
`,s?1+l:l)):c?(c=!1,
|
|
29
|
-
`,l+1)):l===0?s&&(
|
|
30
|
-
`,l):
|
|
31
|
-
`,s?1+l:l),s=!0,o=!0,l=0,r
|
|
32
|
-
`),
|
|
33
|
-
`,n),i===-1?(o=
|
|
34
|
-
`&&(s+=
|
|
35
|
-
`+De.repeat(" ",
|
|
36
|
-
`,i=n&&(
|
|
37
|
-
`||
|
|
38
|
-
`),s=i?"+":n?"":"-";return
|
|
39
|
-
`}function
|
|
40
|
-
`?
|
|
41
|
-
`);return c=c!==-1?c:
|
|
42
|
-
`||
|
|
43
|
-
`:"")+
|
|
44
|
-
`+
|
|
45
|
-
`,
|
|
46
|
-
`+
|
|
47
|
-
`:""}var Q1=J1,X1={dump:Q1};function ic(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var Z1=gt,_1=wn,q1=$r,ex=Fn,tx=Li,rx=Ql,nx=hh.load,ix=hh.loadAll,sx=X1.dump,ox=pt,ax={binary:Go,float:Ms,map:Rn,null:Ce,pairs:Xf,set:Zf,timestamp:Fi,bool:Z,int:zt,merge:ji,omap:Qf,seq:hi,str:Nn},lx=ic("safeLoad","load"),cx=ic("safeLoadAll","loadAll"),ux=ic("safeDump","dump"),fx={Type:Z1,Schema:_1,FAILSAFE_SCHEMA:q1,JSON_SCHEMA:ex,CORE_SCHEMA:tx,DEFAULT_SCHEMA:rx,load:nx,loadAll:ix,dump:sx,YAMLException:ox,types:ax,safeLoad:lx,safeLoadAll:cx,safeDump:ux};const hx=fx,dx=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Dh,Blob:qo,File:Nh}=dx,px=t=>":/?#[]@!$&'()*+,;=".indexOf(t)>-1,gx=t=>/^[a-z0-9\-._~]+$/i.test(t);function Ki(t){let{escape:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return typeof t=="number"&&(t=t.toString()),typeof t!="string"||!t.length||!e?t:r?JSON.parse(t):[...t].map(n=>{if(gx(n)||px(n)&&e==="unsafe")return n;const i=new TextEncoder;return Array.from(i.encode(n)).map(o=>`0${o.toString(16).toUpperCase()}`.slice(-2)).map(o=>`%${o}`).join("")}).join("")}function sc(t){const{value:e}=t;return Array.isArray(e)?mx(t):typeof e=="object"?vx(t):yx(t)}function mx(t){let{key:e,value:r,style:n,explode:i,escape:s}=t;const o=a=>Ki(a,{escape:s});if(n==="simple")return r.map(a=>o(a)).join(",");if(n==="label")return`.${r.map(a=>o(a)).join(".")}`;if(n==="matrix")return r.map(a=>o(a)).reduce((a,l)=>!a||i?`${a||""};${e}=${l}`:`${a},${l}`,"");if(n==="form"){const a=i?`&${e}=`:",";return r.map(l=>o(l)).join(a)}if(n==="spaceDelimited"){const a=i?`${e}=`:"";return r.map(l=>o(l)).join(` ${a}`)}if(n==="pipeDelimited"){const a=i?`${e}=`:"";return r.map(l=>o(l)).join(`|${a}`)}}function vx(t){let{key:e,value:r,style:n,explode:i,escape:s}=t;const o=l=>Ki(l,{escape:s}),a=Object.keys(r);if(n==="simple")return a.reduce((l,c)=>{const u=o(r[c]),h=i?"=":",";return`${l?`${l},`:""}${c}${h}${u}`},"");if(n==="label")return a.reduce((l,c)=>{const u=o(r[c]),h=i?"=":".";return`${l?`${l}.`:"."}${c}${h}${u}`},"");if(n==="matrix"&&i)return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l};`:";"}${c}=${u}`},"");if(n==="matrix")return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l},`:`;${e}=`}${c},${u}`},"");if(n==="form")return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l}${i?"&":","}`:""}${c}${i?"=":","}${u}`},"")}function yx(t){let{key:e,value:r,style:n,escape:i}=t;const s=o=>Ki(o,{escape:i});if(n==="simple")return s(r);if(n==="label")return`.${s(r)}`;if(n==="matrix")return`;${e}=${s(r)}`;if(n==="form")return s(r);if(n==="deepObject")return s(r,{},!0)}const bx=(t,e)=>{e.body=t},oc={serializeRes:kx,mergeInQueryOrForm:jh};async function xx(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof t=="object"&&(e=t,t=e.url),e.headers=e.headers||{},oc.mergeInQueryOrForm(e),e.headers&&Object.keys(e.headers).forEach(i=>{const s=e.headers[i];typeof s=="string"&&(e.headers[i]=s.replace(/\n+/g," "))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);const r=e.headers["content-type"]||e.headers["Content-Type"];/multipart\/form-data/i.test(r)&&e.body instanceof Dh&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await oc.serializeRes(n,t,e),e.responseInterceptor&&(n=await e.responseInterceptor(n)||n)}catch(i){if(!n)throw i;const s=new Error(n.statusText||`response status is ${n.status}`);throw s.status=n.status,s.statusCode=n.status,s.responseError=i,s}if(!n.ok){const i=new Error(n.statusText||`response status is ${n.status}`);throw i.status=n.status,i.statusCode=n.status,i.response=n,i}return n}const wx=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(t)};function Sx(t,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(t):hx.load(t)}function kx(t,e){let{loadSpec:r=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n={ok:t.ok,url:t.url||e,status:t.status,statusText:t.statusText,headers:Cx(t.headers)},i=n.headers["content-type"],s=r||wx(i);return(s?t.text:t.blob||t.buffer).call(t).then(a=>{if(n.text=a,n.data=a,s)try{const l=Sx(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function Ax(t){return t.includes(", ")?t.split(", "):t}function Cx(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return typeof t.entries!="function"?{}:Array.from(t.entries()).reduce((e,r)=>{let[n,i]=r;return e[n]=Ax(i),e},{})}function ac(t,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(t&&typeof t=="object"&&typeof t.uri=="string"):typeof Nh<"u"&&t instanceof Nh||typeof qo<"u"&&t instanceof qo||ArrayBuffer.isView(t)?!0:t!==null&&typeof t=="object"&&typeof t.pipe=="function"}function Rh(t,e){return Array.isArray(t)&&t.some(r=>ac(r,e))}const Ox={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Ex={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Lh(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,a=typeof e=="object"&&!Array.isArray(e)?e.value:e,l=r?u=>u.toString():u=>encodeURIComponent(u),c=l(t);if(typeof a>"u"&&i)return[[c,""]];if(ac(a)||Rh(a))return[[c,a]];if(s)return Bh(t,a,r,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:h,allowReserved:d}=o;return Bh(t,a,r,{style:u,explode:h,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof a=="string"?a:JSON.stringify(a);return[[c,l(u)]]}return[[c,l(a.toString())]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)&&a.every(u=>typeof u!="object")?[[c,a.map(l).join(",")]]:[[c,l(JSON.stringify(a))]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)?n==="multi"?[[c,a.map(l)]]:[[c,a.map(l).join(Ex[n||"csv"])]]:[[c,""]]}function Bh(t,e,r,n){const i=n.style||"form",s=typeof n.explode>"u"?i==="form":n.explode,o=r?!1:n&&n.allowReserved?"unsafe":"reserved",a=c=>Ki(c,{escape:o}),l=r?c=>c:c=>Ki(c,{escape:o});return typeof e!="object"?[[l(t),a(e)]]:Array.isArray(e)?s?[[l(t),e.map(a)]]:[[l(t),e.map(a).join(Ox[i])]]:i==="deepObject"?Object.keys(e).map(c=>[l(`${t}[${c}]`),a(e[c])]):s?Object.keys(e).map(c=>[l(c),a(e[c])]):[[l(t),Object.keys(e).map(c=>[`${l(c)},${a(e[c])}`]).join(",")]]}function Tx(t){return Object.entries(t).reduce((e,r)=>{let[n,i]=r;for(const[s,o]of Lh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new qo([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new qo([o]);e.append(s,a)}else e.append(s,o);return e},new Dh)}function Fh(t){const e=Object.keys(t).reduce((r,n)=>{for(const[i,s]of Lh(n,t[n]))r[i]=s;return r},{});return We().stringify(e,{encode:!1,indices:!1})||""}function jh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{url:e="",query:r,form:n}=t,i=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const l=o.filter(c=>c).join("&");return l?`?${l}`:""};if(n){const s=Object.keys(n).some(a=>{const{value:l}=n[a];return ac(l)||Rh(l)}),o=t.headers["content-type"]||t.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Tx(t.form);bx(a,t)}else t.body=Fh(n);delete t.form}if(r){const[s,o]=e.split("?");let a="";if(o){const c=We().parse(o);Object.keys(r).forEach(h=>delete c[h]),a=We().stringify(c,{encode:!0})}const l=i(a,Fh(r));t.url=s+l,delete t.query}return t}function KI(t,e,r){return r=r||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),oc.mergeInQueryOrForm(n),n=e(n),r(t(n)))}function Px(t,e){function r(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack;for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];[this.message]=i,e&&e.apply(this,i)}return r.prototype=new Error,r.prototype.name=t,r.prototype.constructor=r,r}const Mx={body:Ix,header:Nx,query:Lx,path:Rx,formData:Dx};function Ix(t){let{req:e,value:r}=t;e.body=r}function Dx(t){let{req:e,value:r,parameter:n}=t;(r||n.allowEmptyValue)&&(e.form=e.form||{},e.form[n.name]={value:r,allowEmptyValue:n.allowEmptyValue,collectionFormat:n.collectionFormat})}function Nx(t){let{req:e,parameter:r,value:n}=t;e.headers=e.headers||{},typeof n<"u"&&(e.headers[r.name]=n)}function Rx(t){let{req:e,value:r,parameter:n}=t;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(r))}function Lx(t){let{req:e,value:r,parameter:n}=t;if(e.query=e.query||{},r===!1&&n.type==="boolean"&&(r="false"),r===0&&["number","integer"].indexOf(n.type)>-1&&(r="0"),r)e.query[n.name]={collectionFormat:n.collectionFormat,value:r};else if(n.allowEmptyValue&&r!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}function ea(t,e){return e.includes("application/json")?typeof t=="string"?t:JSON.stringify(t):t.toString()}function Bx(t){let{req:e,value:r,parameter:n}=t;const{name:i,style:s,explode:o,content:a}=n;if(a){const c=Object.keys(a)[0];e.url=e.url.split(`{${i}}`).join(Ki(ea(r,c),{escape:!0}));return}const l=sc({key:n.name,value:r,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Fx(t){let{req:e,value:r,parameter:n}=t;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=ea(r,i);if(s)e.query[n.name]=s;else if(n.allowEmptyValue&&r!==void 0){const o=n.name;e.query[o]=e.query[o]||{},e.query[o].allowEmptyValue=!0}return}if(r===!1&&(r="false"),r===0&&(r="0"),r){const{style:i,explode:s,allowReserved:o}=n;e.query[n.name]={value:r,serializationOption:{style:i,explode:s,allowReserved:o}}}else if(n.allowEmptyValue&&r!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}const jx=["accept","authorization","content-type"];function Vx(t){let{req:e,parameter:r,value:n}=t;if(e.headers=e.headers||{},!(jx.indexOf(r.name.toLowerCase())>-1)){if(r.content){const i=Object.keys(r.content)[0];e.headers[r.name]=ea(n,i);return}typeof n<"u"&&(e.headers[r.name]=sc({key:r.name,value:n,style:r.style||"simple",explode:typeof r.explode>"u"?!1:r.explode,escape:!1}))}}function Wx(t){let{req:e,parameter:r,value:n}=t;e.headers=e.headers||{};const i=typeof n;if(r.content){const s=Object.keys(r.content)[0];e.headers.Cookie=`${r.name}=${ea(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&r.explode?"":`${r.name}=`;e.headers.Cookie=s+sc({key:r.name,value:n,escape:!1,style:r.style||"form",explode:typeof r.explode>"u"?!1:r.explode})}}const $x=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Hx}=$x,Vh=Hx;function zx(t,e){const{operation:r,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=t;let{requestContentType:a}=t;e=Ux({request:e,securities:i,operation:r,spec:s});const l=r.requestBody||{},c=Object.keys(l.content||{}),u=a&&c.indexOf(a)>-1;if(n||o){if(a&&u)e.headers["Content-Type"]=a;else if(!a){const h=c[0];h&&(e.headers["Content-Type"]=h,a=h)}}else a&&u&&(e.headers["Content-Type"]=a);if(!t.responseContentType&&r.responses){const h=Object.entries(r.responses).filter(d=>{let[p,m]=d;const y=parseInt(p,10);return y>=200&&y<300&&ge(m.content)}).reduce((d,p)=>{let[,m]=p;return d.concat(Object.keys(m.content))},[]);h.length>0&&(e.headers.accept=h.join(", "))}if(n)if(a){if(c.indexOf(a)>-1)if(a==="application/x-www-form-urlencoded"||a==="multipart/form-data")if(typeof n=="object"){const h=(l.content[a]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:h[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function Ux(t){let{request:e,securities:r={},operation:n={},spec:i}=t;const s=ee({},e),{authorized:o={}}=r,a=n.security||i.security||[],l=o&&!!Object.keys(o).length,c=ue()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(r).length||!l||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(u=>{Object.keys(u).forEach(h=>{const d=o[h],p=c[h];if(!d)return;const m=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=m),p.in==="header"&&(s.headers[p.name]=m),p.in==="cookie"&&(s.cookies[p.name]=m);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const w=m.username||"",A=m.password||"",T=Vh(`${w}:${A}`);s.headers.Authorization=`Basic ${T}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${m}`)}else if(y==="oauth2"||y==="openIdConnect"){const w=d.token||{},A=p["x-tokenName"]||"access_token",T=w[A];let E=w.token_type;(!E||E.toLowerCase()==="bearer")&&(E="Bearer"),s.headers.Authorization=`${E} ${T}`}}})}),s)}function Gx(t,e){const{spec:r,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=t;if(e=Kx({request:e,securities:i,operation:n,spec:r}),e.body||e.form||a)s?e.headers["Content-Type"]=s:Array.isArray(n.consumes)?[e.headers["Content-Type"]]=n.consumes:Array.isArray(r.consumes)?[e.headers["Content-Type"]]=r.consumes:n.parameters&&n.parameters.filter(l=>l.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(l=>l.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const l=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,c=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(l||c)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function Kx(t){let{request:e,securities:r={},operation:n={},spec:i}=t;const s=ee({},e),{authorized:o={},specSecurity:a=[]}=r,l=n.security||a,c=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(r).length||!c||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(h=>{Object.keys(h).forEach(d=>{const p=o[d];if(!p)return;const{token:m}=p,y=p.value||p,w=u[d],{type:A}=w,T=w["x-tokenName"]||"access_token",E=m&&m[T];let B=m&&m.token_type;if(p)if(A==="apiKey"){const I=w.in==="query"?"query":"headers";s[I]=s[I]||{},s[I][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const I=y.username||"",W=y.password||"";y.base64=Vh(`${I}:${W}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&E&&(B=!B||B.toLowerCase()==="bearer"?"Bearer":B,s.headers.authorization=`${B} ${E}`)})}),s)}function Wh(t,e){return`${e.toLowerCase()}-${t}`}function Yx(t,e,r){if(!t||typeof t!="object"||!t.paths||typeof t.paths!="object")return null;const{paths:n}=t;for(const i in n)for(const s in n[i]){if(s.toUpperCase()==="PARAMETERS")continue;const o=n[i][s];if(!o||typeof o!="object")continue;const a={spec:t,pathName:i,method:s.toUpperCase(),operation:o},l=e(a);if(r&&l)return a}}function Jx(t,e){return Yx(t,e,!0)||null}const $h=t=>t.replace(/\W/gi,"_");function Qx(t,e){let{v2OperationIdCompatibilityMode:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(r){let n=`${e.toLowerCase()}_${t}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return n=n||`${t.substring(1)}_${e}`,n.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${e.toLowerCase()}${$h(t)}`}function Xx(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{v2OperationIdCompatibilityMode:n}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return!t||typeof t!="object"?null:(t.operationId||"").replace(/\s/g,"").length?$h(t.operationId):Qx(e,r,{v2OperationIdCompatibilityMode:n})}function Zx(t,e){return!t||!t.paths?null:Jx(t,r=>{let{pathName:n,method:i,operation:s}=r;if(!s||typeof s!="object")return!1;const o=s.operationId,a=Xx(s,n,i),l=Wh(n,i);return[a,l,o].some(c=>c&&c===e)})}const JI=t=>{try{const{swagger:e}=t;return e==="2.0"}catch{return!1}},_x=t=>{try{const{openapi:e}=t;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},qx=t=>{try{const{openapi:e}=t;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},Hh=t=>_x(t)||qx(t),ew=["http","fetch","spec","operationId","pathName","method","parameters","securities"],zh=t=>Array.isArray(t)?t:[],tw=Px("OperationNotFoundError",function(e,r,n){this.originalError=n,Object.assign(this,r||{})}),rw=(t,e)=>e.filter(r=>r.name===t),nw=t=>{const e={};t.forEach(n=>{e[n.in]||(e[n.in]={}),e[n.in][n.name]=n});const r=[];return Object.keys(e).forEach(n=>{Object.keys(e[n]).forEach(i=>{r.push(e[n][i])})}),r},iw={buildRequest:ow};function sw(t){let{http:e,fetch:r,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=t,c=ie(t,ew);const u=e||r||xx;s&&o&&!i&&(i=Wh(s,o));const h=iw.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(ge(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function ow(t){const{spec:e,operationId:r,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:a,userFetch:l,server:c,serverVariables:u,http:h,signal:d}=t;let{parameters:p,parameterBuilders:m}=t;const y=Hh(e);m||(y?m=g:m=Mx);let A={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(A.signal=d),s&&(A.requestInterceptor=s),o&&(A.responseInterceptor=o),l&&(A.userFetch=l);const T=Zx(e,r);if(!T)throw new tw(`Operation ${r} not found`);const{operation:E={},method:B,pathName:I}=T;if(A.url+=aw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:I,method:B}),!r)return delete A.cookies,A;A.url+=I,A.method=`${B}`.toUpperCase(),p=p||{};const W=e.paths[I]||{};n&&(A.headers.accept=n);const F=nw([].concat(zh(E.parameters)).concat(zh(W.parameters)));F.forEach(j=>{const U=m[j.in];let Y;if(j.in==="body"&&j.schema&&j.schema.properties&&(Y=p),Y=j&&j.name&&p[j.name],typeof Y>"u"?Y=j&&j.name&&p[`${j.in}.${j.name}`]:rw(j.name,F).length>1&&console.warn(`Parameter '${j.name}' is ambiguous because the defined spec has more than one parameter with the name: '${j.name}' and the passed-in parameter values did not define an 'in' value.`),Y!==null){if(typeof j.default<"u"&&typeof Y>"u"&&(Y=j.default),typeof Y>"u"&&j.required&&!j.allowEmptyValue)throw new Error(`Required parameter ${j.name} is not provided`);if(y&&j.schema&&j.schema.type==="object"&&typeof Y=="string")try{Y=JSON.parse(Y)}catch{throw new Error("Could not parse object parameter value string as JSON")}U&&U({req:A,parameter:j,value:Y,operation:E,spec:e})}});const _=ee(ee({},t),{},{operation:E});if(y?A=zx(_,A):A=Gx(_,A),A.cookies&&Object.keys(A.cookies).length){const j=Object.keys(A.cookies).reduce((U,Y)=>{const re=A.cookies[Y],ce=U?"&":"",he=K.serialize(Y,re);return U+ce+he},"");A.headers.Cookie=j}return A.cookies&&delete A.cookies,jh(A),A}const lc=t=>t?t.replace(/\W/g,""):null;function aw(t){return Hh(t.spec)?lw(t):fw(t)}function lw(t){let{spec:e,pathName:r,method:n,server:i,contextUrl:s,serverVariables:o={}}=t;const a=ue()(e,["paths",r,(n||"").toLowerCase(),"servers"])||ue()(e,["paths",r,"servers"])||ue()(e,["servers"]);let l="",c=null;if(i&&a&&a.length){const u=a.map(h=>h.url);u.indexOf(i)>-1&&(l=i,c=a[u.indexOf(i)])}return!l&&a&&a.length&&(l=a[0].url,[c]=a),l.indexOf("{")>-1&&uw(l).forEach(h=>{if(c.variables&&c.variables[h]){const d=c.variables[h],p=o[h]||d.default,m=new RegExp(`{${h}}`,"g");l=l.replace(m,p)}}),cw(l,s)}function cw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t&&e?V.parse(V.resolve(e,t)):V.parse(t),n=V.parse(e),i=lc(r.protocol)||lc(n.protocol)||"",s=r.host||n.host,o=r.pathname||"";let a;return i&&s?a=`${i}://${s+o}`:a=o,a[a.length-1]==="/"?a.slice(0,-1):a}function uw(t){const e=[],r=/{([^}]+)}/g;let n;for(;n=r.exec(t);)e.push(n[1]);return e}function fw(t){let{spec:e,scheme:r,contextUrl:n=""}=t;const i=V.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=r||s||lc(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(29901),mt=f(20202),Hr=f(6206),vt=f(61736),hw=f(81570),dw=f(74025),pw=f(2526),gw=Object.defineProperty,mw=Object.defineProperties,vw=Object.getOwnPropertyDescriptors,Uh=Object.getOwnPropertySymbols,yw=Object.prototype.hasOwnProperty,bw=Object.prototype.propertyIsEnumerable,Gh=(t,e,r)=>e in t?gw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xw=(t,e)=>{for(var r in e||(e={}))yw.call(e,r)&&Gh(t,r,e[r]);if(Uh)for(var r of Uh(e))bw.call(e,r)&&Gh(t,r,e[r]);return t},ww=(t,e)=>mw(t,vw(e)),Sw=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function kw(t,e){return Sw(this,null,function*(){var r,n,i,s;const o=JSON.parse(JSON.stringify(e)),a=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},l=ww(xw({},a),{components:o.components,paths:{[t.path]:{[t.httpVerb]:(n=(r=o.paths)==null?void 0:r[t.path])==null?void 0:n[t.httpVerb],parameters:(s=(i=o.paths)==null?void 0:i[t.path])==null?void 0:s.parameters}}}),c=new dw.Config({}),u=(0,pw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,hw.bundle)(h),o})}var Aw=f(98910),ta=f(84862),_r=f(53134),Kh=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const Yh=Object.values(_r.FileUploadFormats),Cw=["application/octet-stream","application/pdf","application/gzip","application/zip"],Jh=["image/","audio/","video/"];function Qh(t){if(Jh.some(e=>t.startsWith(e)))return t}function ra(t){return Cw.includes(t)?!0:Jh.some(e=>t.startsWith(e))}function Ow(t){const e=t.type==="array"?t.items:t;if(!e||!e.type||e?.type==="any")return!0;const r=e.contentMediaType||"",n=e.format||e.contentEncoding||(ra(r)?"binary":"");return e.type===_r.DefinitionTypes.STRING&&Yh.includes(n)}function Xh(t,e){if(!t||!t.type||t.type==="any")return ra(e);const r=t.format||t.contentEncoding||"";return t.type===_r.DefinitionTypes.STRING&&Yh.includes(r)}function Zh(t){return new Promise((e,r)=>{const n=new FileReader;n.onload=()=>{const s=n.result.replace(/data:.*\/.*;base64,/g,"");e(s)},n.onerror=()=>r(n.error),n.readAsDataURL(t)})}function _h({format:t,contentEncoding:e,contentMediaType:r}){return[t,e,r].includes(_r.FileUploadFormats.BASE64)}function Ew(t,e){return Kh(this,null,function*(){const r=Object.values(t);let n=r.length===1?r[0]:r;return e.type===_r.DefinitionTypes.STRING&&_h(e)?n=yield Zh(r[0]):e.type===_r.DefinitionTypes.ARRAY&&e.items&&(_h(e.items)?n=yield Promise.all(r.map(s=>Kh(this,null,function*(){return yield Zh(s)}))):n=r),n})}var cc=f(84622),Be=f(38612),Ye=f(97495),Oe=f(85739),Nr=f(71608),Tw=f(64393),$n=f(60991);function Pw({response:t}){const{jsonSampleExpandLevel:e}=(0,Hr.Dv)($n.qd);return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Body: "),Mw(t,e))}function Mw(t,e){return t.body?S.createElement(mt.JsonViewer,{data:t.body,jsonSampleExpandLevel:e}):t.fileInfo?S.createElement(Tw.s,{fileInfo:t.fileInfo}):t.data!==null?t.data?S.createElement(mt.CodeBlock,{lang:(0,Oe.M)(t.headers["Content-Type"]||"text/plain"),source:t.data,header:{controls:{copy:{}}}}):S.createElement(mt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Iw({headers:t}){const e=(0,Hr.Dv)($n.qd),[r,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(t),o=!!i&&s.length>i,a=o&&r?[...s].splice(0,i):[...s],l=()=>{n(!r)};return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Headers: "),S.createElement(mt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(qh,null,c,":"),S.createElement("code",null,t[c]))),o&&S.createElement(ed,{onClick:l},r?"Show more...":"Hide headers")))}const qh=Ye.ZP.strong`
|
|
21
|
+
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Ir(r.buffer,n[o+l],i[o+l],r.position-(n[o]-n[o+l]),h),a+=De.repeat(" ",e.indent)+dr((r.line+l+1).toString(),u)+" | "+c.str+`
|
|
22
|
+
`;return a.replace(/\n$/,"")}var Ri=Wr,Dr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],pr=["scalar","sequence","mapping"];function gr(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(n){e[String(n)]=t})}),e}function Jr(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(Dr.indexOf(t)===-1)throw new pt('Unknown option "'+t+'" is met in definition of "'+r+'" YAML type.')}),this.options=e,this.tag=r,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=gr(e.styleAliases||null),pr.indexOf(this.kind)===-1)throw new pt('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}var gt=Jr;function Dn(r,e){var t=[];return r[e].forEach(function(n){var i=t.length;t.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),t[i]=n}),t}function fi(){var r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,t;function n(i){i.multi?(r.multi[i.kind].push(i),r.multi.fallback.push(i)):r[i.kind][i.tag]=r.fallback[i.tag]=i}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}function xn(r){return this.extend(r)}xn.prototype.extend=function(e){var t=[],n=[];if(e instanceof gt)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new pt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof gt))throw new pt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new pt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new pt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof gt))throw new pt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(xn.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Dn(i,"implicit"),i.compiledExplicit=Dn(i,"explicit"),i.compiledTypeMap=fi(i.compiledImplicit,i.compiledExplicit),i};var wn=xn,Nn=new gt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}}),hi=new gt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}}),Rn=new gt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}}),$r=new wn({explicit:[Nn,hi,Rn]});function Ln(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function di(){return null}function Ze(r){return r===null}var Ce=new gt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ln,construct:di,predicate:Ze,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ne(r){if(r===null)return!1;var e=r.length;return e===4&&(r==="true"||r==="True"||r==="TRUE")||e===5&&(r==="false"||r==="False"||r==="FALSE")}function Te(r){return r==="true"||r==="True"||r==="TRUE"}function $(r){return Object.prototype.toString.call(r)==="[object Boolean]"}var _=new gt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ne,construct:Te,predicate:$,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"});function He(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function _e(r){return 48<=r&&r<=55}function ct(r){return 48<=r&&r<=57}function Pe(r){if(r===null)return!1;var e=r.length,t=0,n=!1,i;if(!e)return!1;if(i=r[t],(i==="-"||i==="+")&&(i=r[++t]),i==="0"){if(t+1===e)return!0;if(i=r[++t],i==="b"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(!He(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(!_e(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=r[t],i!=="_"){if(!ct(r.charCodeAt(t)))return!1;n=!0}return!(!n||i==="_")}function Xr(r){var e=r,t=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(t=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return t*parseInt(e.slice(2),2);if(e[1]==="x")return t*parseInt(e.slice(2),16);if(e[1]==="o")return t*parseInt(e.slice(2),8)}return t*parseInt(e,10)}function Sn(r){return Object.prototype.toString.call(r)==="[object Number]"&&r%1===0&&!De.isNegativeZero(r)}var Ut=new gt("tag:yaml.org,2002:int",{kind:"scalar",resolve:Pe,construct:Xr,predicate:Sn,represent:{binary:function(r){return r>=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0o"+r.toString(8):"-0o"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Qr=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ms(r){return!(r===null||!Qr.test(r)||r[r.length-1]==="_")}function Bn(r){var e,t;return e=r.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:t*parseFloat(e,10)}var mr=/^[-+]?[0-9]+e/;function $o(r,e){var t;if(isNaN(r))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(De.isNegativeZero(r))return"-0.0";return t=r.toString(10),mr.test(t)?t.replace("e",".e"):t}function Ho(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||De.isNegativeZero(r))}var Is=new gt("tag:yaml.org,2002:float",{kind:"scalar",resolve:Ms,construct:Bn,predicate:Ho,represent:$o,defaultStyle:"lowercase"}),Fn=$r.extend({implicit:[Ce,_,Ut,Is]}),Li=Fn,pi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Bi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Ds(r){return r===null?!1:pi.exec(r)!==null||Bi.exec(r)!==null}function zo(r){var e,t,n,i,s,o,a,l=0,c=null,u,h,d;if(e=pi.exec(r),e===null&&(e=Bi.exec(r)),e===null)throw new Error("Date resolve error");if(t=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(t,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],h=+(e[11]||0),c=(u*60+h)*6e4,e[9]==="-"&&(c=-c)),d=new Date(Date.UTC(t,n,i,s,o,a,l)),c&&d.setTime(d.getTime()-c),d}function Uo(r){return r.toISOString()}var Fi=new gt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Ds,construct:zo,instanceOf:Date,represent:Uo});function Go(r){return r==="<<"||r===null}var ji=new gt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Go}),Vi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
23
|
+
\r`;function _l(r){if(r===null)return!1;var e,t,n=0,i=r.length,s=Vi;for(t=0;t<i;t++)if(e=s.indexOf(r.charAt(t)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function Ns(r){var e,t,n=r.replace(/[\r\n=]/g,""),i=n.length,s=Vi,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return t=i%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),new Uint8Array(a)}function jn(r){var e="",t=0,n,i,s=r.length,o=Vi;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[n];return i=s%3,i===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):i===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):i===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function Wi(r){return Object.prototype.toString.call(r)==="[object Uint8Array]"}var Ko=new gt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:_l,construct:Ns,predicate:Wi,represent:jn}),Yo=Object.prototype.hasOwnProperty,Vb=Object.prototype.toString;function Wb(r){if(r===null)return!0;var e=[],t,n,i,s,o,a=r;for(t=0,n=a.length;t<n;t+=1){if(i=a[t],o=!1,Vb.call(i)!=="[object Object]")return!1;for(s in i)if(Yo.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}function $b(r){return r!==null?r:[]}var qf=new gt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Wb,construct:$b}),Hb=Object.prototype.toString;function zb(r){if(r===null)return!0;var e,t,n,i,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1){if(n=o[e],Hb.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}function Ub(r){if(r===null)return[];var e,t,n,i,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}var eh=new gt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:zb,construct:Ub}),Gb=Object.prototype.hasOwnProperty;function Kb(r){if(r===null)return!0;var e,t=r;for(e in t)if(Gb.call(t,e)&&t[e]!==null)return!1;return!0}function Yb(r){return r!==null?r:{}}var th=new gt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Kb,construct:Yb}),ql=Li.extend({implicit:[Fi,ji],explicit:[Ko,qf,eh,th]}),Vn=Object.prototype.hasOwnProperty,Jo=1,rh=2,nh=3,Xo=4,ec=1,Jb=2,ih=3,Xb=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Qb=/[\x85\u2028\u2029]/,Zb=/[,\[\]\{\}]/,sh=/^(?:!|!!|![a-z\-]+!)$/i,oh=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ah(r){return Object.prototype.toString.call(r)}function Zr(r){return r===10||r===13}function gi(r){return r===9||r===32}function ar(r){return r===9||r===32||r===10||r===13}function $i(r){return r===44||r===91||r===93||r===123||r===125}function _b(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function qb(r){return r===120?2:r===117?4:r===85?8:0}function e1(r){return 48<=r&&r<=57?r-48:-1}function lh(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?`
|
|
24
|
+
`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function t1(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}for(var ch=new Array(256),uh=new Array(256),Hi=0;Hi<256;Hi++)ch[Hi]=lh(Hi)?1:0,uh[Hi]=lh(Hi);function r1(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||ql,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=r.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function fh(r,e){var t={name:r.filename,buffer:r.input.slice(0,-1),position:r.position,line:r.line,column:r.position-r.lineStart};return t.snippet=Ri(t),new pt(e,t)}function Se(r,e){throw fh(r,e)}function Qo(r,e){r.onWarning&&r.onWarning.call(null,fh(r,e))}var hh={YAML:function(e,t,n){var i,s,o;e.version!==null&&Se(e,"duplication of %YAML directive"),n.length!==1&&Se(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Se(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Se(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Qo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,s;n.length!==2&&Se(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],sh.test(i)||Se(e,"ill-formed tag handle (first argument) of the TAG directive"),Vn.call(e.tagMap,i)&&Se(e,'there is a previously declared suffix for "'+i+'" tag handle'),oh.test(s)||Se(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Se(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s}};function Wn(r,e,t,n){var i,s,o,a;if(e<t){if(a=r.input.slice(e,t),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||Se(r,"expected valid JSON character");else Xb.test(a)&&Se(r,"the stream contains non-printable characters");r.result+=a}}function dh(r,e,t,n){var i,s,o,a;for(De.isObject(t)||Se(r,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),o=0,a=i.length;o<a;o+=1)s=i[o],Vn.call(e,s)||(e[s]=t[s],n[s]=!0)}function zi(r,e,t,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&Se(r,"nested arrays are not supported inside keys"),typeof i=="object"&&ah(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&ah(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)dh(r,e,s[c],t);else dh(r,e,s,t);else!r.json&&!Vn.call(t,i)&&Vn.call(e,i)&&(r.line=o||r.line,r.lineStart=a||r.lineStart,r.position=l||r.position,Se(r,"duplicated mapping key")),i==="__proto__"?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:s}):e[i]=s,delete t[i];return e}function tc(r){var e;e=r.input.charCodeAt(r.position),e===10?r.position++:e===13?(r.position++,r.input.charCodeAt(r.position)===10&&r.position++):Se(r,"a line break is expected"),r.line+=1,r.lineStart=r.position,r.firstTabInLine=-1}function kt(r,e,t){for(var n=0,i=r.input.charCodeAt(r.position);i!==0;){for(;gi(i);)i===9&&r.firstTabInLine===-1&&(r.firstTabInLine=r.position),i=r.input.charCodeAt(++r.position);if(e&&i===35)do i=r.input.charCodeAt(++r.position);while(i!==10&&i!==13&&i!==0);if(Zr(i))for(tc(r),i=r.input.charCodeAt(r.position),n++,r.lineIndent=0;i===32;)r.lineIndent++,i=r.input.charCodeAt(++r.position);else break}return t!==-1&&n!==0&&r.lineIndent<t&&Qo(r,"deficient indentation"),n}function Zo(r){var e=r.position,t;return t=r.input.charCodeAt(e),!!((t===45||t===46)&&t===r.input.charCodeAt(e+1)&&t===r.input.charCodeAt(e+2)&&(e+=3,t=r.input.charCodeAt(e),t===0||ar(t)))}function rc(r,e){e===1?r.result+=" ":e>1&&(r.result+=De.repeat(`
|
|
25
|
+
`,e-1))}function n1(r,e,t){var n,i,s,o,a,l,c,u,h=r.kind,d=r.result,p;if(p=r.input.charCodeAt(r.position),ar(p)||$i(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=r.input.charCodeAt(r.position+1),ar(i)||t&&$i(i)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;p!==0;){if(p===58){if(i=r.input.charCodeAt(r.position+1),ar(i)||t&&$i(i))break}else if(p===35){if(n=r.input.charCodeAt(r.position-1),ar(n))break}else{if(r.position===r.lineStart&&Zo(r)||t&&$i(p))break;if(Zr(p))if(l=r.line,c=r.lineStart,u=r.lineIndent,kt(r,!1,-1),r.lineIndent>=e){a=!0,p=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=l,r.lineStart=c,r.lineIndent=u;break}}a&&(Wn(r,s,o,!1),rc(r,r.line-l),s=o=r.position,a=!1),gi(p)||(o=r.position+1),p=r.input.charCodeAt(++r.position)}return Wn(r,s,o,!1),r.result?!0:(r.kind=h,r.result=d,!1)}function i1(r,e){var t,n,i;if(t=r.input.charCodeAt(r.position),t!==39)return!1;for(r.kind="scalar",r.result="",r.position++,n=i=r.position;(t=r.input.charCodeAt(r.position))!==0;)if(t===39)if(Wn(r,n,r.position,!0),t=r.input.charCodeAt(++r.position),t===39)n=r.position,r.position++,i=r.position;else return!0;else Zr(t)?(Wn(r,n,i,!0),rc(r,kt(r,!1,e)),n=i=r.position):r.position===r.lineStart&&Zo(r)?Se(r,"unexpected end of the document within a single quoted scalar"):(r.position++,i=r.position);Se(r,"unexpected end of the stream within a single quoted scalar")}function s1(r,e){var t,n,i,s,o,a;if(a=r.input.charCodeAt(r.position),a!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=n=r.position;(a=r.input.charCodeAt(r.position))!==0;){if(a===34)return Wn(r,t,r.position,!0),r.position++,!0;if(a===92){if(Wn(r,t,r.position,!0),a=r.input.charCodeAt(++r.position),Zr(a))kt(r,!1,e);else if(a<256&&ch[a])r.result+=uh[a],r.position++;else if((o=qb(a))>0){for(i=o,s=0;i>0;i--)a=r.input.charCodeAt(++r.position),(o=_b(a))>=0?s=(s<<4)+o:Se(r,"expected hexadecimal character");r.result+=t1(s),r.position++}else Se(r,"unknown escape sequence");t=n=r.position}else Zr(a)?(Wn(r,t,n,!0),rc(r,kt(r,!1,e)),t=n=r.position):r.position===r.lineStart&&Zo(r)?Se(r,"unexpected end of the document within a double quoted scalar"):(r.position++,n=r.position)}Se(r,"unexpected end of the stream within a double quoted scalar")}function o1(r,e){var t=!0,n,i,s,o=r.tag,a,l=r.anchor,c,u,h,d,p,m=Object.create(null),y,w,A,T;if(T=r.input.charCodeAt(r.position),T===91)u=93,p=!1,a=[];else if(T===123)u=125,p=!0,a={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=a),T=r.input.charCodeAt(++r.position);T!==0;){if(kt(r,!0,e),T=r.input.charCodeAt(r.position),T===u)return r.position++,r.tag=o,r.anchor=l,r.kind=p?"mapping":"sequence",r.result=a,!0;t?T===44&&Se(r,"expected the node content, but found ','"):Se(r,"missed comma between flow collection entries"),w=y=A=null,h=d=!1,T===63&&(c=r.input.charCodeAt(r.position+1),ar(c)&&(h=d=!0,r.position++,kt(r,!0,e))),n=r.line,i=r.lineStart,s=r.position,Ui(r,e,Jo,!1,!0),w=r.tag,y=r.result,kt(r,!0,e),T=r.input.charCodeAt(r.position),(d||r.line===n)&&T===58&&(h=!0,T=r.input.charCodeAt(++r.position),kt(r,!0,e),Ui(r,e,Jo,!1,!0),A=r.result),p?zi(r,a,m,w,y,A,n,i,s):h?a.push(zi(r,null,m,w,y,A,n,i,s)):a.push(y),kt(r,!0,e),T=r.input.charCodeAt(r.position),T===44?(t=!0,T=r.input.charCodeAt(++r.position)):t=!1}Se(r,"unexpected end of the stream within a flow collection")}function a1(r,e){var t,n,i=ec,s=!1,o=!1,a=e,l=0,c=!1,u,h;if(h=r.input.charCodeAt(r.position),h===124)n=!1;else if(h===62)n=!0;else return!1;for(r.kind="scalar",r.result="";h!==0;)if(h=r.input.charCodeAt(++r.position),h===43||h===45)ec===i?i=h===43?ih:Jb:Se(r,"repeat of a chomping mode identifier");else if((u=e1(h))>=0)u===0?Se(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Se(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(gi(h)){do h=r.input.charCodeAt(++r.position);while(gi(h));if(h===35)do h=r.input.charCodeAt(++r.position);while(!Zr(h)&&h!==0)}for(;h!==0;){for(tc(r),r.lineIndent=0,h=r.input.charCodeAt(r.position);(!o||r.lineIndent<a)&&h===32;)r.lineIndent++,h=r.input.charCodeAt(++r.position);if(!o&&r.lineIndent>a&&(a=r.lineIndent),Zr(h)){l++;continue}if(r.lineIndent<a){i===ih?r.result+=De.repeat(`
|
|
26
|
+
`,s?1+l:l):i===ec&&s&&(r.result+=`
|
|
27
|
+
`);break}for(n?gi(h)?(c=!0,r.result+=De.repeat(`
|
|
28
|
+
`,s?1+l:l)):c?(c=!1,r.result+=De.repeat(`
|
|
29
|
+
`,l+1)):l===0?s&&(r.result+=" "):r.result+=De.repeat(`
|
|
30
|
+
`,l):r.result+=De.repeat(`
|
|
31
|
+
`,s?1+l:l),s=!0,o=!0,l=0,t=r.position;!Zr(h)&&h!==0;)h=r.input.charCodeAt(++r.position);Wn(r,t,r.position,!1)}return!0}function ph(r,e){var t,n=r.tag,i=r.anchor,s=[],o,a=!1,l;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),l=r.input.charCodeAt(r.position);l!==0&&(r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Se(r,"tab characters must not be used in indentation")),!(l!==45||(o=r.input.charCodeAt(r.position+1),!ar(o))));){if(a=!0,r.position++,kt(r,!0,-1)&&r.lineIndent<=e){s.push(null),l=r.input.charCodeAt(r.position);continue}if(t=r.line,Ui(r,e,nh,!1,!0),s.push(r.result),kt(r,!0,-1),l=r.input.charCodeAt(r.position),(r.line===t||r.lineIndent>e)&&l!==0)Se(r,"bad indentation of a sequence entry");else if(r.lineIndent<e)break}return a?(r.tag=n,r.anchor=i,r.kind="sequence",r.result=s,!0):!1}function l1(r,e,t){var n,i,s,o,a,l,c=r.tag,u=r.anchor,h={},d=Object.create(null),p=null,m=null,y=null,w=!1,A=!1,T;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=h),T=r.input.charCodeAt(r.position);T!==0;){if(!w&&r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,Se(r,"tab characters must not be used in indentation")),n=r.input.charCodeAt(r.position+1),s=r.line,(T===63||T===58)&&ar(n))T===63?(w&&(zi(r,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!0,i=!0):w?(w=!1,i=!0):Se(r,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),r.position+=1,T=n;else{if(o=r.line,a=r.lineStart,l=r.position,!Ui(r,t,rh,!1,!0))break;if(r.line===s){for(T=r.input.charCodeAt(r.position);gi(T);)T=r.input.charCodeAt(++r.position);if(T===58)T=r.input.charCodeAt(++r.position),ar(T)||Se(r,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(zi(r,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!1,i=!1,p=r.tag,m=r.result;else if(A)Se(r,"can not read an implicit mapping pair; a colon is missed");else return r.tag=c,r.anchor=u,!0}else if(A)Se(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return r.tag=c,r.anchor=u,!0}if((r.line===s||r.lineIndent>e)&&(w&&(o=r.line,a=r.lineStart,l=r.position),Ui(r,e,Xo,!0,i)&&(w?m=r.result:y=r.result),w||(zi(r,h,d,p,m,y,o,a,l),p=m=y=null),kt(r,!0,-1),T=r.input.charCodeAt(r.position)),(r.line===s||r.lineIndent>e)&&T!==0)Se(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return w&&zi(r,h,d,p,m,null,o,a,l),A&&(r.tag=c,r.anchor=u,r.kind="mapping",r.result=h),A}function c1(r){var e,t=!1,n=!1,i,s,o;if(o=r.input.charCodeAt(r.position),o!==33)return!1;if(r.tag!==null&&Se(r,"duplication of a tag property"),o=r.input.charCodeAt(++r.position),o===60?(t=!0,o=r.input.charCodeAt(++r.position)):o===33?(n=!0,i="!!",o=r.input.charCodeAt(++r.position)):i="!",e=r.position,t){do o=r.input.charCodeAt(++r.position);while(o!==0&&o!==62);r.position<r.length?(s=r.input.slice(e,r.position),o=r.input.charCodeAt(++r.position)):Se(r,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ar(o);)o===33&&(n?Se(r,"tag suffix cannot contain exclamation marks"):(i=r.input.slice(e-1,r.position+1),sh.test(i)||Se(r,"named tag handle cannot contain such characters"),n=!0,e=r.position+1)),o=r.input.charCodeAt(++r.position);s=r.input.slice(e,r.position),Zb.test(s)&&Se(r,"tag suffix cannot contain flow indicator characters")}s&&!oh.test(s)&&Se(r,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Se(r,"tag name is malformed: "+s)}return t?r.tag=s:Vn.call(r.tagMap,i)?r.tag=r.tagMap[i]+s:i==="!"?r.tag="!"+s:i==="!!"?r.tag="tag:yaml.org,2002:"+s:Se(r,'undeclared tag handle "'+i+'"'),!0}function u1(r){var e,t;if(t=r.input.charCodeAt(r.position),t!==38)return!1;for(r.anchor!==null&&Se(r,"duplication of an anchor property"),t=r.input.charCodeAt(++r.position),e=r.position;t!==0&&!ar(t)&&!$i(t);)t=r.input.charCodeAt(++r.position);return r.position===e&&Se(r,"name of an anchor node must contain at least one character"),r.anchor=r.input.slice(e,r.position),!0}function f1(r){var e,t,n;if(n=r.input.charCodeAt(r.position),n!==42)return!1;for(n=r.input.charCodeAt(++r.position),e=r.position;n!==0&&!ar(n)&&!$i(n);)n=r.input.charCodeAt(++r.position);return r.position===e&&Se(r,"name of an alias node must contain at least one character"),t=r.input.slice(e,r.position),Vn.call(r.anchorMap,t)||Se(r,'unidentified alias "'+t+'"'),r.result=r.anchorMap[t],kt(r,!0,-1),!0}function Ui(r,e,t,n,i){var s,o,a,l=1,c=!1,u=!1,h,d,p,m,y,w;if(r.listener!==null&&r.listener("open",r),r.tag=null,r.anchor=null,r.kind=null,r.result=null,s=o=a=Xo===t||nh===t,n&&kt(r,!0,-1)&&(c=!0,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)),l===1)for(;c1(r)||u1(r);)kt(r,!0,-1)?(c=!0,a=s,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||Xo===t)&&(Jo===t||rh===t?y=e:y=e+1,w=r.position-r.lineStart,l===1?a&&(ph(r,w)||l1(r,w,y))||o1(r,y)?u=!0:(o&&a1(r,y)||i1(r,y)||s1(r,y)?u=!0:f1(r)?(u=!0,(r.tag!==null||r.anchor!==null)&&Se(r,"alias node should not have any properties")):n1(r,y,Jo===t)&&(u=!0,r.tag===null&&(r.tag="?")),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):l===0&&(u=a&&ph(r,w))),r.tag===null)r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);else if(r.tag==="?"){for(r.result!==null&&r.kind!=="scalar"&&Se(r,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+r.kind+'"'),h=0,d=r.implicitTypes.length;h<d;h+=1)if(m=r.implicitTypes[h],m.resolve(r.result)){r.result=m.construct(r.result),r.tag=m.tag,r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);break}}else if(r.tag!=="!"){if(Vn.call(r.typeMap[r.kind||"fallback"],r.tag))m=r.typeMap[r.kind||"fallback"][r.tag];else for(m=null,p=r.typeMap.multi[r.kind||"fallback"],h=0,d=p.length;h<d;h+=1)if(r.tag.slice(0,p[h].tag.length)===p[h].tag){m=p[h];break}m||Se(r,"unknown tag !<"+r.tag+">"),r.result!==null&&m.kind!==r.kind&&Se(r,"unacceptable node kind for !<"+r.tag+'> tag; it should be "'+m.kind+'", not "'+r.kind+'"'),m.resolve(r.result,r.tag)?(r.result=m.construct(r.result,r.tag),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):Se(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")}return r.listener!==null&&r.listener("close",r),r.tag!==null||r.anchor!==null||u}function h1(r){var e=r.position,t,n,i,s=!1,o;for(r.version=null,r.checkLineBreaks=r.legacy,r.tagMap=Object.create(null),r.anchorMap=Object.create(null);(o=r.input.charCodeAt(r.position))!==0&&(kt(r,!0,-1),o=r.input.charCodeAt(r.position),!(r.lineIndent>0||o!==37));){for(s=!0,o=r.input.charCodeAt(++r.position),t=r.position;o!==0&&!ar(o);)o=r.input.charCodeAt(++r.position);for(n=r.input.slice(t,r.position),i=[],n.length<1&&Se(r,"directive name must not be less than one character in length");o!==0;){for(;gi(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!Zr(o));break}if(Zr(o))break;for(t=r.position;o!==0&&!ar(o);)o=r.input.charCodeAt(++r.position);i.push(r.input.slice(t,r.position))}o!==0&&tc(r),Vn.call(hh,n)?hh[n](r,n,i):Qo(r,'unknown document directive "'+n+'"')}if(kt(r,!0,-1),r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45?(r.position+=3,kt(r,!0,-1)):s&&Se(r,"directives end mark is expected"),Ui(r,r.lineIndent-1,Xo,!1,!0),kt(r,!0,-1),r.checkLineBreaks&&Qb.test(r.input.slice(e,r.position))&&Qo(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&Zo(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,kt(r,!0,-1));return}if(r.position<r.length-1)Se(r,"end of the stream or a document separator is expected");else return}function gh(r,e){r=String(r),e=e||{},r.length!==0&&(r.charCodeAt(r.length-1)!==10&&r.charCodeAt(r.length-1)!==13&&(r+=`
|
|
32
|
+
`),r.charCodeAt(0)===65279&&(r=r.slice(1)));var t=new r1(r,e),n=r.indexOf("\0");for(n!==-1&&(t.position=n,Se(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)h1(t);return t.documents}function d1(r,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var n=gh(r,t);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}function p1(r,e){var t=gh(r,e);if(t.length!==0){if(t.length===1)return t[0];throw new pt("expected a single document in the stream, but found more")}}var g1=d1,m1=p1,mh={loadAll:g1,load:m1},vh=Object.prototype.toString,yh=Object.prototype.hasOwnProperty,nc=65279,v1=9,Rs=10,y1=13,b1=32,x1=33,w1=34,ic=35,S1=37,k1=38,A1=39,C1=42,bh=44,O1=45,_o=58,E1=61,T1=62,P1=63,M1=64,xh=91,wh=93,I1=96,Sh=123,D1=124,kh=125,Gt={};Gt[0]="\\0",Gt[7]="\\a",Gt[8]="\\b",Gt[9]="\\t",Gt[10]="\\n",Gt[11]="\\v",Gt[12]="\\f",Gt[13]="\\r",Gt[27]="\\e",Gt[34]='\\"',Gt[92]="\\\\",Gt[133]="\\N",Gt[160]="\\_",Gt[8232]="\\L",Gt[8233]="\\P";var N1=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],R1=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function L1(r,e){var t,n,i,s,o,a,l;if(e===null)return{};for(t={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=r.compiledTypeMap.fallback[o],l&&yh.call(l.styleAliases,a)&&(a=l.styleAliases[a]),t[o]=a;return t}function B1(r){var e,t,n;if(e=r.toString(16).toUpperCase(),r<=255)t="x",n=2;else if(r<=65535)t="u",n=4;else if(r<=4294967295)t="U",n=8;else throw new pt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+De.repeat("0",n-e.length)+e}var F1=1,Ls=2;function j1(r){this.schema=r.schema||ql,this.indent=Math.max(1,r.indent||2),this.noArrayIndent=r.noArrayIndent||!1,this.skipInvalid=r.skipInvalid||!1,this.flowLevel=De.isNothing(r.flowLevel)?-1:r.flowLevel,this.styleMap=L1(this.schema,r.styles||null),this.sortKeys=r.sortKeys||!1,this.lineWidth=r.lineWidth||80,this.noRefs=r.noRefs||!1,this.noCompatMode=r.noCompatMode||!1,this.condenseFlow=r.condenseFlow||!1,this.quotingType=r.quotingType==='"'?Ls:F1,this.forceQuotes=r.forceQuotes||!1,this.replacer=typeof r.replacer=="function"?r.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ah(r,e){for(var t=De.repeat(" ",e),n=0,i=-1,s="",o,a=r.length;n<a;)i=r.indexOf(`
|
|
33
|
+
`,n),i===-1?(o=r.slice(n),n=a):(o=r.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
34
|
+
`&&(s+=t),s+=o;return s}function sc(r,e){return`
|
|
35
|
+
`+De.repeat(" ",r.indent*e)}function V1(r,e){var t,n,i;for(t=0,n=r.implicitTypes.length;t<n;t+=1)if(i=r.implicitTypes[t],i.resolve(e))return!0;return!1}function qo(r){return r===b1||r===v1}function Bs(r){return 32<=r&&r<=126||161<=r&&r<=55295&&r!==8232&&r!==8233||57344<=r&&r<=65533&&r!==nc||65536<=r&&r<=1114111}function Ch(r){return Bs(r)&&r!==nc&&r!==y1&&r!==Rs}function Oh(r,e,t){var n=Ch(r),i=n&&!qo(r);return(t?n:n&&r!==bh&&r!==xh&&r!==wh&&r!==Sh&&r!==kh)&&r!==ic&&!(e===_o&&!i)||Ch(e)&&!qo(e)&&r===ic||e===_o&&i}function W1(r){return Bs(r)&&r!==nc&&!qo(r)&&r!==O1&&r!==P1&&r!==_o&&r!==bh&&r!==xh&&r!==wh&&r!==Sh&&r!==kh&&r!==ic&&r!==k1&&r!==C1&&r!==x1&&r!==D1&&r!==E1&&r!==T1&&r!==A1&&r!==w1&&r!==S1&&r!==M1&&r!==I1}function $1(r){return!qo(r)&&r!==_o}function Fs(r,e){var t=r.charCodeAt(e),n;return t>=55296&&t<=56319&&e+1<r.length&&(n=r.charCodeAt(e+1),n>=56320&&n<=57343)?(t-55296)*1024+n-56320+65536:t}function Eh(r){var e=/^\n* /;return e.test(r)}var Th=1,oc=2,Ph=3,Mh=4,Gi=5;function H1(r,e,t,n,i,s,o,a){var l,c=0,u=null,h=!1,d=!1,p=n!==-1,m=-1,y=W1(Fs(r,0))&&$1(Fs(r,r.length-1));if(e||o)for(l=0;l<r.length;c>=65536?l+=2:l++){if(c=Fs(r,l),!Bs(c))return Gi;y=y&&Oh(c,u,a),u=c}else{for(l=0;l<r.length;c>=65536?l+=2:l++){if(c=Fs(r,l),c===Rs)h=!0,p&&(d=d||l-m-1>n&&r[m+1]!==" ",m=l);else if(!Bs(c))return Gi;y=y&&Oh(c,u,a),u=c}d=d||p&&l-m-1>n&&r[m+1]!==" "}return!h&&!d?y&&!o&&!i(r)?Th:s===Ls?Gi:oc:t>9&&Eh(r)?Gi:o?s===Ls?Gi:oc:d?Mh:Ph}function z1(r,e,t,n,i){r.dump=function(){if(e.length===0)return r.quotingType===Ls?'""':"''";if(!r.noCompatMode&&(N1.indexOf(e)!==-1||R1.test(e)))return r.quotingType===Ls?'"'+e+'"':"'"+e+"'";var s=r.indent*Math.max(1,t),o=r.lineWidth===-1?-1:Math.max(Math.min(r.lineWidth,40),r.lineWidth-s),a=n||r.flowLevel>-1&&t>=r.flowLevel;function l(c){return V1(r,c)}switch(H1(e,a,r.indent,o,l,r.quotingType,r.forceQuotes&&!n,i)){case Th:return e;case oc:return"'"+e.replace(/'/g,"''")+"'";case Ph:return"|"+Ih(e,r.indent)+Dh(Ah(e,s));case Mh:return">"+Ih(e,r.indent)+Dh(Ah(U1(e,o),s));case Gi:return'"'+G1(e)+'"';default:throw new pt("impossible error: invalid scalar style")}}()}function Ih(r,e){var t=Eh(r)?String(e):"",n=r[r.length-1]===`
|
|
36
|
+
`,i=n&&(r[r.length-2]===`
|
|
37
|
+
`||r===`
|
|
38
|
+
`),s=i?"+":n?"":"-";return t+s+`
|
|
39
|
+
`}function Dh(r){return r[r.length-1]===`
|
|
40
|
+
`?r.slice(0,-1):r}function U1(r,e){for(var t=/(\n+)([^\n]*)/g,n=function(){var c=r.indexOf(`
|
|
41
|
+
`);return c=c!==-1?c:r.length,t.lastIndex=c,Nh(r.slice(0,c),e)}(),i=r[0]===`
|
|
42
|
+
`||r[0]===" ",s,o;o=t.exec(r);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
43
|
+
`:"")+Nh(l,e),i=s}return n}function Nh(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=t.exec(r);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
|
|
44
|
+
`+r.slice(i,s),i=s+1),o=a;return l+=`
|
|
45
|
+
`,r.length-i>e&&o>i?l+=r.slice(i,o)+`
|
|
46
|
+
`+r.slice(o+1):l+=r.slice(i),l.slice(1)}function G1(r){for(var e="",t=0,n,i=0;i<r.length;t>=65536?i+=2:i++)t=Fs(r,i),n=Gt[t],!n&&Bs(t)?(e+=r[i],t>=65536&&(e+=r[i+1])):e+=n||B1(t);return e}function K1(r,e,t){var n="",i=r.tag,s,o,a;for(s=0,o=t.length;s<o;s+=1)a=t[s],r.replacer&&(a=r.replacer.call(t,String(s),a)),(kn(r,e,a,!1,!1)||typeof a>"u"&&kn(r,e,null,!1,!1))&&(n!==""&&(n+=","+(r.condenseFlow?"":" ")),n+=r.dump);r.tag=i,r.dump="["+n+"]"}function Rh(r,e,t,n){var i="",s=r.tag,o,a,l;for(o=0,a=t.length;o<a;o+=1)l=t[o],r.replacer&&(l=r.replacer.call(t,String(o),l)),(kn(r,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&kn(r,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=sc(r,e)),r.dump&&Rs===r.dump.charCodeAt(0)?i+="-":i+="- ",i+=r.dump);r.tag=s,r.dump=i||"[]"}function Y1(r,e,t){var n="",i=r.tag,s=Object.keys(t),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),r.condenseFlow&&(u+='"'),l=s[o],c=t[l],r.replacer&&(c=r.replacer.call(t,l,c)),kn(r,e,l,!1,!1)&&(r.dump.length>1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),kn(r,e,c,!1,!1)&&(u+=r.dump,n+=u));r.tag=i,r.dump="{"+n+"}"}function J1(r,e,t,n){var i="",s=r.tag,o=Object.keys(t),a,l,c,u,h,d;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new pt("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)d="",(!n||i!=="")&&(d+=sc(r,e)),c=o[a],u=t[c],r.replacer&&(u=r.replacer.call(t,c,u)),kn(r,e+1,c,!0,!0,!0)&&(h=r.tag!==null&&r.tag!=="?"||r.dump&&r.dump.length>1024,h&&(r.dump&&Rs===r.dump.charCodeAt(0)?d+="?":d+="? "),d+=r.dump,h&&(d+=sc(r,e)),kn(r,e+1,u,!0,h)&&(r.dump&&Rs===r.dump.charCodeAt(0)?d+=":":d+=": ",d+=r.dump,i+=d));r.tag=s,r.dump=i||"{}"}function Lh(r,e,t){var n,i,s,o,a,l;for(i=t?r.explicitTypes:r.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(t?a.multi&&a.representName?r.tag=a.representName(e):r.tag=a.tag:r.tag="?",a.represent){if(l=r.styleMap[a.tag]||a.defaultStyle,vh.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(yh.call(a.represent,l))n=a.represent[l](e,l);else throw new pt("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');r.dump=n}return!0}return!1}function kn(r,e,t,n,i,s,o){r.tag=null,r.dump=t,Lh(r,t,!1)||Lh(r,t,!0);var a=vh.call(r.dump),l=n,c;n&&(n=r.flowLevel<0||r.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,d;if(u&&(h=r.duplicates.indexOf(t),d=h!==-1),(r.tag!==null&&r.tag!=="?"||d||r.indent!==2&&e>0)&&(i=!1),d&&r.usedDuplicates[h])r.dump="*ref_"+h;else{if(u&&d&&!r.usedDuplicates[h]&&(r.usedDuplicates[h]=!0),a==="[object Object]")n&&Object.keys(r.dump).length!==0?(J1(r,e,r.dump,i),d&&(r.dump="&ref_"+h+r.dump)):(Y1(r,e,r.dump),d&&(r.dump="&ref_"+h+" "+r.dump));else if(a==="[object Array]")n&&r.dump.length!==0?(r.noArrayIndent&&!o&&e>0?Rh(r,e-1,r.dump,i):Rh(r,e,r.dump,i),d&&(r.dump="&ref_"+h+r.dump)):(K1(r,e,r.dump),d&&(r.dump="&ref_"+h+" "+r.dump));else if(a==="[object String]")r.tag!=="?"&&z1(r,r.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(r.skipInvalid)return!1;throw new pt("unacceptable kind of an object to dump "+a)}r.tag!==null&&r.tag!=="?"&&(c=encodeURI(r.tag[0]==="!"?r.tag.slice(1):r.tag).replace(/!/g,"%21"),r.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",r.dump=c+" "+r.dump)}return!0}function X1(r,e){var t=[],n=[],i,s;for(ac(r,t,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(t[n[i]]);e.usedDuplicates=new Array(s)}function ac(r,e,t){var n,i,s;if(r!==null&&typeof r=="object")if(i=e.indexOf(r),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(r),Array.isArray(r))for(i=0,s=r.length;i<s;i+=1)ac(r[i],e,t);else for(n=Object.keys(r),i=0,s=n.length;i<s;i+=1)ac(r[n[i]],e,t)}function Q1(r,e){e=e||{};var t=new j1(e);t.noRefs||X1(r,t);var n=r;return t.replacer&&(n=t.replacer.call({"":n},"",n)),kn(t,0,n,!0,!0)?t.dump+`
|
|
47
|
+
`:""}var Z1=Q1,_1={dump:Z1};function lc(r,e){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var q1=gt,ex=wn,tx=$r,rx=Fn,nx=Li,ix=ql,sx=mh.load,ox=mh.loadAll,ax=_1.dump,lx=pt,cx={binary:Ko,float:Is,map:Rn,null:Ce,pairs:eh,set:th,timestamp:Fi,bool:_,int:Ut,merge:ji,omap:qf,seq:hi,str:Nn},ux=lc("safeLoad","load"),fx=lc("safeLoadAll","loadAll"),hx=lc("safeDump","dump"),dx={Type:q1,Schema:ex,FAILSAFE_SCHEMA:tx,JSON_SCHEMA:rx,CORE_SCHEMA:nx,DEFAULT_SCHEMA:ix,load:sx,loadAll:ox,dump:ax,YAMLException:lx,types:cx,safeLoad:ux,safeLoadAll:fx,safeDump:hx};const px=dx,gx=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Bh,Blob:ea,File:Fh}=gx,mx=r=>":/?#[]@!$&'()*+,;=".indexOf(r)>-1,vx=r=>/^[a-z0-9\-._~]+$/i.test(r);function Ki(r){let{escape:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return typeof r=="number"&&(r=r.toString()),typeof r!="string"||!r.length||!e?r:t?JSON.parse(r):[...r].map(n=>{if(vx(n)||mx(n)&&e==="unsafe")return n;const i=new TextEncoder;return Array.from(i.encode(n)).map(o=>`0${o.toString(16).toUpperCase()}`.slice(-2)).map(o=>`%${o}`).join("")}).join("")}function cc(r){const{value:e}=r;return Array.isArray(e)?yx(r):typeof e=="object"?bx(r):xx(r)}function yx(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=a=>Ki(a,{escape:s});if(n==="simple")return t.map(a=>o(a)).join(",");if(n==="label")return`.${t.map(a=>o(a)).join(".")}`;if(n==="matrix")return t.map(a=>o(a)).reduce((a,l)=>!a||i?`${a||""};${e}=${l}`:`${a},${l}`,"");if(n==="form"){const a=i?`&${e}=`:",";return t.map(l=>o(l)).join(a)}if(n==="spaceDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(` ${a}`)}if(n==="pipeDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(`|${a}`)}}function bx(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=l=>Ki(l,{escape:s}),a=Object.keys(t);if(n==="simple")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":",";return`${l?`${l},`:""}${c}${h}${u}`},"");if(n==="label")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":".";return`${l?`${l}.`:"."}${c}${h}${u}`},"");if(n==="matrix"&&i)return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l};`:";"}${c}=${u}`},"");if(n==="matrix")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l},`:`;${e}=`}${c},${u}`},"");if(n==="form")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l}${i?"&":","}`:""}${c}${i?"=":","}${u}`},"")}function xx(r){let{key:e,value:t,style:n,escape:i}=r;const s=o=>Ki(o,{escape:i});if(n==="simple")return s(t);if(n==="label")return`.${s(t)}`;if(n==="matrix")return`;${e}=${s(t)}`;if(n==="form")return s(t);if(n==="deepObject")return s(t,{},!0)}const wx=(r,e)=>{e.body=r},uc={serializeRes:Cx,mergeInQueryOrForm:Hh};async function Sx(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof r=="object"&&(e=r,r=e.url),e.headers=e.headers||{},uc.mergeInQueryOrForm(e),e.headers&&Object.keys(e.headers).forEach(i=>{const s=e.headers[i];typeof s=="string"&&(e.headers[i]=s.replace(/\n+/g," "))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);const t=e.headers["content-type"]||e.headers["Content-Type"];/multipart\/form-data/i.test(t)&&e.body instanceof Bh&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await uc.serializeRes(n,r,e),e.responseInterceptor&&(n=await e.responseInterceptor(n)||n)}catch(i){if(!n)throw i;const s=new Error(n.statusText||`response status is ${n.status}`);throw s.status=n.status,s.statusCode=n.status,s.responseError=i,s}if(!n.ok){const i=new Error(n.statusText||`response status is ${n.status}`);throw i.status=n.status,i.statusCode=n.status,i.response=n,i}return n}const kx=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(r)};function Ax(r,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(r):px.load(r)}function Cx(r,e){let{loadSpec:t=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n={ok:r.ok,url:r.url||e,status:r.status,statusText:r.statusText,headers:Ex(r.headers)},i=n.headers["content-type"],s=t||kx(i);return(s?r.text:r.blob||r.buffer).call(r).then(a=>{if(n.text=a,n.data=a,s)try{const l=Ax(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function Ox(r){return r.includes(", ")?r.split(", "):r}function Ex(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return typeof r.entries!="function"?{}:Array.from(r.entries()).reduce((e,t)=>{let[n,i]=t;return e[n]=Ox(i),e},{})}function fc(r,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(r&&typeof r=="object"&&typeof r.uri=="string"):typeof Fh<"u"&&r instanceof Fh||typeof ea<"u"&&r instanceof ea||ArrayBuffer.isView(r)?!0:r!==null&&typeof r=="object"&&typeof r.pipe=="function"}function jh(r,e){return Array.isArray(r)&&r.some(t=>fc(t,e))}const Tx={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Px={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Vh(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,a=typeof e=="object"&&!Array.isArray(e)?e.value:e,l=t?u=>u.toString():u=>encodeURIComponent(u),c=l(r);if(typeof a>"u"&&i)return[[c,""]];if(fc(a)||jh(a))return[[c,a]];if(s)return Wh(r,a,t,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:h,allowReserved:d}=o;return Wh(r,a,t,{style:u,explode:h,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof a=="string"?a:JSON.stringify(a);return[[c,l(u)]]}return[[c,l(a.toString())]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)&&a.every(u=>typeof u!="object")?[[c,a.map(l).join(",")]]:[[c,l(JSON.stringify(a))]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)?n==="multi"?[[c,a.map(l)]]:[[c,a.map(l).join(Px[n||"csv"])]]:[[c,""]]}function Wh(r,e,t,n){const i=n.style||"form",s=typeof n.explode>"u"?i==="form":n.explode,o=t?!1:n&&n.allowReserved?"unsafe":"reserved",a=c=>Ki(c,{escape:o}),l=t?c=>c:c=>Ki(c,{escape:o});return typeof e!="object"?[[l(r),a(e)]]:Array.isArray(e)?s?[[l(r),e.map(a)]]:[[l(r),e.map(a).join(Tx[i])]]:i==="deepObject"?Object.keys(e).map(c=>[l(`${r}[${c}]`),a(e[c])]):s?Object.keys(e).map(c=>[l(c),a(e[c])]):[[l(r),Object.keys(e).map(c=>[`${l(c)},${a(e[c])}`]).join(",")]]}function Mx(r){return Object.entries(r).reduce((e,t)=>{let[n,i]=t;for(const[s,o]of Vh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new ea([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new ea([o]);e.append(s,a)}else e.append(s,o);return e},new Bh)}function $h(r){const e=Object.keys(r).reduce((t,n)=>{for(const[i,s]of Vh(n,r[n]))t[i]=s;return t},{});return We().stringify(e,{encode:!1,indices:!1})||""}function Hh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{url:e="",query:t,form:n}=r,i=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const l=o.filter(c=>c).join("&");return l?`?${l}`:""};if(n){const s=Object.keys(n).some(a=>{const{value:l}=n[a];return fc(l)||jh(l)}),o=r.headers["content-type"]||r.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Mx(r.form);wx(a,r)}else r.body=$h(n);delete r.form}if(t){const[s,o]=e.split("?");let a="";if(o){const c=We().parse(o);Object.keys(t).forEach(h=>delete c[h]),a=We().stringify(c,{encode:!0})}const l=i(a,$h(t));r.url=s+l,delete r.query}return r}function JI(r,e,t){return t=t||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),uc.mergeInQueryOrForm(n),n=e(n),t(r(n)))}function Ix(r,e){function t(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack;for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];[this.message]=i,e&&e.apply(this,i)}return t.prototype=new Error,t.prototype.name=r,t.prototype.constructor=t,t}const Dx={body:Nx,header:Lx,query:Fx,path:Bx,formData:Rx};function Nx(r){let{req:e,value:t}=r;e.body=t}function Rx(r){let{req:e,value:t,parameter:n}=r;(t||n.allowEmptyValue)&&(e.form=e.form||{},e.form[n.name]={value:t,allowEmptyValue:n.allowEmptyValue,collectionFormat:n.collectionFormat})}function Lx(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{},typeof n<"u"&&(e.headers[t.name]=n)}function Bx(r){let{req:e,value:t,parameter:n}=r;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(t))}function Fx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},t===!1&&n.type==="boolean"&&(t="false"),t===0&&["number","integer"].indexOf(n.type)>-1&&(t="0"),t)e.query[n.name]={collectionFormat:n.collectionFormat,value:t};else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}function ta(r,e){return e.includes("application/json")?typeof r=="string"?r:JSON.stringify(r):r.toString()}function jx(r){let{req:e,value:t,parameter:n}=r;const{name:i,style:s,explode:o,content:a}=n;if(a){const c=Object.keys(a)[0];e.url=e.url.split(`{${i}}`).join(Ki(ta(t,c),{escape:!0}));return}const l=cc({key:n.name,value:t,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Vx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=ta(t,i);if(s)e.query[n.name]=s;else if(n.allowEmptyValue&&t!==void 0){const o=n.name;e.query[o]=e.query[o]||{},e.query[o].allowEmptyValue=!0}return}if(t===!1&&(t="false"),t===0&&(t="0"),t){const{style:i,explode:s,allowReserved:o}=n;e.query[n.name]={value:t,serializationOption:{style:i,explode:s,allowReserved:o}}}else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}const Wx=["accept","authorization","content-type"];function $x(r){let{req:e,parameter:t,value:n}=r;if(e.headers=e.headers||{},!(Wx.indexOf(t.name.toLowerCase())>-1)){if(t.content){const i=Object.keys(t.content)[0];e.headers[t.name]=ta(n,i);return}typeof n<"u"&&(e.headers[t.name]=cc({key:t.name,value:n,style:t.style||"simple",explode:typeof t.explode>"u"?!1:t.explode,escape:!1}))}}function Hx(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{};const i=typeof n;if(t.content){const s=Object.keys(t.content)[0];e.headers.Cookie=`${t.name}=${ta(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+cc({key:t.name,value:n,escape:!1,style:t.style||"form",explode:typeof t.explode>"u"?!1:t.explode})}}const zx=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Ux}=zx,zh=Ux;function Gx(r,e){const{operation:t,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=r;let{requestContentType:a}=r;e=Kx({request:e,securities:i,operation:t,spec:s});const l=t.requestBody||{},c=Object.keys(l.content||{}),u=a&&c.indexOf(a)>-1;if(n||o){if(a&&u)e.headers["Content-Type"]=a;else if(!a){const h=c[0];h&&(e.headers["Content-Type"]=h,a=h)}}else a&&u&&(e.headers["Content-Type"]=a);if(!r.responseContentType&&t.responses){const h=Object.entries(t.responses).filter(d=>{let[p,m]=d;const y=parseInt(p,10);return y>=200&&y<300&&ge(m.content)}).reduce((d,p)=>{let[,m]=p;return d.concat(Object.keys(m.content))},[]);h.length>0&&(e.headers.accept=h.join(", "))}if(n)if(a){if(c.indexOf(a)>-1)if(a==="application/x-www-form-urlencoded"||a==="multipart/form-data")if(typeof n=="object"){const h=(l.content[a]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:h[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function Kx(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={}}=t,a=n.security||i.security||[],l=o&&!!Object.keys(o).length,c=ue()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!l||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(u=>{Object.keys(u).forEach(h=>{const d=o[h],p=c[h];if(!d)return;const m=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=m),p.in==="header"&&(s.headers[p.name]=m),p.in==="cookie"&&(s.cookies[p.name]=m);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const w=m.username||"",A=m.password||"",T=zh(`${w}:${A}`);s.headers.Authorization=`Basic ${T}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${m}`)}else if(y==="oauth2"||y==="openIdConnect"){const w=d.token||{},A=p["x-tokenName"]||"access_token",T=w[A];let E=w.token_type;(!E||E.toLowerCase()==="bearer")&&(E="Bearer"),s.headers.Authorization=`${E} ${T}`}}})}),s)}function Yx(r,e){const{spec:t,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=r;if(e=Jx({request:e,securities:i,operation:n,spec:t}),e.body||e.form||a)s?e.headers["Content-Type"]=s:Array.isArray(n.consumes)?[e.headers["Content-Type"]]=n.consumes:Array.isArray(t.consumes)?[e.headers["Content-Type"]]=t.consumes:n.parameters&&n.parameters.filter(l=>l.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(l=>l.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const l=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,c=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(l||c)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function Jx(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={},specSecurity:a=[]}=t,l=n.security||a,c=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!c||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(h=>{Object.keys(h).forEach(d=>{const p=o[d];if(!p)return;const{token:m}=p,y=p.value||p,w=u[d],{type:A}=w,T=w["x-tokenName"]||"access_token",E=m&&m[T];let F=m&&m.token_type;if(p)if(A==="apiKey"){const I=w.in==="query"?"query":"headers";s[I]=s[I]||{},s[I][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const I=y.username||"",W=y.password||"";y.base64=zh(`${I}:${W}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&E&&(F=!F||F.toLowerCase()==="bearer"?"Bearer":F,s.headers.authorization=`${F} ${E}`)})}),s)}function Uh(r,e){return`${e.toLowerCase()}-${r}`}function Xx(r,e,t){if(!r||typeof r!="object"||!r.paths||typeof r.paths!="object")return null;const{paths:n}=r;for(const i in n)for(const s in n[i]){if(s.toUpperCase()==="PARAMETERS")continue;const o=n[i][s];if(!o||typeof o!="object")continue;const a={spec:r,pathName:i,method:s.toUpperCase(),operation:o},l=e(a);if(t&&l)return a}}function Qx(r,e){return Xx(r,e,!0)||null}const Gh=r=>r.replace(/\W/gi,"_");function Zx(r,e){let{v2OperationIdCompatibilityMode:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(t){let n=`${e.toLowerCase()}_${r}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return n=n||`${r.substring(1)}_${e}`,n.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${e.toLowerCase()}${Gh(r)}`}function _x(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{v2OperationIdCompatibilityMode:n}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return!r||typeof r!="object"?null:(r.operationId||"").replace(/\s/g,"").length?Gh(r.operationId):Zx(e,t,{v2OperationIdCompatibilityMode:n})}function qx(r,e){return!r||!r.paths?null:Qx(r,t=>{let{pathName:n,method:i,operation:s}=t;if(!s||typeof s!="object")return!1;const o=s.operationId,a=_x(s,n,i),l=Uh(n,i);return[a,l,o].some(c=>c&&c===e)})}const QI=r=>{try{const{swagger:e}=r;return e==="2.0"}catch{return!1}},ew=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},tw=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},Kh=r=>ew(r)||tw(r),rw=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Yh=r=>Array.isArray(r)?r:[],nw=Ix("OperationNotFoundError",function(e,t,n){this.originalError=n,Object.assign(this,t||{})}),iw=(r,e)=>e.filter(t=>t.name===r),sw=r=>{const e={};r.forEach(n=>{e[n.in]||(e[n.in]={}),e[n.in][n.name]=n});const t=[];return Object.keys(e).forEach(n=>{Object.keys(e[n]).forEach(i=>{t.push(e[n][i])})}),t},ow={buildRequest:lw};function aw(r){let{http:e,fetch:t,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=r,c=ie(r,rw);const u=e||t||Sx;s&&o&&!i&&(i=Uh(s,o));const h=ow.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(ge(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function lw(r){const{spec:e,operationId:t,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:a,userFetch:l,server:c,serverVariables:u,http:h,signal:d}=r;let{parameters:p,parameterBuilders:m}=r;const y=Kh(e);m||(y?m=g:m=Dx);let A={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(A.signal=d),s&&(A.requestInterceptor=s),o&&(A.responseInterceptor=o),l&&(A.userFetch=l);const T=qx(e,t);if(!T)throw new nw(`Operation ${t} not found`);const{operation:E={},method:F,pathName:I}=T;if(A.url+=cw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:I,method:F}),!t)return delete A.cookies,A;A.url+=I,A.method=`${F}`.toUpperCase(),p=p||{};const W=e.paths[I]||{};n&&(A.headers.accept=n);const j=sw([].concat(Yh(E.parameters)).concat(Yh(W.parameters)));j.forEach(B=>{const U=m[B.in];let G;if(B.in==="body"&&B.schema&&B.schema.properties&&(G=p),G=B&&B.name&&p[B.name],typeof G>"u"?G=B&&B.name&&p[`${B.in}.${B.name}`]:iw(B.name,j).length>1&&console.warn(`Parameter '${B.name}' is ambiguous because the defined spec has more than one parameter with the name: '${B.name}' and the passed-in parameter values did not define an 'in' value.`),G!==null){if(typeof B.default<"u"&&typeof G>"u"&&(G=B.default),typeof G>"u"&&B.required&&!B.allowEmptyValue)throw new Error(`Required parameter ${B.name} is not provided`);if(y&&B.schema&&B.schema.type==="object"&&typeof G=="string")try{G=JSON.parse(G)}catch{throw new Error("Could not parse object parameter value string as JSON")}U&&U({req:A,parameter:B,value:G,operation:E,spec:e})}});const Q=ee(ee({},r),{},{operation:E});if(y?A=Gx(Q,A):A=Yx(Q,A),A.cookies&&Object.keys(A.cookies).length){const B=Object.keys(A.cookies).reduce((U,G)=>{const re=A.cookies[G],ce=U?"&":"",he=Y.serialize(G,re);return U+ce+he},"");A.headers.Cookie=B}return A.cookies&&delete A.cookies,Hh(A),A}const hc=r=>r?r.replace(/\W/g,""):null;function cw(r){return Kh(r.spec)?uw(r):dw(r)}function uw(r){let{spec:e,pathName:t,method:n,server:i,contextUrl:s,serverVariables:o={}}=r;const a=ue()(e,["paths",t,(n||"").toLowerCase(),"servers"])||ue()(e,["paths",t,"servers"])||ue()(e,["servers"]);let l="",c=null;if(i&&a&&a.length){const u=a.map(h=>h.url);u.indexOf(i)>-1&&(l=i,c=a[u.indexOf(i)])}return!l&&a&&a.length&&(l=a[0].url,[c]=a),l.indexOf("{")>-1&&hw(l).forEach(h=>{if(c.variables&&c.variables[h]){const d=c.variables[h],p=o[h]||d.default,m=new RegExp(`{${h}}`,"g");l=l.replace(m,p)}}),fw(l,s)}function fw(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const t=r&&e?V.parse(V.resolve(e,r)):V.parse(r),n=V.parse(e),i=hc(t.protocol)||hc(n.protocol)||"",s=t.host||n.host,o=t.pathname||"";let a;return i&&s?a=`${i}://${s+o}`:a=o,a[a.length-1]==="/"?a.slice(0,-1):a}function hw(r){const e=[],t=/{([^}]+)}/g;let n;for(;n=t.exec(r);)e.push(n[1]);return e}function dw(r){let{spec:e,scheme:t,contextUrl:n=""}=r;const i=V.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=t||s||hc(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(52983),mt=f(20202),Hr=f(52886),vt=f(56618),pw=f(25358),gw=f(91643),mw=f(2526),vw=Object.defineProperty,yw=Object.defineProperties,bw=Object.getOwnPropertyDescriptors,Jh=Object.getOwnPropertySymbols,xw=Object.prototype.hasOwnProperty,ww=Object.prototype.propertyIsEnumerable,Xh=(r,e,t)=>e in r?vw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Sw=(r,e)=>{for(var t in e||(e={}))xw.call(e,t)&&Xh(r,t,e[t]);if(Jh)for(var t of Jh(e))ww.call(e,t)&&Xh(r,t,e[t]);return r},kw=(r,e)=>yw(r,bw(e)),Aw=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function Cw(r,e){return Aw(this,null,function*(){var t,n,i,s;const o=JSON.parse(JSON.stringify(e)),a=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},l=kw(Sw({},a),{components:o.components,paths:{[r.path]:{[r.httpVerb]:(n=(t=o.paths)==null?void 0:t[r.path])==null?void 0:n[r.httpVerb],parameters:(s=(i=o.paths)==null?void 0:i[r.path])==null?void 0:s.parameters}}}),c=new gw.Config({}),u=(0,mw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,pw.bundle)(h),o})}var Ow=f(98910),ra=f(84862),_r=f(53134),Qh=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Zh=Object.values(_r.FileUploadFormats),Ew=["application/octet-stream","application/pdf","application/gzip","application/zip"],_h=["image/","audio/","video/"];function qh(r){if(_h.some(e=>r.startsWith(e)))return r}function na(r){return Ew.includes(r)?!0:_h.some(e=>r.startsWith(e))}function Tw(r){const e=r.type==="array"?r.items:r;if(!e||!e.type||e?.type==="any")return!0;const t=e.contentMediaType||"",n=e.format||e.contentEncoding||(na(t)?"binary":"");return e.type===_r.DefinitionTypes.STRING&&Zh.includes(n)}function ed(r,e){if(!r||!r.type||r.type==="any")return na(e);const t=r.format||r.contentEncoding||"";return r.type===_r.DefinitionTypes.STRING&&Zh.includes(t)}function td(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{const s=n.result.replace(/data:.*\/.*;base64,/g,"");e(s)},n.onerror=()=>t(n.error),n.readAsDataURL(r)})}function rd({format:r,contentEncoding:e,contentMediaType:t}){return[r,e,t].includes(_r.FileUploadFormats.BASE64)}function Pw(r,e){return Qh(this,null,function*(){const t=Object.values(r);let n=t.length===1?t[0]:t;return e.type===_r.DefinitionTypes.STRING&&rd(e)?n=yield td(t[0]):e.type===_r.DefinitionTypes.ARRAY&&e.items&&(rd(e.items)?n=yield Promise.all(t.map(s=>Qh(this,null,function*(){return yield td(s)}))):n=t),n})}var dc=f(84622),Be=f(38612),Ye=f(95404),Oe=f(85739),Nr=f(71608),Mw=f(64393),$n=f(60991);function Iw({response:r}){const{jsonSampleExpandLevel:e}=(0,Hr.Dv)($n.qd);return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Body: "),Dw(r,e))}function Dw(r,e){return r.body?S.createElement(mt.JsonViewer,{data:r.body,jsonSampleExpandLevel:e}):r.fileInfo?S.createElement(Mw.s,{fileInfo:r.fileInfo}):r.data!==null?r.data?S.createElement(mt.CodeBlock,{lang:(0,Oe.M)(r.headers["Content-Type"]||"text/plain"),source:r.data,header:{controls:{copy:{}}}}):S.createElement(mt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Nw({headers:r}){const e=(0,Hr.Dv)($n.qd),[t,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(r),o=!!i&&s.length>i,a=o&&t?[...s].splice(0,i):[...s],l=()=>{n(!t)};return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Headers: "),S.createElement(mt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(nd,null,c,":"),S.createElement("code",null,r[c]))),o&&S.createElement(id,{onClick:l},t?"Show more...":"Hide headers")))}const nd=Ye.ZP.strong`
|
|
48
48
|
text-transform: capitalize;
|
|
49
49
|
display: inline-block;
|
|
50
50
|
padding-right: 5px;
|
|
51
|
-
`,
|
|
51
|
+
`,id=Ye.ZP.div`
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
margin-top: 5px;
|
|
54
54
|
font-size: 14px;
|
|
55
|
-
`;
|
|
55
|
+
`;nd.displayName="HeaderName",id.displayName="StyledShowMoreLabel";const Rw=Ye.ZP.div`
|
|
56
56
|
margin-bottom: 10px;
|
|
57
|
-
`,
|
|
57
|
+
`,pc=Ye.ZP.div`
|
|
58
58
|
display: inline-block;
|
|
59
59
|
margin-right: 20px;
|
|
60
60
|
padding: 2px 0;
|
|
61
61
|
text-align: center;
|
|
62
62
|
color: var(--text-primary);
|
|
63
|
-
`,
|
|
64
|
-
color: ${({code:
|
|
65
|
-
`,
|
|
63
|
+
`,Lw=(0,Ye.ZP)(pc)`
|
|
64
|
+
color: ${({code:r})=>r>=200&&r<300?"var(--response-success-text-color)":r>=300&&r<400?"var(--response-redirect-text-color)":r>400?"var(--response-error-text-color)":"var(--response-info-text-color)"};
|
|
65
|
+
`,sd=Ye.ZP.header`
|
|
66
66
|
font-weight: bold;
|
|
67
67
|
margin-bottom: 10px;
|
|
68
|
-
`,
|
|
68
|
+
`,Bw=Ye.ZP.code`
|
|
69
69
|
border-left: 3px solid #ff4040;
|
|
70
70
|
padding-left: 5px;
|
|
71
|
-
`,
|
|
71
|
+
`,Fw=({error:r,response:e,time:t})=>{const n=e||r&&r.response,i=n&&n.data&&n.data.length||0;let s;return i>1e6?s=(i/1e6).toFixed(2)+" MB":i>1e3?s=(i/1e3).toFixed(2)+" KB":s=i+" B",r&&!r.response||!n?S.createElement(S.Fragment,null,S.createElement(sd,null," Could not get any response "),S.createElement(Bw,null,r&&r.message||"Unknown error"),S.createElement("br",null),S.createElement(sd,null," Why this might have happened:"),S.createElement("div",null," - CORS is misconfigured on the server"),S.createElement("div",null," - The server couldn't send a response"),S.createElement("div",null," - No internet access"),S.createElement("div",null," - Documentation issue - contact API owner"),S.createElement("div",null," - Misconfigured security definition")):n?S.createElement(S.Fragment,null,S.createElement(Rw,null,S.createElement(Lw,{code:n.status},S.createElement("span",null," Status: "),n.status," ",n.statusText),S.createElement(pc,null,S.createElement("span",null," Time: "),t,"ms"),S.createElement(pc,null,S.createElement("span",null," Size: "),s)),S.createElement("div",null,S.createElement(Nw,{headers:n.headers}),S.createElement(Iw,{response:n}))):S.createElement(S.Fragment,null,"Something went wrong")},jw=Ye.ZP.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
button {
|
|
75
75
|
margin: 0;
|
|
76
76
|
}
|
|
77
|
-
`,
|
|
77
|
+
`,od=Ye.ZP.button`
|
|
78
78
|
outline: none;
|
|
79
79
|
border: none;
|
|
80
80
|
background-color: var(--panel-try-it-tabs-background-color);
|
|
@@ -94,63 +94,63 @@
|
|
|
94
94
|
color: var(--panel-try-it-tabs-hover-text-color);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
${({active:
|
|
97
|
+
${({active:r})=>r&&(0,Ye.iv)`
|
|
98
98
|
background-color: var(--panel-try-it-tabs-active-background-color);
|
|
99
99
|
color: var(--panel-try-it-tabs-active-text-color);
|
|
100
100
|
`||""}
|
|
101
101
|
|
|
102
|
-
${({disabled:
|
|
102
|
+
${({disabled:r})=>r&&(0,Ye.iv)`
|
|
103
103
|
cursor: default;
|
|
104
104
|
background-color: var(--panel-try-it-tabs-disabled-background-color);
|
|
105
105
|
color: var(--panel-try-it-tabs-disabled-text-color);
|
|
106
106
|
`||""}
|
|
107
|
-
`;function
|
|
107
|
+
`;function Vw({onChange:r,active:e,hasResponse:t}){return S.createElement(jw,null,S.createElement(od,{onClick:()=>r(0),active:e===0},t?"Edit Request":"Request"),S.createElement(od,{onClick:()=>t&&r(1),active:e===1,disabled:!t}," ","Response"," "))}var gc=f(82155),ad=f(79198);function Ww(r,e,t){const n=e.path||{},i=e.query||{},s=Object.keys(i);let o=(0,Be.v5)(r,n);const a=l=>t.find(c=>c.name===l&&c.in==="query");return s.length&&(o+="?"+s.map(l=>{if(!i[l])return"";const c=a(l);return c?(0,Oe.d$)(c,i[l]):`${l}=${encodeURIComponent(i[l])}`}).filter(Boolean).join("&")),o}const $w=({loading:r,operation:e,hasResponse:t,onSubmit:n,params:i={}})=>S.createElement(ra.k1,null,S.createElement(gc.__,null,S.createElement(ad.FH,{color:e.httpVerb},e.httpVerb),S.createElement(gc.y$,{wrap:"true"},Ww(e.path,i,e.parameters))),S.createElement(Hw,{"data-cy":"send-button",color:"primary",type:"submit",blinking:r,onClick:()=>!r&&n()},r?"Sending...":t?"Resend":"Send")),Hw=(0,Ye.ZP)(gc.ev)`
|
|
108
108
|
width: var(--panel-try-it-action-button-width);
|
|
109
|
-
|
|
109
|
+
`,zw=(0,S.memo)($w);var mi=f(26225),Uw=Object.defineProperty,Gw=Object.defineProperties,Kw=Object.getOwnPropertyDescriptors,ld=Object.getOwnPropertySymbols,Yw=Object.prototype.hasOwnProperty,Jw=Object.prototype.propertyIsEnumerable,cd=(r,e,t)=>e in r?Uw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,js=(r,e)=>{for(var t in e||(e={}))Yw.call(e,t)&&cd(r,t,e[t]);if(ld)for(var t of ld(e))Jw.call(e,t)&&cd(r,t,e[t]);return r},Xw=(r,e)=>Gw(r,Kw(e)),ia=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const ud="/oauth2-redirect.html";class zr{static authorizeImplicit({authorizationUrl:e,clientId:t,scopes:n,extraParams:i={},routingBasePath:s,redirectUri:o,successCallback:a,errorCallback:l}){const c=(0,mi.p8)({date:new Date().toString()}),u=new URL(e),h=s==="/"?"":s,d=`${window.location.origin}${h}${ud}`;u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",o||d),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(n)&&u.searchParams.set("scope",n.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:t,scopes:n},state:c,successCallback:p=>{a(p),zr.clearRedirectData("implicit")},errorCallback:p=>{l(p),zr.clearRedirectData("implicit")}},window.open(u.toString())}static authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:t,clientId:n,clientSecret:i,codeVerifier:s,codeChallenge:o,scopes:a,extraParams:l={},extraHeaders:c={},routingBasePath:u,redirectUri:h,successCallback:d,errorCallback:p}){const m=new URL(e),y=u==="/"?"":u,w=`${window.location.origin}${y}${ud}`,A=(0,mi.p8)({date:new Date().toString()});m.searchParams.set("client_id",n),m.searchParams.set("redirect_uri",h||w),m.searchParams.set("response_type","code"),m.searchParams.set("state",A),Array.isArray(a)&&m.searchParams.set("scope",a.join(" ")),o&&(m.searchParams.set("code_challenge",o),m.searchParams.set("code_challenge_method","S256"));for(const T in l)m.searchParams.set(T,l[T]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:n,scopes:a},state:A,successCallback:T=>ia(this,[T],function*({auth_code:E}){try{const F=yield fetch(t,{method:"POST",headers:js({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},c),body:Oe.uM.stringify(js(Xw(js({client_id:n,client_secret:i},s&&{code_verifier:s}),{code:E,grant_type:"authorization_code",redirect_uri:h||w}),l))});yield fd(F,d,p)}catch(F){p(F)}zr.clearRedirectData("authorizationCode")}),errorCallback:T=>{p(T),zr.clearRedirectData("authorizationCode")}},window.open(m.toString())}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static authorizeClientCredentials(e){return ia(this,arguments,function*({tokenUrl:t,clientId:n,clientSecret:i,scopes:s=[],extraParams:o={},extraHeaders:a={},successCallback:l,errorCallback:c}){try{const u=JSON.parse(JSON.stringify(js({client_id:n,client_secret:i,grant_type:"client_credentials",scope:Array.isArray(s)&&s.length?s.join(" "):void 0},o))),h=yield fetch(t,{method:"POST",headers:js({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},a),body:Oe.uM.stringify(u)});yield fd(h,l,c)}catch(u){c(u)}})}}const ZI=new zr;function fd(r,e,t){return ia(this,null,function*(){if(r.ok){const n=yield r.json();e(n)}else t(new Error((r.headers.get("Content-Type")||"").indexOf("json")>-1?JSON.stringify(yield r.json()):yield r.text()))})}function hd(r){return ia(this,null,function*(){return(0,mi.rS)(yield(0,mi.JQ)(r))})}var Vs=f(95709),ye=f(9612),Qw=f(39012),st=f(54597);function Zw({name:r,value:e,description:t,variableEnum:n,onChange:i,defaultValue:s}){const o=(0,S.useCallback)(c=>i(c.target.value),[i]),a=(0,S.useCallback)(c=>i(c.value),[i]),l=n?n.map((c,u)=>({value:c,idx:u})):[];return S.createElement(ye.NI,null,S.createElement(ye.lX,null,r,":"),l&&l.length?S.createElement(Nr.VD,{fullWidth:!0,variant:"dark",value:e,options:l,onChange:a}):S.createElement(st.nv,{fullWidth:!0,value:e,onChange:o,placeholder:s,panel:"try-it"}),t&&S.createElement(_w,{source:t}))}const _w=(0,Ye.ZP)(Qw.Markdown)`
|
|
110
110
|
margin-top: 5px;
|
|
111
111
|
color: #d0d0d0;
|
|
112
|
-
`;var
|
|
112
|
+
`;var qw=Object.defineProperty,eS=Object.defineProperties,tS=Object.getOwnPropertyDescriptors,dd=Object.getOwnPropertySymbols,rS=Object.prototype.hasOwnProperty,nS=Object.prototype.propertyIsEnumerable,pd=(r,e,t)=>e in r?qw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,gd=(r,e)=>{for(var t in e||(e={}))rS.call(e,t)&&pd(r,t,e[t]);if(dd)for(var t of dd(e))nS.call(e,t)&&pd(r,t,e[t]);return r},md=(r,e)=>eS(r,tS(e));function iS({operation:r,onChange:e}){var t;const{control:n,watch:i}=(0,vt.Gc)(),{events:s}=(0,Hr.Dv)($n.qd),{servers:o}=r,a=i("server");(0,mt.useMount)(()=>{const d=(0,Oe.YQ)("serverUrl"),p=o.findIndex(y=>y.url===d),m=(0,Be.fz)(o,p<0?0:p);e(m)});const l=(0,S.useCallback)(({serverUrl:d=""})=>{var p;const m=o.find(A=>A.url===d),y=(0,Be.mj)(m);e({url:d,variables:y}),(0,Oe.WW)("serverUrl",d);const w=(0,dc.Ze)({operation:r,serverUrl:d});(p=s.targetServerSwitch)==null||p.call(s,w)},[e,s,r,o]),c=(d,p)=>{const m=p||p===""?p:(0,Be.mj)(a)[d],y=md(gd({},a.variables),{[d]:m});(0,Be.UY)(d,m),e(md(gd({},a),{variables:y}))},u=(0,S.useMemo)(()=>o.map((d,p)=>({idx:p,serverUrl:d.url,value:`
|
|
113
113
|
${(0,Be.nq)((0,Be.v5)(d.url,d.variables),d.variables)}
|
|
114
114
|
- ${(0,Oe.bG)(d.description)||"Default"}
|
|
115
|
-
`})),[o]),h=Object.keys(((
|
|
115
|
+
`})),[o]),h=Object.keys(((t=o.find(({url:d})=>d===a?.url))==null?void 0:t.variables)||{});return S.createElement(oS,{"data-cy":"console-target-server"},S.createElement(ye.lX,{htmlFor:"server"},"Target server: "),S.createElement(ye.NI,null,S.createElement(vt.Qr,{control:n,name:"server",render:({field:{value:d}})=>{var p;const m=(p=u.find(({serverUrl:y})=>y===d?.url))==null?void 0:p.value;return S.createElement(Nr.VD,{variant:"dark",value:m,options:u,fullWidth:!0,onChange:l})}})),h?.map(d=>{var p;const m=(p=a?.variables)==null?void 0:p[d];return S.createElement(Zw,{key:d,name:d,value:a.variables[d],defaultValue:m.default,onChange:y=>c(d,y),variableEnum:m.enum,description:m.description})}))}const sS=(0,S.memo)(iS),oS=Ye.ZP.div`
|
|
116
116
|
margin-bottom: 20px;
|
|
117
|
-
`;var
|
|
117
|
+
`;var vd=f(86220),aS=Object.defineProperty,lS=Object.defineProperties,cS=Object.getOwnPropertyDescriptors,sa=Object.getOwnPropertySymbols,yd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,xd=(r,e,t)=>e in r?aS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,uS=(r,e)=>{for(var t in e||(e={}))yd.call(e,t)&&xd(r,t,e[t]);if(sa)for(var t of sa(e))bd.call(e,t)&&xd(r,t,e[t]);return r},fS=(r,e)=>lS(r,cS(e)),hS=(r,e)=>{var t={};for(var n in r)yd.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&sa)for(var n of sa(r))e.indexOf(n)<0&&bd.call(r,n)&&(t[n]=r[n]);return t};function mc(r){var e=r,{header:t,error:n,success:i}=e,s=hS(e,["header","error","success"]);const o=({toggle:a,expanded:l=!1})=>S.createElement(mt.PanelHeader,{onClick:a,expanded:l,"data-cy":s["data-cy"]},S.createElement(ra.xz,null,S.createElement(mt.PanelHeaderTitle,null,t),S.createElement(mt.ShelfIcon,{direction:l?"down":"right"})),n&&S.createElement(vd.CrossIcon,{size:"14px",color:"--color-error"})||null,i&&S.createElement(vd.LockIcon,{size:"14px",color:"--color-success"})||null);return S.createElement(dS,fS(uS({className:"panel-try-it-nested"},s),{header:o}))}const dS=(0,Ye.ZP)(mt.Panel)`
|
|
118
118
|
${mt.PanelHeader} {
|
|
119
119
|
border: 1px solid
|
|
120
|
-
${({error:
|
|
120
|
+
${({error:r})=>r?"var(--color-error-border)":"var(--panel-try-it-nested-heading-border-color)"};
|
|
121
121
|
padding: 10px;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
${mt.PanelBody} {
|
|
125
125
|
border: 1px solid
|
|
126
|
-
${({error:
|
|
126
|
+
${({error:r})=>r?"var(--color-error-border)":"var(--panel-try-it-nested-body-border-color)"};
|
|
127
127
|
border-top: 0;
|
|
128
128
|
}
|
|
129
|
-
`;var
|
|
129
|
+
`;var pS=f(4296),gS=f(62701),mS=f(18373);const vS=(0,Ye.ZP)(ad.A3)`
|
|
130
130
|
border-radius: var(--panel-border-radius);
|
|
131
131
|
margin-bottom: 10px;
|
|
132
|
-
`;var
|
|
132
|
+
`;var oa=f(42112),vc=f(34716),yS=f(69852),bS=Object.defineProperty,xS=Object.defineProperties,wS=Object.getOwnPropertyDescriptors,wd=Object.getOwnPropertySymbols,SS=Object.prototype.hasOwnProperty,kS=Object.prototype.propertyIsEnumerable,Sd=(r,e,t)=>e in r?bS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,AS=(r,e)=>{for(var t in e||(e={}))SS.call(e,t)&&Sd(r,t,e[t]);if(wd)for(var t of wd(e))kS.call(e,t)&&Sd(r,t,e[t]);return r},CS=(r,e)=>xS(r,wS(e)),OS=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const kd=(0,S.forwardRef)(({schema:r,contentName:e,onChange:t,fieldName:n,className:i,accept:s,multiple:o},a)=>{const{register:l}=(0,vt.Gc)(),c=u=>OS(void 0,null,function*(){const h=yield Pw(u.target.files,r);t(e,h)});return S.createElement("input",CS(AS({},l(n)),{"data-cy":"file-upload-input",type:"file",id:n,className:i,name:n,onChange:c,multiple:o,accept:s,ref:a}))});kd.displayName="FileUpload";var yc=f(21156);function ES({mediaType:r,onChange:e}){var t;const{setValue:n}=(0,vt.Gc)(),i=r.examples||{},{exampleKey:s}=(0,vc.C6)(r.operation,i),o=(t=i[s])==null?void 0:t.rawValue,a=PS(r);(0,S.useEffect)(()=>n&&a.forEach(c=>{var u,h;const d=o?.[c.name],p=(h=(u=c.example)!=null?u:d?.example)!=null?h:d,m=typeof p=="object"?JSON.stringify(p):p;p!==void 0&&n("body."+c.name,`${m}`)}),[s]);const l=r.schema||{};return ed(l,r.name)?S.createElement(Ad,null,S.createElement(ye.NI,null,S.createElement(Cd,{fullWidth:!0,fieldName:`body.${r.name}`,accept:qh(r.name),schema:l,contentName:r.name,onChange:e}))):l.type!==_r.DefinitionTypes.OBJECT&&!a?(console.warn(`Invalid schema for request body and mime type: "${r.name}"`,l),null):S.createElement(Ad,null,a.map(c=>{const u=c.schema||{contentMediaType:"",type:"",description:""},h=r.name===oa.Tr.MULTIPART&&Tw(u),d=u.contentMediaType||"",p=h?S.createElement(Cd,{fullWidth:!0,fieldName:"body."+c.name,accept:qh(d),multiple:u.type==="array",schema:u,contentName:c.name,onChange:e}):S.createElement(st.Xn,{fullWidth:!0,id:"body."+c.name,fieldName:"body."+c.name,placeholder:(0,Oe.bG)(u.description)||c.name,panel:"try-it"});return S.createElement(ye.NI,{key:c.name},S.createElement(ye.lX,null,c.name,":"),p)}))}const TS=(0,S.memo)(ES);function PS(r){var e,t,n,i,s,o;const{activeOneOf:a}=(0,yS.Sb)((0,yc.N)(r.operation.pointer)),l=(t=a[((e=r.schema)==null?void 0:e.pointer)||""])!=null?t:0;return((i=(n=r.schema)==null?void 0:n.oneOf)!=null&&i.length?((s=r.schema)==null?void 0:s.oneOf[l].fields)||[]:((o=r.schema)==null?void 0:o.fields)||[]).filter(c=>!c.schema.readOnly)}const Ad=Ye.ZP.div`
|
|
133
133
|
> div {
|
|
134
134
|
margin-top: 10px;
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
136
|
+
`,Cd=(0,Ye.ZP)(kd)`
|
|
137
137
|
${(0,st.Hu)("try-it")};
|
|
138
|
-
${({inputType:
|
|
139
|
-
${({fullWidth:
|
|
140
|
-
`,Sd=1024;let TS=0;class Rr{constructor(e,r){this.from=e,this.to=r}}class Re{constructor(e={}){this.id=TS++,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=nr.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}Re.closedBy=new Re({deserialize:t=>t.split(" ")}),Re.openedBy=new Re({deserialize:t=>t.split(" ")}),Re.group=new Re({deserialize:t=>t.split(" ")}),Re.contextHash=new Re({perNode:!0}),Re.lookAhead=new Re({perNode:!0}),Re.mounted=new Re({perNode:!0});class Vs{constructor(e,r,n){this.tree=e,this.overlay=r,this.parser=n}static get(e){return e&&e.props&&e.props[Re.mounted.id]}}const PS=Object.create(null);class nr{constructor(e,r,n,i=0){this.name=e,this.props=r,this.id=n,this.flags=i}static define(e){let r=e.props&&e.props.length?Object.create(null):PS,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new nr(e.name||"",r,e.id,n);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");r[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 r=this.prop(Re.group);return r?r.indexOf(e)>-1:!1}return this.id==e}static match(e){let r=Object.create(null);for(let n in e)for(let i of n.split(" "))r[i]=e[n];return n=>{for(let i=n.prop(Re.group),s=-1;s<(i?i.length:0);s++){let o=r[s<0?n.name:i[s]];if(o)return o}}}}nr.none=new nr("",Object.create(null),0,8);class oa{constructor(e){this.types=e;for(let r=0;r<e.length;r++)if(e[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let r=[];for(let n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}r.push(i?new nr(n.name,i,n.id,n.flags):n)}return new oa(r)}}const aa=new WeakMap,kd=new WeakMap;var ot;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(ot||(ot={}));class ut{constructor(e,r,n,i,s){if(this.type=e,this.children=r,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Vs.get(this);if(e&&!e.overlay)return e.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(e=0){return new la(this.topNode,e)}cursorAt(e,r=0,n=0){let i=aa.get(this)||this.topNode,s=new la(i);return s.moveTo(e,r),aa.set(this,s._tree),s}get topNode(){return new Gt(this,0,0,null)}resolve(e,r=0){let n=Ws(aa.get(this)||this.topNode,e,r,!1);return aa.set(this,n),n}resolveInner(e,r=0){let n=Ws(kd.get(this)||this.topNode,e,r,!0);return kd.set(this,n),n}resolveStack(e,r=0){return DS(this,e,r)}iterate(e){let{enter:r,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&ot.IncludeAnonymous)>0;for(let l=this.cursor(o|ot.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;c=!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 r in this.props)e.push([+r,this.props[r]]);return e}balance(e={}){return this.children.length<=8?this:yc(nr.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ut(this.type,r,n,i,this.propValues),e.makeTree||((r,n,i)=>new ut(nr.none,r,n,i)))}static build(e){return NS(e)}}ut.empty=new ut(nr.none,[],[],0);class gc{constructor(e,r){this.buffer=e,this.index=r}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 gc(this.buffer,this.index)}}class Hn{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return nr.none}toString(){let e=[];for(let r=0;r<this.buffer.length;)e.push(this.childString(r)),r=this.buffer[r+3];return e.join(",")}childString(e){let r=this.buffer[e],n=this.buffer[e+3],i=this.set.types[r],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,r,n,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=r&&!(Ad(s,i,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,r,n){let i=this.buffer,s=new Uint16Array(r-e),o=0;for(let a=e,l=0;a<r;){s[l++]=i[a++],s[l++]=i[a++]-n;let c=s[l++]=i[a++]-n;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Hn(s,o,this.set)}}function Ad(t,e,r,n){switch(t){case-2:return r<e;case-1:return n>=e&&r<e;case 0:return r<e&&n>e;case 1:return r<=e&&n>e;case 2:return n>e;case 4:return!0}}function Ws(t,e,r,n){for(var i;t.from==t.to||(r<1?t.from>=e:t.from>e)||(r>-1?t.to<=e:t.to<e);){let o=!n&&t instanceof Gt&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=n?0:ot.IgnoreOverlays;if(n)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Gt&&o.index<0&&((i=a.enter(e,r,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,r,s);if(!o)return t;t=o}}class Cd{cursor(e=0){return new la(this,e)}getChild(e,r=null,n=null){let i=Od(this,e,r,n);return i.length?i[0]:null}getChildren(e,r=null,n=null){return Od(this,e,r,n)}resolve(e,r=0){return Ws(this,e,r,!1)}resolveInner(e,r=0){return Ws(this,e,r,!0)}matchContext(e){return mc(this,e)}enterUnfinishedNodesBefore(e){let r=this.childBefore(e),n=this;for(;r;){let i=r.lastChild;if(!i||i.to!=r.to)break;i.type.isError&&i.from==i.to?(n=r,r=i.prevSibling):r=i}return n}get node(){return this}get next(){return this.parent}}class Gt extends Cd{constructor(e,r,n,i){super(),this._tree=e,this.from=r,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,r,n,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=r>0?a.length:-1;e!=c;e+=r){let u=a[e],h=l[e]+o.from;if(Ad(i,n,h,h+u.length)){if(u instanceof Hn){if(s&ot.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,r,n-h,i);if(d>-1)return new qr(new MS(o,u,e,h),null,d)}else if(s&ot.IncludeAnonymous||!u.type.isAnonymous||vc(u)){let d;if(!(s&ot.IgnoreMounts)&&(d=Vs.get(u))&&!d.overlay)return new Gt(d.tree,h,e,o);let p=new Gt(u,h,e,o);return s&ot.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?u.children.length-1:0,r,n,i)}}}if(s&ot.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+r:e=r<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,r,n=0){let i;if(!(n&ot.IgnoreOverlays)&&(i=Vs.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((r>0?o<=s:o<s)&&(r<0?a>=s:a>s))return new Gt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,r,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Od(t,e,r,n){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function mc(t,e,r=e.length-1){for(let n=t.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}class MS{constructor(e,r,n,i){this.parent=e,this.buffer=r,this.index=n,this.start=i}}class qr extends Cd{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,r,n){super(),this.context=e,this._parent=r,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,r,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.context.start,n);return s<0?null:new qr(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,r,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,e-this.context.start,r);return s<0?null:new qr(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,r=e.buffer[this.index+3];return r<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new qr(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new qr(this.context,this._parent,e.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],r=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),r.push(0)}return new ut(this.type,e,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Ed(t){if(!t.length)return null;let e=0,r=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>r.from||o.to<r.to)&&(r=o,e=s)}let n=r instanceof Gt&&r.index<0?null:r.parent,i=t.slice();return n?i[e]=n:i.splice(e,1),new IS(i,r)}class IS{constructor(e,r){this.heads=e,this.node=r}get next(){return Ed(this.heads)}}function DS(t,e,r){let n=t.resolveInner(e,r),i=null;for(let s=n instanceof Gt?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,r)),s=o}else{let o=Vs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Gt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(Ws(a,e,r,!1))}}return i?Ed(i):n}class la{get name(){return this.type.name}constructor(e,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Gt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,r){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof Gt?(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,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,r,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.buffer.start,n);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,r,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let r,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:r,parent:n}=i)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let s=r+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&ot.IncludeAnonymous||a instanceof Hn||!a.type.isAnonymous||vc(a))return!1}return!0}move(e,r){if(r&&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,r=0){for(;(this.from==this.to||(r<1?this.from>=e:this.from>e)||(r>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,r););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,r=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)r=new qr(this.buffer,r,this.stack[i]);return this.bufferNode=new qr(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,r){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&r&&r(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return mc(this.node,e);let{buffer:r}=this.buffer,{types:n}=r.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return mc(this.node,e,i);let o=n[r.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function vc(t){return t.children.some(e=>e instanceof Hn||!e.type.isAnonymous||vc(e))}function NS(t){var e;let{buffer:r,nodeSet:n,maxBufferLength:i=Sd,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(r)?new gc(r,r.length):r,l=n.types,c=0,u=0;function h(I,W,F,_,j,U){let{id:Y,start:re,end:ce,size:he}=a,xe=u;for(;he<0;)if(a.next(),he==-1){let Ie=s[Y];F.push(Ie),_.push(re-I);return}else if(he==-3){c=Y;return}else if(he==-4){u=Y;return}else throw new RangeError(`Unrecognized record size: ${he}`);let Fe=l[Y],we,Ee,Ue=re-I;if(ce-re<=i&&(Ee=w(a.pos-W,j))){let Ie=new Uint16Array(Ee.size-Ee.skip),nt=a.pos-Ee.size,dt=Ie.length;for(;a.pos>nt;)dt=A(Ee.start,Ie,dt);we=new Hn(Ie,ce-Ee.start,n),Ue=Ee.start-I}else{let Ie=a.pos-he;a.next();let nt=[],dt=[],Bt=Y>=o?Y:-1,er=0,Tr=ce;for(;a.pos>Ie;)Bt>=0&&a.id==Bt&&a.size>=0?(a.end<=Tr-i&&(m(nt,dt,re,er,a.end,Tr,Bt,xe),er=nt.length,Tr=a.end),a.next()):U>2500?d(re,Ie,nt,dt):h(re,Ie,nt,dt,Bt,U+1);if(Bt>=0&&er>0&&er<nt.length&&m(nt,dt,re,er,re,Tr,Bt,xe),nt.reverse(),dt.reverse(),Bt>-1&&er>0){let Ct=p(Fe);we=yc(Fe,nt,dt,0,nt.length,0,ce-re,Ct,Ct)}else we=y(Fe,nt,dt,ce-re,xe-ce)}F.push(we),_.push(Ue)}function d(I,W,F,_){let j=[],U=0,Y=-1;for(;a.pos>W;){let{id:re,start:ce,end:he,size:xe}=a;if(xe>4)a.next();else{if(Y>-1&&ce<Y)break;Y<0&&(Y=he-i),j.push(re,ce,he),U++,a.next()}}if(U){let re=new Uint16Array(U*4),ce=j[j.length-2];for(let he=j.length-3,xe=0;he>=0;he-=3)re[xe++]=j[he],re[xe++]=j[he+1]-ce,re[xe++]=j[he+2]-ce,re[xe++]=xe;F.push(new Hn(re,j[2]-ce,n)),_.push(ce-I)}}function p(I){return(W,F,_)=>{let j=0,U=W.length-1,Y,re;if(U>=0&&(Y=W[U])instanceof ut){if(!U&&Y.type==I&&Y.length==_)return Y;(re=Y.prop(Re.lookAhead))&&(j=F[U]+Y.length+re)}return y(I,W,F,_,j)}}function m(I,W,F,_,j,U,Y,re){let ce=[],he=[];for(;I.length>_;)ce.push(I.pop()),he.push(W.pop()+F-j);I.push(y(n.types[Y],ce,he,U-j,re-U)),W.push(j-F)}function y(I,W,F,_,j=0,U){if(c){let Y=[Re.contextHash,c];U=U?[Y].concat(U):[Y]}if(j>25){let Y=[Re.lookAhead,j];U=U?[Y].concat(U):[Y]}return new ut(I,W,F,_,U)}function w(I,W){let F=a.fork(),_=0,j=0,U=0,Y=F.end-i,re={size:0,start:0,skip:0};e:for(let ce=F.pos-I;F.pos>ce;){let he=F.size;if(F.id==W&&he>=0){re.size=_,re.start=j,re.skip=U,U+=4,_+=4,F.next();continue}let xe=F.pos-he;if(he<0||xe<ce||F.start<Y)break;let Fe=F.id>=o?4:0,we=F.start;for(F.next();F.pos>xe;){if(F.size<0)if(F.size==-3)Fe+=4;else break e;else F.id>=o&&(Fe+=4);F.next()}j=we,_+=he,U+=Fe}return(W<0||_==I)&&(re.size=_,re.start=j,re.skip=U),re.size>4?re:void 0}function A(I,W,F){let{id:_,start:j,end:U,size:Y}=a;if(a.next(),Y>=0&&_<o){let re=F;if(Y>4){let ce=a.pos-(Y-4);for(;a.pos>ce;)F=A(I,W,F)}W[--F]=re,W[--F]=U-I,W[--F]=j-I,W[--F]=_}else Y==-3?c=_:Y==-4&&(u=_);return F}let T=[],E=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,T,E,-1,0);let B=(e=t.length)!==null&&e!==void 0?e:T.length?E[0]+T[0].length:0;return new ut(l[t.topID],T.reverse(),E.reverse(),B)}const Td=new WeakMap;function ca(t,e){if(!t.isAnonymous||e instanceof Hn||e.type!=t)return 1;let r=Td.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=t||!(n instanceof ut)){r=1;break}r+=ca(t,n)}Td.set(e,r)}return r}function yc(t,e,r,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=ca(t,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let E=w;E<A;){let B=E,I=y[E],W=ca(t,m[E]);for(E++;E<A;E++){let F=ca(t,m[E]);if(W+F>=u)break;W+=F}if(E==B+1){if(W>u){let F=m[B];p(F.children,F.positions,0,F.children.length,y[B]+T);continue}h.push(m[B])}else{let F=y[E-1]+m[E-1].length-I;h.push(yc(t,m,y,B,E,I,F,null,l))}d.push(I+T-s)}}return p(e,r,n,i,0),(a||l)(h,d,o)}class XI{constructor(){this.map=new WeakMap}setBuffer(e,r,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(r,n)}getBuffer(e,r){let n=this.map.get(e);return n&&n.get(r)}set(e,r){e instanceof qr?this.setBuffer(e.context.buffer,e.index,r):e instanceof Gt&&this.map.set(e.tree,r)}get(e){return e instanceof qr?this.getBuffer(e.context.buffer,e.index):e instanceof Gt?this.map.get(e.tree):void 0}cursorSet(e,r){e.buffer?this.setBuffer(e.buffer.buffer,e.index,r):this.map.set(e.tree,r)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class An{constructor(e,r,n,i,s=!1,o=!1){this.from=e,this.to=r,this.tree=n,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,r=[],n=!1){let i=[new An(0,e.length,e,0,!1,n)];for(let s of r)s.to>e.length&&i.push(s);return i}static applyChanges(e,r,n=128){if(!r.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<r.length?r[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,h)-c;d=p>=m?null:new An(p,m,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class Pd{startParse(e,r,n){return typeof e=="string"&&(e=new RS(e)),n=n?n.length?n.map(i=>new Rr(i.from,i.to)):[new Rr(0,0)]:[new Rr(0,e.length)],this.createParse(e,r||[],n)}parse(e,r,n){let i=this.startParse(e,r,n);for(;;){let s=i.advance();if(s)return s}}}class RS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,r){return this.string.slice(e,r)}}function ZI(t){return(e,r,n,i)=>new BS(e,t,r,n,i)}class Md{constructor(e,r,n,i,s){this.parser=e,this.parse=r,this.overlay=n,this.target=i,this.from=s}}function Id(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class LS{constructor(e,r,n,i,s,o,a){this.parser=e,this.predicate=r,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const bc=new Re({perNode:!0});class BS{constructor(e,r,n,i,s){this.nest=r,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new ut(n.type,n.children,n.positions,n.length,n.propValues.concat([[bc,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],r=e.parse.advance();if(r){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Re.mounted.id]=new Vs(r,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].from<e&&(e=Math.min(e,this.inner[r].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(e)}startInner(){let e=new VS(this.fragments),r=null,n=null,i=new la(new Gt(this.baseTree,this.ranges[0].from,0,null),ot.IncludeAnonymous|ot.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(r){let c=r.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!r.ranges.some(p=>p.from<d&&p.to>h)&&r.ranges.push({from:h,to:d})}}a=!1}else if(n&&(o=FS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||jS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")r=new LS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,r);else{let u=Rd(this.ranges,s.overlay||(i.from<i.to?[new Rr(i.from,i.to)]:[]));u.length&&Id(u),(u.length||!s.overlay)&&this.inner.push(new Md(s.parser,u.length?s.parser.startParse(this.input,Ld(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new Rr(h.from-i.from,h.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else r&&(l=r.predicate(i))&&(l===!0&&(l=new Rr(i.from,i.to)),l.from<l.to&&r.ranges.push(l));if(a&&i.firstChild())r&&r.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(r&&!--r.depth){let c=Rd(this.ranges,r.ranges);c.length&&(Id(c),this.inner.splice(r.index,0,new Md(r.parser,r.parser.startParse(this.input,Ld(r.mounts,c),c),r.ranges.map(u=>new Rr(u.from-r.start,u.to-r.start)),r.target,c[0].from))),r=r.prev}n&&!--n.depth&&(n=n.prev)}}}}function FS(t,e,r){for(let n of t){if(n.from>=r)break;if(n.to>e)return n.from<=e&&n.to>=r?2:1}return 0}function Dd(t,e,r,n,i,s){if(e<r){let o=t.buffer[e+1];n.push(t.slice(e,r,o)),i.push(o-s)}}function jS(t){let{node:e}=t,r=[];do r.push(t.index),t.parent();while(!t.tree);let n=0,i=t.tree,s=0;for(;s=i.positions[n]+t.from,!(s<=e.from&&s+i.children[n].length>=e.to);n++);let o=i.children[n],a=o.buffer,l=[n];function c(u,h,d,p,m,y){let w=r[y],A=[],T=[];Dd(o,u,w,A,T,p);let E=a[w+1],B=a[w+2];l.push(A.length);let I=y?c(w+4,a[w+3],o.set.types[a[w]],E,B-E,y-1):e.toTree();return A.push(I),T.push(E-p),Dd(o,a[w+3],h,A,T,p),new ut(d,A,T,m)}i.children[n]=c(0,a.length,nr.none,0,o.length,r.length-1);for(let u of l){let h=t.tree.children[u],d=t.tree.positions[u];t.yield(new Gt(h,d+t.from,u,t._tree))}}class Nd{constructor(e,r){this.offset=r,this.done=!1,this.cursor=e.cursor(ot.IncludeAnonymous|ot.IgnoreMounts)}moveTo(e){let{cursor:r}=this,n=e-this.offset;for(;!this.done&&r.from<n;)r.to>=e&&r.enter(n,1,ot.IgnoreOverlays|ot.ExcludeBuffers)||r.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let r=this.cursor.tree;;){if(r==e.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof ut)r=r.children[0];else break}return!1}}class VS{constructor(e){var r;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(r=n.tree.prop(bc))!==null&&r!==void 0?r:n.to,this.inner=new Nd(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let r=this.curFrag=this.fragments[this.fragI];this.curTo=(e=r.tree.prop(bc))!==null&&e!==void 0?e:r.to,this.inner=new Nd(r.tree,-r.offset)}}findMounts(e,r){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Re.mounted);if(o&&o.parser==r)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function Rd(t,e){let r=null,n=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<n.length;s++){let l=n[s];if(l.from>=a)break;l.to<=o||(r||(n=r=e.slice()),l.from<o?(r[s]=new Rr(l.from,o),l.to>a&&r.splice(s+1,0,new Rr(a,l.to))):l.to>a?r[s--]=new Rr(a,l.to):r.splice(s--,1))}}return n}function WS(t,e,r,n){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,r),p=Math.min(u,h,n);d<p&&c.push(new Rr(d,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function Ld(t,e){let r=[];for(let{pos:n,mount:i,frag:s}of t){let o=n+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new Rr(d.from+n,d.to+n)),h=WS(e,u,l,c);for(let d=0,p=l;;d++){let m=d==h.length,y=m?c:h[d].from;if(y>p&&r.push(new An(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),m)break;p=h[d].to}}else r.push(new An(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return r}class ua{constructor(e,r,n,i,s,o,a,l,c,u=0,h){this.p=e,this.stack=r,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new ua(e,[],r,n,n,0,[],0,i?new Bd(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,d,h+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,r,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(r==n)return;if(o.buffer[a-2]>=r){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,r,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)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]=r,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||r<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(r,n),r<=o.maxNode&&this.buffer.push(r,n,i,4)}}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(r,i),this.buffer.push(n,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,r=e.buffer.length;for(;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new ua(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new $S(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if(!(n&65536))return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>4<<1||this.stack.length>=120){let i=[];for(let s=0,o;s<r.length;s+=2)(o=r[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(r[s],o);if(this.stack.length<120)for(let s=0;i.length<4<<1&&s<r.length;s+=2){let o=r[s+1];i.some((a,l)=>l&1&&a==o)||i.push(r[s],o)}r=i}let n=[];for(let i=0;i<r.length&&n.length<4;i+=2){let s=r[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(r[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,r=e.stateSlot(this.state,5);if(!(r&65536))return!1;if(!e.validAction(this.state,r)){let n=r>>19,i=r&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;r=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,s)=>{if(!r.includes(i))return r.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=n(o,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=e.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(r)))}reduceContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(r)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let r=new Bd(this.curContext.tracker,e);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}class $S{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}}class fa{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new fa(e,r,r-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 fa(this.stack,this.pos,this.index)}}function $s(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n<t.length;){let s=0;for(;;){let o=t.charCodeAt(n++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}r?r[i++]=s:r=new e(s)}return r}class ha{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fd=new ha;class HS{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fd,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;r<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let r of this.ranges)if(r.to>e)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(r);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),r=this.pos+e.length;this.chunk=r>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=Fd,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,r){if(e>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}}class Yi{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;jd(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class zS{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?$s(e):e}token(e,r){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(jd(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}zS.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class _I{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function jd(t,e,r,n,i,s){let o=0,a=1<<n,{dialect:l}=r.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||US(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,h=0,d=t[o+2];if(e.next<0&&d>h&&t[c+d*3-3]==65535){o=t[c+d*3-1];continue e}for(;h<d;){let p=h+d>>1,m=c+p+(p<<1),y=t[m],w=t[m+1]||65536;if(u<y)d=p;else if(u>=w)h=p+1;else{o=t[m+2],e.advance();continue e}}break}}function Vd(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function US(t,e,r,n){let i=Vd(r,n,e);return i<0||Vd(r,n,t)<i}const vr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let xc=null;function Wd(t,e,r){let n=t.cursor(ot.IncludeAnonymous);for(n.moveTo(e);;)if(!(r<0?n.childBefore(e):n.childAfter(e)))for(;;){if((r<0?n.to<e:n.from>e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}class GS{constructor(e,r){this.fragments=e,this.nodeSet=r,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?Wd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Wd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let n=this.trees[r],i=this.index[r];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[r]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ut){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Re.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[r]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+s.length}}}class KS{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new ha)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let d=r;if(h.extended>-1&&(r=this.addActions(e,h.extended,h.end,r)),r=this.addActions(e,h.value,h.end,r),!u.extend&&(n=h,r>d))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new ha,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new ha,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=r,this.actions[i++]=n,i}addActions(e,r,n,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Cn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Cn(a,c+2),r,n,i));break}a[c]==r&&(i=this.putAction(Cn(a,c+1),r,n,i))}return i}}class YS{constructor(e,r,n,i){this.parser=e,this.input=r,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new HS(r,i),this.tokens=new KS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ua.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new GS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>r)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let o=i&&QS(i);if(o)return vr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw vr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);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,n);if(o)return vr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,r,n){let i=e.pos,{parser:s}=this,o=vr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!c||(h.prop(Re.contextHash)||0)==u))return e.useNode(h,d),vr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ut)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ut&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),vr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],d=l[c++],p=c==l.length||!n,m=p?e:e.split(),y=this.tokens.mainToken;if(m.apply(u,h,y?y.start:m.pos,d),vr&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?r.push(m):n.push(m)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return $d(e,r),!0}}runRecovery(e,r,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=r[o<<1],c=r[(o<<1)+1],u=vr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),vr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),d=u;for(let p=0;h.forceReduce()&&p<10&&(vr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)vr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))vr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),vr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),$d(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ut.build({buffer:fa.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let r=(xc||(xc=new WeakMap)).get(e);return r||xc.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}}function $d(t,e){for(let r=0;r<e.length;r++){let n=e[r];if(n.pos==t.pos&&n.sameState(t)){e[r].score<t.score&&(e[r]=t);return}}e.push(t)}class JS{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const wc=t=>t;class qI{constructor(e){this.start=e.start,this.shift=e.shift||wc,this.reduce=e.reduce||wc,this.reuse=e.reuse||wc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class da extends Pd{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let a=0;a<e.repeatNodeCount;a++)r.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<r.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Re[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let h=a[c+-u];for(let d=-u;d>0;d--)s(a[c++],l,h);c++}}}this.nodeSet=new oa(r.map((a,l)=>nr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Sd;let o=$s(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Hd),this.states=$s(e.states,Uint32Array),this.data=$s(e.stateData),this.goto=$s(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Yi(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new YS(this,e,r,n);for(let s of this.wrappers)i=s(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let s=i[r+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&n)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,r){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=Cn(n,s+2)];else{if(n[s+1]==2)return Cn(n,s+2);break}if(o==r||o==0)return Cn(n,s+1)}return 0}stateSlot(e,r){return this.states[e*6+r]}stateFlag(e,r){return(this.stateSlot(e,0)&r)>0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):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=Cn(this.data,s+2);else break;i=r(Cn(this.data,s+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Cn(this.data,n+2);else break;if(!(this.data[n+2]&1)){let i=this.data[n+1];r.some((s,o)=>o&1&&s==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(da.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return r.specializers[i]=Hd(o),o})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}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 r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let s of e.split(" ")){let o=r.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<r.length;s++)if(!n[s])for(let o=this.dialects[r[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new JS(e,n,i)}static deserialize(e){return new da(e)}}function Cn(t,e){return t[e]|t[e+1]<<16}function QS(t){let e=null;for(let r of t){let n=r.p.stoppedAt;(r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.score<r.score)&&(e=r)}return e}function Hd(t){if(t.external){let e=t.extend?1:0;return(r,n)=>t.external(r,n)<<1|e}return t.get}let XS=0;class en{constructor(e,r,n){this.set=e,this.base=r,this.modified=n,this.id=XS++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let r=new en([],null,[]);if(r.set.push(r),e)for(let n of e.set)r.set.push(n);return r}static defineModifier(){let e=new pa;return r=>r.modified.indexOf(e)>-1?r:pa.get(r.base||r,r.modified.concat(e).sort((n,i)=>n.id-i.id))}}let ZS=0;class pa{constructor(){this.instances=[],this.id=ZS++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(a=>a.base==e&&_S(r,a.modified));if(n)return n;let i=[],s=new en(i,e,r);for(let a of r)a.instances.push(s);let o=qS(r);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(pa.get(a,l));return s}}function _S(t,e){return t.length==e.length&&t.every((r,n)=>r==e[n])}function qS(t){let e=[[]];for(let r=0;r<t.length;r++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(t[r]));return e.sort((r,n)=>n.length-r.length)}function zd(t){let e=Object.create(null);for(let r in t){let n=t[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new ga(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Ud.add(e)}const Ud=new Re;class ga{constructor(e,r,n,i){this.tags=e,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ga.empty=new ga([],2,null);function Gd(t,e){let r=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))r[s.tag.id]=s.class;else for(let o of s.tag)r[o.id]=s.class;let{scope:n,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=r[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function ek(t,e){let r=null;for(let n of t){let i=n.style(e);i&&(r=r?r+" "+i:i)}return r}function Kd(t,e,r,n=0,i=t.length){let s=new tk(n,Array.isArray(e)?e:[e],r);s.highlightRange(t.cursor(),n,i,"",s.highlighters),s.flush(i)}function eD(t,e,r,n,i,s=0,o=t.length){let a=s;function l(c,u){if(!(c<=a)){for(let h=t.slice(a,c),d=0;;){let p=h.indexOf(`
|
|
141
|
-
`,d),m=p<0?h.length:p;if(m>d&&n(h.slice(d,m),u),p<0)break;i(),d=p+1}a=c}}
|
|
142
|
-
`){let i="";for(let s=0,o=0;s<=
|
|
143
|
-
`){let i="";for(let s=0,o=0;s<this.children.length&&o<=
|
|
144
|
-
`,this;e--}else if(i instanceof yt){let l=i.text[o+(r<0?-1:0)];if(this.offsets[n]+=r,l.length>Math.max(0,e))return this.value=e==0?l:r>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(r<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=r):(r<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(r>0?1:(l instanceof yt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Xd{constructor(e,r,n){this.value="",this.done=!1,this.cursor=new zs(e,r>n?-1:1),this.pos=r>n?e.length:0,this.from=Math.min(r,n),this.to=Math.max(r,n)}nextInner(e,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let n=r<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*r,this.value=i.length<=n?i:r<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Zd{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:r,lineBreak:n,value:i}=this.inner.next(e);return r?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this.iter()},zs.prototype[Symbol.iterator]=Xd.prototype[Symbol.iterator]=Zd.prototype[Symbol.iterator]=function(){return this});class ok{constructor(e,r,n,i){this.from=e,this.to=r,this.number=n,this.text=i}get length(){return this.to-this.from}}let Ji="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<Ji.length;t++)Ji[t]+=Ji[t-1];function ak(t){for(let e=1;e<Ji.length;e+=2)if(Ji[e]>t)return Ji[e-1]<=t;return!1}function _d(t){return t>=127462&&t<=127487}const qd=8205;function Kt(t,e,r=!0,n=!0){return(r?ep:lk)(t,e,n)}function ep(t,e,r){if(e==t.length)return e;e&&tp(t.charCodeAt(e))&&rp(t.charCodeAt(e-1))&&e--;let n=Ft(t,e);for(e+=Lr(n);e<t.length;){let i=Ft(t,e);if(n==qd||i==qd||r&&ak(i))e+=Lr(i),n=i;else if(_d(i)){let s=0,o=e-2;for(;o>=0&&_d(Ft(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function lk(t,e,r){for(;e>0;){let n=ep(t,e-2,r);if(n<e)return n;e--}return 0}function tp(t){return t>=56320&&t<57344}function rp(t){return t>=55296&&t<56320}function Ft(t,e){let r=t.charCodeAt(e);if(!rp(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return tp(n)?(r-55296<<10)+(n-56320)+65536:r}function Ac(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Lr(t){return t<65536?1:2}const Cc=/\r\n?|\n/;var ir=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ir||(ir={}));class on{constructor(e){this.sections=e}get length(){let e=0;for(let r=0;r<this.sections.length;r+=2)e+=this.sections[r];return e}get newLength(){let e=0;for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r+1];e+=n<0?this.sections[r]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let r=0,n=0,i=0;r<this.sections.length;){let s=this.sections[r++],o=this.sections[r++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,r=!1){Oc(this,e,r)}get invertedDesc(){let e=[];for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];i<0?e.push(n,i):e.push(i,n)}return new on(e)}composeDesc(e){return this.empty?e:e.empty?this:np(this,e)}mapDesc(e,r=!1){return e.empty?this:Ec(this,e,r)}mapPos(e,r=-1,n=ir.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=ir.Simple&&c>=e&&(n==ir.TrackDel&&i<e&&c>e||n==ir.TrackBefore&&i<e||n==ir.TrackAfter&&c>e))return null;if(c>e||c==e&&r<0&&!a)return e==i||r<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,r=e){for(let n=0,i=0;n<this.sections.length&&i<=r;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=r&&a>=e)return i<e&&a>r?"cover":!0;i=a}return!1}toString(){let e="";for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new on(e)}static create(e){return new on(e)}}class Pt extends on{constructor(e,r){super(e),this.inserted=r}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Oc(this,(r,n,i,s,o)=>e=e.replace(i,i+(n-r),o),!1),e}mapDesc(e,r=!1){return Ec(this,e,r,!0)}invert(e){let r=this.sections.slice(),n=[];for(let i=0,s=0;i<r.length;i+=2){let o=r[i],a=r[i+1];if(a>=0){r[i]=a,r[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Je.empty);n.push(o?e.slice(s,s+o):Je.empty)}s+=o}return new Pt(r,n)}compose(e){return this.empty?e:e.empty?this:np(this,e,!0)}map(e,r=!1){return e.empty?this:Ec(this,e,r,!0)}iterChanges(e,r=!1){Oc(this,e,r)}get desc(){return on.create(this.sections)}filter(e){let r=[],n=[],i=[],s=new Us(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);Yt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Yt(r,u,h),h>0&&Gn(n,r,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Yt(r,u,-1),Yt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Pt(r,n),filtered:on.create(i)}}toJSON(){let e=[];for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r],i=this.sections[r+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[r>>1].toJSON()))}return e}static of(e,r,n){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<r&&Yt(i,r-o,-1);let h=new Pt(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Pt){if(u.length!=r)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${r})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:p}=u;if(h>d||h<0||d>r)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${r})`);let m=p?typeof p=="string"?Je.of(p.split(n||Cc)):p:Je.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Yt(i,h-o,-1),Yt(i,d-h,y),Gn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Pt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")r.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)r.push(s[0],0);else{for(;n.length<i;)n.push(Je.empty);n[i]=Je.of(s.slice(1)),r.push(s[0],n[i].length)}}}return new Pt(r,n)}static createSet(e,r){return new Pt(e,r)}}function Yt(t,e,r,n=!1){if(e==0&&r<=0)return;let i=t.length-2;i>=0&&r<=0&&r==t[i+1]?t[i]+=e:e==0&&t[i]==0?t[i+1]+=r:n?(t[i]+=e,t[i+1]+=r):t.push(e,r)}function Gn(t,e,r){if(r.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(r);else{for(;t.length<n;)t.push(Je.empty);t.push(r)}}function Oc(t,e,r){let n=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Je.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(r||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function Ec(t,e,r,n=!1){let i=[],s=n?[]:null,o=new Us(t),a=new Us(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Yt(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!r))){let c=a.len;for(Yt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Yt(i,0,o.ins),s&&Gn(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Yt(i,c,l<o.i?o.ins:0),s&&l<o.i&&Gn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Pt.createSet(i,s):on.create(i);throw new Error("Mismatched change set lengths")}}function np(t,e,r=!1){let n=[],i=r?[]:null,s=new Us(t),o=new Us(e);for(let a=!1;;){if(s.done&&o.done)return i?Pt.createSet(n,i):on.create(n);if(s.ins==0)Yt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Yt(n,0,o.ins,a),i&&Gn(i,n,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Yt(n,l,u,a),i&&u&&Gn(i,n,o.text)}else o.ins==-1?(Yt(n,s.off?0:s.len,l,a),i&&Gn(i,n,s.textBit(l))):(Yt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&Gn(i,n,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),s.forward2(l),o.forward(l)}}}}class Us{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length?Je.empty:e[r]}textBit(e){let{inserted:r}=this.set,n=this.i-2>>1;return n>=r.length&&!e?Je.empty:r[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yi{constructor(e,r,n){this.from=e,this.to=r,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,r=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new yi(n,i,this.flags)}extend(e,r=e){if(e<=this.anchor&&r>=this.anchor)return se.range(e,r);let n=Math.abs(e-this.anchor)>Math.abs(r-this.anchor)?e:r;return se.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}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 se.range(e.anchor,e.head)}static create(e,r,n){return new yi(e,r,n)}}class se{constructor(e,r){this.ranges=e,this.mainIndex=r}map(e,r=-1){return e.empty?this:se.create(this.ranges.map(n=>n.map(e,r)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new se([this.main],0)}addRange(e,r=!0){return se.create([e].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(e,r=this.mainIndex){let n=this.ranges.slice();return n[r]=e,se.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new se(e.ranges.map(r=>yi.fromJSON(r)),e.main)}static single(e,r=e){return new se([se.range(e,r)],0)}static create(e,r=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return se.normalized(e.slice(),r);n=s.to}return new se(e,r)}static cursor(e,r=0,n,i){return yi.create(e,e,(r==0?0:r<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,r,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return r<e?yi.create(r,e,48|s):yi.create(e,r,(r>e?8:0)|s)}static normalized(e,r=0){let n=e[r];e.sort((i,s)=>i.from-s.from),r=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=r&&r--,e.splice(--i,2,s.anchor>s.head?se.range(l,a):se.range(a,l))}}return new se(e,r)}}function ip(t,e){for(let r of t.ranges)if(r.to>e)throw new RangeError("Selection points outside of document")}let Tc=0;class pe{constructor(e,r,n,i,s){this.combine=e,this.compareInput=r,this.compare=n,this.isStatic=i,this.id=Tc++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new pe(e.combine||(r=>r),e.compareInput||((r,n)=>r===n),e.compare||(e.combine?(r,n)=>r===n:Pc),!!e.static,e.enables)}of(e){return new xa([],this,0,e)}compute(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new xa(e,this,1,r)}computeN(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new xa(e,this,2,r)}from(e,r){return r||(r=n=>n),this.compute([e],n=>r(n.field(e)))}}function Pc(t,e){return t==e||t.length==e.length&&t.every((r,n)=>r===e[n])}class xa{constructor(e,r,n,i){this.dependencies=e,this.facet=r,this.type=n,this.value=i,this.id=Tc++}dynamicSlot(e){var r;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((r=e[h.id])!==null&&r!==void 0?r:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Mc(h,u)){let p=n(h);if(a?!sp(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,m=d.config.address[s];if(m!=null){let y=ka(d,m);if(this.dependencies.every(w=>w instanceof pe?d.facet(w)===h.facet(w):w instanceof At?d.field(w,!1)==h.field(w,!1):!0)||(a?sp(p=n(h),y,i):i(p=n(h),y)))return h.values[o]=y,0}else p=n(h);return h.values[o]=p,1}}}}function sp(t,e,r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!r(t[n],e[n]))return!1;return!0}function Mc(t,e){let r=!1;for(let n of e)Ks(t,n)&1&&(r=!0);return r}function ck(t,e,r){let n=r.map(l=>t[l.id]),i=r.map(l=>l.type),s=n.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=ka(l,n[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Ks(l,c);return l.values[o]=a(l),1},update(l,c){if(!Mc(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Mc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Pc(r,h))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const op=pe.define({static:!0});class At{constructor(e,r,n,i,s){this.id=e,this.createF=r,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let r=new At(Tc++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(r.provides=e.provide(r)),r}create(e){let r=e.facet(op).find(n=>n.field==this);return(r?.create||this.createF)(e)}slot(e){let r=e[this.id]>>1;return{create:n=>(n.values[r]=this.create(n),1),update:(n,i)=>{let s=n.values[r],o=this.updateF(s,i);return this.compareF(s,o)?0:(n.values[r]=o,1)},reconfigure:(n,i)=>i.config.address[this.id]!=null?(n.values[r]=i.field(this),0):(n.values[r]=this.create(n),1)}}init(e){return[this,op.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Gs(t){return e=>new ap(e,t)}const xi={highest:Gs(bi.highest),high:Gs(bi.high),default:Gs(bi.default),low:Gs(bi.low),lowest:Gs(bi.lowest)};class ap{constructor(e,r){this.inner=e,this.prec=r}}class wa{of(e){return new Ic(this,e)}reconfigure(e){return wa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ic{constructor(e,r){this.compartment=e,this.inner=r}}class Sa{constructor(e,r,n,i,s,o){for(this.base=e,this.compartments=r,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let r=this.address[e.id];return r==null?e.default:this.staticValues[r>>1]}static resolve(e,r,n){let i=[],s=Object.create(null),o=new Map;for(let d of uk(e,r,o))d instanceof At?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],m=p[0].facet,y=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[m.id]=l.length<<1|1,Pc(y,p))l.push(n.facet(m));else{let w=m.combine(p.map(A=>A.value));l.push(n&&m.compare(w,n.facet(m))?n.facet(m):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(A=>w.dynamicSlot(A)));a[m.id]=c.length<<1,c.push(w=>ck(w,m,p))}}let h=c.map(d=>d(a));return new Sa(e,o,h,a,l,s)}}function uk(t,e,r){let n=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof Ic&&r.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Ic){if(r.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;r.set(o.compartment,c),s(c,a)}else if(o instanceof ap)s(o.inner,o.prec);else if(o instanceof At)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof xa)n[a].push(o),o.facet.extensions&&s(o.facet.extensions,bi.default);else{let c=o.extension;if(!c)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(c,a)}}return s(t,bi.default),n.reduce((o,a)=>o.concat(a))}function Ks(t,e){if(e&1)return 2;let r=e>>1,n=t.status[r];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[r]=4;let i=t.computeSlot(t,t.config.dynamicSlots[r]);return t.status[r]=2|i}function ka(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const lp=pe.define(),cp=pe.define({combine:t=>t.some(e=>e),static:!0}),up=pe.define({combine:t=>t.length?t[0]:void 0,static:!0}),fp=pe.define(),hp=pe.define(),dp=pe.define(),pp=pe.define({combine:t=>t.length?t[0]:!1});class an{constructor(e,r){this.type=e,this.value=r}static define(){return new fk}}class fk{of(e){return new an(this,e)}}class hk{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{constructor(e,r){this.type=e,this.value=r}map(e){let r=this.type.map(this.value,e);return r===void 0?void 0:r==this.value?this:new Ae(this.type,r)}is(e){return this.type==e}static define(e={}){return new hk(e.map||(r=>r))}static mapEffects(e,r){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(r);s&&n.push(s)}return n}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Mt{constructor(e,r,n,i,s,o){this.startState=e,this.changes=r,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&ip(n,r.newLength),s.some(a=>a.type==Mt.time)||(this.annotations=s.concat(Mt.time.of(Date.now())))}static create(e,r,n,i,s,o){return new Mt(e,r,n,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 r of this.annotations)if(r.type==e)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let r=this.annotation(Mt.userEvent);return!!(r&&(r==e||r.length>e.length&&r.slice(0,e.length)==e&&r[e.length]=="."))}}Mt.time=an.define(),Mt.userEvent=an.define(),Mt.addToHistory=an.define(),Mt.remote=an.define();function dk(t,e){let r=[];for(let n=0,i=0;;){let s,o;if(n<t.length&&(i==e.length||e[i]>=t[n]))s=t[n++],o=t[n++];else if(i<e.length)s=e[i++],o=e[i++];else return r;!r.length||r[r.length-1]<s?r.push(s,o):r[r.length-1]<o&&(r[r.length-1]=o)}}function gp(t,e,r){var n;let i,s,o;return r?(i=e.changes,s=Pt.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(n=t.selection)===null||n===void 0?void 0:n.map(i),effects:Ae.mapEffects(t.effects,i).concat(Ae.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Dc(t,e,r){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Mt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Pt?e.changes:Pt.of(e.changes||[],r,t.facet(up)),selection:n&&(n instanceof se?n:se.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function mp(t,e,r){let n=Dc(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(r=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(r=!1);let o=!!e[s].sequential;n=gp(n,Dc(t,e[s],o?n.changes.newLength:t.doc.length),o)}let i=Mt.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return gk(r?pk(i):i)}function pk(t){let e=t.startState,r=!0;for(let i of e.facet(fp)){let s=i(t);if(s===!1){r=!1;break}Array.isArray(s)&&(r=r===!0?s:dk(r,s))}if(r!==!0){let i,s;if(r===!1)s=t.changes.invertedDesc,i=Pt.empty(e.doc.length);else{let o=t.changes.filter(r);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Mt.create(e,i,t.selection&&t.selection.map(s),Ae.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(hp);for(let i=n.length-1;i>=0;i--){let s=n[i](t);s instanceof Mt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mt?t=s[0]:t=mp(e,Qi(s),!1)}return t}function gk(t){let e=t.startState,r=e.facet(dp),n=t;for(let i=r.length-1;i>=0;i--){let s=r[i](t);s&&Object.keys(s).length&&(n=gp(n,Dc(e,s,t.changes.newLength),!0))}return n==t?t:Mt.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const mk=[];function Qi(t){return t==null?mk:Array.isArray(t)?t:[t]}var at=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(at||(at={}));const vk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nc;try{Nc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function yk(t){if(Nc)return Nc.test(t);for(let e=0;e<t.length;e++){let r=t[e];if(/\w/.test(r)||r>"\x80"&&(r.toUpperCase()!=r.toLowerCase()||vk.test(r)))return!0}return!1}function bk(t){return e=>{if(!/\S/.test(e))return at.Space;if(yk(e))return at.Word;for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return at.Word;return at.Other}}class Ve{constructor(e,r,n,i,s,o){this.config=e,this.doc=r,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Ks(this,a<<1);this.computeSlot=null}field(e,r=!0){let n=this.config.address[e.id];if(n==null){if(r)throw new RangeError("Field is not present in this state");return}return Ks(this,n),ka(this,n)}update(...e){return mp(this,e,!0)}applyTransaction(e){let r=this.config,{base:n,compartments:i}=r;for(let o of e.effects)o.is(wa.reconfigure)?(r&&(i=new Map,r.compartments.forEach((a,l)=>i.set(l,a)),r=null),i.set(o.value.compartment,o.value.extension)):o.is(Ae.reconfigure)?(r=null,n=o.value):o.is(Ae.appendConfig)&&(r=null,n=Qi(n).concat(o.value));let s;r?s=e.startState.values.slice():(r=Sa.resolve(n,i,this),s=new Ve(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new Ve(r,e.newDoc,e.newSelection,s,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:e},range:se.cursor(r.from+e.length)}))}changeByRange(e){let r=this.selection,n=e(r.ranges[0]),i=this.changes(n.changes),s=[n.range],o=Qi(n.effects);for(let a=1;a<r.ranges.length;a++){let l=e(r.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=Ae.mapEffects(o,u).concat(Ae.mapEffects(Qi(l.effects),h))}return{changes:i,selection:se.create(s,r.mainIndex),effects:o}}changes(e=[]){return e instanceof Pt?e:Pt.of(e,this.doc.length,this.facet(Ve.lineSeparator))}toText(e){return Je.of(e.split(this.facet(Ve.lineSeparator)||Cc))}sliceDoc(e=0,r=this.doc.length){return this.doc.sliceString(e,r,this.lineBreak)}facet(e){let r=this.config.address[e.id];return r==null?e.default:(Ks(this,r),ka(this,r))}toJSON(e){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof At&&this.config.address[i.id]!=null&&(r[n]=i.spec.toJSON(this.field(e[n]),this))}return r}static fromJSON(e,r={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Ve.create({doc:e.doc,selection:se.fromJSON(e.selection),extensions:r.extensions?i.concat([r.extensions]):i})}static create(e={}){let r=Sa.resolve(e.extensions||[],new Map),n=e.doc instanceof Je?e.doc:Je.of((e.doc||"").split(r.staticFacet(Ve.lineSeparator)||Cc)),i=e.selection?e.selection instanceof se?e.selection:se.single(e.selection.anchor,e.selection.head):se.single(0);return ip(i,n.length),r.staticFacet(cp)||(i=i.asSingle()),new Ve(r,n,i,r.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ve.tabSize)}get lineBreak(){return this.facet(Ve.lineSeparator)||`
|
|
145
|
-
`}get readOnly(){return this.facet(pp)}phrase(e,...r){for(let n of this.facet(Ve.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return r.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>r.length?n:r[s-1]})),e}languageDataAt(e,r,n=-1){let i=[];for(let s of this.facet(lp))for(let o of s(this,r,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return bk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:r,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Kt(r,o,!1);if(s(r.slice(l,o))!=at.Word)break;o=l}for(;a<i;){let l=Kt(r,a);if(s(r.slice(a,l))!=at.Word)break;a=l}return o==a?null:se.range(o+n,a+n)}}Ve.allowMultipleSelections=cp,Ve.tabSize=pe.define({combine:t=>t.length?t[0]:4}),Ve.lineSeparator=up,Ve.readOnly=pp,Ve.phrases=pe.define({compare(t,e){let r=Object.keys(t),n=Object.keys(e);return r.length==n.length&&r.every(i=>t[i]==e[i])}}),Ve.languageData=lp,Ve.changeFilter=fp,Ve.transactionFilter=hp,Ve.transactionExtender=dp,wa.reconfigure=Ae.define();function Ur(t,e,r={}){let n={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(r,s))n[s]=r[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class wi{eq(e){return this==e}range(e,r=e){return Ys.create(e,r,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=ir.TrackDel;class Ys{constructor(e,r,n){this.from=e,this.to=r,this.value=n}static create(e,r,n){return new Ys(e,r,n)}}function Rc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Lc{constructor(e,r,n,i){this.from=e,this.to=r,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,r,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-r;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,r,n,i){for(let s=this.findIndex(r,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,r){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,d,p;if(u==h){let m=r.mapPos(u,c.startSide,c.mapMode);if(m==null||(d=p=m,c.startSide!=c.endSide&&(p=r.mapPos(u,c.endSide),p<d)))continue}else if(d=r.mapPos(u,c.startSide),p=r.mapPos(h,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),n.push(c),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Lc(i,s,n,a):null,pos:o}}}class Qe{constructor(e,r,n,i){this.chunkPos=e,this.chunk=r,this.nextLayer=n,this.maxPoint=i}static create(e,r,n,i){return new Qe(e,r,n,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 r of this.chunk)e+=r.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:r=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(r.length==0&&!o)return this;if(n&&(r=r.slice().sort(Rc)),this.isEmpty)return r.length?Qe.of(r):this;let a=new yp(this,null,-1).goto(0),l=0,c=[],u=new Kn;for(;a.value||l<r.length;)if(l<r.length&&(a.from-r[l].from||a.startSide-r[l].value.startSide)>=0){let h=r[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==r.length||this.chunkEnd(a.chunkIndex)<r[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Ys.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Qe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let r=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),r.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),r.push(u),n.push(h))}}let s=this.nextLayer.map(e);return r.length==0?s:new Qe(n,r,s||Qe.empty,i)}between(e,r,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(r>=s&&e<=s+o.length&&o.between(s,e-s,r-s,n)===!1)return}this.nextLayer.between(e,r,n)}}iter(e=0){return Js.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,r=0){return Js.from(e).goto(r)}static compare(e,r,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=r.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=vp(o,a,n),c=new Qs(o,l,s),u=new Qs(a,l,s);n.iterGaps((h,d,p)=>bp(c,h,u,d,p,i)),n.empty&&n.length==0&&bp(c,0,u,0,0,i)}static eq(e,r,n=0,i){i==null&&(i=1e9-1);let s=e.filter(u=>!u.isEmpty&&r.indexOf(u)<0),o=r.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=vp(s,o),l=new Qs(s,a,0).goto(n),c=new Qs(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Fc(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,r,n,i,s=-1){let o=new Qs(e,null,s).goto(r),a=r,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<r?u.length+1:Math.min(u.length,l);i.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,r=!1){let n=new Kn;for(let i of e instanceof Ys?[e]:r?xk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Qe.empty=new Qe([],[],null,-1);function xk(t){if(t.length>1)for(let e=t[0],r=1;r<t.length;r++){let n=t[r];if(Rc(e,n)>0)return t.slice().sort(Rc);e=n}return t}Qe.empty.nextLayer=Qe.empty;class Kn{finishChunk(e){this.chunks.push(new Lc(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,r,n){this.addInner(e,r,n)||(this.nextLayer||(this.nextLayer=new Kn)).add(e,r,n)}addInner(e,r,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.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(r-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=r,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,r-e)),!0)}addChunk(e,r){if((e-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(e);let n=r.value.length-1;return this.last=r.value[n],this.lastFrom=r.from[n]+e,this.lastTo=r.to[n]+e,!0}finish(){return this.finishInner(Qe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let r=Qe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,r}}function vp(t,e,r){let n=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=n.get(s.chunk[o]);a!=null&&(r?r.mapPos(a):a)==s.chunkPos[o]&&!r?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class yp{constructor(e,r,n,i=0){this.layer=e,this.skip=r,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,r,!1),this}gotoInner(e,r,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],r,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,r){(this.to-e||this.endSide-r)<0&&this.gotoInner(e,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],n=e+r.from[this.rangeIndex];if(this.from=n,this.to=e+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Js{constructor(e){this.heap=e}static from(e,r=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new yp(o,r,n,s));return i.length==1?i[0]:new Js(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,r=-1e9){for(let n of this.heap)n.goto(e,r);for(let n=this.heap.length>>1;n>=0;n--)Bc(this.heap,n);return this.next(),this}forward(e,r){for(let n of this.heap)n.forward(e,r);for(let n=this.heap.length>>1;n>=0;n--)Bc(this.heap,n);(this.to-e||this.value.endSide-r)<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(),Bc(this.heap,0)}}}function Bc(t,e){for(let r=t[e];;){let n=(e<<1)+1;if(n>=t.length)break;let i=t[n];if(n+1<t.length&&i.compare(t[n+1])>=0&&(i=t[n+1],n++),r.compare(i)<0)break;t[n]=r,t[e]=i,e=n}}class Qs{constructor(e,r,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Js.from(e,r,n)}goto(e,r=-1e9){return this.cursor.goto(e,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=r,this.openStart=-1,this.next(),this}forward(e,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(e,r)}removeActive(e){Aa(this.active,e),Aa(this.activeTo,e),Aa(this.activeRank,e),this.minActive=xp(this.active,this.activeTo)}addActive(e){let r=0,{value:n,to:i,rank:s}=this.cursor;for(;r<this.activeRank.length&&this.activeRank[r]<=s;)r++;Ca(this.active,r,n),Ca(this.activeTo,r,i),Ca(this.activeRank,r,s),e&&Ca(e,r,this.cursor.from),this.minActive=xp(this.active,this.activeTo)}next(){let e=this.to,r=this.point;this.point=null;let n=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),n&&Aa(n,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(n),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let r=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&r.push(this.active[n]);return r.reverse()}openEnd(e){let r=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)r++;return r}}function bp(t,e,r,n,i,s){t.goto(e),r.goto(n);let o=n+i,a=n,l=n-e;for(;;){let c=t.to+l-r.to||t.endSide-r.endSide,u=c<0?t.to+l:r.to,h=Math.min(u,o);if(t.point||r.point?t.point&&r.point&&(t.point==r.point||t.point.eq(r.point))&&Fc(t.activeForPoint(t.to),r.activeForPoint(r.to))||s.comparePoint(a,h,t.point,r.point):h>a&&!Fc(t.active,r.active)&&s.compareRange(a,h,t.active,r.active),u>o)break;a=u,c<=0&&t.next(),c>=0&&r.next()}}function Fc(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r]&&!t[r].eq(e[r]))return!1;return!0}function Aa(t,e){for(let r=e,n=t.length-1;r<n;r++)t[r]=t[r+1];t.pop()}function Ca(t,e,r){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=r}function xp(t,e){let r=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||t[i].endSide-t[r].endSide)<0&&(r=i,n=e[i]);return r}function Xi(t,e,r=t.length){let n=0;for(let i=0;i<r;)t.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Kt(t,i));return n}function jc(t,e,r,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?r-s%r:1,i=Kt(t,i)}return n===!0?-1:t.length}const Vc="\u037C",wp=typeof Symbol>"u"?"__"+Vc:Symbol.for(Vc),Wc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Sp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yn{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,u,d)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
146
|
-
`)}static newName(){let e=
|
|
147
|
-
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Jn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Sk=typeof navigator<"u"&&/Mac/.test(navigator.platform),kk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),jt=0;jt<10;jt++)Jn[48+jt]=Jn[96+jt]=String(jt);for(var jt=1;jt<=24;jt++)Jn[jt+111]="F"+jt;for(var jt=65;jt<=90;jt++)Jn[jt]=String.fromCharCode(jt+32),Xs[jt]=String.fromCharCode(jt);for(var $c in Jn)Xs.hasOwnProperty($c)||(Xs[$c]=Jn[$c]);function Ak(t){var e=Sk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||kk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?Xs:Jn)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function Oa(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Hc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ck(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ea(t,e){if(!e.anchorNode)return!1;try{return Hc(t,e.anchorNode)}catch{return!1}}function Zi(t){return t.nodeType==3?Si(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ta(t,e,r,n){return r?Ap(t,e,r,n,-1)||Ap(t,e,r,n,1):!1}function Zs(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Ap(t,e,r,n,i){for(;;){if(t==r&&e==n)return!0;if(e==(i<0?0:On(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Zs(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?On(t):0}else return!1}}function On(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Pa(t,e){let r=e?t.left:t.right;return{left:r,right:r,top:t.top,bottom:t.bottom}}function Ok(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Ek(t,e,r,n,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,h=!1;u&&!h;)if(u.nodeType==1){let d,p=u==l.body,m=1,y=1;if(p)d=Ok(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();m=T.width/u.offsetWidth,y=T.height/u.offsetHeight,d={left:T.left,right:T.left+u.clientWidth*m,top:T.top,bottom:T.top+u.clientHeight*y}}let w=0,A=0;if(i=="nearest")e.top<d.top?(A=-(d.top-e.top+o),r>0&&e.bottom>d.bottom+A&&(A=e.bottom-d.bottom+A+o)):e.bottom>d.bottom&&(A=e.bottom-d.bottom+o,r<0&&e.top-A<d.top&&(A=-(d.top+A-e.top+o)));else{let T=e.bottom-e.top,E=d.bottom-d.top;A=(i=="center"&&T<=E?e.top+T/2-E/2:i=="start"||i=="center"&&r<0?e.top-o:e.bottom-E+o)-d.top}if(n=="nearest"?e.left<d.left?(w=-(d.left-e.left+s),r>0&&e.right>d.right+w&&(w=e.right-d.right+w+s)):e.right>d.right&&(w=e.right-d.right+s,r<0&&e.left<d.left+w&&(w=-(d.left+w-e.left+s))):w=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,w||A)if(p)c.scrollBy(w,A);else{let T=0,E=0;if(A){let B=u.scrollTop;u.scrollTop+=A/y,E=(u.scrollTop-B)*y}if(w){let B=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-B)*m}e={left:e.left-T,top:e.top-E,right:e.right-T,bottom:e.bottom-E},T&&Math.abs(T-w)<1&&(n="nearest"),E&&Math.abs(E-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Tk(t){let e=t.ownerDocument;for(let r=t.parentNode;r&&r!=e.body;)if(r.nodeType==1){if(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)return r;r=r.assignedSlot||r.parentNode}else if(r.nodeType==11)r=r.host;else break;return null}class Pk{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:r,focusNode:n}=e;this.set(r,Math.min(e.anchorOffset,r?On(r):0),n,Math.min(e.focusOffset,n?On(n):0))}set(e,r,n,i){this.anchorNode=e,this.anchorOffset=r,this.focusNode=n,this.focusOffset=i}}let _i=null;function Cp(t){if(t.setActive)return t.setActive();if(_i)return t.focus(_i);let e=[];for(let r=t;r&&(e.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(t.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),!_i){_i=!1;for(let r=0;r<e.length;){let n=e[r++],i=e[r++],s=e[r++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let Op;function Si(t,e,r=e){let n=Op||(Op=document.createRange());return n.setEnd(t,r),n.setStart(t,e),n}function qi(t,e,r){let n={key:e,code:e,keyCode:r,which:r,cancelable:!0},i=new KeyboardEvent("keydown",n);i.synthetic=!0,t.dispatchEvent(i);let s=new KeyboardEvent("keyup",n);return s.synthetic=!0,t.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function Mk(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Ep(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Ik(t,e){let r=e.focusNode,n=e.focusOffset;if(!r||e.anchorNode!=r||e.anchorOffset!=n)return!1;for(n=Math.min(n,On(r));;)if(n){if(r.nodeType!=1)return!1;let i=r.childNodes[n-1];i.contentEditable=="false"?n--:(r=i,n=On(r))}else{if(r==t)return!0;n=Zs(r),r=r.parentNode}}function Tp(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}class Jt{constructor(e,r,n=!0){this.node=e,this.offset=r,this.precise=n}static before(e,r){return new Jt(e.parentNode,Zs(e),r)}static after(e,r){return new Jt(e.parentNode,Zs(e)+1,r)}}const zc=[];class it{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 r=this.posAtStart;for(let n of this.children){if(n==e)return r;r+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,r){if(this.flags&2){let n=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:n.firstChild)){let a=it.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,r),o.flags&=-8}if(s=i?i.nextSibling:n.firstChild,r&&!r.written&&r.node==n&&s!=o.dom&&(r.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=Pp(s);else n.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:n.firstChild,s&&r&&r.node==n&&(r.written=!0);s;)s=Pp(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,r),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,r){let n;if(e==this.dom)n=this.dom.childNodes[r];else{let i=On(e)==0?0:r==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?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!it.get(n);)n=n.nextSibling;if(!n)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,r,n=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<this.children.length;l++){let h=this.children[l],d=c+h.length;if(c<e&&d>r)return h.domBoundsAround(e,r,c);if(d>=e&&i==-1&&(i=l,s=c),c>r&&h.dom.parentNode==this.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?n+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let r=this.parent;r;r=r.parent){if(e&&(r.flags|=2),r.flags&1)return;r.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 r=e.parent;if(!r)return e;e=r}}replaceChildren(e,r,n=zc){this.markDirty();for(let i=e;i<r;i++){let s=this.children[i];s.parent==this&&s.destroy()}this.children.splice(e,r-e,...n);for(let i=0;i<n.length;i++)n[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Mp(this.children,e,this.children.length)}childPos(e,r=1){return this.childCursor().findPos(e,r)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,r,n,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}}it.prototype.breakAfter=0;function Pp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Mp{constructor(e,r,n){this.children=e,this.pos=r,this.i=n,this.off=0}findPos(e,r=1){for(;;){if(e>this.pos||e==this.pos&&(r>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Ip(t,e,r,n,i,s,o,a,l){let{children:c}=t,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(r,i,s.length?h:null,r==0,a,l))){if(n<c.length){let p=c[n];p&&(i<p.length||p.breakAfter&&h?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,l)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,l),s.push(p))):p?.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,r>0&&(!o&&s.length&&u.merge(r,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(r<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(r,u.length,null,!1,a,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,a,l)&&e--,(e<n||s.length)&&t.replaceChildren(e,n,s)}}function Dp(t,e,r,n,i,s){let o=t.childCursor(),{i:a,off:l}=o.findPos(r,1),{i:c,off:u}=o.findPos(e,-1),h=e-r;for(let d of n)h+=d.length;t.length+=h,Ip(t,c,u,a,l,n,0,i,s)}let yr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Uc=typeof document<"u"?document:{documentElement:{style:{}}};const Gc=/Edge\/(\d+)/.exec(yr.userAgent),Np=/MSIE \d/.test(yr.userAgent),Kc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yr.userAgent),Ma=!!(Np||Kc||Gc),Rp=!Ma&&/gecko\/(\d+)/i.test(yr.userAgent),Yc=!Ma&&/Chrome\/(\d+)/.exec(yr.userAgent),Lp="webkitFontSmoothing"in Uc.documentElement.style,Bp=!Ma&&/Apple Computer/.test(yr.vendor),Fp=Bp&&(/Mobile\/\w+/.test(yr.userAgent)||yr.maxTouchPoints>2);var be={mac:Fp||/Mac/.test(yr.platform),windows:/Win/.test(yr.platform),linux:/Linux|X11/.test(yr.platform),ie:Ma,ie_version:Np?Uc.documentMode||6:Kc?+Kc[1]:Gc?+Gc[1]:0,gecko:Rp,gecko_version:Rp?+(/Firefox\/(\d+)/.exec(yr.userAgent)||[0,0])[1]:0,chrome:!!Yc,chrome_version:Yc?+Yc[1]:0,ios:Fp,android:/Android\b/.test(yr.userAgent),webkit:Lp,safari:Bp,webkit_version:Lp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Uc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Dk=256;class En extends it{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,r){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(r&&r.node==this.dom&&(r.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,r,n){return this.flags&8||n&&(!(n instanceof En)||this.length-(r-e)+n.length>Dk||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(r),this.markDirty(),!0)}split(e){let r=new En(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),r.flags|=this.flags&8,r}localPosFromDOM(e,r){return e==this.dom?r:r?this.text.length:0}domAtPos(e){return new Jt(this.dom,e)}domBoundsAround(e,r,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,r){return Nk(this.dom,e,r)}}class Tn extends it{constructor(e,r=[],n=0){super(),this.mark=e,this.children=r,this.length=n;for(let i of r)i.setParent(this)}setAttrs(e){if(Ep(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let r in this.mark.attrs)e.setAttribute(r,this.mark.attrs[r]);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,r){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,r)}merge(e,r,n,i,s,o){return n&&(!(n instanceof Tn&&n.mark.eq(this.mark))||e&&s<=0||r<this.length&&o<=0)?!1:(Dp(this,e,r,n?n.children:[],s-1,o-1),this.markDirty(),!0)}split(e){let r=[],n=0,i=-1,s=0;for(let a of this.children){let l=n+a.length;l>e&&r.push(n<e?a.split(e-n):a),i<0&&n>=e&&(i=s),n=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Tn(this.mark,r,o)}domAtPos(e){return jp(this,e)}coordsAt(e,r){return Wp(this,e,r)}}function Nk(t,e,r){let n=t.nodeValue.length;e>n&&(e=n);let i=e,s=e,o=0;e==0&&r<0||e==n&&r>=0?be.chrome||be.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):r<0?i--:s<n&&s++;let a=Si(t,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:r>=0)?0:a.length-1];return be.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Pa(l,o<0):l||null}class Qn extends it{static create(e,r,n){return new Qn(e,r,n)}constructor(e,r,n){super(),this.widget=e,this.length=r,this.side=n,this.prevWidget=null}split(e){let r=Qn.create(this.widget,this.length-e,this.side);return this.length-=e,r}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.dom.contentEditable="false")}getSide(){return this.side}merge(e,r,n,i,s,o){return n&&(!(n instanceof Qn)||!this.widget.compare(n.widget)||e>0&&s<=0||r<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}become(e){return e instanceof Qn&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Je.empty;let e=this;for(;e.parent;)e=e.parent;let{view:r}=e,n=r&&r.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Je.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,r){let n=this.widget.coordsAt(this.dom,e,r);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return Pa(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class es extends it{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof es&&e.side==this.side}split(){return new es(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Jt.before(this.dom):Jt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Je.empty}get isHidden(){return!0}}En.prototype.children=Qn.prototype.children=es.prototype.children=zc;function jp(t,e){let r=t.dom,{children:n}=t,i=0;for(let s=0;i<n.length;i++){let o=n[i],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==r)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=i;s>0;s--){let o=n[s-1];if(o.dom.parentNode==r)return o.domAtPos(o.length)}for(let s=i;s<n.length;s++){let o=n[s];if(o.dom.parentNode==r)return o.domAtPos(0)}return new Jt(r,0)}function Vp(t,e,r){let n,{children:i}=t;r>0&&e instanceof Tn&&i.length&&(n=i[i.length-1])instanceof Tn&&n.mark.eq(e.mark)?Vp(n,e.children[0],r-1):(i.push(e),e.setParent(t)),t.length+=e.length}function Wp(t,e,r){let n=null,i=-1,s=null,o=-1;function a(c,u){for(let h=0,d=0;h<c.children.length&&d<=u;h++){let p=c.children[h],m=d+p.length;m>=u&&(p.children.length?a(p,u-d):(!s||s.isHidden&&r>0)&&(m>u||d==m&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==m&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=m}}a(t,e);let l=(r<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?i:o),r):Rk(t)}function Rk(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let r=Zi(e);return r[r.length-1]||null}function Jc(t,e){for(let r in t)r=="class"&&e.class?e.class+=" "+t.class:r=="style"&&e.style?e.style+=";"+t.style:e[r]=t[r];return e}const $p=Object.create(null);function Qc(t,e,r){if(t==e)return!0;t||(t=$p),e||(e=$p);let n=Object.keys(t),i=Object.keys(e);if(n.length-(r&&n.indexOf(r)>-1?1:0)!=i.length-(r&&i.indexOf(r)>-1?1:0))return!1;for(let s of n)if(s!=r&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function Xc(t,e,r){let n=!1;if(e)for(let i in e)r&&i in r||(n=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(r)for(let i in r)e&&e[i]==r[i]||(n=!0,i=="style"?t.style.cssText=r[i]:t.setAttribute(i,r[i]));return n}function Lk(t){let e=Object.create(null);for(let r=0;r<t.attributes.length;r++){let n=t.attributes[r];e[n.name]=n.value}return e}class It extends it{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,r,n,i,s,o){if(n){if(!(n instanceof It))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Dp(this,e,r,n?n.children:[],s,o),!0}split(e){let r=new It;if(r.breakAfter=this.breakAfter,this.length==0)return r;let{i:n,off:i}=this.childPos(e);i&&(r.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)r.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,r}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){Qc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,r){Vp(this,e,r)}addLineDeco(e){let r=e.spec.attributes,n=e.spec.class;r&&(this.attrs=Jc(r,this.attrs||{})),n&&(this.attrs=Jc({class:n},this.attrs||{}))}domAtPos(e){return jp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,r){var n;this.dom?this.flags&4&&(Ep(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&&(Xc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,r);let i=this.dom.lastChild;for(;i&&it.get(i)instanceof Tn;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=it.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!be.ios||!this.children.some(s=>s instanceof En))){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,r;for(let n of this.children){if(!(n instanceof En)||/[^ -~]/.test(n.text))return null;let i=Zi(n.dom);if(i.length!=1)return null;e+=i[0].width,r=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:r}:null}coordsAt(e,r){let n=Wp(this,e,r);if(!this.children.length&&n&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,r){for(let n=0,i=0;n<e.children.length;n++){let s=e.children[n],o=i+s.length;if(o>=r){if(s instanceof It)return s;if(o>r)break}i=o+s.breakAfter}return null}}class Xn extends it{constructor(e,r,n){super(),this.widget=e,this.length=r,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,r,n,i,s,o){return n&&(!(n instanceof Xn)||!this.widget.compare(n.widget)||e>0&&s<=0||r<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}domAtPos(e){return e==0?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}split(e){let r=this.length-e;this.length=e;let n=new Xn(this.widget,r,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return zc}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.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Je.empty}domBoundsAround(){return null}become(e){return e instanceof Xn&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,r){return this.widget.coordsAt(this.dom,e,r)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:r,endSide:n}=this.deco;return r==n?!1:e<0?r<0:n>0}}class ln{eq(e){return!1}updateDOM(e,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,r,n){return null}get isHidden(){return!1}destroy(e){}}var sr=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(sr||(sr={}));class ke extends wi{constructor(e,r,n,i){super(),this.startSide=e,this.endSide=r,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new _s(e)}static widget(e){let r=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return r+=n&&!e.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new Zn(e,r,r,n,e.widget||null,!1)}static replace(e){let r=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:s,end:o}=Hp(e,r);n=(s?r?-3e8:-1:5e8)-1,i=(o?r?2e8:1:-6e8)+1}return new Zn(e,n,i,r,e.widget||null,!0)}static line(e){return new qs(e)}static set(e,r=!1){return Qe.of(e,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ke.none=Qe.empty;class _s extends ke{constructor(e){let{start:r,end:n}=Hp(e);super(r?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var r,n;return this==e||e instanceof _s&&this.tagName==e.tagName&&(this.class||((r=this.attrs)===null||r===void 0?void 0:r.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Qc(this.attrs,e.attrs,"class")}range(e,r=e){if(e>=r)throw new RangeError("Mark decorations may not be empty");return super.range(e,r)}}_s.prototype.point=!1;class qs extends ke{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof qs&&this.spec.class==e.spec.class&&Qc(this.spec.attributes,e.spec.attributes)}range(e,r=e){if(r!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,r)}}qs.prototype.mapMode=ir.TrackBefore,qs.prototype.point=!0;class Zn extends ke{constructor(e,r,n,i,s,o){super(r,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?r<=0?ir.TrackBefore:ir.TrackAfter:ir.TrackDel}get type(){return this.startSide!=this.endSide?sr.WidgetRange:this.startSide<=0?sr.WidgetBefore:sr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zn&&Bk(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,r=e){if(this.isReplace&&(e>r||e==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,r)}}Zn.prototype.point=!0;function Hp(t,e=!1){let{inclusiveStart:r,inclusiveEnd:n}=t;return r==null&&(r=t.inclusive),n==null&&(n=t.inclusive),{start:r??e,end:n??e}}function Bk(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zc(t,e,r,n=0){let i=r.length-1;i>=0&&r[i]+n>=t?r[i]=Math.max(r[i],e):r.push(t,e)}class eo{constructor(e,r,n,i){this.doc=e,this.pos=r,this.end=n,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=r}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 Xn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new It),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ia(new es(-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 Xn)&&this.getLine()}buildText(e,r,n){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)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(r.slice(r.length-n)),this.getLine().append(Ia(new En(this.text.slice(this.textOff,this.textOff+i)),r),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,r,n,i){this.buildText(r-e,n,i),this.pos=r,this.openStart<0&&(this.openStart=i)}point(e,r,n,i,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Zn){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(r>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=r-e;if(n instanceof Zn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Xn(n.widget||new zp("div"),a,n));else{let l=Qn.create(n.widget||new zp("span"),a,a?0:n.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<r||n.startSide>0),u=!l.isEditable&&(e<r||s>i.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Ia(new es(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Ia(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<r||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=r),this.openStart<0&&(this.openStart=s)}static build(e,r,n,i,s){let o=new eo(e,r,n,s);return o.openEnd=Qe.spans(i,r,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Ia(t,e){for(let r of e)t=new Tn(r,[t],t.length);return t}class zp extends ln{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}}const Up=pe.define(),Gp=pe.define(),Kp=pe.define(),Yp=pe.define(),_c=pe.define(),Jp=pe.define(),Qp=pe.define(),Xp=pe.define({combine:t=>t.some(e=>e)}),Zp=pe.define({combine:t=>t.some(e=>e)});class ts{constructor(e,r="nearest",n="nearest",i=5,s=5,o=!1){this.range=e,this.y=r,this.x=n,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new ts(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 ts(se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Da=Ae.define({map:(t,e)=>t.map(e)});function br(t,e,r){let n=t.facet(Yp);n.length?n[0](e):window.onerror?window.onerror(String(e),r,void 0,void 0,e):r?console.error(r+":",e):console.error(e)}const Na=pe.define({combine:t=>t.length?t[0]:!0});let Fk=0;const to=pe.define();class ft{constructor(e,r,n,i,s){this.id=e,this.create=r,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,r){const{eventHandlers:n,eventObservers:i,provide:s,decorations:o}=r||{};return new ft(Fk++,e,n,i,a=>{let l=[to.of(a)];return o&&l.push(ro.of(c=>{let u=c.plugin(a);return u?o(u):ke.none})),s&&l.push(s(a)),l})}static fromClass(e,r){return ft.define(n=>new e(n),r)}}class qc{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(n){if(br(r.state,n,"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(r){br(e.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(n){br(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _p=pe.define(),Ra=pe.define(),ro=pe.define(),eu=pe.define(),qp=pe.define();function eg(t,e,r){let n=t.state.facet(qp);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(t):o),s=[];return Qe.spans(i,e,r,{point(){},span(o,a,l,c){let u=s;for(let h=l.length-1;h>=0;h--,c--){let d=l[h].spec.bidiIsolate,p;if(d!=null)if(c>0&&u.length&&(p=u[u.length-1]).to==o&&p.direction==d)p.to=a,u=p.inner;else{let m={from:o,to:a,direction:d,inner:[]};u.push(m),u=m.inner}}}}),s}const tg=pe.define();function rg(t){let e=0,r=0,n=0,i=0;for(let s of t.state.facet(tg)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(r=Math.max(r,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:r,top:n,bottom:i}}const no=pe.define();class xr{constructor(e,r,n,i){this.fromA=e,this.toA=r,this.fromB=n,this.toB=i}join(e){return new xr(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 r=e.length,n=this;for(;r>0;r--){let i=e[r-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(r-1,1)}}return e.splice(r,0,n),e}static extendWithRanges(e,r){if(r.length==0)return e;let n=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<r.length&&r[s]<u;){let h=r[s],d=r[s+1],p=Math.max(a,h),m=Math.min(u,d);if(p<=m&&new xr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new xr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class La{constructor(e,r,n){this.view=e,this.state=r,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Pt.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new xr(s,o,a,l))),this.changedRanges=i}static create(e,r,n){return new La(e,r,n)}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}}var ht=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(ht||(ht={}));const io=ht.LTR,ng=ht.RTL;function ig(t){let e=[];for(let r=0;r<t.length;r++)e.push(1<<+t[r]);return e}const jk=ig("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Vk=ig("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),tu=Object.create(null),cn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),r=t.charCodeAt(1);tu[e]=r,tu[r]=-e}function Wk(t){return t<=247?jk[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Vk[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:t==8204?256:1}const $k=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _n{get dir(){return this.level%2?ng:io}constructor(e,r,n){this.from=e,this.to=r,this.level=n}side(e,r){return this.dir==r==e?this.to:this.from}static find(e,r,n,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=r&&a.to>=r){if(a.level==n)return o;(s<0||(i!=0?i<0?a.from<r:a.to>r:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function sg(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!sg(n.inner,i.inner))return!1}return!0}const qe=[];function Hk(t,e,r,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:r,l=s?256:i;for(let c=o,u=l,h=l;c<a;c++){let d=Wk(t.charCodeAt(c));d==512?d=u:d==8&&h==4&&(d=16),qe[c]=d==4?2:d,d&7&&(h=d),u=d}for(let c=o,u=l,h=l;c<a;c++){let d=qe[c];if(d==128)c<a-1&&u==qe[c+1]&&u&24?d=qe[c]=u:qe[c]=256;else if(d==64){let p=c+1;for(;p<a&&qe[p]==64;)p++;let m=c&&u==8||p<r&&qe[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)qe[y]=m;c=p-1}else d==8&&h==1&&(qe[c]=1);u=d,d&7&&(h=d)}}}function zk(t,e,r,n,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:r;for(let h=c,d,p,m;h<u;h++)if(p=tu[d=t.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(cn[y+1]==-p){let w=cn[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[cn[y]]=A),a=y;break}}else{if(cn.length==189)break;cn[a++]=h,cn[a++]=d,cn[a++]=l}else if((m=qe[h])==2||m==1){let y=m==i;l=y?0:1;for(let w=a-3;w>=0;w-=3){let A=cn[w+2];if(A&2)break;if(y)cn[w+2]|=2;else{if(A&4)break;cn[w+2]|=4}}}}}function Uk(t,e,r,n){for(let i=0,s=n;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:e;for(let l=o;l<a;){let c=qe[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==r.length)break;u=r[i++].to,a=i<r.length?r[i].from:e}else if(qe[u]==256)u++;else break;let h=s==1,d=(u<e?qe[u]:n)==1,p=h==d?h?1:2:n;for(let m=u,y=i,w=y?r[y-1].to:t;m>l;)m==w&&(m=r[--y].from,w=y?r[y-1].to:t),qe[--m]=p;l=u}else s=c,l++}}}function ru(t,e,r,n,i,s,o){let a=n%2?2:1;if(n%2==i%2)for(let l=e,c=0;l<r;){let u=!0,h=!1;if(c==s.length||l<s[c].from){let y=qe[l];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let y=s[c];if(!u)for(let w=y.to,A=c+1;;){if(w==r)break e;if(A<s.length&&s[A].from==w)w=s[A++].to;else{if(qe[w]==a)break e;break}}if(c++,d)d.push(y);else{y.from>l&&o.push(new _n(l,y.from,p));let w=y.direction==io!=!(p%2);nu(t,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.to}m=y.to}else{if(m==r||(u?qe[m]!=a:qe[m]==a))break;m++}d?ru(t,l,m,n+1,i,d,o):l<m&&o.push(new _n(l,m,p)),l=m}else for(let l=r,c=s.length;l>e;){let u=!0,h=!1;if(!c||l>s[c-1].to){let y=qe[l-1];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let y=s[--c];if(!u)for(let w=y.from,A=c;;){if(w==e)break e;if(A&&s[A-1].to==w)w=s[--A].from;else{if(qe[w-1]==a)break e;break}}if(d)d.push(y);else{y.to<l&&o.push(new _n(y.to,l,p));let w=y.direction==io!=!(p%2);nu(t,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.from}m=y.from}else{if(m==e||(u?qe[m-1]!=a:qe[m-1]==a))break;m--}d?ru(t,m,l,n+1,i,d,o):m<l&&o.push(new _n(m,l,p)),l=m}}function nu(t,e,r,n,i,s,o){let a=e%2?2:1;Hk(t,i,s,n,a),zk(t,i,s,n,a),Uk(i,s,n,a),ru(t,i,s,e,r,n,o)}function og(t,e,r){if(!t)return[new _n(0,0,e==ng?1:0)];if(e==io&&!r.length&&!$k.test(t))return ag(t.length);if(r.length)for(;t.length>qe.length;)qe[qe.length]=256;let n=[],i=e==io?0:1;return nu(t,i,i,r,0,t.length,n),n}function ag(t){return[new _n(0,t,0)]}let lg="";function cg(t,e,r,n,i){var s;let o=n.head-t.from,a=-1;if(o==0){if(!i||!t.length)return null;e[0].level!=r&&(o=e[0].side(!1,r),a=0)}else if(o==t.length){if(i)return null;let d=e[e.length-1];d.level!=r&&(o=d.side(!0,r),a=e.length-1)}a<0&&(a=_n.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc));let l=e[a];o==l.side(i,r)&&(l=e[a+=i?1:-1],o=l.side(!i,r));let c=i==(l.dir==r),u=Kt(t.text,o,c);if(lg=t.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,r))return se.cursor(u+t.from,c?-1:1,l.level);let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return!h&&l.level!=r?se.cursor(i?t.to:t.from,i?-1:1,r):h&&h.level<l.level?se.cursor(h.side(!i,r)+t.from,i?1:-1,h.level):se.cursor(u+t.from,i?-1:1,l.level)}class ug extends it{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 It],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xr(0,0,0,e.state.doc.length)],0,null)}update(e){var r;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&(!((r=this.domChanged)===null||r===void 0)&&r.newSel?i=this.domChanged.newSel.head:!Zk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Kk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new xr(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(be.ie||be.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Qk(o,a,e.changes);return n=xr.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,r,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,r,n);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=be.chrome||be.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<this.view.state.doc.length)for(let o of this.children)o instanceof Xn&&o.widget instanceof fg&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,r,n){let i=n?n.range.addToSet(e.slice()):e,s=this.childCursor(r);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:h}=a,d,p,m,y;if(n&&n.range.fromB<h&&n.range.toB>u){let B=eo.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),I=eo.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=B.breakAtStart,m=B.openStart,y=I.openEnd;let W=this.compositionView(n);I.breakAtStart?W.breakAfter=1:I.content.length&&W.merge(W.length,W.length,I.content[0],!1,I.openStart,0)&&(W.breakAfter=I.content[0].breakAfter,I.content.shift()),B.content.length&&W.merge(0,0,B.content[B.content.length-1],!0,0,B.openEnd)&&B.content.pop(),d=B.content.concat(W).concat(I.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=eo.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:E}=s.findPos(l,-1);Ip(this,T,E,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let r=new En(e.text.nodeValue);r.flags|=8;for(let{deco:i}of e.marks)r=new Tn(i,[r],r.length);let n=new It;return n.append(r,0),n}fixCompositionDOM(e){let r=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=it.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];r(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],r(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,r=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&Ea(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||r||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(be.gecko&&a.empty&&!this.hasComposition&&Gk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Jt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Ta(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Ta(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{be.android&&be.chrome&&this.dom.contains(u.focusNode)&&Xk(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Oa(this.view.root);if(h)if(a.empty){if(be.gecko){let d=Yk(l.node,l.offset);if(d&&d!=3){let p=dg(l.node,l.offset,d==1?1:-1);p&&(l=new Jt(p.node,p.offset))}}h.collapse(l.node,l.offset),a.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=a.bidiLevel)}else if(h.extend){h.collapse(l.node,l.offset);try{h.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Jt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Jt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,r=e.state.selection.main,n=Oa(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!r.empty||!r.assoc||!n.modify)return;let o=It.find(this,r.head);if(!o)return;let a=o.posAtStart;if(r.head==a||r.head==a+o.length)return;let l=this.coordsAt(r.head,-1),c=this.coordsAt(r.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(r.head+r.assoc);n.collapse(u.node,u.offset),n.modify("move",r.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=r.from&&n.collapse(i,s)}moveToLine(e){let r=this.dom,n;if(e.node!=r)return e;for(let i=e.offset;!n&&i<r.childNodes.length;i++){let s=it.get(r.childNodes[i]);s instanceof It&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=it.get(r.childNodes[i]);s instanceof It&&(n=s.domAtPos(s.length))}return n?new Jt(n.node,n.offset,!0):e}nearest(e){for(let r=e;r;){let n=it.get(r);if(n&&n.rootView==this)return n;r=r.parentNode}return null}posFromDOM(e,r){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,r)+n.posAtStart}domAtPos(e){let{i:r,off:n}=this.childCursor().findPos(e,-1);for(;r<this.children.length-1;){let i=this.children[r];if(n<i.length||i instanceof It)break;r++,n=0}return this.children[r].domAtPos(n)}coordsAt(e,r){let n=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!n||a instanceof It&&!(n instanceof It&&r>=0))&&(n=a,i=c),s=c}return n?n.coordsAt(e-i,r):null}coordsForChar(e){let{i:r,off:n}=this.childPos(e,1),i=this.children[r];if(!(i instanceof It))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(n,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}n=l}if(!(i instanceof En))return null;let s=Kt(i.text,n);if(s==n)return null;let o=Si(i.dom,n,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let r=[],{from:n,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ht.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],d=c+h.length;if(d>i)break;if(c>=n){let p=h.dom.getBoundingClientRect();if(r.push(p.height),o){let m=h.dom.lastChild,y=m?Zi(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return r}textDirectionAt(e){let{i:r}=this.childPos(e,1);return getComputedStyle(this.children[r].dom).direction=="rtl"?ht.RTL:ht.LTR}measureTextSize(){for(let s of this.children)if(s instanceof It){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),r,n,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=Zi(e.firstChild)[0];r=e.getBoundingClientRect().height,n=s?s.width/27:7,i=s?s.height:r,e.remove()}),{lineHeight:r,charWidth:n,textHeight:i}}childCursor(e=this.length){let r=this.children.length;return r&&(e-=this.children[--r].length),new Mp(this.children,e,r)}computeBlockGapDeco(){let e=[],r=this.view.viewState;for(let n=0,i=0;;i++){let s=i==r.viewports.length?null:r.viewports[i],o=s?s.from-1:this.length;if(o>n){let a=(r.lineBlockAt(o).bottom-r.lineBlockAt(n).top)/this.view.scaleY;e.push(ke.replace({widget:new fg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return ke.set(e)}updateDeco(){let e=this.view.state.facet(ro).map((r,n)=>(this.dynamicDecorationMap[n]=typeof r=="function")?r(this.view):r);for(let r=e.length;r<e.length+3;r++)this.dynamicDecorationMap[r]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}let{range:r}=e,n=this.coordsAt(r.head,r.empty?r.assoc:r.head>r.anchor?-1:1),i;if(!n)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=rg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;Ek(this.view.scrollDOM,o,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==ht.LTR)}}function Gk(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}class fg extends ln{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function hg(t,e){let r=t.observer.selectionRange,n=r.focusNode&&dg(r.focusNode,r.focusOffset,0);if(!n)return null;let i=e-n.offset;return{from:i,to:i+n.node.nodeValue.length,node:n.node}}function Kk(t,e,r){let n=hg(t,r);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,c=new xr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=it.get(h);if(d instanceof Tn)u.push({node:h,deco:d.mark});else{if(d instanceof It||h.nodeName=="DIV"&&h.parentNode==t.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=t.contentDOM)u.push({node:h,deco:new _s({inclusive:!0,attributes:Lk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function dg(t,e,r){if(r<=0)for(let n=t,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i>0)n=n.childNodes[i-1],i=On(n);else break}if(r>=0)for(let n=t,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length&&r>=0)n=n.childNodes[i],i=0;else break}return null}function Yk(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let Jk=class{constructor(){this.changes=[]}compareRange(e,r){Zc(e,r,this.changes)}comparePoint(e,r){Zc(e,r,this.changes)}};function Qk(t,e,r){let n=new Jk;return Qe.compare(t,e,r,n),n.changes}function Xk(t,e){for(let r=t;r&&r!=e;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function Zk(t,e){let r=!1;return e&&t.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(r=!0)}),r}function _k(t,e,r=1){let n=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return se.cursor(e);s==0?r=1:s==i.length&&(r=-1);let o=s,a=s;r<0?o=Kt(i.text,s,!1):a=Kt(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Kt(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Kt(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return se.range(o+i.from,a+i.from)}function qk(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function eA(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function iu(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function pg(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function gg(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function su(t,e,r){let n,i,s,o,a=!1,l,c,u,h;for(let m=t.firstChild;m;m=m.nextSibling){let y=Zi(m);for(let w=0;w<y.length;w++){let A=y[w];i&&iu(i,A)&&(A=pg(gg(A,i.bottom),i.top));let T=qk(e,A),E=eA(r,A);if(T==0&&E==0)return m.nodeType==3?mg(m,e,r):su(m,e,r);if(!n||o>E||o==E&&s>T){n=m,i=A,s=T,o=E;let B=E?r<A.top?-1:1:T?e<A.left?-1:1:0;a=!B||(B>0?w<y.length-1:w>0)}T==0?r>A.bottom&&(!u||u.bottom<A.bottom)?(l=m,u=A):r<A.top&&(!h||h.top>A.top)&&(c=m,h=A):u&&iu(u,A)?u=gg(u,A.bottom):h&&iu(h,A)&&(h=pg(h,A.top))}}if(u&&u.bottom>=r?(n=l,i=u):h&&h.top<=r&&(n=c,i=h),!n)return{node:t,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return mg(n,d,r);if(a&&n.contentEditable!="false")return su(n,d,r);let p=Array.prototype.indexOf.call(t.childNodes,n)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:p}}function mg(t,e,r){let n=t.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<n;a++){let l=Si(t,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>r?u.top-r:r-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let d=e>=(u.left+u.right)/2,p=d;if((be.chrome||be.gecko)&&Si(t,a).getBoundingClientRect().left==u.right&&(p=!d),h<=0)return{node:t,offset:a+(p?1:0)};i=a+(p?1:0),s=h}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function vg(t,e,r,n=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),a=o.top+t.viewState.paddingTop,l,{docHeight:c}=t.viewState,{x:u,y:h}=e,d=h-a;if(d<0)return 0;if(d>c)return t.state.doc.length;for(let B=t.viewState.heightOracle.textHeight/2,I=!1;l=t.elementAtHeight(d),l.type!=sr.Text;)for(;d=n>0?l.bottom+B:l.top-B,!(d>=0&&d<=c);){if(I)return r?null:0;I=!0,n=-n}h=a+d;let p=l.from;if(p<t.viewport.from)return t.viewport.from==0?0:r?null:yg(t,o,l,u,h);if(p>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:r?null:yg(t,o,l,u,h);let m=t.dom.ownerDocument,y=t.root.elementFromPoint?t.root:m,w=y.elementFromPoint(u,h);w&&!t.contentDOM.contains(w)&&(w=null),w||(u=Math.max(o.left+1,Math.min(o.right-1,u)),w=y.elementFromPoint(u,h),w&&!t.contentDOM.contains(w)&&(w=null));let A,T=-1;if(w&&((i=t.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(m.caretPositionFromPoint){let B=m.caretPositionFromPoint(u,h);B&&({offsetNode:A,offset:T}=B)}else if(m.caretRangeFromPoint){let B=m.caretRangeFromPoint(u,h);B&&({startContainer:A,startOffset:T}=B,(!t.contentDOM.contains(A)||be.safari&&tA(A,T,u)||be.chrome&&rA(A,T,u))&&(A=void 0))}}if(!A||!t.docView.dom.contains(A)){let B=It.find(t.docView,p);if(!B)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=su(B.dom,u,h))}let E=t.docView.nearest(A);if(!E)return null;if(E.isWidget&&((s=E.dom)===null||s===void 0?void 0:s.nodeType)==1){let B=E.dom.getBoundingClientRect();return e.y<B.top||e.y<=B.bottom&&e.x<=(B.left+B.right)/2?E.posAtStart:E.posAtEnd}else return E.localPosFromDOM(A,T)+E.posAtStart}function yg(t,e,r,n,i){let s=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&r.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-r.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(r.from,r.to);return r.from+jc(o,s,t.state.tabSize)}function tA(t,e,r){let n;if(t.nodeType!=3||e!=(n=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Si(t,n-1,n).getBoundingClientRect().left>r}function rA(t,e,r){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 n=t.nodeType==1?t.getBoundingClientRect():Si(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return r-n.left>5}function ou(t,e){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){for(let n of r.type)if(n.to>e||n.to==e&&(n.to==r.to||n.type==sr.Text))return n}return r}function nA(t,e,r,n){let i=ou(t,e.head),s=!n||i.type!=sr.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(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:r==(a==ht.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return se.cursor(l,r?-1:1)}return se.cursor(r?i.to:i.from,r?-1:1)}function bg(t,e,r,n){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=cg(i,s,o,a,r),u=lg;if(!c){if(i.number==(r?t.state.doc.lines:1))return a;u=`
|
|
148
|
-
`,i=t.state.doc.line(i.number+(r?1:-1)),s=t.bidiSpans(i),c=se.cursor(r?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function iA(t,e,r){let n=t.state.charCategorizer(e),i=n(r);return s=>{let o=n(s);return i==at.Space&&(i=o),i==o}}function sA(t,e,r,n){let i=e.head,s=r?1:-1;if(i==(r?t.state.doc.length:0))return se.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),u=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=n??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(d+p)*s,y=vg(t,{x:h,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?y<i:y>i)){let w=t.docView.coordsForChar(y),A=!w||m<w.top?-1:1;return se.cursor(y,A,void 0,o)}}}function Ba(t,e,r){for(;;){let n=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||r||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function au(t,e,r){let n=Ba(t.state.facet(eu).map(i=>i(t)),r.from,e.head>r.from?-1:1);return n==r.from?r:se.cursor(n,n<r.from?1:-1)}class oA{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,be.safari&&e.contentDOM.addEventListener("input",()=>null),be.gecko&&SA(e.contentDOM.ownerDocument)}handleEvent(e){!pA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,r){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,r);for(let i of n.handlers){if(r.defaultPrevented)break;if(i(this.view,r)){r.preventDefault();break}}}}ensureHandlers(e){let r=aA(e),n=this.handlers,i=this.view.contentDOM;for(let s in r)if(s!="scroll"){let o=!r[s].handlers.length,a=n[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!r[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=r}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(e.keyCode!=27&&Sg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),be.android&&be.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let r;return be.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((r=wg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||lA.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=r||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,qi(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:be.safari&&!be.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 xg(t,e){return(r,n)=>{try{return e.call(t,n,r)}catch(i){br(r.state,i)}}}function aA(t){let e=Object.create(null);function r(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let i=n.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&r(s).handlers.push(xg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&r(s).observers.push(xg(n.value,o))}}for(let n in Gr)r(n).handlers.push(Gr[n]);for(let n in Kr)r(n).observers.push(Kr[n]);return e}const wg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],lA="dthko",Sg=[16,17,18,20,91,92,224,225],Fa=6;function ja(t){return Math.max(0,t)*.7+8}function cA(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class uA{constructor(e,r,n,i){this.view=e,this.startEvent=r,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParent=Tk(e.contentDOM),this.atoms=e.state.facet(eu).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=r.shiftKey,this.multiple=e.state.facet(Ve.allowMultipleSelections)&&fA(e,r),this.dragging=dA(e,r)&&Dg(r)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var r;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&cA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=0,s=((r=this.scrollParent)===null||r===void 0?void 0:r.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=rg(this.view);e.clientX-o.left<=s.left+Fa?n=-ja(s.left-e.clientX):e.clientX+o.right>=s.right-Fa&&(n=ja(e.clientX-s.right)),e.clientY-o.top<=s.top+Fa?i=-ja(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Fa&&(i=ja(e.clientY-s.bottom)),this.setScrollSpeed(n,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,r){this.scrollSpeed={x:e,y:r},e||r?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 r=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=Ba(this.atoms,i.from,0);o!=i.from&&(s=se.cursor(o,-1))}else{let o=Ba(this.atoms,i.from,-1),a=Ba(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=se.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(r||(r=e.ranges.slice()),r[n]=s)}return r?se.create(r,e.mainIndex):e}select(e){let{view:r}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(r.state.selection)||n.main.assoc!=r.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function fA(t,e){let r=t.state.facet(Up);return r.length?r[0](e):be.mac?e.metaKey:e.ctrlKey}function hA(t,e){let r=t.state.facet(Gp);return r.length?r[0](e):be.mac?!e.altKey:!e.ctrlKey}function dA(t,e){let{main:r}=t.state.selection;if(r.empty)return!1;let n=Oa(t.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function pA(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target,n;r!=t.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(n=it.get(r))&&n.ignoreEvent(e))return!1;return!0}const Gr=Object.create(null),Kr=Object.create(null),kg=be.ie&&be.ie_version<15||be.ios&&be.webkit_version<604;function gA(t){let e=t.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{t.focus(),r.remove(),Ag(t,r.value)},50)}function Ag(t,e){let{state:r}=t,n,i=1,s=r.toText(e),o=s.lines==r.selection.ranges.length;if(lu!=null&&r.selection.ranges.every(l=>l.empty)&&lu==s.toString()){let l=-1;n=r.changeByRange(c=>{let u=r.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=r.toText((o?s.line(i++).text:e)+r.lineBreak);return{changes:{from:u.from,insert:h},range:se.cursor(c.from+h.length)}})}else o?n=r.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:se.cursor(l.from+c.length)}}):n=r.replaceSelection(s);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Kr.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Gr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1),Kr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Kr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Gr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let r=null;for(let n of t.state.facet(Kp))if(r=n(t,e),r)break;if(!r&&e.button==0&&(r=yA(t,e)),r){let n=!t.hasFocus;t.inputState.startMouseSelection(new uA(t,e,r,n)),n&&t.observer.ignore(()=>Cp(t.contentDOM));let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function Cg(t,e,r,n){if(n==1)return se.cursor(e,r);if(n==2)return _k(t.state,e,r);{let i=It.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,se.range(o,a)}}let Og=(t,e)=>t>=e.top&&t<=e.bottom,Eg=(t,e,r)=>Og(e,r)&&t>=r.left&&t<=r.right;function mA(t,e,r,n){let i=It.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&&Eg(r,n,o))return-1;let a=i.coordsAt(s,1);return a&&Eg(r,n,a)?1:o&&Og(n,o)?-1:1}function Tg(t,e){let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:r,bias:mA(t,r,e.clientX,e.clientY)}}const vA=be.ie&&be.ie_version<=11;let Pg=null,Mg=0,Ig=0;function Dg(t){if(!vA)return t.detail;let e=Pg,r=Ig;return Pg=t,Ig=Date.now(),Mg=!e||r>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Mg+1)%3:1}function yA(t,e){let r=Tg(t,e),n=Dg(e),i=t.state.selection;return{update(s){s.docChanged&&(r.pos=s.changes.mapPos(r.pos),i=i.map(s.changes))},get(s,o,a){let l=Tg(t,s),c,u=Cg(t,l.pos,l.bias,n);if(r.pos!=l.pos&&!o){let h=Cg(t,r.pos,r.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?se.range(d,p):se.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=bA(i,l.pos))?c:a?i.addRange(u):se.create([u])}}}function bA(t,e){for(let r=0;r<t.ranges.length;r++){let{from:n,to:i}=t.ranges[r];if(n<=e&&i>=e)return se.create(t.ranges.slice(0,r).concat(t.ranges.slice(r+1)),t.mainIndex==r?0:t.mainIndex-(t.mainIndex>r?1:0))}return null}Gr.dragstart=(t,e)=>{let{selection:{main:r}}=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>=r.to||o<=r.from)&&(r=se.range(s,o))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=r,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(r.from,r.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Gr.dragend=t=>(t.inputState.draggedContent=null,!1);function Ng(t,e,r,n){if(!r)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=n&&s&&hA(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:r},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Gr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let r=e.dataTransfer.files;if(r&&r.length){let n=Array(r.length),i=0,s=()=>{++i==r.length&&Ng(t,e,n.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<r.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),s()},a.readAsText(r[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ng(t,e,n,!0),!0}return!1},Gr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let r=kg?null:e.clipboardData;return r?(Ag(t,r.getData("text/plain")||r.getData("text/uri-text")),!0):(gA(t),!1)};function xA(t,e){let r=t.dom.parentNode;if(!r)return;let n=r.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}function wA(t){let e=[],r=[],n=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),r.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),r.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}n=!0}return{text:e.join(t.lineBreak),ranges:r,linewise:n}}let lu=null;Gr.copy=Gr.cut=(t,e)=>{let{text:r,ranges:n,linewise:i}=wA(t.state);if(!r&&!i)return!1;lu=i?r:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=kg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(xA(t,r),!1)};const Rg=an.define();function Lg(t,e){let r=[];for(let n of t.facet(Qp)){let i=n(t,e);i&&r.push(i)}return r?t.update({effects:r,annotations:Rg.of(!0)}):null}function Bg(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let r=Lg(t.state,e);r?t.dispatch(r):t.update([])}},10)}Kr.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),Bg(t)},Kr.blur=t=>{t.observer.clearSelectionRange(),Bg(t)},Kr.compositionstart=Kr.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Kr.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,be.chrome&&be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)},Kr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Gr.beforeinput=(t,e)=>{var r;let n;if(be.chrome&&be.android&&(n=wg.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.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 Fg=new Set;function SA(t){Fg.has(t)||(Fg.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const jg=["pre-wrap","normal","pre-line","break-spaces"];class Vg{constructor(e){this.lineWrapping=e,this.doc=Je.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,r){let n=this.doc.lineAt(r).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((r-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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 jg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(r=!0,this.heightSamples[Math.floor(i*10)]=!0)}return r}refresh(e,r,n,i,s,o){let a=jg.indexOf(e)>-1,l=Math.round(r)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=r,this.charWidth=n,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class Wg{constructor(e,r){this.from=e,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class un{constructor(e,r,n,i,s){this.from=e,this.length=r,this.top=n,this.height=i,this._content=s}get type(){return typeof this._content=="number"?sr.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Zn?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new un(this.from,this.length+e.length,this.top,this.height+e.height,r)}}var tt=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(tt||(tt={}));const Va=.001;class Qt{constructor(e,r,n=2){this.length=e,this.height=r,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,r){this.height!=r&&(Math.abs(this.height-r)>Va&&(e.heightChanged=!0),this.height=r)}replace(e,r,n){return Qt.of(n)}decomposeLeft(e,r){r.push(this)}decomposeRight(e,r){r.push(this)}applyChanges(e,r,n,i){let s=this,o=n.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,n.setDoc(r),0,0),p=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,n,0,0));u+=d.from-l,l=d.from;let m=cu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new wr(0,0)}static of(e){if(e.length==1)return e[0];let r=0,n=e.length,i=0,s=0;for(;;)if(r==n)if(i>s*2){let a=e[r-1];a.break?e.splice(--r,1,a.left,null,a.right):e.splice(--r,1,a.left,a.right),n+=1+a.break,i-=a.size}else if(s>i*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[r++];a&&(i+=a.size)}else{let a=e[--n];a&&(s+=a.size)}let o=0;return e[r-1]==null?(o=1,r--):e[r]==null&&(o=1,n++),new kA(Qt.of(e.slice(0,r)),o,Qt.of(e.slice(n)))}}Qt.prototype.size=1;class $g extends Qt{constructor(e,r,n){super(e,r),this.deco=n}blockAt(e,r,n,i){return new un(i,this.length,n,this.height,this.deco||0)}lineAt(e,r,n,i,s){return this.blockAt(0,n,i,s)}forEachLine(e,r,n,i,s,o){e<=s+this.length&&r>=s&&o(this.blockAt(0,n,i,s))}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class wr extends $g{constructor(e,r){super(e,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,r,n,i){return new un(i,this.length,n,this.height,this.breaks)}replace(e,r,n){let i=n[0];return n.length==1&&(i instanceof wr||i instanceof Vt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Vt?i=new wr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Qt.of(n)}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more?this.setHeight(e,i.heights[i.index++]):(n||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 Vt extends Qt{constructor(e){super(e,0)}heightMetrics(e,r){let n=e.doc.lineAt(r).number,i=e.doc.lineAt(r+this.length).number,s=i-n+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:i,perLine:o,perChar:a}}blockAt(e,r,n,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i);if(r.lineWrapping){let c=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=r.doc.lineAt(c),h=a+u.length*l,d=Math.max(n,e-h/2);return new un(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/a))),{from:u,length:h}=r.doc.line(s+c);return new un(u,h,n+a*c,a,0)}}lineAt(e,r,n,i,s){if(r==tt.ByHeight)return this.blockAt(e,n,i,s);if(r==tt.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(e);return new un(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new un(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,r,n,i,s,o){e=Math.max(e,s),r=Math.min(r,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=i;u<=r;){let d=n.doc.lineAt(u);if(u==e){let m=d.number-a;h+=l*m+c*(e-s-m)}let p=l+c*d.length;o(new un(d.from,d.length,h,p,0)),h+=p,u=d.to+1}}replace(e,r,n){let i=this.length-r;if(i>0){let s=n[n.length-1];s instanceof Vt?n[n.length-1]=new Vt(s.length+i):n.push(null,new Vt(i-1))}if(e>0){let s=n[0];s instanceof Vt?n[0]=new Vt(e+s.length):n.unshift(new Vt(e-1),null)}return Qt.of(n)}decomposeLeft(e,r){r.push(new Vt(e-1),null)}decomposeRight(e,r){r.push(null,new Vt(this.length-e-1))}updateHeight(e,r=0,n=!1,i){let s=r+this.length;if(i&&i.from<=r+this.length&&i.more){let o=[],a=Math.max(r,i.from),l=-1;for(i.from>r&&o.push(new Vt(i.from-r-1).updateHeight(e,r));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=Va&&(l=-2);let d=new wr(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Vt(s-a).updateHeight(e,a));let c=Qt.of(o);return(l<0||Math.abs(c.height-this.height)>=Va||Math.abs(l-this.heightMetrics(e,r).perLine)>=Va)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class kA extends Qt{constructor(e,r,n){super(e.length+r+n.length,e.height+n.height,r|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,r,n,i){let s=n+this.left.height;return e<s?this.left.blockAt(e,r,n,i):this.right.blockAt(e,r,s,i+this.left.length+this.break)}lineAt(e,r,n,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=r==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,r,n,i,s):this.right.lineAt(e,r,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=r==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,s).join(c)}forEachLine(e,r,n,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,r,n,i,s,o),r>=l&&this.right.forEachLine(e,r,n,a,l,o);else{let c=this.lineAt(l,tt.ByPos,n,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,s,o),c.to>=e&&c.from<=r&&o(c),r>c.to&&this.right.forEachLine(c.to+1,r,n,a,l,o)}}replace(e,r,n){let i=this.left.length+this.break;if(r<i)return this.balanced(this.left.replace(e,r,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,r-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of n)s.push(a);if(e>0&&Hg(s,o-1),r<this.length){let a=s.length;this.decomposeRight(r,s),Hg(s,a)}return Qt.of(s)}decomposeLeft(e,r){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,r);r.push(this.left),this.break&&(n++,e>=n&&r.push(null)),e>n&&this.right.decomposeLeft(e-n,r)}decomposeRight(e,r){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,r);e<n&&this.left.decomposeRight(e,r),this.break&&e<i&&r.push(null),r.push(this.right)}balanced(e,r){return e.size>2*r.size||r.size>2*e.size?Qt.of(this.break?[e,null,r]:[e,r]):(this.left=e,this.right=r,this.height=e.height+r.height,this.outdated=e.outdated||r.outdated,this.size=e.size+r.size,this.length=e.length+this.break+r.length,this)}updateHeight(e,r=0,n=!1,i){let{left:s,right:o}=this,a=r+s.length+this.break,l=null;return i&&i.from<=r+s.length&&i.more?l=s=s.updateHeight(e,r,n,i):s.updateHeight(e,r,n),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,n,i):o.updateHeight(e,a,n),l?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 Hg(t,e){let r,n;t[e]==null&&(r=t[e-1])instanceof Vt&&(n=t[e+1])instanceof Vt&&t.splice(e-1,3,new Vt(r.length+1+n.length))}const AA=5;class cu{constructor(e,r){this.pos=e,this.oracle=r,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,r){if(this.lineStart>-1){let n=Math.min(r,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof wr?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new wr(n-this.pos,-1)),this.writtenTo=n,r>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(e,r,n){if(e<r||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=r-e;n.block?this.addBlock(new $g(o,i,n)):(o||s||i>=AA)&&this.addLineDeco(i,s,o)}else r>e&&this.span(e,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=r,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new wr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,r){let n=new Vt(r-e);return this.oracle.doc.lineAt(e).to==r&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof wr)return e;let r=new wr(0,-1);return this.nodes.push(r),r}addBlock(e){this.enterLine();let r=e.deco;r&&r.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,r&&r.endSide>0&&(this.covering=e)}addLineDeco(e,r,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=r,this.writtenTo=this.pos=this.pos+n}finish(e){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof wr)&&!this.isCovered?this.nodes.push(new wr(0,-1)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof wr&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,r,n,i){let s=new cu(n,e);return Qe.spans(r,n,i,s,0),s.finish(n)}}function CA(t,e,r){let n=new OA;return Qe.compare(t,e,r,n,0),n.changes}class OA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,r,n,i){(e<r||n&&n.heightRelevant||i&&i.heightRelevant)&&Zc(e,r,this.changes,5)}}function EA(t,e){let r=t.getBoundingClientRect(),n=t.ownerDocument,i=n.defaultView||window,s=Math.max(0,r.left),o=Math.min(i.innerWidth,r.right),a=Math.max(0,r.top),l=Math.min(i.innerHeight,r.bottom);for(let c=t.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=c==t.parentNode?d.bottom:Math.min(l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-r.left,right:Math.max(s,o)-r.left,top:a-(r.top+e),bottom:Math.max(a,l)-(r.top+e)}}function TA(t,e){let r=t.getBoundingClientRect();return{left:0,right:r.right-r.left,top:e,bottom:r.bottom-(r.top+e)}}class uu{constructor(e,r,n){this.from=e,this.to=r,this.size=n}static same(e,r){if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],s=r[n];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,r){return ke.replace({widget:new PA(this.size*(r?e.scaleY:e.scaleX),r)}).range(this.from,this.to)}}class PA extends ln{constructor(e,r){super(),this.size=e,this.vertical=r}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class zg{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ug,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ht.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=e.facet(Ra).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Vg(r),this.stateDeco=e.facet(ro).filter(n=>typeof n!="function"),this.heightMap=Qt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle.setDoc(e.doc),[new xr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ke.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:r}=this.state.selection;for(let n=0;n<=1;n++){let i=n?r.head:r.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Wa(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Ug:new DA(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:so(e,this.scaler))})}update(e,r=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ro).filter(u=>typeof u!="function");let i=e.changedRanges,s=xr.extendWithRanges(i,CA(n,this.stateDeco,e?e.changes:Pt.empty(this.state.doc.length))),o=this.heightMap.height,a=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),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(r&&(r.range.head<l.from||r.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,r));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Zp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let r=e.contentDOM,n=window.getComputedStyle(r),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ht.RTL:ht.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=r.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let B=a.width/r.offsetWidth,I=a.height/r.offsetHeight;(B>.995&&B<1.005||!isFinite(B)||Math.abs(a.width-r.offsetWidth)<1)&&(B=1),(I>.995&&I<1.005||!isFinite(I)||Math.abs(a.height-r.offsetHeight)<1)&&(I=1),(this.scaleX!=B||this.scaleY!=I)&&(this.scaleX=B,this.scaleY=I,c|=8,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Tp(e.scrollDOM);let m=(this.printing?TA:EA)(r,this.paddingTop),y=m.top-this.pixelViewport.top,w=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let B=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(B)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:I,charWidth:W,textHeight:F}=e.docView.measureTextSize();o=I>0&&i.refresh(s,I,W,F,T/W,B),o&&(e.docView.minWidth=0,c|=8)}y>0&&w>0?u=Math.max(y,w):y<0&&w<0&&(u=Math.min(y,w)),i.heightChanged=!1;for(let I of this.viewports){let W=I.from==this.viewport.from?B:e.docView.measureVisibleLineHeights(I);this.heightMap=(o?Qt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle,[new xr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new Wg(I.from,W))}i.heightChanged&&(c|=2)}let E=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,r){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Wa(i.lineAt(o-n*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-n)*1e3,tt.ByHeight,s,0,0).to);if(r){let{head:c}=r.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;r.y=="center"?d=(h.top+h.bottom)/2-u/2:r.y=="start"||r.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new Wa(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,r){let n=r.mapPos(e.from,-1),i=r.mapPos(e.to,1);return new Wa(this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:r},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(r,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(r==this.state.doc.length||s>=a+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,r){if(!e.length||r.empty)return e;let n=[];for(let i of e)r.touchesRange(i.from,i.to)||n.push(new uu(r.mapPos(i.from),r.mapPos(i.to),i.size));return n}ensureLineGaps(e,r){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=ht.LTR&&!n)return[];let a=[],l=(c,u,h,d)=>{if(u-c<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let w of m)if(w>c&&w<u){l(c,w-10,h,d),l(w+10,u,h,d);return}let y=IA(e,w=>w.from>=h.from&&w.to<=h.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-u)<s&&!m.some(A=>w.from<A&&w.to>A));if(!y){if(u<h.to&&r&&n&&r.visibleRanges.some(w=>w.from<=u&&w.to>=u)){let w=r.moveToLineBoundary(se.cursor(u),!1,!0).head;w>c&&(u=w)}y=new uu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=MA(c.from,c.to,this.stateDeco);if(u.total<o)continue;let h=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,w;if(h!=null){let A=Ha(u,h),T=((this.visibleBottom-this.visibleTop)/2+m)/c.height;y=A-T,w=A+T}else y=(this.visibleTop-c.top-m)/c.height,w=(this.visibleBottom-c.top+m)/c.height;d=$a(u,y),p=$a(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=Ha(u,h),E=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-E,A=T+E}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=$a(u,w),p=$a(u,A)}d>c.from&&l(c.from,d,c,u),p<c.to&&l(p,c.to,c,u)}return a}gapSize(e,r,n,i){let s=Ha(i,n)-Ha(i,r);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){uu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ke.set(e.map(r=>r.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let r=[];Qe.spans(e,this.viewport.from,this.viewport.to,{span(i,s){r.push({from:i,to:s})},point(){}},20);let n=r.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=r[s].from||i.to!=r[s].to);return this.visibleRanges=r,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(r=>r.from<=e&&r.to>=e)||so(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return so(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let r=this.lineBlockAtHeight(e+8);return r.from>=this.viewport.from||this.viewportLines[0].top-e>200?r:this.viewportLines[0]}elementAtHeight(e){return so(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 Wa{constructor(e,r){this.from=e,this.to=r}}function MA(t,e,r){let n=[],i=t,s=0;return Qe.spans(r,t,e,{span(){},point(o,a){o>i&&(n.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function $a({total:t,ranges:e},r){if(r<=0)return e[0].from;if(r>=1)return e[e.length-1].to;let n=Math.floor(t*r);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(n<=a)return s+n;n-=a}}function Ha(t,e){let r=0;for(let{from:n,to:i}of t.ranges){if(e<=i){r+=e-n;break}r+=i-n}return r/t.total}function IA(t,e){for(let r of t)if(e(r))return r}const Ug={toDOM(t){return t},fromDOM(t){return t},scale:1};class DA{constructor(e,r,n){let i=0,s=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=r.lineAt(a,tt.ByPos,e,0,0).top,u=r.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(r.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let r=0,n=0,i=0;;r++){let s=r<this.viewports.length?this.viewports[r]:null;if(!s||e<s.top)return i+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,i=s.domBottom}}fromDOM(e){for(let r=0,n=0,i=0;;r++){let s=r<this.viewports.length?this.viewports[r]:null;if(!s||e<s.domTop)return n+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,i=s.domBottom}}}function so(t,e){if(e.scale==1)return t;let r=e.toDOM(t.top),n=e.toDOM(t.bottom);return new un(t.from,t.length,r,n-r,Array.isArray(t._content)?t._content.map(i=>so(i,e)):t._content)}const za=pe.define({combine:t=>t.join(" ")}),fu=pe.define({combine:t=>t.indexOf(!0)>-1}),hu=Yn.newName(),Gg=Yn.newName(),Kg=Yn.newName(),Yg={"&light":"."+Gg,"&dark":"."+Kg};function du(t,e,r){return new Yn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return t;if(!r||!r[i])throw new RangeError(`Unsupported selector: ${i}`);return r[i]}):t+" "+n}})}const NA=du("."+hu,{"&":{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"},"&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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Yg),oo="\uFFFF";class RA{constructor(e,r){this.points=e,this.text="",this.lineSeparator=r.facet(Ve.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=oo}readRange(e,r){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==r)break;let a=it.get(i),l=it.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Jg(i))||Jg(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(n,r),this}readTextNode(e){let r=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,r.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=r.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=i.exec(r))&&(s=a.index,o=a[0].length),this.append(r.slice(n,s<0?r.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let r=it.get(e),n=r&&r.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.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,r){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==r&&(n.pos=this.text.length)}findPointInside(e,r){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(LA(e,n.node,n.offset)?r:0))}}function LA(t,e,r){for(;;){if(!e||r<On(e))return!1;if(e==t)return!0;r=Zs(e)+1,e=e.parentNode}}function Jg(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Qg{constructor(e,r){this.node=e,this.offset=r,this.pos=-1}}class BA{constructor(e,r,n,i){this.typeOver=i,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=e.docView.domBoundsAround(r,n,0))){let a=s||o?[]:VA(e),l=new RA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=WA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Hc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Hc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=se.single(c,l)}}}function Xg(t,e){let r,{newSel:n}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||be.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=jA(t.state.doc.sliceString(o,a,oo),e.text,l-o,c);u&&(be.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==oo+oo&&u.toB--,r={from:o+u.from,to:o+u.toA,insert:Je.of(e.text.slice(u.from,u.toB).split(oo))})}else n&&(!t.hasFocus&&t.state.facet(Na)||n.main.eq(i))&&(n=null);if(!r&&!n)return!1;if(!r&&e.typeOver&&!i.empty&&n&&n.main.empty?r={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:r&&r.from>=i.from&&r.to<=i.to&&(r.from!=i.from||r.to!=i.to)&&i.to-i.from-(r.to-r.from)<=4?r={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,r.from).append(r.insert).append(t.state.doc.slice(r.to,i.to))}:(be.mac||be.android)&&r&&r.from==r.to&&r.from==i.head-1&&/^\. ?$/.test(r.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(n&&r.insert.length==2&&(n=se.single(n.main.anchor-1,n.main.head-1)),r={from:i.from,to:i.to,insert:Je.of([" "])}):be.chrome&&r&&r.from==r.to&&r.from==i.head&&r.insert.toString()==`
|
|
149
|
-
`&&t.lineWrapping&&(n&&(n=se.single(n.main.anchor-1,n.main.head-1)),r={from:i.from,to:i.to,insert:Je.of([" "])}),r){if(be.ios&&t.inputState.flushIOSKey()||be.android&&(r.from==i.from&&r.to==i.to&&r.insert.length==1&&r.insert.lines==2&&qi(t.contentDOM,"Enter",13)||(r.from==i.from-1&&r.to==i.to&&r.insert.length==0||s==8&&r.insert.length<r.to-r.from&&r.to>i.head)&&qi(t.contentDOM,"Backspace",8)||r.from==i.from&&r.to==i.to+1&&r.insert.length==0&&qi(t.contentDOM,"Delete",46)))return!0;let o=r.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=FA(t,r,n));return t.state.facet(Jp).some(c=>c(t,r.from,r.to,o,l))||t.dispatch(l()),!0}else if(n&&!n.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function FA(t,e,r){let n,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&&(!r||r.main.empty&&r.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=i.changes(e),l=r&&r.main.to<=a.newLength?r.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),u,h=r&&hg(t,r.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=t.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let y=m.to-d,w=y-c.length;if(m.to-m.from!=p||t.state.sliceDoc(w,y)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let A=i.changes({from:w,to:y,insert:e.insert}),T=m.to-s.to;return{changes:A,range:l?se.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):m.map(A)}})}else n={changes:a,selection:l&&i.selection.replaceRange(l)}}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(n,{userEvent:o,scrollIntoView:!0})}function jA(t,e,r,n){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.length<e.length){let l=r<=s&&r>=o?s-r:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function VA(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}=t.observer.selectionRange;return r&&(e.push(new Qg(r,n)),(i!=r||s!=n)&&e.push(new Qg(i,s))),e}function WA(t,e){if(t.length==0)return null;let r=t[0].pos,n=t.length==2?t[1].pos:r;return r>-1&&n>-1?se.single(r+e,n+e):null}const $A={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},pu=be.ie&&be.ie_version<=11;class HA{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Pk,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(r=>{for(let n of r)this.queue.push(n);(be.ie&&be.ie_version<=11||be.ios&&e.composing)&&r.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),pu&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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 r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.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(r=>{r.length>0&&r[r.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((r,n)=>r!=e[n]))){this.gapIntersection.disconnect();for(let r of e)this.gapIntersection.observe(r);this.gaps=e}}onSelectionChange(e){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Na)?n.root.activeElement!=this.dom:!Ea(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){r||(this.selectionChanged=!1);return}(be.ie&&be.ie_version<=11||be.android&&be.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ta(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,r=be.safari&&e.root.nodeType==11&&Ck(this.dom.ownerDocument)==this.dom&&zA(this.view)||Oa(e.root);if(!r||this.selectionRange.eq(r))return!1;let n=Ea(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Ik(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,r){this.selectionRange.set(e.node,e.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,r=null;for(let n=this.dom;n;)if(n.nodeType==1)!r&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:r||(r=this.scrollTargets.slice(0,e)),r&&r.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,e)),r){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=r)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,$A),pu&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),pu&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,r){var n;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&qi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let r=-1,n=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),r==-1?{from:r,to:n}=o:(r=Math.min(o.from,r),n=Math.max(o.to,n)))}return{from:r,to:n,typeOver:i}}readChange(){let{from:e,to:r,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Ea(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 BA(this.view,e,r,n);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 r=this.readChange();if(!r)return this.view.requestMeasure(),!1;let n=this.view.state,i=Xg(this.view,r);return this.view.state==n&&this.view.update([]),i}readMutation(e){let r=this.view.docView.nearest(e.target);if(!r||r.ignoreMutation(e))return null;if(r.markDirty(e.type=="attributes"),e.type=="attributes"&&(r.flags|=4),e.type=="childList"){let n=Zg(r,e.previousSibling||e.target.previousSibling,-1),i=Zg(r,e.nextSibling||e.target.nextSibling,1);return{from:n?r.posAfter(n):r.posAtStart,to:i?r.posBefore(i):r.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:r.posAtStart,to:r.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,r,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.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 Zg(t,e,r){for(;e;){let n=it.get(e);if(n&&n.parent==t)return n;let i=e.parentNode;e=i!=t.dom?i:r>0?e.nextSibling:e.previousSibling}return null}function zA(t){let e=null;function r(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),!e)return null;let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Ta(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class de{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(n=>n.forEach(i=>r(i,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Mk(e.parent)||document,this.viewState=new zg(e.state||Ve.create(e)),e.scrollTo&&e.scrollTo.is(Da)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(to).map(n=>new qc(n));for(let n of this.plugins)n.update(this);this.observer=new HA(this),this.inputState=new oA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ug(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let r=e.length==1&&e[0]instanceof Mt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(r,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,n=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Rg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Lg(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Ve.phrases)!=this.state.facet(Ve.phrases))return this.setState(s);i=La.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new ts(p.empty?p:se.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Da)&&(h=p.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Ua.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),r=this.docView.update(i),this.state.facet(no)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(r,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(za)!=i.state.facet(za)&&(this.viewState.mustMeasureContent=!0),(r||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(_c))try{d(i)}catch(p){br(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Xg(this,u)&&c.force&&qi(this.contentDOM,c.key,c.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 r=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new zg(e),this.plugins=e.facet(to).map(n=>new qc(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new ug(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(e){let r=e.startState.facet(to),n=e.state.facet(to);if(r!=n){let i=[];for(let s of n){let o=r.indexOf(s);if(o<0)i.push(new qc(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);r!=n&&this.inputState.ensureHandlers(this.plugins)}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let r=null,n=this.scrollDOM,i=n.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 a=0;;a++){if(o<0)if(Tp(n))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(m){return br(this.state,m),_g}}),h=La.create(this,this.state,[]),d=!1;h.flags|=l,r?r.flags|=l:r=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h));for(let p=0;p<c.length;p++)if(u[p]!=_g)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){br(this.state,m)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let a of this.state.facet(_c))a(r)}get themeClasses(){return hu+" "+(this.state.facet(fu)?Kg:Gg)+" "+this.state.facet(za)}updateAttrs(){let e=qg(this,_p,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Na)?"true":"false",class:"cm-content",style:`${be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),qg(this,Ra,r);let n=this.observer.ignore(()=>{let i=Xc(this.contentDOM,this.contentAttrs,r),s=Xc(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=r,n}showAnnouncements(e){let r=!0;for(let n of e)for(let i of n.effects)if(i.is(de.announce)){r&&(this.announceDOM.textContent=""),r=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(no);let e=this.state.facet(de.cspNonce);Yn.mount(this.root,this.styleModules.concat(NA).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 r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===e.key){this.measureRequests[r]=e;return}}this.measureRequests.push(e)}}plugin(e){let r=this.pluginMap.get(e);return(r===void 0||r&&r.spec!=e)&&this.pluginMap.set(e,r=this.plugins.find(n=>n.spec==e)||null),r&&r.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,r,n){return au(this,e,bg(this,e,r,n))}moveByGroup(e,r){return au(this,e,bg(this,e,r,n=>iA(this,e.head,n)))}moveToLineBoundary(e,r,n=!0){return nA(this,e,r,n)}moveVertically(e,r,n){return au(this,e,sA(this,e,r,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,r=0){return this.docView.posFromDOM(e,r)}posAtCoords(e,r=!0){return this.readMeasured(),vg(this,e,r)}coordsAtPos(e,r=1){this.readMeasured();let n=this.docView.coordsAt(e,r);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[_n.find(s,e-i.from,-1,r)];return Pa(n,o.dir==ht.LTR==r>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(Xp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>UA)return ag(e.length);let r=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==r&&(s.fresh||sg(s.isolates,n=eg(this,e.from,e.to))))return s.order;n||(n=eg(this,e.from,e.to));let i=og(e.text,r,n);return this.bidiCache.push(new Ua(e.from,e.to,r,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||be.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cp(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.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,r={}){return Da.of(new ts(typeof e=="number"?se.cursor(e):e,r.y,r.x,r.yMargin,r.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:r}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Da.of(new ts(se.cursor(n.from),"start","start",n.top-e,r,!0))}static domEventHandlers(e){return ft.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ft.define(()=>({}),{eventObservers:e})}static theme(e,r){let n=Yn.newName(),i=[za.of(n),no.of(du(`.${n}`,e))];return r&&r.dark&&i.push(fu.of(!0)),i}static baseTheme(e){return xi.lowest(no.of(du("."+hu,e,Yg)))}static findFromDOM(e){var r;let n=e.querySelector(".cm-content"),i=n&&it.get(n)||it.get(e);return((r=i?.rootView)===null||r===void 0?void 0:r.view)||null}}de.styleModule=no,de.inputHandler=Jp,de.focusChangeEffect=Qp,de.perLineTextDirection=Xp,de.exceptionSink=Yp,de.updateListener=_c,de.editable=Na,de.mouseSelectionStyle=Kp,de.dragMovesSelection=Gp,de.clickAddsSelectionRange=Up,de.decorations=ro,de.atomicRanges=eu,de.bidiIsolatedRanges=qp,de.scrollMargins=tg,de.darkTheme=fu,de.cspNonce=pe.define({combine:t=>t.length?t[0]:""}),de.contentAttributes=Ra,de.editorAttributes=_p,de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"}),de.announce=Ae.define();const UA=4096,_g={};class Ua{constructor(e,r,n,i,s,o){this.from=e,this.to=r,this.dir=n,this.isolates=i,this.fresh=s,this.order=o}static update(e,r){if(r.empty&&!e.some(s=>s.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ht.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!r.touchesRange(o.from,o.to)&&n.push(new Ua(r.mapPos(o.from,1),r.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function qg(t,e,r){for(let n=t.state.facet(e),i=n.length-1;i>=0;i--){let s=n[i],o=typeof s=="function"?s(t):s;o&&Jc(o,r)}return r}const GA=be.mac?"mac":be.windows?"win":be.linux?"linux":"key";function KA(t,e){const r=t.split(/-(?!$)/);let n=r[r.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let l=0;l<r.length-1;++l){const c=r[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ga(t,e,r){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r!==!1&&e.shiftKey&&(t="Shift-"+t),t}const YA=xi.default(de.domEventHandlers({keydown(t,e){return rm(tm(e.state),t,e,"editor")}})),ao=pe.define({enables:YA}),em=new WeakMap;function tm(t){let e=t.facet(ao),r=em.get(e);return r||em.set(e,r=XA(e.reduce((n,i)=>n.concat(i),[]))),r}function JA(t,e,r){return rm(tm(t.state),e,t,r)}let qn=null;const QA=4e3;function XA(t,e=GA){let r=Object.create(null),n=Object.create(null),i=(o,a)=>{let l=n[o];if(l==null)n[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var h,d;let p=r[o]||(r[o]=Object.create(null)),m=a.split(/ (?!$)/).map(A=>KA(A,e));for(let A=1;A<m.length;A++){let T=m.slice(0,A).join(" ");i(T,!0),p[T]||(p[T]={preventDefault:!0,stopPropagation:!1,run:[E=>{let B=qn={view:E,prefix:T,scope:o};return setTimeout(()=>{qn==B&&(qn=null)},QA),!0}]})}let y=m.join(" ");i(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=r[c]||(r[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let h in u)u[h].run.push(o.any)}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return r}function rm(t,e,r,n){let i=Ak(e),s=Ft(i,0),o=Lr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;qn&&qn.view==r&&qn.scope==n&&(a=qn.prefix+" ",Sg.indexOf(e.keyCode)<0&&(c=!0,qn=null));let h=new Set,d=w=>{if(w){for(let A of w.run)if(!h.has(A)&&(h.add(A),A(r,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=t[n],m,y;return p&&(d(p[a+Ga(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(be.windows&&e.ctrlKey&&e.altKey)&&(m=Jn[e.keyCode])&&m!=i?(d(p[a+Ga(m,e,!0)])||e.shiftKey&&(y=Xs[e.keyCode])!=i&&y!=m&&d(p[a+Ga(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ga(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class lo{constructor(e,r,n,i,s){this.className=e,this.left=r,this.top=n,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,r){return r.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,r,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=nm(e);return[new lo(r,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return ZA(e,r,n)}}function nm(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ht.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function im(t,e,r){let n=se.cursor(e);return{from:Math.max(r.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(r.to,t.moveToLineBoundary(n,!0,!0).from),type:sr.Text}}function ZA(t,e,r){if(r.to<=t.viewport.from||r.from>=t.viewport.to)return[];let n=Math.max(r.from,t.viewport.from),i=Math.min(r.to,t.viewport.to),s=t.textDirection==ht.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=nm(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=ou(t,n),m=ou(t,i),y=p.type==sr.Text?p:null,w=m.type==sr.Text?m:null;if(y&&(t.lineWrapping||p.widgetLineBreaks)&&(y=im(t,n,y)),w&&(t.lineWrapping||m.widgetLineBreaks)&&(w=im(t,i,w)),y&&w&&y.from==w.from)return T(E(r.from,r.to,y));{let I=y?E(r.from,null,y):B(p,!1),W=w?E(null,r.to,w):B(m,!0),F=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&I.bottom+t.defaultLineHeight/2<W.top?F.push(A(h,I.bottom,d,W.top)):I.bottom<W.top&&t.elementAtHeight((I.bottom+W.top)/2).type==sr.Text&&(I.bottom=W.top=(I.bottom+W.top)/2),T(I).concat(F).concat(T(W))}function A(I,W,F,_){return new lo(e,I-l.left,W-l.top-.01,F-I,_-W+.01)}function T({top:I,bottom:W,horizontal:F}){let _=[];for(let j=0;j<F.length;j+=2)_.push(A(F[j],I,F[j+1],W));return _}function E(I,W,F){let _=1e9,j=-1e9,U=[];function Y(he,xe,Fe,we,Ee){let Ue=t.coordsAtPos(he,he==F.to?-2:2),Ie=t.coordsAtPos(Fe,Fe==F.from?2:-2);!Ue||!Ie||(_=Math.min(Ue.top,Ie.top,_),j=Math.max(Ue.bottom,Ie.bottom,j),Ee==ht.LTR?U.push(s&&xe?h:Ue.left,s&&we?d:Ie.right):U.push(!s&&we?h:Ie.left,!s&&xe?d:Ue.right))}let re=I??F.from,ce=W??F.to;for(let he of t.visibleRanges)if(he.to>re&&he.from<ce)for(let xe=Math.max(he.from,re),Fe=Math.min(he.to,ce);;){let we=t.state.doc.lineAt(xe);for(let Ee of t.bidiSpans(we)){let Ue=Ee.from+we.from,Ie=Ee.to+we.from;if(Ue>=Fe)break;Ie>xe&&Y(Math.max(Ue,xe),I==null&&Ue<=re,Math.min(Ie,Fe),W==null&&Ie>=ce,Ee.dir)}if(xe=we.to+1,xe>=Fe)break}return U.length==0&&Y(re,I==null,ce,W==null,t.textDirection),{top:_,bottom:j,horizontal:U}}function B(I,W){let F=a.top+(W?I.top:I.bottom);return{top:F,bottom:F,horizontal:[]}}}function _A(t,e){return t.constructor==e.constructor&&t.eq(e)}class qA{constructor(e,r){this.view=e,this.layer=r,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"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,e)}update(e){e.startState.facet(Ka)!=e.state.facet(Ka)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let r=0,n=e.facet(Ka);for(;r<n.length&&n[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:r}=this.view;(e!=this.scaleX||r!=this.scaleY)&&(this.scaleX=e,this.scaleY=r,this.dom.style.transform=`scale(${1/e}, ${1/r})`)}draw(e){if(e.length!=this.drawn.length||e.some((r,n)=>!_A(r,this.drawn[n]))){let r=this.dom.firstChild,n=0;for(let i of e)i.update&&r&&i.constructor&&this.drawn[n].constructor&&i.update(r,this.drawn[n])?(r=r.nextSibling,n++):this.dom.insertBefore(i.draw(),r);for(;r;){let i=r.nextSibling;r.remove(),r=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ka=pe.define();function sm(t){return[ft.define(e=>new qA(e,t)),Ka.of(t)]}const om=!be.ios,rs=pe.define({combine(t){return Ur(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,r)=>Math.min(e,r),drawRangeCursor:(e,r)=>e||r})}});function eC(t={}){return[rs.of(t),tC,rC,nC,Zp.of(!0)]}function rD(t){return t.facet(rs)}function am(t){return t.startState.facet(rs)!=t.state.facet(rs)}const tC=sm({above:!0,markers(t){let{state:e}=t,r=e.facet(rs),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||om:r.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:se.cursor(i.head,i.head>i.anchor?-1:1);for(let l of lo.forRange(t,o,a))n.push(l)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=am(t);return r&&lm(t.state,e),t.docChanged||t.selectionSet||r},mount(t,e){lm(e.state,t)},class:"cm-cursorLayer"});function lm(t,e){e.style.animationDuration=t.facet(rs).cursorBlinkRate+"ms"}const rC=sm({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:lo.forRange(t,"cm-selectionBackground",e)).reduce((e,r)=>e.concat(r))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||am(t)},class:"cm-selectionLayer"}),cm={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};om&&(cm[".cm-line"].caretColor="transparent !important");const nC=xi.highest(de.theme(cm)),um=Ae.define({map(t,e){return t==null?null:e.mapPos(t)}}),co=At.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((r,n)=>n.is(um)?n.value:r,t)}}),iC=ft.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 r=t.state.field(co);r==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(co)!=r||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(co),r=e!=null&&t.coordsAtPos(e);if(!r)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:r.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:r.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:r.bottom-r.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:r}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/r+"px",this.cursor.style.height=t.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(co)!=t&&this.view.dispatch({effects:um.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 sC(){return[co,iC]}function fm(t,e,r,n,i){e.lastIndex=0;for(let s=t.iterRange(r,n),o=r,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function oC(t,e){let r=t.visibleRanges;if(r.length==1&&r[0].from==t.viewport.from&&r[0].to==t.viewport.to)return r;let n=[];for(let{from:i,to:s}of r)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}class gu{constructor(e){const{regexp:r,decoration:n,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let r=new Kn,n=r.add.bind(r);for(let{from:i,to:s}of oC(e,this.maxLength))fm(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,n));return r.finish()}updateDeco(e,r){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(n=Math.min(a,n),i=Math.max(l,i))}),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,r.map(e.changes),n,i):r}updateRange(e,r,n,i){for(let s of e.visibleRanges){let o=Math.max(s.from,n),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],p,m=(y,w,A)=>d.push(A.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else fm(e.state.doc,this.regexp,u,h,(y,w)=>this.addMatch(w,e,y,m));r=r.update({filterFrom:u,filterTo:h,filter:(y,w)=>y<u||w>h,add:d})}}return r}}const mu=/x/.unicode!=null?"gu":"g",aC=new RegExp(`[\0-\b
|
|
150
|
-
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,mu),lC={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 vu=null;function cC(){var t;if(vu==null&&typeof document<"u"&&document.body){let e=document.body.style;vu=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return vu||!1}const Ya=pe.define({combine(t){let e=Ur(t,{render:null,specialChars:aC,addSpecialChars:null});return(e.replaceTabs=!cC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,mu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,mu)),e}});function uC(t={}){return[Ya.of(t),fC()]}let hm=null;function fC(){return hm||(hm=ft.fromClass(class{constructor(t){this.view=t,this.decorations=ke.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ya)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new gu({regexp:t.specialChars,decoration:(e,r,n)=>{let{doc:i}=r.state,s=Ft(e[0],0);if(s==9){let o=i.lineAt(n),a=r.state.tabSize,l=Xi(o.text,a,n-o.from);return ke.replace({widget:new gC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ke.replace({widget:new pC(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ya);t.startState.facet(Ya)!=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 hC="\u2022";function dC(t){return t>=32?hC:t==10?"\u2424":String.fromCharCode(9216+t)}class pC extends ln{constructor(e,r){super(),this.options=e,this.code=r}eq(e){return e.code==this.code}toDOM(e){let r=dC(this.code),n=e.state.phrase("Control character")+" "+(lC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,r);if(i)return i;let s=document.createElement("span");return s.textContent=r,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class gC extends ln{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}}const dm=null;function nD(){return[dm,Ra.of(t=>{var e;return((e=t.plugin(dm))===null||e===void 0?void 0:e.attrs)||null})]}function mC(){return yC}const vC=ke.line({class:"cm-activeLine"}),yC=ft.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,r=[];for(let n of t.state.selection.ranges){let i=t.lineBlockAt(n.head);i.from>e&&(r.push(vC.range(i.from)),e=i.from)}return ke.set(r)}},{decorations:t=>t.decorations});class bC extends ln{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 r=e.firstChild?Zi(e.firstChild):[];if(!r.length)return null;let n=window.getComputedStyle(e.parentNode),i=Pa(r[0],n.direction!="rtl"),s=parseInt(n.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 xC(t){return ft.fromClass(class{constructor(e){this.view=e,this.placeholder=t?ke.set([ke.widget({widget:new bC(t),side:1}).range(0)]):ke.none}get decorations(){return this.view.state.doc.length?ke.none:this.placeholder}},{decorations:e=>e.decorations})}const yu=2e3;function wC(t,e,r){let n=Math.min(e.line,r.line),i=Math.max(e.line,r.line),s=[];if(e.off>yu||r.off>yu||e.col<0||r.col<0){let o=Math.min(e.off,r.off),a=Math.max(e.off,r.off);for(let l=n;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(se.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,r.col),a=Math.max(e.col,r.col);for(let l=n;l<=i;l++){let c=t.doc.line(l),u=jc(c.text,o,t.tabSize,!0);if(u<0)s.push(se.cursor(c.to));else{let h=jc(c.text,a,t.tabSize);s.push(se.range(c.from+u,c.from+h))}}}return s}function SC(t,e){let r=t.coordsAtPos(t.viewport.from);return r?Math.round(Math.abs((r.left-e)/t.defaultCharacterWidth)):-1}function pm(t,e){let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(r),i=r-n.from,s=i>yu?-1:i==n.length?SC(t,e.clientX):Xi(n.text,t.state.tabSize,r-n.from);return{line:n.number,col:s,off:i}}function kC(t,e){let r=pm(t,e),n=t.state.selection;return r?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(r.line).from),o=i.state.doc.lineAt(s);r={line:o.number,col:r.col,off:Math.min(r.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=pm(t,i);if(!a)return n;let l=wC(t.state,r,a);return l.length?o?se.create(l.concat(n.ranges)):se.create(l):n}}:null}function AC(t){let e=t?.eventFilter||(r=>r.altKey&&r.button==0);return de.mouseSelectionStyle.of((r,n)=>e(n)?kC(r,n):null)}const CC={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},OC={style:"cursor: crosshair"};function EC(t={}){let[e,r]=CC[t.key||"Alt"],n=ft.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||r(i))},keyup(i){(i.keyCode==e||!r(i))&&this.set(!1)},mousemove(i){this.set(r(i))}}});return[n,de.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?OC:null})]}const uo="-10000px";class gm{constructor(e,r,n){this.facet=r,this.createTooltipView=n,this.input=e.state.facet(r),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(e,r){var n;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=r?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=r[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(l.dom.remove(),(n=l.destroy)===null||n===void 0||n.call(l));return r&&(a.forEach((l,c)=>r[c]=l),r.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function iD(t={}){return Ja.of(t)}function TC(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ja=pe.define({combine:t=>{var e,r,n;return{position:be.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((r=t.find(i=>i.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((n=t.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||TC}}}),mm=new WeakMap,bu=ft.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(Ja);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.manager=new gm(t,Qa,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.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 r=e||t.geometryChanged,n=t.state.facet(Ja);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",e.dom.appendChild(r)}return e.dom.style.position=this.position,e.dom.style.top=uo,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;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.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,r=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(be.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(this.view.scaleX!=1||this.view.scaleY!=1)n=!0;else if(i.style.top==uo&&i.style.left=="0px"){let s=i.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,r=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:r}=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(Ja).tooltipSpace(this.view),scaleX:e,scaleY:r,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:r,space:n,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=t.pos[a],d=t.size[a];if(!h||h.bottom<=Math.max(r.top,n.top)||h.top>=Math.min(r.bottom,n.bottom)||h.right<Math.max(r.left,n.left)-.1||h.left>Math.min(r.right,n.right)+.1){u.style.top=uo;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=mm.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||MC,T=this.view.textDirection==ht.LTR,E=d.width>n.right-n.left?T?n.left:n.right-d.width:T?Math.min(h.left-(p?14:0)+A.x,n.right-y):Math.max(n.left,h.left-y+(p?14:0)-A.x),B=this.above[a];!l.strictSide&&(B?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&B==n.bottom-h.bottom>h.top-n.top&&(B=this.above[a]=!B);let I=(B?h.top-n.top:n.bottom-h.bottom)-m;if(I<w&&c.resize!==!1){if(I<this.view.defaultLineHeight){u.style.top=uo;continue}mm.set(c,w),u.style.height=(w=I)/s+"px"}else u.style.height&&(u.style.height="");let W=B?h.top-w-m-A.y:h.bottom+m+A.y,F=E+y;if(c.overlap!==!0)for(let _ of o)_.left<F&&_.right>E&&_.top<W+w&&_.bottom>W&&(W=B?_.top-w-2-m:_.bottom+m+2);if(this.position=="absolute"?(u.style.top=(W-t.parent.top)/s+"px",u.style.left=(E-t.parent.left)/i+"px"):(u.style.top=W/s+"px",u.style.left=E/i+"px"),p){let _=h.left+(T?A.x:-A.x)-(E+14-7);p.style.left=_/i+"px"}c.overlap!==!0&&o.push({left:E,top:W,right:F,bottom:W+w}),u.classList.toggle("cm-tooltip-above",B),u.classList.toggle("cm-tooltip-below",!B),c.positioned&&c.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=uo}},{eventObservers:{scroll(){this.maybeMeasure()}}}),PC=de.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"}}}),MC={x:0,y:0},Qa=pe.define({enables:[bu,PC]}),fo=pe.define();class xu{static create(e){return new xu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new gm(e,fo,r=>this.createHostedView(r))}createHostedView(e){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(r.dom),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let r of this.manager.tooltipViews)r.mount&&r.mount(e);this.mounted=!0}positioned(e){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let r of this.manager.tooltipViews)(e=r.destroy)===null||e===void 0||e.call(r)}passProp(e){let r;for(let n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}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 IC=Qa.compute([fo],t=>{let e=t.facet(fo).filter(r=>r);return e.length===0?null:{pos:Math.min(...e.map(r=>r.pos)),end:Math.max(...e.filter(r=>r.end!=null).map(r=>r.end)),create:xu.create,above:e[0].above,arrow:e.some(r=>r.arrow)}});class DC{constructor(e,r,n,i,s){this.view=e,this.source=r,this.field=n,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)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:r}=this,n=e.docView.nearest(r.target);if(!n)return;let i,s=1;if(n instanceof Qn)i=n.posAtStart;else{if(i=e.posAtCoords(r),i==null)return;let a=e.coordsAtPos(i);if(!a||r.y<a.top||r.y>a.bottom||r.x<a.left-e.defaultCharacterWidth||r.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ht.RTL?-1:1;s=r.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>br(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}mousemove(e){var 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 n=this.active;if(n&&!vm(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,s=(r=n?.end)!==null&&r!==void 0?r:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!NC(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!vm(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function vm(t){for(let e=t;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function NC(t,e,r,n,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:n,y:i},!1);return l>=e&&l<=r}function RC(t,e={}){let r=Ae.define(),n=At.define({create(){return null},update(i,s){if(i&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,i)))return null;if(i&&s.docChanged){let o=s.changes.mapPos(i.pos,-1,ir.TrackDel);if(o==null)return null;let a=Object.assign(Object.create(null),i);a.pos=o,i.end!=null&&(a.end=s.changes.mapPos(i.end)),i=a}for(let o of s.effects)o.is(r)&&(i=o.value),o.is(LC)&&(i=null);return i},provide:i=>fo.from(i)});return[n,ft.define(i=>new DC(i,t,n,r,e.hoverTime||300)),IC]}function ym(t,e){let r=t.plugin(bu);if(!r)return null;let n=r.manager.tooltips.indexOf(e);return n<0?null:r.manager.tooltipViews[n]}function sD(t){return t.facet(fo).some(e=>e)}const LC=Ae.define(),oD=null;function aD(t){let e=t.plugin(bu);e&&e.maybeMeasure()}const wu=pe.define({combine(t){let e,r;for(let n of t)e=e||n.topContainer,r=r||n.bottomContainer;return{topContainer:e,bottomContainer:r}}});function lD(t){return t?[wu.of(t)]:[]}function ho(t,e){let r=t.plugin(bm),n=r?r.specs.indexOf(e):-1;return n>-1?r.panels[n]:null}const bm=ft.fromClass(class{constructor(t){this.input=t.state.facet(po),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(t));let e=t.state.facet(wu);this.top=new Xa(t,!0,e.topContainer),this.bottom=new Xa(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(t){let e=t.state.facet(wu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Xa(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Xa(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=t.state.facet(po);if(r!=this.input){let n=r.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>de.scrollMargins.of(e=>{let r=e.plugin(t);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class Xa{constructor(e,r,n){this.view=e,this.top=r,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let r of this.panels)r.destroy&&e.indexOf(r)<0&&r.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 r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let e=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;e!=r.dom;)e=xm(e);e=e.nextSibling}else this.dom.insertBefore(r.dom,e);for(;e;)e=xm(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 xm(t){let e=t.nextSibling;return t.remove(),e}const po=pe.define({enables:bm});class fn extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fn.prototype.elementClass="",fn.prototype.toDOM=void 0,fn.prototype.mapMode=ir.TrackBefore,fn.prototype.startSide=fn.prototype.endSide=-1,fn.prototype.point=!0;const Za=pe.define(),BC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Qe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},go=pe.define();function wm(t){return[Sm(),go.of(Object.assign(Object.assign({},BC),t))]}const Su=pe.define({combine:t=>t.some(e=>e)});function Sm(t){let e=[FC];return t&&t.fixed===!1&&e.push(Su.of(!0)),e}const FC=ft.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(go).map(e=>new Am(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(Su),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,r=t.view.viewport,n=Math.min(e.to,r.to)-Math.max(e.from,r.from);this.syncGutters(n<(r.to-r.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Su)!=!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 r=Qe.iter(this.view.state.facet(Za),this.view.viewport.from),n=[],i=this.gutters.map(s=>new jC(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==sr.Text&&o){ku(r,n,a.from);for(let l of i)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==sr.Text){ku(r,n,s.from);for(let o of i)o.line(this.view,s,n)}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(go),r=t.state.facet(go),n=t.docChanged||t.heightChanged||t.viewportChanged||!Qe.eq(t.startState.facet(Za),t.state.facet(Za),t.view.viewport.from,t.view.viewport.to);if(e==r)for(let i of this.gutters)i.update(t)&&(n=!0);else{n=!0;let i=[];for(let s of r){let o=e.indexOf(s);o<0?i.push(new Am(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 n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>de.scrollMargins.of(e=>{let r=e.plugin(t);return!r||r.gutters.length==0||!r.fixed?null:e.textDirection==ht.LTR?{left:r.dom.offsetWidth*e.scaleX}:{right:r.dom.offsetWidth*e.scaleX}})});function km(t){return Array.isArray(t)?t:[t]}function ku(t,e,r){for(;t.value&&t.from<=r;)t.from==r&&e.push(t.value),t.next()}class jC{constructor(e,r,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Qe.iter(e.markers,r.from)}addElement(e,r,n){let{gutter:i}=this,s=(r.top-this.height)/e.scaleY,o=r.height/e.scaleY;if(this.i==i.elements.length){let a=new Cm(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=r.bottom,this.i++}line(e,r,n){let i=[];ku(this.cursor,i,r.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,r,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,r,i)}widget(e,r){let n=this.gutter.config.widgetMarker(e,r.widget,r);n&&this.addElement(e,r,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let r=e.elements.pop();e.dom.removeChild(r.dom),r.destroy()}}}class Am{constructor(e,r){this.view=e,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in r.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);r.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=km(r.markers(e)),r.initialSpacer&&(this.spacer=new Cm(e,0,0,[r.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let r=this.markers;if(this.markers=km(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 n=e.view.viewport;return!Qe.eq(this.markers,r,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Cm{constructor(e,r,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,r,n,i)}update(e,r,n,i){this.height!=r&&(this.height=r,this.dom.style.height=r+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),VC(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,r){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<r.length?r[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=n,this.markers=r}destroy(){this.setMarkers(null,[])}}function VC(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].compare(e[r]))return!1;return!0}const WC=pe.define(),ns=pe.define({combine(t){return Ur(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,r){let n=Object.assign({},e);for(let i in r){let s=n[i],o=r[i];n[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return n}})}});class Au extends fn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Cu(t,e){return t.state.facet(ns).formatNumber(e,t.state)}const $C=go.compute([ns],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(WC)},lineMarker(e,r,n){return n.some(i=>i.toDOM)?null:new Au(Cu(e,e.state.doc.lineAt(r.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(ns)!=e.state.facet(ns),initialSpacer(e){return new Au(Cu(e,Om(e.state.doc.lines)))},updateSpacer(e,r){let n=Cu(r.view,Om(r.view.state.doc.lines));return n==e.number?e:new Au(n)},domEventHandlers:t.facet(ns).domEventHandlers}));function HC(t={}){return[ns.of(t),Sm(),$C]}function Om(t){let e=9;for(;e<t;)e=e*10+9;return e}const zC=new class extends fn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},UC=Za.compute(["selection"],t=>{let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.head).from;i>r&&(r=i,e.push(zC.range(i)))}return Qe.of(e)});function GC(){return UC}const Em=new Map;function KC(t){let e=Em.get(t);return e||Em.set(t,e=ke.mark({attributes:t===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xB7")}})),e}function Tm(t){return ft.define(e=>({decorations:t.createDeco(e),update(r){this.decorations=t.updateDeco(r,this.decorations)}}),{decorations:e=>e.decorations})}const YC=Tm(new gu({regexp:/\t| +/g,decoration:t=>KC(t[0]),boundary:/\S/}));function cD(){return YC}const JC=Tm(new gu({regexp:/\s+$/g,decoration:ke.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function uD(){return JC}const fD={HeightMap:Qt,HeightOracle:Vg,MeasuredHeights:Wg,QueryType:tt,ChangedRange:xr,computeOrder:og,moveVisually:cg};var Ou;const ki=new Re;function Pm(t){return pe.define({combine:t?e=>e.concat(t):void 0})}const QC=new Re;class Sr{constructor(e,r,n=[],i=""){this.data=e,this.name=i,Ve.prototype.hasOwnProperty("tree")||Object.defineProperty(Ve.prototype,"tree",{get(){return Lt(this)}}),this.parser=r,this.extension=[ei.of(this),Ve.languageData.of((s,o,a)=>{let l=Mm(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(QC);if(h){let d=l.resolve(o-l.from,a);for(let p of h)if(p.test(d,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,r,n=-1){return Mm(e,r,n).type.prop(ki)==this.data}findRegions(e){let r=e.facet(ei);if(r?.data==this.data)return[{from:0,to:e.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(s,o)=>{if(s.prop(ki)==this.data){n.push({from:o,to:o+s.length});return}let a=s.prop(Re.mounted);if(a){if(a.tree.prop(ki)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+s.length});return}else if(a.overlay){let l=n.length;if(i(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ut&&i(c,s.positions[l]+o)}};return i(Lt(e),0),n}get allowsNesting(){return!0}}Sr.setState=Ae.define();function Mm(t,e,r){let n=t.facet(ei),i=Lt(t).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,r,ot.ExcludeBuffers))s.type.isTop&&(i=s);return i}class _a extends Sr{constructor(e,r,n){super(e,r,[],n),this.parser=r}static define(e){let r=Pm(e.languageData);return new _a(r,e.parser.configure({props:[ki.add(n=>n.isTop?r:void 0)]}),e.name)}configure(e,r){return new _a(this.data,this.parser.configure(e),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lt(t){let e=t.field(Sr.state,!1);return e?e.tree:ut.empty}function XC(t,e,r=50){var n;let i=(n=t.field(Sr.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(r,e)?i.tree:null;return i.updateViewport(s),o}function hD(t,e=t.doc.length){var r;return((r=t.field(Sr.state,!1))===null||r===void 0?void 0:r.context.isDone(e))||!1}function dD(t,e=t.viewport.to,r=100){let n=XC(t.state,e,r);return n!=Lt(t.state)&&t.dispatch({}),!!n}function pD(t){var e;return((e=t.plugin(Nm))===null||e===void 0?void 0:e.isWorking())||!1}class ZC{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,r){let n=this.cursorPos-this.string.length;return e<n||r>=this.cursorPos?this.doc.sliceString(e,r):this.string.slice(e-n,r-n)}}let mo=null;class is{constructor(e,r,n=[],i,s,o,a,l){this.parser=e,this.state=r,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,r,n){return new is(e,r,[],ut.empty,0,n,[],null)}startParse(){return this.parser.startParse(new ZC(this.state.doc),this.fragments)}work(e,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ut.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(An.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,r;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=e,this.tree=r,this.fragments=this.withoutTempSkipped(An.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let r=mo;mo=this;try{return e()}finally{mo=r}}withoutTempSkipped(e){for(let r;r=this.tempSkipped.pop();)e=Im(e,r.from,r.to);return e}changes(e,r){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),n=An.applyChanges(n,l),i=ut.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new is(this.parser,r,n,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let r=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Im(this.fragments,i,s),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,r){this.skipped.push({from:e,to:r})}static getSkippingParser(e){return new class extends Pd{createParse(r,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=mo;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ut(nr.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let r=this.fragments;return this.treeLen>=e&&r.length&&r[0].from==0&&r[0].to>=e}static get(){return mo}}function Im(t,e,r){return An.applyChanges(t,[{fromA:e,toA:r,fromB:e,toB:r}])}class ss{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new ss(r)}static init(e){let r=Math.min(3e3,e.doc.length),n=is.create(e.facet(ei).parser,e,{from:0,to:r});return n.work(20,r)||n.takeTree(),new ss(n)}}Sr.state=At.define({create:ss.init,update(t,e){for(let r of e.effects)if(r.is(Sr.setState))return r.value;return e.startState.facet(ei)!=e.state.facet(ei)?ss.init(e.state):t.apply(e)}});let Dm=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Dm=t=>{let e=-1,r=setTimeout(()=>{e=requestIdleCallback(t,{timeout:500-100})},100);return()=>e<0?clearTimeout(r):cancelIdleCallback(e)});const Eu=typeof navigator<"u"&&(!((Ou=navigator.scheduling)===null||Ou===void 0)&&Ou.isInputPending)?()=>navigator.scheduling.isInputPending():null,Nm=ft.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 r=this.view.state.field(Sr.state).context;(r.updateViewport(e.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:e}=this.view,r=e.field(Sr.state);(r.tree!=r.context.tree||!r.context.isDone(e.doc.length))&&(this.working=Dm(this.work))}work(e){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,s=n.field(Sr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Eu?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Eu&&Eu()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Sr.setState.of(new ss(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(r=>br(this.view.state,r)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ei=pe.define({combine(t){return t.length?t[0]:null},enables:t=>[Sr.state,Nm,de.contentAttributes.compute([t],e=>{let r=e.facet(t);return r&&r.name?{"data-language":r.name}:{}})]});class _C{constructor(e,r=[]){this.language=e,this.support=r,this.extension=[e,r]}}class Rm{constructor(e,r,n,i,s,o=void 0){this.name=e,this.alias=r,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:r,support:n}=e;if(!r){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");r=()=>Promise.resolve(n)}return new Rm(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,r,n)}static matchFilename(e,r){for(let i of e)if(i.filename&&i.filename.test(r))return i;let n=/\.([^.]+)$/.exec(r);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,r,n=!0){r=r.toLowerCase();for(let i of e)if(i.alias.some(s=>s==r))return i;if(n)for(let i of e)for(let s of i.alias){let o=r.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(r[o-1])&&!/\w/.test(r[o+s.length])))return i}return null}}const Lm=pe.define(),qa=pe.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(r=>r!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Ai(t){let e=t.facet(qa);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function os(t,e){let r="",n=t.tabSize,i=t.facet(qa)[0];if(i==" "){for(;e>=n;)r+=" ",e-=n;i=" "}for(let s=0;s<e;s++)r+=i;return r}function el(t,e){t instanceof Ve&&(t=new vo(t));for(let n of t.state.facet(Lm)){let i=n(t,e);if(i!==void 0)return i}let r=Lt(t.state);return r.length>=e?qC(t,r,e):null}function gD(t,e,r){let n=Object.create(null),i=new vo(t,{overrideIndentation:o=>{var a;return(a=n[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=r;){let a=t.doc.lineAt(o);o=a.to+1;let l=el(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=os(t,l);c!=u&&(n[a.from]=l,s.push({from:a.from,to:a.from+c.length,insert:u}))}return t.changes(s)}class vo{constructor(e,r={}){this.state=e,this.options=r,this.unit=Ai(e)}lineAt(e,r=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(r<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,r=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,r);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,r=1){let{text:n,from:i}=this.lineAt(e,r),s=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,r=e.length){return Xi(e,this.state.tabSize,r)}lineIndent(e,r=1){let{text:n,from:i}=this.lineAt(e,r),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Bm=new Re;function qC(t,e,r){let n=e.resolveStack(r),i=n.node.enterUnfinishedNodesBefore(r);if(i!=n.node){let s=[];for(let o=i;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return Fm(n,t,r)}function Fm(t,e,r){for(let n=t;n;n=n.next){let i=tO(n.node);if(i)return i(Tu.create(e,r,n))}return 0}function eO(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function tO(t){let e=t.type.prop(Bm);if(e)return e;let r=t.firstChild,n;if(r&&(n=r.type.prop(Re.closedBy))){let i=t.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>jm(o,!0,1,void 0,s&&!eO(o)?i.from:void 0)}return t.parent==null?rO:null}function rO(){return 0}class Tu extends vo{constructor(e,r,n){super(e.state,e.options),this.base=e,this.pos=r,this.context=n}get node(){return this.context.node}static create(e,r,n){return new Tu(e,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let r=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(nO(n,e))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return Fm(this.context.next,this.base,this.pos)}}function nO(t,e){for(let r=e;r;r=r.parent)if(t==r)return!0;return!1}function iO(t){let e=t.node,r=e.childAfter(e.from),n=e.lastChild;if(!r)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(r.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=r.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from<o?r:null;a=l.to}}function mD({closing:t,align:e=!0,units:r=1}){return n=>jm(n,e,r,t)}function jm(t,e,r,n,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==t.pos+o,l=e?iO(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*r)}const vD=t=>t.baseIndent;function Vm({except:t,units:e=1}={}){return r=>{let n=t&&t.test(r.textAfter);return r.baseIndent+(n?0:e*r.unit)}}const sO=200;function oO(){return Ve.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 r=t.newDoc,{head:n}=t.newSelection.main,i=r.lineAt(n);if(n>i.from+sO)return t;let s=r.sliceString(i.from,n);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=el(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=os(o,h);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const aO=pe.define(),Wm=new Re;function lO(t){let e=t.firstChild,r=t.lastChild;return e&&e.to<r.from?{from:e.to,to:r.type.isError?t.to:r.from}:null}function cO(t,e,r){let n=Lt(t);if(n.length<r)return null;let i=n.resolveStack(r,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=r||a.from>r)continue;if(s&&a.from<e)break;let l=a.type.prop(Wm);if(l&&(a.to<n.length-50||n.length==t.doc.length||!uO(a))){let c=l(a,t);c&&c.from<=r&&c.from>=e&&c.to>r&&(s=c)}}return s}function uO(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function yo(t,e,r){for(let n of t.facet(aO)){let i=n(t,e,r);if(i)return i}return cO(t,e,r)}function $m(t,e){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return r>=n?void 0:{from:r,to:n}}const bo=Ae.define({map:$m}),as=Ae.define({map:$m});function Pu(t){let e=[];for(let{head:r}of t.state.selection.ranges)e.some(n=>n.from<=r&&n.to>=r)||e.push(t.lineBlockAt(r));return e}const ti=At.define({create(){return ke.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)if(r.is(bo)&&!fO(t,r.value.from,r.value.to)){let{preparePlaceholder:n}=e.state.facet(Iu),i=n?ke.replace({widget:new bO(n(e.state,r.value))}):Um;t=t.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(as)&&(t=t.update({filter:(n,i)=>r.value.from!=n||r.value.to!=i,filterFrom:r.value.from,filterTo:r.value.to}));if(e.selection){let r=!1,{head:n}=e.selection.main;t.between(n,n,(i,s)=>{i<n&&s>n&&(r=!0)}),r&&(t=t.update({filterFrom:n,filterTo:n,filter:(i,s)=>s<=n||i>=n}))}return t},provide:t=>de.decorations.from(t),toJSON(t,e){let r=[];return t.between(0,e.doc.length,(n,i)=>{r.push(n,i)}),r},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let r=0;r<t.length;){let n=t[r++],i=t[r++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Um.range(n,i))}return ke.set(e,!0)}});function yD(t){return t.field(ti,!1)||RangeSet.empty}function xo(t,e,r){var n;let i=null;return(n=t.field(ti,!1))===null||n===void 0||n.between(e,r,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function fO(t,e,r){let n=!1;return t.between(e,e,(i,s)=>{i==e&&s==r&&(n=!0)}),n}function Mu(t,e){return t.field(ti,!1)?e:e.concat(Ae.appendConfig.of(Hm()))}const hO=t=>{for(let e of Pu(t)){let r=yo(t.state,e.from,e.to);if(r)return t.dispatch({effects:Mu(t.state,[bo.of(r),tl(t,r)])}),!0}return!1},dO=t=>{if(!t.state.field(ti,!1))return!1;let e=[];for(let r of Pu(t)){let n=xo(t.state,r.from,r.to);n&&e.push(as.of(n),tl(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function tl(t,e,r=!0){let n=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return de.announce.of(`${t.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${i}.`)}const pO=t=>{let{state:e}=t,r=[];for(let n=0;n<e.doc.length;){let i=t.lineBlockAt(n),s=yo(e,i.from,i.to);s&&r.push(bo.of(s)),n=(s?t.lineBlockAt(s.to):i).to+1}return r.length&&t.dispatch({effects:Mu(t.state,r)}),!!r.length},gO=t=>{let e=t.state.field(ti,!1);if(!e||!e.size)return!1;let r=[];return e.between(0,t.state.doc.length,(n,i)=>{r.push(as.of({from:n,to:i}))}),t.dispatch({effects:r}),!0};function mO(t,e){for(let r=e;;){let n=yo(t.state,r.from,r.to);if(n&&n.to>e.from)return n;if(!r.from)return null;r=t.lineBlockAt(r.from-1)}}const bD=t=>{let e=[];for(let r of Pu(t)){let n=xo(t.state,r.from,r.to);if(n)e.push(as.of(n),tl(t,n,!1));else{let i=mO(t,r);i&&e.push(bo.of(i),tl(t,i))}}return e.length>0&&t.dispatch({effects:Mu(t.state,e)}),!!e.length},vO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:hO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:dO},{key:"Ctrl-Alt-[",run:pO},{key:"Ctrl-Alt-]",run:gO}],yO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Iu=pe.define({combine(t){return Ur(t,yO)}});function Hm(t){let e=[ti,SO];return t&&e.push(Iu.of(t)),e}function zm(t,e){let{state:r}=t,n=r.facet(Iu),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=xo(t.state,a.from,a.to);l&&t.dispatch({effects:as.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",r.phrase("folded code")),s.title=r.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Um=ke.replace({widget:new class extends ln{toDOM(t){return zm(t,null)}}});class bO extends ln{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return zm(e,this.value)}}const xO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Du extends fn{constructor(e,r){super(),this.config=e,this.open=r}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=e.state.phrase(this.open?"Fold line":"Unfold line"),r}}function wO(t={}){let e=Object.assign(Object.assign({},xO),t),r=new Du(e,!0),n=new Du(e,!1),i=ft.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ei)!=o.state.facet(ei)||o.startState.field(ti,!1)!=o.state.field(ti,!1)||Lt(o.startState)!=Lt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Kn;for(let l of o.viewportLineBlocks){let c=xo(o.state,l.from,l.to)?n:yo(o.state,l.from,l.to)?r:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,wm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Qe.empty},initialSpacer(){return new Du(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=xo(o.state,a.from,a.to);if(c)return o.dispatch({effects:as.of(c)}),!0;let u=yo(o.state,a.from,a.to);return u?(o.dispatch({effects:bo.of(u)}),!0):!1}})}),Hm()]}const SO=de.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ls{constructor(e,r){this.specs=e;let n;function i(a){let l=Yn.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const s=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Sr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=Gd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Yn(n):null,this.themeType=r.themeType}static define(e,r){return new ls(e,r||{})}}const Nu=pe.define(),Gm=pe.define({combine(t){return t.length?[t[0]]:null}});function rl(t){let e=t.facet(Nu);return e.length?e:t.facet(Gm)}function Ru(t,e){let r=[AO],n;return t instanceof ls&&(t.module&&r.push(de.styleModule.of(t.module)),n=t.themeType),e?.fallback?r.push(Gm.of(t)):n?r.push(Nu.computeN([de.darkTheme],i=>i.facet(de.darkTheme)==(n=="dark")?[t]:[])):r.push(Nu.of(t)),r}function xD(t,e,r){let n=rl(t),i=null;if(n){for(let s of n)if(!s.scope||r&&s.scope(r)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class kO{constructor(e){this.markCache=Object.create(null),this.tree=Lt(e.state),this.decorations=this.buildDeco(e,rl(e.state))}update(e){let r=Lt(e.state),n=rl(e.state),i=n!=rl(e.startState);r.length<e.view.viewport.to&&!i&&r.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(r!=this.tree||e.viewportChanged||i)&&(this.tree=r,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,r){if(!r||!this.tree.length)return ke.none;let n=new Kn;for(let{from:i,to:s}of e.visibleRanges)Kd(this.tree,r,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=ke.mark({class:l})))},i,s);return n.finish()}}const AO=xi.high(ft.fromClass(kO,{decorations:t=>t.decorations})),CO=ls.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),OO=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Km=1e4,Ym="()[]{}",Jm=pe.define({combine(t){return Ur(t,{afterCursor:!0,brackets:Ym,maxScanDistance:Km,renderMatch:PO})}}),EO=ke.mark({class:"cm-matchingBracket"}),TO=ke.mark({class:"cm-nonmatchingBracket"});function PO(t){let e=[],r=t.matched?EO:TO;return e.push(r.range(t.start.from,t.start.to)),t.end&&e.push(r.range(t.end.from,t.end.to)),e}const MO=[At.define({create(){return ke.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let r=[],n=e.state.facet(Jm);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=hn(e.state,i.head,-1,n)||i.head>0&&hn(e.state,i.head-1,1,n)||n.afterCursor&&(hn(e.state,i.head,1,n)||i.head<e.state.doc.length&&hn(e.state,i.head+1,-1,n));s&&(r=r.concat(n.renderMatch(s,e.state)))}return ke.set(r,!0)},provide:t=>de.decorations.from(t)}),OO];function IO(t={}){return[Jm.of(t),MO]}const DO=new Re;function Lu(t,e,r){let n=t.prop(e<0?Re.openedBy:Re.closedBy);if(n)return n;if(t.name.length==1){let i=r.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[r[i+e]]}return null}function Bu(t){let e=t.type.prop(DO);return e?e(t.node):t}function hn(t,e,r,n={}){let i=n.maxScanDistance||Km,s=n.brackets||Ym,o=Lt(t),a=o.resolveInner(e,r);for(let l=a;l;l=l.parent){let c=Lu(l.type,r,s);if(c&&l.from<l.to){let u=Bu(l);if(u&&(r>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return NO(t,e,r,l,u,c,s)}}return RO(t,e,r,o,a.type,i,s)}function NO(t,e,r,n,i,s,o){let a=n.parent,l={from:i.from,to:i.to},c=0,u=a?.cursor();if(u&&(r<0?u.childBefore(n.from):u.childAfter(n.to)))do if(r<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Bu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Lu(u.type,r,o))c++;else if(Lu(u.type,-r,o)){if(c==0){let h=Bu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(r<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function RO(t,e,r,n,i,s,o){let a=r<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=r>0)return null;let c={from:r<0?e-1:e,to:r>0?e+1:e},u=t.doc.iterRange(e,r>0?t.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;r<0&&(d+=p.length);let m=e+d*r;for(let y=r>0?0:p.length-1,w=r>0?p.length:-1;y!=w;y+=r){let A=o.indexOf(p[y]);if(!(A<0||n.resolveInner(m+y,1).type!=i))if(A%2==0==r>0)h++;else{if(h==1)return{start:c,end:{from:m+y,to:m+y+1},matched:A>>1==l>>1};h--}}r>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function Qm(t,e,r,n=0,i=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let s=i;for(let o=n;o<e;o++)t.charCodeAt(o)==9?s+=r-s%r:s++;return s}class Xm{constructor(e,r,n,i){this.string=e,this.tabSize=r,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let r=this.string.charAt(this.pos),n;if(typeof e=="string"?n=r==e:n=r&&(e instanceof RegExp?e.test(r):e(r)),n)return++this.pos,r}eatWhile(e){let r=this.pos;for(;this.eat(e););return this.pos>r}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let r=this.string.indexOf(e,this.pos);if(r>-1)return this.pos=r,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Qm(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Qm(this.string,null,this.tabSize)}match(e,r,n){if(typeof e=="string"){let i=o=>n?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(r!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&r!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function LO(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||BO,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||ju}}function BO(t){if(typeof t!="object")return t;let e={};for(let r in t){let n=t[r];e[r]=n instanceof Array?n.slice():n}return e}const Zm=new WeakMap;class _m extends null{constructor(e){let r=Pm(e.languageData),n=LO(e),i,s=new class extends Parser{createParse(o,a,l){return new jO(i,o,a,l)}};super(r,s,[Lm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=$O(r),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new n0(n.tokenTable):WO}static define(e){return new _m(e)}getIndent(e,r){let n=Lt(e.state),i=n.resolve(r);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let s,{overrideIndentation:o}=e.options;o&&(s=Zm.get(e.state),s!=null&&s<r-1e4&&(s=void 0));let a=Fu(this,n,0,i.from,s??r),l,c;if(a?(c=a.state,l=a.pos+1):(c=this.streamParser.startState(e.unit),l=0),r-l>1e4)return null;for(;l<r;){let h=e.state.doc.lineAt(l),d=Math.min(r,h.to);if(h.length){let p=o?o(h.from):-1,m=new Xm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)e0(this.streamParser.token,m,c)}else this.streamParser.blankLine(c,e.unit);if(d==r)break;l=h.to+1}let u=e.lineAt(r);return o&&s==null&&Zm.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Fu(t,e,r,n,i){let s=r>=n&&r+e.length<=i&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:r+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=r+e.positions[o],c=a instanceof Tree&&l<i&&Fu(t,a,l,n,i);if(c)return c}return null}function qm(t,e,r,n,i){if(i&&r<=0&&n>=e.length)return e;!i&&e.type==t.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<n&&a instanceof Tree){if(!(l=qm(t,a,r-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function FO(t,e,r,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),a=s<=r&&o>r&&Fu(t,i.tree,0-i.offset,r,o),l;if(a&&(l=qm(t,i.tree,r+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:t.streamParser.startState(n?Ai(n):4),tree:Tree.empty}}class jO{constructor(e,r,n,i){this.lang=e,this.input=r,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=is.get(),o=i[0].from,{state:a,tree:l}=FO(e,n,o,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ai(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=is.get(),r=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(r,this.chunkStart+2048);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=r?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,r),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let r=this.input.chunk(e);if(this.input.lineChunks)r==`
|
|
151
|
-
`&&(
|
|
152
|
-
`);n>-1&&(r=r.slice(0,n))}return e+r.length<=this.to?r:r.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,r=this.lineAfter(e),n=e+r.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(r=r.slice(0,s-(n-r.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);r+=a,n=o+a.length}return{line:r,end:n}}skipGapsTo(e,r,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+r;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;r+=o-i}return r}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,r,n,i,s){if(this.ranges.length>1){s=this.skipGapsTo(r,s,1),r+=s;let o=this.chunk.length;s=this.skipGapsTo(n,s,-1),n+=s,i+=this.chunk.length-o}return this.chunk.push(e,r,n,i),s}parseLine(e){let{line:r,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Xm(r,e?e.state.tabSize:4,e?Ai(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=e0(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:VO,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function e0(t,e,r){e.start=e.pos;for(let n=0;n<10;n++){let i=t(e,r);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const ju=Object.create(null),wo=[nr.none],VO=new oa(wo),t0=[],r0=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"]])r0[t]=i0(ju,e);class n0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),r0)}resolve(e){return e?this.table[e]||(this.table[e]=i0(this.extra,e)):0}}const WO=new n0(ju);function Vu(t,e){t0.indexOf(t)>-1||(t0.push(t),console.warn(e))}function i0(t,e){let r=[];for(let s of e.split(" ")){let o=[];for(let a of s.split(".")){let l=t[a]||M[a];l?typeof l=="function"?o.length?o=o.map(l):Vu(a,`Modifier ${a} used at start of tag`):o.length?Vu(a,`Tag ${a} used as modifier`):o=Array.isArray(l)?l:[l]:Vu(a,`Unknown highlighting tag ${a}`)}for(let a of o)r.push(a)}if(!r.length)return 0;let n=e.replace(/ /g,"_"),i=nr.define({id:wo.length,name:n,props:[zd({[n]:r})]});return wo.push(i),i.id}function $O(t){let e=NodeType.define({id:wo.length,name:"Document",props:[ki.add(()=>t)],top:!0});return wo.push(e),e}const SD=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const r=HO(e,t.state.doc);return[{from:r,message:e.message,severity:"error",to:r}]}return[]};function HO(t,e){let r;return(r=t.message.match(/at position (\d+)/))?Math.min(+r[1],e.length):(r=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+r[1]).from+ +r[2]-1,e.length):0}const zO=_a.define({name:"json",parser:ik.configure({props:[Bm.add({Object:Vm({except:/^\s*\}/}),Array:Vm({except:/^\s*\]/})}),Wm.add({"Object Array":lO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function UO(){return new _C(zO)}function Wu(){return Wu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Wu.apply(this,arguments)}function GO(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}const KO=t=>{let{state:e}=t,r=e.doc.lineAt(e.selection.main.from),n=Hu(t.state,r.from);return n.line?YO(t):n.block?QO(t):!1};function $u(t,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let i=t(e,r);return i?(n(r.update(i)),!0):!1}}const YO=$u(_O,0),kD=null,AD=null,JO=$u(s0,0),CD=null,OD=null,QO=$u((t,e)=>s0(t,e,ZO(e)),0);function Hu(t,e){let r=t.languageDataAt("commentTokens",e);return r.length?r[0]:{}}const So=50;function XO(t,{open:e,close:r},n,i){let s=t.sliceDoc(n-So,n),o=t.sliceDoc(i,i+So),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+r.length)==r)return{open:{pos:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-n<=2*So?u=h=t.sliceDoc(n,i):(u=t.sliceDoc(n,n+So),h=t.sliceDoc(i-So,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-r.length;return u.slice(d,d+e.length)==e&&h.slice(m,m+r.length)==r?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-p-r.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function ZO(t){let e=[];for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),i=r.to<=n.to?n:t.doc.lineAt(r.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function s0(t,e,r=e.selection.ranges){let n=r.map(s=>Hu(e,s.from).block);if(!n.every(s=>s))return null;let i=r.map((s,o)=>XO(e,n[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(r.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function _O(t,e,r=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of r){let a=n.length,l=1e9,c=Hu(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,m=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),n.push({line:h,comment:m,token:c,indent:d,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}}if(t!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const zu=an.define(),qO=an.define(),e2=pe.define(),o0=pe.define({combine(t){return Ur(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,r)=>(n,i)=>e(n,i)||r(n,i)})}});function t2(t){let e=0;return t.iterChangedRanges((r,n)=>e=n),e}const Uu=At.define({create(){return dn.empty},update(t,e){let r=e.state.facet(o0),n=e.annotation(zu);if(n){let l=e.docChanged?se.single(t2(e.changes)):void 0,c=lr.fromTransaction(e,l),u=n.side,h=u==0?t.undone:t.done;return c?h=il(h,h.length,r.minDepth,c):h=c0(h,e.startState.selection),new dn(u==0?n.rest:h,u==0?h:n.rest)}let i=e.annotation(qO);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=lr.fromTransaction(e),o=e.annotation(Mt.time),a=e.annotation(Mt.userEvent);return s?t=t.addChanges(s,o,a,r,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,r.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 dn(t.done.map(lr.fromJSON),t.undone.map(lr.fromJSON))}});function r2(t={}){return[Uu,o0.of(t),de.domEventHandlers({beforeinput(e,r){let n=e.inputType=="historyUndo"?a0:e.inputType=="historyRedo"?Gu:null;return n?(e.preventDefault(),n(r)):!1}})]}const ED=null;function nl(t,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let i=r.field(Uu,!1);if(!i)return!1;let s=i.pop(t,r,e);return s?(n(s),!0):!1}}const a0=nl(0,!1),Gu=nl(1,!1),n2=nl(0,!0),i2=nl(1,!0);function TD(t){return function(e){let r=e.field(Uu,!1);if(!r)return 0;let n=t==0?r.done:r.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const PD=null,MD=null;class lr{constructor(e,r,n,i,s){this.changes=e,this.effects=r,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new lr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,r,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new lr(e.changes&&Pt.fromJSON(e.changes),[],e.mapped&&on.fromJSON(e.mapped),e.startSelection&&se.fromJSON(e.startSelection),e.selectionsAfter.map(se.fromJSON))}static fromTransaction(e,r){let n=Br;for(let i of e.startState.facet(e2)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new lr(e.changes.invert(e.startState.doc),n,void 0,r||e.startState.selection,Br)}static selection(e){return new lr(void 0,Br,void 0,void 0,e)}}function il(t,e,r,n){let i=e+1>r+20?e-r-1:0,s=t.slice(i,e);return s.push(n),s}function s2(t,e){let r=[],n=!1;return t.iterChangedRanges((i,s)=>r.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<r.length;){let c=r[l++],u=r[l++];a>=c&&o<=u&&(n=!0)}}),n}function o2(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((r,n)=>r.empty!=e.ranges[n].empty).length===0}function l0(t,e){return t.length?e.length?t.concat(e):t:e}const Br=[],a2=200;function c0(t,e){if(t.length){let r=t[t.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-a2));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),il(t,t.length-1,1e9,r.setSelAfter(n)))}else return[lr.selection([e])]}function l2(t){let e=t[t.length-1],r=t.slice();return r[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function Ku(t,e){if(!t.length)return t;let r=t.length,n=Br;for(;r;){let i=c2(t[r-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,r);return s[r-1]=i,s}else e=i.mapped,r--,n=i.selectionsAfter}return n.length?[lr.selection(n)]:Br}function c2(t,e,r){let n=l0(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Br,r);if(!t.changes)return lr.selection(n);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new lr(i,Ae.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const u2=/^(input\.type|delete)($|\.)/;class dn{constructor(e,r,n=0,i=void 0){this.done=e,this.undone=r,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new dn(this.done,this.undone):this}addChanges(e,r,n,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||u2.test(n))&&(!a.selectionsAfter.length&&r-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,s2(a.changes,e.changes))||n=="input.type.compose")?o=il(o,o.length-1,i.minDepth,new lr(e.changes.compose(a.changes),l0(e.effects,a.effects),a.mapped,a.startSelection,Br)):o=il(o,o.length,i.minDepth,e),new dn(o,Br,r,n)}addSelection(e,r,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Br;return s.length>0&&r-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&o2(s[s.length-1],e)?this:new dn(c0(this.done,e),this.undone,r,n)}addMapping(e){return new dn(Ku(this.done,e),Ku(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,r,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1];if(n&&s.selectionsAfter.length)return r.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:zu.of({side:e,rest:l2(i)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?Br:i.slice(0,i.length-1);return s.mapped&&(o=Ku(o,s.mapped)),r.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:zu.of({side:e,rest:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}dn.empty=new dn(Br,Br);const f2=[{key:"Mod-z",run:a0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Gu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Gu,preventDefault:!0},{key:"Mod-u",run:n2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:i2,preventDefault:!0}];function cs(t,e){return se.create(t.ranges.map(e),t.mainIndex)}function pn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Fr({state:t,dispatch:e},r){let n=cs(t.selection,r);return n.eq(t.selection)?!1:(e(pn(t,n)),!0)}function ko(t,e){return se.cursor(e?t.to:t.from)}function sl(t,e){return Fr(t,r=>r.empty?t.moveByChar(r,e):ko(r,e))}function Xt(t){return t.textDirectionAt(t.state.selection.main.head)==ht.LTR}const u0=t=>sl(t,!Xt(t)),f0=t=>sl(t,Xt(t)),ID=t=>sl(t,!0),DD=t=>sl(t,!1);function ol(t,e){return Fr(t,r=>r.empty?t.moveByGroup(r,e):ko(r,e))}const h2=t=>ol(t,!Xt(t)),d2=t=>ol(t,Xt(t)),ND=t=>ol(t,!0),RD=t=>ol(t,!1),h0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function d0(t,e,r){let n=t.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,a=!1,l=!1,c=!1,u=d=>{if(a)return!1;s+=r?d.length:-d.length;let p=n(d),m;if(p==CharCategory.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(p=-1),i==CharCategory.Space&&(i=p),i!=p)return!1;if(i==CharCategory.Word)if(d.toLowerCase()==d){if(!r&&l)return!1;c=!0}else if(c){if(r)return!1;a=!0}else{if(l&&r&&n(m=t.state.sliceDoc(s,s+1))==CharCategory.Word&&m.toLowerCase()==m)return!1;l=!0}return o++,!0},h=t.moveByChar(e,r,d=>(u(d),u));if(h0&&i==CharCategory.Word&&h.from==e.from+o*(r?1:-1)){let d=Math.min(e.head,h.head),p=Math.max(e.head,h.head),m=t.state.sliceDoc(d,p);if(m.length>1&&/[\u4E00-\uffff]/.test(m)){let y=Array.from(h0.segment(m));if(y.length>1)return r?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(h.head+y[y.length-1].index,1)}}return h}function p0(t,e){return Fr(t,r=>r.empty?d0(t,r,e):ko(r,e))}const LD=t=>p0(t,!0),BD=t=>p0(t,!1);function p2(t,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function al(t,e,r){let n=Lt(t).resolveInner(e.head),i=r?Re.closedBy:Re.openedBy;for(let l=e.head;;){let c=r?n.childAfter(l):n.childBefore(l);if(!c)break;p2(t,c,i)?n=c:l=r?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=r?hn(t,n.from,1):hn(t,n.to,-1))&&o.matched?a=r?o.end.to:o.end.from:a=r?n.to:n.from,se.cursor(a,r?-1:1)}const g2=t=>Fr(t,e=>al(t.state,e,!Xt(t))),m2=t=>Fr(t,e=>al(t.state,e,Xt(t)));function g0(t,e){return Fr(t,r=>{if(!r.empty)return ko(r,e);let n=t.moveVertically(r,e);return n.head!=r.head?n:t.moveToLineBoundary(r,e)})}const m0=t=>g0(t,!1),v0=t=>g0(t,!0);function y0(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,r=0,n=0,i;if(e){for(let s of t.state.facet(de.scrollMargins)){let o=s(t);o?.top&&(r=Math.max(o?.top,r)),o?.bottom&&(n=Math.max(o?.bottom,n))}i=t.scrollDOM.clientHeight-r-n}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function b0(t,e){let r=y0(t),{state:n}=t,i=cs(n.selection,o=>o.empty?t.moveVertically(o,e,r.height):ko(o,e));if(i.eq(n.selection))return!1;let s;if(r.selfScroll){let o=t.coordsAtPos(n.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+r.marginTop,c=a.bottom-r.marginBottom;o&&o.top>l&&o.bottom<c&&(s=de.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(pn(n,i),{effects:s}),!0}const x0=t=>b0(t,!1),Yu=t=>b0(t,!0);function ri(t,e,r){let n=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,r);if(i.head==e.head&&i.head!=(r?n.to:n.from)&&(i=t.moveToLineBoundary(e,r,!1)),!r&&i.head==n.from&&n.length){let s=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(i=se.cursor(n.from+s))}return i}const v2=t=>Fr(t,e=>ri(t,e,!0)),y2=t=>Fr(t,e=>ri(t,e,!1)),b2=t=>Fr(t,e=>ri(t,e,!Xt(t))),x2=t=>Fr(t,e=>ri(t,e,Xt(t))),w2=t=>Fr(t,e=>se.cursor(t.lineBlockAt(e.head).from,1)),S2=t=>Fr(t,e=>se.cursor(t.lineBlockAt(e.head).to,-1));function w0(t,e,r){let n=!1,i=cs(t.selection,s=>{let o=hn(t,s.head,-1)||hn(t,s.head,1)||s.head>0&&hn(t,s.head-1,1)||s.head<t.doc.length&&hn(t,s.head+1,-1);if(!o||!o.end)return s;n=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return r?se.range(s.anchor,a):se.cursor(a)});return n?(e(pn(t,i)),!0):!1}const k2=({state:t,dispatch:e})=>w0(t,e,!1),FD=({state:t,dispatch:e})=>w0(t,e,!0);function kr(t,e){let r=cs(t.state.selection,n=>{let i=e(n);return se.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return r.eq(t.state.selection)?!1:(t.dispatch(pn(t.state,r)),!0)}function ll(t,e){return kr(t,r=>t.moveByChar(r,e))}const S0=t=>ll(t,!Xt(t)),k0=t=>ll(t,Xt(t)),jD=t=>ll(t,!0),VD=t=>ll(t,!1);function cl(t,e){return kr(t,r=>t.moveByGroup(r,e))}const A2=t=>cl(t,!Xt(t)),C2=t=>cl(t,Xt(t)),WD=t=>cl(t,!0),$D=t=>cl(t,!1);function A0(t,e){return kr(t,r=>d0(t,r,e))}const HD=t=>A0(t,!0),zD=t=>A0(t,!1),O2=t=>kr(t,e=>al(t.state,e,!Xt(t))),E2=t=>kr(t,e=>al(t.state,e,Xt(t)));function C0(t,e){return kr(t,r=>t.moveVertically(r,e))}const O0=t=>C0(t,!1),E0=t=>C0(t,!0);function T0(t,e){return kr(t,r=>t.moveVertically(r,e,y0(t).height))}const P0=t=>T0(t,!1),M0=t=>T0(t,!0),T2=t=>kr(t,e=>ri(t,e,!0)),P2=t=>kr(t,e=>ri(t,e,!1)),M2=t=>kr(t,e=>ri(t,e,!Xt(t))),I2=t=>kr(t,e=>ri(t,e,Xt(t))),D2=t=>kr(t,e=>se.cursor(t.lineBlockAt(e.head).from)),N2=t=>kr(t,e=>se.cursor(t.lineBlockAt(e.head).to)),I0=({state:t,dispatch:e})=>(e(pn(t,{anchor:0})),!0),D0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.doc.length})),!0),N0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.selection.main.anchor,head:0})),!0),R0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),R2=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),L2=({state:t,dispatch:e})=>{let r=fl(t).map(({from:n,to:i})=>se.range(n,Math.min(i+1,t.doc.length)));return e(t.update({selection:se.create(r),userEvent:"select"})),!0},B2=({state:t,dispatch:e})=>{let r=cs(t.selection,n=>{var i;let s=Lt(t).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return se.range(a.to,a.from)}return n});return e(pn(t,r)),!0},F2=({state:t,dispatch:e})=>{let r=t.selection,n=null;return r.ranges.length>1?n=se.create([r.main]):r.main.empty||(n=se.create([se.cursor(r.main.head)])),n?(e(pn(t,n)),!0):!1};function us(t,e){if(t.state.readOnly)return!1;let r="delete.selection",{state:n}=t,i=n.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(r="delete.backward",l=ul(t,l,!1)):l>o&&(r="delete.forward",l=ul(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ul(t,o,!1),a=ul(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:se.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(n.update(i,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?de.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ul(t,e,r){if(t instanceof de)for(let n of t.state.facet(de.atomicRanges).map(i=>i(t)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=r?s:i)});return e}const L0=(t,e)=>us(t,r=>{let n=r.from,{state:i}=t,s=i.doc.lineAt(n),o,a;if(!e&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(o=s.text.slice(0,n-s.from))){if(o[o.length-1]==" ")return n-1;let l=Xi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Kt(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)&&(a+=e?1:-1);return a}),Ju=t=>L0(t,!1),B0=t=>L0(t,!0),F0=(t,e)=>us(t,r=>{let n=r.head,{state:i}=t,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let a=null;;){if(n==(e?s.to:s.from)){n==r.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let l=Kt(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=r.head)&&(a=u),n=l}return n}),j0=t=>F0(t,!1),j2=t=>F0(t,!0),V2=t=>us(t,e=>{let r=t.lineBlockAt(e.head).to;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),UD=t=>us(t,e=>{let r=t.lineBlockAt(e.head).from;return e.head>r?r:Math.max(0,e.head-1)}),W2=t=>us(t,e=>{let r=t.moveToLineBoundary(e,!1).head;return e.head>r?r:Math.max(0,e.head-1)}),$2=t=>us(t,e=>{let r=t.moveToLineBoundary(e,!0).head;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),GD=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=[];for(let n=0,i="",s=t.doc.iter();;){if(s.next(),s.lineBreak||s.done){let o=i.search(/\s+$/);if(o>-1&&r.push({from:n-(i.length-o),to:n}),s.done)break;i=""}else i=s.value;n+=s.value.length}return r.length?(e(t.update({changes:r,userEvent:"delete"})),!0):!1},H2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Je.of(["",""])},range:se.cursor(n.from)}));return e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},z2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let i=n.from,s=t.doc.lineAt(i),o=i==s.from?i-1:Kt(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Kt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:se.cursor(a)}});return r.changes.empty?!1:(e(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function fl(t){let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),s=t.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=t.doc.lineAt(n.to-1)),r>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:i.from,to:s.to,ranges:[n]});r=s.number+1}return e}function V0(t,e,r){if(t.readOnly)return!1;let n=[],i=[];for(let s of fl(t)){if(r?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(r?s.to+1:s.from-1),a=o.length+1;if(r){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(se.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(se.range(l.anchor-a,l.head-a))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:se.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const U2=({state:t,dispatch:e})=>V0(t,e,!1),G2=({state:t,dispatch:e})=>V0(t,e,!0);function W0(t,e,r){if(t.readOnly)return!1;let n=[];for(let i of fl(t))r?n.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):n.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const K2=({state:t,dispatch:e})=>W0(t,e,!1),Y2=({state:t,dispatch:e})=>W0(t,e,!0),J2=t=>{if(t.state.readOnly)return!1;let{state:e}=t,r=e.changes(fl(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=cs(e.selection,i=>t.moveVertically(i,!0)).map(r);return t.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},KD=({state:t,dispatch:e})=>(e(t.update(t.replaceSelection(t.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function Q2(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let r=Lt(t).resolveInner(e),n=r.childBefore(e),i=r.childAfter(e),s;return n&&i&&n.to<=e&&i.from>=e&&(s=n.type.prop(Re.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const X2=$0(!1),Z2=$0(!0);function $0(t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&Q2(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new vo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=el(c,s);for(u==null&&(u=Xi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",os(e,u)];return l&&h.push(os(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Je.of(h)},range:se.cursor(s+1+h[1].length)}});return r(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Qu(t,e){let r=-1;return t.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let a=t.doc.lineAt(o);a.number>r&&(n.empty||n.to>a.from)&&(e(a,i,n),r=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:se.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const _2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Object.create(null),n=new vo(t,{overrideIndentation:s=>{let o=r[s];return o??-1}}),i=Qu(t,(s,o,a)=>{let l=el(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=os(t,l);(c!=u||a.from<s.from+c.length)&&(r[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},Xu=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qu(t,(r,n)=>{n.push({from:r.from,insert:t.facet(qa)})}),{userEvent:"input.indent"})),!0),H0=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qu(t,(r,n)=>{let i=/^\s*/.exec(r.text)[0];if(!i)return;let s=Xi(i,t.tabSize),o=0,a=os(t,Math.max(0,s-Ai(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:r.from+o,to:r.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),YD=({state:t,dispatch:e})=>t.selection.ranges.some(r=>!r.empty)?Xu({state:t,dispatch:e}):(e(t.update(t.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),q2=[{key:"Ctrl-b",run:u0,shift:S0,preventDefault:!0},{key:"Ctrl-f",run:f0,shift:k0},{key:"Ctrl-p",run:m0,shift:O0},{key:"Ctrl-n",run:v0,shift:E0},{key:"Ctrl-a",run:w2,shift:D2},{key:"Ctrl-e",run:S2,shift:N2},{key:"Ctrl-d",run:B0},{key:"Ctrl-h",run:Ju},{key:"Ctrl-k",run:V2},{key:"Ctrl-Alt-h",run:j0},{key:"Ctrl-o",run:H2},{key:"Ctrl-t",run:z2},{key:"Ctrl-v",run:Yu}],eE=[{key:"ArrowLeft",run:u0,shift:S0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:h2,shift:A2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:b2,shift:M2,preventDefault:!0},{key:"ArrowRight",run:f0,shift:k0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:d2,shift:C2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:x2,shift:I2,preventDefault:!0},{key:"ArrowUp",run:m0,shift:O0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:I0,shift:N0},{mac:"Ctrl-ArrowUp",run:x0,shift:P0},{key:"ArrowDown",run:v0,shift:E0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:D0,shift:R0},{mac:"Ctrl-ArrowDown",run:Yu,shift:M0},{key:"PageUp",run:x0,shift:P0},{key:"PageDown",run:Yu,shift:M0},{key:"Home",run:y2,shift:P2,preventDefault:!0},{key:"Mod-Home",run:I0,shift:N0},{key:"End",run:v2,shift:T2,preventDefault:!0},{key:"Mod-End",run:D0,shift:R0},{key:"Enter",run:X2},{key:"Mod-a",run:R2},{key:"Backspace",run:Ju,shift:Ju},{key:"Delete",run:B0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:j0},{key:"Mod-Delete",mac:"Alt-Delete",run:j2},{mac:"Mod-Backspace",run:W2},{mac:"Mod-Delete",run:$2}].concat(q2.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),tE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:g2,shift:O2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:m2,shift:E2},{key:"Alt-ArrowUp",run:U2},{key:"Shift-Alt-ArrowUp",run:K2},{key:"Alt-ArrowDown",run:G2},{key:"Shift-Alt-ArrowDown",run:Y2},{key:"Escape",run:F2},{key:"Mod-Enter",run:Z2},{key:"Alt-l",mac:"Ctrl-l",run:L2},{key:"Mod-i",run:B2,preventDefault:!0},{key:"Mod-[",run:H0},{key:"Mod-]",run:Xu},{key:"Mod-Alt-\\",run:_2},{key:"Shift-Mod-k",run:J2},{key:"Shift-Mod-\\",run:k2},{key:"Mod-/",run:KO},{key:"Alt-A",run:JO}].concat(eE),rE={key:"Tab",run:Xu,shift:H0};function rt(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var i=r[n];typeof i=="string"?t.setAttribute(n,i):i!=null&&(t[n]=i)}e++}for(;e<arguments.length;e++)z0(t,arguments[e]);return t}function z0(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var r=0;r<e.length;r++)z0(t,e[r]);else throw new RangeError("Unsupported child node: "+e)}const U0=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class fs{constructor(e,r,n=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(n,i),this.bufferStart=n,this.normalize=s?a=>s(U0(a)):U0,this.query=this.normalize(r)}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 Ft(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 r=Ac(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Lr(e);let i=this.normalize(r);for(let s=0,o=n;;s++){let a=i.charCodeAt(s),l=this.match(a,o);if(s==i.length-1){if(l)return this.value=l,this;break}o==n&&s<r.length&&r.charCodeAt(s)==a&&o++}}}match(e,r){let n=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],o=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?n={from:this.matches[i+1],to:r+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:r,to:r+1}:this.matches.push(1,r)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}typeof Symbol<"u"&&(fs.prototype[Symbol.iterator]=function(){return this});const G0={from:-1,to:-1,match:/.*/.exec("")},Zu="gm"+(/x/.unicode==null?"":"u");class K0{constructor(e,r,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=G0,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Y0(e,r,n,i,s);this.re=new RegExp(r,Zu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=hl(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=hl(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const _u=new WeakMap;class hs{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let i=_u.get(e);if(!i||i.from>=n||i.to<=r){let a=new hs(r,e.sliceString(r,n));return _u.set(e,a),a}if(i.from==r&&i.to==n)return i;let{text:s,from:o}=i;return o>r&&(s=e.sliceString(r,o)+s,o=r),i.to<n&&(s+=e.sliceString(i.to,n)),_u.set(e,new hs(o,s)),new hs(r,s.slice(r-o,n-o))}}class Y0{constructor(e,r,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=G0,this.matchPos=hl(e,i),this.re=new RegExp(r,Zu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=hs.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this.matchPos=hl(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=hs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(K0.prototype[Symbol.iterator]=Y0.prototype[Symbol.iterator]=function(){return this});function nE(t){try{return new RegExp(t,Zu),!0}catch{return!1}}function hl(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}function qu(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),r=rt("input",{class:"cm-textfield",name:"line",value:e}),n=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:dl.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",t.state.phrase("Go to line"),": ",r)," ",rt("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!s)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,h]=s,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=se.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[dl.of(!1),de.scrollIntoView(y.from,{y:"center"})],selection:y}),t.focus()}return{dom:n}}const dl=Ae.define(),J0=At.define({create(){return!0},update(t,e){for(let r of e.effects)r.is(dl)&&(t=r.value);return t},provide:t=>po.from(t,e=>e?qu:null)}),iE=t=>{let e=ho(t,qu);if(!e){let r=[dl.of(!0)];t.state.field(J0,!1)==null&&r.push(Ae.appendConfig.of([J0,sE])),t.dispatch({effects:r}),e=ho(t,qu)}return e&&e.dom.querySelector("input").select(),!0},sE=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),oE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Q0=pe.define({combine(t){return Ur(t,oE,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function aE(t){let e=[hE,fE];return t&&e.push(Q0.of(t)),e}const lE=ke.mark({class:"cm-selectionMatch"}),cE=ke.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function X0(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=at.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=at.Word)}function uE(t,e,r,n){return t(e.sliceDoc(r,r+1))==at.Word&&t(e.sliceDoc(n-1,n))==at.Word}const fE=ft.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(Q0),{state:r}=t,n=r.selection;if(n.ranges.length>1)return ke.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ke.none;let l=r.wordAt(i.head);if(!l)return ke.none;o=r.charCategorizer(i.head),s=r.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ke.none;if(e.wholeWords){if(s=r.sliceDoc(i.from,i.to),o=r.charCategorizer(i.head),!(X0(o,r,i.from,i.to)&&uE(o,r,i.from,i.to)))return ke.none}else if(s=r.sliceDoc(i.from,i.to).trim(),!s)return ke.none}let a=[];for(let l of t.visibleRanges){let c=new fs(r.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||X0(o,r,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(cE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(lE.range(u,h)),a.length>e.maxMatches))return ke.none}}return ke.set(a)}},{decorations:t=>t.decorations}),hE=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),dE=({state:t,dispatch:e})=>{let{selection:r}=t,n=se.create(r.ranges.map(i=>t.wordAt(i.head)||se.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function pE(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let o=!1,a=new fs(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new fs(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const gE=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(s=>s.from===s.to))return dE({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=n))return!1;let i=pE(t,n);return i?(e(t.update({selection:t.selection.addRange(se.range(i.from,i.to),!1),effects:de.scrollIntoView(i.to)})),!0):!1},Ci=pe.define({combine(t){return Ur(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new EE(e),scrollToMatch:e=>de.scrollIntoView(e)})}});function JD(t){return t?[Ci.of(t),sf]:sf}class Z0{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||nE(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
153
|
-
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new bE(this):new vE(this)}getCursor(e,r=0,n){let i=e.doc?e:Ve.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ps(this,i,r,n):ds(this,i,r,n)}}class _0{constructor(e){this.spec=e}}function ds(t,e,r,n){return new fs(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?mE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function mE(t,e){return(r,n,i,s)=>((s>r||s+i.length<n)&&(s=Math.max(0,r-2),i=t.sliceString(s,Math.min(t.length,n+2))),(e(pl(i,r-s))!=at.Word||e(gl(i,r-s))!=at.Word)&&(e(gl(i,n-s))!=at.Word||e(pl(i,n-s))!=at.Word))}class vE extends _0{constructor(e){super(e)}nextMatch(e,r,n){let i=ds(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=ds(this.spec,e,0,r).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=n;;){let s=Math.max(r,i-1e4-this.spec.unquoted.length),o=ds(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==r)return null;i-=1e4}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=ds(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=ds(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ps(t,e,r,n){return new K0(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?yE(e.charCategorizer(e.selection.main.head)):void 0},r,n)}function pl(t,e){return t.slice(Kt(t,e,!1),e)}function gl(t,e){return t.slice(e,Kt(t,e))}function yE(t){return(e,r,n)=>!n[0].length||(t(pl(n.input,n.index))!=at.Word||t(gl(n.input,n.index))!=at.Word)&&(t(gl(n.input,n.index+n[0].length))!=at.Word||t(pl(n.input,n.index+n[0].length))!=at.Word)}class bE extends _0{nextMatch(e,r,n){let i=ps(this.spec,e,n,e.doc.length).next();return i.done&&(i=ps(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let s=Math.max(r,n-i*1e4),o=ps(this.spec,e,s,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==r||a.from>s+10))return a;if(s==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(r,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:r))}matchAll(e,r){let n=ps(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=ps(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ao=Ae.define(),ef=Ae.define(),gn=At.define({create(t){return new tf(yl(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Ao)?t=new tf(r.value.create(),t.panel):r.is(ef)&&(t=new tf(t.query,r.value?rf:null));return t},provide:t=>po.from(t,e=>e.panel)});function QD(t){let e=t.field(gn,!1);return e?e.query.spec:yl(t)}function XD(t){var e;return((e=t.field(gn,!1))===null||e===void 0?void 0:e.panel)!=null}class tf{constructor(e,r){this.query=e,this.panel=r}}const xE=ke.mark({class:"cm-searchMatch"}),wE=ke.mark({class:"cm-searchMatch cm-searchMatch-selected"}),SE=ft.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(gn))}update(t){let e=t.state.field(gn);(e!=t.startState.field(gn)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ke.none;let{view:r}=this,n=new Kn;for(let i=0,s=r.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(r.state,a,l,(c,u)=>{let h=r.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,h?wE:xE)})}return n.finish()}},{decorations:t=>t.decorations});function Co(t){return e=>{let r=e.state.field(gn,!1);return r&&r.query.spec.valid?t(e,r):rv(e)}}const ml=Co((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=se.single(n.from,n.to),s=t.state.facet(Ci);return t.dispatch({selection:i,effects:[nf(t,n),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),tv(t),!0}),vl=Co((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let s=se.single(i.from,i.to),o=t.state.facet(Ci);return t.dispatch({selection:s,effects:[nf(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),tv(t),!0}),kE=Co((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:se.create(r.map(n=>se.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),AE=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],o=0;for(let a=new fs(t.doc,t.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(se.range(a.value.from,a.value.to))}return e(t.update({selection:se.create(s,o),userEvent:"select.search.matches"})),!0},q0=Co((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=e.nextMatch(r,n,n);if(!s)return!1;let o=[],a,l,c=[];if(s.from==n&&s.to==i&&(l=r.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(r,s.from,s.to),c.push(de.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=se.single(s.from-u,s.to-u),c.push(nf(t,s)),c.push(r.facet(Ci).scrollToMatch(a.main,t))}return t.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),CE=Co((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:de.announce.of(n),userEvent:"input.replace.all"}),!0});function rf(t){return t.state.facet(Ci).createPanel(t)}function yl(t,e){var r,n,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Ci);return new Z0({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function ev(t){let e=ho(t,rf);return e&&e.dom.querySelector("[main-field]")}function tv(t){let e=ev(t);e&&e==t.root.activeElement&&e.select()}const rv=t=>{let e=t.state.field(gn,!1);if(e&&e.panel){let r=ev(t);if(r&&r!=t.root.activeElement){let n=yl(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ao.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[ef.of(!0),e?Ao.of(yl(t.state,e.query.spec)):Ae.appendConfig.of(sf)]});return!0},nv=t=>{let e=t.state.field(gn,!1);if(!e||!e.panel)return!1;let r=ho(t,rf);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ef.of(!1)}),!0},OE=[{key:"Mod-f",run:rv,scope:"editor search-panel"},{key:"F3",run:ml,shift:vl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ml,shift:vl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:nv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:AE},{key:"Alt-g",run:iE},{key:"Mod-d",run:gE,preventDefault:!0}];class EE{constructor(e){this.view=e;let r=this.query=e.state.field(gn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:r.search,placeholder:Ar(e,"Find"),"aria-label":Ar(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:r.replace,placeholder:Ar(e,"Replace"),"aria-label":Ar(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>ml(e),[Ar(e,"next")]),n("prev",()=>vl(e),[Ar(e,"previous")]),n("select",()=>kE(e),[Ar(e,"all")]),rt("label",null,[this.caseField,Ar(e,"match case")]),rt("label",null,[this.reField,Ar(e,"regexp")]),rt("label",null,[this.wordField,Ar(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>q0(e),[Ar(e,"replace")]),n("replaceAll",()=>CE(e),[Ar(e,"replace all")])],rt("button",{name:"close",onclick:()=>nv(e),"aria-label":Ar(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Z0({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:Ao.of(e)}))}keydown(e){JA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vl:ml)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),q0(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Ao)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ci).top}}function Ar(t,e){return t.state.phrase(e)}const bl=30,xl=/[\s\.,:;?!]/;function nf(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,s=Math.max(n.from,e-bl),o=Math.min(i,r+bl),a=t.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<bl;l++)if(!xl.test(a[l+1])&&xl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-bl;l--)if(!xl.test(a[l-1])&&xl.test(a[l])){a=a.slice(0,l);break}}return de.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const TE=de.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sf=[gn,xi.low(SE),TE];class iv{constructor(e,r,n){this.state=e,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let r=Lt(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),s=i.search(av(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,r){e=="abort"&&this.abortListeners&&this.abortListeners.push(r)}}function sv(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PE(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)r[i[s]]=!0}let n=sv(e)+sv(r)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function ME(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:PE(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:r}:null}}function ZD(t,e){return r=>{for(let n=syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return e(r);if(n.type.isTop)break}return null}}function _D(t,e){return r=>{for(let n=syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}class ov{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}}function ni(t){return t.selection.main.from}function av(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}const lv=an.define();function IE(t,e,r,n){let{main:i}=t.selection,s=r-i.from,o=n-i.from;return Object.assign(Object.assign({},t.changeByRange(a=>a!=i&&r!=n&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(r,n)?{range:a}:{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:e},range:se.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const cv=new WeakMap;function DE(t){if(!Array.isArray(t))return t;let e=cv.get(t);return e||cv.set(t,e=ME(t)),e}const of=Ae.define(),Oo=Ae.define();class NE{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<e.length;){let n=Ft(e,r),i=Lr(n);this.chars.push(n);let s=e.slice(r,r+i),o=s.toUpperCase();this.folded.push(Ft(o==s?s.toLowerCase():o,0)),r+=i}this.astral=e.length!=this.chars.length}ret(e,r){return this.score=e,this.matched=r,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:r,folded:n,any:i,precise:s,byWord:o}=this;if(r.length==1){let T=Ft(e,0),E=Lr(T),B=E==e.length?0:-100;if(T!=r[0])if(T==n[0])B+=-200;else return!1;return this.ret(B,[0,E])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=r.length,c=0;if(a<0){for(let T=0,E=Math.min(e.length,200);T<E&&c<l;){let B=Ft(e,T);(B==r[c]||B==n[c])&&(i[c++]=T),T+=Lr(B)}if(c<l)return!1}let u=0,h=0,d=!1,p=0,m=-1,y=-1,w=/[a-z]/.test(e),A=!0;for(let T=0,E=Math.min(e.length,200),B=0;T<E&&h<l;){let I=Ft(e,T);a<0&&(u<l&&I==r[u]&&(s[u++]=T),p<l&&(I==r[p]||I==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let W,F=I<255?I>=48&&I<=57||I>=97&&I<=122?2:I>=65&&I<=90?1:0:(W=Ac(I))!=W.toLowerCase()?1:W!=W.toUpperCase()?2:0;(!T||F==1&&w||B==0&&F!=0)&&(r[h]==I||n[h]==I&&(d=!0)?o[h++]=T:o.length&&(A=!1)),B=F,T+=Lr(I)}return h==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-200+-700-e.length,[m,y]):h==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,e):r.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],s=0;for(let o of r){let a=o+(this.astral?Lr(Ft(n,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-n.length,i)}}const Zt=pe.define({combine(t){return Ur(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RE,compareCompletions:(e,r)=>e.label.localeCompare(r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>uv(e(n),r(n)),optionClass:(e,r)=>n=>uv(e(n),r(n)),addToOptions:(e,r)=>e.concat(r)})}});function uv(t,e){return t?e?t+" "+e:t:e}function RE(t,e,r,n,i,s){let o=t.textDirection==ht.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,p=i.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&d<Math.min(m,p)?a=!1:!a&&p<Math.min(m,d)&&(a=!0),m<=(a?d:p))u=Math.max(i.top,Math.min(r.top,i.bottom-y))-e.top,h=Math.min(400,a?d:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=y||T>e.top?u=r.bottom-e.top:(c="bottom",u=e.bottom-r.top)}let w=(e.bottom-e.top)/s.offsetHeight,A=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${h/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function LE(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=r.displayLabel||r.label,l=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,h))),d.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(r){if(!r.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=r.detail,n},position:80}),e.sort((r,n)=>r.position-n.position).map(r=>r.render)}function af(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.floor((t-e)/r);return{from:t-(n+1)*r,to:t-n*r}}class BE{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:s,selected:o}=i.open,a=e.state.facet(Zt);this.optionContent=LE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=af(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(r).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Zt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Oo.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:o,disabled:a}=n.open;(!i.open||i.open.options!=s)&&(this.range=af(s.length,o,e.state.facet(Zt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;if((r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=af(r.options.length,r.selected,this.view.state.facet(Zt).maxRenderedOptions),this.showOptions(r.options,e.id)),this.updateSelectedOption(r.selected)){this.destroyInfo();let{completion:n}=r.options[r.selected],{info:i}=n;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>br(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return r&&jE(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=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,r.bottom)-10||i.bottom<Math.max(s.top,r.top)+10?null:this.view.state.facet(Zt).positionInfo(this.view,r,i,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,r,n){const i=document.createElement("ul");i.id=r,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=r+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let p=d(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function FE(t,e){return r=>new BE(r,t,e)}function jE(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.top<r.top?t.scrollTop-=(r.top-n.top)/i:n.bottom>r.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function fv(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function VE(t,e){let r=[],n=null,i=l=>{r.push(l);let{section:c}=l.completion;if(c){n||(n=[]);let u=typeof c=="string"?c:c.name;n.some(h=>h.name==u)||n.push(typeof c=="string"?{name:u}:c)}};for(let l of t)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let u of l.result.options)i(new ov(u,l.source,c?c(u):[],1e9-r.length));else{let u=new NE(e.sliceDoc(l.from,l.to));for(let h of l.result.options)if(u.match(h.label)){let d=h.displayLabel?c?c(h,u.matched):[]:u.matched;i(new ov(h,l.source,d,u.score+(h.boost||0)))}}}if(n){let l=Object.create(null),c=0,u=(h,d)=>{var p,m;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(h.name<d.name?-1:1)};for(let h of n.sort(u))c-=1e5,l[h.name]=c;for(let h of r){let{section:d}=h.completion;d&&(h.score+=l[typeof d=="string"?d:d.name])}}let s=[],o=null,a=e.facet(Zt).compareCompletions;for(let l of r.sort((c,u)=>u.score-c.score||a(c.completion,u.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?s.push(l):fv(l.completion)>fv(o)&&(s[s.length-1]=l),o=l.completion}return s}class gs{constructor(e,r,n,i,s,o){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new gs(this.options,hv(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,s){let o=VE(e,r);if(!o.length)return i&&e.some(l=>l.state==1)?new gs(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=r.facet(Zt).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new gs(o,hv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:UE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new gs(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class wl{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new wl(HE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Zt),s=(n.override||r.languageDataAt("autocomplete",ni(r)).map(DE)).map(a=>(this.active.find(c=>c.source==a)||new cr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!WE(s,this.active)?o=gs.build(s,r,this.id,o,n):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new cr(a.source,0):a));for(let a of e.effects)a.is(cf)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new wl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:$E}}function WE(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r<t.length&&!t[r].hasResult;)r++;for(;n<e.length&&!e[n].hasResult;)n++;let i=r==t.length,s=n==e.length;if(i||s)return i==s;if(t[r++].result!=e[n++].result)return!1}}const $E={"aria-autocomplete":"list"};function hv(t,e){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(r["aria-activedescendant"]=t+"-"+e),r}const HE=[];function lf(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class cr{constructor(e,r,n=-1){this.source=e,this.state=r,this.explicitPos=n}hasResult(){return!1}update(e,r){let n=lf(e),i=this;n?i=i.handleUserEvent(e,n,r):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new cr(i.source,0));for(let s of e.effects)if(s.is(of))i=new cr(i.source,1,s.value?ni(e.state):-1);else if(s.is(Oo))i=new cr(i.source,0);else if(s.is(dv))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,r,n){return r=="delete"||!n.activateOnTyping?this.map(e.changes):new cr(this.source,1)}handleChange(e){return e.changes.touchesRange(ni(e.startState))?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new cr(this.source,this.state,e.mapPos(this.explicitPos))}}class ms extends cr{constructor(e,r,n,i,s){super(e,2,r),this.result=n,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,r,n){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ni(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||r=="delete"&&ni(e.startState)==this.from)return new cr(this.source,r=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return zE(this.result.validFor,e.state,s,o)?new ms(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new iv(e.state,a,l>=0)))?new ms(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ni(e.state)):new cr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ms(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function zE(t,e,r,n){if(!t)return!1;let i=e.sliceDoc(r,n);return typeof t=="function"?t(i,r,n,e):av(t,!0).test(i)}const dv=Ae.define({map(t,e){return t.map(r=>r.map(e))}}),cf=Ae.define(),Wt=At.define({create(){return wl.start()},update(t,e){return t.update(e)},provide:t=>[Qa.from(t,e=>e.tooltip),de.contentAttributes.from(t,e=>e.attrs)]});function pv(t,e){const r=e.completion.apply||e.completion.label;let n=t.state.field(Wt).active.find(i=>i.source==e.source);return n instanceof ms?(typeof r=="string"?t.dispatch(Object.assign(Object.assign({},IE(t.state,r,n.from,n.to)),{annotations:lv.of(e.completion)})):r(t,e.completion,n.from,n.to),!0):!1}const UE=FE(Wt,pv);function Sl(t,e="option"){return r=>{let n=r.state.field(Wt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<r.state.facet(Zt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=ym(r,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),r.dispatch({effects:cf.of(a)}),!0}}const GE=t=>{let e=t.state.field(Wt,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Zt).interactionDelay?!1:pv(t,e.open.options[e.open.selected])},KE=t=>t.state.field(Wt,!1)?(t.dispatch({effects:of.of(!0)}),!0):!1,YE=t=>{let e=t.state.field(Wt,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:Oo.of(null)}),!0)};class JE{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const QE=50,XE=1e3,ZE=ft.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(Wt).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(Wt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Wt)==e)return;let r=t.transactions.some(n=>(n.selection||n.docChanged)&&!lf(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(r||i.updates.length+t.transactions.length>QE&&Date.now()-i.time>XE){for(let s of i.context.abortListeners)try{s()}catch(o){br(this.view.state,o)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(i=>i.active.source==n.source))?setTimeout(()=>this.startUpdate(),50):-1,this.composing!=0)for(let n of t.transactions)lf(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Wt);for(let r of e.active)r.state==1&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r)}startQuery(t){let{state:e}=this.view,r=ni(e),n=new iv(e,r,t.explicitPos==r),i=new JE(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Oo.of(null)}),br(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(Zt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Zt);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;if(this.running.splice(n--,1),i.done){let o=new ms(i.active.source,i.active.explicitPos,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:ni(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,r);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(Wt).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new cr(i.active.source,0);for(let a of i.updates)o=o.update(a,r);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:dv.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Wt,!1);if(e&&e.tooltip&&this.view.state.facet(Zt).closeOnBlur){let r=e.open&&ym(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&this.view.dispatch({effects:Oo.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:of.of(!1)}),20),this.composing=0}}}),gv=de.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class _E{constructor(e,r,n,i){this.field=e,this.line=r,this.from=n,this.to=i}}class uf{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return r==null||n==null?null:new uf(this.field,r,n)}}class ff{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],i=[r],s=e.doc.lineAt(r),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(indentUnit);i.push(r+c.length-u),l=c+l.slice(u)}n.push(l),r+=l.length+1}let a=this.fieldPositions.map(l=>new uf(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let r=[],n=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1;for(let u=0;u<r.length;u++)(a!=null?r[u].seq==a:l&&r[u].name==l)&&(c=u);if(c<0){let u=0;for(;u<r.length&&(a==null||r[u].seq!=null&&r[u].seq<a);)u++;r.splice(u,0,{seq:a,name:l}),c=u;for(let h of i)h.field>=c&&h.field++}i.push(new _E(c,n.length,s.index,s.index+l.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of i)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(o)}return new ff(n,i)}}let qE=ke.widget({widget:new class extends ln{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),eT=ke.mark({class:"cm-snippetField"});class vs{constructor(e,r){this.ranges=e,this.active=r,this.deco=ke.set(e.map(n=>(n.from==n.to?qE:eT).range(n.from,n.to)))}map(e){let r=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;r.push(i)}return new vs(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}}const Eo=Ae.define({map(t,e){return t&&t.map(e)}}),tT=Ae.define(),Oi=At.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(Eo))return r.value;if(r.is(tT)&&t)return new vs(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>de.decorations.from(t,e=>e?e.deco:ke.none)});function hf(t,e){return se.create(t.filter(r=>r.field==e).map(r=>se.range(r.from,r.to)))}function rT(t){let e=ff.parse(t);return(r,n,i,s)=>{let{text:o,ranges:a}=e.instantiate(r.state,i),l={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?lv.of(n):void 0};if(a.length&&(l.selection=hf(a,0)),a.length>1){let c=new vs(a,0),u=l.effects=[Eo.of(c)];r.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,aT,lT,gv]))}r.dispatch(r.state.update(l))}}function mv(t){return({state:e,dispatch:r})=>{let n=e.field(Oi,!1);if(!n||t<0&&n.active==0)return!1;let i=n.active+t,s=t>0&&!n.ranges.some(o=>o.field==i+t);return r(e.update({selection:hf(n.ranges,i),effects:Eo.of(s?null:new vs(n.ranges,i)),scrollIntoView:!0})),!0}}const nT=({state:t,dispatch:e})=>t.field(Oi,!1)?(e(t.update({effects:Eo.of(null)})),!0):!1,iT=mv(1),sT=mv(-1);function qD(t){let e=t.field(Oi,!1);return!!(e&&e.ranges.some(r=>r.field==e.active+1))}function e3(t){let e=t.field(Oi,!1);return!!(e&&e.active>0)}const oT=[{key:"Tab",run:iT,shift:sT},{key:"Escape",run:nT}],vv=pe.define({combine(t){return t.length?t[0]:oT}}),aT=xi.highest(ao.compute([vv],t=>t.facet(vv)));function t3(t,e){return Object.assign(Object.assign({},e),{apply:rT(t)})}const lT=de.domEventHandlers({mousedown(t,e){let r=e.state.field(Oi,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=r.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==r.active?!1:(e.dispatch({selection:hf(r.ranges,i.field),effects:Eo.of(r.ranges.some(s=>s.field>i.field)?new vs(r.ranges,i.field):null),scrollIntoView:!0}),!0)}});function cT(t){let e=t.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function yv(t,e){return new RegExp(e(t.source),t.unicode?"u":"")}const bv=null;function uT(t){return bv[t]||(bv[t]=new WeakMap)}function xv(t,e,r,n,i){for(let s=t.iterLines(),o=0;!s.next().done;){let{value:a}=s,l;for(e.lastIndex=0;l=e.exec(a);)if(!n[l[0]]&&o+l.index!=i&&(r.push({type:"text",label:l[0]}),n[l[0]]=!0,r.length>=2e3))return;o+=a.length+1}}function wv(t,e,r,n,i){let s=t.length>=1e3,o=s&&e.get(t);if(o)return o;let a=[],l=Object.create(null);if(t.children){let c=0;for(let u of t.children){if(u.length>=1e3)for(let h of wv(u,e,r,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else xv(u,r,a,l,i-c);c+=u.length+1}}else xv(t,r,a,l,i);return s&&a.length<2e3&&e.set(t,a),a}const r3=t=>{let e=t.state.languageDataAt("wordChars",t.pos).join(""),r=cT(e),n=t.matchBefore(yv(r,o=>o+"$"));if(!n&&!t.explicit)return null;let i=n?n.from:t.pos,s=wv(t.state.doc,uT(e),r,5e4,i);return{from:i,options:s,validFor:yv(r,o=>"^"+o)}},To={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(t,e){let r=e.mapPos(t,-1,ir.TrackAfter);return r??void 0}}),df=new class extends wi{};df.startSide=1,df.endSide=-1;const Sv=At.define({create(){return Qe.empty},update(t,e){if(e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}t=t.map(e.changes);for(let r of e.effects)r.is(Ei)&&(t=t.update({add:[df.range(r.value,r.value+1)]}));return t}});function fT(){return[dT,Sv]}const pf="()[]{}<>";function kv(t){for(let e=0;e<pf.length;e+=2)if(pf.charCodeAt(e)==t)return pf.charAt(e+1);return Ac(t<128?t:t+1)}function Av(t,e){return t.languageDataAt("closeBrackets",e)[0]||To}const hT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),dT=de.inputHandler.of((t,e,r,n)=>{if((hT?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&Lr(Ft(n,0))==1||e!=i.from||r!=i.to)return!1;let s=gT(t.state,n);return s?(t.dispatch(s),!0):!1}),pT=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Av(t,t.selection.main.head).brackets||To.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=mT(t.doc,o.head);for(let l of n)if(l==a&&kl(t.doc,o.head)==kv(Ft(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:se.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function gT(t,e){let r=Av(t,t.selection.main.head),n=r.brackets||To.brackets;for(let i of n){let s=kv(Ft(i,0));if(e==i)return s==i?bT(t,i,n.indexOf(i+i+i)>-1,r):vT(t,i,s,r.before||To.before);if(e==s&&Cv(t,t.selection.main.from))return yT(t,i,s)}return null}function Cv(t,e){let r=!1;return t.field(Sv).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function kl(t,e){let r=t.sliceString(e,e+2);return r.slice(0,Lr(Ft(r,0)))}function mT(t,e){let r=t.sliceString(e-2,e);return Lr(Ft(r,0))==r.length?r:r.slice(1)}function vT(t,e,r,n){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:r,from:o.to}],effects:Ei.of(o.to+e.length),range:se.range(o.anchor+e.length,o.head+e.length)};let a=kl(t.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+r,from:o.head},effects:Ei.of(o.head+e.length),range:se.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function yT(t,e,r){let n=null,i=t.changeByRange(s=>s.empty&&kl(t.doc,s.head)==r?{changes:{from:s.head,to:s.head+r.length,insert:r},range:se.cursor(s.head+r.length)}:n={range:s});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function bT(t,e,r,n){let i=n.stringPrefixes||To.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ei.of(a.to+e.length),range:se.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=kl(t.doc,l),u;if(c==e){if(Ov(t,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(Cv(t,l)){let d=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:se.cursor(l+d.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=Ev(t,l-2*e.length,i))>-1&&Ov(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=at.Word&&Ev(t,l,i)>-1&&!xT(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ov(t,e){let r=Lt(t).resolveInner(e+1);return r.parent&&r.from==e}function xT(t,e,r,n){let i=Lt(t).resolveInner(e,-1),s=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),l=a.indexOf(r);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>r.length+l;){if(t.sliceDoc(u.to-r.length,u.to)==r)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Ev(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=at.Word)return e;for(let i of r){let s=e-i.length;if(t.sliceDoc(s,e)==i&&n(t.sliceDoc(s-1,s))!=at.Word)return s}return-1}function wT(t={}){return[Wt,Zt.of(t),ZE,ST,gv]}const Tv=[{key:"Ctrl-Space",run:KE},{key:"Escape",run:YE},{key:"ArrowDown",run:Sl(!0)},{key:"ArrowUp",run:Sl(!1)},{key:"PageDown",run:Sl(!0,"page")},{key:"PageUp",run:Sl(!1,"page")},{key:"Enter",run:GE}],ST=xi.highest(ao.computeN([Zt],t=>t.facet(Zt).defaultKeymap?[Tv]:[]));function i3(t){let e=t.field(Wt,!1);return e&&e.active.some(r=>r.state==1)?"pending":e&&e.active.some(r=>r.state!=0)?"active":null}const Pv=new WeakMap;function s3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;if(!r||r.disabled)return[];let n=Pv.get(r.options);return n||Pv.set(r.options,n=r.options.map(i=>i.completion)),n}function o3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;return r&&!r.disabled&&r.selected>=0?r.options[r.selected].completion:null}function a3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;return r&&!r.disabled&&r.selected>=0?r.selected:null}function l3(t){return cf.of(t)}class kT{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class Ti{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let i=e,s=n.facet(Pi).markerFilter;s&&(i=s(i));let o=ke.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?ke.widget({widget:new IT(a),diagnostic:a}).range(a.from):ke.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ti(o,r,ys(o))}}function ys(t,e=null,r=0){let n=null;return t.between(r,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new kT(i,s,o.diagnostic),!1}),n}function Mv(t,e){let r=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(n=>n.is(Al))||t.changes.touchesRange(r.from,r.to))}function Iv(t,e){return t.field(_t,!1)?e:e.concat(Ae.appendConfig.of(Hv))}function AT(t,e){return{effects:Iv(t,[Al.of(e)])}}const Al=Ae.define(),gf=Ae.define(),Dv=Ae.define(),_t=At.define({create(){return new Ti(ke.none,null,null)},update(t,e){if(e.docChanged){let r=t.diagnostics.map(e.changes),n=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);n=ys(r,t.selected.diagnostic,i)||ys(r,null,i)}t=new Ti(r,t.panel,n)}for(let r of e.effects)r.is(Al)?t=Ti.init(r.value,t.panel,e.state):r.is(gf)?t=new Ti(t.diagnostics,r.value?Cl.open:null,t.selected):r.is(Dv)&&(t=new Ti(t.diagnostics,t.panel,r.value));return t},provide:t=>[po.from(t,e=>e.panel),de.decorations.from(t,e=>e.diagnostics)]});function c3(t){let e=t.field(_t,!1);return e?e.diagnostics.size:0}const CT=ke.mark({class:"cm-lintRange cm-lintRange-active"});function OT(t,e,r){let{diagnostics:n}=t.state.field(_t),i=[],s=2e8,o=0;n.between(e-(r<0?1:0),e+(r>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||r>0)&&(e<c||r<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=t.state.facet(Pi).tooltipFilter;return a&&(i=a(i)),i.length?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:Nv(t,i)}}}:null}function Nv(t,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(r=>Fv(t,r,!1)))}const ET=t=>{let e=t.state.field(_t,!1);(!e||!e.panel)&&t.dispatch({effects:Iv(t.state,[gf.of(!0)])});let r=ho(t,Cl.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Rv=t=>{let e=t.state.field(_t,!1);return!e||!e.panel?!1:(t.dispatch({effects:gf.of(!1)}),!0)},TT=t=>{let e=t.state.field(_t,!1);if(!e)return!1;let r=t.state.selection.main,n=e.diagnostics.iter(r.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},u3=t=>{let{state:e}=t,r=e.field(_t,!1);if(!r)return!1;let n=e.selection.main,i,s,o,a;return r.diagnostics.between(0,e.doc.length,(l,c)=>{c<n.to&&(i==null||i<l)&&(i=l,s=c),(o==null||l>o)&&(o=l,a=c)}),o==null||i==null&&o==n.from?!1:(t.dispatch({selection:{anchor:i??o,head:s??a},scrollIntoView:!0}),!0)},PT=[{key:"Mod-Shift-m",run:ET,preventDefault:!0},{key:"F8",run:TT}],Lv=ft.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(Pi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:r}=e.facet(Pi);Promise.all(r.map(n=>Promise.resolve(n(this.view)))).then(n=>{let i=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(AT(this.view.state,i))},n=>{br(this.view.state,n)})}}update(t){let e=t.state.facet(Pi);(t.docChanged||e!=t.startState.facet(Pi)||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)}}),Pi=pe.define({combine(t){return Object.assign({sources:t.map(e=>e.source)},Ur(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r}))}});function MT(t,e={}){return[Pi.of({source:t,config:e}),Lv,Hv]}function f3(t){let e=t.plugin(Lv);e&&e.force()}function Bv(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let i=r[n];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Fv(t,e,r){var n;let i=r?Bv(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=ys(t.state.field(_t).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),rt("u",c.slice(u,u+1)),c.slice(u+1)];return rt("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class IT extends ln{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class jv{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Fv(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Cl{constructor(e){this.view=e,this.items=[];let r=i=>{if(i.keyCode==27)Rv(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=Bv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=ys(this.view.state.field(_t).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},n=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Rv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(_t).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(_t),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==l.diagnostic){c=h;break}c<0?(u=new jv(this.view,l.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),i=!0)),r&&u.diagnostic==r.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new jv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(_t),n=ys(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Dv.of(n)})}static open(e){return new Cl(e)}}function Ol(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function El(t){return Ol(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const DT=de.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:El("#d11")},".cm-lintRange-warning":{backgroundImage:El("orange")},".cm-lintRange-info":{backgroundImage:El("#999")},".cm-lintRange-hint":{backgroundImage:El("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Vv(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}class NT extends fn{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((r,n)=>Vv(r)<Vv(n.severity)?n.severity:r,"hint")}toDOM(e){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(Tl).tooltipFilter;return i&&(n=i(n)),n.length&&(r.onmouseover=()=>LT(e,r,n)),r}}function RT(t,e){let r=n=>{let i=e.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),t.state.field($v)&&t.dispatch({effects:mf.of(null)})}};window.addEventListener("mousemove",r)}function LT(t,e,r){function n(){let o=t.elementAtHeight(e.getBoundingClientRect().top+5-t.documentTop);t.coordsAtPos(o.from)&&t.dispatch({effects:mf.of({pos:o.from,above:!1,create(){return{dom:Nv(t,r),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,RT(t,e)}let{hoverTime:i}=t.state.facet(Tl),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function BT(t,e){let r=Object.create(null);for(let i of e){let s=t.lineAt(i.from);(r[s.from]||(r[s.from]=[])).push(i)}let n=[];for(let i in r)n.push(new NT(r[i]).range(+i));return Qe.of(n,!0)}const FT=wm({class:"cm-gutter-lint",markers:t=>t.state.field(Wv)}),Wv=At.define({create(){return Qe.empty},update(t,e){t=t.map(e.changes);let r=e.state.facet(Tl).markerFilter;for(let n of e.effects)if(n.is(Al)){let i=n.value;r&&(i=r(i||[])),t=BT(e.state.doc,i.slice(0))}return t}}),mf=Ae.define(),$v=At.define({create(){return null},update(t,e){return t&&e.docChanged&&(t=Mv(e,t)?null:Object.assign(Object.assign({},t),{pos:e.changes.mapPos(t.pos)})),e.effects.reduce((r,n)=>n.is(mf)?n.value:r,t)},provide:t=>Qa.from(t)}),jT=de.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Ol('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Ol('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Ol('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Hv=[_t,de.decorations.compute([_t],t=>{let{selected:e,panel:r}=t.field(_t);return!e||!r||e.from==e.to?ke.none:ke.set([CT.range(e.from,e.to)])}),RC(OT,{hideOn:Mv}),DT],Tl=pe.define({combine(t){return Ur(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function h3(t={}){return[Tl.of(t),Wv,FT,jT,$v]}function d3(t,e){let r=t.field(_t,!1);if(r&&r.diagnostics.size)for(let n=RangeSet.iter([r.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}var zv=function(e){e===void 0&&(e={});var{crosshairCursor:r=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(pT)),e.defaultKeymap!==!1&&(n=n.concat(tE)),e.searchKeymap!==!1&&(n=n.concat(OE)),e.historyKeymap!==!1&&(n=n.concat(f2)),e.foldKeymap!==!1&&(n=n.concat(vO)),e.completionKeymap!==!1&&(n=n.concat(Tv)),e.lintKeymap!==!1&&(n=n.concat(PT));var i=[];return e.lineNumbers!==!1&&i.push(HC()),e.highlightActiveLineGutter!==!1&&i.push(GC()),e.highlightSpecialChars!==!1&&i.push(uC()),e.history!==!1&&i.push(r2()),e.foldGutter!==!1&&i.push(wO()),e.drawSelection!==!1&&i.push(eC()),e.dropCursor!==!1&&i.push(sC()),e.allowMultipleSelections!==!1&&i.push(Ve.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(oO()),e.syntaxHighlighting!==!1&&i.push(Ru(CO,{fallback:!0})),e.bracketMatching!==!1&&i.push(IO()),e.closeBrackets!==!1&&i.push(fT()),e.autocompletion!==!1&&i.push(wT()),e.rectangularSelection!==!1&&i.push(AC()),r!==!1&&i.push(EC()),e.highlightActiveLine!==!1&&i.push(mC()),e.highlightSelectionMatches!==!1&&i.push(aE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(qa.of(" ".repeat(e.tabSize))),i.concat([ao.of(n.flat())]).filter(Boolean)},p3=function(e){e===void 0&&(e={});var r=[];e.defaultKeymap!==!1&&(r=r.concat(defaultKeymap)),e.historyKeymap!==!1&&(r=r.concat(historyKeymap));var n=[];return e.highlightSpecialChars!==!1&&n.push(highlightSpecialChars()),e.history!==!1&&n.push(history()),e.drawSelection!==!1&&n.push(drawSelection()),e.syntaxHighlighting!==!1&&n.push(syntaxHighlighting(defaultHighlightStyle,{fallback:!0})),n.concat([keymap.of(r.flat())]).filter(Boolean)};const Uv="#e5c07b",vf="#e06c75",Gv="#56b6c2",Kv="#ffffff",Po="#abb2bf",Pl="#7d8799",Yv="#61afef",Jv="#98c379",yf="#d19a66",Qv="#c678dd",Xv="#21252b",bf="#2c313a",xf="#282c34",Ml="#353a42",Zv="#3E4451",wf="#528bff",g3={chalky:Uv,coral:vf,cyan:Gv,invalid:Kv,ivory:Po,stone:Pl,malibu:Yv,sage:Jv,whiskey:yf,violet:Qv,darkBackground:Xv,highlightBackground:bf,background:xf,tooltipBackground:Ml,selection:Zv,cursor:wf},VT=de.theme({"&":{color:Po,backgroundColor:xf},".cm-content":{caretColor:wf},".cm-cursor, .cm-dropCursor":{borderLeftColor:wf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Zv},".cm-panels":{backgroundColor:Xv,color:Po},".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:xf,color:Pl,border:"none"},".cm-activeLineGutter":{backgroundColor:bf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ml},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ml,borderBottomColor:Ml},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:bf,color:Po}}},{dark:!0}),WT=ls.define([{tag:M.keyword,color:Qv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:vf},{tag:[M.function(M.variableName),M.labelName],color:Yv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:yf},{tag:[M.definition(M.name),M.separator],color:Po},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Uv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:Gv},{tag:[M.meta,M.comment],color:Pl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Pl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:vf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:yf},{tag:[M.processingInstruction,M.string,M.inserted],color:Jv},{tag:M.invalid,color:Kv}]),$T=[VT,Ru(WT)];var HT=de.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),zT=function(e){e===void 0&&(e={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(r&&l.unshift(ao.of([rE])),a&&(typeof a=="boolean"?l.unshift(zv()):l.unshift(zv(a))),o&&l.unshift(xC(o)),s){case"light":l.push(HT);break;case"dark":l.push($T);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(de.editable.of(!1)),i&&l.push(Ve.readOnly.of(!0)),[...l]},UT=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)}),_v=an.define(),GT=[];function KT(t){var{value:e,selection:r,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=GT,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:y=null,placeholder:w="",editable:A=!0,readOnly:T=!1,indentWithTab:E=!0,basicSetup:B=!0,root:I,initialState:W}=t,[F,_]=(0,S.useState)(),[j,U]=(0,S.useState)(),[Y,re]=(0,S.useState)(),ce=de.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),he=de.updateListener.of(we=>{if(we.docChanged&&typeof n=="function"&&!we.transactions.some(Ie=>Ie.annotation(_v))){var Ee=we.state.doc,Ue=Ee.toString();n(Ue,we)}i&&i(UT(we))}),xe=zT({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:E,basicSetup:B}),Fe=[he,ce,...xe];return o&&typeof o=="function"&&Fe.push(de.updateListener.of(o)),Fe=Fe.concat(a),(0,S.useEffect)(()=>{if(F&&!Y){var we={doc:e,selection:r,extensions:Fe},Ee=W?Ve.fromJSON(W.json,we,W.fields):Ve.create(we);if(re(Ee),!j){var Ue=new de({state:Ee,parent:F,root:I});U(Ue),s&&s(Ue,Ee)}}return()=>{j&&(re(void 0),U(void 0))}},[F,Y]),(0,S.useEffect)(()=>_(t.container),[t.container]),(0,S.useEffect)(()=>()=>{j&&(j.destroy(),U(void 0))},[j]),(0,S.useEffect)(()=>{l&&j&&j.focus()},[l,j]),(0,S.useEffect)(()=>{j&&j.dispatch({effects:Ae.reconfigure.of(Fe)})},[c,a,u,h,d,p,m,y,w,A,T,E,B,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var we=j?j.state.doc.toString():"";j&&e!==we&&j.dispatch({changes:{from:0,to:we.length,insert:e||""},annotations:[_v.of(!0)]})}},[e,j]),{state:Y,setState:re,view:j,setView:U,container:F,setContainer:_}}var YT=f(61250),JT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],qv=(0,S.forwardRef)((t,e)=>{var{className:r,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:B,editable:I,readOnly:W,root:F,initialState:_}=t,j=GO(t,JT),U=(0,S.useRef)(null),{state:Y,view:re,container:ce}=KT({container:U.current,root:F,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:B,editable:I,readOnly:W,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:_});if((0,S.useImperativeHandle)(e,()=>({editor:U.current,state:Y,view:re}),[U,ce,Y,re]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var he=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,YT.jsx)("div",Wu({ref:U,className:""+he+(r?" "+r:"")},j))});qv.displayName="CodeMirror";const QT=qv,XT=(0,Ye.ZP)(QT)`
|
|
138
|
+
${({inputType:r})=>r==="password"?"padding-right: 40px;":""};
|
|
139
|
+
${({fullWidth:r})=>r?"width: 100%;":""}
|
|
140
|
+
`,Od=1024;let MS=0;class Rr{constructor(e,t){this.from=e,this.to=t}}class Re{constructor(e={}){this.id=MS++,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=nr.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Re.closedBy=new Re({deserialize:r=>r.split(" ")}),Re.openedBy=new Re({deserialize:r=>r.split(" ")}),Re.group=new Re({deserialize:r=>r.split(" ")}),Re.contextHash=new Re({perNode:!0}),Re.lookAhead=new Re({perNode:!0}),Re.mounted=new Re({perNode:!0});class Ws{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Re.mounted.id]}}const IS=Object.create(null);class nr{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):IS,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new nr(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Re.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(Re.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}}nr.none=new nr("",Object.create(null),0,8);class aa{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}t.push(i?new nr(n.name,i,n.id,n.flags):n)}return new aa(t)}}const la=new WeakMap,Ed=new WeakMap;var ot;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(ot||(ot={}));class ut{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Ws.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new ca(this.topNode,e)}cursorAt(e,t=0,n=0){let i=la.get(this)||this.topNode,s=new ca(i);return s.moveTo(e,t),la.set(this,s._tree),s}get topNode(){return new Kt(this,0,0,null)}resolve(e,t=0){let n=$s(la.get(this)||this.topNode,e,t,!1);return la.set(this,n),n}resolveInner(e,t=0){let n=$s(Ed.get(this)||this.topNode,e,t,!0);return Ed.set(this,n),n}resolveStack(e,t=0){return RS(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&ot.IncludeAnonymous)>0;for(let l=this.cursor(o|ot.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Sc(nr.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new ut(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new ut(nr.none,t,n,i)))}static build(e){return LS(e)}}ut.empty=new ut(nr.none,[],[],0);class bc{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new bc(this.buffer,this.index)}}class Hn{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return nr.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(Td(s,i,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-n;let c=s[l++]=i[a++]-n;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Hn(s,o,this.set)}}function Td(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function $s(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof Kt&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:ot.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof Kt&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class Pd{cursor(e=0){return new ca(this,e)}getChild(e,t=null,n=null){let i=Md(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Md(this,e,t,n)}resolve(e,t=0){return $s(this,e,t,!1)}resolveInner(e,t=0){return $s(this,e,t,!0)}matchContext(e){return xc(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}}class Kt extends Pd{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let u=a[e],h=l[e]+o.from;if(Td(i,n,h,h+u.length)){if(u instanceof Hn){if(s&ot.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-h,i);if(d>-1)return new qr(new DS(o,u,e,h),null,d)}else if(s&ot.IncludeAnonymous||!u.type.isAnonymous||wc(u)){let d;if(!(s&ot.IgnoreMounts)&&(d=Ws.get(u))&&!d.overlay)return new Kt(d.tree,h,e,o);let p=new Kt(u,h,e,o);return s&ot.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&ot.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&ot.IgnoreOverlays)&&(i=Ws.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new Kt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Md(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(;!i.type.is(t);)if(!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function xc(r,e,t=e.length-1){for(let n=r.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class DS{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class qr extends Pd{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new qr(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,t,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new qr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new qr(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new qr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),t.push(0)}return new ut(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Id(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof Kt&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new NS(i,t)}class NS{constructor(e,t){this.heads=e,this.node=t}get next(){return Id(this.heads)}}function RS(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof Kt?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,t)),s=o}else{let o=Ws.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Kt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push($s(a,e,t,!1))}}return i?Id(i):n}class ca{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Kt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof Kt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&ot.IncludeAnonymous||a instanceof Hn||!a.type.isAnonymous||wc(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new qr(this.buffer,t,this.stack[i]);return this.bufferNode=new qr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&t&&t(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return xc(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return xc(this.node,e,i);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function wc(r){return r.children.some(e=>e instanceof Hn||!e.type.isAnonymous||wc(e))}function LS(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=Od,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new bc(t,t.length):t,l=n.types,c=0,u=0;function h(I,W,j,Q,B,U){let{id:G,start:re,end:ce,size:he}=a,xe=u;for(;he<0;)if(a.next(),he==-1){let Ie=s[G];j.push(Ie),Q.push(re-I);return}else if(he==-3){c=G;return}else if(he==-4){u=G;return}else throw new RangeError(`Unrecognized record size: ${he}`);let Fe=l[G],we,Ee,Ue=re-I;if(ce-re<=i&&(Ee=w(a.pos-W,B))){let Ie=new Uint16Array(Ee.size-Ee.skip),nt=a.pos-Ee.size,dt=Ie.length;for(;a.pos>nt;)dt=A(Ee.start,Ie,dt);we=new Hn(Ie,ce-Ee.start,n),Ue=Ee.start-I}else{let Ie=a.pos-he;a.next();let nt=[],dt=[],Bt=G>=o?G:-1,er=0,Tr=ce;for(;a.pos>Ie;)Bt>=0&&a.id==Bt&&a.size>=0?(a.end<=Tr-i&&(m(nt,dt,re,er,a.end,Tr,Bt,xe),er=nt.length,Tr=a.end),a.next()):U>2500?d(re,Ie,nt,dt):h(re,Ie,nt,dt,Bt,U+1);if(Bt>=0&&er>0&&er<nt.length&&m(nt,dt,re,er,re,Tr,Bt,xe),nt.reverse(),dt.reverse(),Bt>-1&&er>0){let Ct=p(Fe);we=Sc(Fe,nt,dt,0,nt.length,0,ce-re,Ct,Ct)}else we=y(Fe,nt,dt,ce-re,xe-ce)}j.push(we),Q.push(Ue)}function d(I,W,j,Q){let B=[],U=0,G=-1;for(;a.pos>W;){let{id:re,start:ce,end:he,size:xe}=a;if(xe>4)a.next();else{if(G>-1&&ce<G)break;G<0&&(G=he-i),B.push(re,ce,he),U++,a.next()}}if(U){let re=new Uint16Array(U*4),ce=B[B.length-2];for(let he=B.length-3,xe=0;he>=0;he-=3)re[xe++]=B[he],re[xe++]=B[he+1]-ce,re[xe++]=B[he+2]-ce,re[xe++]=xe;j.push(new Hn(re,B[2]-ce,n)),Q.push(ce-I)}}function p(I){return(W,j,Q)=>{let B=0,U=W.length-1,G,re;if(U>=0&&(G=W[U])instanceof ut){if(!U&&G.type==I&&G.length==Q)return G;(re=G.prop(Re.lookAhead))&&(B=j[U]+G.length+re)}return y(I,W,j,Q,B)}}function m(I,W,j,Q,B,U,G,re){let ce=[],he=[];for(;I.length>Q;)ce.push(I.pop()),he.push(W.pop()+j-B);I.push(y(n.types[G],ce,he,U-B,re-U)),W.push(B-j)}function y(I,W,j,Q,B=0,U){if(c){let G=[Re.contextHash,c];U=U?[G].concat(U):[G]}if(B>25){let G=[Re.lookAhead,B];U=U?[G].concat(U):[G]}return new ut(I,W,j,Q,U)}function w(I,W){let j=a.fork(),Q=0,B=0,U=0,G=j.end-i,re={size:0,start:0,skip:0};e:for(let ce=j.pos-I;j.pos>ce;){let he=j.size;if(j.id==W&&he>=0){re.size=Q,re.start=B,re.skip=U,U+=4,Q+=4,j.next();continue}let xe=j.pos-he;if(he<0||xe<ce||j.start<G)break;let Fe=j.id>=o?4:0,we=j.start;for(j.next();j.pos>xe;){if(j.size<0)if(j.size==-3)Fe+=4;else break e;else j.id>=o&&(Fe+=4);j.next()}B=we,Q+=he,U+=Fe}return(W<0||Q==I)&&(re.size=Q,re.start=B,re.skip=U),re.size>4?re:void 0}function A(I,W,j){let{id:Q,start:B,end:U,size:G}=a;if(a.next(),G>=0&&Q<o){let re=j;if(G>4){let ce=a.pos-(G-4);for(;a.pos>ce;)j=A(I,W,j)}W[--j]=re,W[--j]=U-I,W[--j]=B-I,W[--j]=Q}else G==-3?c=Q:G==-4&&(u=Q);return j}let T=[],E=[];for(;a.pos>0;)h(r.start||0,r.bufferStart||0,T,E,-1,0);let F=(e=r.length)!==null&&e!==void 0?e:T.length?E[0]+T[0].length:0;return new ut(l[r.topID],T.reverse(),E.reverse(),F)}const Dd=new WeakMap;function ua(r,e){if(!r.isAnonymous||e instanceof Hn||e.type!=r)return 1;let t=Dd.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof ut)){t=1;break}t+=ua(r,n)}Dd.set(e,t)}return t}function Sc(r,e,t,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=ua(r,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let E=w;E<A;){let F=E,I=y[E],W=ua(r,m[E]);for(E++;E<A;E++){let j=ua(r,m[E]);if(W+j>=u)break;W+=j}if(E==F+1){if(W>u){let j=m[F];p(j.children,j.positions,0,j.children.length,y[F]+T);continue}h.push(m[F])}else{let j=y[E-1]+m[E-1].length-I;h.push(Sc(r,m,y,F,E,I,j,null,l))}d.push(I+T-s)}}return p(e,t,n,i,0),(a||l)(h,d,o)}class _I{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof qr?this.setBuffer(e.context.buffer,e.index,t):e instanceof Kt&&this.map.set(e.tree,t)}get(e){return e instanceof qr?this.getBuffer(e.context.buffer,e.index):e instanceof Kt?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class An{constructor(e,t,n,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new An(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<t.length?t[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,h)-c;d=p>=m?null:new An(p,m,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class Nd{startParse(e,t,n){return typeof e=="string"&&(e=new BS(e)),n=n?n.length?n.map(i=>new Rr(i.from,i.to)):[new Rr(0,0)]:[new Rr(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}}class BS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function qI(r){return(e,t,n,i)=>new jS(e,r,t,n,i)}class Rd{constructor(e,t,n,i,s){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=s}}function Ld(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class FS{constructor(e,t,n,i,s,o,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const kc=new Re({perNode:!0});class jS{constructor(e,t,n,i,s){this.nest=t,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new ut(n.type,n.children,n.positions,n.length,n.propValues.concat([[kc,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Re.mounted.id]=new Ws(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new $S(this.fragments),t=null,n=null,i=new ca(new Kt(this.baseTree,this.ranges[0].from,0,null),ot.IncludeAnonymous|ot.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(t){let c=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!t.ranges.some(p=>p.from<d&&p.to>h)&&t.ranges.push({from:h,to:d})}}a=!1}else if(n&&(o=VS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||WS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new FS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=jd(this.ranges,s.overlay||(i.from<i.to?[new Rr(i.from,i.to)]:[]));u.length&&Ld(u),(u.length||!s.overlay)&&this.inner.push(new Rd(s.parser,u.length?s.parser.startParse(this.input,Vd(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new Rr(h.from-i.from,h.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else t&&(l=t.predicate(i))&&(l===!0&&(l=new Rr(i.from,i.to)),l.from<l.to&&t.ranges.push(l));if(a&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=jd(this.ranges,t.ranges);c.length&&(Ld(c),this.inner.splice(t.index,0,new Rd(t.parser,t.parser.startParse(this.input,Vd(t.mounts,c),c),t.ranges.map(u=>new Rr(u.from-t.start,u.to-t.start)),t.target,c[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function VS(r,e,t){for(let n of r){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function Bd(r,e,t,n,i,s){if(e<t){let o=r.buffer[e+1];n.push(r.slice(e,t,o)),i.push(o-s)}}function WS(r){let{node:e}=r,t=[];do t.push(r.index),r.parent();while(!r.tree);let n=0,i=r.tree,s=0;for(;s=i.positions[n]+r.from,!(s<=e.from&&s+i.children[n].length>=e.to);n++);let o=i.children[n],a=o.buffer,l=[n];function c(u,h,d,p,m,y){let w=t[y],A=[],T=[];Bd(o,u,w,A,T,p);let E=a[w+1],F=a[w+2];l.push(A.length);let I=y?c(w+4,a[w+3],o.set.types[a[w]],E,F-E,y-1):e.toTree();return A.push(I),T.push(E-p),Bd(o,a[w+3],h,A,T,p),new ut(d,A,T,m)}i.children[n]=c(0,a.length,nr.none,0,o.length,t.length-1);for(let u of l){let h=r.tree.children[u],d=r.tree.positions[u];r.yield(new Kt(h,d+r.from,u,r._tree))}}class Fd{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(ot.IncludeAnonymous|ot.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,ot.IgnoreOverlays|ot.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof ut)t=t.children[0];else break}return!1}}class $S{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(kc))!==null&&t!==void 0?t:n.to,this.inner=new Fd(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(kc))!==null&&e!==void 0?e:t.to,this.inner=new Fd(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Re.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function jd(r,e){let t=null,n=e;for(let i=1,s=0;i<r.length;i++){let o=r[i-1].to,a=r[i].from;for(;s<n.length;s++){let l=n[s];if(l.from>=a)break;l.to<=o||(t||(n=t=e.slice()),l.from<o?(t[s]=new Rr(l.from,o),l.to>a&&t.splice(s+1,0,new Rr(a,l.to))):l.to>a?t[s--]=new Rr(a,l.to):t.splice(s--,1))}}return n}function HS(r,e,t,n){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==r.length?1e9:o?r[i].to:r[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,t),p=Math.min(u,h,n);d<p&&c.push(new Rr(d,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function Vd(r,e){let t=[];for(let{pos:n,mount:i,frag:s}of r){let o=n+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new Rr(d.from+n,d.to+n)),h=HS(e,u,l,c);for(let d=0,p=l;;d++){let m=d==h.length,y=m?c:h[d].from;if(y>p&&t.push(new An(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),m)break;p=h[d].to}}else t.push(new An(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return t}class fa{constructor(e,t,n,i,s,o,a,l,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new fa(e,[],t,n,n,0,[],0,i?new Wd(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,d,h+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==n)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new fa(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new zS(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<4<<1&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let n=[];for(let i=0;i<t.length&&n.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=n(o,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Wd(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Wd{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class zS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class ha{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ha(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ha(this.stack,this.pos,this.index)}}function Hs(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n<r.length;){let s=0;for(;;){let o=r.charCodeAt(n++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class da{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $d=new da;class US{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$d,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;t<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,i;if(t>=0&&t<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=$d,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Yi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Hd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class GS{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Hs(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Hd(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}GS.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class eD{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Hd(r,e,t,n,i,s){let o=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;a&r[o];){let c=r[o+1];for(let p=o+3;p<c;p+=2)if((r[p+1]&a)>0){let m=r[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||KS(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,h=0,d=r[o+2];if(e.next<0&&d>h&&r[c+d*3-3]==65535){o=r[c+d*3-1];continue e}for(;h<d;){let p=h+d>>1,m=c+p+(p<<1),y=r[m],w=r[m+1]||65536;if(u<y)d=p;else if(u>=w)h=p+1;else{o=r[m+2],e.advance();continue e}}break}}function zd(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function KS(r,e,t,n){let i=zd(t,n,e);return i<0||zd(t,n,r)<i}const vr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let Ac=null;function Ud(r,e,t){let n=r.cursor(ot.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}class YS{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ud(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ud(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[t]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ut){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Re.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class JS{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new da)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let d=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new da,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new da,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Cn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Cn(a,c+2),t,n,i));break}a[c]==t&&(i=this.putAction(Cn(a,c+1),t,n,i))}return i}}class XS{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new US(t,i),this.tokens=new JS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[fa.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new YS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let o=i&&ZS(i);if(o)return vr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw vr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(o)return vr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:s}=this,o=vr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!c||(h.prop(Re.contextHash)||0)==u))return e.useNode(h,d),vr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ut)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ut&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),vr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],d=l[c++],p=c==l.length||!n,m=p?e:e.split(),y=this.tokens.mainToken;if(m.apply(u,h,y?y.start:m.pos,d),vr&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Gd(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],u=vr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),vr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),d=u;for(let p=0;h.forceReduce()&&p<10&&(vr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)vr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))vr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),vr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Gd(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ut.build({buffer:ha.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Ac||(Ac=new WeakMap)).get(e);return t||Ac.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Gd(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class QS{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const Cc=r=>r;class tD{constructor(e){this.start=e.start,this.shift=e.shift||Cc,this.reduce=e.reduce||Cc,this.reuse=e.reuse||Cc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class pa extends Nd{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Re[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let h=a[c+-u];for(let d=-u;d>0;d--)s(a[c++],l,h);c++}}}this.nodeSet=new aa(t.map((a,l)=>nr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Od;let o=Hs(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Kd),this.states=Hs(e.states,Uint32Array),this.data=Hs(e.stateData),this.goto=Hs(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Yi(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new XS(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&n)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=Cn(n,s+2)];else{if(n[s+1]==2)return Cn(n,s+2);break}if(o==t||o==0)return Cn(n,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):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=Cn(this.data,s+2);else break;i=t(Cn(this.data,s+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Cn(this.data,n+2);else break;if(!(this.data[n+2]&1)){let i=this.data[n+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(pa.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Kd(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!n[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new QS(e,n,i)}static deserialize(e){return new pa(e)}}function Cn(r,e){return r[e]|r[e+1]<<16}function ZS(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Kd(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}let _S=0;class en{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=_S++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new en([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new ga;return t=>t.modified.indexOf(e)>-1?t:ga.get(t.base||t,t.modified.concat(e).sort((n,i)=>n.id-i.id))}}let qS=0;class ga{constructor(){this.instances=[],this.id=qS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&ek(t,a.modified));if(n)return n;let i=[],s=new en(i,e,t);for(let a of t)a.instances.push(s);let o=tk(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(ga.get(a,l));return s}}function ek(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function tk(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function Yd(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new ma(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Jd.add(e)}const Jd=new Re;class ma{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ma.empty=new ma([],2,null);function Xd(r,e){let t=Object.create(null);for(let s of r)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:n,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function rk(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function Qd(r,e,t,n=0,i=r.length){let s=new nk(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}function rD(r,e,t,n,i,s=0,o=r.length){let a=s;function l(c,u){if(!(c<=a)){for(let h=r.slice(a,c),d=0;;){let p=h.indexOf(`
|
|
141
|
+
`,d),m=p<0?h.length:p;if(m>d&&n(h.slice(d,m),u),p<0)break;i(),d=p+1}a=c}}Qd(e,t,(c,u,h)=>{l(c,""),l(u,h)},s,o),l(o,"")}class nk{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,s){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=ik(e)||ma.empty,h=rk(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Re.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),y=e.firstChild();for(let w=0,A=a;;w++){let T=w<d.overlay.length?d.overlay[w]:null,E=T?T.from+a:l,F=Math.max(t,A),I=Math.min(n,E);if(F<I&&y)for(;e.from<I&&(this.highlightRange(e,F,I,i,s),this.startSpan(Math.min(I,e.to),c),!(e.to>=E||!e.nextSibling())););if(!T||E>n)break;A=T.to+a,A>t&&(this.highlightRange(p.cursor(),Math.max(t,T.from+a),Math.min(n,A),"",m),this.startSpan(Math.min(n,A),c))}y&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function ik(r){let e=r.type.prop(Jd);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const fe=en.define,va=fe(),zn=fe(),Zd=fe(zn),_d=fe(zn),Un=fe(),ya=fe(Un),Oc=fe(Un),tn=fe(),vi=fe(tn),rn=fe(),nn=fe(),Ec=fe(),zs=fe(Ec),ba=fe(),M={comment:va,lineComment:fe(va),blockComment:fe(va),docComment:fe(va),name:zn,variableName:fe(zn),typeName:Zd,tagName:fe(Zd),propertyName:_d,attributeName:fe(_d),className:fe(zn),labelName:fe(zn),namespace:fe(zn),macroName:fe(zn),literal:Un,string:ya,docString:fe(ya),character:fe(ya),attributeValue:fe(ya),number:Oc,integer:fe(Oc),float:fe(Oc),bool:fe(Un),regexp:fe(Un),escape:fe(Un),color:fe(Un),url:fe(Un),keyword:rn,self:fe(rn),null:fe(rn),atom:fe(rn),unit:fe(rn),modifier:fe(rn),operatorKeyword:fe(rn),controlKeyword:fe(rn),definitionKeyword:fe(rn),moduleKeyword:fe(rn),operator:nn,derefOperator:fe(nn),arithmeticOperator:fe(nn),logicOperator:fe(nn),bitwiseOperator:fe(nn),compareOperator:fe(nn),updateOperator:fe(nn),definitionOperator:fe(nn),typeOperator:fe(nn),controlOperator:fe(nn),punctuation:Ec,separator:fe(Ec),bracket:zs,angleBracket:fe(zs),squareBracket:fe(zs),paren:fe(zs),brace:fe(zs),content:tn,heading:vi,heading1:fe(vi),heading2:fe(vi),heading3:fe(vi),heading4:fe(vi),heading5:fe(vi),heading6:fe(vi),contentSeparator:fe(tn),list:fe(tn),quote:fe(tn),emphasis:fe(tn),strong:fe(tn),link:fe(tn),monospace:fe(tn),strikethrough:fe(tn),inserted:fe(),deleted:fe(),changed:fe(),invalid:fe(),meta:ba,documentMeta:fe(ba),annotation:fe(ba),processingInstruction:fe(ba),definition:en.defineModifier(),constant:en.defineModifier(),function:en.defineModifier(),standard:en.defineModifier(),local:en.defineModifier(),special:en.defineModifier()},nD=Xd([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]),sk=Yd({String:M.string,Number:M.number,"True False":M.bool,PropertyName:M.propertyName,Null:M.null,",":M.separator,"[ ]":M.squareBracket,"{ }":M.brace}),ok=pa.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:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[sk],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 Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ji(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),sn.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ji(this,e,t);let n=[];return this.decompose(e,t,n,0),sn.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Us(this),s=new Us(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}iter(e=1){return new Us(this,e)}iterRange(e,t=this.length){return new ep(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new tp(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new yt(e):sn.from(yt.split(e,[]))}}class yt extends Je{constructor(e,t=ak(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?n:a)>=e)return new lk(i,a,n,o);i=a+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new yt(qd(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),a=xa(s.text,o.text.slice(),0,s.length);if(a.length<=32)n.push(new yt(a,o.length+s.length));else{let l=a.length>>1;n.push(new yt(a.slice(0,l)),new yt(a.slice(l)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof yt))return super.replace(e,t,n);[e,t]=Ji(this,e,t);let i=xa(this.text,xa(n.text,qd(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new yt(i,s):sn.from(yt.split(i,[]),s)}sliceString(e,t=this.length,n=`
|
|
142
|
+
`){[e,t]=Ji(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=n),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let s of e)n.push(s),i+=s.length+1,n.length==32&&(t.push(new yt(n,i)),n=[],i=-1);return i>-1&&t.push(new yt(n,i)),t}}class sn extends Je{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=n+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,n,i);i=a+1,n=l+1}}decompose(e,t,n,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=l+1}}replace(e,t,n){if([e,t]=Ji(this,e,t),n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>5-1&&l.lines>c>>5+1){let u=this.children.slice();return u[i]=l,new sn(u,this.length-(t-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
143
|
+
`){[e,t]=Ji(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=n),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,n)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof sn))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let p of e)n+=p.lines;if(n<32){let p=[];for(let m of e)m.flatten(p);return new yt(p,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function h(p){let m;if(p.lines>s&&p instanceof sn)for(let y of p.children)h(y);else p.lines>o&&(l>o||!l)?(d(),a.push(p)):p instanceof yt&&l&&(m=u[u.length-1])instanceof yt&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new yt(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&d(),l+=p.lines,c+=p.length+1,u.push(p))}function d(){l!=0&&(a.push(u.length==1?u[0]:sn.from(u,c)),c=-1,l=u.length=0)}for(let p of e)h(p);return d(),a.length==1?a[0]:new sn(a,t)}}Je.empty=new yt([""],0);function ak(r){let e=-1;for(let t of r)e+=t.length+1;return e}function xa(r,e,t=0,n=1e9){for(let i=0,s=0,o=!0;s<r.length&&i<=n;s++){let a=r[s],l=i+a.length;l>=t&&(l>n&&(a=a.slice(0,n-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function qd(r,e,t){return xa(r,[""],e,t)}class Us{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof yt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],o=s>>1,a=i instanceof yt?i.text.length:i.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
144
|
+
`,this;e--}else if(i instanceof yt){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof yt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class ep{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Us(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class tp{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this.iter()},Us.prototype[Symbol.iterator]=ep.prototype[Symbol.iterator]=tp.prototype[Symbol.iterator]=function(){return this});class lk{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Ji(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}let Xi="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(r=>r?parseInt(r,36):1);for(let r=1;r<Xi.length;r++)Xi[r]+=Xi[r-1];function ck(r){for(let e=1;e<Xi.length;e+=2)if(Xi[e]>r)return Xi[e-1]<=r;return!1}function rp(r){return r>=127462&&r<=127487}const np=8205;function Ft(r,e,t=!0,n=!0){return(t?ip:uk)(r,e,n)}function ip(r,e,t){if(e==r.length)return e;e&&sp(r.charCodeAt(e))&&op(r.charCodeAt(e-1))&&e--;let n=jt(r,e);for(e+=Lr(n);e<r.length;){let i=jt(r,e);if(n==np||i==np||t&&ck(i))e+=Lr(i),n=i;else if(rp(i)){let s=0,o=e-2;for(;o>=0&&rp(jt(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function uk(r,e,t){for(;e>0;){let n=ip(r,e-2,t);if(n<e)return n;e--}return 0}function sp(r){return r>=56320&&r<57344}function op(r){return r>=55296&&r<56320}function jt(r,e){let t=r.charCodeAt(e);if(!op(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return sp(n)?(t-55296<<10)+(n-56320)+65536:t}function Tc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Lr(r){return r<65536?1:2}const Pc=/\r\n?|\n/;var ir=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(ir||(ir={}));class on{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,t=!1){Mc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new on(e)}composeDesc(e){return this.empty?e:e.empty?this:ap(this,e)}mapDesc(e,t=!1){return e.empty?this:Ic(this,e,t)}mapPos(e,t=-1,n=ir.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=ir.Simple&&c>=e&&(n==ir.TrackDel&&i<e&&c>e||n==ir.TrackBefore&&i<e||n==ir.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new on(e)}static create(e){return new on(e)}}class Pt extends on{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Mc(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Ic(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Je.empty);n.push(o?e.slice(s,s+o):Je.empty)}s+=o}return new Pt(t,n)}compose(e){return this.empty?e:e.empty?this:ap(this,e,!0)}map(e,t=!1){return e.empty?this:Ic(this,e,t,!0)}iterChanges(e,t=!1){Mc(this,e,t)}get desc(){return on.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new Gs(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);Yt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Yt(t,u,h),h>0&&Gn(n,t,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Yt(t,u,-1),Yt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Pt(t,n),filtered:on.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<t&&Yt(i,t-o,-1);let h=new Pt(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Pt){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:p}=u;if(h>d||h<0||d>t)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${t})`);let m=p?typeof p=="string"?Je.of(p.split(n||Pc)):p:Je.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Yt(i,h-o,-1),Yt(i,d-h,y),Gn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Pt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length<i;)n.push(Je.empty);n[i]=Je.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new Pt(t,n)}static createSet(e,t){return new Pt(e,t)}}function Yt(r,e,t,n=!1){if(e==0&&t<=0)return;let i=r.length-2;i>=0&&t<=0&&t==r[i+1]?r[i]+=e:e==0&&r[i]==0?r[i+1]+=t:n?(r[i]+=e,r[i+1]+=t):r.push(e,t)}function Gn(r,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<n;)r.push(Je.empty);r.push(t)}}function Mc(r,e,t){let n=r.inserted;for(let i=0,s=0,o=0;o<r.sections.length;){let a=r.sections[o++],l=r.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Je.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)a=r.sections[o++],l=r.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function Ic(r,e,t,n=!1){let i=[],s=n?[]:null,o=new Gs(r),a=new Gs(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Yt(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(Yt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Yt(i,0,o.ins),s&&Gn(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Yt(i,c,l<o.i?o.ins:0),s&&l<o.i&&Gn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Pt.createSet(i,s):on.create(i);throw new Error("Mismatched change set lengths")}}function ap(r,e,t=!1){let n=[],i=t?[]:null,s=new Gs(r),o=new Gs(e);for(let a=!1;;){if(s.done&&o.done)return i?Pt.createSet(n,i):on.create(n);if(s.ins==0)Yt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Yt(n,0,o.ins,a),i&&Gn(i,n,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Yt(n,l,u,a),i&&u&&Gn(i,n,o.text)}else o.ins==-1?(Yt(n,s.off?0:s.len,l,a),i&&Gn(i,n,s.textBit(l))):(Yt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&Gn(i,n,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),s.forward2(l),o.forward(l)}}}}class Gs{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Je.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Je.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yi{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new yi(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return se.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return se.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}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 se.range(e.anchor,e.head)}static create(e,t,n){return new yi(e,t,n)}}class se{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:se.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new se([this.main],0)}addRange(e,t=!0){return se.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,se.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new se(e.ranges.map(t=>yi.fromJSON(t)),e.main)}static single(e,t=e){return new se([se.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return se.normalized(e.slice(),t);n=s.to}return new se(e,t)}static cursor(e,t=0,n,i){return yi.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,t,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?yi.create(t,e,48|s):yi.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?se.range(l,a):se.range(a,l))}}return new se(e,t)}}function lp(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Dc=0;class pe{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Dc++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new pe(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Nc),!!e.static,e.enables)}of(e){return new wa([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new wa(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new wa(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Nc(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class wa{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Dc++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((t=e[h.id])!==null&&t!==void 0?t:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Rc(h,u)){let p=n(h);if(a?!cp(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,m=d.config.address[s];if(m!=null){let y=Aa(d,m);if(this.dependencies.every(w=>w instanceof pe?d.facet(w)===h.facet(w):w instanceof At?d.field(w,!1)==h.field(w,!1):!0)||(a?cp(p=n(h),y,i):i(p=n(h),y)))return h.values[o]=y,0}else p=n(h);return h.values[o]=p,1}}}}function cp(r,e,t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function Rc(r,e){let t=!1;for(let n of e)Ys(r,n)&1&&(t=!0);return t}function fk(r,e,t){let n=t.map(l=>r[l.id]),i=t.map(l=>l.type),s=n.filter(l=>!(l&1)),o=r[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=Aa(l,n[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Ys(l,c);return l.values[o]=a(l),1},update(l,c){if(!Rc(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Rc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Nc(t,h))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const up=pe.define({static:!0});class At{constructor(e,t,n,i,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new At(Dc++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(up).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,i)=>{let s=n.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,i)=>i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}init(e){return[this,up.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Ks(r){return e=>new fp(e,r)}const xi={highest:Ks(bi.highest),high:Ks(bi.high),default:Ks(bi.default),low:Ks(bi.low),lowest:Ks(bi.lowest)};class fp{constructor(e,t){this.inner=e,this.prec=t}}class Sa{of(e){return new Lc(this,e)}reconfigure(e){return Sa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Lc{constructor(e,t){this.compartment=e,this.inner=t}}class ka{constructor(e,t,n,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],s=Object.create(null),o=new Map;for(let d of hk(e,t,o))d instanceof At?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],m=p[0].facet,y=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[m.id]=l.length<<1|1,Nc(y,p))l.push(n.facet(m));else{let w=m.combine(p.map(A=>A.value));l.push(n&&m.compare(w,n.facet(m))?n.facet(m):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(A=>w.dynamicSlot(A)));a[m.id]=c.length<<1,c.push(w=>fk(w,m,p))}}let h=c.map(d=>d(a));return new ka(e,o,h,a,l,s)}}function hk(r,e,t){let n=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof Lc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Lc){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof fp)s(o.inner,o.prec);else if(o instanceof At)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof wa)n[a].push(o),o.facet.extensions&&s(o.facet.extensions,bi.default);else{let c=o.extension;if(!c)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(c,a)}}return s(r,bi.default),n.reduce((o,a)=>o.concat(a))}function Ys(r,e){if(e&1)return 2;let t=e>>1,n=r.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[t]=4;let i=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|i}function Aa(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const hp=pe.define(),Bc=pe.define({combine:r=>r.some(e=>e),static:!0}),dp=pe.define({combine:r=>r.length?r[0]:void 0,static:!0}),pp=pe.define(),gp=pe.define(),mp=pe.define(),vp=pe.define({combine:r=>r.length?r[0]:!1});class an{constructor(e,t){this.type=e,this.value=t}static define(){return new dk}}class dk{of(e){return new an(this,e)}}class pk{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ae(this.type,t)}is(e){return this.type==e}static define(e={}){return new pk(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(t);s&&n.push(s)}return n}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Mt{constructor(e,t,n,i,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&lp(n,t.newLength),s.some(a=>a.type==Mt.time)||(this.annotations=s.concat(Mt.time.of(Date.now())))}static create(e,t,n,i,s,o){return new Mt(e,t,n,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Mt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Mt.time=an.define(),Mt.userEvent=an.define(),Mt.addToHistory=an.define(),Mt.remote=an.define();function gk(r,e){let t=[];for(let n=0,i=0;;){let s,o;if(n<r.length&&(i==e.length||e[i]>=r[n]))s=r[n++],o=r[n++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function yp(r,e,t){var n;let i,s,o;return t?(i=e.changes,s=Pt.empty(e.changes.length),o=r.changes.compose(e.changes)):(i=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(n=r.selection)===null||n===void 0?void 0:n.map(i),effects:Ae.mapEffects(r.effects,i).concat(Ae.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Fc(r,e,t){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Mt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Pt?e.changes:Pt.of(e.changes||[],t,r.facet(dp)),selection:n&&(n instanceof se?n:se.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function bp(r,e,t){let n=Fc(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;n=yp(n,Fc(r,e[s],o?n.changes.newLength:r.doc.length),o)}let i=Mt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return vk(t?mk(i):i)}function mk(r){let e=r.startState,t=!0;for(let i of e.facet(pp)){let s=i(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:gk(t,s))}if(t!==!0){let i,s;if(t===!1)s=r.changes.invertedDesc,i=Pt.empty(e.doc.length);else{let o=r.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=Mt.create(e,i,r.selection&&r.selection.map(s),Ae.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let n=e.facet(gp);for(let i=n.length-1;i>=0;i--){let s=n[i](r);s instanceof Mt?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mt?r=s[0]:r=bp(e,Qi(s),!1)}return r}function vk(r){let e=r.startState,t=e.facet(mp),n=r;for(let i=t.length-1;i>=0;i--){let s=t[i](r);s&&Object.keys(s).length&&(n=yp(n,Fc(e,s,r.changes.newLength),!0))}return n==r?r:Mt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const yk=[];function Qi(r){return r==null?yk:Array.isArray(r)?r:[r]}var at=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(at||(at={}));const bk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let jc;try{jc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function xk(r){if(jc)return jc.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||bk.test(t)))return!0}return!1}function wk(r){return e=>{if(!/\S/.test(e))return at.Space;if(xk(e))return at.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return at.Word;return at.Other}}class Ve{constructor(e,t,n,i,s,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Ys(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Ys(this,n),Aa(this,n)}update(...e){return bp(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let a of e.effects)a.is(Sa.reconfigure)?(t&&(i=new Map,t.compartments.forEach((l,c)=>i.set(c,l)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(Ae.reconfigure)?(t=null,n=a.value):a.is(Ae.appendConfig)&&(t=null,n=Qi(n).concat(a.value));let s;t?s=e.startState.values.slice():(t=ka.resolve(n,i,this),s=new Ve(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Bc)?e.newSelection:e.newSelection.asSingle();new Ve(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:se.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],o=Qi(n.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=Ae.mapEffects(o,u).concat(Ae.mapEffects(Qi(l.effects),h))}return{changes:i,selection:se.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Pt?e:Pt.of(e,this.doc.length,this.facet(Ve.lineSeparator))}toText(e){return Je.of(e.split(this.facet(Ve.lineSeparator)||Pc))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ys(this,t),Aa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof At&&this.config.address[i.id]!=null&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Ve.create({doc:e.doc,selection:se.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=ka.resolve(e.extensions||[],new Map),n=e.doc instanceof Je?e.doc:Je.of((e.doc||"").split(t.staticFacet(Ve.lineSeparator)||Pc)),i=e.selection?e.selection instanceof se?e.selection:se.single(e.selection.anchor,e.selection.head):se.single(0);return lp(i,n.length),t.staticFacet(Bc)||(i=i.asSingle()),new Ve(t,n,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ve.tabSize)}get lineBreak(){return this.facet(Ve.lineSeparator)||`
|
|
145
|
+
`}get readOnly(){return this.facet(vp)}phrase(e,...t){for(let n of this.facet(Ve.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(hp))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return wk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Ft(t,o,!1);if(s(t.slice(l,o))!=at.Word)break;o=l}for(;a<i;){let l=Ft(t,a);if(s(t.slice(a,l))!=at.Word)break;a=l}return o==a?null:se.range(o+n,a+n)}}Ve.allowMultipleSelections=Bc,Ve.tabSize=pe.define({combine:r=>r.length?r[0]:4}),Ve.lineSeparator=dp,Ve.readOnly=vp,Ve.phrases=pe.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}}),Ve.languageData=hp,Ve.changeFilter=pp,Ve.transactionFilter=gp,Ve.transactionExtender=mp,Sa.reconfigure=Ae.define();function Ur(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class wi{eq(e){return this==e}range(e,t=e){return Js.create(e,t,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=ir.TrackDel;class Js{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Js(e,t,n)}}function Vc(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Wc{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,d,p;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(d=p=m,c.startSide!=c.endSide&&(p=t.mapPos(u,c.endSide),p<d)))continue}else if(d=t.mapPos(u,c.startSide),p=t.mapPos(h,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),n.push(c),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Wc(i,s,n,a):null,pos:o}}}class Xe{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Xe(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Vc)),this.isEmpty)return t.length?Xe.of(t):this;let a=new wp(this,null,-1).goto(0),l=0,c=[],u=new Kn;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Js.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Xe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new Xe(n,t,s||Xe.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Xs.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Xs.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=xp(o,a,n),c=new Qs(o,l,s),u=new Qs(a,l,s);n.iterGaps((h,d,p)=>Sp(c,h,u,d,p,i)),n.empty&&n.length==0&&Sp(c,0,u,0,0,i)}static eq(e,t,n=0,i){i==null&&(i=1e9-1);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=xp(s,o),l=new Qs(s,a,0).goto(n),c=new Qs(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Hc(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,n,i,s=-1){let o=new Qs(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:Math.min(u.length,l);i.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new Kn;for(let i of e instanceof Js?[e]:t?Sk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Xe.empty=new Xe([],[],null,-1);function Sk(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Vc(e,n)>0)return r.slice().sort(Vc);e=n}return r}Xe.empty.nextLayer=Xe.empty;class Kn{finishChunk(e){this.chunks.push(new Wc(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Kn)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Xe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Xe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function xp(r,e,t){let n=new Map;for(let s of r)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=n.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class wp{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Xs{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new wp(o,t,n,s));return i.length==1?i[0]:new Xs(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)$c(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)$c(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),$c(this.heap,0)}}}function $c(r,e){for(let t=r[e];;){let n=(e<<1)+1;if(n>=r.length)break;let i=r[n];if(n+1<r.length&&i.compare(r[n+1])>=0&&(i=r[n+1],n++),t.compare(i)<0)break;r[n]=t,r[e]=i,e=n}}class Qs{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Xs.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Ca(this.active,e),Ca(this.activeTo,e),Ca(this.activeRank,e),this.minActive=kp(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&this.activeRank[t]<=s;)t++;Oa(this.active,t,n),Oa(this.activeTo,t,i),Oa(this.activeRank,t,s),e&&Oa(e,t,this.cursor.from),this.minActive=kp(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=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),n&&Ca(n,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(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Sp(r,e,t,n,i,s){r.goto(e),t.goto(n);let o=n+i,a=n,l=n-e;for(;;){let c=r.to+l-t.to||r.endSide-t.endSide,u=c<0?r.to+l:t.to,h=Math.min(u,o);if(r.point||t.point?r.point&&t.point&&(r.point==t.point||r.point.eq(t.point))&&Hc(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(a,h,r.point,t.point):h>a&&!Hc(r.active,t.active)&&s.compareRange(a,h,r.active,t.active),u>o)break;a=u,c<=0&&r.next(),c>=0&&t.next()}}function Hc(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t]&&!r[t].eq(e[t]))return!1;return!0}function Ca(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function Oa(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function kp(r,e){let t=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||r[i].endSide-r[t].endSide)<0&&(t=i,n=e[i]);return t}function Zi(r,e,t=r.length){let n=0;for(let i=0;i<t;)r.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Ft(r,i));return n}function zc(r,e,t,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==r.length)break;s+=r.charCodeAt(i)==9?t-s%t:1,i=Ft(r,i)}return n===!0?-1:r.length}const Uc="\u037C",Ap=typeof Symbol>"u"?"__"+Uc:Symbol.for(Uc),Gc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Cp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yn{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,u,d)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
146
|
+
`)}static newName(){let e=Cp[Ap]||1;return Cp[Ap]=e+1,Uc+e.toString(36)}static mount(e,t,n){let i=e[Gc],s=n&&n.nonce;i?s&&i.setNonce(s):i=new kk(e,s),i.mount(Array.isArray(t)?t:[t])}}let Op=new Map;class kk{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Op.get(n);if(s)return e.adoptedStyleSheets=[s.sheet,...e.adoptedStyleSheets],e[Gc]=s;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],Op.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[Gc]=this}mount(e){let t=this.sheet,n=0,i=0;for(let s=0;s<e.length;s++){let o=e[s],a=this.modules.indexOf(o);if(a<i&&a>-1&&(this.modules.splice(a,1),i--,a=-1),a==-1){if(this.modules.splice(i++,0,o),t)for(let l=0;l<o.rules.length;l++)t.insertRule(o.rules[l],n++)}else{for(;i<a;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!t){let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
|
|
147
|
+
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Jn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Zs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ak=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ck=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vt=0;Vt<10;Vt++)Jn[48+Vt]=Jn[96+Vt]=String(Vt);for(var Vt=1;Vt<=24;Vt++)Jn[Vt+111]="F"+Vt;for(var Vt=65;Vt<=90;Vt++)Jn[Vt]=String.fromCharCode(Vt+32),Zs[Vt]=String.fromCharCode(Vt);for(var Kc in Jn)Zs.hasOwnProperty(Kc)||(Zs[Kc]=Jn[Kc]);function Ok(r){var e=Ak&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||Ck&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Zs:Jn)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ea(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function Yc(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function Ek(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ta(r,e){if(!e.anchorNode)return!1;try{return Yc(r,e.anchorNode)}catch{return!1}}function _i(r){return r.nodeType==3?Si(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Pa(r,e,t,n){return t?Ep(r,e,t,n,-1)||Ep(r,e,t,n,1):!1}function _s(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function Ep(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:On(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=_s(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;e=i<0?On(r):0}else return!1}}function On(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ma(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function Tk(r){return{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Pk(r,e,t,n,i,s,o,a){let l=r.ownerDocument,c=l.defaultView||window;for(let u=r,h=!1;u&&!h;)if(u.nodeType==1){let d,p=u==l.body,m=1,y=1;if(p)d=Tk(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();m=T.width/u.offsetWidth,y=T.height/u.offsetHeight,d={left:T.left,right:T.left+u.clientWidth*m,top:T.top,bottom:T.top+u.clientHeight*y}}let w=0,A=0;if(i=="nearest")e.top<d.top?(A=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+A&&(A=e.bottom-d.bottom+A+o)):e.bottom>d.bottom&&(A=e.bottom-d.bottom+o,t<0&&e.top-A<d.top&&(A=-(d.top+A-e.top+o)));else{let T=e.bottom-e.top,E=d.bottom-d.top;A=(i=="center"&&T<=E?e.top+T/2-E/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-E+o)-d.top}if(n=="nearest"?e.left<d.left?(w=-(d.left-e.left+s),t>0&&e.right>d.right+w&&(w=e.right-d.right+w+s)):e.right>d.right&&(w=e.right-d.right+s,t<0&&e.left<d.left+w&&(w=-(d.left+w-e.left+s))):w=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,w||A)if(p)c.scrollBy(w,A);else{let T=0,E=0;if(A){let F=u.scrollTop;u.scrollTop+=A/y,E=(u.scrollTop-F)*y}if(w){let F=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-F)*m}e={left:e.left-T,top:e.top-E,right:e.right-T,bottom:e.bottom-E},T&&Math.abs(T-w)<1&&(n="nearest"),E&&Math.abs(E-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Mk(r){let e=r.ownerDocument;for(let t=r.parentNode;t&&t!=e.body;)if(t.nodeType==1){if(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class Ik{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?On(t):0),n,Math.min(e.focusOffset,n?On(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let qi=null;function Tp(r){if(r.setActive)return r.setActive();if(qi)return r.focus(qi);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(qi==null?{get preventScroll(){return qi={preventScroll:!0},!0}}:void 0),!qi){qi=!1;for(let t=0;t<e.length;){let n=e[t++],i=e[t++],s=e[t++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let Pp;function Si(r,e,t=e){let n=Pp||(Pp=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function es(r,e,t){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0},i=new KeyboardEvent("keydown",n);i.synthetic=!0,r.dispatchEvent(i);let s=new KeyboardEvent("keyup",n);return s.synthetic=!0,r.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function Dk(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Mp(r){for(;r.attributes.length;)r.removeAttributeNode(r.attributes[0])}function Nk(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,On(t));;)if(n){if(t.nodeType!=1)return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=On(t))}else{if(t==r)return!0;n=_s(t),t=t.parentNode}}function Ip(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}class Jt{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Jt(e.parentNode,_s(e),t)}static after(e,t){return new Jt(e.parentNode,_s(e)+1,t)}}const Jc=[];class it{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 t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:n.firstChild)){let a=it.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=i?i.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&s!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=Dp(s);else n.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:n.firstChild,s&&t&&t.node==n&&(t.written=!0);s;)s=Dp(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=On(e)==0?0:t==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?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!it.get(n);)n=n.nextSibling;if(!n)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<this.children.length;l++){let h=this.children[l],d=c+h.length;if(c<e&&d>t)return h.domBoundsAround(e,t,c);if(d>=e&&i==-1&&(i=l,s=c),c>t&&h.dom.parentNode==this.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?n+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.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 t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=Jc){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&n.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...n);for(let i=0;i<n.length;i++)n[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Np(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.destroy();this.parent=null}}it.prototype.breakAfter=0;function Dp(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Np{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Rp(r,e,t,n,i,s,o,a,l){let{children:c}=r,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(t,i,s.length?h:null,t==0,a,l))){if(n<c.length){let p=c[n];p&&(i<p.length||p.breakAfter&&h?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,l)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,l),s.push(p))):p?.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,a,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,a,l)&&e--,(e<n||s.length)&&r.replaceChildren(e,n,s)}}function Lp(r,e,t,n,i,s){let o=r.childCursor(),{i:a,off:l}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let d of n)h+=d.length;r.length+=h,Rp(r,c,u,a,l,n,0,i,s)}let yr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Xc=typeof document<"u"?document:{documentElement:{style:{}}};const Qc=/Edge\/(\d+)/.exec(yr.userAgent),Bp=/MSIE \d/.test(yr.userAgent),Zc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yr.userAgent),Ia=!!(Bp||Zc||Qc),Fp=!Ia&&/gecko\/(\d+)/i.test(yr.userAgent),_c=!Ia&&/Chrome\/(\d+)/.exec(yr.userAgent),jp="webkitFontSmoothing"in Xc.documentElement.style,Vp=!Ia&&/Apple Computer/.test(yr.vendor),Wp=Vp&&(/Mobile\/\w+/.test(yr.userAgent)||yr.maxTouchPoints>2);var be={mac:Wp||/Mac/.test(yr.platform),windows:/Win/.test(yr.platform),linux:/Linux|X11/.test(yr.platform),ie:Ia,ie_version:Bp?Xc.documentMode||6:Zc?+Zc[1]:Qc?+Qc[1]:0,gecko:Fp,gecko_version:Fp?+(/Firefox\/(\d+)/.exec(yr.userAgent)||[0,0])[1]:0,chrome:!!_c,chrome_version:_c?+_c[1]:0,ios:Wp,android:/Android\b/.test(yr.userAgent),webkit:jp,safari:Vp,webkit_version:jp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Xc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Rk=256;class En extends it{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof En)||this.length-(t-e)+n.length>Rk||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new En(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Jt(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Lk(this.dom,e,t)}}class Tn extends it{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let i of t)i.setParent(this)}setAttrs(e){if(Mp(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);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,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,s,o){return n&&(!(n instanceof Tn&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Lp(this,e,t,n?n.children:[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,s=0;for(let a of this.children){let l=n+a.length;l>e&&t.push(n<e?a.split(e-n):a),i<0&&n>=e&&(i=s),n=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Tn(this.mark,t,o)}domAtPos(e){return $p(this,e)}coordsAt(e,t){return zp(this,e,t)}}function Lk(r,e,t){let n=r.nodeValue.length;e>n&&(e=n);let i=e,s=e,o=0;e==0&&t<0||e==n&&t>=0?be.chrome||be.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):t<0?i--:s<n&&s++;let a=Si(r,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return be.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Ma(l,o<0):l||null}class Xn extends it{static create(e,t,n){return new Xn(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Xn.create(this.widget,this.length-e,this.side);return this.length-=e,t}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.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,s,o){return n&&(!(n instanceof Xn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Xn&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Je.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Je.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return Ma(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class ts extends it{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof ts&&e.side==this.side}split(){return new ts(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Jt.before(this.dom):Jt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Je.empty}get isHidden(){return!0}}En.prototype.children=Xn.prototype.children=ts.prototype.children=Jc;function $p(r,e){let t=r.dom,{children:n}=r,i=0;for(let s=0;i<n.length;i++){let o=n[i],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=i;s>0;s--){let o=n[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=i;s<n.length;s++){let o=n[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Jt(t,0)}function Hp(r,e,t){let n,{children:i}=r;t>0&&e instanceof Tn&&i.length&&(n=i[i.length-1])instanceof Tn&&n.mark.eq(e.mark)?Hp(n,e.children[0],t-1):(i.push(e),e.setParent(r)),r.length+=e.length}function zp(r,e,t){let n=null,i=-1,s=null,o=-1;function a(c,u){for(let h=0,d=0;h<c.children.length&&d<=u;h++){let p=c.children[h],m=d+p.length;m>=u&&(p.children.length?a(p,u-d):(!s||s.isHidden&&t>0)&&(m>u||d==m&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==m&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=m}}a(r,e);let l=(t<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?i:o),t):Bk(r)}function Bk(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=_i(e);return t[t.length-1]||null}function qc(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}const Up=Object.create(null);function eu(r,e,t){if(r==e)return!0;r||(r=Up),e||(e=Up);let n=Object.keys(r),i=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(i.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function tu(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function Fk(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}class It extends it{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,s,o){if(n){if(!(n instanceof It))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Lp(this,e,t,n?n.children:[],s,o),!0}split(e){let t=new It;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)t.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}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){eu(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Hp(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=qc(t,this.attrs||{})),n&&(this.attrs=qc({class:n},this.attrs||{}))}domAtPos(e){return $p(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Mp(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&&(tu(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&it.get(i)instanceof Tn;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=it.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!be.ios||!this.children.some(s=>s instanceof En))){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,t;for(let n of this.children){if(!(n instanceof En)||/[^ -~]/.test(n.text))return null;let i=_i(n.dom);if(i.length!=1)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=zp(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,t){for(let n=0,i=0;n<e.children.length;n++){let s=e.children[n],o=i+s.length;if(o>=t){if(s instanceof It)return s;if(o>t)break}i=o+s.breakAfter}return null}}class Qn extends it{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,s,o){return n&&(!(n instanceof Qn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Qn(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Jc}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.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Je.empty}domBoundsAround(){return null}become(e){return e instanceof Qn&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){return this.widget.coordsAt(this.dom,e,t)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class ln{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}destroy(e){}}var sr=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(sr||(sr={}));class ke extends wi{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new qs(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Zn(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:s,end:o}=Gp(e,t);n=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Zn(e,n,i,t,e.widget||null,!0)}static line(e){return new eo(e)}static set(e,t=!1){return Xe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ke.none=Xe.empty;class qs extends ke{constructor(e){let{start:t,end:n}=Gp(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof qs&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&eu(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}qs.prototype.point=!1;class eo extends ke{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof eo&&this.spec.class==e.spec.class&&eu(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}eo.prototype.mapMode=ir.TrackBefore,eo.prototype.point=!0;class Zn extends ke{constructor(e,t,n,i,s,o){super(t,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?ir.TrackBefore:ir.TrackAfter:ir.TrackDel}get type(){return this.startSide!=this.endSide?sr.WidgetRange:this.startSide<=0?sr.WidgetBefore:sr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zn&&jk(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Zn.prototype.point=!0;function Gp(r,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=r;return t==null&&(t=r.inclusive),n==null&&(n=r.inclusive),{start:t??e,end:n??e}}function jk(r,e){return r==e||!!(r&&e&&r.compare(e))}function ru(r,e,t,n=0){let i=t.length-1;i>=0&&t[i]+n>=r?t[i]=Math.max(t[i],e):t.push(r,e)}class to{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,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=t}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 Qn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new It),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Da(new ts(-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 Qn)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)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(t.slice(t.length-n)),this.getLine().append(Da(new En(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Zn){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(n instanceof Zn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Qn(n.widget||new Kp("div"),a,n));else{let l=Xn.create(n.widget||new Kp("span"),a,a?0:n.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<t||n.startSide>0),u=!l.isEditable&&(e<t||s>i.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Da(new ts(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Da(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,n,i,s){let o=new to(e,t,n,s);return o.openEnd=Xe.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Da(r,e){for(let t of e)r=new Tn(t,[r],r.length);return r}class Kp extends ln{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}}const Yp=pe.define(),Jp=pe.define(),Xp=pe.define(),Qp=pe.define(),nu=pe.define(),Zp=pe.define(),_p=pe.define(),qp=pe.define({combine:r=>r.some(e=>e)}),eg=pe.define({combine:r=>r.some(e=>e)});class rs{constructor(e,t="nearest",n="nearest",i=5,s=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new rs(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 rs(se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Na=Ae.define({map:(r,e)=>r.map(e)});function br(r,e,t){let n=r.facet(Qp);n.length?n[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Ra=pe.define({combine:r=>r.length?r[0]:!0});let Vk=0;const ro=pe.define();class ft{constructor(e,t,n,i,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:s,decorations:o}=t||{};return new ft(Vk++,e,n,i,a=>{let l=[ro.of(a)];return o&&l.push(no.of(c=>{let u=c.plugin(a);return u?o(u):ke.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return ft.define(n=>new e(n),t)}}class iu{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(br(t.state,n,"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(t){br(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){br(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const tg=pe.define(),La=pe.define(),no=pe.define(),su=pe.define(),rg=pe.define();function ng(r,e,t){let n=r.state.facet(rg);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(r):o),s=[];return Xe.spans(i,e,t,{point(){},span(o,a,l,c){let u=s;for(let h=l.length-1;h>=0;h--,c--){let d=l[h].spec.bidiIsolate,p;if(d!=null)if(c>0&&u.length&&(p=u[u.length-1]).to==o&&p.direction==d)p.to=a,u=p.inner;else{let m={from:o,to:a,direction:d,inner:[]};u.push(m),u=m.inner}}}}),s}const ig=pe.define();function sg(r){let e=0,t=0,n=0,i=0;for(let s of r.state.facet(ig)){let o=s(r);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:n,bottom:i}}const io=pe.define();class xr{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new xr(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],d=t[s+1],p=Math.max(a,h),m=Math.min(u,d);if(p<=m&&new xr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new xr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class Ba{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Pt.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new xr(s,o,a,l))),this.changedRanges=i}static create(e,t,n){return new Ba(e,t,n)}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}}var ht=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(ht||(ht={}));const so=ht.LTR,og=ht.RTL;function ag(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const Wk=ag("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),$k=ag("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ou=Object.create(null),cn=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);ou[e]=t,ou[t]=-e}function Hk(r){return r<=247?Wk[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?$k[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8203?256:64336<=r&&r<=65023?4:r==8204?256:1}const zk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _n{get dir(){return this.level%2?og:so}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}static find(e,t,n,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==n)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function lg(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!lg(n.inner,i.inner))return!1}return!0}const qe=[];function Uk(r,e,t,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t,l=s?256:i;for(let c=o,u=l,h=l;c<a;c++){let d=Hk(r.charCodeAt(c));d==512?d=u:d==8&&h==4&&(d=16),qe[c]=d==4?2:d,d&7&&(h=d),u=d}for(let c=o,u=l,h=l;c<a;c++){let d=qe[c];if(d==128)c<a-1&&u==qe[c+1]&&u&24?d=qe[c]=u:qe[c]=256;else if(d==64){let p=c+1;for(;p<a&&qe[p]==64;)p++;let m=c&&u==8||p<t&&qe[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)qe[y]=m;c=p-1}else d==8&&h==1&&(qe[c]=1);u=d,d&7&&(h=d)}}}function Gk(r,e,t,n,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let h=c,d,p,m;h<u;h++)if(p=ou[d=r.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(cn[y+1]==-p){let w=cn[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[cn[y]]=A),a=y;break}}else{if(cn.length==189)break;cn[a++]=h,cn[a++]=d,cn[a++]=l}else if((m=qe[h])==2||m==1){let y=m==i;l=y?0:1;for(let w=a-3;w>=0;w-=3){let A=cn[w+2];if(A&2)break;if(y)cn[w+2]|=2;else{if(A&4)break;cn[w+2]|=4}}}}}function Kk(r,e,t,n){for(let i=0,s=n;i<=t.length;i++){let o=i?t[i-1].to:r,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=qe[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==t.length)break;u=t[i++].to,a=i<t.length?t[i].from:e}else if(qe[u]==256)u++;else break;let h=s==1,d=(u<e?qe[u]:n)==1,p=h==d?h?1:2:n;for(let m=u,y=i,w=y?t[y-1].to:r;m>l;)m==w&&(m=t[--y].from,w=y?t[y-1].to:r),qe[--m]=p;l=u}else s=c,l++}}}function au(r,e,t,n,i,s,o){let a=n%2?2:1;if(n%2==i%2)for(let l=e,c=0;l<t;){let u=!0,h=!1;if(c==s.length||l<s[c].from){let y=qe[l];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let y=s[c];if(!u)for(let w=y.to,A=c+1;;){if(w==t)break e;if(A<s.length&&s[A].from==w)w=s[A++].to;else{if(qe[w]==a)break e;break}}if(c++,d)d.push(y);else{y.from>l&&o.push(new _n(l,y.from,p));let w=y.direction==so!=!(p%2);lu(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.to}m=y.to}else{if(m==t||(u?qe[m]!=a:qe[m]==a))break;m++}d?au(r,l,m,n+1,i,d,o):l<m&&o.push(new _n(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let u=!0,h=!1;if(!c||l>s[c-1].to){let y=qe[l-1];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let y=s[--c];if(!u)for(let w=y.from,A=c;;){if(w==e)break e;if(A&&s[A-1].to==w)w=s[--A].from;else{if(qe[w-1]==a)break e;break}}if(d)d.push(y);else{y.to<l&&o.push(new _n(y.to,l,p));let w=y.direction==so!=!(p%2);lu(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.from}m=y.from}else{if(m==e||(u?qe[m-1]!=a:qe[m-1]==a))break;m--}d?au(r,m,l,n+1,i,d,o):m<l&&o.push(new _n(m,l,p)),l=m}}function lu(r,e,t,n,i,s,o){let a=e%2?2:1;Uk(r,i,s,n,a),Gk(r,i,s,n,a),Kk(i,s,n,a),au(r,i,s,e,t,n,o)}function cg(r,e,t){if(!r)return[new _n(0,0,e==og?1:0)];if(e==so&&!t.length&&!zk.test(r))return ug(r.length);if(t.length)for(;r.length>qe.length;)qe[qe.length]=256;let n=[],i=e==so?0:1;return lu(r,i,i,t,0,r.length,n),n}function ug(r){return[new _n(0,r,0)]}let fg="";function hg(r,e,t,n,i){var s;let o=n.head-r.from,a=-1;if(o==0){if(!i||!r.length)return null;e[0].level!=t&&(o=e[0].side(!1,t),a=0)}else if(o==r.length){if(i)return null;let d=e[e.length-1];d.level!=t&&(o=d.side(!0,t),a=e.length-1)}a<0&&(a=_n.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc));let l=e[a];o==l.side(i,t)&&(l=e[a+=i?1:-1],o=l.side(!i,t));let c=i==(l.dir==t),u=Ft(r.text,o,c);if(fg=r.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,t))return se.cursor(u+r.from,c?-1:1,l.level);let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return!h&&l.level!=t?se.cursor(i?r.to:r.from,i?-1:1,t):h&&h.level<l.level?se.cursor(h.side(!i,t)+r.from,i?1:-1,h.level):se.cursor(u+r.from,i?-1:1,l.level)}class dg extends it{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 It],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xr(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!qk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Jk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new xr(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(be.ie||be.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Zk(o,a,e.changes);return n=xr.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);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=be.chrome||be.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<this.view.state.doc.length)for(let o of this.children)o instanceof Qn&&o.widget instanceof pg&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:h}=a,d,p,m,y;if(n&&n.range.fromB<h&&n.range.toB>u){let F=to.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),I=to.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=F.breakAtStart,m=F.openStart,y=I.openEnd;let W=this.compositionView(n);I.breakAtStart?W.breakAfter=1:I.content.length&&W.merge(W.length,W.length,I.content[0],!1,I.openStart,0)&&(W.breakAfter=I.content[0].breakAfter,I.content.shift()),F.content.length&&W.merge(0,0,F.content[F.content.length-1],!0,0,F.openEnd)&&F.content.pop(),d=F.content.concat(W).concat(I.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=to.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:E}=s.findPos(l,-1);Rp(this,T,E,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new En(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new Tn(i,[t],t.length);let n=new It;return n.append(t,0),n}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=it.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&Ta(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(be.gecko&&a.empty&&!this.hasComposition&&Yk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Jt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Pa(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Pa(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{be.android&&be.chrome&&this.dom.contains(u.focusNode)&&_k(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ea(this.view.root);if(h)if(a.empty){if(be.gecko){let d=Xk(l.node,l.offset);if(d&&d!=3){let p=mg(l.node,l.offset,d==1?1:-1);p&&(l=new Jt(p.node,p.offset))}}h.collapse(l.node,l.offset),a.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=a.bidiLevel)}else if(h.extend){h.collapse(l.node,l.offset);try{h.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Jt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Jt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ea(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=It.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,s)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let i=e.offset;!n&&i<t.childNodes.length;i++){let s=it.get(t.childNodes[i]);s instanceof It&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=it.get(t.childNodes[i]);s instanceof It&&(n=s.domAtPos(s.length))}return n?new Jt(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=it.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let i=this.children[t];if(n<i.length||i instanceof It)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!n||a instanceof It&&!(n instanceof It&&t>=0))&&(n=a,i=c),s=c}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof It))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(n,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}n=l}if(!(i instanceof En))return null;let s=Ft(i.text,n);if(s==n)return null;let o=Si(i.dom,n,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ht.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],d=c+h.length;if(d>i)break;if(c>=n){let p=h.dom.getBoundingClientRect();if(t.push(p.height),o){let m=h.dom.lastChild,y=m?_i(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ht.RTL:ht.LTR}measureTextSize(){for(let s of this.children)if(s instanceof It){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,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=_i(e.firstChild)[0];t=e.getBoundingClientRect().height,n=s?s.width/27:7,i=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Np(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ke.replace({widget:new pg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return ke.set(e)}updateDeco(){let e=this.view.state.facet(no).map((t,n)=>(this.dynamicDecorationMap[n]=typeof t=="function")?t(this.view):t);for(let t=e.length;t<e.length+3;t++)this.dynamicDecorationMap[t]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!n)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=sg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;Pk(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==ht.LTR)}}function Yk(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}class pg extends ln{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function gg(r,e){let t=r.observer.selectionRange,n=t.focusNode&&mg(t.focusNode,t.focusOffset,0);if(!n)return null;let i=e-n.offset;return{from:i,to:i+n.node.nodeValue.length,node:n.node}}function Jk(r,e,t){let n=gg(r,t);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||r.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,c=new xr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=it.get(h);if(d instanceof Tn)u.push({node:h,deco:d.mark});else{if(d instanceof It||h.nodeName=="DIV"&&h.parentNode==r.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=r.contentDOM)u.push({node:h,deco:new qs({inclusive:!0,attributes:Fk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function mg(r,e,t){if(t<=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i>0)n=n.childNodes[i-1],i=On(n);else break}if(t>=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length&&t>=0)n=n.childNodes[i],i=0;else break}return null}function Xk(r,e){return r.nodeType!=1?0:(e&&r.childNodes[e-1].contentEditable=="false"?1:0)|(e<r.childNodes.length&&r.childNodes[e].contentEditable=="false"?2:0)}let Qk=class{constructor(){this.changes=[]}compareRange(e,t){ru(e,t,this.changes)}comparePoint(e,t){ru(e,t,this.changes)}};function Zk(r,e,t){let n=new Qk;return Xe.compare(r,e,t,n),n.changes}function _k(r,e){for(let t=r;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function qk(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}function eA(r,e,t=1){let n=r.charCategorizer(e),i=r.doc.lineAt(e),s=e-i.from;if(i.length==0)return se.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Ft(i.text,s,!1):a=Ft(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Ft(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ft(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return se.range(o+i.from,a+i.from)}function tA(r,e){return e.left>r?e.left-r:Math.max(0,r-e.right)}function rA(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function cu(r,e){return r.top<e.bottom-1&&r.bottom>e.top+1}function vg(r,e){return e<r.top?{top:e,left:r.left,right:r.right,bottom:r.bottom}:r}function yg(r,e){return e>r.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function uu(r,e,t){let n,i,s,o,a=!1,l,c,u,h;for(let m=r.firstChild;m;m=m.nextSibling){let y=_i(m);for(let w=0;w<y.length;w++){let A=y[w];i&&cu(i,A)&&(A=vg(yg(A,i.bottom),i.top));let T=tA(e,A),E=rA(t,A);if(T==0&&E==0)return m.nodeType==3?bg(m,e,t):uu(m,e,t);if(!n||o>E||o==E&&s>T){n=m,i=A,s=T,o=E;let F=E?t<A.top?-1:1:T?e<A.left?-1:1:0;a=!F||(F>0?w<y.length-1:w>0)}T==0?t>A.bottom&&(!u||u.bottom<A.bottom)?(l=m,u=A):t<A.top&&(!h||h.top>A.top)&&(c=m,h=A):u&&cu(u,A)?u=yg(u,A.bottom):h&&cu(h,A)&&(h=vg(h,A.top))}}if(u&&u.bottom>=t?(n=l,i=u):h&&h.top<=t&&(n=c,i=h),!n)return{node:r,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return bg(n,d,t);if(a&&n.contentEditable!="false")return uu(n,d,t);let p=Array.prototype.indexOf.call(r.childNodes,n)+(e>=(i.left+i.right)/2?1:0);return{node:r,offset:p}}function bg(r,e,t){let n=r.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<n;a++){let l=Si(r,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let d=e>=(u.left+u.right)/2,p=d;if((be.chrome||be.gecko)&&Si(r,a).getBoundingClientRect().left==u.right&&(p=!d),h<=0)return{node:r,offset:a+(p?1:0)};i=a+(p?1:0),s=h}}}return{node:r,offset:i>-1?i:o>0?r.nodeValue.length:0}}function xg(r,e,t,n=-1){var i,s;let o=r.contentDOM.getBoundingClientRect(),a=o.top+r.viewState.paddingTop,l,{docHeight:c}=r.viewState,{x:u,y:h}=e,d=h-a;if(d<0)return 0;if(d>c)return r.state.doc.length;for(let F=r.viewState.heightOracle.textHeight/2,I=!1;l=r.elementAtHeight(d),l.type!=sr.Text;)for(;d=n>0?l.bottom+F:l.top-F,!(d>=0&&d<=c);){if(I)return t?null:0;I=!0,n=-n}h=a+d;let p=l.from;if(p<r.viewport.from)return r.viewport.from==0?0:t?null:wg(r,o,l,u,h);if(p>r.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:wg(r,o,l,u,h);let m=r.dom.ownerDocument,y=r.root.elementFromPoint?r.root:m,w=y.elementFromPoint(u,h);w&&!r.contentDOM.contains(w)&&(w=null),w||(u=Math.max(o.left+1,Math.min(o.right-1,u)),w=y.elementFromPoint(u,h),w&&!r.contentDOM.contains(w)&&(w=null));let A,T=-1;if(w&&((i=r.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(m.caretPositionFromPoint){let F=m.caretPositionFromPoint(u,h);F&&({offsetNode:A,offset:T}=F)}else if(m.caretRangeFromPoint){let F=m.caretRangeFromPoint(u,h);F&&({startContainer:A,startOffset:T}=F,(!r.contentDOM.contains(A)||be.safari&&nA(A,T,u)||be.chrome&&iA(A,T,u))&&(A=void 0))}}if(!A||!r.docView.dom.contains(A)){let F=It.find(r.docView,p);if(!F)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=uu(F.dom,u,h))}let E=r.docView.nearest(A);if(!E)return null;if(E.isWidget&&((s=E.dom)===null||s===void 0?void 0:s.nodeType)==1){let F=E.dom.getBoundingClientRect();return e.y<F.top||e.y<=F.bottom&&e.x<=(F.left+F.right)/2?E.posAtStart:E.posAtEnd}else return E.localPosFromDOM(A,T)+E.posAtStart}function wg(r,e,t,n,i){let s=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let a=r.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(r.defaultLineHeight-a)*.5)/a);s+=l*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+zc(o,s,r.state.tabSize)}function nA(r,e,t){let n;if(r.nodeType!=3||e!=(n=r.nodeValue.length))return!1;for(let i=r.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Si(r,n-1,n).getBoundingClientRect().left>t}function iA(r,e,t){if(e!=0)return!1;for(let i=r;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let n=r.nodeType==1?r.getBoundingClientRect():Si(r,0,Math.max(r.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function fu(r,e){let t=r.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==sr.Text))return n}return t}function sA(r,e,t,n){let i=fu(r,e.head),s=!n||i.type!=sr.Text||!(r.lineWrapping||i.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=r.dom.getBoundingClientRect(),a=r.textDirectionAt(i.from),l=r.posAtCoords({x:t==(a==ht.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return se.cursor(l,t?-1:1)}return se.cursor(t?i.to:i.from,t?-1:1)}function Sg(r,e,t,n){let i=r.state.doc.lineAt(e.head),s=r.bidiSpans(i),o=r.textDirectionAt(i.from);for(let a=e,l=null;;){let c=hg(i,s,o,a,t),u=fg;if(!c){if(i.number==(t?r.state.doc.lines:1))return a;u=`
|
|
148
|
+
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=se.cursor(t?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function oA(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==at.Space&&(i=o),i==o}}function aA(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return se.cursor(i,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(i,e.assoc||-1),u=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=n??r.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(d+p)*s,y=xg(r,{x:h,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?y<i:y>i)){let w=r.docView.coordsForChar(y),A=!w||m<w.top?-1:1;return se.cursor(y,A,void 0,o)}}}function Fa(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function hu(r,e,t){let n=Fa(r.state.facet(su).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:se.cursor(n,n<t.from?1:-1)}class lA{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,be.safari&&e.contentDOM.addEventListener("input",()=>null),be.gecko&&AA(e.contentDOM.ownerDocument)}handleEvent(e){!mA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=cA(e),n=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=n[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(e.keyCode!=27&&Cg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),be.android&&be.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return be.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Ag.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||uA.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,es(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:be.safari&&!be.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 kg(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){br(t.state,i)}}}function cA(r){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of r){let i=n.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&t(s).handlers.push(kg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&t(s).observers.push(kg(n.value,o))}}for(let n in Gr)t(n).handlers.push(Gr[n]);for(let n in Kr)t(n).observers.push(Kr[n]);return e}const Ag=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],uA="dthko",Cg=[16,17,18,20,91,92,224,225],ja=6;function Va(r){return Math.max(0,r)*.7+8}function fA(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class hA{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Mk(e.contentDOM),this.atoms=e.state.facet(su).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ve.allowMultipleSelections)&&dA(e,t),this.dragging=gA(e,t)&&Lg(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&fA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=0,s=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=sg(this.view);e.clientX-o.left<=s.left+ja?n=-Va(s.left-e.clientX):e.clientX+o.right>=s.right-ja&&(n=Va(e.clientX-s.right)),e.clientY-o.top<=s.top+ja?i=-Va(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-ja&&(i=Va(e.clientY-s.bottom)),this.setScrollSpeed(n,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){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 t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=Fa(this.atoms,i.from,0);o!=i.from&&(s=se.cursor(o,-1))}else{let o=Fa(this.atoms,i.from,-1),a=Fa(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=se.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?se.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection)||n.main.assoc!=t.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function dA(r,e){let t=r.state.facet(Yp);return t.length?t[0](e):be.mac?e.metaKey:e.ctrlKey}function pA(r,e){let t=r.state.facet(Jp);return t.length?t[0](e):be.mac?!e.altKey:!e.ctrlKey}function gA(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=Ea(r.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function mA(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=it.get(t))&&n.ignoreEvent(e))return!1;return!0}const Gr=Object.create(null),Kr=Object.create(null),Og=be.ie&&be.ie_version<15||be.ios&&be.webkit_version<604;function vA(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),Eg(r,t.value)},50)}function Eg(r,e){let{state:t}=r,n,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(du!=null&&t.selection.ranges.every(l=>l.empty)&&du==s.toString()){let l=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:se.cursor(c.from+h.length)}})}else o?n=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:se.cursor(l.from+c.length)}}):n=t.replaceSelection(s);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Kr.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft},Gr.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&(r.inputState.lastEscPress=Date.now()),!1),Kr.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")},Kr.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")},Gr.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of r.state.facet(Xp))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=xA(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new hA(r,e,t,n)),n&&r.observer.ignore(()=>Tp(r.contentDOM));let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function Tg(r,e,t,n){if(n==1)return se.cursor(e,t);if(n==2)return eA(r.state,e,t);{let i=It.find(r.docView,e),s=r.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<r.state.doc.length&&a==s.to&&a++,se.range(o,a)}}let Pg=(r,e)=>r>=e.top&&r<=e.bottom,Mg=(r,e,t)=>Pg(e,t)&&r>=t.left&&r<=t.right;function yA(r,e,t,n){let i=It.find(r.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&&Mg(t,n,o))return-1;let a=i.coordsAt(s,1);return a&&Mg(t,n,a)?1:o&&Pg(n,o)?-1:1}function Ig(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:yA(r,t,e.clientX,e.clientY)}}const bA=be.ie&&be.ie_version<=11;let Dg=null,Ng=0,Rg=0;function Lg(r){if(!bA)return r.detail;let e=Dg,t=Rg;return Dg=r,Rg=Date.now(),Ng=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(Ng+1)%3:1}function xA(r,e){let t=Ig(r,e),n=Lg(e),i=r.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=Ig(r,s),c,u=Tg(r,l.pos,l.bias,n);if(t.pos!=l.pos&&!o){let h=Tg(r,t.pos,t.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?se.range(d,p):se.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=wA(i,l.pos))?c:a?i.addRange(u):se.create([u])}}}function wA(r,e){for(let t=0;t<r.ranges.length;t++){let{from:n,to:i}=r.ranges[t];if(n<=e&&i>=e)return se.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}Gr.dragstart=(r,e)=>{let{selection:{main:t}}=r.state;if(e.target.draggable){let i=r.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=se.range(s,o))}}let{inputState:n}=r;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",r.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Gr.dragend=r=>(r.inputState.draggedContent=null,!1);function Bg(r,e,t,n){if(!t)return;let i=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=r.inputState,o=n&&s&&pA(r,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},l=r.state.changes(o?[o,a]:a);r.focus(),r.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}Gr.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),i=0,s=()=>{++i==t.length&&Bg(r,e,n.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Bg(r,e,n,!0),!0}return!1},Gr.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=Og?null:e.clipboardData;return t?(Eg(r,t.getData("text/plain")||t.getData("text/uri-text")),!0):(vA(r),!1)};function SA(r,e){let t=r.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function kA(r){let e=[],t=[],n=!1;for(let i of r.selection.ranges)i.empty||(e.push(r.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of r.selection.ranges){let o=r.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),i=o.number}n=!0}return{text:e.join(r.lineBreak),ranges:t,linewise:n}}let du=null;Gr.copy=Gr.cut=(r,e)=>{let{text:t,ranges:n,linewise:i}=kA(r.state);if(!t&&!i)return!1;du=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=Og?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(SA(r,t),!1)};const Fg=an.define();function jg(r,e){let t=[];for(let n of r.facet(_p)){let i=n(r,e);i&&t.push(i)}return t?r.update({effects:t,annotations:Fg.of(!0)}):null}function Vg(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=jg(r.state,e);t?r.dispatch(t):r.update([])}},10)}Kr.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),Vg(r)},Kr.blur=r=>{r.observer.clearSelectionRange(),Vg(r)},Kr.compositionstart=Kr.compositionupdate=r=>{r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0)},Kr.compositionend=r=>{r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,be.chrome&&be.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50)},Kr.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()},Gr.beforeinput=(r,e)=>{var t;let n;if(be.chrome&&be.android&&(n=Ag.find(i=>i.inputType==e.inputType))&&(r.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let i=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return!1};const Wg=new Set;function AA(r){Wg.has(r)||(Wg.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const $g=["pre-wrap","normal","pre-line","break-spaces"];class Hg{constructor(e){this.lineWrapping=e,this.doc=Je.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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 $g.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,n,i,s,o){let a=$g.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class zg{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class un{constructor(e,t,n,i,s){this.from=e,this.length=t,this.top=n,this.height=i,this._content=s}get type(){return typeof this._content=="number"?sr.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Zn?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new un(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var tt=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(tt||(tt={}));const Wa=.001;class Xt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Wa&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Xt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let s=this,o=n.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,n.setDoc(t),0,0),p=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,n,0,0));u+=d.from-l,l=d.from;let m=pu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new wr(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,s=0;for(;;)if(t==n)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),n+=1+a.break,i-=a.size}else if(s>i*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--n];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new CA(Xt.of(e.slice(0,t)),o,Xt.of(e.slice(n)))}}Xt.prototype.size=1;class Ug extends Xt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new un(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,s){return this.blockAt(0,n,i,s)}forEachLine(e,t,n,i,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,n,i,s))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class wr extends Ug{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new un(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof wr||i instanceof Wt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Wt?i=new wr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Xt.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||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 Wt extends Xt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-n+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,n,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=t.doc.lineAt(c),h=a+u.length*l,d=Math.max(n,e-h/2);return new un(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/a))),{from:u,length:h}=t.doc.line(s+c);return new un(u,h,n+a*c,a,0)}}lineAt(e,t,n,i,s){if(t==tt.ByHeight)return this.blockAt(e,n,i,s);if(t==tt.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(e);return new un(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new un(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,t,n,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=i;u<=t;){let d=n.doc.lineAt(u);if(u==e){let m=d.number-a;h+=l*m+c*(e-s-m)}let p=l+c*d.length;o(new un(d.from,d.length,h,p,0)),h+=p,u=d.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let s=n[n.length-1];s instanceof Wt?n[n.length-1]=new Wt(s.length+i):n.push(null,new Wt(i-1))}if(e>0){let s=n[0];s instanceof Wt?n[0]=new Wt(e+s.length):n.unshift(new Wt(e-1),null)}return Xt.of(n)}decomposeLeft(e,t){t.push(new Wt(e-1),null)}decomposeRight(e,t){t.push(null,new Wt(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new Wt(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=Wa&&(l=-2);let d=new wr(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Wt(s-a).updateHeight(e,a));let c=Xt.of(o);return(l<0||Math.abs(c.height-this.height)>=Wa||Math.abs(l-this.heightMetrics(e,t).perLine)>=Wa)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class CA extends Xt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let s=n+this.left.height;return e<s?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,n,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,n,i,s):this.right.lineAt(e,t,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=t==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,s).join(c)}forEachLine(e,t,n,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,s,o),t>=l&&this.right.forEachLine(e,t,n,a,l,o);else{let c=this.lineAt(l,tt.ByPos,n,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of n)s.push(a);if(e>0&&Gg(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Gg(s,a)}return Xt.of(s)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Xt.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,n,i):o.updateHeight(e,a,n),l?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 Gg(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Wt&&(n=r[e+1])instanceof Wt&&r.splice(e-1,3,new Wt(t.length+1+n.length))}const OA=5;class pu{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof wr?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new wr(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Ug(o,i,n)):(o||s||i>=OA)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new wr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Wt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof wr)return e;let t=new wr(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof wr)&&!this.isCovered?this.nodes.push(new wr(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof wr&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let s=new pu(n,e);return Xe.spans(t,n,i,s,0),s.finish(n)}}function EA(r,e,t){let n=new TA;return Xe.compare(r,e,t,n,0),n.changes}class TA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&ru(e,t,this.changes,5)}}function PA(r,e){let t=r.getBoundingClientRect(),n=r.ownerDocument,i=n.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=r.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=c==r.parentNode?d.bottom:Math.min(l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function MA(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class gu{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],s=t[n];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return ke.replace({widget:new IA(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class IA extends ln{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Kg{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Yg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ht.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(La).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Hg(t),this.stateDeco=e.facet(no).filter(n=>typeof n!="function"),this.heightMap=Xt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle.setDoc(e.doc),[new xr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ke.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new $a(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Yg:new RA(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:oo(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(no).filter(u=>typeof u!="function");let i=e.changedRanges,s=xr.extendWithRanges(i,EA(n,this.stateDeco,e?e.changes:Pt.empty(this.state.doc.length))),o=this.heightMap.height,a=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),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(eg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ht.RTL:ht.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let F=a.width/t.offsetWidth,I=a.height/t.offsetHeight;(F>.995&&F<1.005||!isFinite(F)||Math.abs(a.width-t.offsetWidth)<1)&&(F=1),(I>.995&&I<1.005||!isFinite(I)||Math.abs(a.height-t.offsetHeight)<1)&&(I=1),(this.scaleX!=F||this.scaleY!=I)&&(this.scaleX=F,this.scaleY=I,c|=8,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Ip(e.scrollDOM);let m=(this.printing?MA:PA)(t,this.paddingTop),y=m.top-this.pixelViewport.top,w=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let F=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(F)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:I,charWidth:W,textHeight:j}=e.docView.measureTextSize();o=I>0&&i.refresh(s,I,W,j,T/W,F),o&&(e.docView.minWidth=0,c|=8)}y>0&&w>0?u=Math.max(y,w):y<0&&w<0&&(u=Math.min(y,w)),i.heightChanged=!1;for(let I of this.viewports){let W=I.from==this.viewport.from?F:e.docView.measureVisibleLineHeights(I);this.heightMap=(o?Xt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle,[new xr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new zg(I.from,W))}i.heightChanged&&(c|=2)}let E=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new $a(i.lineAt(o-n*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-n)*1e3,tt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;t.y=="center"?d=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new $a(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new $a(this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new gu(t.mapPos(i.from),t.mapPos(i.to),i.size));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=ht.LTR&&!n)return[];let a=[],l=(c,u,h,d)=>{if(u-c<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let w of m)if(w>c&&w<u){l(c,w-10,h,d),l(w+10,u,h,d);return}let y=NA(e,w=>w.from>=h.from&&w.to<=h.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-u)<s&&!m.some(A=>w.from<A&&w.to>A));if(!y){if(u<h.to&&t&&n&&t.visibleRanges.some(w=>w.from<=u&&w.to>=u)){let w=t.moveToLineBoundary(se.cursor(u),!1,!0).head;w>c&&(u=w)}y=new gu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=DA(c.from,c.to,this.stateDeco);if(u.total<o)continue;let h=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,w;if(h!=null){let A=za(u,h),T=((this.visibleBottom-this.visibleTop)/2+m)/c.height;y=A-T,w=A+T}else y=(this.visibleTop-c.top-m)/c.height,w=(this.visibleBottom-c.top+m)/c.height;d=Ha(u,y),p=Ha(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=za(u,h),E=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-E,A=T+E}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=Ha(u,w),p=Ha(u,A)}d>c.from&&l(c.from,d,c,u),p<c.to&&l(p,c.to,c,u)}return a}gapSize(e,t,n,i){let s=za(i,n)-za(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){gu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ke.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];Xe.spans(e,this.viewport.from,this.viewport.to,{span(i,s){t.push({from:i,to:s})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=t[s].from||i.to!=t[s].to);return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||oo(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return oo(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return oo(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 $a{constructor(e,t){this.from=e,this.to=t}}function DA(r,e,t){let n=[],i=r,s=0;return Xe.spans(t,r,e,{span(){},point(o,a){o>i&&(n.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function Ha({total:r,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(r*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(n<=a)return s+n;n-=a}}function za(r,e){let t=0;for(let{from:n,to:i}of r.ranges){if(e<=i){t+=e-n;break}t+=i-n}return t/r.total}function NA(r,e){for(let t of r)if(e(t))return t}const Yg={toDOM(r){return r},fromDOM(r){return r},scale:1};class RA{constructor(e,t,n){let i=0,s=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=t.lineAt(a,tt.ByPos,e,0,0).top,u=t.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return n+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,i=s.domBottom}}}function oo(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new un(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>oo(i,e)):r._content)}const Ua=pe.define({combine:r=>r.join(" ")}),mu=pe.define({combine:r=>r.indexOf(!0)>-1}),vu=Yn.newName(),Jg=Yn.newName(),Xg=Yn.newName(),Qg={"&light":"."+Jg,"&dark":"."+Xg};function yu(r,e,t){return new Yn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return r;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):r+" "+n}})}const LA=yu("."+vu,{"&":{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-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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qg),ao="\uFFFF";class BA{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Ve.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ao}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let a=it.get(i),l=it.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Zg(i))||Zg(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=it.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(FA(e,n.node,n.offset)?t:0))}}function FA(r,e,t){for(;;){if(!e||t<On(e))return!1;if(e==r)return!0;t=_s(e)+1,e=e.parentNode}}function Zg(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}class _g{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class jA{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let a=s||o?[]:$A(e),l=new BA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=HA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Yc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Yc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=se.single(c,l)}}}function qg(r,e){let t,{newSel:n}=e,i=r.state.selection.main,s=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||be.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=WA(r.state.doc.sliceString(o,a,ao),e.text,l-o,c);u&&(be.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==ao+ao&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Je.of(e.text.slice(u.from,u.toB).split(ao))})}else n&&(!r.hasFocus&&r.state.facet(Ra)||n.main.eq(i))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!i.empty&&n&&n.main.empty?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,i.to)}:t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,t.from).append(t.insert).append(r.state.doc.slice(t.to,i.to))}:(be.mac||be.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=se.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Je.of([" "])}):be.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
|
|
149
|
+
`&&r.lineWrapping&&(n&&(n=se.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Je.of([" "])}),t){if(be.ios&&r.inputState.flushIOSKey()||be.android&&(t.from==i.from&&t.to==i.to&&t.insert.length==1&&t.insert.lines==2&&es(r.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&es(r.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&es(r.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let a,l=()=>a||(a=VA(r,t,n));return r.state.facet(Zp).some(c=>c(r,t.from,t.to,o,l))||r.dispatch(l()),!0}else if(n&&!n.main.eq(i)){let o=!1,a="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),a=r.inputState.lastSelectionOrigin),r.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function VA(r,e,t){let n,i=r.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(a+e.insert.sliceString(0,void 0,r.state.lineBreak)+l))}else{let a=i.changes(e),l=t&&t.main.to<=a.newLength?t.main:void 0;if(i.selection.ranges.length>1&&r.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=r.state.sliceDoc(e.from,e.to),u,h=t&&gg(r,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=r.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let y=m.to-d,w=y-c.length;if(m.to-m.from!=p||r.state.sliceDoc(w,y)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let A=i.changes({from:w,to:y,insert:e.insert}),T=m.to-s.to;return{changes:A,range:l?se.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):m.map(A)}})}else n={changes:a,selection:l&&i.selection.replaceRange(l)}}let o="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,o+=".compose",r.inputState.compositionFirstChange&&(o+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:o,scrollIntoView:!0})}function WA(r,e,t,n){let i=Math.min(r.length,e.length),s=0;for(;s<i&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function $A(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new _g(t,n)),(i!=t||s!=n)&&e.push(new _g(i,s))),e}function HA(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?se.single(t+e,n+e):null}const zA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},bu=be.ie&&be.ie_version<=11;class UA{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Ik,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(t=>{for(let n of t)this.queue.push(n);(be.ie&&be.ie_version<=11||be.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),bu&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.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((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Ra)?n.root.activeElement!=this.dom:!Ta(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(be.ie&&be.ie_version<=11||be.android&&be.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Pa(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=be.safari&&e.root.nodeType==11&&Ek(this.dom.ownerDocument)==this.dom&&GA(this.view)||Ea(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Ta(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Nk(this.dom,t)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(t),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,zA),bu&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),bu&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&es(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Ta(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 jA(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=qg(this.view,t);return this.view.state==n&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=em(t,e.previousSibling||e.target.previousSibling,-1),i=em(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),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,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.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 em(r,e,t){for(;e;){let n=it.get(e);if(n&&n.parent==r)return n;let i=e.parentNode;e=i!=r.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function GA(r){let e=null;function t(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(r.contentDOM.addEventListener("beforeinput",t,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=r.docView.domAtPos(r.state.selection.main.anchor);return Pa(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class de{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.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);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(n=>n.forEach(i=>t(i,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Dk(e.parent)||document,this.viewState=new Kg(e.state||Ve.create(e)),e.scrollTo&&e.scrollTo.is(Na)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ro).map(n=>new iu(n));for(let n of this.plugins)n.update(this);this.observer=new UA(this),this.inputState=new lA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new dg(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let t=e.length==1&&e[0]instanceof Mt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Fg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=jg(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Ve.phrases)!=this.state.facet(Ve.phrases))return this.setState(s);i=Ba.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new rs(p.empty?p:se.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Na)&&(h=p.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Ga.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(io)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ua)!=i.state.facet(Ua)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(nu))try{d(i)}catch(p){br(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!qg(this,u)&&c.force&&es(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Kg(e),this.plugins=e.facet(ro).map(n=>new iu(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new dg(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ro),n=e.state.facet(ro);if(t!=n){let i=[];for(let s of n){let o=t.indexOf(s);if(o<0)i.push(new iu(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.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 a=0;;a++){if(o<0)if(Ip(n))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(m){return br(this.state,m),tm}}),h=Ba.create(this,this.state,[]),d=!1;h.flags|=l,t?t.flags|=l:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h));for(let p=0;p<c.length;p++)if(u[p]!=tm)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){br(this.state,m)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(nu))a(t)}get themeClasses(){return vu+" "+(this.state.facet(mu)?Xg:Jg)+" "+this.state.facet(Ua)}updateAttrs(){let e=rm(this,tg,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ra)?"true":"false",class:"cm-content",style:`${be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),rm(this,La,t);let n=this.observer.ignore(()=>{let i=tu(this.contentDOM,this.contentAttrs,t),s=tu(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(de.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(io);let e=this.state.facet(de.cspNonce);Yn.mount(this.root,this.styleModules.concat(LA).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return hu(this,e,Sg(this,e,t,n))}moveByGroup(e,t){return hu(this,e,Sg(this,e,t,n=>oA(this,e.head,n)))}moveToLineBoundary(e,t,n=!0){return sA(this,e,t,n)}moveVertically(e,t,n){return hu(this,e,aA(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),xg(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[_n.find(s,e-i.from,-1,t)];return Ma(n,o.dir==ht.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(qp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>KA)return ug(e.length);let t=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||lg(s.isolates,n=ng(this,e.from,e.to))))return s.order;n||(n=ng(this,e.from,e.to));let i=cg(e.text,t,n);return this.bidiCache.push(new Ga(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||be.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Tp(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,t={}){return Na.of(new rs(typeof e=="number"?se.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Na.of(new rs(se.cursor(n.from),"start","start",n.top-e,t,!0))}static domEventHandlers(e){return ft.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ft.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Yn.newName(),i=[Ua.of(n),io.of(yu(`.${n}`,e))];return t&&t.dark&&i.push(mu.of(!0)),i}static baseTheme(e){return xi.lowest(io.of(yu("."+vu,e,Qg)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&it.get(n)||it.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}}de.styleModule=io,de.inputHandler=Zp,de.focusChangeEffect=_p,de.perLineTextDirection=qp,de.exceptionSink=Qp,de.updateListener=nu,de.editable=Ra,de.mouseSelectionStyle=Xp,de.dragMovesSelection=Jp,de.clickAddsSelectionRange=Yp,de.decorations=no,de.atomicRanges=su,de.bidiIsolatedRanges=rg,de.scrollMargins=ig,de.darkTheme=mu,de.cspNonce=pe.define({combine:r=>r.length?r[0]:""}),de.contentAttributes=La,de.editorAttributes=tg,de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"}),de.announce=Ae.define();const KA=4096,tm={};class Ga{constructor(e,t,n,i,s,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ht.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&n.push(new Ga(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function rm(r,e,t){for(let n=r.state.facet(e),i=n.length-1;i>=0;i--){let s=n[i],o=typeof s=="function"?s(r):s;o&&qc(o,t)}return t}const YA=be.mac?"mac":be.windows?"win":be.linux?"linux":"key";function JA(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ka(r,e,t){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t!==!1&&e.shiftKey&&(r="Shift-"+r),r}const XA=xi.default(de.domEventHandlers({keydown(r,e){return sm(im(e.state),r,e,"editor")}})),lo=pe.define({enables:XA}),nm=new WeakMap;function im(r){let e=r.facet(lo),t=nm.get(e);return t||nm.set(e,t=_A(e.reduce((n,i)=>n.concat(i),[]))),t}function QA(r,e,t){return sm(im(r.state),e,r,t)}let qn=null;const ZA=4e3;function _A(r,e=YA){let t=Object.create(null),n=Object.create(null),i=(o,a)=>{let l=n[o];if(l==null)n[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var h,d;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(A=>JA(A,e));for(let A=1;A<m.length;A++){let T=m.slice(0,A).join(" ");i(T,!0),p[T]||(p[T]={preventDefault:!0,stopPropagation:!1,run:[E=>{let F=qn={view:E,prefix:T,scope:o};return setTimeout(()=>{qn==F&&(qn=null)},ZA),!0}]})}let y=m.join(" ");i(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of r){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let h in u)u[h].run.push(o.any)}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}function sm(r,e,t,n){let i=Ok(e),s=jt(i,0),o=Lr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;qn&&qn.view==t&&qn.scope==n&&(a=qn.prefix+" ",Cg.indexOf(e.keyCode)<0&&(c=!0,qn=null));let h=new Set,d=w=>{if(w){for(let A of w.run)if(!h.has(A)&&(h.add(A),A(t,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=r[n],m,y;return p&&(d(p[a+Ka(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(be.windows&&e.ctrlKey&&e.altKey)&&(m=Jn[e.keyCode])&&m!=i?(d(p[a+Ka(m,e,!0)])||e.shiftKey&&(y=Zs[e.keyCode])!=i&&y!=m&&d(p[a+Ka(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ka(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class co{constructor(e,t,n,i,s){this.className=e,this.left=t,this.top=n,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=om(e);return[new co(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return qA(e,t,n)}}function om(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==ht.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function am(r,e,t){let n=se.cursor(e);return{from:Math.max(t.from,r.moveToLineBoundary(n,!1,!0).from),to:Math.min(t.to,r.moveToLineBoundary(n,!0,!0).from),type:sr.Text}}function qA(r,e,t){if(t.to<=r.viewport.from||t.from>=r.viewport.to)return[];let n=Math.max(t.from,r.viewport.from),i=Math.min(t.to,r.viewport.to),s=r.textDirection==ht.LTR,o=r.contentDOM,a=o.getBoundingClientRect(),l=om(r),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=fu(r,n),m=fu(r,i),y=p.type==sr.Text?p:null,w=m.type==sr.Text?m:null;if(y&&(r.lineWrapping||p.widgetLineBreaks)&&(y=am(r,n,y)),w&&(r.lineWrapping||m.widgetLineBreaks)&&(w=am(r,i,w)),y&&w&&y.from==w.from)return T(E(t.from,t.to,y));{let I=y?E(t.from,null,y):F(p,!1),W=w?E(null,t.to,w):F(m,!0),j=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&I.bottom+r.defaultLineHeight/2<W.top?j.push(A(h,I.bottom,d,W.top)):I.bottom<W.top&&r.elementAtHeight((I.bottom+W.top)/2).type==sr.Text&&(I.bottom=W.top=(I.bottom+W.top)/2),T(I).concat(j).concat(T(W))}function A(I,W,j,Q){return new co(e,I-l.left,W-l.top-.01,j-I,Q-W+.01)}function T({top:I,bottom:W,horizontal:j}){let Q=[];for(let B=0;B<j.length;B+=2)Q.push(A(j[B],I,j[B+1],W));return Q}function E(I,W,j){let Q=1e9,B=-1e9,U=[];function G(he,xe,Fe,we,Ee){let Ue=r.coordsAtPos(he,he==j.to?-2:2),Ie=r.coordsAtPos(Fe,Fe==j.from?2:-2);!Ue||!Ie||(Q=Math.min(Ue.top,Ie.top,Q),B=Math.max(Ue.bottom,Ie.bottom,B),Ee==ht.LTR?U.push(s&&xe?h:Ue.left,s&&we?d:Ie.right):U.push(!s&&we?h:Ie.left,!s&&xe?d:Ue.right))}let re=I??j.from,ce=W??j.to;for(let he of r.visibleRanges)if(he.to>re&&he.from<ce)for(let xe=Math.max(he.from,re),Fe=Math.min(he.to,ce);;){let we=r.state.doc.lineAt(xe);for(let Ee of r.bidiSpans(we)){let Ue=Ee.from+we.from,Ie=Ee.to+we.from;if(Ue>=Fe)break;Ie>xe&&G(Math.max(Ue,xe),I==null&&Ue<=re,Math.min(Ie,Fe),W==null&&Ie>=ce,Ee.dir)}if(xe=we.to+1,xe>=Fe)break}return U.length==0&&G(re,I==null,ce,W==null,r.textDirection),{top:Q,bottom:B,horizontal:U}}function F(I,W){let j=a.top+(W?I.top:I.bottom);return{top:j,bottom:j,horizontal:[]}}}function eC(r,e){return r.constructor==e.constructor&&r.eq(e)}class tC{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Ya)!=e.state.facet(Ya)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(Ya);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!eC(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ya=pe.define();function lm(r){return[ft.define(e=>new tC(e,r)),Ya.of(r)]}const cm=!be.ios,ns=pe.define({combine(r){return Ur(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function rC(r={}){return[ns.of(r),nC,iC,sC,eg.of(!0)]}function iD(r){return r.facet(ns)}function um(r){return r.startState.facet(ns)!=r.state.facet(ns)}const nC=lm({above:!0,markers(r){let{state:e}=r,t=e.facet(ns),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||cm:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:se.cursor(i.head,i.head>i.anchor?-1:1);for(let l of co.forRange(r,o,a))n.push(l)}}return n},update(r,e){r.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=um(r);return t&&fm(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){fm(e.state,r)},class:"cm-cursorLayer"});function fm(r,e){e.style.animationDuration=r.facet(ns).cursorBlinkRate+"ms"}const iC=lm({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:co.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||um(r)},class:"cm-selectionLayer"}),xu={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cm&&(xu[".cm-line"].caretColor="transparent !important",xu[".cm-content"]={caretColor:"transparent !important"});const sC=xi.highest(de.theme(xu)),hm=Ae.define({map(r,e){return r==null?null:e.mapPos(r)}}),uo=At.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(hm)?n.value:t,r)}}),oC=ft.fromClass(class{constructor(r){this.view=r,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(r){var e;let t=r.state.field(uo);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(r.startState.field(uo)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(uo),t=e!=null&&r.coordsAtPos(e);if(!t)return null;let n=r.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+r.scrollDOM.scrollLeft*r.scaleX,top:t.top-n.top+r.scrollDOM.scrollTop*r.scaleY,height:t.bottom-t.top}}drawCursor(r){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;r?(this.cursor.style.left=r.left/e+"px",this.cursor.style.top=r.top/t+"px",this.cursor.style.height=r.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(r){this.view.state.field(uo)!=r&&this.view.dispatch({effects:hm.of(r)})}},{eventObservers:{dragover(r){this.setDropPos(this.view.posAtCoords({x:r.clientX,y:r.clientY}))},dragleave(r){(r.target==this.view.contentDOM||!this.view.contentDOM.contains(r.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function aC(){return[uo,oC]}function dm(r,e,t,n,i){e.lastIndex=0;for(let s=r.iterRange(t,n),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function lC(r,e){let t=r.visibleRanges;if(t.length==1&&t[0].from==r.viewport.from&&t[0].to==r.viewport.to)return t;let n=[];for(let{from:i,to:s}of t)i=Math.max(r.state.doc.lineAt(i).from,i-e),s=Math.min(r.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}class wu{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Kn,n=t.add.bind(t);for(let{from:i,to:s}of lC(e,this.maxLength))dm(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(n=Math.min(a,n),i=Math.max(l,i))}),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let s of e.visibleRanges){let o=Math.max(s.from,n),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],p,m=(y,w,A)=>d.push(A.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else dm(e.state.doc,this.regexp,u,h,(y,w)=>this.addMatch(w,e,y,m));t=t.update({filterFrom:u,filterTo:h,filter:(y,w)=>y<u||w>h,add:d})}}return t}}const Su=/x/.unicode!=null?"gu":"g",cC=new RegExp(`[\0-\b
|
|
150
|
+
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Su),uC={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 ku=null;function fC(){var r;if(ku==null&&typeof document<"u"&&document.body){let e=document.body.style;ku=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return ku||!1}const Ja=pe.define({combine(r){let e=Ur(r,{render:null,specialChars:cC,addSpecialChars:null});return(e.replaceTabs=!fC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Su)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Su)),e}});function hC(r={}){return[Ja.of(r),dC()]}let pm=null;function dC(){return pm||(pm=ft.fromClass(class{constructor(r){this.view=r,this.decorations=ke.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(Ja)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new wu({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=jt(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=Zi(o.text,a,n-o.from);return ke.replace({widget:new vC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ke.replace({widget:new mC(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(Ja);r.startState.facet(Ja)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}const pC="\u2022";function gC(r){return r>=32?pC:r==10?"\u2424":String.fromCharCode(9216+r)}class mC extends ln{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=gC(this.code),n=e.state.phrase("Control character")+" "+(uC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class vC extends ln{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}}const gm=null;function sD(){return[gm,La.of(r=>{var e;return((e=r.plugin(gm))===null||e===void 0?void 0:e.attrs)||null})]}function yC(){return xC}const bC=ke.line({class:"cm-activeLine"}),xC=ft.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(bC.range(i.from)),e=i.from)}return ke.set(t)}},{decorations:r=>r.decorations});class wC extends ln{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 t=e.firstChild?_i(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Ma(t[0],n.direction!="rtl"),s=parseInt(n.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 SC(r){return ft.fromClass(class{constructor(e){this.view=e,this.placeholder=r?ke.set([ke.widget({widget:new wC(r),side:1}).range(0)]):ke.none}get decorations(){return this.view.state.doc.length?ke.none:this.placeholder}},{decorations:e=>e.decorations})}const Au=2e3;function kC(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Au||t.off>Au||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=i;l++){let c=r.doc.line(l);c.length<=a&&s.push(se.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=n;l<=i;l++){let c=r.doc.line(l),u=zc(c.text,o,r.tabSize,!0);if(u<0)s.push(se.cursor(c.to));else{let h=zc(c.text,a,r.tabSize);s.push(se.range(c.from+u,c.from+h))}}}return s}function AC(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function mm(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),i=t-n.from,s=i>Au?-1:i==n.length?AC(r,e.clientX):Zi(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function CC(r,e){let t=mm(r,e),n=r.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=mm(r,i);if(!a)return n;let l=kC(r.state,t,a);return l.length?o?se.create(l.concat(n.ranges)):se.create(l):n}}:null}function OC(r){let e=r?.eventFilter||(t=>t.altKey&&t.button==0);return de.mouseSelectionStyle.of((t,n)=>e(n)?CC(t,n):null)}const EC={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},TC={style:"cursor: crosshair"};function PC(r={}){let[e,t]=EC[r.key||"Alt"],n=ft.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[n,de.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?TC:null})]}const fo="-10000px";class vm{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=t[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(l.dom.remove(),(n=l.destroy)===null||n===void 0||n.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function oD(r={}){return Xa.of(r)}function MC(r){let{win:e}=r;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Xa=pe.define({combine:r=>{var e,t,n;return{position:be.ios?"absolute":((e=r.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=r.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=r.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||MC}}}),ym=new WeakMap,Qa=ft.fromClass(class{constructor(r){this.view=r,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=r.state.facet(Xa);this.position=e.position,this.parent=e.parent,this.classes=r.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new vm(r,Za,t=>this.createTooltip(t)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),r.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 r of this.manager.tooltipViews)this.intersectionObserver.observe(r.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(r){r.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(r,this.above);e&&this.observeIntersection();let t=e||r.geometryChanged,n=r.state.facet(Xa);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(r){let e=r.create(this.view);if(e.dom.classList.add("cm-tooltip"),r.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=fo,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var r,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(r=t.destroy)===null||r===void 0||r.call(t);this.parent&&this.container.remove(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let r=this.view.dom.getBoundingClientRect(),e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(be.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(this.view.scaleX!=1||this.view.scaleY!=1)n=!0;else if(i.style.top==fo&&i.style.left=="0px"){let s=i.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:r,parent:this.parent?this.container.getBoundingClientRect():r,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(Xa).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:t,space:n,scaleX:i,scaleY:s}=r,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=r.pos[a],d=r.size[a];if(!h||h.bottom<=Math.max(t.top,n.top)||h.top>=Math.min(t.bottom,n.bottom)||h.right<Math.max(t.left,n.left)-.1||h.left>Math.min(t.right,n.right)+.1){u.style.top=fo;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=ym.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||DC,T=this.view.textDirection==ht.LTR,E=d.width>n.right-n.left?T?n.left:n.right-d.width:T?Math.min(h.left-(p?14:0)+A.x,n.right-y):Math.max(n.left,h.left-y+(p?14:0)-A.x),F=this.above[a];!l.strictSide&&(F?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&F==n.bottom-h.bottom>h.top-n.top&&(F=this.above[a]=!F);let I=(F?h.top-n.top:n.bottom-h.bottom)-m;if(I<w&&c.resize!==!1){if(I<this.view.defaultLineHeight){u.style.top=fo;continue}ym.set(c,w),u.style.height=(w=I)/s+"px"}else u.style.height&&(u.style.height="");let W=F?h.top-w-m-A.y:h.bottom+m+A.y,j=E+y;if(c.overlap!==!0)for(let Q of o)Q.left<j&&Q.right>E&&Q.top<W+w&&Q.bottom>W&&(W=F?Q.top-w-2-m:Q.bottom+m+2);if(this.position=="absolute"?(u.style.top=(W-r.parent.top)/s+"px",u.style.left=(E-r.parent.left)/i+"px"):(u.style.top=W/s+"px",u.style.left=E/i+"px"),p){let Q=h.left+(T?A.x:-A.x)-(E+14-7);p.style.left=Q/i+"px"}c.overlap!==!0&&o.push({left:E,top:W,right:j,bottom:W+w}),u.classList.toggle("cm-tooltip-above",F),u.classList.toggle("cm-tooltip-below",!F),c.positioned&&c.positioned(r.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 r of this.manager.tooltipViews)r.dom.style.top=fo}},{eventObservers:{scroll(){this.maybeMeasure()}}}),IC=de.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"}}}),DC={x:0,y:0},Za=pe.define({enables:[Qa,IC]}),ho=pe.define();class _a{static create(e){return new _a(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new vm(e,ho,t=>this.createHostedView(t))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const NC=Za.compute([ho],r=>{let e=r.facet(ho).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:_a.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class RC{constructor(e,t,n,i,s){this.view=e,this.source=t,this.field=n,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)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let i,s=1;if(n instanceof Xn)i=n.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let a=e.coordsAtPos(i);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ht.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>br(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}get tooltip(){let e=this.view.plugin(Qa),t=e?e.manager.tooltips.findIndex(n=>n.create==_a.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t;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:n,tooltip:i}=this;if(n&&i&&!LC(i.dom,e)||this.pending){let{pos:s}=n||this.pending,o=(t=n?.end)!==null&&t!==void 0?t:s;(s==o?this.view.posAtCoords(this.lastMove)!=s:!BC(this.view,s,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of(null)})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const qa=4;function LC(r,e){let t=r.getBoundingClientRect();return e.clientX>=t.left-qa&&e.clientX<=t.right+qa&&e.clientY>=t.top-qa&&e.clientY<=t.bottom+qa}function BC(r,e,t,n,i,s){let o=r.scrollDOM.getBoundingClientRect(),a=r.documentTop+r.documentPadding.top+r.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=r.posAtCoords({x:n,y:i},!1);return l>=e&&l<=t}function FC(r,e={}){let t=Ae.define(),n=At.define({create(){return null},update(i,s){if(i&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,i)))return null;if(i&&s.docChanged){let o=s.changes.mapPos(i.pos,-1,ir.TrackDel);if(o==null)return null;let a=Object.assign(Object.create(null),i);a.pos=o,i.end!=null&&(a.end=s.changes.mapPos(i.end)),i=a}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(jC)&&(i=null);return i},provide:i=>ho.from(i)});return[n,ft.define(i=>new RC(i,r,n,t,e.hoverTime||300)),NC]}function bm(r,e){let t=r.plugin(Qa);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}function aD(r){return r.facet(ho).some(e=>e)}const jC=Ae.define(),lD=null;function cD(r){let e=r.plugin(Qa);e&&e.maybeMeasure()}const Cu=pe.define({combine(r){let e,t;for(let n of r)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function uD(r){return r?[Cu.of(r)]:[]}function po(r,e){let t=r.plugin(xm),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const xm=ft.fromClass(class{constructor(r){this.input=r.state.facet(go),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(Cu);this.top=new el(r,!0,e.topContainer),this.bottom=new el(r,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(r){let e=r.state.facet(Cu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new el(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new el(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(go);if(t!=this.input){let n=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(r.view),a.push(u)):(u=this.panels[c],u.update&&u.update(r)),i.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(r)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:r=>de.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class el{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=wm(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=wm(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 wm(r){let e=r.nextSibling;return r.remove(),e}const go=pe.define({enables:xm});class fn extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fn.prototype.elementClass="",fn.prototype.toDOM=void 0,fn.prototype.mapMode=ir.TrackBefore,fn.prototype.startSide=fn.prototype.endSide=-1,fn.prototype.point=!0;const tl=pe.define(),VC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Xe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},mo=pe.define();function Sm(r){return[km(),mo.of(Object.assign(Object.assign({},VC),r))]}const Ou=pe.define({combine:r=>r.some(e=>e)});function km(r){let e=[WC];return r&&r.fixed===!1&&e.push(Ou.of(!0)),e}const WC=ft.fromClass(class{constructor(r){this.view=r,this.prevViewport=r.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=r.state.facet(mo).map(e=>new Cm(r,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!r.state.facet(Ou),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),r.scrollDOM.insertBefore(this.dom,r.contentDOM)}update(r){if(this.updateGutters(r)){let e=this.prevViewport,t=r.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}r.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Ou)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=r.view.viewport}syncGutters(r){let e=this.dom.nextSibling;r&&this.dom.remove();let t=Xe.iter(this.view.state.facet(tl),this.view.viewport.from),n=[],i=this.gutters.map(s=>new $C(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==sr.Text&&o){Eu(t,n,a.from);for(let l of i)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==sr.Text){Eu(t,n,s.from);for(let o of i)o.line(this.view,s,n)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();r&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(r){let e=r.startState.facet(mo),t=r.state.facet(mo),n=r.docChanged||r.heightChanged||r.viewportChanged||!Xe.eq(r.startState.facet(tl),r.state.facet(tl),r.view.viewport.from,r.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(r)&&(n=!0);else{n=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new Cm(this.view,s)):(this.gutters[o].update(r),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 n}destroy(){for(let r of this.gutters)r.destroy();this.dom.remove()}},{provide:r=>de.scrollMargins.of(e=>{let t=e.plugin(r);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==ht.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Am(r){return Array.isArray(r)?r:[r]}function Eu(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class $C{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Xe.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new Om(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Eu(this.cursor,i,t.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Cm{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=Am(t.markers(e)),t.initialSpacer&&(this.spacer=new Om(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Am(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 n=e.view.viewport;return!Xe.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Om{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),HC(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function HC(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}const zC=pe.define(),is=pe.define({combine(r){return Ur(r,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let i in t){let s=n[i],o=t[i];n[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return n}})}});class Tu extends fn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Pu(r,e){return r.state.facet(is).formatNumber(e,r.state)}const UC=mo.compute([is],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(zC)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new Tu(Pu(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(is)!=e.state.facet(is),initialSpacer(e){return new Tu(Pu(e,Em(e.state.doc.lines)))},updateSpacer(e,t){let n=Pu(t.view,Em(t.view.state.doc.lines));return n==e.number?e:new Tu(n)},domEventHandlers:r.facet(is).domEventHandlers}));function GC(r={}){return[is.of(r),km(),UC]}function Em(r){let e=9;for(;e<r;)e=e*10+9;return e}const KC=new class extends fn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},YC=tl.compute(["selection"],r=>{let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.head).from;i>t&&(t=i,e.push(KC.range(i)))}return Xe.of(e)});function JC(){return YC}const Tm=new Map;function XC(r){let e=Tm.get(r);return e||Tm.set(r,e=ke.mark({attributes:r===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":r.replace(/ /g,"\xB7")}})),e}function Pm(r){return ft.define(e=>({decorations:r.createDeco(e),update(t){this.decorations=r.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const QC=Pm(new wu({regexp:/\t| +/g,decoration:r=>XC(r[0]),boundary:/\S/}));function fD(){return QC}const ZC=Pm(new wu({regexp:/\s+$/g,decoration:ke.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function hD(){return ZC}const dD={HeightMap:Xt,HeightOracle:Hg,MeasuredHeights:zg,QueryType:tt,ChangedRange:xr,computeOrder:cg,moveVisually:hg};var Mu;const ki=new Re;function Mm(r){return pe.define({combine:r?e=>e.concat(r):void 0})}const _C=new Re;class Sr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,Ve.prototype.hasOwnProperty("tree")||Object.defineProperty(Ve.prototype,"tree",{get(){return Lt(this)}}),this.parser=t,this.extension=[ei.of(this),Ve.languageData.of((s,o,a)=>{let l=Im(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(_C);if(h){let d=l.resolve(o-l.from,a);for(let p of h)if(p.test(d,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Im(e,t,n).type.prop(ki)==this.data}findRegions(e){let t=e.facet(ei);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(s,o)=>{if(s.prop(ki)==this.data){n.push({from:o,to:o+s.length});return}let a=s.prop(Re.mounted);if(a){if(a.tree.prop(ki)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+s.length});return}else if(a.overlay){let l=n.length;if(i(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ut&&i(c,s.positions[l]+o)}};return i(Lt(e),0),n}get allowsNesting(){return!0}}Sr.setState=Ae.define();function Im(r,e,t){let n=r.facet(ei),i=Lt(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,ot.ExcludeBuffers))s.type.isTop&&(i=s);return i}class rl extends Sr{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Mm(e.languageData);return new rl(t,e.parser.configure({props:[ki.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new rl(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lt(r){let e=r.field(Sr.state,!1);return e?e.tree:ut.empty}function qC(r,e,t=50){var n;let i=(n=r.field(Sr.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),o}function pD(r,e=r.doc.length){var t;return((t=r.field(Sr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function gD(r,e=r.viewport.to,t=100){let n=qC(r.state,e,t);return n!=Lt(r.state)&&r.dispatch({}),!!n}function mD(r){var e;return((e=r.plugin(Rm))===null||e===void 0?void 0:e.isWorking())||!1}class eO{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let vo=null;class ss{constructor(e,t,n=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ss(e,t,[],ut.empty,0,n,[],null)}startParse(){return this.parser.startParse(new eO(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ut.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(An.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(An.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=vo;vo=this;try{return e()}finally{vo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Dm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),n=An.applyChanges(n,l),i=ut.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new ss(this.parser,t,n,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Dm(this.fragments,i,s),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Nd{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=vo;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ut(nr.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return vo}}function Dm(r,e,t){return An.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class os{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new os(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ss.create(e.facet(ei).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new os(n)}}Sr.state=At.define({create:os.init,update(r,e){for(let t of e.effects)if(t.is(Sr.setState))return t.value;return e.startState.facet(ei)!=e.state.facet(ei)?os.init(e.state):r.apply(e)}});let Nm=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Nm=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Iu=typeof navigator<"u"&&(!((Mu=navigator.scheduling)===null||Mu===void 0)&&Mu.isInputPending)?()=>navigator.scheduling.isInputPending():null,Rm=ft.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Sr.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Sr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Nm(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,s=n.field(Sr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Iu?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Iu&&Iu()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Sr.setState.of(new os(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>br(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ei=pe.define({combine(r){return r.length?r[0]:null},enables:r=>[Sr.state,Rm,de.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class tO{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Lm{constructor(e,t,n,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new Lm(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let n=/\.([^.]+)$/.exec(t);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(n)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const Bm=pe.define(),nl=pe.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function Ai(r){let e=r.facet(nl);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function as(r,e){let t="",n=r.tabSize,i=r.facet(nl)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function il(r,e){r instanceof Ve&&(r=new yo(r));for(let n of r.state.facet(Bm)){let i=n(r,e);if(i!==void 0)return i}let t=Lt(r.state);return t.length>=e?rO(r,t,e):null}function vD(r,e,t){let n=Object.create(null),i=new yo(r,{overrideIndentation:o=>{var a;return(a=n[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=t;){let a=r.doc.lineAt(o);o=a.to+1;let l=il(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=as(r,l);c!=u&&(n[a.from]=l,s.push({from:a.from,to:a.from+c.length,insert:u}))}return r.changes(s)}class yo{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ai(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Zi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Fm=new Re;function rO(r,e,t){let n=e.resolveStack(t),i=n.node.enterUnfinishedNodesBefore(t);if(i!=n.node){let s=[];for(let o=i;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return jm(n,r,t)}function jm(r,e,t){for(let n=r;n;n=n.next){let i=iO(n.node);if(i)return i(Du.create(e,t,n))}return 0}function nO(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function iO(r){let e=r.type.prop(Fm);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(Re.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>Vm(o,!0,1,void 0,s&&!nO(o)?i.from:void 0)}return r.parent==null?sO:null}function sO(){return 0}class Du extends yo{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Du(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(oO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return jm(this.context.next,this.base,this.pos)}}function oO(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function aO(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from<o?t:null;a=l.to}}function yD({closing:r,align:e=!0,units:t=1}){return n=>Vm(n,e,t,r)}function Vm(r,e,t,n,i){let s=r.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==r.pos+o,l=e?aO(r):null;return l?a?r.column(l.from):r.column(l.to):r.baseIndent+(a?0:r.unit*t)}const bD=r=>r.baseIndent;function Wm({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const lO=200;function cO(){return Ve.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+lO)return r;let s=t.sliceString(i.from,n);if(!e.some(c=>c.test(s)))return r;let{state:o}=r,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=il(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=as(o,h);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[r,{changes:l,sequential:!0}]:r})}const uO=pe.define(),$m=new Re;function fO(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function hO(r,e,t){let n=Lt(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop($m);if(l&&(a.to<n.length-50||n.length==r.doc.length||!dO(a))){let c=l(a,r);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function dO(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function bo(r,e,t){for(let n of r.facet(uO)){let i=n(r,e,t);if(i)return i}return hO(r,e,t)}function Hm(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}const xo=Ae.define({map:Hm}),ls=Ae.define({map:Hm});function Nu(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}const ti=At.define({create(){return ke.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(xo)&&!pO(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Lu),i=n?ke.replace({widget:new SO(n(e.state,t.value))}):Gm;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(ls)&&(r=r.update({filter:(n,i)=>t.value.from!=n||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;r.between(n,n,(i,s)=>{i<n&&s>n&&(t=!0)}),t&&(r=r.update({filterFrom:n,filterTo:n,filter:(i,s)=>s<=n||i>=n}))}return r},provide:r=>de.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,i)=>{t.push(n,i)}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],i=r[t++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Gm.range(n,i))}return ke.set(e,!0)}});function xD(r){return r.field(ti,!1)||RangeSet.empty}function wo(r,e,t){var n;let i=null;return(n=r.field(ti,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function pO(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Ru(r,e){return r.field(ti,!1)?e:e.concat(Ae.appendConfig.of(zm()))}const gO=r=>{for(let e of Nu(r)){let t=bo(r.state,e.from,e.to);if(t)return r.dispatch({effects:Ru(r.state,[xo.of(t),sl(r,t)])}),!0}return!1},mO=r=>{if(!r.state.field(ti,!1))return!1;let e=[];for(let t of Nu(r)){let n=wo(r.state,t.from,t.to);n&&e.push(ls.of(n),sl(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function sl(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return de.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const vO=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=bo(e,i.from,i.to);s&&t.push(xo.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Ru(r.state,t)}),!!t.length},yO=r=>{let e=r.state.field(ti,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(ls.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function bO(r,e){for(let t=e;;){let n=bo(r.state,t.from,t.to);if(n&&n.to>e.from)return n;if(!t.from)return null;t=r.lineBlockAt(t.from-1)}}const wD=r=>{let e=[];for(let t of Nu(r)){let n=wo(r.state,t.from,t.to);if(n)e.push(ls.of(n),sl(r,n,!1));else{let i=bO(r,t);i&&e.push(xo.of(i),sl(r,i))}}return e.length>0&&r.dispatch({effects:Ru(r.state,e)}),!!e.length},xO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:gO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:mO},{key:"Ctrl-Alt-[",run:vO},{key:"Ctrl-Alt-]",run:yO}],wO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Lu=pe.define({combine(r){return Ur(r,wO)}});function zm(r){let e=[ti,CO];return r&&e.push(Lu.of(r)),e}function Um(r,e){let{state:t}=r,n=t.facet(Lu),i=o=>{let a=r.lineBlockAt(r.posAtDOM(o.target)),l=wo(r.state,a.from,a.to);l&&r.dispatch({effects:ls.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(r,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Gm=ke.replace({widget:new class extends ln{toDOM(r){return Um(r,null)}}});class SO extends ln{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Um(e,this.value)}}const kO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Bu extends fn{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function AO(r={}){let e=Object.assign(Object.assign({},kO),r),t=new Bu(e,!0),n=new Bu(e,!1),i=ft.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ei)!=o.state.facet(ei)||o.startState.field(ti,!1)!=o.state.field(ti,!1)||Lt(o.startState)!=Lt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Kn;for(let l of o.viewportLineBlocks){let c=wo(o.state,l.from,l.to)?n:bo(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,Sm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Xe.empty},initialSpacer(){return new Bu(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=wo(o.state,a.from,a.to);if(c)return o.dispatch({effects:ls.of(c)}),!0;let u=bo(o.state,a.from,a.to);return u?(o.dispatch({effects:xo.of(u)}),!0):!1}})}),zm()]}const CO=de.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class cs{constructor(e,t){this.specs=e;let n;function i(a){let l=Yn.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Sr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=Xd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Yn(n):null,this.themeType=t.themeType}static define(e,t){return new cs(e,t||{})}}const Fu=pe.define(),Km=pe.define({combine(r){return r.length?[r[0]]:null}});function ol(r){let e=r.facet(Fu);return e.length?e:r.facet(Km)}function ju(r,e){let t=[EO],n;return r instanceof cs&&(r.module&&t.push(de.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(Km.of(r)):n?t.push(Fu.computeN([de.darkTheme],i=>i.facet(de.darkTheme)==(n=="dark")?[r]:[])):t.push(Fu.of(r)),t}function SD(r,e,t){let n=ol(r),i=null;if(n){for(let s of n)if(!s.scope||t&&s.scope(t)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class OO{constructor(e){this.markCache=Object.create(null),this.tree=Lt(e.state),this.decorations=this.buildDeco(e,ol(e.state))}update(e){let t=Lt(e.state),n=ol(e.state),i=n!=ol(e.startState);t.length<e.view.viewport.to&&!i&&t.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,t){if(!t||!this.tree.length)return ke.none;let n=new Kn;for(let{from:i,to:s}of e.visibleRanges)Qd(this.tree,t,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=ke.mark({class:l})))},i,s);return n.finish()}}const EO=xi.high(ft.fromClass(OO,{decorations:r=>r.decorations})),TO=cs.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),PO=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ym=1e4,Jm="()[]{}",Xm=pe.define({combine(r){return Ur(r,{afterCursor:!0,brackets:Jm,maxScanDistance:Ym,renderMatch:DO})}}),MO=ke.mark({class:"cm-matchingBracket"}),IO=ke.mark({class:"cm-nonmatchingBracket"});function DO(r){let e=[],t=r.matched?MO:IO;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}const NO=[At.define({create(){return ke.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(Xm);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=hn(e.state,i.head,-1,n)||i.head>0&&hn(e.state,i.head-1,1,n)||n.afterCursor&&(hn(e.state,i.head,1,n)||i.head<e.state.doc.length&&hn(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return ke.set(t,!0)},provide:r=>de.decorations.from(r)}),PO];function RO(r={}){return[Xm.of(r),NO]}const LO=new Re;function Vu(r,e,t){let n=r.prop(e<0?Re.openedBy:Re.closedBy);if(n)return n;if(r.name.length==1){let i=t.indexOf(r.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Wu(r){let e=r.type.prop(LO);return e?e(r.node):r}function hn(r,e,t,n={}){let i=n.maxScanDistance||Ym,s=n.brackets||Jm,o=Lt(r),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Vu(l.type,t,s);if(c&&l.from<l.to){let u=Wu(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return BO(r,e,t,l,u,c,s)}}return FO(r,e,t,o,a.type,i,s)}function BO(r,e,t,n,i,s,o){let a=n.parent,l={from:i.from,to:i.to},c=0,u=a?.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Wu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Vu(u.type,t,o))c++;else if(Vu(u.type,-t,o)){if(c==0){let h=Wu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function FO(r,e,t,n,i,s,o){let a=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=r.doc.iterRange(e,t>0?r.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;t<0&&(d+=p.length);let m=e+d*t;for(let y=t>0?0:p.length-1,w=t>0?p.length:-1;y!=w;y+=t){let A=o.indexOf(p[y]);if(!(A<0||n.resolveInner(m+y,1).type!=i))if(A%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:m+y,to:m+y+1},matched:A>>1==l>>1};h--}}t>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function Qm(r,e,t,n=0,i=0){e==null&&(e=r.search(/[^\s\u00a0]/),e==-1&&(e=r.length));let s=i;for(let o=n;o<e;o++)r.charCodeAt(o)==9?s+=t-s%t:s++;return s}class Zm{constructor(e,t,n,i){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Qm(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Qm(this.string,null,this.tabSize)}match(e,t,n){if(typeof e=="string"){let i=o=>n?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function jO(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||VO,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Hu}}function VO(r){if(typeof r!="object")return r;let e={};for(let t in r){let n=r[t];e[t]=n instanceof Array?n.slice():n}return e}const _m=new WeakMap;class qm extends null{constructor(e){let t=Mm(e.languageData),n=jO(e),i,s=new class extends Parser{createParse(o,a,l){return new $O(i,o,a,l)}};super(t,s,[Bm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=UO(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new s0(n.tokenTable):zO}static define(e){return new qm(e)}getIndent(e,t){let n=Lt(e.state),i=n.resolve(t);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let s,{overrideIndentation:o}=e.options;o&&(s=_m.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let a=$u(this,n,0,i.from,s??t),l,c;if(a?(c=a.state,l=a.pos+1):(c=this.streamParser.startState(e.unit),l=0),t-l>1e4)return null;for(;l<t;){let h=e.state.doc.lineAt(l),d=Math.min(t,h.to);if(h.length){let p=o?o(h.from):-1,m=new Zm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)t0(this.streamParser.token,m,c)}else this.streamParser.blankLine(c,e.unit);if(d==t)break;l=h.to+1}let u=e.lineAt(t);return o&&s==null&&_m.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function $u(r,e,t,n,i){let s=t>=n&&t+e.length<=i&&e.prop(r.stateAfter);if(s)return{state:r.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o],c=a instanceof Tree&&l<i&&$u(r,a,l,n,i);if(c)return c}return null}function e0(r,e,t,n,i){if(i&&t<=0&&n>=e.length)return e;!i&&e.type==r.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<n&&a instanceof Tree){if(!(l=e0(r,a,t-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function WO(r,e,t,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),a=s<=t&&o>t&&$u(r,i.tree,0-i.offset,t,o),l;if(a&&(l=e0(r,i.tree,t+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:r.streamParser.startState(n?Ai(n):4),tree:Tree.empty}}class $O{constructor(e,t,n,i){this.lang=e,this.input=t,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=ss.get(),o=i[0].from,{state:a,tree:l}=WO(e,n,o,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ai(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=ss.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+2048);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
151
|
+
`&&(t="");else{let n=t.indexOf(`
|
|
152
|
+
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,n=o+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,i,s){if(this.ranges.length>1){s=this.skipGapsTo(t,s,1),t+=s;let o=this.chunk.length;s=this.skipGapsTo(n,s,-1),n+=s,i+=this.chunk.length-o}return this.chunk.push(e,t,n,i),s}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Zm(t,e?e.state.tabSize:4,e?Ai(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=t0(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:HO,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function t0(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const Hu=Object.create(null),So=[nr.none],HO=new aa(So),r0=[],n0=Object.create(null),i0=Object.create(null);for(let[r,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"]])i0[r]=o0(Hu,e);class s0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),i0)}resolve(e){return e?this.table[e]||(this.table[e]=o0(this.extra,e)):0}}const zO=new s0(Hu);function zu(r,e){r0.indexOf(r)>-1||(r0.push(r),console.warn(e))}function o0(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=r[c]||M[c];u?typeof u=="function"?l.length?l=l.map(u):zu(c,`Modifier ${c} used at start of tag`):l.length?zu(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:zu(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(a=>a.id),s=n0[i];if(s)return s.id;let o=n0[i]=nr.define({id:So.length,name:n,props:[Yd({[n]:t})]});return So.push(o),o.id}function UO(r){let e=NodeType.define({id:So.length,name:"Document",props:[ki.add(()=>r)],top:!0});return So.push(e),e}const AD=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=GO(e,r.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function GO(r,e){let t;return(t=r.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=r.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const KO=rl.define({name:"json",parser:ok.configure({props:[Fm.add({Object:Wm({except:/^\s*\}/}),Array:Wm({except:/^\s*\]/})}),$m.add({"Object Array":fO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function YO(){return new tO(KO)}function Uu(){return Uu=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Uu.apply(this,arguments)}function JO(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}const XO=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=Ku(r.state,t.from);return n.line?QO(r):n.block?_O(r):!1};function Gu(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}const QO=Gu(t2,0),CD=null,OD=null,ZO=Gu(a0,0),ED=null,TD=null,_O=Gu((r,e)=>a0(r,e,e2(e)),0);function Ku(r,e){let t=r.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const ko=50;function qO(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-ko,n),o=r.sliceDoc(i,i+ko),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-n<=2*ko?u=h=r.sliceDoc(n,i):(u=r.sliceDoc(n,n+ko),h=r.sliceDoc(i-ko,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-t.length;return u.slice(d,d+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function e2(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function a0(r,e,t=e.selection.ranges){let n=t.map(s=>Ku(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>qO(e,n[o],s.from,s.to));if(r!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(r!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function t2(r,e,t=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of t){let a=n.length,l=1e9,c=Ku(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,m=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),n.push({line:h,comment:m,token:c,indent:d,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Yu=an.define(),r2=an.define(),n2=pe.define(),l0=pe.define({combine(r){return Ur(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}}),Ju=At.define({create(){return dn.empty},update(r,e){let t=e.state.facet(l0),n=e.annotation(Yu);if(n){let l=lr.fromTransaction(e,n.selection),c=n.side,u=c==0?r.undone:r.done;return l?u=ll(u,u.length,t.minDepth,l):u=f0(u,e.startState.selection),new dn(c==0?n.rest:u,c==0?u:n.rest)}let i=e.annotation(r2);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(Mt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=lr.fromTransaction(e),o=e.annotation(Mt.time),a=e.annotation(Mt.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new dn(r.done.map(lr.fromJSON),r.undone.map(lr.fromJSON))}});function i2(r={}){return[Ju,l0.of(r),de.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?c0:e.inputType=="historyRedo"?Xu:null;return n?(e.preventDefault(),n(t)):!1}})]}const PD=null;function al(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(Ju,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}const c0=al(0,!1),Xu=al(1,!1),s2=al(0,!0),o2=al(1,!0);function MD(r){return function(e){let t=e.field(Ju,!1);if(!t)return 0;let n=r==0?t.done:t.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const ID=null,DD=null;class lr{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new lr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new lr(e.changes&&Pt.fromJSON(e.changes),[],e.mapped&&on.fromJSON(e.mapped),e.startSelection&&se.fromJSON(e.startSelection),e.selectionsAfter.map(se.fromJSON))}static fromTransaction(e,t){let n=Br;for(let i of e.startState.facet(n2)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new lr(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Br)}static selection(e){return new lr(void 0,Br,void 0,void 0,e)}}function ll(r,e,t,n){let i=e+1>t+20?e-t-1:0,s=r.slice(i,e);return s.push(n),s}function a2(r,e){let t=[],n=!1;return r.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],u=t[l++];a>=c&&o<=u&&(n=!0)}}),n}function l2(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function u0(r,e){return r.length?e.length?r.concat(e):r:e}const Br=[],c2=200;function f0(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-c2));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),ll(r,r.length-1,1e9,t.setSelAfter(n)))}else return[lr.selection([e])]}function u2(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Qu(r,e){if(!r.length)return r;let t=r.length,n=Br;for(;t;){let i=f2(r[t-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let s=r.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,n=i.selectionsAfter}return n.length?[lr.selection(n)]:Br}function f2(r,e,t){let n=u0(r.selectionsAfter.length?r.selectionsAfter.map(a=>a.map(e)):Br,t);if(!r.changes)return lr.selection(n);let i=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new lr(i,Ae.mapEffects(r.effects,e),o,r.startSelection.map(s),n)}const h2=/^(input\.type|delete)($|\.)/;class dn{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new dn(this.done,this.undone):this}addChanges(e,t,n,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||h2.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,a2(a.changes,e.changes))||n=="input.type.compose")?o=ll(o,o.length-1,i.minDepth,new lr(e.changes.compose(a.changes),u0(e.effects,a.effects),a.mapped,a.startSelection,Br)):o=ll(o,o.length,i.minDepth,e),new dn(o,Br,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Br;return s.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&l2(s[s.length-1],e)?this:new dn(f0(this.done,e),this.undone,t,n)}addMapping(e){return new dn(Qu(this.done,e),Qu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||t.selection;if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Yu.of({side:e,rest:u2(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Br:i.slice(0,i.length-1);return s.mapped&&(a=Qu(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Yu.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}dn.empty=new dn(Br,Br);const d2=[{key:"Mod-z",run:c0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Xu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Xu,preventDefault:!0},{key:"Mod-u",run:s2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:o2,preventDefault:!0}];function us(r,e){return se.create(r.ranges.map(e),r.mainIndex)}function pn(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Fr({state:r,dispatch:e},t){let n=us(r.selection,t);return n.eq(r.selection)?!1:(e(pn(r,n)),!0)}function Ao(r,e){return se.cursor(e?r.to:r.from)}function cl(r,e){return Fr(r,t=>t.empty?r.moveByChar(t,e):Ao(t,e))}function Qt(r){return r.textDirectionAt(r.state.selection.main.head)==ht.LTR}const h0=r=>cl(r,!Qt(r)),d0=r=>cl(r,Qt(r)),ND=r=>cl(r,!0),RD=r=>cl(r,!1);function ul(r,e){return Fr(r,t=>t.empty?r.moveByGroup(t,e):Ao(t,e))}const p2=r=>ul(r,!Qt(r)),g2=r=>ul(r,Qt(r)),LD=r=>ul(r,!0),BD=r=>ul(r,!1),p0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function g0(r,e,t){let n=r.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,a=!1,l=!1,c=!1,u=d=>{if(a)return!1;s+=t?d.length:-d.length;let p=n(d),m;if(p==CharCategory.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(p=-1),i==CharCategory.Space&&(i=p),i!=p)return!1;if(i==CharCategory.Word)if(d.toLowerCase()==d){if(!t&&l)return!1;c=!0}else if(c){if(t)return!1;a=!0}else{if(l&&t&&n(m=r.state.sliceDoc(s,s+1))==CharCategory.Word&&m.toLowerCase()==m)return!1;l=!0}return o++,!0},h=r.moveByChar(e,t,d=>(u(d),u));if(p0&&i==CharCategory.Word&&h.from==e.from+o*(t?1:-1)){let d=Math.min(e.head,h.head),p=Math.max(e.head,h.head),m=r.state.sliceDoc(d,p);if(m.length>1&&/[\u4E00-\uffff]/.test(m)){let y=Array.from(p0.segment(m));if(y.length>1)return t?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(h.head+y[y.length-1].index,1)}}return h}function m0(r,e){return Fr(r,t=>t.empty?g0(r,t,e):Ao(t,e))}const FD=r=>m0(r,!0),jD=r=>m0(r,!1);function m2(r,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(r.sliceDoc(e.from,e.to)))||e.firstChild}function fl(r,e,t){let n=Lt(r).resolveInner(e.head),i=t?Re.closedBy:Re.openedBy;for(let l=e.head;;){let c=t?n.childAfter(l):n.childBefore(l);if(!c)break;m2(r,c,i)?n=c:l=t?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=t?hn(r,n.from,1):hn(r,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,se.cursor(a,t?-1:1)}const v2=r=>Fr(r,e=>fl(r.state,e,!Qt(r))),y2=r=>Fr(r,e=>fl(r.state,e,Qt(r)));function v0(r,e){return Fr(r,t=>{if(!t.empty)return Ao(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const y0=r=>v0(r,!1),b0=r=>v0(r,!0);function x0(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let s of r.state.facet(de.scrollMargins)){let o=s(r);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(n=Math.max(o?.bottom,n))}i=r.scrollDOM.clientHeight-t-n}else i=(r.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(r.defaultLineHeight,i-5)}}function w0(r,e){let t=x0(r),{state:n}=r,i=us(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):Ao(o,e));if(i.eq(n.selection))return!1;let s;if(t.selfScroll){let o=r.coordsAtPos(n.selection.main.head),a=r.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=de.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return r.dispatch(pn(n,i),{effects:s}),!0}const S0=r=>w0(r,!1),Zu=r=>w0(r,!0);function ri(r,e,t){let n=r.lineBlockAt(e.head),i=r.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?n.to:n.from)&&(i=r.moveToLineBoundary(e,t,!1)),!t&&i.head==n.from&&n.length){let s=/^\s*/.exec(r.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(i=se.cursor(n.from+s))}return i}const b2=r=>Fr(r,e=>ri(r,e,!0)),x2=r=>Fr(r,e=>ri(r,e,!1)),w2=r=>Fr(r,e=>ri(r,e,!Qt(r))),S2=r=>Fr(r,e=>ri(r,e,Qt(r))),k2=r=>Fr(r,e=>se.cursor(r.lineBlockAt(e.head).from,1)),A2=r=>Fr(r,e=>se.cursor(r.lineBlockAt(e.head).to,-1));function k0(r,e,t){let n=!1,i=us(r.selection,s=>{let o=hn(r,s.head,-1)||hn(r,s.head,1)||s.head>0&&hn(r,s.head-1,1)||s.head<r.doc.length&&hn(r,s.head+1,-1);if(!o||!o.end)return s;n=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return t?se.range(s.anchor,a):se.cursor(a)});return n?(e(pn(r,i)),!0):!1}const C2=({state:r,dispatch:e})=>k0(r,e,!1),VD=({state:r,dispatch:e})=>k0(r,e,!0);function kr(r,e){let t=us(r.state.selection,n=>{let i=e(n);return se.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(r.state.selection)?!1:(r.dispatch(pn(r.state,t)),!0)}function hl(r,e){return kr(r,t=>r.moveByChar(t,e))}const A0=r=>hl(r,!Qt(r)),C0=r=>hl(r,Qt(r)),WD=r=>hl(r,!0),$D=r=>hl(r,!1);function dl(r,e){return kr(r,t=>r.moveByGroup(t,e))}const O2=r=>dl(r,!Qt(r)),E2=r=>dl(r,Qt(r)),HD=r=>dl(r,!0),zD=r=>dl(r,!1);function O0(r,e){return kr(r,t=>g0(r,t,e))}const UD=r=>O0(r,!0),GD=r=>O0(r,!1),T2=r=>kr(r,e=>fl(r.state,e,!Qt(r))),P2=r=>kr(r,e=>fl(r.state,e,Qt(r)));function E0(r,e){return kr(r,t=>r.moveVertically(t,e))}const T0=r=>E0(r,!1),P0=r=>E0(r,!0);function M0(r,e){return kr(r,t=>r.moveVertically(t,e,x0(r).height))}const I0=r=>M0(r,!1),D0=r=>M0(r,!0),M2=r=>kr(r,e=>ri(r,e,!0)),I2=r=>kr(r,e=>ri(r,e,!1)),D2=r=>kr(r,e=>ri(r,e,!Qt(r))),N2=r=>kr(r,e=>ri(r,e,Qt(r))),R2=r=>kr(r,e=>se.cursor(r.lineBlockAt(e.head).from)),L2=r=>kr(r,e=>se.cursor(r.lineBlockAt(e.head).to)),N0=({state:r,dispatch:e})=>(e(pn(r,{anchor:0})),!0),R0=({state:r,dispatch:e})=>(e(pn(r,{anchor:r.doc.length})),!0),L0=({state:r,dispatch:e})=>(e(pn(r,{anchor:r.selection.main.anchor,head:0})),!0),B0=({state:r,dispatch:e})=>(e(pn(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),B2=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),F2=({state:r,dispatch:e})=>{let t=gl(r).map(({from:n,to:i})=>se.range(n,Math.min(i+1,r.doc.length)));return e(r.update({selection:se.create(t),userEvent:"select"})),!0},j2=({state:r,dispatch:e})=>{let t=us(r.selection,n=>{var i;let s=Lt(r).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return se.range(a.to,a.from)}return n});return e(pn(r,t)),!0},V2=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=se.create([t.main]):t.main.empty||(n=se.create([se.cursor(t.main.head)])),n?(e(pn(r,n)),!0):!1};function fs(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,i=n.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=pl(r,l,!1)):l>o&&(t="delete.forward",l=pl(r,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=pl(r,o,!1),a=pl(r,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:se.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(r.dispatch(n.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?de.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function pl(r,e,t){if(r instanceof de)for(let n of r.state.facet(de.atomicRanges).map(i=>i(r)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const F0=(r,e)=>fs(r,t=>{let n=t.from,{state:i}=r,s=i.doc.lineAt(n),o,a;if(!e&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(o=s.text.slice(0,n-s.from))){if(o[o.length-1]==" ")return n-1;let l=Zi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Ft(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,n-s.from))&&(a=Ft(s.text,a-s.from,!1,!1)+s.from);return a}),_u=r=>F0(r,!1),j0=r=>F0(r,!0),V0=(r,e)=>fs(r,t=>{let n=t.head,{state:i}=r,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let a=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let l=Ft(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=t.head)&&(a=u),n=l}return n}),W0=r=>V0(r,!1),W2=r=>V0(r,!0),$2=r=>fs(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),KD=r=>fs(r,e=>{let t=r.lineBlockAt(e.head).from;return e.head>t?t:Math.max(0,e.head-1)}),H2=r=>fs(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),z2=r=>fs(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),YD=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=[];for(let n=0,i="",s=r.doc.iter();;){if(s.next(),s.lineBreak||s.done){let o=i.search(/\s+$/);if(o>-1&&t.push({from:n-(i.length-o),to:n}),s.done)break;i=""}else i=s.value;n+=s.value.length}return t.length?(e(r.update({changes:t,userEvent:"delete"})),!0):!1},U2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Je.of(["",""])},range:se.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},G2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>{if(!n.empty||n.from==0||n.from==r.doc.length)return{range:n};let i=n.from,s=r.doc.lineAt(i),o=i==s.from?i-1:Ft(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ft(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:r.doc.slice(i,a).append(r.doc.slice(o,i))},range:se.cursor(a)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function gl(r){let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.from),s=r.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=r.doc.lineAt(n.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:i.from,to:s.to,ranges:[n]});t=s.number+1}return e}function $0(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let s of gl(r)){if(t?s.to==r.doc.length:s.from==0)continue;let o=r.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+r.lineBreak});for(let l of s.ranges)i.push(se.range(Math.min(r.doc.length,l.anchor+a),Math.min(r.doc.length,l.head+a)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:r.lineBreak+o.text});for(let l of s.ranges)i.push(se.range(l.anchor-a,l.head-a))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:se.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const K2=({state:r,dispatch:e})=>$0(r,e,!1),Y2=({state:r,dispatch:e})=>$0(r,e,!0);function H0(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of gl(r))t?n.push({from:i.from,insert:r.doc.slice(i.from,i.to)+r.lineBreak}):n.push({from:i.to,insert:r.lineBreak+r.doc.slice(i.from,i.to)});return e(r.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const J2=({state:r,dispatch:e})=>H0(r,e,!1),X2=({state:r,dispatch:e})=>H0(r,e,!0),Q2=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(gl(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=us(e.selection,i=>r.moveVertically(i,!0)).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},JD=({state:r,dispatch:e})=>(e(r.update(r.replaceSelection(r.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function Z2(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Lt(r).resolveInner(e),n=t.childBefore(e),i=t.childAfter(e),s;return n&&i&&n.to<=e&&i.from>=e&&(s=n.type.prop(Re.closedBy))&&s.indexOf(i.name)>-1&&r.doc.lineAt(n.to).from==r.doc.lineAt(i.from).from&&!/\S/.test(r.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const _2=z0(!1),q2=z0(!0);function z0(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!r&&s==o&&Z2(e,s);r&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new yo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=il(c,s);for(u==null&&(u=Zi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",as(e,u)];return l&&h.push(as(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Je.of(h)},range:se.cursor(s+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function qu(r,e){let t=-1;return r.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let a=r.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,i,n),t=a.number),o=a.to+1}let s=r.changes(i);return{changes:i,range:se.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const eE=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new yo(r,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=qu(r,(s,o,a)=>{let l=il(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=as(r,l);(c!=u||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(r.update(i,{userEvent:"indent"})),!0},ef=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(qu(r,(t,n)=>{n.push({from:t.from,insert:r.facet(nl)})}),{userEvent:"input.indent"})),!0),U0=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(qu(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Zi(i,r.tabSize),o=0,a=as(r,Math.max(0,s-Ai(r)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),XD=({state:r,dispatch:e})=>r.selection.ranges.some(t=>!t.empty)?ef({state:r,dispatch:e}):(e(r.update(r.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),tE=[{key:"Ctrl-b",run:h0,shift:A0,preventDefault:!0},{key:"Ctrl-f",run:d0,shift:C0},{key:"Ctrl-p",run:y0,shift:T0},{key:"Ctrl-n",run:b0,shift:P0},{key:"Ctrl-a",run:k2,shift:R2},{key:"Ctrl-e",run:A2,shift:L2},{key:"Ctrl-d",run:j0},{key:"Ctrl-h",run:_u},{key:"Ctrl-k",run:$2},{key:"Ctrl-Alt-h",run:W0},{key:"Ctrl-o",run:U2},{key:"Ctrl-t",run:G2},{key:"Ctrl-v",run:Zu}],rE=[{key:"ArrowLeft",run:h0,shift:A0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:p2,shift:O2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:w2,shift:D2,preventDefault:!0},{key:"ArrowRight",run:d0,shift:C0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:g2,shift:E2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:S2,shift:N2,preventDefault:!0},{key:"ArrowUp",run:y0,shift:T0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:N0,shift:L0},{mac:"Ctrl-ArrowUp",run:S0,shift:I0},{key:"ArrowDown",run:b0,shift:P0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:R0,shift:B0},{mac:"Ctrl-ArrowDown",run:Zu,shift:D0},{key:"PageUp",run:S0,shift:I0},{key:"PageDown",run:Zu,shift:D0},{key:"Home",run:x2,shift:I2,preventDefault:!0},{key:"Mod-Home",run:N0,shift:L0},{key:"End",run:b2,shift:M2,preventDefault:!0},{key:"Mod-End",run:R0,shift:B0},{key:"Enter",run:_2},{key:"Mod-a",run:B2},{key:"Backspace",run:_u,shift:_u},{key:"Delete",run:j0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:W0},{key:"Mod-Delete",mac:"Alt-Delete",run:W2},{mac:"Mod-Backspace",run:H2},{mac:"Mod-Delete",run:z2}].concat(tE.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),nE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:v2,shift:T2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:y2,shift:P2},{key:"Alt-ArrowUp",run:K2},{key:"Shift-Alt-ArrowUp",run:J2},{key:"Alt-ArrowDown",run:Y2},{key:"Shift-Alt-ArrowDown",run:X2},{key:"Escape",run:V2},{key:"Mod-Enter",run:q2},{key:"Alt-l",mac:"Ctrl-l",run:F2},{key:"Mod-i",run:j2,preventDefault:!0},{key:"Mod-[",run:U0},{key:"Mod-]",run:ef},{key:"Mod-Alt-\\",run:eE},{key:"Shift-Mod-k",run:Q2},{key:"Shift-Mod-\\",run:C2},{key:"Mod-/",run:XO},{key:"Alt-A",run:ZO}].concat(rE),iE={key:"Tab",run:ef,shift:U0};function rt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)G0(r,arguments[e]);return r}function G0(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)G0(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const K0=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class hs{constructor(e,t,n=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(n,i),this.bufferStart=n,this.normalize=s?a=>s(K0(a)):K0,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return jt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Tc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Lr(e);let i=this.normalize(t);for(let s=0,o=n;;s++){let a=i.charCodeAt(s),l=this.match(a,o);if(s==i.length-1){if(l)return this.value=l,this;break}o==n&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t){let n=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],o=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?n={from:this.matches[i+1],to:t+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:t,to:t+1}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}typeof Symbol<"u"&&(hs.prototype[Symbol.iterator]=function(){return this});const Y0={from:-1,to:-1,match:/.*/.exec("")},tf="gm"+(/x/.unicode==null?"":"u");class J0{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=Y0,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new X0(e,t,n,i,s);this.re=new RegExp(t,tf+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=ml(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=ml(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const rf=new WeakMap;class ds{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=rf.get(e);if(!i||i.from>=n||i.to<=t){let a=new ds(t,e.sliceString(t,n));return rf.set(e,a),a}if(i.from==t&&i.to==n)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<n&&(s+=e.sliceString(i.to,n)),rf.set(e,new ds(o,s)),new ds(t,s.slice(t-o,n-o))}}class X0{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=Y0,this.matchPos=ml(e,i),this.re=new RegExp(t,tf+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=ds.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,i=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this.matchPos=ml(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ds.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(J0.prototype[Symbol.iterator]=X0.prototype[Symbol.iterator]=function(){return this});function sE(r){try{return new RegExp(r,tf),!0}catch{return!1}}function ml(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function nf(r){let e=String(r.state.doc.lineAt(r.state.selection.main.head).number),t=rt("input",{class:"cm-textfield",name:"line",value:e}),n=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),r.dispatch({effects:vl.of(!1)}),r.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",r.state.phrase("Go to line"),": ",t)," ",rt("button",{class:"cm-button",type:"submit"},r.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=r,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,h]=s,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=se.cursor(m.from+Math.max(0,Math.min(d,m.length)));r.dispatch({effects:[vl.of(!1),de.scrollIntoView(y.from,{y:"center"})],selection:y}),r.focus()}return{dom:n}}const vl=Ae.define(),Q0=At.define({create(){return!0},update(r,e){for(let t of e.effects)t.is(vl)&&(r=t.value);return r},provide:r=>go.from(r,e=>e?nf:null)}),oE=r=>{let e=po(r,nf);if(!e){let t=[vl.of(!0)];r.state.field(Q0,!1)==null&&t.push(Ae.appendConfig.of([Q0,aE])),r.dispatch({effects:t}),e=po(r,nf)}return e&&e.dom.querySelector("input").select(),!0},aE=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),lE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Z0=pe.define({combine(r){return Ur(r,lE,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function cE(r){let e=[pE,dE];return r&&e.push(Z0.of(r)),e}const uE=ke.mark({class:"cm-selectionMatch"}),fE=ke.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function _0(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=at.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=at.Word)}function hE(r,e,t,n){return r(e.sliceDoc(t,t+1))==at.Word&&r(e.sliceDoc(n-1,n))==at.Word}const dE=ft.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(Z0),{state:t}=r,n=t.selection;if(n.ranges.length>1)return ke.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ke.none;let l=t.wordAt(i.head);if(!l)return ke.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ke.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(_0(o,t,i.from,i.to)&&hE(o,t,i.from,i.to)))return ke.none}else if(s=t.sliceDoc(i.from,i.to).trim(),!s)return ke.none}let a=[];for(let l of r.visibleRanges){let c=new hs(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||_0(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(fE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(uE.range(u,h)),a.length>e.maxMatches))return ke.none}}return ke.set(a)}},{decorations:r=>r.decorations}),pE=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),gE=({state:r,dispatch:e})=>{let{selection:t}=r,n=se.create(t.ranges.map(i=>r.wordAt(i.head)||se.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function mE(r,e){let{main:t,ranges:n}=r.selection,i=r.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new hs(r.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new hs(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(s){let l=r.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const vE=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return gE({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(s=>r.sliceDoc(s.from,s.to)!=n))return!1;let i=mE(r,n);return i?(e(r.update({selection:r.selection.addRange(se.range(i.from,i.to),!1),effects:de.scrollIntoView(i.to)})),!0):!1},Ci=pe.define({combine(r){return Ur(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new PE(e),scrollToMatch:e=>de.scrollIntoView(e)})}});function QD(r){return r?[Ci.of(r),cf]:cf}class q0{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||sE(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
153
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new wE(this):new bE(this)}getCursor(e,t=0,n){let i=e.doc?e:Ve.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?gs(this,i,t,n):ps(this,i,t,n)}}class ev{constructor(e){this.spec=e}}function ps(r,e,t,n){return new hs(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),r.wholeWord?yE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function yE(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(yl(i,t-s))!=at.Word||e(bl(i,t-s))!=at.Word)&&(e(bl(i,n-s))!=at.Word||e(yl(i,n-s))!=at.Word))}class bE extends ev{constructor(e){super(e)}nextMatch(e,t,n){let i=ps(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=ps(this.spec,e,0,t).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=ps(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=ps(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ps(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function gs(r,e,t,n){return new J0(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:r.wholeWord?xE(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function yl(r,e){return r.slice(Ft(r,e,!1),e)}function bl(r,e){return r.slice(e,Ft(r,e))}function xE(r){return(e,t,n)=>!n[0].length||(r(yl(n.input,n.index))!=at.Word||r(bl(n.input,n.index))!=at.Word)&&(r(bl(n.input,n.index+n[0].length))!=at.Word||r(yl(n.input,n.index+n[0].length))!=at.Word)}class wE extends ev{nextMatch(e,t,n){let i=gs(this.spec,e,n,e.doc.length).next();return i.done&&(i=gs(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),o=gs(this.spec,e,s,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t)}matchAll(e,t){let n=gs(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=gs(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Co=Ae.define(),sf=Ae.define(),gn=At.define({create(r){return new of(Sl(r).create(),null)},update(r,e){for(let t of e.effects)t.is(Co)?r=new of(t.value.create(),r.panel):t.is(sf)&&(r=new of(r.query,t.value?af:null));return r},provide:r=>go.from(r,e=>e.panel)});function ZD(r){let e=r.field(gn,!1);return e?e.query.spec:Sl(r)}function _D(r){var e;return((e=r.field(gn,!1))===null||e===void 0?void 0:e.panel)!=null}class of{constructor(e,t){this.query=e,this.panel=t}}const SE=ke.mark({class:"cm-searchMatch"}),kE=ke.mark({class:"cm-searchMatch cm-searchMatch-selected"}),AE=ft.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(gn))}update(r){let e=r.state.field(gn);(e!=r.startState.field(gn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return ke.none;let{view:t}=this,n=new Kn;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;r.highlight(t.state,a,l,(c,u)=>{let h=t.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,h?kE:SE)})}return n.finish()}},{decorations:r=>r.decorations});function Oo(r){return e=>{let t=e.state.field(gn,!1);return t&&t.query.spec.valid?r(e,t):iv(e)}}const xl=Oo((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=se.single(n.from,n.to),s=r.state.facet(Ci);return r.dispatch({selection:i,effects:[lf(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),nv(r),!0}),wl=Oo((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=se.single(i.from,i.to),o=r.state.facet(Ci);return r.dispatch({selection:s,effects:[lf(r,i),o.scrollToMatch(s.main,r)],userEvent:"select.search"}),nv(r),!0}),CE=Oo((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:se.create(t.map(n=>se.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),OE=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:i}=t.main,s=[],o=0;for(let a=new hs(r.doc,r.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(se.range(a.value.from,a.value.to))}return e(r.update({selection:se.create(s,o),userEvent:"select.search.matches"})),!0},tv=Oo((r,{query:e})=>{let{state:t}=r,{from:n,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let o=[],a,l,c=[];if(s.from==n&&s.to==i&&(l=t.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(t,s.from,s.to),c.push(de.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=se.single(s.from-u,s.to-u),c.push(lf(r,s)),c.push(t.facet(Ci).scrollToMatch(a.main,r))}return r.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),EE=Oo((r,{query:e})=>{if(r.state.readOnly)return!1;let t=e.matchAll(r.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:de.announce.of(n),userEvent:"input.replace.all"}),!0});function af(r){return r.state.facet(Ci).createPanel(r)}function Sl(r,e){var t,n,i,s,o;let a=r.selection.main,l=a.empty||a.to>a.from+100?"":r.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=r.facet(Ci);return new q0({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function rv(r){let e=po(r,af);return e&&e.dom.querySelector("[main-field]")}function nv(r){let e=rv(r);e&&e==r.root.activeElement&&e.select()}const iv=r=>{let e=r.state.field(gn,!1);if(e&&e.panel){let t=rv(r);if(t&&t!=r.root.activeElement){let n=Sl(r.state,e.query.spec);n.valid&&r.dispatch({effects:Co.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[sf.of(!0),e?Co.of(Sl(r.state,e.query.spec)):Ae.appendConfig.of(cf)]});return!0},sv=r=>{let e=r.state.field(gn,!1);if(!e||!e.panel)return!1;let t=po(r,af);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:sf.of(!1)}),!0},TE=[{key:"Mod-f",run:iv,scope:"editor search-panel"},{key:"F3",run:xl,shift:wl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xl,shift:wl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:sv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:OE},{key:"Mod-Alt-g",run:oE},{key:"Mod-d",run:vE,preventDefault:!0}];class PE{constructor(e){this.view=e;let t=this.query=e.state.field(gn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Ar(e,"Find"),"aria-label":Ar(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:t.replace,placeholder:Ar(e,"Replace"),"aria-label":Ar(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>xl(e),[Ar(e,"next")]),n("prev",()=>wl(e),[Ar(e,"previous")]),n("select",()=>CE(e),[Ar(e,"all")]),rt("label",null,[this.caseField,Ar(e,"match case")]),rt("label",null,[this.reField,Ar(e,"regexp")]),rt("label",null,[this.wordField,Ar(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>tv(e),[Ar(e,"replace")]),n("replaceAll",()=>EE(e),[Ar(e,"replace all")])],rt("button",{name:"close",onclick:()=>sv(e),"aria-label":Ar(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new q0({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:Co.of(e)}))}keydown(e){QA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?wl:xl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),tv(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Co)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ci).top}}function Ar(r,e){return r.state.phrase(e)}const kl=30,Al=/[\s\.,:;?!]/;function lf(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),i=r.state.doc.lineAt(t).to,s=Math.max(n.from,e-kl),o=Math.min(i,t+kl),a=r.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<kl;l++)if(!Al.test(a[l+1])&&Al.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-kl;l--)if(!Al.test(a[l-1])&&Al.test(a[l])){a=a.slice(0,l);break}}return de.announce.of(`${r.state.phrase("current match")}. ${a} ${r.state.phrase("on line")} ${n.number}.`)}const ME=de.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),cf=[gn,xi.low(AE),ME];class ov{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Lt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(cv(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function av(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function IE(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let n=av(e)+av(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function DE(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:IE(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function qD(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return e(t);if(n.type.isTop)break}return null}}function e3(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class lv{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ni(r){return r.selection.main.from}function cv(r,e){var t;let{source:n}=r,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?r:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}const uv=an.define();function NE(r,e,t,n){let{main:i}=r.selection,s=t-i.from,o=n-i.from;return Object.assign(Object.assign({},r.changeByRange(a=>a!=i&&t!=n&&r.sliceDoc(a.from+s,a.from+o)!=r.sliceDoc(t,n)?{range:a}:{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:e},range:se.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const fv=new WeakMap;function RE(r){if(!Array.isArray(r))return r;let e=fv.get(r);return e||fv.set(r,e=DE(r)),e}const uf=Ae.define(),Eo=Ae.define();class LE{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=jt(e,t),i=Lr(n);this.chars.push(n);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(jt(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:t,folded:n,any:i,precise:s,byWord:o}=this;if(t.length==1){let T=jt(e,0),E=Lr(T),F=E==e.length?0:-100;if(T!=t[0])if(T==n[0])F+=-200;else return!1;return this.ret(F,[0,E])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let T=0,E=Math.min(e.length,200);T<E&&c<l;){let F=jt(e,T);(F==t[c]||F==n[c])&&(i[c++]=T),T+=Lr(F)}if(c<l)return!1}let u=0,h=0,d=!1,p=0,m=-1,y=-1,w=/[a-z]/.test(e),A=!0;for(let T=0,E=Math.min(e.length,200),F=0;T<E&&h<l;){let I=jt(e,T);a<0&&(u<l&&I==t[u]&&(s[u++]=T),p<l&&(I==t[p]||I==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let W,j=I<255?I>=48&&I<=57||I>=97&&I<=122?2:I>=65&&I<=90?1:0:(W=Tc(I))!=W.toLowerCase()?1:W!=W.toUpperCase()?2:0;(!T||j==1&&w||F==0&&j!=0)&&(t[h]==I||n[h]==I&&(d=!0)?o[h++]=T:o.length&&(A=!1)),F=j,T+=Lr(I)}return h==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-200+-700-e.length,[m,y]):h==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,e):t.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],s=0;for(let o of t){let a=o+(this.astral?Lr(jt(n,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-n.length,i)}}const Zt=pe.define({combine(r){return Ur(r,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:BE,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>hv(e(n),t(n)),optionClass:(e,t)=>n=>hv(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function hv(r,e){return r?e?r+" "+e:r:e}function BE(r,e,t,n,i,s){let o=r.textDirection==ht.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,p=i.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&d<Math.min(m,p)?a=!1:!a&&p<Math.min(m,d)&&(a=!0),m<=(a?d:p))u=Math.max(i.top,Math.min(t.top,i.bottom-y))-e.top,h=Math.min(400,a?d:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=y||T>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let w=(e.bottom-e.top)/s.offsetHeight,A=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${h/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function FE(r){let e=r.addToOptions.slice();return r.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,h))),d.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function ff(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let n=Math.floor((r-e)/t);return{from:r-(n+1)*t,to:r-n*t}}class jE{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Zt);this.optionContent=FE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=ff(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Zt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Eo.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:o,disabled:a}=n.open;(!i.open||i.open.options!=s)&&(this.range=ff(s.length,o,e.state.facet(Zt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ff(t.options.length,t.selected,this.view.state.facet(Zt).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>br(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&WE(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=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,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Zt).positionInfo(this.view,t,i,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let p=d(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function VE(r,e){return t=>new jE(t,r,e)}function WE(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.height/r.offsetHeight;n.top<t.top?r.scrollTop-=(t.top-n.top)/i:n.bottom>t.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/i)}function dv(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function $E(r,e){let t=[],n=null,i=l=>{t.push(l);let{section:c}=l.completion;if(c){n||(n=[]);let u=typeof c=="string"?c:c.name;n.some(h=>h.name==u)||n.push(typeof c=="string"?{name:u}:c)}};for(let l of r)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let u of l.result.options)i(new lv(u,l.source,c?c(u):[],1e9-t.length));else{let u=new LE(e.sliceDoc(l.from,l.to));for(let h of l.result.options)if(u.match(h.label)){let d=h.displayLabel?c?c(h,u.matched):[]:u.matched;i(new lv(h,l.source,d,u.score+(h.boost||0)))}}}if(n){let l=Object.create(null),c=0,u=(h,d)=>{var p,m;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(h.name<d.name?-1:1)};for(let h of n.sort(u))c-=1e5,l[h.name]=c;for(let h of t){let{section:d}=h.completion;d&&(h.score+=l[typeof d=="string"?d:d.name])}}let s=[],o=null,a=e.facet(Zt).compareCompletions;for(let l of t.sort((c,u)=>u.score-c.score||a(c.completion,u.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?s.push(l):dv(l.completion)>dv(o)&&(s[s.length-1]=l),o=l.completion}return s}class ms{constructor(e,t,n,i,s,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ms(this.options,pv(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s){let o=$E(e,t);if(!o.length)return i&&e.some(l=>l.state==1)?new ms(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=t.facet(Zt).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new ms(o,pv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:KE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new ms(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Cl{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Cl(UE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Zt),s=(n.override||t.languageDataAt("autocomplete",ni(t)).map(RE)).map(a=>(this.active.find(c=>c.source==a)||new cr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!HE(s,this.active)?o=ms.build(s,t,this.id,o,n):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new cr(a.source,0):a));for(let a of e.effects)a.is(df)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new Cl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:zE}}function HE(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t<r.length&&!r[t].hasResult;)t++;for(;n<e.length&&!e[n].hasResult;)n++;let i=t==r.length,s=n==e.length;if(i||s)return i==s;if(r[t++].result!=e[n++].result)return!1}}const zE={"aria-autocomplete":"list"};function pv(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const UE=[];function hf(r){return r.isUserEvent("input.type")?"input":r.isUserEvent("delete.backward")?"delete":null}class cr{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=hf(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new cr(i.source,0));for(let s of e.effects)if(s.is(uf))i=new cr(i.source,1,s.value?ni(e.state):-1);else if(s.is(Eo))i=new cr(i.source,0);else if(s.is(gv))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,t,n){return t=="delete"||!n.activateOnTyping?this.map(e.changes):new cr(this.source,1)}handleChange(e){return e.changes.touchesRange(ni(e.startState))?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new cr(this.source,this.state,e.mapPos(this.explicitPos))}}class vs extends cr{constructor(e,t,n,i,s){super(e,2,t),this.result=n,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,t,n){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ni(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||t=="delete"&&ni(e.startState)==this.from)return new cr(this.source,t=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return GE(this.result.validFor,e.state,s,o)?new vs(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new ov(e.state,a,l>=0)))?new vs(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ni(e.state)):new cr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new vs(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function GE(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):cv(r,!0).test(i)}const gv=Ae.define({map(r,e){return r.map(t=>t.map(e))}}),df=Ae.define(),$t=At.define({create(){return Cl.start()},update(r,e){return r.update(e)},provide:r=>[Za.from(r,e=>e.tooltip),de.contentAttributes.from(r,e=>e.attrs)]});function mv(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field($t).active.find(i=>i.source==e.source);return n instanceof vs?(typeof t=="string"?r.dispatch(Object.assign(Object.assign({},NE(r.state,t,n.from,n.to)),{annotations:uv.of(e.completion)})):t(r,e.completion,n.from,n.to),!0):!1}const KE=VE($t,mv);function Ol(r,e="option"){return t=>{let n=t.state.field($t,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Zt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=bm(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(r?1:-1):r?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:df.of(a)}),!0}}const YE=r=>{let e=r.state.field($t,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(Zt).interactionDelay?!1:mv(r,e.open.options[e.open.selected])},JE=r=>r.state.field($t,!1)?(r.dispatch({effects:uf.of(!0)}),!0):!1,XE=r=>{let e=r.state.field($t,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:Eo.of(null)}),!0)};class QE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ZE=50,_E=1e3,qE=ft.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of r.state.field($t).active)e.state==1&&this.startQuery(e)}update(r){let e=r.state.field($t);if(!r.selectionSet&&!r.docChanged&&r.startState.field($t)==e)return;let t=r.transactions.some(n=>(n.selection||n.docChanged)&&!hf(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(t||i.updates.length+r.transactions.length>ZE&&Date.now()-i.time>_E){for(let s of i.context.abortListeners)try{s()}catch(o){br(this.view.state,o)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...r.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(i=>i.active.source==n.source))?setTimeout(()=>this.startUpdate(),50):-1,this.composing!=0)for(let n of r.transactions)hf(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:r}=this.view,e=r.field($t);for(let t of e.active)t.state==1&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t)}startQuery(r){let{state:e}=this.view,t=ni(e),n=new ov(e,t,r.explicitPos==t),i=new QE(r,n);this.running.push(i),Promise.resolve(r.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Eo.of(null)}),br(this.view.state,s)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Zt);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;if(this.running.splice(n--,1),i.done){let o=new vs(i.active.source,i.active.explicitPos,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:ni(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field($t).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new cr(i.active.source,0);for(let a of i.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:gv.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field($t,!1);if(e&&e.tooltip&&this.view.state.facet(Zt).closeOnBlur){let t=e.open&&bm(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&this.view.dispatch({effects:Eo.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:uf.of(!1)}),20),this.composing=0}}}),vv=de.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class eT{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class pf{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return t==null||n==null?null:new pf(this.field,t,n)}}class gf{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(indentUnit);i.push(t+c.length-u),l=c+l.slice(u)}n.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new pf(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1;for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:l&&t[u].name==l)&&(c=u);if(c<0){let u=0;for(;u<t.length&&(a==null||t[u].seq!=null&&t[u].seq<a);)u++;t.splice(u,0,{seq:a,name:l}),c=u;for(let h of i)h.field>=c&&h.field++}i.push(new eT(c,n.length,s.index,s.index+l.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of i)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(o)}return new gf(n,i)}}let tT=ke.widget({widget:new class extends ln{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),rT=ke.mark({class:"cm-snippetField"});class ys{constructor(e,t){this.ranges=e,this.active=t,this.deco=ke.set(e.map(n=>(n.from==n.to?tT:rT).range(n.from,n.to)))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new ys(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const To=Ae.define({map(r,e){return r&&r.map(e)}}),nT=Ae.define(),Oi=At.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(To))return t.value;if(t.is(nT)&&r)return new ys(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>de.decorations.from(r,e=>e?e.deco:ke.none)});function mf(r,e){return se.create(r.filter(t=>t.field==e).map(t=>se.range(t.from,t.to)))}function iT(r){let e=gf.parse(r);return(t,n,i,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,i),l={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?uv.of(n):void 0};if(a.length&&(l.selection=mf(a,0)),a.length>1){let c=new ys(a,0),u=l.effects=[To.of(c)];t.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,cT,uT,vv]))}t.dispatch(t.state.update(l))}}function yv(r){return({state:e,dispatch:t})=>{let n=e.field(Oi,!1);if(!n||r<0&&n.active==0)return!1;let i=n.active+r,s=r>0&&!n.ranges.some(o=>o.field==i+r);return t(e.update({selection:mf(n.ranges,i),effects:To.of(s?null:new ys(n.ranges,i)),scrollIntoView:!0})),!0}}const sT=({state:r,dispatch:e})=>r.field(Oi,!1)?(e(r.update({effects:To.of(null)})),!0):!1,oT=yv(1),aT=yv(-1);function t3(r){let e=r.field(Oi,!1);return!!(e&&e.ranges.some(t=>t.field==e.active+1))}function r3(r){let e=r.field(Oi,!1);return!!(e&&e.active>0)}const lT=[{key:"Tab",run:oT,shift:aT},{key:"Escape",run:sT}],bv=pe.define({combine(r){return r.length?r[0]:lT}}),cT=xi.highest(lo.compute([bv],r=>r.facet(bv)));function n3(r,e){return Object.assign(Object.assign({},e),{apply:iT(r)})}const uT=de.domEventHandlers({mousedown(r,e){let t=e.state.field(Oi,!1),n;if(!t||(n=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==t.active?!1:(e.dispatch({selection:mf(t.ranges,i.field),effects:To.of(t.ranges.some(s=>s.field>i.field)?new ys(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});function fT(r){let e=r.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function xv(r,e){return new RegExp(e(r.source),r.unicode?"u":"")}const wv=null;function hT(r){return wv[r]||(wv[r]=new WeakMap)}function Sv(r,e,t,n,i){for(let s=r.iterLines(),o=0;!s.next().done;){let{value:a}=s,l;for(e.lastIndex=0;l=e.exec(a);)if(!n[l[0]]&&o+l.index!=i&&(t.push({type:"text",label:l[0]}),n[l[0]]=!0,t.length>=2e3))return;o+=a.length+1}}function kv(r,e,t,n,i){let s=r.length>=1e3,o=s&&e.get(r);if(o)return o;let a=[],l=Object.create(null);if(r.children){let c=0;for(let u of r.children){if(u.length>=1e3)for(let h of kv(u,e,t,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else Sv(u,t,a,l,i-c);c+=u.length+1}}else Sv(r,t,a,l,i);return s&&a.length<2e3&&e.set(r,a),a}const i3=r=>{let e=r.state.languageDataAt("wordChars",r.pos).join(""),t=fT(e),n=r.matchBefore(xv(t,o=>o+"$"));if(!n&&!r.explicit)return null;let i=n?n.from:r.pos,s=kv(r.state.doc,hT(e),t,5e4,i);return{from:i,options:s,validFor:xv(t,o=>"^"+o)}},Po={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(r,e){let t=e.mapPos(r,-1,ir.TrackAfter);return t??void 0}}),vf=new class extends wi{};vf.startSide=1,vf.endSide=-1;const Av=At.define({create(){return Xe.empty},update(r,e){if(r=r.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);r=r.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(Ei)&&(r=r.update({add:[vf.range(t.value,t.value+1)]}));return r}});function dT(){return[gT,Av]}const yf="()[]{}<>";function Cv(r){for(let e=0;e<yf.length;e+=2)if(yf.charCodeAt(e)==r)return yf.charAt(e+1);return Tc(r<128?r:r+1)}function Ov(r,e){return r.languageDataAt("closeBrackets",e)[0]||Po}const pT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),gT=de.inputHandler.of((r,e,t,n)=>{if((pT?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Lr(jt(n,0))==1||e!=i.from||t!=i.to)return!1;let s=vT(r.state,n);return s?(r.dispatch(s),!0):!1}),mT=[{key:"Backspace",run:({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Ov(r,r.selection.main.head).brackets||Po.brackets,i=null,s=r.changeByRange(o=>{if(o.empty){let a=yT(r.doc,o.head);for(let l of n)if(l==a&&El(r.doc,o.head)==Cv(jt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:se.cursor(o.head-l.length)}}return{range:i=o}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function vT(r,e){let t=Ov(r,r.selection.main.head),n=t.brackets||Po.brackets;for(let i of n){let s=Cv(jt(i,0));if(e==i)return s==i?wT(r,i,n.indexOf(i+i+i)>-1,t):bT(r,i,s,t.before||Po.before);if(e==s&&Ev(r,r.selection.main.from))return xT(r,i,s)}return null}function Ev(r,e){let t=!1;return r.field(Av).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function El(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Lr(jt(t,0)))}function yT(r,e){let t=r.sliceString(e-2,e);return Lr(jt(t,0))==t.length?t:t.slice(1)}function bT(r,e,t,n){let i=null,s=r.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ei.of(o.to+e.length),range:se.range(o.anchor+e.length,o.head+e.length)};let a=El(r.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Ei.of(o.head+e.length),range:se.cursor(o.head+e.length)}:{range:i=o}});return i?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function xT(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&El(r.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:se.cursor(s.head+t.length)}:n={range:s});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function wT(r,e,t,n){let i=n.stringPrefixes||Po.stringPrefixes,s=null,o=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ei.of(a.to+e.length),range:se.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=El(r.doc,l),u;if(c==e){if(Tv(r,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(Ev(r,l)){let d=t&&r.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:se.cursor(l+d.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(u=Pv(r,l-2*e.length,i))>-1&&Tv(r,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(r.charCategorizer(l)(c)!=at.Word&&Pv(r,l,i)>-1&&!ST(r,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)}}return{range:s=a}});return s?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Tv(r,e){let t=Lt(r).resolveInner(e+1);return t.parent&&t.from==e}function ST(r,e,t,n){let i=Lt(r).resolveInner(e,-1),s=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+l;){if(r.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Pv(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=at.Word)return e;for(let i of t){let s=e-i.length;if(r.sliceDoc(s,e)==i&&n(r.sliceDoc(s-1,s))!=at.Word)return s}return-1}function kT(r={}){return[$t,Zt.of(r),qE,AT,vv]}const Mv=[{key:"Ctrl-Space",run:JE},{key:"Escape",run:XE},{key:"ArrowDown",run:Ol(!0)},{key:"ArrowUp",run:Ol(!1)},{key:"PageDown",run:Ol(!0,"page")},{key:"PageUp",run:Ol(!1,"page")},{key:"Enter",run:YE}],AT=xi.highest(lo.computeN([Zt],r=>r.facet(Zt).defaultKeymap?[Mv]:[]));function o3(r){let e=r.field($t,!1);return e&&e.active.some(t=>t.state==1)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}const Iv=new WeakMap;function a3(r){var e;let t=(e=r.field($t,!1))===null||e===void 0?void 0:e.open;if(!t||t.disabled)return[];let n=Iv.get(t.options);return n||Iv.set(t.options,n=t.options.map(i=>i.completion)),n}function l3(r){var e;let t=(e=r.field($t,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.options[t.selected].completion:null}function c3(r){var e;let t=(e=r.field($t,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.selected:null}function u3(r){return df.of(r)}class CT{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ti{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,s=n.facet(Pi).markerFilter;s&&(i=s(i));let o=ke.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?ke.widget({widget:new NT(a),diagnostic:a}).range(a.from):ke.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ti(o,t,bs(o))}}function bs(r,e=null,t=0){let n=null;return r.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new CT(i,s,o.diagnostic),!1}),n}function Dv(r,e){let t=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(n=>n.is(Tl))||r.changes.touchesRange(t.from,t.to))}function Nv(r,e){return r.field(_t,!1)?e:e.concat(Ae.appendConfig.of(Uv))}function OT(r,e){return{effects:Nv(r,[Tl.of(e)])}}const Tl=Ae.define(),bf=Ae.define(),Rv=Ae.define(),_t=At.define({create(){return new Ti(ke.none,null,null)},update(r,e){if(e.docChanged){let t=r.diagnostics.map(e.changes),n=null;if(r.selected){let i=e.changes.mapPos(r.selected.from,1);n=bs(t,r.selected.diagnostic,i)||bs(t,null,i)}r=new Ti(t,r.panel,n)}for(let t of e.effects)t.is(Tl)?r=Ti.init(t.value,r.panel,e.state):t.is(bf)?r=new Ti(r.diagnostics,t.value?Pl.open:null,r.selected):t.is(Rv)&&(r=new Ti(r.diagnostics,r.panel,t.value));return r},provide:r=>[go.from(r,e=>e.panel),de.decorations.from(r,e=>e.diagnostics)]});function f3(r){let e=r.field(_t,!1);return e?e.diagnostics.size:0}const ET=ke.mark({class:"cm-lintRange cm-lintRange-active"});function TT(r,e,t){let{diagnostics:n}=r.state.field(_t),i=[],s=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=r.state.facet(Pi).tooltipFilter;return a&&(i=a(i)),i.length?{pos:s,end:o,above:r.state.doc.lineAt(s).to<o,create(){return{dom:Lv(r,i)}}}:null}function Lv(r,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>Vv(r,t,!1)))}const PT=r=>{let e=r.state.field(_t,!1);(!e||!e.panel)&&r.dispatch({effects:Nv(r.state,[bf.of(!0)])});let t=po(r,Pl.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Bv=r=>{let e=r.state.field(_t,!1);return!e||!e.panel?!1:(r.dispatch({effects:bf.of(!1)}),!0)},MT=r=>{let e=r.state.field(_t,!1);if(!e)return!1;let t=r.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(r.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},h3=r=>{let{state:e}=r,t=e.field(_t,!1);if(!t)return!1;let n=e.selection.main,i,s,o,a;return t.diagnostics.between(0,e.doc.length,(l,c)=>{c<n.to&&(i==null||i<l)&&(i=l,s=c),(o==null||l>o)&&(o=l,a=c)}),o==null||i==null&&o==n.from?!1:(r.dispatch({selection:{anchor:i??o,head:s??a},scrollIntoView:!0}),!0)},IT=[{key:"Mod-Shift-m",run:PT,preventDefault:!0},{key:"F8",run:MT}],Fv=ft.fromClass(class{constructor(r){this.view=r,this.timeout=-1,this.set=!0;let{delay:e}=r.state.facet(Pi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let r=Date.now();if(r<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-r);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(Pi);Promise.all(t.map(n=>Promise.resolve(n(this.view)))).then(n=>{let i=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(OT(this.view.state,i))},n=>{br(this.view.state,n)})}}update(r){let e=r.state.facet(Pi);(r.docChanged||e!=r.startState.facet(Pi)||e.needsRefresh&&e.needsRefresh(r))&&(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)}}),Pi=pe.define({combine(r){return Object.assign({sources:r.map(e=>e.source)},Ur(r.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function DT(r,e={}){return[Pi.of({source:r,config:e}),Fv,Uv]}function d3(r){let e=r.plugin(Fv);e&&e.force()}function jv(r){let e=[];if(r)e:for(let{name:t}of r){for(let n=0;n<t.length;n++){let i=t[n];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Vv(r,e,t){var n;let i=t?jv(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=bs(r.state.field(_t).diagnostics,e);p&&s.apply(r,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),rt("u",c.slice(u,u+1)),c.slice(u+1)];return rt("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class NT extends ln{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Wv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Vv(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Pl{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Bv(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=jv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=bs(this.view.state.field(_t).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},n=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Bv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(_t).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(_t),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==l.diagnostic){c=h;break}c<0?(u=new Wv(this.view,l.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),i=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Wv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(_t),n=bs(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Rv.of(n)})}static open(e){return new Pl(e)}}function Ml(r,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(r)}</svg>')`}function Il(r){return Ml(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${r}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const RT=de.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Il("#d11")},".cm-lintRange-warning":{backgroundImage:Il("orange")},".cm-lintRange-info":{backgroundImage:Il("#999")},".cm-lintRange-hint":{backgroundImage:Il("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $v(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}class LT extends fn{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>$v(t)<$v(n.severity)?n.severity:t,"hint")}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(Dl).tooltipFilter;return i&&(n=i(n)),n.length&&(t.onmouseover=()=>FT(e,t,n)),t}}function BT(r,e){let t=n=>{let i=e.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(zv)&&r.dispatch({effects:xf.of(null)})}};window.addEventListener("mousemove",t)}function FT(r,e,t){function n(){let o=r.elementAtHeight(e.getBoundingClientRect().top+5-r.documentTop);r.coordsAtPos(o.from)&&r.dispatch({effects:xf.of({pos:o.from,above:!1,create(){return{dom:Lv(r,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,BT(r,e)}let{hoverTime:i}=r.state.facet(Dl),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function jT(r,e){let t=Object.create(null);for(let i of e){let s=r.lineAt(i.from);(t[s.from]||(t[s.from]=[])).push(i)}let n=[];for(let i in t)n.push(new LT(t[i]).range(+i));return Xe.of(n,!0)}const VT=Sm({class:"cm-gutter-lint",markers:r=>r.state.field(Hv)}),Hv=At.define({create(){return Xe.empty},update(r,e){r=r.map(e.changes);let t=e.state.facet(Dl).markerFilter;for(let n of e.effects)if(n.is(Tl)){let i=n.value;t&&(i=t(i||[])),r=jT(e.state.doc,i.slice(0))}return r}}),xf=Ae.define(),zv=At.define({create(){return null},update(r,e){return r&&e.docChanged&&(r=Dv(e,r)?null:Object.assign(Object.assign({},r),{pos:e.changes.mapPos(r.pos)})),e.effects.reduce((t,n)=>n.is(xf)?n.value:t,r)},provide:r=>Za.from(r)}),WT=de.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Ml('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Ml('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Ml('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Uv=[_t,de.decorations.compute([_t],r=>{let{selected:e,panel:t}=r.field(_t);return!e||!t||e.from==e.to?ke.none:ke.set([ET.range(e.from,e.to)])}),FC(TT,{hideOn:Dv}),RT],Dl=pe.define({combine(r){return Ur(r,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function p3(r={}){return[Dl.of(r),Hv,VT,WT,zv]}function g3(r,e){let t=r.field(_t,!1);if(t&&t.diagnostics.size)for(let n=RangeSet.iter([t.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}var Gv=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(mT)),e.defaultKeymap!==!1&&(n=n.concat(nE)),e.searchKeymap!==!1&&(n=n.concat(TE)),e.historyKeymap!==!1&&(n=n.concat(d2)),e.foldKeymap!==!1&&(n=n.concat(xO)),e.completionKeymap!==!1&&(n=n.concat(Mv)),e.lintKeymap!==!1&&(n=n.concat(IT));var i=[];return e.lineNumbers!==!1&&i.push(GC()),e.highlightActiveLineGutter!==!1&&i.push(JC()),e.highlightSpecialChars!==!1&&i.push(hC()),e.history!==!1&&i.push(i2()),e.foldGutter!==!1&&i.push(AO()),e.drawSelection!==!1&&i.push(rC()),e.dropCursor!==!1&&i.push(aC()),e.allowMultipleSelections!==!1&&i.push(Ve.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(cO()),e.syntaxHighlighting!==!1&&i.push(ju(TO,{fallback:!0})),e.bracketMatching!==!1&&i.push(RO()),e.closeBrackets!==!1&&i.push(dT()),e.autocompletion!==!1&&i.push(kT()),e.rectangularSelection!==!1&&i.push(OC()),t!==!1&&i.push(PC()),e.highlightActiveLine!==!1&&i.push(yC()),e.highlightSelectionMatches!==!1&&i.push(cE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(nl.of(" ".repeat(e.tabSize))),i.concat([lo.of(n.flat())]).filter(Boolean)},m3=function(e){e===void 0&&(e={});var t=[];e.defaultKeymap!==!1&&(t=t.concat(defaultKeymap)),e.historyKeymap!==!1&&(t=t.concat(historyKeymap));var n=[];return e.highlightSpecialChars!==!1&&n.push(highlightSpecialChars()),e.history!==!1&&n.push(history()),e.drawSelection!==!1&&n.push(drawSelection()),e.syntaxHighlighting!==!1&&n.push(syntaxHighlighting(defaultHighlightStyle,{fallback:!0})),n.concat([keymap.of(t.flat())]).filter(Boolean)};const Kv="#e5c07b",wf="#e06c75",Yv="#56b6c2",Jv="#ffffff",Mo="#abb2bf",Nl="#7d8799",Xv="#61afef",Qv="#98c379",Sf="#d19a66",Zv="#c678dd",_v="#21252b",kf="#2c313a",Af="#282c34",Rl="#353a42",qv="#3E4451",Cf="#528bff",v3={chalky:Kv,coral:wf,cyan:Yv,invalid:Jv,ivory:Mo,stone:Nl,malibu:Xv,sage:Qv,whiskey:Sf,violet:Zv,darkBackground:_v,highlightBackground:kf,background:Af,tooltipBackground:Rl,selection:qv,cursor:Cf},$T=de.theme({"&":{color:Mo,backgroundColor:Af},".cm-content":{caretColor:Cf},".cm-cursor, .cm-dropCursor":{borderLeftColor:Cf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:qv},".cm-panels":{backgroundColor:_v,color:Mo},".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:Af,color:Nl,border:"none"},".cm-activeLineGutter":{backgroundColor:kf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Rl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Rl,borderBottomColor:Rl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:kf,color:Mo}}},{dark:!0}),HT=cs.define([{tag:M.keyword,color:Zv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:wf},{tag:[M.function(M.variableName),M.labelName],color:Xv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:Sf},{tag:[M.definition(M.name),M.separator],color:Mo},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Kv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:Yv},{tag:[M.meta,M.comment],color:Nl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Nl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:wf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:Sf},{tag:[M.processingInstruction,M.string,M.inserted],color:Qv},{tag:M.invalid,color:Jv}]),zT=[$T,ju(HT)];var UT=de.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),GT=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(t&&l.unshift(lo.of([iE])),a&&(typeof a=="boolean"?l.unshift(Gv()):l.unshift(Gv(a))),o&&l.unshift(SC(o)),s){case"light":l.push(UT);break;case"dark":l.push(zT);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(de.editable.of(!1)),i&&l.push(Ve.readOnly.of(!0)),[...l]},KT=r=>({line:r.state.doc.lineAt(r.state.selection.main.from),lineCount:r.state.doc.lines,lineBreak:r.state.lineBreak,length:r.state.doc.length,readOnly:r.state.readOnly,tabSize:r.state.tabSize,selection:r.state.selection,selectionAsSingle:r.state.selection.asSingle().main,ranges:r.state.selection.ranges,selectionCode:r.state.sliceDoc(r.state.selection.main.from,r.state.selection.main.to),selections:r.state.selection.ranges.map(e=>r.state.sliceDoc(e.from,e.to)),selectedText:r.state.selection.ranges.some(e=>!e.empty)}),ey=an.define(),YT=[];function JT(r){var{value:e,selection:t,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=YT,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:y=null,placeholder:w="",editable:A=!0,readOnly:T=!1,indentWithTab:E=!0,basicSetup:F=!0,root:I,initialState:W}=r,[j,Q]=(0,S.useState)(),[B,U]=(0,S.useState)(),[G,re]=(0,S.useState)(),ce=de.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),he=de.updateListener.of(we=>{if(we.docChanged&&typeof n=="function"&&!we.transactions.some(Ie=>Ie.annotation(ey))){var Ee=we.state.doc,Ue=Ee.toString();n(Ue,we)}i&&i(KT(we))}),xe=GT({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:E,basicSetup:F}),Fe=[he,ce,...xe];return o&&typeof o=="function"&&Fe.push(de.updateListener.of(o)),Fe=Fe.concat(a),(0,S.useEffect)(()=>{if(j&&!G){var we={doc:e,selection:t,extensions:Fe},Ee=W?Ve.fromJSON(W.json,we,W.fields):Ve.create(we);if(re(Ee),!B){var Ue=new de({state:Ee,parent:j,root:I});U(Ue),s&&s(Ue,Ee)}}return()=>{B&&(re(void 0),U(void 0))}},[j,G]),(0,S.useEffect)(()=>Q(r.container),[r.container]),(0,S.useEffect)(()=>()=>{B&&(B.destroy(),U(void 0))},[B]),(0,S.useEffect)(()=>{l&&B&&B.focus()},[l,B]),(0,S.useEffect)(()=>{B&&B.dispatch({effects:Ae.reconfigure.of(Fe)})},[c,a,u,h,d,p,m,y,w,A,T,E,F,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var we=B?B.state.doc.toString():"";B&&e!==we&&B.dispatch({changes:{from:0,to:we.length,insert:e||""},annotations:[ey.of(!0)]})}},[e,B]),{state:G,setState:re,view:B,setView:U,container:j,setContainer:Q}}var XT=f(97458),QT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],ty=(0,S.forwardRef)((r,e)=>{var{className:t,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:F,editable:I,readOnly:W,root:j,initialState:Q}=r,B=JO(r,QT),U=(0,S.useRef)(null),{state:G,view:re,container:ce}=JT({container:U.current,root:j,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:F,editable:I,readOnly:W,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:Q});if((0,S.useImperativeHandle)(e,()=>({editor:U.current,state:G,view:re}),[U,ce,G,re]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var he=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,XT.jsx)("div",Uu({ref:U,className:""+he+(t?" "+t:"")},B))});ty.displayName="CodeMirror";const ZT=ty,_T=(0,Ye.ZP)(ZT)`
|
|
154
154
|
display: flex;
|
|
155
155
|
flex-direction: column;
|
|
156
156
|
justify-content: flex-start;
|
|
@@ -201,34 +201,34 @@
|
|
|
201
201
|
background: none;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
`;function
|
|
205
|
-
`;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:var
|
|
206
|
-
`),a++,c=n,o=14;switch(E){case 123:return n++,o=1;case 125:return n++,o=2;case 91:return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=y(),o=10;case 47:var
|
|
204
|
+
`;function Ll(){return Ll=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Ll.apply(this,arguments)}var ry=r=>{var{theme:e,settings:t={},styles:n=[]}=r,i={".cm-gutters":{}},s={};t.background&&(s.backgroundColor=t.background),t.backgroundImage&&(s.backgroundImage=t.backgroundImage),t.foreground&&(s.color=t.foreground),(t.background||t.foreground)&&(i["&"]=s),t.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(i[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(i[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(i[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(i[".cm-content"]={caretColor:t.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var o={};t.gutterActiveForeground&&(o.color=t.gutterActiveForeground),t.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:t.lineHighlight},o.backgroundColor=t.lineHighlight),i[".cm-activeLineGutter"]=o,t.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var a=de.theme(i,{dark:e==="dark"}),l=cs.define(n),c=[a,ju(l)];return c};const y3=null;var qT={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f063",selectionMatch:"#d7d4f063",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b6130"},b3=null,Of=r=>{var{theme:e="dark",settings:t={},styles:n=[]}=r||{};return ry({theme:e,settings:Ll({},qT,t),styles:[{tag:M.keyword,color:"#cf6edf"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#56c8d8"},{tag:[M.propertyName],color:"#facf4e"},{tag:[M.variableName],color:"#bdbdbd"},{tag:[M.function(M.variableName)],color:"#56c8d8"},{tag:[M.labelName],color:"#cf6edf"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#facf4e"},{tag:[M.definition(M.name),M.separator],color:"#fa5788"},{tag:[M.brace],color:"#cf6edf"},{tag:[M.annotation],color:"#ff5f52"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#ffad42"},{tag:[M.typeName,M.className],color:"#ffad42"},{tag:[M.operator,M.operatorKeyword],color:"#7186f0"},{tag:[M.tagName],color:"#99d066"},{tag:[M.squareBracket],color:"#ff5f52"},{tag:[M.angleBracket],color:"#606f7a"},{tag:[M.attributeName],color:"#bdbdbd"},{tag:[M.regexp],color:"#ff5f52"},{tag:[M.quote],color:"#6abf69"},{tag:[M.string],color:"#99d066"},{tag:M.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[M.url,M.escape,M.special(M.string)],color:"#facf4e"},{tag:[M.meta],color:"#707d8b"},{tag:[M.comment],color:"#707d8b",fontStyle:"italic"},{tag:M.monospace,color:"#bdbdbd"},{tag:M.strong,fontWeight:"bold",color:"#ff5f52"},{tag:M.emphasis,fontStyle:"italic",color:"#99d066"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.heading,fontWeight:"bold",color:"#facf4e"},{tag:M.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[M.heading2,M.heading3,M.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[M.heading5,M.heading6],color:"#facf4e"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#56c8d8"},{tag:[M.processingInstruction,M.inserted],color:"#ff5f52"},{tag:[M.contentSeparator],color:"#56c8d8"},{tag:M.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"},...n]})},eP=Of,x3=Of(),w3=Of(),tP={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#80CBC440",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},Ef=r=>{var{theme:e="light",settings:t={},styles:n=[]}=r||{};return ry({theme:e,settings:Ll({},tP,t),styles:[{tag:M.keyword,color:"#39ADB5"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#90A4AE"},{tag:[M.propertyName],color:"#6182B8"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"#91B859"},{tag:[M.function(M.variableName),M.labelName],color:"#6182B8"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#39ADB5"},{tag:[M.definition(M.name),M.separator],color:"#90A4AE"},{tag:[M.className],color:"#E2931D"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#F76D47"},{tag:[M.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[M.operator,M.operatorKeyword],color:"#39ADB5"},{tag:[M.url,M.escape,M.regexp,M.link],color:"#91B859"},{tag:[M.meta,M.comment],color:"#90A4AE"},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#90A4AE"},{tag:M.invalid,color:"#E5393570"},{tag:M.strikethrough,textDecoration:"line-through"},...n]})},S3=Ef();function Bl(r,e){e===void 0&&(e=!1);var t=r.length,n=0,i="",s=0,o=16,a=0,l=0,c=0,u=0,h=0;function d(E,F){for(var I=0,W=0;I<E||!F;){var j=r.charCodeAt(n);if(j>=48&&j<=57)W=W*16+j-48;else if(j>=65&&j<=70)W=W*16+j-65+10;else if(j>=97&&j<=102)W=W*16+j-97+10;else break;n++,I++}return I<E&&(W=-1),W}function p(E){n=E,i="",s=0,o=16,h=0}function m(){var E=n;if(r.charCodeAt(n)===48)n++;else for(n++;n<r.length&&xs(r.charCodeAt(n));)n++;if(n<r.length&&r.charCodeAt(n)===46)if(n++,n<r.length&&xs(r.charCodeAt(n)))for(n++;n<r.length&&xs(r.charCodeAt(n));)n++;else return h=3,r.substring(E,n);var F=n;if(n<r.length&&(r.charCodeAt(n)===69||r.charCodeAt(n)===101))if(n++,(n<r.length&&r.charCodeAt(n)===43||r.charCodeAt(n)===45)&&n++,n<r.length&&xs(r.charCodeAt(n))){for(n++;n<r.length&&xs(r.charCodeAt(n));)n++;F=n}else h=3;return r.substring(E,F)}function y(){for(var E="",F=n;;){if(n>=t){E+=r.substring(F,n),h=2;break}var I=r.charCodeAt(n);if(I===34){E+=r.substring(F,n),n++;break}if(I===92){if(E+=r.substring(F,n),n++,n>=t){h=2;break}var W=r.charCodeAt(n++);switch(W){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
|
|
205
|
+
`;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:var j=d(4,!0);j>=0?E+=String.fromCharCode(j):h=4;break;default:h=5}F=n;continue}if(I>=0&&I<=31)if(Io(I)){E+=r.substring(F,n),h=2;break}else h=6;n++}return E}function w(){if(i="",h=0,s=n,l=a,u=c,n>=t)return s=t,o=17;var E=r.charCodeAt(n);if(Tf(E)){do n++,i+=String.fromCharCode(E),E=r.charCodeAt(n);while(Tf(E));return o=15}if(Io(E))return n++,i+=String.fromCharCode(E),E===13&&r.charCodeAt(n)===10&&(n++,i+=`
|
|
206
|
+
`),a++,c=n,o=14;switch(E){case 123:return n++,o=1;case 125:return n++,o=2;case 91:return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=y(),o=10;case 47:var F=n-1;if(r.charCodeAt(n+1)===47){for(n+=2;n<t&&!Io(r.charCodeAt(n));)n++;return i=r.substring(F,n),o=12}if(r.charCodeAt(n+1)===42){n+=2;for(var I=t-1,W=!1;n<I;){var j=r.charCodeAt(n);if(j===42&&r.charCodeAt(n+1)===47){n+=2,W=!0;break}n++,Io(j)&&(j===13&&r.charCodeAt(n)===10&&n++,a++,c=n)}return W||(n++,h=1),i=r.substring(F,n),o=13}return i+=String.fromCharCode(E),n++,o=16;case 45:if(i+=String.fromCharCode(E),n++,n===t||!xs(r.charCodeAt(n)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;n<t&&A(E);)n++,E=r.charCodeAt(n);if(s!==n){switch(i=r.substring(s,n),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(E),n++,o=16}}function A(E){if(Tf(E)||Io(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function T(){var E;do E=w();while(E>=12&&E<=15);return E}return{setPosition:p,getPosition:function(){return n},scan:e?T:w,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return n-s},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return s-u},getTokenError:function(){return h}}}function Tf(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function Io(r){return r===10||r===13||r===8232||r===8233}function xs(r){return r>=48&&r<=57}function rP(r,e,t){var n,i,s,o,a;if(e){for(o=e.offset,a=o+e.length,s=o;s>0&&!ny(r,s-1);)s--;for(var l=a;l<r.length&&!ny(r,l);)l++;i=r.substring(s,l),n=nP(i,t)}else i=r,n=0,s=0,o=0,a=r.length;var c=iP(t,r),u=!1,h=0,d;t.insertSpaces?d=Pf(" ",t.tabSize||4):d=" ";var p=Bl(i,!1),m=!1;function y(){return c+Pf(d,n+h)}function w(){var G=p.scan();for(u=!1;G===15||G===14;)u=u||G===14,G=p.scan();return m=G===16||p.getTokenError()!==0,G}var A=[];function T(G,re,ce){!m&&re<a&&ce>o&&r.substring(re,ce)!==G&&A.push({offset:re,length:ce-re,content:G})}var E=w();if(E!==17){var F=p.getTokenOffset()+s,I=Pf(d,n);T(I,s,F)}for(;E!==17;){for(var W=p.getTokenOffset()+p.getTokenLength()+s,j=w(),Q="";!u&&(j===12||j===13);){var B=p.getTokenOffset()+s;T(" ",W,B),W=p.getTokenOffset()+p.getTokenLength()+s,Q=j===12?y():"",j=w()}if(j===2)E!==1&&(h--,Q=y());else if(j===4)E!==3&&(h--,Q=y());else{switch(E){case 3:case 1:h++,Q=y();break;case 5:case 12:Q=y();break;case 13:u?Q=y():Q=" ";break;case 6:Q=" ";break;case 10:if(j===6){Q="";break}case 7:case 8:case 9:case 11:case 2:case 4:j===12||j===13?Q=" ":j!==5&&j!==17&&(m=!0);break;case 16:m=!0;break}u&&(j===12||j===13)&&(Q=y())}var U=p.getTokenOffset()+s;T(Q,W,U),E=j}return A}function Pf(r,e){for(var t="",n=0;n<e;n++)t+=r;return t}function nP(r,e){for(var t=0,n=0,i=e.tabSize||4;t<r.length;){var s=r.charAt(t);if(s===" ")n++;else if(s===" ")n+=i;else break;t++}return Math.floor(n/i)}function iP(r,e){for(var t=0;t<e.length;t++){var n=e.charAt(t);if(n==="\r")return t+1<e.length&&e.charAt(t+1)===`
|
|
207
207
|
`?`\r
|
|
208
208
|
`:"\r";if(n===`
|
|
209
209
|
`)return`
|
|
210
|
-
`}return
|
|
211
|
-
`}function
|
|
212
|
-
`.indexOf(
|
|
213
|
-
`.indexOf(t.charAt(e))!==-1}var xs=Dl,k3=nP,uP=iP,A3=sP,C3=oP,fP=ny,hP=ry,dP=Of,O3=Nl,E3=lP;function T3(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function pP(t,e,r){return eP(t,e,r)}function P3(t,e,r,n){return edit.setProperty(t,e,r,n)}function M3(t,e){for(var r=e.length-1;r>=0;r--)t=edit.applyEdit(t,e[r]);return t}function Do(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0||typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;var r,n;if(Array.isArray(t)){if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(!Do(t[r],e[r]))return!1}else{var i=[];for(n in t)i.push(n);i.sort();var s=[];for(n in e)s.push(n);if(s.sort(),!Do(i,s))return!1;for(r=0;r<i.length;r++)if(!Do(t[i[r]],e[i[r]]))return!1}return!0}function Cr(t){return typeof t=="number"}function Pn(t){return typeof t<"u"}function mn(t){return typeof t=="boolean"}function gP(t){return typeof t=="string"}var oy;(function(t){function e(r){return typeof r=="string"}t.is=e})(oy||(oy={}));var Ef;(function(t){function e(r){return typeof r=="string"}t.is=e})(Ef||(Ef={}));var ay;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(ay||(ay={}));var Rl;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Rl||(Rl={}));var jr;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Rl.MAX_VALUE),i===Number.MAX_VALUE&&(i=Rl.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.uinteger(i.line)&&Q.uinteger(i.character)}t.is=r})(jr||(jr={}));var ze;(function(t){function e(n,i,s,o){if(Q.uinteger(n)&&Q.uinteger(i)&&Q.uinteger(s)&&Q.uinteger(o))return{start:jr.create(n,i),end:jr.create(s,o)};if(jr.is(n)&&jr.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments[".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,"]"))}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&jr.is(i.start)&&jr.is(i.end)}t.is=r})(ze||(ze={}));var ws;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&(Q.string(i.uri)||Q.undefined(i.uri))}t.is=r})(ws||(ws={}));var ly;(function(t){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.targetRange)&&Q.string(i.targetUri)&&ze.is(i.targetSelectionRange)&&(ze.is(i.originSelectionRange)||Q.undefined(i.originSelectionRange))}t.is=r})(ly||(ly={}));var Tf;(function(t){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.numberRange(i.red,0,1)&&Q.numberRange(i.green,0,1)&&Q.numberRange(i.blue,0,1)&&Q.numberRange(i.alpha,0,1)}t.is=r})(Tf||(Tf={}));var cy;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&Tf.is(i.color)}t.is=r})(cy||(cy={}));var uy;(function(t){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.string(i.label)&&(Q.undefined(i.textEdit)||Vr.is(i))&&(Q.undefined(i.additionalTextEdits)||Q.typedArray(i.additionalTextEdits,Vr.is))}t.is=r})(uy||(uy={}));var No;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(No||(No={}));var fy;(function(t){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return Q.defined(s)&&(c.startCharacter=s),Q.defined(o)&&(c.endCharacter=o),Q.defined(a)&&(c.kind=a),Q.defined(l)&&(c.collapsedText=l),c}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.uinteger(i.startLine)&&Q.uinteger(i.startLine)&&(Q.undefined(i.startCharacter)||Q.uinteger(i.startCharacter))&&(Q.undefined(i.endCharacter)||Q.uinteger(i.endCharacter))&&(Q.undefined(i.kind)||Q.string(i.kind))}t.is=r})(fy||(fy={}));var Pf;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ws.is(i.location)&&Q.string(i.message)}t.is=r})(Pf||(Pf={}));var Me;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Me||(Me={}));var hy;(function(t){t.Unnecessary=1,t.Deprecated=2})(hy||(hy={}));var dy;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&Q.string(n.href)}t.is=e})(dy||(dy={}));var Mn;(function(t){function e(n,i,s,o,a,l){var c={range:n,message:i};return Q.defined(s)&&(c.severity=s),Q.defined(o)&&(c.code=o),Q.defined(a)&&(c.source=a),Q.defined(l)&&(c.relatedInformation=l),c}t.create=e;function r(n){var i,s=n;return Q.defined(s)&&ze.is(s.range)&&Q.string(s.message)&&(Q.number(s.severity)||Q.undefined(s.severity))&&(Q.integer(s.code)||Q.string(s.code)||Q.undefined(s.code))&&(Q.undefined(s.codeDescription)||Q.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(Q.string(s.source)||Q.undefined(s.source))&&(Q.undefined(s.relatedInformation)||Q.typedArray(s.relatedInformation,Pf.is))}t.is=r})(Mn||(Mn={}));var Ss;(function(t){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a={title:n,command:i};return Q.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.title)&&Q.string(i.command)}t.is=r})(Ss||(Ss={}));var Vr;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function r(s,o){return{range:{start:s,end:s},newText:o}}t.insert=r;function n(s){return{range:s,newText:""}}t.del=n;function i(s){var o=s;return Q.objectLiteral(o)&&Q.string(o.newText)&&ze.is(o.range)}t.is=i})(Vr||(Vr={}));var ks;(function(t){function e(n,i,s){var o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.string(i.label)&&(Q.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Q.string(i.description)||i.description===void 0)}t.is=r})(ks||(ks={}));var qt;(function(t){function e(r){var n=r;return Q.string(n)}t.is=e})(qt||(qt={}));var ii;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function r(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}t.del=n;function i(s){var o=s;return Vr.is(o)&&(ks.is(o.annotationId)||qt.is(o.annotationId))}t.is=i})(ii||(ii={}));var Ll;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Fl.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(Ll||(Ll={}));var Ro;(function(t){function e(n,i,s){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){var i=n;return i&&i.kind==="create"&&Q.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||Q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Ro||(Ro={}));var Lo;(function(t){function e(n,i,s,o){var a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function r(n){var i=n;return i&&i.kind==="rename"&&Q.string(i.oldUri)&&Q.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||Q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Lo||(Lo={}));var Bo;(function(t){function e(n,i,s){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){var i=n;return i&&i.kind==="delete"&&Q.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||Q.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||Q.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Bo||(Bo={}));var Mf;(function(t){function e(r){var n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return Q.string(i.kind)?Ro.is(i)||Lo.is(i)||Bo.is(i):Ll.is(i)}))}t.is=e})(Mf||(Mf={}));var Bl=function(){function t(e,r){this.edits=e,this.changeAnnotations=r}return t.prototype.insert=function(e,r,n){var i,s;if(n===void 0?i=Vr.insert(e,r):qt.is(n)?(s=n,i=ii.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.insert(e,r,s)),this.edits.push(i),s!==void 0)return s},t.prototype.replace=function(e,r,n){var i,s;if(n===void 0?i=Vr.replace(e,r):qt.is(n)?(s=n,i=ii.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.replace(e,r,s)),this.edits.push(i),s!==void 0)return s},t.prototype.delete=function(e,r){var n,i;if(r===void 0?n=Vr.del(e):qt.is(r)?(i=r,n=ii.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=ii.del(e,i)),this.edits.push(n),i!==void 0)return i},t.prototype.add=function(e){this.edits.push(e)},t.prototype.all=function(){return this.edits},t.prototype.clear=function(){this.edits.splice(0,this.edits.length)},t.prototype.assertChangeAnnotations=function(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},t}(),py=function(){function t(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(e,r){var n;if(qt.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error("Id ".concat(n," is already in use."));if(r===void 0)throw new Error("No annotation provided for id ".concat(n));return this._annotations[n]=r,this._size++,n},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),I3=function(){function t(e){var r=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new py(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Ll.is(n)){var i=new Bl(n.edits,r._changeAnnotations);r._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Bl(e.changes[n]);r._textEditChanges[n]=i})):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(e){if(Fl.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){var i=[],s={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(s),n=new Bl(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[e];if(!n){var i=[];this._workspaceEdit.changes[e]=i,n=new Bl(i),this._textEditChanges[e]=n}return n}},t.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new py,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;ks.is(r)||qt.is(r)?i=r:n=r;var s,o;if(i===void 0?s=Ro.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Ro.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},t.prototype.renameFile=function(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;ks.is(n)||qt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Lo.create(e,r,i):(a=qt.is(s)?s:this._changeAnnotations.manage(s),o=Lo.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a},t.prototype.deleteFile=function(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;ks.is(r)||qt.is(r)?i=r:n=r;var s,o;if(i===void 0?s=Bo.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Bo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},t}(),gy;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)}t.is=r})(gy||(gy={}));var my;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&Q.integer(i.version)}t.is=r})(my||(my={}));var Fl;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&(i.version===null||Q.integer(i.version))}t.is=r})(Fl||(Fl={}));var vy;(function(t){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&Q.string(i.languageId)&&Q.integer(i.version)&&Q.string(i.text)}t.is=r})(vy||(vy={}));var Ii;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){var n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(Ii||(Ii={}));var Fo;(function(t){function e(r){var n=r;return Q.objectLiteral(r)&&Ii.is(n.kind)&&Q.string(n.value)}t.is=e})(Fo||(Fo={}));var Or;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Or||(Or={}));var Dt;(function(t){t.PlainText=1,t.Snippet=2})(Dt||(Dt={}));var yy;(function(t){t.Deprecated=1})(yy||(yy={}));var by;(function(t){function e(n,i,s){return{newText:n,insert:i,replace:s}}t.create=e;function r(n){var i=n;return i&&Q.string(i.newText)&&ze.is(i.insert)&&ze.is(i.replace)}t.is=r})(by||(by={}));var xy;(function(t){t.asIs=1,t.adjustIndentation=2})(xy||(xy={}));var wy;(function(t){function e(r){var n=r;return n&&(Q.string(n.detail)||n.detail===void 0)&&(Q.string(n.description)||n.description===void 0)}t.is=e})(wy||(wy={}));var If;(function(t){function e(r){return{label:r}}t.create=e})(If||(If={}));var Sy;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(Sy||(Sy={}));var jl;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){var i=n;return Q.string(i)||Q.objectLiteral(i)&&Q.string(i.language)&&Q.string(i.value)}t.is=r})(jl||(jl={}));var ky;(function(t){function e(r){var n=r;return!!n&&Q.objectLiteral(n)&&(Fo.is(n.contents)||jl.is(n.contents)||Q.typedArray(n.contents,jl.is))&&(r.range===void 0||ze.is(r.range))}t.is=e})(ky||(ky={}));var Ay;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Ay||(Ay={}));var Cy;(function(t){function e(r,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var o={label:r};return Q.defined(n)&&(o.documentation=n),Q.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(Cy||(Cy={}));var Oy;(function(t){t.Text=1,t.Read=2,t.Write=3})(Oy||(Oy={}));var Ey;(function(t){function e(r,n){var i={range:r};return Q.number(n)&&(i.kind=n),i}t.create=e})(Ey||(Ey={}));var vn;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(vn||(vn={}));var Ty;(function(t){t.Deprecated=1})(Ty||(Ty={}));var Py;(function(t){function e(r,n,i,s,o){var a={name:r,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(Py||(Py={}));var My;(function(t){function e(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(My||(My={}));var Iy;(function(t){function e(n,i,s,o,a,l){var c={name:n,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}t.create=e;function r(n){var i=n;return i&&Q.string(i.name)&&Q.number(i.kind)&&ze.is(i.range)&&ze.is(i.selectionRange)&&(i.detail===void 0||Q.string(i.detail))&&(i.deprecated===void 0||Q.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Iy||(Iy={}));var Dy;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(Dy||(Dy={}));var Vl;(function(t){t.Invoked=1,t.Automatic=2})(Vl||(Vl={}));var Ny;(function(t){function e(n,i,s){var o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.typedArray(i.diagnostics,Mn.is)&&(i.only===void 0||Q.typedArray(i.only,Q.string))&&(i.triggerKind===void 0||i.triggerKind===Vl.Invoked||i.triggerKind===Vl.Automatic)}t.is=r})(Ny||(Ny={}));var Ry;(function(t){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Ss.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function r(n){var i=n;return i&&Q.string(i.title)&&(i.diagnostics===void 0||Q.typedArray(i.diagnostics,Mn.is))&&(i.kind===void 0||Q.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Ss.is(i.command))&&(i.isPreferred===void 0||Q.boolean(i.isPreferred))&&(i.edit===void 0||Mf.is(i.edit))}t.is=r})(Ry||(Ry={}));var Ly;(function(t){function e(n,i){var s={range:n};return Q.defined(i)&&(s.data=i),s}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(i.range)&&(Q.undefined(i.command)||Ss.is(i.command))}t.is=r})(Ly||(Ly={}));var By;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.uinteger(i.tabSize)&&Q.boolean(i.insertSpaces)}t.is=r})(By||(By={}));var Fy;(function(t){function e(n,i,s){return{range:n,target:i,data:s}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(i.range)&&(Q.undefined(i.target)||Q.string(i.target))}t.is=r})(Fy||(Fy={}));var Wl;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Wl||(Wl={}));var jy;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(jy||(jy={}));var Vy;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Vy||(Vy={}));var Wy;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(Wy||(Wy={}));var $y;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&Q.string(i.text)}t.is=r})($y||($y={}));var Hy;(function(t){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&Q.boolean(i.caseSensitiveLookup)&&(Q.string(i.variableName)||i.variableName===void 0)}t.is=r})(Hy||(Hy={}));var zy;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&(Q.string(i.expression)||i.expression===void 0)}t.is=r})(zy||(zy={}));var Uy;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(n.stoppedLocation)}t.is=r})(Uy||(Uy={}));var Df;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(Df||(Df={}));var Nf;(function(t){function e(n){return{value:n}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&(i.tooltip===void 0||Q.string(i.tooltip)||Fo.is(i.tooltip))&&(i.location===void 0||ws.is(i.location))&&(i.command===void 0||Ss.is(i.command))}t.is=r})(Nf||(Nf={}));var Gy;(function(t){function e(n,i,s){var o={position:n,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&jr.is(i.position)&&(Q.string(i.label)||Q.typedArray(i.label,Nf.is))&&(i.kind===void 0||Df.is(i.kind))&&i.textEdits===void 0||Q.typedArray(i.textEdits,Vr.is)&&(i.tooltip===void 0||Q.string(i.tooltip)||Fo.is(i.tooltip))&&(i.paddingLeft===void 0||Q.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Q.boolean(i.paddingRight))}t.is=r})(Gy||(Gy={}));var Ky;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&Ef.is(n.uri)&&Q.string(n.name)}t.is=e})(Ky||(Ky={}));var D3=null,Yy;(function(t){function e(s,o,a,l){return new mP(s,o,a,l)}t.create=e;function r(s){var o=s;return!!(Q.defined(o)&&Q.string(o.uri)&&(Q.undefined(o.languageId)||Q.string(o.languageId))&&Q.uinteger(o.lineCount)&&Q.func(o.getText)&&Q.func(o.positionAt)&&Q.func(o.offsetAt))}t.is=r;function n(s,o){for(var a=s.getText(),l=i(o,function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),c=a.length,u=l.length-1;u>=0;u--){var h=l[u],d=s.offsetAt(h.range.start),p=s.offsetAt(h.range.end);if(p<=c)a=a.substring(0,d)+h.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}t.applyEdits=n;function i(s,o){if(s.length<=1)return s;var a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);for(var u=0,h=0,d=0;u<l.length&&h<c.length;){var p=o(l[u],c[h]);p<=0?s[d++]=l[u++]:s[d++]=c[h++]}for(;u<l.length;)s[d++]=l[u++];for(;h<c.length;)s[d++]=c[h++];return s}})(Yy||(Yy={}));var mP=function(){function t(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(e){if(e){var r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content},t.prototype.update=function(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0},t.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],r=this._content,n=!0,i=0;i<r.length;i++){n&&(e.push(i),n=!1);var s=r.charAt(i);n=s==="\r"||s===`
|
|
214
|
-
`,s==="\r"&&i+1<
|
|
215
|
-
`&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets},t.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return jr.create(0,e);for(;n<i;){var s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}var o=n-1;return jr.create(o,e-r[o])},t.prototype.offsetAt=function(e){var r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;var n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t}(),Q;(function(t){var e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function o(p){return e.call(p)==="[object Number]"}t.number=o;function a(p,m,y){return e.call(p)==="[object Number]"&&m<=p&&p<=y}t.numberRange=a;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=c;function u(p){return e.call(p)==="[object Function]"}t.func=u;function h(p){return p!==null&&typeof p=="object"}t.objectLiteral=h;function d(p,m){return Array.isArray(p)&&p.every(m)}t.typedArray=d})(Q||(Q={}));var vP=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},Jy=function(){function t(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(e){if(e){var r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content},t.prototype.update=function(e,r){for(var n=0,i=e;n<i.length;n++){var s=i[n];if(t.isIncremental(s)){var o=Xy(s.range),a=this.offsetAt(o.start),l=this.offsetAt(o.end);this._content=this._content.substring(0,a)+s.text+this._content.substring(l,this._content.length);var c=Math.max(o.start.line,0),u=Math.max(o.end.line,0),h=this._lineOffsets,d=Qy(s.text,!1,a);if(u-c===d.length)for(var p=0,m=d.length;p<m;p++)h[p+c+1]=d[p];else d.length<1e4?h.splice.apply(h,vP([c+1,u-c],d,!1)):this._lineOffsets=h=h.slice(0,c+1).concat(d,h.slice(u+1));var y=s.text.length-(l-a);if(y!==0)for(var p=c+1+d.length,m=h.length;p<m;p++)h[p]=h[p]+y}else if(t.isFull(s))this._content=s.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received")}this._version=r},t.prototype.getLineOffsets=function(){return this._lineOffsets===void 0&&(this._lineOffsets=Qy(this._content,!0)),this._lineOffsets},t.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){var s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}var o=n-1;return{line:o,character:e-r[o]}},t.prototype.offsetAt=function(e){var r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;var n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t.isIncremental=function(e){var r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")},t.isFull=function(e){var r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0},t}(),Rf;(function(t){function e(i,s,o,a){return new Jy(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof Jy)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,s){for(var o=i.getText(),a=Lf(s.map(yP),function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),l=0,c=[],u=0,h=a;u<h.length;u++){var d=h[u],p=i.offsetAt(d.range.start);if(p<l)throw new Error("Overlapping edit");p>l&&c.push(o.substring(l,p)),d.newText.length&&c.push(d.newText),l=i.offsetAt(d.range.end)}return c.push(o.substr(l)),c.join("")}t.applyEdits=n})(Rf||(Rf={}));function Lf(t,e){if(t.length<=1)return t;var r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Lf(n,e),Lf(i,e);for(var s=0,o=0,a=0;s<n.length&&o<i.length;){var l=e(n[s],i[o]);l<=0?t[a++]=n[s++]:t[a++]=i[o++]}for(;s<n.length;)t[a++]=n[s++];for(;o<i.length;)t[a++]=i[o++];return t}function Qy(t,e,r){r===void 0&&(r=0);for(var n=e?[r]:[],i=0;i<t.length;i++){var s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function Xy(t){var e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function yP(t){var e=Xy(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var $e;(function(t){t[t.Undefined=0]="Undefined",t[t.EnumValueMismatch=1]="EnumValueMismatch",t[t.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=258]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",t[t.InvalidUnicode=260]="InvalidUnicode",t[t.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",t[t.InvalidCharacter=262]="InvalidCharacter",t[t.PropertyExpected=513]="PropertyExpected",t[t.CommaExpected=514]="CommaExpected",t[t.ColonExpected=515]="ColonExpected",t[t.ValueExpected=516]="ValueExpected",t[t.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",t[t.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",t[t.TrailingComma=519]="TrailingComma",t[t.DuplicateKey=520]="DuplicateKey",t[t.CommentNotPermitted=521]="CommentNotPermitted",t[t.SchemaResolveError=768]="SchemaResolveError"})($e||($e={}));var Zy;(function(t){t.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Ii.Markdown,Ii.PlainText],commitCharactersSupport:!0}}}}})(Zy||(Zy={}));var Di=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),bP={"color-hex":{errorMessage:"Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.",pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:"String is not a RFC3339 date-time.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:"String is not a RFC3339 date.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:"String is not a RFC3339 time.",pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:"String is not an e-mail address.",pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Ni=function(){function t(e,r,n){this.offset=r,this.length=n,this.parent=e}return Object.defineProperty(t.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},t}(),xP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="null",i.value=null,i}return e}(Ni),_y=function(t){Di(e,t);function e(r,n,i){var s=t.call(this,r,i)||this;return s.type="boolean",s.value=n,s}return e}(Ni),wP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(Ni),SP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return e}(Ni),qy=function(t){Di(e,t);function e(r,n,i){var s=t.call(this,r,n,i)||this;return s.type="string",s.value="",s}return e}(Ni),kP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="property",i.colonOffset=-1,i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(Ni),AP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(Ni);function ur(t){return mn(t)?t?{}:{not:{}}:t}var eb;(function(t){t[t.Key=0]="Key",t[t.Enum=1]="Enum"})(eb||(eb={}));var CP=function(){function t(e,r){e===void 0&&(e=-1),r===void 0&&(r=null),this.focusOffset=e,this.exclude=r,this.schemas=[]}return t.prototype.add=function(e){this.schemas.push(e)},t.prototype.merge=function(e){var r;(r=this.schemas).push.apply(r,e.schemas)},t.prototype.include=function(e){return(this.focusOffset===-1||tb(e,this.focusOffset))&&e!==this.exclude},t.prototype.newSub=function(){return new t(-1,this.exclude)},t}(),Bf=function(){function t(){}return Object.defineProperty(t.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.add=function(e){},t.prototype.merge=function(e){},t.prototype.include=function(e){return!0},t.prototype.newSub=function(){return this},t.instance=new t,t}(),fr=function(){function t(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return t.prototype.hasProblems=function(){return!!this.problems.length},t.prototype.mergeAll=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r];this.merge(i)}},t.prototype.merge=function(e){this.problems=this.problems.concat(e.problems)},t.prototype.mergeEnumValues=function(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(var r=0,n=this.problems;r<n.length;r++){var i=n[r];i.code===$e.EnumValueMismatch&&(i.message="Value is not accepted. Valid values: "+this.enumValues.map(function(s){return JSON.stringify(s)}).join(", ")+".")}}},t.prototype.mergePropertyMatch=function(e){this.merge(e),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++},t.prototype.compare=function(e){var r=this.hasProblems();return r!==e.hasProblems()?r?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches},t}();function OP(t,e){return e===void 0&&(e=[]),new rb(t,e,[])}function si(t){return dP(t)}function Ff(t){return hP(t)}function tb(t,e,r){return r===void 0&&(r=!1),e>=t.offset&&e<t.offset+t.length||r&&e===t.offset+t.length}var rb=function(){function t(e,r,n){r===void 0&&(r=[]),n===void 0&&(n=[]),this.root=e,this.syntaxErrors=r,this.comments=n}return t.prototype.getNodeFromOffset=function(e,r){if(r===void 0&&(r=!1),this.root)return fP(this.root,e,r)},t.prototype.visit=function(e){if(this.root){var r=function(n){var i=e(n),s=n.children;if(Array.isArray(s))for(var o=0;o<s.length&&i;o++)i=r(s[o]);return i};r(this.root)}},t.prototype.validate=function(e,r){if(this.root&&r){var n=new fr;return $t(this.root,r,n,Bf.instance),n.problems.map(function(i){var s=ze.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Mn.create(s,i.message,i.severity,i.code)})}return null},t.prototype.getMatchingSchemas=function(e,r,n){r===void 0&&(r=-1),n===void 0&&(n=null);var i=new CP(r,n);return this.root&&e&&$t(this.root,e,new fr,i),i.schemas},t}();function $t(t,e,r,n){if(!t||!n.include(t))return;switch(t.type){case"object":l(t,e,r,n);break;case"array":a(t,e,r,n);break;case"string":o(t,e,r,n);break;case"number":s(t,e,r,n);break;case"property":return $t(t.valueNode,e,r,n)}i(),n.add({node:t,schema:e});function i(){function c(re){return t.type===re||re==="integer"&&t.type==="number"&&t.isInteger||e.nullable&&t.value===null}if(Array.isArray(e.type)?e.type.some(c)||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(c(e.type)||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,h=e.allOf;u<h.length;u++){var d=h[u];$t(t,ur(d),r,n)}var p=ur(e.not);if(p){var m=new fr,y=n.newSub();$t(t,p,m,y),m.hasProblems()||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:"Matches a schema that is not allowed."});for(var w=0,A=y.schemas;w<A.length;w++){var T=A[w];T.inverted=!T.inverted,n.add(T)}}var E=function(re,ce){for(var he=[],xe=null,Fe=0,we=re;Fe<we.length;Fe++){var Ee=we[Fe],Ue=ur(Ee),Ie=new fr,nt=n.newSub();if($t(t,Ue,Ie,nt),Ie.hasProblems()||he.push(Ue),!xe)xe={schema:Ue,validationResult:Ie,matchingSchemas:nt};else if(!ce&&!Ie.hasProblems()&&!xe.validationResult.hasProblems())xe.matchingSchemas.merge(nt),xe.validationResult.propertiesMatches+=Ie.propertiesMatches,xe.validationResult.propertiesValueMatches+=Ie.propertiesValueMatches;else{var dt=Ie.compare(xe.validationResult);dt>0?xe={schema:Ue,validationResult:Ie,matchingSchemas:nt}:dt===0&&(xe.matchingSchemas.merge(nt),xe.validationResult.mergeEnumValues(Ie))}}return he.length>1&&ce&&r.problems.push({location:{offset:t.offset,length:1},severity:Me.Warning,message:"Matches multiple schemas when only one must validate."}),xe!==null&&(r.merge(xe.validationResult),r.propertiesMatches+=xe.validationResult.propertiesMatches,r.propertiesValueMatches+=xe.validationResult.propertiesValueMatches,n.merge(xe.matchingSchemas)),he.length};Array.isArray(e.anyOf)&&E(e.anyOf,!1),Array.isArray(e.oneOf)&&E(e.oneOf,!0);var B=function(re){var ce=new fr,he=n.newSub();$t(t,ur(re),ce,he),r.merge(ce),r.propertiesMatches+=ce.propertiesMatches,r.propertiesValueMatches+=ce.propertiesValueMatches,n.merge(he)},I=function(re,ce,he){var xe=ur(re),Fe=new fr,we=n.newSub();$t(t,xe,Fe,we),n.merge(we),Fe.hasProblems()?he&&B(he):ce&&B(ce)},W=ur(e.if);if(W&&I(W,ur(e.then),ur(e.else)),Array.isArray(e.enum)){for(var F=si(t),_=!1,j=0,U=e.enum;j<U.length;j++){var Y=U[j];if(Do(F,Y)){_=!0;break}}r.enumValues=e.enum,r.enumValueMatch=_,_||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(re){return JSON.stringify(re)}).join(", ")+"."})}if(Pn(e.const)){var F=si(t);Do(F,e.const)?r.enumValueMatch=!0:(r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value must be "+JSON.stringify(e.const)+"."}),r.enumValueMatch=!1),r.enumValues=[e.const]}e.deprecationMessage&&t.parent&&r.problems.push({location:{offset:t.parent.offset,length:t.parent.length},severity:Me.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;Cr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(B,I){if(Cr(I))return I;if(mn(I)&&I)return B}function y(B,I){if(!mn(I)||!I)return B}var w=m(u.minimum,u.exclusiveMinimum);Cr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);Cr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);Cr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the minimum of "+T+"."});var E=y(u.maximum,u.exclusiveMaximum);Cr(E)&&p>E&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the maximum of "+E+"."})}function o(c,u,h,d){if(Cr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),Cr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),gP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||'String does not match the pattern of "'+u.pattern+'".'})}if(u.format)switch(u.format){case"uri":case"uri-reference":{var m=void 0;if(!c.value)m="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(c.value);y?!y[2]&&u.format==="uri"&&(m="URI with a scheme is expected."):m="URI is expected."}m&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+m})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var w=bP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||w.errorMessage});break;default:}}function a(c,u,h,d){if(Array.isArray(u.items)){for(var p=u.items,m=0;m<p.length;m++){var y=p[m],w=ur(y),A=new fr,T=c.items[m];T?($t(T,w,A,d),h.mergePropertyMatch(A)):c.items.length>=p.length&&h.propertiesValueMatches++}if(c.items.length>p.length)if(typeof u.additionalItems=="object")for(var E=p.length;E<c.items.length;E++){var A=new fr;$t(c.items[E],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var B=ur(u.items);if(B)for(var I=0,W=c.items;I<W.length;I++){var T=W[I],A=new fr;$t(T,B,A,d),h.mergePropertyMatch(A)}}var F=ur(u.contains);if(F){var _=c.items.some(function(Y){var re=new fr;return $t(Y,F,re,Bf.instance),!re.hasProblems()});_||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.errorMessage||"Array does not contain required item."})}if(Cr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),Cr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var j=si(c),U=j.some(function(Y,re){return re!==j.lastIndexOf(Y)});U&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has duplicate items."})}}function l(c,u,h,d){for(var p=Object.create(null),m=[],y=0,w=c.properties;y<w.length;y++){var A=w[y],T=A.keyNode.value;p[T]=A.valueNode,m.push(T)}if(Array.isArray(u.required))for(var E=0,B=u.required;E<B.length;E++){var I=B[E];if(!p[I]){var W=c.parent&&c.parent.type==="property"&&c.parent.keyNode,F=W?{offset:W.offset,length:W.length}:{offset:c.offset,length:1};h.problems.push({location:F,severity:Me.Warning,message:'Missing property "'+I+'".'})}}var _=function(or){for(var Ts=m.indexOf(or);Ts>=0;)m.splice(Ts,1),Ts=m.indexOf(or)};if(u.properties)for(var j=0,U=Object.keys(u.properties);j<U.length;j++){var I=U[j];_(I);var Y=u.properties[I],re=p[I];if(re)if(mn(Y))if(Y)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;$t(re,Y,ce,d),h.mergePropertyMatch(ce)}}if(u.patternProperties)for(var he=0,xe=Object.keys(u.patternProperties);he<xe.length;he++)for(var Fe=xe[he],we=new RegExp(Fe),Ee=0,Ue=m.slice(0);Ee<Ue.length;Ee++){var I=Ue[Ee];if(we.test(I)){_(I);var re=p[I];if(re){var Y=u.patternProperties[Fe];if(mn(Y))if(Y)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;$t(re,Y,ce,d),h.mergePropertyMatch(ce)}}}}if(typeof u.additionalProperties=="object")for(var Ie=0,nt=m;Ie<nt.length;Ie++){var I=nt[Ie],re=p[I];if(re){var ce=new fr;$t(re,u.additionalProperties,ce,d),h.mergePropertyMatch(ce)}}else if(u.additionalProperties===!1&&m.length>0)for(var dt=0,Bt=m;dt<Bt.length;dt++){var I=Bt[dt],re=p[I];if(re){var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}}if(Cr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),Cr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var er=0,Tr=Object.keys(u.dependencies);er<Tr.length;er++){var T=Tr[er],Ct=p[T];if(Ct){var tr=u.dependencies[T];if(Array.isArray(tr))for(var Pr=0,ai=tr;Pr<ai.length;Pr++){var li=ai[Pr];p[li]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object is missing property "+li+" required by property {$key}."})}else{var Y=ur(tr);if(Y){var ce=new fr;$t(c,Y,ce,d),h.mergePropertyMatch(ce)}}}}var Mr=ur(u.propertyNames);if(Mr)for(var yn=0,Kl=c.properties;yn<Kl.length;yn++){var ci=Kl[yn],T=ci.keyNode;T&&$t(T,Mr,h,Bf.instance)}}}function EP(t,e){var r=[],n=-1,i=t.getText(),s=xs(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var W=s.scan();switch(h(),W){case 12:case 13:Array.isArray(o)&&o.push(ze.create(t.positionAt(s.getTokenOffset()),t.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return W}}}function l(W){return s.getToken()===W?(a(),!0):!1}function c(W,F,_,j,U){if(U===void 0&&(U=Me.Error),r.length===0||_!==n){var Y=ze.create(t.positionAt(_),t.positionAt(j));r.push(Mn.create(Y,W,U,F,t.languageId)),n=_}}function u(W,F,_,j,U){_===void 0&&(_=null),j===void 0&&(j=[]),U===void 0&&(U=[]);var Y=s.getTokenOffset(),re=s.getTokenOffset()+s.getTokenLength();if(Y===re&&Y>0){for(Y--;Y>0&&/\s/.test(i.charAt(Y));)Y--;re=Y+1}if(c(W,F,Y,re),_&&d(_,!1),j.length+U.length>0)for(var ce=s.getToken();ce!==17;){if(j.indexOf(ce)!==-1){a();break}else if(U.indexOf(ce)!==-1)break;ce=a()}return _}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",$e.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",$e.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",$e.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",$e.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",$e.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",$e.InvalidCharacter),!0}return!1}function d(W,F){return W.length=s.getTokenOffset()+s.getTokenLength()-W.offset,F&&a(),W}function p(W){if(s.getToken()!==3)return null;var F=new wP(W,s.getTokenOffset());a();for(var _=0,j=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){j||u("Value expected",$e.ValueExpected);var U=s.getTokenOffset();if(a(),s.getToken()===4){j&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else j&&u("Expected comma",$e.CommaExpected);var Y=E(F,_++);Y?F.items.push(Y):u("Value expected",$e.ValueExpected,null,[],[4,5]),j=!0}return s.getToken()!==4?u("Expected comma or closing bracket",$e.CommaOrCloseBacketExpected,F):d(F,!0)}function m(W,F){var _=new kP(W,s.getTokenOffset()),j=w(_);if(!j)if(s.getToken()===16){u("Property keys must be doublequoted",$e.Undefined);var U=new qy(_,s.getTokenOffset(),s.getTokenLength());U.value=s.getTokenValue(),j=U,a()}else return null;_.keyNode=j;var Y=F[j.value];if(Y?(c("Duplicate object key",$e.DuplicateKey,_.keyNode.offset,_.keyNode.offset+_.keyNode.length,Me.Warning),typeof Y=="object"&&c("DuplicateKeyWarning",$e.DuplicateKey,Y.keyNode.offset,Y.keyNode.offset+Y.keyNode.length,Me.Warning),F[j.value]=!0):F[j.value]=_,s.getToken()===6)_.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",$e.ColonExpected),s.getToken()===10&&t.positionAt(j.offset+j.length).line<t.positionAt(s.getTokenOffset()).line)return _.length=j.length,_;var re=E(_,j.value);return re?(_.valueNode=re,_.length=re.offset+re.length-_.offset,_):u("Value expected",$e.ValueExpected,_,[],[2,5])}function y(W){if(s.getToken()!==1)return null;var F=new AP(W,s.getTokenOffset()),_=Object.create(null);a();for(var j=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){j||u("Property expected",$e.PropertyExpected);var U=s.getTokenOffset();if(a(),s.getToken()===2){j&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else j&&u("Expected comma",$e.CommaExpected);var Y=m(F,_);Y?F.properties.push(Y):u("Property expected",$e.PropertyExpected,null,[],[2,5]),j=!0}return s.getToken()!==2?u("Expected comma or closing brace",$e.CommaOrCloseBraceExpected,F):d(F,!0)}function w(W){if(s.getToken()!==10)return null;var F=new qy(W,s.getTokenOffset());return F.value=s.getTokenValue(),d(F,!0)}function A(W){if(s.getToken()!==11)return null;var F=new SP(W,s.getTokenOffset());if(s.getTokenError()===0){var _=s.getTokenValue();try{var j=JSON.parse(_);if(!Cr(j))return u("Invalid number format.",$e.Undefined,F);F.value=j}catch{return u("Invalid number format.",$e.Undefined,F)}F.isInteger=_.indexOf(".")===-1}return d(F,!0)}function T(W){var F;switch(s.getToken()){case 7:return d(new xP(W,s.getTokenOffset()),!0);case 8:return d(new _y(W,!0,s.getTokenOffset()),!0);case 9:return d(new _y(W,!1,s.getTokenOffset()),!0);default:return null}}function E(W,F){return p(W)||y(W)||w(W)||A(W)||T(W)}var B=null,I=a();return I!==17&&(B=E(null,null),B?s.getToken()!==17&&u("End of file expected.",$e.Undefined):u("Expected a JSON object, array or literal.",$e.Undefined)),new rb(B,r,o)}function jf(t,e,r){if(t!==null&&typeof t=="object"){var n=e+" ";if(Array.isArray(t)){if(t.length===0)return"[]";for(var i=`[
|
|
216
|
-
`,s=0;s<
|
|
217
|
-
`;return i+=e+"]",i}else{var o=Object.keys(
|
|
218
|
-
`,s=0;s<o.length;s++){var a=o[s];i+=n+JSON.stringify(a)+": "+
|
|
219
|
-
`}return i+=e+"}",i}}return r
|
|
210
|
+
`}return r&&r.eol||`
|
|
211
|
+
`}function ny(r,e){return`\r
|
|
212
|
+
`.indexOf(r.charAt(e))!==-1}var Do;(function(r){r.DEFAULT={allowTrailingComma:!1}})(Do||(Do={}));function sP(r,e){var t=[],n=new Object,i=void 0,s={value:{},offset:0,length:0,type:"object",parent:void 0},o=!1;function a(l,c,u,h){s.value=l,s.offset=c,s.length=u,s.type=h,s.colonOffset=void 0,i=s}try{Fl(r,{onObjectBegin:function(l,c){if(e<=l)throw n;i=void 0,o=e>l,t.push("")},onObjectProperty:function(l,c,u){if(e<c||(a(l,c,u,"property"),t[t.length-1]=l,e<=c+u))throw n},onObjectEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onArrayBegin:function(l,c){if(e<=l)throw n;i=void 0,t.push(0)},onArrayEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onLiteralValue:function(l,c,u){if(e<c||(a(l,c,u,oy(l)),e<=c+u))throw n},onSeparator:function(l,c,u){if(e<=c)throw n;if(l===":"&&i&&i.type==="property")i.colonOffset=c,o=!1,i=void 0;else if(l===","){var h=t[t.length-1];typeof h=="number"?t[t.length-1]=h+1:(o=!0,t[t.length-1]=""),i=void 0}}})}catch(l){if(l!==n)throw l}return{path:t,previousNode:i,isAtPropertyKey:o,matches:function(l){for(var c=0,u=0;c<l.length&&u<t.length;u++)if(l[c]===t[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function oP(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Do.DEFAULT);var n=null,i=[],s=[];function o(l){Array.isArray(i)?i.push(l):n!==null&&(i[n]=l)}var a={onObjectBegin:function(){var l={};o(l),s.push(i),i=l,n=null},onObjectProperty:function(l){n=l},onObjectEnd:function(){i=s.pop()},onArrayBegin:function(){var l=[];o(l),s.push(i),i=l,n=null},onArrayEnd:function(){i=s.pop()},onLiteralValue:o,onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};return Fl(r,a,t),i[0]}function aP(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Do.DEFAULT);var n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function s(l){return n.children.push(l),l}var o={onObjectBegin:function(l){n=s({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:function(l,c,u){n=s({type:"property",offset:c,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:c,length:u,parent:n})},onObjectEnd:function(l,c){i(l+c),n.length=l+c-n.offset,n=n.parent,i(l+c)},onArrayBegin:function(l,c){n=s({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:function(l,c){n.length=l+c-n.offset,n=n.parent,i(l+c)},onLiteralValue:function(l,c,u){s({type:oy(l),offset:c,length:u,parent:n,value:l}),i(c+u)},onSeparator:function(l,c,u){n.type==="property"&&(l===":"?n.colonOffset=c:l===","&&i(c))},onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};Fl(r,o,t);var a=n.children[0];return a&&delete a.parent,a}function lP(r,e){if(r){for(var t=r,n=0,i=e;n<i.length;n++){var s=i[n];if(typeof s=="string"){if(t.type!=="object"||!Array.isArray(t.children))return;for(var o=!1,a=0,l=t.children;a<l.length;a++){var c=l[a];if(Array.isArray(c.children)&&c.children[0].value===s){t=c.children[1],o=!0;break}}if(!o)return}else{var u=s;if(t.type!=="array"||u<0||!Array.isArray(t.children)||u>=t.children.length)return;t=t.children[u]}}return t}}function iy(r){if(!r.parent||!r.parent.children)return[];var e=iy(r.parent);if(r.parent.type==="property"){var t=r.parent.children[0].value;e.push(t)}else if(r.parent.type==="array"){var n=r.parent.children.indexOf(r);n!==-1&&e.push(n)}return e}function Mf(r){switch(r.type){case"array":return r.children.map(Mf);case"object":for(var e=Object.create(null),t=0,n=r.children;t<n.length;t++){var i=n[t],s=i.children[1];s&&(e[i.children[0].value]=Mf(s))}return e;case"null":case"string":case"number":case"boolean":return r.value;default:return}}function cP(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}function sy(r,e,t){if(t===void 0&&(t=!1),cP(r,e,t)){var n=r.children;if(Array.isArray(n))for(var i=0;i<n.length&&n[i].offset<=e;i++){var s=sy(n[i],e,t);if(s)return s}return r}}function Fl(r,e,t){t===void 0&&(t=Do.DEFAULT);var n=Bl(r,!1);function i(B){return B?function(){return B(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}function s(B){return B?function(U){return B(U,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}var o=i(e.onObjectBegin),a=s(e.onObjectProperty),l=i(e.onObjectEnd),c=i(e.onArrayBegin),u=i(e.onArrayEnd),h=s(e.onLiteralValue),d=s(e.onSeparator),p=i(e.onComment),m=s(e.onError),y=t&&t.disallowComments,w=t&&t.allowTrailingComma;function A(){for(;;){var B=n.scan();switch(n.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:y||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(B){case 12:case 13:y?T(10):p();break;case 16:T(1);break;case 15:case 14:break;default:return B}}}function T(B,U,G){if(U===void 0&&(U=[]),G===void 0&&(G=[]),m(B),U.length+G.length>0)for(var re=n.getToken();re!==17;){if(U.indexOf(re)!==-1){A();break}else if(G.indexOf(re)!==-1)break;re=A()}}function E(B){var U=n.getTokenValue();return B?h(U):a(U),A(),!0}function F(){switch(n.getToken()){case 11:var B=n.getTokenValue(),U=Number(B);isNaN(U)&&(T(2),U=0),h(U);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return A(),!0}function I(){return n.getToken()!==10?(T(3,[],[2,5]),!1):(E(!1),n.getToken()===6?(d(":"),A(),Q()||T(4,[],[2,5])):T(5,[],[2,5]),!0)}function W(){o(),A();for(var B=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(B||T(4,[],[]),d(","),A(),n.getToken()===2&&w)break}else B&&T(6,[],[]);I()||T(4,[],[2,5]),B=!0}return l(),n.getToken()!==2?T(7,[2],[]):A(),!0}function j(){c(),A();for(var B=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(B||T(4,[],[]),d(","),A(),n.getToken()===4&&w)break}else B&&T(6,[],[]);Q()||T(4,[],[4,5]),B=!0}return u(),n.getToken()!==4?T(8,[4],[]):A(),!0}function Q(){switch(n.getToken()){case 3:return j();case 1:return W();case 10:return E(!0);default:return F()}}return A(),n.getToken()===17?t.allowEmptyContent?!0:(T(4,[],[]),!1):Q()?(n.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}function uP(r,e){var t=Bl(r),n=[],i,s=0,o;do switch(o=t.getPosition(),i=t.scan(),i){case 12:case 13:case 17:s!==o&&n.push(r.substring(s,o)),e!==void 0&&n.push(t.getTokenValue().replace(/[^\r\n]/g,e)),s=t.getPosition();break}while(i!==17);return n.join("")}function oy(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(r){if(Array.isArray(r))return"array"}else return"null";return"object"}default:return"null"}}function k3(r,e,t){return fP(r,e,void 0,t)}function fP(r,e,t,n){for(var i,s=e.slice(),o=[],a=parseTree(r,o),l=void 0,c=void 0;s.length>0&&(c=s.pop(),l=findNodeAtLocation(a,s),l===void 0&&t!==void 0);)typeof c=="string"?t=(i={},i[c]=t,i):t=[t];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){var u=findNodeAtLocation(l,[c]);if(u!==void 0)if(t===void 0){if(!u.parent)throw new Error("Malformed AST");var h=l.children.indexOf(u.parent),d=void 0,p=u.parent.offset+u.parent.length;if(h>0){var m=l.children[h-1];d=m.offset+m.length}else if(d=l.offset+1,l.children.length>1){var y=l.children[1];p=y.offset}return Mi(r,{offset:d,length:p-d,content:""},n)}else return Mi(r,{offset:u.offset,length:u.length,content:JSON.stringify(t)},n);else{if(t===void 0)return[];var w=JSON.stringify(c)+": "+JSON.stringify(t),A=n.getInsertionIndex?n.getInsertionIndex(l.children.map(function(B){return B.children[0].value})):l.children.length,T=void 0;if(A>0){var m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}else l.children.length===0?T={offset:l.offset+1,length:0,content:w}:T={offset:l.offset+1,length:0,content:w+","};return Mi(r,T,n)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children)){var E=c;if(E===-1){var w=""+JSON.stringify(t),T=void 0;if(l.children.length===0)T={offset:l.offset+1,length:0,content:w};else{var m=l.children[l.children.length-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(r,T,n)}else if(t===void 0&&l.children.length>=0){var F=c,I=l.children[F],T=void 0;if(l.children.length===1)T={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===F){var m=l.children[F-1],W=m.offset+m.length,j=l.offset+l.length;T={offset:W,length:j-2-W,content:""}}else T={offset:I.offset,length:l.children[F+1].offset-I.offset,content:""};return Mi(r,T,n)}else if(t!==void 0){var T=void 0,w=""+JSON.stringify(t);if(!n.isArrayInsertion&&l.children.length>c){var Q=l.children[c];T={offset:Q.offset,length:Q.length,content:w}}else if(l.children.length===0||c===0)T={offset:l.offset+1,length:0,content:l.children.length===0?w:w+","};else{var A=c>l.children.length?l.children.length:c,m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(r,T,n)}else throw new Error("Can not "+(t===void 0?"remove":n.isArrayInsertion?"insert":"modify")+" Array index "+E+" as length is not sufficient")}else throw new Error("Can not add "+(typeof c!="number"?"index":"property")+" to parent of type "+l.type);else{if(t===void 0)throw new Error("Can not delete in empty document");return Mi(r,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(t)},n)}}function Mi(r,e,t){if(!t.formattingOptions)return[e];var n=ay(r,e),i=e.offset,s=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!isEOL(n,i-1);)i--;for(;s<n.length&&!isEOL(n,s);)s++}for(var o=format(n,{offset:i,length:s-i},t.formattingOptions),a=o.length-1;a>=0;a--){var l=o[a];n=ay(n,l),i=Math.min(i,l.offset),s=Math.max(s,l.offset+l.length),s+=l.content.length-l.length}var c=r.length-(n.length-s)-i;return[{offset:i,length:c,content:n.substring(i,s)}]}function ay(r,e){return r.substring(0,e.offset)+e.content+r.substring(e.offset+e.length)}function A3(r,e){return`\r
|
|
213
|
+
`.indexOf(r.charAt(e))!==-1}var ws=Bl,C3=sP,hP=oP,O3=aP,E3=lP,dP=sy,pP=iy,gP=Mf,T3=Fl,P3=uP;function M3(r){switch(r){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function mP(r,e,t){return rP(r,e,t)}function I3(r,e,t,n){return edit.setProperty(r,e,t,n)}function D3(r,e){for(var t=e.length-1;t>=0;t--)r=edit.applyEdit(r,e[t]);return r}function No(r,e){if(r===e)return!0;if(r==null||e===null||e===void 0||typeof r!=typeof e||typeof r!="object"||Array.isArray(r)!==Array.isArray(e))return!1;var t,n;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(t=0;t<r.length;t++)if(!No(r[t],e[t]))return!1}else{var i=[];for(n in r)i.push(n);i.sort();var s=[];for(n in e)s.push(n);if(s.sort(),!No(i,s))return!1;for(t=0;t<i.length;t++)if(!No(r[i[t]],e[i[t]]))return!1}return!0}function Cr(r){return typeof r=="number"}function Pn(r){return typeof r<"u"}function mn(r){return typeof r=="boolean"}function vP(r){return typeof r=="string"}var ly;(function(r){function e(t){return typeof t=="string"}r.is=e})(ly||(ly={}));var If;(function(r){function e(t){return typeof t=="string"}r.is=e})(If||(If={}));var cy;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(cy||(cy={}));var jl;(function(r){r.MIN_VALUE=0,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(jl||(jl={}));var jr;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=jl.MAX_VALUE),i===Number.MAX_VALUE&&(i=jl.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&X.uinteger(i.line)&&X.uinteger(i.character)}r.is=t})(jr||(jr={}));var ze;(function(r){function e(n,i,s,o){if(X.uinteger(n)&&X.uinteger(i)&&X.uinteger(s)&&X.uinteger(o))return{start:jr.create(n,i),end:jr.create(s,o)};if(jr.is(n)&&jr.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments[".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,"]"))}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&jr.is(i.start)&&jr.is(i.end)}r.is=t})(ze||(ze={}));var Ss;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&ze.is(i.range)&&(X.string(i.uri)||X.undefined(i.uri))}r.is=t})(Ss||(Ss={}));var uy;(function(r){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&ze.is(i.targetRange)&&X.string(i.targetUri)&&ze.is(i.targetSelectionRange)&&(ze.is(i.originSelectionRange)||X.undefined(i.originSelectionRange))}r.is=t})(uy||(uy={}));var Df;(function(r){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&X.numberRange(i.red,0,1)&&X.numberRange(i.green,0,1)&&X.numberRange(i.blue,0,1)&&X.numberRange(i.alpha,0,1)}r.is=t})(Df||(Df={}));var fy;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&ze.is(i.range)&&Df.is(i.color)}r.is=t})(fy||(fy={}));var hy;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&X.string(i.label)&&(X.undefined(i.textEdit)||Vr.is(i))&&(X.undefined(i.additionalTextEdits)||X.typedArray(i.additionalTextEdits,Vr.is))}r.is=t})(hy||(hy={}));var Ro;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(Ro||(Ro={}));var dy;(function(r){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return X.defined(s)&&(c.startCharacter=s),X.defined(o)&&(c.endCharacter=o),X.defined(a)&&(c.kind=a),X.defined(l)&&(c.collapsedText=l),c}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&X.uinteger(i.startLine)&&X.uinteger(i.startLine)&&(X.undefined(i.startCharacter)||X.uinteger(i.startCharacter))&&(X.undefined(i.endCharacter)||X.uinteger(i.endCharacter))&&(X.undefined(i.kind)||X.string(i.kind))}r.is=t})(dy||(dy={}));var Nf;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&Ss.is(i.location)&&X.string(i.message)}r.is=t})(Nf||(Nf={}));var Me;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(Me||(Me={}));var py;(function(r){r.Unnecessary=1,r.Deprecated=2})(py||(py={}));var gy;(function(r){function e(t){var n=t;return X.objectLiteral(n)&&X.string(n.href)}r.is=e})(gy||(gy={}));var Mn;(function(r){function e(n,i,s,o,a,l){var c={range:n,message:i};return X.defined(s)&&(c.severity=s),X.defined(o)&&(c.code=o),X.defined(a)&&(c.source=a),X.defined(l)&&(c.relatedInformation=l),c}r.create=e;function t(n){var i,s=n;return X.defined(s)&&ze.is(s.range)&&X.string(s.message)&&(X.number(s.severity)||X.undefined(s.severity))&&(X.integer(s.code)||X.string(s.code)||X.undefined(s.code))&&(X.undefined(s.codeDescription)||X.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(X.string(s.source)||X.undefined(s.source))&&(X.undefined(s.relatedInformation)||X.typedArray(s.relatedInformation,Nf.is))}r.is=t})(Mn||(Mn={}));var ks;(function(r){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a={title:n,command:i};return X.defined(s)&&s.length>0&&(a.arguments=s),a}r.create=e;function t(n){var i=n;return X.defined(i)&&X.string(i.title)&&X.string(i.command)}r.is=t})(ks||(ks={}));var Vr;(function(r){function e(s,o){return{range:s,newText:o}}r.replace=e;function t(s,o){return{range:{start:s,end:s},newText:o}}r.insert=t;function n(s){return{range:s,newText:""}}r.del=n;function i(s){var o=s;return X.objectLiteral(o)&&X.string(o.newText)&&ze.is(o.range)}r.is=i})(Vr||(Vr={}));var As;(function(r){function e(n,i,s){var o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&X.string(i.label)&&(X.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(X.string(i.description)||i.description===void 0)}r.is=t})(As||(As={}));var qt;(function(r){function e(t){var n=t;return X.string(n)}r.is=e})(qt||(qt={}));var ii;(function(r){function e(s,o,a){return{range:s,newText:o,annotationId:a}}r.replace=e;function t(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}r.insert=t;function n(s,o){return{range:s,newText:"",annotationId:o}}r.del=n;function i(s){var o=s;return Vr.is(o)&&(As.is(o.annotationId)||qt.is(o.annotationId))}r.is=i})(ii||(ii={}));var Vl;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&$l.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(Vl||(Vl={}));var Lo;(function(r){function e(n,i,s){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="create"&&X.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||X.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||X.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}r.is=t})(Lo||(Lo={}));var Bo;(function(r){function e(n,i,s,o){var a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}r.create=e;function t(n){var i=n;return i&&i.kind==="rename"&&X.string(i.oldUri)&&X.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||X.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||X.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}r.is=t})(Bo||(Bo={}));var Fo;(function(r){function e(n,i,s){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="delete"&&X.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||X.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||X.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}r.is=t})(Fo||(Fo={}));var Rf;(function(r){function e(t){var n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return X.string(i.kind)?Lo.is(i)||Bo.is(i)||Fo.is(i):Vl.is(i)}))}r.is=e})(Rf||(Rf={}));var Wl=function(){function r(e,t){this.edits=e,this.changeAnnotations=t}return r.prototype.insert=function(e,t,n){var i,s;if(n===void 0?i=Vr.insert(e,t):qt.is(n)?(s=n,i=ii.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.insert(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.replace=function(e,t,n){var i,s;if(n===void 0?i=Vr.replace(e,t):qt.is(n)?(s=n,i=ii.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.replace(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.delete=function(e,t){var n,i;if(t===void 0?n=Vr.del(e):qt.is(t)?(i=t,n=ii.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),n=ii.del(e,i)),this.edits.push(n),i!==void 0)return i},r.prototype.add=function(e){this.edits.push(e)},r.prototype.all=function(){return this.edits},r.prototype.clear=function(){this.edits.splice(0,this.edits.length)},r.prototype.assertChangeAnnotations=function(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},r}(),my=function(){function r(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}return r.prototype.all=function(){return this._annotations},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),r.prototype.manage=function(e,t){var n;if(qt.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw new Error("Id ".concat(n," is already in use."));if(t===void 0)throw new Error("No annotation provided for id ".concat(n));return this._annotations[n]=t,this._size++,n},r.prototype.nextId=function(){return this._counter++,this._counter.toString()},r}(),N3=function(){function r(e){var t=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new my(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Vl.is(n)){var i=new Wl(n.edits,t._changeAnnotations);t._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Wl(e.changes[n]);t._textEditChanges[n]=i})):this._workspaceEdit={}}return Object.defineProperty(r.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),r.prototype.getTextEditChange=function(e){if($l.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){var i=[],s={textDocument:t,edits:i};this._workspaceEdit.documentChanges.push(s),n=new Wl(i,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[e];if(!n){var i=[];this._workspaceEdit.changes[e]=i,n=new Wl(i),this._textEditChanges[e]=n}return n}},r.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new my,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},r.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},r.prototype.createFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;As.is(t)||qt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=Lo.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Lo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r.prototype.renameFile=function(e,t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;As.is(n)||qt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Bo.create(e,t,i):(a=qt.is(s)?s:this._changeAnnotations.manage(s),o=Bo.create(e,t,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a},r.prototype.deleteFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;As.is(t)||qt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=Fo.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Fo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r}(),vy;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){var i=n;return X.defined(i)&&X.string(i.uri)}r.is=t})(vy||(vy={}));var yy;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&X.string(i.uri)&&X.integer(i.version)}r.is=t})(yy||(yy={}));var $l;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&X.string(i.uri)&&(i.version===null||X.integer(i.version))}r.is=t})($l||($l={}));var by;(function(r){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}r.create=e;function t(n){var i=n;return X.defined(i)&&X.string(i.uri)&&X.string(i.languageId)&&X.integer(i.version)&&X.string(i.text)}r.is=t})(by||(by={}));var Ii;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){var n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(Ii||(Ii={}));var jo;(function(r){function e(t){var n=t;return X.objectLiteral(t)&&Ii.is(n.kind)&&X.string(n.value)}r.is=e})(jo||(jo={}));var Or;(function(r){r.Text=1,r.Method=2,r.Function=3,r.Constructor=4,r.Field=5,r.Variable=6,r.Class=7,r.Interface=8,r.Module=9,r.Property=10,r.Unit=11,r.Value=12,r.Enum=13,r.Keyword=14,r.Snippet=15,r.Color=16,r.File=17,r.Reference=18,r.Folder=19,r.EnumMember=20,r.Constant=21,r.Struct=22,r.Event=23,r.Operator=24,r.TypeParameter=25})(Or||(Or={}));var Dt;(function(r){r.PlainText=1,r.Snippet=2})(Dt||(Dt={}));var xy;(function(r){r.Deprecated=1})(xy||(xy={}));var wy;(function(r){function e(n,i,s){return{newText:n,insert:i,replace:s}}r.create=e;function t(n){var i=n;return i&&X.string(i.newText)&&ze.is(i.insert)&&ze.is(i.replace)}r.is=t})(wy||(wy={}));var Sy;(function(r){r.asIs=1,r.adjustIndentation=2})(Sy||(Sy={}));var ky;(function(r){function e(t){var n=t;return n&&(X.string(n.detail)||n.detail===void 0)&&(X.string(n.description)||n.description===void 0)}r.is=e})(ky||(ky={}));var Lf;(function(r){function e(t){return{label:t}}r.create=e})(Lf||(Lf={}));var Ay;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(Ay||(Ay={}));var Hl;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){var i=n;return X.string(i)||X.objectLiteral(i)&&X.string(i.language)&&X.string(i.value)}r.is=t})(Hl||(Hl={}));var Cy;(function(r){function e(t){var n=t;return!!n&&X.objectLiteral(n)&&(jo.is(n.contents)||Hl.is(n.contents)||X.typedArray(n.contents,Hl.is))&&(t.range===void 0||ze.is(t.range))}r.is=e})(Cy||(Cy={}));var Oy;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(Oy||(Oy={}));var Ey;(function(r){function e(t,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var o={label:t};return X.defined(n)&&(o.documentation=n),X.defined(i)?o.parameters=i:o.parameters=[],o}r.create=e})(Ey||(Ey={}));var Ty;(function(r){r.Text=1,r.Read=2,r.Write=3})(Ty||(Ty={}));var Py;(function(r){function e(t,n){var i={range:t};return X.number(n)&&(i.kind=n),i}r.create=e})(Py||(Py={}));var vn;(function(r){r.File=1,r.Module=2,r.Namespace=3,r.Package=4,r.Class=5,r.Method=6,r.Property=7,r.Field=8,r.Constructor=9,r.Enum=10,r.Interface=11,r.Function=12,r.Variable=13,r.Constant=14,r.String=15,r.Number=16,r.Boolean=17,r.Array=18,r.Object=19,r.Key=20,r.Null=21,r.EnumMember=22,r.Struct=23,r.Event=24,r.Operator=25,r.TypeParameter=26})(vn||(vn={}));var My;(function(r){r.Deprecated=1})(My||(My={}));var Iy;(function(r){function e(t,n,i,s,o){var a={name:t,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}r.create=e})(Iy||(Iy={}));var Dy;(function(r){function e(t,n,i,s){return s!==void 0?{name:t,kind:n,location:{uri:i,range:s}}:{name:t,kind:n,location:{uri:i}}}r.create=e})(Dy||(Dy={}));var Ny;(function(r){function e(n,i,s,o,a,l){var c={name:n,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}r.create=e;function t(n){var i=n;return i&&X.string(i.name)&&X.number(i.kind)&&ze.is(i.range)&&ze.is(i.selectionRange)&&(i.detail===void 0||X.string(i.detail))&&(i.deprecated===void 0||X.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}r.is=t})(Ny||(Ny={}));var Ry;(function(r){r.Empty="",r.QuickFix="quickfix",r.Refactor="refactor",r.RefactorExtract="refactor.extract",r.RefactorInline="refactor.inline",r.RefactorRewrite="refactor.rewrite",r.Source="source",r.SourceOrganizeImports="source.organizeImports",r.SourceFixAll="source.fixAll"})(Ry||(Ry={}));var zl;(function(r){r.Invoked=1,r.Automatic=2})(zl||(zl={}));var Ly;(function(r){function e(n,i,s){var o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}r.create=e;function t(n){var i=n;return X.defined(i)&&X.typedArray(i.diagnostics,Mn.is)&&(i.only===void 0||X.typedArray(i.only,X.string))&&(i.triggerKind===void 0||i.triggerKind===zl.Invoked||i.triggerKind===zl.Automatic)}r.is=t})(Ly||(Ly={}));var By;(function(r){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ks.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return i&&X.string(i.title)&&(i.diagnostics===void 0||X.typedArray(i.diagnostics,Mn.is))&&(i.kind===void 0||X.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ks.is(i.command))&&(i.isPreferred===void 0||X.boolean(i.isPreferred))&&(i.edit===void 0||Rf.is(i.edit))}r.is=t})(By||(By={}));var Fy;(function(r){function e(n,i){var s={range:n};return X.defined(i)&&(s.data=i),s}r.create=e;function t(n){var i=n;return X.defined(i)&&ze.is(i.range)&&(X.undefined(i.command)||ks.is(i.command))}r.is=t})(Fy||(Fy={}));var jy;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&X.uinteger(i.tabSize)&&X.boolean(i.insertSpaces)}r.is=t})(jy||(jy={}));var Vy;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){var i=n;return X.defined(i)&&ze.is(i.range)&&(X.undefined(i.target)||X.string(i.target))}r.is=t})(Vy||(Vy={}));var Ul;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&ze.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Ul||(Ul={}));var Wy;(function(r){r.namespace="namespace",r.type="type",r.class="class",r.enum="enum",r.interface="interface",r.struct="struct",r.typeParameter="typeParameter",r.parameter="parameter",r.variable="variable",r.property="property",r.enumMember="enumMember",r.event="event",r.function="function",r.method="method",r.macro="macro",r.keyword="keyword",r.modifier="modifier",r.comment="comment",r.string="string",r.number="number",r.regexp="regexp",r.operator="operator",r.decorator="decorator"})(Wy||(Wy={}));var $y;(function(r){r.declaration="declaration",r.definition="definition",r.readonly="readonly",r.static="static",r.deprecated="deprecated",r.abstract="abstract",r.async="async",r.modification="modification",r.documentation="documentation",r.defaultLibrary="defaultLibrary"})($y||($y={}));var Hy;(function(r){function e(t){var n=t;return X.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}r.is=e})(Hy||(Hy={}));var zy;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){var i=n;return i!=null&&ze.is(i.range)&&X.string(i.text)}r.is=t})(zy||(zy={}));var Uy;(function(r){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}r.create=e;function t(n){var i=n;return i!=null&&ze.is(i.range)&&X.boolean(i.caseSensitiveLookup)&&(X.string(i.variableName)||i.variableName===void 0)}r.is=t})(Uy||(Uy={}));var Gy;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){var i=n;return i!=null&&ze.is(i.range)&&(X.string(i.expression)||i.expression===void 0)}r.is=t})(Gy||(Gy={}));var Ky;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){var i=n;return X.defined(i)&&ze.is(n.stoppedLocation)}r.is=t})(Ky||(Ky={}));var Bf;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(Bf||(Bf={}));var Ff;(function(r){function e(n){return{value:n}}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&(i.tooltip===void 0||X.string(i.tooltip)||jo.is(i.tooltip))&&(i.location===void 0||Ss.is(i.location))&&(i.command===void 0||ks.is(i.command))}r.is=t})(Ff||(Ff={}));var Yy;(function(r){function e(n,i,s){var o={position:n,label:i};return s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return X.objectLiteral(i)&&jr.is(i.position)&&(X.string(i.label)||X.typedArray(i.label,Ff.is))&&(i.kind===void 0||Bf.is(i.kind))&&i.textEdits===void 0||X.typedArray(i.textEdits,Vr.is)&&(i.tooltip===void 0||X.string(i.tooltip)||jo.is(i.tooltip))&&(i.paddingLeft===void 0||X.boolean(i.paddingLeft))&&(i.paddingRight===void 0||X.boolean(i.paddingRight))}r.is=t})(Yy||(Yy={}));var Jy;(function(r){function e(t){var n=t;return X.objectLiteral(n)&&If.is(n.uri)&&X.string(n.name)}r.is=e})(Jy||(Jy={}));var R3=null,Xy;(function(r){function e(s,o,a,l){return new yP(s,o,a,l)}r.create=e;function t(s){var o=s;return!!(X.defined(o)&&X.string(o.uri)&&(X.undefined(o.languageId)||X.string(o.languageId))&&X.uinteger(o.lineCount)&&X.func(o.getText)&&X.func(o.positionAt)&&X.func(o.offsetAt))}r.is=t;function n(s,o){for(var a=s.getText(),l=i(o,function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),c=a.length,u=l.length-1;u>=0;u--){var h=l[u],d=s.offsetAt(h.range.start),p=s.offsetAt(h.range.end);if(p<=c)a=a.substring(0,d)+h.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}r.applyEdits=n;function i(s,o){if(s.length<=1)return s;var a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);for(var u=0,h=0,d=0;u<l.length&&h<c.length;){var p=o(l[u],c[h]);p<=0?s[d++]=l[u++]:s[d++]=c[h++]}for(;u<l.length;)s[d++]=l[u++];for(;h<c.length;)s[d++]=c[h++];return s}})(Xy||(Xy={}));var yP=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0},r.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],t=this._content,n=!0,i=0;i<t.length;i++){n&&(e.push(i),n=!1);var s=t.charAt(i);n=s==="\r"||s===`
|
|
214
|
+
`,s==="\r"&&i+1<t.length&&t.charAt(i+1)===`
|
|
215
|
+
`&&i++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return jr.create(0,e);for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return jr.create(o,e-t[o])},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r}(),X;(function(r){var e=Object.prototype.toString;function t(p){return typeof p<"u"}r.defined=t;function n(p){return typeof p>"u"}r.undefined=n;function i(p){return p===!0||p===!1}r.boolean=i;function s(p){return e.call(p)==="[object String]"}r.string=s;function o(p){return e.call(p)==="[object Number]"}r.number=o;function a(p,m,y){return e.call(p)==="[object Number]"&&m<=p&&p<=y}r.numberRange=a;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}r.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}r.uinteger=c;function u(p){return e.call(p)==="[object Function]"}r.func=u;function h(p){return p!==null&&typeof p=="object"}r.objectLiteral=h;function d(p,m){return Array.isArray(p)&&p.every(m)}r.typedArray=d})(X||(X={}));var bP=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return r.concat(s||Array.prototype.slice.call(e))},Qy=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){for(var n=0,i=e;n<i.length;n++){var s=i[n];if(r.isIncremental(s)){var o=_y(s.range),a=this.offsetAt(o.start),l=this.offsetAt(o.end);this._content=this._content.substring(0,a)+s.text+this._content.substring(l,this._content.length);var c=Math.max(o.start.line,0),u=Math.max(o.end.line,0),h=this._lineOffsets,d=Zy(s.text,!1,a);if(u-c===d.length)for(var p=0,m=d.length;p<m;p++)h[p+c+1]=d[p];else d.length<1e4?h.splice.apply(h,bP([c+1,u-c],d,!1)):this._lineOffsets=h=h.slice(0,c+1).concat(d,h.slice(u+1));var y=s.text.length-(l-a);if(y!==0)for(var p=c+1+d.length,m=h.length;p<m;p++)h[p]=h[p]+y}else if(r.isFull(s))this._content=s.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received")}this._version=t},r.prototype.getLineOffsets=function(){return this._lineOffsets===void 0&&(this._lineOffsets=Zy(this._content,!0)),this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return{line:o,character:e-t[o]}},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r.isIncremental=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")},r.isFull=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0},r}(),jf;(function(r){function e(i,s,o,a){return new Qy(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof Qy)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){for(var o=i.getText(),a=Vf(s.map(xP),function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),l=0,c=[],u=0,h=a;u<h.length;u++){var d=h[u],p=i.offsetAt(d.range.start);if(p<l)throw new Error("Overlapping edit");p>l&&c.push(o.substring(l,p)),d.newText.length&&c.push(d.newText),l=i.offsetAt(d.range.end)}return c.push(o.substr(l)),c.join("")}r.applyEdits=n})(jf||(jf={}));function Vf(r,e){if(r.length<=1)return r;var t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Vf(n,e),Vf(i,e);for(var s=0,o=0,a=0;s<n.length&&o<i.length;){var l=e(n[s],i[o]);l<=0?r[a++]=n[s++]:r[a++]=i[o++]}for(;s<n.length;)r[a++]=n[s++];for(;o<i.length;)r[a++]=i[o++];return r}function Zy(r,e,t){t===void 0&&(t=0);for(var n=e?[t]:[],i=0;i<r.length;i++){var s=r.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function _y(r){var e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function xP(r){var e=_y(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var $e;(function(r){r[r.Undefined=0]="Undefined",r[r.EnumValueMismatch=1]="EnumValueMismatch",r[r.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",r[r.UnexpectedEndOfString=258]="UnexpectedEndOfString",r[r.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",r[r.InvalidUnicode=260]="InvalidUnicode",r[r.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",r[r.InvalidCharacter=262]="InvalidCharacter",r[r.PropertyExpected=513]="PropertyExpected",r[r.CommaExpected=514]="CommaExpected",r[r.ColonExpected=515]="ColonExpected",r[r.ValueExpected=516]="ValueExpected",r[r.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",r[r.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",r[r.TrailingComma=519]="TrailingComma",r[r.DuplicateKey=520]="DuplicateKey",r[r.CommentNotPermitted=521]="CommentNotPermitted",r[r.SchemaResolveError=768]="SchemaResolveError"})($e||($e={}));var qy;(function(r){r.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Ii.Markdown,Ii.PlainText],commitCharactersSupport:!0}}}}})(qy||(qy={}));var Di=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),wP={"color-hex":{errorMessage:"Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.",pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:"String is not a RFC3339 date-time.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:"String is not a RFC3339 date.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:"String is not a RFC3339 time.",pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:"String is not an e-mail address.",pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Ni=function(){function r(e,t,n){this.offset=t,this.length=n,this.parent=e}return Object.defineProperty(r.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},r}(),SP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="null",i.value=null,i}return e}(Ni),eb=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,i)||this;return s.type="boolean",s.value=n,s}return e}(Ni),kP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(Ni),AP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return e}(Ni),tb=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,n,i)||this;return s.type="string",s.value="",s}return e}(Ni),CP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="property",i.colonOffset=-1,i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(Ni),OP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(Ni);function ur(r){return mn(r)?r?{}:{not:{}}:r}var rb;(function(r){r[r.Key=0]="Key",r[r.Enum=1]="Enum"})(rb||(rb={}));var EP=function(){function r(e,t){e===void 0&&(e=-1),t===void 0&&(t=null),this.focusOffset=e,this.exclude=t,this.schemas=[]}return r.prototype.add=function(e){this.schemas.push(e)},r.prototype.merge=function(e){var t;(t=this.schemas).push.apply(t,e.schemas)},r.prototype.include=function(e){return(this.focusOffset===-1||nb(e,this.focusOffset))&&e!==this.exclude},r.prototype.newSub=function(){return new r(-1,this.exclude)},r}(),Wf=function(){function r(){}return Object.defineProperty(r.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.add=function(e){},r.prototype.merge=function(e){},r.prototype.include=function(e){return!0},r.prototype.newSub=function(){return this},r.instance=new r,r}(),fr=function(){function r(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return r.prototype.hasProblems=function(){return!!this.problems.length},r.prototype.mergeAll=function(e){for(var t=0,n=e;t<n.length;t++){var i=n[t];this.merge(i)}},r.prototype.merge=function(e){this.problems=this.problems.concat(e.problems)},r.prototype.mergeEnumValues=function(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(var t=0,n=this.problems;t<n.length;t++){var i=n[t];i.code===$e.EnumValueMismatch&&(i.message="Value is not accepted. Valid values: "+this.enumValues.map(function(s){return JSON.stringify(s)}).join(", ")+".")}}},r.prototype.mergePropertyMatch=function(e){this.merge(e),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++},r.prototype.compare=function(e){var t=this.hasProblems();return t!==e.hasProblems()?t?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches},r}();function TP(r,e){return e===void 0&&(e=[]),new ib(r,e,[])}function si(r){return gP(r)}function $f(r){return pP(r)}function nb(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}var ib=function(){function r(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=[]),this.root=e,this.syntaxErrors=t,this.comments=n}return r.prototype.getNodeFromOffset=function(e,t){if(t===void 0&&(t=!1),this.root)return dP(this.root,e,t)},r.prototype.visit=function(e){if(this.root){var t=function(n){var i=e(n),s=n.children;if(Array.isArray(s))for(var o=0;o<s.length&&i;o++)i=t(s[o]);return i};t(this.root)}},r.prototype.validate=function(e,t){if(this.root&&t){var n=new fr;return Ht(this.root,t,n,Wf.instance),n.problems.map(function(i){var s=ze.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Mn.create(s,i.message,i.severity,i.code)})}return null},r.prototype.getMatchingSchemas=function(e,t,n){t===void 0&&(t=-1),n===void 0&&(n=null);var i=new EP(t,n);return this.root&&e&&Ht(this.root,e,new fr,i),i.schemas},r}();function Ht(r,e,t,n){if(!r||!n.include(r))return;switch(r.type){case"object":l(r,e,t,n);break;case"array":a(r,e,t,n);break;case"string":o(r,e,t,n);break;case"number":s(r,e,t,n);break;case"property":return Ht(r.valueNode,e,t,n)}i(),n.add({node:r,schema:e});function i(){function c(re){return r.type===re||re==="integer"&&r.type==="number"&&r.isInteger||e.nullable&&r.value===null}if(Array.isArray(e.type)?e.type.some(c)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Me.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(c(e.type)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Me.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,h=e.allOf;u<h.length;u++){var d=h[u];Ht(r,ur(d),t,n)}var p=ur(e.not);if(p){var m=new fr,y=n.newSub();Ht(r,p,m,y),m.hasProblems()||t.problems.push({location:{offset:r.offset,length:r.length},severity:Me.Warning,message:"Matches a schema that is not allowed."});for(var w=0,A=y.schemas;w<A.length;w++){var T=A[w];T.inverted=!T.inverted,n.add(T)}}var E=function(re,ce){for(var he=[],xe=null,Fe=0,we=re;Fe<we.length;Fe++){var Ee=we[Fe],Ue=ur(Ee),Ie=new fr,nt=n.newSub();if(Ht(r,Ue,Ie,nt),Ie.hasProblems()||he.push(Ue),!xe)xe={schema:Ue,validationResult:Ie,matchingSchemas:nt};else if(!ce&&!Ie.hasProblems()&&!xe.validationResult.hasProblems())xe.matchingSchemas.merge(nt),xe.validationResult.propertiesMatches+=Ie.propertiesMatches,xe.validationResult.propertiesValueMatches+=Ie.propertiesValueMatches;else{var dt=Ie.compare(xe.validationResult);dt>0?xe={schema:Ue,validationResult:Ie,matchingSchemas:nt}:dt===0&&(xe.matchingSchemas.merge(nt),xe.validationResult.mergeEnumValues(Ie))}}return he.length>1&&ce&&t.problems.push({location:{offset:r.offset,length:1},severity:Me.Warning,message:"Matches multiple schemas when only one must validate."}),xe!==null&&(t.merge(xe.validationResult),t.propertiesMatches+=xe.validationResult.propertiesMatches,t.propertiesValueMatches+=xe.validationResult.propertiesValueMatches,n.merge(xe.matchingSchemas)),he.length};Array.isArray(e.anyOf)&&E(e.anyOf,!1),Array.isArray(e.oneOf)&&E(e.oneOf,!0);var F=function(re){var ce=new fr,he=n.newSub();Ht(r,ur(re),ce,he),t.merge(ce),t.propertiesMatches+=ce.propertiesMatches,t.propertiesValueMatches+=ce.propertiesValueMatches,n.merge(he)},I=function(re,ce,he){var xe=ur(re),Fe=new fr,we=n.newSub();Ht(r,xe,Fe,we),n.merge(we),Fe.hasProblems()?he&&F(he):ce&&F(ce)},W=ur(e.if);if(W&&I(W,ur(e.then),ur(e.else)),Array.isArray(e.enum)){for(var j=si(r),Q=!1,B=0,U=e.enum;B<U.length;B++){var G=U[B];if(No(j,G)){Q=!0;break}}t.enumValues=e.enum,t.enumValueMatch=Q,Q||t.problems.push({location:{offset:r.offset,length:r.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(re){return JSON.stringify(re)}).join(", ")+"."})}if(Pn(e.const)){var j=si(r);No(j,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:r.offset,length:r.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value must be "+JSON.stringify(e.const)+"."}),t.enumValueMatch=!1),t.enumValues=[e.const]}e.deprecationMessage&&r.parent&&t.problems.push({location:{offset:r.parent.offset,length:r.parent.length},severity:Me.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;Cr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(F,I){if(Cr(I))return I;if(mn(I)&&I)return F}function y(F,I){if(!mn(I)||!I)return F}var w=m(u.minimum,u.exclusiveMinimum);Cr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);Cr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);Cr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the minimum of "+T+"."});var E=y(u.maximum,u.exclusiveMaximum);Cr(E)&&p>E&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the maximum of "+E+"."})}function o(c,u,h,d){if(Cr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),Cr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),vP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||'String does not match the pattern of "'+u.pattern+'".'})}if(u.format)switch(u.format){case"uri":case"uri-reference":{var m=void 0;if(!c.value)m="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(c.value);y?!y[2]&&u.format==="uri"&&(m="URI with a scheme is expected."):m="URI is expected."}m&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+m})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var w=wP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||w.errorMessage});break;default:}}function a(c,u,h,d){if(Array.isArray(u.items)){for(var p=u.items,m=0;m<p.length;m++){var y=p[m],w=ur(y),A=new fr,T=c.items[m];T?(Ht(T,w,A,d),h.mergePropertyMatch(A)):c.items.length>=p.length&&h.propertiesValueMatches++}if(c.items.length>p.length)if(typeof u.additionalItems=="object")for(var E=p.length;E<c.items.length;E++){var A=new fr;Ht(c.items[E],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var F=ur(u.items);if(F)for(var I=0,W=c.items;I<W.length;I++){var T=W[I],A=new fr;Ht(T,F,A,d),h.mergePropertyMatch(A)}}var j=ur(u.contains);if(j){var Q=c.items.some(function(G){var re=new fr;return Ht(G,j,re,Wf.instance),!re.hasProblems()});Q||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.errorMessage||"Array does not contain required item."})}if(Cr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),Cr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var B=si(c),U=B.some(function(G,re){return re!==B.lastIndexOf(G)});U&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has duplicate items."})}}function l(c,u,h,d){for(var p=Object.create(null),m=[],y=0,w=c.properties;y<w.length;y++){var A=w[y],T=A.keyNode.value;p[T]=A.valueNode,m.push(T)}if(Array.isArray(u.required))for(var E=0,F=u.required;E<F.length;E++){var I=F[E];if(!p[I]){var W=c.parent&&c.parent.type==="property"&&c.parent.keyNode,j=W?{offset:W.offset,length:W.length}:{offset:c.offset,length:1};h.problems.push({location:j,severity:Me.Warning,message:'Missing property "'+I+'".'})}}var Q=function(or){for(var Ps=m.indexOf(or);Ps>=0;)m.splice(Ps,1),Ps=m.indexOf(or)};if(u.properties)for(var B=0,U=Object.keys(u.properties);B<U.length;B++){var I=U[B];Q(I);var G=u.properties[I],re=p[I];if(re)if(mn(G))if(G)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;Ht(re,G,ce,d),h.mergePropertyMatch(ce)}}if(u.patternProperties)for(var he=0,xe=Object.keys(u.patternProperties);he<xe.length;he++)for(var Fe=xe[he],we=new RegExp(Fe),Ee=0,Ue=m.slice(0);Ee<Ue.length;Ee++){var I=Ue[Ee];if(we.test(I)){Q(I);var re=p[I];if(re){var G=u.patternProperties[Fe];if(mn(G))if(G)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;Ht(re,G,ce,d),h.mergePropertyMatch(ce)}}}}if(typeof u.additionalProperties=="object")for(var Ie=0,nt=m;Ie<nt.length;Ie++){var I=nt[Ie],re=p[I];if(re){var ce=new fr;Ht(re,u.additionalProperties,ce,d),h.mergePropertyMatch(ce)}}else if(u.additionalProperties===!1&&m.length>0)for(var dt=0,Bt=m;dt<Bt.length;dt++){var I=Bt[dt],re=p[I];if(re){var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}}if(Cr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),Cr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var er=0,Tr=Object.keys(u.dependencies);er<Tr.length;er++){var T=Tr[er],Ct=p[T];if(Ct){var tr=u.dependencies[T];if(Array.isArray(tr))for(var Pr=0,ai=tr;Pr<ai.length;Pr++){var li=ai[Pr];p[li]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object is missing property "+li+" required by property {$key}."})}else{var G=ur(tr);if(G){var ce=new fr;Ht(c,G,ce,d),h.mergePropertyMatch(ce)}}}}var Mr=ur(u.propertyNames);if(Mr)for(var yn=0,Ql=c.properties;yn<Ql.length;yn++){var ci=Ql[yn],T=ci.keyNode;T&&Ht(T,Mr,h,Wf.instance)}}}function PP(r,e){var t=[],n=-1,i=r.getText(),s=ws(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var W=s.scan();switch(h(),W){case 12:case 13:Array.isArray(o)&&o.push(ze.create(r.positionAt(s.getTokenOffset()),r.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return W}}}function l(W){return s.getToken()===W?(a(),!0):!1}function c(W,j,Q,B,U){if(U===void 0&&(U=Me.Error),t.length===0||Q!==n){var G=ze.create(r.positionAt(Q),r.positionAt(B));t.push(Mn.create(G,W,U,j,r.languageId)),n=Q}}function u(W,j,Q,B,U){Q===void 0&&(Q=null),B===void 0&&(B=[]),U===void 0&&(U=[]);var G=s.getTokenOffset(),re=s.getTokenOffset()+s.getTokenLength();if(G===re&&G>0){for(G--;G>0&&/\s/.test(i.charAt(G));)G--;re=G+1}if(c(W,j,G,re),Q&&d(Q,!1),B.length+U.length>0)for(var ce=s.getToken();ce!==17;){if(B.indexOf(ce)!==-1){a();break}else if(U.indexOf(ce)!==-1)break;ce=a()}return Q}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",$e.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",$e.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",$e.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",$e.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",$e.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",$e.InvalidCharacter),!0}return!1}function d(W,j){return W.length=s.getTokenOffset()+s.getTokenLength()-W.offset,j&&a(),W}function p(W){if(s.getToken()!==3)return null;var j=new kP(W,s.getTokenOffset());a();for(var Q=0,B=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){B||u("Value expected",$e.ValueExpected);var U=s.getTokenOffset();if(a(),s.getToken()===4){B&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else B&&u("Expected comma",$e.CommaExpected);var G=E(j,Q++);G?j.items.push(G):u("Value expected",$e.ValueExpected,null,[],[4,5]),B=!0}return s.getToken()!==4?u("Expected comma or closing bracket",$e.CommaOrCloseBacketExpected,j):d(j,!0)}function m(W,j){var Q=new CP(W,s.getTokenOffset()),B=w(Q);if(!B)if(s.getToken()===16){u("Property keys must be doublequoted",$e.Undefined);var U=new tb(Q,s.getTokenOffset(),s.getTokenLength());U.value=s.getTokenValue(),B=U,a()}else return null;Q.keyNode=B;var G=j[B.value];if(G?(c("Duplicate object key",$e.DuplicateKey,Q.keyNode.offset,Q.keyNode.offset+Q.keyNode.length,Me.Warning),typeof G=="object"&&c("DuplicateKeyWarning",$e.DuplicateKey,G.keyNode.offset,G.keyNode.offset+G.keyNode.length,Me.Warning),j[B.value]=!0):j[B.value]=Q,s.getToken()===6)Q.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",$e.ColonExpected),s.getToken()===10&&r.positionAt(B.offset+B.length).line<r.positionAt(s.getTokenOffset()).line)return Q.length=B.length,Q;var re=E(Q,B.value);return re?(Q.valueNode=re,Q.length=re.offset+re.length-Q.offset,Q):u("Value expected",$e.ValueExpected,Q,[],[2,5])}function y(W){if(s.getToken()!==1)return null;var j=new OP(W,s.getTokenOffset()),Q=Object.create(null);a();for(var B=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){B||u("Property expected",$e.PropertyExpected);var U=s.getTokenOffset();if(a(),s.getToken()===2){B&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else B&&u("Expected comma",$e.CommaExpected);var G=m(j,Q);G?j.properties.push(G):u("Property expected",$e.PropertyExpected,null,[],[2,5]),B=!0}return s.getToken()!==2?u("Expected comma or closing brace",$e.CommaOrCloseBraceExpected,j):d(j,!0)}function w(W){if(s.getToken()!==10)return null;var j=new tb(W,s.getTokenOffset());return j.value=s.getTokenValue(),d(j,!0)}function A(W){if(s.getToken()!==11)return null;var j=new AP(W,s.getTokenOffset());if(s.getTokenError()===0){var Q=s.getTokenValue();try{var B=JSON.parse(Q);if(!Cr(B))return u("Invalid number format.",$e.Undefined,j);j.value=B}catch{return u("Invalid number format.",$e.Undefined,j)}j.isInteger=Q.indexOf(".")===-1}return d(j,!0)}function T(W){var j;switch(s.getToken()){case 7:return d(new SP(W,s.getTokenOffset()),!0);case 8:return d(new eb(W,!0,s.getTokenOffset()),!0);case 9:return d(new eb(W,!1,s.getTokenOffset()),!0);default:return null}}function E(W,j){return p(W)||y(W)||w(W)||A(W)||T(W)}var F=null,I=a();return I!==17&&(F=E(null,null),F?s.getToken()!==17&&u("End of file expected.",$e.Undefined):u("Expected a JSON object, array or literal.",$e.Undefined)),new ib(F,t,o)}function Hf(r,e,t){if(r!==null&&typeof r=="object"){var n=e+" ";if(Array.isArray(r)){if(r.length===0)return"[]";for(var i=`[
|
|
216
|
+
`,s=0;s<r.length;s++)i+=n+Hf(r[s],n,t),s<r.length-1&&(i+=","),i+=`
|
|
217
|
+
`;return i+=e+"]",i}else{var o=Object.keys(r);if(o.length===0)return"{}";for(var i=`{
|
|
218
|
+
`,s=0;s<o.length;s++){var a=o[s];i+=n+JSON.stringify(a)+": "+Hf(r[a],n,t),s<o.length-1&&(i+=","),i+=`
|
|
219
|
+
`}return i+=e+"}",i}}return t(r)}function MP(r,e){if(r.length<e.length)return!1;for(var t=0;t<e.length;t++)if(r[t]!==e[t])return!1;return!0}function zf(r,e){var t=r.length-e.length;return t>0?r.lastIndexOf(e)===t:t===0?r===e:!1}function IP(r){return r.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function L3(r,e){for(var t="";e>0;)(e&1)===1&&(t+=r),r+=r,e=e>>>1;return t}var DP=[",","}","]"],NP=[":"],RP=function(){function r(e,t,n,i){t===void 0&&(t=[]),n===void 0&&(n=Promise),i===void 0&&(i={}),this.schemaService=e,this.contributions=t,this.promiseConstructor=n,this.clientCapabilities=i,this.templateVarIdCounter=0}return r.prototype.doResolve=function(e){for(var t=this.contributions.length-1;t>=0;t--)if(this.contributions[t].resolveCompletion){var n=this.contributions[t].resolveCompletion(e);if(n)return n}return this.promiseConstructor.resolve(e)},r.prototype.doComplete=function(e,t,n){var i=this,s={items:[],isIncomplete:!1},o=e.getText(),a=e.offsetAt(t),l=n.getNodeFromOffset(a,!0);if(this.isInComment(e,l?l.offset:0,a))return Promise.resolve(s);if(l&&a===l.offset+l.length&&a>0){var c=o[a-1];(l.type==="object"&&c==="}"||l.type==="array"&&c==="]")&&(l=l.parent)}var u=this.getCurrentWord(e,a),h=null;if(l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null"))h=ze.create(e.positionAt(l.offset),e.positionAt(l.offset+l.length));else{var d=a-u.length;d>0&&o[d-1]==='"'&&d--,h=ze.create(e.positionAt(d),t)}var p=this.doesSupportsCommitCharacters(),m={},y={add:function(w){var A=m[w.label];A?A.documentation||(A.documentation=w.documentation):(m[w.label]=w,h&&(w.textEdit=Vr.replace(h,w.insertText)),p&&(w.commitCharacters=w.kind===Or.Property?NP:DP),s.items.push(w))},setAsIncomplete:function(){s.isIncomplete=!0},error:function(w){console.error(w)},log:function(w){console.log(w)},getNumberOfProposals:function(){return s.items.length}};return this.schemaService.getSchemaForResource(e.uri,n).then(function(w){var A=[],T=!0,E="",F=null;if(l&&l.type==="string"){var I=l.parent;I&&I.type==="property"&&I.keyNode===l&&(T=!I.valueNode,F=I,E=o.substr(l.offset+1,l.length-2),I&&(l=I.parent))}if(l&&l.type==="object"){if(l.offset===a)return s;var W=l.properties;W.forEach(function(U){(!F||F!==U)&&(m[U.keyNode.value]=Lf.create("__"))});var j="";T&&(j=i.evaluateSeparatorAfter(e,e.offsetAt(h.end))),w?i.getPropertyCompletions(w,n,l,T,j,y):i.getSchemaLessPropertyCompletions(n,l,E,y);var Q=$f(l);i.contributions.forEach(function(U){var G=U.collectPropertyCompletions(e.uri,Q,u,T,j==="",y);G&&A.push(G)}),!w&&u.length>0&&o.charAt(a-u.length-1)!=='"'&&(y.add({kind:Or.Property,label:i.getLabelForValue(u),insertText:i.getInsertTextForProperty(u,null,!1,j),insertTextFormat:Dt.Snippet,documentation:""}),y.setAsIncomplete())}var B={};return w?i.getValueCompletions(w,n,l,a,e,y,B):i.getSchemaLessValueCompletions(n,l,a,e,y),i.contributions.length>0&&i.getContributedValueCompletions(n,l,a,e,y,A),i.promiseConstructor.all(A).then(function(){if(y.getNumberOfProposals()===0){var U=a;l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null")&&(U=l.offset+l.length);var G=i.evaluateSeparatorAfter(e,U);i.addFillerValueCompletions(B,G,y)}return s})})},r.prototype.getPropertyCompletions=function(e,t,n,i,s,o){var a=this,l=t.getMatchingSchemas(e.schema,n.offset);l.forEach(function(c){if(c.node===n&&!c.inverted){var u=c.schema.properties;u&&Object.keys(u).forEach(function(h){var d=u[h],p=!1;if(typeof d=="object"&&d.allOf)for(var m=0,y=d.allOf;m<y.length;m++){var w=y[m];if(w.readOnly){p=!0;break}}if(typeof d=="object"&&!d.deprecationMessage&&!d.doNotSuggest&&!p){var A={kind:Or.Property,label:a.sanitizeLabel(h),insertText:a.getInsertTextForProperty(h,d,i,s),insertTextFormat:Dt.Snippet,filterText:a.getFilterTextForValue(h),documentation:a.fromMarkup(d.markdownDescription)||d.description||""};zf(A.insertText,"$1"+s)&&(A.command={title:"Suggest",command:"editor.action.triggerSuggest"}),o.add(A)}})}})},r.prototype.getSchemaLessPropertyCompletions=function(e,t,n,i){var s=this,o=function(l){l.properties.forEach(function(c){var u=c.keyNode.value;i.add({kind:Or.Property,label:s.sanitizeLabel(u),insertText:s.getInsertTextForValue(u,""),insertTextFormat:Dt.Snippet,filterText:s.getFilterTextForValue(u),documentation:""})})};if(t.parent)if(t.parent.type==="property"){var a=t.parent.keyNode.value;e.visit(function(l){return l.type==="property"&&l!==t.parent&&l.keyNode.value===a&&l.valueNode&&l.valueNode.type==="object"&&o(l.valueNode),!0})}else t.parent.type==="array"&&t.parent.items.forEach(function(l){l.type==="object"&&l!==t&&o(l)});else t.type==="object"&&i.add({kind:Or.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",null,!0,""),insertTextFormat:Dt.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})},r.prototype.getSchemaLessValueCompletions=function(e,t,n,i,s){var o=this,a=n;if(t&&(t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(a=t.offset+t.length,t=t.parent),!t){s.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:Dt.Snippet,documentation:""}),s.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:Dt.Snippet,documentation:""});return}var l=this.evaluateSeparatorAfter(i,a),c=function(p){nb(p.parent,n,!0)||s.add({kind:o.getSuggestionKind(p.type),label:o.getLabelTextForMatchingNode(p,i),insertText:o.getInsertTextForMatchingNode(p,i,l),insertTextFormat:Dt.Snippet,documentation:""}),p.type==="boolean"&&o.addBooleanValueCompletion(!p.value,l,s)};if(t.type==="property"&&n>t.colonOffset){var u=t.valueNode;if(u&&(n>u.offset+u.length||u.type==="object"||u.type==="array"))return;var h=t.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===h&&p.valueNode&&c(p.valueNode),!0}),h==="$schema"&&t.parent&&!t.parent.parent&&this.addDollarSchemaCompletions(l,s)}if(t.type==="array")if(t.parent&&t.parent.type==="property"){var d=t.parent.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===d&&p.valueNode&&p.valueNode.type==="array"&&p.valueNode.items.forEach(c),!0})}else t.items.forEach(c)},r.prototype.getValueCompletions=function(e,t,n,i,s,o,a){var l=this,c=i,u=null,h=null;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(c=n.offset+n.length,h=n,n=n.parent),!n){this.addSchemaValueCompletions(e.schema,"",o,a);return}if(n.type==="property"&&i>n.colonOffset){var d=n.valueNode;if(d&&i>d.offset+d.length)return;u=n.keyNode.value,n=n.parent}if(n&&(u!==null||n.type==="array")){var p=this.evaluateSeparatorAfter(s,c),m=t.getMatchingSchemas(e.schema,n.offset,h);m.forEach(function(y){if(y.node===n&&!y.inverted&&y.schema){if(n.type==="array"&&y.schema.items)if(Array.isArray(y.schema.items)){var w=l.findItemAtOffset(n,s,i);w<y.schema.items.length&&l.addSchemaValueCompletions(y.schema.items[w],p,o,a)}else l.addSchemaValueCompletions(y.schema.items,p,o,a);if(y.schema.properties){var A=y.schema.properties[u];A&&l.addSchemaValueCompletions(A,p,o,a)}}}),u==="$schema"&&!n.parent&&this.addDollarSchemaCompletions(p,o),a.boolean&&(this.addBooleanValueCompletion(!0,p,o),this.addBooleanValueCompletion(!1,p,o)),a.null&&this.addNullValueCompletion(p,o)}},r.prototype.getContributedValueCompletions=function(e,t,n,i,s,o){if(!t)this.contributions.forEach(function(u){var h=u.collectDefaultCompletions(i.uri,s);h&&o.push(h)});else if((t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(t=t.parent),t.type==="property"&&n>t.colonOffset){var a=t.keyNode.value,l=t.valueNode;if(!l||n<=l.offset+l.length){var c=$f(t.parent);this.contributions.forEach(function(u){var h=u.collectValueCompletions(i.uri,c,a,s);h&&o.push(h)})}}},r.prototype.addSchemaValueCompletions=function(e,t,n,i){var s=this;typeof e=="object"&&(this.addEnumValueCompletions(e,t,n),this.addDefaultValueCompletions(e,t,n),this.collectTypes(e,i),Array.isArray(e.allOf)&&e.allOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}),Array.isArray(e.anyOf)&&e.anyOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}),Array.isArray(e.oneOf)&&e.oneOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}))},r.prototype.addDefaultValueCompletions=function(e,t,n,i){var s=this;i===void 0&&(i=0);var o=!1;if(Pn(e.default)){for(var a=e.type,l=e.default,c=i;c>0;c--)l=[l],a="array";n.add({kind:this.getSuggestionKind(a),label:this.getLabelForValue(l),insertText:this.getInsertTextForValue(l,t),insertTextFormat:Dt.Snippet}),o=!0}Array.isArray(e.examples)&&e.examples.forEach(function(u){for(var h=e.type,d=u,p=i;p>0;p--)d=[d],h="array";n.add({kind:s.getSuggestionKind(h),label:s.getLabelForValue(d),insertText:s.getInsertTextForValue(d,t),insertTextFormat:Dt.Snippet}),o=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(function(u){var h=e.type,d=u.body,p=u.label,m,y;if(Pn(d)){for(var w=e.type,A=i;A>0;A--)d=[d],w="array";m=s.getInsertTextForSnippetValue(d,t),y=s.getFilterTextForSnippetValue(d),p=p||s.getLabelForSnippetValue(d)}else if(typeof u.bodyText=="string"){for(var T="",E="",F="",A=i;A>0;A--)T=T+F+`[
|
|
220
220
|
`,E=E+`
|
|
221
|
-
`+
|
|
221
|
+
`+F+"]",F+=" ",h="array";m=T+F+u.bodyText.split(`
|
|
222
222
|
`).join(`
|
|
223
|
-
`+
|
|
224
|
-
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,
|
|
223
|
+
`+F)+E+t,p=p||s.sanitizeLabel(m),y=m.replace(/[\n]/g,"")}n.add({kind:s.getSuggestionKind(h),label:p,documentation:s.fromMarkup(u.markdownDescription)||u.description,insertText:m,insertTextFormat:Dt.Snippet,filterText:y}),o=!0}),!o&&typeof e.items=="object"&&!Array.isArray(e.items)&&this.addDefaultValueCompletions(e.items,t,n,i+1)},r.prototype.addEnumValueCompletions=function(e,t,n){if(Pn(e.const)&&n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,t),insertTextFormat:Dt.Snippet,documentation:this.fromMarkup(e.markdownDescription)||e.description}),Array.isArray(e.enum))for(var i=0,s=e.enum.length;i<s;i++){var o=e.enum[i],a=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&i<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?a=this.fromMarkup(e.markdownEnumDescriptions[i]):e.enumDescriptions&&i<e.enumDescriptions.length&&(a=e.enumDescriptions[i]),n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(o),insertText:this.getInsertTextForValue(o,t),insertTextFormat:Dt.Snippet,documentation:a})}},r.prototype.collectTypes=function(e,t){if(!(Array.isArray(e.enum)||Pn(e.const))){var n=e.type;Array.isArray(n)?n.forEach(function(i){return t[i]=!0}):t[n]=!0}},r.prototype.addFillerValueCompletions=function(e,t,n){e.object&&n.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},t),insertTextFormat:Dt.Snippet,detail:"New object",documentation:""}),e.array&&n.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],t),insertTextFormat:Dt.Snippet,detail:"New array",documentation:""})},r.prototype.addBooleanValueCompletion=function(e,t,n){n.add({kind:this.getSuggestionKind("boolean"),label:e?"true":"false",insertText:this.getInsertTextForValue(e,t),insertTextFormat:Dt.Snippet,documentation:""})},r.prototype.addNullValueCompletion=function(e,t){t.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:Dt.Snippet,documentation:""})},r.prototype.addDollarSchemaCompletions=function(e,t){var n=this,i=this.schemaService.getRegisteredSchemaIds(function(s){return s==="http"||s==="https"});i.forEach(function(s){return t.add({kind:Or.Module,label:n.getLabelForValue(s),filterText:n.getFilterTextForValue(s),insertText:n.getInsertTextForValue(s,e),insertTextFormat:Dt.Snippet,documentation:""})})},r.prototype.sanitizeLabel=function(e){return e=e.replace(/[\n]/g,"\u21B5"),e.length>57&&(e=e.substr(0,57).trim()+"..."),e},r.prototype.getLabelForValue=function(e){return this.sanitizeLabel(JSON.stringify(e))},r.prototype.getFilterTextForValue=function(e){return JSON.stringify(e)},r.prototype.getFilterTextForSnippetValue=function(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")},r.prototype.getLabelForSnippetValue=function(e){var t=JSON.stringify(e);return t=t.replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1"),this.sanitizeLabel(t)},r.prototype.getInsertTextForPlainText=function(e){return e.replace(/[\\\$\}]/g,"\\$&")},r.prototype.getInsertTextForValue=function(e,t){var n=JSON.stringify(e,null," ");return n==="{}"?"{$1}"+t:n==="[]"?"[$1]"+t:this.getInsertTextForPlainText(n+t)},r.prototype.getInsertTextForSnippetValue=function(e,t){var n=function(i){return typeof i=="string"&&i[0]==="^"?i.substr(1):JSON.stringify(i)};return Hf(e,"",n)+t},r.prototype.getInsertTextForGuessedValue=function(e,t){switch(typeof e){case"object":return e===null?"${1:null}"+t:this.getInsertTextForValue(e,t);case"string":var n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),'"${1:'+n+'}"'+t;case"number":case"boolean":return"${1:"+JSON.stringify(e)+"}"+t}return this.getInsertTextForValue(e,t)},r.prototype.getSuggestionKind=function(e){if(Array.isArray(e)){var t=e;e=t.length>0?t[0]:null}if(!e)return Or.Value;switch(e){case"string":return Or.Value;case"object":return Or.Module;case"property":return Or.Property;default:return Or.Value}},r.prototype.getLabelTextForMatchingNode=function(e,t){switch(e.type){case"array":return"[]";case"object":return"{}";default:var n=t.getText().substr(e.offset,e.length);return n}},r.prototype.getInsertTextForMatchingNode=function(e,t,n){switch(e.type){case"array":return this.getInsertTextForValue([],n);case"object":return this.getInsertTextForValue({},n);default:var i=t.getText().substr(e.offset,e.length)+n;return this.getInsertTextForPlainText(i)}},r.prototype.getInsertTextForProperty=function(e,t,n,i){var s=this.getInsertTextForValue(e,"");if(!n)return s;var o=s+": ",a,l=0;if(t){if(Array.isArray(t.defaultSnippets)){if(t.defaultSnippets.length===1){var c=t.defaultSnippets[0].body;Pn(c)&&(a=this.getInsertTextForSnippetValue(c,""))}l+=t.defaultSnippets.length}if(t.enum&&(!a&&t.enum.length===1&&(a=this.getInsertTextForGuessedValue(t.enum[0],"")),l+=t.enum.length),Pn(t.default)&&(a||(a=this.getInsertTextForGuessedValue(t.default,"")),l++),l===0){var u=Array.isArray(t.type)?t.type[0]:t.type;switch(u||(t.properties?u="object":t.items&&(u="array")),u){case"boolean":a="$1";break;case"string":a='"$1"';break;case"object":a="{$1}";break;case"array":a="[$1]";break;case"number":case"integer":a="${1:0}";break;case"null":a="${1:null}";break;default:return s}}}return(!a||l>1)&&(a="$1"),o+a+i},r.prototype.getCurrentWord=function(e,t){for(var n=t-1,i=e.getText();n>=0&&`
|
|
224
|
+
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,t)},r.prototype.evaluateSeparatorAfter=function(e,t){var n=ws(e.getText(),!0);n.setPosition(t);var i=n.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},r.prototype.findItemAtOffset=function(e,t,n){for(var i=ws(t.getText(),!0),s=e.items,o=s.length-1;o>=0;o--){var a=s[o];if(n>a.offset+a.length){i.setPosition(a.offset+a.length);var l=i.scan();return l===5&&n>=i.getTokenOffset()+i.getTokenLength()?o+1:o}else if(n>=a.offset)return o}return 0},r.prototype.isInComment=function(e,t,n){var i=ws(e.getText(),!1);i.setPosition(t);for(var s=i.scan();s!==17&&i.getTokenOffset()+i.getTokenLength()<n;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=n},r.prototype.fromMarkup=function(e){if(e&&this.doesSupportMarkdown())return{kind:Ii.Markdown,value:e}},r.prototype.doesSupportMarkdown=function(){if(!Pn(this.supportsMarkdown)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsMarkdown=e&&e.completionItem&&Array.isArray(e.completionItem.documentationFormat)&&e.completionItem.documentationFormat.indexOf(Ii.Markdown)!==-1}return this.supportsMarkdown},r.prototype.doesSupportsCommitCharacters=function(){if(!Pn(this.supportsCommitCharacters)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=e&&e.completionItem&&!!e.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},r}(),LP=function(){function r(e,t,n){t===void 0&&(t=[]),this.schemaService=e,this.contributions=t,this.promise=n||Promise}return r.prototype.doHover=function(e,t,n){var i=e.offsetAt(t),s=n.getNodeFromOffset(i);if(!s||(s.type==="object"||s.type==="array")&&i>s.offset+1&&i<s.offset+s.length-1)return this.promise.resolve(null);var o=s;if(s.type==="string"){var a=s.parent;if(a&&a.type==="property"&&a.keyNode===s&&(s=a.valueNode,!s))return this.promise.resolve(null)}for(var l=ze.create(e.positionAt(o.offset),e.positionAt(o.offset+o.length)),c=function(m){var y={contents:m,range:l};return y},u=$f(s),h=this.contributions.length-1;h>=0;h--){var d=this.contributions[h],p=d.getInfoContribution(e.uri,u);if(p)return p.then(function(m){return c(m)})}return this.schemaService.getSchemaForResource(e.uri,n).then(function(m){if(m){var y=n.getMatchingSchemas(m.schema,s.offset),w=null,A=null,T=null,E=null;y.every(function(I){if(I.node===s&&!I.inverted&&I.schema&&(w=w||I.schema.title,A=A||I.schema.markdownDescription||Uf(I.schema.description),I.schema.enum)){var W=I.schema.enum.indexOf(si(s));I.schema.markdownEnumDescriptions?T=I.schema.markdownEnumDescriptions[W]:I.schema.enumDescriptions&&(T=Uf(I.schema.enumDescriptions[W])),T&&(E=I.schema.enum[W],typeof E!="string"&&(E=JSON.stringify(E)))}return!0});var F="";return w&&(F=Uf(w)),A&&(F.length>0&&(F+=`
|
|
225
225
|
|
|
226
|
-
`),
|
|
226
|
+
`),F+=A),T&&(F.length>0&&(F+=`
|
|
227
227
|
|
|
228
|
-
`),
|
|
228
|
+
`),F+="`"+BP(E)+"`: "+T),c([F])}return null})},r}();function Uf(r){if(r){var e=r.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
|
|
229
229
|
|
|
230
|
-
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.indexOf("`")!==-1?"`` "+t+" ``":t}var LP=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),bt,jo;if(typeof process=="object")jo=!1;else if(typeof navigator=="object"){var BP=navigator.userAgent;jo=BP.indexOf("Windows")>=0}function R3(t){return 55296<=t&&t<=56319}function L3(t){return 56320<=t&&t<=57343}function B3(t){return t>=97&&t<=102}function FP(t){return t>=97&&t<=122}function jP(t){return t>=65&&t<=90}function F3(t){return FP(t)||jP(t)}var VP=/^\w[\w\d+.-]*$/,WP=/^\//,$P=/^\/\//;function HP(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!VP.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path){if(t.authority){if(!WP.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if($P.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function zP(t,e){return!t&&!e?"file":t}function UP(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==Yr&&(e=Yr+e):e=Yr;break}return e}var et="",Yr="/",GP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,$f=function(){function t(e,r,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||et,this.authority=e.authority||et,this.path=e.path||et,this.query=e.query||et,this.fragment=e.fragment||et):(this.scheme=zP(e,o),this.authority=r||et,this.path=UP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,HP(this,o))}return t.isUri=function(e){return e instanceof t?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(t.prototype,"fsPath",{get:function(){return ob(this,!1)},enumerable:!0,configurable:!0}),t.prototype.with=function(e){if(!e)return this;var r=e.scheme,n=e.authority,i=e.path,s=e.query,o=e.fragment;return r===void 0?r=this.scheme:r===null&&(r=et),n===void 0?n=this.authority:n===null&&(n=et),i===void 0?i=this.path:i===null&&(i=et),s===void 0?s=this.query:s===null&&(s=et),o===void 0?o=this.fragment:o===null&&(o=et),r===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new As(r,n,i,s,o)},t.parse=function(e,r){r===void 0&&(r=!1);var n=GP.exec(e);return n?new As(n[2]||et,$l(n[4]||et),$l(n[5]||et),$l(n[7]||et),$l(n[9]||et),r):new As(et,et,et,et,et)},t.file=function(e){var r=et;if(jo&&(e=e.replace(/\\/g,Yr)),e[0]===Yr&&e[1]===Yr){var n=e.indexOf(Yr,2);n===-1?(r=e.substring(2),e=Yr):(r=e.substring(2,n),e=e.substring(n)||Yr)}return new As("file",r,e,et,et)},t.from=function(e){return new As(e.scheme,e.authority,e.path,e.query,e.fragment)},t.prototype.toString=function(e){return e===void 0&&(e=!1),Hf(this,e)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new As(e);return r._formatted=e.external,r._fsPath=e._sep===nb?e.fsPath:null,r}else return e},t}(),nb=jo?1:void 0,As=function(t){LP(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._formatted=null,r._fsPath=null,r}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=ob(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(r){return r===void 0&&(r=!1),r?Hf(this,!0):(this._formatted||(this._formatted=Hf(this,!1)),this._formatted)},e.prototype.toJSON=function(){var r={$mid:1};return this._fsPath&&(r.fsPath=this._fsPath,r._sep=nb),this._formatted&&(r.external=this._formatted),this.path&&(r.path=this.path),this.scheme&&(r.scheme=this.scheme),this.authority&&(r.authority=this.authority),this.query&&(r.query=this.query),this.fragment&&(r.fragment=this.fragment),r},e}($f),ib=(bt={},bt[58]="%3A",bt[47]="%2F",bt[63]="%3F",bt[35]="%23",bt[91]="%5B",bt[93]="%5D",bt[64]="%40",bt[33]="%21",bt[36]="%24",bt[38]="%26",bt[39]="%27",bt[40]="%28",bt[41]="%29",bt[42]="%2A",bt[43]="%2B",bt[44]="%2C",bt[59]="%3B",bt[61]="%3D",bt[32]="%20",bt);function sb(t,e){for(var r=void 0,n=-1,i=0;i<t.length;i++){var s=t.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47)n!==-1&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),r!==void 0&&(r+=t.charAt(i));else{r===void 0&&(r=t.substr(0,i));var o=ib[s];o!==void 0?(n!==-1&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),r+=o):n===-1&&(n=i)}}return n!==-1&&(r+=encodeURIComponent(t.substring(n))),r!==void 0?r:t}function KP(t){for(var e=void 0,r=0;r<t.length;r++){var n=t.charCodeAt(r);n===35||n===63?(e===void 0&&(e=t.substr(0,r)),e+=ib[n]):e!==void 0&&(e+=t[r])}return e!==void 0?e:t}function ob(t,e){var r;return t.authority&&t.path.length>1&&t.scheme==="file"?r="//"+t.authority+t.path:t.path.charCodeAt(0)===47&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&t.path.charCodeAt(2)===58?e?r=t.path.substr(1):r=t.path[1].toLowerCase()+t.path.substr(2):r=t.path,jo&&(r=r.replace(/\//g,"\\")),r}function Hf(t,e){var r=e?KP:sb,n="",i=t.scheme,s=t.authority,o=t.path,a=t.query,l=t.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=Yr,n+=Yr),s){var c=s.indexOf("@");if(c!==-1){var u=s.substr(0,c);s=s.substr(c+1),c=u.indexOf(":"),c===-1?n+=r(u,!1):(n+=r(u.substr(0,c),!1),n+=":",n+=r(u.substr(c+1),!1)),n+="@"}s=s.toLowerCase(),c=s.indexOf(":"),c===-1?n+=r(s,!1):(n+=r(s.substr(0,c),!1),n+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var h=o.charCodeAt(1);h>=65&&h<=90&&(o="/"+String.fromCharCode(h+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var h=o.charCodeAt(0);h>=65&&h<=90&&(o=String.fromCharCode(h+32)+":"+o.substr(2))}n+=r(o,!0)}return a&&(n+="?",n+=r(a,!1)),l&&(n+="#",n+=e?l:sb(l,!1)),n}function ab(t){try{return decodeURIComponent(t)}catch{return t.length>3?t.substr(0,3)+ab(t.substr(3)):t}}var lb=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function $l(t){return t.match(lb)?t.replace(lb,function(e){return ab(e)}):t}var YP=function(){function t(e){try{this.patternRegExp=new RegExp(PP(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return t.prototype.addSchema=function(e){this.schemas.push(e)},t.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},t.prototype.getSchemas=function(){return this.schemas},t}(),JP=function(){function t(e,r,n){this.service=e,this.url=r,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new Cs(n)))}return t.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},t.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(r){return e.service.resolveSchemaContent(r,e.url,e.dependencies)})),this.resolvedSchema},t.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},t}(),Cs=function(){function t(e,r){r===void 0&&(r=[]),this.schema=e,this.errors=r}return t}(),cb=function(){function t(e,r){r===void 0&&(r=[]),this.schema=e,this.errors=r}return t.prototype.getSection=function(e){return ur(this.getSectionRecursive(e,this.schema))},t.prototype.getSectionRecursive=function(e,r){if(!r||typeof r=="boolean"||e.length===0)return r;var n=e.shift();if(r.properties&&typeof r.properties[n])return this.getSectionRecursive(e,r.properties[n]);if(r.patternProperties)for(var i=0,s=Object.keys(r.patternProperties);i<s.length;i++){var o=s[i],a=new RegExp(o);if(a.test(n))return this.getSectionRecursive(e,r.patternProperties[o])}else{if(typeof r.additionalProperties=="object")return this.getSectionRecursive(e,r.additionalProperties);if(n.match("[0-9]+")){if(Array.isArray(r.items)){var l=parseInt(n,10);if(!isNaN(l)&&r.items[l])return this.getSectionRecursive(e,r.items[l])}else if(r.items)return this.getSectionRecursive(e,r.items)}}return null},t}(),QP=function(){function t(e,r,n){this.contextService=r,this.requestService=e,this.promiseConstructor=n||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return t.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(r){var n=$f.parse(r).scheme;return n!=="schemaservice"&&(!e||e(n))})},Object.defineProperty(t.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},t.prototype.onResourceChange=function(e){var r=this,n=!1;e=this.normalizeId(e);for(var i=[e],s=Object.keys(this.schemasById).map(function(c){return r.schemasById[c]});i.length;)for(var o=i.pop(),a=0;a<s.length;a++){var l=s[a];l&&(l.url===o||l.dependencies[o])&&(l.url!==o&&i.push(l.url),l.clearSchema(),s[a]=void 0,n=!0)}return n},t.prototype.normalizeId=function(e){try{return $f.parse(e).toString()}catch{return e}},t.prototype.setSchemaContributions=function(e){if(e.schemas){var r=e.schemas;for(var n in r){var i=this.normalizeId(n);this.contributionSchemas[i]=this.addSchemaHandle(i,r[n])}}if(e.schemaAssociations){var s=e.schemaAssociations;for(var o in s){var a=s[o];this.contributionAssociations[o]=a;for(var l=this.getOrAddFilePatternAssociation(o),c=0,u=a;c<u.length;c++){var h=u[c],n=this.normalizeId(h);l.addSchema(n)}}}},t.prototype.addSchemaHandle=function(e,r){var n=new JP(this,e,r);return this.schemasById[e]=n,n},t.prototype.getOrAddSchemaHandle=function(e,r){return this.schemasById[e]||this.addSchemaHandle(e,r)},t.prototype.getOrAddFilePatternAssociation=function(e){var r=this.filePatternAssociationById[e];return r||(r=new YP(e),this.filePatternAssociationById[e]=r,this.filePatternAssociations.push(r)),r},t.prototype.registerExternalSchema=function(e,r,n){r===void 0&&(r=null);var i=this.normalizeId(e);if(this.registeredSchemasIds[i]=!0,r)for(var s=0,o=r;s<o.length;s++){var a=o[s];this.getOrAddFilePatternAssociation(a).addSchema(i)}return n?this.addSchemaHandle(i,n):this.getOrAddSchemaHandle(i)},t.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var r in this.contributionAssociations)for(var n=this.getOrAddFilePatternAssociation(r),i=0,s=this.contributionAssociations[r];i<s.length;i++){var o=s[i],e=this.normalizeId(o);n.addSchema(e)}},t.prototype.getResolvedSchema=function(e){var r=this.normalizeId(e),n=this.schemasById[r];return n?n.getResolvedSchema():this.promise.resolve(null)},t.prototype.loadSchema=function(e){if(!this.requestService){var r="Unable to load schema from '"+Hl(e)+"'. No schema request service available";return this.promise.resolve(new Cs({},[r]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+Hl(e)+"': No content.";return new Cs({},[i])}var s={},o=[];s=uP(n,o);var a=o.length?["Unable to parse content from '"+Hl(e)+"': Parse error at offset "+o[0].offset]:[];return new Cs(s,a)},function(n){var i="Unable to load schema from '"+Hl(e)+"': "+n.toString();return new Cs({},[i])})},t.prototype.resolveSchemaContent=function(e,r,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var a=this.normalizeId(o.$schema);if(a==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new cb({},["Draft-03 schemas are not supported."]));a==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var l=this.contextService,c=function(p,m){if(!m)return p;var y=p;return m[0]==="/"&&(m=m.substr(1)),m.split("/").some(function(w){return y=y[w],!y}),y},u=function(p,m,y,w){var A=c(m,w);if(A)for(var T in A)A.hasOwnProperty(T)&&!p.hasOwnProperty(T)&&(p[T]=A[T]);else s.push("$ref '"+w+"' in '"+y+"' can not be resolved.")},h=function(p,m,y,w,A){l&&!/^\w+:\/\/.*/.test(m)&&(m=l.resolveRelativePath(m,w)),m=i.normalizeId(m);var T=i.getOrAddSchemaHandle(m);return T.getUnresolvedSchema().then(function(E){if(A[m]=!0,E.errors.length){var B=y?m+"#"+y:m;s.push("Problems loading reference '"+B+"': "+E.errors[0]+".")}return u(p,E.schema,m,y),d(p,E.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],E=[],B=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];typeof ce=="object"&&A.push(ce)}},I=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];if(typeof ce=="object")for(var he in ce){var xe=ce[he];typeof xe=="object"&&A.push(xe)}}},W=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];if(Array.isArray(ce))for(var he=0,xe=ce;he<xe.length;he++){var Fe=xe[he];typeof Fe=="object"&&A.push(Fe)}}},F=function(j){for(var U=[];j.$ref;){var Y=j.$ref,re=Y.split("#",2);if(delete j.$ref,re[0].length>0){E.push(h(j,re[0],re[1],y,w));return}else U.indexOf(Y)===-1&&(u(j,m,y,re[1]),U.push(Y))}B(j.items,j.additionalProperties,j.not,j.contains,j.propertyNames,j.if,j.then,j.else),I(j.definitions,j.properties,j.patternProperties,j.dependencies),W(j.anyOf,j.allOf,j.oneOf,j.items)};A.length;){var _=A.pop();T.indexOf(_)>=0||(T.push(_),F(_))}return i.promise.all(E)};return d(o,o,r,n).then(function(p){return new cb(o,s)})},t.prototype.getSchemaForResource=function(e,r){if(r&&r.root&&r.root.type==="object"){var n=r.root.properties.filter(function(m){return m.keyNode.value==="$schema"&&m.valueNode&&m.valueNode.type==="string"});if(n.length>0){var i=si(n[0].valueNode);if(i&&TP(i,".")&&this.contextService&&(i=this.contextService.resolveRelativePath(i,e)),i){var s=this.normalizeId(i);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}for(var o=Object.create(null),a=[],l=0,c=this.filePatternAssociations;l<c.length;l++){var u=c[l];if(u.matchesPattern(e))for(var h=0,d=u.getSchemas();h<d.length;h++){var p=d[h];o[p]||(a.push(p),o[p]=!0)}}return a.length>0?this.createCombinedSchema(e,a).getResolvedSchema():this.promise.resolve(null)},t.prototype.createCombinedSchema=function(e,r){if(r.length===1)return this.getOrAddSchemaHandle(r[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(e),i={allOf:r.map(function(s){return{$ref:s}})};return this.addSchemaHandle(n,i)},t}();function Hl(t){try{}catch{}return t}var XP=function(){function t(e,r){this.jsonSchemaService=e,this.promise=r,this.validationEnabled=!0}return t.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:Me.Error)},t.prototype.doValidation=function(e,r,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],a={},l=function(h){var d=h.range.start.line+" "+h.range.start.character+" "+h.message;a[d]||(a[d]=!0,o.push(h))},c=function(h){var d=n?hb(n.trailingCommas):Me.Error,p=n?hb(n.comments):s.commentSeverity;if(h){if(h.errors.length&&r.root){var m=r.root,y=m.type==="object"?m.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var w=y.valueNode||y,A=ze.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}else{var A=ze.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}}else{var T=r.validate(e,h.schema);T&&T.forEach(l)}ub(h.schema)&&(p=void 0),fb(h.schema)&&(d=void 0)}for(var E=0,B=r.syntaxErrors;E<B.length;E++){var I=B[E];if(I.code===$e.TrailingComma){if(typeof d!="number")continue;I.severity=d}l(I)}if(typeof p=="number"){var W="Comments are not permitted in JSON.";r.comments.forEach(function(F){l(Mn.create(F,W,p,$e.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+ZP++;return this.jsonSchemaService.resolveSchemaContent(new Cs(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,r).then(function(h){return c(h)})},t}(),ZP=0;function ub(t){if(t&&typeof t=="object"){if(mn(t.allowComments))return t.allowComments;if(t.allOf)for(var e=0,r=t.allOf;e<r.length;e++){var n=r[e],i=ub(n);if(mn(i))return i}}}function fb(t){if(t&&typeof t=="object"){if(mn(t.allowTrailingCommas))return t.allowTrailingCommas;if(mn(t.allowsTrailingCommas))return t.allowsTrailingCommas;if(t.allOf)for(var e=0,r=t.allOf;e<r.length;e++){var n=r[e],i=fb(n);if(mn(i))return i}}}function hb(t){switch(t){case"error":return Me.Error;case"warning":return Me.Warning;case"ignore":return}}var db=48,_P=57,qP=65,zl=97,eM=102;function xt(t){return t<db?0:t<=_P?t-db:(t<zl&&(t+=zl-qP),t>=zl&&t<=eM?t-zl+10:0)}function tM(t){if(t[0]!=="#")return null;switch(t.length){case 4:return{red:xt(t.charCodeAt(1))*17/255,green:xt(t.charCodeAt(2))*17/255,blue:xt(t.charCodeAt(3))*17/255,alpha:1};case 5:return{red:xt(t.charCodeAt(1))*17/255,green:xt(t.charCodeAt(2))*17/255,blue:xt(t.charCodeAt(3))*17/255,alpha:xt(t.charCodeAt(4))*17/255};case 7:return{red:(xt(t.charCodeAt(1))*16+xt(t.charCodeAt(2)))/255,green:(xt(t.charCodeAt(3))*16+xt(t.charCodeAt(4)))/255,blue:(xt(t.charCodeAt(5))*16+xt(t.charCodeAt(6)))/255,alpha:1};case 9:return{red:(xt(t.charCodeAt(1))*16+xt(t.charCodeAt(2)))/255,green:(xt(t.charCodeAt(3))*16+xt(t.charCodeAt(4)))/255,blue:(xt(t.charCodeAt(5))*16+xt(t.charCodeAt(6)))/255,alpha:(xt(t.charCodeAt(7))*16+xt(t.charCodeAt(8)))/255}}return null}function j3(t,e,r,n){return n===void 0&&(n=1),{red:t/255,green:e/255,blue:r/255,alpha:n}}var rM=function(){function t(e){this.schemaService=e}return t.prototype.findDocumentSymbols=function(e,r,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=r.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||Vf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=ws.create(e.uri,oi(e,h));if(l.push({name:si(m.valueNode),kind:vn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,E,B){return o>=0&&(E.type==="array"?E.items.forEach(function(I){return w(T,I,B)}):E.type==="object"&&E.properties.forEach(function(I){if(o>=0){var W=I.valueNode;if(W){o--;var F=ws.create(e.uri,oi(e,I)),_=B?B+"."+I.keyNode.value:I.keyNode.value;T.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),location:F,containerName:B}),w(T,W,_)}}})),T},A=w([],s,void 0);return o<0&&(A.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),A},t.prototype.findDocumentSymbols2=function(e,r,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=r.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||Vf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=oi(e,h),w=oi(e,m.keyNode);if(l.push({name:si(m.valueNode),kind:vn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(E,B){return o>=0&&(B.type==="array"?B.items.forEach(function(I,W){if(I&&o>=0){o--;var F=oi(e,I),_=F,j=String(W),U=A([],I);E.push({name:j,kind:i.getSymbolKind(I.type),range:F,selectionRange:_,children:U})}}):B.type==="object"&&B.properties.forEach(function(I){var W=I.valueNode;if(W&&o>=0){o--;var F=oi(e,I),_=oi(e,I.keyNode),j=A([],W);E.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),range:F,selectionRange:_,children:j})}})),E},T=A([],s);return o<0&&(T.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),T},t.prototype.getSymbolKind=function(e){switch(e){case"object":return vn.Module;case"string":return vn.String;case"number":return vn.Number;case"array":return vn.Array;case"boolean":return vn.Boolean;default:return vn.Variable}},t.prototype.getKeyLabel=function(e){var r=e.keyNode.value;return r&&(r=r.replace(/[\n]/g,"\u21B5")),r&&r.trim()?r:'"'+r+'"'},t.prototype.findDocumentColors=function(e,r,n){return this.schemaService.getSchemaForResource(e.uri,r).then(function(i){var s=[];if(i)for(var o=n&&typeof n.resultLimit=="number"?n.resultLimit:Number.MAX_VALUE,a=r.getMatchingSchemas(i.schema),l={},c=0,u=a;c<u.length;c++){var h=u[c];if(!h.inverted&&h.schema&&(h.schema.format==="color"||h.schema.format==="color-hex")&&h.node&&h.node.type==="string"){var d=String(h.node.offset);if(!l[d]){var p=tM(si(h.node));if(p){var m=oi(e,h.node);s.push({color:p,range:m})}if(l[d]=!0,o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(e.uri),s}}}return s})},t.prototype.getColorPresentations=function(e,r,n,i){var s=[],o=Math.round(n.red*255),a=Math.round(n.green*255),l=Math.round(n.blue*255);function c(h){var d=h.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+c(o)+c(a)+c(l):u="#"+c(o)+c(a)+c(l)+c(Math.round(n.alpha*255)),s.push({label:u,textEdit:Vr.replace(i,JSON.stringify(u))}),s},t}();function oi(t,e){return ze.create(t.positionAt(e.offset),t.positionAt(e.offset+e.length))}var nM={schemaAssociations:{},schemas:{}};function iM(t,e){var r=[],n=[],i=[],s=-1,o=xs(t.getText(),!1),a=o.scan();function l(U){r.push(U),n.push(i.length)}for(;a!==17;){switch(a){case 1:case 3:{var c=t.positionAt(o.getTokenOffset()).line,u={startLine:c,endLine:c,kind:a===1?"object":"array"};i.push(u);break}case 2:case 4:{var h=a===2?"object":"array";if(i.length>0&&i[i.length-1].kind===h){var u=i.pop(),d=t.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,l(u),s=u.startLine)}break}case 13:{var c=t.positionAt(o.getTokenOffset()).line,p=t.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&c+1<t.lineCount?o.setPosition(t.offsetAt(jr.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:No.Comment}),s=c);break}case 12:{var m=t.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=m.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(y){var d=t.positionAt(o.getTokenOffset()).line;if(y[1]){var u={startLine:d,endLine:d,kind:No.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==No.Region;)w--;if(w>=0){var u=i[w];i.length=w,d>u.startLine&&s!==u.startLine&&(u.endLine=d,l(u),s=u.startLine)}}}break}}a=o.scan()}var A=e&&e.rangeLimit;if(typeof A!="number"||r.length<=A)return r;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(t.uri);for(var T=[],E=0,B=n;E<B.length;E++){var I=B[E];I<30&&(T[I]=(T[I]||0)+1)}for(var W=0,F=0,w=0;w<T.length;w++){var _=T[w];if(_){if(_+W>A){F=w;break}W+=_}}for(var j=[],w=0;w<r.length;w++){var I=n[w];typeof I=="number"&&(I<F||I===F&&W++<A)&&j.push(r[w])}return j}function sM(t,e,r){function n(a){for(var l=t.offsetAt(a),c=r.getNodeFromOffset(l,!0),u=[];c;){switch(c.type){case"string":case"object":case"array":var h=c.offset+1,d=c.offset+c.length-1;h<d&&l>=h&&l<=d&&u.push(i(h,d)),u.push(i(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":u.push(i(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){var p=o(c.offset+c.length,5);p!==-1&&u.push(i(c.offset,p))}c=c.parent}for(var m=void 0,y=u.length-1;y>=0;y--)m=Wl.create(u[y],m);return m||(m=Wl.create(ze.create(a,a))),m}function i(a,l){return ze.create(t.positionAt(a),t.positionAt(l))}var s=xs(t.getText(),!0);function o(a,l){s.setPosition(a);var c=s.scan();return c===l?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function oM(t){var e=t.promiseConstructor||Promise,r=new QP(t.schemaRequestService,t.workspaceContext,e);r.setSchemaContributions(nM);var n=new DP(r,t.contributions,e,t.clientCapabilities),i=new NP(r,t.contributions,e),s=new rM(r),o=new XP(r,e);return{configure:function(a){r.clearExternalSchemas(),a.schemas&&a.schemas.forEach(function(l){r.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),o.configure(a)},resetSchema:function(a){return r.onResourceChange(a)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(a){return EP(a,{collectComments:!0})},newJSONDocument:function(a,l){return OP(a,l)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(a,l){return s.findDocumentColors(a,l).then(function(c){return c.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:iM,getSelectionRanges:sM,format:function(a,l,c){var u=void 0;if(l){var h=a.offsetAt(l.start),d=a.offsetAt(l.end)-h;u={offset:h,length:d}}var p={tabSize:c?c.tabSize:4,insertSpaces:c?c.insertSpaces:!0,eol:`
|
|
231
|
-
`};return
|
|
230
|
+
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.indexOf("`")!==-1?"`` "+r+" ``":r}var FP=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),bt,Vo;if(typeof process=="object")Vo=!1;else if(typeof navigator=="object"){var jP=navigator.userAgent;Vo=jP.indexOf("Windows")>=0}function B3(r){return 55296<=r&&r<=56319}function F3(r){return 56320<=r&&r<=57343}function j3(r){return r>=97&&r<=102}function VP(r){return r>=97&&r<=122}function WP(r){return r>=65&&r<=90}function V3(r){return VP(r)||WP(r)}var $P=/^\w[\w\d+.-]*$/,HP=/^\//,zP=/^\/\//;function UP(r,e){if(!r.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+r.authority+'", path: "'+r.path+'", query: "'+r.query+'", fragment: "'+r.fragment+'"}');if(r.scheme&&!$P.test(r.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(r.path){if(r.authority){if(!HP.test(r.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(zP.test(r.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function GP(r,e){return!r&&!e?"file":r}function KP(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==Yr&&(e=Yr+e):e=Yr;break}return e}var et="",Yr="/",YP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Gf=function(){function r(e,t,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||et,this.authority=e.authority||et,this.path=e.path||et,this.query=e.query||et,this.fragment=e.fragment||et):(this.scheme=GP(e,o),this.authority=t||et,this.path=KP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,UP(this,o))}return r.isUri=function(e){return e instanceof r?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(r.prototype,"fsPath",{get:function(){return lb(this,!1)},enumerable:!0,configurable:!0}),r.prototype.with=function(e){if(!e)return this;var t=e.scheme,n=e.authority,i=e.path,s=e.query,o=e.fragment;return t===void 0?t=this.scheme:t===null&&(t=et),n===void 0?n=this.authority:n===null&&(n=et),i===void 0?i=this.path:i===null&&(i=et),s===void 0?s=this.query:s===null&&(s=et),o===void 0?o=this.fragment:o===null&&(o=et),t===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new Cs(t,n,i,s,o)},r.parse=function(e,t){t===void 0&&(t=!1);var n=YP.exec(e);return n?new Cs(n[2]||et,Gl(n[4]||et),Gl(n[5]||et),Gl(n[7]||et),Gl(n[9]||et),t):new Cs(et,et,et,et,et)},r.file=function(e){var t=et;if(Vo&&(e=e.replace(/\\/g,Yr)),e[0]===Yr&&e[1]===Yr){var n=e.indexOf(Yr,2);n===-1?(t=e.substring(2),e=Yr):(t=e.substring(2,n),e=e.substring(n)||Yr)}return new Cs("file",t,e,et,et)},r.from=function(e){return new Cs(e.scheme,e.authority,e.path,e.query,e.fragment)},r.prototype.toString=function(e){return e===void 0&&(e=!1),Kf(this,e)},r.prototype.toJSON=function(){return this},r.revive=function(e){if(e){if(e instanceof r)return e;var t=new Cs(e);return t._formatted=e.external,t._fsPath=e._sep===sb?e.fsPath:null,t}else return e},r}(),sb=Vo?1:void 0,Cs=function(r){FP(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._formatted=null,t._fsPath=null,t}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=lb(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){return t===void 0&&(t=!1),t?Kf(this,!0):(this._formatted||(this._formatted=Kf(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=sb),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(Gf),ob=(bt={},bt[58]="%3A",bt[47]="%2F",bt[63]="%3F",bt[35]="%23",bt[91]="%5B",bt[93]="%5D",bt[64]="%40",bt[33]="%21",bt[36]="%24",bt[38]="%26",bt[39]="%27",bt[40]="%28",bt[41]="%29",bt[42]="%2A",bt[43]="%2B",bt[44]="%2C",bt[59]="%3B",bt[61]="%3D",bt[32]="%20",bt);function ab(r,e){for(var t=void 0,n=-1,i=0;i<r.length;i++){var s=r.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47)n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t!==void 0&&(t+=r.charAt(i));else{t===void 0&&(t=r.substr(0,i));var o=ob[s];o!==void 0?(n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t+=o):n===-1&&(n=i)}}return n!==-1&&(t+=encodeURIComponent(r.substring(n))),t!==void 0?t:r}function JP(r){for(var e=void 0,t=0;t<r.length;t++){var n=r.charCodeAt(t);n===35||n===63?(e===void 0&&(e=r.substr(0,t)),e+=ob[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function lb(r,e){var t;return r.authority&&r.path.length>1&&r.scheme==="file"?t="//"+r.authority+r.path:r.path.charCodeAt(0)===47&&(r.path.charCodeAt(1)>=65&&r.path.charCodeAt(1)<=90||r.path.charCodeAt(1)>=97&&r.path.charCodeAt(1)<=122)&&r.path.charCodeAt(2)===58?e?t=r.path.substr(1):t=r.path[1].toLowerCase()+r.path.substr(2):t=r.path,Vo&&(t=t.replace(/\//g,"\\")),t}function Kf(r,e){var t=e?JP:ab,n="",i=r.scheme,s=r.authority,o=r.path,a=r.query,l=r.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=Yr,n+=Yr),s){var c=s.indexOf("@");if(c!==-1){var u=s.substr(0,c);s=s.substr(c+1),c=u.indexOf(":"),c===-1?n+=t(u,!1):(n+=t(u.substr(0,c),!1),n+=":",n+=t(u.substr(c+1),!1)),n+="@"}s=s.toLowerCase(),c=s.indexOf(":"),c===-1?n+=t(s,!1):(n+=t(s.substr(0,c),!1),n+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var h=o.charCodeAt(1);h>=65&&h<=90&&(o="/"+String.fromCharCode(h+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var h=o.charCodeAt(0);h>=65&&h<=90&&(o=String.fromCharCode(h+32)+":"+o.substr(2))}n+=t(o,!0)}return a&&(n+="?",n+=t(a,!1)),l&&(n+="#",n+=e?l:ab(l,!1)),n}function cb(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+cb(r.substr(3)):r}}var ub=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Gl(r){return r.match(ub)?r.replace(ub,function(e){return cb(e)}):r}var XP=function(){function r(e){try{this.patternRegExp=new RegExp(IP(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return r.prototype.addSchema=function(e){this.schemas.push(e)},r.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},r.prototype.getSchemas=function(){return this.schemas},r}(),QP=function(){function r(e,t,n){this.service=e,this.url=t,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new Os(n)))}return r.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},r.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(t){return e.service.resolveSchemaContent(t,e.url,e.dependencies)})),this.resolvedSchema},r.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},r}(),Os=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r}(),fb=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r.prototype.getSection=function(e){return ur(this.getSectionRecursive(e,this.schema))},r.prototype.getSectionRecursive=function(e,t){if(!t||typeof t=="boolean"||e.length===0)return t;var n=e.shift();if(t.properties&&typeof t.properties[n])return this.getSectionRecursive(e,t.properties[n]);if(t.patternProperties)for(var i=0,s=Object.keys(t.patternProperties);i<s.length;i++){var o=s[i],a=new RegExp(o);if(a.test(n))return this.getSectionRecursive(e,t.patternProperties[o])}else{if(typeof t.additionalProperties=="object")return this.getSectionRecursive(e,t.additionalProperties);if(n.match("[0-9]+")){if(Array.isArray(t.items)){var l=parseInt(n,10);if(!isNaN(l)&&t.items[l])return this.getSectionRecursive(e,t.items[l])}else if(t.items)return this.getSectionRecursive(e,t.items)}}return null},r}(),ZP=function(){function r(e,t,n){this.contextService=t,this.requestService=e,this.promiseConstructor=n||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return r.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(t){var n=Gf.parse(t).scheme;return n!=="schemaservice"&&(!e||e(n))})},Object.defineProperty(r.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),r.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},r.prototype.onResourceChange=function(e){var t=this,n=!1;e=this.normalizeId(e);for(var i=[e],s=Object.keys(this.schemasById).map(function(c){return t.schemasById[c]});i.length;)for(var o=i.pop(),a=0;a<s.length;a++){var l=s[a];l&&(l.url===o||l.dependencies[o])&&(l.url!==o&&i.push(l.url),l.clearSchema(),s[a]=void 0,n=!0)}return n},r.prototype.normalizeId=function(e){try{return Gf.parse(e).toString()}catch{return e}},r.prototype.setSchemaContributions=function(e){if(e.schemas){var t=e.schemas;for(var n in t){var i=this.normalizeId(n);this.contributionSchemas[i]=this.addSchemaHandle(i,t[n])}}if(e.schemaAssociations){var s=e.schemaAssociations;for(var o in s){var a=s[o];this.contributionAssociations[o]=a;for(var l=this.getOrAddFilePatternAssociation(o),c=0,u=a;c<u.length;c++){var h=u[c],n=this.normalizeId(h);l.addSchema(n)}}}},r.prototype.addSchemaHandle=function(e,t){var n=new QP(this,e,t);return this.schemasById[e]=n,n},r.prototype.getOrAddSchemaHandle=function(e,t){return this.schemasById[e]||this.addSchemaHandle(e,t)},r.prototype.getOrAddFilePatternAssociation=function(e){var t=this.filePatternAssociationById[e];return t||(t=new XP(e),this.filePatternAssociationById[e]=t,this.filePatternAssociations.push(t)),t},r.prototype.registerExternalSchema=function(e,t,n){t===void 0&&(t=null);var i=this.normalizeId(e);if(this.registeredSchemasIds[i]=!0,t)for(var s=0,o=t;s<o.length;s++){var a=o[s];this.getOrAddFilePatternAssociation(a).addSchema(i)}return n?this.addSchemaHandle(i,n):this.getOrAddSchemaHandle(i)},r.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var t in this.contributionAssociations)for(var n=this.getOrAddFilePatternAssociation(t),i=0,s=this.contributionAssociations[t];i<s.length;i++){var o=s[i],e=this.normalizeId(o);n.addSchema(e)}},r.prototype.getResolvedSchema=function(e){var t=this.normalizeId(e),n=this.schemasById[t];return n?n.getResolvedSchema():this.promise.resolve(null)},r.prototype.loadSchema=function(e){if(!this.requestService){var t="Unable to load schema from '"+Kl(e)+"'. No schema request service available";return this.promise.resolve(new Os({},[t]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+Kl(e)+"': No content.";return new Os({},[i])}var s={},o=[];s=hP(n,o);var a=o.length?["Unable to parse content from '"+Kl(e)+"': Parse error at offset "+o[0].offset]:[];return new Os(s,a)},function(n){var i="Unable to load schema from '"+Kl(e)+"': "+n.toString();return new Os({},[i])})},r.prototype.resolveSchemaContent=function(e,t,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var a=this.normalizeId(o.$schema);if(a==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new fb({},["Draft-03 schemas are not supported."]));a==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var l=this.contextService,c=function(p,m){if(!m)return p;var y=p;return m[0]==="/"&&(m=m.substr(1)),m.split("/").some(function(w){return y=y[w],!y}),y},u=function(p,m,y,w){var A=c(m,w);if(A)for(var T in A)A.hasOwnProperty(T)&&!p.hasOwnProperty(T)&&(p[T]=A[T]);else s.push("$ref '"+w+"' in '"+y+"' can not be resolved.")},h=function(p,m,y,w,A){l&&!/^\w+:\/\/.*/.test(m)&&(m=l.resolveRelativePath(m,w)),m=i.normalizeId(m);var T=i.getOrAddSchemaHandle(m);return T.getUnresolvedSchema().then(function(E){if(A[m]=!0,E.errors.length){var F=y?m+"#"+y:m;s.push("Problems loading reference '"+F+"': "+E.errors[0]+".")}return u(p,E.schema,m,y),d(p,E.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],E=[],F=function(){for(var B=[],U=0;U<arguments.length;U++)B[U]=arguments[U];for(var G=0,re=B;G<re.length;G++){var ce=re[G];typeof ce=="object"&&A.push(ce)}},I=function(){for(var B=[],U=0;U<arguments.length;U++)B[U]=arguments[U];for(var G=0,re=B;G<re.length;G++){var ce=re[G];if(typeof ce=="object")for(var he in ce){var xe=ce[he];typeof xe=="object"&&A.push(xe)}}},W=function(){for(var B=[],U=0;U<arguments.length;U++)B[U]=arguments[U];for(var G=0,re=B;G<re.length;G++){var ce=re[G];if(Array.isArray(ce))for(var he=0,xe=ce;he<xe.length;he++){var Fe=xe[he];typeof Fe=="object"&&A.push(Fe)}}},j=function(B){for(var U=[];B.$ref;){var G=B.$ref,re=G.split("#",2);if(delete B.$ref,re[0].length>0){E.push(h(B,re[0],re[1],y,w));return}else U.indexOf(G)===-1&&(u(B,m,y,re[1]),U.push(G))}F(B.items,B.additionalProperties,B.not,B.contains,B.propertyNames,B.if,B.then,B.else),I(B.definitions,B.properties,B.patternProperties,B.dependencies),W(B.anyOf,B.allOf,B.oneOf,B.items)};A.length;){var Q=A.pop();T.indexOf(Q)>=0||(T.push(Q),j(Q))}return i.promise.all(E)};return d(o,o,t,n).then(function(p){return new fb(o,s)})},r.prototype.getSchemaForResource=function(e,t){if(t&&t.root&&t.root.type==="object"){var n=t.root.properties.filter(function(m){return m.keyNode.value==="$schema"&&m.valueNode&&m.valueNode.type==="string"});if(n.length>0){var i=si(n[0].valueNode);if(i&&MP(i,".")&&this.contextService&&(i=this.contextService.resolveRelativePath(i,e)),i){var s=this.normalizeId(i);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}for(var o=Object.create(null),a=[],l=0,c=this.filePatternAssociations;l<c.length;l++){var u=c[l];if(u.matchesPattern(e))for(var h=0,d=u.getSchemas();h<d.length;h++){var p=d[h];o[p]||(a.push(p),o[p]=!0)}}return a.length>0?this.createCombinedSchema(e,a).getResolvedSchema():this.promise.resolve(null)},r.prototype.createCombinedSchema=function(e,t){if(t.length===1)return this.getOrAddSchemaHandle(t[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(e),i={allOf:t.map(function(s){return{$ref:s}})};return this.addSchemaHandle(n,i)},r}();function Kl(r){try{}catch{}return r}var _P=function(){function r(e,t){this.jsonSchemaService=e,this.promise=t,this.validationEnabled=!0}return r.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:Me.Error)},r.prototype.doValidation=function(e,t,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],a={},l=function(h){var d=h.range.start.line+" "+h.range.start.character+" "+h.message;a[d]||(a[d]=!0,o.push(h))},c=function(h){var d=n?pb(n.trailingCommas):Me.Error,p=n?pb(n.comments):s.commentSeverity;if(h){if(h.errors.length&&t.root){var m=t.root,y=m.type==="object"?m.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var w=y.valueNode||y,A=ze.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}else{var A=ze.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}}else{var T=t.validate(e,h.schema);T&&T.forEach(l)}hb(h.schema)&&(p=void 0),db(h.schema)&&(d=void 0)}for(var E=0,F=t.syntaxErrors;E<F.length;E++){var I=F[E];if(I.code===$e.TrailingComma){if(typeof d!="number")continue;I.severity=d}l(I)}if(typeof p=="number"){var W="Comments are not permitted in JSON.";t.comments.forEach(function(j){l(Mn.create(j,W,p,$e.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+qP++;return this.jsonSchemaService.resolveSchemaContent(new Os(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(function(h){return c(h)})},r}(),qP=0;function hb(r){if(r&&typeof r=="object"){if(mn(r.allowComments))return r.allowComments;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=hb(n);if(mn(i))return i}}}function db(r){if(r&&typeof r=="object"){if(mn(r.allowTrailingCommas))return r.allowTrailingCommas;if(mn(r.allowsTrailingCommas))return r.allowsTrailingCommas;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=db(n);if(mn(i))return i}}}function pb(r){switch(r){case"error":return Me.Error;case"warning":return Me.Warning;case"ignore":return}}var gb=48,eM=57,tM=65,Yl=97,rM=102;function xt(r){return r<gb?0:r<=eM?r-gb:(r<Yl&&(r+=Yl-tM),r>=Yl&&r<=rM?r-Yl+10:0)}function nM(r){if(r[0]!=="#")return null;switch(r.length){case 4:return{red:xt(r.charCodeAt(1))*17/255,green:xt(r.charCodeAt(2))*17/255,blue:xt(r.charCodeAt(3))*17/255,alpha:1};case 5:return{red:xt(r.charCodeAt(1))*17/255,green:xt(r.charCodeAt(2))*17/255,blue:xt(r.charCodeAt(3))*17/255,alpha:xt(r.charCodeAt(4))*17/255};case 7:return{red:(xt(r.charCodeAt(1))*16+xt(r.charCodeAt(2)))/255,green:(xt(r.charCodeAt(3))*16+xt(r.charCodeAt(4)))/255,blue:(xt(r.charCodeAt(5))*16+xt(r.charCodeAt(6)))/255,alpha:1};case 9:return{red:(xt(r.charCodeAt(1))*16+xt(r.charCodeAt(2)))/255,green:(xt(r.charCodeAt(3))*16+xt(r.charCodeAt(4)))/255,blue:(xt(r.charCodeAt(5))*16+xt(r.charCodeAt(6)))/255,alpha:(xt(r.charCodeAt(7))*16+xt(r.charCodeAt(8)))/255}}return null}function W3(r,e,t,n){return n===void 0&&(n=1),{red:r/255,green:e/255,blue:t/255,alpha:n}}var iM=function(){function r(e){this.schemaService=e}return r.prototype.findDocumentSymbols=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||zf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=Ss.create(e.uri,oi(e,h));if(l.push({name:si(m.valueNode),kind:vn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,E,F){return o>=0&&(E.type==="array"?E.items.forEach(function(I){return w(T,I,F)}):E.type==="object"&&E.properties.forEach(function(I){if(o>=0){var W=I.valueNode;if(W){o--;var j=Ss.create(e.uri,oi(e,I)),Q=F?F+"."+I.keyNode.value:I.keyNode.value;T.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),location:j,containerName:F}),w(T,W,Q)}}})),T},A=w([],s,void 0);return o<0&&(A.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),A},r.prototype.findDocumentSymbols2=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||zf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=oi(e,h),w=oi(e,m.keyNode);if(l.push({name:si(m.valueNode),kind:vn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(E,F){return o>=0&&(F.type==="array"?F.items.forEach(function(I,W){if(I&&o>=0){o--;var j=oi(e,I),Q=j,B=String(W),U=A([],I);E.push({name:B,kind:i.getSymbolKind(I.type),range:j,selectionRange:Q,children:U})}}):F.type==="object"&&F.properties.forEach(function(I){var W=I.valueNode;if(W&&o>=0){o--;var j=oi(e,I),Q=oi(e,I.keyNode),B=A([],W);E.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),range:j,selectionRange:Q,children:B})}})),E},T=A([],s);return o<0&&(T.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),T},r.prototype.getSymbolKind=function(e){switch(e){case"object":return vn.Module;case"string":return vn.String;case"number":return vn.Number;case"array":return vn.Array;case"boolean":return vn.Boolean;default:return vn.Variable}},r.prototype.getKeyLabel=function(e){var t=e.keyNode.value;return t&&(t=t.replace(/[\n]/g,"\u21B5")),t&&t.trim()?t:'"'+t+'"'},r.prototype.findDocumentColors=function(e,t,n){return this.schemaService.getSchemaForResource(e.uri,t).then(function(i){var s=[];if(i)for(var o=n&&typeof n.resultLimit=="number"?n.resultLimit:Number.MAX_VALUE,a=t.getMatchingSchemas(i.schema),l={},c=0,u=a;c<u.length;c++){var h=u[c];if(!h.inverted&&h.schema&&(h.schema.format==="color"||h.schema.format==="color-hex")&&h.node&&h.node.type==="string"){var d=String(h.node.offset);if(!l[d]){var p=nM(si(h.node));if(p){var m=oi(e,h.node);s.push({color:p,range:m})}if(l[d]=!0,o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(e.uri),s}}}return s})},r.prototype.getColorPresentations=function(e,t,n,i){var s=[],o=Math.round(n.red*255),a=Math.round(n.green*255),l=Math.round(n.blue*255);function c(h){var d=h.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+c(o)+c(a)+c(l):u="#"+c(o)+c(a)+c(l)+c(Math.round(n.alpha*255)),s.push({label:u,textEdit:Vr.replace(i,JSON.stringify(u))}),s},r}();function oi(r,e){return ze.create(r.positionAt(e.offset),r.positionAt(e.offset+e.length))}var sM={schemaAssociations:{},schemas:{}};function oM(r,e){var t=[],n=[],i=[],s=-1,o=ws(r.getText(),!1),a=o.scan();function l(U){t.push(U),n.push(i.length)}for(;a!==17;){switch(a){case 1:case 3:{var c=r.positionAt(o.getTokenOffset()).line,u={startLine:c,endLine:c,kind:a===1?"object":"array"};i.push(u);break}case 2:case 4:{var h=a===2?"object":"array";if(i.length>0&&i[i.length-1].kind===h){var u=i.pop(),d=r.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,l(u),s=u.startLine)}break}case 13:{var c=r.positionAt(o.getTokenOffset()).line,p=r.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&c+1<r.lineCount?o.setPosition(r.offsetAt(jr.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:Ro.Comment}),s=c);break}case 12:{var m=r.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=m.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(y){var d=r.positionAt(o.getTokenOffset()).line;if(y[1]){var u={startLine:d,endLine:d,kind:Ro.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==Ro.Region;)w--;if(w>=0){var u=i[w];i.length=w,d>u.startLine&&s!==u.startLine&&(u.endLine=d,l(u),s=u.startLine)}}}break}}a=o.scan()}var A=e&&e.rangeLimit;if(typeof A!="number"||t.length<=A)return t;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(r.uri);for(var T=[],E=0,F=n;E<F.length;E++){var I=F[E];I<30&&(T[I]=(T[I]||0)+1)}for(var W=0,j=0,w=0;w<T.length;w++){var Q=T[w];if(Q){if(Q+W>A){j=w;break}W+=Q}}for(var B=[],w=0;w<t.length;w++){var I=n[w];typeof I=="number"&&(I<j||I===j&&W++<A)&&B.push(t[w])}return B}function aM(r,e,t){function n(a){for(var l=r.offsetAt(a),c=t.getNodeFromOffset(l,!0),u=[];c;){switch(c.type){case"string":case"object":case"array":var h=c.offset+1,d=c.offset+c.length-1;h<d&&l>=h&&l<=d&&u.push(i(h,d)),u.push(i(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":u.push(i(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){var p=o(c.offset+c.length,5);p!==-1&&u.push(i(c.offset,p))}c=c.parent}for(var m=void 0,y=u.length-1;y>=0;y--)m=Ul.create(u[y],m);return m||(m=Ul.create(ze.create(a,a))),m}function i(a,l){return ze.create(r.positionAt(a),r.positionAt(l))}var s=ws(r.getText(),!0);function o(a,l){s.setPosition(a);var c=s.scan();return c===l?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function lM(r){var e=r.promiseConstructor||Promise,t=new ZP(r.schemaRequestService,r.workspaceContext,e);t.setSchemaContributions(sM);var n=new RP(t,r.contributions,e,r.clientCapabilities),i=new LP(t,r.contributions,e),s=new iM(t),o=new _P(t,e);return{configure:function(a){t.clearExternalSchemas(),a.schemas&&a.schemas.forEach(function(l){t.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),o.configure(a)},resetSchema:function(a){return t.onResourceChange(a)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(a){return PP(a,{collectComments:!0})},newJSONDocument:function(a,l){return TP(a,l)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(a,l){return s.findDocumentColors(a,l).then(function(c){return c.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:oM,getSelectionRanges:aM,format:function(a,l,c){var u=void 0;if(l){var h=a.offsetAt(l.start),d=a.offsetAt(l.end)-h;u={offset:h,length:d}}var p={tabSize:c?c.tabSize:4,insertSpaces:c?c.insertSpaces:!0,eol:`
|
|
231
|
+
`};return mP(a.getText(),u,p).map(function(m){return Vr.replace(ze.create(a.positionAt(m.offset),a.positionAt(m.offset+m.length)),m.content)})}}}var cM=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function uM(r){const e={settings:{background:"var(--bg-overlay)",fontFamily:"var(--code-block-font-family)"},styles:[{tag:[M.propertyName],color:"var(--code-block-tokens-property-string-color)"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"var(--code-block-tokens-string-color)"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"var(--text-secondary)"}]};switch(r){case"light":return Ef(e);case"dark":return eP(e);default:return Ef(e)}}const Yf=lM({});function fM({id:r,schema:e,handleErrors:t}){return Yf.configure({validate:!0,schemas:[{uri:"stub://"+r,fileMatch:["*"],schema:e}]}),DT(n=>cM(this,null,function*(){var i;const s=n.state.doc,o=jf.create(r+".json","json",0,s.toString()),a=Yf.parseJSONDocument(o),l=yield Yf.doValidation(o,a);return t((i=l?.[0])==null?void 0:i.message),l?.map(c=>({from:mb(s,c.range.start.line,c.range.start.character),to:mb(s,c.range.end.line,c.range.end.character),message:c.message,severity:hM[c.severity||3]}))}))}const hM={1:"error",2:"warning",3:"info",4:"hint"};function mb(r,e,t){return r.line(e+1).from+t}const dM=({onChange:r,onBlur:e,id:t,schema:n,fieldName:i,validate:s,defaultValue:o,mode:a})=>{const{setValue:l,control:c,setError:u,clearErrors:h,getFieldState:d}=(0,vt.Gc)(),p=(0,S.useCallback)(A=>{const{error:T}=d(i);A&&!T?u(i,{message:A}):T&&h(i)},[h,i,d,u]),m=(0,S.useCallback)(A=>{l(i,A),r?.(A)},[i,r,l]),y=(0,S.useCallback)(A=>{e?.(A)},[e]),w=(0,S.useMemo)(()=>[YO(),fM({id:t,schema:n,handleErrors:p})],[p,t,n]);return S.createElement(vt.Qr,{control:c,name:i,rules:{validate:s},defaultValue:o,render:({field:{value:A,ref:T}})=>S.createElement(_T,{ref:T,className:"codemirror-container",value:A||"",onChange:m,onBlur:y,lang:a||oa.Tr.JSON,theme:uM("light"),extensions:w,basicSetup:{bracketMatching:!0,closeBrackets:!0,tabSize:2,foldGutter:!1,lineNumbers:!1,lintKeymap:!0,drawSelection:!1}})})},pM=(0,S.memo)(dM);var Jf=f(91582);function gM({mediaType:r,mediaContent:e,properties:t,id:n,resolvedBody:i,getActiveSample:s,validate:o}){const{setValue:a}=(0,vt.Gc)(),l=(0,Jf.yN)(e),c=r.examples||{},u=Object.keys(c),h=r.schema,d=ed(h||{},r.name)||r.name===oa.Tr.MULTIPART||r.name===oa.Tr.URL_ENCODED,{exampleKey:p}=(0,vc.C6)(r.operation,c),m=(0,Oe.YQ)((0,Be.P6)(n,r.name,p,c))||(0,Be.oY)(c[p],t),y=(0,S.useCallback)((E="",F="",I)=>W=>{(0,Oe.WW)((0,Be.P6)(n,E,F,I),W)},[n]),w=(0,S.useCallback)(E=>{l?.(E),a("body",s(E))},[a,s,l]),A=(0,S.useCallback)((E,F)=>{a(`body.${E}`,F)},[a]),T=(0,S.useMemo)(()=>(i?.content[r.name]||{}).schema,[r.name,i?.content]);return S.createElement(S.Fragment,null,u.length&&u.length!==1&&S.createElement(vc.b_,{examples:c,onChange:w,exampleKey:p,panel:"try-it"})||null,d?S.createElement(TS,{mediaType:r,onChange:A}):S.createElement(pM,{id:"body"+n,fieldName:"body",defaultValue:m,schema:T,mode:r.name,validate:o,onChange:y(r.name,p,c)}))}const mM=(0,S.memo)(gM);var vM=f(60821),yM=Object.defineProperty,bM=Object.defineProperties,xM=Object.getOwnPropertyDescriptors,vb=Object.getOwnPropertySymbols,wM=Object.prototype.hasOwnProperty,SM=Object.prototype.propertyIsEnumerable,yb=(r,e,t)=>e in r?yM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kM=(r,e)=>{for(var t in e||(e={}))wM.call(e,t)&&yb(r,t,e[t]);if(vb)for(var t of vb(e))SM.call(e,t)&&yb(r,t,e[t]);return r},AM=(r,e)=>bM(r,xM(e));function CM({body:{content:r},resolvedBody:e,properties:t,mergeExampleBody:n,id:i,validate:s,pointer:o}){const{setValue:a}=(0,vt.Gc)(),l=(0,Hr.Dv)(vM.J8),{examples:c,name:u}=r&&(0,_r.getActiveMediaType)(r,l)||{},h=(0,S.useCallback)(m=>{if(!r||!r.hasSample||!c?.[m])return"";const y=u&&(0,Oe.YQ)((0,Be.P6)(i,u,m,c)),w=y?JSON.parse(y):c?.[m];return(0,Be.oY)(w,t)},[u,c,i,r,t]),{activeExampleName:d}=(0,Hr.Dv)((0,yc.N)(o));(0,S.useEffect)(()=>{if(t&&!n){a("body",JSON.stringify(t||{},null,2));return}const m=(0,Be.P6)(i,u,d,c),y=(0,Oe.YQ)(m)||h(d||"");a("body",typeof y=="object"?JSON.stringify(y,null,2):y)},[c,d,u,a,h,i,t,n]);const p=m=>S.createElement(pS.C,AM(kM({},m),{variant:"dark",fullWidth:!0,Label:vS,Dropdown:mS.Lt}));return S.createElement(S.Fragment,null,S.createElement(gS.d,{content:r,renderDropdown:p},m=>S.createElement(mM,{mediaType:m,mediaContent:r,resolvedBody:e,id:i,properties:t,getActiveSample:h,validate:s})))}const OM=(0,S.memo)(CM),EM=({paramEnum:r,fieldName:e,defaultValue:t})=>{const{control:n,setValue:i}=(0,vt.Gc)(),s=r.map((l,c)=>({idx:c,value:l})),o=l=>{i(e,l.value)},a=()=>{i(e,"")};return S.createElement(vt.Qr,{control:n,name:e,defaultValue:Array.isArray(t)?t[0]:t,render:({field:{value:l}})=>S.createElement(Nr.VD,{clearable:!0,fullWidth:!0,variant:"dark",value:l,options:s,handleClear:a,onChange:o})})},TM=(0,S.memo)(EM),PM=({name:r,param:e,place:t,renderParameter:n})=>{var i,s,o,a,l;const[c,u]=S.useState([]),h=()=>{u([...c,c.length?c[c.length-1]+1:0])},d=m=>{u(c.filter(y=>y!==m))},p=(i=e.schema.items)!=null&&i.fields?(s=e.schema.items)==null?void 0:s.fields:[{schema:((o=e.schema.items)==null?void 0:o.schema)||e.schema.items,name:"",required:e.required,description:(a=e.schema.items)==null?void 0:a.description,externalDocs:(l=e.schema.items)==null?void 0:l.externalDocs,deprecated:!1,toggle:()=>null,expanded:!1}];return S.createElement(S.Fragment,null,S.createElement(bb,null,S.createElement(ye.lX,{required:e.required},r,"(",c.length," items)"),S.createElement("span",{onClick:h},"Add item +")),c?.map((m,y)=>S.createElement(bb,{key:m},p.map(w=>n(w,t,`${r}.[${m}]`,`[${y}]${w.name&&"."+w.name}`,S.createElement(MM,{onClick:()=>d(m)},"Delete"))))))},bb=Ye.ZP.div`
|
|
232
232
|
display: flex;
|
|
233
233
|
width: 100%;
|
|
234
234
|
align-items: center;
|
|
@@ -249,14 +249,14 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.i
|
|
|
249
249
|
color: #fff;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
`,
|
|
252
|
+
`,MM=Ye.ZP.span`
|
|
253
253
|
background: transparent;
|
|
254
254
|
border: none;
|
|
255
255
|
cursor: pointer;
|
|
256
256
|
position: relative;
|
|
257
257
|
margin-left: 5px;
|
|
258
258
|
display: inline-block;
|
|
259
|
-
`;var
|
|
259
|
+
`;var Wo=(r=>(r.ARRAY="array",r.OBJECT="object",r))(Wo||{});function IM({schema:r,example:e}){return`(${r.type})`+(e?` ${e}`:"")}function DM(r){const e={};return r.forEach(t=>{t.in&&(e[t.in]||(e[t.in]=[]),e[t.in].push(t))}),e}function NM({schema:r,required:e}){return t=>{if(e&&!t)return"Field is required";if(e&&r.type===Wo.ARRAY&&Array.isArray(t)){if(t.length>(r.rawSchema&&r.rawSchema.maxItems||1/0))return`Too many items selected, maximum ${r.rawSchema.maxItems}`;if(t.length<(r.rawSchema&&r.rawSchema.minItems||0)){const n=r.rawSchema.minItems;return`You should select at least ${n===1?`${n} item`:`${n} items`}`}}}}function RM(r){if(r.type===Wo.ARRAY){const e=r.default||r.example;if(!e&&typeof r.rawSchema.items!="boolean"&&Array.isArray(r.rawSchema.items)){if(r.rawSchema.items[0].default)return[r.rawSchema.items[0].default];if(r.rawSchema.items[0].example)return[r.rawSchema.items[0].example]}if(!e&&typeof r.rawSchema.items!="boolean"&&!Array.isArray(r.rawSchema.items)&&(0,Oe.Kn)(r.rawSchema.items)){if(r.rawSchema.items.default)return[r.rawSchema.items.default];if(r.rawSchema.items.example)return[r.rawSchema.items.example]}return e||[]}else return(Number.isInteger(r.default)?r.default.toString():r.default)||r.example}function LM({oneOfType:r}){return r}const BM=["path","query","cookie","header"];function FM({id:r,param:e,values:t}){const n=(0,S.useMemo)(()=>NM(e),[e]),i=Array.isArray(e.schema.enum)&&e.schema.enum.length?e.schema.enum:void 0,s=RM(e.schema),o=r.split(".").map(a=>(0,Oe.dw)(a));return i?S.createElement(ye.NI,null,S.createElement(TM,{defaultValue:s,paramEnum:i,fieldName:r})):S.createElement(st.Xn,{fullWidth:!0,"data-cy":"parameter-input",id:r,fieldName:r,placeholder:IM(e),rules:{validate:n},defaultValue:s||(0,Oe.U2)(t,o),validateOnBlur:!0,validateOnChange:!0})}function jM({values:r,operation:e}){const t=(0,S.useMemo)(()=>DM(e.parameters||[]),[e]),n=(s,o,a,l,c)=>{var u;const h=a?(0,Oe.s1)(a,s.name):s.name,d=LM(s.schema),p=a?[o,a]:[s.in],m=(0,Oe.s1)(...p,(0,Oe.A8)(s.name));return d&&console.warn(`Unsupported parameter definition: "${d}"`),(Array.isArray(s.schema.type)?s.schema.type:[s.schema.type]).includes(Wo.ARRAY)?S.createElement(PM,{key:m,name:h,param:s,place:o,renderParameter:n}):s.schema.type===Wo.OBJECT?(u=s.schema.fields)==null?void 0:u.map(w=>n(w,o,h)):S.createElement(ye.NI,{key:m},S.createElement(ye.lX,{required:s.required},l||h,": ",c),d?S.createElement(ye.GE,null,"Unsupported field schema definition"):S.createElement(FM,{id:m,param:s,values:r}))},i=s=>{const o=t[s];return!o||!o.length?null:S.createElement(S.Fragment,{key:s},S.createElement(ye.NI,null,S.createElement(ye.iG,null," # ",s," parameters "),S.createElement("span",null,"\xA0")),o.map(a=>n(a,s)))};return S.createElement(ye.iA,null,BM.map(i))}var VM=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function WM(r){return VM(this,null,function*(){return(yield fetch(r)).json()})}const $M=Ye.ZP.div`
|
|
260
260
|
position: relative;
|
|
261
261
|
height: 4px;
|
|
262
262
|
display: block;
|
|
@@ -358,19 +358,19 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.i
|
|
|
358
358
|
right: -8%;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
`,
|
|
361
|
+
`,xb=()=>S.createElement($M,null,S.createElement("div",{className:"indeterminate"})),HM=Ye.ZP.div`
|
|
362
362
|
font-family: var(--font-family-monospaced);
|
|
363
363
|
margin-top: 10px;
|
|
364
364
|
line-height: 1;
|
|
365
365
|
padding-left: 10px;
|
|
366
366
|
border-left: 1px solid gray;
|
|
367
|
-
|
|
367
|
+
`,zM=Ye.ZP.div`
|
|
368
368
|
margin-bottom: 15px;
|
|
369
|
-
`,
|
|
369
|
+
`,UM=Ye.ZP.div`
|
|
370
370
|
padding: 8px 0 20px;
|
|
371
|
-
`,
|
|
371
|
+
`,GM=Ye.ZP.div`
|
|
372
372
|
padding: 4px 0;
|
|
373
|
-
`;var
|
|
373
|
+
`;var KM=Object.defineProperty,YM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,wb=Object.getOwnPropertySymbols,XM=Object.prototype.hasOwnProperty,QM=Object.prototype.propertyIsEnumerable,Sb=(r,e,t)=>e in r?KM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ZM=(r,e)=>{for(var t in e||(e={}))XM.call(e,t)&&Sb(r,t,e[t]);if(wb)for(var t of wb(e))QM.call(e,t)&&Sb(r,t,e[t]);return r},_M=(r,e)=>YM(r,JM(e));const qM=Ye.ZP.input`
|
|
374
374
|
cursor: pointer;
|
|
375
375
|
margin-left: 0;
|
|
376
376
|
margin-right: 5px;
|
|
@@ -379,7 +379,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.i
|
|
|
379
379
|
align-self: baseline;
|
|
380
380
|
margin-top: 0;
|
|
381
381
|
margin-bottom: 0;
|
|
382
|
-
`,
|
|
382
|
+
`,eI=Ye.ZP.label`
|
|
383
383
|
display: inline-block;
|
|
384
384
|
cursor: pointer;
|
|
385
385
|
vertical-align: middle;
|
|
@@ -389,34 +389,35 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.i
|
|
|
389
389
|
|
|
390
390
|
overflow-wrap: break-word;
|
|
391
391
|
line-height: 20px;
|
|
392
|
-
`,
|
|
393
|
-
width: ${({fullWidth:
|
|
392
|
+
`,tI=Ye.ZP.div`
|
|
393
|
+
width: ${({fullWidth:r})=>r?"100%":"50%"};
|
|
394
394
|
display: inline-flex;
|
|
395
395
|
align-items: center;
|
|
396
396
|
|
|
397
397
|
& > label {
|
|
398
|
-
white-space: ${({nowrap:
|
|
398
|
+
white-space: ${({nowrap:r})=>r?"nowrap":"normal"};
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
${({nowrap:
|
|
401
|
+
${({nowrap:r})=>r?"":`
|
|
402
402
|
:not(:first-child) {
|
|
403
403
|
margin-top: 5px;
|
|
404
404
|
}
|
|
405
405
|
`}
|
|
406
|
-
`;function
|
|
406
|
+
`;function rI(r,e){const{fullWidth:t,id:n,label:i,nowrap:s}=r;return S.createElement(tI,{fullWidth:t,nowrap:s},S.createElement(qM,_M(ZM({},r),{type:"checkbox",ref:e})),S.createElement(eI,{htmlFor:n},i))}const kb=(0,S.forwardRef)(rI),nI=11,iI=({fieldName:r,defaultValue:e,items:t,validateOnChange:n,maxDisplayedItems:i,showControls:s,trimItemsLength:o})=>{var a,l;const{control:c,setValue:u,getValues:h,formState:d,trigger:p}=(0,vt.Gc)(),[m,y]=(0,S.useState)(!0),w=Q=>{const B=Q.target.value,U=Q.target.checked,G=h(r)||[];let re;if(U)re=[...G,B];else{const ce=G.indexOf(B);re=[...G.slice(0,ce),...G.slice(ce+1)]}u(r,re)},A=Q=>h(r).includes(Q),T=()=>{y(Q=>!Q)},E=()=>{u(r,t)},F=()=>{u(r,[])},I=(l=(a=d.errors[r])==null?void 0:a.message)==null?void 0:l.toString(),W=i||nI,j=o&&m?t.slice(0,W):t;return S.createElement("div",null,s?S.createElement(mt.CodeBlockControls,{controls:{select:{onClick:E,label:"Select all",tooltipText:"Select all checkboxes"},deselect:{onClick:F,label:"Deselect all",tooltipText:"Deselect all checkboxes"}}}):null,S.createElement(oI,null,S.createElement(vt.Qr,{control:c,name:r,defaultValue:e,render:()=>S.createElement(S.Fragment,null,j.map(Q=>S.createElement(kb,{fullWidth:!0,id:Q,value:Q,checked:A(Q),label:Q,key:Q,onChange:B=>{w(B),n&&p(r)}})))}),t.length>W&&o?S.createElement(aI,{onClick:()=>{T()}},m?"Show all":"Collapse"):null),I?S.createElement(ye.Xq,null,I):"")},sI=(0,S.memo)(iI),oI=Ye.ZP.div`
|
|
407
407
|
padding: 10px;
|
|
408
408
|
border: 1px solid var(--border-primary);
|
|
409
409
|
border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
|
|
410
|
-
`,
|
|
410
|
+
`,aI=(0,Ye.ZP)(mt.CodeBlockControlButton)`
|
|
411
411
|
float: right;
|
|
412
|
-
`;function Sb(t){const{scopes:e,id:r}=t;let n=[];try{n=JSON.parse((0,Oe.YQ)(`auth.${r}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ye.NI,null,S.createElement(ye.lX,null," Scopes: "),S.createElement(nI,{fieldName:`auth.${r}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const oI=({token:t,loading:e,error:r})=>e?S.createElement(ye.GE,null,"Please, finish your authorization flow or cancel authorization."):r?S.createElement(WM,null,S.createElement(ye.Xq,null,r)):t?.access_token?null:S.createElement(ye.GE,null," No Access Token. Please, Authorize. ");var aI=Object.defineProperty,lI=Object.defineProperties,cI=Object.getOwnPropertyDescriptors,kb=Object.getOwnPropertySymbols,uI=Object.prototype.hasOwnProperty,fI=Object.prototype.propertyIsEnumerable,Ab=(t,e,r)=>e in t?aI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ul=(t,e)=>{for(var r in e||(e={}))uI.call(e,r)&&Ab(t,r,e[r]);if(kb)for(var r of kb(e))fI.call(e,r)&&Ab(t,r,e[r]);return t},Gf=(t,e)=>lI(t,cI(e)),Cb=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const Gl=({usePkce:t,id:e,flow:r,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:a,authorizationUrl:l,defaultValues:c,clientId:u})=>{var h;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,Hr.Dv)($n.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,vt.Gc)(),[T,E]=(0,S.useState)(null),[B,I]=(0,S.useState)(!1),[W,F]=(0,S.useState)(!1),[_,j]=(0,S.useState)(void 0),[U,Y]=(0,S.useState)(void 0),[re,ce]=(0,S.useState)(void 0),he=((h=y("auth"))==null?void 0:h[e])||{},xe=A.errors||{},Fe=_!==void 0&&U!==re?{label:"sync",onClick:()=>{_&&Y(re)}}:void 0;(0,S.useEffect)(()=>{if(t){const Ct=(0,mi.CY)(43);ld(Ct).then(tr=>{j(Ct),Y(tr),ce(tr)})}},[t]);const we=Ct=>Cb(void 0,null,function*(){if(!Ct||(yield w(),!(0,mi.Qr)(xe)))return;I(!0),E(null);const tr=i?i+(0,Be.jg)(Ct):Ct,Pr=i&&n?i+(0,Be.jg)(n):n,ai=y(`auth.${e}.scopes`),li={authorizationUrl:tr.startsWith("http")?tr:o+tr,clientId:he.client_id,scopes:ai,redirectUri:d,routingBasePath:p,successCallback:Mr=>{m(`auth.${e}.token`,Mr),I(!1),E(null)},errorCallback:Mr=>{I(!1),E(Mr?.message||"Failed to retrieve the access token")}};if(r==="implicit"&&zr.authorizeImplicit(li),!(0,Be.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}r==="authorizationCode"&&zr.authorizeAuthorizationCode(Ul(Gf(Ul({},li),{tokenUrl:Pr?.startsWith("http")?Pr:o+Pr,clientSecret:he.client_secret,extraHeaders:(0,Be.Or)({authMethod:s,clientId:he.client_id,clientSecret:he.client_secret})}),t&&{codeVerifier:_,codeChallenge:U}))}),Ee=()=>{Ie(),E(null)},Ue=()=>{I(!1),E(null),zr.clearRedirectData(r)},Ie=()=>{m(`auth.${e}.token`,"")},nt=()=>{F(Ct=>!Ct)},dt=Ct=>Cb(void 0,[Ct],function*({target:{value:tr}}){const Pr=yield ld(tr);j(tr),ce(Pr)});if(!l)return S.createElement(ye.Xq,null,"No flow info");let Bt=(0,Oe.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);Bt=Bt?JSON.parse(Bt):"";const er=(0,Oe.Al)(e,"client_id"),Tr={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null," Client ID: "),er?S.createElement(st.F0,Gf(Ul({},Tr),{options:er})):S.createElement(st.Xn,Gf(Ul({},Tr),{"data-cy":"client-id-input",panel:"try-it"}))),r==="authorizationCode"&&S.createElement(S.Fragment,null,(!t?.hideClientSecretInput||!t)&&S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${e}.client_secret`)||c?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),t&&!t.disableManualConfiguration&&S.createElement(HM,null,S.createElement(wb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:W,onChange:nt,"data-cy":"pkce-options-toggle"}),W&&S.createElement(zM,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Verifier"),S.createElement(st.nv,{fullWidth:!0,value:_,onChange:dt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Challenge"),S.createElement(st.nv,{fullWidth:!0,value:U,onChange:({target:{value:Ct}})=>{Y(Ct)},inputActionButton:Fe,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:Bt,panel:"try-it"}),S.createElement(Sb,{id:e,scopes:a}),he.token&&he.token.access_token?S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.nv,{disabled:!0,type:"password",fullWidth:!0,value:he.token.access_token,panel:"try-it"})):null),S.createElement($M,null,he.token&&he.token.access_token?S.createElement(mt.Button,{fullWidth:!0,onClick:Ee},"Log out"):B?S.createElement(S.Fragment,null,S.createElement(mt.Button,{fullWidth:!0,onClick:Ue},"Cancel"),S.createElement(yb,null)):S.createElement(mt.Button,{fullWidth:!0,disabled:!(0,mi.Qr)(xe),onClick:()=>{we(l)}},"Authorize")),B||T||!he.token||!he.token.access_token&&S.createElement(oI,{loading:B,error:T,token:he.token}))};var hI=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function dI(t){var e,r;const{scheme:n,defaultValues:i}=t,[s,o]=(0,S.useState)({}),[a,l]=(0,S.useState)(),[c,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{h(n.openIdConnectUrl)},[n.openIdConnectUrl]);const h=d=>hI(this,null,function*(){u(!0),l("");try{const p=yield jM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(pI,null):a?S.createElement(Ob,{message:a}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Gl,{key:t.id,authorizationUrl:s.authorization_endpoint,authCorsProxyUrl:t.authCorsProxyUrl,scopes:s.scopes_supported,server:t.server,id:t.id,clientId:t.clientId,flow:"implicit",defaultValues:i})):(r=s?.response_types_supported)!=null&&r.includes("code")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Gl,{key:t.id,authorizationUrl:s.authorization_endpoint,tokenUrl:s.token_endpoint,authCorsProxyUrl:t.authCorsProxyUrl,scopes:s.scopes_supported,server:t.server,id:t.id,clientId:t.clientId,tokenEndpointAuthMethod:s?.token_endpoint_auth_methods_supported,flow:"authorizationCode",defaultValues:i})):S.createElement("div",null,"Unsupported flow")))}function pI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(yb,null)))}function Ob({message:t}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ye.Xq,null,t)))}var gI=Object.defineProperty,mI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,Eb=Object.getOwnPropertySymbols,yI=Object.prototype.hasOwnProperty,bI=Object.prototype.propertyIsEnumerable,Tb=(t,e,r)=>e in t?gI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pb=(t,e)=>{for(var r in e||(e={}))yI.call(e,r)&&Tb(t,r,e[r]);if(Eb)for(var r of Eb(e))bI.call(e,r)&&Tb(t,r,e[r]);return t},Mb=(t,e)=>mI(t,vI(e)),xI=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function wI(t){if(!t)return"Token is required"}const SI=({id:t,server:e,flow:r,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,vt.Gc)(),[h,d]=(0,S.useState)(""),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!0),A=((o=c("auth"))==null?void 0:o[t])||{},T=((a=u.errors)==null?void 0:a.auth)||{},E=()=>{l(`auth.${t}.token`,""),(0,Oe.WW)(`auth.${t}.token`,"")},B=()=>{w(U=>!U)},I=()=>xI(void 0,null,function*(){if(p)return;const U=n&&r.tokenUrl?n+(0,Be.jg)(r.tokenUrl):r.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const Y=A.client_id,re=A.client_secret;if(!Y||!re){console.log("Provide client_id and client_secret");return}m(!0);const ce=r["x-tokenEndpointAuthMethod"];if(!(0,Be.xl)(ce)){console.log(`Unsupported token endpoint auth method: ${ce}`);return}yield zr.authorizeClientCredentials({tokenUrl:U.startsWith("http")?U:e+U,clientId:Y,clientSecret:re,scopes:A.scopes,extraHeaders:(0,Be.Or)({authMethod:ce,clientId:Y,clientSecret:re}),successCallback:he=>{l(`auth.${t}.token`,he),m(!1)},errorCallback:he=>{E(),d(he.message),m(!1)}})}),W=Object.keys(r.scopes);let F=(0,Oe.YQ)(`auth.${t}.token`)||JSON.stringify(i?.token);F=F?JSON.parse(F):"";const _=(0,Oe.Al)(t,"client_id"),j={fieldName:`auth.${t}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${t}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client ID:"),_?S.createElement(st.F0,Mb(Pb({},j),{options:_})):S.createElement(st.Xn,Mb(Pb({},j),{type:"password",panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${t}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${t}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${t}.token`,type:"hidden",defaultValue:F,rules:{validate:wI}}),S.createElement(Sb,{id:t,scopes:W})),S.createElement(mt.Button,{color:"primary",onClick:I,blinking:p},p?"Loading...":"Request Token"),S.createElement(ye.ph,null," Access Token "),h?S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ye.TR,null,S.createElement(ye.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ye.lf,{onClick:B},y?"Show":"Hide"," "),S.createElement(ye.h,{onClick:E}," Clear ")):S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"No token"))};var kI=Object.defineProperty,AI=Object.defineProperties,CI=Object.getOwnPropertyDescriptors,Ib=Object.getOwnPropertySymbols,OI=Object.prototype.hasOwnProperty,EI=Object.prototype.propertyIsEnumerable,Db=(t,e,r)=>e in t?kI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Os=(t,e)=>{for(var r in e||(e={}))OI.call(e,r)&&Db(t,r,e[r]);if(Ib)for(var r of Ib(e))EI.call(e,r)&&Db(t,r,e[r]);return t},Es=(t,e)=>AI(t,CI(e));const TI=({securityDefaults:t,operation:e,activeServer:r,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,vt.Gc)(),{parser:c}=(0,Hr.Dv)($n.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(E=>E.schemes.map(B=>B.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const E=h.findIndex(B=>B===d);return E<0?0:E},[h,d]);(0,S.useEffect)(()=>{const E=(0,Oe.YQ)("securityRequirementName"),B=h.findIndex(I=>I===E);a("securityScheme",h[B<0?0:B])},[h,e,a]);const m=(0,S.useCallback)(E=>{a("securityScheme",E.value),(0,Oe.WW)("securityRequirementName",E.value)},[a]),y=(0,S.useMemo)(()=>h.map((E,B)=>({value:E,idx:B})),[h]);if(y.length===0)return S.createElement(Ob,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Oe.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,y.length>1&&S.createElement(ye.NI,null,S.createElement(ye.lX,null," Security scheme: "),S.createElement(vt.Qr,{control:o,name:"securityScheme",render:({field:{value:E}})=>S.createElement(Nr.VD,{variant:"dark",fullWidth:!0,options:y,value:E,onChange:m})}))||null,S.createElement(mt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:E=>{a(`auth.${A}`,E)}}),w.schemes.map(E=>{var B,I,W,F,_,j;const U=(0,Oe.A8)(E.id);if(E.type==="apiKey"){const Y=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Be.NG)(E)||(0,Oe.YQ)(`auth.${U}`)||t?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ye.NI,{key:U},S.createElement(ye.lX,null," ",E.name,": "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(E.type==="http"){if(E.scheme==="basic"){const Y=(0,Oe.Al)(U,"username"),re={fieldName:`auth.${U}.username`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}.username`)||((B=t?.[U])==null?void 0:B.username),validate:Be.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,js.l)("tryItAuthBasicUsername"),": "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,js.l)("tryItAuthBasicPassword"),": "),S.createElement(st.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${U}.password`,defaultValue:(0,Oe.YQ)(`auth.${U}.password`)||((I=t?.[U])==null?void 0:I.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.scheme==="bearer"){const Y=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}`)||t?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Bearer Token: "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(E.type==="oauth2"&&E.flows&&E.flows.clientCredentials)return S.createElement(SI,{key:U,flow:E.flows.clientCredentials,server:r,authCorsProxyUrl:n,id:U,clientId:E.flows.clientCredentials["x-defaultClientId"]||E["x-defaultClientId"],defaultValues:t?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.implicit)return S.createElement(Gl,{key:U,authorizationUrl:E.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((F=(W=E?.flows)==null?void 0:W.implicit)==null?void 0:F.scopes)||{}),server:r,id:U,clientId:E.flows.implicit["x-defaultClientId"]||E["x-defaultClientId"],flow:"implicit",defaultValues:t?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.authorizationCode)return S.createElement(Gl,{key:U,authorizationUrl:E.flows.authorizationCode.authorizationUrl,tokenUrl:E.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((_=E.flows.authorizationCode)==null?void 0:_.scopes)||{}),server:r,id:U,clientId:E.flows.authorizationCode["x-defaultClientId"]||E["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:E.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:E.flows.authorizationCode["x-usePkce"],defaultValues:t?.[U]});if(E.type==="oauth2"){let Y=(0,Oe.YQ)(`auth.${U}.token`)||JSON.stringify((j=t?.[U])==null?void 0:j.token);return Y=Y?JSON.parse(Y):{},S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token Type: "),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${U}.token.token_type`,defaultValue:Y.token_type||"Bearer",panel:"try-it"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${U}.token.access_token`,rules:{validate:Be.np},defaultValue:Y.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.type==="openIdConnect")return S.createElement(dI,{key:U,server:r,authCorsProxyUrl:n,id:U,scheme:E,clientId:E["x-defaultClientId"],defaultValues:t?.[U]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var PI=f(55919);function MI({operation:t,properties:e,mergeExampleBody:r,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,vt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,Hr.Dv)($n.qd),p=i&&Oe.IB.get(i,t.pointer),m=a();let y=m&&m.auth&&Object.keys(m.auth)[0];(!y||!m.auth[y])&&(y=void 0),y&&(m.auth[y].token!==void 0||m.auth[y].client_id!==void 0||m.auth[y].client_secret!==void 0)&&(!m.auth[y].token||!m.auth[y].token.access_token)&&(y=void 0),y&&m.auth[y].username!=null&&(!m.auth[y].username||!m.auth[y].password)&&(y=void 0);const w=t.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(nS,{operation:t,onChange:o}),S.createElement(ta.UQ,{initialActiveIdx:t.security.length&&y?1:0},t.security.length&&S.createElement(hc,{header:(0,js.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(II,{fieldName:"auth",validate:Be.np},A=>S.createElement(PI.Q,{Hook:mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:t,onChange:A,OAuth2:zr}})):S.createElement(TI,{operation:t,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,t.requestBody&&S.createElement(hc,{header:(0,js.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(AM,{validate:DI,body:t.requestBody,pointer:t.pointer,id:t.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:r}))||null,w.length&&S.createElement(hc,{header:(0,js.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(BM,{operation:t,values:m}))||null))}function II({fieldName:t,validate:e,children:r}){const{control:n,setValue:i}=(0,vt.Gc)();return S.createElement(vt.Qr,{control:n,name:t,rules:{validate:e},render:()=>r(i)})}function DI(){}const NI=(0,S.memo)(MI);function RI({shaking:t,className:e,children:r,rootElement:n}){const[i]=(0,Uf.Bs)(n),s=(0,Hr.Dv)($n.qd);return S.createElement(Nr.q2,{scrollYOffset:s.scrollYOffset,shaking:t,className:e,"data-cy":"console",fullWidth:i?.width},r)}const LI=(0,S.memo)(RI);var BI=Object.defineProperty,FI=Object.defineProperties,jI=Object.getOwnPropertyDescriptors,Nb=Object.getOwnPropertySymbols,VI=Object.prototype.hasOwnProperty,WI=Object.prototype.propertyIsEnumerable,Rb=(t,e,r)=>e in t?BI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nt=(t,e)=>{for(var r in e||(e={}))VI.call(e,r)&&Rb(t,r,e[r]);if(Nb)for(var r of Nb(e))WI.call(e,r)&&Rb(t,r,e[r]);return t},Er=(t,e)=>FI(t,jI(e)),Lb=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function Bb(t){return t.startsWith("//")?"https:"+t:t}function $I({operation:t,onResponse:e,className:r,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,vt.cI)({defaultValues:{path:(0,Be.ZS)(t.parameters,"path"),cookie:(0,Be.ZS)(t.parameters,"cookie"),header:(0,Be.ZS)(t.parameters,"header"),query:(0,Be.ZS)(t.parameters,"query")}}),[{activeServer:c},u]=(0,Hr.KO)((0,pc.N)(t.pointer)),[h,d]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!1),[A,T]=(0,S.useState)(),[E,B]=(0,S.useState)(),[I,W]=(0,S.useState)(),[F,_]=(0,S.useState)(),j=(0,Uf.D9)(t),{parser:U,options:Y}=(0,Hr.Dv)($n.eG);(0,S.useEffect)(()=>{const{unsubscribe:we}=l.watch((Ee={})=>{u(Ue=>Er(Nt({},Ue),{requestValues:JSON.parse(JSON.stringify(Ee))})),(0,Be.Hc)(Er(Nt({},Ee),{query:(0,Be.FU)(Ee.query||{})}))});return()=>we()},[l,u]);const re=(0,S.useCallback)(we=>{d(we)},[]),ce=(0,S.useCallback)(we=>{u(Ee=>Er(Nt({},Ee),{activeServer:we})),l.setValue("server",we)},[u,l]),he=l.handleSubmit(we=>Lb(this,null,function*(){var Ee,Ue,Ie,nt,dt,Bt,er,Tr,Ct,tr,Pr,ai,li;const{servers:Mr,requestBody:yn}=t,Kl=yn&&yn.content&&((Ee=(0,_r.getActiveMediaType)(yn.content))==null?void 0:Ee.name)||"";let ci=we.body;if(/json/.test(Kl))try{ci=JSON.parse(ci)}catch(Ge){console.error(Ge)}m(!0);const or=A,Ts=(t.httpVerb||"").toLowerCase();if(!Mr)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");const Kf=Mr.find(Ge=>c?.url.endsWith(Ge.url.endsWith("/")?Ge.url.substring(0,Ge.url.length-1):Ge.url)),zI=Date.now();let In,ui=we.auth;if(ui){const Ge=Object.keys(ui)[0],bn=(0,Aw.dw)(Ge);In=Er(Nt({},or),{components:Er(Nt({},or?.components),{securitySchemes:Er(Nt({},(Ue=or?.components)==null?void 0:Ue.securitySchemes),{[bn]:Er(Nt({},(nt=(Ie=or?.components)==null?void 0:Ie.securitySchemes)==null?void 0:nt[bn]),{type:((er=(Bt=(dt=or?.components)==null?void 0:dt.securitySchemes)==null?void 0:Bt[bn])==null?void 0:er.type)==="openIdConnect"?"oauth2":((Ct=(Tr=or?.components)==null?void 0:Tr.securitySchemes)==null?void 0:Ct[bn]).type})})})}),ui=Er(Nt({},ui),{[bn]:ui[Ge]})}else In=Nt({},or);In.servers=Mr;const Yl=Y.corsProxyUrl;Yl&&Mr.length&&(In.servers=Mr.map(Ge=>Er(Nt({},Ge),{url:Yl+Bb(Ge.url)})),In.paths=Er(Nt({},In.paths),{[t.path]:Er(Nt({},In.paths[t.path]),{[Ts]:Er(Nt({},In.paths[t.path][Ts]),{servers:void 0}),servers:void 0})}));const Yf=yn?.content&&((tr=(0,_r.getActiveMediaType)(yn.content))==null?void 0:tr.name)||null;if(Yf&&ci&&ra(Yf)){const Ge=Object.values(ci);ci=Ge.length>1?Ge:Ge[0]}const UI=(0,Be.FU)(we.query||{}),Jf={server:Yl?Yl+Bb(Kf.url):Kf.url,serverVariables:(0,Be.mj)(Kf),spec:In,pathName:t.path,method:t.httpVerb,parameters:Nt(Nt(Nt(Nt({},we.path),UI),we.header),we.cookie),securities:{authorized:ui},requestBody:ci,requestContentType:Yf,responseContentType:((Pr=we.header)==null?void 0:Pr.Accept)||null,requestInterceptor:(0,Be.Tz)(Y,t,ui?.Authorization)};try{const Ge=yield sw(Jf),bn=Ge?.data;bn instanceof Blob&&(ra(bn.type)&&(Ge.fileInfo={rawData:bn,fileName:(0,Be.AM)(Ge.headers)}),Ge.data=yield bn.text()),e?.({request:Jf,response:Ge}),_(Ge),W(void 0)}catch(Ge){Ge&&Ge.response&&Ge.response.data instanceof Blob&&(Ge.response.data=yield Ge.response.data.text(),e?.({request:Jf,response:Ge.response})),_(void 0),W(Ge)}finally{m(!1),d(1),B(Date.now()-zI),(li=(ai=Y.events)==null?void 0:ai.tryItSent)==null||li.call(ai,{eventType:cc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})}}),()=>{var we,Ee;w(!0),setTimeout(()=>w(!1),1e3),(Ee=(we=Y.events)==null?void 0:we.tryItSent)==null||Ee.call(we,{eventType:cc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})});(0,mt.useMount)(()=>Lb(this,null,function*(){const we=yield kw(t,U.definition);T(we),t.activeServer&&!c&&u(Ee=>Er(Nt({},Ee),{activeServer:t.activeServer}))})),(0,S.useEffect)(()=>{j&&j!==t&&(_(void 0),W(void 0),d(0))},[t,j]);const xe=!!(F||I),Fe=l.getValues();return S.createElement(vt.RV,Nt({},l),S.createElement(LI,{shaking:y,className:r,rootElement:n},S.createElement(ta.Hc,null,S.createElement(Fw,{active:h,hasResponse:xe,onChange:re}),a&&S.createElement(Nr.PZ,{onClick:a}," \u2715 ")),S.createElement(Nr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(NI,{operation:t,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||t.activeServer,onServerChange:ce})),S.createElement(Nr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Lw,{response:F,error:I,time:E})),S.createElement($w,{hasResponse:xe,params:Fe,operation:t,loading:p,onSubmit:he})))}const HI=(0,S.memo)($I)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},72887:(v,C,f)=>{var g=f(65234),b=f(83250),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},70861:(v,C,f)=>{var g=f(83250),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var P=0,N=O.length;k!=null&&P<N;)k=k[b(O[P++])];return P&&P==N?k:void 0}v.exports=x},69823:(v,C,f)=>{var g=f(70861),b=f(91339),x=f(25151),k="[object Null]",O="[object Undefined]",P=g?g.toStringTag:void 0;function N(D){return D==null?D===void 0?O:k:P&&P in Object(D)?b(D):x(D)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,P=/^\[object .+?Constructor\]$/,N=Function.prototype,D=Object.prototype,L=N.toString,H=D.hasOwnProperty,J=RegExp("^"+L.call(H).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q(X){if(!x(X)||b(X))return!1;var G=g(X)?J:P;return G.test(k(X))}v.exports=q},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,P=g?g.prototype:void 0,N=P?P.toString:void 0;function D(L){if(typeof L=="string")return L;if(x(L))return b(L,D)+"";if(k(L))return N?N.call(L):"";var H=L+"";return H=="0"&&1/L==-O?"-0":H}v.exports=D},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(P,N){return g(P)?P:b(P,N)?[P]:x(k(P))}v.exports=O},1622:(v,C,f)=>{var g=f(83250),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var P=b(k,O);return g(P)?P:void 0}v.exports=x},91339:(v,C,f)=>{var g=f(70861),b=Object.prototype,x=b.hasOwnProperty,k=b.toString,O=g?g.toStringTag:void 0;function P(N){var D=x.call(N,O),L=N[O];try{N[O]=void 0;var H=!0}catch{}var J=k.call(N);return H&&(D?N[O]=L:delete N[O]),J}v.exports=P},67736:v=>{function C(f,g){return f?.[g]}v.exports=C},34440:(v,C,f)=>{var g=f(24545);function b(){this.__data__=g?g(null):{},this.size=0}v.exports=b},84108:v=>{function C(f){var g=this.has(f)&&delete this.__data__[f];return this.size-=g?1:0,g}v.exports=C},61085:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__",x=Object.prototype,k=x.hasOwnProperty;function O(P){var N=this.__data__;if(g){var D=N[P];return D===b?void 0:D}return k.call(N,P)?N[P]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var P=this.__data__;return g?P[O]!==void 0:x.call(P,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var P=this.__data__;return this.size+=this.has(k)?0:1,P[k]=g&&O===void 0?b:O,this}v.exports=x},5130:(v,C,f)=>{var g=f(55589),b=f(52624),x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/;function O(P,N){if(g(P))return!1;var D=typeof P;return D=="number"||D=="symbol"||D=="boolean"||P==null||b(P)?!0:k.test(P)||!x.test(P)||N!=null&&P in Object(N)}v.exports=O},58949:v=>{function C(f){var g=typeof f;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?f!=="__proto__":f===null}v.exports=C},28597:(v,C,f)=>{var g=f(1622),b=function(){var k=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}();function x(k){return!!b&&b in k}v.exports=x},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,f)=>{var g=f(18498),b=Array.prototype,x=b.splice;function k(O){var P=this.__data__,N=g(P,O);if(N<0)return!1;var D=P.length-1;return N==D?P.pop():x.call(P,N,1),--this.size,!0}v.exports=k},45828:(v,C,f)=>{var g=f(18498);function b(x){var k=this.__data__,O=g(k,x);return O<0?void 0:k[O][1]}v.exports=b},24115:(v,C,f)=>{var g=f(18498);function b(x){return g(this.__data__,x)>-1}v.exports=b},67690:(v,C,f)=>{var g=f(18498);function b(x,k){var O=this.__data__,P=g(O,x);return P<0?(++this.size,O.push([x,k])):O[P][1]=k,this}v.exports=b},39016:(v,C,f)=>{var g=f(85208),b=f(81998),x=f(72887);function k(){this.size=0,this.__data__={hash:new g,map:new(x||b),string:new g}}v.exports=k},62363:(v,C,f)=>{var g=f(77570);function b(x){var k=g(this,x).delete(x);return this.size-=k?1:0,k}v.exports=b},64348:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).get(x)}v.exports=b},53062:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).has(x)}v.exports=b},30262:(v,C,f)=>{var g=f(77570);function b(x,k){var O=g(this,x),P=O.size;return O.set(x,k),this.size+=O.size==P?0:1,this}v.exports=b},32924:(v,C,f)=>{var g=f(67997),b=500;function x(k){var O=g(k,function(N){return P.size===b&&P.clear(),N}),P=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},83250:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var P=[];return O.charCodeAt(0)===46&&P.push(""),O.replace(b,function(N,D,L,H){P.push(L?H.replace(x,"$1"):D||N)}),P});v.exports=k},86040:(v,C,f)=>{var g=f(52624),b=1/0;function x(k){if(typeof k=="string"||g(k))return k;var O=k+"";return O=="0"&&1/k==-b?"-0":O}v.exports=x},55784:v=>{var C=Function.prototype,f=C.toString;function g(b){if(b!=null){try{return f.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=g},58260:v=>{function C(f,g){return f===g||f!==f&&g!==g}v.exports=C},13546:(v,C,f)=>{var g=f(40548);function b(x,k,O){var P=x==null?void 0:g(x,k);return P===void 0?O:P}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,f)=>{var g=f(69823),b=f(93702),x="[object AsyncFunction]",k="[object Function]",O="[object GeneratorFunction]",P="[object Proxy]";function N(D){if(!b(D))return!1;var L=g(D);return L==k||L==O||L==x||L==P}v.exports=N},93702:v=>{function C(f){var g=typeof f;return f!=null&&(g=="object"||g=="function")}v.exports=C},50440:v=>{function C(f){return f!=null&&typeof f=="object"}v.exports=C},52624:(v,C,f)=>{var g=f(69823),b=f(50440),x="[object Symbol]";function k(O){return typeof O=="symbol"||b(O)&&g(O)==x}v.exports=k},67997:(v,C,f)=>{var g=f(95678),b="Expected a function";function x(k,O){if(typeof k!="function"||O!=null&&typeof O!="function")throw new TypeError(b);var P=function(){var N=arguments,D=O?O.apply(this,N):N[0],L=P.cache;if(L.has(D))return L.get(D);var H=k.apply(this,N);return P.cache=L.set(D,H)||L,H};return P.cache=new(x.Cache||g),P}x.Cache=g,v.exports=x},99835:(v,C,f)=>{var g=f(86245);function b(x){return x==null?"":g(x)}v.exports=b},14927:(v,C,f)=>{var g=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,x=g&&b&&typeof b.get=="function"?b.get:null,k=g&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,P=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&P&&typeof P.get=="function"?P.get:null,D=O&&Set.prototype.forEach,L=typeof WeakMap=="function"&&WeakMap.prototype,H=L?WeakMap.prototype.has:null,J=typeof WeakSet=="function"&&WeakSet.prototype,q=J?WeakSet.prototype.has:null,X=typeof WeakRef=="function"&&WeakRef.prototype,G=X?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,oe=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,z=String.prototype.slice,ne=String.prototype.replace,ie=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ue=RegExp.prototype.test,V=Array.prototype.concat,K=Array.prototype.join,le=Array.prototype.slice,ge=Math.floor,me=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ve=Object.getOwnPropertySymbols,We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,je=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ke=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===je||"symbol")?Symbol.toStringTag:null,Le=Object.prototype.propertyIsEnumerable,lt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Rt($,Z){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ue.call(/e/,Z))return Z;var He=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-ge(-$):ge($);if(_e!==$){var ct=String(_e),Pe=z.call(Z,ct.length+1);return ne.call(ct,He,"$&_")+"."+ne.call(ne.call(Pe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ne.call(Z,He,"$&_")}var Ot=f(65710),rr=Ot.custom,Xe=dr(rr)?rr:null;v.exports=function $(Z,He,_e,ct){var Pe=He||{};if(Dr(Pe,"quoteStyle")&&Pe.quoteStyle!=="single"&&Pe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Dr(Pe,"maxStringLength")&&(typeof Pe.maxStringLength=="number"?Pe.maxStringLength<0&&Pe.maxStringLength!==1/0:Pe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Qr=Dr(Pe,"customInspect")?Pe.customInspect:!0;if(typeof Qr!="boolean"&&Qr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Dr(Pe,"indent")&&Pe.indent!==null&&Pe.indent!==" "&&!(parseInt(Pe.indent,10)===Pe.indent&&Pe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Dr(Pe,"numericSeparator")&&typeof Pe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Sn=Pe.numericSeparator;if(typeof Z>"u")return"undefined";if(Z===null)return"null";if(typeof Z=="boolean")return Z?"true":"false";if(typeof Z=="string")return hi(Z,Pe);if(typeof Z=="number"){if(Z===0)return 1/0/Z>0?"0":"-0";var zt=String(Z);return Sn?Rt(Z,zt):zt}if(typeof Z=="bigint"){var Xr=String(Z)+"n";return Sn?Rt(Z,Xr):Xr}var Ps=typeof Pe.depth>"u"?5:Pe.depth;if(typeof _e>"u"&&(_e=0),_e>=Ps&&Ps>0&&typeof Z=="object")return Tt(Z)?"[Array]":"[Object]";var Bn=Ce(Pe,_e);if(typeof ct>"u")ct=[];else if(Jr(ct,Z)>=0)return"[Circular]";function mr(jn,Wi,Go){if(Wi&&(ct=le.call(ct),ct.push(Wi)),Go){var Ko={depth:Pe.depth};return Dr(Pe,"quoteStyle")&&(Ko.quoteStyle=Pe.quoteStyle),$(jn,Ko,_e+1,ct)}return $(jn,Pe,_e+1,ct)}if(typeof Z=="function"&&!De(Z)){var Wo=gr(Z),$o=Te(Z,mr);return"[Function"+(Wo?": "+Wo:" (anonymous)")+"]"+($o.length>0?" { "+K.call($o,", ")+" }":"")}if(dr(Z)){var Ms=je?ne.call(String(Z),/^(Symbol\(.*\))_[^)]*$/,"$1"):We.call(Z);return typeof Z=="object"&&!je?$r(Ms):Ms}if(Nn(Z)){for(var Fn="<"+ae.call(String(Z.nodeName)),Li=Z.attributes||[],pi=0;pi<Li.length;pi++)Fn+=" "+Li[pi].name+"="+Et(wt(Li[pi].value),"double",Pe);return Fn+=">",Z.childNodes&&Z.childNodes.length&&(Fn+="..."),Fn+="</"+ae.call(String(Z.nodeName))+">",Fn}if(Tt(Z)){if(Z.length===0)return"[]";var Bi=Te(Z,mr);return Bn&&!Ze(Bi)?"["+Ne(Bi,Bn)+"]":"[ "+K.call(Bi,", ")+" ]"}if(St(Z)){var Is=Te(Z,mr);return!("cause"in Error.prototype)&&"cause"in Z&&!Le.call(Z,"cause")?"{ ["+String(Z)+"] "+K.call(V.call("[cause]: "+mr(Z.cause),Is),", ")+" }":Is.length===0?"["+String(Z)+"]":"{ ["+String(Z)+"] "+K.call(Is,", ")+" }"}if(typeof Z=="object"&&Qr){if(Xe&&typeof Z[Xe]=="function"&&Ot)return Ot(Z,{depth:Ps-_e});if(Qr!=="symbol"&&typeof Z.inspect=="function")return Z.inspect()}if(gt(Z)){var Ho=[];return k&&k.call(Z,function(jn,Wi){Ho.push(mr(Wi,Z,!0)+" => "+mr(jn,Z))}),di("Map",x.call(Z),Ho,Bn)}if(xn(Z)){var zo=[];return D&&D.call(Z,function(jn){zo.push(mr(jn,Z))}),di("Set",N.call(Z),zo,Bn)}if(Dn(Z))return Ln("WeakMap");if(wn(Z))return Ln("WeakSet");if(fi(Z))return Ln("WeakRef");if(pt(Z))return $r(mr(Number(Z)));if(Wr(Z))return $r(mr(me.call(Z)));if(Ir(Z))return $r(te.call(Z));if(Ht(Z))return $r(mr(String(Z)));if(!hr(Z)&&!De(Z)){var Fi=Te(Z,mr),Uo=lt?lt(Z)===Object.prototype:Z instanceof Object||Z.constructor===Object,ji=Z instanceof Object?"":"null prototype",Vi=!Uo&&Ke&&Object(Z)===Z&&Ke in Z?z.call(pr(Z),8,-1):ji?"Object":"",Jl=Uo||typeof Z.constructor!="function"?"":Z.constructor.name?Z.constructor.name+" ":"",Ds=Jl+(Vi||ji?"["+K.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Ds+"{}":Bn?Ds+"{"+Ne(Fi,Bn)+"}":Ds+"{ "+K.call(Fi,", ")+" }"}return String(Z)};function Et($,Z,He){var _e=(He.quoteStyle||Z)==="double"?'"':"'";return _e+$+_e}function wt($){return ne.call(String($),/"/g,""")}function Tt($){return pr($)==="[object Array]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function hr($){return pr($)==="[object Date]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function De($){return pr($)==="[object RegExp]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function St($){return pr($)==="[object Error]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function Ht($){return pr($)==="[object String]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function pt($){return pr($)==="[object Number]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function Ir($){return pr($)==="[object Boolean]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function dr($){if(je)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!We)return!1;try{return We.call($),!0}catch{}return!1}function Wr($){if(!$||typeof $!="object"||!me)return!1;try{return me.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Dr($,Z){return Ri.call($,Z)}function pr($){return oe.call($)}function gr($){if($.name)return $.name;var Z=ee.call(R.call($),/^function\s*([\w$]+)/);return Z?Z[1]:null}function Jr($,Z){if($.indexOf)return $.indexOf(Z);for(var He=0,_e=$.length;He<_e;He++)if($[He]===Z)return He;return-1}function gt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function Dn($){if(!H||!$||typeof $!="object")return!1;try{H.call($,H);try{q.call($,q)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function fi($){if(!G||!$||typeof $!="object")return!1;try{return G.call($),!0}catch{}return!1}function xn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function wn($){if(!q||!$||typeof $!="object")return!1;try{q.call($,q);try{H.call($,H)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Nn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function hi($,Z){if($.length>Z.maxStringLength){var He=$.length-Z.maxStringLength,_e="... "+He+" more character"+(He>1?"s":"");return hi(z.call($,0,Z.maxStringLength),Z)+_e}var ct=ne.call(ne.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Rn);return Et(ct,"single",Z)}function Rn($){var Z=$.charCodeAt(0),He={8:"b",9:"t",10:"n",12:"f",13:"r"}[Z];return He?"\\"+He:"\\x"+(Z<16?"0":"")+ie.call(Z.toString(16))}function $r($){return"Object("+$+")"}function Ln($){return $+" { ? }"}function di($,Z,He,_e){var ct=_e?Ne(He,_e):K.call(He,", ");return $+" ("+Z+") {"+ct+"}"}function Ze($){for(var Z=0;Z<$.length;Z++)if(Jr($[Z],`
|
|
413
|
-
`)>=0)return!1;return!0}function Ce($,
|
|
414
|
-
`+
|
|
415
|
-
`+Z.prev}function Te($,Z){var He=Tt($),_e=[];if(He){_e.length=$.length;for(var ct=0;ct<$.length;ct++)_e[ct]=Dr($,ct)?Z($[ct],$):""}var Pe=typeof ve=="function"?ve($):[],Qr;if(je){Qr={};for(var Sn=0;Sn<Pe.length;Sn++)Qr["$"+Pe[Sn]]=Pe[Sn]}for(var zt in $)Dr($,zt)&&(He&&String(Number(zt))===zt&&zt<$.length||je&&Qr["$"+zt]instanceof Symbol||(ue.call(/[^\w$]/,zt)?_e.push(Z(zt,$)+": "+Z($[zt],$)):_e.push(zt+": "+Z($[zt],$))));if(typeof ve=="function")for(var Xr=0;Xr<Pe.length;Xr++)Le.call($,Pe[Xr])&&_e.push("["+Z(Pe[Xr])+"]: "+Z($[Pe[Xr]],$));return _e}},83949:v=>{"use strict";var C=String.prototype.replace,f=/%20/g,g={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:g.RFC3986,formatters:{RFC1738:function(b){return C.call(b,f,"+")},RFC3986:function(b){return String(b)}},RFC1738:g.RFC1738,RFC3986:g.RFC3986}},67905:(v,C,f)=>{"use strict";var g=f(85095),b=f(95990),x=f(83949);v.exports={formats:x,parse:b,stringify:g}},95990:(v,C,f)=>{"use strict";var g=f(37748),b=Object.prototype.hasOwnProperty,x=Array.isArray,k={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:g.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O=function(X){return X.replace(/&#(\d+);/g,function(G,te){return String.fromCharCode(parseInt(te,10))})},P=function(X,G){return X&&typeof X=="string"&&G.comma&&X.indexOf(",")>-1?X.split(","):X},N="utf8=%26%2310003%3B",D="utf8=%E2%9C%93",L=function(G,te){var oe={__proto__:null},R=te.ignoreQueryPrefix?G.replace(/^\?/,""):G,ee=te.parameterLimit===1/0?void 0:te.parameterLimit,z=R.split(te.delimiter,ee),ne=-1,ie,ae=te.charset;if(te.charsetSentinel)for(ie=0;ie<z.length;++ie)z[ie].indexOf("utf8=")===0&&(z[ie]===D?ae="utf-8":z[ie]===N&&(ae="iso-8859-1"),ne=ie,ie=z.length);for(ie=0;ie<z.length;++ie)if(ie!==ne){var ue=z[ie],V=ue.indexOf("]="),K=V===-1?ue.indexOf("="):V+1,le,ge;K===-1?(le=te.decoder(ue,k.decoder,ae,"key"),ge=te.strictNullHandling?null:""):(le=te.decoder(ue.slice(0,K),k.decoder,ae,"key"),ge=g.maybeMap(P(ue.slice(K+1),te),function(me){return te.decoder(me,k.decoder,ae,"value")})),ge&&te.interpretNumericEntities&&ae==="iso-8859-1"&&(ge=O(ge)),ue.indexOf("[]=")>-1&&(ge=x(ge)?[ge]:ge),b.call(oe,le)?oe[le]=g.combine(oe[le],ge):oe[le]=ge}return oe},H=function(X,G,te,oe){for(var R=oe?G:P(G,te),ee=X.length-1;ee>=0;--ee){var z,ne=X[ee];if(ne==="[]"&&te.parseArrays)z=[].concat(R);else{z=te.plainObjects?Object.create(null):{};var ie=ne.charAt(0)==="["&&ne.charAt(ne.length-1)==="]"?ne.slice(1,-1):ne,ae=parseInt(ie,10);!te.parseArrays&&ie===""?z={0:R}:!isNaN(ae)&&ne!==ie&&String(ae)===ie&&ae>=0&&te.parseArrays&&ae<=te.arrayLimit?(z=[],z[ae]=R):ie!=="__proto__"&&(z[ie]=R)}R=z}return R},J=function(G,te,oe,R){if(G){var ee=oe.allowDots?G.replace(/\.([^.[]+)/g,"[$1]"):G,z=/(\[[^[\]]*])/,ne=/(\[[^[\]]*])/g,ie=oe.depth>0&&z.exec(ee),ae=ie?ee.slice(0,ie.index):ee,ue=[];if(ae){if(!oe.plainObjects&&b.call(Object.prototype,ae)&&!oe.allowPrototypes)return;ue.push(ae)}for(var V=0;oe.depth>0&&(ie=ne.exec(ee))!==null&&V<oe.depth;){if(V+=1,!oe.plainObjects&&b.call(Object.prototype,ie[1].slice(1,-1))&&!oe.allowPrototypes)return;ue.push(ie[1])}return ie&&ue.push("["+ee.slice(ie.index)+"]"),H(ue,te,oe,R)}},q=function(G){if(!G)return k;if(G.decoder!==null&&G.decoder!==void 0&&typeof G.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof G.charset<"u"&&G.charset!=="utf-8"&&G.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var te=typeof G.charset>"u"?k.charset:G.charset;return{allowDots:typeof G.allowDots>"u"?k.allowDots:!!G.allowDots,allowPrototypes:typeof G.allowPrototypes=="boolean"?G.allowPrototypes:k.allowPrototypes,allowSparse:typeof G.allowSparse=="boolean"?G.allowSparse:k.allowSparse,arrayLimit:typeof G.arrayLimit=="number"?G.arrayLimit:k.arrayLimit,charset:te,charsetSentinel:typeof G.charsetSentinel=="boolean"?G.charsetSentinel:k.charsetSentinel,comma:typeof G.comma=="boolean"?G.comma:k.comma,decoder:typeof G.decoder=="function"?G.decoder:k.decoder,delimiter:typeof G.delimiter=="string"||g.isRegExp(G.delimiter)?G.delimiter:k.delimiter,depth:typeof G.depth=="number"||G.depth===!1?+G.depth:k.depth,ignoreQueryPrefix:G.ignoreQueryPrefix===!0,interpretNumericEntities:typeof G.interpretNumericEntities=="boolean"?G.interpretNumericEntities:k.interpretNumericEntities,parameterLimit:typeof G.parameterLimit=="number"?G.parameterLimit:k.parameterLimit,parseArrays:G.parseArrays!==!1,plainObjects:typeof G.plainObjects=="boolean"?G.plainObjects:k.plainObjects,strictNullHandling:typeof G.strictNullHandling=="boolean"?G.strictNullHandling:k.strictNullHandling}};v.exports=function(X,G){var te=q(G);if(X===""||X===null||typeof X>"u")return te.plainObjects?Object.create(null):{};for(var oe=typeof X=="string"?L(X,te):X,R=te.plainObjects?Object.create(null):{},ee=Object.keys(oe),z=0;z<ee.length;++z){var ne=ee[z],ie=J(ne,oe[ne],te,typeof X=="string");R=g.merge(R,ie,te)}return te.allowSparse===!0?R:g.compact(R)}},85095:(v,C,f)=>{"use strict";var g=f(44852),b=f(37748),x=f(83949),k=Object.prototype.hasOwnProperty,O={brackets:function(R){return R+"[]"},comma:"comma",indices:function(R,ee){return R+"["+ee+"]"},repeat:function(R){return R}},P=Array.isArray,N=Array.prototype.push,D=function(oe,R){N.apply(oe,P(R)?R:[R])},L=Date.prototype.toISOString,H=x.default,J={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:H,formatter:x.formatters[H],indices:!1,serializeDate:function(R){return L.call(R)},skipNulls:!1,strictNullHandling:!1},q=function(R){return typeof R=="string"||typeof R=="number"||typeof R=="boolean"||typeof R=="symbol"||typeof R=="bigint"},X={},G=function oe(R,ee,z,ne,ie,ae,ue,V,K,le,ge,me,ve,We,je,Ke){for(var Le=R,lt=Ke,Rt=0,Ot=!1;(lt=lt.get(X))!==void 0&&!Ot;){var rr=lt.get(R);if(Rt+=1,typeof rr<"u"){if(rr===Rt)throw new RangeError("Cyclic object value");Ot=!0}typeof lt.get(X)>"u"&&(Rt=0)}if(typeof V=="function"?Le=V(ee,Le):Le instanceof Date?Le=ge(Le):z==="comma"&&P(Le)&&(Le=b.maybeMap(Le,function(dr){return dr instanceof Date?ge(dr):dr})),Le===null){if(ie)return ue&&!We?ue(ee,J.encoder,je,"key",me):ee;Le=""}if(q(Le)||b.isBuffer(Le)){if(ue){var Xe=We?ee:ue(ee,J.encoder,je,"key",me);return[ve(Xe)+"="+ve(ue(Le,J.encoder,je,"value",me))]}return[ve(ee)+"="+ve(String(Le))]}var Et=[];if(typeof Le>"u")return Et;var wt;if(z==="comma"&&P(Le))We&&ue&&(Le=b.maybeMap(Le,ue)),wt=[{value:Le.length>0?Le.join(",")||null:void 0}];else if(P(V))wt=V;else{var Tt=Object.keys(Le);wt=K?Tt.sort(K):Tt}for(var hr=ne&&P(Le)&&Le.length===1?ee+"[]":ee,De=0;De<wt.length;++De){var St=wt[De],Ht=typeof St=="object"&&typeof St.value<"u"?St.value:Le[St];if(!(ae&&Ht===null)){var pt=P(Le)?typeof z=="function"?z(hr,St):hr:hr+(le?"."+St:"["+St+"]");Ke.set(R,Rt);var Ir=g();Ir.set(X,Ke),D(Et,oe(Ht,pt,z,ne,ie,ae,z==="comma"&&We&&P(Le)?null:ue,V,K,le,ge,me,ve,We,je,Ir))}}return Et},te=function(R){if(!R)return J;if(R.encoder!==null&&typeof R.encoder<"u"&&typeof R.encoder!="function")throw new TypeError("Encoder has to be a function.");var ee=R.charset||J.charset;if(typeof R.charset<"u"&&R.charset!=="utf-8"&&R.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var z=x.default;if(typeof R.format<"u"){if(!k.call(x.formatters,R.format))throw new TypeError("Unknown format option provided.");z=R.format}var ne=x.formatters[z],ie=J.filter;return(typeof R.filter=="function"||P(R.filter))&&(ie=R.filter),{addQueryPrefix:typeof R.addQueryPrefix=="boolean"?R.addQueryPrefix:J.addQueryPrefix,allowDots:typeof R.allowDots>"u"?J.allowDots:!!R.allowDots,charset:ee,charsetSentinel:typeof R.charsetSentinel=="boolean"?R.charsetSentinel:J.charsetSentinel,delimiter:typeof R.delimiter>"u"?J.delimiter:R.delimiter,encode:typeof R.encode=="boolean"?R.encode:J.encode,encoder:typeof R.encoder=="function"?R.encoder:J.encoder,encodeValuesOnly:typeof R.encodeValuesOnly=="boolean"?R.encodeValuesOnly:J.encodeValuesOnly,filter:ie,format:z,formatter:ne,serializeDate:typeof R.serializeDate=="function"?R.serializeDate:J.serializeDate,skipNulls:typeof R.skipNulls=="boolean"?R.skipNulls:J.skipNulls,sort:typeof R.sort=="function"?R.sort:null,strictNullHandling:typeof R.strictNullHandling=="boolean"?R.strictNullHandling:J.strictNullHandling}};v.exports=function(oe,R){var ee=oe,z=te(R),ne,ie;typeof z.filter=="function"?(ie=z.filter,ee=ie("",ee)):P(z.filter)&&(ie=z.filter,ne=ie);var ae=[];if(typeof ee!="object"||ee===null)return"";var ue;R&&R.arrayFormat in O?ue=R.arrayFormat:R&&"indices"in R?ue=R.indices?"indices":"repeat":ue="indices";var V=O[ue];if(R&&"commaRoundTrip"in R&&typeof R.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var K=V==="comma"&&R&&R.commaRoundTrip;ne||(ne=Object.keys(ee)),z.sort&&ne.sort(z.sort);for(var le=g(),ge=0;ge<ne.length;++ge){var me=ne[ge];z.skipNulls&&ee[me]===null||D(ae,G(ee[me],me,V,K,z.strictNullHandling,z.skipNulls,z.encode?z.encoder:null,z.filter,z.sort,z.allowDots,z.serializeDate,z.format,z.formatter,z.encodeValuesOnly,z.charset,le))}var ve=ae.join(z.delimiter),We=z.addQueryPrefix===!0?"?":"";return z.charsetSentinel&&(z.charset==="iso-8859-1"?We+="utf8=%26%2310003%3B&":We+="utf8=%E2%9C%93&"),ve.length>0?We+ve:""}},37748:(v,C,f)=>{"use strict";var g=f(83949),b=Object.prototype.hasOwnProperty,x=Array.isArray,k=function(){for(var oe=[],R=0;R<256;++R)oe.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return oe}(),O=function(R){for(;R.length>1;){var ee=R.pop(),z=ee.obj[ee.prop];if(x(z)){for(var ne=[],ie=0;ie<z.length;++ie)typeof z[ie]<"u"&&ne.push(z[ie]);ee.obj[ee.prop]=ne}}},P=function(R,ee){for(var z=ee&&ee.plainObjects?Object.create(null):{},ne=0;ne<R.length;++ne)typeof R[ne]<"u"&&(z[ne]=R[ne]);return z},N=function oe(R,ee,z){if(!ee)return R;if(typeof ee!="object"){if(x(R))R.push(ee);else if(R&&typeof R=="object")(z&&(z.plainObjects||z.allowPrototypes)||!b.call(Object.prototype,ee))&&(R[ee]=!0);else return[R,ee];return R}if(!R||typeof R!="object")return[R].concat(ee);var ne=R;return x(R)&&!x(ee)&&(ne=P(R,z)),x(R)&&x(ee)?(ee.forEach(function(ie,ae){if(b.call(R,ae)){var ue=R[ae];ue&&typeof ue=="object"&&ie&&typeof ie=="object"?R[ae]=oe(ue,ie,z):R.push(ie)}else R[ae]=ie}),R):Object.keys(ee).reduce(function(ie,ae){var ue=ee[ae];return b.call(ie,ae)?ie[ae]=oe(ie[ae],ue,z):ie[ae]=ue,ie},ne)},D=function(R,ee){return Object.keys(ee).reduce(function(z,ne){return z[ne]=ee[ne],z},R)},L=function(oe,R,ee){var z=oe.replace(/\+/g," ");if(ee==="iso-8859-1")return z.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(z)}catch{return z}},H=function(R,ee,z,ne,ie){if(R.length===0)return R;var ae=R;if(typeof R=="symbol"?ae=Symbol.prototype.toString.call(R):typeof R!="string"&&(ae=String(R)),z==="iso-8859-1")return escape(ae).replace(/%u[0-9a-f]{4}/gi,function(le){return"%26%23"+parseInt(le.slice(2),16)+"%3B"});for(var ue="",V=0;V<ae.length;++V){var K=ae.charCodeAt(V);if(K===45||K===46||K===95||K===126||K>=48&&K<=57||K>=65&&K<=90||K>=97&&K<=122||ie===g.RFC1738&&(K===40||K===41)){ue+=ae.charAt(V);continue}if(K<128){ue=ue+k[K];continue}if(K<2048){ue=ue+(k[192|K>>6]+k[128|K&63]);continue}if(K<55296||K>=57344){ue=ue+(k[224|K>>12]+k[128|K>>6&63]+k[128|K&63]);continue}V+=1,K=65536+((K&1023)<<10|ae.charCodeAt(V)&1023),ue+=k[240|K>>18]+k[128|K>>12&63]+k[128|K>>6&63]+k[128|K&63]}return ue},J=function(R){for(var ee=[{obj:{o:R},prop:"o"}],z=[],ne=0;ne<ee.length;++ne)for(var ie=ee[ne],ae=ie.obj[ie.prop],ue=Object.keys(ae),V=0;V<ue.length;++V){var K=ue[V],le=ae[K];typeof le=="object"&&le!==null&&z.indexOf(le)===-1&&(ee.push({obj:ae,prop:K}),z.push(le))}return O(ee),R},q=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},X=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},G=function(R,ee){return[].concat(R,ee)},te=function(R,ee){if(x(R)){for(var z=[],ne=0;ne<R.length;ne+=1)z.push(ee(R[ne]));return z}return ee(R)};v.exports={arrayToObject:P,assign:D,combine:G,compact:J,decode:L,encode:H,isBuffer:X,isRegExp:q,maybeMap:te,merge:N}},95472:(v,C,f)=>{"use strict";var g;/** @license React v17.0.2
|
|
412
|
+
`;function Ab(r){const{scopes:e,id:t}=r;let n=[];try{n=JSON.parse((0,Oe.YQ)(`auth.${t}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ye.NI,null,S.createElement(ye.lX,null," Scopes: "),S.createElement(sI,{fieldName:`auth.${t}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const lI=({token:r,loading:e,error:t})=>e?S.createElement(ye.GE,null,"Please, finish your authorization flow or cancel authorization."):t?S.createElement(HM,null,S.createElement(ye.Xq,null,t)):r?.access_token?null:S.createElement(ye.GE,null," No Access Token. Please, Authorize. ");var cI=Object.defineProperty,uI=Object.defineProperties,fI=Object.getOwnPropertyDescriptors,Cb=Object.getOwnPropertySymbols,hI=Object.prototype.hasOwnProperty,dI=Object.prototype.propertyIsEnumerable,Ob=(r,e,t)=>e in r?cI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jl=(r,e)=>{for(var t in e||(e={}))hI.call(e,t)&&Ob(r,t,e[t]);if(Cb)for(var t of Cb(e))dI.call(e,t)&&Ob(r,t,e[t]);return r},Xf=(r,e)=>uI(r,fI(e)),Eb=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Xl=({usePkce:r,id:e,flow:t,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:a,authorizationUrl:l,defaultValues:c,clientId:u})=>{var h;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,Hr.Dv)($n.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,vt.Gc)(),[T,E]=(0,S.useState)(null),[F,I]=(0,S.useState)(!1),[W,j]=(0,S.useState)(!1),[Q,B]=(0,S.useState)(void 0),[U,G]=(0,S.useState)(void 0),[re,ce]=(0,S.useState)(void 0),he=((h=y("auth"))==null?void 0:h[e])||{},xe=A.errors||{},Fe=Q!==void 0&&U!==re?{label:"sync",onClick:()=>{Q&&G(re)}}:void 0;(0,S.useEffect)(()=>{if(r){const Ct=(0,mi.CY)(43);hd(Ct).then(tr=>{B(Ct),G(tr),ce(tr)})}},[r]);const we=Ct=>Eb(void 0,null,function*(){if(!Ct||(yield w(),!(0,mi.Qr)(xe)))return;I(!0),E(null);const tr=i?i+(0,Be.jg)(Ct):Ct,Pr=i&&n?i+(0,Be.jg)(n):n,ai=y(`auth.${e}.scopes`),li={authorizationUrl:tr.startsWith("http")?tr:o+tr,clientId:he.client_id,scopes:ai,redirectUri:d,routingBasePath:p,successCallback:Mr=>{m(`auth.${e}.token`,Mr),I(!1),E(null)},errorCallback:Mr=>{I(!1),E(Mr?.message||"Failed to retrieve the access token")}};if(t==="implicit"&&zr.authorizeImplicit(li),!(0,Be.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}t==="authorizationCode"&&zr.authorizeAuthorizationCode(Jl(Xf(Jl({},li),{tokenUrl:Pr?.startsWith("http")?Pr:o+Pr,clientSecret:he.client_secret,extraHeaders:(0,Be.Or)({authMethod:s,clientId:he.client_id,clientSecret:he.client_secret})}),r&&{codeVerifier:Q,codeChallenge:U}))}),Ee=()=>{Ie(),E(null)},Ue=()=>{I(!1),E(null),zr.clearRedirectData(t)},Ie=()=>{m(`auth.${e}.token`,"")},nt=()=>{j(Ct=>!Ct)},dt=Ct=>Eb(void 0,[Ct],function*({target:{value:tr}}){const Pr=yield hd(tr);B(tr),ce(Pr)});if(!l)return S.createElement(ye.Xq,null,"No flow info");let Bt=(0,Oe.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);Bt=Bt?JSON.parse(Bt):"";const er=(0,Oe.Al)(e,"client_id"),Tr={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null," Client ID: "),er?S.createElement(st.F0,Xf(Jl({},Tr),{options:er})):S.createElement(st.Xn,Xf(Jl({},Tr),{"data-cy":"client-id-input",panel:"try-it"}))),t==="authorizationCode"&&S.createElement(S.Fragment,null,(!r?.hideClientSecretInput||!r)&&S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${e}.client_secret`)||c?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),r&&!r.disableManualConfiguration&&S.createElement(UM,null,S.createElement(kb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:W,onChange:nt,"data-cy":"pkce-options-toggle"}),W&&S.createElement(GM,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Verifier"),S.createElement(st.nv,{fullWidth:!0,value:Q,onChange:dt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Challenge"),S.createElement(st.nv,{fullWidth:!0,value:U,onChange:({target:{value:Ct}})=>{G(Ct)},inputActionButton:Fe,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:Bt,panel:"try-it"}),S.createElement(Ab,{id:e,scopes:a}),he.token&&he.token.access_token?S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.nv,{disabled:!0,type:"password",fullWidth:!0,value:he.token.access_token,panel:"try-it"})):null),S.createElement(zM,null,he.token&&he.token.access_token?S.createElement(mt.Button,{fullWidth:!0,onClick:Ee},"Log out"):F?S.createElement(S.Fragment,null,S.createElement(mt.Button,{fullWidth:!0,onClick:Ue},"Cancel"),S.createElement(xb,null)):S.createElement(mt.Button,{fullWidth:!0,disabled:!(0,mi.Qr)(xe),onClick:()=>{we(l)}},"Authorize")),F||T||!he.token||!he.token.access_token&&S.createElement(lI,{loading:F,error:T,token:he.token}))};var pI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function gI(r){var e,t;const{scheme:n,defaultValues:i}=r,[s,o]=(0,S.useState)({}),[a,l]=(0,S.useState)(),[c,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{h(n.openIdConnectUrl)},[n.openIdConnectUrl]);const h=d=>pI(this,null,function*(){u(!0),l("");try{const p=yield WM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(mI,null):a?S.createElement(Tb,{message:a}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Xl,{key:r.id,authorizationUrl:s.authorization_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,flow:"implicit",defaultValues:i})):(t=s?.response_types_supported)!=null&&t.includes("code")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Xl,{key:r.id,authorizationUrl:s.authorization_endpoint,tokenUrl:s.token_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,tokenEndpointAuthMethod:s?.token_endpoint_auth_methods_supported,flow:"authorizationCode",defaultValues:i})):S.createElement("div",null,"Unsupported flow")))}function mI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(xb,null)))}function Tb({message:r}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ye.Xq,null,r)))}var vI=Object.defineProperty,yI=Object.defineProperties,bI=Object.getOwnPropertyDescriptors,Pb=Object.getOwnPropertySymbols,xI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,Mb=(r,e,t)=>e in r?vI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ib=(r,e)=>{for(var t in e||(e={}))xI.call(e,t)&&Mb(r,t,e[t]);if(Pb)for(var t of Pb(e))wI.call(e,t)&&Mb(r,t,e[t]);return r},Db=(r,e)=>yI(r,bI(e)),SI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function kI(r){if(!r)return"Token is required"}const AI=({id:r,server:e,flow:t,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,vt.Gc)(),[h,d]=(0,S.useState)(""),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!0),A=((o=c("auth"))==null?void 0:o[r])||{},T=((a=u.errors)==null?void 0:a.auth)||{},E=()=>{l(`auth.${r}.token`,""),(0,Oe.WW)(`auth.${r}.token`,"")},F=()=>{w(U=>!U)},I=()=>SI(void 0,null,function*(){if(p)return;const U=n&&t.tokenUrl?n+(0,Be.jg)(t.tokenUrl):t.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const G=A.client_id,re=A.client_secret;if(!G||!re){console.log("Provide client_id and client_secret");return}m(!0);const ce=t["x-tokenEndpointAuthMethod"];if(!(0,Be.xl)(ce)){console.log(`Unsupported token endpoint auth method: ${ce}`);return}yield zr.authorizeClientCredentials({tokenUrl:U.startsWith("http")?U:e+U,clientId:G,clientSecret:re,scopes:A.scopes,extraHeaders:(0,Be.Or)({authMethod:ce,clientId:G,clientSecret:re}),successCallback:he=>{l(`auth.${r}.token`,he),m(!1)},errorCallback:he=>{E(),d(he.message),m(!1)}})}),W=Object.keys(t.scopes);let j=(0,Oe.YQ)(`auth.${r}.token`)||JSON.stringify(i?.token);j=j?JSON.parse(j):"";const Q=(0,Oe.Al)(r,"client_id"),B={fieldName:`auth.${r}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${r}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client ID:"),Q?S.createElement(st.F0,Db(Ib({},B),{options:Q})):S.createElement(st.Xn,Db(Ib({},B),{type:"password",panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${r}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${r}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${r}.token`,type:"hidden",defaultValue:j,rules:{validate:kI}}),S.createElement(Ab,{id:r,scopes:W})),S.createElement(mt.Button,{color:"primary",onClick:I,blinking:p},p?"Loading...":"Request Token"),S.createElement(ye.ph,null," Access Token "),h?S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ye.TR,null,S.createElement(ye.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ye.lf,{onClick:F},y?"Show":"Hide"," "),S.createElement(ye.h,{onClick:E}," Clear ")):S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"No token"))};var CI=Object.defineProperty,OI=Object.defineProperties,EI=Object.getOwnPropertyDescriptors,Nb=Object.getOwnPropertySymbols,TI=Object.prototype.hasOwnProperty,PI=Object.prototype.propertyIsEnumerable,Rb=(r,e,t)=>e in r?CI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Es=(r,e)=>{for(var t in e||(e={}))TI.call(e,t)&&Rb(r,t,e[t]);if(Nb)for(var t of Nb(e))PI.call(e,t)&&Rb(r,t,e[t]);return r},Ts=(r,e)=>OI(r,EI(e));const MI=({securityDefaults:r,operation:e,activeServer:t,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,vt.Gc)(),{parser:c}=(0,Hr.Dv)($n.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(E=>E.schemes.map(F=>F.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const E=h.findIndex(F=>F===d);return E<0?0:E},[h,d]);(0,S.useEffect)(()=>{const E=(0,Oe.YQ)("securityRequirementName"),F=h.findIndex(I=>I===E);a("securityScheme",h[F<0?0:F])},[h,e,a]);const m=(0,S.useCallback)(E=>{a("securityScheme",E.value),(0,Oe.WW)("securityRequirementName",E.value)},[a]),y=(0,S.useMemo)(()=>h.map((E,F)=>({value:E,idx:F})),[h]);if(y.length===0)return S.createElement(Tb,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Oe.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,y.length>1&&S.createElement(ye.NI,null,S.createElement(ye.lX,null," Security scheme: "),S.createElement(vt.Qr,{control:o,name:"securityScheme",render:({field:{value:E}})=>S.createElement(Nr.VD,{variant:"dark",fullWidth:!0,options:y,value:E,onChange:m})}))||null,S.createElement(mt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:E=>{a(`auth.${A}`,E)}}),w.schemes.map(E=>{var F,I,W,j,Q,B;const U=(0,Oe.A8)(E.id);if(E.type==="apiKey"){const G=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Be.NG)(E)||(0,Oe.YQ)(`auth.${U}`)||r?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ye.NI,{key:U},S.createElement(ye.lX,null," ",E.name,": "),G?S.createElement(st.F0,Ts(Es({},re),{options:G})):S.createElement(st.Xn,Ts(Es({},re),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(E.type==="http"){if(E.scheme==="basic"){const G=(0,Oe.Al)(U,"username"),re={fieldName:`auth.${U}.username`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}.username`)||((F=r?.[U])==null?void 0:F.username),validate:Be.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,Vs.l)("tryItAuthBasicUsername"),": "),G?S.createElement(st.F0,Ts(Es({},re),{options:G})):S.createElement(st.Xn,Ts(Es({},re),{panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,Vs.l)("tryItAuthBasicPassword"),": "),S.createElement(st.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${U}.password`,defaultValue:(0,Oe.YQ)(`auth.${U}.password`)||((I=r?.[U])==null?void 0:I.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.scheme==="bearer"){const G=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}`)||r?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Bearer Token: "),G?S.createElement(st.F0,Ts(Es({},re),{options:G})):S.createElement(st.Xn,Ts(Es({},re),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(E.type==="oauth2"&&E.flows&&E.flows.clientCredentials)return S.createElement(AI,{key:U,flow:E.flows.clientCredentials,server:t,authCorsProxyUrl:n,id:U,clientId:E.flows.clientCredentials["x-defaultClientId"]||E["x-defaultClientId"],defaultValues:r?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.implicit)return S.createElement(Xl,{key:U,authorizationUrl:E.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((j=(W=E?.flows)==null?void 0:W.implicit)==null?void 0:j.scopes)||{}),server:t,id:U,clientId:E.flows.implicit["x-defaultClientId"]||E["x-defaultClientId"],flow:"implicit",defaultValues:r?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.authorizationCode)return S.createElement(Xl,{key:U,authorizationUrl:E.flows.authorizationCode.authorizationUrl,tokenUrl:E.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((Q=E.flows.authorizationCode)==null?void 0:Q.scopes)||{}),server:t,id:U,clientId:E.flows.authorizationCode["x-defaultClientId"]||E["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:E.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:E.flows.authorizationCode["x-usePkce"],defaultValues:r?.[U]});if(E.type==="oauth2"){let G=(0,Oe.YQ)(`auth.${U}.token`)||JSON.stringify((B=r?.[U])==null?void 0:B.token);return G=G?JSON.parse(G):{},S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token Type: "),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${U}.token.token_type`,defaultValue:G.token_type||"Bearer",panel:"try-it"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${U}.token.access_token`,rules:{validate:Be.np},defaultValue:G.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.type==="openIdConnect")return S.createElement(gI,{key:U,server:t,authCorsProxyUrl:n,id:U,scheme:E,clientId:E["x-defaultClientId"],defaultValues:r?.[U]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var II=f(55919);function DI({operation:r,properties:e,mergeExampleBody:t,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,vt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,Hr.Dv)($n.qd),p=i&&Oe.IB.get(i,r.pointer),m=a();let y=m&&m.auth&&Object.keys(m.auth)[0];(!y||!m.auth[y])&&(y=void 0),y&&(m.auth[y].token!==void 0||m.auth[y].client_id!==void 0||m.auth[y].client_secret!==void 0)&&(!m.auth[y].token||!m.auth[y].token.access_token)&&(y=void 0),y&&m.auth[y].username!=null&&(!m.auth[y].username||!m.auth[y].password)&&(y=void 0);const w=r.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(sS,{operation:r,onChange:o}),S.createElement(ra.UQ,{initialActiveIdx:r.security.length&&y?1:0},r.security.length&&S.createElement(mc,{header:(0,Vs.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(NI,{fieldName:"auth",validate:Be.np},A=>S.createElement(II.Q,{Hook:mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:r,onChange:A,OAuth2:zr}})):S.createElement(MI,{operation:r,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,r.requestBody&&S.createElement(mc,{header:(0,Vs.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(OM,{validate:RI,body:r.requestBody,pointer:r.pointer,id:r.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:t}))||null,w.length&&S.createElement(mc,{header:(0,Vs.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(jM,{operation:r,values:m}))||null))}function NI({fieldName:r,validate:e,children:t}){const{control:n,setValue:i}=(0,vt.Gc)();return S.createElement(vt.Qr,{control:n,name:r,rules:{validate:e},render:()=>t(i)})}function RI(){}const LI=(0,S.memo)(DI);function BI({shaking:r,className:e,children:t,rootElement:n}){const[i]=(0,Jf.Bs)(n),s=(0,Hr.Dv)($n.qd);return S.createElement(Nr.q2,{scrollYOffset:s.scrollYOffset,shaking:r,className:e,"data-cy":"console",fullWidth:i?.width},t)}const FI=(0,S.memo)(BI);var jI=Object.defineProperty,VI=Object.defineProperties,WI=Object.getOwnPropertyDescriptors,Lb=Object.getOwnPropertySymbols,$I=Object.prototype.hasOwnProperty,HI=Object.prototype.propertyIsEnumerable,Bb=(r,e,t)=>e in r?jI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nt=(r,e)=>{for(var t in e||(e={}))$I.call(e,t)&&Bb(r,t,e[t]);if(Lb)for(var t of Lb(e))HI.call(e,t)&&Bb(r,t,e[t]);return r},Er=(r,e)=>VI(r,WI(e)),Fb=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function jb(r){return r.startsWith("//")?"https:"+r:r}function zI({operation:r,onResponse:e,className:t,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,vt.cI)({defaultValues:{path:(0,Be.ZS)(r.parameters,"path"),cookie:(0,Be.ZS)(r.parameters,"cookie"),header:(0,Be.ZS)(r.parameters,"header"),query:(0,Be.ZS)(r.parameters,"query")}}),[{activeServer:c},u]=(0,Hr.KO)((0,yc.N)(r.pointer)),[h,d]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!1),[A,T]=(0,S.useState)(),[E,F]=(0,S.useState)(),[I,W]=(0,S.useState)(),[j,Q]=(0,S.useState)(),B=(0,Jf.D9)(r),{parser:U,options:G}=(0,Hr.Dv)($n.eG);(0,S.useEffect)(()=>{const{unsubscribe:we}=l.watch((Ee={})=>{u(Ue=>Er(Nt({},Ue),{requestValues:JSON.parse(JSON.stringify(Ee))})),(0,Be.Hc)(Er(Nt({},Ee),{query:(0,Be.FU)(Ee.query||{})}))});return()=>we()},[l,u]);const re=(0,S.useCallback)(we=>{d(we)},[]),ce=(0,S.useCallback)(we=>{u(Ee=>Er(Nt({},Ee),{activeServer:we})),l.setValue("server",we)},[u,l]),he=l.handleSubmit(we=>Fb(this,null,function*(){var Ee,Ue,Ie,nt,dt,Bt,er,Tr,Ct,tr,Pr,ai,li;const{servers:Mr,requestBody:yn}=r,Ql=yn&&yn.content&&((Ee=(0,_r.getActiveMediaType)(yn.content))==null?void 0:Ee.name)||"";let ci=we.body;if(/json/.test(Ql))try{ci=JSON.parse(ci)}catch(Ge){console.error(Ge)}m(!0);const or=A,Ps=(r.httpVerb||"").toLowerCase();if(!Mr)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");const Qf=Mr.find(Ge=>c?.url.endsWith(Ge.url.endsWith("/")?Ge.url.substring(0,Ge.url.length-1):Ge.url)),GI=Date.now();let In,ui=we.auth;if(ui){const Ge=Object.keys(ui)[0],bn=(0,Ow.dw)(Ge);In=Er(Nt({},or),{components:Er(Nt({},or?.components),{securitySchemes:Er(Nt({},(Ue=or?.components)==null?void 0:Ue.securitySchemes),{[bn]:Er(Nt({},(nt=(Ie=or?.components)==null?void 0:Ie.securitySchemes)==null?void 0:nt[bn]),{type:((er=(Bt=(dt=or?.components)==null?void 0:dt.securitySchemes)==null?void 0:Bt[bn])==null?void 0:er.type)==="openIdConnect"?"oauth2":((Ct=(Tr=or?.components)==null?void 0:Tr.securitySchemes)==null?void 0:Ct[bn]).type})})})}),ui=Er(Nt({},ui),{[bn]:ui[Ge]})}else In=Nt({},or);In.servers=Mr;const Zl=G.corsProxyUrl;Zl&&Mr.length&&(In.servers=Mr.map(Ge=>Er(Nt({},Ge),{url:Zl+jb(Ge.url)})),In.paths=Er(Nt({},In.paths),{[r.path]:Er(Nt({},In.paths[r.path]),{[Ps]:Er(Nt({},In.paths[r.path][Ps]),{servers:void 0}),servers:void 0})}));const Zf=yn?.content&&((tr=(0,_r.getActiveMediaType)(yn.content))==null?void 0:tr.name)||null;if(Zf&&ci&&na(Zf)){const Ge=Object.values(ci);ci=Ge.length>1?Ge:Ge[0]}const KI=(0,Be.FU)(we.query||{}),_f={server:Zl?Zl+jb(Qf.url):Qf.url,serverVariables:(0,Be.mj)(Qf),spec:In,pathName:r.path,method:r.httpVerb,parameters:Nt(Nt(Nt(Nt({},we.path),KI),we.header),we.cookie),securities:{authorized:ui},requestBody:ci,requestContentType:Zf,responseContentType:((Pr=we.header)==null?void 0:Pr.Accept)||null,requestInterceptor:(0,Be.Tz)(G,r,ui?.Authorization)};try{const Ge=yield aw(_f),bn=Ge?.data;bn instanceof Blob&&(na(bn.type)&&(Ge.fileInfo={rawData:bn,fileName:(0,Be.AM)(Ge.headers)}),Ge.data=yield bn.text()),e?.({request:_f,response:Ge}),Q(Ge),W(void 0)}catch(Ge){Ge&&Ge.response&&Ge.response.data instanceof Blob&&(Ge.response.data=yield Ge.response.data.text(),e?.({request:_f,response:Ge.response})),Q(void 0),W(Ge)}finally{m(!1),d(1),F(Date.now()-GI),(li=(ai=G.events)==null?void 0:ai.tryItSent)==null||li.call(ai,{eventType:dc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})}}),()=>{var we,Ee;w(!0),setTimeout(()=>w(!1),1e3),(Ee=(we=G.events)==null?void 0:we.tryItSent)==null||Ee.call(we,{eventType:dc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})});(0,mt.useMount)(()=>Fb(this,null,function*(){const we=yield Cw(r,U.definition);T(we),r.activeServer&&!c&&u(Ee=>Er(Nt({},Ee),{activeServer:r.activeServer}))})),(0,S.useEffect)(()=>{B&&B!==r&&(Q(void 0),W(void 0),d(0))},[r,B]);const xe=!!(j||I),Fe=l.getValues();return S.createElement(vt.RV,Nt({},l),S.createElement(FI,{shaking:y,className:t,rootElement:n},S.createElement(ra.Hc,null,S.createElement(Vw,{active:h,hasResponse:xe,onChange:re}),a&&S.createElement(Nr.PZ,{onClick:a}," \u2715 ")),S.createElement(Nr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(LI,{operation:r,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||r.activeServer,onServerChange:ce})),S.createElement(Nr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Fw,{response:j,error:I,time:E})),S.createElement(zw,{hasResponse:xe,params:Fe,operation:r,loading:p,onSubmit:he})))}const UI=(0,S.memo)(zI)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},72887:(v,C,f)=>{var g=f(65234),b=f(84100),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},70861:(v,C,f)=>{var g=f(84100),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var P=0,N=O.length;k!=null&&P<N;)k=k[b(O[P++])];return P&&P==N?k:void 0}v.exports=x},69823:(v,C,f)=>{var g=f(70861),b=f(91339),x=f(25151),k="[object Null]",O="[object Undefined]",P=g?g.toStringTag:void 0;function N(D){return D==null?D===void 0?O:k:P&&P in Object(D)?b(D):x(D)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,P=/^\[object .+?Constructor\]$/,N=Function.prototype,D=Object.prototype,L=N.toString,H=D.hasOwnProperty,J=RegExp("^"+L.call(H).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q(Z){if(!x(Z)||b(Z))return!1;var K=g(Z)?J:P;return K.test(k(Z))}v.exports=q},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,P=g?g.prototype:void 0,N=P?P.toString:void 0;function D(L){if(typeof L=="string")return L;if(x(L))return b(L,D)+"";if(k(L))return N?N.call(L):"";var H=L+"";return H=="0"&&1/L==-O?"-0":H}v.exports=D},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(P,N){return g(P)?P:b(P,N)?[P]:x(k(P))}v.exports=O},1622:(v,C,f)=>{var g=f(84100),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var P=b(k,O);return g(P)?P:void 0}v.exports=x},91339:(v,C,f)=>{var g=f(70861),b=Object.prototype,x=b.hasOwnProperty,k=b.toString,O=g?g.toStringTag:void 0;function P(N){var D=x.call(N,O),L=N[O];try{N[O]=void 0;var H=!0}catch{}var J=k.call(N);return H&&(D?N[O]=L:delete N[O]),J}v.exports=P},67736:v=>{function C(f,g){return f?.[g]}v.exports=C},34440:(v,C,f)=>{var g=f(24545);function b(){this.__data__=g?g(null):{},this.size=0}v.exports=b},84108:v=>{function C(f){var g=this.has(f)&&delete this.__data__[f];return this.size-=g?1:0,g}v.exports=C},61085:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__",x=Object.prototype,k=x.hasOwnProperty;function O(P){var N=this.__data__;if(g){var D=N[P];return D===b?void 0:D}return k.call(N,P)?N[P]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var P=this.__data__;return g?P[O]!==void 0:x.call(P,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var P=this.__data__;return this.size+=this.has(k)?0:1,P[k]=g&&O===void 0?b:O,this}v.exports=x},5130:(v,C,f)=>{var g=f(55589),b=f(52624),x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/;function O(P,N){if(g(P))return!1;var D=typeof P;return D=="number"||D=="symbol"||D=="boolean"||P==null||b(P)?!0:k.test(P)||!x.test(P)||N!=null&&P in Object(N)}v.exports=O},58949:v=>{function C(f){var g=typeof f;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?f!=="__proto__":f===null}v.exports=C},28597:(v,C,f)=>{var g=f(1622),b=function(){var k=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}();function x(k){return!!b&&b in k}v.exports=x},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,f)=>{var g=f(18498),b=Array.prototype,x=b.splice;function k(O){var P=this.__data__,N=g(P,O);if(N<0)return!1;var D=P.length-1;return N==D?P.pop():x.call(P,N,1),--this.size,!0}v.exports=k},45828:(v,C,f)=>{var g=f(18498);function b(x){var k=this.__data__,O=g(k,x);return O<0?void 0:k[O][1]}v.exports=b},24115:(v,C,f)=>{var g=f(18498);function b(x){return g(this.__data__,x)>-1}v.exports=b},67690:(v,C,f)=>{var g=f(18498);function b(x,k){var O=this.__data__,P=g(O,x);return P<0?(++this.size,O.push([x,k])):O[P][1]=k,this}v.exports=b},39016:(v,C,f)=>{var g=f(85208),b=f(81998),x=f(72887);function k(){this.size=0,this.__data__={hash:new g,map:new(x||b),string:new g}}v.exports=k},62363:(v,C,f)=>{var g=f(77570);function b(x){var k=g(this,x).delete(x);return this.size-=k?1:0,k}v.exports=b},64348:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).get(x)}v.exports=b},53062:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).has(x)}v.exports=b},30262:(v,C,f)=>{var g=f(77570);function b(x,k){var O=g(this,x),P=O.size;return O.set(x,k),this.size+=O.size==P?0:1,this}v.exports=b},32924:(v,C,f)=>{var g=f(67997),b=500;function x(k){var O=g(k,function(N){return P.size===b&&P.clear(),N}),P=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},84100:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var P=[];return O.charCodeAt(0)===46&&P.push(""),O.replace(b,function(N,D,L,H){P.push(L?H.replace(x,"$1"):D||N)}),P});v.exports=k},86040:(v,C,f)=>{var g=f(52624),b=1/0;function x(k){if(typeof k=="string"||g(k))return k;var O=k+"";return O=="0"&&1/k==-b?"-0":O}v.exports=x},55784:v=>{var C=Function.prototype,f=C.toString;function g(b){if(b!=null){try{return f.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=g},58260:v=>{function C(f,g){return f===g||f!==f&&g!==g}v.exports=C},13546:(v,C,f)=>{var g=f(40548);function b(x,k,O){var P=x==null?void 0:g(x,k);return P===void 0?O:P}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,f)=>{var g=f(69823),b=f(93702),x="[object AsyncFunction]",k="[object Function]",O="[object GeneratorFunction]",P="[object Proxy]";function N(D){if(!b(D))return!1;var L=g(D);return L==k||L==O||L==x||L==P}v.exports=N},93702:v=>{function C(f){var g=typeof f;return f!=null&&(g=="object"||g=="function")}v.exports=C},50440:v=>{function C(f){return f!=null&&typeof f=="object"}v.exports=C},52624:(v,C,f)=>{var g=f(69823),b=f(50440),x="[object Symbol]";function k(O){return typeof O=="symbol"||b(O)&&g(O)==x}v.exports=k},67997:(v,C,f)=>{var g=f(95678),b="Expected a function";function x(k,O){if(typeof k!="function"||O!=null&&typeof O!="function")throw new TypeError(b);var P=function(){var N=arguments,D=O?O.apply(this,N):N[0],L=P.cache;if(L.has(D))return L.get(D);var H=k.apply(this,N);return P.cache=L.set(D,H)||L,H};return P.cache=new(x.Cache||g),P}x.Cache=g,v.exports=x},99835:(v,C,f)=>{var g=f(86245);function b(x){return x==null?"":g(x)}v.exports=b},14927:(v,C,f)=>{var g=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,x=g&&b&&typeof b.get=="function"?b.get:null,k=g&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,P=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&P&&typeof P.get=="function"?P.get:null,D=O&&Set.prototype.forEach,L=typeof WeakMap=="function"&&WeakMap.prototype,H=L?WeakMap.prototype.has:null,J=typeof WeakSet=="function"&&WeakSet.prototype,q=J?WeakSet.prototype.has:null,Z=typeof WeakRef=="function"&&WeakRef.prototype,K=Z?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,oe=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,z=String.prototype.slice,ne=String.prototype.replace,ie=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ue=RegExp.prototype.test,V=Array.prototype.concat,Y=Array.prototype.join,le=Array.prototype.slice,ge=Math.floor,me=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ve=Object.getOwnPropertySymbols,We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,je=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ke=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===je||"symbol")?Symbol.toStringTag:null,Le=Object.prototype.propertyIsEnumerable,lt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Rt($,_){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ue.call(/e/,_))return _;var He=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-ge(-$):ge($);if(_e!==$){var ct=String(_e),Pe=z.call(_,ct.length+1);return ne.call(ct,He,"$&_")+"."+ne.call(ne.call(Pe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ne.call(_,He,"$&_")}var Ot=f(65710),rr=Ot.custom,Qe=dr(rr)?rr:null;v.exports=function $(_,He,_e,ct){var Pe=He||{};if(Dr(Pe,"quoteStyle")&&Pe.quoteStyle!=="single"&&Pe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Dr(Pe,"maxStringLength")&&(typeof Pe.maxStringLength=="number"?Pe.maxStringLength<0&&Pe.maxStringLength!==1/0:Pe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Xr=Dr(Pe,"customInspect")?Pe.customInspect:!0;if(typeof Xr!="boolean"&&Xr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Dr(Pe,"indent")&&Pe.indent!==null&&Pe.indent!==" "&&!(parseInt(Pe.indent,10)===Pe.indent&&Pe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Dr(Pe,"numericSeparator")&&typeof Pe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Sn=Pe.numericSeparator;if(typeof _>"u")return"undefined";if(_===null)return"null";if(typeof _=="boolean")return _?"true":"false";if(typeof _=="string")return hi(_,Pe);if(typeof _=="number"){if(_===0)return 1/0/_>0?"0":"-0";var Ut=String(_);return Sn?Rt(_,Ut):Ut}if(typeof _=="bigint"){var Qr=String(_)+"n";return Sn?Rt(_,Qr):Qr}var Ms=typeof Pe.depth>"u"?5:Pe.depth;if(typeof _e>"u"&&(_e=0),_e>=Ms&&Ms>0&&typeof _=="object")return Tt(_)?"[Array]":"[Object]";var Bn=Ce(Pe,_e);if(typeof ct>"u")ct=[];else if(Jr(ct,_)>=0)return"[Circular]";function mr(jn,Wi,Ko){if(Wi&&(ct=le.call(ct),ct.push(Wi)),Ko){var Yo={depth:Pe.depth};return Dr(Pe,"quoteStyle")&&(Yo.quoteStyle=Pe.quoteStyle),$(jn,Yo,_e+1,ct)}return $(jn,Pe,_e+1,ct)}if(typeof _=="function"&&!De(_)){var $o=gr(_),Ho=Te(_,mr);return"[Function"+($o?": "+$o:" (anonymous)")+"]"+(Ho.length>0?" { "+Y.call(Ho,", ")+" }":"")}if(dr(_)){var Is=je?ne.call(String(_),/^(Symbol\(.*\))_[^)]*$/,"$1"):We.call(_);return typeof _=="object"&&!je?$r(Is):Is}if(Nn(_)){for(var Fn="<"+ae.call(String(_.nodeName)),Li=_.attributes||[],pi=0;pi<Li.length;pi++)Fn+=" "+Li[pi].name+"="+Et(wt(Li[pi].value),"double",Pe);return Fn+=">",_.childNodes&&_.childNodes.length&&(Fn+="..."),Fn+="</"+ae.call(String(_.nodeName))+">",Fn}if(Tt(_)){if(_.length===0)return"[]";var Bi=Te(_,mr);return Bn&&!Ze(Bi)?"["+Ne(Bi,Bn)+"]":"[ "+Y.call(Bi,", ")+" ]"}if(St(_)){var Ds=Te(_,mr);return!("cause"in Error.prototype)&&"cause"in _&&!Le.call(_,"cause")?"{ ["+String(_)+"] "+Y.call(V.call("[cause]: "+mr(_.cause),Ds),", ")+" }":Ds.length===0?"["+String(_)+"]":"{ ["+String(_)+"] "+Y.call(Ds,", ")+" }"}if(typeof _=="object"&&Xr){if(Qe&&typeof _[Qe]=="function"&&Ot)return Ot(_,{depth:Ms-_e});if(Xr!=="symbol"&&typeof _.inspect=="function")return _.inspect()}if(gt(_)){var zo=[];return k&&k.call(_,function(jn,Wi){zo.push(mr(Wi,_,!0)+" => "+mr(jn,_))}),di("Map",x.call(_),zo,Bn)}if(xn(_)){var Uo=[];return D&&D.call(_,function(jn){Uo.push(mr(jn,_))}),di("Set",N.call(_),Uo,Bn)}if(Dn(_))return Ln("WeakMap");if(wn(_))return Ln("WeakSet");if(fi(_))return Ln("WeakRef");if(pt(_))return $r(mr(Number(_)));if(Wr(_))return $r(mr(me.call(_)));if(Ir(_))return $r(te.call(_));if(zt(_))return $r(mr(String(_)));if(!hr(_)&&!De(_)){var Fi=Te(_,mr),Go=lt?lt(_)===Object.prototype:_ instanceof Object||_.constructor===Object,ji=_ instanceof Object?"":"null prototype",Vi=!Go&&Ke&&Object(_)===_&&Ke in _?z.call(pr(_),8,-1):ji?"Object":"",_l=Go||typeof _.constructor!="function"?"":_.constructor.name?_.constructor.name+" ":"",Ns=_l+(Vi||ji?"["+Y.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Ns+"{}":Bn?Ns+"{"+Ne(Fi,Bn)+"}":Ns+"{ "+Y.call(Fi,", ")+" }"}return String(_)};function Et($,_,He){var _e=(He.quoteStyle||_)==="double"?'"':"'";return _e+$+_e}function wt($){return ne.call(String($),/"/g,""")}function Tt($){return pr($)==="[object Array]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function hr($){return pr($)==="[object Date]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function De($){return pr($)==="[object RegExp]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function St($){return pr($)==="[object Error]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function zt($){return pr($)==="[object String]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function pt($){return pr($)==="[object Number]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function Ir($){return pr($)==="[object Boolean]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function dr($){if(je)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!We)return!1;try{return We.call($),!0}catch{}return!1}function Wr($){if(!$||typeof $!="object"||!me)return!1;try{return me.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Dr($,_){return Ri.call($,_)}function pr($){return oe.call($)}function gr($){if($.name)return $.name;var _=ee.call(R.call($),/^function\s*([\w$]+)/);return _?_[1]:null}function Jr($,_){if($.indexOf)return $.indexOf(_);for(var He=0,_e=$.length;He<_e;He++)if($[He]===_)return He;return-1}function gt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function Dn($){if(!H||!$||typeof $!="object")return!1;try{H.call($,H);try{q.call($,q)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function fi($){if(!K||!$||typeof $!="object")return!1;try{return K.call($),!0}catch{}return!1}function xn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function wn($){if(!q||!$||typeof $!="object")return!1;try{q.call($,q);try{H.call($,H)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Nn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function hi($,_){if($.length>_.maxStringLength){var He=$.length-_.maxStringLength,_e="... "+He+" more character"+(He>1?"s":"");return hi(z.call($,0,_.maxStringLength),_)+_e}var ct=ne.call(ne.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Rn);return Et(ct,"single",_)}function Rn($){var _=$.charCodeAt(0),He={8:"b",9:"t",10:"n",12:"f",13:"r"}[_];return He?"\\"+He:"\\x"+(_<16?"0":"")+ie.call(_.toString(16))}function $r($){return"Object("+$+")"}function Ln($){return $+" { ? }"}function di($,_,He,_e){var ct=_e?Ne(He,_e):Y.call(He,", ");return $+" ("+_+") {"+ct+"}"}function Ze($){for(var _=0;_<$.length;_++)if(Jr($[_],`
|
|
413
|
+
`)>=0)return!1;return!0}function Ce($,_){var He;if($.indent===" ")He=" ";else if(typeof $.indent=="number"&&$.indent>0)He=Y.call(Array($.indent+1)," ");else return null;return{base:He,prev:Y.call(Array(_+1),He)}}function Ne($,_){if($.length===0)return"";var He=`
|
|
414
|
+
`+_.prev+_.base;return He+Y.call($,","+He)+`
|
|
415
|
+
`+_.prev}function Te($,_){var He=Tt($),_e=[];if(He){_e.length=$.length;for(var ct=0;ct<$.length;ct++)_e[ct]=Dr($,ct)?_($[ct],$):""}var Pe=typeof ve=="function"?ve($):[],Xr;if(je){Xr={};for(var Sn=0;Sn<Pe.length;Sn++)Xr["$"+Pe[Sn]]=Pe[Sn]}for(var Ut in $)Dr($,Ut)&&(He&&String(Number(Ut))===Ut&&Ut<$.length||je&&Xr["$"+Ut]instanceof Symbol||(ue.call(/[^\w$]/,Ut)?_e.push(_(Ut,$)+": "+_($[Ut],$)):_e.push(Ut+": "+_($[Ut],$))));if(typeof ve=="function")for(var Qr=0;Qr<Pe.length;Qr++)Le.call($,Pe[Qr])&&_e.push("["+_(Pe[Qr])+"]: "+_($[Pe[Qr]],$));return _e}},83949:v=>{"use strict";var C=String.prototype.replace,f=/%20/g,g={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:g.RFC3986,formatters:{RFC1738:function(b){return C.call(b,f,"+")},RFC3986:function(b){return String(b)}},RFC1738:g.RFC1738,RFC3986:g.RFC3986}},67905:(v,C,f)=>{"use strict";var g=f(85095),b=f(95990),x=f(83949);v.exports={formats:x,parse:b,stringify:g}},95990:(v,C,f)=>{"use strict";var g=f(37748),b=Object.prototype.hasOwnProperty,x=Array.isArray,k={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:g.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O=function(Z){return Z.replace(/&#(\d+);/g,function(K,te){return String.fromCharCode(parseInt(te,10))})},P=function(Z,K){return Z&&typeof Z=="string"&&K.comma&&Z.indexOf(",")>-1?Z.split(","):Z},N="utf8=%26%2310003%3B",D="utf8=%E2%9C%93",L=function(K,te){var oe={__proto__:null},R=te.ignoreQueryPrefix?K.replace(/^\?/,""):K,ee=te.parameterLimit===1/0?void 0:te.parameterLimit,z=R.split(te.delimiter,ee),ne=-1,ie,ae=te.charset;if(te.charsetSentinel)for(ie=0;ie<z.length;++ie)z[ie].indexOf("utf8=")===0&&(z[ie]===D?ae="utf-8":z[ie]===N&&(ae="iso-8859-1"),ne=ie,ie=z.length);for(ie=0;ie<z.length;++ie)if(ie!==ne){var ue=z[ie],V=ue.indexOf("]="),Y=V===-1?ue.indexOf("="):V+1,le,ge;Y===-1?(le=te.decoder(ue,k.decoder,ae,"key"),ge=te.strictNullHandling?null:""):(le=te.decoder(ue.slice(0,Y),k.decoder,ae,"key"),ge=g.maybeMap(P(ue.slice(Y+1),te),function(me){return te.decoder(me,k.decoder,ae,"value")})),ge&&te.interpretNumericEntities&&ae==="iso-8859-1"&&(ge=O(ge)),ue.indexOf("[]=")>-1&&(ge=x(ge)?[ge]:ge),b.call(oe,le)?oe[le]=g.combine(oe[le],ge):oe[le]=ge}return oe},H=function(Z,K,te,oe){for(var R=oe?K:P(K,te),ee=Z.length-1;ee>=0;--ee){var z,ne=Z[ee];if(ne==="[]"&&te.parseArrays)z=[].concat(R);else{z=te.plainObjects?Object.create(null):{};var ie=ne.charAt(0)==="["&&ne.charAt(ne.length-1)==="]"?ne.slice(1,-1):ne,ae=parseInt(ie,10);!te.parseArrays&&ie===""?z={0:R}:!isNaN(ae)&&ne!==ie&&String(ae)===ie&&ae>=0&&te.parseArrays&&ae<=te.arrayLimit?(z=[],z[ae]=R):ie!=="__proto__"&&(z[ie]=R)}R=z}return R},J=function(K,te,oe,R){if(K){var ee=oe.allowDots?K.replace(/\.([^.[]+)/g,"[$1]"):K,z=/(\[[^[\]]*])/,ne=/(\[[^[\]]*])/g,ie=oe.depth>0&&z.exec(ee),ae=ie?ee.slice(0,ie.index):ee,ue=[];if(ae){if(!oe.plainObjects&&b.call(Object.prototype,ae)&&!oe.allowPrototypes)return;ue.push(ae)}for(var V=0;oe.depth>0&&(ie=ne.exec(ee))!==null&&V<oe.depth;){if(V+=1,!oe.plainObjects&&b.call(Object.prototype,ie[1].slice(1,-1))&&!oe.allowPrototypes)return;ue.push(ie[1])}return ie&&ue.push("["+ee.slice(ie.index)+"]"),H(ue,te,oe,R)}},q=function(K){if(!K)return k;if(K.decoder!==null&&K.decoder!==void 0&&typeof K.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof K.charset<"u"&&K.charset!=="utf-8"&&K.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var te=typeof K.charset>"u"?k.charset:K.charset;return{allowDots:typeof K.allowDots>"u"?k.allowDots:!!K.allowDots,allowPrototypes:typeof K.allowPrototypes=="boolean"?K.allowPrototypes:k.allowPrototypes,allowSparse:typeof K.allowSparse=="boolean"?K.allowSparse:k.allowSparse,arrayLimit:typeof K.arrayLimit=="number"?K.arrayLimit:k.arrayLimit,charset:te,charsetSentinel:typeof K.charsetSentinel=="boolean"?K.charsetSentinel:k.charsetSentinel,comma:typeof K.comma=="boolean"?K.comma:k.comma,decoder:typeof K.decoder=="function"?K.decoder:k.decoder,delimiter:typeof K.delimiter=="string"||g.isRegExp(K.delimiter)?K.delimiter:k.delimiter,depth:typeof K.depth=="number"||K.depth===!1?+K.depth:k.depth,ignoreQueryPrefix:K.ignoreQueryPrefix===!0,interpretNumericEntities:typeof K.interpretNumericEntities=="boolean"?K.interpretNumericEntities:k.interpretNumericEntities,parameterLimit:typeof K.parameterLimit=="number"?K.parameterLimit:k.parameterLimit,parseArrays:K.parseArrays!==!1,plainObjects:typeof K.plainObjects=="boolean"?K.plainObjects:k.plainObjects,strictNullHandling:typeof K.strictNullHandling=="boolean"?K.strictNullHandling:k.strictNullHandling}};v.exports=function(Z,K){var te=q(K);if(Z===""||Z===null||typeof Z>"u")return te.plainObjects?Object.create(null):{};for(var oe=typeof Z=="string"?L(Z,te):Z,R=te.plainObjects?Object.create(null):{},ee=Object.keys(oe),z=0;z<ee.length;++z){var ne=ee[z],ie=J(ne,oe[ne],te,typeof Z=="string");R=g.merge(R,ie,te)}return te.allowSparse===!0?R:g.compact(R)}},85095:(v,C,f)=>{"use strict";var g=f(44852),b=f(37748),x=f(83949),k=Object.prototype.hasOwnProperty,O={brackets:function(R){return R+"[]"},comma:"comma",indices:function(R,ee){return R+"["+ee+"]"},repeat:function(R){return R}},P=Array.isArray,N=Array.prototype.push,D=function(oe,R){N.apply(oe,P(R)?R:[R])},L=Date.prototype.toISOString,H=x.default,J={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:H,formatter:x.formatters[H],indices:!1,serializeDate:function(R){return L.call(R)},skipNulls:!1,strictNullHandling:!1},q=function(R){return typeof R=="string"||typeof R=="number"||typeof R=="boolean"||typeof R=="symbol"||typeof R=="bigint"},Z={},K=function oe(R,ee,z,ne,ie,ae,ue,V,Y,le,ge,me,ve,We,je,Ke){for(var Le=R,lt=Ke,Rt=0,Ot=!1;(lt=lt.get(Z))!==void 0&&!Ot;){var rr=lt.get(R);if(Rt+=1,typeof rr<"u"){if(rr===Rt)throw new RangeError("Cyclic object value");Ot=!0}typeof lt.get(Z)>"u"&&(Rt=0)}if(typeof V=="function"?Le=V(ee,Le):Le instanceof Date?Le=ge(Le):z==="comma"&&P(Le)&&(Le=b.maybeMap(Le,function(dr){return dr instanceof Date?ge(dr):dr})),Le===null){if(ie)return ue&&!We?ue(ee,J.encoder,je,"key",me):ee;Le=""}if(q(Le)||b.isBuffer(Le)){if(ue){var Qe=We?ee:ue(ee,J.encoder,je,"key",me);return[ve(Qe)+"="+ve(ue(Le,J.encoder,je,"value",me))]}return[ve(ee)+"="+ve(String(Le))]}var Et=[];if(typeof Le>"u")return Et;var wt;if(z==="comma"&&P(Le))We&&ue&&(Le=b.maybeMap(Le,ue)),wt=[{value:Le.length>0?Le.join(",")||null:void 0}];else if(P(V))wt=V;else{var Tt=Object.keys(Le);wt=Y?Tt.sort(Y):Tt}for(var hr=ne&&P(Le)&&Le.length===1?ee+"[]":ee,De=0;De<wt.length;++De){var St=wt[De],zt=typeof St=="object"&&typeof St.value<"u"?St.value:Le[St];if(!(ae&&zt===null)){var pt=P(Le)?typeof z=="function"?z(hr,St):hr:hr+(le?"."+St:"["+St+"]");Ke.set(R,Rt);var Ir=g();Ir.set(Z,Ke),D(Et,oe(zt,pt,z,ne,ie,ae,z==="comma"&&We&&P(Le)?null:ue,V,Y,le,ge,me,ve,We,je,Ir))}}return Et},te=function(R){if(!R)return J;if(R.encoder!==null&&typeof R.encoder<"u"&&typeof R.encoder!="function")throw new TypeError("Encoder has to be a function.");var ee=R.charset||J.charset;if(typeof R.charset<"u"&&R.charset!=="utf-8"&&R.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var z=x.default;if(typeof R.format<"u"){if(!k.call(x.formatters,R.format))throw new TypeError("Unknown format option provided.");z=R.format}var ne=x.formatters[z],ie=J.filter;return(typeof R.filter=="function"||P(R.filter))&&(ie=R.filter),{addQueryPrefix:typeof R.addQueryPrefix=="boolean"?R.addQueryPrefix:J.addQueryPrefix,allowDots:typeof R.allowDots>"u"?J.allowDots:!!R.allowDots,charset:ee,charsetSentinel:typeof R.charsetSentinel=="boolean"?R.charsetSentinel:J.charsetSentinel,delimiter:typeof R.delimiter>"u"?J.delimiter:R.delimiter,encode:typeof R.encode=="boolean"?R.encode:J.encode,encoder:typeof R.encoder=="function"?R.encoder:J.encoder,encodeValuesOnly:typeof R.encodeValuesOnly=="boolean"?R.encodeValuesOnly:J.encodeValuesOnly,filter:ie,format:z,formatter:ne,serializeDate:typeof R.serializeDate=="function"?R.serializeDate:J.serializeDate,skipNulls:typeof R.skipNulls=="boolean"?R.skipNulls:J.skipNulls,sort:typeof R.sort=="function"?R.sort:null,strictNullHandling:typeof R.strictNullHandling=="boolean"?R.strictNullHandling:J.strictNullHandling}};v.exports=function(oe,R){var ee=oe,z=te(R),ne,ie;typeof z.filter=="function"?(ie=z.filter,ee=ie("",ee)):P(z.filter)&&(ie=z.filter,ne=ie);var ae=[];if(typeof ee!="object"||ee===null)return"";var ue;R&&R.arrayFormat in O?ue=R.arrayFormat:R&&"indices"in R?ue=R.indices?"indices":"repeat":ue="indices";var V=O[ue];if(R&&"commaRoundTrip"in R&&typeof R.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var Y=V==="comma"&&R&&R.commaRoundTrip;ne||(ne=Object.keys(ee)),z.sort&&ne.sort(z.sort);for(var le=g(),ge=0;ge<ne.length;++ge){var me=ne[ge];z.skipNulls&&ee[me]===null||D(ae,K(ee[me],me,V,Y,z.strictNullHandling,z.skipNulls,z.encode?z.encoder:null,z.filter,z.sort,z.allowDots,z.serializeDate,z.format,z.formatter,z.encodeValuesOnly,z.charset,le))}var ve=ae.join(z.delimiter),We=z.addQueryPrefix===!0?"?":"";return z.charsetSentinel&&(z.charset==="iso-8859-1"?We+="utf8=%26%2310003%3B&":We+="utf8=%E2%9C%93&"),ve.length>0?We+ve:""}},37748:(v,C,f)=>{"use strict";var g=f(83949),b=Object.prototype.hasOwnProperty,x=Array.isArray,k=function(){for(var oe=[],R=0;R<256;++R)oe.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return oe}(),O=function(R){for(;R.length>1;){var ee=R.pop(),z=ee.obj[ee.prop];if(x(z)){for(var ne=[],ie=0;ie<z.length;++ie)typeof z[ie]<"u"&&ne.push(z[ie]);ee.obj[ee.prop]=ne}}},P=function(R,ee){for(var z=ee&&ee.plainObjects?Object.create(null):{},ne=0;ne<R.length;++ne)typeof R[ne]<"u"&&(z[ne]=R[ne]);return z},N=function oe(R,ee,z){if(!ee)return R;if(typeof ee!="object"){if(x(R))R.push(ee);else if(R&&typeof R=="object")(z&&(z.plainObjects||z.allowPrototypes)||!b.call(Object.prototype,ee))&&(R[ee]=!0);else return[R,ee];return R}if(!R||typeof R!="object")return[R].concat(ee);var ne=R;return x(R)&&!x(ee)&&(ne=P(R,z)),x(R)&&x(ee)?(ee.forEach(function(ie,ae){if(b.call(R,ae)){var ue=R[ae];ue&&typeof ue=="object"&&ie&&typeof ie=="object"?R[ae]=oe(ue,ie,z):R.push(ie)}else R[ae]=ie}),R):Object.keys(ee).reduce(function(ie,ae){var ue=ee[ae];return b.call(ie,ae)?ie[ae]=oe(ie[ae],ue,z):ie[ae]=ue,ie},ne)},D=function(R,ee){return Object.keys(ee).reduce(function(z,ne){return z[ne]=ee[ne],z},R)},L=function(oe,R,ee){var z=oe.replace(/\+/g," ");if(ee==="iso-8859-1")return z.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(z)}catch{return z}},H=function(R,ee,z,ne,ie){if(R.length===0)return R;var ae=R;if(typeof R=="symbol"?ae=Symbol.prototype.toString.call(R):typeof R!="string"&&(ae=String(R)),z==="iso-8859-1")return escape(ae).replace(/%u[0-9a-f]{4}/gi,function(le){return"%26%23"+parseInt(le.slice(2),16)+"%3B"});for(var ue="",V=0;V<ae.length;++V){var Y=ae.charCodeAt(V);if(Y===45||Y===46||Y===95||Y===126||Y>=48&&Y<=57||Y>=65&&Y<=90||Y>=97&&Y<=122||ie===g.RFC1738&&(Y===40||Y===41)){ue+=ae.charAt(V);continue}if(Y<128){ue=ue+k[Y];continue}if(Y<2048){ue=ue+(k[192|Y>>6]+k[128|Y&63]);continue}if(Y<55296||Y>=57344){ue=ue+(k[224|Y>>12]+k[128|Y>>6&63]+k[128|Y&63]);continue}V+=1,Y=65536+((Y&1023)<<10|ae.charCodeAt(V)&1023),ue+=k[240|Y>>18]+k[128|Y>>12&63]+k[128|Y>>6&63]+k[128|Y&63]}return ue},J=function(R){for(var ee=[{obj:{o:R},prop:"o"}],z=[],ne=0;ne<ee.length;++ne)for(var ie=ee[ne],ae=ie.obj[ie.prop],ue=Object.keys(ae),V=0;V<ue.length;++V){var Y=ue[V],le=ae[Y];typeof le=="object"&&le!==null&&z.indexOf(le)===-1&&(ee.push({obj:ae,prop:Y}),z.push(le))}return O(ee),R},q=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},Z=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},K=function(R,ee){return[].concat(R,ee)},te=function(R,ee){if(x(R)){for(var z=[],ne=0;ne<R.length;ne+=1)z.push(ee(R[ne]));return z}return ee(R)};v.exports={arrayToObject:P,assign:D,combine:K,compact:J,decode:L,encode:H,isBuffer:Z,isRegExp:q,maybeMap:te,merge:N}},56053:(v,C,f)=>{"use strict";var g;/**
|
|
416
|
+
* @license React
|
|
416
417
|
* react-jsx-runtime.production.min.js
|
|
417
418
|
*
|
|
418
419
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
419
420
|
*
|
|
420
421
|
* This source code is licensed under the MIT license found in the
|
|
421
422
|
* LICENSE file in the root directory of this source tree.
|
|
422
|
-
*/
|
|
423
|
+
*/var b=f(52983),x=Symbol.for("react.element"),k=Symbol.for("react.fragment"),O=Object.prototype.hasOwnProperty,P=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,N={key:!0,ref:!0,__self:!0,__source:!0};function D(L,H,J){var q,Z={},K=null,te=null;J!==void 0&&(K=""+J),H.key!==void 0&&(K=""+H.key),H.ref!==void 0&&(te=H.ref);for(q in H)O.call(H,q)&&!N.hasOwnProperty(q)&&(Z[q]=H[q]);if(L&&L.defaultProps)for(q in H=L.defaultProps,H)Z[q]===void 0&&(Z[q]=H[q]);return{$$typeof:x,type:L,key:K,ref:te,props:Z,_owner:P.current}}g=k,C.jsx=D,g=D},97458:(v,C,f)=>{"use strict";v.exports=f(56053)},44852:(v,C,f)=>{"use strict";var g=f(71013),b=f(2864),x=f(14927),k=g("%TypeError%"),O=g("%WeakMap%",!0),P=g("%Map%",!0),N=b("WeakMap.prototype.get",!0),D=b("WeakMap.prototype.set",!0),L=b("WeakMap.prototype.has",!0),H=b("Map.prototype.get",!0),J=b("Map.prototype.set",!0),q=b("Map.prototype.has",!0),Z=function(R,ee){for(var z=R,ne;(ne=z.next)!==null;z=ne)if(ne.key===ee)return z.next=ne.next,ne.next=R.next,R.next=ne,ne},K=function(R,ee){var z=Z(R,ee);return z&&z.value},te=function(R,ee,z){var ne=Z(R,ee);ne?ne.value=z:R.next={key:ee,next:R.next,value:z}},oe=function(R,ee){return!!Z(R,ee)};v.exports=function(){var ee,z,ne,ie={assert:function(ae){if(!ie.has(ae))throw new k("Side channel does not contain "+x(ae))},get:function(ae){if(O&&ae&&(typeof ae=="object"||typeof ae=="function")){if(ee)return N(ee,ae)}else if(P){if(z)return H(z,ae)}else if(ne)return K(ne,ae)},has:function(ae){if(O&&ae&&(typeof ae=="object"||typeof ae=="function")){if(ee)return L(ee,ae)}else if(P){if(z)return q(z,ae)}else if(ne)return oe(ne,ae);return!1},set:function(ae,ue){O&&ae&&(typeof ae=="object"||typeof ae=="function")?(ee||(ee=new O),D(ee,ae,ue)):P?(z||(z=new P),J(z,ae,ue)):(ne||(ne={key:{},next:null}),te(ne,ae,ue))}};return ie}},65710:()=>{},93652:(v,C,f)=>{v.exports=f(24018)},10017:(v,C,f)=>{v.exports=f(27411)},34961:(v,C,f)=>{v.exports=f(79155)},86751:(v,C,f)=>{v.exports=f(13375)},12953:(v,C,f)=>{v.exports=f(95442)},11099:(v,C,f)=>{v.exports=f(55334)},86351:(v,C,f)=>{v.exports=f(48261)},70762:(v,C,f)=>{v.exports=f(92864)},10954:(v,C,f)=>{v.exports=f(27923)},55839:(v,C,f)=>{v.exports=f(89225)},23422:(v,C,f)=>{v.exports=f(95281)},47319:(v,C,f)=>{v.exports=f(55468)}}]);
|