@redocly/openapi-docs 3.0.0-alpha.86 → 3.0.0-alpha.88
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 +102 -100
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-openapi-docs.min.js +1394 -1387
- package/package.json +16 -14
|
@@ -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.88"
|
|
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,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",Be=!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):(Be=!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||Be||!(wt in lt))&&J(lt,wt,Et[wt]);else g({target:Y,proto:!0,forced:ee||Be},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),Be=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){Be(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);/*!
|
|
11
|
+
*/C.parse=b,C.serialize=w;var h=Object.prototype.toString,m=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(N,V){if(typeof N!="string")throw new TypeError("argument str must be a string");for(var G={},X=V||{},ee=X.decode||A,Z=0;Z<N.length;){var _=N.indexOf("=",Z);if(_===-1)break;var re=N.indexOf(";",Z);if(re===-1)re=N.length;else if(re<_){Z=N.lastIndexOf(";",_-1)+1;continue}var oe=N.slice(Z,_).trim();if(G[oe]===void 0){var B=N.slice(_+1,re).trim();B.charCodeAt(0)===34&&(B=B.slice(1,-1)),G[oe]=R(B,ee)}Z=re+1}return G}function w(N,V,G){var X=G||{},ee=X.encode||T;if(typeof ee!="function")throw new TypeError("option encode is invalid");if(!m.test(N))throw new TypeError("argument name is invalid");var Z=ee(V);if(Z&&!m.test(Z))throw new TypeError("argument val is invalid");var _=N+"="+Z;if(X.maxAge!=null){var re=X.maxAge-0;if(isNaN(re)||!isFinite(re))throw new TypeError("option maxAge is invalid");_+="; Max-Age="+Math.floor(re)}if(X.domain){if(!m.test(X.domain))throw new TypeError("option domain is invalid");_+="; Domain="+X.domain}if(X.path){if(!m.test(X.path))throw new TypeError("option path is invalid");_+="; Path="+X.path}if(X.expires){var oe=X.expires;if(!I(oe)||isNaN(oe.valueOf()))throw new TypeError("option expires is invalid");_+="; Expires="+oe.toUTCString()}if(X.httpOnly&&(_+="; HttpOnly"),X.secure&&(_+="; Secure"),X.priority){var B=typeof X.priority=="string"?X.priority.toLowerCase():X.priority;switch(B){case"low":_+="; Priority=Low";break;case"medium":_+="; Priority=Medium";break;case"high":_+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(X.sameSite){var te=typeof X.sameSite=="string"?X.sameSite.toLowerCase():X.sameSite;switch(te){case!0:_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"strict":_+="; SameSite=Strict";break;case"none":_+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return _}function A(N){return N.indexOf("%")!==-1?decodeURIComponent(N):N}function T(N){return encodeURIComponent(N)}function I(N){return h.call(N)==="[object Date]"||N instanceof Date}function R(N,V){try{return V(N)}catch{return N}}},97529:(v,C,h)=>{var m=h(44928);v.exports=m},75342:(v,C,h)=>{var m=h(26087);v.exports=m},64218:(v,C,h)=>{var m=h(11783);v.exports=m},95050:(v,C,h)=>{var m=h(88462);v.exports=m},84779:(v,C,h)=>{var m=h(83531);v.exports=m},17190:(v,C,h)=>{var m=h(19941);v.exports=m},96589:(v,C,h)=>{var m=h(25081);v.exports=m},32276:(v,C,h)=>{var m=h(22145);v.exports=m},15064:(v,C,h)=>{var m=h(93690);v.exports=m},31986:(v,C,h)=>{var m=h(8429);h(42319),v.exports=m},69635:(v,C,h)=>{var m=h(13099);v.exports=m},3529:(v,C,h)=>{var m=h(44931);v.exports=m},85373:(v,C,h)=>{h(17802);var m=h(70291);v.exports=m("Array").filter},94537:(v,C,h)=>{h(64009);var m=h(70291);v.exports=m("Array").forEach},27794:(v,C,h)=>{h(32449);var m=h(70291);v.exports=m("Array").indexOf},55794:(v,C,h)=>{var m=h(15166),b=h(85373),w=Array.prototype;v.exports=function(A){var T=A.filter;return A===w||m(w,A)&&T===w.filter?b:T}},85838:(v,C,h)=>{var m=h(15166),b=h(27794),w=Array.prototype;v.exports=function(A){var T=A.indexOf;return A===w||m(w,A)&&T===w.indexOf?b:T}},95617:(v,C,h)=>{h(28135);var m=h(59921),b=m.Object,w=v.exports=function(T,I){return b.defineProperties(T,I)};b.defineProperties.sham&&(w.sham=!0)},11906:(v,C,h)=>{h(70829);var m=h(59921),b=m.Object,w=v.exports=function(T,I,R){return b.defineProperty(T,I,R)};b.defineProperty.sham&&(w.sham=!0)},59123:(v,C,h)=>{h(51964);var m=h(59921),b=m.Object,w=v.exports=function(T,I){return b.getOwnPropertyDescriptor(T,I)};b.getOwnPropertyDescriptor.sham&&(w.sham=!0)},63332:(v,C,h)=>{h(723);var m=h(59921);v.exports=m.Object.getOwnPropertyDescriptors},83606:(v,C,h)=>{h(68030);var m=h(59921);v.exports=m.Object.getOwnPropertySymbols},90660:(v,C,h)=>{h(38339);var m=h(59921);v.exports=m.Object.keys},49198:(v,C,h)=>{h(29126),h(97829),h(68030),h(95353),h(63906),h(39542),h(47882),h(84911),h(88725),h(47954),h(67703),h(2220),h(48990),h(50240),h(99921),h(3502),h(80220),h(23870),h(5828),h(5708);var m=h(59921);v.exports=m.Symbol},15413:(v,C,h)=>{h(44390),h(97829),h(27626),h(84911);var m=h(39378);v.exports=m.f("iterator")},4793:(v,C,h)=>{h(91667),h(99921);var m=h(39378);v.exports=m.f("toPrimitive")},24018:(v,C,h)=>{v.exports=h(11226)},27411:(v,C,h)=>{v.exports=h(39743)},79155:(v,C,h)=>{v.exports=h(17018)},13375:(v,C,h)=>{v.exports=h(45057)},95442:(v,C,h)=>{v.exports=h(97947)},55334:(v,C,h)=>{v.exports=h(26452)},48261:(v,C,h)=>{v.exports=h(4477)},92864:(v,C,h)=>{v.exports=h(74013)},27923:(v,C,h)=>{v.exports=h(17685)},89225:(v,C,h)=>{v.exports=h(2371)},95281:(v,C,h)=>{v.exports=h(89061)},55468:(v,C,h)=>{v.exports=h(51553)},11226:(v,C,h)=>{var m=h(97529);v.exports=m},39743:(v,C,h)=>{var m=h(75342);v.exports=m},17018:(v,C,h)=>{var m=h(64218);v.exports=m},45057:(v,C,h)=>{var m=h(95050);v.exports=m},97947:(v,C,h)=>{var m=h(84779);v.exports=m},26452:(v,C,h)=>{var m=h(17190);v.exports=m},4477:(v,C,h)=>{var m=h(96589);v.exports=m},74013:(v,C,h)=>{var m=h(32276);v.exports=m},17685:(v,C,h)=>{var m=h(15064);v.exports=m},2371:(v,C,h)=>{var m=h(31986);h(45987),h(58052),h(90181),h(25129),h(90397),h(18097),h(82793),h(52100),h(99742),v.exports=m},89061:(v,C,h)=>{var m=h(69635);v.exports=m},51553:(v,C,h)=>{var m=h(3529);v.exports=m},81970:(v,C,h)=>{var m=h(43152),b=h(18342),w=TypeError;v.exports=function(A){if(m(A))return A;throw w(b(A)+" is not a function")}},72185:(v,C,h)=>{var m=h(43152),b=String,w=TypeError;v.exports=function(A){if(typeof A=="object"||m(A))return A;throw w("Can't set "+b(A)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,h)=>{var m=h(92548),b=String,w=TypeError;v.exports=function(A){if(m(A))return A;throw w(b(A)+" is not an object")}},24782:(v,C,h)=>{"use strict";var m=h(93935).forEach,b=h(10454),w=b("forEach");v.exports=w?[].forEach:function(T){return m(this,T,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,h)=>{var m=h(88966),b=h(13249),w=h(53387),A=function(T){return function(I,R,N){var V=m(I),G=w(V),X=b(N,G),ee;if(T&&R!=R){for(;G>X;)if(ee=V[X++],ee!=ee)return!0}else for(;G>X;X++)if((T||X in V)&&V[X]===R)return T||X||0;return!T&&-1}};v.exports={includes:A(!0),indexOf:A(!1)}},93935:(v,C,h)=>{var m=h(7416),b=h(90406),w=h(38622),A=h(53254),T=h(53387),I=h(69573),R=b([].push),N=function(V){var G=V==1,X=V==2,ee=V==3,Z=V==4,_=V==6,re=V==7,oe=V==5||_;return function(B,te,K,ne){for(var ie=A(B),ae=w(ie),he=m(te,K),H=T(ae),J=0,ue=ne||I,ve=G?ue(B,H):X||re?ue(B,0):void 0,be,we;H>J;J++)if((oe||J in ae)&&(be=ae[J],we=he(be,J,ie),V))if(G)ve[J]=we;else if(we)switch(V){case 3:return!0;case 5:return be;case 6:return J;case 2:R(ve,be)}else switch(V){case 4:return!1;case 7:R(ve,be)}return _?-1:ee||Z?Z:ve}};v.exports={forEach:N(0),map:N(1),filter:N(2),some:N(3),every:N(4),find:N(5),findIndex:N(6),filterReject:N(7)}},36844:(v,C,h)=>{var m=h(31982),b=h(33538),w=h(32438),A=b("species");v.exports=function(T){return w>=51||!m(function(){var I=[],R=I.constructor={};return R[A]=function(){return{foo:1}},I[T](Boolean).foo!==1})}},10454:(v,C,h)=>{"use strict";var m=h(31982);v.exports=function(b,w){var A=[][b];return!!A&&m(function(){A.call(null,w||function(){return 1},1)})}},67932:(v,C,h)=>{var m=h(13249),b=h(53387),w=h(53437),A=Array,T=Math.max;v.exports=function(I,R,N){for(var V=b(I),G=m(R,V),X=m(N===void 0?V:N,V),ee=A(T(X-G,0)),Z=0;G<X;G++,Z++)w(ee,Z,I[G]);return ee.length=Z,ee}},53160:(v,C,h)=>{var m=h(90406);v.exports=m([].slice)},76562:(v,C,h)=>{var m=h(93053),b=h(43455),w=h(92548),A=h(33538),T=A("species"),I=Array;v.exports=function(R){var N;return m(R)&&(N=R.constructor,b(N)&&(N===I||m(N.prototype))?N=void 0:w(N)&&(N=N[T],N===null&&(N=void 0))),N===void 0?I:N}},69573:(v,C,h)=>{var m=h(76562);v.exports=function(b,w){return new(m(b))(w===0?0:w)}},58310:(v,C,h)=>{var m=h(90406),b=m({}.toString),w=m("".slice);v.exports=function(A){return w(b(A),8,-1)}},82059:(v,C,h)=>{var m=h(48448),b=h(43152),w=h(58310),A=h(33538),T=A("toStringTag"),I=Object,R=w(function(){return arguments}())=="Arguments",N=function(V,G){try{return V[G]}catch{}};v.exports=m?w:function(V){var G,X,ee;return V===void 0?"Undefined":V===null?"Null":typeof(X=N(G=I(V),T))=="string"?X:R?w(G):(ee=w(G))=="Object"&&b(G.callee)?"Arguments":ee}},74838:(v,C,h)=>{var m=h(31982);v.exports=!m(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,h){return{value:C,done:h}}},20410:(v,C,h)=>{var m=h(56049),b=h(36133),w=h(54686);v.exports=m?function(A,T,I){return b.f(A,T,w(1,I))}:function(A,T,I){return A[T]=I,A}},54686:v=>{v.exports=function(C,h){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:h}}},53437:(v,C,h)=>{"use strict";var m=h(5135),b=h(36133),w=h(54686);v.exports=function(A,T,I){var R=m(T);R in A?b.f(A,R,w(0,I)):A[R]=I}},37912:(v,C,h)=>{var m=h(36133);v.exports=function(b,w,A){return m.f(b,w,A)}},27519:(v,C,h)=>{var m=h(20410);v.exports=function(b,w,A,T){return T&&T.enumerable?b[w]=A:m(b,w,A),b}},9267:(v,C,h)=>{var m=h(62447),b=Object.defineProperty;v.exports=function(w,A){try{b(m,w,{value:A,configurable:!0,writable:!0})}catch{m[w]=A}return A}},56049:(v,C,h)=>{var m=h(31982);v.exports=!m(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,h=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:h}},45511:(v,C,h)=>{var m=h(62447),b=h(92548),w=m.document,A=b(w)&&b(w.createElement);v.exports=function(T){return A?w.createElement(T):{}}},11452:v=>{var C=TypeError,h=9007199254740991;v.exports=function(m){if(m>h)throw C("Maximum allowed index exceeded");return m}},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,h)=>{var m=h(62447),b=h(90740),w=m.process,A=m.Deno,T=w&&w.versions||A&&A.version,I=T&&T.v8,R,N;I&&(R=I.split("."),N=R[0]>0&&R[0]<4?1:+(R[0]+R[1])),!N&&b&&(R=b.match(/Edge\/(\d+)/),(!R||R[1]>=74)&&(R=b.match(/Chrome\/(\d+)/),R&&(N=+R[1]))),v.exports=N},70291:(v,C,h)=>{var m=h(59921);v.exports=function(b){return m[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,h)=>{"use strict";var m=h(62447),b=h(82768),w=h(57953),A=h(43152),T=h(80016).f,I=h(51585),R=h(59921),N=h(7416),V=h(20410),G=h(18768),X=function(ee){var Z=function(_,re,oe){if(this instanceof Z){switch(arguments.length){case 0:return new ee;case 1:return new ee(_);case 2:return new ee(_,re)}return new ee(_,re,oe)}return b(ee,this,arguments)};return Z.prototype=ee.prototype,Z};v.exports=function(ee,Z){var _=ee.target,re=ee.global,oe=ee.stat,B=ee.proto,te=re?m:oe?m[_]:(m[_]||{}).prototype,K=re?R:R[_]||V(R,_,{})[_],ne=K.prototype,ie,ae,he,H,J,ue,ve,be,we;for(H in Z)ie=I(re?H:_+(oe?".":"#")+H,ee.forced),ae=!ie&&te&&G(te,H),ue=K[H],ae&&(ee.dontCallGetSet?(we=T(te,H),ve=we&&we.value):ve=te[H]),J=ae&&ve?ve:Z[H],!(ae&&typeof ue==typeof J)&&(ee.bind&&ae?be=N(J,m):ee.wrap&&ae?be=X(J):B&&A(J)?be=w(J):be=J,(ee.sham||J&&J.sham||ue&&ue.sham)&&V(be,"sham",!0),V(K,H,be),B&&(he=_+"Prototype",G(R,he)||V(R,he,{}),V(R[he],H,J),ee.real&&ne&&(ie||!ne[H])&&V(ne,H,J)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,h)=>{var m=h(97966),b=Function.prototype,w=b.apply,A=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(m?A.bind(w):function(){return A.apply(w,arguments)})},7416:(v,C,h)=>{var m=h(57953),b=h(81970),w=h(97966),A=m(m.bind);v.exports=function(T,I){return b(T),I===void 0?T:w?A(T,I):function(){return T.apply(I,arguments)}}},97966:(v,C,h)=>{var m=h(31982);v.exports=!m(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,h)=>{var m=h(97966),b=Function.prototype.call;v.exports=m?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,h)=>{var m=h(56049),b=h(18768),w=Function.prototype,A=m&&Object.getOwnPropertyDescriptor,T=b(w,"name"),I=T&&function(){}.name==="something",R=T&&(!m||m&&A(w,"name").configurable);v.exports={EXISTS:T,PROPER:I,CONFIGURABLE:R}},54518:(v,C,h)=>{var m=h(90406),b=h(81970);v.exports=function(w,A,T){try{return m(b(Object.getOwnPropertyDescriptor(w,A)[T]))}catch{}}},57953:(v,C,h)=>{var m=h(58310),b=h(90406);v.exports=function(w){if(m(w)==="Function")return b(w)}},90406:(v,C,h)=>{var m=h(97966),b=Function.prototype,w=b.call,A=m&&b.bind.bind(w,w);v.exports=m?A:function(T){return function(){return w.apply(T,arguments)}}},97080:(v,C,h)=>{var m=h(59921),b=h(62447),w=h(43152),A=function(T){return w(T)?T:void 0};v.exports=function(T,I){return arguments.length<2?A(m[T])||A(b[T]):m[T]&&m[T][I]||b[T]&&b[T][I]}},82850:(v,C,h)=>{var m=h(90406),b=h(93053),w=h(43152),A=h(58310),T=h(46025),I=m([].push);v.exports=function(R){if(w(R))return R;if(b(R)){for(var N=R.length,V=[],G=0;G<N;G++){var X=R[G];typeof X=="string"?I(V,X):(typeof X=="number"||A(X)=="Number"||A(X)=="String")&&I(V,T(X))}var ee=V.length,Z=!0;return function(_,re){if(Z)return Z=!1,re;if(b(this))return re;for(var oe=0;oe<ee;oe++)if(V[oe]===_)return re}}}},27529:(v,C,h)=>{var m=h(81970),b=h(71365);v.exports=function(w,A){var T=w[A];return b(T)?void 0:m(T)}},62447:(v,C,h)=>{var m=function(b){return b&&b.Math==Math&&b};v.exports=m(typeof globalThis=="object"&&globalThis)||m(typeof window=="object"&&window)||m(typeof self=="object"&&self)||m(typeof h.g=="object"&&h.g)||function(){return this}()||Function("return this")()},18768:(v,C,h)=>{var m=h(90406),b=h(53254),w=m({}.hasOwnProperty);v.exports=Object.hasOwn||function(T,I){return w(b(T),I)}},13477:v=>{v.exports={}},19552:(v,C,h)=>{var m=h(97080);v.exports=m("document","documentElement")},11314:(v,C,h)=>{var m=h(56049),b=h(31982),w=h(45511);v.exports=!m&&!b(function(){return Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,h)=>{var m=h(90406),b=h(31982),w=h(58310),A=Object,T=m("".split);v.exports=b(function(){return!A("z").propertyIsEnumerable(0)})?function(I){return w(I)=="String"?T(I,""):A(I)}:A},41524:(v,C,h)=>{var m=h(90406),b=h(43152),w=h(70716),A=m(Function.toString);b(w.inspectSource)||(w.inspectSource=function(T){return A(T)}),v.exports=w.inspectSource},44083:(v,C,h)=>{var m=h(57761),b=h(62447),w=h(92548),A=h(20410),T=h(18768),I=h(70716),R=h(4580),N=h(13477),V="Object already initialized",G=b.TypeError,X=b.WeakMap,ee,Z,_,re=function(K){return _(K)?Z(K):ee(K,{})},oe=function(K){return function(ne){var ie;if(!w(ne)||(ie=Z(ne)).type!==K)throw G("Incompatible receiver, "+K+" required");return ie}};if(m||I.state){var B=I.state||(I.state=new X);B.get=B.get,B.has=B.has,B.set=B.set,ee=function(K,ne){if(B.has(K))throw G(V);return ne.facade=K,B.set(K,ne),ne},Z=function(K){return B.get(K)||{}},_=function(K){return B.has(K)}}else{var te=R("state");N[te]=!0,ee=function(K,ne){if(T(K,te))throw G(V);return ne.facade=K,A(K,te,ne),ne},Z=function(K){return T(K,te)?K[te]:{}},_=function(K){return T(K,te)}}v.exports={set:ee,get:Z,has:_,enforce:re,getterFor:oe}},93053:(v,C,h)=>{var m=h(58310);v.exports=Array.isArray||function(w){return m(w)=="Array"}},43152:(v,C,h)=>{var m=h(51647),b=m.all;v.exports=m.IS_HTMLDDA?function(w){return typeof w=="function"||w===b}:function(w){return typeof w=="function"}},43455:(v,C,h)=>{var m=h(90406),b=h(31982),w=h(43152),A=h(82059),T=h(97080),I=h(41524),R=function(){},N=[],V=T("Reflect","construct"),G=/^\s*(?:class|function)\b/,X=m(G.exec),ee=!G.exec(R),Z=function(oe){if(!w(oe))return!1;try{return V(R,N,oe),!0}catch{return!1}},_=function(oe){if(!w(oe))return!1;switch(A(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ee||!!X(G,I(oe))}catch{return!0}};_.sham=!0,v.exports=!V||b(function(){var re;return Z(Z.call)||!Z(Object)||!Z(function(){re=!0})||re})?_:Z},51585:(v,C,h)=>{var m=h(31982),b=h(43152),w=/#|\.prototype\./,A=function(V,G){var X=I[T(V)];return X==N?!0:X==R?!1:b(G)?m(G):!!G},T=A.normalize=function(V){return String(V).replace(w,".").toLowerCase()},I=A.data={},R=A.NATIVE="N",N=A.POLYFILL="P";v.exports=A},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,h)=>{var m=h(43152),b=h(51647),w=b.all;v.exports=b.IS_HTMLDDA?function(A){return typeof A=="object"?A!==null:m(A)||A===w}:function(A){return typeof A=="object"?A!==null:m(A)}},39839:v=>{v.exports=!0},28609:(v,C,h)=>{var m=h(97080),b=h(43152),w=h(15166),A=h(27237),T=Object;v.exports=A?function(I){return typeof I=="symbol"}:function(I){var R=m("Symbol");return b(R)&&w(R.prototype,T(I))}},41709:(v,C,h)=>{"use strict";var m=h(98488).IteratorPrototype,b=h(73270),w=h(54686),A=h(98889),T=h(94609),I=function(){return this};v.exports=function(R,N,V,G){var X=N+" Iterator";return R.prototype=b(m,{next:w(+!G,V)}),A(R,X,!1,!0),T[X]=I,R}},78107:(v,C,h)=>{"use strict";var m=h(30080),b=h(12461),w=h(39839),A=h(58100),T=h(43152),I=h(41709),R=h(90851),N=h(70738),V=h(98889),G=h(20410),X=h(27519),ee=h(33538),Z=h(94609),_=h(98488),re=A.PROPER,oe=A.CONFIGURABLE,B=_.IteratorPrototype,te=_.BUGGY_SAFARI_ITERATORS,K=ee("iterator"),ne="keys",ie="values",ae="entries",he=function(){return this};v.exports=function(H,J,ue,ve,be,we,ze){I(ue,J,ve);var We=function(Nt){if(Nt===be&&Mt)return Mt;if(!te&&Nt in dt)return dt[Nt];switch(Nt){case ne:return function(){return new ue(this,Nt)};case ie:return function(){return new ue(this,Nt)};case ae:return function(){return new ue(this,Nt)}}return function(){return new ue(this)}},Je=J+" Iterator",Ve=!1,dt=H.prototype,Wt=dt[K]||dt["@@iterator"]||be&&dt[be],Mt=!te&&Wt||We(be),lr=J=="Array"&&dt.entries||Wt,qe,Dt,Tt;if(lr&&(qe=R(lr.call(new H)),qe!==Object.prototype&&qe.next&&(!w&&R(qe)!==B&&(N?N(qe,B):T(qe[K])||X(qe,K,he)),V(qe,Je,!0,!0),w&&(Z[Je]=he))),re&&be==ie&&Wt&&Wt.name!==ie&&(!w&&oe?G(dt,"name",ie):(Ve=!0,Mt=function(){return b(Wt,this)})),be)if(Dt={values:We(ie),keys:we?Mt:We(ne),entries:We(ae)},ze)for(Tt in Dt)(te||Ve||!(Tt in dt))&&X(dt,Tt,Dt[Tt]);else m({target:J,proto:!0,forced:te||Ve},Dt);return(!w||ze)&&dt[K]!==Mt&&X(dt,K,Mt,{name:be}),Z[J]=Mt,Dt}},98488:(v,C,h)=>{"use strict";var m=h(31982),b=h(43152),w=h(92548),A=h(73270),T=h(90851),I=h(27519),R=h(33538),N=h(39839),V=R("iterator"),G=!1,X,ee,Z;[].keys&&(Z=[].keys(),"next"in Z?(ee=T(T(Z)),ee!==Object.prototype&&(X=ee)):G=!0);var _=!w(X)||m(function(){var re={};return X[V].call(re)!==re});_?X={}:N&&(X=A(X)),b(X[V])||I(X,V,function(){return this}),v.exports={IteratorPrototype:X,BUGGY_SAFARI_ITERATORS:G}},94609:v=>{v.exports={}},53387:(v,C,h)=>{var m=h(62567);v.exports=function(b){return m(b.length)}},99295:v=>{var C=Math.ceil,h=Math.floor;v.exports=Math.trunc||function(b){var w=+b;return(w>0?h:C)(w)}},73270:(v,C,h)=>{var m=h(35970),b=h(98911),w=h(11792),A=h(13477),T=h(19552),I=h(45511),R=h(4580),N=">",V="<",G="prototype",X="script",ee=R("IE_PROTO"),Z=function(){},_=function(K){return V+X+N+K+V+"/"+X+N},re=function(K){K.write(_("")),K.close();var ne=K.parentWindow.Object;return K=null,ne},oe=function(){var K=I("iframe"),ne="java"+X+":",ie;return K.style.display="none",T.appendChild(K),K.src=String(ne),ie=K.contentWindow.document,ie.open(),ie.write(_("document.F=Object")),ie.close(),ie.F},B,te=function(){try{B=new ActiveXObject("htmlfile")}catch{}te=typeof document<"u"?document.domain&&B?re(B):oe():re(B);for(var K=w.length;K--;)delete te[G][w[K]];return te()};A[ee]=!0,v.exports=Object.create||function(ne,ie){var ae;return ne!==null?(Z[G]=m(ne),ae=new Z,Z[G]=null,ae[ee]=ne):ae=te(),ie===void 0?ae:b.f(ae,ie)}},98911:(v,C,h)=>{var m=h(56049),b=h(98715),w=h(36133),A=h(35970),T=h(88966),I=h(16619);C.f=m&&!b?Object.defineProperties:function(N,V){A(N);for(var G=T(V),X=I(V),ee=X.length,Z=0,_;ee>Z;)w.f(N,_=X[Z++],G[_]);return N}},36133:(v,C,h)=>{var m=h(56049),b=h(11314),w=h(98715),A=h(35970),T=h(5135),I=TypeError,R=Object.defineProperty,N=Object.getOwnPropertyDescriptor,V="enumerable",G="configurable",X="writable";C.f=m?w?function(Z,_,re){if(A(Z),_=T(_),A(re),typeof Z=="function"&&_==="prototype"&&"value"in re&&X in re&&!re[X]){var oe=N(Z,_);oe&&oe[X]&&(Z[_]=re.value,re={configurable:G in re?re[G]:oe[G],enumerable:V in re?re[V]:oe[V],writable:!1})}return R(Z,_,re)}:R:function(Z,_,re){if(A(Z),_=T(_),A(re),b)try{return R(Z,_,re)}catch{}if("get"in re||"set"in re)throw I("Accessors not supported");return"value"in re&&(Z[_]=re.value),Z}},80016:(v,C,h)=>{var m=h(56049),b=h(12461),w=h(16457),A=h(54686),T=h(88966),I=h(5135),R=h(18768),N=h(11314),V=Object.getOwnPropertyDescriptor;C.f=m?V:function(X,ee){if(X=T(X),ee=I(ee),N)try{return V(X,ee)}catch{}if(R(X,ee))return A(!b(w.f,X,ee),X[ee])}},53515:(v,C,h)=>{var m=h(58310),b=h(88966),w=h(51203).f,A=h(67932),T=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],I=function(R){try{return w(R)}catch{return A(T)}};v.exports.f=function(N){return T&&m(N)=="Window"?I(N):w(b(N))}},51203:(v,C,h)=>{var m=h(4541),b=h(11792),w=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(T){return m(T,w)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,h)=>{var m=h(18768),b=h(43152),w=h(53254),A=h(4580),T=h(74838),I=A("IE_PROTO"),R=Object,N=R.prototype;v.exports=T?R.getPrototypeOf:function(V){var G=w(V);if(m(G,I))return G[I];var X=G.constructor;return b(X)&&G instanceof X?X.prototype:G instanceof R?N:null}},15166:(v,C,h)=>{var m=h(90406);v.exports=m({}.isPrototypeOf)},4541:(v,C,h)=>{var m=h(90406),b=h(18768),w=h(88966),A=h(66322).indexOf,T=h(13477),I=m([].push);v.exports=function(R,N){var V=w(R),G=0,X=[],ee;for(ee in V)!b(T,ee)&&b(V,ee)&&I(X,ee);for(;N.length>G;)b(V,ee=N[G++])&&(~A(X,ee)||I(X,ee));return X}},16619:(v,C,h)=>{var m=h(4541),b=h(11792);v.exports=Object.keys||function(A){return m(A,b)}},16457:(v,C)=>{"use strict";var h={}.propertyIsEnumerable,m=Object.getOwnPropertyDescriptor,b=m&&!h.call({1:2},1);C.f=b?function(A){var T=m(this,A);return!!T&&T.enumerable}:h},70738:(v,C,h)=>{var m=h(54518),b=h(35970),w=h(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var A=!1,T={},I;try{I=m(Object.prototype,"__proto__","set"),I(T,[]),A=T instanceof Array}catch{}return function(N,V){return b(N),w(V),A?I(N,V):N.__proto__=V,N}}():void 0)},68399:(v,C,h)=>{"use strict";var m=h(48448),b=h(82059);v.exports=m?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,h)=>{var m=h(12461),b=h(43152),w=h(92548),A=TypeError;v.exports=function(T,I){var R,N;if(I==="string"&&b(R=T.toString)&&!w(N=m(R,T))||b(R=T.valueOf)&&!w(N=m(R,T))||I!=="string"&&b(R=T.toString)&&!w(N=m(R,T)))return N;throw A("Can't convert object to primitive value")}},47813:(v,C,h)=>{var m=h(97080),b=h(90406),w=h(51203),A=h(97620),T=h(35970),I=b([].concat);v.exports=m("Reflect","ownKeys")||function(N){var V=w.f(T(N)),G=A.f;return G?I(V,G(N)):V}},59921:v=>{v.exports={}},31251:(v,C,h)=>{var m=h(71365),b=TypeError;v.exports=function(w){if(m(w))throw b("Can't call method on "+w);return w}},98889:(v,C,h)=>{var m=h(48448),b=h(36133).f,w=h(20410),A=h(18768),T=h(68399),I=h(33538),R=I("toStringTag");v.exports=function(N,V,G,X){if(N){var ee=G?N:N.prototype;A(ee,R)||b(ee,R,{configurable:!0,value:V}),X&&!m&&w(ee,"toString",T)}}},4580:(v,C,h)=>{var m=h(95976),b=h(91248),w=m("keys");v.exports=function(A){return w[A]||(w[A]=b(A))}},70716:(v,C,h)=>{var m=h(62447),b=h(9267),w="__core-js_shared__",A=m[w]||b(w,{});v.exports=A},95976:(v,C,h)=>{var m=h(39839),b=h(70716);(v.exports=function(w,A){return b[w]||(b[w]=A!==void 0?A:{})})("versions",[]).push({version:"3.29.1",mode:m?"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,h)=>{var m=h(90406),b=h(32041),w=h(46025),A=h(31251),T=m("".charAt),I=m("".charCodeAt),R=m("".slice),N=function(V){return function(G,X){var ee=w(A(G)),Z=b(X),_=ee.length,re,oe;return Z<0||Z>=_?V?"":void 0:(re=I(ee,Z),re<55296||re>56319||Z+1===_||(oe=I(ee,Z+1))<56320||oe>57343?V?T(ee,Z):re:V?R(ee,Z,Z+2):(re-55296<<10)+(oe-56320)+65536)}};v.exports={codeAt:N(!1),charAt:N(!0)}},71775:(v,C,h)=>{var m=h(32438),b=h(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var w=Symbol();return!String(w)||!(Object(w)instanceof Symbol)||!Symbol.sham&&m&&m<41})},95679:(v,C,h)=>{var m=h(12461),b=h(97080),w=h(33538),A=h(27519);v.exports=function(){var T=b("Symbol"),I=T&&T.prototype,R=I&&I.valueOf,N=w("toPrimitive");I&&!I[N]&&A(I,N,function(V){return m(R,this)},{arity:1})}},82294:(v,C,h)=>{var m=h(71775);v.exports=m&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,h)=>{var m=h(32041),b=Math.max,w=Math.min;v.exports=function(A,T){var I=m(A);return I<0?b(I+T,0):w(I,T)}},88966:(v,C,h)=>{var m=h(38622),b=h(31251);v.exports=function(w){return m(b(w))}},32041:(v,C,h)=>{var m=h(99295);v.exports=function(b){var w=+b;return w!==w||w===0?0:m(w)}},62567:(v,C,h)=>{var m=h(32041),b=Math.min;v.exports=function(w){return w>0?b(m(w),9007199254740991):0}},53254:(v,C,h)=>{var m=h(31251),b=Object;v.exports=function(w){return b(m(w))}},37505:(v,C,h)=>{var m=h(12461),b=h(92548),w=h(28609),A=h(27529),T=h(96380),I=h(33538),R=TypeError,N=I("toPrimitive");v.exports=function(V,G){if(!b(V)||w(V))return V;var X=A(V,N),ee;if(X){if(G===void 0&&(G="default"),ee=m(X,V,G),!b(ee)||w(ee))return ee;throw R("Can't convert object to primitive value")}return G===void 0&&(G="number"),T(V,G)}},5135:(v,C,h)=>{var m=h(37505),b=h(28609);v.exports=function(w){var A=m(w,"string");return b(A)?A:A+""}},48448:(v,C,h)=>{var m=h(33538),b=m("toStringTag"),w={};w[b]="z",v.exports=String(w)==="[object z]"},46025:(v,C,h)=>{var m=h(82059),b=String;v.exports=function(w){if(m(w)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(w)}},18342:v=>{var C=String;v.exports=function(h){try{return C(h)}catch{return"Object"}}},91248:(v,C,h)=>{var m=h(90406),b=0,w=Math.random(),A=m(1 .toString);v.exports=function(T){return"Symbol("+(T===void 0?"":T)+")_"+A(++b+w,36)}},27237:(v,C,h)=>{var m=h(71775);v.exports=m&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,h)=>{var m=h(56049),b=h(31982);v.exports=m&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,h)=>{var m=h(62447),b=h(43152),w=m.WeakMap;v.exports=b(w)&&/native code/.test(String(w))},64832:(v,C,h)=>{var m=h(59921),b=h(18768),w=h(39378),A=h(36133).f;v.exports=function(T){var I=m.Symbol||(m.Symbol={});b(I,T)||A(I,T,{value:w.f(T)})}},39378:(v,C,h)=>{var m=h(33538);C.f=m},33538:(v,C,h)=>{var m=h(62447),b=h(95976),w=h(18768),A=h(91248),T=h(71775),I=h(27237),R=m.Symbol,N=b("wks"),V=I?R.for||R:R&&R.withoutSetter||A;v.exports=function(G){return w(N,G)||(N[G]=T&&w(R,G)?R[G]:V("Symbol."+G)),N[G]}},29126:(v,C,h)=>{"use strict";var m=h(30080),b=h(31982),w=h(93053),A=h(92548),T=h(53254),I=h(53387),R=h(11452),N=h(53437),V=h(69573),G=h(36844),X=h(33538),ee=h(32438),Z=X("isConcatSpreadable"),_=ee>=51||!b(function(){var B=[];return B[Z]=!1,B.concat()[0]!==B}),re=function(B){if(!A(B))return!1;var te=B[Z];return te!==void 0?!!te:w(B)},oe=!_||!G("concat");m({target:"Array",proto:!0,arity:1,forced:oe},{concat:function(te){var K=T(this),ne=V(K,0),ie=0,ae,he,H,J,ue;for(ae=-1,H=arguments.length;ae<H;ae++)if(ue=ae===-1?K:arguments[ae],re(ue))for(J=I(ue),R(ie+J),he=0;he<J;he++,ie++)he in ue&&N(ne,ie,ue[he]);else R(ie+1),N(ne,ie++,ue);return ne.length=ie,ne}})},17802:(v,C,h)=>{"use strict";var m=h(30080),b=h(93935).filter,w=h(36844),A=w("filter");m({target:"Array",proto:!0,forced:!A},{filter:function(I){return b(this,I,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,h)=>{"use strict";var m=h(30080),b=h(24782);m({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,h)=>{"use strict";var m=h(30080),b=h(57953),w=h(66322).indexOf,A=h(10454),T=b([].indexOf),I=!!T&&1/T([1],1,-0)<0,R=I||!A("indexOf");m({target:"Array",proto:!0,forced:R},{indexOf:function(V){var G=arguments.length>1?arguments[1]:void 0;return I?T(this,V,G)||0:w(this,V,G)}})},44390:(v,C,h)=>{"use strict";var m=h(88966),b=h(20844),w=h(94609),A=h(44083),T=h(36133).f,I=h(78107),R=h(10248),N=h(39839),V=h(56049),G="Array Iterator",X=A.set,ee=A.getterFor(G);v.exports=I(Array,"Array",function(_,re){X(this,{type:G,target:m(_),index:0,kind:re})},function(){var _=ee(this),re=_.target,oe=_.kind,B=_.index++;return!re||B>=re.length?(_.target=void 0,R(void 0,!0)):oe=="keys"?R(B,!1):oe=="values"?R(re[B],!1):R([B,re[B]],!1)},"values");var Z=w.Arguments=w.Array;if(b("keys"),b("values"),b("entries"),!N&&V&&Z.name!=="values")try{T(Z,"name",{value:"values"})}catch{}},91667:()=>{},39306:(v,C,h)=>{var m=h(30080),b=h(97080),w=h(82768),A=h(12461),T=h(90406),I=h(31982),R=h(43152),N=h(28609),V=h(53160),G=h(82850),X=h(71775),ee=String,Z=b("JSON","stringify"),_=T(/./.exec),re=T("".charAt),oe=T("".charCodeAt),B=T("".replace),te=T(1 .toString),K=/[\uD800-\uDFFF]/g,ne=/^[\uD800-\uDBFF]$/,ie=/^[\uDC00-\uDFFF]$/,ae=!X||I(function(){var ue=b("Symbol")();return Z([ue])!="[null]"||Z({a:ue})!="{}"||Z(Object(ue))!="{}"}),he=I(function(){return Z("\uDF06\uD834")!=='"\\udf06\\ud834"'||Z("\uDEAD")!=='"\\udead"'}),H=function(ue,ve){var be=V(arguments),we=G(ve);if(!(!R(we)&&(ue===void 0||N(ue))))return be[1]=function(ze,We){if(R(we)&&(We=A(we,this,ee(ze),We)),!N(We))return We},w(Z,null,be)},J=function(ue,ve,be){var we=re(be,ve-1),ze=re(be,ve+1);return _(ne,ue)&&!_(ie,ze)||_(ie,ue)&&!_(ne,we)?"\\u"+te(oe(ue,0),16):ue};Z&&m({target:"JSON",stat:!0,arity:3,forced:ae||he},{stringify:function(ve,be,we){var ze=V(arguments),We=w(ae?H:Z,null,ze);return he&&typeof We=="string"?B(We,K,J):We}})},23870:(v,C,h)=>{var m=h(62447),b=h(98889);b(m.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,h)=>{var m=h(30080),b=h(56049),w=h(98911).f;m({target:"Object",stat:!0,forced:Object.defineProperties!==w,sham:!b},{defineProperties:w})},70829:(v,C,h)=>{var m=h(30080),b=h(56049),w=h(36133).f;m({target:"Object",stat:!0,forced:Object.defineProperty!==w,sham:!b},{defineProperty:w})},51964:(v,C,h)=>{var m=h(30080),b=h(31982),w=h(88966),A=h(80016).f,T=h(56049),I=!T||b(function(){A(1)});m({target:"Object",stat:!0,forced:I,sham:!T},{getOwnPropertyDescriptor:function(N,V){return A(w(N),V)}})},723:(v,C,h)=>{var m=h(30080),b=h(56049),w=h(47813),A=h(88966),T=h(80016),I=h(53437);m({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(N){for(var V=A(N),G=T.f,X=w(V),ee={},Z=0,_,re;X.length>Z;)re=G(V,_=X[Z++]),re!==void 0&&I(ee,_,re);return ee}})},86884:(v,C,h)=>{var m=h(30080),b=h(71775),w=h(31982),A=h(97620),T=h(53254),I=!b||w(function(){A.f(1)});m({target:"Object",stat:!0,forced:I},{getOwnPropertySymbols:function(N){var V=A.f;return V?V(T(N)):[]}})},38339:(v,C,h)=>{var m=h(30080),b=h(53254),w=h(16619),A=h(31982),T=A(function(){w(1)});m({target:"Object",stat:!0,forced:T},{keys:function(R){return w(b(R))}})},97829:()=>{},5708:()=>{},27626:(v,C,h)=>{"use strict";var m=h(18143).charAt,b=h(46025),w=h(44083),A=h(78107),T=h(10248),I="String Iterator",R=w.set,N=w.getterFor(I);A(String,"String",function(V){R(this,{type:I,string:b(V),index:0})},function(){var G=N(this),X=G.string,ee=G.index,Z;return ee>=X.length?T(void 0,!0):(Z=m(X,ee),G.index+=Z.length,T(Z,!1))})},95353:(v,C,h)=>{var m=h(64832);m("asyncIterator")},16212:(v,C,h)=>{"use strict";var m=h(30080),b=h(62447),w=h(12461),A=h(90406),T=h(39839),I=h(56049),R=h(71775),N=h(31982),V=h(18768),G=h(15166),X=h(35970),ee=h(88966),Z=h(5135),_=h(46025),re=h(54686),oe=h(73270),B=h(16619),te=h(51203),K=h(53515),ne=h(97620),ie=h(80016),ae=h(36133),he=h(98911),H=h(16457),J=h(27519),ue=h(37912),ve=h(95976),be=h(4580),we=h(13477),ze=h(91248),We=h(33538),Je=h(39378),Ve=h(64832),dt=h(95679),Wt=h(98889),Mt=h(44083),lr=h(93935).forEach,qe=be("hidden"),Dt="Symbol",Tt="prototype",Nt=Mt.set,br=Mt.getterFor(Dt),Ne=Object[Tt],Et=b.Symbol,Jt=Et&&Et[Tt],xt=b.TypeError,Fr=b.QObject,xr=ie.f,Xr=ae.f,Xi=K.f,jr=H.f,wr=A([].push),Sr=ve("symbols"),nn=ve("op-symbols"),wt=ve("wks"),Gn=!Fr||!Fr[Tt]||!Fr[Tt].findChild,Ci=I&&N(function(){return oe(Xr({},"a",{get:function(){return Xr(this,"a",{value:7}).a}})).a!=7})?function(et,Ee,Be){var Ie=xr(Ne,Ee);Ie&&delete Ne[Ee],Xr(et,Ee,Be),Ie&&et!==Ne&&Xr(Ne,Ee,Ie)}:Xr,Dn=function(et,Ee){var Be=Sr[et]=oe(Jt);return Nt(Be,{type:Dt,tag:et,description:Ee}),I||(Be.description=Ee),Be},Nn=function(Ee,Be,Ie){Ee===Ne&&Nn(nn,Be,Ie),X(Ee);var z=Z(Be);return X(Ie),V(Sr,z)?(Ie.enumerable?(V(Ee,qe)&&Ee[qe][z]&&(Ee[qe][z]=!1),Ie=oe(Ie,{enumerable:re(0,!1)})):(V(Ee,qe)||Xr(Ee,qe,re(1,{})),Ee[qe][z]=!0),Ci(Ee,z,Ie)):Xr(Ee,z,Ie)},Kn=function(Ee,Be){X(Ee);var Ie=ee(Be),z=B(Ie).concat(Ti(Ie));return lr(z,function(q){(!I||w(Yn,Ie,q))&&Nn(Ee,q,Ie[q])}),Ee},Oi=function(Ee,Be){return Be===void 0?oe(Ee):Kn(oe(Ee),Be)},Yn=function(Ee){var Be=Z(Ee),Ie=w(jr,this,Be);return this===Ne&&V(Sr,Be)&&!V(nn,Be)?!1:Ie||!V(this,Be)||!V(Sr,Be)||V(this,qe)&&this[qe][Be]?Ie:!0},Qr=function(Ee,Be){var Ie=ee(Ee),z=Z(Be);if(!(Ie===Ne&&V(Sr,z)&&!V(nn,z))){var q=xr(Ie,z);return q&&V(Sr,z)&&!(V(Ie,qe)&&Ie[qe][z])&&(q.enumerable=!0),q}},_n=function(Ee){var Be=Xi(ee(Ee)),Ie=[];return lr(Be,function(z){!V(Sr,z)&&!V(we,z)&&wr(Ie,z)}),Ie},Ti=function(et){var Ee=et===Ne,Be=Xi(Ee?nn:ee(et)),Ie=[];return lr(Be,function(z){V(Sr,z)&&(!Ee||V(Ne,z))&&wr(Ie,Sr[z])}),Ie};R||(Et=function(){if(G(Jt,this))throw xt("Symbol is not a constructor");var Ee=!arguments.length||arguments[0]===void 0?void 0:_(arguments[0]),Be=ze(Ee),Ie=function(z){this===Ne&&w(Ie,nn,z),V(this,qe)&&V(this[qe],Be)&&(this[qe][Be]=!1),Ci(this,Be,re(1,z))};return I&&Gn&&Ci(Ne,Be,{configurable:!0,set:Ie}),Dn(Be,Ee)},Jt=Et[Tt],J(Jt,"toString",function(){return br(this).tag}),J(Et,"withoutSetter",function(et){return Dn(ze(et),et)}),H.f=Yn,ae.f=Nn,he.f=Kn,ie.f=Qr,te.f=K.f=_n,ne.f=Ti,Je.f=function(et){return Dn(We(et),et)},I&&(ue(Jt,"description",{configurable:!0,get:function(){return br(this).description}}),T||J(Ne,"propertyIsEnumerable",Yn,{unsafe:!0}))),m({global:!0,constructor:!0,wrap:!0,forced:!R,sham:!R},{Symbol:Et}),lr(B(wt),function(et){Ve(et)}),m({target:Dt,stat:!0,forced:!R},{useSetter:function(){Gn=!0},useSimple:function(){Gn=!1}}),m({target:"Object",stat:!0,forced:!R,sham:!I},{create:Oi,defineProperty:Nn,defineProperties:Kn,getOwnPropertyDescriptor:Qr}),m({target:"Object",stat:!0,forced:!R},{getOwnPropertyNames:_n}),dt(),Wt(Et,Dt),we[qe]=!0},63906:()=>{},3598:(v,C,h)=>{var m=h(30080),b=h(97080),w=h(18768),A=h(46025),T=h(95976),I=h(82294),R=T("string-to-symbol-registry"),N=T("symbol-to-string-registry");m({target:"Symbol",stat:!0,forced:!I},{for:function(V){var G=A(V);if(w(R,G))return R[G];var X=b("Symbol")(G);return R[G]=X,N[X]=G,X}})},39542:(v,C,h)=>{var m=h(64832);m("hasInstance")},47882:(v,C,h)=>{var m=h(64832);m("isConcatSpreadable")},84911:(v,C,h)=>{var m=h(64832);m("iterator")},68030:(v,C,h)=>{h(16212),h(3598),h(50338),h(39306),h(86884)},50338:(v,C,h)=>{var m=h(30080),b=h(18768),w=h(28609),A=h(18342),T=h(95976),I=h(82294),R=T("symbol-to-string-registry");m({target:"Symbol",stat:!0,forced:!I},{keyFor:function(V){if(!w(V))throw TypeError(A(V)+" is not a symbol");if(b(R,V))return R[V]}})},47954:(v,C,h)=>{var m=h(64832);m("matchAll")},88725:(v,C,h)=>{var m=h(64832);m("match")},67703:(v,C,h)=>{var m=h(64832);m("replace")},2220:(v,C,h)=>{var m=h(64832);m("search")},48990:(v,C,h)=>{var m=h(64832);m("species")},50240:(v,C,h)=>{var m=h(64832);m("split")},99921:(v,C,h)=>{var m=h(64832),b=h(95679);m("toPrimitive"),b()},3502:(v,C,h)=>{var m=h(97080),b=h(64832),w=h(98889);b("toStringTag"),w(m("Symbol"),"Symbol")},80220:(v,C,h)=>{var m=h(64832);m("unscopables")},45987:(v,C,h)=>{var m=h(64832);m("asyncDispose")},42319:(v,C,h)=>{var m=h(64832);m("dispose")},58052:(v,C,h)=>{var m=h(30080),b=h(97080),w=h(90406),A=b("Symbol"),T=A.keyFor,I=w(A.prototype.valueOf);m({target:"Symbol",stat:!0},{isRegistered:function(N){try{return T(I(N))!==void 0}catch{return!1}}})},90181:(v,C,h)=>{for(var m=h(30080),b=h(95976),w=h(97080),A=h(90406),T=h(28609),I=h(33538),R=w("Symbol"),N=R.isWellKnown,V=w("Object","getOwnPropertyNames"),G=A(R.prototype.valueOf),X=b("wks"),ee=0,Z=V(R),_=Z.length;ee<_;ee++)try{var re=Z[ee];T(R[re])&&I(re)}catch{}m({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(B){if(N&&N(B))return!0;try{for(var te=G(B),K=0,ne=V(X),ie=ne.length;K<ie;K++)if(X[ne[K]]==te)return!0}catch{}return!1}})},25129:(v,C,h)=>{var m=h(64832);m("matcher")},90397:(v,C,h)=>{var m=h(64832);m("metadataKey")},82793:(v,C,h)=>{var m=h(64832);m("metadata")},18097:(v,C,h)=>{var m=h(64832);m("observable")},52100:(v,C,h)=>{var m=h(64832);m("patternMatch")},99742:(v,C,h)=>{var m=h(64832);m("replaceAll")},48713:(v,C,h)=>{h(44390);var m=h(81595),b=h(62447),w=h(82059),A=h(20410),T=h(94609),I=h(33538),R=I("toStringTag");for(var N in m){var V=b[N],G=V&&V.prototype;G&&w(G)!==R&&A(G,R,N),T[N]=T.Array}},41544:(v,C,h)=>{var m=h(94537);v.exports=m},44928:(v,C,h)=>{var m=h(55794);v.exports=m},26087:(v,C,h)=>{h(48713);var m=h(82059),b=h(18768),w=h(15166),A=h(41544),T=Array.prototype,I={DOMTokenList:!0,NodeList:!0};v.exports=function(R){var N=R.forEach;return R===T||w(T,R)&&N===T.forEach||b(I,m(R))?A:N}},11783:(v,C,h)=>{var m=h(85838);v.exports=m},88462:(v,C,h)=>{var m=h(95617);v.exports=m},83531:(v,C,h)=>{var m=h(11906);v.exports=m},19941:(v,C,h)=>{var m=h(59123);v.exports=m},25081:(v,C,h)=>{var m=h(63332);v.exports=m},22145:(v,C,h)=>{var m=h(83606);v.exports=m},93690:(v,C,h)=>{var m=h(90660);v.exports=m},8429:(v,C,h)=>{var m=h(49198);h(48713),v.exports=m},13099:(v,C,h)=>{var m=h(15413);h(48713),v.exports=m},44931:(v,C,h)=>{var m=h(4793);v.exports=m},81933:function(){(function(v){var C=function(h){var m={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(H){return H&&DataView.prototype.isPrototypeOf(H)}if(m.arrayBuffer)var w=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(H){return H&&w.indexOf(Object.prototype.toString.call(H))>-1};function T(H){if(typeof H!="string"&&(H=String(H)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(H))throw new TypeError("Invalid character in header field name");return H.toLowerCase()}function I(H){return typeof H!="string"&&(H=String(H)),H}function R(H){var J={next:function(){var ue=H.shift();return{done:ue===void 0,value:ue}}};return m.iterable&&(J[Symbol.iterator]=function(){return J}),J}function N(H){this.map={},H instanceof N?H.forEach(function(J,ue){this.append(ue,J)},this):Array.isArray(H)?H.forEach(function(J){this.append(J[0],J[1])},this):H&&Object.getOwnPropertyNames(H).forEach(function(J){this.append(J,H[J])},this)}N.prototype.append=function(H,J){H=T(H),J=I(J);var ue=this.map[H];this.map[H]=ue?ue+", "+J:J},N.prototype.delete=function(H){delete this.map[T(H)]},N.prototype.get=function(H){return H=T(H),this.has(H)?this.map[H]:null},N.prototype.has=function(H){return this.map.hasOwnProperty(T(H))},N.prototype.set=function(H,J){this.map[T(H)]=I(J)},N.prototype.forEach=function(H,J){for(var ue in this.map)this.map.hasOwnProperty(ue)&&H.call(J,this.map[ue],ue,this)},N.prototype.keys=function(){var H=[];return this.forEach(function(J,ue){H.push(ue)}),R(H)},N.prototype.values=function(){var H=[];return this.forEach(function(J){H.push(J)}),R(H)},N.prototype.entries=function(){var H=[];return this.forEach(function(J,ue){H.push([ue,J])}),R(H)},m.iterable&&(N.prototype[Symbol.iterator]=N.prototype.entries);function V(H){if(H.bodyUsed)return Promise.reject(new TypeError("Already read"));H.bodyUsed=!0}function G(H){return new Promise(function(J,ue){H.onload=function(){J(H.result)},H.onerror=function(){ue(H.error)}})}function X(H){var J=new FileReader,ue=G(J);return J.readAsArrayBuffer(H),ue}function ee(H){var J=new FileReader,ue=G(J);return J.readAsText(H),ue}function Z(H){for(var J=new Uint8Array(H),ue=new Array(J.length),ve=0;ve<J.length;ve++)ue[ve]=String.fromCharCode(J[ve]);return ue.join("")}function _(H){if(H.slice)return H.slice(0);var J=new Uint8Array(H.byteLength);return J.set(new Uint8Array(H)),J.buffer}function re(){return this.bodyUsed=!1,this._initBody=function(H){this._bodyInit=H,H?typeof H=="string"?this._bodyText=H:m.blob&&Blob.prototype.isPrototypeOf(H)?this._bodyBlob=H:m.formData&&FormData.prototype.isPrototypeOf(H)?this._bodyFormData=H:m.searchParams&&URLSearchParams.prototype.isPrototypeOf(H)?this._bodyText=H.toString():m.arrayBuffer&&m.blob&&b(H)?(this._bodyArrayBuffer=_(H.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):m.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(H)||A(H))?this._bodyArrayBuffer=_(H):this._bodyText=H=Object.prototype.toString.call(H):this._bodyText="",this.headers.get("content-type")||(typeof H=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):m.searchParams&&URLSearchParams.prototype.isPrototypeOf(H)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m.blob&&(this.blob=function(){var H=V(this);if(H)return H;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?V(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(X)}),this.text=function(){var H=V(this);if(H)return H;if(this._bodyBlob)return ee(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)},m.formData&&(this.formData=function(){return this.text().then(K)}),this.json=function(){return this.text().then(JSON.parse)},this}var oe=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function B(H){var J=H.toUpperCase();return oe.indexOf(J)>-1?J:H}function te(H,J){J=J||{};var ue=J.body;if(H instanceof te){if(H.bodyUsed)throw new TypeError("Already read");this.url=H.url,this.credentials=H.credentials,J.headers||(this.headers=new N(H.headers)),this.method=H.method,this.mode=H.mode,this.signal=H.signal,!ue&&H._bodyInit!=null&&(ue=H._bodyInit,H.bodyUsed=!0)}else this.url=String(H);if(this.credentials=J.credentials||this.credentials||"same-origin",(J.headers||!this.headers)&&(this.headers=new N(J.headers)),this.method=B(J.method||this.method||"GET"),this.mode=J.mode||this.mode||null,this.signal=J.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&ue)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(ue)}te.prototype.clone=function(){return new te(this,{body:this._bodyInit})};function K(H){var J=new FormData;return H.trim().split("&").forEach(function(ue){if(ue){var ve=ue.split("="),be=ve.shift().replace(/\+/g," "),we=ve.join("=").replace(/\+/g," ");J.append(decodeURIComponent(be),decodeURIComponent(we))}}),J}function ne(H){var J=new N,ue=H.replace(/\r?\n[\t ]+/g," ");return ue.split(/\r?\n/).forEach(function(ve){var be=ve.split(":"),we=be.shift().trim();if(we){var ze=be.join(":").trim();J.append(we,ze)}}),J}re.call(te.prototype);function ie(H,J){J||(J={}),this.type="default",this.status=J.status===void 0?200:J.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in J?J.statusText:"OK",this.headers=new N(J.headers),this.url=J.url||"",this._initBody(H)}re.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new N(this.headers),url:this.url})},ie.error=function(){var H=new ie(null,{status:0,statusText:""});return H.type="error",H};var ae=[301,302,303,307,308];ie.redirect=function(H,J){if(ae.indexOf(J)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:J,headers:{location:H}})},h.DOMException=v.DOMException;try{new h.DOMException}catch{h.DOMException=function(J,ue){this.message=J,this.name=ue;var ve=Error(J);this.stack=ve.stack},h.DOMException.prototype=Object.create(Error.prototype),h.DOMException.prototype.constructor=h.DOMException}function he(H,J){return new Promise(function(ue,ve){var be=new te(H,J);if(be.signal&&be.signal.aborted)return ve(new h.DOMException("Aborted","AbortError"));var we=new XMLHttpRequest;function ze(){we.abort()}we.onload=function(){var We={status:we.status,statusText:we.statusText,headers:ne(we.getAllResponseHeaders()||"")};We.url="responseURL"in we?we.responseURL:We.headers.get("X-Request-URL");var Je="response"in we?we.response:we.responseText;ue(new ie(Je,We))},we.onerror=function(){ve(new TypeError("Network request failed"))},we.ontimeout=function(){ve(new TypeError("Network request failed"))},we.onabort=function(){ve(new h.DOMException("Aborted","AbortError"))},we.open(be.method,be.url,!0),be.credentials==="include"?we.withCredentials=!0:be.credentials==="omit"&&(we.withCredentials=!1),"responseType"in we&&m.blob&&(we.responseType="blob"),be.headers.forEach(function(We,Je){we.setRequestHeader(Je,We)}),be.signal&&(be.signal.addEventListener("abort",ze),we.onreadystatechange=function(){we.readyState===4&&be.signal.removeEventListener("abort",ze)}),we.send(typeof be._bodyInit>"u"?null:be._bodyInit)})}return he.polyfill=!0,v.fetch||(v.fetch=he,v.Headers=N,v.Request=te,v.Response=ie),h.Headers=N,h.Request=te,h.Response=ie,h.fetch=he,Object.defineProperty(h,"__esModule",{value:!0}),h}({})})(typeof self<"u"?self:this)},23653:(v,C,h)=>{"use strict";h.r(C),h.d(C,{Console:()=>J3});var m={};h.r(m),h.d(m,{cookie:()=>FS,header:()=>BS,path:()=>NS,query:()=>RS});var b=h(10954),w=h(70762),A=h(93652),T=h(11099),I=h(10017),R=h(86351),N=h(86751),V=h(12953),G=h(55839),X=h(23422);function ee(r){return ee=typeof G=="function"&&typeof X=="symbol"?function(e){return typeof e}:function(e){return e&&typeof G=="function"&&e.constructor===G&&e!==G.prototype?"symbol":typeof e},ee(r)}var Z=h(47319);function _(r,e){if(ee(r)!=="object"||r===null)return r;var t=r[Z];if(t!==void 0){var n=t.call(r,e||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function re(r){var e=_(r,"string");return ee(e)==="symbol"?e:String(e)}function oe(r,e,t){return e=re(e),e in r?V(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function B(r,e){var t=b(r);if(w){var n=w(r);e&&(n=A(n).call(n,function(i){return T(r,i).enumerable})),t.push.apply(t,n)}return t}function te(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?I(t=B(Object(i),!0)).call(t,function(s){oe(r,s,i[s])}):R?N(r,R(i)):I(n=B(Object(i))).call(n,function(s){V(r,s,T(i,s))})}return r}var K=h(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],!(K(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(w){var s=w(r);for(i=0;i<s.length;i++)n=s[i],!(K(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}var ae=h(13546),he=h.n(ae),H=h(51121),J=h(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
|
|
16
|
+
*/function ue(r){return Object.prototype.toString.call(r)==="[object Object]"}function ve(r){var e,t;return ue(r)===!1?!1:(e=r.constructor,e===void 0?!0:(t=e.prototype,!(ue(t)===!1||t.hasOwnProperty("isPrototypeOf")===!1)))}var be=h(81933),we=h(67905),ze=h.n(we);/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function We(r){return typeof r>"u"||r===null}function Je(r){return typeof r=="object"&&r!==null}function Ve(r){return Array.isArray(r)?r:We(r)?[]:[r]}function dt(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 Wt(r,e){var t="",n;for(n=0;n<e;n+=1)t+=r;return t}function Mt(r){return r===0&&Number.NEGATIVE_INFINITY===1/r}var lr=We,qe=Je,Dt=Ve,Tt=Wt,Nt=Mt,br=dt,Ne={isNothing:lr,isObject:qe,toArray:Dt,repeat:Tt,isNegativeZero:Nt,extend:br};function Et(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
|
-
`+r.mark.snippet),n+" "+t):n}function
|
|
19
|
-
`+
|
|
20
|
-
`,
|
|
21
|
-
`,
|
|
22
|
-
`;return
|
|
23
|
-
\r`;function
|
|
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
|
|
25
|
-
`,e-1))}function
|
|
26
|
-
`,s?1+
|
|
27
|
-
`);break}for(n?
|
|
28
|
-
`,s?1+
|
|
29
|
-
`,
|
|
30
|
-
`,
|
|
31
|
-
`,s?1+
|
|
32
|
-
`),r.charCodeAt(0)===65279&&(r=r.slice(1)));var t=new
|
|
33
|
-
`,n),i===-1?(o=r.slice(n),n=
|
|
34
|
-
`&&(s+=t),s+=o;return s}function
|
|
35
|
-
`+
|
|
18
|
+
`+r.mark.snippet),n+" "+t):n}function Jt(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=Et(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Jt.prototype=Object.create(Error.prototype),Jt.prototype.constructor=Jt,Jt.prototype.toString=function(e){return this.name+": "+Et(this,e)};var xt=Jt;function Fr(r,e,t,n,i){var s="",o="",l=Math.floor(i/2)-1;return n-e>l&&(s=" ... ",e=n-l+s.length),t-n>l&&(o=" ...",t=n+l-o.length),{str:s+r.slice(e,t).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function xr(r,e){return Ne.repeat(" ",e-r.length)+r}function Xr(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 l="",a,f,u=Math.min(r.line+e.linesAfter,i.length).toString().length,c=e.maxLength-(e.indent+u+3);for(a=1;a<=e.linesBefore&&!(o-a<0);a++)f=Fr(r.buffer,n[o-a],i[o-a],r.position-(n[o]-n[o-a]),c),l=Ne.repeat(" ",e.indent)+xr((r.line-a+1).toString(),u)+" | "+f.str+`
|
|
19
|
+
`+l;for(f=Fr(r.buffer,n[o],i[o],r.position,c),l+=Ne.repeat(" ",e.indent)+xr((r.line+1).toString(),u)+" | "+f.str+`
|
|
20
|
+
`,l+=Ne.repeat("-",e.indent+u+3+f.pos)+`^
|
|
21
|
+
`,a=1;a<=e.linesAfter&&!(o+a>=i.length);a++)f=Fr(r.buffer,n[o+a],i[o+a],r.position-(n[o]-n[o+a]),c),l+=Ne.repeat(" ",e.indent)+xr((r.line+a+1).toString(),u)+" | "+f.str+`
|
|
22
|
+
`;return l.replace(/\n$/,"")}var Xi=Xr,jr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],wr=["scalar","sequence","mapping"];function Sr(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(n){e[String(n)]=t})}),e}function nn(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(jr.indexOf(t)===-1)throw new xt('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=Sr(e.styleAliases||null),wr.indexOf(this.kind)===-1)throw new xt('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}var wt=nn;function Gn(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 Ci(){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 Dn(r){return this.extend(r)}Dn.prototype.extend=function(e){var t=[],n=[];if(e instanceof wt)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 xt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof wt))throw new xt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new xt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new xt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof wt))throw new xt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Dn.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Gn(i,"implicit"),i.compiledExplicit=Gn(i,"explicit"),i.compiledTypeMap=Ci(i.compiledImplicit,i.compiledExplicit),i};var Nn=Dn,Kn=new wt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}}),Oi=new wt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}}),Yn=new wt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}}),Qr=new Nn({explicit:[Kn,Oi,Yn]});function _n(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function Ti(){return null}function et(r){return r===null}var Ee=new wt("tag:yaml.org,2002:null",{kind:"scalar",resolve:_n,construct:Ti,predicate:et,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Be(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 Ie(r){return r==="true"||r==="True"||r==="TRUE"}function z(r){return Object.prototype.toString.call(r)==="[object Boolean]"}var q=new wt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Be,construct:Ie,predicate:z,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 Ge(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function tt(r){return 48<=r&&r<=55}function pt(r){return 48<=r&&r<=57}function Me(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(!Ge(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(!tt(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=r[t],i!=="_"){if(!pt(r.charCodeAt(t)))return!1;n=!0}return!(!n||i==="_")}function sn(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 Rn(r){return Object.prototype.toString.call(r)==="[object Number]"&&r%1===0&&!Ne.isNegativeZero(r)}var Xt=new wt("tag:yaml.org,2002:int",{kind:"scalar",resolve:Me,construct:sn,predicate:Rn,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"]}}),on=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Js(r){return!(r===null||!on.test(r)||r[r.length-1]==="_")}function Jn(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 kr=/^[-+]?[0-9]+e/;function dl(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(Ne.isNegativeZero(r))return"-0.0";return t=r.toString(10),kr.test(t)?t.replace("e",".e"):t}function pl(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||Ne.isNegativeZero(r))}var Xs=new wt("tag:yaml.org,2002:float",{kind:"scalar",resolve:Js,construct:Jn,predicate:pl,represent:dl,defaultStyle:"lowercase"}),Xn=Qr.extend({implicit:[Ee,q,Xt,Xs]}),Qi=Xn,Ei=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Zi=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 Qs(r){return r===null?!1:Ei.exec(r)!==null||Zi.exec(r)!==null}function gl(r){var e,t,n,i,s,o,l,a=0,f=null,u,c,d;if(e=Ei.exec(r),e===null&&(e=Zi.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],l=+e[6],e[7]){for(a=e[7].slice(0,3);a.length<3;)a+="0";a=+a}return e[9]&&(u=+e[10],c=+(e[11]||0),f=(u*60+c)*6e4,e[9]==="-"&&(f=-f)),d=new Date(Date.UTC(t,n,i,s,o,l,a)),f&&d.setTime(d.getTime()-f),d}function ml(r){return r.toISOString()}var qi=new wt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Qs,construct:gl,instanceOf:Date,represent:ml});function vl(r){return r==="<<"||r===null}var es=new wt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:vl}),ts=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
23
|
+
\r`;function Nf(r){if(r===null)return!1;var e,t,n=0,i=r.length,s=ts;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 Zs(r){var e,t,n=r.replace(/[\r\n=]/g,""),i=n.length,s=ts,o=0,l=[];for(e=0;e<i;e++)e%4===0&&e&&(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return t=i%4*6,t===0?(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)):t===18?(l.push(o>>10&255),l.push(o>>2&255)):t===12&&l.push(o>>4&255),new Uint8Array(l)}function Qn(r){var e="",t=0,n,i,s=r.length,o=ts;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 rs(r){return Object.prototype.toString.call(r)==="[object Uint8Array]"}var yl=new wt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Nf,construct:Zs,predicate:rs,represent:Qn}),bl=Object.prototype.hasOwnProperty,Rx=Object.prototype.toString;function Lx(r){if(r===null)return!0;var e=[],t,n,i,s,o,l=r;for(t=0,n=l.length;t<n;t+=1){if(i=l[t],o=!1,Rx.call(i)!=="[object Object]")return!1;for(s in i)if(bl.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 Bx(r){return r!==null?r:[]}var id=new wt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Lx,construct:Bx}),Fx=Object.prototype.toString;function jx(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],Fx.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}function Vx(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 sd=new wt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:jx,construct:Vx}),Wx=Object.prototype.hasOwnProperty;function $x(r){if(r===null)return!0;var e,t=r;for(e in t)if(Wx.call(t,e)&&t[e]!==null)return!1;return!0}function Hx(r){return r!==null?r:{}}var od=new wt("tag:yaml.org,2002:set",{kind:"mapping",resolve:$x,construct:Hx}),Rf=Qi.extend({implicit:[qi,es],explicit:[yl,id,sd,od]}),Zn=Object.prototype.hasOwnProperty,xl=1,ld=2,ad=3,wl=4,Lf=1,zx=2,fd=3,Ux=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Gx=/[\x85\u2028\u2029]/,Kx=/[,\[\]\{\}]/,ud=/^(?:!|!!|![a-z\-]+!)$/i,cd=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function hd(r){return Object.prototype.toString.call(r)}function ln(r){return r===10||r===13}function Pi(r){return r===9||r===32}function dr(r){return r===9||r===32||r===10||r===13}function ns(r){return r===44||r===91||r===93||r===123||r===125}function Yx(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function _x(r){return r===120?2:r===117?4:r===85?8:0}function Jx(r){return 48<=r&&r<=57?r-48:-1}function dd(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 Xx(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}for(var pd=new Array(256),gd=new Array(256),is=0;is<256;is++)pd[is]=dd(is)?1:0,gd[is]=dd(is);function Qx(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||Rf,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 md(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=Xi(t),new xt(e,t)}function ke(r,e){throw md(r,e)}function Sl(r,e){r.onWarning&&r.onWarning.call(null,md(r,e))}var vd={YAML:function(e,t,n){var i,s,o;e.version!==null&&ke(e,"duplication of %YAML directive"),n.length!==1&&ke(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&ke(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&ke(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Sl(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,s;n.length!==2&&ke(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],ud.test(i)||ke(e,"ill-formed tag handle (first argument) of the TAG directive"),Zn.call(e.tagMap,i)&&ke(e,'there is a previously declared suffix for "'+i+'" tag handle'),cd.test(s)||ke(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ke(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s}};function qn(r,e,t,n){var i,s,o,l;if(e<t){if(l=r.input.slice(e,t),n)for(i=0,s=l.length;i<s;i+=1)o=l.charCodeAt(i),o===9||32<=o&&o<=1114111||ke(r,"expected valid JSON character");else Ux.test(l)&&ke(r,"the stream contains non-printable characters");r.result+=l}}function yd(r,e,t,n){var i,s,o,l;for(Ne.isObject(t)||ke(r,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),o=0,l=i.length;o<l;o+=1)s=i[o],Zn.call(e,s)||(e[s]=t[s],n[s]=!0)}function ss(r,e,t,n,i,s,o,l,a){var f,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),f=0,u=i.length;f<u;f+=1)Array.isArray(i[f])&&ke(r,"nested arrays are not supported inside keys"),typeof i=="object"&&hd(i[f])==="[object Object]"&&(i[f]="[object Object]");if(typeof i=="object"&&hd(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(f=0,u=s.length;f<u;f+=1)yd(r,e,s[f],t);else yd(r,e,s,t);else!r.json&&!Zn.call(t,i)&&Zn.call(e,i)&&(r.line=o||r.line,r.lineStart=l||r.lineStart,r.position=a||r.position,ke(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 Bf(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++):ke(r,"a line break is expected"),r.line+=1,r.lineStart=r.position,r.firstTabInLine=-1}function Pt(r,e,t){for(var n=0,i=r.input.charCodeAt(r.position);i!==0;){for(;Pi(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(ln(i))for(Bf(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&&Sl(r,"deficient indentation"),n}function kl(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||dr(t)))}function Ff(r,e){e===1?r.result+=" ":e>1&&(r.result+=Ne.repeat(`
|
|
25
|
+
`,e-1))}function Zx(r,e,t){var n,i,s,o,l,a,f,u,c=r.kind,d=r.result,p;if(p=r.input.charCodeAt(r.position),dr(p)||ns(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),dr(i)||t&&ns(i)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,l=!1;p!==0;){if(p===58){if(i=r.input.charCodeAt(r.position+1),dr(i)||t&&ns(i))break}else if(p===35){if(n=r.input.charCodeAt(r.position-1),dr(n))break}else{if(r.position===r.lineStart&&kl(r)||t&&ns(p))break;if(ln(p))if(a=r.line,f=r.lineStart,u=r.lineIndent,Pt(r,!1,-1),r.lineIndent>=e){l=!0,p=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=a,r.lineStart=f,r.lineIndent=u;break}}l&&(qn(r,s,o,!1),Ff(r,r.line-a),s=o=r.position,l=!1),Pi(p)||(o=r.position+1),p=r.input.charCodeAt(++r.position)}return qn(r,s,o,!1),r.result?!0:(r.kind=c,r.result=d,!1)}function qx(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(qn(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 ln(t)?(qn(r,n,i,!0),Ff(r,Pt(r,!1,e)),n=i=r.position):r.position===r.lineStart&&kl(r)?ke(r,"unexpected end of the document within a single quoted scalar"):(r.position++,i=r.position);ke(r,"unexpected end of the stream within a single quoted scalar")}function ew(r,e){var t,n,i,s,o,l;if(l=r.input.charCodeAt(r.position),l!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=n=r.position;(l=r.input.charCodeAt(r.position))!==0;){if(l===34)return qn(r,t,r.position,!0),r.position++,!0;if(l===92){if(qn(r,t,r.position,!0),l=r.input.charCodeAt(++r.position),ln(l))Pt(r,!1,e);else if(l<256&&pd[l])r.result+=gd[l],r.position++;else if((o=_x(l))>0){for(i=o,s=0;i>0;i--)l=r.input.charCodeAt(++r.position),(o=Yx(l))>=0?s=(s<<4)+o:ke(r,"expected hexadecimal character");r.result+=Xx(s),r.position++}else ke(r,"unknown escape sequence");t=n=r.position}else ln(l)?(qn(r,t,n,!0),Ff(r,Pt(r,!1,e)),t=n=r.position):r.position===r.lineStart&&kl(r)?ke(r,"unexpected end of the document within a double quoted scalar"):(r.position++,n=r.position)}ke(r,"unexpected end of the stream within a double quoted scalar")}function tw(r,e){var t=!0,n,i,s,o=r.tag,l,a=r.anchor,f,u,c,d,p,g=Object.create(null),y,x,k,E;if(E=r.input.charCodeAt(r.position),E===91)u=93,p=!1,l=[];else if(E===123)u=125,p=!0,l={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=l),E=r.input.charCodeAt(++r.position);E!==0;){if(Pt(r,!0,e),E=r.input.charCodeAt(r.position),E===u)return r.position++,r.tag=o,r.anchor=a,r.kind=p?"mapping":"sequence",r.result=l,!0;t?E===44&&ke(r,"expected the node content, but found ','"):ke(r,"missed comma between flow collection entries"),x=y=k=null,c=d=!1,E===63&&(f=r.input.charCodeAt(r.position+1),dr(f)&&(c=d=!0,r.position++,Pt(r,!0,e))),n=r.line,i=r.lineStart,s=r.position,os(r,e,xl,!1,!0),x=r.tag,y=r.result,Pt(r,!0,e),E=r.input.charCodeAt(r.position),(d||r.line===n)&&E===58&&(c=!0,E=r.input.charCodeAt(++r.position),Pt(r,!0,e),os(r,e,xl,!1,!0),k=r.result),p?ss(r,l,g,x,y,k,n,i,s):c?l.push(ss(r,null,g,x,y,k,n,i,s)):l.push(y),Pt(r,!0,e),E=r.input.charCodeAt(r.position),E===44?(t=!0,E=r.input.charCodeAt(++r.position)):t=!1}ke(r,"unexpected end of the stream within a flow collection")}function rw(r,e){var t,n,i=Lf,s=!1,o=!1,l=e,a=0,f=!1,u,c;if(c=r.input.charCodeAt(r.position),c===124)n=!1;else if(c===62)n=!0;else return!1;for(r.kind="scalar",r.result="";c!==0;)if(c=r.input.charCodeAt(++r.position),c===43||c===45)Lf===i?i=c===43?fd:zx:ke(r,"repeat of a chomping mode identifier");else if((u=Jx(c))>=0)u===0?ke(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?ke(r,"repeat of an indentation width identifier"):(l=e+u-1,o=!0);else break;if(Pi(c)){do c=r.input.charCodeAt(++r.position);while(Pi(c));if(c===35)do c=r.input.charCodeAt(++r.position);while(!ln(c)&&c!==0)}for(;c!==0;){for(Bf(r),r.lineIndent=0,c=r.input.charCodeAt(r.position);(!o||r.lineIndent<l)&&c===32;)r.lineIndent++,c=r.input.charCodeAt(++r.position);if(!o&&r.lineIndent>l&&(l=r.lineIndent),ln(c)){a++;continue}if(r.lineIndent<l){i===fd?r.result+=Ne.repeat(`
|
|
26
|
+
`,s?1+a:a):i===Lf&&s&&(r.result+=`
|
|
27
|
+
`);break}for(n?Pi(c)?(f=!0,r.result+=Ne.repeat(`
|
|
28
|
+
`,s?1+a:a)):f?(f=!1,r.result+=Ne.repeat(`
|
|
29
|
+
`,a+1)):a===0?s&&(r.result+=" "):r.result+=Ne.repeat(`
|
|
30
|
+
`,a):r.result+=Ne.repeat(`
|
|
31
|
+
`,s?1+a:a),s=!0,o=!0,a=0,t=r.position;!ln(c)&&c!==0;)c=r.input.charCodeAt(++r.position);qn(r,t,r.position,!1)}return!0}function bd(r,e){var t,n=r.tag,i=r.anchor,s=[],o,l=!1,a;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),a=r.input.charCodeAt(r.position);a!==0&&(r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,ke(r,"tab characters must not be used in indentation")),!(a!==45||(o=r.input.charCodeAt(r.position+1),!dr(o))));){if(l=!0,r.position++,Pt(r,!0,-1)&&r.lineIndent<=e){s.push(null),a=r.input.charCodeAt(r.position);continue}if(t=r.line,os(r,e,ad,!1,!0),s.push(r.result),Pt(r,!0,-1),a=r.input.charCodeAt(r.position),(r.line===t||r.lineIndent>e)&&a!==0)ke(r,"bad indentation of a sequence entry");else if(r.lineIndent<e)break}return l?(r.tag=n,r.anchor=i,r.kind="sequence",r.result=s,!0):!1}function nw(r,e,t){var n,i,s,o,l,a,f=r.tag,u=r.anchor,c={},d=Object.create(null),p=null,g=null,y=null,x=!1,k=!1,E;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=c),E=r.input.charCodeAt(r.position);E!==0;){if(!x&&r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,ke(r,"tab characters must not be used in indentation")),n=r.input.charCodeAt(r.position+1),s=r.line,(E===63||E===58)&&dr(n))E===63?(x&&(ss(r,c,d,p,g,null,o,l,a),p=g=y=null),k=!0,x=!0,i=!0):x?(x=!1,i=!0):ke(r,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),r.position+=1,E=n;else{if(o=r.line,l=r.lineStart,a=r.position,!os(r,t,ld,!1,!0))break;if(r.line===s){for(E=r.input.charCodeAt(r.position);Pi(E);)E=r.input.charCodeAt(++r.position);if(E===58)E=r.input.charCodeAt(++r.position),dr(E)||ke(r,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(ss(r,c,d,p,g,null,o,l,a),p=g=y=null),k=!0,x=!1,i=!1,p=r.tag,g=r.result;else if(k)ke(r,"can not read an implicit mapping pair; a colon is missed");else return r.tag=f,r.anchor=u,!0}else if(k)ke(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return r.tag=f,r.anchor=u,!0}if((r.line===s||r.lineIndent>e)&&(x&&(o=r.line,l=r.lineStart,a=r.position),os(r,e,wl,!0,i)&&(x?g=r.result:y=r.result),x||(ss(r,c,d,p,g,y,o,l,a),p=g=y=null),Pt(r,!0,-1),E=r.input.charCodeAt(r.position)),(r.line===s||r.lineIndent>e)&&E!==0)ke(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return x&&ss(r,c,d,p,g,null,o,l,a),k&&(r.tag=f,r.anchor=u,r.kind="mapping",r.result=c),k}function iw(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&&ke(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)):ke(r,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!dr(o);)o===33&&(n?ke(r,"tag suffix cannot contain exclamation marks"):(i=r.input.slice(e-1,r.position+1),ud.test(i)||ke(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),Kx.test(s)&&ke(r,"tag suffix cannot contain flow indicator characters")}s&&!cd.test(s)&&ke(r,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ke(r,"tag name is malformed: "+s)}return t?r.tag=s:Zn.call(r.tagMap,i)?r.tag=r.tagMap[i]+s:i==="!"?r.tag="!"+s:i==="!!"?r.tag="tag:yaml.org,2002:"+s:ke(r,'undeclared tag handle "'+i+'"'),!0}function sw(r){var e,t;if(t=r.input.charCodeAt(r.position),t!==38)return!1;for(r.anchor!==null&&ke(r,"duplication of an anchor property"),t=r.input.charCodeAt(++r.position),e=r.position;t!==0&&!dr(t)&&!ns(t);)t=r.input.charCodeAt(++r.position);return r.position===e&&ke(r,"name of an anchor node must contain at least one character"),r.anchor=r.input.slice(e,r.position),!0}function ow(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&&!dr(n)&&!ns(n);)n=r.input.charCodeAt(++r.position);return r.position===e&&ke(r,"name of an alias node must contain at least one character"),t=r.input.slice(e,r.position),Zn.call(r.anchorMap,t)||ke(r,'unidentified alias "'+t+'"'),r.result=r.anchorMap[t],Pt(r,!0,-1),!0}function os(r,e,t,n,i){var s,o,l,a=1,f=!1,u=!1,c,d,p,g,y,x;if(r.listener!==null&&r.listener("open",r),r.tag=null,r.anchor=null,r.kind=null,r.result=null,s=o=l=wl===t||ad===t,n&&Pt(r,!0,-1)&&(f=!0,r.lineIndent>e?a=1:r.lineIndent===e?a=0:r.lineIndent<e&&(a=-1)),a===1)for(;iw(r)||sw(r);)Pt(r,!0,-1)?(f=!0,l=s,r.lineIndent>e?a=1:r.lineIndent===e?a=0:r.lineIndent<e&&(a=-1)):l=!1;if(l&&(l=f||i),(a===1||wl===t)&&(xl===t||ld===t?y=e:y=e+1,x=r.position-r.lineStart,a===1?l&&(bd(r,x)||nw(r,x,y))||tw(r,y)?u=!0:(o&&rw(r,y)||qx(r,y)||ew(r,y)?u=!0:ow(r)?(u=!0,(r.tag!==null||r.anchor!==null)&&ke(r,"alias node should not have any properties")):Zx(r,y,xl===t)&&(u=!0,r.tag===null&&(r.tag="?")),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):a===0&&(u=l&&bd(r,x))),r.tag===null)r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);else if(r.tag==="?"){for(r.result!==null&&r.kind!=="scalar"&&ke(r,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+r.kind+'"'),c=0,d=r.implicitTypes.length;c<d;c+=1)if(g=r.implicitTypes[c],g.resolve(r.result)){r.result=g.construct(r.result),r.tag=g.tag,r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);break}}else if(r.tag!=="!"){if(Zn.call(r.typeMap[r.kind||"fallback"],r.tag))g=r.typeMap[r.kind||"fallback"][r.tag];else for(g=null,p=r.typeMap.multi[r.kind||"fallback"],c=0,d=p.length;c<d;c+=1)if(r.tag.slice(0,p[c].tag.length)===p[c].tag){g=p[c];break}g||ke(r,"unknown tag !<"+r.tag+">"),r.result!==null&&g.kind!==r.kind&&ke(r,"unacceptable node kind for !<"+r.tag+'> tag; it should be "'+g.kind+'", not "'+r.kind+'"'),g.resolve(r.result,r.tag)?(r.result=g.construct(r.result,r.tag),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):ke(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 lw(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&&(Pt(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&&!dr(o);)o=r.input.charCodeAt(++r.position);for(n=r.input.slice(t,r.position),i=[],n.length<1&&ke(r,"directive name must not be less than one character in length");o!==0;){for(;Pi(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!ln(o));break}if(ln(o))break;for(t=r.position;o!==0&&!dr(o);)o=r.input.charCodeAt(++r.position);i.push(r.input.slice(t,r.position))}o!==0&&Bf(r),Zn.call(vd,n)?vd[n](r,n,i):Sl(r,'unknown document directive "'+n+'"')}if(Pt(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,Pt(r,!0,-1)):s&&ke(r,"directives end mark is expected"),os(r,r.lineIndent-1,wl,!1,!0),Pt(r,!0,-1),r.checkLineBreaks&&Gx.test(r.input.slice(e,r.position))&&Sl(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&kl(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,Pt(r,!0,-1));return}if(r.position<r.length-1)ke(r,"end of the stream or a document separator is expected");else return}function xd(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 Qx(r,e),n=r.indexOf("\0");for(n!==-1&&(t.position=n,ke(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;)lw(t);return t.documents}function aw(r,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var n=xd(r,t);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}function fw(r,e){var t=xd(r,e);if(t.length!==0){if(t.length===1)return t[0];throw new xt("expected a single document in the stream, but found more")}}var uw=aw,cw=fw,wd={loadAll:uw,load:cw},Sd=Object.prototype.toString,kd=Object.prototype.hasOwnProperty,jf=65279,hw=9,qs=10,dw=13,pw=32,gw=33,mw=34,Vf=35,vw=37,yw=38,bw=39,xw=42,Ad=44,ww=45,Al=58,Sw=61,kw=62,Aw=63,Cw=64,Cd=91,Od=93,Ow=96,Td=123,Tw=124,Ed=125,Qt={};Qt[0]="\\0",Qt[7]="\\a",Qt[8]="\\b",Qt[9]="\\t",Qt[10]="\\n",Qt[11]="\\v",Qt[12]="\\f",Qt[13]="\\r",Qt[27]="\\e",Qt[34]='\\"',Qt[92]="\\\\",Qt[133]="\\N",Qt[160]="\\_",Qt[8232]="\\L",Qt[8233]="\\P";var Ew=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Pw=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Iw(r,e){var t,n,i,s,o,l,a;if(e===null)return{};for(t={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],l=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),a=r.compiledTypeMap.fallback[o],a&&kd.call(a.styleAliases,l)&&(l=a.styleAliases[l]),t[o]=l;return t}function Mw(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 xt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+Ne.repeat("0",n-e.length)+e}var Dw=1,eo=2;function Nw(r){this.schema=r.schema||Rf,this.indent=Math.max(1,r.indent||2),this.noArrayIndent=r.noArrayIndent||!1,this.skipInvalid=r.skipInvalid||!1,this.flowLevel=Ne.isNothing(r.flowLevel)?-1:r.flowLevel,this.styleMap=Iw(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==='"'?eo:Dw,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 Pd(r,e){for(var t=Ne.repeat(" ",e),n=0,i=-1,s="",o,l=r.length;n<l;)i=r.indexOf(`
|
|
33
|
+
`,n),i===-1?(o=r.slice(n),n=l):(o=r.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
34
|
+
`&&(s+=t),s+=o;return s}function Wf(r,e){return`
|
|
35
|
+
`+Ne.repeat(" ",r.indent*e)}function Rw(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 Cl(r){return r===pw||r===hw}function to(r){return 32<=r&&r<=126||161<=r&&r<=55295&&r!==8232&&r!==8233||57344<=r&&r<=65533&&r!==jf||65536<=r&&r<=1114111}function Id(r){return to(r)&&r!==jf&&r!==dw&&r!==qs}function Md(r,e,t){var n=Id(r),i=n&&!Cl(r);return(t?n:n&&r!==Ad&&r!==Cd&&r!==Od&&r!==Td&&r!==Ed)&&r!==Vf&&!(e===Al&&!i)||Id(e)&&!Cl(e)&&r===Vf||e===Al&&i}function Lw(r){return to(r)&&r!==jf&&!Cl(r)&&r!==ww&&r!==Aw&&r!==Al&&r!==Ad&&r!==Cd&&r!==Od&&r!==Td&&r!==Ed&&r!==Vf&&r!==yw&&r!==xw&&r!==gw&&r!==Tw&&r!==Sw&&r!==kw&&r!==bw&&r!==mw&&r!==vw&&r!==Cw&&r!==Ow}function Bw(r){return!Cl(r)&&r!==Al}function ro(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 Dd(r){var e=/^\n* /;return e.test(r)}var Nd=1,$f=2,Rd=3,Ld=4,ls=5;function Fw(r,e,t,n,i,s,o,l){var a,f=0,u=null,c=!1,d=!1,p=n!==-1,g=-1,y=Lw(ro(r,0))&&Bw(ro(r,r.length-1));if(e||o)for(a=0;a<r.length;f>=65536?a+=2:a++){if(f=ro(r,a),!to(f))return ls;y=y&&Md(f,u,l),u=f}else{for(a=0;a<r.length;f>=65536?a+=2:a++){if(f=ro(r,a),f===qs)c=!0,p&&(d=d||a-g-1>n&&r[g+1]!==" ",g=a);else if(!to(f))return ls;y=y&&Md(f,u,l),u=f}d=d||p&&a-g-1>n&&r[g+1]!==" "}return!c&&!d?y&&!o&&!i(r)?Nd:s===eo?ls:$f:t>9&&Dd(r)?ls:o?s===eo?ls:$f:d?Ld:Rd}function jw(r,e,t,n,i){r.dump=function(){if(e.length===0)return r.quotingType===eo?'""':"''";if(!r.noCompatMode&&(Ew.indexOf(e)!==-1||Pw.test(e)))return r.quotingType===eo?'"'+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),l=n||r.flowLevel>-1&&t>=r.flowLevel;function a(f){return Rw(r,f)}switch(Fw(e,l,r.indent,o,a,r.quotingType,r.forceQuotes&&!n,i)){case Nd:return e;case $f:return"'"+e.replace(/'/g,"''")+"'";case Rd:return"|"+Bd(e,r.indent)+Fd(Pd(e,s));case Ld:return">"+Bd(e,r.indent)+Fd(Pd(Vw(e,o),s));case ls:return'"'+Ww(e)+'"';default:throw new xt("impossible error: invalid scalar style")}}()}function Bd(r,e){var t=Dd(r)?String(e):"",n=r[r.length-1]===`
|
|
36
36
|
`,i=n&&(r[r.length-2]===`
|
|
37
37
|
`||r===`
|
|
38
38
|
`),s=i?"+":n?"":"-";return t+s+`
|
|
39
|
-
`}function
|
|
40
|
-
`?r.slice(0,-1):r}function
|
|
41
|
-
`);return
|
|
42
|
-
`||r[0]===" ",s,o;o=t.exec(r);){var
|
|
43
|
-
`:"")+
|
|
44
|
-
`+r.slice(i,s),i=s+1),o=
|
|
45
|
-
`,r.length-i>e&&o>i?
|
|
46
|
-
`+r.slice(o+1):
|
|
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(95659),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),Re=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`
|
|
39
|
+
`}function Fd(r){return r[r.length-1]===`
|
|
40
|
+
`?r.slice(0,-1):r}function Vw(r,e){for(var t=/(\n+)([^\n]*)/g,n=function(){var f=r.indexOf(`
|
|
41
|
+
`);return f=f!==-1?f:r.length,t.lastIndex=f,jd(r.slice(0,f),e)}(),i=r[0]===`
|
|
42
|
+
`||r[0]===" ",s,o;o=t.exec(r);){var l=o[1],a=o[2];s=a[0]===" ",n+=l+(!i&&!s&&a!==""?`
|
|
43
|
+
`:"")+jd(a,e),i=s}return n}function jd(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,n,i=0,s,o=0,l=0,a="";n=t.exec(r);)l=n.index,l-i>e&&(s=o>i?o:l,a+=`
|
|
44
|
+
`+r.slice(i,s),i=s+1),o=l;return a+=`
|
|
45
|
+
`,r.length-i>e&&o>i?a+=r.slice(i,o)+`
|
|
46
|
+
`+r.slice(o+1):a+=r.slice(i),a.slice(1)}function Ww(r){for(var e="",t=0,n,i=0;i<r.length;t>=65536?i+=2:i++)t=ro(r,i),n=Qt[t],!n&&to(t)?(e+=r[i],t>=65536&&(e+=r[i+1])):e+=n||Mw(t);return e}function $w(r,e,t){var n="",i=r.tag,s,o,l;for(s=0,o=t.length;s<o;s+=1)l=t[s],r.replacer&&(l=r.replacer.call(t,String(s),l)),(Ln(r,e,l,!1,!1)||typeof l>"u"&&Ln(r,e,null,!1,!1))&&(n!==""&&(n+=","+(r.condenseFlow?"":" ")),n+=r.dump);r.tag=i,r.dump="["+n+"]"}function Vd(r,e,t,n){var i="",s=r.tag,o,l,a;for(o=0,l=t.length;o<l;o+=1)a=t[o],r.replacer&&(a=r.replacer.call(t,String(o),a)),(Ln(r,e+1,a,!0,!0,!1,!0)||typeof a>"u"&&Ln(r,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Wf(r,e)),r.dump&&qs===r.dump.charCodeAt(0)?i+="-":i+="- ",i+=r.dump);r.tag=s,r.dump=i||"[]"}function Hw(r,e,t){var n="",i=r.tag,s=Object.keys(t),o,l,a,f,u;for(o=0,l=s.length;o<l;o+=1)u="",n!==""&&(u+=", "),r.condenseFlow&&(u+='"'),a=s[o],f=t[a],r.replacer&&(f=r.replacer.call(t,a,f)),Ln(r,e,a,!1,!1)&&(r.dump.length>1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),Ln(r,e,f,!1,!1)&&(u+=r.dump,n+=u));r.tag=i,r.dump="{"+n+"}"}function zw(r,e,t,n){var i="",s=r.tag,o=Object.keys(t),l,a,f,u,c,d;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new xt("sortKeys must be a boolean or a function");for(l=0,a=o.length;l<a;l+=1)d="",(!n||i!=="")&&(d+=Wf(r,e)),f=o[l],u=t[f],r.replacer&&(u=r.replacer.call(t,f,u)),Ln(r,e+1,f,!0,!0,!0)&&(c=r.tag!==null&&r.tag!=="?"||r.dump&&r.dump.length>1024,c&&(r.dump&&qs===r.dump.charCodeAt(0)?d+="?":d+="? "),d+=r.dump,c&&(d+=Wf(r,e)),Ln(r,e+1,u,!0,c)&&(r.dump&&qs===r.dump.charCodeAt(0)?d+=":":d+=": ",d+=r.dump,i+=d));r.tag=s,r.dump=i||"{}"}function Wd(r,e,t){var n,i,s,o,l,a;for(i=t?r.explicitTypes:r.implicitTypes,s=0,o=i.length;s<o;s+=1)if(l=i[s],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof e=="object"&&e instanceof l.instanceOf)&&(!l.predicate||l.predicate(e))){if(t?l.multi&&l.representName?r.tag=l.representName(e):r.tag=l.tag:r.tag="?",l.represent){if(a=r.styleMap[l.tag]||l.defaultStyle,Sd.call(l.represent)==="[object Function]")n=l.represent(e,a);else if(kd.call(l.represent,a))n=l.represent[a](e,a);else throw new xt("!<"+l.tag+'> tag resolver accepts not "'+a+'" style');r.dump=n}return!0}return!1}function Ln(r,e,t,n,i,s,o){r.tag=null,r.dump=t,Wd(r,t,!1)||Wd(r,t,!0);var l=Sd.call(r.dump),a=n,f;n&&(n=r.flowLevel<0||r.flowLevel>e);var u=l==="[object Object]"||l==="[object Array]",c,d;if(u&&(c=r.duplicates.indexOf(t),d=c!==-1),(r.tag!==null&&r.tag!=="?"||d||r.indent!==2&&e>0)&&(i=!1),d&&r.usedDuplicates[c])r.dump="*ref_"+c;else{if(u&&d&&!r.usedDuplicates[c]&&(r.usedDuplicates[c]=!0),l==="[object Object]")n&&Object.keys(r.dump).length!==0?(zw(r,e,r.dump,i),d&&(r.dump="&ref_"+c+r.dump)):(Hw(r,e,r.dump),d&&(r.dump="&ref_"+c+" "+r.dump));else if(l==="[object Array]")n&&r.dump.length!==0?(r.noArrayIndent&&!o&&e>0?Vd(r,e-1,r.dump,i):Vd(r,e,r.dump,i),d&&(r.dump="&ref_"+c+r.dump)):($w(r,e,r.dump),d&&(r.dump="&ref_"+c+" "+r.dump));else if(l==="[object String]")r.tag!=="?"&&jw(r,r.dump,e,s,a);else{if(l==="[object Undefined]")return!1;if(r.skipInvalid)return!1;throw new xt("unacceptable kind of an object to dump "+l)}r.tag!==null&&r.tag!=="?"&&(f=encodeURI(r.tag[0]==="!"?r.tag.slice(1):r.tag).replace(/!/g,"%21"),r.tag[0]==="!"?f="!"+f:f.slice(0,18)==="tag:yaml.org,2002:"?f="!!"+f.slice(18):f="!<"+f+">",r.dump=f+" "+r.dump)}return!0}function Uw(r,e){var t=[],n=[],i,s;for(Hf(r,t,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(t[n[i]]);e.usedDuplicates=new Array(s)}function Hf(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)Hf(r[i],e,t);else for(n=Object.keys(r),i=0,s=n.length;i<s;i+=1)Hf(r[n[i]],e,t)}function Gw(r,e){e=e||{};var t=new Nw(e);t.noRefs||Uw(r,t);var n=r;return t.replacer&&(n=t.replacer.call({"":n},"",n)),Ln(t,0,n,!0,!0)?t.dump+`
|
|
47
|
+
`:""}var Kw=Gw,Yw={dump:Kw};function zf(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 _w=wt,Jw=Nn,Xw=Qr,Qw=Xn,Zw=Qi,qw=Rf,eS=wd.load,tS=wd.loadAll,rS=Yw.dump,nS=xt,iS={binary:yl,float:Xs,map:Yn,null:Ee,pairs:sd,set:od,timestamp:qi,bool:q,int:Xt,merge:es,omap:id,seq:Oi,str:Kn},sS=zf("safeLoad","load"),oS=zf("safeLoadAll","loadAll"),lS=zf("safeDump","dump"),aS={Type:_w,Schema:Jw,FAILSAFE_SCHEMA:Xw,JSON_SCHEMA:Qw,CORE_SCHEMA:Zw,DEFAULT_SCHEMA:qw,load:eS,loadAll:tS,dump:rS,YAMLException:nS,types:iS,safeLoad:sS,safeLoadAll:oS,safeDump:lS};const fS=aS,uS=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:$d,Blob:Ol,File:Hd}=uS,cS=r=>":/?#[]@!$&'()*+,;=".indexOf(r)>-1,hS=r=>/^[a-z0-9\-._~]+$/i.test(r);function as(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(hS(n)||cS(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 Uf(r){const{value:e}=r;return Array.isArray(e)?dS(r):typeof e=="object"?pS(r):gS(r)}function dS(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=l=>as(l,{escape:s});if(n==="simple")return t.map(l=>o(l)).join(",");if(n==="label")return`.${t.map(l=>o(l)).join(".")}`;if(n==="matrix")return t.map(l=>o(l)).reduce((l,a)=>!l||i?`${l||""};${e}=${a}`:`${l},${a}`,"");if(n==="form"){const l=i?`&${e}=`:",";return t.map(a=>o(a)).join(l)}if(n==="spaceDelimited"){const l=i?`${e}=`:"";return t.map(a=>o(a)).join(` ${l}`)}if(n==="pipeDelimited"){const l=i?`${e}=`:"";return t.map(a=>o(a)).join(`|${l}`)}}function pS(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=a=>as(a,{escape:s}),l=Object.keys(t);if(n==="simple")return l.reduce((a,f)=>{const u=o(t[f]),c=i?"=":",";return`${a?`${a},`:""}${f}${c}${u}`},"");if(n==="label")return l.reduce((a,f)=>{const u=o(t[f]),c=i?"=":".";return`${a?`${a}.`:"."}${f}${c}${u}`},"");if(n==="matrix"&&i)return l.reduce((a,f)=>{const u=o(t[f]);return`${a?`${a};`:";"}${f}=${u}`},"");if(n==="matrix")return l.reduce((a,f)=>{const u=o(t[f]);return`${a?`${a},`:`;${e}=`}${f},${u}`},"");if(n==="form")return l.reduce((a,f)=>{const u=o(t[f]);return`${a?`${a}${i?"&":","}`:""}${f}${i?"=":","}${u}`},"")}function gS(r){let{key:e,value:t,style:n,escape:i}=r;const s=o=>as(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 mS=(r,e)=>{e.body=r},Gf={serializeRes:xS,mergeInQueryOrForm:Yd};async function vS(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof r=="object"&&(e=r,r=e.url),e.headers=e.headers||{},Gf.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 $d&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await Gf.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 yS=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(r)};function bS(r,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(r):fS.load(r)}function xS(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:SS(r.headers)},i=n.headers["content-type"],s=t||yS(i);return(s?r.text:r.blob||r.buffer).call(r).then(l=>{if(n.text=l,n.data=l,s)try{const a=bS(l,i);n.body=a,n.obj=a}catch(a){n.parseError=a}return n})}function wS(r){return r.includes(", ")?r.split(", "):r}function SS(){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]=wS(i),e},{})}function Kf(r,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(r&&typeof r=="object"&&typeof r.uri=="string"):typeof Hd<"u"&&r instanceof Hd||typeof Ol<"u"&&r instanceof Ol||ArrayBuffer.isView(r)?!0:r!==null&&typeof r=="object"&&typeof r.pipe=="function"}function zd(r,e){return Array.isArray(r)&&r.some(t=>Kf(t,e))}const kS={form:",",spaceDelimited:"%20",pipeDelimited:"|"},AS={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Ud(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,l=typeof e=="object"&&!Array.isArray(e)?e.value:e,a=t?u=>u.toString():u=>encodeURIComponent(u),f=a(r);if(typeof l>"u"&&i)return[[f,""]];if(Kf(l)||zd(l))return[[f,l]];if(s)return Gd(r,l,t,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:c,allowReserved:d}=o;return Gd(r,l,t,{style:u,explode:c,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof l=="string"?l:JSON.stringify(l);return[[f,a(u)]]}return[[f,a(l.toString())]]}return typeof l!="object"?[[f,a(l)]]:Array.isArray(l)&&l.every(u=>typeof u!="object")?[[f,l.map(a).join(",")]]:[[f,a(JSON.stringify(l))]]}return typeof l!="object"?[[f,a(l)]]:Array.isArray(l)?n==="multi"?[[f,l.map(a)]]:[[f,l.map(a).join(AS[n||"csv"])]]:[[f,""]]}function Gd(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",l=f=>as(f,{escape:o}),a=t?f=>f:f=>as(f,{escape:o});return typeof e!="object"?[[a(r),l(e)]]:Array.isArray(e)?s?[[a(r),e.map(l)]]:[[a(r),e.map(l).join(kS[i])]]:i==="deepObject"?Object.keys(e).map(f=>[a(`${r}[${f}]`),l(e[f])]):s?Object.keys(e).map(f=>[a(f),l(e[f])]):[[a(r),Object.keys(e).map(f=>[`${a(f)},${l(e[f])}`]).join(",")]]}function CS(r){return Object.entries(r).reduce((e,t)=>{let[n,i]=t;for(const[s,o]of Ud(n,i,!0))if(Array.isArray(o))for(const l of o)if(ArrayBuffer.isView(l)){const a=new Ol([l]);e.append(s,a)}else e.append(s,l);else if(ArrayBuffer.isView(o)){const l=new Ol([o]);e.append(s,l)}else e.append(s,o);return e},new $d)}function Kd(r){const e=Object.keys(r).reduce((t,n)=>{for(const[i,s]of Ud(n,r[n]))t[i]=s;return t},{});return ze().stringify(e,{encode:!1,indices:!1})||""}function Yd(){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),l=0;l<s;l++)o[l]=arguments[l];const a=o.filter(f=>f).join("&");return a?`?${a}`:""};if(n){const s=Object.keys(n).some(l=>{const{value:a}=n[l];return Kf(a)||zd(a)}),o=r.headers["content-type"]||r.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const l=CS(r.form);mS(l,r)}else r.body=Kd(n);delete r.form}if(t){const[s,o]=e.split("?");let l="";if(o){const f=ze().parse(o);Object.keys(t).forEach(c=>delete f[c]),l=ze().stringify(f,{encode:!0})}const a=i(l,Kd(t));r.url=s+a,delete r.query}return r}function q3(r,e,t){return t=t||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),Gf.mergeInQueryOrForm(n),n=e(n),t(r(n)))}function OS(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 TS={body:ES,header:IS,query:DS,path:MS,formData:PS};function ES(r){let{req:e,value:t}=r;e.body=t}function PS(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 IS(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{},typeof n<"u"&&(e.headers[t.name]=n)}function MS(r){let{req:e,value:t,parameter:n}=r;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(t))}function DS(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 Tl(r,e){return e.includes("application/json")?typeof r=="string"?r:JSON.stringify(r):r.toString()}function NS(r){let{req:e,value:t,parameter:n}=r;const{name:i,style:s,explode:o,content:l}=n;if(l){const f=Object.keys(l)[0];e.url=e.url.split(`{${i}}`).join(as(Tl(t,f),{escape:!0}));return}const a=Uf({key:n.name,value:t,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(a)}function RS(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=Tl(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 LS=["accept","authorization","content-type"];function BS(r){let{req:e,parameter:t,value:n}=r;if(e.headers=e.headers||{},!(LS.indexOf(t.name.toLowerCase())>-1)){if(t.content){const i=Object.keys(t.content)[0];e.headers[t.name]=Tl(n,i);return}typeof n<"u"&&(e.headers[t.name]=Uf({key:t.name,value:n,style:t.style||"simple",explode:typeof t.explode>"u"?!1:t.explode,escape:!1}))}}function FS(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}=${Tl(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+Uf({key:t.name,value:n,escape:!1,style:t.style||"form",explode:typeof t.explode>"u"?!1:t.explode})}}const jS=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:VS}=jS,_d=VS;function WS(r,e){const{operation:t,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=r;let{requestContentType:l}=r;e=$S({request:e,securities:i,operation:t,spec:s});const a=t.requestBody||{},f=Object.keys(a.content||{}),u=l&&f.indexOf(l)>-1;if(n||o){if(l&&u)e.headers["Content-Type"]=l;else if(!l){const c=f[0];c&&(e.headers["Content-Type"]=c,l=c)}}else l&&u&&(e.headers["Content-Type"]=l);if(!r.responseContentType&&t.responses){const c=Object.entries(t.responses).filter(d=>{let[p,g]=d;const y=parseInt(p,10);return y>=200&&y<300&&ve(g.content)}).reduce((d,p)=>{let[,g]=p;return d.concat(Object.keys(g.content))},[]);c.length>0&&(e.headers.accept=c.join(", "))}if(n)if(l){if(f.indexOf(l)>-1)if(l==="application/x-www-form-urlencoded"||l==="multipart/form-data")if(typeof n=="object"){const c=(a.content[l]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:c[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function $S(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=te({},e),{authorized:o={}}=t,l=n.security||i.security||[],a=o&&!!Object.keys(o).length,f=he()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!a||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(u=>{Object.keys(u).forEach(c=>{const d=o[c],p=f[c];if(!d)return;const g=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=g),p.in==="header"&&(s.headers[p.name]=g),p.in==="cookie"&&(s.cookies[p.name]=g);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const x=g.username||"",k=g.password||"",E=_d(`${x}:${k}`);s.headers.Authorization=`Basic ${E}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${g}`)}else if(y==="oauth2"||y==="openIdConnect"){const x=d.token||{},k=p["x-tokenName"]||"access_token",E=x[k];let O=x.token_type;(!O||O.toLowerCase()==="bearer")&&(O="Bearer"),s.headers.Authorization=`${O} ${E}`}}})}),s)}function HS(r,e){const{spec:t,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:l}=r;if(e=zS({request:e,securities:i,operation:n,spec:t}),e.body||e.form||l)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(a=>a.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(a=>a.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const a=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,f=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(a||f)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function zS(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=te({},e),{authorized:o={},specSecurity:l=[]}=t,a=n.security||l,f=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!f||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(c=>{Object.keys(c).forEach(d=>{const p=o[d];if(!p)return;const{token:g}=p,y=p.value||p,x=u[d],{type:k}=x,E=x["x-tokenName"]||"access_token",O=g&&g[E];let j=g&&g.token_type;if(p)if(k==="apiKey"){const M=x.in==="query"?"query":"headers";s[M]=s[M]||{},s[M][x.name]=y}else if(k==="basic")if(y.header)s.headers.authorization=y.header;else{const M=y.username||"",F=y.password||"";y.base64=_d(`${M}:${F}`),s.headers.authorization=`Basic ${y.base64}`}else k==="oauth2"&&O&&(j=!j||j.toLowerCase()==="bearer"?"Bearer":j,s.headers.authorization=`${j} ${O}`)})}),s)}function Jd(r,e){return`${e.toLowerCase()}-${r}`}function US(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 l={spec:r,pathName:i,method:s.toUpperCase(),operation:o},a=e(l);if(t&&a)return l}}function GS(r,e){return US(r,e,!0)||null}const Xd=r=>r.replace(/\W/gi,"_");function KS(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()}${Xd(r)}`}function YS(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?Xd(r.operationId):KS(e,t,{v2OperationIdCompatibilityMode:n})}function _S(r,e){return!r||!r.paths?null:GS(r,t=>{let{pathName:n,method:i,operation:s}=t;if(!s||typeof s!="object")return!1;const o=s.operationId,l=YS(s,n,i),a=Jd(n,i);return[l,a,o].some(f=>f&&f===e)})}const tR=r=>{try{const{swagger:e}=r;return e==="2.0"}catch{return!1}},JS=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},XS=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},Qd=r=>JS(r)||XS(r),QS=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Zd=r=>Array.isArray(r)?r:[],ZS=OS("OperationNotFoundError",function(e,t,n){this.originalError=n,Object.assign(this,t||{})}),qS=(r,e)=>e.filter(t=>t.name===r),ek=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},tk={buildRequest:nk};function rk(r){let{http:e,fetch:t,spec:n,operationId:i,pathName:s,method:o,parameters:l,securities:a}=r,f=ie(r,QS);const u=e||t||vS;s&&o&&!i&&(i=Jd(s,o));const c=tk.buildRequest(te({spec:n,operationId:i,parameters:l,securities:a,http:u},f));return c.body&&(ve(c.body)||Array.isArray(c.body))&&(c.body=JSON.stringify(c.body)),u(c)}function nk(r){const{spec:e,operationId:t,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:l,userFetch:a,server:f,serverVariables:u,http:c,signal:d}=r;let{parameters:p,parameterBuilders:g}=r;const y=Qd(e);g||(y?g=m:g=TS);let k={url:"",credentials:c&&c.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(k.signal=d),s&&(k.requestInterceptor=s),o&&(k.responseInterceptor=o),a&&(k.userFetch=a);const E=_S(e,t);if(!E)throw new ZS(`Operation ${t} not found`);const{operation:O={},method:j,pathName:M}=E;if(k.url+=ik({spec:e,scheme:i,contextUrl:l,server:f,serverVariables:u,pathName:M,method:j}),!t)return delete k.cookies,k;k.url+=M,k.method=`${j}`.toUpperCase(),p=p||{};const F=e.paths[M]||{};n&&(k.headers.accept=n);const D=ek([].concat(Zd(O.parameters)).concat(Zd(F.parameters)));D.forEach(L=>{const $=g[L.in];let W;if(L.in==="body"&&L.schema&&L.schema.properties&&(W=p),W=L&&L.name&&p[L.name],typeof W>"u"?W=L&&L.name&&p[`${L.in}.${L.name}`]:qS(L.name,D).length>1&&console.warn(`Parameter '${L.name}' is ambiguous because the defined spec has more than one parameter with the name: '${L.name}' and the passed-in parameter values did not define an 'in' value.`),W!==null){if(typeof L.default<"u"&&typeof W>"u"&&(W=L.default),typeof W>"u"&&L.required&&!L.allowEmptyValue)throw new Error(`Required parameter ${L.name} is not provided`);if(y&&L.schema&&L.schema.type==="object"&&typeof W=="string")try{W=JSON.parse(W)}catch{throw new Error("Could not parse object parameter value string as JSON")}$&&$({req:k,parameter:L,value:W,operation:O,spec:e})}});const U=te(te({},r),{},{operation:O});if(y?k=WS(U,k):k=HS(U,k),k.cookies&&Object.keys(k.cookies).length){const L=Object.keys(k.cookies).reduce(($,W)=>{const Y=k.cookies[W],le=$?"&":"",fe=J.serialize(W,Y);return $+le+fe},"");k.headers.Cookie=L}return k.cookies&&delete k.cookies,Yd(k),k}const Yf=r=>r?r.replace(/\W/g,""):null;function ik(r){return Qd(r.spec)?sk(r):ak(r)}function sk(r){let{spec:e,pathName:t,method:n,server:i,contextUrl:s,serverVariables:o={}}=r;const l=he()(e,["paths",t,(n||"").toLowerCase(),"servers"])||he()(e,["paths",t,"servers"])||he()(e,["servers"]);let a="",f=null;if(i&&l&&l.length){const u=l.map(c=>c.url);u.indexOf(i)>-1&&(a=i,f=l[u.indexOf(i)])}return!a&&l&&l.length&&(a=l[0].url,[f]=l),a.indexOf("{")>-1&&lk(a).forEach(c=>{if(f.variables&&f.variables[c]){const d=f.variables[c],p=o[c]||d.default,g=new RegExp(`{${c}}`,"g");a=a.replace(g,p)}}),ok(a,s)}function ok(){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?H.parse(H.resolve(e,r)):H.parse(r),n=H.parse(e),i=Yf(t.protocol)||Yf(n.protocol)||"",s=t.host||n.host,o=t.pathname||"";let l;return i&&s?l=`${i}://${s+o}`:l=o,l[l.length-1]==="/"?l.slice(0,-1):l}function lk(r){const e=[],t=/{([^}]+)}/g;let n;for(;n=t.exec(r);)e.push(n[1]);return e}function ak(r){let{spec:e,scheme:t,contextUrl:n=""}=r;const i=H.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=t||s||Yf(i.protocol)||"http",l=e.host||i.host||"",a=e.basePath||"";let f;return o&&l?f=`${o}://${l+a}`:f=a,f[f.length-1]==="/"?f.slice(0,-1):f}var S=h(52983),St=h(20202),Zr=h(95659),kt=h(56618),fk=h(92314),uk=h(90853),ck=h(2526),hk=Object.defineProperty,dk=Object.defineProperties,pk=Object.getOwnPropertyDescriptors,qd=Object.getOwnPropertySymbols,gk=Object.prototype.hasOwnProperty,mk=Object.prototype.propertyIsEnumerable,ep=(r,e,t)=>e in r?hk(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vk=(r,e)=>{for(var t in e||(e={}))gk.call(e,t)&&ep(r,t,e[t]);if(qd)for(var t of qd(e))mk.call(e,t)&&ep(r,t,e[t]);return r},yk=(r,e)=>dk(r,pk(e)),bk=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function xk(r,e){return bk(this,null,function*(){var t,n,i,s;const o=JSON.parse(JSON.stringify(e)),l=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},a=yk(vk({},l),{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}}}),f=new uk.Config({}),u=(0,ck.I)(a),c={config:f,doc:u,dereference:!0};return yield(0,fk.bundle)(c),o})}var wk=h(98910),El=h(84862),an=h(53134),tp=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});const rp=Object.values(an.FileUploadFormats),Sk=["application/octet-stream","application/pdf","application/gzip","application/zip"],np=["image/","audio/","video/"];function ip(r){if(np.some(e=>r.startsWith(e)))return r}function Pl(r){return Sk.includes(r)?!0:np.some(e=>r.startsWith(e))}function kk(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||(Pl(t)?"binary":"");return e.type===an.DefinitionTypes.STRING&&rp.includes(n)}function sp(r,e){if(!r||!r.type||r.type==="any")return Pl(e);const t=r.format||r.contentEncoding||"";return r.type===an.DefinitionTypes.STRING&&rp.includes(t)}function op(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 lp({format:r,contentEncoding:e,contentMediaType:t}){return[r,e,t].includes(an.FileUploadFormats.BASE64)}function Ak(r,e){return tp(this,null,function*(){const t=Object.values(r);let n=t.length===1?t[0]:t;return e.type===an.DefinitionTypes.STRING&&lp(e)?n=yield op(t[0]):e.type===an.DefinitionTypes.ARRAY&&e.items&&(lp(e.items)?n=yield Promise.all(t.map(s=>tp(this,null,function*(){return yield op(s)}))):n=t),n})}var _f=h(84622),Fe=h(38612),Xe=h(95404),Pe=h(85739),Vr=h(71608),Ck=h(64393),ei=h(60991);function Ok({response:r}){const{jsonSampleExpandLevel:e}=(0,Zr.Dv)(ei.qd);return S.createElement(S.Fragment,null,S.createElement(Vr.EE,null," Body: "),Tk(r,e))}function Tk(r,e){return r.body?S.createElement(St.JsonViewer,{data:r.body,jsonSampleExpandLevel:e}):r.fileInfo?S.createElement(Ck.s,{fileInfo:r.fileInfo}):r.data!==null?r.data?S.createElement(St.CodeBlock,{lang:(0,Pe.M)(r.headers["Content-Type"]||"text/plain"),source:r.data,header:{controls:{copy:{}}}}):S.createElement(St.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Ek({headers:r}){const e=(0,Zr.Dv)(ei.qd),[t,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(r),o=!!i&&s.length>i,l=o&&t?[...s].splice(0,i):[...s],a=()=>{n(!t)};return S.createElement(S.Fragment,null,S.createElement(Vr.EE,null," Headers: "),S.createElement(St.CodeBlockContainer,{withControls:!0},l.map(f=>S.createElement("div",{key:f},S.createElement(ap,null,f,":"),S.createElement("code",null,r[f]))),o&&S.createElement(fp,{onClick:a},t?"Show more...":"Hide headers")))}const ap=Xe.ZP.strong`
|
|
48
48
|
text-transform: capitalize;
|
|
49
49
|
display: inline-block;
|
|
50
50
|
padding-right: 5px;
|
|
51
|
-
`,
|
|
51
|
+
`,fp=Xe.ZP.div`
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
margin-top: 5px;
|
|
54
54
|
font-size: 14px;
|
|
55
|
-
`;
|
|
55
|
+
`;ap.displayName="HeaderName",fp.displayName="StyledShowMoreLabel";const Pk=Xe.ZP.div`
|
|
56
56
|
margin-bottom: 10px;
|
|
57
|
-
`,
|
|
57
|
+
`,Jf=Xe.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
|
-
`,
|
|
63
|
+
`,Ik=(0,Xe.ZP)(Jf)`
|
|
64
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
|
-
`,
|
|
65
|
+
`,up=Xe.ZP.header`
|
|
66
66
|
font-weight: bold;
|
|
67
67
|
margin-bottom: 10px;
|
|
68
|
-
`,
|
|
68
|
+
`,Mk=Xe.ZP.code`
|
|
69
69
|
border-left: 3px solid #ff4040;
|
|
70
70
|
padding-left: 5px;
|
|
71
|
-
`,
|
|
71
|
+
`,Dk=({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(up,null," Could not get any response "),S.createElement(Mk,null,r&&r.message||"Unknown error"),S.createElement("br",null),S.createElement(up,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(Pk,null,S.createElement(Ik,{code:n.status},S.createElement("span",null," Status: "),n.status," ",n.statusText),S.createElement(Jf,null,S.createElement("span",null," Time: "),t,"ms"),S.createElement(Jf,null,S.createElement("span",null," Size: "),s)),S.createElement("div",null,S.createElement(Ek,{headers:n.headers}),S.createElement(Ok,{response:n}))):S.createElement(S.Fragment,null,"Something went wrong")},Nk=Xe.ZP.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
button {
|
|
75
75
|
margin: 0;
|
|
76
76
|
}
|
|
77
|
-
`,
|
|
77
|
+
`,cp=Xe.ZP.button`
|
|
78
78
|
outline: none;
|
|
79
79
|
border: none;
|
|
80
80
|
background-color: var(--panel-try-it-tabs-background-color);
|
|
@@ -94,63 +94,65 @@
|
|
|
94
94
|
color: var(--panel-try-it-tabs-hover-text-color);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
${({active:r})=>r&&(0,
|
|
97
|
+
${({active:r})=>r&&(0,Xe.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:r})=>r&&(0,
|
|
102
|
+
${({disabled:r})=>r&&(0,Xe.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 Rk({onChange:r,active:e,hasResponse:t}){return S.createElement(Nk,null,S.createElement(cp,{onClick:()=>r(0),active:e===0},t?"Edit Request":"Request"),S.createElement(cp,{onClick:()=>t&&r(1),active:e===1,disabled:!t}," ","Response"," "))}var Xf=h(82155),hp=h(79198);function Lk(r,e,t){const n=e.path||{},i=e.query||{},s=Object.keys(i);let o=(0,Fe.v5)(r,n);const l=a=>t.find(f=>f.name===a&&f.in==="query");return s.length&&(o+="?"+s.map(a=>{if(!i[a])return"";const f=l(a);return f?(0,Pe.d$)(f,i[a]):`${a}=${encodeURIComponent(i[a])}`}).filter(Boolean).join("&")),o}const Bk=({loading:r,operation:e,hasResponse:t,onSubmit:n,params:i={}})=>S.createElement(El.k1,null,S.createElement(Xf.__,null,S.createElement(hp.FH,{color:e.httpVerb},e.httpVerb),S.createElement(Xf.y$,{wrap:"true"},Lk(e.path,i,e.parameters))),S.createElement(Fk,{"data-cy":"send-button",color:"primary",type:"submit",blinking:r,onClick:()=>!r&&n()},r?"Sending...":t?"Resend":"Send")),Fk=(0,Xe.ZP)(Xf.ev)`
|
|
108
108
|
width: var(--panel-try-it-action-button-width);
|
|
109
|
-
`,
|
|
109
|
+
`,jk=(0,S.memo)(Bk);var Ii=h(26225),Vk=Object.defineProperty,Wk=Object.defineProperties,$k=Object.getOwnPropertyDescriptors,dp=Object.getOwnPropertySymbols,Hk=Object.prototype.hasOwnProperty,zk=Object.prototype.propertyIsEnumerable,pp=(r,e,t)=>e in r?Vk(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,no=(r,e)=>{for(var t in e||(e={}))Hk.call(e,t)&&pp(r,t,e[t]);if(dp)for(var t of dp(e))zk.call(e,t)&&pp(r,t,e[t]);return r},Uk=(r,e)=>Wk(r,$k(e)),Il=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});const gp="/oauth2-redirect.html";class qr{static authorizeImplicit({authorizationUrl:e,clientId:t,scopes:n,extraParams:i={},routingBasePath:s,redirectUri:o,successCallback:l,errorCallback:a}){const f=(0,Ii.p8)({date:new Date().toString()}),u=new URL(e),c=s==="/"?"":s,d=`${window.location.origin}${c}${gp}`;u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",o||d),u.searchParams.set("response_type","token"),u.searchParams.set("state",f),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:f,successCallback:p=>{l(p),qr.clearRedirectData("implicit")},errorCallback:p=>{a(p),qr.clearRedirectData("implicit")}},window.open(u.toString())}static authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:t,clientId:n,clientSecret:i,codeVerifier:s,codeChallenge:o,scopes:l,extraParams:a={},extraHeaders:f={},routingBasePath:u,redirectUri:c,successCallback:d,errorCallback:p}){const g=new URL(e),y=u==="/"?"":u,x=`${window.location.origin}${y}${gp}`,k=(0,Ii.p8)({date:new Date().toString()});g.searchParams.set("client_id",n),g.searchParams.set("redirect_uri",c||x),g.searchParams.set("response_type","code"),g.searchParams.set("state",k),Array.isArray(l)&&g.searchParams.set("scope",l.join(" ")),o&&(g.searchParams.set("code_challenge",o),g.searchParams.set("code_challenge_method","S256"));for(const E in a)g.searchParams.set(E,a[E]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:n,scopes:l},state:k,successCallback:E=>Il(this,[E],function*({auth_code:O}){try{const j=yield fetch(t,{method:"POST",headers:no({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},f),body:Pe.uM.stringify(no(Uk(no({client_id:n,client_secret:i},s&&{code_verifier:s}),{code:O,grant_type:"authorization_code",redirect_uri:c||x}),a))});yield mp(j,d,p)}catch(j){p(j)}qr.clearRedirectData("authorizationCode")}),errorCallback:E=>{p(E),qr.clearRedirectData("authorizationCode")}},window.open(g.toString())}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static authorizeClientCredentials(e){return Il(this,arguments,function*({tokenUrl:t,clientId:n,clientSecret:i,scopes:s=[],extraParams:o={},extraHeaders:l={},successCallback:a,errorCallback:f}){try{const u=JSON.parse(JSON.stringify(no({client_id:n,client_secret:i,grant_type:"client_credentials",scope:Array.isArray(s)&&s.length?s.join(" "):void 0},o))),c=yield fetch(t,{method:"POST",headers:no({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},l),body:Pe.uM.stringify(u)});yield mp(c,a,f)}catch(u){f(u)}})}}const rR=new qr;function mp(r,e,t){return Il(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 vp(r){return Il(this,null,function*(){return(0,Ii.rS)(yield(0,Ii.JQ)(r))})}var io=h(95709),Se=h(9612),Gk=h(39012),ut=h(54597);function Kk({name:r,value:e,description:t,variableEnum:n,onChange:i,defaultValue:s}){const o=(0,S.useCallback)(f=>i(f.target.value),[i]),l=(0,S.useCallback)(f=>i(f.value),[i]),a=n?n.map((f,u)=>({value:f,idx:u})):[];return S.createElement(Se.NI,null,S.createElement(Se.lX,null,r,":"),a&&a.length?S.createElement(Vr.VD,{fullWidth:!0,variant:"dark",value:e,options:a,onChange:l}):S.createElement(ut.nv,{fullWidth:!0,value:e,onChange:o,placeholder:s,panel:"try-it"}),t&&S.createElement(Yk,{source:t}))}const Yk=(0,Xe.ZP)(Gk.Markdown)`
|
|
110
110
|
margin-top: 5px;
|
|
111
111
|
color: #d0d0d0;
|
|
112
|
-
`;var
|
|
113
|
-
${(0,
|
|
114
|
-
- ${(0,
|
|
115
|
-
`}}),[o]),
|
|
112
|
+
`;var _k=Object.defineProperty,Jk=Object.defineProperties,Xk=Object.getOwnPropertyDescriptors,yp=Object.getOwnPropertySymbols,Qk=Object.prototype.hasOwnProperty,Zk=Object.prototype.propertyIsEnumerable,bp=(r,e,t)=>e in r?_k(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xp=(r,e)=>{for(var t in e||(e={}))Qk.call(e,t)&&bp(r,t,e[t]);if(yp)for(var t of yp(e))Zk.call(e,t)&&bp(r,t,e[t]);return r},wp=(r,e)=>Jk(r,Xk(e));function qk({operation:r,onChange:e}){var t;const{control:n,watch:i}=(0,kt.Gc)(),{events:s}=(0,Zr.Dv)(ei.qd),{servers:o}=r,l=i("server");(0,St.useMount)(()=>{const d=(0,Pe.YQ)("serverUrl"),p=o.findIndex(y=>y.url===d),g=(0,Fe.fz)(o,p<0?0:p);e(g)});const a=(0,S.useCallback)(({serverUrl:d=""})=>{var p;const g=o.find(k=>k.url===d),y=(0,Fe.mj)(g);e({url:d,variables:y}),(0,Pe.WW)("serverUrl",d);const x=(0,_f.Ze)({operation:r,serverUrl:d});(p=s.targetServerSwitch)==null||p.call(s,x)},[e,s,r,o]),f=(d,p)=>{const g=p||p===""?p:(0,Fe.mj)(l)[d],y=wp(xp({},l.variables),{[d]:g});(0,Fe.UY)(d,g),e(wp(xp({},l),{variables:y}))},u=(0,S.useMemo)(()=>o.map((d,p)=>{const g=(0,Fe.mj)(d);return{idx:p,serverUrl:d.url,value:`
|
|
113
|
+
${(0,Fe.nq)((0,Fe.v5)(d.url,g),d.variables)}
|
|
114
|
+
- ${(0,Pe.bG)(d.description)||"Default"}
|
|
115
|
+
`}}),[o]),c=Object.keys(((t=o.find(({url:d})=>d===l?.url))==null?void 0:t.variables)||{});return S.createElement(tA,{"data-cy":"console-target-server"},S.createElement(Se.lX,{htmlFor:"server"},"Target server: "),S.createElement(Se.NI,null,S.createElement(kt.Qr,{control:n,name:"server",render:({field:{value:d}})=>{var p;const g=(p=u.find(({serverUrl:y})=>y===d?.url))==null?void 0:p.value;return S.createElement(Vr.VD,{variant:"dark",value:g,options:u,fullWidth:!0,onChange:a})}})),c?.map(d=>{var p;const g=(p=l?.variables)==null?void 0:p[d];return S.createElement(Kk,{key:d,name:d,value:l.variables[d],defaultValue:g.default,onChange:y=>f(d,y),variableEnum:g.enum,description:g.description})}))}const eA=(0,S.memo)(qk),tA=Xe.ZP.div`
|
|
116
116
|
margin-bottom: 20px;
|
|
117
|
-
`;var
|
|
118
|
-
${
|
|
117
|
+
`;var Sp=h(86220),rA=Object.defineProperty,nA=Object.defineProperties,iA=Object.getOwnPropertyDescriptors,Ml=Object.getOwnPropertySymbols,kp=Object.prototype.hasOwnProperty,Ap=Object.prototype.propertyIsEnumerable,Cp=(r,e,t)=>e in r?rA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sA=(r,e)=>{for(var t in e||(e={}))kp.call(e,t)&&Cp(r,t,e[t]);if(Ml)for(var t of Ml(e))Ap.call(e,t)&&Cp(r,t,e[t]);return r},oA=(r,e)=>nA(r,iA(e)),lA=(r,e)=>{var t={};for(var n in r)kp.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&Ml)for(var n of Ml(r))e.indexOf(n)<0&&Ap.call(r,n)&&(t[n]=r[n]);return t};function Qf(r){var e=r,{header:t,error:n,success:i}=e,s=lA(e,["header","error","success"]);const o=({toggle:l,expanded:a=!1})=>S.createElement(St.PanelHeader,{onClick:l,expanded:a,"data-cy":s["data-cy"]},S.createElement(El.xz,null,S.createElement(St.PanelHeaderTitle,null,t),S.createElement(St.ShelfIcon,{direction:a?"down":"right"})),n&&S.createElement(Sp.CrossIcon,{size:"14px",color:"--color-error"})||null,i&&S.createElement(Sp.LockIcon,{size:"14px",color:"--color-success"})||null);return S.createElement(aA,oA(sA({className:"panel-try-it-nested"},s),{header:o}))}const aA=(0,Xe.ZP)(St.Panel)`
|
|
118
|
+
${St.PanelHeader} {
|
|
119
119
|
border: 1px solid
|
|
120
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
|
+
${St.PanelBody} {
|
|
125
125
|
border: 1px solid
|
|
126
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 fA=h(4296),uA=h(62701),cA=h(18373);const hA=(0,Xe.ZP)(hp.A3)`
|
|
130
130
|
border-radius: var(--panel-border-radius);
|
|
131
131
|
margin-bottom: 10px;
|
|
132
|
-
`;var
|
|
132
|
+
`;var Dl=h(42112),Zf=h(34716),dA=h(66291),pA=Object.defineProperty,gA=Object.defineProperties,mA=Object.getOwnPropertyDescriptors,Op=Object.getOwnPropertySymbols,vA=Object.prototype.hasOwnProperty,yA=Object.prototype.propertyIsEnumerable,Tp=(r,e,t)=>e in r?pA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bA=(r,e)=>{for(var t in e||(e={}))vA.call(e,t)&&Tp(r,t,e[t]);if(Op)for(var t of Op(e))yA.call(e,t)&&Tp(r,t,e[t]);return r},xA=(r,e)=>gA(r,mA(e)),wA=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});const Ep=(0,S.forwardRef)(({schema:r,contentName:e,onChange:t,fieldName:n,className:i,accept:s,multiple:o},l)=>{const{register:a}=(0,kt.Gc)(),f=u=>wA(void 0,null,function*(){const c=yield Ak(u.target.files,r);t(e,c)});return S.createElement("input",xA(bA({},a(n)),{"data-cy":"file-upload-input",type:"file",id:n,className:i,name:n,onChange:f,multiple:o,accept:s,ref:l}))});Ep.displayName="FileUpload";var qf=h(21156);function SA({mediaType:r,onChange:e}){var t;const{setValue:n}=(0,kt.Gc)(),i=r.examples||{},{exampleKey:s}=(0,Zf.C6)(r.operation,i),o=(t=i[s])==null?void 0:t.rawValue,l=AA(r);(0,S.useEffect)(()=>n&&l.forEach(f=>{var u,c;const d=o?.[f.name],p=(c=(u=f.example)!=null?u:d?.example)!=null?c:d,g=typeof p=="object"?JSON.stringify(p):p;p!==void 0&&n("body."+f.name,`${g}`)}),[s]);const a=r.schema||{};return sp(a,r.name)?S.createElement(Pp,null,S.createElement(Se.NI,null,S.createElement(Ip,{fullWidth:!0,fieldName:`body.${r.name}`,accept:ip(r.name),schema:a,contentName:r.name,onChange:e}))):a.type!==an.DefinitionTypes.OBJECT&&!l?(console.warn(`Invalid schema for request body and mime type: "${r.name}"`,a),null):S.createElement(Pp,null,l.map(f=>{const u=f.schema||{contentMediaType:"",type:"",description:""},c=r.name===Dl.Tr.MULTIPART&&kk(u),d=u.contentMediaType||"",p=c?S.createElement(Ip,{fullWidth:!0,fieldName:"body."+f.name,accept:ip(d),multiple:u.type==="array",schema:u,contentName:f.name,onChange:e}):S.createElement(ut.Xn,{fullWidth:!0,id:"body."+f.name,fieldName:"body."+f.name,placeholder:(0,Pe.bG)(u.description)||f.name,panel:"try-it"});return S.createElement(Se.NI,{key:f.name},S.createElement(Se.lX,null,f.name,":"),p)}))}const kA=(0,S.memo)(SA);function AA(r){var e,t,n,i,s,o;const{activeOneOf:l}=(0,dA.Sb)((0,qf.N)(r.operation.pointer)),a=(t=l[((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[a].fields)||[]:((o=r.schema)==null?void 0:o.fields)||[]).filter(f=>!f.schema.readOnly)}const Pp=Xe.ZP.div`
|
|
133
133
|
> div {
|
|
134
134
|
margin-top: 10px;
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
137
|
-
${(0,
|
|
136
|
+
`,Ip=(0,Xe.ZP)(Ep)`
|
|
137
|
+
${(0,ut.Hu)("try-it")};
|
|
138
138
|
${({inputType:r})=>r==="password"?"padding-right: 40px;":""};
|
|
139
139
|
${({fullWidth:r})=>r?"width: 100%;":""}
|
|
140
|
-
`,Od=1024;let MS=0;class Rr{constructor(e,t){this.from=e,this.to=t}}class Le{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]}}}Le.closedBy=new Le({deserialize:r=>r.split(" ")}),Le.openedBy=new Le({deserialize:r=>r.split(" ")}),Le.group=new Le({deserialize:r=>r.split(" ")}),Le.contextHash=new Le({perNode:!0}),Le.lookAhead=new Le({perNode:!0}),Le.mounted=new Le({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[Le.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(Le.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(Le.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(Le.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=[Le.contextHash,c];U=U?[G].concat(U):[G]}if(B>25){let G=[Le.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 Le({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[Le.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(Le.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(Le.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(Le.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=Le[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 Le;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),
|
|
142
|
-
`){[e,t]=
|
|
143
|
-
`){[e,t]=
|
|
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=
|
|
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 Le;function Mm(r){return pe.define({combine:r?e=>e.concat(r):void 0})}const _C=new Le;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(Le.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 Le;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(Le.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 Le;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 Le;function Vu(r,e,t){let n=r.prop(e<0?Le.openedBy:Le.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==`
|
|
140
|
+
`,Mp=1024;let CA=0;class Wr{constructor(e,t){this.from=e,this.to=t}}class Re{constructor(e={}){this.id=CA++,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=ar.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.isolate=new Re({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}}),Re.contextHash=new Re({perNode:!0}),Re.lookAhead=new Re({perNode:!0}),Re.mounted=new Re({perNode:!0});class so{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 OA=Object.create(null);class ar{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):OA,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new ar(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}}}}ar.none=new ar("",Object.create(null),0,8);class Nl{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 ar(n.name,i,n.id,n.flags):n)}return new Nl(t)}}const Rl=new WeakMap,Dp=new WeakMap;var ct;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(ct||(ct={}));class gt{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,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=so.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 Ll(this.topNode,e)}cursorAt(e,t=0,n=0){let i=Rl.get(this)||this.topNode,s=new Ll(i);return s.moveTo(e,t),Rl.set(this,s._tree),s}get topNode(){return new Zt(this,0,0,null)}resolve(e,t=0){let n=oo(Rl.get(this)||this.topNode,e,t,!1);return Rl.set(this,n),n}resolveInner(e,t=0){let n=oo(Dp.get(this)||this.topNode,e,t,!0);return Dp.set(this,n),n}resolveStack(e,t=0){return PA(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&ct.IncludeAnonymous)>0;for(let a=this.cursor(o|ct.IncludeAnonymous);;){let f=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;f=!0}for(;f&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;f=!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:nu(ar.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new gt(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new gt(ar.none,t,n,i)))}static build(e){return IA(e)}}gt.empty=new gt(ar.none,[],[],0);class eu{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 eu(this.buffer,this.index)}}class ti{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return ar.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,l=-1;for(let a=e;a!=t&&!(Np(s,i,o[a+1],o[a+2])&&(l=a,n>0));a=o[a+3]);return l}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=i[l++],s[a++]=i[l++]-n;let f=s[a++]=i[l++]-n;s[a++]=i[l++]-e,o=Math.max(o,f)}return new ti(s,o,this.set)}}function Np(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 oo(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 Zt&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:ct.IgnoreOverlays;if(n)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof Zt&&o.index<0&&((i=l.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class Rp{cursor(e=0){return new Ll(this,e)}getChild(e,t=null,n=null){let i=Lp(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Lp(this,e,t,n)}resolve(e,t=0){return oo(this,e,t,!1)}resolveInner(e,t=0){return oo(this,e,t,!0)}matchContext(e){return tu(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 Zt extends Rp{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:l,positions:a}=o._tree,f=t>0?l.length:-1;e!=f;e+=t){let u=l[e],c=a[e]+o.from;if(Np(i,n,c,c+u.length)){if(u instanceof ti){if(s&ct.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-c,i);if(d>-1)return new fn(new TA(o,u,e,c),null,d)}else if(s&ct.IncludeAnonymous||!u.type.isAnonymous||ru(u)){let d;if(!(s&ct.IgnoreMounts)&&(d=so.get(u))&&!d.overlay)return new Zt(d.tree,c,e,o);let p=new Zt(u,c,e,o);return s&ct.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&ct.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&ct.IgnoreOverlays)&&(i=so.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?l>=s:l>s))return new Zt(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 Lp(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!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 tu(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 TA{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class fn extends Rp{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 fn(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&ct.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 fn(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 fn(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 fn(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 gt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Bp(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 Zt&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new EA(i,t)}class EA{constructor(e,t){this.heads=e,this.node=t}get next(){return Bp(this.heads)}}function PA(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof Zt?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=so.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Zt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(oo(l,e,t,!1))}}return i?Bp(i):n}class Ll{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 Zt)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 Zt?(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&ct.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ct.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ct.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 l=n._tree.children[s];if(this.mode&ct.IncludeAnonymous||l instanceof ti||!l.type.isAnonymous||ru(l))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 fn(this.buffer,t,this.stack[i]);return this.bufferNode=new fn(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 tu(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 tu(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 ru(r){return r.children.some(e=>e instanceof ti||!e.type.isAnonymous||ru(e))}function IA(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=Mp,reused:s=[],minRepeatType:o=n.types.length}=r,l=Array.isArray(t)?new eu(t,t.length):t,a=n.types,f=0,u=0;function c(M,F,D,U,L,$){let{id:W,start:Y,end:le,size:fe}=l,me=u;for(;fe<0;)if(l.next(),fe==-1){let Ae=s[W];D.push(Ae),U.push(Y-M);return}else if(fe==-3){f=W;return}else if(fe==-4){u=W;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let Te=a[W],ye,Ce,He=Y-M;if(le-Y<=i&&(Ce=x(l.pos-F,L))){let Ae=new Uint16Array(Ce.size-Ce.skip),Le=l.pos-Ce.size,Ye=Ae.length;for(;l.pos>Le;)Ye=k(Ce.start,Ae,Ye);ye=new ti(Ae,le-Ce.start,n),He=Ce.start-M}else{let Ae=l.pos-fe;l.next();let Le=[],Ye=[],at=W>=o?W:-1,yt=0,Ht=le;for(;l.pos>Ae;)at>=0&&l.id==at&&l.size>=0?(l.end<=Ht-i&&(g(Le,Ye,Y,yt,l.end,Ht,at,me),yt=Le.length,Ht=l.end),l.next()):$>2500?d(Y,Ae,Le,Ye):c(Y,Ae,Le,Ye,at,$+1);if(at>=0&&yt>0&&yt<Le.length&&g(Le,Ye,Y,yt,Y,Ht,at,me),Le.reverse(),Ye.reverse(),at>-1&&yt>0){let bt=p(Te);ye=nu(Te,Le,Ye,0,Le.length,0,le-Y,bt,bt)}else ye=y(Te,Le,Ye,le-Y,me-le)}D.push(ye),U.push(He)}function d(M,F,D,U){let L=[],$=0,W=-1;for(;l.pos>F;){let{id:Y,start:le,end:fe,size:me}=l;if(me>4)l.next();else{if(W>-1&&le<W)break;W<0&&(W=fe-i),L.push(Y,le,fe),$++,l.next()}}if($){let Y=new Uint16Array($*4),le=L[L.length-2];for(let fe=L.length-3,me=0;fe>=0;fe-=3)Y[me++]=L[fe],Y[me++]=L[fe+1]-le,Y[me++]=L[fe+2]-le,Y[me++]=me;D.push(new ti(Y,L[2]-le,n)),U.push(le-M)}}function p(M){return(F,D,U)=>{let L=0,$=F.length-1,W,Y;if($>=0&&(W=F[$])instanceof gt){if(!$&&W.type==M&&W.length==U)return W;(Y=W.prop(Re.lookAhead))&&(L=D[$]+W.length+Y)}return y(M,F,D,U,L)}}function g(M,F,D,U,L,$,W,Y){let le=[],fe=[];for(;M.length>U;)le.push(M.pop()),fe.push(F.pop()+D-L);M.push(y(n.types[W],le,fe,$-L,Y-$)),F.push(L-D)}function y(M,F,D,U,L=0,$){if(f){let W=[Re.contextHash,f];$=$?[W].concat($):[W]}if(L>25){let W=[Re.lookAhead,L];$=$?[W].concat($):[W]}return new gt(M,F,D,U,$)}function x(M,F){let D=l.fork(),U=0,L=0,$=0,W=D.end-i,Y={size:0,start:0,skip:0};e:for(let le=D.pos-M;D.pos>le;){let fe=D.size;if(D.id==F&&fe>=0){Y.size=U,Y.start=L,Y.skip=$,$+=4,U+=4,D.next();continue}let me=D.pos-fe;if(fe<0||me<le||D.start<W)break;let Te=D.id>=o?4:0,ye=D.start;for(D.next();D.pos>me;){if(D.size<0)if(D.size==-3)Te+=4;else break e;else D.id>=o&&(Te+=4);D.next()}L=ye,U+=fe,$+=Te}return(F<0||U==M)&&(Y.size=U,Y.start=L,Y.skip=$),Y.size>4?Y:void 0}function k(M,F,D){let{id:U,start:L,end:$,size:W}=l;if(l.next(),W>=0&&U<o){let Y=D;if(W>4){let le=l.pos-(W-4);for(;l.pos>le;)D=k(M,F,D)}F[--D]=Y,F[--D]=$-M,F[--D]=L-M,F[--D]=U}else W==-3?f=U:W==-4&&(u=U);return D}let E=[],O=[];for(;l.pos>0;)c(r.start||0,r.bufferStart||0,E,O,-1,0);let j=(e=r.length)!==null&&e!==void 0?e:E.length?O[0]+E[0].length:0;return new gt(a[r.topID],E.reverse(),O.reverse(),j)}const Fp=new WeakMap;function Bl(r,e){if(!r.isAnonymous||e instanceof ti||e.type!=r)return 1;let t=Fp.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof gt)){t=1;break}t+=Bl(r,n)}Fp.set(e,t)}return t}function nu(r,e,t,n,i,s,o,l,a){let f=0;for(let g=n;g<i;g++)f+=Bl(r,e[g]);let u=Math.ceil(f*1.5/8),c=[],d=[];function p(g,y,x,k,E){for(let O=x;O<k;){let j=O,M=y[O],F=Bl(r,g[O]);for(O++;O<k;O++){let D=Bl(r,g[O]);if(F+D>=u)break;F+=D}if(O==j+1){if(F>u){let D=g[j];p(D.children,D.positions,0,D.children.length,y[j]+E);continue}c.push(g[j])}else{let D=y[O-1]+g[O-1].length-M;c.push(nu(r,g,y,j,O,M,D,null,a))}d.push(M+E-s)}}return p(e,t,n,i,0),(l||a)(c,d,o)}class nR{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 fn?this.setBuffer(e.context.buffer,e.index,t):e instanceof Zt&&this.map.set(e.tree,t)}get(e){return e instanceof fn?this.getBuffer(e.context.buffer,e.index):e instanceof Zt?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 Bn{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 Bn(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 l=0,a=0,f=0;;l++){let u=l<t.length?t[l]:null,c=u?u.fromA:1e9;if(c-a>=n)for(;o&&o.from<c;){let d=o;if(a>=d.from||c<=d.to||f){let p=Math.max(d.from,a)-f,g=Math.min(d.to,c)-f;d=p>=g?null:new Bn(p,g,d.tree,d.offset+f,l>0,!!u)}if(d&&i.push(d),o.to>c)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,f=u.toA-u.toB}return i}}class jp{startParse(e,t,n){return typeof e=="string"&&(e=new MA(e)),n=n?n.length?n.map(i=>new Wr(i.from,i.to)):[new Wr(0,0)]:[new Wr(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 MA{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 iR(r){return(e,t,n,i)=>new NA(e,r,t,n,i)}class Vp{constructor(e,t,n,i,s){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=s}}function Wp(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class DA{constructor(e,t,n,i,s,o,l){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const iu=new Re({perNode:!0});class NA{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 gt(n.type,n.children,n.positions,n.length,n.propValues.concat([[iu,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 so(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 BA(this.fragments),t=null,n=null,i=new Ll(new Zt(this.baseTree,this.ranges[0].from,0,null),ct.IncludeAnonymous|ct.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let f=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(f)for(let u of f.mount.overlay){let c=u.from+f.pos,d=u.to+f.pos;c>=i.from&&d<=i.to&&!t.ranges.some(p=>p.from<d&&p.to>c)&&t.ranges.push({from:c,to:d})}}l=!1}else if(n&&(o=RA(n.ranges,i.from,i.to)))l=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||LA(i);let f=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new DA(s.parser,s.overlay,f,this.inner.length,i.from,i.tree,t);else{let u=zp(this.ranges,s.overlay||(i.from<i.to?[new Wr(i.from,i.to)]:[]));u.length&&Wp(u),(u.length||!s.overlay)&&this.inner.push(new Vp(s.parser,u.length?s.parser.startParse(this.input,Up(f,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(c=>new Wr(c.from-i.from,c.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):l=!1}}else t&&(a=t.predicate(i))&&(a===!0&&(a=new Wr(i.from,i.to)),a.from<a.to&&t.ranges.push(a));if(l&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let f=zp(this.ranges,t.ranges);f.length&&(Wp(f),this.inner.splice(t.index,0,new Vp(t.parser,t.parser.startParse(this.input,Up(t.mounts,f),f),t.ranges.map(u=>new Wr(u.from-t.start,u.to-t.start)),t.target,f[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function RA(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 $p(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 LA(r){let{node:e}=r,t=[],n=e.context.buffer;do t.push(r.index),r.parent();while(!r.tree);let i=r.tree,s=i.children.indexOf(n),o=i.children[s],l=o.buffer,a=[s];function f(u,c,d,p,g,y){let x=t[y],k=[],E=[];$p(o,u,x,k,E,p);let O=l[x+1],j=l[x+2];a.push(k.length);let M=y?f(x+4,l[x+3],o.set.types[l[x]],O,j-O,y-1):e.toTree();return k.push(M),E.push(O-p),$p(o,l[x+3],c,k,E,p),new gt(d,k,E,g)}i.children[s]=f(0,l.length,ar.none,0,o.length,t.length-1);for(let u of a){let c=r.tree.children[u],d=r.tree.positions[u];r.yield(new Zt(c,d+r.from,u,r._tree))}}class Hp{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(ct.IncludeAnonymous|ct.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,ct.IgnoreOverlays|ct.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 gt)t=t.children[0];else break}return!1}}class BA{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(iu))!==null&&t!==void 0?t:n.to,this.inner=new Hp(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(iu))!==null&&e!==void 0?e:t.to,this.inner=new Hp(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 l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&i.push({frag:a,pos:s.from-a.offset,mount:o})}}}return i}}function zp(r,e){let t=null,n=e;for(let i=1,s=0;i<r.length;i++){let o=r[i-1].to,l=r[i].from;for(;s<n.length;s++){let a=n[s];if(a.from>=l)break;a.to<=o||(t||(n=t=e.slice()),a.from<o?(t[s]=new Wr(a.from,o),a.to>l&&t.splice(s+1,0,new Wr(l,a.to))):a.to>l?t[s--]=new Wr(l,a.to):t.splice(s--,1))}}return n}function FA(r,e,t,n){let i=0,s=0,o=!1,l=!1,a=-1e9,f=[];for(;;){let u=i==r.length?1e9:o?r[i].to:r[i].from,c=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let d=Math.max(a,t),p=Math.min(u,c,n);d<p&&f.push(new Wr(d,p))}if(a=Math.min(u,c),a==1e9)break;u==a&&(o?(o=!1,i++):o=!0),c==a&&(l?(l=!1,s++):l=!0)}return f}function Up(r,e){let t=[];for(let{pos:n,mount:i,frag:s}of r){let o=n+(i.overlay?i.overlay[0].from:0),l=o+i.tree.length,a=Math.max(s.from,o),f=Math.min(s.to,l);if(i.overlay){let u=i.overlay.map(d=>new Wr(d.from+n,d.to+n)),c=FA(e,u,a,f);for(let d=0,p=a;;d++){let g=d==c.length,y=g?f:c[d].from;if(y>p&&t.push(new Bn(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),g)break;p=c[d].to}}else t.push(new Bn(a,f,i.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}class Fl{constructor(e,t,n,i,s,o,l,a,f,u=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=f,this.lookAhead=u,this.parent=c}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 Fl(e,[],t,n,n,0,[],0,i?new Gp(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 l=this.stack.length-(n-1)*3-(e&262144?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,f=this.reducePos-a;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=f));let u=l?this.stack[l-1]:0,c=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,a,d,c+4,!0)}if(e&262144)this.state=this.stack[l];else{let d=this.stack[l-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}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,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==n)return;if(o.buffer[l-2]>=t){o.buffer[l-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 Fl(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 jA(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((l,a)=>a&1&&l==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 l=(o>>19)-s;if(l>1){let a=o&65535,f=this.stack.length-l*3;if(f>=0&&e.getGoto(this.stack[f],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};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 Gp(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 Gp{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class jA{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 jl{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 jl(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 jl(this.stack,this.pos,this.index)}}function lo(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++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class Vl{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Kp=new Vl;class VA{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Kp,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,l=this.range;for(;l.to<=n;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.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=Kp,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 fs{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yp(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}fs.prototype.contextual=fs.prototype.fallback=fs.prototype.extend=!1;class WA{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?lo(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Yp(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))}}WA.prototype.contextual=fs.prototype.fallback=fs.prototype.extend=!1;class sR{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Yp(r,e,t,n,i,s){let o=0,l=1<<n,{dialect:a}=t.p.parser;e:for(;l&r[o];){let f=r[o+1];for(let p=o+3;p<f;p+=2)if((r[p+1]&l)>0){let g=r[p];if(a.allows(g)&&(e.token.value==-1||e.token.value==g||$A(g,e.token.value,i,s))){e.acceptToken(g);break}}let u=e.next,c=0,d=r[o+2];if(e.next<0&&d>c&&r[f+d*3-3]==65535){o=r[f+d*3-1];continue e}for(;c<d;){let p=c+d>>1,g=f+p+(p<<1),y=r[g],x=r[g+1]||65536;if(u<y)d=p;else if(u>=x)c=p+1;else{o=r[g+2],e.advance();continue e}}break}}function _p(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function $A(r,e,t,n){let i=_p(t,n,e);return i<0||_p(t,n,r)<i}const Ar=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let su=null;function Jp(r,e,t){let n=r.cursor(ct.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 HA{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?Jp(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Jp(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 gt){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(Re.lookAhead);if(!a||l+a<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 zA{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Vl)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let f=0;f<s.length;f++){if(!(1<<f&o))continue;let u=s[f],c=this.tokens[f];if(!(n&&!u.fallback)&&((u.contextual||c.start!=e.pos||c.mask!=o||c.context!=l)&&(this.updateCachedToken(c,u,e),c.mask=o,c.context=l),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let d=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!u.extend&&(n=c,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Vl,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 Vl,{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 l=s.specializers[o](this.stream.read(e.start,e.end),n);if(l>=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,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:l}=o;for(let a=0;a<2;a++)for(let f=o.stateSlot(s,a?2:1);;f+=3){if(l[f]==65535)if(l[f+1]==1)f=Fn(l,f+2);else{i==0&&l[f+1]==2&&(i=this.putAction(Fn(l,f+2),t,n,i));break}l[f]==t&&(i=this.putAction(Fn(l,f+1),t,n,i))}return i}}class UA{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 VA(t,i),this.tokens=new zA(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[Fl.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new HA(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 l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)n.push(l);else{if(this.advanceStack(l,n,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=i&&KA(i);if(o)return Ar&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ar&&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 Ar&&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((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let l=n[o];for(let a=o+1;a<n.length;a++){let f=n[a];if(l.sameState(f)||l.buffer.length>500&&f.buffer.length>500)if((l.score-f.score||l.buffer.length-f.buffer.length)>0)n.splice(a--,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=Ar?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let f=e.curContext&&e.curContext.tracker.strict,u=f?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let d=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(d>-1&&c.length&&(!f||(c.prop(Re.contextHash)||0)==u))return e.useNode(c,d),Ar&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof gt)||c.children.length==0||c.positions[0]>0)break;let p=c.children[0];if(p instanceof gt&&c.positions[0]==0)c=p;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Ar&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let f=0;f<a.length;){let u=a[f++],c=a[f++],d=a[f++],p=f==a.length||!n,g=p?e:e.split(),y=this.tokens.mainToken;if(g.apply(u,c,y?y.start:g.pos,d),Ar&&console.log(o+this.stackID(g)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(c)} @ ${i}${g==e?"":", split"})`),p)return!0;g.pos>i?t.push(g):n.push(g)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Xp(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],f=t[(o<<1)+1],u=Ar?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Ar&&console.log(u+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let c=l.split(),d=u;for(let p=0;c.forceReduce()&&p<10&&(Ar&&console.log(d+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));p++)Ar&&(d=this.stackID(c)+" -> ");for(let p of l.recoverByInsert(a))Ar&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>l.pos?(f==l.pos&&(f++,a=0),l.recoverByDelete(a,f),Ar&&console.log(u+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Xp(l,n)):(!i||i.score<l.score)&&(i=l)}return i}stackToTree(e){return e.close(),gt.build({buffer:jl.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=(su||(su=new WeakMap)).get(e);return t||su.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Xp(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 GA{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const ou=r=>r;class oR{constructor(e){this.start=e.start,this.shift=e.shift||ou,this.reduce=e.reduce||ou,this.reuse=e.reuse||ou,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Wl extends jp{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 l=0;l<e.repeatNodeCount;l++)t.push("");let n=Object.keys(e.topRules).map(l=>e.topRules[l][1]),i=[];for(let l=0;l<t.length;l++)i.push([]);function s(l,a,f){i[l].push([a,a.deserialize(String(f))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=Re[a]);for(let f=1;f<l.length;){let u=l[f++];if(u>=0)s(u,a,l[f++]);else{let c=l[f+-u];for(let d=-u;d>0;d--)s(l[f++],a,c);f++}}}this.nodeSet=new Nl(t.map((l,a)=>ar.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Mp;let o=lo(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(Qp),this.states=lo(e.states,Uint32Array),this.data=lo(e.stateData),this.goto=lo(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new fs(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new UA(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++],l=o&1,a=i[s++];if(l&&n)return a;for(let f=s+(o>>1);s<f;s++)if(i[s]==e)return a;if(l)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=Fn(n,s+2)];else{if(n[s+1]==2)return Fn(n,s+2);break}if(o==t||o==0)return Fn(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=Fn(this.data,s+2);else break;i=t(Fn(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=Fn(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(Wl.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(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Qp(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]],l;(l=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[l]=1;return new GA(e,n,i)}static deserialize(e){return new Wl(e)}}function Fn(r,e){return r[e]|r[e+1]<<16}function KA(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 Qp(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}const YA=1024;let _A=0;class $r{constructor(e,t){this.from=e,this.to=t}}class Qe{constructor(e={}){this.id=_A++,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=pr.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Qe.closedBy=new Qe({deserialize:r=>r.split(" ")}),Qe.openedBy=new Qe({deserialize:r=>r.split(" ")}),Qe.group=new Qe({deserialize:r=>r.split(" ")}),Qe.contextHash=new Qe({perNode:!0}),Qe.lookAhead=new Qe({perNode:!0}),Qe.mounted=new Qe({perNode:!0});class ao{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Qe.mounted.id]}}const JA=Object.create(null);class pr{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):JA,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new pr(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(Qe.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(Qe.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}}pr.none=new pr("",Object.create(null),0,8);class lu{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 pr(n.name,i,n.id,n.flags):n)}return new lu(t)}}const $l=new WeakMap,Zp=new WeakMap;var mt;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(mt||(mt={}));class Rt{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,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=ao.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 Hl(this.topNode,e)}cursorAt(e,t=0,n=0){let i=$l.get(this)||this.topNode,s=new Hl(i);return s.moveTo(e,t),$l.set(this,s._tree),s}get topNode(){return new qt(this,0,0,null)}resolve(e,t=0){let n=fo($l.get(this)||this.topNode,e,t,!1);return $l.set(this,n),n}resolveInner(e,t=0){let n=fo(Zp.get(this)||this.topNode,e,t,!0);return Zp.set(this,n),n}resolveStack(e,t=0){return ZA(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&mt.IncludeAnonymous)>0;for(let a=this.cursor(o|mt.IncludeAnonymous);;){let f=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;f=!0}for(;f&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;f=!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:cu(pr.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new Rt(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new Rt(pr.none,t,n,i)))}static build(e){return qA(e)}}Rt.empty=new Rt(pr.none,[],[],0);class au{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 au(this.buffer,this.index)}}class ri{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return pr.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,l=-1;for(let a=e;a!=t&&!(qp(s,i,o[a+1],o[a+2])&&(l=a,n>0));a=o[a+3]);return l}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=i[l++],s[a++]=i[l++]-n;let f=s[a++]=i[l++]-n;s[a++]=i[l++]-e,o=Math.max(o,f)}return new ri(s,o,this.set)}}function qp(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 fo(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 qt&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:mt.IgnoreOverlays;if(n)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof qt&&o.index<0&&((i=l.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=l);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class eg{cursor(e=0){return new Hl(this,e)}getChild(e,t=null,n=null){let i=tg(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return tg(this,e,t,n)}resolve(e,t=0){return fo(this,e,t,!1)}resolveInner(e,t=0){return fo(this,e,t,!0)}matchContext(e){return fu(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 qt extends eg{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:l,positions:a}=o._tree,f=t>0?l.length:-1;e!=f;e+=t){let u=l[e],c=a[e]+o.from;if(qp(i,n,c,c+u.length)){if(u instanceof ri){if(s&mt.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-c,i);if(d>-1)return new un(new XA(o,u,e,c),null,d)}else if(s&mt.IncludeAnonymous||!u.type.isAnonymous||uu(u)){let d;if(!(s&mt.IgnoreMounts)&&(d=ao.get(u))&&!d.overlay)return new qt(d.tree,c,e,o);let p=new qt(u,c,e,o);return s&mt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&mt.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&mt.IgnoreOverlays)&&(i=ao.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?l>=s:l>s))return new qt(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 tg(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 fu(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 XA{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class un extends eg{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 un(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&mt.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 un(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 un(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 un(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 Rt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function rg(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 qt&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new QA(i,t)}class QA{constructor(e,t){this.heads=e,this.node=t}get next(){return rg(this.heads)}}function ZA(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof qt?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=ao.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new qt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(fo(l,e,t,!1))}}return i?rg(i):n}class Hl{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 qt)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 qt?(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&mt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&mt.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 l=n._tree.children[s];if(this.mode&mt.IncludeAnonymous||l instanceof ri||!l.type.isAnonymous||uu(l))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 un(this.buffer,t,this.stack[i]);return this.bufferNode=new un(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 fu(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 fu(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 uu(r){return r.children.some(e=>e instanceof ri||!e.type.isAnonymous||uu(e))}function qA(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=YA,reused:s=[],minRepeatType:o=n.types.length}=r,l=Array.isArray(t)?new au(t,t.length):t,a=n.types,f=0,u=0;function c(M,F,D,U,L,$){let{id:W,start:Y,end:le,size:fe}=l,me=u;for(;fe<0;)if(l.next(),fe==-1){let Ae=s[W];D.push(Ae),U.push(Y-M);return}else if(fe==-3){f=W;return}else if(fe==-4){u=W;return}else throw new RangeError(`Unrecognized record size: ${fe}`);let Te=a[W],ye,Ce,He=Y-M;if(le-Y<=i&&(Ce=x(l.pos-F,L))){let Ae=new Uint16Array(Ce.size-Ce.skip),Le=l.pos-Ce.size,Ye=Ae.length;for(;l.pos>Le;)Ye=k(Ce.start,Ae,Ye);ye=new ri(Ae,le-Ce.start,n),He=Ce.start-M}else{let Ae=l.pos-fe;l.next();let Le=[],Ye=[],at=W>=o?W:-1,yt=0,Ht=le;for(;l.pos>Ae;)at>=0&&l.id==at&&l.size>=0?(l.end<=Ht-i&&(g(Le,Ye,Y,yt,l.end,Ht,at,me),yt=Le.length,Ht=l.end),l.next()):$>2500?d(Y,Ae,Le,Ye):c(Y,Ae,Le,Ye,at,$+1);if(at>=0&&yt>0&&yt<Le.length&&g(Le,Ye,Y,yt,Y,Ht,at,me),Le.reverse(),Ye.reverse(),at>-1&&yt>0){let bt=p(Te);ye=cu(Te,Le,Ye,0,Le.length,0,le-Y,bt,bt)}else ye=y(Te,Le,Ye,le-Y,me-le)}D.push(ye),U.push(He)}function d(M,F,D,U){let L=[],$=0,W=-1;for(;l.pos>F;){let{id:Y,start:le,end:fe,size:me}=l;if(me>4)l.next();else{if(W>-1&&le<W)break;W<0&&(W=fe-i),L.push(Y,le,fe),$++,l.next()}}if($){let Y=new Uint16Array($*4),le=L[L.length-2];for(let fe=L.length-3,me=0;fe>=0;fe-=3)Y[me++]=L[fe],Y[me++]=L[fe+1]-le,Y[me++]=L[fe+2]-le,Y[me++]=me;D.push(new ri(Y,L[2]-le,n)),U.push(le-M)}}function p(M){return(F,D,U)=>{let L=0,$=F.length-1,W,Y;if($>=0&&(W=F[$])instanceof Rt){if(!$&&W.type==M&&W.length==U)return W;(Y=W.prop(Qe.lookAhead))&&(L=D[$]+W.length+Y)}return y(M,F,D,U,L)}}function g(M,F,D,U,L,$,W,Y){let le=[],fe=[];for(;M.length>U;)le.push(M.pop()),fe.push(F.pop()+D-L);M.push(y(n.types[W],le,fe,$-L,Y-$)),F.push(L-D)}function y(M,F,D,U,L=0,$){if(f){let W=[Qe.contextHash,f];$=$?[W].concat($):[W]}if(L>25){let W=[Qe.lookAhead,L];$=$?[W].concat($):[W]}return new Rt(M,F,D,U,$)}function x(M,F){let D=l.fork(),U=0,L=0,$=0,W=D.end-i,Y={size:0,start:0,skip:0};e:for(let le=D.pos-M;D.pos>le;){let fe=D.size;if(D.id==F&&fe>=0){Y.size=U,Y.start=L,Y.skip=$,$+=4,U+=4,D.next();continue}let me=D.pos-fe;if(fe<0||me<le||D.start<W)break;let Te=D.id>=o?4:0,ye=D.start;for(D.next();D.pos>me;){if(D.size<0)if(D.size==-3)Te+=4;else break e;else D.id>=o&&(Te+=4);D.next()}L=ye,U+=fe,$+=Te}return(F<0||U==M)&&(Y.size=U,Y.start=L,Y.skip=$),Y.size>4?Y:void 0}function k(M,F,D){let{id:U,start:L,end:$,size:W}=l;if(l.next(),W>=0&&U<o){let Y=D;if(W>4){let le=l.pos-(W-4);for(;l.pos>le;)D=k(M,F,D)}F[--D]=Y,F[--D]=$-M,F[--D]=L-M,F[--D]=U}else W==-3?f=U:W==-4&&(u=U);return D}let E=[],O=[];for(;l.pos>0;)c(r.start||0,r.bufferStart||0,E,O,-1,0);let j=(e=r.length)!==null&&e!==void 0?e:E.length?O[0]+E[0].length:0;return new Rt(a[r.topID],E.reverse(),O.reverse(),j)}const ng=new WeakMap;function zl(r,e){if(!r.isAnonymous||e instanceof ri||e.type!=r)return 1;let t=ng.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof Rt)){t=1;break}t+=zl(r,n)}ng.set(e,t)}return t}function cu(r,e,t,n,i,s,o,l,a){let f=0;for(let g=n;g<i;g++)f+=zl(r,e[g]);let u=Math.ceil(f*1.5/8),c=[],d=[];function p(g,y,x,k,E){for(let O=x;O<k;){let j=O,M=y[O],F=zl(r,g[O]);for(O++;O<k;O++){let D=zl(r,g[O]);if(F+D>=u)break;F+=D}if(O==j+1){if(F>u){let D=g[j];p(D.children,D.positions,0,D.children.length,y[j]+E);continue}c.push(g[j])}else{let D=y[O-1]+g[O-1].length-M;c.push(cu(r,g,y,j,O,M,D,null,a))}d.push(M+E-s)}}return p(e,t,n,i,0),(l||a)(c,d,o)}class lR{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 un?this.setBuffer(e.context.buffer,e.index,t):e instanceof qt&&this.map.set(e.tree,t)}get(e){return e instanceof un?this.getBuffer(e.context.buffer,e.index):e instanceof qt?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 jn{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 jn(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 l=0,a=0,f=0;;l++){let u=l<t.length?t[l]:null,c=u?u.fromA:1e9;if(c-a>=n)for(;o&&o.from<c;){let d=o;if(a>=d.from||c<=d.to||f){let p=Math.max(d.from,a)-f,g=Math.min(d.to,c)-f;d=p>=g?null:new jn(p,g,d.tree,d.offset+f,l>0,!!u)}if(d&&i.push(d),o.to>c)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,f=u.toA-u.toB}return i}}class eC{startParse(e,t,n){return typeof e=="string"&&(e=new tC(e)),n=n?n.length?n.map(i=>new $r(i.from,i.to)):[new $r(0,0)]:[new $r(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 tC{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 aR(r){return(e,t,n,i)=>new nC(e,r,t,n,i)}class ig{constructor(e,t,n,i,s){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=s}}function sg(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class rC{constructor(e,t,n,i,s,o,l){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const hu=new Qe({perNode:!0});class nC{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 Rt(n.type,n.children,n.positions,n.length,n.propValues.concat([[hu,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[Qe.mounted.id]=new ao(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 oC(this.fragments),t=null,n=null,i=new Hl(new qt(this.baseTree,this.ranges[0].from,0,null),mt.IncludeAnonymous|mt.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let f=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(f)for(let u of f.mount.overlay){let c=u.from+f.pos,d=u.to+f.pos;c>=i.from&&d<=i.to&&!t.ranges.some(p=>p.from<d&&p.to>c)&&t.ranges.push({from:c,to:d})}}l=!1}else if(n&&(o=iC(n.ranges,i.from,i.to)))l=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||sC(i);let f=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new rC(s.parser,s.overlay,f,this.inner.length,i.from,i.tree,t);else{let u=ag(this.ranges,s.overlay||(i.from<i.to?[new $r(i.from,i.to)]:[]));u.length&&sg(u),(u.length||!s.overlay)&&this.inner.push(new ig(s.parser,u.length?s.parser.startParse(this.input,fg(f,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(c=>new $r(c.from-i.from,c.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):l=!1}}else t&&(a=t.predicate(i))&&(a===!0&&(a=new $r(i.from,i.to)),a.from<a.to&&t.ranges.push(a));if(l&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let f=ag(this.ranges,t.ranges);f.length&&(sg(f),this.inner.splice(t.index,0,new ig(t.parser,t.parser.startParse(this.input,fg(t.mounts,f),f),t.ranges.map(u=>new $r(u.from-t.start,u.to-t.start)),t.target,f[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function iC(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 og(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 sC(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],l=o.buffer,a=[n];function f(u,c,d,p,g,y){let x=t[y],k=[],E=[];og(o,u,x,k,E,p);let O=l[x+1],j=l[x+2];a.push(k.length);let M=y?f(x+4,l[x+3],o.set.types[l[x]],O,j-O,y-1):e.toTree();return k.push(M),E.push(O-p),og(o,l[x+3],c,k,E,p),new Rt(d,k,E,g)}i.children[n]=f(0,l.length,pr.none,0,o.length,t.length-1);for(let u of a){let c=r.tree.children[u],d=r.tree.positions[u];r.yield(new qt(c,d+r.from,u,r._tree))}}class lg{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(mt.IncludeAnonymous|mt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,mt.IgnoreOverlays|mt.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 Rt)t=t.children[0];else break}return!1}}class oC{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(hu))!==null&&t!==void 0?t:n.to,this.inner=new lg(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(hu))!==null&&e!==void 0?e:t.to,this.inner=new lg(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(Qe.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&i.push({frag:a,pos:s.from-a.offset,mount:o})}}}return i}}function ag(r,e){let t=null,n=e;for(let i=1,s=0;i<r.length;i++){let o=r[i-1].to,l=r[i].from;for(;s<n.length;s++){let a=n[s];if(a.from>=l)break;a.to<=o||(t||(n=t=e.slice()),a.from<o?(t[s]=new $r(a.from,o),a.to>l&&t.splice(s+1,0,new $r(l,a.to))):a.to>l?t[s--]=new $r(l,a.to):t.splice(s--,1))}}return n}function lC(r,e,t,n){let i=0,s=0,o=!1,l=!1,a=-1e9,f=[];for(;;){let u=i==r.length?1e9:o?r[i].to:r[i].from,c=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let d=Math.max(a,t),p=Math.min(u,c,n);d<p&&f.push(new $r(d,p))}if(a=Math.min(u,c),a==1e9)break;u==a&&(o?(o=!1,i++):o=!0),c==a&&(l?(l=!1,s++):l=!0)}return f}function fg(r,e){let t=[];for(let{pos:n,mount:i,frag:s}of r){let o=n+(i.overlay?i.overlay[0].from:0),l=o+i.tree.length,a=Math.max(s.from,o),f=Math.min(s.to,l);if(i.overlay){let u=i.overlay.map(d=>new $r(d.from+n,d.to+n)),c=lC(e,u,a,f);for(let d=0,p=a;;d++){let g=d==c.length,y=g?f:c[d].from;if(y>p&&t.push(new jn(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),g)break;p=c[d].to}}else t.push(new jn(a,f,i.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let aC=0;class cn{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=aC++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new cn([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new Ul;return t=>t.modified.indexOf(e)>-1?t:Ul.get(t.base||t,t.modified.concat(e).sort((n,i)=>n.id-i.id))}}let fC=0;class Ul{constructor(){this.instances=[],this.id=fC++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&uC(t,l.modified));if(n)return n;let i=[],s=new cn(i,e,t);for(let l of t)l.instances.push(s);let o=cC(t);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(Ul.get(l,a));return s}}function uC(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function cC(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 du(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,l=i;for(let c=0;;){if(l=="..."&&c>0&&c+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),c+=d[0].length,c==i.length)break;let p=i[c++];if(c==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);l=i.slice(c)}let a=s.length-1,f=s[a];if(!f)throw new RangeError("Invalid path: "+i);let u=new Gl(n,o,a>0?s.slice(0,a):null);e[f]=u.sort(e[f])}}return ug.add(e)}const ug=new Qe;class Gl{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}}Gl.empty=new Gl([],2,null);function pu(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 l of s)for(let a of l.set){let f=t[a.id];if(f){o=o?o+" "+f:f;break}}return o},scope:n}}function hC(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function gu(r,e,t,n=0,i=r.length){let s=new dC(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}function fR(r,e,t,n,i,s=0,o=r.length){let l=s;function a(f,u){if(!(f<=l)){for(let c=r.slice(l,f),d=0;;){let p=c.indexOf(`
|
|
141
|
+
`,d),g=p<0?c.length:p;if(g>d&&n(c.slice(d,g),u),p<0)break;i(),d=p+1}l=f}}gu(e,t,(f,u,c)=>{a(f,""),a(u,c)},s,o),a(o,"")}class dC{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:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let f=i,u=pC(e)||Gl.empty,c=hC(s,u.tags);if(c&&(f&&(f+=" "),f+=c,u.mode==1&&(i+=(i?" ":"")+c)),this.startSpan(Math.max(t,l),f),u.opaque)return;let d=e.tree&&e.tree.prop(Qe.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+l,1),g=this.highlighters.filter(x=>!x.scope||x.scope(d.tree.type)),y=e.firstChild();for(let x=0,k=l;;x++){let E=x<d.overlay.length?d.overlay[x]:null,O=E?E.from+l:a,j=Math.max(t,k),M=Math.min(n,O);if(j<M&&y)for(;e.from<M&&(this.highlightRange(e,j,M,i,s),this.startSpan(Math.min(M,e.to),f),!(e.to>=O||!e.nextSibling())););if(!E||O>n)break;k=E.to+l,k>t&&(this.highlightRange(p.cursor(),Math.max(t,E.from+l),Math.min(n,k),"",g),this.startSpan(Math.min(n,k),f))}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),f)}while(e.nextSibling());e.parent()}}}function pC(r){let e=r.type.prop(ug);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const de=cn.define,Kl=de(),ni=de(),cg=de(ni),hg=de(ni),ii=de(),Yl=de(ii),mu=de(ii),hn=de(),Mi=de(hn),dn=de(),pn=de(),vu=de(),uo=de(vu),_l=de(),P={comment:Kl,lineComment:de(Kl),blockComment:de(Kl),docComment:de(Kl),name:ni,variableName:de(ni),typeName:cg,tagName:de(cg),propertyName:hg,attributeName:de(hg),className:de(ni),labelName:de(ni),namespace:de(ni),macroName:de(ni),literal:ii,string:Yl,docString:de(Yl),character:de(Yl),attributeValue:de(Yl),number:mu,integer:de(mu),float:de(mu),bool:de(ii),regexp:de(ii),escape:de(ii),color:de(ii),url:de(ii),keyword:dn,self:de(dn),null:de(dn),atom:de(dn),unit:de(dn),modifier:de(dn),operatorKeyword:de(dn),controlKeyword:de(dn),definitionKeyword:de(dn),moduleKeyword:de(dn),operator:pn,derefOperator:de(pn),arithmeticOperator:de(pn),logicOperator:de(pn),bitwiseOperator:de(pn),compareOperator:de(pn),updateOperator:de(pn),definitionOperator:de(pn),typeOperator:de(pn),controlOperator:de(pn),punctuation:vu,separator:de(vu),bracket:uo,angleBracket:de(uo),squareBracket:de(uo),paren:de(uo),brace:de(uo),content:hn,heading:Mi,heading1:de(Mi),heading2:de(Mi),heading3:de(Mi),heading4:de(Mi),heading5:de(Mi),heading6:de(Mi),contentSeparator:de(hn),list:de(hn),quote:de(hn),emphasis:de(hn),strong:de(hn),link:de(hn),monospace:de(hn),strikethrough:de(hn),inserted:de(),deleted:de(),changed:de(),invalid:de(),meta:_l,documentMeta:de(_l),annotation:de(_l),processingInstruction:de(_l),definition:cn.defineModifier(),constant:cn.defineModifier(),function:cn.defineModifier(),standard:cn.defineModifier(),local:cn.defineModifier(),special:cn.defineModifier()},uR=pu([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]),gC=du({String:P.string,Number:P.number,"True False":P.bool,PropertyName:P.propertyName,Null:P.null,",":P.separator,"[ ]":P.squareBracket,"{ }":P.brace}),mC=Wl.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:[gC],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 Ze{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]=us(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),gn.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]=us(this,e,t);let n=[];return this.decompose(e,t,n,0),gn.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 co(this),s=new co(e);for(let o=t,l=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(l+=i.value.length,i.done||l>=n)return!0}}iter(e=1){return new co(this,e)}iterRange(e,t=this.length){return new pg(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 gg(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]?Ze.empty:e.length<=32?new At(e):gn.from(At.split(e,[]))}}class At extends Ze{constructor(e,t=vC(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],l=i+o.length;if((t?n:l)>=e)return new yC(i,l,n,o);i=l+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new At(dg(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),l=Jl(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new At(l,o.length+s.length));else{let a=l.length>>1;n.push(new At(l.slice(0,a)),new At(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof At))return super.replace(e,t,n);[e,t]=us(this,e,t);let i=Jl(this.text,Jl(n.text,dg(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new At(i,s):gn.from(At.split(i,[]),s)}sliceString(e,t=this.length,n=`
|
|
142
|
+
`){[e,t]=us(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(i+=n),e<a&&t>s&&(i+=l.slice(Math.max(0,e-s),t-s)),s=a+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 At(n,i)),n=[],i=-1);return i>-1&&t.push(new At(n,i)),t}}class gn extends Ze{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],l=i+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,i);i=l+1,n=a+1}}decompose(e,t,n,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let f=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!f?n.push(l):l.decompose(e-o,t-o,n,f)}o=a+1}}replace(e,t,n){if([e,t]=us(this,e,t),n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,n),f=this.lines-o.lines+a.lines;if(a.lines<f>>5-1&&a.lines>f>>5+1){let u=this.children.slice();return u[i]=a,new gn(u,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
143
|
+
`){[e,t]=us(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(i+=n),e<a&&t>o&&(i+=l.sliceString(e-o,t-o,n)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof gn))return 0;let n=0,[i,s,o,l]=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==l)return n;let a=this.children[i],f=e.children[s];if(a!=f)return n+a.scanIdentical(f,t);n+=a.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 g of e)g.flatten(p);return new At(p,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,l=[],a=0,f=-1,u=[];function c(p){let g;if(p.lines>s&&p instanceof gn)for(let y of p.children)c(y);else p.lines>o&&(a>o||!a)?(d(),l.push(p)):p instanceof At&&a&&(g=u[u.length-1])instanceof At&&p.lines+g.lines<=32?(a+=p.lines,f+=p.length+1,u[u.length-1]=new At(g.text.concat(p.text),g.length+1+p.length)):(a+p.lines>i&&d(),a+=p.lines,f+=p.length+1,u.push(p))}function d(){a!=0&&(l.push(u.length==1?u[0]:gn.from(u,f)),f=-1,a=u.length=0)}for(let p of e)c(p);return d(),l.length==1?l[0]:new gn(l,t)}}Ze.empty=new At([""],0);function vC(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Jl(r,e,t=0,n=1e9){for(let i=0,s=0,o=!0;s<r.length&&i<=n;s++){let l=r[s],a=i+l.length;a>=t&&(a>n&&(l=l.slice(0,n-i)),i<t&&(l=l.slice(t-i)),o?(e[e.length-1]+=l,o=!1):e.push(l)),i=a+1}return e}function dg(r,e,t){return Jl(r,[""],e,t)}class co{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 At?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,l=i instanceof At?i.text.length:i.children.length;if(o==(t>0?l: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 At){let a=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof At?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class pg{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new co(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 gg{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"&&(Ze.prototype[Symbol.iterator]=function(){return this.iter()},co.prototype[Symbol.iterator]=pg.prototype[Symbol.iterator]=gg.prototype[Symbol.iterator]=function(){return this});class yC{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 us(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}let cs="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<cs.length;r++)cs[r]+=cs[r-1];function bC(r){for(let e=1;e<cs.length;e+=2)if(cs[e]>r)return cs[e-1]<=r;return!1}function mg(r){return r>=127462&&r<=127487}const vg=8205;function zt(r,e,t=!0,n=!0){return(t?yg:xC)(r,e,n)}function yg(r,e,t){if(e==r.length)return e;e&&bg(r.charCodeAt(e))&&xg(r.charCodeAt(e-1))&&e--;let n=Ut(r,e);for(e+=Hr(n);e<r.length;){let i=Ut(r,e);if(n==vg||i==vg||t&&bC(i))e+=Hr(i),n=i;else if(mg(i)){let s=0,o=e-2;for(;o>=0&&mg(Ut(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function xC(r,e,t){for(;e>0;){let n=yg(r,e-2,t);if(n<e)return n;e--}return 0}function bg(r){return r>=56320&&r<57344}function xg(r){return r>=55296&&r<56320}function Ut(r,e){let t=r.charCodeAt(e);if(!xg(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return bg(n)?(t-55296<<10)+(n-56320)+65536:t}function yu(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Hr(r){return r<65536?1:2}const bu=/\r\n?|\n/;var fr=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(fr||(fr={}));class mn{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){xu(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 mn(e)}composeDesc(e){return this.empty?e:e.empty?this:wg(this,e)}mapDesc(e,t=!1){return e.empty?this:wu(this,e,t)}mapPos(e,t=-1,n=fr.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],f=i+l;if(a<0){if(f>e)return s+(e-i);s+=l}else{if(n!=fr.Simple&&f>=e&&(n==fr.TrackDel&&i<e&&f>e||n==fr.TrackBefore&&i<e||n==fr.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!l)return e==i||t<0?s:s+a;s+=a}i=f}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++],l=i+s;if(o>=0&&i<=t&&l>=e)return i<e&&l>t?"cover":!0;i=l}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 mn(e)}static create(e){return new mn(e)}}class Lt extends mn{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 xu(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return wu(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],l=t[i+1];if(l>=0){t[i]=l,t[i+1]=o;let a=i>>1;for(;n.length<a;)n.push(Ze.empty);n.push(o?e.slice(s,s+o):Ze.empty)}s+=o}return new Lt(t,n)}compose(e){return this.empty?e:e.empty?this:wg(this,e,!0)}map(e,t=!1){return e.empty?this:wu(this,e,t,!0)}iterChanges(e,t=!1){xu(this,e,t)}get desc(){return mn.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new ho(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,a-l);er(i,u,-1);let c=s.ins==-1?-1:s.off==0?s.ins:0;er(t,u,c),c>0&&si(n,t,s.text),s.forward(u),l+=u}let f=e[o++];for(;l<f;){if(s.done)break e;let u=Math.min(s.len,f-l);er(t,u,-1),er(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),l+=u}}return{changes:new Lt(t,n),filtered:mn.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,l=null;function a(u=!1){if(!u&&!i.length)return;o<t&&er(i,t-o,-1);let c=new Lt(i,s);l=l?l.compose(c.map(l)):c,i=[],s=[],o=0}function f(u){if(Array.isArray(u))for(let c of u)f(c);else if(u instanceof Lt){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);a(),l=l?l.compose(u.map(l)):u}else{let{from:c,to:d=c,insert:p}=u;if(c>d||c<0||d>t)throw new RangeError(`Invalid change range ${c} to ${d} (in doc of length ${t})`);let g=p?typeof p=="string"?Ze.of(p.split(n||bu)):p:Ze.empty,y=g.length;if(c==d&&y==0)return;c<o&&a(),c>o&&er(i,c-o,-1),er(i,d-c,y),si(s,i,g),o=d}}return f(e),a(!l),l}static empty(e){return new Lt(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,l)=>l&&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(Ze.empty);n[i]=Ze.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new Lt(t,n)}static createSet(e,t){return new Lt(e,t)}}function er(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 si(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(Ze.empty);r.push(t)}}function xu(r,e,t){let n=r.inserted;for(let i=0,s=0,o=0;o<r.sections.length;){let l=r.sections[o++],a=r.sections[o++];if(a<0)i+=l,s+=l;else{let f=i,u=s,c=Ze.empty;for(;f+=l,u+=a,a&&n&&(c=c.append(n[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],a=r.sections[o++];e(i,f,s,u,c),i=f,s=u}}}function wu(r,e,t,n=!1){let i=[],s=n?[]:null,o=new ho(r),l=new ho(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let f=Math.min(o.len,l.len);er(i,f,-1),o.forward(f),l.forward(f)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let f=l.len;for(er(i,l.ins,-1);f;){let u=Math.min(o.len,f);o.ins>=0&&a<o.i&&o.len<=u&&(er(i,0,o.ins),s&&si(s,i,o.text),a=o.i),o.forward(u),f-=u}l.next()}else if(o.ins>=0){let f=0,u=o.len;for(;u;)if(l.ins==-1){let c=Math.min(u,l.len);f+=c,u-=c,l.forward(c)}else if(l.ins==0&&l.len<u)u-=l.len,l.next();else break;er(i,f,a<o.i?o.ins:0),s&&a<o.i&&si(s,i,o.text),a=o.i,o.forward(o.len-u)}else{if(o.done&&l.done)return s?Lt.createSet(i,s):mn.create(i);throw new Error("Mismatched change set lengths")}}function wg(r,e,t=!1){let n=[],i=t?[]:null,s=new ho(r),o=new ho(e);for(let l=!1;;){if(s.done&&o.done)return i?Lt.createSet(n,i):mn.create(n);if(s.ins==0)er(n,s.len,0,l),s.next();else if(o.len==0&&!o.done)er(n,0,o.ins,l),i&&si(i,n,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),f=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;er(n,a,u,l),i&&u&&si(i,n,o.text)}else o.ins==-1?(er(n,s.off?0:s.len,a,l),i&&si(i,n,s.textBit(a))):(er(n,s.off?0:s.len,o.off?0:o.ins,l),i&&!o.off&&si(i,n,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||n.length>f),s.forward2(a),o.forward(a)}}}}class ho{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?Ze.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Ze.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 Di{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 Di(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,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return se.range(e.anchor,e.head)}static create(e,t,n){return new Di(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,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],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=>Di.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 Di.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?Di.create(t,e,48|s):Di.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 l=o.from,a=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?se.range(a,l):se.range(l,a))}}return new se(e,t)}}function Sg(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Su=0;class ge{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Su++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ge(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:ku),!!e.static,e.enables)}of(e){return new Xl([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xl(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xl(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function ku(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class Xl{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Su++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,f=!1,u=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?f=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||u.push(e[c.id]);return{create(c){return c.values[o]=n(c),1},update(c,d){if(a&&d.docChanged||f&&(d.docChanged||d.selection)||Au(c,u)){let p=n(c);if(l?!kg(p,c.values[o],i):!i(p,c.values[o]))return c.values[o]=p,1}return 0},reconfigure:(c,d)=>{let p,g=d.config.address[s];if(g!=null){let y=ql(d,g);if(this.dependencies.every(x=>x instanceof ge?d.facet(x)===c.facet(x):x instanceof vt?d.field(x,!1)==c.field(x,!1):!0)||(l?kg(p=n(c),y,i):i(p=n(c),y)))return c.values[o]=y,0}else p=n(c);return c.values[o]=p,1}}}}function kg(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 Au(r,e){let t=!1;for(let n of e)go(r,n)&1&&(t=!0);return t}function wC(r,e,t){let n=t.map(a=>r[a.id]),i=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=r[e.id]>>1;function l(a){let f=[];for(let u=0;u<n.length;u++){let c=ql(a,n[u]);if(i[u]==2)for(let d of c)f.push(d);else f.push(c)}return e.combine(f)}return{create(a){for(let f of n)go(a,f);return a.values[o]=l(a),1},update(a,f){if(!Au(a,s))return 0;let u=l(a);return e.compare(u,a.values[o])?0:(a.values[o]=u,1)},reconfigure(a,f){let u=Au(a,n),c=f.config.facets[e.id],d=f.facet(e);if(c&&!u&&ku(t,c))return a.values[o]=d,0;let p=l(a);return e.compare(p,d)?(a.values[o]=d,0):(a.values[o]=p,1)}}}const Ag=ge.define({static:!0});class vt{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 vt(Su++,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(Ag).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,Ag.of({field:this,create:e})]}get extension(){return this}}const Ni={lowest:4,low:3,default:2,high:1,highest:0};function po(r){return e=>new Cg(e,r)}const vn={highest:po(Ni.highest),high:po(Ni.high),default:po(Ni.default),low:po(Ni.low),lowest:po(Ni.lowest)};class Cg{constructor(e,t){this.inner=e,this.prec=t}}class Ql{of(e){return new Cu(this,e)}reconfigure(e){return Ql.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Cu{constructor(e,t){this.compartment=e,this.inner=t}}class Zl{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 SC(e,t,o))d instanceof vt?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],f=[];for(let d of i)l[d.id]=f.length<<1,f.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],g=p[0].facet,y=u&&u[d]||[];if(p.every(x=>x.type==0))if(l[g.id]=a.length<<1|1,ku(y,p))a.push(n.facet(g));else{let x=g.combine(p.map(k=>k.value));a.push(n&&g.compare(x,n.facet(g))?n.facet(g):x)}else{for(let x of p)x.type==0?(l[x.id]=a.length<<1|1,a.push(x.value)):(l[x.id]=f.length<<1,f.push(k=>x.dynamicSlot(k)));l[g.id]=f.length<<1,f.push(x=>wC(x,g,p))}}let c=f.map(d=>d(l));return new Zl(e,o,c,l,a,s)}}function SC(r,e,t){let n=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let f=n[a].indexOf(o);f>-1&&n[a].splice(f,1),o instanceof Cu&&t.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let f of o)s(f,l);else if(o instanceof Cu){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(o.compartment)||o.inner;t.set(o.compartment,f),s(f,l)}else if(o instanceof Cg)s(o.inner,o.prec);else if(o instanceof vt)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Xl)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,Ni.default);else{let f=o.extension;if(!f)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(f,l)}}return s(r,Ni.default),n.reduce((o,l)=>o.concat(l))}function go(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 ql(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Og=ge.define(),Ou=ge.define({combine:r=>r.some(e=>e),static:!0}),Tg=ge.define({combine:r=>r.length?r[0]:void 0,static:!0}),Eg=ge.define(),Pg=ge.define(),Ig=ge.define(),Mg=ge.define({combine:r=>r.length?r[0]:!1});class yn{constructor(e,t){this.type=e,this.value=t}static define(){return new kC}}class kC{of(e){return new yn(this,e)}}class AC{constructor(e){this.map=e}of(e){return new Oe(this,e)}}class Oe{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 Oe(this.type,t)}is(e){return this.type==e}static define(e={}){return new AC(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}}Oe.reconfigure=Oe.define(),Oe.appendConfig=Oe.define();class Bt{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&&Sg(n,t.newLength),s.some(l=>l.type==Bt.time)||(this.annotations=s.concat(Bt.time.of(Date.now())))}static create(e,t,n,i,s,o){return new Bt(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(Bt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Bt.time=yn.define(),Bt.userEvent=yn.define(),Bt.addToHistory=yn.define(),Bt.remote=yn.define();function CC(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 Dg(r,e,t){var n;let i,s,o;return t?(i=e.changes,s=Lt.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:Oe.mapEffects(r.effects,i).concat(Oe.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Tu(r,e,t){let n=e.selection,i=hs(e.annotations);return e.userEvent&&(i=i.concat(Bt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Lt?e.changes:Lt.of(e.changes||[],t,r.facet(Tg)),selection:n&&(n instanceof se?n:se.single(n.anchor,n.head)),effects:hs(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Ng(r,e,t){let n=Tu(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=Dg(n,Tu(r,e[s],o?n.changes.newLength:r.doc.length),o)}let i=Bt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return TC(t?OC(i):i)}function OC(r){let e=r.startState,t=!0;for(let i of e.facet(Eg)){let s=i(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:CC(t,s))}if(t!==!0){let i,s;if(t===!1)s=r.changes.invertedDesc,i=Lt.empty(e.doc.length);else{let o=r.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=Bt.create(e,i,r.selection&&r.selection.map(s),Oe.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let n=e.facet(Pg);for(let i=n.length-1;i>=0;i--){let s=n[i](r);s instanceof Bt?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Bt?r=s[0]:r=Ng(e,hs(s),!1)}return r}function TC(r){let e=r.startState,t=e.facet(Ig),n=r;for(let i=t.length-1;i>=0;i--){let s=t[i](r);s&&Object.keys(s).length&&(n=Dg(n,Tu(e,s,r.changes.newLength),!0))}return n==r?r:Bt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const EC=[];function hs(r){return r==null?EC:Array.isArray(r)?r:[r]}var ht=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(ht||(ht={}));const PC=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Eu;try{Eu=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function IC(r){if(Eu)return Eu.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||PC.test(t)))return!0}return!1}function MC(r){return e=>{if(!/\S/.test(e))return ht.Space;if(IC(e))return ht.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return ht.Word;return ht.Other}}class je{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 l=0;l<this.config.dynamicSlots.length;l++)go(this,l<<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 go(this,n),ql(this,n)}update(...e){return Ng(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let l of e.effects)l.is(Ql.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,f)=>i.set(f,a)),t=null),i.set(l.value.compartment,l.value.extension)):l.is(Oe.reconfigure)?(t=null,n=l.value):l.is(Oe.appendConfig)&&(t=null,n=hs(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Zl.resolve(n,i,this),s=new je(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,f)=>f.reconfigure(a,this),null).values);let o=e.startState.facet(Ou)?e.newSelection:e.newSelection.asSingle();new je(t,e.newDoc,o,s,(l,a)=>a.update(l,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=hs(n.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),f=this.changes(a.changes),u=f.map(i);for(let d=0;d<l;d++)s[d]=s[d].map(u);let c=i.mapDesc(f,!0);s.push(a.range.map(c)),i=i.compose(u),o=Oe.mapEffects(o,u).concat(Oe.mapEffects(hs(a.effects),c))}return{changes:i,selection:se.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Lt?e:Lt.of(e,this.doc.length,this.facet(je.lineSeparator))}toText(e){return Ze.of(e.split(this.facet(je.lineSeparator)||bu))}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:(go(this,t),ql(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 vt&&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],l=e[s];i.push(o.init(a=>o.spec.fromJSON(l,a)))}}return je.create({doc:e.doc,selection:se.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Zl.resolve(e.extensions||[],new Map),n=e.doc instanceof Ze?e.doc:Ze.of((e.doc||"").split(t.staticFacet(je.lineSeparator)||bu)),i=e.selection?e.selection instanceof se?e.selection:se.single(e.selection.anchor,e.selection.head):se.single(0);return Sg(i,n.length),t.staticFacet(Ou)||(i=i.asSingle()),new je(t,n,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(je.tabSize)}get lineBreak(){return this.facet(je.lineSeparator)||`
|
|
145
|
+
`}get readOnly(){return this.facet(Mg)}phrase(e,...t){for(let n of this.facet(je.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(Og))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return MC(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,l=e-n;for(;o>0;){let a=zt(t,o,!1);if(s(t.slice(a,o))!=ht.Word)break;o=a}for(;l<i;){let a=zt(t,l);if(s(t.slice(l,a))!=ht.Word)break;l=a}return o==l?null:se.range(o+n,l+n)}}je.allowMultipleSelections=Ou,je.tabSize=ge.define({combine:r=>r.length?r[0]:4}),je.lineSeparator=Tg,je.readOnly=Mg,je.phrases=ge.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])}}),je.languageData=Og,je.changeFilter=Eg,je.transactionFilter=Pg,je.transactionExtender=Ig,Ql.reconfigure=Oe.define();function Cr(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](l,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 Ri{eq(e){return this==e}range(e,t=e){return mo.create(e,t,this)}}Ri.prototype.startSide=Ri.prototype.endSide=0,Ri.prototype.point=!1,Ri.prototype.mapMode=fr.TrackDel;class mo{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new mo(e,t,n)}}function Pu(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Iu{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,l=s.length;;){if(o==l)return o;let a=o+l>>1,f=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return f>=0?o:l;f>=0?l=a:o=a+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,l=-1;for(let a=0;a<this.value.length;a++){let f=this.value[a],u=this.from[a]+e,c=this.to[a]+e,d,p;if(u==c){let g=t.mapPos(u,f.startSide,f.mapMode);if(g==null||(d=p=g,f.startSide!=f.endSide&&(p=t.mapPos(u,f.endSide),p<d)))continue}else if(d=t.mapPos(u,f.startSide),p=t.mapPos(c,f.endSide),d>p||d==p&&f.startSide>0&&f.endSide<=0)continue;(p-d||f.endSide-f.startSide)<0||(o<0&&(o=d),f.point&&(l=Math.max(l,p-d)),n.push(f),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Iu(i,s,n,l):null,pos:o}}}class $e{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 $e(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(Pu)),this.isEmpty)return t.length?$e.of(t):this;let l=new Lg(this,null,-1).goto(0),a=0,f=[],u=new bn;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let c=t[a++];u.addInner(c.from,c.to,c.value)||f.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||i>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||i>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||f.push(mo.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!f.length?$e.empty:this.nextLayer.update({add:f,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 l=this.chunkPos[o],a=this.chunk[o],f=e.touchesRange(l,l+a.length);if(f===!1)i=Math.max(i,a.maxPoint),t.push(a),n.push(e.mapPos(l));else if(f===!0){let{mapped:u,pos:c}=a.map(l,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),n.push(c))}}let s=this.nextLayer.map(e);return t.length==0?s:new $e(n,t,s||$e.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 vo.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return vo.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Rg(o,l,n),f=new yo(o,a,s),u=new yo(l,a,s);n.iterGaps((c,d,p)=>Bg(f,c,u,d,p,i)),n.empty&&n.length==0&&Bg(f,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 l=Rg(s,o),a=new yo(s,l,0).goto(n),f=new yo(o,l,0).goto(n);for(;;){if(a.to!=f.to||!Du(a.active,f.active)||a.point&&(!f.point||!a.point.eq(f.point)))return!1;if(a.to>i)return!0;a.next(),f.next()}}static spans(e,t,n,i,s=-1){let o=new yo(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let f=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),c=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,a);i.point(l,f,o.point,u,c,o.pointRank),a=Math.min(o.openEnd(f),u.length)}else f>l&&(i.span(l,f,o.active,a),a=o.openEnd(f));if(o.to>n)return a+(o.point&&o.to>n?1:0);l=o.to,o.next()}}static of(e,t=!1){let n=new bn;for(let i of e instanceof mo?[e]:t?DC(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return $e.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=$e.empty;i=i.nextLayer)t=new $e(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}$e.empty=new $e([],[],null,-1);function DC(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Pu(e,n)>0)return r.slice().sort(Pu);e=n}return r}$e.empty.nextLayer=$e.empty;class bn{finishChunk(e){this.chunks.push(new Iu(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 bn)).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($e.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=$e.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Rg(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 l=n.get(s.chunk[o]);l!=null&&(t?t.mapPos(l):l)==s.chunkPos[o]&&!t?.touchesRange(l,l+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class Lg{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 vo{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 Lg(o,t,n,s));return i.length==1?i[0]:new vo(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--)Mu(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--)Mu(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(),Mu(this.heap,0)}}}function Mu(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 yo{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=vo.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){ea(this.active,e),ea(this.activeTo,e),ea(this.activeRank,e),this.minActive=Fg(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;ta(this.active,t,n),ta(this.activeTo,t,i),ta(this.activeRank,t,s),e&&ta(e,t,this.cursor.from),this.minActive=Fg(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&&ea(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 Bg(r,e,t,n,i,s){r.goto(e),t.goto(n);let o=n+i,l=n,a=n-e;for(;;){let f=r.to+a-t.to||r.endSide-t.endSide,u=f<0?r.to+a:t.to,c=Math.min(u,o);if(r.point||t.point?r.point&&t.point&&(r.point==t.point||r.point.eq(t.point))&&Du(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(l,c,r.point,t.point):c>l&&!Du(r.active,t.active)&&s.compareRange(l,c,r.active,t.active),u>o)break;l=u,f<=0&&r.next(),f>=0&&t.next()}}function Du(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 ea(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function ta(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function Fg(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 ds(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=zt(r,i));return n}function Nu(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=zt(r,i)}return n===!0?-1:r.length}const Ru="\u037C",jg=typeof Symbol>"u"?"__"+Ru:Symbol.for(Ru),Lu=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Vg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xn{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,f){let u=[],c=/^@(\w+)\b/.exec(o[0]),d=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let p in l){let g=l[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(x=>y.replace(/&/,x))).reduce((y,x)=>y.concat(x)),g,a);else if(g&&typeof g=="object"){if(!c)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),g,u,d)}else g!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+g+";")}(u.length||d)&&a.push((n&&!c&&!f?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=Vg[jg]||1;return Vg[jg]=e+1,Ru+e.toString(36)}static mount(e,t,n){let i=e[Lu],s=n&&n.nonce;i?s&&i.setNonce(s):i=new NC(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let Wg=new Map;class NC{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Wg.get(n);if(s)return e[Lu]=s;this.sheet=new i.CSSStyleSheet,Wg.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Lu]=this}mount(e,t){let n=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let f=0;f<l.rules.length;f++)n.insertRule(l.rules[f],i++)}else{for(;s<a;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
|
147
|
+
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var oi={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:"'"},bo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},RC=typeof navigator<"u"&&/Mac/.test(navigator.platform),LC=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Gt=0;Gt<10;Gt++)oi[48+Gt]=oi[96+Gt]=String(Gt);for(var Gt=1;Gt<=24;Gt++)oi[Gt+111]="F"+Gt;for(var Gt=65;Gt<=90;Gt++)oi[Gt]=String.fromCharCode(Gt+32),bo[Gt]=String.fromCharCode(Gt);for(var Bu in oi)bo.hasOwnProperty(Bu)||(bo[Bu]=oi[Bu]);function BC(r){var e=RC&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||LC&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?bo:oi)[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 ra(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function Fu(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function FC(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function na(r,e){if(!e.anchorNode)return!1;try{return Fu(r,e.anchorNode)}catch{return!1}}function ps(r){return r.nodeType==3?Li(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function xo(r,e,t,n){return t?$g(r,e,t,n,-1)||$g(r,e,t,n,1):!1}function wo(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function $g(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Vn(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=wo(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?Vn(r):0}else return!1}}function Vn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function ia(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function jC(r){return{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Hg(r,e){let t=e.width/r.offsetWidth,n=e.height/r.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-r.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-r.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function VC(r,e,t,n,i,s,o,l){let a=r.ownerDocument,f=a.defaultView||window;for(let u=r,c=!1;u&&!c;)if(u.nodeType==1){let d,p=u==a.body,g=1,y=1;if(p)d=jC(f);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(c=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let E=u.getBoundingClientRect();({scaleX:g,scaleY:y}=Hg(u,E)),d={left:E.left,right:E.left+u.clientWidth*g,top:E.top,bottom:E.top+u.clientHeight*y}}let x=0,k=0;if(i=="nearest")e.top<d.top?(k=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+k&&(k=e.bottom-d.bottom+k+o)):e.bottom>d.bottom&&(k=e.bottom-d.bottom+o,t<0&&e.top-k<d.top&&(k=-(d.top+k-e.top+o)));else{let E=e.bottom-e.top,O=d.bottom-d.top;k=(i=="center"&&E<=O?e.top+E/2-O/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-O+o)-d.top}if(n=="nearest"?e.left<d.left?(x=-(d.left-e.left+s),t>0&&e.right>d.right+x&&(x=e.right-d.right+x+s)):e.right>d.right&&(x=e.right-d.right+s,t<0&&e.left<d.left+x&&(x=-(d.left+x-e.left+s))):x=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==l?e.left-s:e.right-(d.right-d.left)+s)-d.left,x||k)if(p)f.scrollBy(x,k);else{let E=0,O=0;if(k){let j=u.scrollTop;u.scrollTop+=k/y,O=(u.scrollTop-j)*y}if(x){let j=u.scrollLeft;u.scrollLeft+=x/g,E=(u.scrollLeft-j)*g}e={left:e.left-E,top:e.top-O,right:e.right-E,bottom:e.bottom-O},E&&Math.abs(E-x)<1&&(n="nearest"),O&&Math.abs(O-k)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function WC(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 $C{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?Vn(t):0),n,Math.min(e.focusOffset,n?Vn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let gs=null;function zg(r){if(r.setActive)return r.setActive();if(gs)return r.focus(gs);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(gs==null?{get preventScroll(){return gs={preventScroll:!0},!0}}:void 0),!gs){gs=!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 Ug;function Li(r,e,t=e){let n=Ug||(Ug=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function ms(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 HC(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Gg(r){for(;r.attributes.length;)r.removeAttributeNode(r.attributes[0])}function zC(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,Vn(t));;)if(n){if(t.nodeType!=1)return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=Vn(t))}else{if(t==r)return!0;n=wo(t),t=t.parentNode}}function Kg(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}class tr{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new tr(e.parentNode,wo(e),t)}static after(e,t){return new tr(e.parentNode,wo(e)+1,t)}}const ju=[];class ft{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 l=ft.get(s);(!l||!l.parent&&l.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=Yg(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=Yg(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=Vn(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&&!ft.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,l=-1;for(let a=0,f=n,u=n;a<this.children.length;a++){let c=this.children[a],d=f+c.length;if(f<e&&d>t)return c.domBoundsAround(e,t,f);if(d>=e&&i==-1&&(i=a,s=f),f>t&&c.dom.parentNode==this.dom){o=a,l=u;break}u=d,f=d+c.breakAfter}return{from:s,to:l<0?n+this.length:l,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=ju){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 _g(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.parent==this&&e.destroy();this.parent=null}}ft.prototype.breakAfter=0;function Yg(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class _g{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 Jg(r,e,t,n,i,s,o,l,a){let{children:f}=r,u=f.length?f[e]:null,c=s.length?s[s.length-1]:null,d=c?c.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(t,i,s.length?c:null,t==0,l,a))){if(n<f.length){let p=f[n];p&&(i<p.length||p.breakAfter&&c?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&c&&p.merge(0,i,c,!0,0,a)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,a),s.push(p))):p?.breakAfter&&(c?c.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,l,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,l,0),e++));e<n&&s.length;)if(f[n-1].become(s[s.length-1]))n--,s.pop(),a=s.length?0:l;else if(f[e].become(s[0]))e++,s.shift(),l=s.length?0:a;else break;!s.length&&e&&n<f.length&&!f[e-1].breakAfter&&f[n].merge(0,0,f[e-1],!1,l,a)&&e--,(e<n||s.length)&&r.replaceChildren(e,n,s)}}function Xg(r,e,t,n,i,s){let o=r.childCursor(),{i:l,off:a}=o.findPos(t,1),{i:f,off:u}=o.findPos(e,-1),c=e-t;for(let d of n)c+=d.length;r.length+=c,Jg(r,f,u,l,a,n,0,i,s)}let Or=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Vu=typeof document<"u"?document:{documentElement:{style:{}}};const Wu=/Edge\/(\d+)/.exec(Or.userAgent),Qg=/MSIE \d/.test(Or.userAgent),$u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Or.userAgent),sa=!!(Qg||$u||Wu),Zg=!sa&&/gecko\/(\d+)/i.test(Or.userAgent),Hu=!sa&&/Chrome\/(\d+)/.exec(Or.userAgent),qg="webkitFontSmoothing"in Vu.documentElement.style,em=!sa&&/Apple Computer/.test(Or.vendor),tm=em&&(/Mobile\/\w+/.test(Or.userAgent)||Or.maxTouchPoints>2);var xe={mac:tm||/Mac/.test(Or.platform),windows:/Win/.test(Or.platform),linux:/Linux|X11/.test(Or.platform),ie:sa,ie_version:Qg?Vu.documentMode||6:$u?+$u[1]:Wu?+Wu[1]:0,gecko:Zg,gecko_version:Zg?+(/Firefox\/(\d+)/.exec(Or.userAgent)||[0,0])[1]:0,chrome:!!Hu,chrome_version:Hu?+Hu[1]:0,ios:tm,android:/Android\b/.test(Or.userAgent),webkit:qg,safari:em,webkit_version:qg?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Vu.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const UC=256;class Wn extends ft{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 Wn)||this.length-(t-e)+n.length>UC||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 Wn(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 tr(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 GC(this.dom,e,t)}}class $n extends ft{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(Gg(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 $n&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Xg(this,e,t,n?n.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,s=0;for(let l of this.children){let a=n+l.length;a>e&&t.push(n<e?l.split(e-n):l),i<0&&n>=e&&(i=s),n=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new $n(this.mark,t,o)}domAtPos(e){return rm(this,e)}coordsAt(e,t){return im(this,e,t)}}function GC(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?xe.chrome||xe.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):t<0?i--:s<n&&s++;let l=Li(r,i,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return xe.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,f=>f.width)||a),o?ia(a,o<0):a||null}class li extends ft{static create(e,t,n){return new li(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=li.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.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,i,s,o){return n&&(!(n instanceof li)||!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 li&&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 Ze.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):Ze.empty}domAtPos(e){return(this.length?e==0:this.side>0)?tr.before(this.dom):tr.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 l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top<s.bottom);l+=o?-1:1);return ia(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 vs extends ft{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof vs&&e.side==this.side}split(){return new vs(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?tr.before(this.dom):tr.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Ze.empty}get isHidden(){return!0}}Wn.prototype.children=li.prototype.children=vs.prototype.children=ju;function rm(r,e){let t=r.dom,{children:n}=r,i=0;for(let s=0;i<n.length;i++){let o=n[i],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(e>s&&e<l&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=l}}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 tr(t,0)}function nm(r,e,t){let n,{children:i}=r;t>0&&e instanceof $n&&i.length&&(n=i[i.length-1])instanceof $n&&n.mark.eq(e.mark)?nm(n,e.children[0],t-1):(i.push(e),e.setParent(r)),r.length+=e.length}function im(r,e,t){let n=null,i=-1,s=null,o=-1;function l(f,u){for(let c=0,d=0;c<f.children.length&&d<=u;c++){let p=f.children[c],g=d+p.length;g>=u&&(p.children.length?l(p,u-d):(!s||s.isHidden&&t>0)&&(g>u||d==g&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==g&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=g}}l(r,e);let a=(t<0?n:s)||n||s;return a?a.coordsAt(Math.max(0,a==n?i:o),t):KC(r)}function KC(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=ps(e);return t[t.length-1]||null}function zu(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 sm=Object.create(null);function Uu(r,e,t){if(r==e)return!0;r||(r=sm),e||(e=sm);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 Gu(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 YC(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 Ft extends ft{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 Ft))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Xg(this,e,t,n?n.children.slice():[],s,o),!0}split(e){let t=new Ft;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){Uu(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){nm(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=zu(t,this.attrs||{})),n&&(this.attrs=zu({class:n},this.attrs||{}))}domAtPos(e){return rm(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Gg(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&&(Gu(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&&ft.get(i)instanceof $n;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=ft.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!xe.ios||!this.children.some(s=>s instanceof Wn))){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 Wn)||/[^ -~]/.test(n.text))return null;let i=ps(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=im(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 Ft)return s;if(o>t)break}i=o+s.breakAfter}return null}}class ai extends ft{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 ai)||!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?tr.before(this.dom):tr.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new ai(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ju}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Ze.empty}domBoundsAround(){return null}become(e){return e instanceof ai&&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 zr{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}get editable(){return!1}destroy(e){}}var ur=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(ur||(ur={}));class pe extends Ri{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 So(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 fi(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}=om(e,t);n=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new fi(e,n,i,t,e.widget||null,!0)}static line(e){return new ko(e)}static set(e,t=!1){return $e.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}pe.none=$e.empty;class So extends pe{constructor(e){let{start:t,end:n}=om(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 So&&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))&&Uu(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)}}So.prototype.point=!1;class ko extends pe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ko&&this.spec.class==e.spec.class&&Uu(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)}}ko.prototype.mapMode=fr.TrackBefore,ko.prototype.point=!0;class fi extends pe{constructor(e,t,n,i,s,o){super(t,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?fr.TrackBefore:fr.TrackAfter:fr.TrackDel}get type(){return this.startSide!=this.endSide?ur.WidgetRange:this.startSide<=0?ur.WidgetBefore:ur.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof fi&&_C(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)}}fi.prototype.point=!0;function om(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 _C(r,e){return r==e||!!(r&&e&&r.compare(e))}function Ku(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 Ao{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 ai&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ft),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(oa(new vs(-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 ai)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(oa(new Wn(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 fi){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 l=t-e;if(n instanceof fi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ai(n.widget||Bi.block,l,n));else{let a=li.create(n.widget||Bi.inline,l,l?0:n.startSide),f=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e<t||n.startSide>0),u=!a.isEditable&&(e<t||s>i.length||n.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!f&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),f&&(c.append(oa(new vs(1),i),s),s=i.length+Math.max(0,s-i.length)),c.append(oa(a,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);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,n,i,s){let o=new Ao(e,t,n,s);return o.openEnd=$e.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function oa(r,e){for(let t of e)r=new $n(t,[r],r.length);return r}class Bi extends zr{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}}Bi.inline=new Bi("span"),Bi.block=new Bi("div");var rt=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(rt||(rt={}));const Fi=rt.LTR,Yu=rt.RTL;function lm(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const JC=lm("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),XC=lm("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_u=Object.create(null),wn=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);_u[e]=t,_u[t]=-e}function am(r){return r<=247?JC[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?XC[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1}const QC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ui{get dir(){return this.level%2?Yu:Fi}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}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==n)return o;(s<0||(i!=0?i<0?l.from<t:l.to>t:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function fm(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||!fm(n.inner,i.inner))return!1}return!0}const nt=[];function ZC(r,e,t,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,l=s<n.length?n[s].from:t,a=s?256:i;for(let f=o,u=a,c=a;f<l;f++){let d=am(r.charCodeAt(f));d==512?d=u:d==8&&c==4&&(d=16),nt[f]=d==4?2:d,d&7&&(c=d),u=d}for(let f=o,u=a,c=a;f<l;f++){let d=nt[f];if(d==128)f<l-1&&u==nt[f+1]&&u&24?d=nt[f]=u:nt[f]=256;else if(d==64){let p=f+1;for(;p<l&&nt[p]==64;)p++;let g=f&&u==8||p<t&&nt[p]==8?c==1?1:8:256;for(let y=f;y<p;y++)nt[y]=g;f=p-1}else d==8&&c==1&&(nt[f]=1);u=d,d&7&&(c=d)}}}function qC(r,e,t,n,i){let s=i==1?2:1;for(let o=0,l=0,a=0;o<=n.length;o++){let f=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let c=f,d,p,g;c<u;c++)if(p=_u[d=r.charCodeAt(c)])if(p<0){for(let y=l-3;y>=0;y-=3)if(wn[y+1]==-p){let x=wn[y+2],k=x&2?i:x&4?x&1?s:i:0;k&&(nt[c]=nt[wn[y]]=k),l=y;break}}else{if(wn.length==189)break;wn[l++]=c,wn[l++]=d,wn[l++]=a}else if((g=nt[c])==2||g==1){let y=g==i;a=y?0:1;for(let x=l-3;x>=0;x-=3){let k=wn[x+2];if(k&2)break;if(y)wn[x+2]|=2;else{if(k&4)break;wn[x+2]|=4}}}}}function eO(r,e,t,n){for(let i=0,s=n;i<=t.length;i++){let o=i?t[i-1].to:r,l=i<t.length?t[i].from:e;for(let a=o;a<l;){let f=nt[a];if(f==256){let u=a+1;for(;;)if(u==l){if(i==t.length)break;u=t[i++].to,l=i<t.length?t[i].from:e}else if(nt[u]==256)u++;else break;let c=s==1,d=(u<e?nt[u]:n)==1,p=c==d?c?1:2:n;for(let g=u,y=i,x=y?t[y-1].to:r;g>a;)g==x&&(g=t[--y].from,x=y?t[y-1].to:r),nt[--g]=p;a=u}else s=f,a++}}}function Ju(r,e,t,n,i,s,o){let l=n%2?2:1;if(n%2==i%2)for(let a=e,f=0;a<t;){let u=!0,c=!1;if(f==s.length||a<s[f].from){let y=nt[a];y!=l&&(u=!1,c=y==16)}let d=!u&&l==1?[]:null,p=u?n:n+1,g=a;e:for(;;)if(f<s.length&&g==s[f].from){if(c)break e;let y=s[f];if(!u)for(let x=y.to,k=f+1;;){if(x==t)break e;if(k<s.length&&s[k].from==x)x=s[k++].to;else{if(nt[x]==l)break e;break}}if(f++,d)d.push(y);else{y.from>a&&o.push(new ui(a,y.from,p));let x=y.direction==Fi!=!(p%2);Xu(r,x?n+1:n,i,y.inner,y.from,y.to,o),a=y.to}g=y.to}else{if(g==t||(u?nt[g]!=l:nt[g]==l))break;g++}d?Ju(r,a,g,n+1,i,d,o):a<g&&o.push(new ui(a,g,p)),a=g}else for(let a=t,f=s.length;a>e;){let u=!0,c=!1;if(!f||a>s[f-1].to){let y=nt[a-1];y!=l&&(u=!1,c=y==16)}let d=!u&&l==1?[]:null,p=u?n:n+1,g=a;e:for(;;)if(f&&g==s[f-1].to){if(c)break e;let y=s[--f];if(!u)for(let x=y.from,k=f;;){if(x==e)break e;if(k&&s[k-1].to==x)x=s[--k].from;else{if(nt[x-1]==l)break e;break}}if(d)d.push(y);else{y.to<a&&o.push(new ui(y.to,a,p));let x=y.direction==Fi!=!(p%2);Xu(r,x?n+1:n,i,y.inner,y.from,y.to,o),a=y.from}g=y.from}else{if(g==e||(u?nt[g-1]!=l:nt[g-1]==l))break;g--}d?Ju(r,g,a,n+1,i,d,o):g<a&&o.push(new ui(g,a,p)),a=g}}function Xu(r,e,t,n,i,s,o){let l=e%2?2:1;ZC(r,i,s,n,l),qC(r,i,s,n,l),eO(i,s,n,l),Ju(r,i,s,e,t,n,o)}function um(r,e,t){if(!r)return[new ui(0,0,e==Yu?1:0)];if(e==Fi&&!t.length&&!QC.test(r))return cm(r.length);if(t.length)for(;r.length>nt.length;)nt[nt.length]=256;let n=[],i=e==Fi?0:1;return Xu(r,i,i,t,0,r.length,n),n}function cm(r){return[new ui(0,r,0)]}let hm="";function dm(r,e,t,n,i){var s;let o=n.head-r.from,l=ui.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc),a=e[l],f=a.side(i,t);if(o==f){let d=l+=i?1:-1;if(d<0||d>=e.length)return null;a=e[l=d],o=a.side(!i,t),f=a.side(i,t)}let u=zt(r.text,o,a.forward(i,t));(u<a.from||u>a.to)&&(u=f),hm=r.text.slice(Math.min(o,u),Math.max(o,u));let c=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return c&&u==f&&c.level+(i?0:1)<a.level?se.cursor(c.side(!i,t)+r.from,c.forward(i,t)?1:-1,c.level):se.cursor(u+r.from,a.forward(i,t)?-1:1,a.level)}function tO(r,e,t){for(let n=e;n<t;n++){let i=am(r.charCodeAt(n));if(i==1)return Fi;if(i==2||i==4)return Yu}return Fi}const pm=ge.define(),gm=ge.define(),mm=ge.define(),vm=ge.define(),Qu=ge.define(),ym=ge.define(),bm=ge.define(),xm=ge.define({combine:r=>r.some(e=>e)}),wm=ge.define({combine:r=>r.some(e=>e)});class ys{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 ys(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 ys(se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const la=Oe.define({map:(r,e)=>r.map(e)});function cr(r,e,t){let n=r.facet(vm);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 aa=ge.define({combine:r=>r.length?r[0]:!0});let rO=0;const Co=ge.define();class st{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 st(rO++,e,n,i,l=>{let a=[Co.of(l)];return o&&a.push(Oo.of(f=>{let u=f.plugin(l);return u?o(u):pe.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return st.define(n=>new e(n),t)}}class Zu{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(cr(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){cr(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){cr(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Sm=ge.define(),fa=ge.define(),Oo=ge.define(),km=ge.define(),qu=ge.define(),Am=ge.define();function Cm(r,e){let t=r.state.facet(Am);if(!t.length)return t;let n=t.map(s=>s instanceof Function?s(r):s),i=[];return $e.spans(n,e.from,e.to,{point(){},span(s,o,l,a){let f=s-e.from,u=o-e.from,c=i;for(let d=l.length-1;d>=0;d--,a--){let p=l[d].spec.bidiIsolate,g;if(p==null&&(p=tO(e.text,f,u)),a>0&&c.length&&(g=c[c.length-1]).to==f&&g.direction==p)g.to=u,c=g.inner;else{let y={from:f,to:u,direction:p,inner:[]};c.push(y),c=y.inner}}}}),i}const Om=ge.define();function Tm(r){let e=0,t=0,n=0,i=0;for(let s of r.state.facet(Om)){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 To=ge.define();class Tr{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Tr(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,l=0;;i++){let a=i==e.length?null:e[i],f=o-l,u=a?a.fromB:1e9;for(;s<t.length&&t[s]<u;){let c=t[s],d=t[s+1],p=Math.max(l,c),g=Math.min(u,d);if(p<=g&&new Tr(p+f,g+f,p,g).addToSet(n),d>u)break;s+=2}if(!a)return n;new Tr(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,l=a.toB}}}class ua{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Lt.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new Tr(s,o,l,a))),this.changedRanges=i}static create(e,t,n){return new ua(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}}class Em extends ft{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.compositionBarrier=pe.none,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 Ft],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Tr(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:f,toA:u})=>u<this.minWidthFrom||f>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:!uO(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?sO(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:f,to:u}=this.hasComposition;n=new Tr(f,u,e.changes.mapPos(f,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(xe.ie||xe.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=aO(o,l,e.changes);return n=Tr.extendWithRanges(n,a),!(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=xe.chrome||xe.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 ai&&o.widget instanceof Pm&&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 l=o>=0?i[o]:null;if(!l)break;let{fromA:a,toA:f,fromB:u,toB:c}=l,d,p,g,y;if(n&&n.range.fromB<c&&n.range.toB>u){let j=Ao.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),M=Ao.build(this.view.state.doc,n.range.toB,c,this.decorations,this.dynamicDecorationMap);p=j.breakAtStart,g=j.openStart,y=M.openEnd;let F=this.compositionView(n);M.breakAtStart?F.breakAfter=1:M.content.length&&F.merge(F.length,F.length,M.content[0],!1,M.openStart,0)&&(F.breakAfter=M.content[0].breakAfter,M.content.shift()),j.content.length&&F.merge(0,0,j.content[j.content.length-1],!0,0,j.openEnd)&&j.content.pop(),d=j.content.concat(F).concat(M.content)}else({content:d,breakAtStart:p,openStart:g,openEnd:y}=Ao.build(this.view.state.doc,u,c,this.decorations,this.dynamicDecorationMap));let{i:x,off:k}=s.findPos(f,1),{i:E,off:O}=s.findPos(a,-1);Jg(this,E,O,x,k,d,p,g,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new Wn(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new $n(i,[t],t.length);let n=new Ft;return n.append(t,0),n}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=ft.get(s);l&&l!=o&&(l.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&&na(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),f=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(xe.gecko&&l.empty&&!this.hasComposition&&iO(a)){let c=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=f=new tr(c,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!xo(a.node,a.offset,u.anchorNode,u.anchorOffset)||!xo(f.node,f.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{xe.android&&xe.chrome&&this.dom.contains(u.focusNode)&&fO(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=ra(this.view.root);if(c)if(l.empty){if(xe.gecko){let d=oO(a.node,a.offset);if(d&&d!=3){let p=Mm(a.node,a.offset,d==1?1:-1);p&&(a=new tr(p.node,p.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(f.node,f.offset)}catch{}}else{let d=document.createRange();l.anchor>l.head&&([a,f]=[f,a]),d.setEnd(f.node,f.offset),d.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,f)),this.impreciseAnchor=a.precise?null:new tr(u.anchorNode,u.anchorOffset),this.impreciseHead=f.precise?null:new tr(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&!this.compositionBarrier.size&&xo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ra(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Ft.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),f=this.coordsAt(t.head,1);if(!a||!f||a.bottom>f.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 c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.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=ft.get(t.childNodes[i]);s instanceof Ft&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=ft.get(t.childNodes[i]);s instanceof Ft&&(n=s.domAtPos(s.length))}return n?new tr(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=ft.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 Ft)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 l=this.children[o],a=s-l.breakAfter,f=a-l.length;if(a<e)break;f<=e&&(f<e||l.covers(-1))&&(a>e||l.covers(1))&&(!n||l instanceof Ft&&!(n instanceof Ft&&t>=0))&&(n=l,i=f),s=f}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 Ft))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(n,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}n=a}if(!(i instanceof Wn))return null;let s=zt(i.text,n);if(s==n)return null;let o=Li(i.dom,n,s).getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(l==o.length-1||a.top<a.bottom&&a.left<a.right)return a}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,l=-1,a=this.view.textDirection==rt.LTR;for(let f=0,u=0;u<this.children.length;u++){let c=this.children[u],d=f+c.length;if(d>i)break;if(f>=n){let p=c.dom.getBoundingClientRect();if(t.push(p.height),o){let g=c.dom.lastChild,y=g?ps(g):[];if(y.length){let x=y[y.length-1],k=a?x.right-p.left:p.right-x.left;k>l&&(l=k,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=d)}}}f=d+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?rt.RTL:rt.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Ft){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=ps(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 _g(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 l=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(pe.replace({widget:new Pm(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return pe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Oo).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),n=!1,i=this.view.state.facet(km).map((s,o)=>{let l=typeof s=="function";return l&&(n=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push($e.join(i))),this.decorations=[this.compositionBarrier,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}maybeCreateCompositionBarrier(){let{main:{head:e,empty:t}}=this.view.state.selection;if(!t)return!1;let n=null;for(let i of this.decorations)if(i.between(e,e,(s,o,l)=>{l.point?n=!1:l.endSide<0&&s<e&&o==e&&(n=!0)}),n===!1)break;return this.compositionBarrier=n?pe.set(nO.range(e)):pe.none,!!n}clearCompositionBarrier(){this.compositionBarrier=pe.none}scrollIntoView(e){if(e.isSnapshot){let f=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=f.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=Tm(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;VC(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==rt.LTR)}}const nO=pe.widget({side:-1,widget:Bi.inline});function iO(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 Pm extends zr{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Im(r,e){let t=r.observer.selectionRange,n=t.focusNode&&Mm(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 sO(r,e,t){let n=Im(r,t);if(!n)return null;let{node:i,from:s,to:o}=n,l=i.nodeValue;if(/[\n\r]/.test(l)||r.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc,f=new Tr(a.mapPos(s),a.mapPos(o),s,o),u=[];for(let c=i.parentNode;;c=c.parentNode){let d=ft.get(c);if(d instanceof $n)u.push({node:c,deco:d.mark});else{if(d instanceof Ft||c.nodeName=="DIV"&&c.parentNode==r.contentDOM)return{range:f,text:i,marks:u,line:c};if(c!=r.contentDOM)u.push({node:c,deco:new So({inclusive:!0,attributes:YC(c),tagName:c.tagName.toLowerCase()})});else return null}}}function Mm(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=Vn(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 oO(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 lO=class{constructor(){this.changes=[]}compareRange(e,t){Ku(e,t,this.changes)}comparePoint(e,t){Ku(e,t,this.changes)}};function aO(r,e,t){let n=new lO;return $e.compare(r,e,t,n),n.changes}function fO(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 uO(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}function cO(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,l=s;t<0?o=zt(i.text,s,!1):l=zt(i.text,s);let a=n(i.text.slice(o,l));for(;o>0;){let f=zt(i.text,o,!1);if(n(i.text.slice(f,o))!=a)break;o=f}for(;l<i.length;){let f=zt(i.text,l);if(n(i.text.slice(l,f))!=a)break;l=f}return se.range(o+i.from,l+i.from)}function hO(r,e){return e.left>r?e.left-r:Math.max(0,r-e.right)}function dO(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function ec(r,e){return r.top<e.bottom-1&&r.bottom>e.top+1}function Dm(r,e){return e<r.top?{top:e,left:r.left,right:r.right,bottom:r.bottom}:r}function Nm(r,e){return e>r.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function tc(r,e,t){let n,i,s,o,l=!1,a,f,u,c;for(let g=r.firstChild;g;g=g.nextSibling){let y=ps(g);for(let x=0;x<y.length;x++){let k=y[x];i&&ec(i,k)&&(k=Dm(Nm(k,i.bottom),i.top));let E=hO(e,k),O=dO(t,k);if(E==0&&O==0)return g.nodeType==3?Rm(g,e,t):tc(g,e,t);if(!n||o>O||o==O&&s>E){n=g,i=k,s=E,o=O;let j=O?t<k.top?-1:1:E?e<k.left?-1:1:0;l=!j||(j>0?x<y.length-1:x>0)}E==0?t>k.bottom&&(!u||u.bottom<k.bottom)?(a=g,u=k):t<k.top&&(!c||c.top>k.top)&&(f=g,c=k):u&&ec(u,k)?u=Nm(u,k.bottom):c&&ec(c,k)&&(c=Dm(c,k.top))}}if(u&&u.bottom>=t?(n=a,i=u):c&&c.top<=t&&(n=f,i=c),!n)return{node:r,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return Rm(n,d,t);if(l&&n.contentEditable!="false")return tc(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 Rm(r,e,t){let n=r.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;l<n;l++){let a=Li(r,l,l+1).getClientRects();for(let f=0;f<a.length;f++){let u=a[f];if(u.top==u.bottom)continue;o||(o=e-u.left);let c=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&c<s){let d=e>=(u.left+u.right)/2,p=d;if((xe.chrome||xe.gecko)&&Li(r,l).getBoundingClientRect().left==u.right&&(p=!d),c<=0)return{node:r,offset:l+(p?1:0)};i=l+(p?1:0),s=c}}}return{node:r,offset:i>-1?i:o>0?r.nodeValue.length:0}}function Lm(r,e,t,n=-1){var i,s;let o=r.contentDOM.getBoundingClientRect(),l=o.top+r.viewState.paddingTop,a,{docHeight:f}=r.viewState,{x:u,y:c}=e,d=c-l;if(d<0)return 0;if(d>f)return r.state.doc.length;for(let j=r.viewState.heightOracle.textHeight/2,M=!1;a=r.elementAtHeight(d),a.type!=ur.Text;)for(;d=n>0?a.bottom+j:a.top-j,!(d>=0&&d<=f);){if(M)return t?null:0;M=!0,n=-n}c=l+d;let p=a.from;if(p<r.viewport.from)return r.viewport.from==0?0:t?null:Bm(r,o,a,u,c);if(p>r.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:Bm(r,o,a,u,c);let g=r.dom.ownerDocument,y=r.root.elementFromPoint?r.root:g,x=y.elementFromPoint(u,c);x&&!r.contentDOM.contains(x)&&(x=null),x||(u=Math.max(o.left+1,Math.min(o.right-1,u)),x=y.elementFromPoint(u,c),x&&!r.contentDOM.contains(x)&&(x=null));let k,E=-1;if(x&&((i=r.docView.nearest(x))===null||i===void 0?void 0:i.isEditable)!=!1){if(g.caretPositionFromPoint){let j=g.caretPositionFromPoint(u,c);j&&({offsetNode:k,offset:E}=j)}else if(g.caretRangeFromPoint){let j=g.caretRangeFromPoint(u,c);j&&({startContainer:k,startOffset:E}=j,(!r.contentDOM.contains(k)||xe.safari&&pO(k,E,u)||xe.chrome&&gO(k,E,u))&&(k=void 0))}}if(!k||!r.docView.dom.contains(k)){let j=Ft.find(r.docView,p);if(!j)return d>a.top+a.height/2?a.to:a.from;({node:k,offset:E}=tc(j.dom,u,c))}let O=r.docView.nearest(k);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let j=O.dom.getBoundingClientRect();return e.y<j.top||e.y<=j.bottom&&e.x<=(j.left+j.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(k,E)+O.posAtStart}function Bm(r,e,t,n,i){let s=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let l=r.viewState.heightOracle.textHeight,a=Math.floor((i-t.top-(r.defaultLineHeight-l)*.5)/l);s+=a*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+Nu(o,s,r.state.tabSize)}function pO(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 Li(r,n-1,n).getBoundingClientRect().left>t}function gO(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():Li(r,0,Math.max(r.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function rc(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==ur.Text))return n}return t}function mO(r,e,t,n){let i=rc(r,e.head),s=!n||i.type!=ur.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(),l=r.textDirectionAt(i.from),a=r.posAtCoords({x:t==(l==rt.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return se.cursor(a,t?-1:1)}return se.cursor(t?i.to:i.from,t?-1:1)}function Fm(r,e,t,n){let i=r.state.doc.lineAt(e.head),s=r.bidiSpans(i),o=r.textDirectionAt(i.from);for(let l=e,a=null;;){let f=dm(i,s,o,l,t),u=hm;if(!f){if(i.number==(t?r.state.doc.lines:1))return l;u=`
|
|
148
|
+
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),f=r.visualLineSide(i,!t)}if(a){if(!a(u))return l}else{if(!n)return f;a=n(u)}l=f}}function vO(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==ht.Space&&(i=o),i==o}}function yO(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,l,a=r.contentDOM.getBoundingClientRect(),f=r.coordsAtPos(i,e.assoc||-1),u=r.documentTop;if(f)o==null&&(o=f.left-a.left),l=s<0?f.top:f.bottom;else{let p=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,r.defaultCharacterWidth*(i-p.from))),l=(s<0?p.top:p.bottom)+u}let c=a.left+o,d=n??r.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let g=l+(d+p)*s,y=Lm(r,{x:c,y:g},!1,s);if(g<a.top||g>a.bottom||(s<0?y<i:y>i)){let x=r.docView.coordsForChar(y),k=!x||g<x.top?-1:1;return se.cursor(y,k,void 0,o)}}}function ca(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||t||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function nc(r,e,t){let n=ca(r.state.facet(qu).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 bO{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,xe.safari&&e.contentDOM.addEventListener("input",()=>null),xe.gecko&&LO(e.contentDOM.ownerDocument)}handleEvent(e){!TO(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=xO(e),n=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in 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&&Wm.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),xe.android&&xe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return xe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Vm.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||wO.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,ms(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:xe.safari&&!xe.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 jm(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){cr(t.state,i)}}}function xO(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(jm(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&t(s).observers.push(jm(n.value,o))}}for(let n in en)t(n).handlers.push(en[n]);for(let n in tn)t(n).observers.push(tn[n]);return e}const Vm=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],wO="dthko",Wm=[16,17,18,20,91,92,224,225],ha=6;function da(r){return Math.max(0,r)*.7+8}function SO(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class kO{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=WC(e.contentDOM),this.atoms=e.state.facet(qu).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(je.allowMultipleSelections)&&AO(e,t),this.dragging=OO(e,t)&&Xm(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&&SO(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=Tm(this.view);e.clientX-o.left<=s.left+ha?n=-da(s.left-e.clientX):e.clientX+o.right>=s.right-ha&&(n=da(e.clientX-s.right)),e.clientY-o.top<=s.top+ha?i=-da(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-ha&&(i=da(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=ca(this.atoms,i.from,0);o!=i.from&&(s=se.cursor(o,-1))}else{let o=ca(this.atoms,i.from,-1),l=ca(this.atoms,i.to,1);(o!=i.from||l!=i.to)&&(s=se.range(i.from==i.anchor?o:l,i.from==i.head?o:l))}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,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 AO(r,e){let t=r.state.facet(pm);return t.length?t[0](e):xe.mac?e.metaKey:e.ctrlKey}function CO(r,e){let t=r.state.facet(gm);return t.length?t[0](e):xe.mac?!e.altKey:!e.ctrlKey}function OO(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=ra(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 TO(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=ft.get(t))&&n.ignoreEvent(e))return!1;return!0}const en=Object.create(null),tn=Object.create(null),$m=xe.ie&&xe.ie_version<15||xe.ios&&xe.webkit_version<604;function EO(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(),Hm(r,t.value)},50)}function Hm(r,e){let{state:t}=r,n,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(ic!=null&&t.selection.ranges.every(a=>a.empty)&&ic==s.toString()){let a=-1;n=t.changeByRange(f=>{let u=t.doc.lineAt(f.from);if(u.from==a)return{range:f};a=u.from;let c=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:c},range:se.cursor(f.from+c.length)}})}else o?n=t.changeByRange(a=>{let f=s.line(i++);return{changes:{from:a.from,to:a.to,insert:f.text},range:se.cursor(a.from+f.length)}}):n=t.replaceSelection(s);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}tn.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft},en.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&(r.inputState.lastEscPress=Date.now()),!1),tn.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")},tn.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")},en.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(mm))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=MO(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new kO(r,e,t,n)),n&&r.observer.ignore(()=>zg(r.contentDOM));let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function zm(r,e,t,n){if(n==1)return se.cursor(e,t);if(n==2)return cO(r.state,e,t);{let i=Ft.find(r.docView,e),s=r.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return l<r.state.doc.length&&l==s.to&&l++,se.range(o,l)}}let Um=(r,e)=>r>=e.top&&r<=e.bottom,Gm=(r,e,t)=>Um(e,t)&&r>=t.left&&r<=t.right;function PO(r,e,t,n){let i=Ft.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&&Gm(t,n,o))return-1;let l=i.coordsAt(s,1);return l&&Gm(t,n,l)?1:o&&Um(n,o)?-1:1}function Km(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:PO(r,t,e.clientX,e.clientY)}}const IO=xe.ie&&xe.ie_version<=11;let Ym=null,_m=0,Jm=0;function Xm(r){if(!IO)return r.detail;let e=Ym,t=Jm;return Ym=r,Jm=Date.now(),_m=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(_m+1)%3:1}function MO(r,e){let t=Km(r,e),n=Xm(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,l){let a=Km(r,s),f,u=zm(r,a.pos,a.bias,n);if(t.pos!=a.pos&&!o){let c=zm(r,t.pos,t.bias,n),d=Math.min(c.from,u.from),p=Math.max(c.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)):l&&n==1&&i.ranges.length>1&&(f=DO(i,a.pos))?f:l?i.addRange(u):se.create([u])}}}function DO(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}en.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},en.dragend=r=>(r.inputState.draggedContent=null,!1);function Qm(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&&CO(r,e)?{from:s.from,to:s.to}:null,l={from:i,insert:t},a=r.state.changes(o?[o,l]:l);r.focus(),r.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}en.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&&Qm(r,e,n.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Qm(r,e,n,!0),!0}return!1},en.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=$m?null:e.clipboardData;return t?(Hm(r,t.getData("text/plain")||t.getData("text/uri-text")),!0):(EO(r),!1)};function NO(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 RO(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 ic=null;en.copy=en.cut=(r,e)=>{let{text:t,ranges:n,linewise:i}=RO(r.state);if(!t&&!i)return!1;ic=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=$m?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(NO(r,t),!1)};const Zm=yn.define();function qm(r,e){let t=[];for(let n of r.facet(bm)){let i=n(r,e);i&&t.push(i)}return t?r.update({effects:t,annotations:Zm.of(!0)}):null}function e0(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=qm(r.state,e);t?r.dispatch(t):r.update([])}},10)}tn.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),e0(r)},tn.blur=r=>{r.observer.clearSelectionRange(),e0(r)},tn.compositionstart=tn.compositionupdate=r=>{r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0,r.docView.maybeCreateCompositionBarrier()&&(r.update([]),r.docView.clearCompositionBarrier()))},tn.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,xe.chrome&&xe.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50)},tn.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()},en.beforeinput=(r,e)=>{var t;let n;if(xe.chrome&&xe.android&&(n=Vm.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 t0=new Set;function LO(r){t0.has(r)||(t0.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const r0=["pre-wrap","normal","pre-line","break-spaces"];class n0{constructor(e){this.lineWrapping=e,this.doc=Ze.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 r0.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 l=r0.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let f=0;f<o.length;f++){let u=o[f];u<0?f++:this.heightSamples[Math.floor(u*10)]=!0}}return a}}class i0{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Sn{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"?ur.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 fi?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 Sn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ot=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(ot||(ot={}));const pa=.001;class rr{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)>pa&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return rr.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 l=i.length-1;l>=0;l--){let{fromA:a,toA:f,fromB:u,toB:c}=i[l],d=s.lineAt(a,ot.ByPosNoHeight,n.setDoc(t),0,0),p=d.to>=f?d:s.lineAt(f,ot.ByPosNoHeight,n,0,0);for(c+=p.to-f,f=p.to;l>0&&d.from<=i[l-1].toA;)a=i[l-1].fromA,u=i[l-1].fromB,l--,a<d.from&&(d=s.lineAt(a,ot.ByPosNoHeight,n,0,0));u+=d.from-a,a=d.from;let g=sc.build(n.setDoc(o),e,u,c);s=s.replace(a,f,g)}return s.updateHeight(n,0)}static empty(){return new Er(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 l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),n+=1+l.break,i-=l.size}else if(s>i*2){let l=e[n];l.break?e.splice(n,1,l.left,null,l.right):e.splice(n,1,l.left,l.right),n+=2+l.break,s-=l.size}else break;else if(i<s){let l=e[t++];l&&(i+=l.size)}else{let l=e[--n];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new BO(rr.of(e.slice(0,t)),o,rr.of(e.slice(n)))}}rr.prototype.size=1;class s0 extends rr{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new Sn(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 Er extends s0{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new Sn(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof Er||i instanceof Kt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Kt?i=new Er(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):rr.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 Kt extends rr{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,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:i,perLine:o,perChar:l}}blockAt(e,t,n,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let f=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=t.doc.lineAt(f),c=l+u.length*a,d=Math.max(n,e-c/2);return new Sn(u.from,u.length,d,c,0)}else{let f=Math.max(0,Math.min(o-s,Math.floor((e-n)/l))),{from:u,length:c}=t.doc.line(s+f);return new Sn(u,c,n+l*f,l,0)}}lineAt(e,t,n,i,s){if(t==ot.ByHeight)return this.blockAt(e,n,i,s);if(t==ot.ByPosNoHeight){let{from:p,to:g}=n.doc.lineAt(e);return new Sn(p,g-p,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,s),f=n.doc.lineAt(e),u=l+f.length*a,c=f.number-o,d=i+l*c+a*(f.from-s-c);return new Sn(f.from,f.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:l,perLine:a,perChar:f}=this.heightMetrics(n,s);for(let u=e,c=i;u<=t;){let d=n.doc.lineAt(u);if(u==e){let g=d.number-l;c+=a*g+f*(e-s-g)}let p=a+f*d.length;o(new Sn(d.from,d.length,c,p,0)),c+=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 Kt?n[n.length-1]=new Kt(s.length+i):n.push(null,new Kt(i-1))}if(e>0){let s=n[0];s instanceof Kt?n[0]=new Kt(e+s.length):n.unshift(new Kt(e-1),null)}return rr.of(n)}decomposeLeft(e,t){t.push(new Kt(e-1),null)}decomposeRight(e,t){t.push(null,new Kt(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=[],l=Math.max(t,i.from),a=-1;for(i.from>t&&o.push(new Kt(i.from-t-1).updateHeight(e,t));l<=s&&i.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let c=i.heights[i.index++];a==-1?a=c:Math.abs(c-a)>=pa&&(a=-2);let d=new Er(u,c);d.outdated=!1,o.push(d),l+=u+1}l<=s&&o.push(null,new Kt(s-l).updateHeight(e,l));let f=rr.of(o);return(a<0||Math.abs(f.height-this.height)>=pa||Math.abs(a-this.heightMetrics(e,t).perLine)>=pa)&&(e.heightChanged=!0),f}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class BO extends rr{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,l=s+this.left.length+this.break,a=t==ot.ByHeight?e<o:e<l,f=a?this.left.lineAt(e,t,n,i,s):this.right.lineAt(e,t,n,o,l);if(this.break||(a?f.to<l:f.from>l))return f;let u=t==ot.ByPosNoHeight?ot.ByPosNoHeight:ot.ByPos;return a?f.join(this.right.lineAt(l,u,n,o,l)):this.left.lineAt(l,u,n,i,s).join(f)}forEachLine(e,t,n,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,i,s,o),t>=a&&this.right.forEachLine(e,t,n,l,a,o);else{let f=this.lineAt(a,ot.ByPos,n,i,s);e<f.from&&this.left.forEachLine(e,f.from-1,n,i,s,o),f.to>=e&&f.from<=t&&o(f),t>f.to&&this.right.forEachLine(f.to+1,t,n,l,a,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 l of n)s.push(l);if(e>0&&o0(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),o0(s,l)}return rr.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?rr.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,l=t+s.length+this.break,a=null;return i&&i.from<=t+s.length&&i.more?a=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,n,i):o.updateHeight(e,l,n),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function o0(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Kt&&(n=r[e+1])instanceof Kt&&r.splice(e-1,3,new Kt(t.length+1+n.length))}const FO=5;class sc{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 Er?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Er(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 s0(o,i,n)):(o||s||i>=FO)&&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 Er(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Kt(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 Er)return e;let t=new Er(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 Er)&&!this.isCovered?this.nodes.push(new Er(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 Er&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let s=new sc(n,e);return $e.spans(t,n,i,s,0),s.finish(n)}}function jO(r,e,t){let n=new VO;return $e.compare(r,e,t,n,0),n.changes}class VO{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&Ku(e,t,this.changes,5)}}function WO(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),l=Math.max(0,t.top),a=Math.min(i.innerHeight,t.bottom);for(let f=r.parentNode;f&&f!=n.body;)if(f.nodeType==1){let u=f,c=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&c.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),a=f==r.parentNode?d.bottom:Math.min(a,d.bottom)}f=c.position=="absolute"||c.position=="fixed"?u.offsetParent:u.parentNode}else if(f.nodeType==11)f=f.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function $O(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class oc{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 pe.replace({widget:new HO(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class HO extends zr{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 l0{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=a0,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=rt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(fa).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new n0(t),this.stateDeco=e.facet(Oo).filter(n=>typeof n!="function"),this.heightMap=rr.empty().applyChanges(this.stateDeco,Ze.empty,this.heightOracle.setDoc(e.doc),[new Tr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=pe.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 ga(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?a0:new GO(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:Eo(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Oo).filter(u=>typeof u!="function");let i=e.changedRanges,s=Tr.extendWithRanges(i,jO(n,this.stateDeco,e?e.changes:Lt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let f=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),f&&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(wm)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?rt.RTL:rt.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let f=0,u=0;if(l.width&&l.height){let{scaleX:j,scaleY:M}=Hg(t,l);(this.scaleX!=j||this.scaleY!=M)&&(this.scaleX=j,this.scaleY=M,f|=8,o=a=!0)}let c=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=d)&&(this.paddingTop=c,this.paddingBottom=d,f|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,f|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Kg(e.scrollDOM);let g=(this.printing?$O:WO)(t,this.paddingTop),y=g.top-this.pixelViewport.top,x=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let E=l.width;if((this.contentDOMWidth!=E||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,f|=8),a){let j=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(j)&&(o=!0),o||i.lineWrapping&&Math.abs(E-this.contentDOMWidth)>i.charWidth){let{lineHeight:M,charWidth:F,textHeight:D}=e.docView.measureTextSize();o=M>0&&i.refresh(s,M,F,D,E/F,j),o&&(e.docView.minWidth=0,f|=8)}y>0&&x>0?u=Math.max(y,x):y<0&&x<0&&(u=Math.min(y,x)),i.heightChanged=!1;for(let M of this.viewports){let F=M.from==this.viewport.from?j:e.docView.measureVisibleLineHeights(M);this.heightMap=(o?rr.empty().applyChanges(this.stateDeco,Ze.empty,this.heightOracle,[new Tr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new i0(M.from,F))}i.heightChanged&&(f|=2)}let O=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(f&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),f}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:l}=this,a=new ga(i.lineAt(o-n*1e3,ot.ByHeight,s,0,0).from,i.lineAt(l+(1-n)*1e3,ot.ByHeight,s,0,0).to);if(t){let{head:f}=t.range;if(f<a.from||f>a.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(f,ot.ByPos,s,0,0),d;t.y=="center"?d=(c.top+c.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&f<a.from?d=c.top:d=c.bottom-u,a=new ga(i.lineAt(d-1e3/2,ot.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,ot.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new ga(this.heightMap.lineAt(n,ot.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ot.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,ot.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,ot.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<l+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 oc(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!=rt.LTR&&!n)return[];let l=[],a=(f,u,c,d)=>{if(u-f<s)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let x of g)if(x>f&&x<u){a(f,x-10,c,d),a(x+10,u,c,d);return}let y=UO(e,x=>x.from>=c.from&&x.to<=c.to&&Math.abs(x.from-f)<s&&Math.abs(x.to-u)<s&&!g.some(k=>x.from<k&&x.to>k));if(!y){if(u<c.to&&t&&n&&t.visibleRanges.some(x=>x.from<=u&&x.to>=u)){let x=t.moveToLineBoundary(se.cursor(u),!1,!0).head;x>f&&(u=x)}y=new oc(f,u,this.gapSize(c,f,u,d))}l.push(y)};for(let f of this.viewportLines){if(f.length<o)continue;let u=zO(f.from,f.to,this.stateDeco);if(u.total<o)continue;let c=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let g=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,x;if(c!=null){let k=va(u,c),E=((this.visibleBottom-this.visibleTop)/2+g)/f.height;y=k-E,x=k+E}else y=(this.visibleTop-f.top-g)/f.height,x=(this.visibleBottom-f.top+g)/f.height;d=ma(u,y),p=ma(u,x)}else{let g=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,x,k;if(c!=null){let E=va(u,c),O=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/g;x=E-O,k=E+O}else x=(this.pixelViewport.left-y)/g,k=(this.pixelViewport.right+y)/g;d=ma(u,x),p=ma(u,k)}d>f.from&&a(f.from,d,f,u),p<f.to&&a(p,f.to,f,u)}return l}gapSize(e,t,n,i){let s=va(i,n)-va(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){oc.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=pe.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=[];$e.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)||Eo(this.heightMap.lineAt(e,ot.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return Eo(this.heightMap.lineAt(this.scaler.fromDOM(e),ot.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 Eo(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 ga{constructor(e,t){this.from=e,this.to=t}}function zO(r,e,t){let n=[],i=r,s=0;return $e.spans(t,r,e,{span(){},point(o,l){o>i&&(n.push({from:i,to:o}),s+=o-i),i=l}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function ma({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],l=o-s;if(n<=l)return s+n;n-=l}}function va(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 UO(r,e){for(let t of r)if(e(t))return t}const a0={toDOM(r){return r},fromDOM(r){return r},scale:1};class GO{constructor(e,t,n){let i=0,s=0,o=0;this.viewports=n.map(({from:l,to:a})=>{let f=t.lineAt(l,ot.ByPos,e,0,0).top,u=t.lineAt(a,ot.ByPos,e,0,0).bottom;return i+=u-f,{from:l,to:a,top:f,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let 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 Eo(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new Sn(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>Eo(i,e)):r._content)}const ya=ge.define({combine:r=>r.join(" ")}),lc=ge.define({combine:r=>r.indexOf(!0)>-1}),ac=xn.newName(),f0=xn.newName(),u0=xn.newName(),c0={"&light":"."+f0,"&dark":"."+u0};function fc(r,e,t){return new xn(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 KO=fc("."+ac,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<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"}},c0),Po="\uFFFF";class YO{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(je.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Po}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 l=ft.get(i),a=ft.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:h0(i))||h0(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,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=i.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=ft.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+(_O(e,n.node,n.offset)?t:0))}}function _O(r,e,t){for(;;){if(!e||t<Vn(e))return!1;if(e==r)return!0;t=wo(e)+1,e=e.parentNode}}function h0(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}class d0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class JO{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 l=s||o?[]:ZO(e),a=new YO(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=qO(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Fu(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),f=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Fu(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((xe.ios||xe.chrome)&&e.state.selection.main.empty&&a!=f&&(u.from>0||u.to<e.state.doc.length)){let c=Math.min(a,f),d=Math.max(a,f),p=u.from-c,g=u.to-d;(p==0||p==1||c==0)&&(g==0||g==-1||d==e.state.doc.length)&&(a=0,f=e.state.doc.length)}this.newSel=se.single(f,a)}}}function p0(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:l}=e.bounds,a=i.from,f=null;(s===8||xe.android&&e.text.length<l-o)&&(a=i.to,f="end");let u=QO(r.state.doc.sliceString(o,l,Po),e.text,a-o,f);u&&(xe.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Po+Po&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Ze.of(e.text.slice(u.from,u.toB).split(Po))})}else n&&(!r.hasFocus&&r.state.facet(aa)||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))}:(xe.mac||xe.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:Ze.of([" "])}):xe.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:Ze.of([" "])}),t){if(xe.ios&&r.inputState.flushIOSKey()||xe.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&r.state.sliceDoc(t.from,i.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&ms(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)&&ms(r.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&ms(r.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let l,a=()=>l||(l=XO(r,t,n));return r.state.facet(ym).some(f=>f(r,t.from,t.to,o,a))||r.dispatch(a()),!0}else if(n&&!n.main.eq(i)){let o=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),l=r.inputState.lastSelectionOrigin),r.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function XO(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 l=s.from<e.from?i.sliceDoc(s.from,e.from):"",a=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+a))}else{let l=i.changes(e),a=t&&t.main.to<=l.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 f=r.state.sliceDoc(e.from,e.to),u,c=t&&Im(r,t.main.head);if(c){let g=e.insert.length-(e.to-e.from);u={from:c.from,to:c.to-g}}else u=r.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:l,range:a||g.map(l)};let y=g.to-d,x=y-f.length;if(g.to-g.from!=p||r.state.sliceDoc(x,y)!=f||g.to>=u.from&&g.from<=u.to)return{range:g};let k=i.changes({from:x,to:y,insert:e.insert}),E=g.to-s.to;return{changes:k,range:a?se.range(Math.max(0,a.anchor+E),Math.max(0,a.head+E)):g.map(k)}})}else n={changes:l,selection:a&&i.selection.replaceRange(a)}}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 QO(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,l=e.length;for(;o>0&&l>0&&r.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&r.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function ZO(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 d0(t,n)),(i!=t||s!=n)&&e.push(new d0(i,s))),e}function qO(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 e2={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},uc=xe.ie&&xe.ie_version<=11;class t2{constructor(e){this.view=e,this.active=!1,this.selectionRange=new $C,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);(xe.ie&&xe.ie_version<=11||xe.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()}),uc&&(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(aa)?n.root.activeElement!=this.dom:!na(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(xe.ie&&xe.ie_version<=11||xe.android&&xe.chrome)&&!n.state.selection.main.empty&&i.focusNode&&xo(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=xe.safari&&e.root.nodeType==11&&FC(this.dom.ownerDocument)==this.dom&&r2(this.view)||ra(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=na(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&zC(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,e2),uc&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),uc&&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&&ms(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&&na(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 JO(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=p0(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=g0(t,e.previousSibling||e.target.previousSibling,-1),i=g0(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 g0(r,e,t){for(;e;){let n=ft.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 r2(r){let e=null;function t(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.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,l=r.docView.domAtPos(r.state.selection.main.anchor);return xo(l.node,l.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class ce{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch: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||HC(e.parent)||document,this.viewState=new l0(e.state||je.create(e)),e.scrollTo&&e.scrollTo.is(la)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Co).map(n=>new Zu(n));for(let n of this.plugins)n.update(this);this.observer=new t2(this),this.inputState=new bO(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Em(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof Bt?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,l=0,a=null;e.some(d=>d.annotation(Zm))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=qm(s,o),a||(l=1));let f=this.observer.delayedAndroidKey,u=null;if(f?(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(je.phrases)!=this.state.facet(je.phrases))return this.setState(s);i=ua.create(this,s,e),i.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(c&&(c=c.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;c=new ys(p.empty?p:se.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(la)&&(c=p.value.clip(this.state))}this.viewState.update(i,c),this.bidiCache=ba.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(To)!=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(ya)!=i.state.facet(ya)&&(this.viewState.mustMeasureContent=!0),(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(Qu))try{d(i)}catch(p){cr(this.state,p,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!p0(this,u)&&f.force&&ms(this.contentDOM,f.key,f.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 l0(e),this.plugins=e.facet(Co).map(n=>new Zu(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Em(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(Co),n=e.state.facet(Co);if(t!=n){let i=[];for(let s of n){let o=t.indexOf(s);if(o<0)i.push(new Zu(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){cr(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let 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 l=0;;l++){if(o<0)if(Kg(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 a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];a&4||([this.measureRequests,f]=[f,this.measureRequests]);let u=f.map(p=>{try{return p.read(this)}catch(g){return cr(this.state,g),m0}}),c=ua.create(this,this.state,[]),d=!1;c.flags|=a,t?t.flags|=a:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),d=this.docView.update(c),d&&this.docViewUpdate());for(let p=0;p<f.length;p++)if(u[p]!=m0)try{let g=f[p];g.write&&g.write(u[p],this)}catch(g){cr(this.state,g)}if(d&&this.docView.updateSelection(!0),!c.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(g>1||g<-1){i=i+g,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Qu))l(t)}get themeClasses(){return ac+" "+(this.state.facet(lc)?u0:f0)+" "+this.state.facet(ya)}updateAttrs(){let e=v0(this,Sm,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(aa)?"true":"false",class:"cm-content",style:`${xe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),v0(this,fa,t);let n=this.observer.ignore(()=>{let i=Gu(this.contentDOM,this.contentAttrs,t),s=Gu(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(ce.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(To);let e=this.state.facet(ce.cspNonce);xn.mount(this.root,this.styleModules.concat(KO).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 nc(this,e,Fm(this,e,t,n))}moveByGroup(e,t){return nc(this,e,Fm(this,e,t,n=>vO(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=n[t?n.length-1:0];return se.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return mO(this,e,t,n)}moveVertically(e,t,n){return nc(this,e,yO(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(),Lm(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[ui.find(s,e-i.from,-1,t)];return ia(n,o.dir==rt.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(xm)||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>n2)return cm(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||fm(s.isolates,n=Cm(this,e))))return s.order;n||(n=Cm(this,e));let i=um(e.text,t,n);return this.bidiCache.push(new ba(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||xe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{zg(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 la.of(new ys(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 la.of(new ys(se.cursor(n.from),"start","start",n.top-e,t,!0))}static domEventHandlers(e){return st.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return st.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=xn.newName(),i=[ya.of(n),To.of(fc(`.${n}`,e))];return t&&t.dark&&i.push(lc.of(!0)),i}static baseTheme(e){return vn.lowest(To.of(fc("."+ac,e,c0)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&ft.get(n)||ft.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}}ce.styleModule=To,ce.inputHandler=ym,ce.focusChangeEffect=bm,ce.perLineTextDirection=xm,ce.exceptionSink=vm,ce.updateListener=Qu,ce.editable=aa,ce.mouseSelectionStyle=mm,ce.dragMovesSelection=gm,ce.clickAddsSelectionRange=pm,ce.decorations=Oo,ce.outerDecorations=km,ce.atomicRanges=qu,ce.bidiIsolatedRanges=Am,ce.scrollMargins=Om,ce.darkTheme=lc,ce.cspNonce=ge.define({combine:r=>r.length?r[0]:""}),ce.contentAttributes=fa,ce.editorAttributes=Sm,ce.lineWrapping=ce.contentAttributes.of({class:"cm-lineWrapping"}),ce.announce=Oe.define();const n2=4096,m0={};class ba{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:rt.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 ba(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function v0(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&&zu(o,t)}return t}const i2=xe.mac?"mac":xe.windows?"win":xe.linux?"linux":"key";function s2(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let i,s,o,l;for(let a=0;a<t.length-1;++a){const f=t[a];if(/^(cmd|meta|m)$/i.test(f))l=!0;else if(/^a(lt)?$/i.test(f))i=!0;else if(/^(c|ctrl|control)$/i.test(f))s=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+f)}return i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),l&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function xa(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 o2=vn.default(ce.domEventHandlers({keydown(r,e){return x0(b0(e.state),r,e,"editor")}})),Io=ge.define({enables:o2}),y0=new WeakMap;function b0(r){let e=r.facet(Io),t=y0.get(e);return t||y0.set(e,t=f2(e.reduce((n,i)=>n.concat(i),[]))),t}function l2(r,e,t){return x0(b0(r.state),e,r,t)}let ci=null;const a2=4e3;function f2(r,e=i2){let t=Object.create(null),n=Object.create(null),i=(o,l)=>{let a=n[o];if(a==null)n[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,f,u)=>{var c,d;let p=t[o]||(t[o]=Object.create(null)),g=l.split(/ (?!$)/).map(k=>s2(k,e));for(let k=1;k<g.length;k++){let E=g.slice(0,k).join(" ");i(E,!0),p[E]||(p[E]={preventDefault:!0,stopPropagation:!1,run:[O=>{let j=ci={view:O,prefix:E,scope:o};return setTimeout(()=>{ci==j&&(ci=null)},a2),!0}]})}let y=g.join(" ");i(y,!1);let x=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(c=p._any)===null||c===void 0?void 0:c.run)===null||d===void 0?void 0:d.slice())||[]});a&&x.run.push(a),f&&(x.preventDefault=!0),u&&(x.stopPropagation=!0)};for(let o of r){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let f of l){let u=t[f]||(t[f]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in u)u[c].run.push(o.any)}let a=o[e]||o.key;if(a)for(let f of l)s(f,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(f,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}function x0(r,e,t,n){let i=BC(e),s=Ut(i,0),o=Hr(s)==i.length&&i!=" ",l="",a=!1,f=!1,u=!1;ci&&ci.view==t&&ci.scope==n&&(l=ci.prefix+" ",Wm.indexOf(e.keyCode)<0&&(f=!0,ci=null));let c=new Set,d=x=>{if(x){for(let k of x.run)if(!c.has(k)&&(c.add(k),k(t,e)))return x.stopPropagation&&(u=!0),!0;x.preventDefault&&(x.stopPropagation&&(u=!0),f=!0)}return!1},p=r[n],g,y;return p&&(d(p[l+xa(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(xe.windows&&e.ctrlKey&&e.altKey)&&(g=oi[e.keyCode])&&g!=i?(d(p[l+xa(g,e,!0)])||e.shiftKey&&(y=bo[e.keyCode])!=i&&y!=g&&d(p[l+xa(y,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(p[l+xa(i,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),f&&(a=!0),a&&u&&e.stopPropagation(),a}class Mo{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=w0(e);return[new Mo(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return u2(e,t,n)}}function w0(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==rt.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function S0(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:ur.Text}}function u2(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==rt.LTR,o=r.contentDOM,l=o.getBoundingClientRect(),a=w0(r),f=o.querySelector(".cm-line"),u=f&&window.getComputedStyle(f),c=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=l.right-(u?parseInt(u.paddingRight):0),p=rc(r,n),g=rc(r,i),y=p.type==ur.Text?p:null,x=g.type==ur.Text?g:null;if(y&&(r.lineWrapping||p.widgetLineBreaks)&&(y=S0(r,n,y)),x&&(r.lineWrapping||g.widgetLineBreaks)&&(x=S0(r,i,x)),y&&x&&y.from==x.from)return E(O(t.from,t.to,y));{let M=y?O(t.from,null,y):j(p,!1),F=x?O(null,t.to,x):j(g,!0),D=[];return(y||p).to<(x||g).from-(y&&x?1:0)||p.widgetLineBreaks>1&&M.bottom+r.defaultLineHeight/2<F.top?D.push(k(c,M.bottom,d,F.top)):M.bottom<F.top&&r.elementAtHeight((M.bottom+F.top)/2).type==ur.Text&&(M.bottom=F.top=(M.bottom+F.top)/2),E(M).concat(D).concat(E(F))}function k(M,F,D,U){return new Mo(e,M-a.left,F-a.top-.01,D-M,U-F+.01)}function E({top:M,bottom:F,horizontal:D}){let U=[];for(let L=0;L<D.length;L+=2)U.push(k(D[L],M,D[L+1],F));return U}function O(M,F,D){let U=1e9,L=-1e9,$=[];function W(fe,me,Te,ye,Ce){let He=r.coordsAtPos(fe,fe==D.to?-2:2),Ae=r.coordsAtPos(Te,Te==D.from?2:-2);!He||!Ae||(U=Math.min(He.top,Ae.top,U),L=Math.max(He.bottom,Ae.bottom,L),Ce==rt.LTR?$.push(s&&me?c:He.left,s&&ye?d:Ae.right):$.push(!s&&ye?c:Ae.left,!s&&me?d:He.right))}let Y=M??D.from,le=F??D.to;for(let fe of r.visibleRanges)if(fe.to>Y&&fe.from<le)for(let me=Math.max(fe.from,Y),Te=Math.min(fe.to,le);;){let ye=r.state.doc.lineAt(me);for(let Ce of r.bidiSpans(ye)){let He=Ce.from+ye.from,Ae=Ce.to+ye.from;if(He>=Te)break;Ae>me&&W(Math.max(He,me),M==null&&He<=Y,Math.min(Ae,Te),F==null&&Ae>=le,Ce.dir)}if(me=ye.to+1,me>=Te)break}return $.length==0&&W(Y,M==null,le,F==null,r.textDirection),{top:U,bottom:L,horizontal:$}}function j(M,F){let D=l.top+(F?M.top:M.bottom);return{top:D,bottom:D,horizontal:[]}}}function c2(r,e){return r.constructor==e.constructor&&r.eq(e)}class h2{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(wa)!=e.state.facet(wa)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(wa);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)=>!c2(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 wa=ge.define();function k0(r){return[st.define(e=>new h2(e,r)),wa.of(r)]}const A0=!xe.ios,bs=ge.define({combine(r){return Cr(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function d2(r={}){return[bs.of(r),p2,g2,m2,wm.of(!0)]}function cR(r){return r.facet(bs)}function C0(r){return r.startState.facet(bs)!=r.state.facet(bs)}const p2=k0({above:!0,markers(r){let{state:e}=r,t=e.facet(bs),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||A0:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:se.cursor(i.head,i.head>i.anchor?-1:1);for(let a of Mo.forRange(r,o,l))n.push(a)}}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=C0(r);return t&&O0(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){O0(e.state,r)},class:"cm-cursorLayer"});function O0(r,e){e.style.animationDuration=r.facet(bs).cursorBlinkRate+"ms"}const g2=k0({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:Mo.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||C0(r)},class:"cm-selectionLayer"}),cc={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};A0&&(cc[".cm-line"].caretColor="transparent !important",cc[".cm-content"]={caretColor:"transparent !important"});const m2=vn.highest(ce.theme(cc)),T0=Oe.define({map(r,e){return r==null?null:e.mapPos(r)}}),Do=vt.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(T0)?n.value:t,r)}}),v2=st.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(Do);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(Do)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(Do),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(Do)!=r&&this.view.dispatch({effects:T0.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 y2(){return[Do,v2]}function E0(r,e,t,n,i){e.lastIndex=0;for(let s=r.iterRange(t,n),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function b2(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 hc{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=(l,a,f,u)=>i(u,f,f+l[0].length,l,a);else if(typeof n=="function")this.addMatch=(l,a,f,u)=>{let c=n(l,a,f);c&&u(f,f+l[0].length,c)};else if(n)this.addMatch=(l,a,f,u)=>u(f,f+l[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 bn,n=t.add.bind(t);for(let{from:i,to:s}of b2(e,this.maxLength))E0(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>e.view.viewport.from&&l<e.view.viewport.to&&(n=Math.min(l,n),i=Math.max(a,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),l=Math.min(s.to,i);if(l>o){let a=e.state.doc.lineAt(o),f=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(s.from,a.from),c=Math.min(s.to,f.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;l<f.to;l++)if(this.boundary.test(f.text[l-f.from])){c=l;break}}let d=[],p,g=(y,x,k)=>d.push(k.range(y,x));if(a==f)for(this.regexp.lastIndex=u-a.from;(p=this.regexp.exec(a.text))&&p.index<c-a.from;)this.addMatch(p,e,p.index+a.from,g);else E0(e.state.doc,this.regexp,u,c,(y,x)=>this.addMatch(x,e,y,g));t=t.update({filterFrom:u,filterTo:c,filter:(y,x)=>y<u||x>c,add:d})}}return t}}const dc=/x/.unicode!=null?"gu":"g",x2=new RegExp(`[\0-\b
|
|
150
|
+
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,dc),w2={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 pc=null;function S2(){var r;if(pc==null&&typeof document<"u"&&document.body){let e=document.body.style;pc=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return pc||!1}const Sa=ge.define({combine(r){let e=Cr(r,{render:null,specialChars:x2,addSpecialChars:null});return(e.replaceTabs=!S2())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,dc)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,dc)),e}});function k2(r={}){return[Sa.of(r),A2()]}let P0=null;function A2(){return P0||(P0=st.fromClass(class{constructor(r){this.view=r,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(Sa)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new hc({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Ut(e[0],0);if(s==9){let o=i.lineAt(n),l=t.state.tabSize,a=ds(o.text,l,n-o.from);return pe.replace({widget:new E2((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=pe.replace({widget:new T2(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(Sa);r.startState.facet(Sa)!=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 C2="\u2022";function O2(r){return r>=32?C2:r==10?"\u2424":String.fromCharCode(9216+r)}class T2 extends zr{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=O2(this.code),n=e.state.phrase("Control character")+" "+(w2[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 E2 extends zr{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 I0=null;function hR(){return[I0,fa.of(r=>{var e;return((e=r.plugin(I0))===null||e===void 0?void 0:e.attrs)||null})]}function P2(){return M2}const I2=pe.line({class:"cm-activeLine"}),M2=st.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(I2.range(i.from)),e=i.from)}return pe.set(t)}},{decorations:r=>r.decorations});class D2 extends zr{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?ps(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=ia(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 N2(r){return st.fromClass(class{constructor(e){this.view=e,this.placeholder=r?pe.set([pe.widget({widget:new D2(r),side:1}).range(0)]):pe.none}get decorations(){return this.view.state.doc.length?pe.none:this.placeholder}},{decorations:e=>e.decorations})}const gc=2e3;function R2(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>gc||t.off>gc||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=n;a<=i;a++){let f=r.doc.line(a);f.length<=l&&s.push(se.range(f.from+o,f.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=n;a<=i;a++){let f=r.doc.line(a),u=Nu(f.text,o,r.tabSize,!0);if(u<0)s.push(se.cursor(f.to));else{let c=Nu(f.text,l,r.tabSize);s.push(se.range(f.from+u,f.from+c))}}}return s}function L2(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function M0(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>gc?-1:i==n.length?L2(r,e.clientX):ds(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function B2(r,e){let t=M0(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 l=M0(r,i);if(!l)return n;let a=R2(r.state,t,l);return a.length?o?se.create(a.concat(n.ranges)):se.create(a):n}}:null}function F2(r){let e=r?.eventFilter||(t=>t.altKey&&t.button==0);return ce.mouseSelectionStyle.of((t,n)=>e(n)?B2(t,n):null)}const j2={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},V2={style:"cursor: crosshair"};function W2(r={}){let[e,t]=j2[r.key||"Alt"],n=st.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,ce.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?V2:null})]}const No="-10000px";class D0{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=n(o,s))}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<s.length;a++){let f=s[a],u=-1;if(f){for(let c=0;c<this.tooltips.length;c++){let d=this.tooltips[c];d&&d.create==f.create&&(u=c)}if(u<0)o[a]=this.createTooltipView(f,a?o[a-1]:null),l&&(l[a]=!!f.above);else{let c=o[a]=this.tooltipViews[u];l&&(l[a]=t[u]),c.update&&c.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(n=a.destroy)===null||n===void 0||n.call(a));return t&&(l.forEach((a,f)=>t[f]=a),t.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function dR(r={}){return ka.of(r)}function $2(r){let{win:e}=r;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const ka=ge.define({combine:r=>{var e,t,n;return{position:xe.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)||$2}}}),N0=new WeakMap,Aa=st.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(ka);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.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new D0(r,Ca,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),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(ka);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,e){let t=r.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),r.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.insertBefore(i,n)}return t.dom.style.position=this.position,t.dom.style.top=No,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var r,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(r=n.destroy)===null||r===void 0||r.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let 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(xe.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(i.style.top==No&&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(ka).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:n,scaleX:i,scaleY:s}=r,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],f=this.manager.tooltipViews[l],{dom:u}=f,c=r.pos[l],d=r.size[l];if(!c||c.bottom<=Math.max(t.top,n.top)||c.top>=Math.min(t.bottom,n.bottom)||c.right<Math.max(t.left,n.left)-.1||c.left>Math.min(t.right,n.right)+.1){u.style.top=No;continue}let p=a.arrow?f.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,y=d.right-d.left,x=(e=N0.get(f))!==null&&e!==void 0?e:d.bottom-d.top,k=f.offset||z2,E=this.view.textDirection==rt.LTR,O=d.width>n.right-n.left?E?n.left:n.right-d.width:E?Math.min(c.left-(p?14:0)+k.x,n.right-y):Math.max(n.left,c.left-y+(p?14:0)-k.x),j=this.above[l];!a.strictSide&&(j?c.top-(d.bottom-d.top)-k.y<n.top:c.bottom+(d.bottom-d.top)+k.y>n.bottom)&&j==n.bottom-c.bottom>c.top-n.top&&(j=this.above[l]=!j);let M=(j?c.top-n.top:n.bottom-c.bottom)-g;if(M<x&&f.resize!==!1){if(M<this.view.defaultLineHeight){u.style.top=No;continue}N0.set(f,x),u.style.height=(x=M)/s+"px"}else u.style.height&&(u.style.height="");let F=j?c.top-x-g-k.y:c.bottom+g+k.y,D=O+y;if(f.overlap!==!0)for(let U of o)U.left<D&&U.right>O&&U.top<F+x&&U.bottom>F&&(F=j?U.top-x-2-g:U.bottom+g+2);if(this.position=="absolute"?(u.style.top=(F-r.parent.top)/s+"px",u.style.left=(O-r.parent.left)/i+"px"):(u.style.top=F/s+"px",u.style.left=O/i+"px"),p){let U=c.left+(E?k.x:-k.x)-(O+14-7);p.style.left=U/i+"px"}f.overlap!==!0&&o.push({left:O,top:F,right:D,bottom:F+x}),u.classList.toggle("cm-tooltip-above",j),u.classList.toggle("cm-tooltip-below",!j),f.positioned&&f.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=No}},{eventObservers:{scroll(){this.maybeMeasure()}}}),H2=ce.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"}}}),z2={x:0,y:0},Ca=ge.define({enables:[Aa,H2]}),Ro=ge.define({combine:r=>r.reduce((e,t)=>e.concat(t),[])});class Oa{static create(e){return new Oa(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new D0(e,Ro,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}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 U2=Ca.compute([Ro],r=>{let e=r.facet(Ro);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:Oa.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class G2{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.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let i,s=1;if(n instanceof li)i=n.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let l=e.coordsAtPos(i);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),f=a&&a.dir==rt.RTL?-1:1;s=t.x<l.left?-f:f}let o=this.source(e,i,s);if(o?.then){let l=this.pending={pos:i};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>cr(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Aa),t=e?e.manager.tooltips.findIndex(n=>n.create==Oa.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!K2(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(n=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Y2(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ta=4;function K2(r,e){let t=r.getBoundingClientRect();return e.clientX>=t.left-Ta&&e.clientX<=t.right+Ta&&e.clientY>=t.top-Ta&&e.clientY<=t.bottom+Ta}function Y2(r,e,t,n,i,s){let o=r.scrollDOM.getBoundingClientRect(),l=r.documentTop+r.documentPadding.top+r.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,l)<i)return!1;let a=r.posAtCoords({x:n,y:i},!1);return a>=e&&a<=t}function _2(r,e={}){let t=Oe.define(),n=vt.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,fr.TrackDel);if(a!=null){let f=Object.assign(Object.create(null),l);f.pos=a,f.end!=null&&(f.end=s.changes.mapPos(f.end)),o.push(f)}}i=o}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(J2)&&(i=[]);return i},provide:i=>Ro.from(i)});return[n,st.define(i=>new G2(i,r,n,t,e.hoverTime||300)),U2]}function R0(r,e){let t=r.plugin(Aa);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}function pR(r){return r.facet(Ro).some(e=>e)}const J2=Oe.define(),gR=null;function mR(r){let e=r.plugin(Aa);e&&e.maybeMeasure()}const mc=ge.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 vR(r){return r?[mc.of(r)]:[]}function Lo(r,e){let t=r.plugin(L0),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const L0=st.fromClass(class{constructor(r){this.input=r.state.facet(Bo),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(mc);this.top=new Ea(r,!0,e.topContainer),this.bottom=new Ea(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(mc);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ea(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ea(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(Bo);if(t!=this.input){let n=t.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of n){let f=this.specs.indexOf(a),u;f<0?(u=a(r.view),l.push(u)):(u=this.panels[f],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 a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let n of this.panels)n.update&&n.update(r)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:r=>ce.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ea{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=B0(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=B0(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 B0(r){let e=r.nextSibling;return r.remove(),e}const Bo=ge.define({enables:L0});class kn extends Ri{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}kn.prototype.elementClass="",kn.prototype.toDOM=void 0,kn.prototype.mapMode=fr.TrackBefore,kn.prototype.startSide=kn.prototype.endSide=-1,kn.prototype.point=!0;const Pa=ge.define(),X2={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>$e.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Fo=ge.define();function F0(r){return[j0(),Fo.of(Object.assign(Object.assign({},X2),r))]}const vc=ge.define({combine:r=>r.some(e=>e)});function j0(r){let e=[Q2];return r&&r.fixed===!1&&e.push(vc.of(!0)),e}const Q2=st.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(Fo).map(e=>new W0(r,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!r.state.facet(vc),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/this.view.scaleY+"px"),this.view.state.facet(vc)!=!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=$e.iter(this.view.state.facet(Pa),this.view.viewport.from),n=[],i=this.gutters.map(s=>new Z2(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 l of s.type)if(l.type==ur.Text&&o){yc(t,n,l.from);for(let a of i)a.line(this.view,l,n);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==ur.Text){yc(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(Fo),t=r.state.facet(Fo),n=r.docChanged||r.heightChanged||r.viewportChanged||!$e.eq(r.startState.facet(Pa),r.state.facet(Pa),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 W0(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=>ce.scrollMargins.of(e=>{let t=e.plugin(r);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==rt.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function V0(r){return Array.isArray(r)?r:[r]}function yc(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class Z2{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=$e.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 l=new $0(e,o,s,n);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];yc(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 W0{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 a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,l,i)&&i.preventDefault()});this.markers=V0(t.markers(e)),t.initialSpacer&&(this.spacer=new $0(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=V0(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!$e.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 $0{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":""),q2(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 l=o,a=s<t.length?t[s++]:null,f=!1;if(a){let u=a.elementClass;u&&(n+=" "+u);for(let c=o;c<this.markers.length;c++)if(this.markers[c].compare(a)){l=c,f=!0;break}}else l=this.markers.length;for(;o<l;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let c=i.nextSibling;i.remove(),i=c}}if(!a)break;a.toDOM&&(f?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),f&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function q2(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 eT=ge.define(),xs=ge.define({combine(r){return Cr(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?(l,a,f)=>s(l,a,f)||o(l,a,f):o}return n}})}});class bc extends kn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function xc(r,e){return r.state.facet(xs).formatNumber(e,r.state)}const tT=Fo.compute([xs],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(eT)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new bc(xc(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(xs)!=e.state.facet(xs),initialSpacer(e){return new bc(xc(e,H0(e.state.doc.lines)))},updateSpacer(e,t){let n=xc(t.view,H0(t.view.state.doc.lines));return n==e.number?e:new bc(n)},domEventHandlers:r.facet(xs).domEventHandlers}));function rT(r={}){return[xs.of(r),j0(),tT]}function H0(r){let e=9;for(;e<r;)e=e*10+9;return e}const nT=new class extends kn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},iT=Pa.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(nT.range(i)))}return $e.of(e)});function sT(){return iT}const z0=new Map;function oT(r){let e=z0.get(r);return e||z0.set(r,e=pe.mark({attributes:r===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":r.replace(/ /g,"\xB7")}})),e}function U0(r){return st.define(e=>({decorations:r.createDeco(e),update(t){this.decorations=r.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const lT=U0(new hc({regexp:/\t| +/g,decoration:r=>oT(r[0]),boundary:/\S/}));function yR(){return lT}const aT=U0(new hc({regexp:/\s+$/g,decoration:pe.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function bR(){return aT}const xR={HeightMap:rr,HeightOracle:n0,MeasuredHeights:i0,QueryType:ot,ChangedRange:Tr,computeOrder:um,moveVisually:dm};var wc;const ji=new Qe;function G0(r){return ge.define({combine:r?e=>e.concat(r):void 0})}const fT=new Qe;class Pr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,je.prototype.hasOwnProperty("tree")||Object.defineProperty(je.prototype,"tree",{get(){return Ur(this)}}),this.parser=t,this.extension=[hi.of(this),je.languageData.of((s,o,l)=>{let a=K0(s,o,l),f=a.type.prop(ji);if(!f)return[];let u=s.facet(f),c=a.type.prop(fT);if(c){let d=a.resolve(o-a.from,l);for(let p of c)if(p.test(d,s)){let g=s.facet(p.facet);return p.type=="replace"?g:g.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return K0(e,t,n).type.prop(ji)==this.data}findRegions(e){let t=e.facet(hi);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(ji)==this.data){n.push({from:o,to:o+s.length});return}let l=s.prop(Qe.mounted);if(l){if(l.tree.prop(ji)==this.data){if(l.overlay)for(let a of l.overlay)n.push({from:a.from+o,to:a.to+o});else n.push({from:o,to:o+s.length});return}else if(l.overlay){let a=n.length;if(i(l.tree,l.overlay[0].from+o),n.length>a)return}}for(let a=0;a<s.children.length;a++){let f=s.children[a];f instanceof Rt&&i(f,s.positions[a]+o)}};return i(Ur(e),0),n}get allowsNesting(){return!0}}Pr.setState=Oe.define();function K0(r,e,t){let n=r.facet(hi),i=Ur(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,mt.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Ia extends Pr{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=G0(e.languageData);return new Ia(t,e.parser.configure({props:[ji.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ia(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ur(r){let e=r.field(Pr.state,!1);return e?e.tree:Rt.empty}function uT(r,e,t=50){var n;let i=(n=r.field(Pr.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 wR(r,e=r.doc.length){var t;return((t=r.field(Pr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function SR(r,e=r.viewport.to,t=100){let n=uT(r.state,e,t);return n!=Ur(r.state)&&r.dispatch({}),!!n}function kR(r){var e;return((e=r.plugin(J0))===null||e===void 0?void 0:e.isWorking())||!1}class cT{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 jo=null;class ws{constructor(e,t,n=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ws(e,t,[],Rt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new cT(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Rt.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(jn.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(jn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=jo;jo=this;try{return e()}finally{jo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Y0(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((f,u,c,d)=>a.push({fromA:f,toA:u,fromB:c,toB:d})),n=jn.applyChanges(n,a),i=Rt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let f of this.skipped){let u=e.mapPos(f.from,1),c=e.mapPos(f.to,-1);u<c&&l.push({from:u,to:c})}}}return new ws(this.parser,t,n,i,s,o,l,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=Y0(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 eC{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=jo;if(a){for(let f of i)a.tempSkipped.push(f);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Rt(pr.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 jo}}function Y0(r,e,t){return jn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ss{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 Ss(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ws.create(e.facet(hi).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ss(n)}}Pr.state=vt.define({create:Ss.init,update(r,e){for(let t of e.effects)if(t.is(Pr.setState))return t.value;return e.startState.facet(hi)!=e.state.facet(hi)?Ss.init(e.state):r.apply(e)}});let _0=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(_0=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Sc=typeof navigator<"u"&&(!((wc=navigator.scheduling)===null||wc===void 0)&&wc.isInputPending)?()=>navigator.scheduling.isInputPending():null,J0=st.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(Pr.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(Pr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=_0(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(Pr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Sc?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&n.doc.length>i+1e3,a=s.context.work(()=>Sc&&Sc()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pr.setState.of(new Ss(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>cr(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()}}}),hi=ge.define({combine(r){return r.length?r[0]:null},enables:r=>[Pr.state,J0,ce.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class hT{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class X0{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 X0(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 Q0=null,Z0=ge.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 Ma(r){let e=r.facet(Z0);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function q0(r,e){let t="",n=r.tabSize,i=r.facet(Z0)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function ev(r,e){r instanceof EditorState&&(r=new tv(r));for(let n of r.state.facet(Q0)){let i=n(r,e);if(i!==void 0)return i}let t=Ur(r.state);return t.length>=e?dT(r,t,e):null}function AR(r,e,t){let n=Object.create(null),i=new tv(r,{overrideIndentation:o=>{var l;return(l=n[o])!==null&&l!==void 0?l:-1}}),s=[];for(let o=e;o<=t;){let l=r.doc.lineAt(o);o=l.to+1;let a=ev(i,l.from);if(a==null)continue;/\S/.test(l.text)||(a=0);let f=/^\s*/.exec(l.text)[0],u=q0(r,a);f!=u&&(n[l.from]=a,s.push({from:l.from,to:l.from+f.length,insert:u}))}return r.changes(s)}class tv{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ma(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 countColumn(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 rv=new Qe;function dT(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 nv(n,r,t)}function nv(r,e,t){for(let n=r;n;n=n.next){let i=gT(n.node);if(i)return i(kc.create(e,t,n))}return 0}function pT(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function gT(r){let e=r.type.prop(rv);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(NodeProp.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>iv(o,!0,1,void 0,s&&!pT(o)?i.from:void 0)}return r.parent==null?mT:null}function mT(){return 0}class kc extends null{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 kc(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(vT(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return nv(this.context.next,this.base,this.pos)}}function vT(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function yT(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 l=t.to;;){let a=e.childAfter(l);if(!a||a==n)return null;if(!a.type.isSkipped)return a.from<o?t:null;l=a.to}}function CR({closing:r,align:e=!0,units:t=1}){return n=>iv(n,e,t,r)}function iv(r,e,t,n,i){let s=r.textAfter,o=s.match(/^\s*/)[0].length,l=n&&s.slice(o,o+n.length)==n||i==r.pos+o,a=e?yT(r):null;return a?l?r.column(a.from):r.column(a.to):r.baseIndent+(l?0:r.unit*t)}const OR=r=>r.baseIndent;function sv({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const bT=200;function TR(){return EditorState.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+bT)return r;let s=t.sliceString(i.from,n);if(!e.some(f=>f.test(s)))return r;let{state:o}=r,l=-1,a=[];for(let{head:f}of o.selection.ranges){let u=o.doc.lineAt(f);if(u.from==l)continue;l=u.from;let c=ev(o,u.from);if(c==null)continue;let d=/^\s*/.exec(u.text)[0],p=q0(o,c);d!=p&&a.push({from:u.from,to:u.from+d.length,insert:p})}return a.length?[r,{changes:a,sequential:!0}]:r})}const xT=ge.define(),ov=new Qe;function wT(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 ST(r,e,t){let n=Ur(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(ov);if(a&&(l.to<n.length-50||n.length==r.doc.length||!kT(l))){let f=a(l,r);f&&f.from<=t&&f.from>=e&&f.to>t&&(s=f)}}return s}function kT(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function Vo(r,e,t){for(let n of r.facet(xT)){let i=n(r,e,t);if(i)return i}return ST(r,e,t)}function lv(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 Wo=Oe.define({map:lv}),ks=Oe.define({map:lv});function Ac(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 di=vt.define({create(){return pe.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(Wo)&&!AT(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Oc),i=n?pe.replace({widget:new MT(n(e.state,t.value))}):uv;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(ks)&&(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=>ce.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(uv.range(n,i))}return pe.set(e,!0)}});function ER(r){return r.field(di,!1)||RangeSet.empty}function $o(r,e,t){var n;let i=null;return(n=r.field(di,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function AT(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Cc(r,e){return r.field(di,!1)?e:e.concat(Oe.appendConfig.of(av()))}const CT=r=>{for(let e of Ac(r)){let t=Vo(r.state,e.from,e.to);if(t)return r.dispatch({effects:Cc(r.state,[Wo.of(t),Da(r,t)])}),!0}return!1},OT=r=>{if(!r.state.field(di,!1))return!1;let e=[];for(let t of Ac(r)){let n=$o(r.state,t.from,t.to);n&&e.push(ks.of(n),Da(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function Da(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return ce.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const TT=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=Vo(e,i.from,i.to);s&&t.push(Wo.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Cc(r.state,t)}),!!t.length},ET=r=>{let e=r.state.field(di,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(ks.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function PT(r,e){for(let t=e;;){let n=Vo(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 PR=r=>{let e=[];for(let t of Ac(r)){let n=$o(r.state,t.from,t.to);if(n)e.push(ks.of(n),Da(r,n,!1));else{let i=PT(r,t);i&&e.push(Wo.of(i),Da(r,i))}}return e.length>0&&r.dispatch({effects:Cc(r.state,e)}),!!e.length},IR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:CT},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:OT},{key:"Ctrl-Alt-[",run:TT},{key:"Ctrl-Alt-]",run:ET}],IT={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Oc=ge.define({combine(r){return Cr(r,IT)}});function av(r){let e=[di,NT];return r&&e.push(Oc.of(r)),e}function fv(r,e){let{state:t}=r,n=t.facet(Oc),i=o=>{let l=r.lineBlockAt(r.posAtDOM(o.target)),a=$o(r.state,l.from,l.to);a&&r.dispatch({effects:ks.of(a)}),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 uv=pe.replace({widget:new class extends zr{toDOM(r){return fv(r,null)}}});class MT extends zr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return fv(e,this.value)}}const DT={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Tc extends null{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 MR(r={}){let e=Object.assign(Object.assign({},DT),r),t=new Tc(e,!0),n=new Tc(e,!1),i=ViewPlugin.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(hi)!=o.state.facet(hi)||o.startState.field(di,!1)!=o.state.field(di,!1)||Ur(o.startState)!=Ur(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new RangeSetBuilder;for(let a of o.viewportLineBlocks){let f=$o(o.state,a.from,a.to)?n:Vo(o.state,a.from,a.to)?t:null;f&&l.add(a.from,a.from,f)}return l.finish()}}),{domEventHandlers:s}=e;return[i,gutter({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||RangeSet.empty},initialSpacer(){return new Tc(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let f=$o(o.state,l.from,l.to);if(f)return o.dispatch({effects:ks.of(f)}),!0;let u=Vo(o.state,l.from,l.to);return u?(o.dispatch({effects:Wo.of(u)}),!0):!1}})}),av()]}const NT=ce.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 Na{constructor(e,t){this.specs=e;let n;function i(l){let a=xn.newName();return(n||(n=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Pr?l=>l.prop(ji)==o.data:o?l=>l==o:void 0,this.style=pu(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=n?new xn(n):null,this.themeType=t.themeType}static define(e,t){return new Na(e,t||{})}}const Ec=ge.define(),cv=ge.define({combine(r){return r.length?[r[0]]:null}});function Ra(r){let e=r.facet(Ec);return e.length?e:r.facet(cv)}function DR(r,e){let t=[LT],n;return r instanceof Na&&(r.module&&t.push(EditorView.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(cv.of(r)):n?t.push(Ec.computeN([EditorView.darkTheme],i=>i.facet(EditorView.darkTheme)==(n=="dark")?[r]:[])):t.push(Ec.of(r)),t}function NR(r,e,t){let n=Ra(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 RT{constructor(e){this.markCache=Object.create(null),this.tree=Ur(e.state),this.decorations=this.buildDeco(e,Ra(e.state))}update(e){let t=Ur(e.state),n=Ra(e.state),i=n!=Ra(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 pe.none;let n=new bn;for(let{from:i,to:s}of e.visibleRanges)gu(this.tree,t,(o,l,a)=>{n.add(o,l,this.markCache[a]||(this.markCache[a]=pe.mark({class:a})))},i,s);return n.finish()}}const LT=vn.high(st.fromClass(RT,{decorations:r=>r.decorations})),RR=Na.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]),BT=ce.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),hv=1e4,dv="()[]{}",pv=ge.define({combine(r){return Cr(r,{afterCursor:!0,brackets:dv,maxScanDistance:hv,renderMatch:VT})}}),FT=pe.mark({class:"cm-matchingBracket"}),jT=pe.mark({class:"cm-nonmatchingBracket"});function VT(r){let e=[],t=r.matched?FT:jT;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 WT=[vt.define({create(){return pe.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(pv);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=La(e.state,i.head,-1,n)||i.head>0&&La(e.state,i.head-1,1,n)||n.afterCursor&&(La(e.state,i.head,1,n)||i.head<e.state.doc.length&&La(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return pe.set(t,!0)},provide:r=>ce.decorations.from(r)}),BT];function BR(r={}){return[pv.of(r),WT]}const $T=new Qe;function Pc(r,e,t){let n=r.prop(e<0?Qe.openedBy:Qe.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 Ic(r){let e=r.type.prop($T);return e?e(r.node):r}function La(r,e,t,n={}){let i=n.maxScanDistance||hv,s=n.brackets||dv,o=Ur(r),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let f=Pc(a.type,t,s);if(f&&a.from<a.to){let u=Ic(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return HT(r,e,t,a,u,f,s)}}return zT(r,e,t,o,l.type,i,s)}function HT(r,e,t,n,i,s,o){let l=n.parent,a={from:i.from,to:i.to},f=0,u=l?.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(f==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let c=Ic(u);return{start:a,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(Pc(u.type,t,o))f++;else if(Pc(u.type,-t,o)){if(f==0){let c=Ic(u);return{start:a,end:c&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1}}f--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function zT(r,e,t,n,i,s,o){let l=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let f={from:t<0?e-1:e,to:t>0?e+1:e},u=r.doc.iterRange(e,t>0?r.doc.length:0),c=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;t<0&&(d+=p.length);let g=e+d*t;for(let y=t>0?0:p.length-1,x=t>0?p.length:-1;y!=x;y+=t){let k=o.indexOf(p[y]);if(!(k<0||n.resolveInner(g+y,1).type!=i))if(k%2==0==t>0)c++;else{if(c==1)return{start:f,end:{from:g+y,to:g+y+1},matched:k>>1==a>>1};c--}}t>0&&(d+=p.length)}return u.done?{start:f,matched:!1}:null}function gv(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 mv{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=gv(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:gv(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 UT(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||GT,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Dc}}function GT(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 vv=new WeakMap;class yv extends null{constructor(e){let t=G0(e.languageData),n=UT(e),i,s=new class extends Parser{createParse(o,l,a){return new YT(i,o,l,a)}};super(t,s,[Q0.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=XT(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new Av(n.tokenTable):JT}static define(e){return new yv(e)}getIndent(e,t){let n=Ur(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=vv.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let l=Mc(this,n,0,i.from,s??t),a,f;if(l?(f=l.state,a=l.pos+1):(f=this.streamParser.startState(e.unit),a=0),t-a>1e4)return null;for(;a<t;){let c=e.state.doc.lineAt(a),d=Math.min(t,c.to);if(c.length){let p=o?o(c.from):-1,g=new mv(c.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;g.pos<d-c.from;)xv(this.streamParser.token,g,f)}else this.streamParser.blankLine(f,e.unit);if(d==t)break;a=c.to+1}let u=e.lineAt(t);return o&&s==null&&vv.set(e.state,u.from),this.streamParser.indent(f,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Mc(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 l=e.children[o],a=t+e.positions[o],f=l instanceof Tree&&a<i&&Mc(r,l,a,n,i);if(f)return f}return null}function bv(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],l=e.children[s],a;if(o<n&&l instanceof Tree){if(!(a=bv(r,l,t-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function KT(r,e,t,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),l=s<=t&&o>t&&Mc(r,i.tree,0-i.offset,t,o),a;if(l&&(a=bv(r,i.tree,t+i.offset,l.pos+i.offset,!1)))return{state:l.state,tree:a}}return{state:r.streamParser.startState(n?Ma(n):4),tree:Tree.empty}}class YT{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=ws.get(),o=i[0].from,{state:l,tree:a}=KT(e,n,o,s?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let f=0;f<a.children.length;f++)this.chunks.push(a.children[f]),this.chunkPos.push(a.positions[f]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ma(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=ws.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
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?Le.closedBy:Le.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(Le.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)`
|
|
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,l=this.lineAfter(o);t+=l,n=o+l.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 mv(t,e?e.state.tabSize:4,e?Ma(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xv(s.token,o,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),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:_T,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 xv(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 Dc=Object.create(null),Ho=[pr.none],_T=new lu(Ho),wv=[],Sv=Object.create(null),kv=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"]])kv[r]=Cv(Dc,e);class Av{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kv)}resolve(e){return e?this.table[e]||(this.table[e]=Cv(this.extra,e)):0}}const JT=new Av(Dc);function Nc(r,e){wv.indexOf(r)>-1||(wv.push(r),console.warn(e))}function Cv(r,e){let t=[];for(let l of e.split(" ")){let a=[];for(let f of l.split(".")){let u=r[f]||P[f];u?typeof u=="function"?a.length?a=a.map(u):Nc(f,`Modifier ${f} used at start of tag`):a.length?Nc(f,`Tag ${f} used as modifier`):a=Array.isArray(u)?u:[u]:Nc(f,`Unknown highlighting tag ${f}`)}for(let f of a)t.push(f)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(l=>l.id),s=Sv[i];if(s)return s.id;let o=Sv[i]=pr.define({id:Ho.length,name:n,props:[du({[n]:t})]});return Ho.push(o),o.id}function XT(r){let e=NodeType.define({id:Ho.length,name:"Document",props:[ji.add(()=>r)],top:!0});return Ho.push(e),e}const FR=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=QT(e,r.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function QT(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 ZT=Ia.define({name:"json",parser:mC.configure({props:[rv.add({Object:sv({except:/^\s*\}/}),Array:sv({except:/^\s*\]/})}),ov.add({"Object Array":wT})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function qT(){return new hT(ZT)}function Rc(){return Rc=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},Rc.apply(this,arguments)}function eE(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}var Lc;const Vi=new Re;function Ov(r){return Facet.define({combine:r?e=>e.concat(r):void 0})}const tE=new Re;class Gr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,je.prototype.hasOwnProperty("tree")||Object.defineProperty(je.prototype,"tree",{get(){return It(this)}}),this.parser=t,this.extension=[pi.of(this),je.languageData.of((s,o,l)=>{let a=Tv(s,o,l),f=a.type.prop(Vi);if(!f)return[];let u=s.facet(f),c=a.type.prop(tE);if(c){let d=a.resolve(o-a.from,l);for(let p of c)if(p.test(d,s)){let g=s.facet(p.facet);return p.type=="replace"?g:g.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Tv(e,t,n).type.prop(Vi)==this.data}findRegions(e){let t=e.facet(pi);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(Vi)==this.data){n.push({from:o,to:o+s.length});return}let l=s.prop(Re.mounted);if(l){if(l.tree.prop(Vi)==this.data){if(l.overlay)for(let a of l.overlay)n.push({from:a.from+o,to:a.to+o});else n.push({from:o,to:o+s.length});return}else if(l.overlay){let a=n.length;if(i(l.tree,l.overlay[0].from+o),n.length>a)return}}for(let a=0;a<s.children.length;a++){let f=s.children[a];f instanceof gt&&i(f,s.positions[a]+o)}};return i(It(e),0),n}get allowsNesting(){return!0}}Gr.setState=Oe.define();function Tv(r,e,t){let n=r.facet(pi),i=It(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,ct.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Bc extends null{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Ov(e.languageData);return new Bc(t,e.parser.configure({props:[Vi.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Bc(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function It(r){let e=r.field(Gr.state,!1);return e?e.tree:gt.empty}function rE(r,e,t=50){var n;let i=(n=r.field(Gr.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 jR(r,e=r.doc.length){var t;return((t=r.field(Gr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function VR(r,e=r.viewport.to,t=100){let n=rE(r.state,e,t);return n!=It(r.state)&&r.dispatch({}),!!n}function WR(r){var e;return((e=r.plugin(Iv))===null||e===void 0?void 0:e.isWorking())||!1}class nE{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 zo=null;class As{constructor(e,t,n=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new As(e,t,[],gt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new nE(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=gt.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(Bn.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(Bn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=zo;zo=this;try{return e()}finally{zo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ev(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((f,u,c,d)=>a.push({fromA:f,toA:u,fromB:c,toB:d})),n=Bn.applyChanges(n,a),i=gt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let f of this.skipped){let u=e.mapPos(f.from,1),c=e.mapPos(f.to,-1);u<c&&l.push({from:u,to:c})}}}return new As(this.parser,t,n,i,s,o,l,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=Ev(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 jp{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=zo;if(a){for(let f of i)a.tempSkipped.push(f);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new gt(ar.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 zo}}function Ev(r,e,t){return Bn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class Cs{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 Cs(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=As.create(e.facet(pi).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Cs(n)}}Gr.state=vt.define({create:Cs.init,update(r,e){for(let t of e.effects)if(t.is(Gr.setState))return t.value;return e.startState.facet(pi)!=e.state.facet(pi)?Cs.init(e.state):r.apply(e)}});let Pv=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Pv=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Fc=typeof navigator<"u"&&(!((Lc=navigator.scheduling)===null||Lc===void 0)&&Lc.isInputPending)?()=>navigator.scheduling.isInputPending():null,Iv=st.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(Gr.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(Gr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Pv(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(Gr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Fc?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&n.doc.length>i+1e3,a=s.context.work(()=>Fc&&Fc()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Gr.setState.of(new Cs(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>cr(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()}}}),pi=ge.define({combine(r){return r.length?r[0]:null},enables:r=>[Gr.state,Iv,ce.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class $R{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Mv{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 Mv(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 Dv=ge.define(),Ba=ge.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 Wi(r){let e=r.facet(Ba);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function Os(r,e){let t="",n=r.tabSize,i=r.facet(Ba)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Fa(r,e){r instanceof je&&(r=new Uo(r));for(let n of r.state.facet(Dv)){let i=n(r,e);if(i!==void 0)return i}let t=It(r.state);return t.length>=e?sE(r,t,e):null}function HR(r,e,t){let n=Object.create(null),i=new Uo(r,{overrideIndentation:o=>{var l;return(l=n[o])!==null&&l!==void 0?l:-1}}),s=[];for(let o=e;o<=t;){let l=r.doc.lineAt(o);o=l.to+1;let a=Fa(i,l.from);if(a==null)continue;/\S/.test(l.text)||(a=0);let f=/^\s*/.exec(l.text)[0],u=Os(r,a);f!=u&&(n[l.from]=a,s.push({from:l.from,to:l.from+f.length,insert:u}))}return r.changes(s)}class Uo{constructor(e,t={}){this.state=e,this.options=t,this.unit=Wi(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 ds(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 iE=new Re;function sE(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 Nv(n,r,t)}function Nv(r,e,t){for(let n=r;n;n=n.next){let i=lE(n.node);if(i)return i(jc.create(e,t,n))}return 0}function oE(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function lE(r){let e=r.type.prop(iE);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=>Rv(o,!0,1,void 0,s&&!oE(o)?i.from:void 0)}return r.parent==null?aE:null}function aE(){return 0}class jc extends Uo{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 jc(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(fE(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Nv(this.context.next,this.base,this.pos)}}function fE(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function uE(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 l=t.to;;){let a=e.childAfter(l);if(!a||a==n)return null;if(!a.type.isSkipped)return a.from<o?t:null;l=a.to}}function zR({closing:r,align:e=!0,units:t=1}){return n=>Rv(n,e,t,r)}function Rv(r,e,t,n,i){let s=r.textAfter,o=s.match(/^\s*/)[0].length,l=n&&s.slice(o,o+n.length)==n||i==r.pos+o,a=e?uE(r):null;return a?l?r.column(a.from):r.column(a.to):r.baseIndent+(l?0:r.unit*t)}const UR=r=>r.baseIndent;function GR({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const cE=200;function hE(){return je.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+cE)return r;let s=t.sliceString(i.from,n);if(!e.some(f=>f.test(s)))return r;let{state:o}=r,l=-1,a=[];for(let{head:f}of o.selection.ranges){let u=o.doc.lineAt(f);if(u.from==l)continue;l=u.from;let c=Fa(o,u.from);if(c==null)continue;let d=/^\s*/.exec(u.text)[0],p=Os(o,c);d!=p&&a.push({from:u.from,to:u.from+d.length,insert:p})}return a.length?[r,{changes:a,sequential:!0}]:r})}const dE=ge.define(),pE=new Re;function KR(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 gE(r,e,t){let n=It(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(pE);if(a&&(l.to<n.length-50||n.length==r.doc.length||!mE(l))){let f=a(l,r);f&&f.from<=t&&f.from>=e&&f.to>t&&(s=f)}}return s}function mE(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function Go(r,e,t){for(let n of r.facet(dE)){let i=n(r,e,t);if(i)return i}return gE(r,e,t)}function Lv(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 Ko=Oe.define({map:Lv}),Ts=Oe.define({map:Lv});function Vc(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 gi=vt.define({create(){return pe.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(Ko)&&!vE(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet($c),i=n?pe.replace({widget:new CE(n(e.state,t.value))}):jv;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(Ts)&&(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=>ce.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(jv.range(n,i))}return pe.set(e,!0)}});function YR(r){return r.field(gi,!1)||RangeSet.empty}function Yo(r,e,t){var n;let i=null;return(n=r.field(gi,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function vE(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Wc(r,e){return r.field(gi,!1)?e:e.concat(Oe.appendConfig.of(Bv()))}const yE=r=>{for(let e of Vc(r)){let t=Go(r.state,e.from,e.to);if(t)return r.dispatch({effects:Wc(r.state,[Ko.of(t),ja(r,t)])}),!0}return!1},bE=r=>{if(!r.state.field(gi,!1))return!1;let e=[];for(let t of Vc(r)){let n=Yo(r.state,t.from,t.to);n&&e.push(Ts.of(n),ja(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function ja(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return ce.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const xE=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=Go(e,i.from,i.to);s&&t.push(Ko.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Wc(r.state,t)}),!!t.length},wE=r=>{let e=r.state.field(gi,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(Ts.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function SE(r,e){for(let t=e;;){let n=Go(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 _R=r=>{let e=[];for(let t of Vc(r)){let n=Yo(r.state,t.from,t.to);if(n)e.push(Ts.of(n),ja(r,n,!1));else{let i=SE(r,t);i&&e.push(Ko.of(i),ja(r,i))}}return e.length>0&&r.dispatch({effects:Wc(r.state,e)}),!!e.length},kE=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yE},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bE},{key:"Ctrl-Alt-[",run:xE},{key:"Ctrl-Alt-]",run:wE}],AE={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},$c=ge.define({combine(r){return Cr(r,AE)}});function Bv(r){let e=[gi,EE];return r&&e.push($c.of(r)),e}function Fv(r,e){let{state:t}=r,n=t.facet($c),i=o=>{let l=r.lineBlockAt(r.posAtDOM(o.target)),a=Yo(r.state,l.from,l.to);a&&r.dispatch({effects:Ts.of(a)}),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 jv=pe.replace({widget:new class extends zr{toDOM(r){return Fv(r,null)}}});class CE extends zr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Fv(e,this.value)}}const OE={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Hc extends kn{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 TE(r={}){let e=Object.assign(Object.assign({},OE),r),t=new Hc(e,!0),n=new Hc(e,!1),i=st.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(pi)!=o.state.facet(pi)||o.startState.field(gi,!1)!=o.state.field(gi,!1)||It(o.startState)!=It(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new bn;for(let a of o.viewportLineBlocks){let f=Yo(o.state,a.from,a.to)?n:Go(o.state,a.from,a.to)?t:null;f&&l.add(a.from,a.from,f)}return l.finish()}}),{domEventHandlers:s}=e;return[i,F0({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||$e.empty},initialSpacer(){return new Hc(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let f=Yo(o.state,l.from,l.to);if(f)return o.dispatch({effects:Ts.of(f)}),!0;let u=Go(o.state,l.from,l.to);return u?(o.dispatch({effects:Ko.of(u)}),!0):!1}})}),Bv()]}const EE=ce.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 Es{constructor(e,t){this.specs=e;let n;function i(l){let a=xn.newName();return(n||(n=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Gr?l=>l.prop(Vi)==o.data:o?l=>l==o:void 0,this.style=pu(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=n?new xn(n):null,this.themeType=t.themeType}static define(e,t){return new Es(e,t||{})}}const zc=ge.define(),Vv=ge.define({combine(r){return r.length?[r[0]]:null}});function Va(r){let e=r.facet(zc);return e.length?e:r.facet(Vv)}function Uc(r,e){let t=[IE],n;return r instanceof Es&&(r.module&&t.push(ce.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(Vv.of(r)):n?t.push(zc.computeN([ce.darkTheme],i=>i.facet(ce.darkTheme)==(n=="dark")?[r]:[])):t.push(zc.of(r)),t}function JR(r,e,t){let n=Va(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 PE{constructor(e){this.markCache=Object.create(null),this.tree=It(e.state),this.decorations=this.buildDeco(e,Va(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=It(e.state),n=Va(e.state),i=n!=Va(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return pe.none;let n=new bn;for(let{from:i,to:s}of e.visibleRanges)gu(this.tree,t,(o,l,a)=>{n.add(o,l,this.markCache[a]||(this.markCache[a]=pe.mark({class:a})))},i,s);return n.finish()}}const IE=vn.high(st.fromClass(PE,{decorations:r=>r.decorations})),ME=Es.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]),DE=ce.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Wv=1e4,$v="()[]{}",Hv=ge.define({combine(r){return Cr(r,{afterCursor:!0,brackets:$v,maxScanDistance:Wv,renderMatch:LE})}}),NE=pe.mark({class:"cm-matchingBracket"}),RE=pe.mark({class:"cm-nonmatchingBracket"});function LE(r){let e=[],t=r.matched?NE:RE;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 BE=[vt.define({create(){return pe.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(Hv);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=An(e.state,i.head,-1,n)||i.head>0&&An(e.state,i.head-1,1,n)||n.afterCursor&&(An(e.state,i.head,1,n)||i.head<e.state.doc.length&&An(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return pe.set(t,!0)},provide:r=>ce.decorations.from(r)}),DE];function FE(r={}){return[Hv.of(r),BE]}const jE=new Re;function Gc(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 Kc(r){let e=r.type.prop(jE);return e?e(r.node):r}function An(r,e,t,n={}){let i=n.maxScanDistance||Wv,s=n.brackets||$v,o=It(r),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let f=Gc(a.type,t,s);if(f&&a.from<a.to){let u=Kc(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return VE(r,e,t,a,u,f,s)}}return WE(r,e,t,o,l.type,i,s)}function VE(r,e,t,n,i,s,o){let l=n.parent,a={from:i.from,to:i.to},f=0,u=l?.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(f==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let c=Kc(u);return{start:a,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(Gc(u.type,t,o))f++;else if(Gc(u.type,-t,o)){if(f==0){let c=Kc(u);return{start:a,end:c&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1}}f--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function WE(r,e,t,n,i,s,o){let l=t<0?r.sliceDoc(e-1,e):r.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let f={from:t<0?e-1:e,to:t>0?e+1:e},u=r.doc.iterRange(e,t>0?r.doc.length:0),c=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;t<0&&(d+=p.length);let g=e+d*t;for(let y=t>0?0:p.length-1,x=t>0?p.length:-1;y!=x;y+=t){let k=o.indexOf(p[y]);if(!(k<0||n.resolveInner(g+y,1).type!=i))if(k%2==0==t>0)c++;else{if(c==1)return{start:f,end:{from:g+y,to:g+y+1},matched:k>>1==a>>1};c--}}t>0&&(d+=p.length)}return u.done?{start:f,matched:!1}:null}function zv(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 Uv{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=zv(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:zv(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 $E(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||HE,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||_c}}function HE(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 Gv=new WeakMap;class Kv extends null{constructor(e){let t=Ov(e.languageData),n=$E(e),i,s=new class extends Parser{createParse(o,l,a){return new UE(i,o,l,a)}};super(t,s,[Dv.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=YE(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new Zv(n.tokenTable):KE}static define(e){return new Kv(e)}getIndent(e,t){let n=It(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=Gv.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let l=Yc(this,n,0,i.from,s??t),a,f;if(l?(f=l.state,a=l.pos+1):(f=this.streamParser.startState(e.unit),a=0),t-a>1e4)return null;for(;a<t;){let c=e.state.doc.lineAt(a),d=Math.min(t,c.to);if(c.length){let p=o?o(c.from):-1,g=new Uv(c.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;g.pos<d-c.from;)_v(this.streamParser.token,g,f)}else this.streamParser.blankLine(f,e.unit);if(d==t)break;a=c.to+1}let u=e.lineAt(t);return o&&s==null&&Gv.set(e.state,u.from),this.streamParser.indent(f,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Yc(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 l=e.children[o],a=t+e.positions[o],f=l instanceof Tree&&a<i&&Yc(r,l,a,n,i);if(f)return f}return null}function Yv(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],l=e.children[s],a;if(o<n&&l instanceof Tree){if(!(a=Yv(r,l,t-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function zE(r,e,t,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),l=s<=t&&o>t&&Yc(r,i.tree,0-i.offset,t,o),a;if(l&&(a=Yv(r,i.tree,t+i.offset,l.pos+i.offset,!1)))return{state:l.state,tree:a}}return{state:r.streamParser.startState(n?Wi(n):4),tree:Tree.empty}}class UE{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=As.get(),o=i[0].from,{state:l,tree:a}=zE(e,n,o,s?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let f=0;f<a.children.length;f++)this.chunks.push(a.children[f]),this.chunkPos.push(a.positions[f]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Wi(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=As.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==`
|
|
153
|
+
`&&(t="");else{let n=t.indexOf(`
|
|
154
|
+
`);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,l=this.lineAfter(o);t+=l,n=o+l.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 Uv(t,e?e.state.tabSize:4,e?Wi(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=_v(s.token,o,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),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:GE,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 _v(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 _c=Object.create(null),_o=[ar.none],GE=new Nl(_o),Jv=[],Xv=Object.create(null),Qv=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"]])Qv[r]=qv(_c,e);class Zv{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Qv)}resolve(e){return e?this.table[e]||(this.table[e]=qv(this.extra,e)):0}}const KE=new Zv(_c);function Jc(r,e){Jv.indexOf(r)>-1||(Jv.push(r),console.warn(e))}function qv(r,e){let t=[];for(let l of e.split(" ")){let a=[];for(let f of l.split(".")){let u=r[f]||P[f];u?typeof u=="function"?a.length?a=a.map(u):Jc(f,`Modifier ${f} used at start of tag`):a.length?Jc(f,`Tag ${f} used as modifier`):a=Array.isArray(u)?u:[u]:Jc(f,`Unknown highlighting tag ${f}`)}for(let f of a)t.push(f)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(l=>l.id),s=Xv[i];if(s)return s.id;let o=Xv[i]=ar.define({id:_o.length,name:n,props:[du({[n]:t})]});return _o.push(o),o.id}function YE(r){let e=NodeType.define({id:_o.length,name:"Document",props:[Vi.add(()=>r)],top:!0});return _o.push(e),e}function ey(r){return r.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(r)}function ty(r){for(let e=r.iter();!e.next().done;)if(ey(e.value))return!0;return!1}function _E(r){let e=!1;return r.iterChanges((t,n,i,s,o)=>{!e&&ty(o)&&(e=!0)}),e}const Xc=ge.define({combine:r=>r.some(e=>e)});function QR(r={}){let e=[JE];return r.alwaysIsolate&&e.push(Xc.of(!0)),e}const JE=st.fromClass(class{constructor(r){this.always=r.state.facet(Xc)||r.textDirection!=rt.LTR||r.state.facet(ce.perLineTextDirection),this.hasRTL=!this.always&&ty(r.state.doc),this.tree=It(r.state),this.decorations=this.always||this.hasRTL?ry(r,this.tree,this.always):pe.none}update(r){let e=r.state.facet(Xc)||r.view.textDirection!=rt.LTR||r.state.facet(ce.perLineTextDirection);if(!e&&!this.hasRTL&&_E(r.changes)&&(this.hasRTL=!0),!e&&!this.hasRTL)return;let t=It(r.state);(e!=this.always||t!=this.tree||r.docChanged||r.viewportChanged)&&(this.tree=t,this.always=e,this.decorations=ry(r.view,t,e))}},{provide:r=>{function e(t){var n,i;return(i=(n=t.plugin(r))===null||n===void 0?void 0:n.decorations)!==null&&i!==void 0?i:pe.none}return[ce.outerDecorations.of(e),vn.lowest(ce.bidiIsolatedRanges.of(e))]}});function ry(r,e,t){let n=new bn,i=r.visibleRanges;t||(i=XE(i,r.state.doc));for(let{from:s,to:o}of i)e.iterate({enter:l=>{let a=l.type.prop(Re.isolate);a&&n.add(l.from,l.to,QE[a])},from:s,to:o});return n.finish()}function XE(r,e){let t=e.iter(),n=0,i=[],s=null;for(let{from:o,to:l}of r)for(o!=n&&(n<o&&t.next(o-n),n=o);;){let a=n,f=n+t.value.length;if(!t.lineBreak&&ey(t.value)&&(s&&s.to>a-10?s.to=Math.min(l,f):i.push(s={from:a,to:Math.min(l,f)})),n>=l)break;n=f,t.next()}return i}const QE={rtl:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:rt.RTL}),ltr:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:rt.LTR}),auto:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})},ZE=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=Zc(r.state,t.from);return n.line?qE(r):n.block?tP(r):!1};function Qc(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 qE=Qc(iP,0),ZR=null,qR=null,eP=Qc(ny,0),e5=null,t5=null,tP=Qc((r,e)=>ny(r,e,nP(e)),0);function Zc(r,e){let t=r.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Jo=50;function rP(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-Jo,n),o=r.sliceDoc(i,i+Jo),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,f=s.length-l;if(s.slice(f-e.length,f)==e&&o.slice(a,a+t.length)==t)return{open:{pos:n-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let u,c;i-n<=2*Jo?u=c=r.sliceDoc(n,i):(u=r.sliceDoc(n,n+Jo),c=r.sliceDoc(i-Jo,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(c)[0].length,g=c.length-p-t.length;return u.slice(d,d+e.length)==e&&c.slice(g,g+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(c.charAt(g-1))?1:0}}:null}function nP(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 ny(r,e,t=e.selection.ranges){let n=t.map(s=>Zc(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>rP(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,l;o<i.length;o++)if(l=i[o]){let a=n[o],{open:f,close:u}=l;s.push({from:f.pos-a.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:s}}return null}function iP(r,e,t=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of t){let l=n.length,a=1e9,f=Zc(e,s).line;if(f){for(let u=s;u<=o;){let c=e.doc.lineAt(u);if(c.from>i&&(s==o||o>c.from)){i=c.from;let d=/^\s*/.exec(c.text)[0].length,p=d==c.length,g=c.text.slice(d,d+f.length)==f?d:-1;d<c.text.length&&d<a&&(a=d),n.push({line:c,comment:g,token:f,indent:d,empty:p,single:!1})}u=c.to+1}if(a<1e9)for(let u=l;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=a);n.length==l+1&&(n[l].single=!0)}}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:f,empty:u,single:c}of n)(c||!u)&&s.push({from:l.from+f,insert:a+" "});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:l,token:a}of n)if(l>=0){let f=o.from+l,u=f+a.length;o.text[u-o.from]==" "&&u++,s.push({from:f,to:u})}return{changes:s}}return null}const qc=yn.define(),sP=yn.define(),oP=ge.define(),iy=ge.define({combine(r){return Cr(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)})}}),eh=vt.define({create(){return Cn.empty},update(r,e){let t=e.state.facet(iy),n=e.annotation(qc);if(n){let a=gr.fromTransaction(e,n.selection),f=n.side,u=f==0?r.undone:r.done;return a?u=$a(u,u.length,t.minDepth,a):u=ly(u,e.startState.selection),new Cn(f==0?n.rest:u,f==0?u:n.rest)}let i=e.annotation(sP);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(Bt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=gr.fromTransaction(e),o=e.annotation(Bt.time),l=e.annotation(Bt.userEvent);return s?r=r.addChanges(s,o,l,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,l,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 Cn(r.done.map(gr.fromJSON),r.undone.map(gr.fromJSON))}});function lP(r={}){return[eh,iy.of(r),ce.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?sy:e.inputType=="historyRedo"?th:null;return n?(e.preventDefault(),n(t)):!1}})]}const r5=null;function Wa(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(eh,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}const sy=Wa(0,!1),th=Wa(1,!1),aP=Wa(0,!0),fP=Wa(1,!0);function n5(r){return function(e){let t=e.field(eh,!1);if(!t)return 0;let n=r==0?t.done:t.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const i5=null,s5=null;class gr{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 gr(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 gr(e.changes&&Lt.fromJSON(e.changes),[],e.mapped&&mn.fromJSON(e.mapped),e.startSelection&&se.fromJSON(e.startSelection),e.selectionsAfter.map(se.fromJSON))}static fromTransaction(e,t){let n=Kr;for(let i of e.startState.facet(oP)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new gr(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Kr)}static selection(e){return new gr(void 0,Kr,void 0,void 0,e)}}function $a(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 uP(r,e){let t=[],n=!1;return r.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a<t.length;){let f=t[a++],u=t[a++];l>=f&&o<=u&&(n=!0)}}),n}function cP(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function oy(r,e){return r.length?e.length?r.concat(e):r:e}const Kr=[],hP=200;function ly(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-hP));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),$a(r,r.length-1,1e9,t.setSelAfter(n)))}else return[gr.selection([e])]}function dP(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 rh(r,e){if(!r.length)return r;let t=r.length,n=Kr;for(;t;){let i=pP(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?[gr.selection(n)]:Kr}function pP(r,e,t){let n=oy(r.selectionsAfter.length?r.selectionsAfter.map(l=>l.map(e)):Kr,t);if(!r.changes)return gr.selection(n);let i=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new gr(i,Oe.mapEffects(r.effects,e),o,r.startSelection.map(s),n)}const gP=/^(input\.type|delete)($|\.)/;class Cn{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 Cn(this.done,this.undone):this}addChanges(e,t,n,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!n||gP.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,uP(l.changes,e.changes))||n=="input.type.compose")?o=$a(o,o.length-1,i.minDepth,new gr(e.changes.compose(l.changes),oy(e.effects,l.effects),l.mapped,l.startSelection,Kr)):o=$a(o,o.length,i.minDepth,e),new Cn(o,Kr,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Kr;return s.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&cP(s[s.length-1],e)?this:new Cn(ly(this.done,e),this.undone,t,n)}addMapping(e){return new Cn(rh(this.done,e),rh(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:qc.of({side:e,rest:dP(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=i.length==1?Kr:i.slice(0,i.length-1);return s.mapped&&(l=rh(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:qc.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Cn.empty=new Cn(Kr,Kr);const mP=[{key:"Mod-z",run:sy,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:th,preventDefault:!0},{linux:"Ctrl-Shift-z",run:th,preventDefault:!0},{key:"Mod-u",run:aP,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:fP,preventDefault:!0}];function Ps(r,e){return se.create(r.ranges.map(e),r.mainIndex)}function On(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Yr({state:r,dispatch:e},t){let n=Ps(r.selection,t);return n.eq(r.selection,!0)?!1:(e(On(r,n)),!0)}function Xo(r,e){return se.cursor(e?r.to:r.from)}function Ha(r,e){return Yr(r,t=>t.empty?r.moveByChar(t,e):Xo(t,e))}function nr(r){return r.textDirectionAt(r.state.selection.main.head)==rt.LTR}const ay=r=>Ha(r,!nr(r)),fy=r=>Ha(r,nr(r)),o5=r=>Ha(r,!0),l5=r=>Ha(r,!1);function za(r,e){return Yr(r,t=>t.empty?r.moveByGroup(t,e):Xo(t,e))}const vP=r=>za(r,!nr(r)),yP=r=>za(r,nr(r)),a5=r=>za(r,!0),f5=r=>za(r,!1),uy=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function cy(r,e,t){let n=r.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,l=!1,a=!1,f=!1,u=d=>{if(l)return!1;s+=t?d.length:-d.length;let p=n(d),g;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&&a)return!1;f=!0}else if(f){if(t)return!1;l=!0}else{if(a&&t&&n(g=r.state.sliceDoc(s,s+1))==CharCategory.Word&&g.toLowerCase()==g)return!1;a=!0}return o++,!0},c=r.moveByChar(e,t,d=>(u(d),u));if(uy&&i==CharCategory.Word&&c.from==e.from+o*(t?1:-1)){let d=Math.min(e.head,c.head),p=Math.max(e.head,c.head),g=r.state.sliceDoc(d,p);if(g.length>1&&/[\u4E00-\uffff]/.test(g)){let y=Array.from(uy.segment(g));if(y.length>1)return t?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(c.head+y[y.length-1].index,1)}}return c}function hy(r,e){return Yr(r,t=>t.empty?cy(r,t,e):Xo(t,e))}const u5=r=>hy(r,!0),c5=r=>hy(r,!1);function bP(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 Ua(r,e,t){let n=It(r).resolveInner(e.head),i=t?Re.closedBy:Re.openedBy;for(let a=e.head;;){let f=t?n.childAfter(a):n.childBefore(a);if(!f)break;bP(r,f,i)?n=f:a=t?f.to:f.from}let s=n.type.prop(i),o,l;return s&&(o=t?An(r,n.from,1):An(r,n.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?n.to:n.from,se.cursor(l,t?-1:1)}const xP=r=>Yr(r,e=>Ua(r.state,e,!nr(r))),wP=r=>Yr(r,e=>Ua(r.state,e,nr(r)));function dy(r,e){return Yr(r,t=>{if(!t.empty)return Xo(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const py=r=>dy(r,!1),gy=r=>dy(r,!0);function my(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let s of r.state.facet(ce.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 vy(r,e){let t=my(r),{state:n}=r,i=Ps(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):Xo(o,e));if(i.eq(n.selection))return!1;let s;if(t.selfScroll){let o=r.coordsAtPos(n.selection.main.head),l=r.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,f=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<f&&(s=ce.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-a}))}return r.dispatch(On(n,i),{effects:s}),!0}const yy=r=>vy(r,!1),nh=r=>vy(r,!0);function mi(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 SP=r=>Yr(r,e=>mi(r,e,!0)),kP=r=>Yr(r,e=>mi(r,e,!1)),AP=r=>Yr(r,e=>mi(r,e,!nr(r))),CP=r=>Yr(r,e=>mi(r,e,nr(r))),OP=r=>Yr(r,e=>se.cursor(r.lineBlockAt(e.head).from,1)),TP=r=>Yr(r,e=>se.cursor(r.lineBlockAt(e.head).to,-1));function by(r,e,t){let n=!1,i=Ps(r.selection,s=>{let o=An(r,s.head,-1)||An(r,s.head,1)||s.head>0&&An(r,s.head-1,1)||s.head<r.doc.length&&An(r,s.head+1,-1);if(!o||!o.end)return s;n=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return t?se.range(s.anchor,l):se.cursor(l)});return n?(e(On(r,i)),!0):!1}const EP=({state:r,dispatch:e})=>by(r,e,!1),h5=({state:r,dispatch:e})=>by(r,e,!0);function Ir(r,e){let t=Ps(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(On(r.state,t)),!0)}function Ga(r,e){return Ir(r,t=>r.moveByChar(t,e))}const xy=r=>Ga(r,!nr(r)),wy=r=>Ga(r,nr(r)),d5=r=>Ga(r,!0),p5=r=>Ga(r,!1);function Ka(r,e){return Ir(r,t=>r.moveByGroup(t,e))}const PP=r=>Ka(r,!nr(r)),IP=r=>Ka(r,nr(r)),g5=r=>Ka(r,!0),m5=r=>Ka(r,!1);function Sy(r,e){return Ir(r,t=>cy(r,t,e))}const v5=r=>Sy(r,!0),y5=r=>Sy(r,!1),MP=r=>Ir(r,e=>Ua(r.state,e,!nr(r))),DP=r=>Ir(r,e=>Ua(r.state,e,nr(r)));function ky(r,e){return Ir(r,t=>r.moveVertically(t,e))}const Ay=r=>ky(r,!1),Cy=r=>ky(r,!0);function Oy(r,e){return Ir(r,t=>r.moveVertically(t,e,my(r).height))}const Ty=r=>Oy(r,!1),Ey=r=>Oy(r,!0),NP=r=>Ir(r,e=>mi(r,e,!0)),RP=r=>Ir(r,e=>mi(r,e,!1)),LP=r=>Ir(r,e=>mi(r,e,!nr(r))),BP=r=>Ir(r,e=>mi(r,e,nr(r))),FP=r=>Ir(r,e=>se.cursor(r.lineBlockAt(e.head).from)),jP=r=>Ir(r,e=>se.cursor(r.lineBlockAt(e.head).to)),Py=({state:r,dispatch:e})=>(e(On(r,{anchor:0})),!0),Iy=({state:r,dispatch:e})=>(e(On(r,{anchor:r.doc.length})),!0),My=({state:r,dispatch:e})=>(e(On(r,{anchor:r.selection.main.anchor,head:0})),!0),Dy=({state:r,dispatch:e})=>(e(On(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),VP=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),WP=({state:r,dispatch:e})=>{let t=_a(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},$P=({state:r,dispatch:e})=>{let t=Ps(r.selection,n=>{var i;let s=It(r).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&(!((i=l.parent)===null||i===void 0)&&i.parent))return se.range(l.to,l.from)}return n});return e(On(r,t)),!0},HP=({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(On(r,n)),!0):!1};function Is(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,i=n.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Ya(r,a,!1)):a>o&&(t="delete.forward",a=Ya(r,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Ya(r,o,!1),l=Ya(r,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},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"?ce.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Ya(r,e,t){if(r instanceof ce)for(let n of r.state.facet(ce.atomicRanges).map(i=>i(r)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const Ny=(r,e)=>Is(r,t=>{let n=t.from,{state:i}=r,s=i.doc.lineAt(n),o,l;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 a=ds(o,i.tabSize),f=a%Wi(i)||Wi(i);for(let u=0;u<f&&o[o.length-1-u]==" ";u++)n--;l=n}else l=zt(s.text,n-s.from,e,e)+s.from,l==n&&s.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,n-s.from))&&(l=zt(s.text,l-s.from,!1,!1)+s.from);return l}),ih=r=>Ny(r,!1),Ry=r=>Ny(r,!0),Ly=(r,e)=>Is(r,t=>{let n=t.head,{state:i}=r,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let l=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let a=zt(s.text,n-s.from,e)+s.from,f=s.text.slice(Math.min(n,a)-s.from,Math.max(n,a)-s.from),u=o(f);if(l!=null&&u!=l)break;(f!=" "||n!=t.head)&&(l=u),n=a}return n}),By=r=>Ly(r,!1),zP=r=>Ly(r,!0),UP=r=>Is(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),b5=r=>Is(r,e=>{let t=r.lineBlockAt(e.head).from;return e.head>t?t:Math.max(0,e.head-1)}),GP=r=>Is(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),KP=r=>Is(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),x5=({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},YP=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ze.of(["",""])},range:se.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},_P=({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:zt(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:zt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:r.doc.slice(i,l).append(r.doc.slice(o,i))},range:se.cursor(l)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _a(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 Fy(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let s of _a(r)){if(t?s.to==r.doc.length:s.from==0)continue;let o=r.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+r.lineBreak});for(let a of s.ranges)i.push(se.range(Math.min(r.doc.length,a.anchor+l),Math.min(r.doc.length,a.head+l)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:r.lineBreak+o.text});for(let a of s.ranges)i.push(se.range(a.anchor-l,a.head-l))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:se.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const JP=({state:r,dispatch:e})=>Fy(r,e,!1),XP=({state:r,dispatch:e})=>Fy(r,e,!0);function jy(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of _a(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 QP=({state:r,dispatch:e})=>jy(r,e,!1),ZP=({state:r,dispatch:e})=>jy(r,e,!0),qP=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(_a(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=Ps(e.selection,i=>r.moveVertically(i,!0)).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},w5=({state:r,dispatch:e})=>(e(r.update(r.replaceSelection(r.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function eI(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=It(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 tI=Vy(!1),rI=Vy(!0);function Vy(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!r&&s==o&&eI(e,s);r&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let f=new Uo(e,{simulateBreak:s,simulateDoubleBreak:!!a}),u=Fa(f,s);for(u==null&&(u=ds(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let c=["",Os(e,u)];return a&&c.push(Os(e,f.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:Ze.of(c)},range:se.cursor(s+1+c[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function sh(r,e){let t=-1;return r.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let l=r.doc.lineAt(o);l.number>t&&(n.empty||n.to>l.from)&&(e(l,i,n),t=l.number),o=l.to+1}let s=r.changes(i);return{changes:i,range:se.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const nI=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new Uo(r,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=sh(r,(s,o,l)=>{let a=Fa(n,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let f=/^\s*/.exec(s.text)[0],u=Os(r,a);(f!=u||l.from<s.from+f.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+f.length,insert:u}))});return i.changes.empty||e(r.update(i,{userEvent:"indent"})),!0},oh=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(sh(r,(t,n)=>{n.push({from:t.from,insert:r.facet(Ba)})}),{userEvent:"input.indent"})),!0),Wy=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(sh(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=ds(i,r.tabSize),o=0,l=Os(r,Math.max(0,s-Wi(r)));for(;o<i.length&&o<l.length&&i.charCodeAt(o)==l.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),S5=({state:r,dispatch:e})=>r.selection.ranges.some(t=>!t.empty)?oh({state:r,dispatch:e}):(e(r.update(r.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),iI=[{key:"Ctrl-b",run:ay,shift:xy,preventDefault:!0},{key:"Ctrl-f",run:fy,shift:wy},{key:"Ctrl-p",run:py,shift:Ay},{key:"Ctrl-n",run:gy,shift:Cy},{key:"Ctrl-a",run:OP,shift:FP},{key:"Ctrl-e",run:TP,shift:jP},{key:"Ctrl-d",run:Ry},{key:"Ctrl-h",run:ih},{key:"Ctrl-k",run:UP},{key:"Ctrl-Alt-h",run:By},{key:"Ctrl-o",run:YP},{key:"Ctrl-t",run:_P},{key:"Ctrl-v",run:nh}],sI=[{key:"ArrowLeft",run:ay,shift:xy,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:vP,shift:PP,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:AP,shift:LP,preventDefault:!0},{key:"ArrowRight",run:fy,shift:wy,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yP,shift:IP,preventDefault:!0},{mac:"Cmd-ArrowRight",run:CP,shift:BP,preventDefault:!0},{key:"ArrowUp",run:py,shift:Ay,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Py,shift:My},{mac:"Ctrl-ArrowUp",run:yy,shift:Ty},{key:"ArrowDown",run:gy,shift:Cy,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Iy,shift:Dy},{mac:"Ctrl-ArrowDown",run:nh,shift:Ey},{key:"PageUp",run:yy,shift:Ty},{key:"PageDown",run:nh,shift:Ey},{key:"Home",run:kP,shift:RP,preventDefault:!0},{key:"Mod-Home",run:Py,shift:My},{key:"End",run:SP,shift:NP,preventDefault:!0},{key:"Mod-End",run:Iy,shift:Dy},{key:"Enter",run:tI},{key:"Mod-a",run:VP},{key:"Backspace",run:ih,shift:ih},{key:"Delete",run:Ry},{key:"Mod-Backspace",mac:"Alt-Backspace",run:By},{key:"Mod-Delete",mac:"Alt-Delete",run:zP},{mac:"Mod-Backspace",run:GP},{mac:"Mod-Delete",run:KP}].concat(iI.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),oI=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xP,shift:MP},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:wP,shift:DP},{key:"Alt-ArrowUp",run:JP},{key:"Shift-Alt-ArrowUp",run:QP},{key:"Alt-ArrowDown",run:XP},{key:"Shift-Alt-ArrowDown",run:ZP},{key:"Escape",run:HP},{key:"Mod-Enter",run:rI},{key:"Alt-l",mac:"Ctrl-l",run:WP},{key:"Mod-i",run:$P,preventDefault:!0},{key:"Mod-[",run:Wy},{key:"Mod-]",run:oh},{key:"Mod-Alt-\\",run:nI},{key:"Shift-Mod-k",run:qP},{key:"Shift-Mod-\\",run:EP},{key:"Mod-/",run:ZE},{key:"Alt-A",run:eP}].concat(sI),lI={key:"Tab",run:oh,shift:Wy};function lt(){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++)$y(r,arguments[e]);return r}function $y(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++)$y(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const Hy=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class Ms{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?l=>s(Hy(l)):Hy,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 Ut(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=yu(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Hr(e);let i=this.normalize(t);for(let s=0,o=n;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==n&&s<t.length&&t.charCodeAt(s)==l&&o++}}}match(e,t,n){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:n}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:n}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(Ms.prototype[Symbol.iterator]=function(){return this});const zy={from:-1,to:-1,match:/.*/.exec("")},lh="gm"+(/x/.unicode==null?"":"u");class Uy{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=zy,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Gy(e,t,n,i,s);this.re=new RegExp(t,lh+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=Ja(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=Ja(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 ah=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=ah.get(e);if(!i||i.from>=n||i.to<=t){let l=new Ds(t,e.sliceString(t,n));return ah.set(e,l),l}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)),ah.set(e,new Ds(o,s)),new Ds(t,s.slice(t-o,n-o))}}class Gy{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=zy,this.matchPos=Ja(e,i),this.re=new RegExp(t,lh+(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=Ja(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"&&(Uy.prototype[Symbol.iterator]=Gy.prototype[Symbol.iterator]=function(){return this});function aI(r){try{return new RegExp(r,lh),!0}catch{return!1}}function Ja(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 fh(r){let e=String(r.state.doc.lineAt(r.state.selection.main.head).number),t=lt("input",{class:"cm-textfield",name:"line",value:e}),n=lt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),r.dispatch({effects:Xa.of(!1)}),r.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},lt("label",r.state.phrase("Go to line"),": ",t)," ",lt("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,l=o.doc.lineAt(o.selection.main.head),[,a,f,u,c]=s,d=u?+u.slice(1):0,p=f?+f:l.number;if(f&&c){let x=p/100;a&&(x=x*(a=="-"?-1:1)+l.number/o.doc.lines),p=Math.round(o.doc.lines*x)}else f&&a&&(p=p*(a=="-"?-1:1)+l.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=se.cursor(g.from+Math.max(0,Math.min(d,g.length)));r.dispatch({effects:[Xa.of(!1),ce.scrollIntoView(y.from,{y:"center"})],selection:y}),r.focus()}return{dom:n}}const Xa=Oe.define(),Ky=vt.define({create(){return!0},update(r,e){for(let t of e.effects)t.is(Xa)&&(r=t.value);return r},provide:r=>Bo.from(r,e=>e?fh:null)}),fI=r=>{let e=Lo(r,fh);if(!e){let t=[Xa.of(!0)];r.state.field(Ky,!1)==null&&t.push(Oe.appendConfig.of([Ky,uI])),r.dispatch({effects:t}),e=Lo(r,fh)}return e&&e.dom.querySelector("input").select(),!0},uI=ce.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),cI={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Yy=ge.define({combine(r){return Cr(r,cI,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function hI(r){let e=[vI,mI];return r&&e.push(Yy.of(r)),e}const dI=pe.mark({class:"cm-selectionMatch"}),pI=pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function _y(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=ht.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=ht.Word)}function gI(r,e,t,n){return r(e.sliceDoc(t,t+1))==ht.Word&&r(e.sliceDoc(n-1,n))==ht.Word}const mI=st.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(Yy),{state:t}=r,n=t.selection;if(n.ranges.length>1)return pe.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return pe.none;let a=t.wordAt(i.head);if(!a)return pe.none;o=t.charCategorizer(i.head),s=t.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return pe.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(_y(o,t,i.from,i.to)&&gI(o,t,i.from,i.to)))return pe.none}else if(s=t.sliceDoc(i.from,i.to),!s)return pe.none}let l=[];for(let a of r.visibleRanges){let f=new Ms(t.doc,s,a.from,a.to);for(;!f.next().done;){let{from:u,to:c}=f.value;if((!o||_y(o,t,u,c))&&(i.empty&&u<=i.from&&c>=i.to?l.push(pI.range(u,c)):(u>=i.to||c<=i.from)&&l.push(dI.range(u,c)),l.length>e.maxMatches))return pe.none}}return pe.set(l)}},{decorations:r=>r.decorations}),vI=ce.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yI=({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 bI(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,l=new Ms(r.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Ms(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(a=>a.from==l.value.from))continue;if(s){let a=r.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const xI=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return yI({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=bI(r,n);return i?(e(r.update({selection:r.selection.addRange(se.range(i.from,i.to),!1),effects:ce.scrollIntoView(i.to)})),!0):!1},$i=ge.define({combine(r){return Cr(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DI(e),scrollToMatch:e=>ce.scrollIntoView(e)})}});function k5(r){return r?[$i.of(r),ph]:ph}class Jy{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||aI(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"?`
|
|
155
|
+
`: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 AI(this):new SI(this)}getCursor(e,t=0,n){let i=e.doc?e:je.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?Rs(this,i,t,n):Ns(this,i,t,n)}}class Xy{constructor(e){this.spec=e}}function Ns(r,e,t,n){return new Ms(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),r.wholeWord?wI(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function wI(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(Qa(i,t-s))!=ht.Word||e(Za(i,t-s))!=ht.Word)&&(e(Za(i,n-s))!=ht.Word||e(Qa(i,n-s))!=ht.Word))}class SI extends Xy{constructor(e){super(e)}nextMatch(e,t,n){let i=Ns(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=Ns(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=Ns(this.spec,e,s,i),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;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=Ns(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=Ns(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 Rs(r,e,t,n){return new Uy(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:r.wholeWord?kI(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function Qa(r,e){return r.slice(zt(r,e,!1),e)}function Za(r,e){return r.slice(e,zt(r,e))}function kI(r){return(e,t,n)=>!n[0].length||(r(Qa(n.input,n.index))!=ht.Word||r(Za(n.input,n.index))!=ht.Word)&&(r(Za(n.input,n.index+n[0].length))!=ht.Word||r(Qa(n.input,n.index+n[0].length))!=ht.Word)}class AI extends Xy{nextMatch(e,t,n){let i=Rs(this.spec,e,n,e.doc.length).next();return i.done&&(i=Rs(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=Rs(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;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=Rs(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=Rs(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 Qo=Oe.define(),uh=Oe.define(),Tn=vt.define({create(r){return new ch(tf(r).create(),null)},update(r,e){for(let t of e.effects)t.is(Qo)?r=new ch(t.value.create(),r.panel):t.is(uh)&&(r=new ch(r.query,t.value?hh:null));return r},provide:r=>Bo.from(r,e=>e.panel)});function A5(r){let e=r.field(Tn,!1);return e?e.query.spec:tf(r)}function C5(r){var e;return((e=r.field(Tn,!1))===null||e===void 0?void 0:e.panel)!=null}class ch{constructor(e,t){this.query=e,this.panel=t}}const CI=pe.mark({class:"cm-searchMatch"}),OI=pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TI=st.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(Tn))}update(r){let e=r.state.field(Tn);(e!=r.startState.field(Tn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return pe.none;let{view:t}=this,n=new bn;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:l,to:a}=s[i];for(;i<o-1&&a>s[i+1].from-2*250;)a=s[++i].to;r.highlight(t.state,l,a,(f,u)=>{let c=t.state.selection.ranges.some(d=>d.from==f&&d.to==u);n.add(f,u,c?OI:CI)})}return n.finish()}},{decorations:r=>r.decorations});function Zo(r){return e=>{let t=e.state.field(Tn,!1);return t&&t.query.spec.valid?r(e,t):eb(e)}}const qa=Zo((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($i);return r.dispatch({selection:i,effects:[dh(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),qy(r),!0}),ef=Zo((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($i);return r.dispatch({selection:s,effects:[dh(r,i),o.scrollToMatch(s.main,r)],userEvent:"select.search"}),qy(r),!0}),EI=Zo((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)}),PI=({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 l=new Ms(r.doc,r.sliceDoc(n,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==n&&(o=s.length),s.push(se.range(l.value.from,l.value.to))}return e(r.update({selection:se.create(s,o),userEvent:"select.search.matches"})),!0},Qy=Zo((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=[],l,a,f=[];if(s.from==n&&s.to==i&&(a=t.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=e.nextMatch(t,s.from,s.to),f.push(ce.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-a.length;l=se.single(s.from-u,s.to-u),f.push(dh(r,s)),f.push(t.facet($i).scrollToMatch(l.main,r))}return r.dispatch({changes:o,selection:l,effects:f,userEvent:"input.replace"}),!0}),II=Zo((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:ce.announce.of(n),userEvent:"input.replace.all"}),!0});function hh(r){return r.state.facet($i).createPanel(r)}function tf(r,e){var t,n,i,s,o;let l=r.selection.main,a=l.empty||l.to>l.from+100?"":r.sliceDoc(l.from,l.to);if(e&&!a)return e;let f=r.facet($i);return new Jy({search:((t=e?.literal)!==null&&t!==void 0?t:f.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:f.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:f.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:f.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:f.wholeWord})}function Zy(r){let e=Lo(r,hh);return e&&e.dom.querySelector("[main-field]")}function qy(r){let e=Zy(r);e&&e==r.root.activeElement&&e.select()}const eb=r=>{let e=r.state.field(Tn,!1);if(e&&e.panel){let t=Zy(r);if(t&&t!=r.root.activeElement){let n=tf(r.state,e.query.spec);n.valid&&r.dispatch({effects:Qo.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[uh.of(!0),e?Qo.of(tf(r.state,e.query.spec)):Oe.appendConfig.of(ph)]});return!0},tb=r=>{let e=r.state.field(Tn,!1);if(!e||!e.panel)return!1;let t=Lo(r,hh);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:uh.of(!1)}),!0},MI=[{key:"Mod-f",run:eb,scope:"editor search-panel"},{key:"F3",run:qa,shift:ef,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:qa,shift:ef,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tb,scope:"editor search-panel"},{key:"Mod-Shift-l",run:PI},{key:"Mod-Alt-g",run:fI},{key:"Mod-d",run:xI,preventDefault:!0}];class DI{constructor(e){this.view=e;let t=this.query=e.state.field(Tn).query.spec;this.commit=this.commit.bind(this),this.searchField=lt("input",{value:t.search,placeholder:Mr(e,"Find"),"aria-label":Mr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=lt("input",{value:t.replace,placeholder:Mr(e,"Replace"),"aria-label":Mr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=lt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=lt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=lt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,o){return lt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=lt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>qa(e),[Mr(e,"next")]),n("prev",()=>ef(e),[Mr(e,"previous")]),n("select",()=>EI(e),[Mr(e,"all")]),lt("label",null,[this.caseField,Mr(e,"match case")]),lt("label",null,[this.reField,Mr(e,"regexp")]),lt("label",null,[this.wordField,Mr(e,"by word")]),...e.state.readOnly?[]:[lt("br"),this.replaceField,n("replace",()=>Qy(e),[Mr(e,"replace")]),n("replaceAll",()=>II(e),[Mr(e,"replace all")])],lt("button",{name:"close",onclick:()=>tb(e),"aria-label":Mr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Jy({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:Qo.of(e)}))}keydown(e){l2(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ef:qa)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Qy(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Qo)&&!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($i).top}}function Mr(r,e){return r.state.phrase(e)}const rf=30,nf=/[\s\.,:;?!]/;function dh(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-rf),o=Math.min(i,t+rf),l=r.state.sliceDoc(s,o);if(s!=n.from){for(let a=0;a<rf;a++)if(!nf.test(l[a+1])&&nf.test(l[a])){l=l.slice(a);break}}if(o!=i){for(let a=l.length-1;a>l.length-rf;a--)if(!nf.test(l[a-1])&&nf.test(l[a])){l=l.slice(0,a);break}}return ce.announce.of(`${r.state.phrase("current match")}. ${l} ${r.state.phrase("on line")} ${n.number}.`)}const NI=ce.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"}}),ph=[Tn,vn.low(TI),NI];class rb{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=It(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(sb(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 nb(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 RI(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=nb(e)+nb(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function LI(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:RI(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function O5(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 T5(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 ib{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function vi(r){return r.selection.main.from}function sb(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 ob=yn.define();function BI(r,e,t,n){let{main:i}=r.selection,s=t-i.from,o=n-i.from;return Object.assign(Object.assign({},r.changeByRange(l=>l!=i&&t!=n&&r.sliceDoc(l.from+s,l.from+o)!=r.sliceDoc(t,n)?{range:l}:{changes:{from:l.from+s,to:n==i.from?l.to:l.from+o,insert:e},range:se.cursor(l.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const lb=new WeakMap;function FI(r){if(!Array.isArray(r))return r;let e=lb.get(r);return e||lb.set(r,e=LI(r)),e}const sf=Oe.define(),qo=Oe.define();class jI{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=Ut(e,t),i=Hr(n);this.chars.push(n);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Ut(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 E=Ut(e,0),O=Hr(E),j=O==e.length?0:-100;if(E!=t[0])if(E==n[0])j+=-200;else return!1;return this.ret(j,[0,O])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,f=0;if(l<0){for(let E=0,O=Math.min(e.length,200);E<O&&f<a;){let j=Ut(e,E);(j==t[f]||j==n[f])&&(i[f++]=E),E+=Hr(j)}if(f<a)return!1}let u=0,c=0,d=!1,p=0,g=-1,y=-1,x=/[a-z]/.test(e),k=!0;for(let E=0,O=Math.min(e.length,200),j=0;E<O&&c<a;){let M=Ut(e,E);l<0&&(u<a&&M==t[u]&&(s[u++]=E),p<a&&(M==t[p]||M==n[p]?(p==0&&(g=E),y=E+1,p++):p=0));let F,D=M<255?M>=48&&M<=57||M>=97&&M<=122?2:M>=65&&M<=90?1:0:(F=yu(M))!=F.toLowerCase()?1:F!=F.toUpperCase()?2:0;(!E||D==1&&x||j==0&&D!=0)&&(t[c]==M||n[c]==M&&(d=!0)?o[c++]=E:o.length&&(k=!1)),j=D,E+=Hr(M)}return c==a&&o[0]==0&&k?this.result(-100+(d?-200:0),o,e):p==a&&g==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):p==a?this.ret(-200+-700-e.length,[g,y]):c==a?this.result(-100+(d?-200:0)+-700+(k?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 l=o+(this.astral?Hr(Ut(n,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-n.length,i)}}const Yt=ge.define({combine(r){return Cr(r,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:VI,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=>ab(e(n),t(n)),optionClass:(e,t)=>n=>ab(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function ab(r,e){return r?e?r+" "+e:r:e}function VI(r,e,t,n,i,s){let o=r.textDirection==rt.RTL,l=o,a=!1,f="top",u,c,d=e.left-i.left,p=i.right-e.right,g=n.right-n.left,y=n.bottom-n.top;if(l&&d<Math.min(g,p)?l=!1:!l&&p<Math.min(g,d)&&(l=!0),g<=(l?d:p))u=Math.max(i.top,Math.min(t.top,i.bottom-y))-e.top,c=Math.min(400,l?d:p);else{a=!0,c=Math.min(400,(o?e.right:i.right-e.left)-30);let E=i.bottom-e.bottom;E>=y||E>e.top?u=t.bottom-e.top:(f="bottom",u=e.bottom-t.top)}let x=(e.bottom-e.top)/s.offsetHeight,k=(e.right-e.left)/s.offsetWidth;return{style:`${f}: ${u/x}px; max-width: ${c/k}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function WI(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 l=t.displayLabel||t.label,a=0;for(let f=0;f<s.length;){let u=s[f++],c=s[f++];u>a&&o.appendChild(document.createTextNode(l.slice(a,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(l.slice(u,c))),d.className="cm-completionMatchedText",a=c}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),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 gh(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 $I{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:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,l=e.state.facet(Yt);this.optionContent=WI(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=gh(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:f}=e.state.field(t).open;for(let u=a.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]<f.length){this.applyCompletion(e,f[+c[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let f=e.state.field(this.stateField,!1);f&&f.tooltip&&e.state.facet(Yt).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:qo.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:l}=n.open;(!i.open||i.open.options!=s)&&(this.range=gh(s.length,o,e.state.facet(Yt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),l!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}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=gh(t.options.length,t.selected,this.view.state.facet(Yt).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=>cr(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&&zI(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(Yt).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:l,match:a}=e[o],{section:f}=l;if(f){let d=typeof f=="string"?f:f.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof f!="string"&&f.header)i.appendChild(f.header(f));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 c=this.optionClass(l);c&&(u.className=c);for(let d of this.optionContent){let p=d(l,this.view.state,this.view,a);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 HI(r,e){return t=>new $I(t,r,e)}function zI(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 fb(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function UI(r,e){let t=[],n=null,i=a=>{t.push(a);let{section:f}=a.completion;if(f){n||(n=[]);let u=typeof f=="string"?f:f.name;n.some(c=>c.name==u)||n.push(typeof f=="string"?{name:u}:f)}};for(let a of r)if(a.hasResult()){let f=a.result.getMatch;if(a.result.filter===!1)for(let u of a.result.options)i(new ib(u,a.source,f?f(u):[],1e9-t.length));else{let u=new jI(e.sliceDoc(a.from,a.to));for(let c of a.result.options)if(u.match(c.label)){let d=c.displayLabel?f?f(c,u.matched):[]:u.matched;i(new ib(c,a.source,d,u.score+(c.boost||0)))}}}if(n){let a=Object.create(null),f=0,u=(c,d)=>{var p,g;return((p=c.rank)!==null&&p!==void 0?p:1e9)-((g=d.rank)!==null&&g!==void 0?g:1e9)||(c.name<d.name?-1:1)};for(let c of n.sort(u))f-=1e5,a[c.name]=f;for(let c of t){let{section:d}=c.completion;d&&(c.score+=a[typeof d=="string"?d:d.name])}}let s=[],o=null,l=e.facet(Yt).compareCompletions;for(let a of t.sort((f,u)=>u.score-f.score||l(f.completion,u.completion))){let f=a.completion;!o||o.label!=f.label||o.detail!=f.detail||o.type!=null&&f.type!=null&&o.type!=f.type||o.apply!=f.apply||o.boost!=f.boost?s.push(a):fb(a.completion)>fb(o)&&(s[s.length-1]=a),o=a.completion}return s}class Ls{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 Ls(this.options,ub(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s){let o=UI(e,t);if(!o.length)return i&&e.some(a=>a.state==1)?new Ls(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let l=t.facet(Yt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let f=0;f<o.length;f++)if(o[f].completion==a){l=f;break}}return new Ls(o,ub(n,l),{pos:e.reduce((a,f)=>f.hasResult()?Math.min(a,f.from):a,1e8),create:JI,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Ls(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class of{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new of(YI,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Yt),s=(n.override||t.languageDataAt("autocomplete",vi(t)).map(FI)).map(l=>(this.active.find(f=>f.source==l)||new mr(l,this.active.some(f=>f.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!GI(s,this.active)?o=Ls.build(s,t,this.id,o,n):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new mr(l.source,0):l));for(let l of e.effects)l.is(vh)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new of(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:KI}}function GI(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 KI={"aria-autocomplete":"list"};function ub(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const YI=[];function mh(r){return r.isUserEvent("input.type")?"input":r.isUserEvent("delete.backward")?"delete":null}class mr{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=mh(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new mr(i.source,0));for(let s of e.effects)if(s.is(sf))i=new mr(i.source,1,s.value?vi(e.state):-1);else if(s.is(qo))i=new mr(i.source,0);else if(s.is(cb))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 mr(this.source,1)}handleChange(e){return e.changes.touchesRange(vi(e.startState))?new mr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new mr(this.source,this.state,e.mapPos(this.explicitPos))}}class Bs extends mr{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),l=vi(e.state);if((this.explicitPos<0?l<=s:l<this.from)||l>o||t=="delete"&&vi(e.startState)==this.from)return new mr(this.source,t=="input"&&n.activateOnTyping?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),f;return _I(this.result.validFor,e.state,s,o)?new Bs(this.source,a,this.result,s,o):this.result.update&&(f=this.result.update(this.result,s,o,new rb(e.state,l,a>=0)))?new Bs(this.source,a,f,f.from,(i=f.to)!==null&&i!==void 0?i:vi(e.state)):new mr(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new mr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Bs(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function _I(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):sb(r,!0).test(i)}const cb=Oe.define({map(r,e){return r.map(t=>t.map(e))}}),vh=Oe.define(),$t=vt.define({create(){return of.start()},update(r,e){return r.update(e)},provide:r=>[Ca.from(r,e=>e.tooltip),ce.contentAttributes.from(r,e=>e.attrs)]});function yh(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 Bs?(typeof t=="string"?r.dispatch(Object.assign(Object.assign({},BI(r.state,t,n.from,n.to)),{annotations:ob.of(e.completion)})):t(r,e.completion,n.from,n.to),!0):!1}const JI=HI($t,yh);function lf(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(Yt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=R0(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,l=n.open.selected>-1?n.open.selected+i*(r?1:-1):r?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:vh.of(l)}),!0}}const XI=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(Yt).interactionDelay?!1:yh(r,e.open.options[e.open.selected])},QI=r=>r.state.field($t,!1)?(r.dispatch({effects:sf.of(!0)}),!0):!1,ZI=r=>{let e=r.state.field($t,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:qo.of(null)}),!0)};class qI{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const eM=50,tM=1e3,rM=st.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!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(i=>(i.selection||i.docChanged)&&!mh(i));for(let i=0;i<this.running.length;i++){let s=this.running[i];if(t||s.updates.length+r.transactions.length>eM&&Date.now()-s.time>tM){for(let o of s.context.abortListeners)try{o()}catch(l){cr(this.view.state,l)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...r.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),r.transactions.some(i=>i.effects.some(s=>s.is(sf)))&&(this.pendingStart=!0);let n=this.pendingStart?50:r.state.facet(Yt).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let i of r.transactions)mh(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!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=vi(e),n=new rb(e,t,r.explicitPos==t),i=new qI(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:qo.of(null)}),cr(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(Yt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Yt);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 Bs(i.active.source,i.active.explicitPos,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:vi(i.updates.length?i.updates[0].startState:this.view.state));for(let l of i.updates)o=o.update(l,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 mr(i.active.source,0);for(let l of i.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:cb.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field($t,!1);if(e&&e.tooltip&&this.view.state.facet(Yt).closeOnBlur){let t=e.open&&R0(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:qo.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sf.of(!1)}),20),this.composing=0}}}),nM=typeof navigator=="object"&&/Win/.test(navigator.platform),iM=vn.highest(ce.domEventHandlers({keydown(r,e){let t=e.state.field($t,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||r.key.length>1||r.ctrlKey&&!(nM&&r.altKey)||r.metaKey)return!1;let n=t.open.options[t.open.selected],i=t.active.find(o=>o.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(r.key)>-1&&yh(e,n),!1}})),hb=ce.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 sM{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class bh{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 bh(this.field,t,n)}}class xh{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 a of this.lines){if(n.length){let f=o,u=/^\t*/.exec(a)[0].length;for(let c=0;c<u;c++)f+=e.facet(indentUnit);i.push(t+f.length-u),a=f+a.slice(u)}n.push(a),t+=a.length+1}let l=this.fieldPositions.map(a=>new bh(a.field,i[a.line]+a.from,i[a.line]+a.to));return{text:n,ranges:l}}static parse(e){let t=[],n=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",f=-1;for(let u=0;u<t.length;u++)(l!=null?t[u].seq==l:a&&t[u].name==a)&&(f=u);if(f<0){let u=0;for(;u<t.length&&(l==null||t[u].seq!=null&&t[u].seq<l);)u++;t.splice(u,0,{seq:l,name:a}),f=u;for(let c of i)c.field>=f&&c.field++}i.push(new sM(f,n.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of i)a.line==n.length&&a.from>l.index&&(a.from--,a.to--)}n.push(o)}return new xh(n,i)}}let oM=pe.widget({widget:new class extends zr{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),lM=pe.mark({class:"cm-snippetField"});class Fs{constructor(e,t){this.ranges=e,this.active=t,this.deco=pe.set(e.map(n=>(n.from==n.to?oM:lM).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 Fs(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 el=Oe.define({map(r,e){return r&&r.map(e)}}),aM=Oe.define(),Hi=vt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(el))return t.value;if(t.is(aM)&&r)return new Fs(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=>ce.decorations.from(r,e=>e?e.deco:pe.none)});function wh(r,e){return se.create(r.filter(t=>t.field==e).map(t=>se.range(t.from,t.to)))}function fM(r){let e=xh.parse(r);return(t,n,i,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,i),a={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?[ob.of(n),Transaction.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=wh(l,0)),l.some(f=>f.field>0)){let f=new Fs(l,0),u=a.effects=[el.of(f)];t.state.field(Hi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Hi,pM,gM,hb]))}t.dispatch(t.state.update(a))}}function db(r){return({state:e,dispatch:t})=>{let n=e.field(Hi,!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:wh(n.ranges,i),effects:el.of(s?null:new Fs(n.ranges,i)),scrollIntoView:!0})),!0}}const uM=({state:r,dispatch:e})=>r.field(Hi,!1)?(e(r.update({effects:el.of(null)})),!0):!1,cM=db(1),hM=db(-1);function E5(r){let e=r.field(Hi,!1);return!!(e&&e.ranges.some(t=>t.field==e.active+1))}function P5(r){let e=r.field(Hi,!1);return!!(e&&e.active>0)}const dM=[{key:"Tab",run:cM,shift:hM},{key:"Escape",run:uM}],pb=ge.define({combine(r){return r.length?r[0]:dM}}),pM=vn.highest(Io.compute([pb],r=>r.facet(pb)));function I5(r,e){return Object.assign(Object.assign({},e),{apply:fM(r)})}const gM=ce.domEventHandlers({mousedown(r,e){let t=e.state.field(Hi,!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:wh(t.ranges,i.field),effects:el.of(t.ranges.some(s=>s.field>i.field)?new Fs(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});function mM(r){let e=r.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function gb(r,e){return new RegExp(e(r.source),r.unicode?"u":"")}const mb=null;function vM(r){return mb[r]||(mb[r]=new WeakMap)}function vb(r,e,t,n,i){for(let s=r.iterLines(),o=0;!s.next().done;){let{value:l}=s,a;for(e.lastIndex=0;a=e.exec(l);)if(!n[a[0]]&&o+a.index!=i&&(t.push({type:"text",label:a[0]}),n[a[0]]=!0,t.length>=2e3))return;o+=l.length+1}}function yb(r,e,t,n,i){let s=r.length>=1e3,o=s&&e.get(r);if(o)return o;let l=[],a=Object.create(null);if(r.children){let f=0;for(let u of r.children){if(u.length>=1e3)for(let c of yb(u,e,t,n-f,i-f))a[c.label]||(a[c.label]=!0,l.push(c));else vb(u,t,l,a,i-f);f+=u.length+1}}else vb(r,t,l,a,i);return s&&l.length<2e3&&e.set(r,l),l}const M5=r=>{let e=r.state.languageDataAt("wordChars",r.pos).join(""),t=mM(e),n=r.matchBefore(gb(t,o=>o+"$"));if(!n&&!r.explicit)return null;let i=n?n.from:r.pos,s=yb(r.state.doc,vM(e),t,5e4,i);return{from:i,options:s,validFor:gb(t,o=>"^"+o)}},tl={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zi=Oe.define({map(r,e){let t=e.mapPos(r,-1,fr.TrackAfter);return t??void 0}}),Sh=new class extends Ri{};Sh.startSide=1,Sh.endSide=-1;const bb=vt.define({create(){return $e.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(zi)&&(r=r.update({add:[Sh.range(t.value,t.value+1)]}));return r}});function yM(){return[xM,bb]}const kh="()[]{}<>";function xb(r){for(let e=0;e<kh.length;e+=2)if(kh.charCodeAt(e)==r)return kh.charAt(e+1);return yu(r<128?r:r+1)}function wb(r,e){return r.languageDataAt("closeBrackets",e)[0]||tl}const bM=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),xM=ce.inputHandler.of((r,e,t,n)=>{if((bM?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Hr(Ut(n,0))==1||e!=i.from||t!=i.to)return!1;let s=SM(r.state,n);return s?(r.dispatch(s),!0):!1}),wM=[{key:"Backspace",run:({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=wb(r,r.selection.main.head).brackets||tl.brackets,i=null,s=r.changeByRange(o=>{if(o.empty){let l=kM(r.doc,o.head);for(let a of n)if(a==l&&af(r.doc,o.head)==xb(Ut(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:se.cursor(o.head-a.length)}}return{range:i=o}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function SM(r,e){let t=wb(r,r.selection.main.head),n=t.brackets||tl.brackets;for(let i of n){let s=xb(Ut(i,0));if(e==i)return s==i?OM(r,i,n.indexOf(i+i+i)>-1,t):AM(r,i,s,t.before||tl.before);if(e==s&&Sb(r,r.selection.main.from))return CM(r,i,s)}return null}function Sb(r,e){let t=!1;return r.field(bb).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function af(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Hr(Ut(t,0)))}function kM(r,e){let t=r.sliceString(e-2,e);return Hr(Ut(t,0))==t.length?t:t.slice(1)}function AM(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:zi.of(o.to+e.length),range:se.range(o.anchor+e.length,o.head+e.length)};let l=af(r.doc,o.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:zi.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 CM(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&af(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 OM(r,e,t,n){let i=n.stringPrefixes||tl.stringPrefixes,s=null,o=r.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:zi.of(l.to+e.length),range:se.range(l.anchor+e.length,l.head+e.length)};let a=l.head,f=af(r.doc,a),u;if(f==e){if(kb(r,a))return{changes:{insert:e+e,from:a},effects:zi.of(a+e.length),range:se.cursor(a+e.length)};if(Sb(r,a)){let d=t&&r.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+d.length,insert:d},range:se.cursor(a+d.length)}}}else{if(t&&r.sliceDoc(a-2*e.length,a)==e+e&&(u=Ab(r,a-2*e.length,i))>-1&&kb(r,u))return{changes:{insert:e+e+e+e,from:a},effects:zi.of(a+e.length),range:se.cursor(a+e.length)};if(r.charCategorizer(a)(f)!=ht.Word&&Ab(r,a,i)>-1&&!TM(r,a,e,i))return{changes:{insert:e+e,from:a},effects:zi.of(a+e.length),range:se.cursor(a+e.length)}}return{range:s=l}});return s?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function kb(r,e){let t=It(r).resolveInner(e+1);return t.parent&&t.from==e}function TM(r,e,t,n){let i=It(r).resolveInner(e,-1),s=n.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&n.indexOf(l.slice(0,a))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+a;){if(r.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let f=i.to==e&&i.parent;if(!f)break;i=f}return!1}function Ab(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=ht.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))!=ht.Word)return s}return-1}function EM(r={}){return[iM,$t,Yt.of(r),rM,PM,hb]}const Cb=[{key:"Ctrl-Space",run:QI},{key:"Escape",run:ZI},{key:"ArrowDown",run:lf(!0)},{key:"ArrowUp",run:lf(!1)},{key:"PageDown",run:lf(!0,"page")},{key:"PageUp",run:lf(!1,"page")},{key:"Enter",run:XI}],PM=vn.highest(Io.computeN([Yt],r=>r.facet(Yt).defaultKeymap?[Cb]:[]));function N5(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 Ob=new WeakMap;function R5(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=Ob.get(t.options);return n||Ob.set(t.options,n=t.options.map(i=>i.completion)),n}function L5(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 B5(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 F5(r){return vh.of(r)}class IM{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ui{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,s=n.facet(Gi).markerFilter;s&&(i=s(i));let o=pe.set(i.map(l=>l.from==l.to||l.from==l.to-1&&n.doc.lineAt(l.from).to==l.from?pe.widget({widget:new jM(l),diagnostic:l}).range(l.from):pe.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l}).range(l.from,l.to)),!0);return new Ui(o,t,js(o))}}function js(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 IM(i,s,o.diagnostic),!1}),n}function Tb(r,e){let t=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(n=>n.is(ff))||r.changes.touchesRange(t.from,t.to))}function Eb(r,e){return r.field(ir,!1)?e:e.concat(Oe.appendConfig.of(Vb))}function MM(r,e){return{effects:Eb(r,[ff.of(e)])}}const ff=Oe.define(),Ah=Oe.define(),Pb=Oe.define(),ir=vt.define({create(){return new Ui(pe.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=js(t,r.selected.diagnostic,i)||js(t,null,i)}r=new Ui(t,r.panel,n)}for(let t of e.effects)t.is(ff)?r=Ui.init(t.value,r.panel,e.state):t.is(Ah)?r=new Ui(r.diagnostics,t.value?uf.open:null,r.selected):t.is(Pb)&&(r=new Ui(r.diagnostics,r.panel,t.value));return r},provide:r=>[Bo.from(r,e=>e.panel),ce.decorations.from(r,e=>e.diagnostics)]});function j5(r){let e=r.field(ir,!1);return e?e.diagnostics.size:0}const DM=pe.mark({class:"cm-lintRange cm-lintRange-active"});function NM(r,e,t){let{diagnostics:n}=r.state.field(ir),i=[],s=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(a,f,{spec:u})=>{e>=a&&e<=f&&(a==f||(e>a||t>0)&&(e<f||t<0))&&(i.push(u.diagnostic),s=Math.min(a,s),o=Math.max(f,o))});let l=r.state.facet(Gi).tooltipFilter;return l&&(i=l(i)),i.length?{pos:s,end:o,above:r.state.doc.lineAt(s).to<o,create(){return{dom:Ib(r,i)}}}:null}function Ib(r,e){return lt("ul",{class:"cm-tooltip-lint"},e.map(t=>Rb(r,t,!1)))}const RM=r=>{let e=r.state.field(ir,!1);(!e||!e.panel)&&r.dispatch({effects:Eb(r.state,[Ah.of(!0)])});let t=Lo(r,uf.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Mb=r=>{let e=r.state.field(ir,!1);return!e||!e.panel?!1:(r.dispatch({effects:Ah.of(!1)}),!0)},LM=r=>{let e=r.state.field(ir,!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)},V5=r=>{let{state:e}=r,t=e.field(ir,!1);if(!t)return!1;let n=e.selection.main,i,s,o,l;return t.diagnostics.between(0,e.doc.length,(a,f)=>{f<n.to&&(i==null||i<a)&&(i=a,s=f),(o==null||a>o)&&(o=a,l=f)}),o==null||i==null&&o==n.from?!1:(r.dispatch({selection:{anchor:i??o,head:s??l},scrollIntoView:!0}),!0)},BM=[{key:"Mod-Shift-m",run:RM,preventDefault:!0},{key:"F8",run:LM}],Db=st.fromClass(class{constructor(r){this.view=r,this.timeout=-1,this.set=!0;let{delay:e}=r.state.facet(Gi);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(Gi);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(MM(this.view.state,i))},n=>{cr(this.view.state,n)})}}update(r){let e=r.state.facet(Gi);(r.docChanged||e!=r.startState.facet(Gi)||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)}}),Gi=ge.define({combine(r){return Object.assign({sources:r.map(e=>e.source)},Cr(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 FM(r,e={}){return[Gi.of({source:r,config:e}),Db,Vb]}function W5(r){let e=r.plugin(Db);e&&e.force()}function Nb(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 Rb(r,e,t){var n;let i=t?Nb(e.actions):[];return lt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},lt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=js(r.state.field(ir).diagnostics,e);p&&s.apply(r,p.from,p.to)},{name:f}=s,u=i[o]?f.indexOf(i[o]):-1,c=u<0?f:[f.slice(0,u),lt("u",f.slice(u,u+1)),f.slice(u+1)];return lt("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${f}${u<0?"":` (access key "${i[o]})"`}.`},c)}),e.source&<("div",{class:"cm-diagnosticSource"},e.source))}class jM extends zr{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return lt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Lb{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Rb(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class uf{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Mb(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=Nb(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=js(this.view.state.field(ir).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.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=lt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=lt("div",{class:"cm-panel-lint"},this.list,lt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Mb(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(ir).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(ir),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,l,{spec:a})=>{let f=-1,u;for(let c=n;c<this.items.length;c++)if(this.items[c].diagnostic==a.diagnostic){f=c;break}f<0?(u=new Lb(this.view,a.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[f],f>n&&(this.items.splice(n,f-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 Lb(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:l})=>{let a=l.height/this.list.offsetHeight;o.top<l.top?this.list.scrollTop-=(l.top-o.top)/a:o.bottom>l.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function 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(ir),n=js(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Pb.of(n)})}static open(e){return new uf(e)}}function cf(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 hf(r){return cf(`<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 VM=ce.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:hf("#d11")},".cm-lintRange-warning":{backgroundImage:hf("orange")},".cm-lintRange-info":{backgroundImage:hf("#999")},".cm-lintRange-hint":{backgroundImage:hf("#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 Bb(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}class WM extends kn{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>Bb(t)<Bb(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(df).tooltipFilter;return i&&(n=i(n)),n.length&&(t.onmouseover=()=>HM(e,t,n)),t}}function $M(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(jb)&&r.dispatch({effects:Ch.of(null)})}};window.addEventListener("mousemove",t)}function HM(r,e,t){function n(){let o=r.elementAtHeight(e.getBoundingClientRect().top+5-r.documentTop);r.coordsAtPos(o.from)&&r.dispatch({effects:Ch.of({pos:o.from,above:!1,create(){return{dom:Ib(r,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,$M(r,e)}let{hoverTime:i}=r.state.facet(df),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function zM(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 WM(t[i]).range(+i));return $e.of(n,!0)}const UM=F0({class:"cm-gutter-lint",markers:r=>r.state.field(Fb)}),Fb=vt.define({create(){return $e.empty},update(r,e){r=r.map(e.changes);let t=e.state.facet(df).markerFilter;for(let n of e.effects)if(n.is(ff)){let i=n.value;t&&(i=t(i||[])),r=zM(e.state.doc,i.slice(0))}return r}}),Ch=Oe.define(),jb=vt.define({create(){return null},update(r,e){return r&&e.docChanged&&(r=Tb(e,r)?null:Object.assign(Object.assign({},r),{pos:e.changes.mapPos(r.pos)})),e.effects.reduce((t,n)=>n.is(Ch)?n.value:t,r)},provide:r=>Ca.from(r)}),GM=ce.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:cf('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:cf('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:cf('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Vb=[ir,ce.decorations.compute([ir],r=>{let{selected:e,panel:t}=r.field(ir);return!e||!t||e.from==e.to?pe.none:pe.set([DM.range(e.from,e.to)])}),_2(NM,{hideOn:Tb}),VM],df=ge.define({combine(r){return Cr(r,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function $5(r={}){return[df.of(r),Fb,UM,GM,jb]}function H5(r,e){let t=r.field(ir,!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 Wb=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(wM)),e.defaultKeymap!==!1&&(n=n.concat(oI)),e.searchKeymap!==!1&&(n=n.concat(MI)),e.historyKeymap!==!1&&(n=n.concat(mP)),e.foldKeymap!==!1&&(n=n.concat(kE)),e.completionKeymap!==!1&&(n=n.concat(Cb)),e.lintKeymap!==!1&&(n=n.concat(BM));var i=[];return e.lineNumbers!==!1&&i.push(rT()),e.highlightActiveLineGutter!==!1&&i.push(sT()),e.highlightSpecialChars!==!1&&i.push(k2()),e.history!==!1&&i.push(lP()),e.foldGutter!==!1&&i.push(TE()),e.drawSelection!==!1&&i.push(d2()),e.dropCursor!==!1&&i.push(y2()),e.allowMultipleSelections!==!1&&i.push(je.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(hE()),e.syntaxHighlighting!==!1&&i.push(Uc(ME,{fallback:!0})),e.bracketMatching!==!1&&i.push(FE()),e.closeBrackets!==!1&&i.push(yM()),e.autocompletion!==!1&&i.push(EM()),e.rectangularSelection!==!1&&i.push(F2()),t!==!1&&i.push(W2()),e.highlightActiveLine!==!1&&i.push(P2()),e.highlightSelectionMatches!==!1&&i.push(hI()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Ba.of(" ".repeat(e.tabSize))),i.concat([Io.of(n.flat())]).filter(Boolean)},z5=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 $b="#e5c07b",Oh="#e06c75",Hb="#56b6c2",zb="#ffffff",rl="#abb2bf",pf="#7d8799",Ub="#61afef",Gb="#98c379",Th="#d19a66",Kb="#c678dd",Yb="#21252b",Eh="#2c313a",Ph="#282c34",gf="#353a42",_b="#3E4451",Ih="#528bff",U5={chalky:$b,coral:Oh,cyan:Hb,invalid:zb,ivory:rl,stone:pf,malibu:Ub,sage:Gb,whiskey:Th,violet:Kb,darkBackground:Yb,highlightBackground:Eh,background:Ph,tooltipBackground:gf,selection:_b,cursor:Ih},KM=ce.theme({"&":{color:rl,backgroundColor:Ph},".cm-content":{caretColor:Ih},".cm-cursor, .cm-dropCursor":{borderLeftColor:Ih},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_b},".cm-panels":{backgroundColor:Yb,color:rl},".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:Ph,color:pf,border:"none"},".cm-activeLineGutter":{backgroundColor:Eh},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:gf},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gf,borderBottomColor:gf},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Eh,color:rl}}},{dark:!0}),YM=Es.define([{tag:P.keyword,color:Kb},{tag:[P.name,P.deleted,P.character,P.propertyName,P.macroName],color:Oh},{tag:[P.function(P.variableName),P.labelName],color:Ub},{tag:[P.color,P.constant(P.name),P.standard(P.name)],color:Th},{tag:[P.definition(P.name),P.separator],color:rl},{tag:[P.typeName,P.className,P.number,P.changed,P.annotation,P.modifier,P.self,P.namespace],color:$b},{tag:[P.operator,P.operatorKeyword,P.url,P.escape,P.regexp,P.link,P.special(P.string)],color:Hb},{tag:[P.meta,P.comment],color:pf},{tag:P.strong,fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.link,color:pf,textDecoration:"underline"},{tag:P.heading,fontWeight:"bold",color:Oh},{tag:[P.atom,P.bool,P.special(P.variableName)],color:Th},{tag:[P.processingInstruction,P.string,P.inserted],color:Gb},{tag:P.invalid,color:zb}]),_M=[KM,Uc(YM)];var JM=ce.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),XM=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(t&&a.unshift(Io.of([lI])),l&&(typeof l=="boolean"?a.unshift(Wb()):a.unshift(Wb(l))),o&&a.unshift(N2(o)),s){case"light":a.push(JM);break;case"dark":a.push(_M);break;case"none":break;default:a.push(s);break}return n===!1&&a.push(ce.editable.of(!1)),i&&a.push(je.readOnly.of(!0)),[...a]},QM=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)}),Jb=yn.define(),ZM=[];function qM(r){var{value:e,selection:t,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:l=ZM,autoFocus:a,theme:f="light",height:u=null,minHeight:c=null,maxHeight:d=null,width:p=null,minWidth:g=null,maxWidth:y=null,placeholder:x="",editable:k=!0,readOnly:E=!1,indentWithTab:O=!0,basicSetup:j=!0,root:M,initialState:F}=r,[D,U]=(0,S.useState)(),[L,$]=(0,S.useState)(),[W,Y]=(0,S.useState)(),le=ce.theme({"&":{height:u,minHeight:c,maxHeight:d,width:p,minWidth:g,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),fe=ce.updateListener.of(ye=>{if(ye.docChanged&&typeof n=="function"&&!ye.transactions.some(Ae=>Ae.annotation(Jb))){var Ce=ye.state.doc,He=Ce.toString();n(He,ye)}i&&i(QM(ye))}),me=XM({theme:f,editable:k,readOnly:E,placeholder:x,indentWithTab:O,basicSetup:j}),Te=[fe,le,...me];return o&&typeof o=="function"&&Te.push(ce.updateListener.of(o)),Te=Te.concat(l),(0,S.useEffect)(()=>{if(D&&!W){var ye={doc:e,selection:t,extensions:Te},Ce=F?je.fromJSON(F.json,ye,F.fields):je.create(ye);if(Y(Ce),!L){var He=new ce({state:Ce,parent:D,root:M});$(He),s&&s(He,Ce)}}return()=>{L&&(Y(void 0),$(void 0))}},[D,W]),(0,S.useEffect)(()=>U(r.container),[r.container]),(0,S.useEffect)(()=>()=>{L&&(L.destroy(),$(void 0))},[L]),(0,S.useEffect)(()=>{a&&L&&L.focus()},[a,L]),(0,S.useEffect)(()=>{L&&L.dispatch({effects:Oe.reconfigure.of(Te)})},[f,l,u,c,d,p,g,y,x,k,E,O,j,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var ye=L?L.state.doc.toString():"";L&&e!==ye&&L.dispatch({changes:{from:0,to:ye.length,insert:e||""},annotations:[Jb.of(!0)]})}},[e,L]),{state:W,setState:Y,view:L,setView:$,container:D,setContainer:U}}var eD=h(97458),tD=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Xb=(0,S.forwardRef)((r,e)=>{var{className:t,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:f,autoFocus:u,theme:c="light",height:d,minHeight:p,maxHeight:g,width:y,minWidth:x,maxWidth:k,basicSetup:E,placeholder:O,indentWithTab:j,editable:M,readOnly:F,root:D,initialState:U}=r,L=eE(r,tD),$=(0,S.useRef)(null),{state:W,view:Y,container:le}=qM({container:$.current,root:D,value:n,autoFocus:u,theme:c,height:d,minHeight:p,maxHeight:g,width:y,minWidth:x,maxWidth:k,basicSetup:E,placeholder:O,indentWithTab:j,editable:M,readOnly:F,selection:i,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:f,extensions:s,initialState:U});if((0,S.useImperativeHandle)(e,()=>({editor:$.current,state:W,view:Y}),[$,le,W,Y]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var fe=typeof c=="string"?"cm-theme-"+c:"cm-theme";return(0,eD.jsx)("div",Rc({ref:$,className:""+fe+(t?" "+t:"")},L))});Xb.displayName="CodeMirror";const rD=Xb,nD=(0,Xe.ZP)(rD)`
|
|
154
156
|
display: flex;
|
|
155
157
|
flex-direction: column;
|
|
156
158
|
justify-content: flex-start;
|
|
@@ -201,34 +203,34 @@
|
|
|
201
203
|
background: none;
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
|
-
`;function
|
|
205
|
-
`;break;case 114:
|
|
206
|
-
`),
|
|
206
|
+
`;function mf(){return mf=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},mf.apply(this,arguments)}var Qb=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 l=ce.theme(i,{dark:e==="dark"}),a=Es.define(n),f=[l,Uc(a)];return f};const G5=null;var iD={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f063",selectionMatch:"#d7d4f063",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b6130"},K5=null,Mh=r=>{var{theme:e="dark",settings:t={},styles:n=[]}=r||{};return Qb({theme:e,settings:mf({},iD,t),styles:[{tag:P.keyword,color:"#cf6edf"},{tag:[P.name,P.deleted,P.character,P.macroName],color:"#56c8d8"},{tag:[P.propertyName],color:"#facf4e"},{tag:[P.variableName],color:"#bdbdbd"},{tag:[P.function(P.variableName)],color:"#56c8d8"},{tag:[P.labelName],color:"#cf6edf"},{tag:[P.color,P.constant(P.name),P.standard(P.name)],color:"#facf4e"},{tag:[P.definition(P.name),P.separator],color:"#fa5788"},{tag:[P.brace],color:"#cf6edf"},{tag:[P.annotation],color:"#ff5f52"},{tag:[P.number,P.changed,P.annotation,P.modifier,P.self,P.namespace],color:"#ffad42"},{tag:[P.typeName,P.className],color:"#ffad42"},{tag:[P.operator,P.operatorKeyword],color:"#7186f0"},{tag:[P.tagName],color:"#99d066"},{tag:[P.squareBracket],color:"#ff5f52"},{tag:[P.angleBracket],color:"#606f7a"},{tag:[P.attributeName],color:"#bdbdbd"},{tag:[P.regexp],color:"#ff5f52"},{tag:[P.quote],color:"#6abf69"},{tag:[P.string],color:"#99d066"},{tag:P.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[P.url,P.escape,P.special(P.string)],color:"#facf4e"},{tag:[P.meta],color:"#707d8b"},{tag:[P.comment],color:"#707d8b",fontStyle:"italic"},{tag:P.monospace,color:"#bdbdbd"},{tag:P.strong,fontWeight:"bold",color:"#ff5f52"},{tag:P.emphasis,fontStyle:"italic",color:"#99d066"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.heading,fontWeight:"bold",color:"#facf4e"},{tag:P.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[P.heading2,P.heading3,P.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[P.heading5,P.heading6],color:"#facf4e"},{tag:[P.atom,P.bool,P.special(P.variableName)],color:"#56c8d8"},{tag:[P.processingInstruction,P.inserted],color:"#ff5f52"},{tag:[P.contentSeparator],color:"#56c8d8"},{tag:P.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"},...n]})},sD=Mh,Y5=Mh(),_5=Mh(),oD={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#80CBC440",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},Dh=r=>{var{theme:e="light",settings:t={},styles:n=[]}=r||{};return Qb({theme:e,settings:mf({},oD,t),styles:[{tag:P.keyword,color:"#39ADB5"},{tag:[P.name,P.deleted,P.character,P.macroName],color:"#90A4AE"},{tag:[P.propertyName],color:"#6182B8"},{tag:[P.processingInstruction,P.string,P.inserted,P.special(P.string)],color:"#91B859"},{tag:[P.function(P.variableName),P.labelName],color:"#6182B8"},{tag:[P.color,P.constant(P.name),P.standard(P.name)],color:"#39ADB5"},{tag:[P.definition(P.name),P.separator],color:"#90A4AE"},{tag:[P.className],color:"#E2931D"},{tag:[P.number,P.changed,P.annotation,P.modifier,P.self,P.namespace],color:"#F76D47"},{tag:[P.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[P.operator,P.operatorKeyword],color:"#39ADB5"},{tag:[P.url,P.escape,P.regexp,P.link],color:"#91B859"},{tag:[P.meta,P.comment],color:"#90A4AE"},{tag:P.strong,fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[P.atom,P.bool,P.special(P.variableName)],color:"#90A4AE"},{tag:P.invalid,color:"#E5393570"},{tag:P.strikethrough,textDecoration:"line-through"},...n]})},J5=Dh();function vf(r,e){e===void 0&&(e=!1);var t=r.length,n=0,i="",s=0,o=16,l=0,a=0,f=0,u=0,c=0;function d(O,j){for(var M=0,F=0;M<O||!j;){var D=r.charCodeAt(n);if(D>=48&&D<=57)F=F*16+D-48;else if(D>=65&&D<=70)F=F*16+D-65+10;else if(D>=97&&D<=102)F=F*16+D-97+10;else break;n++,M++}return M<O&&(F=-1),F}function p(O){n=O,i="",s=0,o=16,c=0}function g(){var O=n;if(r.charCodeAt(n)===48)n++;else for(n++;n<r.length&&Vs(r.charCodeAt(n));)n++;if(n<r.length&&r.charCodeAt(n)===46)if(n++,n<r.length&&Vs(r.charCodeAt(n)))for(n++;n<r.length&&Vs(r.charCodeAt(n));)n++;else return c=3,r.substring(O,n);var j=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&&Vs(r.charCodeAt(n))){for(n++;n<r.length&&Vs(r.charCodeAt(n));)n++;j=n}else c=3;return r.substring(O,j)}function y(){for(var O="",j=n;;){if(n>=t){O+=r.substring(j,n),c=2;break}var M=r.charCodeAt(n);if(M===34){O+=r.substring(j,n),n++;break}if(M===92){if(O+=r.substring(j,n),n++,n>=t){c=2;break}var F=r.charCodeAt(n++);switch(F){case 34:O+='"';break;case 92:O+="\\";break;case 47:O+="/";break;case 98:O+="\b";break;case 102:O+="\f";break;case 110:O+=`
|
|
207
|
+
`;break;case 114:O+="\r";break;case 116:O+=" ";break;case 117:var D=d(4,!0);D>=0?O+=String.fromCharCode(D):c=4;break;default:c=5}j=n;continue}if(M>=0&&M<=31)if(nl(M)){O+=r.substring(j,n),c=2;break}else c=6;n++}return O}function x(){if(i="",c=0,s=n,a=l,u=f,n>=t)return s=t,o=17;var O=r.charCodeAt(n);if(Nh(O)){do n++,i+=String.fromCharCode(O),O=r.charCodeAt(n);while(Nh(O));return o=15}if(nl(O))return n++,i+=String.fromCharCode(O),O===13&&r.charCodeAt(n)===10&&(n++,i+=`
|
|
208
|
+
`),l++,f=n,o=14;switch(O){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 j=n-1;if(r.charCodeAt(n+1)===47){for(n+=2;n<t&&!nl(r.charCodeAt(n));)n++;return i=r.substring(j,n),o=12}if(r.charCodeAt(n+1)===42){n+=2;for(var M=t-1,F=!1;n<M;){var D=r.charCodeAt(n);if(D===42&&r.charCodeAt(n+1)===47){n+=2,F=!0;break}n++,nl(D)&&(D===13&&r.charCodeAt(n)===10&&n++,l++,f=n)}return F||(n++,c=1),i=r.substring(j,n),o=13}return i+=String.fromCharCode(O),n++,o=16;case 45:if(i+=String.fromCharCode(O),n++,n===t||!Vs(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+=g(),o=11;default:for(;n<t&&k(O);)n++,O=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(O),n++,o=16}}function k(O){if(Nh(O)||nl(O))return!1;switch(O){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function E(){var O;do O=x();while(O>=12&&O<=15);return O}return{setPosition:p,getPosition:function(){return n},scan:e?E:x,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return n-s},getTokenStartLine:function(){return a},getTokenStartCharacter:function(){return s-u},getTokenError:function(){return c}}}function Nh(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 nl(r){return r===10||r===13||r===8232||r===8233}function Vs(r){return r>=48&&r<=57}function lD(r,e,t){var n,i,s,o,l;if(e){for(o=e.offset,l=o+e.length,s=o;s>0&&!Zb(r,s-1);)s--;for(var a=l;a<r.length&&!Zb(r,a);)a++;i=r.substring(s,a),n=aD(i,t)}else i=r,n=0,s=0,o=0,l=r.length;var f=fD(t,r),u=!1,c=0,d;t.insertSpaces?d=Rh(" ",t.tabSize||4):d=" ";var p=vf(i,!1),g=!1;function y(){return f+Rh(d,n+c)}function x(){var W=p.scan();for(u=!1;W===15||W===14;)u=u||W===14,W=p.scan();return g=W===16||p.getTokenError()!==0,W}var k=[];function E(W,Y,le){!g&&Y<l&&le>o&&r.substring(Y,le)!==W&&k.push({offset:Y,length:le-Y,content:W})}var O=x();if(O!==17){var j=p.getTokenOffset()+s,M=Rh(d,n);E(M,s,j)}for(;O!==17;){for(var F=p.getTokenOffset()+p.getTokenLength()+s,D=x(),U="";!u&&(D===12||D===13);){var L=p.getTokenOffset()+s;E(" ",F,L),F=p.getTokenOffset()+p.getTokenLength()+s,U=D===12?y():"",D=x()}if(D===2)O!==1&&(c--,U=y());else if(D===4)O!==3&&(c--,U=y());else{switch(O){case 3:case 1:c++,U=y();break;case 5:case 12:U=y();break;case 13:u?U=y():U=" ";break;case 6:U=" ";break;case 10:if(D===6){U="";break}case 7:case 8:case 9:case 11:case 2:case 4:D===12||D===13?U=" ":D!==5&&D!==17&&(g=!0);break;case 16:g=!0;break}u&&(D===12||D===13)&&(U=y())}var $=p.getTokenOffset()+s;E(U,F,$),O=D}return k}function Rh(r,e){for(var t="",n=0;n<e;n++)t+=r;return t}function aD(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 fD(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
209
|
`?`\r
|
|
208
210
|
`:"\r";if(n===`
|
|
209
211
|
`)return`
|
|
210
212
|
`}return r&&r.eol||`
|
|
211
|
-
`}function
|
|
212
|
-
`.indexOf(r.charAt(e))!==-1}var
|
|
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===`
|
|
213
|
+
`}function Zb(r,e){return`\r
|
|
214
|
+
`.indexOf(r.charAt(e))!==-1}var il;(function(r){r.DEFAULT={allowTrailingComma:!1}})(il||(il={}));function uD(r,e){var t=[],n=new Object,i=void 0,s={value:{},offset:0,length:0,type:"object",parent:void 0},o=!1;function l(a,f,u,c){s.value=a,s.offset=f,s.length=u,s.type=c,s.colonOffset=void 0,i=s}try{yf(r,{onObjectBegin:function(a,f){if(e<=a)throw n;i=void 0,o=e>a,t.push("")},onObjectProperty:function(a,f,u){if(e<f||(l(a,f,u,"property"),t[t.length-1]=a,e<=f+u))throw n},onObjectEnd:function(a,f){if(e<=a)throw n;i=void 0,t.pop()},onArrayBegin:function(a,f){if(e<=a)throw n;i=void 0,t.push(0)},onArrayEnd:function(a,f){if(e<=a)throw n;i=void 0,t.pop()},onLiteralValue:function(a,f,u){if(e<f||(l(a,f,u,t1(a)),e<=f+u))throw n},onSeparator:function(a,f,u){if(e<=f)throw n;if(a===":"&&i&&i.type==="property")i.colonOffset=f,o=!1,i=void 0;else if(a===","){var c=t[t.length-1];typeof c=="number"?t[t.length-1]=c+1:(o=!0,t[t.length-1]=""),i=void 0}}})}catch(a){if(a!==n)throw a}return{path:t,previousNode:i,isAtPropertyKey:o,matches:function(a){for(var f=0,u=0;f<a.length&&u<t.length;u++)if(a[f]===t[u]||a[f]==="*")f++;else if(a[f]!=="**")return!1;return f===a.length}}}function cD(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=il.DEFAULT);var n=null,i=[],s=[];function o(a){Array.isArray(i)?i.push(a):n!==null&&(i[n]=a)}var l={onObjectBegin:function(){var a={};o(a),s.push(i),i=a,n=null},onObjectProperty:function(a){n=a},onObjectEnd:function(){i=s.pop()},onArrayBegin:function(){var a=[];o(a),s.push(i),i=a,n=null},onArrayEnd:function(){i=s.pop()},onLiteralValue:o,onError:function(a,f,u){e.push({error:a,offset:f,length:u})}};return yf(r,l,t),i[0]}function hD(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=il.DEFAULT);var n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(a){n.type==="property"&&(n.length=a-n.offset,n=n.parent)}function s(a){return n.children.push(a),a}var o={onObjectBegin:function(a){n=s({type:"object",offset:a,length:-1,parent:n,children:[]})},onObjectProperty:function(a,f,u){n=s({type:"property",offset:f,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:a,offset:f,length:u,parent:n})},onObjectEnd:function(a,f){i(a+f),n.length=a+f-n.offset,n=n.parent,i(a+f)},onArrayBegin:function(a,f){n=s({type:"array",offset:a,length:-1,parent:n,children:[]})},onArrayEnd:function(a,f){n.length=a+f-n.offset,n=n.parent,i(a+f)},onLiteralValue:function(a,f,u){s({type:t1(a),offset:f,length:u,parent:n,value:a}),i(f+u)},onSeparator:function(a,f,u){n.type==="property"&&(a===":"?n.colonOffset=f:a===","&&i(f))},onError:function(a,f,u){e.push({error:a,offset:f,length:u})}};yf(r,o,t);var l=n.children[0];return l&&delete l.parent,l}function dD(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,l=0,a=t.children;l<a.length;l++){var f=a[l];if(Array.isArray(f.children)&&f.children[0].value===s){t=f.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 qb(r){if(!r.parent||!r.parent.children)return[];var e=qb(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 Lh(r){switch(r.type){case"array":return r.children.map(Lh);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]=Lh(s))}return e;case"null":case"string":case"number":case"boolean":return r.value;default:return}}function pD(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}function e1(r,e,t){if(t===void 0&&(t=!1),pD(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=e1(n[i],e,t);if(s)return s}return r}}function yf(r,e,t){t===void 0&&(t=il.DEFAULT);var n=vf(r,!1);function i(L){return L?function(){return L(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}function s(L){return L?function($){return L($,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}var o=i(e.onObjectBegin),l=s(e.onObjectProperty),a=i(e.onObjectEnd),f=i(e.onArrayBegin),u=i(e.onArrayEnd),c=s(e.onLiteralValue),d=s(e.onSeparator),p=i(e.onComment),g=s(e.onError),y=t&&t.disallowComments,x=t&&t.allowTrailingComma;function k(){for(;;){var L=n.scan();switch(n.getTokenError()){case 4:E(14);break;case 5:E(15);break;case 3:E(13);break;case 1:y||E(11);break;case 2:E(12);break;case 6:E(16);break}switch(L){case 12:case 13:y?E(10):p();break;case 16:E(1);break;case 15:case 14:break;default:return L}}}function E(L,$,W){if($===void 0&&($=[]),W===void 0&&(W=[]),g(L),$.length+W.length>0)for(var Y=n.getToken();Y!==17;){if($.indexOf(Y)!==-1){k();break}else if(W.indexOf(Y)!==-1)break;Y=k()}}function O(L){var $=n.getTokenValue();return L?c($):l($),k(),!0}function j(){switch(n.getToken()){case 11:var L=n.getTokenValue(),$=Number(L);isNaN($)&&(E(2),$=0),c($);break;case 7:c(null);break;case 8:c(!0);break;case 9:c(!1);break;default:return!1}return k(),!0}function M(){return n.getToken()!==10?(E(3,[],[2,5]),!1):(O(!1),n.getToken()===6?(d(":"),k(),U()||E(4,[],[2,5])):E(5,[],[2,5]),!0)}function F(){o(),k();for(var L=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(L||E(4,[],[]),d(","),k(),n.getToken()===2&&x)break}else L&&E(6,[],[]);M()||E(4,[],[2,5]),L=!0}return a(),n.getToken()!==2?E(7,[2],[]):k(),!0}function D(){f(),k();for(var L=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(L||E(4,[],[]),d(","),k(),n.getToken()===4&&x)break}else L&&E(6,[],[]);U()||E(4,[],[4,5]),L=!0}return u(),n.getToken()!==4?E(8,[4],[]):k(),!0}function U(){switch(n.getToken()){case 3:return D();case 1:return F();case 10:return O(!0);default:return j()}}return k(),n.getToken()===17?t.allowEmptyContent?!0:(E(4,[],[]),!1):U()?(n.getToken()!==17&&E(9,[],[]),!0):(E(4,[],[]),!1)}function gD(r,e){var t=vf(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 t1(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 X5(r,e,t){return mD(r,e,void 0,t)}function mD(r,e,t,n){for(var i,s=e.slice(),o=[],l=parseTree(r,o),a=void 0,f=void 0;s.length>0&&(f=s.pop(),a=findNodeAtLocation(l,s),a===void 0&&t!==void 0);)typeof f=="string"?t=(i={},i[f]=t,i):t=[t];if(a)if(a.type==="object"&&typeof f=="string"&&Array.isArray(a.children)){var u=findNodeAtLocation(a,[f]);if(u!==void 0)if(t===void 0){if(!u.parent)throw new Error("Malformed AST");var c=a.children.indexOf(u.parent),d=void 0,p=u.parent.offset+u.parent.length;if(c>0){var g=a.children[c-1];d=g.offset+g.length}else if(d=a.offset+1,a.children.length>1){var y=a.children[1];p=y.offset}return Ki(r,{offset:d,length:p-d,content:""},n)}else return Ki(r,{offset:u.offset,length:u.length,content:JSON.stringify(t)},n);else{if(t===void 0)return[];var x=JSON.stringify(f)+": "+JSON.stringify(t),k=n.getInsertionIndex?n.getInsertionIndex(a.children.map(function(L){return L.children[0].value})):a.children.length,E=void 0;if(k>0){var g=a.children[k-1];E={offset:g.offset+g.length,length:0,content:","+x}}else a.children.length===0?E={offset:a.offset+1,length:0,content:x}:E={offset:a.offset+1,length:0,content:x+","};return Ki(r,E,n)}}else if(a.type==="array"&&typeof f=="number"&&Array.isArray(a.children)){var O=f;if(O===-1){var x=""+JSON.stringify(t),E=void 0;if(a.children.length===0)E={offset:a.offset+1,length:0,content:x};else{var g=a.children[a.children.length-1];E={offset:g.offset+g.length,length:0,content:","+x}}return Ki(r,E,n)}else if(t===void 0&&a.children.length>=0){var j=f,M=a.children[j],E=void 0;if(a.children.length===1)E={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===j){var g=a.children[j-1],F=g.offset+g.length,D=a.offset+a.length;E={offset:F,length:D-2-F,content:""}}else E={offset:M.offset,length:a.children[j+1].offset-M.offset,content:""};return Ki(r,E,n)}else if(t!==void 0){var E=void 0,x=""+JSON.stringify(t);if(!n.isArrayInsertion&&a.children.length>f){var U=a.children[f];E={offset:U.offset,length:U.length,content:x}}else if(a.children.length===0||f===0)E={offset:a.offset+1,length:0,content:a.children.length===0?x:x+","};else{var k=f>a.children.length?a.children.length:f,g=a.children[k-1];E={offset:g.offset+g.length,length:0,content:","+x}}return Ki(r,E,n)}else throw new Error("Can not "+(t===void 0?"remove":n.isArrayInsertion?"insert":"modify")+" Array index "+O+" as length is not sufficient")}else throw new Error("Can not add "+(typeof f!="number"?"index":"property")+" to parent of type "+a.type);else{if(t===void 0)throw new Error("Can not delete in empty document");return Ki(r,{offset:l?l.offset:0,length:l?l.length:0,content:JSON.stringify(t)},n)}}function Ki(r,e,t){if(!t.formattingOptions)return[e];var n=r1(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),l=o.length-1;l>=0;l--){var a=o[l];n=r1(n,a),i=Math.min(i,a.offset),s=Math.max(s,a.offset+a.length),s+=a.content.length-a.length}var f=r.length-(n.length-s)-i;return[{offset:i,length:f,content:n.substring(i,s)}]}function r1(r,e){return r.substring(0,e.offset)+e.content+r.substring(e.offset+e.length)}function Q5(r,e){return`\r
|
|
215
|
+
`.indexOf(r.charAt(e))!==-1}var Ws=vf,Z5=uD,vD=cD,q5=hD,eL=dD,yD=e1,bD=qb,xD=Lh,tL=yf,rL=gD;function nL(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 wD(r,e,t){return lD(r,e,t)}function iL(r,e,t,n){return edit.setProperty(r,e,t,n)}function sL(r,e){for(var t=e.length-1;t>=0;t--)r=edit.applyEdit(r,e[t]);return r}function sl(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(!sl(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(),!sl(i,s))return!1;for(t=0;t<i.length;t++)if(!sl(r[i[t]],e[i[t]]))return!1}return!0}function Dr(r){return typeof r=="number"}function Hn(r){return typeof r<"u"}function En(r){return typeof r=="boolean"}function SD(r){return typeof r=="string"}var n1;(function(r){function e(t){return typeof t=="string"}r.is=e})(n1||(n1={}));var Bh;(function(r){function e(t){return typeof t=="string"}r.is=e})(Bh||(Bh={}));var i1;(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})(i1||(i1={}));var bf;(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})(bf||(bf={}));var _r;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=bf.MAX_VALUE),i===Number.MAX_VALUE&&(i=bf.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&Q.uinteger(i.line)&&Q.uinteger(i.character)}r.is=t})(_r||(_r={}));var Ke;(function(r){function e(n,i,s,o){if(Q.uinteger(n)&&Q.uinteger(i)&&Q.uinteger(s)&&Q.uinteger(o))return{start:_r.create(n,i),end:_r.create(s,o)};if(_r.is(n)&&_r.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 Q.objectLiteral(i)&&_r.is(i.start)&&_r.is(i.end)}r.is=t})(Ke||(Ke={}));var $s;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&Ke.is(i.range)&&(Q.string(i.uri)||Q.undefined(i.uri))}r.is=t})($s||($s={}));var s1;(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 Q.objectLiteral(i)&&Ke.is(i.targetRange)&&Q.string(i.targetUri)&&Ke.is(i.targetSelectionRange)&&(Ke.is(i.originSelectionRange)||Q.undefined(i.originSelectionRange))}r.is=t})(s1||(s1={}));var Fh;(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 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)}r.is=t})(Fh||(Fh={}));var o1;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&Ke.is(i.range)&&Fh.is(i.color)}r.is=t})(o1||(o1={}));var l1;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&Q.string(i.label)&&(Q.undefined(i.textEdit)||Jr.is(i))&&(Q.undefined(i.additionalTextEdits)||Q.typedArray(i.additionalTextEdits,Jr.is))}r.is=t})(l1||(l1={}));var ol;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(ol||(ol={}));var a1;(function(r){function e(n,i,s,o,l,a){var f={startLine:n,endLine:i};return Q.defined(s)&&(f.startCharacter=s),Q.defined(o)&&(f.endCharacter=o),Q.defined(l)&&(f.kind=l),Q.defined(a)&&(f.collapsedText=a),f}r.create=e;function t(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))}r.is=t})(a1||(a1={}));var jh;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&$s.is(i.location)&&Q.string(i.message)}r.is=t})(jh||(jh={}));var De;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(De||(De={}));var f1;(function(r){r.Unnecessary=1,r.Deprecated=2})(f1||(f1={}));var u1;(function(r){function e(t){var n=t;return Q.objectLiteral(n)&&Q.string(n.href)}r.is=e})(u1||(u1={}));var zn;(function(r){function e(n,i,s,o,l,a){var f={range:n,message:i};return Q.defined(s)&&(f.severity=s),Q.defined(o)&&(f.code=o),Q.defined(l)&&(f.source=l),Q.defined(a)&&(f.relatedInformation=a),f}r.create=e;function t(n){var i,s=n;return Q.defined(s)&&Ke.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,jh.is))}r.is=t})(zn||(zn={}));var Hs;(function(r){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var l={title:n,command:i};return Q.defined(s)&&s.length>0&&(l.arguments=s),l}r.create=e;function t(n){var i=n;return Q.defined(i)&&Q.string(i.title)&&Q.string(i.command)}r.is=t})(Hs||(Hs={}));var Jr;(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 Q.objectLiteral(o)&&Q.string(o.newText)&&Ke.is(o.range)}r.is=i})(Jr||(Jr={}));var zs;(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 Q.objectLiteral(i)&&Q.string(i.label)&&(Q.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Q.string(i.description)||i.description===void 0)}r.is=t})(zs||(zs={}));var sr;(function(r){function e(t){var n=t;return Q.string(n)}r.is=e})(sr||(sr={}));var yi;(function(r){function e(s,o,l){return{range:s,newText:o,annotationId:l}}r.replace=e;function t(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}r.insert=t;function n(s,o){return{range:s,newText:"",annotationId:o}}r.del=n;function i(s){var o=s;return Jr.is(o)&&(zs.is(o.annotationId)||sr.is(o.annotationId))}r.is=i})(yi||(yi={}));var xf;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Sf.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(xf||(xf={}));var ll;(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"&&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||sr.is(i.annotationId))}r.is=t})(ll||(ll={}));var al;(function(r){function e(n,i,s,o){var l={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}r.create=e;function t(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||sr.is(i.annotationId))}r.is=t})(al||(al={}));var fl;(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"&&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||sr.is(i.annotationId))}r.is=t})(fl||(fl={}));var Vh;(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 Q.string(i.kind)?ll.is(i)||al.is(i)||fl.is(i):xf.is(i)}))}r.is=e})(Vh||(Vh={}));var wf=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=Jr.insert(e,t):sr.is(n)?(s=n,i=yi.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=yi.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=Jr.replace(e,t):sr.is(n)?(s=n,i=yi.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=yi.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=Jr.del(e):sr.is(t)?(i=t,n=yi.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),n=yi.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}(),c1=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(sr.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}(),oL=function(){function r(e){var t=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new c1(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(xf.is(n)){var i=new wf(n.edits,t._changeAnnotations);t._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new wf(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(Sf.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 wf(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 wf(i),this._textEditChanges[e]=n}return n}},r.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new c1,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;zs.is(t)||sr.is(t)?i=t:n=t;var s,o;if(i===void 0?s=ll.create(e,n):(o=sr.is(i)?i:this._changeAnnotations.manage(i),s=ll.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;zs.is(n)||sr.is(n)?s=n:i=n;var o,l;if(s===void 0?o=al.create(e,t,i):(l=sr.is(s)?s:this._changeAnnotations.manage(s),o=al.create(e,t,i,l)),this._workspaceEdit.documentChanges.push(o),l!==void 0)return l},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;zs.is(t)||sr.is(t)?i=t:n=t;var s,o;if(i===void 0?s=fl.create(e,n):(o=sr.is(i)?i:this._changeAnnotations.manage(i),s=fl.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r}(),h1;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Q.string(i.uri)}r.is=t})(h1||(h1={}));var d1;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&Q.integer(i.version)}r.is=t})(d1||(d1={}));var Sf;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&(i.version===null||Q.integer(i.version))}r.is=t})(Sf||(Sf={}));var p1;(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 Q.defined(i)&&Q.string(i.uri)&&Q.string(i.languageId)&&Q.integer(i.version)&&Q.string(i.text)}r.is=t})(p1||(p1={}));var Yi;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){var n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(Yi||(Yi={}));var ul;(function(r){function e(t){var n=t;return Q.objectLiteral(t)&&Yi.is(n.kind)&&Q.string(n.value)}r.is=e})(ul||(ul={}));var Nr;(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})(Nr||(Nr={}));var jt;(function(r){r.PlainText=1,r.Snippet=2})(jt||(jt={}));var g1;(function(r){r.Deprecated=1})(g1||(g1={}));var m1;(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&&Q.string(i.newText)&&Ke.is(i.insert)&&Ke.is(i.replace)}r.is=t})(m1||(m1={}));var v1;(function(r){r.asIs=1,r.adjustIndentation=2})(v1||(v1={}));var y1;(function(r){function e(t){var n=t;return n&&(Q.string(n.detail)||n.detail===void 0)&&(Q.string(n.description)||n.description===void 0)}r.is=e})(y1||(y1={}));var Wh;(function(r){function e(t){return{label:t}}r.create=e})(Wh||(Wh={}));var b1;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(b1||(b1={}));var kf;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){var i=n;return Q.string(i)||Q.objectLiteral(i)&&Q.string(i.language)&&Q.string(i.value)}r.is=t})(kf||(kf={}));var x1;(function(r){function e(t){var n=t;return!!n&&Q.objectLiteral(n)&&(ul.is(n.contents)||kf.is(n.contents)||Q.typedArray(n.contents,kf.is))&&(t.range===void 0||Ke.is(t.range))}r.is=e})(x1||(x1={}));var w1;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(w1||(w1={}));var S1;(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 Q.defined(n)&&(o.documentation=n),Q.defined(i)?o.parameters=i:o.parameters=[],o}r.create=e})(S1||(S1={}));var k1;(function(r){r.Text=1,r.Read=2,r.Write=3})(k1||(k1={}));var A1;(function(r){function e(t,n){var i={range:t};return Q.number(n)&&(i.kind=n),i}r.create=e})(A1||(A1={}));var Pn;(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})(Pn||(Pn={}));var C1;(function(r){r.Deprecated=1})(C1||(C1={}));var O1;(function(r){function e(t,n,i,s,o){var l={name:t,kind:n,location:{uri:s,range:i}};return o&&(l.containerName=o),l}r.create=e})(O1||(O1={}));var T1;(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})(T1||(T1={}));var E1;(function(r){function e(n,i,s,o,l,a){var f={name:n,detail:i,kind:s,range:o,selectionRange:l};return a!==void 0&&(f.children=a),f}r.create=e;function t(n){var i=n;return i&&Q.string(i.name)&&Q.number(i.kind)&&Ke.is(i.range)&&Ke.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))}r.is=t})(E1||(E1={}));var P1;(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"})(P1||(P1={}));var Af;(function(r){r.Invoked=1,r.Automatic=2})(Af||(Af={}));var I1;(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 Q.defined(i)&&Q.typedArray(i.diagnostics,zn.is)&&(i.only===void 0||Q.typedArray(i.only,Q.string))&&(i.triggerKind===void 0||i.triggerKind===Af.Invoked||i.triggerKind===Af.Automatic)}r.is=t})(I1||(I1={}));var M1;(function(r){function e(n,i,s){var o={title:n},l=!0;return typeof i=="string"?(l=!1,o.kind=i):Hs.is(i)?o.command=i:o.edit=i,l&&s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return i&&Q.string(i.title)&&(i.diagnostics===void 0||Q.typedArray(i.diagnostics,zn.is))&&(i.kind===void 0||Q.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Hs.is(i.command))&&(i.isPreferred===void 0||Q.boolean(i.isPreferred))&&(i.edit===void 0||Vh.is(i.edit))}r.is=t})(M1||(M1={}));var D1;(function(r){function e(n,i){var s={range:n};return Q.defined(i)&&(s.data=i),s}r.create=e;function t(n){var i=n;return Q.defined(i)&&Ke.is(i.range)&&(Q.undefined(i.command)||Hs.is(i.command))}r.is=t})(D1||(D1={}));var N1;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Q.uinteger(i.tabSize)&&Q.boolean(i.insertSpaces)}r.is=t})(N1||(N1={}));var R1;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Ke.is(i.range)&&(Q.undefined(i.target)||Q.string(i.target))}r.is=t})(R1||(R1={}));var Cf;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&Ke.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Cf||(Cf={}));var L1;(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"})(L1||(L1={}));var B1;(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"})(B1||(B1={}));var F1;(function(r){function e(t){var n=t;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")}r.is=e})(F1||(F1={}));var j1;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){var i=n;return i!=null&&Ke.is(i.range)&&Q.string(i.text)}r.is=t})(j1||(j1={}));var V1;(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&&Ke.is(i.range)&&Q.boolean(i.caseSensitiveLookup)&&(Q.string(i.variableName)||i.variableName===void 0)}r.is=t})(V1||(V1={}));var W1;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){var i=n;return i!=null&&Ke.is(i.range)&&(Q.string(i.expression)||i.expression===void 0)}r.is=t})(W1||(W1={}));var $1;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){var i=n;return Q.defined(i)&&Ke.is(n.stoppedLocation)}r.is=t})($1||($1={}));var $h;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})($h||($h={}));var Hh;(function(r){function e(n){return{value:n}}r.create=e;function t(n){var i=n;return Q.objectLiteral(i)&&(i.tooltip===void 0||Q.string(i.tooltip)||ul.is(i.tooltip))&&(i.location===void 0||$s.is(i.location))&&(i.command===void 0||Hs.is(i.command))}r.is=t})(Hh||(Hh={}));var H1;(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 Q.objectLiteral(i)&&_r.is(i.position)&&(Q.string(i.label)||Q.typedArray(i.label,Hh.is))&&(i.kind===void 0||$h.is(i.kind))&&i.textEdits===void 0||Q.typedArray(i.textEdits,Jr.is)&&(i.tooltip===void 0||Q.string(i.tooltip)||ul.is(i.tooltip))&&(i.paddingLeft===void 0||Q.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Q.boolean(i.paddingRight))}r.is=t})(H1||(H1={}));var z1;(function(r){function e(t){var n=t;return Q.objectLiteral(n)&&Bh.is(n.uri)&&Q.string(n.name)}r.is=e})(z1||(z1={}));var lL=null,U1;(function(r){function e(s,o,l,a){return new kD(s,o,l,a)}r.create=e;function t(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))}r.is=t;function n(s,o){for(var l=s.getText(),a=i(o,function(g,y){var x=g.range.start.line-y.range.start.line;return x===0?g.range.start.character-y.range.start.character:x}),f=l.length,u=a.length-1;u>=0;u--){var c=a[u],d=s.offsetAt(c.range.start),p=s.offsetAt(c.range.end);if(p<=f)l=l.substring(0,d)+c.newText+l.substring(p,l.length);else throw new Error("Overlapping edit");f=d}return l}r.applyEdits=n;function i(s,o){if(s.length<=1)return s;var l=s.length/2|0,a=s.slice(0,l),f=s.slice(l);i(a,o),i(f,o);for(var u=0,c=0,d=0;u<a.length&&c<f.length;){var p=o(a[u],f[c]);p<=0?s[d++]=a[u++]:s[d++]=f[c++]}for(;u<a.length;)s[d++]=a[u++];for(;c<f.length;)s[d++]=f[c++];return s}})(U1||(U1={}));var kD=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
216
|
`,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+
|
|
217
|
+
`&&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 _r.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 _r.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}(),Q;(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 l(p,g,y){return e.call(p)==="[object Number]"&&g<=p&&p<=y}r.numberRange=l;function a(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}r.integer=a;function f(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}r.uinteger=f;function u(p){return e.call(p)==="[object Function]"}r.func=u;function c(p){return p!==null&&typeof p=="object"}r.objectLiteral=c;function d(p,g){return Array.isArray(p)&&p.every(g)}r.typedArray=d})(Q||(Q={}));var AD=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))},G1=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=Y1(s.range),l=this.offsetAt(o.start),a=this.offsetAt(o.end);this._content=this._content.substring(0,l)+s.text+this._content.substring(a,this._content.length);var f=Math.max(o.start.line,0),u=Math.max(o.end.line,0),c=this._lineOffsets,d=K1(s.text,!1,l);if(u-f===d.length)for(var p=0,g=d.length;p<g;p++)c[p+f+1]=d[p];else d.length<1e4?c.splice.apply(c,AD([f+1,u-f],d,!1)):this._lineOffsets=c=c.slice(0,f+1).concat(d,c.slice(u+1));var y=s.text.length-(a-l);if(y!==0)for(var p=f+1+d.length,g=c.length;p<g;p++)c[p]=c[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=K1(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}(),zh;(function(r){function e(i,s,o,l){return new G1(i,s,o,l)}r.create=e;function t(i,s,o){if(i instanceof G1)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(),l=Uh(s.map(CD),function(g,y){var x=g.range.start.line-y.range.start.line;return x===0?g.range.start.character-y.range.start.character:x}),a=0,f=[],u=0,c=l;u<c.length;u++){var d=c[u],p=i.offsetAt(d.range.start);if(p<a)throw new Error("Overlapping edit");p>a&&f.push(o.substring(a,p)),d.newText.length&&f.push(d.newText),a=i.offsetAt(d.range.end)}return f.push(o.substr(a)),f.join("")}r.applyEdits=n})(zh||(zh={}));function Uh(r,e){if(r.length<=1)return r;var t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Uh(n,e),Uh(i,e);for(var s=0,o=0,l=0;s<n.length&&o<i.length;){var a=e(n[s],i[o]);a<=0?r[l++]=n[s++]:r[l++]=i[o++]}for(;s<n.length;)r[l++]=n[s++];for(;o<i.length;)r[l++]=i[o++];return r}function K1(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 Y1(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 CD(r){var e=Y1(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var Ue;(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"})(Ue||(Ue={}));var _1;(function(r){r.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Yi.Markdown,Yi.PlainText],commitCharactersSupport:!0}}}}})(_1||(_1={}));var _i=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)}}(),OD={"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,}))$/}},Ji=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}(),TD=function(r){_i(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="null",i.value=null,i}return e}(Ji),J1=function(r){_i(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}(Ji),ED=function(r){_i(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}(Ji),PD=function(r){_i(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}(Ji),X1=function(r){_i(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}(Ji),ID=function(r){_i(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}(Ji),MD=function(r){_i(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}(Ji);function vr(r){return En(r)?r?{}:{not:{}}:r}var Q1;(function(r){r[r.Key=0]="Key",r[r.Enum=1]="Enum"})(Q1||(Q1={}));var DD=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||Z1(e,this.focusOffset))&&e!==this.exclude},r.prototype.newSub=function(){return new r(-1,this.exclude)},r}(),Gh=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}(),yr=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===Ue.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 ND(r,e){return e===void 0&&(e=[]),new q1(r,e,[])}function bi(r){return xD(r)}function Kh(r){return bD(r)}function Z1(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}var q1=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 yD(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 yr;return _t(this.root,t,n,Gh.instance),n.problems.map(function(i){var s=Ke.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return zn.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 DD(t,n);return this.root&&e&&_t(this.root,e,new yr,i),i.schemas},r}();function _t(r,e,t,n){if(!r||!n.include(r))return;switch(r.type){case"object":a(r,e,t,n);break;case"array":l(r,e,t,n);break;case"string":o(r,e,t,n);break;case"number":s(r,e,t,n);break;case"property":return _t(r.valueNode,e,t,n)}i(),n.add({node:r,schema:e});function i(){function f(Y){return r.type===Y||Y==="integer"&&r.type==="number"&&r.isInteger||e.nullable&&r.value===null}if(Array.isArray(e.type)?e.type.some(f)||t.problems.push({location:{offset:r.offset,length:r.length},severity:De.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(f(e.type)||t.problems.push({location:{offset:r.offset,length:r.length},severity:De.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,c=e.allOf;u<c.length;u++){var d=c[u];_t(r,vr(d),t,n)}var p=vr(e.not);if(p){var g=new yr,y=n.newSub();_t(r,p,g,y),g.hasProblems()||t.problems.push({location:{offset:r.offset,length:r.length},severity:De.Warning,message:"Matches a schema that is not allowed."});for(var x=0,k=y.schemas;x<k.length;x++){var E=k[x];E.inverted=!E.inverted,n.add(E)}}var O=function(Y,le){for(var fe=[],me=null,Te=0,ye=Y;Te<ye.length;Te++){var Ce=ye[Te],He=vr(Ce),Ae=new yr,Le=n.newSub();if(_t(r,He,Ae,Le),Ae.hasProblems()||fe.push(He),!me)me={schema:He,validationResult:Ae,matchingSchemas:Le};else if(!le&&!Ae.hasProblems()&&!me.validationResult.hasProblems())me.matchingSchemas.merge(Le),me.validationResult.propertiesMatches+=Ae.propertiesMatches,me.validationResult.propertiesValueMatches+=Ae.propertiesValueMatches;else{var Ye=Ae.compare(me.validationResult);Ye>0?me={schema:He,validationResult:Ae,matchingSchemas:Le}:Ye===0&&(me.matchingSchemas.merge(Le),me.validationResult.mergeEnumValues(Ae))}}return fe.length>1&&le&&t.problems.push({location:{offset:r.offset,length:1},severity:De.Warning,message:"Matches multiple schemas when only one must validate."}),me!==null&&(t.merge(me.validationResult),t.propertiesMatches+=me.validationResult.propertiesMatches,t.propertiesValueMatches+=me.validationResult.propertiesValueMatches,n.merge(me.matchingSchemas)),fe.length};Array.isArray(e.anyOf)&&O(e.anyOf,!1),Array.isArray(e.oneOf)&&O(e.oneOf,!0);var j=function(Y){var le=new yr,fe=n.newSub();_t(r,vr(Y),le,fe),t.merge(le),t.propertiesMatches+=le.propertiesMatches,t.propertiesValueMatches+=le.propertiesValueMatches,n.merge(fe)},M=function(Y,le,fe){var me=vr(Y),Te=new yr,ye=n.newSub();_t(r,me,Te,ye),n.merge(ye),Te.hasProblems()?fe&&j(fe):le&&j(le)},F=vr(e.if);if(F&&M(F,vr(e.then),vr(e.else)),Array.isArray(e.enum)){for(var D=bi(r),U=!1,L=0,$=e.enum;L<$.length;L++){var W=$[L];if(sl(D,W)){U=!0;break}}t.enumValues=e.enum,t.enumValueMatch=U,U||t.problems.push({location:{offset:r.offset,length:r.length},severity:De.Warning,code:Ue.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(Y){return JSON.stringify(Y)}).join(", ")+"."})}if(Hn(e.const)){var D=bi(r);sl(D,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:r.offset,length:r.length},severity:De.Warning,code:Ue.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:De.Warning,message:e.deprecationMessage})}function s(f,u,c,d){var p=f.value;Dr(u.multipleOf)&&p%u.multipleOf!==0&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function g(j,M){if(Dr(M))return M;if(En(M)&&M)return j}function y(j,M){if(!En(M)||!M)return j}var x=g(u.minimum,u.exclusiveMinimum);Dr(x)&&p<=x&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Value is below the exclusive minimum of "+x+"."});var k=g(u.maximum,u.exclusiveMaximum);Dr(k)&&p>=k&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Value is above the exclusive maximum of "+k+"."});var E=y(u.minimum,u.exclusiveMinimum);Dr(E)&&p<E&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Value is below the minimum of "+E+"."});var O=y(u.maximum,u.exclusiveMaximum);Dr(O)&&p>O&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Value is above the maximum of "+O+"."})}function o(f,u,c,d){if(Dr(u.minLength)&&f.value.length<u.minLength&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),Dr(u.maxLength)&&f.value.length>u.maxLength&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),SD(u.pattern)){var p=new RegExp(u.pattern);p.test(f.value)||c.problems.push({location:{offset:f.offset,length:f.length},severity:De.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 g=void 0;if(!f.value)g="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(f.value);y?!y[2]&&u.format==="uri"&&(g="URI with a scheme is expected."):g="URI is expected."}g&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+g})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var x=OD[u.format];(!f.value||!x.pattern.exec(f.value))&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:u.patternErrorMessage||u.errorMessage||x.errorMessage});break;default:}}function l(f,u,c,d){if(Array.isArray(u.items)){for(var p=u.items,g=0;g<p.length;g++){var y=p[g],x=vr(y),k=new yr,E=f.items[g];E?(_t(E,x,k,d),c.mergePropertyMatch(k)):f.items.length>=p.length&&c.propertiesValueMatches++}if(f.items.length>p.length)if(typeof u.additionalItems=="object")for(var O=p.length;O<f.items.length;O++){var k=new yr;_t(f.items[O],u.additionalItems,k,d),c.mergePropertyMatch(k)}else u.additionalItems===!1&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var j=vr(u.items);if(j)for(var M=0,F=f.items;M<F.length;M++){var E=F[M],k=new yr;_t(E,j,k,d),c.mergePropertyMatch(k)}}var D=vr(u.contains);if(D){var U=f.items.some(function(W){var Y=new yr;return _t(W,D,Y,Gh.instance),!Y.hasProblems()});U||c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:u.errorMessage||"Array does not contain required item."})}if(Dr(u.minItems)&&f.items.length<u.minItems&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),Dr(u.maxItems)&&f.items.length>u.maxItems&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var L=bi(f),$=L.some(function(W,Y){return Y!==L.lastIndexOf(W)});$&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Array has duplicate items."})}}function a(f,u,c,d){for(var p=Object.create(null),g=[],y=0,x=f.properties;y<x.length;y++){var k=x[y],E=k.keyNode.value;p[E]=k.valueNode,g.push(E)}if(Array.isArray(u.required))for(var O=0,j=u.required;O<j.length;O++){var M=j[O];if(!p[M]){var F=f.parent&&f.parent.type==="property"&&f.parent.keyNode,D=F?{offset:F.offset,length:F.length}:{offset:f.offset,length:1};c.problems.push({location:D,severity:De.Warning,message:'Missing property "'+M+'".'})}}var U=function(hr){for(var _s=g.indexOf(hr);_s>=0;)g.splice(_s,1),_s=g.indexOf(hr)};if(u.properties)for(var L=0,$=Object.keys(u.properties);L<$.length;L++){var M=$[L];U(M);var W=u.properties[M],Y=p[M];if(Y)if(En(W))if(W)c.propertiesMatches++,c.propertiesValueMatches++;else{var k=Y.parent;c.problems.push({location:{offset:k.keyNode.offset,length:k.keyNode.length},severity:De.Warning,message:u.errorMessage||"Property "+M+" is not allowed."})}else{var le=new yr;_t(Y,W,le,d),c.mergePropertyMatch(le)}}if(u.patternProperties)for(var fe=0,me=Object.keys(u.patternProperties);fe<me.length;fe++)for(var Te=me[fe],ye=new RegExp(Te),Ce=0,He=g.slice(0);Ce<He.length;Ce++){var M=He[Ce];if(ye.test(M)){U(M);var Y=p[M];if(Y){var W=u.patternProperties[Te];if(En(W))if(W)c.propertiesMatches++,c.propertiesValueMatches++;else{var k=Y.parent;c.problems.push({location:{offset:k.keyNode.offset,length:k.keyNode.length},severity:De.Warning,message:u.errorMessage||"Property "+M+" is not allowed."})}else{var le=new yr;_t(Y,W,le,d),c.mergePropertyMatch(le)}}}}if(typeof u.additionalProperties=="object")for(var Ae=0,Le=g;Ae<Le.length;Ae++){var M=Le[Ae],Y=p[M];if(Y){var le=new yr;_t(Y,u.additionalProperties,le,d),c.mergePropertyMatch(le)}}else if(u.additionalProperties===!1&&g.length>0)for(var Ye=0,at=g;Ye<at.length;Ye++){var M=at[Ye],Y=p[M];if(Y){var k=Y.parent;c.problems.push({location:{offset:k.keyNode.offset,length:k.keyNode.length},severity:De.Warning,message:u.errorMessage||"Property "+M+" is not allowed."})}}if(Dr(u.maxProperties)&&f.properties.length>u.maxProperties&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),Dr(u.minProperties)&&f.properties.length<u.minProperties&&c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var yt=0,Ht=Object.keys(u.dependencies);yt<Ht.length;yt++){var E=Ht[yt],bt=p[E];if(bt){var or=u.dependencies[E];if(Array.isArray(or))for(var Lr=0,wi=or;Lr<wi.length;Lr++){var Si=wi[Lr];p[Si]?c.propertiesValueMatches++:c.problems.push({location:{offset:f.offset,length:f.length},severity:De.Warning,message:"Object is missing property "+Si+" required by property {$key}."})}else{var W=vr(or);if(W){var le=new yr;_t(f,W,le,d),c.mergePropertyMatch(le)}}}}var Br=vr(u.propertyNames);if(Br)for(var In=0,Mf=f.properties;In<Mf.length;In++){var ki=Mf[In],E=ki.keyNode;E&&_t(E,Br,c,Gh.instance)}}}function RD(r,e){var t=[],n=-1,i=r.getText(),s=Ws(i,!1),o=e&&e.collectComments?[]:void 0;function l(){for(;;){var F=s.scan();switch(c(),F){case 12:case 13:Array.isArray(o)&&o.push(Ke.create(r.positionAt(s.getTokenOffset()),r.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return F}}}function a(F){return s.getToken()===F?(l(),!0):!1}function f(F,D,U,L,$){if($===void 0&&($=De.Error),t.length===0||U!==n){var W=Ke.create(r.positionAt(U),r.positionAt(L));t.push(zn.create(W,F,$,D,r.languageId)),n=U}}function u(F,D,U,L,$){U===void 0&&(U=null),L===void 0&&(L=[]),$===void 0&&($=[]);var W=s.getTokenOffset(),Y=s.getTokenOffset()+s.getTokenLength();if(W===Y&&W>0){for(W--;W>0&&/\s/.test(i.charAt(W));)W--;Y=W+1}if(f(F,D,W,Y),U&&d(U,!1),L.length+$.length>0)for(var le=s.getToken();le!==17;){if(L.indexOf(le)!==-1){l();break}else if($.indexOf(le)!==-1)break;le=l()}return U}function c(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",Ue.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",Ue.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",Ue.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",Ue.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",Ue.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",Ue.InvalidCharacter),!0}return!1}function d(F,D){return F.length=s.getTokenOffset()+s.getTokenLength()-F.offset,D&&l(),F}function p(F){if(s.getToken()!==3)return null;var D=new ED(F,s.getTokenOffset());l();for(var U=0,L=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){L||u("Value expected",Ue.ValueExpected);var $=s.getTokenOffset();if(l(),s.getToken()===4){L&&f("Trailing comma",Ue.TrailingComma,$,$+1);continue}}else L&&u("Expected comma",Ue.CommaExpected);var W=O(D,U++);W?D.items.push(W):u("Value expected",Ue.ValueExpected,null,[],[4,5]),L=!0}return s.getToken()!==4?u("Expected comma or closing bracket",Ue.CommaOrCloseBacketExpected,D):d(D,!0)}function g(F,D){var U=new ID(F,s.getTokenOffset()),L=x(U);if(!L)if(s.getToken()===16){u("Property keys must be doublequoted",Ue.Undefined);var $=new X1(U,s.getTokenOffset(),s.getTokenLength());$.value=s.getTokenValue(),L=$,l()}else return null;U.keyNode=L;var W=D[L.value];if(W?(f("Duplicate object key",Ue.DuplicateKey,U.keyNode.offset,U.keyNode.offset+U.keyNode.length,De.Warning),typeof W=="object"&&f("DuplicateKeyWarning",Ue.DuplicateKey,W.keyNode.offset,W.keyNode.offset+W.keyNode.length,De.Warning),D[L.value]=!0):D[L.value]=U,s.getToken()===6)U.colonOffset=s.getTokenOffset(),l();else if(u("Colon expected",Ue.ColonExpected),s.getToken()===10&&r.positionAt(L.offset+L.length).line<r.positionAt(s.getTokenOffset()).line)return U.length=L.length,U;var Y=O(U,L.value);return Y?(U.valueNode=Y,U.length=Y.offset+Y.length-U.offset,U):u("Value expected",Ue.ValueExpected,U,[],[2,5])}function y(F){if(s.getToken()!==1)return null;var D=new MD(F,s.getTokenOffset()),U=Object.create(null);l();for(var L=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){L||u("Property expected",Ue.PropertyExpected);var $=s.getTokenOffset();if(l(),s.getToken()===2){L&&f("Trailing comma",Ue.TrailingComma,$,$+1);continue}}else L&&u("Expected comma",Ue.CommaExpected);var W=g(D,U);W?D.properties.push(W):u("Property expected",Ue.PropertyExpected,null,[],[2,5]),L=!0}return s.getToken()!==2?u("Expected comma or closing brace",Ue.CommaOrCloseBraceExpected,D):d(D,!0)}function x(F){if(s.getToken()!==10)return null;var D=new X1(F,s.getTokenOffset());return D.value=s.getTokenValue(),d(D,!0)}function k(F){if(s.getToken()!==11)return null;var D=new PD(F,s.getTokenOffset());if(s.getTokenError()===0){var U=s.getTokenValue();try{var L=JSON.parse(U);if(!Dr(L))return u("Invalid number format.",Ue.Undefined,D);D.value=L}catch{return u("Invalid number format.",Ue.Undefined,D)}D.isInteger=U.indexOf(".")===-1}return d(D,!0)}function E(F){var D;switch(s.getToken()){case 7:return d(new TD(F,s.getTokenOffset()),!0);case 8:return d(new J1(F,!0,s.getTokenOffset()),!0);case 9:return d(new J1(F,!1,s.getTokenOffset()),!0);default:return null}}function O(F,D){return p(F)||y(F)||x(F)||k(F)||E(F)}var j=null,M=l();return M!==17&&(j=O(null,null),j?s.getToken()!==17&&u("End of file expected.",Ue.Undefined):u("Expected a JSON object, array or literal.",Ue.Undefined)),new q1(j,t,o)}function Yh(r,e,t){if(r!==null&&typeof r=="object"){var n=e+" ";if(Array.isArray(r)){if(r.length===0)return"[]";for(var i=`[
|
|
218
|
+
`,s=0;s<r.length;s++)i+=n+Yh(r[s],n,t),s<r.length-1&&(i+=","),i+=`
|
|
217
219
|
`;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
|
|
219
|
-
`}return i+=e+"}",i}}return t(r)}function
|
|
220
|
-
`,
|
|
221
|
-
`+
|
|
220
|
+
`,s=0;s<o.length;s++){var l=o[s];i+=n+JSON.stringify(l)+": "+Yh(r[l],n,t),s<o.length-1&&(i+=","),i+=`
|
|
221
|
+
`}return i+=e+"}",i}}return t(r)}function LD(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 _h(r,e){var t=r.length-e.length;return t>0?r.lastIndexOf(e)===t:t===0?r===e:!1}function BD(r){return r.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function aL(r,e){for(var t="";e>0;)(e&1)===1&&(t+=r),r+=r,e=e>>>1;return t}var FD=[",","}","]"],jD=[":"],VD=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(),l=e.offsetAt(t),a=n.getNodeFromOffset(l,!0);if(this.isInComment(e,a?a.offset:0,l))return Promise.resolve(s);if(a&&l===a.offset+a.length&&l>0){var f=o[l-1];(a.type==="object"&&f==="}"||a.type==="array"&&f==="]")&&(a=a.parent)}var u=this.getCurrentWord(e,l),c=null;if(a&&(a.type==="string"||a.type==="number"||a.type==="boolean"||a.type==="null"))c=Ke.create(e.positionAt(a.offset),e.positionAt(a.offset+a.length));else{var d=l-u.length;d>0&&o[d-1]==='"'&&d--,c=Ke.create(e.positionAt(d),t)}var p=this.doesSupportsCommitCharacters(),g={},y={add:function(x){var k=g[x.label];k?k.documentation||(k.documentation=x.documentation):(g[x.label]=x,c&&(x.textEdit=Jr.replace(c,x.insertText)),p&&(x.commitCharacters=x.kind===Nr.Property?jD:FD),s.items.push(x))},setAsIncomplete:function(){s.isIncomplete=!0},error:function(x){console.error(x)},log:function(x){console.log(x)},getNumberOfProposals:function(){return s.items.length}};return this.schemaService.getSchemaForResource(e.uri,n).then(function(x){var k=[],E=!0,O="",j=null;if(a&&a.type==="string"){var M=a.parent;M&&M.type==="property"&&M.keyNode===a&&(E=!M.valueNode,j=M,O=o.substr(a.offset+1,a.length-2),M&&(a=M.parent))}if(a&&a.type==="object"){if(a.offset===l)return s;var F=a.properties;F.forEach(function($){(!j||j!==$)&&(g[$.keyNode.value]=Wh.create("__"))});var D="";E&&(D=i.evaluateSeparatorAfter(e,e.offsetAt(c.end))),x?i.getPropertyCompletions(x,n,a,E,D,y):i.getSchemaLessPropertyCompletions(n,a,O,y);var U=Kh(a);i.contributions.forEach(function($){var W=$.collectPropertyCompletions(e.uri,U,u,E,D==="",y);W&&k.push(W)}),!x&&u.length>0&&o.charAt(l-u.length-1)!=='"'&&(y.add({kind:Nr.Property,label:i.getLabelForValue(u),insertText:i.getInsertTextForProperty(u,null,!1,D),insertTextFormat:jt.Snippet,documentation:""}),y.setAsIncomplete())}var L={};return x?i.getValueCompletions(x,n,a,l,e,y,L):i.getSchemaLessValueCompletions(n,a,l,e,y),i.contributions.length>0&&i.getContributedValueCompletions(n,a,l,e,y,k),i.promiseConstructor.all(k).then(function(){if(y.getNumberOfProposals()===0){var $=l;a&&(a.type==="string"||a.type==="number"||a.type==="boolean"||a.type==="null")&&($=a.offset+a.length);var W=i.evaluateSeparatorAfter(e,$);i.addFillerValueCompletions(L,W,y)}return s})})},r.prototype.getPropertyCompletions=function(e,t,n,i,s,o){var l=this,a=t.getMatchingSchemas(e.schema,n.offset);a.forEach(function(f){if(f.node===n&&!f.inverted){var u=f.schema.properties;u&&Object.keys(u).forEach(function(c){var d=u[c],p=!1;if(typeof d=="object"&&d.allOf)for(var g=0,y=d.allOf;g<y.length;g++){var x=y[g];if(x.readOnly){p=!0;break}}if(typeof d=="object"&&!d.deprecationMessage&&!d.doNotSuggest&&!p){var k={kind:Nr.Property,label:l.sanitizeLabel(c),insertText:l.getInsertTextForProperty(c,d,i,s),insertTextFormat:jt.Snippet,filterText:l.getFilterTextForValue(c),documentation:l.fromMarkup(d.markdownDescription)||d.description||""};_h(k.insertText,"$1"+s)&&(k.command={title:"Suggest",command:"editor.action.triggerSuggest"}),o.add(k)}})}})},r.prototype.getSchemaLessPropertyCompletions=function(e,t,n,i){var s=this,o=function(a){a.properties.forEach(function(f){var u=f.keyNode.value;i.add({kind:Nr.Property,label:s.sanitizeLabel(u),insertText:s.getInsertTextForValue(u,""),insertTextFormat:jt.Snippet,filterText:s.getFilterTextForValue(u),documentation:""})})};if(t.parent)if(t.parent.type==="property"){var l=t.parent.keyNode.value;e.visit(function(a){return a.type==="property"&&a!==t.parent&&a.keyNode.value===l&&a.valueNode&&a.valueNode.type==="object"&&o(a.valueNode),!0})}else t.parent.type==="array"&&t.parent.items.forEach(function(a){a.type==="object"&&a!==t&&o(a)});else t.type==="object"&&i.add({kind:Nr.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",null,!0,""),insertTextFormat:jt.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})},r.prototype.getSchemaLessValueCompletions=function(e,t,n,i,s){var o=this,l=n;if(t&&(t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(l=t.offset+t.length,t=t.parent),!t){s.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:jt.Snippet,documentation:""}),s.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:jt.Snippet,documentation:""});return}var a=this.evaluateSeparatorAfter(i,l),f=function(p){Z1(p.parent,n,!0)||s.add({kind:o.getSuggestionKind(p.type),label:o.getLabelTextForMatchingNode(p,i),insertText:o.getInsertTextForMatchingNode(p,i,a),insertTextFormat:jt.Snippet,documentation:""}),p.type==="boolean"&&o.addBooleanValueCompletion(!p.value,a,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 c=t.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===c&&p.valueNode&&f(p.valueNode),!0}),c==="$schema"&&t.parent&&!t.parent.parent&&this.addDollarSchemaCompletions(a,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(f),!0})}else t.items.forEach(f)},r.prototype.getValueCompletions=function(e,t,n,i,s,o,l){var a=this,f=i,u=null,c=null;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(f=n.offset+n.length,c=n,n=n.parent),!n){this.addSchemaValueCompletions(e.schema,"",o,l);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,f),g=t.getMatchingSchemas(e.schema,n.offset,c);g.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 x=a.findItemAtOffset(n,s,i);x<y.schema.items.length&&a.addSchemaValueCompletions(y.schema.items[x],p,o,l)}else a.addSchemaValueCompletions(y.schema.items,p,o,l);if(y.schema.properties){var k=y.schema.properties[u];k&&a.addSchemaValueCompletions(k,p,o,l)}}}),u==="$schema"&&!n.parent&&this.addDollarSchemaCompletions(p,o),l.boolean&&(this.addBooleanValueCompletion(!0,p,o),this.addBooleanValueCompletion(!1,p,o)),l.null&&this.addNullValueCompletion(p,o)}},r.prototype.getContributedValueCompletions=function(e,t,n,i,s,o){if(!t)this.contributions.forEach(function(u){var c=u.collectDefaultCompletions(i.uri,s);c&&o.push(c)});else if((t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(t=t.parent),t.type==="property"&&n>t.colonOffset){var l=t.keyNode.value,a=t.valueNode;if(!a||n<=a.offset+a.length){var f=Kh(t.parent);this.contributions.forEach(function(u){var c=u.collectValueCompletions(i.uri,f,l,s);c&&o.push(c)})}}},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(Hn(e.default)){for(var l=e.type,a=e.default,f=i;f>0;f--)a=[a],l="array";n.add({kind:this.getSuggestionKind(l),label:this.getLabelForValue(a),insertText:this.getInsertTextForValue(a,t),insertTextFormat:jt.Snippet}),o=!0}Array.isArray(e.examples)&&e.examples.forEach(function(u){for(var c=e.type,d=u,p=i;p>0;p--)d=[d],c="array";n.add({kind:s.getSuggestionKind(c),label:s.getLabelForValue(d),insertText:s.getInsertTextForValue(d,t),insertTextFormat:jt.Snippet}),o=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(function(u){var c=e.type,d=u.body,p=u.label,g,y;if(Hn(d)){for(var x=e.type,k=i;k>0;k--)d=[d],x="array";g=s.getInsertTextForSnippetValue(d,t),y=s.getFilterTextForSnippetValue(d),p=p||s.getLabelForSnippetValue(d)}else if(typeof u.bodyText=="string"){for(var E="",O="",j="",k=i;k>0;k--)E=E+j+`[
|
|
222
|
+
`,O=O+`
|
|
223
|
+
`+j+"]",j+=" ",c="array";g=E+j+u.bodyText.split(`
|
|
222
224
|
`).join(`
|
|
223
|
-
`+
|
|
224
|
-
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,t)},r.prototype.evaluateSeparatorAfter=function(e,t){var n=
|
|
225
|
+
`+j)+O+t,p=p||s.sanitizeLabel(g),y=g.replace(/[\n]/g,"")}n.add({kind:s.getSuggestionKind(c),label:p,documentation:s.fromMarkup(u.markdownDescription)||u.description,insertText:g,insertTextFormat:jt.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(Hn(e.const)&&n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,t),insertTextFormat:jt.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],l=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&i<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?l=this.fromMarkup(e.markdownEnumDescriptions[i]):e.enumDescriptions&&i<e.enumDescriptions.length&&(l=e.enumDescriptions[i]),n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(o),insertText:this.getInsertTextForValue(o,t),insertTextFormat:jt.Snippet,documentation:l})}},r.prototype.collectTypes=function(e,t){if(!(Array.isArray(e.enum)||Hn(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:jt.Snippet,detail:"New object",documentation:""}),e.array&&n.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],t),insertTextFormat:jt.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:jt.Snippet,documentation:""})},r.prototype.addNullValueCompletion=function(e,t){t.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:jt.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:Nr.Module,label:n.getLabelForValue(s),filterText:n.getFilterTextForValue(s),insertText:n.getInsertTextForValue(s,e),insertTextFormat:jt.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 Yh(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 Nr.Value;switch(e){case"string":return Nr.Value;case"object":return Nr.Module;case"property":return Nr.Property;default:return Nr.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+": ",l,a=0;if(t){if(Array.isArray(t.defaultSnippets)){if(t.defaultSnippets.length===1){var f=t.defaultSnippets[0].body;Hn(f)&&(l=this.getInsertTextForSnippetValue(f,""))}a+=t.defaultSnippets.length}if(t.enum&&(!l&&t.enum.length===1&&(l=this.getInsertTextForGuessedValue(t.enum[0],"")),a+=t.enum.length),Hn(t.default)&&(l||(l=this.getInsertTextForGuessedValue(t.default,"")),a++),a===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":l="$1";break;case"string":l='"$1"';break;case"object":l="{$1}";break;case"array":l="[$1]";break;case"number":case"integer":l="${1:0}";break;case"null":l="${1:null}";break;default:return s}}}return(!l||a>1)&&(l="$1"),o+l+i},r.prototype.getCurrentWord=function(e,t){for(var n=t-1,i=e.getText();n>=0&&`
|
|
226
|
+
\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 l=s[o];if(n>l.offset+l.length){i.setPosition(l.offset+l.length);var a=i.scan();return a===5&&n>=i.getTokenOffset()+i.getTokenLength()?o+1:o}else if(n>=l.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:Yi.Markdown,value:e}},r.prototype.doesSupportMarkdown=function(){if(!Hn(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(Yi.Markdown)!==-1}return this.supportsMarkdown},r.prototype.doesSupportsCommitCharacters=function(){if(!Hn(this.supportsCommitCharacters)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=e&&e.completionItem&&!!e.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},r}(),WD=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 l=s.parent;if(l&&l.type==="property"&&l.keyNode===s&&(s=l.valueNode,!s))return this.promise.resolve(null)}for(var a=Ke.create(e.positionAt(o.offset),e.positionAt(o.offset+o.length)),f=function(g){var y={contents:g,range:a};return y},u=Kh(s),c=this.contributions.length-1;c>=0;c--){var d=this.contributions[c],p=d.getInfoContribution(e.uri,u);if(p)return p.then(function(g){return f(g)})}return this.schemaService.getSchemaForResource(e.uri,n).then(function(g){if(g){var y=n.getMatchingSchemas(g.schema,s.offset),x=null,k=null,E=null,O=null;y.every(function(M){if(M.node===s&&!M.inverted&&M.schema&&(x=x||M.schema.title,k=k||M.schema.markdownDescription||Jh(M.schema.description),M.schema.enum)){var F=M.schema.enum.indexOf(bi(s));M.schema.markdownEnumDescriptions?E=M.schema.markdownEnumDescriptions[F]:M.schema.enumDescriptions&&(E=Jh(M.schema.enumDescriptions[F])),E&&(O=M.schema.enum[F],typeof O!="string"&&(O=JSON.stringify(O)))}return!0});var j="";return x&&(j=Jh(x)),k&&(j.length>0&&(j+=`
|
|
225
227
|
|
|
226
|
-
`),
|
|
228
|
+
`),j+=k),E&&(j.length>0&&(j+=`
|
|
227
229
|
|
|
228
|
-
`),
|
|
230
|
+
`),j+="`"+$D(O)+"`: "+E),f([j])}return null})},r}();function Jh(r){if(r){var e=r.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
|
|
229
231
|
|
|
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
|
|
232
|
+
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function $D(r){return r.indexOf("`")!==-1?"`` "+r+" ``":r}var HD=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)}}(),Ct,cl;if(typeof process=="object")cl=!1;else if(typeof navigator=="object"){var zD=navigator.userAgent;cl=zD.indexOf("Windows")>=0}function fL(r){return 55296<=r&&r<=56319}function uL(r){return 56320<=r&&r<=57343}function cL(r){return r>=97&&r<=102}function UD(r){return r>=97&&r<=122}function GD(r){return r>=65&&r<=90}function hL(r){return UD(r)||GD(r)}var KD=/^\w[\w\d+.-]*$/,YD=/^\//,_D=/^\/\//;function JD(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&&!KD.test(r.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(r.path){if(r.authority){if(!YD.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(_D.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 XD(r,e){return!r&&!e?"file":r}function QD(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==rn&&(e=rn+e):e=rn;break}return e}var it="",rn="/",ZD=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Xh=function(){function r(e,t,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||it,this.authority=e.authority||it,this.path=e.path||it,this.query=e.query||it,this.fragment=e.fragment||it):(this.scheme=XD(e,o),this.authority=t||it,this.path=QD(this.scheme,n||it),this.query=i||it,this.fragment=s||it,JD(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 nx(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=it),n===void 0?n=this.authority:n===null&&(n=it),i===void 0?i=this.path:i===null&&(i=it),s===void 0?s=this.query:s===null&&(s=it),o===void 0?o=this.fragment:o===null&&(o=it),t===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new Us(t,n,i,s,o)},r.parse=function(e,t){t===void 0&&(t=!1);var n=ZD.exec(e);return n?new Us(n[2]||it,Of(n[4]||it),Of(n[5]||it),Of(n[7]||it),Of(n[9]||it),t):new Us(it,it,it,it,it)},r.file=function(e){var t=it;if(cl&&(e=e.replace(/\\/g,rn)),e[0]===rn&&e[1]===rn){var n=e.indexOf(rn,2);n===-1?(t=e.substring(2),e=rn):(t=e.substring(2,n),e=e.substring(n)||rn)}return new Us("file",t,e,it,it)},r.from=function(e){return new Us(e.scheme,e.authority,e.path,e.query,e.fragment)},r.prototype.toString=function(e){return e===void 0&&(e=!1),Qh(this,e)},r.prototype.toJSON=function(){return this},r.revive=function(e){if(e){if(e instanceof r)return e;var t=new Us(e);return t._formatted=e.external,t._fsPath=e._sep===ex?e.fsPath:null,t}else return e},r}(),ex=cl?1:void 0,Us=function(r){HD(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=nx(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){return t===void 0&&(t=!1),t?Qh(this,!0):(this._formatted||(this._formatted=Qh(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=ex),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}(Xh),tx=(Ct={},Ct[58]="%3A",Ct[47]="%2F",Ct[63]="%3F",Ct[35]="%23",Ct[91]="%5B",Ct[93]="%5D",Ct[64]="%40",Ct[33]="%21",Ct[36]="%24",Ct[38]="%26",Ct[39]="%27",Ct[40]="%28",Ct[41]="%29",Ct[42]="%2A",Ct[43]="%2B",Ct[44]="%2C",Ct[59]="%3B",Ct[61]="%3D",Ct[32]="%20",Ct);function rx(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=tx[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 qD(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+=tx[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function nx(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,cl&&(t=t.replace(/\//g,"\\")),t}function Qh(r,e){var t=e?qD:rx,n="",i=r.scheme,s=r.authority,o=r.path,l=r.query,a=r.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=rn,n+=rn),s){var f=s.indexOf("@");if(f!==-1){var u=s.substr(0,f);s=s.substr(f+1),f=u.indexOf(":"),f===-1?n+=t(u,!1):(n+=t(u.substr(0,f),!1),n+=":",n+=t(u.substr(f+1),!1)),n+="@"}s=s.toLowerCase(),f=s.indexOf(":"),f===-1?n+=t(s,!1):(n+=t(s.substr(0,f),!1),n+=s.substr(f))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var c=o.charCodeAt(1);c>=65&&c<=90&&(o="/"+String.fromCharCode(c+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var c=o.charCodeAt(0);c>=65&&c<=90&&(o=String.fromCharCode(c+32)+":"+o.substr(2))}n+=t(o,!0)}return l&&(n+="?",n+=t(l,!1)),a&&(n+="#",n+=e?a:rx(a,!1)),n}function ix(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+ix(r.substr(3)):r}}var sx=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Of(r){return r.match(sx)?r.replace(sx,function(e){return ix(e)}):r}var eN=function(){function r(e){try{this.patternRegExp=new RegExp(BD(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}(),tN=function(){function r(e,t,n){this.service=e,this.url=t,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new Gs(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}(),Gs=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r}(),ox=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r.prototype.getSection=function(e){return vr(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],l=new RegExp(o);if(l.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 a=parseInt(n,10);if(!isNaN(a)&&t.items[a])return this.getSectionRecursive(e,t.items[a])}else if(t.items)return this.getSectionRecursive(e,t.items)}}return null},r}(),rN=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=Xh.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(f){return t.schemasById[f]});i.length;)for(var o=i.pop(),l=0;l<s.length;l++){var a=s[l];a&&(a.url===o||a.dependencies[o])&&(a.url!==o&&i.push(a.url),a.clearSchema(),s[l]=void 0,n=!0)}return n},r.prototype.normalizeId=function(e){try{return Xh.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 l=s[o];this.contributionAssociations[o]=l;for(var a=this.getOrAddFilePatternAssociation(o),f=0,u=l;f<u.length;f++){var c=u[f],n=this.normalizeId(c);a.addSchema(n)}}}},r.prototype.addSchemaHandle=function(e,t){var n=new tN(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 eN(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 l=o[s];this.getOrAddFilePatternAssociation(l).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 '"+Tf(e)+"'. No schema request service available";return this.promise.resolve(new Gs({},[t]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+Tf(e)+"': No content.";return new Gs({},[i])}var s={},o=[];s=vD(n,o);var l=o.length?["Unable to parse content from '"+Tf(e)+"': Parse error at offset "+o[0].offset]:[];return new Gs(s,l)},function(n){var i="Unable to load schema from '"+Tf(e)+"': "+n.toString();return new Gs({},[i])})},r.prototype.resolveSchemaContent=function(e,t,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var l=this.normalizeId(o.$schema);if(l==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new ox({},["Draft-03 schemas are not supported."]));l==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var a=this.contextService,f=function(p,g){if(!g)return p;var y=p;return g[0]==="/"&&(g=g.substr(1)),g.split("/").some(function(x){return y=y[x],!y}),y},u=function(p,g,y,x){var k=f(g,x);if(k)for(var E in k)k.hasOwnProperty(E)&&!p.hasOwnProperty(E)&&(p[E]=k[E]);else s.push("$ref '"+x+"' in '"+y+"' can not be resolved.")},c=function(p,g,y,x,k){a&&!/^\w+:\/\/.*/.test(g)&&(g=a.resolveRelativePath(g,x)),g=i.normalizeId(g);var E=i.getOrAddSchemaHandle(g);return E.getUnresolvedSchema().then(function(O){if(k[g]=!0,O.errors.length){var j=y?g+"#"+y:g;s.push("Problems loading reference '"+j+"': "+O.errors[0]+".")}return u(p,O.schema,g,y),d(p,O.schema,g,E.dependencies)})},d=function(p,g,y,x){if(!p||typeof p!="object")return Promise.resolve(null);for(var k=[p],E=[],O=[],j=function(){for(var L=[],$=0;$<arguments.length;$++)L[$]=arguments[$];for(var W=0,Y=L;W<Y.length;W++){var le=Y[W];typeof le=="object"&&k.push(le)}},M=function(){for(var L=[],$=0;$<arguments.length;$++)L[$]=arguments[$];for(var W=0,Y=L;W<Y.length;W++){var le=Y[W];if(typeof le=="object")for(var fe in le){var me=le[fe];typeof me=="object"&&k.push(me)}}},F=function(){for(var L=[],$=0;$<arguments.length;$++)L[$]=arguments[$];for(var W=0,Y=L;W<Y.length;W++){var le=Y[W];if(Array.isArray(le))for(var fe=0,me=le;fe<me.length;fe++){var Te=me[fe];typeof Te=="object"&&k.push(Te)}}},D=function(L){for(var $=[];L.$ref;){var W=L.$ref,Y=W.split("#",2);if(delete L.$ref,Y[0].length>0){O.push(c(L,Y[0],Y[1],y,x));return}else $.indexOf(W)===-1&&(u(L,g,y,Y[1]),$.push(W))}j(L.items,L.additionalProperties,L.not,L.contains,L.propertyNames,L.if,L.then,L.else),M(L.definitions,L.properties,L.patternProperties,L.dependencies),F(L.anyOf,L.allOf,L.oneOf,L.items)};k.length;){var U=k.pop();E.indexOf(U)>=0||(E.push(U),D(U))}return i.promise.all(O)};return d(o,o,t,n).then(function(p){return new ox(o,s)})},r.prototype.getSchemaForResource=function(e,t){if(t&&t.root&&t.root.type==="object"){var n=t.root.properties.filter(function(g){return g.keyNode.value==="$schema"&&g.valueNode&&g.valueNode.type==="string"});if(n.length>0){var i=bi(n[0].valueNode);if(i&&LD(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),l=[],a=0,f=this.filePatternAssociations;a<f.length;a++){var u=f[a];if(u.matchesPattern(e))for(var c=0,d=u.getSchemas();c<d.length;c++){var p=d[c];o[p]||(l.push(p),o[p]=!0)}}return l.length>0?this.createCombinedSchema(e,l).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 Tf(r){try{}catch{}return r}var nN=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:De.Error)},r.prototype.doValidation=function(e,t,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],l={},a=function(c){var d=c.range.start.line+" "+c.range.start.character+" "+c.message;l[d]||(l[d]=!0,o.push(c))},f=function(c){var d=n?fx(n.trailingCommas):De.Error,p=n?fx(n.comments):s.commentSeverity;if(c){if(c.errors.length&&t.root){var g=t.root,y=g.type==="object"?g.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var x=y.valueNode||y,k=Ke.create(e.positionAt(x.offset),e.positionAt(x.offset+x.length));a(zn.create(k,c.errors[0],De.Warning,Ue.SchemaResolveError))}else{var k=Ke.create(e.positionAt(g.offset),e.positionAt(g.offset+1));a(zn.create(k,c.errors[0],De.Warning,Ue.SchemaResolveError))}}else{var E=t.validate(e,c.schema);E&&E.forEach(a)}lx(c.schema)&&(p=void 0),ax(c.schema)&&(d=void 0)}for(var O=0,j=t.syntaxErrors;O<j.length;O++){var M=j[O];if(M.code===Ue.TrailingComma){if(typeof d!="number")continue;M.severity=d}a(M)}if(typeof p=="number"){var F="Comments are not permitted in JSON.";t.comments.forEach(function(D){a(zn.create(D,F,p,Ue.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+iN++;return this.jsonSchemaService.resolveSchemaContent(new Gs(i),u,{}).then(function(c){return f(c)})}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(function(c){return f(c)})},r}(),iN=0;function lx(r){if(r&&typeof r=="object"){if(En(r.allowComments))return r.allowComments;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=lx(n);if(En(i))return i}}}function ax(r){if(r&&typeof r=="object"){if(En(r.allowTrailingCommas))return r.allowTrailingCommas;if(En(r.allowsTrailingCommas))return r.allowsTrailingCommas;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=ax(n);if(En(i))return i}}}function fx(r){switch(r){case"error":return De.Error;case"warning":return De.Warning;case"ignore":return}}var ux=48,sN=57,oN=65,Ef=97,lN=102;function Ot(r){return r<ux?0:r<=sN?r-ux:(r<Ef&&(r+=Ef-oN),r>=Ef&&r<=lN?r-Ef+10:0)}function aN(r){if(r[0]!=="#")return null;switch(r.length){case 4:return{red:Ot(r.charCodeAt(1))*17/255,green:Ot(r.charCodeAt(2))*17/255,blue:Ot(r.charCodeAt(3))*17/255,alpha:1};case 5:return{red:Ot(r.charCodeAt(1))*17/255,green:Ot(r.charCodeAt(2))*17/255,blue:Ot(r.charCodeAt(3))*17/255,alpha:Ot(r.charCodeAt(4))*17/255};case 7:return{red:(Ot(r.charCodeAt(1))*16+Ot(r.charCodeAt(2)))/255,green:(Ot(r.charCodeAt(3))*16+Ot(r.charCodeAt(4)))/255,blue:(Ot(r.charCodeAt(5))*16+Ot(r.charCodeAt(6)))/255,alpha:1};case 9:return{red:(Ot(r.charCodeAt(1))*16+Ot(r.charCodeAt(2)))/255,green:(Ot(r.charCodeAt(3))*16+Ot(r.charCodeAt(4)))/255,blue:(Ot(r.charCodeAt(5))*16+Ot(r.charCodeAt(6)))/255,alpha:(Ot(r.charCodeAt(7))*16+Ot(r.charCodeAt(8)))/255}}return null}function dL(r,e,t,n){return n===void 0&&(n=1),{red:r/255,green:e/255,blue:t/255,alpha:n}}var fN=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,l=e.uri;if((l==="vscode://defaultsettings/keybindings.json"||_h(l.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var a=[],f=0,u=s.items;f<u.length;f++){var c=u[f];if(c.type==="object")for(var d=0,p=c.properties;d<p.length;d++){var g=p[d];if(g.keyNode.value==="key"&&g.valueNode){var y=$s.create(e.uri,xi(e,c));if(a.push({name:bi(g.valueNode),kind:Pn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(l),a}}}return a}var x=function(E,O,j){return o>=0&&(O.type==="array"?O.items.forEach(function(M){return x(E,M,j)}):O.type==="object"&&O.properties.forEach(function(M){if(o>=0){var F=M.valueNode;if(F){o--;var D=$s.create(e.uri,xi(e,M)),U=j?j+"."+M.keyNode.value:M.keyNode.value;E.push({name:i.getKeyLabel(M),kind:i.getSymbolKind(F.type),location:D,containerName:j}),x(E,F,U)}}})),E},k=x([],s,void 0);return o<0&&(k.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(l)),k},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,l=e.uri;if((l==="vscode://defaultsettings/keybindings.json"||_h(l.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var a=[],f=0,u=s.items;f<u.length;f++){var c=u[f];if(c.type==="object")for(var d=0,p=c.properties;d<p.length;d++){var g=p[d];if(g.keyNode.value==="key"&&g.valueNode){var y=xi(e,c),x=xi(e,g.keyNode);if(a.push({name:bi(g.valueNode),kind:Pn.Function,range:y,selectionRange:x}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(l),a}}}return a}var k=function(O,j){return o>=0&&(j.type==="array"?j.items.forEach(function(M,F){if(M&&o>=0){o--;var D=xi(e,M),U=D,L=String(F),$=k([],M);O.push({name:L,kind:i.getSymbolKind(M.type),range:D,selectionRange:U,children:$})}}):j.type==="object"&&j.properties.forEach(function(M){var F=M.valueNode;if(F&&o>=0){o--;var D=xi(e,M),U=xi(e,M.keyNode),L=k([],F);O.push({name:i.getKeyLabel(M),kind:i.getSymbolKind(F.type),range:D,selectionRange:U,children:L})}})),O},E=k([],s);return o<0&&(E.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(l)),E},r.prototype.getSymbolKind=function(e){switch(e){case"object":return Pn.Module;case"string":return Pn.String;case"number":return Pn.Number;case"array":return Pn.Array;case"boolean":return Pn.Boolean;default:return Pn.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,l=t.getMatchingSchemas(i.schema),a={},f=0,u=l;f<u.length;f++){var c=u[f];if(!c.inverted&&c.schema&&(c.schema.format==="color"||c.schema.format==="color-hex")&&c.node&&c.node.type==="string"){var d=String(c.node.offset);if(!a[d]){var p=aN(bi(c.node));if(p){var g=xi(e,c.node);s.push({color:p,range:g})}if(a[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),l=Math.round(n.green*255),a=Math.round(n.blue*255);function f(c){var d=c.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+f(o)+f(l)+f(a):u="#"+f(o)+f(l)+f(a)+f(Math.round(n.alpha*255)),s.push({label:u,textEdit:Jr.replace(i,JSON.stringify(u))}),s},r}();function xi(r,e){return Ke.create(r.positionAt(e.offset),r.positionAt(e.offset+e.length))}var uN={schemaAssociations:{},schemas:{}};function cN(r,e){var t=[],n=[],i=[],s=-1,o=Ws(r.getText(),!1),l=o.scan();function a($){t.push($),n.push(i.length)}for(;l!==17;){switch(l){case 1:case 3:{var f=r.positionAt(o.getTokenOffset()).line,u={startLine:f,endLine:f,kind:l===1?"object":"array"};i.push(u);break}case 2:case 4:{var c=l===2?"object":"array";if(i.length>0&&i[i.length-1].kind===c){var u=i.pop(),d=r.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,a(u),s=u.startLine)}break}case 13:{var f=r.positionAt(o.getTokenOffset()).line,p=r.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&f+1<r.lineCount?o.setPosition(r.offsetAt(_r.create(f+1,0))):f<p&&(a({startLine:f,endLine:p,kind:ol.Comment}),s=f);break}case 12:{var g=r.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=g.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:ol.Region};i.push(u)}else{for(var x=i.length-1;x>=0&&i[x].kind!==ol.Region;)x--;if(x>=0){var u=i[x];i.length=x,d>u.startLine&&s!==u.startLine&&(u.endLine=d,a(u),s=u.startLine)}}}break}}l=o.scan()}var k=e&&e.rangeLimit;if(typeof k!="number"||t.length<=k)return t;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(r.uri);for(var E=[],O=0,j=n;O<j.length;O++){var M=j[O];M<30&&(E[M]=(E[M]||0)+1)}for(var F=0,D=0,x=0;x<E.length;x++){var U=E[x];if(U){if(U+F>k){D=x;break}F+=U}}for(var L=[],x=0;x<t.length;x++){var M=n[x];typeof M=="number"&&(M<D||M===D&&F++<k)&&L.push(t[x])}return L}function hN(r,e,t){function n(l){for(var a=r.offsetAt(l),f=t.getNodeFromOffset(a,!0),u=[];f;){switch(f.type){case"string":case"object":case"array":var c=f.offset+1,d=f.offset+f.length-1;c<d&&a>=c&&a<=d&&u.push(i(c,d)),u.push(i(f.offset,f.offset+f.length));break;case"number":case"boolean":case"null":case"property":u.push(i(f.offset,f.offset+f.length));break}if(f.type==="property"||f.parent&&f.parent.type==="array"){var p=o(f.offset+f.length,5);p!==-1&&u.push(i(f.offset,p))}f=f.parent}for(var g=void 0,y=u.length-1;y>=0;y--)g=Cf.create(u[y],g);return g||(g=Cf.create(Ke.create(l,l))),g}function i(l,a){return Ke.create(r.positionAt(l),r.positionAt(a))}var s=Ws(r.getText(),!0);function o(l,a){s.setPosition(l);var f=s.scan();return f===a?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function dN(r){var e=r.promiseConstructor||Promise,t=new rN(r.schemaRequestService,r.workspaceContext,e);t.setSchemaContributions(uN);var n=new VD(t,r.contributions,e,r.clientCapabilities),i=new WD(t,r.contributions,e),s=new fN(t),o=new nN(t,e);return{configure:function(l){t.clearExternalSchemas(),l.schemas&&l.schemas.forEach(function(a){t.registerExternalSchema(a.uri,a.fileMatch,a.schema)}),o.configure(l)},resetSchema:function(l){return t.onResourceChange(l)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(l){return RD(l,{collectComments:!0})},newJSONDocument:function(l,a){return ND(l,a)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(l,a){return s.findDocumentColors(l,a).then(function(f){return f.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:cN,getSelectionRanges:hN,format:function(l,a,f){var u=void 0;if(a){var c=l.offsetAt(a.start),d=l.offsetAt(a.end)-c;u={offset:c,length:d}}var p={tabSize:f?f.tabSize:4,insertSpaces:f?f.insertSpaces:!0,eol:`
|
|
233
|
+
`};return wD(l.getText(),u,p).map(function(g){return Jr.replace(Ke.create(l.positionAt(g.offset),l.positionAt(g.offset+g.length)),g.content)})}}}var pN=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function gN(r){const e={settings:{background:"var(--bg-overlay)",fontFamily:"var(--code-block-font-family)"},styles:[{tag:[P.propertyName],color:"var(--code-block-tokens-property-string-color)"},{tag:[P.processingInstruction,P.string,P.inserted,P.special(P.string)],color:"var(--code-block-tokens-string-color)"},{tag:[P.atom,P.bool,P.special(P.variableName)],color:"var(--text-secondary)"}]};switch(r){case"light":return Dh(e);case"dark":return sD(e);default:return Dh(e)}}const Zh=dN({});function mN({id:r,schema:e,handleErrors:t}){return Zh.configure({validate:!0,schemas:[{uri:"stub://"+r,fileMatch:["*"],schema:e}]}),FM(n=>pN(this,null,function*(){var i;const s=n.state.doc,o=zh.create(r+".json","json",0,s.toString()),l=Zh.parseJSONDocument(o),a=yield Zh.doValidation(o,l),f=a?.filter(({severity:u})=>u===1);return t((i=f[0])==null?void 0:i.message),a?.map(u=>({from:cx(s,u.range.start.line,u.range.start.character),to:cx(s,u.range.end.line,u.range.end.character),message:u.message,severity:vN[u.severity||3]}))}))}const vN={1:"error",2:"warning",3:"info",4:"hint"};function cx(r,e,t){return r.line(e+1).from+t}const yN=({onChange:r,onBlur:e,id:t,schema:n,fieldName:i,validate:s,defaultValue:o,mode:l})=>{const{setValue:a,control:f,setError:u,clearErrors:c,getFieldState:d}=(0,kt.Gc)(),p=(0,S.useCallback)(k=>{const{error:E}=d(i);k&&!E?u(i,{message:k}):E&&c(i)},[c,i,d,u]),g=(0,S.useCallback)(k=>{a(i,k),r?.(k)},[i,r,a]),y=(0,S.useCallback)(k=>{e?.(k)},[e]),x=(0,S.useMemo)(()=>[qT(),mN({id:t,schema:n,handleErrors:p})],[p,t,n]);return S.createElement(kt.Qr,{control:f,name:i,rules:{validate:s},defaultValue:o,render:({field:{value:k,ref:E}})=>S.createElement(nD,{ref:E,className:"codemirror-container",value:k||"",onChange:g,onBlur:y,lang:l||Dl.Tr.JSON,theme:gN("light"),extensions:x,basicSetup:{bracketMatching:!0,closeBrackets:!0,tabSize:2,foldGutter:!1,lineNumbers:!1,lintKeymap:!0,drawSelection:!1}})})},bN=(0,S.memo)(yN);var qh=h(91582);function xN({mediaType:r,mediaContent:e,properties:t,id:n,resolvedBody:i,getActiveSample:s,validate:o}){const{setValue:l}=(0,kt.Gc)(),a=(0,qh.yN)(e),f=r.examples||{},u=Object.keys(f),c=r.schema,d=sp(c||{},r.name)||r.name===Dl.Tr.MULTIPART||r.name===Dl.Tr.URL_ENCODED,{exampleKey:p}=(0,Zf.C6)(r.operation,f),g=(0,Pe.YQ)((0,Fe.P6)(n,r.name,p,f))||(0,Fe.oY)(f[p],t),y=(0,S.useCallback)((O="",j="",M)=>F=>{(0,Pe.WW)((0,Fe.P6)(n,O,j,M),F)},[n]),x=(0,S.useCallback)(O=>{a?.(O),l("body",s(O))},[l,s,a]),k=(0,S.useCallback)((O,j)=>{l(`body.${O}`,j)},[l]),E=(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(Zf.b_,{examples:f,onChange:x,exampleKey:p,panel:"try-it"})||null,d?S.createElement(kA,{mediaType:r,onChange:k}):S.createElement(bN,{id:"body"+n,fieldName:"body",defaultValue:g,schema:E,mode:r.name,validate:o,onChange:y(r.name,p,f)}))}const wN=(0,S.memo)(xN);var SN=h(60821),kN=Object.defineProperty,AN=Object.defineProperties,CN=Object.getOwnPropertyDescriptors,hx=Object.getOwnPropertySymbols,ON=Object.prototype.hasOwnProperty,TN=Object.prototype.propertyIsEnumerable,dx=(r,e,t)=>e in r?kN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,EN=(r,e)=>{for(var t in e||(e={}))ON.call(e,t)&&dx(r,t,e[t]);if(hx)for(var t of hx(e))TN.call(e,t)&&dx(r,t,e[t]);return r},PN=(r,e)=>AN(r,CN(e));function IN({body:{content:r},resolvedBody:e,properties:t,mergeExampleBody:n,id:i,validate:s,pointer:o}){const{setValue:l}=(0,kt.Gc)(),a=(0,Zr.Dv)(SN.J8),{examples:f,name:u}=r&&(0,an.getActiveMediaType)(r,a)||{},c=(0,S.useCallback)(g=>{if(!r||!r.hasSample||!f?.[g])return"";const y=u&&(0,Pe.YQ)((0,Fe.P6)(i,u,g,f)),x=y?JSON.parse(y):f?.[g];return(0,Fe.oY)(x,t)},[u,f,i,r,t]),{activeExampleName:d}=(0,Zr.Dv)((0,qf.N)(o));(0,S.useEffect)(()=>{if(t&&!n){l("body",JSON.stringify(t||{},null,2));return}const g=(0,Fe.P6)(i,u,d,f),y=(0,Pe.YQ)(g)||c(d||"");l("body",typeof y=="object"?JSON.stringify(y,null,2):y)},[f,d,u,l,c,i,t,n]);const p=g=>S.createElement(fA.C,PN(EN({},g),{variant:"dark",fullWidth:!0,Label:hA,Dropdown:cA.Lt}));return S.createElement(S.Fragment,null,S.createElement(uA.d,{content:r,renderDropdown:p},g=>S.createElement(wN,{mediaType:g,mediaContent:r,resolvedBody:e,id:i,properties:t,getActiveSample:c,validate:s})))}const MN=(0,S.memo)(IN),DN=({paramEnum:r,fieldName:e,defaultValue:t})=>{const{control:n,setValue:i}=(0,kt.Gc)(),s=r.map((a,f)=>({idx:f,value:a})),o=a=>{i(e,a.value)},l=()=>{i(e,"")};return S.createElement(kt.Qr,{control:n,name:e,defaultValue:Array.isArray(t)?t[0]:t,render:({field:{value:a}})=>S.createElement(Vr.VD,{clearable:!0,fullWidth:!0,variant:"dark",value:a,options:s,handleClear:l,onChange:o})})},NN=(0,S.memo)(DN),RN=({name:r,param:e,place:t,renderParameter:n})=>{var i,s,o,l,a;const[f,u]=S.useState([]),c=()=>{u([...f,f.length?f[f.length-1]+1:0])},d=g=>{u(f.filter(y=>y!==g))},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:(l=e.schema.items)==null?void 0:l.description,externalDocs:(a=e.schema.items)==null?void 0:a.externalDocs,deprecated:!1,toggle:()=>null,expanded:!1}];return S.createElement(S.Fragment,null,S.createElement(px,null,S.createElement(Se.lX,{required:e.required},r,"(",f.length," items)"),S.createElement("span",{onClick:c},"Add item +")),f?.map((g,y)=>S.createElement(px,{key:g},p.map(x=>n(x,t,`${r}.[${g}]`,`[${y}]${x.name&&"."+x.name}`,S.createElement(LN,{onClick:()=>d(g)},"Delete"))))))},px=Xe.ZP.div`
|
|
232
234
|
display: flex;
|
|
233
235
|
width: 100%;
|
|
234
236
|
align-items: center;
|
|
@@ -249,14 +251,14 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
249
251
|
color: #fff;
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
|
-
`,
|
|
254
|
+
`,LN=Xe.ZP.span`
|
|
253
255
|
background: transparent;
|
|
254
256
|
border: none;
|
|
255
257
|
cursor: pointer;
|
|
256
258
|
position: relative;
|
|
257
259
|
margin-left: 5px;
|
|
258
260
|
display: inline-block;
|
|
259
|
-
`;var
|
|
261
|
+
`;var hl=(r=>(r.ARRAY="array",r.OBJECT="object",r))(hl||{});function BN({schema:r,example:e}){return`(${r.type})`+(e?` ${e}`:"")}function FN(r){const e={};return r.forEach(t=>{t.in&&(e[t.in]||(e[t.in]=[]),e[t.in].push(t))}),e}function jN({schema:r,required:e}){return t=>{if(e&&!t)return"Field is required";if(e&&r.type===hl.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 VN(r){if(r.type===hl.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,Pe.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 WN({oneOfType:r}){return r}const $N=["path","query","cookie","header"];function HN({id:r,param:e,values:t}){const n=(0,S.useMemo)(()=>jN(e),[e]),i=Array.isArray(e.schema.enum)&&e.schema.enum.length?e.schema.enum:void 0,s=VN(e.schema),o=r.split(".").map(l=>(0,Pe.dw)(l));return i?S.createElement(Se.NI,null,S.createElement(NN,{defaultValue:s,paramEnum:i,fieldName:r})):S.createElement(ut.Xn,{fullWidth:!0,"data-cy":"parameter-input",id:r,fieldName:r,placeholder:BN(e),rules:{validate:n},defaultValue:s||(0,Pe.U2)(t,o),validateOnBlur:!0,validateOnChange:!0})}function zN({values:r,operation:e}){const t=(0,S.useMemo)(()=>FN(e.parameters||[]),[e]),n=(s,o,l,a,f)=>{var u;const c=l?(0,Pe.s1)(l,s.name):s.name,d=WN(s.schema),p=l?[o,l]:[s.in],g=(0,Pe.s1)(...p,(0,Pe.A8)(s.name));return d&&console.warn(`Unsupported parameter definition: "${d}"`),(Array.isArray(s.schema.type)?s.schema.type:[s.schema.type]).includes(hl.ARRAY)?S.createElement(RN,{key:g,name:c,param:s,place:o,renderParameter:n}):s.schema.type===hl.OBJECT?(u=s.schema.fields)==null?void 0:u.map(x=>n(x,o,c)):S.createElement(Se.NI,{key:g},S.createElement(Se.lX,{required:s.required},a||c,": ",f),d?S.createElement(Se.GE,null,"Unsupported field schema definition"):S.createElement(HN,{id:g,param:s,values:r}))},i=s=>{const o=t[s];return!o||!o.length?null:S.createElement(S.Fragment,{key:s},S.createElement(Se.NI,null,S.createElement(Se.iG,null," # ",s," parameters "),S.createElement("span",null,"\xA0")),o.map(l=>n(l,s)))};return S.createElement(Se.iA,null,$N.map(i))}var UN=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function GN(r){return UN(this,null,function*(){return(yield fetch(r)).json()})}const KN=Xe.ZP.div`
|
|
260
262
|
position: relative;
|
|
261
263
|
height: 4px;
|
|
262
264
|
display: block;
|
|
@@ -358,19 +360,19 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
358
360
|
right: -8%;
|
|
359
361
|
}
|
|
360
362
|
}
|
|
361
|
-
`,
|
|
363
|
+
`,gx=()=>S.createElement(KN,null,S.createElement("div",{className:"indeterminate"})),YN=Xe.ZP.div`
|
|
362
364
|
font-family: var(--font-family-monospaced);
|
|
363
365
|
margin-top: 10px;
|
|
364
366
|
line-height: 1;
|
|
365
367
|
padding-left: 10px;
|
|
366
368
|
border-left: 1px solid gray;
|
|
367
|
-
`,
|
|
369
|
+
`,_N=Xe.ZP.div`
|
|
368
370
|
margin-bottom: 15px;
|
|
369
|
-
`,
|
|
371
|
+
`,JN=Xe.ZP.div`
|
|
370
372
|
padding: 8px 0 20px;
|
|
371
|
-
`,
|
|
373
|
+
`,XN=Xe.ZP.div`
|
|
372
374
|
padding: 4px 0;
|
|
373
|
-
`;var
|
|
375
|
+
`;var QN=Object.defineProperty,ZN=Object.defineProperties,qN=Object.getOwnPropertyDescriptors,mx=Object.getOwnPropertySymbols,e3=Object.prototype.hasOwnProperty,t3=Object.prototype.propertyIsEnumerable,vx=(r,e,t)=>e in r?QN(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,r3=(r,e)=>{for(var t in e||(e={}))e3.call(e,t)&&vx(r,t,e[t]);if(mx)for(var t of mx(e))t3.call(e,t)&&vx(r,t,e[t]);return r},n3=(r,e)=>ZN(r,qN(e));const i3=Xe.ZP.input`
|
|
374
376
|
cursor: pointer;
|
|
375
377
|
margin-left: 0;
|
|
376
378
|
margin-right: 5px;
|
|
@@ -379,7 +381,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
379
381
|
align-self: baseline;
|
|
380
382
|
margin-top: 0;
|
|
381
383
|
margin-bottom: 0;
|
|
382
|
-
`,
|
|
384
|
+
`,s3=Xe.ZP.label`
|
|
383
385
|
display: inline-block;
|
|
384
386
|
cursor: pointer;
|
|
385
387
|
vertical-align: middle;
|
|
@@ -389,7 +391,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
389
391
|
|
|
390
392
|
overflow-wrap: break-word;
|
|
391
393
|
line-height: 20px;
|
|
392
|
-
`,
|
|
394
|
+
`,o3=Xe.ZP.div`
|
|
393
395
|
width: ${({fullWidth:r})=>r?"100%":"50%"};
|
|
394
396
|
display: inline-flex;
|
|
395
397
|
align-items: center;
|
|
@@ -403,16 +405,16 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
403
405
|
margin-top: 5px;
|
|
404
406
|
}
|
|
405
407
|
`}
|
|
406
|
-
`;function
|
|
408
|
+
`;function l3(r,e){const{fullWidth:t,id:n,label:i,nowrap:s}=r;return S.createElement(o3,{fullWidth:t,nowrap:s},S.createElement(i3,n3(r3({},r),{type:"checkbox",ref:e})),S.createElement(s3,{htmlFor:n},i))}const yx=(0,S.forwardRef)(l3),a3=11,f3=({fieldName:r,defaultValue:e,items:t,validateOnChange:n,maxDisplayedItems:i,showControls:s,trimItemsLength:o})=>{var l,a;const{control:f,setValue:u,getValues:c,formState:d,trigger:p}=(0,kt.Gc)(),[g,y]=(0,S.useState)(!0),x=U=>{const L=U.target.value,$=U.target.checked,W=c(r)||[];let Y;if($)Y=[...W,L];else{const le=W.indexOf(L);Y=[...W.slice(0,le),...W.slice(le+1)]}u(r,Y)},k=U=>c(r).includes(U),E=()=>{y(U=>!U)},O=()=>{u(r,t)},j=()=>{u(r,[])},M=(a=(l=d.errors[r])==null?void 0:l.message)==null?void 0:a.toString(),F=i||a3,D=o&&g?t.slice(0,F):t;return S.createElement("div",null,s?S.createElement(St.CodeBlockControls,{controls:{select:{onClick:O,label:"Select all",tooltipText:"Select all checkboxes"},deselect:{onClick:j,label:"Deselect all",tooltipText:"Deselect all checkboxes"}}}):null,S.createElement(c3,null,S.createElement(kt.Qr,{control:f,name:r,defaultValue:e,render:()=>S.createElement(S.Fragment,null,D.map(U=>S.createElement(yx,{fullWidth:!0,id:U,value:U,checked:k(U),label:U,key:U,onChange:L=>{x(L),n&&p(r)}})))}),t.length>F&&o?S.createElement(h3,{onClick:()=>{E()}},g?"Show all":"Collapse"):null),M?S.createElement(Se.Xq,null,M):"")},u3=(0,S.memo)(f3),c3=Xe.ZP.div`
|
|
407
409
|
padding: 10px;
|
|
408
410
|
border: 1px solid var(--border-primary);
|
|
409
411
|
border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
|
|
410
|
-
`,
|
|
412
|
+
`,h3=(0,Xe.ZP)(St.CodeBlockControlButton)`
|
|
411
413
|
float: right;
|
|
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,Re.jg)(Ct):Ct,Pr=i&&n?i+(0,Re.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,Re.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,Re.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:Re.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,Re.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,Re.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,Re.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,Re.NG)(E)||(0,Oe.YQ)(`auth.${U}`)||r?.[U],rules:{validate:Re.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:Re.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:Re.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:Re.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:Re.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,Re.ZS)(r.parameters,"path"),cookie:(0,Re.ZS)(r.parameters,"cookie"),header:(0,Re.ZS)(r.parameters,"header"),query:(0,Re.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,Re.Hc)(Er(Nt({},Ee),{query:(0,Re.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,Re.FU)(we.query||{}),_f={server:Zl?Zl+jb(Qf.url):Qf.url,serverVariables:(0,Re.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,Re.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,Re.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,Be=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 _&&!Be.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
|
|
414
|
-
`+
|
|
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++)Be.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 Be=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"?Be=V(ee,Be):Be instanceof Date?Be=ge(Be):z==="comma"&&P(Be)&&(Be=b.maybeMap(Be,function(dr){return dr instanceof Date?ge(dr):dr})),Be===null){if(ie)return ue&&!We?ue(ee,J.encoder,je,"key",me):ee;Be=""}if(q(Be)||b.isBuffer(Be)){if(ue){var Qe=We?ee:ue(ee,J.encoder,je,"key",me);return[ve(Qe)+"="+ve(ue(Be,J.encoder,je,"value",me))]}return[ve(ee)+"="+ve(String(Be))]}var Et=[];if(typeof Be>"u")return Et;var wt;if(z==="comma"&&P(Be))We&&ue&&(Be=b.maybeMap(Be,ue)),wt=[{value:Be.length>0?Be.join(",")||null:void 0}];else if(P(V))wt=V;else{var Tt=Object.keys(Be);wt=Y?Tt.sort(Y):Tt}for(var hr=ne&&P(Be)&&Be.length===1?ee+"[]":ee,De=0;De<wt.length;++De){var St=wt[De],zt=typeof St=="object"&&typeof St.value<"u"?St.value:Be[St];if(!(ae&&zt===null)){var pt=P(Be)?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(Be)?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;/**
|
|
414
|
+
`;function bx(r){const{scopes:e,id:t}=r;let n=[];try{n=JSON.parse((0,Pe.YQ)(`auth.${t}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(Se.NI,null,S.createElement(Se.lX,null," Scopes: "),S.createElement(u3,{fieldName:`auth.${t}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const d3=({token:r,loading:e,error:t})=>e?S.createElement(Se.GE,null,"Please, finish your authorization flow or cancel authorization."):t?S.createElement(YN,null,S.createElement(Se.Xq,null,t)):r?.access_token?null:S.createElement(Se.GE,null," No Access Token. Please, Authorize. ");var p3=Object.defineProperty,g3=Object.defineProperties,m3=Object.getOwnPropertyDescriptors,xx=Object.getOwnPropertySymbols,v3=Object.prototype.hasOwnProperty,y3=Object.prototype.propertyIsEnumerable,wx=(r,e,t)=>e in r?p3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pf=(r,e)=>{for(var t in e||(e={}))v3.call(e,t)&&wx(r,t,e[t]);if(xx)for(var t of xx(e))y3.call(e,t)&&wx(r,t,e[t]);return r},ed=(r,e)=>g3(r,m3(e)),Sx=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});const If=({usePkce:r,id:e,flow:t,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:l,authorizationUrl:a,defaultValues:f,clientId:u})=>{var c;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,Zr.Dv)(ei.qd),{setValue:g,getValues:y,trigger:x,formState:k}=(0,kt.Gc)(),[E,O]=(0,S.useState)(null),[j,M]=(0,S.useState)(!1),[F,D]=(0,S.useState)(!1),[U,L]=(0,S.useState)(void 0),[$,W]=(0,S.useState)(void 0),[Y,le]=(0,S.useState)(void 0),fe=((c=y("auth"))==null?void 0:c[e])||{},me=k.errors||{},Te=U!==void 0&&$!==Y?{label:"sync",onClick:()=>{U&&W(Y)}}:void 0;(0,S.useEffect)(()=>{if(r){const bt=(0,Ii.CY)(43);vp(bt).then(or=>{L(bt),W(or),le(or)})}},[r]);const ye=bt=>Sx(void 0,null,function*(){if(!bt||(yield x(),!(0,Ii.Qr)(me)))return;M(!0),O(null);const or=i?i+(0,Fe.jg)(bt):bt,Lr=i&&n?i+(0,Fe.jg)(n):n,wi=y(`auth.${e}.scopes`),Si={authorizationUrl:or.startsWith("http")?or:o+or,clientId:fe.client_id,scopes:wi,redirectUri:d,routingBasePath:p,successCallback:Br=>{g(`auth.${e}.token`,Br),M(!1),O(null)},errorCallback:Br=>{M(!1),O(Br?.message||"Failed to retrieve the access token")}};if(t==="implicit"&&qr.authorizeImplicit(Si),!(0,Fe.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}t==="authorizationCode"&&qr.authorizeAuthorizationCode(Pf(ed(Pf({},Si),{tokenUrl:Lr?.startsWith("http")?Lr:o+Lr,clientSecret:fe.client_secret,extraHeaders:(0,Fe.Or)({authMethod:s,clientId:fe.client_id,clientSecret:fe.client_secret})}),r&&{codeVerifier:U,codeChallenge:$}))}),Ce=()=>{Ae(),O(null)},He=()=>{M(!1),O(null),qr.clearRedirectData(t)},Ae=()=>{g(`auth.${e}.token`,"")},Le=()=>{D(bt=>!bt)},Ye=bt=>Sx(void 0,[bt],function*({target:{value:or}}){const Lr=yield vp(or);L(or),le(Lr)});if(!a)return S.createElement(Se.Xq,null,"No flow info");let at=(0,Pe.YQ)(`auth.${e}.token`)||JSON.stringify(f?.token);at=at?JSON.parse(at):"";const yt=(0,Pe.Al)(e,"client_id"),Ht={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Pe.YQ)(`auth.${e}.client_id`)||u||f?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:Fe.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(Se.n5,null,S.createElement(Se.NI,null,S.createElement(Se.lX,null," Client ID: "),yt?S.createElement(ut.F0,ed(Pf({},Ht),{options:yt})):S.createElement(ut.Xn,ed(Pf({},Ht),{"data-cy":"client-id-input",panel:"try-it"}))),t==="authorizationCode"&&S.createElement(S.Fragment,null,(!r?.hideClientSecretInput||!r)&&S.createElement(Se.NI,null,S.createElement(Se.lX,null,"Client Secret:"),S.createElement(ut.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Pe.YQ)(`auth.${e}.client_secret`)||f?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),r&&!r.disableManualConfiguration&&S.createElement(JN,null,S.createElement(yx,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:F,onChange:Le,"data-cy":"pkce-options-toggle"}),F&&S.createElement(XN,null,S.createElement(Se.NI,null,S.createElement(Se.lX,null,"Code Verifier"),S.createElement(ut.nv,{fullWidth:!0,value:U,onChange:Ye,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(Se.NI,null,S.createElement(Se.lX,null,"Code Challenge"),S.createElement(ut.nv,{fullWidth:!0,value:$,onChange:({target:{value:bt}})=>{W(bt)},inputActionButton:Te,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(ut.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:at,panel:"try-it"}),S.createElement(bx,{id:e,scopes:l}),fe.token&&fe.token.access_token?S.createElement(Se.NI,null,S.createElement(Se.lX,null," Access Token: "),S.createElement(ut.nv,{disabled:!0,type:"password",fullWidth:!0,value:fe.token.access_token,panel:"try-it"})):null),S.createElement(_N,null,fe.token&&fe.token.access_token?S.createElement(St.Button,{fullWidth:!0,onClick:Ce},"Log out"):j?S.createElement(S.Fragment,null,S.createElement(St.Button,{fullWidth:!0,onClick:He},"Cancel"),S.createElement(gx,null)):S.createElement(St.Button,{fullWidth:!0,disabled:!(0,Ii.Qr)(me),onClick:()=>{ye(a)}},"Authorize")),j||E||!fe.token||!fe.token.access_token&&S.createElement(d3,{loading:j,error:E,token:fe.token}))};var b3=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function x3(r){var e,t;const{scheme:n,defaultValues:i}=r,[s,o]=(0,S.useState)({}),[l,a]=(0,S.useState)(),[f,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{c(n.openIdConnectUrl)},[n.openIdConnectUrl]);const c=d=>b3(this,null,function*(){u(!0),a("");try{const p=yield GN(d);o(p)}catch(p){a(p.message)}u(!1)});return f?S.createElement(w3,null):l?S.createElement(kx,{message:l}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Vr.S6,null,"OAuth2 Implicit Flow"),S.createElement(If,{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(Vr.S6,null,"OAuth2 Authorization Flow"),S.createElement(If,{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 w3(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(gx,null)))}function kx({message:r}){return S.createElement("div",null,S.createElement("div",null,S.createElement(Se.Xq,null,r)))}var S3=Object.defineProperty,k3=Object.defineProperties,A3=Object.getOwnPropertyDescriptors,Ax=Object.getOwnPropertySymbols,C3=Object.prototype.hasOwnProperty,O3=Object.prototype.propertyIsEnumerable,Cx=(r,e,t)=>e in r?S3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ox=(r,e)=>{for(var t in e||(e={}))C3.call(e,t)&&Cx(r,t,e[t]);if(Ax)for(var t of Ax(e))O3.call(e,t)&&Cx(r,t,e[t]);return r},Tx=(r,e)=>k3(r,A3(e)),T3=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function E3(r){if(!r)return"Token is required"}const P3=({id:r,server:e,flow:t,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,l;const{setValue:a,watch:f,formState:u}=(0,kt.Gc)(),[c,d]=(0,S.useState)(""),[p,g]=(0,S.useState)(!1),[y,x]=(0,S.useState)(!0),k=((o=f("auth"))==null?void 0:o[r])||{},E=((l=u.errors)==null?void 0:l.auth)||{},O=()=>{a(`auth.${r}.token`,""),(0,Pe.WW)(`auth.${r}.token`,"")},j=()=>{x($=>!$)},M=()=>T3(void 0,null,function*(){if(p)return;const $=n&&t.tokenUrl?n+(0,Fe.jg)(t.tokenUrl):t.tokenUrl;if(E.client_id||E.client_secret){console.log("Provide client_id and client_secret");return}const W=k.client_id,Y=k.client_secret;if(!W||!Y){console.log("Provide client_id and client_secret");return}g(!0);const le=t["x-tokenEndpointAuthMethod"];if(!(0,Fe.xl)(le)){console.log(`Unsupported token endpoint auth method: ${le}`);return}yield qr.authorizeClientCredentials({tokenUrl:$.startsWith("http")?$:e+$,clientId:W,clientSecret:Y,scopes:k.scopes,extraHeaders:(0,Fe.Or)({authMethod:le,clientId:W,clientSecret:Y}),successCallback:fe=>{a(`auth.${r}.token`,fe),g(!1)},errorCallback:fe=>{O(),d(fe.message),g(!1)}})}),F=Object.keys(t.scopes);let D=(0,Pe.YQ)(`auth.${r}.token`)||JSON.stringify(i?.token);D=D?JSON.parse(D):"";const U=(0,Pe.Al)(r,"client_id"),L={fieldName:`auth.${r}.client_id`,fullWidth:!0,defaultValue:(0,Pe.YQ)(`auth.${r}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(Se.n5,null,S.createElement(Se.NI,null,S.createElement(Se.lX,null,"Client ID:"),U?S.createElement(ut.F0,Tx(Ox({},L),{options:U})):S.createElement(ut.Xn,Tx(Ox({},L),{type:"password",panel:"try-it"}))),S.createElement(Se.NI,null,S.createElement(Se.lX,null,"Client Secret:"),S.createElement(ut.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${r}.client_secret`,defaultValue:(0,Pe.YQ)(`auth.${r}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(ut.Xn,{fullWidth:!0,fieldName:`auth.${r}.token`,type:"hidden",defaultValue:D,rules:{validate:E3}}),S.createElement(bx,{id:r,scopes:F})),S.createElement(St.Button,{color:"primary",onClick:M,blinking:p},p?"Loading...":"Request Token"),S.createElement(Se.ph,null," Access Token "),c?S.createElement(Se.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,c)," "):k.token&&k.token.access_token?S.createElement(Se.TR,null,S.createElement(Se.WA,{length:k.token.access_token.length,masked:y},k.token.access_token),S.createElement(Se.lf,{onClick:j},y?"Show":"Hide"," "),S.createElement(Se.h,{onClick:O}," Clear ")):S.createElement(Se.Xq,{style:{marginBottom:"1em"}},"No token"))};var I3=Object.defineProperty,M3=Object.defineProperties,D3=Object.getOwnPropertyDescriptors,Ex=Object.getOwnPropertySymbols,N3=Object.prototype.hasOwnProperty,R3=Object.prototype.propertyIsEnumerable,Px=(r,e,t)=>e in r?I3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ks=(r,e)=>{for(var t in e||(e={}))N3.call(e,t)&&Px(r,t,e[t]);if(Ex)for(var t of Ex(e))R3.call(e,t)&&Px(r,t,e[t]);return r},Ys=(r,e)=>M3(r,D3(e));const L3=({securityDefaults:r,operation:e,activeServer:t,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:l,watch:a}=(0,kt.Gc)(),{parser:f}=(0,Zr.Dv)(ei.eG),u=e.security,c=(0,S.useMemo)(()=>u.map(O=>O.schemes.map(j=>j.id).join(" and ")).filter(Boolean),[u]),d=a("securityScheme"),p=(0,S.useMemo)(()=>{const O=c.findIndex(j=>j===d);return O<0?0:O},[c,d]);(0,S.useEffect)(()=>{const O=(0,Pe.YQ)("securityRequirementName"),j=c.findIndex(M=>M===O);l("securityScheme",c[j<0?0:j])},[c,e,l]);const g=(0,S.useCallback)(O=>{l("securityScheme",O.value),(0,Pe.WW)("securityRequirementName",O.value)},[l]),y=(0,S.useMemo)(()=>c.map((O,j)=>({value:O,idx:j})),[c]);if(y.length===0)return S.createElement(kx,{message:"Cannot find security schema in the definition"});const x=u[p],k=(0,Pe.A8)(x.schemes[0].id),E=a(`auth.${k}`);return S.createElement(S.Fragment,null,S.createElement(Se.n5,null,y.length>1&&S.createElement(Se.NI,null,S.createElement(Se.lX,null," Security scheme: "),S.createElement(kt.Qr,{control:o,name:"securityScheme",render:({field:{value:O}})=>S.createElement(Vr.VD,{variant:"dark",fullWidth:!0,options:y,value:O,onChange:g})}))||null,S.createElement(St.TryItSecurityApps,{apiId:(s=(i=f?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:E,onChange:O=>{l(`auth.${k}`,O)}}),x.schemes.map(O=>{var j,M,F,D,U,L;const $=(0,Pe.A8)(O.id);if(O.type==="apiKey"){const W=(0,Pe.Al)($,""),Y={fieldName:`auth.${$}`,fullWidth:!0,defaultValue:(0,Fe.NG)(O)||(0,Pe.YQ)(`auth.${$}`)||r?.[$],rules:{validate:Fe.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(Se.NI,{key:$},S.createElement(Se.lX,null," ",O.name,": "),W?S.createElement(ut.F0,Ys(Ks({},Y),{options:W})):S.createElement(ut.Xn,Ys(Ks({},Y),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(O.type==="http"){if(O.scheme==="basic"){const W=(0,Pe.Al)($,"username"),Y={fieldName:`auth.${$}.username`,fullWidth:!0,defaultValue:(0,Pe.YQ)(`auth.${$}.username`)||((j=r?.[$])==null?void 0:j.username),validate:Fe.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:$},S.createElement(Se.NI,null,S.createElement(Se.lX,null," ",(0,io.l)("tryItAuthBasicUsername"),": "),W?S.createElement(ut.F0,Ys(Ks({},Y),{options:W})):S.createElement(ut.Xn,Ys(Ks({},Y),{panel:"try-it"}))),S.createElement(Se.NI,null,S.createElement(Se.lX,null," ",(0,io.l)("tryItAuthBasicPassword"),": "),S.createElement(ut.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${$}.password`,defaultValue:(0,Pe.YQ)(`auth.${$}.password`)||((M=r?.[$])==null?void 0:M.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(O.scheme==="bearer"){const W=(0,Pe.Al)($,""),Y={fieldName:`auth.${$}`,fullWidth:!0,defaultValue:(0,Pe.YQ)(`auth.${$}`)||r?.[$],rules:{validate:Fe.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:$},S.createElement(Se.NI,null,S.createElement(Se.lX,null," Bearer Token: "),W?S.createElement(ut.F0,Ys(Ks({},Y),{options:W})):S.createElement(ut.Xn,Ys(Ks({},Y),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(O.type==="oauth2"&&O.flows&&O.flows.clientCredentials)return S.createElement(P3,{key:$,flow:O.flows.clientCredentials,server:t,authCorsProxyUrl:n,id:$,clientId:O.flows.clientCredentials["x-defaultClientId"]||O["x-defaultClientId"],defaultValues:r?.[$]});if(O.type==="oauth2"&&O.flows&&O.flows.implicit)return S.createElement(If,{key:$,authorizationUrl:O.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((D=(F=O?.flows)==null?void 0:F.implicit)==null?void 0:D.scopes)||{}),server:t,id:$,clientId:O.flows.implicit["x-defaultClientId"]||O["x-defaultClientId"],flow:"implicit",defaultValues:r?.[$]});if(O.type==="oauth2"&&O.flows&&O.flows.authorizationCode)return S.createElement(If,{key:$,authorizationUrl:O.flows.authorizationCode.authorizationUrl,tokenUrl:O.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((U=O.flows.authorizationCode)==null?void 0:U.scopes)||{}),server:t,id:$,clientId:O.flows.authorizationCode["x-defaultClientId"]||O["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:O.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:O.flows.authorizationCode["x-usePkce"],defaultValues:r?.[$]});if(O.type==="oauth2"){let W=(0,Pe.YQ)(`auth.${$}.token`)||JSON.stringify((L=r?.[$])==null?void 0:L.token);return W=W?JSON.parse(W):{},S.createElement(S.Fragment,{key:$},S.createElement(Se.NI,null,S.createElement(Se.lX,null," Access Token Type: "),S.createElement(ut.Xn,{fullWidth:!0,fieldName:`auth.${$}.token.token_type`,defaultValue:W.token_type||"Bearer",panel:"try-it"})),S.createElement(Se.NI,null,S.createElement(Se.lX,null," Access Token: "),S.createElement(ut.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${$}.token.access_token`,rules:{validate:Fe.np},defaultValue:W.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(O.type==="openIdConnect")return S.createElement(x3,{key:$,server:t,authCorsProxyUrl:n,id:$,scheme:O,clientId:O["x-defaultClientId"],defaultValues:r?.[$]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var B3=h(55919);function F3({operation:r,properties:e,mergeExampleBody:t,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:l,formState:a}=(0,kt.Gc)(),f=a.errors||{},u=!!(f.path||f.cookie||f.header||f.query),{hooks:c,authCorsProxyUrl:d}=(0,Zr.Dv)(ei.qd),p=i&&Pe.IB.get(i,r.pointer),g=l();let y=g&&g.auth&&Object.keys(g.auth)[0];(!y||!g.auth[y])&&(y=void 0),y&&(g.auth[y].token!==void 0||g.auth[y].client_id!==void 0||g.auth[y].client_secret!==void 0)&&(!g.auth[y].token||!g.auth[y].token.access_token)&&(y=void 0),y&&g.auth[y].username!=null&&(!g.auth[y].username||!g.auth[y].password)&&(y=void 0);const x=r.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(eA,{operation:r,onChange:o}),S.createElement(El.UQ,{initialActiveIdx:r.security.length&&y?1:0},r.security.length&&S.createElement(Qf,{header:(0,io.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!f.auth,success:!!y,renderChildrenHidden:!0},St.OpenApiTryItSecurityPanel||c?.ReplaceTryItSecurityPanel?S.createElement(j3,{fieldName:"auth",validate:Fe.np},k=>S.createElement(B3.Q,{Hook:St.OpenApiTryItSecurityPanel||c?.ReplaceTryItSecurityPanel,props:{server:s,operation:r,onChange:k,OAuth2:qr}})):S.createElement(L3,{operation:r,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,r.requestBody&&S.createElement(Qf,{header:(0,io.l)("tryItBody"),"data-cy":"body-trigger",error:!!f.body,renderChildrenHidden:!0},S.createElement(MN,{validate:V3,body:r.requestBody,pointer:r.pointer,id:r.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:t}))||null,x.length&&S.createElement(Qf,{header:(0,io.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(zN,{operation:r,values:g}))||null))}function j3({fieldName:r,validate:e,children:t}){const{control:n,setValue:i}=(0,kt.Gc)();return S.createElement(kt.Qr,{control:n,name:r,rules:{validate:e},render:()=>t(i)})}function V3(){}const W3=(0,S.memo)(F3);function $3({shaking:r,className:e,children:t,rootElement:n}){const[i]=(0,qh.Bs)(n),s=(0,Zr.Dv)(ei.qd);return S.createElement(Vr.q2,{scrollYOffset:s.scrollYOffset,shaking:r,className:e,"data-cy":"console",fullWidth:i?.width},t)}const H3=(0,S.memo)($3);var z3=Object.defineProperty,U3=Object.defineProperties,G3=Object.getOwnPropertyDescriptors,Ix=Object.getOwnPropertySymbols,K3=Object.prototype.hasOwnProperty,Y3=Object.prototype.propertyIsEnumerable,Mx=(r,e,t)=>e in r?z3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Vt=(r,e)=>{for(var t in e||(e={}))K3.call(e,t)&&Mx(r,t,e[t]);if(Ix)for(var t of Ix(e))Y3.call(e,t)&&Mx(r,t,e[t]);return r},Rr=(r,e)=>U3(r,G3(e)),Dx=(r,e,t)=>new Promise((n,i)=>{var s=a=>{try{l(t.next(a))}catch(f){i(f)}},o=a=>{try{l(t.throw(a))}catch(f){i(f)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(r,e)).next())});function Nx(r){return r.startsWith("//")?"https:"+r:r}function _3({operation:r,onResponse:e,className:t,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:l}){const a=(0,kt.cI)({defaultValues:{path:(0,Fe.ZS)(r.parameters,"path"),cookie:(0,Fe.ZS)(r.parameters,"cookie"),header:(0,Fe.ZS)(r.parameters,"header"),query:(0,Fe.ZS)(r.parameters,"query")}}),[{activeServer:f},u]=(0,Zr.KO)((0,qf.N)(r.pointer)),[c,d]=(0,S.useState)(0),[p,g]=(0,S.useState)(!1),[y,x]=(0,S.useState)(!1),[k,E]=(0,S.useState)(),[O,j]=(0,S.useState)(),[M,F]=(0,S.useState)(),[D,U]=(0,S.useState)(),L=(0,qh.D9)(r),{parser:$,options:W}=(0,Zr.Dv)(ei.eG);(0,S.useEffect)(()=>{const{unsubscribe:ye}=a.watch((Ce={})=>{u(He=>Rr(Vt({},He),{requestValues:JSON.parse(JSON.stringify(Ce))})),(0,Fe.Hc)(Rr(Vt({},Ce),{query:(0,Fe.FU)(Ce.query||{})}))});return()=>ye()},[a,u]);const Y=(0,S.useCallback)(ye=>{d(ye)},[]),le=(0,S.useCallback)(ye=>{u(Ce=>Rr(Vt({},Ce),{activeServer:ye})),a.setValue("server",ye)},[u,a]),fe=a.handleSubmit(ye=>Dx(this,null,function*(){var Ce,He,Ae,Le,Ye,at,yt,Ht,bt,or,Lr,wi,Si;const{servers:Br,requestBody:In}=r,Mf=In&&In.content&&((Ce=(0,an.getActiveMediaType)(In.content))==null?void 0:Ce.name)||"";let ki=ye.body;if(/json/.test(Mf))try{ki=JSON.parse(ki)}catch(_e){console.error(_e)}g(!0);const hr=k,_s=(r.httpVerb||"").toLowerCase();if(!Br)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 td=Br.find(_e=>f?.url.endsWith(_e.url.endsWith("/")?_e.url.substring(0,_e.url.length-1):_e.url)),X3=Date.now();let Un,Ai=ye.auth;if(Ai){const _e=Object.keys(Ai)[0],Mn=(0,wk.dw)(_e);Un=Rr(Vt({},hr),{components:Rr(Vt({},hr?.components),{securitySchemes:Rr(Vt({},(He=hr?.components)==null?void 0:He.securitySchemes),{[Mn]:Rr(Vt({},(Le=(Ae=hr?.components)==null?void 0:Ae.securitySchemes)==null?void 0:Le[Mn]),{type:((yt=(at=(Ye=hr?.components)==null?void 0:Ye.securitySchemes)==null?void 0:at[Mn])==null?void 0:yt.type)==="openIdConnect"?"oauth2":((bt=(Ht=hr?.components)==null?void 0:Ht.securitySchemes)==null?void 0:bt[Mn]).type})})})}),Ai=Rr(Vt({},Ai),{[Mn]:Ai[_e]})}else Un=Vt({},hr);Un.servers=Br;const Df=W.corsProxyUrl;Df&&Br.length&&(Un.servers=Br.map(_e=>Rr(Vt({},_e),{url:Df+Nx(_e.url)})),Un.paths=Rr(Vt({},Un.paths),{[r.path]:Rr(Vt({},Un.paths[r.path]),{[_s]:Rr(Vt({},Un.paths[r.path][_s]),{servers:void 0}),servers:void 0})}));const rd=In?.content&&((or=(0,an.getActiveMediaType)(In.content))==null?void 0:or.name)||null;if(rd&&ki&&Pl(rd)){const _e=Object.values(ki);ki=_e.length>1?_e:_e[0]}const Q3=(0,Fe.FU)(ye.query||{}),nd={server:Df?Df+Nx(td.url):td.url,serverVariables:(0,Fe.mj)(td),spec:Un,pathName:r.path,method:r.httpVerb,parameters:Vt(Vt(Vt(Vt({},ye.path),Q3),ye.header),ye.cookie),securities:{authorized:Ai},requestBody:ki,requestContentType:rd,responseContentType:((Lr=ye.header)==null?void 0:Lr.Accept)||null,requestInterceptor:(0,Fe.Tz)(W,r,Ai?.Authorization)};try{const _e=yield rk(nd),Mn=_e?.data;Mn instanceof Blob&&(Pl(Mn.type)&&(_e.fileInfo={rawData:Mn,fileName:(0,Fe.AM)(_e.headers)}),_e.data=yield Mn.text()),e?.({request:nd,response:_e}),U(_e),F(void 0)}catch(_e){_e&&_e.response&&_e.response.data instanceof Blob&&(_e.response.data=yield _e.response.data.text(),e?.({request:nd,response:_e.response})),U(void 0),F(_e)}finally{g(!1),d(1),j(Date.now()-X3),(Si=(wi=W.events)==null?void 0:wi.tryItSent)==null||Si.call(wi,{eventType:_f.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})}}),()=>{var ye,Ce;x(!0),setTimeout(()=>x(!1),1e3),(Ce=(ye=W.events)==null?void 0:ye.tryItSent)==null||Ce.call(ye,{eventType:_f.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})});(0,St.useMount)(()=>Dx(this,null,function*(){const ye=yield xk(r,$.definition);E(ye),r.activeServer&&!f&&u(Ce=>Rr(Vt({},Ce),{activeServer:r.activeServer}))})),(0,S.useEffect)(()=>{L&&L!==r&&(U(void 0),F(void 0),d(0))},[r,L]);const me=!!(D||M),Te=a.getValues();return S.createElement(kt.RV,Vt({},a),S.createElement(H3,{shaking:y,className:t,rootElement:n},S.createElement(El.Hc,null,S.createElement(Rk,{active:c,hasResponse:me,onChange:Y}),l&&S.createElement(Vr.PZ,{onClick:l}," \u2715 ")),S.createElement(Vr.RE,{hidden:c!==0,"data-cy":"console-request-body"},S.createElement(W3,{operation:r,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:k,server:f||r.activeServer,onServerChange:le})),S.createElement(Vr.RE,{hidden:c!==1,"data-cy":"console-response-body"},S.createElement(Dk,{response:D,error:M,time:O})),S.createElement(jk,{hasResponse:me,params:Te,operation:r,loading:p,onSubmit:fe})))}const J3=(0,S.memo)(_3)},85208:(v,C,h)=>{var m=h(34440),b=h(84108),w=h(61085),A=h(77706),T=h(8636);function I(R){var N=-1,V=R==null?0:R.length;for(this.clear();++N<V;){var G=R[N];this.set(G[0],G[1])}}I.prototype.clear=m,I.prototype.delete=b,I.prototype.get=w,I.prototype.has=A,I.prototype.set=T,v.exports=I},81998:(v,C,h)=>{var m=h(90266),b=h(42875),w=h(45828),A=h(24115),T=h(67690);function I(R){var N=-1,V=R==null?0:R.length;for(this.clear();++N<V;){var G=R[N];this.set(G[0],G[1])}}I.prototype.clear=m,I.prototype.delete=b,I.prototype.get=w,I.prototype.has=A,I.prototype.set=T,v.exports=I},72887:(v,C,h)=>{var m=h(65234),b=h(84100),w=m(b,"Map");v.exports=w},95678:(v,C,h)=>{var m=h(39016),b=h(62363),w=h(64348),A=h(53062),T=h(30262);function I(R){var N=-1,V=R==null?0:R.length;for(this.clear();++N<V;){var G=R[N];this.set(G[0],G[1])}}I.prototype.clear=m,I.prototype.delete=b,I.prototype.get=w,I.prototype.has=A,I.prototype.set=T,v.exports=I},70861:(v,C,h)=>{var m=h(84100),b=m.Symbol;v.exports=b},29233:v=>{function C(h,m){for(var b=-1,w=h==null?0:h.length,A=Array(w);++b<w;)A[b]=m(h[b],b,h);return A}v.exports=C},18498:(v,C,h)=>{var m=h(58260);function b(w,A){for(var T=w.length;T--;)if(m(w[T][0],A))return T;return-1}v.exports=b},40548:(v,C,h)=>{var m=h(24007),b=h(86040);function w(A,T){T=m(T,A);for(var I=0,R=T.length;A!=null&&I<R;)A=A[b(T[I++])];return I&&I==R?A:void 0}v.exports=w},69823:(v,C,h)=>{var m=h(70861),b=h(91339),w=h(25151),A="[object Null]",T="[object Undefined]",I=m?m.toStringTag:void 0;function R(N){return N==null?N===void 0?T:A:I&&I in Object(N)?b(N):w(N)}v.exports=R},99817:(v,C,h)=>{var m=h(45563),b=h(28597),w=h(93702),A=h(55784),T=/[\\^$.*+?()[\]{}|]/g,I=/^\[object .+?Constructor\]$/,R=Function.prototype,N=Object.prototype,V=R.toString,G=N.hasOwnProperty,X=RegExp("^"+V.call(G).replace(T,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ee(Z){if(!w(Z)||b(Z))return!1;var _=m(Z)?X:I;return _.test(A(Z))}v.exports=ee},86245:(v,C,h)=>{var m=h(70861),b=h(29233),w=h(55589),A=h(52624),T=1/0,I=m?m.prototype:void 0,R=I?I.toString:void 0;function N(V){if(typeof V=="string")return V;if(w(V))return b(V,N)+"";if(A(V))return R?R.call(V):"";var G=V+"";return G=="0"&&1/V==-T?"-0":G}v.exports=N},24007:(v,C,h)=>{var m=h(55589),b=h(5130),w=h(44041),A=h(99835);function T(I,R){return m(I)?I:b(I,R)?[I]:w(A(I))}v.exports=T},1622:(v,C,h)=>{var m=h(84100),b=m["__core-js_shared__"];v.exports=b},20302:(v,C,h)=>{var m=typeof h.g=="object"&&h.g&&h.g.Object===Object&&h.g;v.exports=m},77570:(v,C,h)=>{var m=h(58949);function b(w,A){var T=w.__data__;return m(A)?T[typeof A=="string"?"string":"hash"]:T.map}v.exports=b},65234:(v,C,h)=>{var m=h(99817),b=h(67736);function w(A,T){var I=b(A,T);return m(I)?I:void 0}v.exports=w},91339:(v,C,h)=>{var m=h(70861),b=Object.prototype,w=b.hasOwnProperty,A=b.toString,T=m?m.toStringTag:void 0;function I(R){var N=w.call(R,T),V=R[T];try{R[T]=void 0;var G=!0}catch{}var X=A.call(R);return G&&(N?R[T]=V:delete R[T]),X}v.exports=I},67736:v=>{function C(h,m){return h?.[m]}v.exports=C},34440:(v,C,h)=>{var m=h(24545);function b(){this.__data__=m?m(null):{},this.size=0}v.exports=b},84108:v=>{function C(h){var m=this.has(h)&&delete this.__data__[h];return this.size-=m?1:0,m}v.exports=C},61085:(v,C,h)=>{var m=h(24545),b="__lodash_hash_undefined__",w=Object.prototype,A=w.hasOwnProperty;function T(I){var R=this.__data__;if(m){var N=R[I];return N===b?void 0:N}return A.call(R,I)?R[I]:void 0}v.exports=T},77706:(v,C,h)=>{var m=h(24545),b=Object.prototype,w=b.hasOwnProperty;function A(T){var I=this.__data__;return m?I[T]!==void 0:w.call(I,T)}v.exports=A},8636:(v,C,h)=>{var m=h(24545),b="__lodash_hash_undefined__";function w(A,T){var I=this.__data__;return this.size+=this.has(A)?0:1,I[A]=m&&T===void 0?b:T,this}v.exports=w},5130:(v,C,h)=>{var m=h(55589),b=h(52624),w=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A=/^\w*$/;function T(I,R){if(m(I))return!1;var N=typeof I;return N=="number"||N=="symbol"||N=="boolean"||I==null||b(I)?!0:A.test(I)||!w.test(I)||R!=null&&I in Object(R)}v.exports=T},58949:v=>{function C(h){var m=typeof h;return m=="string"||m=="number"||m=="symbol"||m=="boolean"?h!=="__proto__":h===null}v.exports=C},28597:(v,C,h)=>{var m=h(1622),b=function(){var A=/[^.]+$/.exec(m&&m.keys&&m.keys.IE_PROTO||"");return A?"Symbol(src)_1."+A:""}();function w(A){return!!b&&b in A}v.exports=w},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,h)=>{var m=h(18498),b=Array.prototype,w=b.splice;function A(T){var I=this.__data__,R=m(I,T);if(R<0)return!1;var N=I.length-1;return R==N?I.pop():w.call(I,R,1),--this.size,!0}v.exports=A},45828:(v,C,h)=>{var m=h(18498);function b(w){var A=this.__data__,T=m(A,w);return T<0?void 0:A[T][1]}v.exports=b},24115:(v,C,h)=>{var m=h(18498);function b(w){return m(this.__data__,w)>-1}v.exports=b},67690:(v,C,h)=>{var m=h(18498);function b(w,A){var T=this.__data__,I=m(T,w);return I<0?(++this.size,T.push([w,A])):T[I][1]=A,this}v.exports=b},39016:(v,C,h)=>{var m=h(85208),b=h(81998),w=h(72887);function A(){this.size=0,this.__data__={hash:new m,map:new(w||b),string:new m}}v.exports=A},62363:(v,C,h)=>{var m=h(77570);function b(w){var A=m(this,w).delete(w);return this.size-=A?1:0,A}v.exports=b},64348:(v,C,h)=>{var m=h(77570);function b(w){return m(this,w).get(w)}v.exports=b},53062:(v,C,h)=>{var m=h(77570);function b(w){return m(this,w).has(w)}v.exports=b},30262:(v,C,h)=>{var m=h(77570);function b(w,A){var T=m(this,w),I=T.size;return T.set(w,A),this.size+=T.size==I?0:1,this}v.exports=b},32924:(v,C,h)=>{var m=h(67997),b=500;function w(A){var T=m(A,function(R){return I.size===b&&I.clear(),R}),I=T.cache;return T}v.exports=w},24545:(v,C,h)=>{var m=h(65234),b=m(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,h=C.toString;function m(b){return h.call(b)}v.exports=m},84100:(v,C,h)=>{var m=h(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,w=m||b||Function("return this")();v.exports=w},44041:(v,C,h)=>{var m=h(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,A=m(function(T){var I=[];return T.charCodeAt(0)===46&&I.push(""),T.replace(b,function(R,N,V,G){I.push(V?G.replace(w,"$1"):N||R)}),I});v.exports=A},86040:(v,C,h)=>{var m=h(52624),b=1/0;function w(A){if(typeof A=="string"||m(A))return A;var T=A+"";return T=="0"&&1/A==-b?"-0":T}v.exports=w},55784:v=>{var C=Function.prototype,h=C.toString;function m(b){if(b!=null){try{return h.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=m},58260:v=>{function C(h,m){return h===m||h!==h&&m!==m}v.exports=C},13546:(v,C,h)=>{var m=h(40548);function b(w,A,T){var I=w==null?void 0:m(w,A);return I===void 0?T:I}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,h)=>{var m=h(69823),b=h(93702),w="[object AsyncFunction]",A="[object Function]",T="[object GeneratorFunction]",I="[object Proxy]";function R(N){if(!b(N))return!1;var V=m(N);return V==A||V==T||V==w||V==I}v.exports=R},93702:v=>{function C(h){var m=typeof h;return h!=null&&(m=="object"||m=="function")}v.exports=C},50440:v=>{function C(h){return h!=null&&typeof h=="object"}v.exports=C},52624:(v,C,h)=>{var m=h(69823),b=h(50440),w="[object Symbol]";function A(T){return typeof T=="symbol"||b(T)&&m(T)==w}v.exports=A},67997:(v,C,h)=>{var m=h(95678),b="Expected a function";function w(A,T){if(typeof A!="function"||T!=null&&typeof T!="function")throw new TypeError(b);var I=function(){var R=arguments,N=T?T.apply(this,R):R[0],V=I.cache;if(V.has(N))return V.get(N);var G=A.apply(this,R);return I.cache=V.set(N,G)||V,G};return I.cache=new(w.Cache||m),I}w.Cache=m,v.exports=w},99835:(v,C,h)=>{var m=h(86245);function b(w){return w==null?"":m(w)}v.exports=b},14927:(v,C,h)=>{var m=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&m?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,w=m&&b&&typeof b.get=="function"?b.get:null,A=m&&Map.prototype.forEach,T=typeof Set=="function"&&Set.prototype,I=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,R=T&&I&&typeof I.get=="function"?I.get:null,N=T&&Set.prototype.forEach,V=typeof WeakMap=="function"&&WeakMap.prototype,G=V?WeakMap.prototype.has:null,X=typeof WeakSet=="function"&&WeakSet.prototype,ee=X?WeakSet.prototype.has:null,Z=typeof WeakRef=="function"&&WeakRef.prototype,_=Z?WeakRef.prototype.deref:null,re=Boolean.prototype.valueOf,oe=Object.prototype.toString,B=Function.prototype.toString,te=String.prototype.match,K=String.prototype.slice,ne=String.prototype.replace,ie=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,he=RegExp.prototype.test,H=Array.prototype.concat,J=Array.prototype.join,ue=Array.prototype.slice,ve=Math.floor,be=typeof BigInt=="function"?BigInt.prototype.valueOf:null,we=Object.getOwnPropertySymbols,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,We=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Je=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===We||"symbol")?Symbol.toStringTag:null,Ve=Object.prototype.propertyIsEnumerable,dt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(z){return z.__proto__}:null);function Wt(z,q){if(z===1/0||z===-1/0||z!==z||z&&z>-1e3&&z<1e3||he.call(/e/,q))return q;var Ge=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof z=="number"){var tt=z<0?-ve(-z):ve(z);if(tt!==z){var pt=String(tt),Me=K.call(q,pt.length+1);return ne.call(pt,Ge,"$&_")+"."+ne.call(ne.call(Me,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ne.call(q,Ge,"$&_")}var Mt=h(65710),lr=Mt.custom,qe=xr(lr)?lr:null;v.exports=function z(q,Ge,tt,pt){var Me=Ge||{};if(jr(Me,"quoteStyle")&&Me.quoteStyle!=="single"&&Me.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(jr(Me,"maxStringLength")&&(typeof Me.maxStringLength=="number"?Me.maxStringLength<0&&Me.maxStringLength!==1/0:Me.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var sn=jr(Me,"customInspect")?Me.customInspect:!0;if(typeof sn!="boolean"&&sn!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(jr(Me,"indent")&&Me.indent!==null&&Me.indent!==" "&&!(parseInt(Me.indent,10)===Me.indent&&Me.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(jr(Me,"numericSeparator")&&typeof Me.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Rn=Me.numericSeparator;if(typeof q>"u")return"undefined";if(q===null)return"null";if(typeof q=="boolean")return q?"true":"false";if(typeof q=="string")return Oi(q,Me);if(typeof q=="number"){if(q===0)return 1/0/q>0?"0":"-0";var Xt=String(q);return Rn?Wt(q,Xt):Xt}if(typeof q=="bigint"){var on=String(q)+"n";return Rn?Wt(q,on):on}var Js=typeof Me.depth>"u"?5:Me.depth;if(typeof tt>"u"&&(tt=0),tt>=Js&&Js>0&&typeof q=="object")return Nt(q)?"[Array]":"[Object]";var Jn=Ee(Me,tt);if(typeof pt>"u")pt=[];else if(nn(pt,q)>=0)return"[Circular]";function kr(Qn,rs,yl){if(rs&&(pt=ue.call(pt),pt.push(rs)),yl){var bl={depth:Me.depth};return jr(Me,"quoteStyle")&&(bl.quoteStyle=Me.quoteStyle),z(Qn,bl,tt+1,pt)}return z(Qn,Me,tt+1,pt)}if(typeof q=="function"&&!Ne(q)){var dl=Sr(q),pl=Ie(q,kr);return"[Function"+(dl?": "+dl:" (anonymous)")+"]"+(pl.length>0?" { "+J.call(pl,", ")+" }":"")}if(xr(q)){var Xs=We?ne.call(String(q),/^(Symbol\(.*\))_[^)]*$/,"$1"):ze.call(q);return typeof q=="object"&&!We?Qr(Xs):Xs}if(Kn(q)){for(var Xn="<"+ae.call(String(q.nodeName)),Qi=q.attributes||[],Ei=0;Ei<Qi.length;Ei++)Xn+=" "+Qi[Ei].name+"="+Dt(Tt(Qi[Ei].value),"double",Me);return Xn+=">",q.childNodes&&q.childNodes.length&&(Xn+="..."),Xn+="</"+ae.call(String(q.nodeName))+">",Xn}if(Nt(q)){if(q.length===0)return"[]";var Zi=Ie(q,kr);return Jn&&!et(Zi)?"["+Be(Zi,Jn)+"]":"[ "+J.call(Zi,", ")+" ]"}if(Et(q)){var Qs=Ie(q,kr);return!("cause"in Error.prototype)&&"cause"in q&&!Ve.call(q,"cause")?"{ ["+String(q)+"] "+J.call(H.call("[cause]: "+kr(q.cause),Qs),", ")+" }":Qs.length===0?"["+String(q)+"]":"{ ["+String(q)+"] "+J.call(Qs,", ")+" }"}if(typeof q=="object"&&sn){if(qe&&typeof q[qe]=="function"&&Mt)return Mt(q,{depth:Js-tt});if(sn!=="symbol"&&typeof q.inspect=="function")return q.inspect()}if(wt(q)){var gl=[];return A&&A.call(q,function(Qn,rs){gl.push(kr(rs,q,!0)+" => "+kr(Qn,q))}),Ti("Map",w.call(q),gl,Jn)}if(Dn(q)){var ml=[];return N&&N.call(q,function(Qn){ml.push(kr(Qn,q))}),Ti("Set",R.call(q),ml,Jn)}if(Gn(q))return _n("WeakMap");if(Nn(q))return _n("WeakSet");if(Ci(q))return _n("WeakRef");if(xt(q))return Qr(kr(Number(q)));if(Xr(q))return Qr(kr(be.call(q)));if(Fr(q))return Qr(re.call(q));if(Jt(q))return Qr(kr(String(q)));if(!br(q)&&!Ne(q)){var qi=Ie(q,kr),vl=dt?dt(q)===Object.prototype:q instanceof Object||q.constructor===Object,es=q instanceof Object?"":"null prototype",ts=!vl&&Je&&Object(q)===q&&Je in q?K.call(wr(q),8,-1):es?"Object":"",Nf=vl||typeof q.constructor!="function"?"":q.constructor.name?q.constructor.name+" ":"",Zs=Nf+(ts||es?"["+J.call(H.call([],ts||[],es||[]),": ")+"] ":"");return qi.length===0?Zs+"{}":Jn?Zs+"{"+Be(qi,Jn)+"}":Zs+"{ "+J.call(qi,", ")+" }"}return String(q)};function Dt(z,q,Ge){var tt=(Ge.quoteStyle||q)==="double"?'"':"'";return tt+z+tt}function Tt(z){return ne.call(String(z),/"/g,""")}function Nt(z){return wr(z)==="[object Array]"&&(!Je||!(typeof z=="object"&&Je in z))}function br(z){return wr(z)==="[object Date]"&&(!Je||!(typeof z=="object"&&Je in z))}function Ne(z){return wr(z)==="[object RegExp]"&&(!Je||!(typeof z=="object"&&Je in z))}function Et(z){return wr(z)==="[object Error]"&&(!Je||!(typeof z=="object"&&Je in z))}function Jt(z){return wr(z)==="[object String]"&&(!Je||!(typeof z=="object"&&Je in z))}function xt(z){return wr(z)==="[object Number]"&&(!Je||!(typeof z=="object"&&Je in z))}function Fr(z){return wr(z)==="[object Boolean]"&&(!Je||!(typeof z=="object"&&Je in z))}function xr(z){if(We)return z&&typeof z=="object"&&z instanceof Symbol;if(typeof z=="symbol")return!0;if(!z||typeof z!="object"||!ze)return!1;try{return ze.call(z),!0}catch{}return!1}function Xr(z){if(!z||typeof z!="object"||!be)return!1;try{return be.call(z),!0}catch{}return!1}var Xi=Object.prototype.hasOwnProperty||function(z){return z in this};function jr(z,q){return Xi.call(z,q)}function wr(z){return oe.call(z)}function Sr(z){if(z.name)return z.name;var q=te.call(B.call(z),/^function\s*([\w$]+)/);return q?q[1]:null}function nn(z,q){if(z.indexOf)return z.indexOf(q);for(var Ge=0,tt=z.length;Ge<tt;Ge++)if(z[Ge]===q)return Ge;return-1}function wt(z){if(!w||!z||typeof z!="object")return!1;try{w.call(z);try{R.call(z)}catch{return!0}return z instanceof Map}catch{}return!1}function Gn(z){if(!G||!z||typeof z!="object")return!1;try{G.call(z,G);try{ee.call(z,ee)}catch{return!0}return z instanceof WeakMap}catch{}return!1}function Ci(z){if(!_||!z||typeof z!="object")return!1;try{return _.call(z),!0}catch{}return!1}function Dn(z){if(!R||!z||typeof z!="object")return!1;try{R.call(z);try{w.call(z)}catch{return!0}return z instanceof Set}catch{}return!1}function Nn(z){if(!ee||!z||typeof z!="object")return!1;try{ee.call(z,ee);try{G.call(z,G)}catch{return!0}return z instanceof WeakSet}catch{}return!1}function Kn(z){return!z||typeof z!="object"?!1:typeof HTMLElement<"u"&&z instanceof HTMLElement?!0:typeof z.nodeName=="string"&&typeof z.getAttribute=="function"}function Oi(z,q){if(z.length>q.maxStringLength){var Ge=z.length-q.maxStringLength,tt="... "+Ge+" more character"+(Ge>1?"s":"");return Oi(K.call(z,0,q.maxStringLength),q)+tt}var pt=ne.call(ne.call(z,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Yn);return Dt(pt,"single",q)}function Yn(z){var q=z.charCodeAt(0),Ge={8:"b",9:"t",10:"n",12:"f",13:"r"}[q];return Ge?"\\"+Ge:"\\x"+(q<16?"0":"")+ie.call(q.toString(16))}function Qr(z){return"Object("+z+")"}function _n(z){return z+" { ? }"}function Ti(z,q,Ge,tt){var pt=tt?Be(Ge,tt):J.call(Ge,", ");return z+" ("+q+") {"+pt+"}"}function et(z){for(var q=0;q<z.length;q++)if(nn(z[q],`
|
|
415
|
+
`)>=0)return!1;return!0}function Ee(z,q){var Ge;if(z.indent===" ")Ge=" ";else if(typeof z.indent=="number"&&z.indent>0)Ge=J.call(Array(z.indent+1)," ");else return null;return{base:Ge,prev:J.call(Array(q+1),Ge)}}function Be(z,q){if(z.length===0)return"";var Ge=`
|
|
416
|
+
`+q.prev+q.base;return Ge+J.call(z,","+Ge)+`
|
|
417
|
+
`+q.prev}function Ie(z,q){var Ge=Nt(z),tt=[];if(Ge){tt.length=z.length;for(var pt=0;pt<z.length;pt++)tt[pt]=jr(z,pt)?q(z[pt],z):""}var Me=typeof we=="function"?we(z):[],sn;if(We){sn={};for(var Rn=0;Rn<Me.length;Rn++)sn["$"+Me[Rn]]=Me[Rn]}for(var Xt in z)jr(z,Xt)&&(Ge&&String(Number(Xt))===Xt&&Xt<z.length||We&&sn["$"+Xt]instanceof Symbol||(he.call(/[^\w$]/,Xt)?tt.push(q(Xt,z)+": "+q(z[Xt],z)):tt.push(Xt+": "+q(z[Xt],z))));if(typeof we=="function")for(var on=0;on<Me.length;on++)Ve.call(z,Me[on])&&tt.push("["+q(Me[on])+"]: "+q(z[Me[on]],z));return tt}},83949:v=>{"use strict";var C=String.prototype.replace,h=/%20/g,m={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:m.RFC3986,formatters:{RFC1738:function(b){return C.call(b,h,"+")},RFC3986:function(b){return String(b)}},RFC1738:m.RFC1738,RFC3986:m.RFC3986}},67905:(v,C,h)=>{"use strict";var m=h(85095),b=h(95990),w=h(83949);v.exports={formats:w,parse:b,stringify:m}},95990:(v,C,h)=>{"use strict";var m=h(37748),b=Object.prototype.hasOwnProperty,w=Array.isArray,A={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:m.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},T=function(Z){return Z.replace(/&#(\d+);/g,function(_,re){return String.fromCharCode(parseInt(re,10))})},I=function(Z,_){return Z&&typeof Z=="string"&&_.comma&&Z.indexOf(",")>-1?Z.split(","):Z},R="utf8=%26%2310003%3B",N="utf8=%E2%9C%93",V=function(_,re){var oe={__proto__:null},B=re.ignoreQueryPrefix?_.replace(/^\?/,""):_,te=re.parameterLimit===1/0?void 0:re.parameterLimit,K=B.split(re.delimiter,te),ne=-1,ie,ae=re.charset;if(re.charsetSentinel)for(ie=0;ie<K.length;++ie)K[ie].indexOf("utf8=")===0&&(K[ie]===N?ae="utf-8":K[ie]===R&&(ae="iso-8859-1"),ne=ie,ie=K.length);for(ie=0;ie<K.length;++ie)if(ie!==ne){var he=K[ie],H=he.indexOf("]="),J=H===-1?he.indexOf("="):H+1,ue,ve;J===-1?(ue=re.decoder(he,A.decoder,ae,"key"),ve=re.strictNullHandling?null:""):(ue=re.decoder(he.slice(0,J),A.decoder,ae,"key"),ve=m.maybeMap(I(he.slice(J+1),re),function(be){return re.decoder(be,A.decoder,ae,"value")})),ve&&re.interpretNumericEntities&&ae==="iso-8859-1"&&(ve=T(ve)),he.indexOf("[]=")>-1&&(ve=w(ve)?[ve]:ve),b.call(oe,ue)?oe[ue]=m.combine(oe[ue],ve):oe[ue]=ve}return oe},G=function(Z,_,re,oe){for(var B=oe?_:I(_,re),te=Z.length-1;te>=0;--te){var K,ne=Z[te];if(ne==="[]"&&re.parseArrays)K=[].concat(B);else{K=re.plainObjects?Object.create(null):{};var ie=ne.charAt(0)==="["&&ne.charAt(ne.length-1)==="]"?ne.slice(1,-1):ne,ae=parseInt(ie,10);!re.parseArrays&&ie===""?K={0:B}:!isNaN(ae)&&ne!==ie&&String(ae)===ie&&ae>=0&&re.parseArrays&&ae<=re.arrayLimit?(K=[],K[ae]=B):ie!=="__proto__"&&(K[ie]=B)}B=K}return B},X=function(_,re,oe,B){if(_){var te=oe.allowDots?_.replace(/\.([^.[]+)/g,"[$1]"):_,K=/(\[[^[\]]*])/,ne=/(\[[^[\]]*])/g,ie=oe.depth>0&&K.exec(te),ae=ie?te.slice(0,ie.index):te,he=[];if(ae){if(!oe.plainObjects&&b.call(Object.prototype,ae)&&!oe.allowPrototypes)return;he.push(ae)}for(var H=0;oe.depth>0&&(ie=ne.exec(te))!==null&&H<oe.depth;){if(H+=1,!oe.plainObjects&&b.call(Object.prototype,ie[1].slice(1,-1))&&!oe.allowPrototypes)return;he.push(ie[1])}return ie&&he.push("["+te.slice(ie.index)+"]"),G(he,re,oe,B)}},ee=function(_){if(!_)return A;if(_.decoder!==null&&_.decoder!==void 0&&typeof _.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof _.charset<"u"&&_.charset!=="utf-8"&&_.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var re=typeof _.charset>"u"?A.charset:_.charset;return{allowDots:typeof _.allowDots>"u"?A.allowDots:!!_.allowDots,allowPrototypes:typeof _.allowPrototypes=="boolean"?_.allowPrototypes:A.allowPrototypes,allowSparse:typeof _.allowSparse=="boolean"?_.allowSparse:A.allowSparse,arrayLimit:typeof _.arrayLimit=="number"?_.arrayLimit:A.arrayLimit,charset:re,charsetSentinel:typeof _.charsetSentinel=="boolean"?_.charsetSentinel:A.charsetSentinel,comma:typeof _.comma=="boolean"?_.comma:A.comma,decoder:typeof _.decoder=="function"?_.decoder:A.decoder,delimiter:typeof _.delimiter=="string"||m.isRegExp(_.delimiter)?_.delimiter:A.delimiter,depth:typeof _.depth=="number"||_.depth===!1?+_.depth:A.depth,ignoreQueryPrefix:_.ignoreQueryPrefix===!0,interpretNumericEntities:typeof _.interpretNumericEntities=="boolean"?_.interpretNumericEntities:A.interpretNumericEntities,parameterLimit:typeof _.parameterLimit=="number"?_.parameterLimit:A.parameterLimit,parseArrays:_.parseArrays!==!1,plainObjects:typeof _.plainObjects=="boolean"?_.plainObjects:A.plainObjects,strictNullHandling:typeof _.strictNullHandling=="boolean"?_.strictNullHandling:A.strictNullHandling}};v.exports=function(Z,_){var re=ee(_);if(Z===""||Z===null||typeof Z>"u")return re.plainObjects?Object.create(null):{};for(var oe=typeof Z=="string"?V(Z,re):Z,B=re.plainObjects?Object.create(null):{},te=Object.keys(oe),K=0;K<te.length;++K){var ne=te[K],ie=X(ne,oe[ne],re,typeof Z=="string");B=m.merge(B,ie,re)}return re.allowSparse===!0?B:m.compact(B)}},85095:(v,C,h)=>{"use strict";var m=h(44852),b=h(37748),w=h(83949),A=Object.prototype.hasOwnProperty,T={brackets:function(B){return B+"[]"},comma:"comma",indices:function(B,te){return B+"["+te+"]"},repeat:function(B){return B}},I=Array.isArray,R=Array.prototype.push,N=function(oe,B){R.apply(oe,I(B)?B:[B])},V=Date.prototype.toISOString,G=w.default,X={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:G,formatter:w.formatters[G],indices:!1,serializeDate:function(B){return V.call(B)},skipNulls:!1,strictNullHandling:!1},ee=function(B){return typeof B=="string"||typeof B=="number"||typeof B=="boolean"||typeof B=="symbol"||typeof B=="bigint"},Z={},_=function oe(B,te,K,ne,ie,ae,he,H,J,ue,ve,be,we,ze,We,Je){for(var Ve=B,dt=Je,Wt=0,Mt=!1;(dt=dt.get(Z))!==void 0&&!Mt;){var lr=dt.get(B);if(Wt+=1,typeof lr<"u"){if(lr===Wt)throw new RangeError("Cyclic object value");Mt=!0}typeof dt.get(Z)>"u"&&(Wt=0)}if(typeof H=="function"?Ve=H(te,Ve):Ve instanceof Date?Ve=ve(Ve):K==="comma"&&I(Ve)&&(Ve=b.maybeMap(Ve,function(xr){return xr instanceof Date?ve(xr):xr})),Ve===null){if(ie)return he&&!ze?he(te,X.encoder,We,"key",be):te;Ve=""}if(ee(Ve)||b.isBuffer(Ve)){if(he){var qe=ze?te:he(te,X.encoder,We,"key",be);return[we(qe)+"="+we(he(Ve,X.encoder,We,"value",be))]}return[we(te)+"="+we(String(Ve))]}var Dt=[];if(typeof Ve>"u")return Dt;var Tt;if(K==="comma"&&I(Ve))ze&&he&&(Ve=b.maybeMap(Ve,he)),Tt=[{value:Ve.length>0?Ve.join(",")||null:void 0}];else if(I(H))Tt=H;else{var Nt=Object.keys(Ve);Tt=J?Nt.sort(J):Nt}for(var br=ne&&I(Ve)&&Ve.length===1?te+"[]":te,Ne=0;Ne<Tt.length;++Ne){var Et=Tt[Ne],Jt=typeof Et=="object"&&typeof Et.value<"u"?Et.value:Ve[Et];if(!(ae&&Jt===null)){var xt=I(Ve)?typeof K=="function"?K(br,Et):br:br+(ue?"."+Et:"["+Et+"]");Je.set(B,Wt);var Fr=m();Fr.set(Z,Je),N(Dt,oe(Jt,xt,K,ne,ie,ae,K==="comma"&&ze&&I(Ve)?null:he,H,J,ue,ve,be,we,ze,We,Fr))}}return Dt},re=function(B){if(!B)return X;if(B.encoder!==null&&typeof B.encoder<"u"&&typeof B.encoder!="function")throw new TypeError("Encoder has to be a function.");var te=B.charset||X.charset;if(typeof B.charset<"u"&&B.charset!=="utf-8"&&B.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var K=w.default;if(typeof B.format<"u"){if(!A.call(w.formatters,B.format))throw new TypeError("Unknown format option provided.");K=B.format}var ne=w.formatters[K],ie=X.filter;return(typeof B.filter=="function"||I(B.filter))&&(ie=B.filter),{addQueryPrefix:typeof B.addQueryPrefix=="boolean"?B.addQueryPrefix:X.addQueryPrefix,allowDots:typeof B.allowDots>"u"?X.allowDots:!!B.allowDots,charset:te,charsetSentinel:typeof B.charsetSentinel=="boolean"?B.charsetSentinel:X.charsetSentinel,delimiter:typeof B.delimiter>"u"?X.delimiter:B.delimiter,encode:typeof B.encode=="boolean"?B.encode:X.encode,encoder:typeof B.encoder=="function"?B.encoder:X.encoder,encodeValuesOnly:typeof B.encodeValuesOnly=="boolean"?B.encodeValuesOnly:X.encodeValuesOnly,filter:ie,format:K,formatter:ne,serializeDate:typeof B.serializeDate=="function"?B.serializeDate:X.serializeDate,skipNulls:typeof B.skipNulls=="boolean"?B.skipNulls:X.skipNulls,sort:typeof B.sort=="function"?B.sort:null,strictNullHandling:typeof B.strictNullHandling=="boolean"?B.strictNullHandling:X.strictNullHandling}};v.exports=function(oe,B){var te=oe,K=re(B),ne,ie;typeof K.filter=="function"?(ie=K.filter,te=ie("",te)):I(K.filter)&&(ie=K.filter,ne=ie);var ae=[];if(typeof te!="object"||te===null)return"";var he;B&&B.arrayFormat in T?he=B.arrayFormat:B&&"indices"in B?he=B.indices?"indices":"repeat":he="indices";var H=T[he];if(B&&"commaRoundTrip"in B&&typeof B.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var J=H==="comma"&&B&&B.commaRoundTrip;ne||(ne=Object.keys(te)),K.sort&&ne.sort(K.sort);for(var ue=m(),ve=0;ve<ne.length;++ve){var be=ne[ve];K.skipNulls&&te[be]===null||N(ae,_(te[be],be,H,J,K.strictNullHandling,K.skipNulls,K.encode?K.encoder:null,K.filter,K.sort,K.allowDots,K.serializeDate,K.format,K.formatter,K.encodeValuesOnly,K.charset,ue))}var we=ae.join(K.delimiter),ze=K.addQueryPrefix===!0?"?":"";return K.charsetSentinel&&(K.charset==="iso-8859-1"?ze+="utf8=%26%2310003%3B&":ze+="utf8=%E2%9C%93&"),we.length>0?ze+we:""}},37748:(v,C,h)=>{"use strict";var m=h(83949),b=Object.prototype.hasOwnProperty,w=Array.isArray,A=function(){for(var oe=[],B=0;B<256;++B)oe.push("%"+((B<16?"0":"")+B.toString(16)).toUpperCase());return oe}(),T=function(B){for(;B.length>1;){var te=B.pop(),K=te.obj[te.prop];if(w(K)){for(var ne=[],ie=0;ie<K.length;++ie)typeof K[ie]<"u"&&ne.push(K[ie]);te.obj[te.prop]=ne}}},I=function(B,te){for(var K=te&&te.plainObjects?Object.create(null):{},ne=0;ne<B.length;++ne)typeof B[ne]<"u"&&(K[ne]=B[ne]);return K},R=function oe(B,te,K){if(!te)return B;if(typeof te!="object"){if(w(B))B.push(te);else if(B&&typeof B=="object")(K&&(K.plainObjects||K.allowPrototypes)||!b.call(Object.prototype,te))&&(B[te]=!0);else return[B,te];return B}if(!B||typeof B!="object")return[B].concat(te);var ne=B;return w(B)&&!w(te)&&(ne=I(B,K)),w(B)&&w(te)?(te.forEach(function(ie,ae){if(b.call(B,ae)){var he=B[ae];he&&typeof he=="object"&&ie&&typeof ie=="object"?B[ae]=oe(he,ie,K):B.push(ie)}else B[ae]=ie}),B):Object.keys(te).reduce(function(ie,ae){var he=te[ae];return b.call(ie,ae)?ie[ae]=oe(ie[ae],he,K):ie[ae]=he,ie},ne)},N=function(B,te){return Object.keys(te).reduce(function(K,ne){return K[ne]=te[ne],K},B)},V=function(oe,B,te){var K=oe.replace(/\+/g," ");if(te==="iso-8859-1")return K.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(K)}catch{return K}},G=function(B,te,K,ne,ie){if(B.length===0)return B;var ae=B;if(typeof B=="symbol"?ae=Symbol.prototype.toString.call(B):typeof B!="string"&&(ae=String(B)),K==="iso-8859-1")return escape(ae).replace(/%u[0-9a-f]{4}/gi,function(ue){return"%26%23"+parseInt(ue.slice(2),16)+"%3B"});for(var he="",H=0;H<ae.length;++H){var J=ae.charCodeAt(H);if(J===45||J===46||J===95||J===126||J>=48&&J<=57||J>=65&&J<=90||J>=97&&J<=122||ie===m.RFC1738&&(J===40||J===41)){he+=ae.charAt(H);continue}if(J<128){he=he+A[J];continue}if(J<2048){he=he+(A[192|J>>6]+A[128|J&63]);continue}if(J<55296||J>=57344){he=he+(A[224|J>>12]+A[128|J>>6&63]+A[128|J&63]);continue}H+=1,J=65536+((J&1023)<<10|ae.charCodeAt(H)&1023),he+=A[240|J>>18]+A[128|J>>12&63]+A[128|J>>6&63]+A[128|J&63]}return he},X=function(B){for(var te=[{obj:{o:B},prop:"o"}],K=[],ne=0;ne<te.length;++ne)for(var ie=te[ne],ae=ie.obj[ie.prop],he=Object.keys(ae),H=0;H<he.length;++H){var J=he[H],ue=ae[J];typeof ue=="object"&&ue!==null&&K.indexOf(ue)===-1&&(te.push({obj:ae,prop:J}),K.push(ue))}return T(te),B},ee=function(B){return Object.prototype.toString.call(B)==="[object RegExp]"},Z=function(B){return!B||typeof B!="object"?!1:!!(B.constructor&&B.constructor.isBuffer&&B.constructor.isBuffer(B))},_=function(B,te){return[].concat(B,te)},re=function(B,te){if(w(B)){for(var K=[],ne=0;ne<B.length;ne+=1)K.push(te(B[ne]));return K}return te(B)};v.exports={arrayToObject:I,assign:N,combine:_,compact:X,decode:V,encode:G,isBuffer:Z,isRegExp:ee,maybeMap:re,merge:R}},56053:(v,C,h)=>{"use strict";var m;/**
|
|
416
418
|
* @license React
|
|
417
419
|
* react-jsx-runtime.production.min.js
|
|
418
420
|
*
|
|
@@ -420,4 +422,4 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function BP(r){return r.i
|
|
|
420
422
|
*
|
|
421
423
|
* This source code is licensed under the MIT license found in the
|
|
422
424
|
* LICENSE file in the root directory of this source tree.
|
|
423
|
-
*/var b=
|
|
425
|
+
*/var b=h(52983),w=Symbol.for("react.element"),A=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,I=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,R={key:!0,ref:!0,__self:!0,__source:!0};function N(V,G,X){var ee,Z={},_=null,re=null;X!==void 0&&(_=""+X),G.key!==void 0&&(_=""+G.key),G.ref!==void 0&&(re=G.ref);for(ee in G)T.call(G,ee)&&!R.hasOwnProperty(ee)&&(Z[ee]=G[ee]);if(V&&V.defaultProps)for(ee in G=V.defaultProps,G)Z[ee]===void 0&&(Z[ee]=G[ee]);return{$$typeof:w,type:V,key:_,ref:re,props:Z,_owner:I.current}}m=A,C.jsx=N,m=N},97458:(v,C,h)=>{"use strict";v.exports=h(56053)},44852:(v,C,h)=>{"use strict";var m=h(71013),b=h(2864),w=h(14927),A=m("%TypeError%"),T=m("%WeakMap%",!0),I=m("%Map%",!0),R=b("WeakMap.prototype.get",!0),N=b("WeakMap.prototype.set",!0),V=b("WeakMap.prototype.has",!0),G=b("Map.prototype.get",!0),X=b("Map.prototype.set",!0),ee=b("Map.prototype.has",!0),Z=function(B,te){for(var K=B,ne;(ne=K.next)!==null;K=ne)if(ne.key===te)return K.next=ne.next,ne.next=B.next,B.next=ne,ne},_=function(B,te){var K=Z(B,te);return K&&K.value},re=function(B,te,K){var ne=Z(B,te);ne?ne.value=K:B.next={key:te,next:B.next,value:K}},oe=function(B,te){return!!Z(B,te)};v.exports=function(){var te,K,ne,ie={assert:function(ae){if(!ie.has(ae))throw new A("Side channel does not contain "+w(ae))},get:function(ae){if(T&&ae&&(typeof ae=="object"||typeof ae=="function")){if(te)return R(te,ae)}else if(I){if(K)return G(K,ae)}else if(ne)return _(ne,ae)},has:function(ae){if(T&&ae&&(typeof ae=="object"||typeof ae=="function")){if(te)return V(te,ae)}else if(I){if(K)return ee(K,ae)}else if(ne)return oe(ne,ae);return!1},set:function(ae,he){T&&ae&&(typeof ae=="object"||typeof ae=="function")?(te||(te=new T),N(te,ae,he)):I?(K||(K=new I),X(K,ae,he)):(ne||(ne={key:{},next:null}),re(ne,ae,he))}};return ie}},65710:()=>{},93652:(v,C,h)=>{v.exports=h(24018)},10017:(v,C,h)=>{v.exports=h(27411)},34961:(v,C,h)=>{v.exports=h(79155)},86751:(v,C,h)=>{v.exports=h(13375)},12953:(v,C,h)=>{v.exports=h(95442)},11099:(v,C,h)=>{v.exports=h(55334)},86351:(v,C,h)=>{v.exports=h(48261)},70762:(v,C,h)=>{v.exports=h(92864)},10954:(v,C,h)=>{v.exports=h(27923)},55839:(v,C,h)=>{v.exports=h(89225)},23422:(v,C,h)=>{v.exports=h(95281)},47319:(v,C,h)=>{v.exports=h(55468)}}]);
|