@redocly/openapi-docs 3.0.0-alpha.78 → 3.0.0-alpha.79
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 +115 -114
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-openapi-docs.min.js +363 -362
- package/package.json +3 -3
|
@@ -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.79"
|
|
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(I,B){if(typeof I!="string")throw new TypeError("argument str must be a string");for(var z={},Y=B||{},_=Y.decode||k,X=0;X<I.length;){var G=I.indexOf("=",X);if(G===-1)break;var te=I.indexOf(";",X);if(te===-1)te=I.length;else if(te<G){X=I.lastIndexOf(";",G-1)+1;continue}var se=I.slice(X,G).trim();if(z[se]===void 0){var R=I.slice(G+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),z[se]=N(R,_)}X=te+1}return z}function x(I,B,z){var Y=z||{},_=Y.encode||O;if(typeof _!="function")throw new TypeError("option encode is invalid");if(!g.test(I))throw new TypeError("argument name is invalid");var X=_(B);if(X&&!g.test(X))throw new TypeError("argument val is invalid");var G=I+"="+X;if(Y.maxAge!=null){var te=Y.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");G+="; Max-Age="+Math.floor(te)}if(Y.domain){if(!g.test(Y.domain))throw new TypeError("option domain is invalid");G+="; Domain="+Y.domain}if(Y.path){if(!g.test(Y.path))throw new TypeError("option path is invalid");G+="; Path="+Y.path}if(Y.expires){var se=Y.expires;if(!E(se)||isNaN(se.valueOf()))throw new TypeError("option expires is invalid");G+="; Expires="+se.toUTCString()}if(Y.httpOnly&&(G+="; HttpOnly"),Y.secure&&(G+="; Secure"),Y.priority){var R=typeof Y.priority=="string"?Y.priority.toLowerCase():Y.priority;switch(R){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(Y.sameSite){var ee=typeof Y.sameSite=="string"?Y.sameSite.toLowerCase():Y.sameSite;switch(ee){case!0:G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"strict":G+="; SameSite=Strict";break;case"none":G+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return G}function k(I){return I.indexOf("%")!==-1?decodeURIComponent(I):I}function O(I){return encodeURIComponent(I)}function E(I){return f.call(I)==="[object Date]"||I instanceof Date}function N(I,B){try{return B(I)}catch{return I}}},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,E){return b.defineProperties(O,E)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,E,N){return b.defineProperty(O,E,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,E){return b.getOwnPropertyDescriptor(O,E)};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(E,N,I){var B=g(E),z=x(B),Y=b(I,z),_;if(O&&N!=N){for(;z>Y;)if(_=B[Y++],_!=_)return!0}else for(;z>Y;Y++)if((O||Y in B)&&B[Y]===N)return O||Y||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),E=f(69573),N=b([].push),I=function(B){var z=B==1,Y=B==2,_=B==3,X=B==4,G=B==6,te=B==7,se=B==5||G;return function(R,ee,U,re){for(var ne=k(R),ae=x(ne),ce=g(ee,U),V=O(ae),K=0,le=re||E,pe=z?le(R,V):Y||te?le(R,0):void 0,ge,me;V>K;K++)if((se||K in ae)&&(ge=ae[K],me=ce(ge,K,ne),B))if(z)pe[K]=me;else if(me)switch(B){case 3:return!0;case 5:return ge;case 6:return K;case 2:N(pe,ge)}else switch(B){case 4:return!1;case 7:N(pe,ge)}return G?-1:_||X?X:pe}};v.exports={forEach:I(0),map:I(1),filter:I(2),some:I(3),every:I(4),find:I(5),findIndex:I(6),filterReject:I(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 E=[],N=E.constructor={};return N[k]=function(){return{foo:1}},E[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(E,N,I){for(var B=b(E),z=g(N,B),Y=g(I===void 0?B:I,B),_=k(O(Y-z,0)),X=0;z<Y;z++,X++)x(_,X,E[z]);return _.length=X,_}},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"),E=Array;v.exports=function(N){var I;return g(N)&&(I=N.constructor,b(I)&&(I===E||g(I.prototype))?I=void 0:x(I)&&(I=I[O],I===null&&(I=void 0))),I===void 0?E:I}},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"),E=Object,N=x(function(){return arguments}())=="Arguments",I=function(B,z){try{return B[z]}catch{}};v.exports=g?x:function(B){var z,Y,_;return B===void 0?"Undefined":B===null?"Null":typeof(Y=I(z=E(B),O))=="string"?Y:N?x(z):(_=x(z))=="Object"&&b(z.callee)?"Arguments":_}},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,E){return b.f(k,O,x(1,E))}:function(k,O,E){return k[O]=E,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,E){var N=g(O);N in k?b.f(k,N,x(0,E)):k[N]=E}},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,E=O&&O.v8,N,I;E&&(N=E.split("."),I=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!I&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(I=+N[1]))),v.exports=I},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,E=f(51585),N=f(59921),I=f(7416),B=f(20410),z=f(18768),Y=function(_){var X=function(G,te,se){if(this instanceof X){switch(arguments.length){case 0:return new _;case 1:return new _(G);case 2:return new _(G,te)}return new _(G,te,se)}return b(_,this,arguments)};return X.prototype=_.prototype,X};v.exports=function(_,X){var G=_.target,te=_.global,se=_.stat,R=_.proto,ee=te?g:se?g[G]:(g[G]||{}).prototype,U=te?N:N[G]||B(N,G,{})[G],re=U.prototype,ne,ae,ce,V,K,le,pe,ge,me;for(V in X)ne=E(te?V:G+(se?".":"#")+V,_.forced),ae=!ne&&ee&&z(ee,V),le=U[V],ae&&(_.dontCallGetSet?(me=O(ee,V),pe=me&&me.value):pe=ee[V]),K=ae&&pe?pe:X[V],!(ae&&typeof le==typeof K)&&(_.bind&&ae?ge=I(K,g):_.wrap&&ae?ge=Y(K):R&&k(K)?ge=x(K):ge=K,(_.sham||K&&K.sham||le&&le.sham)&&B(ge,"sham",!0),B(U,V,ge),R&&(ce=G+"Prototype",z(N,ce)||B(N,ce,{}),B(N[ce],V,K),_.real&&re&&(ne||!re[V])&&B(re,V,K)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,E){return b(O),E===void 0?O:x?k(O,E):function(){return O.apply(E,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"),E=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:E,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,E){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][E]||b[O]&&b[O][E]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),E=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var I=N.length,B=[],z=0;z<I;z++){var Y=N[z];typeof Y=="string"?E(B,Y):(typeof Y=="number"||k(Y)=="Number"||k(Y)=="String")&&E(B,O(Y))}var _=B.length,X=!0;return function(G,te){if(X)return X=!1,te;if(b(this))return te;for(var se=0;se<_;se++)if(B[se]===G)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,E){return x(b(O),E)}},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(E){return x(E)=="String"?O(E,""):k(E)}: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),E=f(70716),N=f(4580),I=f(13477),B="Object already initialized",z=b.TypeError,Y=b.WeakMap,_,X,G,te=function(U){return G(U)?X(U):_(U,{})},se=function(U){return function(re){var ne;if(!x(re)||(ne=X(re)).type!==U)throw z("Incompatible receiver, "+U+" required");return ne}};if(g||E.state){var R=E.state||(E.state=new Y);R.get=R.get,R.has=R.has,R.set=R.set,_=function(U,re){if(R.has(U))throw z(B);return re.facade=U,R.set(U,re),re},X=function(U){return R.get(U)||{}},G=function(U){return R.has(U)}}else{var ee=N("state");I[ee]=!0,_=function(U,re){if(O(U,ee))throw z(B);return re.facade=U,k(U,ee,re),re},X=function(U){return O(U,ee)?U[ee]:{}},G=function(U){return O(U,ee)}}v.exports={set:_,get:X,has:G,enforce:te,getterFor:se}},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),E=f(41524),N=function(){},I=[],B=O("Reflect","construct"),z=/^\s*(?:class|function)\b/,Y=g(z.exec),_=!z.exec(N),X=function(se){if(!x(se))return!1;try{return B(N,I,se),!0}catch{return!1}},G=function(se){if(!x(se))return!1;switch(k(se)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _||!!Y(z,E(se))}catch{return!0}};G.sham=!0,v.exports=!B||b(function(){var te;return X(X.call)||!X(Object)||!X(function(){te=!0})||te})?G:X},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(B,z){var Y=E[O(B)];return Y==I?!0:Y==N?!1:b(z)?g(z):!!z},O=k.normalize=function(B){return String(B).replace(x,".").toLowerCase()},E=k.data={},N=k.NATIVE="N",I=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(E){return typeof E=="symbol"}:function(E){var N=g("Symbol");return b(N)&&x(N.prototype,O(E))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),E=function(){return this};v.exports=function(N,I,B,z){var Y=I+" Iterator";return N.prototype=b(g,{next:x(+!z,B)}),k(N,Y,!1,!0),O[Y]=E,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),E=f(41709),N=f(90851),I=f(70738),B=f(98889),z=f(20410),Y=f(27519),_=f(33538),X=f(94609),G=f(98488),te=k.PROPER,se=k.CONFIGURABLE,R=G.IteratorPrototype,ee=G.BUGGY_SAFARI_ITERATORS,U=_("iterator"),re="keys",ne="values",ae="entries",ce=function(){return this};v.exports=function(V,K,le,pe,ge,me,$e){E(le,K,pe);var Ve=function(Ot){if(Ot===ge&&At)return At;if(!ee&&Ot in at)return at[Ot];switch(Ot){case re:return function(){return new le(this,Ot)};case ne:return function(){return new le(this,Ot)};case ae:return function(){return new le(this,Ot)}}return function(){return new le(this)}},Ye=K+" Iterator",Fe=!1,at=V.prototype,Dt=at[U]||at["@@iterator"]||ge&&at[ge],At=!ee&&Dt||Ve(ge),qt=K=="Array"&&at.entries||Dt,Xe,Ct,xt;if(qt&&(Xe=N(qt.call(new V)),Xe!==Object.prototype&&Xe.next&&(!x&&N(Xe)!==R&&(I?I(Xe,R):O(Xe[U])||Y(Xe,U,ce)),B(Xe,Ye,!0,!0),x&&(X[Ye]=ce))),te&&ge==ne&&Dt&&Dt.name!==ne&&(!x&&se?z(at,"name",ne):(Fe=!0,At=function(){return b(Dt,this)})),ge)if(Ct={values:Ve(ne),keys:me?At:Ve(re),entries:Ve(ae)},$e)for(xt in Ct)(ee||Fe||!(xt in at))&&Y(at,xt,Ct[xt]);else g({target:K,proto:!0,forced:ee||Fe},Ct);return(!x||$e)&&at[U]!==At&&Y(at,U,At,{name:ge}),X[K]=At,Ct}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),E=f(27519),N=f(33538),I=f(39839),B=N("iterator"),z=!1,Y,_,X;[].keys&&(X=[].keys(),"next"in X?(_=O(O(X)),_!==Object.prototype&&(Y=_)):z=!0);var G=!x(Y)||g(function(){var te={};return Y[B].call(te)!==te});G?Y={}:I&&(Y=k(Y)),b(Y[B])||E(Y,B,function(){return this}),v.exports={IteratorPrototype:Y,BUGGY_SAFARI_ITERATORS:z}},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),E=f(45511),N=f(4580),I=">",B="<",z="prototype",Y="script",_=N("IE_PROTO"),X=function(){},G=function(U){return B+Y+I+U+B+"/"+Y+I},te=function(U){U.write(G("")),U.close();var re=U.parentWindow.Object;return U=null,re},se=function(){var U=E("iframe"),re="java"+Y+":",ne;return U.style.display="none",O.appendChild(U),U.src=String(re),ne=U.contentWindow.document,ne.open(),ne.write(G("document.F=Object")),ne.close(),ne.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):se():te(R);for(var U=x.length;U--;)delete ee[z][x[U]];return ee()};k[_]=!0,v.exports=Object.create||function(re,ne){var ae;return re!==null?(X[z]=g(re),ae=new X,X[z]=null,ae[_]=re):ae=ee(),ne===void 0?ae:b.f(ae,ne)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),E=f(16619);C.f=g&&!b?Object.defineProperties:function(I,B){k(I);for(var z=O(B),Y=E(B),_=Y.length,X=0,G;_>X;)x.f(I,G=Y[X++],z[G]);return I}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),E=TypeError,N=Object.defineProperty,I=Object.getOwnPropertyDescriptor,B="enumerable",z="configurable",Y="writable";C.f=g?x?function(X,G,te){if(k(X),G=O(G),k(te),typeof X=="function"&&G==="prototype"&&"value"in te&&Y in te&&!te[Y]){var se=I(X,G);se&&se[Y]&&(X[G]=te.value,te={configurable:z in te?te[z]:se[z],enumerable:B in te?te[B]:se[B],writable:!1})}return N(X,G,te)}:N:function(X,G,te){if(k(X),G=O(G),k(te),b)try{return N(X,G,te)}catch{}if("get"in te||"set"in te)throw E("Accessors not supported");return"value"in te&&(X[G]=te.value),X}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),E=f(5135),N=f(18768),I=f(11314),B=Object.getOwnPropertyDescriptor;C.f=g?B:function(Y,_){if(Y=O(Y),_=E(_),I)try{return B(Y,_)}catch{}if(N(Y,_))return k(!b(x.f,Y,_),Y[_])}},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):[],E=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(I){return O&&g(I)=="Window"?E(I):x(b(I))}},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),E=k("IE_PROTO"),N=Object,I=N.prototype;v.exports=O?N.getPrototypeOf:function(B){var z=x(B);if(g(z,E))return z[E];var Y=z.constructor;return b(Y)&&z instanceof Y?Y.prototype:z instanceof N?I: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),E=g([].push);v.exports=function(N,I){var B=x(N),z=0,Y=[],_;for(_ in B)!b(O,_)&&b(B,_)&&E(Y,_);for(;I.length>z;)b(B,_=I[z++])&&(~k(Y,_)||E(Y,_));return Y}},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={},E;try{E=g(Object.prototype,"__proto__","set"),E(O,[]),k=O instanceof Array}catch{}return function(I,B){return b(I),x(B),k?E(I,B):I.__proto__=B,I}}():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,E){var N,I;if(E==="string"&&b(N=O.toString)&&!x(I=g(N,O))||b(N=O.valueOf)&&!x(I=g(N,O))||E!=="string"&&b(N=O.toString)&&!x(I=g(N,O)))return I;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),E=b([].concat);v.exports=g("Reflect","ownKeys")||function(I){var B=x.f(O(I)),z=k.f;return z?E(B,z(I)):B}},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),E=f(33538),N=E("toStringTag");v.exports=function(I,B,z,Y){if(I){var _=z?I:I.prototype;k(_,N)||b(_,N,{configurable:!0,value:B}),Y&&!g&&x(_,"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),E=g("".charCodeAt),N=g("".slice),I=function(B){return function(z,Y){var _=x(k(z)),X=b(Y),G=_.length,te,se;return X<0||X>=G?B?"":void 0:(te=E(_,X),te<55296||te>56319||X+1===G||(se=E(_,X+1))<56320||se>57343?B?O(_,X):te:B?N(_,X,X+2):(te-55296<<10)+(se-56320)+65536)}};v.exports={codeAt:I(!1),charAt:I(!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"),E=O&&O.prototype,N=E&&E.valueOf,I=x("toPrimitive");E&&!E[I]&&k(E,I,function(B){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 E=g(k);return E<0?b(E+O,0):x(E,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),E=f(33538),N=TypeError,I=E("toPrimitive");v.exports=function(B,z){if(!b(B)||x(B))return B;var Y=k(B,I),_;if(Y){if(z===void 0&&(z="default"),_=g(Y,B,z),!b(_)||x(_))return _;throw N("Can't convert object to primitive value")}return z===void 0&&(z="number"),O(B,z)}},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 E=g.Symbol||(g.Symbol={});b(E,O)||k(E,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),E=f(27237),N=g.Symbol,I=b("wks"),B=E?N.for||N:N&&N.withoutSetter||k;v.exports=function(z){return x(I,z)||(I[z]=O&&x(N,z)?N[z]:B("Symbol."+z)),I[z]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),E=f(53387),N=f(11452),I=f(53437),B=f(69573),z=f(36844),Y=f(33538),_=f(32438),X=Y("isConcatSpreadable"),G=_>=51||!b(function(){var R=[];return R[X]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[X];return ee!==void 0?!!ee:x(R)},se=!G||!z("concat");g({target:"Array",proto:!0,arity:1,forced:se},{concat:function(ee){var U=O(this),re=B(U,0),ne=0,ae,ce,V,K,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?U:arguments[ae],te(le))for(K=E(le),N(ne+K),ce=0;ce<K;ce++,ne++)ce in le&&I(re,ne,le[ce]);else N(ne+1),I(re,ne++,le);return re.length=ne,re}})},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(E){return b(this,E,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),E=!!O&&1/O([1],1,-0)<0,N=E||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(B){var z=arguments.length>1?arguments[1]:void 0;return E?O(this,B,z)||0:x(this,B,z)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,E=f(78107),N=f(10248),I=f(39839),B=f(56049),z="Array Iterator",Y=k.set,_=k.getterFor(z);v.exports=E(Array,"Array",function(G,te){Y(this,{type:z,target:g(G),index:0,kind:te})},function(){var G=_(this),te=G.target,se=G.kind,R=G.index++;return!te||R>=te.length?(G.target=void 0,N(void 0,!0)):se=="keys"?N(R,!1):se=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var X=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!I&&B&&X.name!=="values")try{O(X,"name",{value:"values"})}catch{}},91667:()=>{},9754:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),E=f(31982),N=f(43152),I=f(28609),B=f(53160),z=f(82850),Y=f(71775),_=String,X=b("JSON","stringify"),G=O(/./.exec),te=O("".charAt),se=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),U=/[\uD800-\uDFFF]/g,re=/^[\uD800-\uDBFF]$/,ne=/^[\uDC00-\uDFFF]$/,ae=!Y||E(function(){var le=b("Symbol")();return X([le])!="[null]"||X({a:le})!="{}"||X(Object(le))!="{}"}),ce=E(function(){return X("\uDF06\uD834")!=='"\\udf06\\ud834"'||X("\uDEAD")!=='"\\udead"'}),V=function(le,pe){var ge=B(arguments),me=z(pe);if(!(!N(me)&&(le===void 0||I(le))))return ge[1]=function($e,Ve){if(N(me)&&(Ve=k(me,this,_($e),Ve)),!I(Ve))return Ve},x(X,null,ge)},K=function(le,pe,ge){var me=te(ge,pe-1),$e=te(ge,pe+1);return G(re,le)&&!G(ne,$e)||G(ne,le)&&!G(re,me)?"\\u"+ee(se(le,0),16):le};X&&g({target:"JSON",stat:!0,arity:3,forced:ae||ce},{stringify:function(pe,ge,me){var $e=B(arguments),Ve=x(ae?V:X,null,$e);return ce&&typeof Ve=="string"?R(Ve,U,K):Ve}})},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),E=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:E,sham:!O},{getOwnPropertyDescriptor:function(I,B){return k(x(I),B)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),E=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(I){for(var B=k(I),z=O.f,Y=x(B),_={},X=0,G,te;Y.length>X;)te=z(B,G=Y[X++]),te!==void 0&&E(_,G,te);return _}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),E=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:E},{getOwnPropertySymbols:function(I){var B=k.f;return B?B(O(I)):[]}})},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),E="String Iterator",N=x.set,I=x.getterFor(E);k(String,"String",function(B){N(this,{type:E,string:b(B),index:0})},function(){var z=I(this),Y=z.string,_=z.index,X;return _>=Y.length?O(void 0,!0):(X=g(Y,_),z.index+=X.length,O(X,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),E=f(56049),N=f(71775),I=f(31982),B=f(18768),z=f(15166),Y=f(35970),_=f(88966),X=f(5135),G=f(46025),te=f(54686),se=f(73270),R=f(16619),ee=f(51203),U=f(53515),re=f(97620),ne=f(80016),ae=f(36133),ce=f(98911),V=f(16457),K=f(27519),le=f(37912),pe=f(95976),ge=f(4580),me=f(13477),$e=f(91248),Ve=f(33538),Ye=f(39378),Fe=f(64832),at=f(95679),Dt=f(98889),At=f(44083),qt=f(93935).forEach,Xe=ge("hidden"),Ct="Symbol",xt="prototype",Ot=At.set,fr=At.getterFor(Ct),Ne=Object[xt],wt=b.Symbol,$t=wt&&wt[xt],ht=b.TypeError,Tr=b.QObject,hr=ne.f,Vr=ae.f,Ri=U.f,Pr=V.f,dr=k([].push),pr=pe("symbols"),Kr=pe("op-symbols"),dt=pe("wks"),In=!Tr||!Tr[xt]||!Tr[xt].findChild,ui=E&&I(function(){return se(Vr({},"a",{get:function(){return Vr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Le){var Pe=hr(Ne,Ce);Pe&&delete Ne[Ce],Vr(Ze,Ce,Le),Pe&&Ze!==Ne&&Vr(Ne,Ce,Pe)}:Vr,bn=function(Ze,Ce){var Le=pr[Ze]=se($t);return Ot(Le,{type:Ct,tag:Ze,description:Ce}),E||(Le.description=Ce),Le},xn=function(Ce,Le,Pe){Ce===Ne&&xn(Kr,Le,Pe),Y(Ce);var $=X(Le);return Y(Pe),B(pr,$)?(Pe.enumerable?(B(Ce,Xe)&&Ce[Xe][$]&&(Ce[Xe][$]=!1),Pe=se(Pe,{enumerable:te(0,!1)})):(B(Ce,Xe)||Vr(Ce,Xe,te(1,{})),Ce[Xe][$]=!0),ui(Ce,$,Pe)):Vr(Ce,$,Pe)},Dn=function(Ce,Le){Y(Ce);var Pe=_(Le),$=R(Pe).concat(hi(Pe));return qt($,function(Z){(!E||x(Nn,Pe,Z))&&xn(Ce,Z,Pe[Z])}),Ce},fi=function(Ce,Le){return Le===void 0?se(Ce):Dn(se(Ce),Le)},Nn=function(Ce){var Le=X(Ce),Pe=x(Pr,this,Le);return this===Ne&&B(pr,Le)&&!B(Kr,Le)?!1:Pe||!B(this,Le)||!B(pr,Le)||B(this,Xe)&&this[Xe][Le]?Pe:!0},Wr=function(Ce,Le){var Pe=_(Ce),$=X(Le);if(!(Pe===Ne&&B(pr,$)&&!B(Kr,$))){var Z=hr(Pe,$);return Z&&B(pr,$)&&!(B(Pe,Xe)&&Pe[Xe][$])&&(Z.enumerable=!0),Z}},Rn=function(Ce){var Le=Ri(_(Ce)),Pe=[];return qt(Le,function($){!B(pr,$)&&!B(me,$)&&dr(Pe,$)}),Pe},hi=function(Ze){var Ce=Ze===Ne,Le=Ri(Ce?Kr:_(Ze)),Pe=[];return qt(Le,function($){B(pr,$)&&(!Ce||B(Ne,$))&&dr(Pe,pr[$])}),Pe};N||(wt=function(){if(z($t,this))throw ht("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:G(arguments[0]),Le=$e(Ce),Pe=function($){this===Ne&&x(Pe,Kr,$),B(this,Xe)&&B(this[Xe],Le)&&(this[Xe][Le]=!1),ui(this,Le,te(1,$))};return E&&In&&ui(Ne,Le,{configurable:!0,set:Pe}),bn(Le,Ce)},$t=wt[xt],K($t,"toString",function(){return fr(this).tag}),K(wt,"withoutSetter",function(Ze){return bn($e(Ze),Ze)}),V.f=Nn,ae.f=xn,ce.f=Dn,ne.f=Wr,ee.f=U.f=Rn,re.f=hi,Ye.f=function(Ze){return bn(Ve(Ze),Ze)},E&&(le($t,"description",{configurable:!0,get:function(){return fr(this).description}}),O||K(Ne,"propertyIsEnumerable",Nn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:wt}),qt(R(dt),function(Ze){Fe(Ze)}),g({target:Ct,stat:!0,forced:!N},{useSetter:function(){In=!0},useSimple:function(){In=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!E},{create:fi,defineProperty:xn,defineProperties:Dn,getOwnPropertyDescriptor:Wr}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Rn}),at(),Dt(wt,Ct),me[Xe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),E=f(82294),N=O("string-to-symbol-registry"),I=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{for:function(B){var z=k(B);if(x(N,z))return N[z];var Y=b("Symbol")(z);return N[z]=Y,I[Y]=z,Y}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(9754),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),E=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{keyFor:function(B){if(!x(B))throw TypeError(k(B)+" is not a symbol");if(b(N,B))return N[B]}})},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,E=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(I){try{return O(E(I))!==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),E=f(33538),N=x("Symbol"),I=N.isWellKnown,B=x("Object","getOwnPropertyNames"),z=k(N.prototype.valueOf),Y=b("wks"),_=0,X=B(N),G=X.length;_<G;_++)try{var te=X[_];O(N[te])&&E(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(I&&I(R))return!0;try{for(var ee=z(R),U=0,re=B(Y),ne=re.length;U<ne;U++)if(Y[re[U]]==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),E=f(33538),N=E("toStringTag");for(var I in g){var B=b[I],z=B&&B.prototype;z&&x(z)!==N&&k(z,N,I),O[I]=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,E={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var I=N.forEach;return N===O||x(O,N)&&I===O.forEach||b(E,g(N))?k:I}},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 E(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var K={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(K[Symbol.iterator]=function(){return K}),K}function I(V){this.map={},V instanceof I?V.forEach(function(K,le){this.append(le,K)},this):Array.isArray(V)?V.forEach(function(K){this.append(K[0],K[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(K){this.append(K,V[K])},this)}I.prototype.append=function(V,K){V=O(V),K=E(K);var le=this.map[V];this.map[V]=le?le+", "+K:K},I.prototype.delete=function(V){delete this.map[O(V)]},I.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},I.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},I.prototype.set=function(V,K){this.map[O(V)]=E(K)},I.prototype.forEach=function(V,K){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(K,this.map[le],le,this)},I.prototype.keys=function(){var V=[];return this.forEach(function(K,le){V.push(le)}),N(V)},I.prototype.values=function(){var V=[];return this.forEach(function(K){V.push(K)}),N(V)},I.prototype.entries=function(){var V=[];return this.forEach(function(K,le){V.push([le,K])}),N(V)},g.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function B(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function z(V){return new Promise(function(K,le){V.onload=function(){K(V.result)},V.onerror=function(){le(V.error)}})}function Y(V){var K=new FileReader,le=z(K);return K.readAsArrayBuffer(V),le}function _(V){var K=new FileReader,le=z(K);return K.readAsText(V),le}function X(V){for(var K=new Uint8Array(V),le=new Array(K.length),pe=0;pe<K.length;pe++)le[pe]=String.fromCharCode(K[pe]);return le.join("")}function G(V){if(V.slice)return V.slice(0);var K=new Uint8Array(V.byteLength);return K.set(new Uint8Array(V)),K.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=G(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=G(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=B(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?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var V=B(this);if(V)return V;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(X(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var se=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var K=V.toUpperCase();return se.indexOf(K)>-1?K:V}function ee(V,K){K=K||{};var le=K.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,K.headers||(this.headers=new I(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new I(K.headers)),this.method=R(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function U(V){var K=new FormData;return V.trim().split("&").forEach(function(le){if(le){var pe=le.split("="),ge=pe.shift().replace(/\+/g," "),me=pe.join("=").replace(/\+/g," ");K.append(decodeURIComponent(ge),decodeURIComponent(me))}}),K}function re(V){var K=new I,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(pe){var ge=pe.split(":"),me=ge.shift().trim();if(me){var $e=ge.join(":").trim();K.append(me,$e)}}),K}te.call(ee.prototype);function ne(V,K){K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"OK",this.headers=new I(K.headers),this.url=K.url||"",this._initBody(V)}te.call(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},ne.error=function(){var V=new ne(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ne.redirect=function(V,K){if(ae.indexOf(K)===-1)throw new RangeError("Invalid status code");return new ne(null,{status:K,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(K,le){this.message=K,this.name=le;var pe=Error(K);this.stack=pe.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ce(V,K){return new Promise(function(le,pe){var ge=new ee(V,K);if(ge.signal&&ge.signal.aborted)return pe(new f.DOMException("Aborted","AbortError"));var me=new XMLHttpRequest;function $e(){me.abort()}me.onload=function(){var Ve={status:me.status,statusText:me.statusText,headers:re(me.getAllResponseHeaders()||"")};Ve.url="responseURL"in me?me.responseURL:Ve.headers.get("X-Request-URL");var Ye="response"in me?me.response:me.responseText;le(new ne(Ye,Ve))},me.onerror=function(){pe(new TypeError("Network request failed"))},me.ontimeout=function(){pe(new TypeError("Network request failed"))},me.onabort=function(){pe(new f.DOMException("Aborted","AbortError"))},me.open(ge.method,ge.url,!0),ge.credentials==="include"?me.withCredentials=!0:ge.credentials==="omit"&&(me.withCredentials=!1),"responseType"in me&&g.blob&&(me.responseType="blob"),ge.headers.forEach(function(Ve,Ye){me.setRequestHeader(Ye,Ve)}),ge.signal&&(ge.signal.addEventListener("abort",$e),me.onreadystatechange=function(){me.readyState===4&&ge.signal.removeEventListener("abort",$e)}),me.send(typeof ge._bodyInit>"u"?null:ge._bodyInit)})}return ce.polyfill=!0,v.fetch||(v.fetch=ce,v.Headers=I,v.Request=ee,v.Response=ne),f.Headers=I,f.Request=ee,f.Response=ne,f.fetch=ce,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},16068:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>$I});var g={};f.r(g),f.d(g,{cookie:()=>jx,header:()=>Fx,path:()=>Rx,query:()=>Lx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),E=f(10017),N=f(86351),I=f(86751),B=f(12953),z=f(55839),Y=f(23422);function _(r){return _=typeof z=="function"&&typeof Y=="symbol"?function(e){return typeof e}:function(e){return e&&typeof z=="function"&&e.constructor===z&&e!==z.prototype?"symbol":typeof e},_(r)}var X=f(47319);function G(r,e){if(_(r)!=="object"||r===null)return r;var t=r[X];if(t!==void 0){var n=t.call(r,e||"default");if(_(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function te(r){var e=G(r,"string");return _(e)==="symbol"?e:String(e)}function se(r,e,t){return e=te(e),e in r?B(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?E(t=R(Object(i),!0)).call(t,function(s){se(r,s,i[s])}):N?I(r,N(i)):E(n=R(Object(i))).call(n,function(s){B(r,s,O(i,s))})}return r}var U=f(34961);function re(r,e){if(r==null)return{};var t={},n=b(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(U(e).call(e,i)>=0)&&(t[i]=r[i]);return t}function ne(r,e){if(r==null)return{};var t=re(r,e),n,i;if(x){var s=x(r);for(i=0;i<s.length;i++)n=s[i],!(U(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}var ae=f(13546),ce=f.n(ae),V=f(51121),K=f(26179);/*!
|
|
11
|
+
*/C.parse=b,C.serialize=x;var f=Object.prototype.toString,g=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(D,L){if(typeof D!="string")throw new TypeError("argument str must be a string");for(var H={},J=L||{},q=J.decode||k,X=0;X<D.length;){var G=D.indexOf("=",X);if(G===-1)break;var te=D.indexOf(";",X);if(te===-1)te=D.length;else if(te<G){X=D.lastIndexOf(";",G-1)+1;continue}var oe=D.slice(X,G).trim();if(H[oe]===void 0){var R=D.slice(G+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),H[oe]=N(R,q)}X=te+1}return H}function x(D,L,H){var J=H||{},q=J.encode||O;if(typeof q!="function")throw new TypeError("option encode is invalid");if(!g.test(D))throw new TypeError("argument name is invalid");var X=q(L);if(X&&!g.test(X))throw new TypeError("argument val is invalid");var G=D+"="+X;if(J.maxAge!=null){var te=J.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");G+="; Max-Age="+Math.floor(te)}if(J.domain){if(!g.test(J.domain))throw new TypeError("option domain is invalid");G+="; Domain="+J.domain}if(J.path){if(!g.test(J.path))throw new TypeError("option path is invalid");G+="; Path="+J.path}if(J.expires){var oe=J.expires;if(!P(oe)||isNaN(oe.valueOf()))throw new TypeError("option expires is invalid");G+="; Expires="+oe.toUTCString()}if(J.httpOnly&&(G+="; HttpOnly"),J.secure&&(G+="; Secure"),J.priority){var R=typeof J.priority=="string"?J.priority.toLowerCase():J.priority;switch(R){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(J.sameSite){var ee=typeof J.sameSite=="string"?J.sameSite.toLowerCase():J.sameSite;switch(ee){case!0:G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"strict":G+="; SameSite=Strict";break;case"none":G+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return G}function k(D){return D.indexOf("%")!==-1?decodeURIComponent(D):D}function O(D){return encodeURIComponent(D)}function P(D){return f.call(D)==="[object Date]"||D instanceof Date}function N(D,L){try{return L(D)}catch{return D}}},97529:(v,C,f)=>{var g=f(44928);v.exports=g},75342:(v,C,f)=>{var g=f(26087);v.exports=g},64218:(v,C,f)=>{var g=f(11783);v.exports=g},95050:(v,C,f)=>{var g=f(88462);v.exports=g},84779:(v,C,f)=>{var g=f(83531);v.exports=g},17190:(v,C,f)=>{var g=f(19941);v.exports=g},96589:(v,C,f)=>{var g=f(25081);v.exports=g},32276:(v,C,f)=>{var g=f(22145);v.exports=g},15064:(v,C,f)=>{var g=f(93690);v.exports=g},31986:(v,C,f)=>{var g=f(8429);f(42319),v.exports=g},69635:(v,C,f)=>{var g=f(13099);v.exports=g},3529:(v,C,f)=>{var g=f(44931);v.exports=g},85373:(v,C,f)=>{f(17802);var g=f(70291);v.exports=g("Array").filter},94537:(v,C,f)=>{f(64009);var g=f(70291);v.exports=g("Array").forEach},27794:(v,C,f)=>{f(32449);var g=f(70291);v.exports=g("Array").indexOf},55794:(v,C,f)=>{var g=f(15166),b=f(85373),x=Array.prototype;v.exports=function(k){var O=k.filter;return k===x||g(x,k)&&O===x.filter?b:O}},85838:(v,C,f)=>{var g=f(15166),b=f(27794),x=Array.prototype;v.exports=function(k){var O=k.indexOf;return k===x||g(x,k)&&O===x.indexOf?b:O}},95617:(v,C,f)=>{f(28135);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.defineProperties(O,P)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,P,N){return b.defineProperty(O,P,N)};b.defineProperty.sham&&(x.sham=!0)},59123:(v,C,f)=>{f(51964);var g=f(59921),b=g.Object,x=v.exports=function(O,P){return b.getOwnPropertyDescriptor(O,P)};b.getOwnPropertyDescriptor.sham&&(x.sham=!0)},63332:(v,C,f)=>{f(723);var g=f(59921);v.exports=g.Object.getOwnPropertyDescriptors},83606:(v,C,f)=>{f(68030);var g=f(59921);v.exports=g.Object.getOwnPropertySymbols},90660:(v,C,f)=>{f(38339);var g=f(59921);v.exports=g.Object.keys},49198:(v,C,f)=>{f(69825),f(97829),f(68030),f(95353),f(63906),f(39542),f(47882),f(84911),f(88725),f(47954),f(67703),f(2220),f(48990),f(50240),f(99921),f(3502),f(80220),f(23870),f(5828),f(5708);var g=f(59921);v.exports=g.Symbol},15413:(v,C,f)=>{f(44390),f(97829),f(27626),f(84911);var g=f(39378);v.exports=g.f("iterator")},4793:(v,C,f)=>{f(91667),f(99921);var g=f(39378);v.exports=g.f("toPrimitive")},24018:(v,C,f)=>{v.exports=f(11226)},27411:(v,C,f)=>{v.exports=f(39743)},79155:(v,C,f)=>{v.exports=f(17018)},13375:(v,C,f)=>{v.exports=f(45057)},95442:(v,C,f)=>{v.exports=f(97947)},55334:(v,C,f)=>{v.exports=f(26452)},48261:(v,C,f)=>{v.exports=f(4477)},92864:(v,C,f)=>{v.exports=f(74013)},27923:(v,C,f)=>{v.exports=f(17685)},89225:(v,C,f)=>{v.exports=f(2371)},95281:(v,C,f)=>{v.exports=f(89061)},55468:(v,C,f)=>{v.exports=f(51553)},11226:(v,C,f)=>{var g=f(97529);v.exports=g},39743:(v,C,f)=>{var g=f(75342);v.exports=g},17018:(v,C,f)=>{var g=f(64218);v.exports=g},45057:(v,C,f)=>{var g=f(95050);v.exports=g},97947:(v,C,f)=>{var g=f(84779);v.exports=g},26452:(v,C,f)=>{var g=f(17190);v.exports=g},4477:(v,C,f)=>{var g=f(96589);v.exports=g},74013:(v,C,f)=>{var g=f(32276);v.exports=g},17685:(v,C,f)=>{var g=f(15064);v.exports=g},2371:(v,C,f)=>{var g=f(31986);f(45987),f(58052),f(90181),f(25129),f(90397),f(18097),f(82793),f(52100),f(99742),v.exports=g},89061:(v,C,f)=>{var g=f(69635);v.exports=g},51553:(v,C,f)=>{var g=f(3529);v.exports=g},81970:(v,C,f)=>{var g=f(43152),b=f(18342),x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not a function")}},72185:(v,C,f)=>{var g=f(43152),b=String,x=TypeError;v.exports=function(k){if(typeof k=="object"||g(k))return k;throw x("Can't set "+b(k)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,f)=>{var g=f(92548),b=String,x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not an object")}},24782:(v,C,f)=>{"use strict";var g=f(93935).forEach,b=f(10454),x=b("forEach");v.exports=x?[].forEach:function(O){return g(this,O,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,f)=>{var g=f(88966),b=f(13249),x=f(53387),k=function(O){return function(P,N,D){var L=g(P),H=x(L),J=b(D,H),q;if(O&&N!=N){for(;H>J;)if(q=L[J++],q!=q)return!0}else for(;H>J;J++)if((O||J in L)&&L[J]===N)return O||J||0;return!O&&-1}};v.exports={includes:k(!0),indexOf:k(!1)}},93935:(v,C,f)=>{var g=f(7416),b=f(90406),x=f(38622),k=f(53254),O=f(53387),P=f(69573),N=b([].push),D=function(L){var H=L==1,J=L==2,q=L==3,X=L==4,G=L==6,te=L==7,oe=L==5||G;return function(R,ee,z,ne){for(var ie=k(R),ae=x(ie),ue=g(ee,z),V=O(ae),K=0,le=ne||P,ge=H?le(R,V):J||te?le(R,0):void 0,me,ve;V>K;K++)if((oe||K in ae)&&(me=ae[K],ve=ue(me,K,ie),L))if(H)ge[K]=ve;else if(ve)switch(L){case 3:return!0;case 5:return me;case 6:return K;case 2:N(ge,me)}else switch(L){case 4:return!1;case 7:N(ge,me)}return G?-1:q||X?X:ge}};v.exports={forEach:D(0),map:D(1),filter:D(2),some:D(3),every:D(4),find:D(5),findIndex:D(6),filterReject:D(7)}},36844:(v,C,f)=>{var g=f(31982),b=f(33538),x=f(32438),k=b("species");v.exports=function(O){return x>=51||!g(function(){var P=[],N=P.constructor={};return N[k]=function(){return{foo:1}},P[O](Boolean).foo!==1})}},10454:(v,C,f)=>{"use strict";var g=f(31982);v.exports=function(b,x){var k=[][b];return!!k&&g(function(){k.call(null,x||function(){return 1},1)})}},67932:(v,C,f)=>{var g=f(13249),b=f(53387),x=f(53437),k=Array,O=Math.max;v.exports=function(P,N,D){for(var L=b(P),H=g(N,L),J=g(D===void 0?L:D,L),q=k(O(J-H,0)),X=0;H<J;H++,X++)x(q,X,P[H]);return q.length=X,q}},53160:(v,C,f)=>{var g=f(90406);v.exports=g([].slice)},76562:(v,C,f)=>{var g=f(93053),b=f(43455),x=f(92548),k=f(33538),O=k("species"),P=Array;v.exports=function(N){var D;return g(N)&&(D=N.constructor,b(D)&&(D===P||g(D.prototype))?D=void 0:x(D)&&(D=D[O],D===null&&(D=void 0))),D===void 0?P:D}},69573:(v,C,f)=>{var g=f(76562);v.exports=function(b,x){return new(g(b))(x===0?0:x)}},58310:(v,C,f)=>{var g=f(90406),b=g({}.toString),x=g("".slice);v.exports=function(k){return x(b(k),8,-1)}},82059:(v,C,f)=>{var g=f(48448),b=f(43152),x=f(58310),k=f(33538),O=k("toStringTag"),P=Object,N=x(function(){return arguments}())=="Arguments",D=function(L,H){try{return L[H]}catch{}};v.exports=g?x:function(L){var H,J,q;return L===void 0?"Undefined":L===null?"Null":typeof(J=D(H=P(L),O))=="string"?J:N?x(H):(q=x(H))=="Object"&&b(H.callee)?"Arguments":q}},74838:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,f){return{value:C,done:f}}},20410:(v,C,f)=>{var g=f(56049),b=f(36133),x=f(54686);v.exports=g?function(k,O,P){return b.f(k,O,x(1,P))}:function(k,O,P){return k[O]=P,k}},54686:v=>{v.exports=function(C,f){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:f}}},53437:(v,C,f)=>{"use strict";var g=f(5135),b=f(36133),x=f(54686);v.exports=function(k,O,P){var N=g(O);N in k?b.f(k,N,x(0,P)):k[N]=P}},37912:(v,C,f)=>{var g=f(36133);v.exports=function(b,x,k){return g.f(b,x,k)}},27519:(v,C,f)=>{var g=f(20410);v.exports=function(b,x,k,O){return O&&O.enumerable?b[x]=k:g(b,x,k),b}},9267:(v,C,f)=>{var g=f(62447),b=Object.defineProperty;v.exports=function(x,k){try{b(g,x,{value:k,configurable:!0,writable:!0})}catch{g[x]=k}return k}},56049:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,f=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:f}},45511:(v,C,f)=>{var g=f(62447),b=f(92548),x=g.document,k=b(x)&&b(x.createElement);v.exports=function(O){return k?x.createElement(O):{}}},11452:v=>{var C=TypeError,f=9007199254740991;v.exports=function(g){if(g>f)throw C("Maximum allowed index exceeded");return g}},81595:v=>{v.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},90740:v=>{v.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},32438:(v,C,f)=>{var g=f(62447),b=f(90740),x=g.process,k=g.Deno,O=x&&x.versions||k&&k.version,P=O&&O.v8,N,D;P&&(N=P.split("."),D=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!D&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(D=+N[1]))),v.exports=D},70291:(v,C,f)=>{var g=f(59921);v.exports=function(b){return g[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,f)=>{"use strict";var g=f(62447),b=f(82768),x=f(57953),k=f(43152),O=f(80016).f,P=f(51585),N=f(59921),D=f(7416),L=f(20410),H=f(18768),J=function(q){var X=function(G,te,oe){if(this instanceof X){switch(arguments.length){case 0:return new q;case 1:return new q(G);case 2:return new q(G,te)}return new q(G,te,oe)}return b(q,this,arguments)};return X.prototype=q.prototype,X};v.exports=function(q,X){var G=q.target,te=q.global,oe=q.stat,R=q.proto,ee=te?g:oe?g[G]:(g[G]||{}).prototype,z=te?N:N[G]||L(N,G,{})[G],ne=z.prototype,ie,ae,ue,V,K,le,ge,me,ve;for(V in X)ie=P(te?V:G+(oe?".":"#")+V,q.forced),ae=!ie&&ee&&H(ee,V),le=z[V],ae&&(q.dontCallGetSet?(ve=O(ee,V),ge=ve&&ve.value):ge=ee[V]),K=ae&&ge?ge:X[V],!(ae&&typeof le==typeof K)&&(q.bind&&ae?me=D(K,g):q.wrap&&ae?me=J(K):R&&k(K)?me=x(K):me=K,(q.sham||K&&K.sham||le&&le.sham)&&L(me,"sham",!0),L(z,V,me),R&&(ue=G+"Prototype",H(N,ue)||L(N,ue,{}),L(N[ue],V,K),q.real&&ne&&(ie||!ne[V])&&L(ne,V,K)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,P){return b(O),P===void 0?O:x?k(O,P):function(){return O.apply(P,arguments)}}},97966:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,f)=>{var g=f(97966),b=Function.prototype.call;v.exports=g?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,f)=>{var g=f(56049),b=f(18768),x=Function.prototype,k=g&&Object.getOwnPropertyDescriptor,O=b(x,"name"),P=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:P,CONFIGURABLE:N}},54518:(v,C,f)=>{var g=f(90406),b=f(81970);v.exports=function(x,k,O){try{return g(b(Object.getOwnPropertyDescriptor(x,k)[O]))}catch{}}},57953:(v,C,f)=>{var g=f(58310),b=f(90406);v.exports=function(x){if(g(x)==="Function")return b(x)}},90406:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.call,k=g&&b.bind.bind(x,x);v.exports=g?k:function(O){return function(){return x.apply(O,arguments)}}},97080:(v,C,f)=>{var g=f(59921),b=f(62447),x=f(43152),k=function(O){return x(O)?O:void 0};v.exports=function(O,P){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][P]||b[O]&&b[O][P]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),P=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var D=N.length,L=[],H=0;H<D;H++){var J=N[H];typeof J=="string"?P(L,J):(typeof J=="number"||k(J)=="Number"||k(J)=="String")&&P(L,O(J))}var q=L.length,X=!0;return function(G,te){if(X)return X=!1,te;if(b(this))return te;for(var oe=0;oe<q;oe++)if(L[oe]===G)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,P){return x(b(O),P)}},13477:v=>{v.exports={}},19552:(v,C,f)=>{var g=f(97080);v.exports=g("document","documentElement")},11314:(v,C,f)=>{var g=f(56049),b=f(31982),x=f(45511);v.exports=!g&&!b(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(58310),k=Object,O=g("".split);v.exports=b(function(){return!k("z").propertyIsEnumerable(0)})?function(P){return x(P)=="String"?O(P,""):k(P)}:k},41524:(v,C,f)=>{var g=f(90406),b=f(43152),x=f(70716),k=g(Function.toString);b(x.inspectSource)||(x.inspectSource=function(O){return k(O)}),v.exports=x.inspectSource},44083:(v,C,f)=>{var g=f(57761),b=f(62447),x=f(92548),k=f(20410),O=f(18768),P=f(70716),N=f(4580),D=f(13477),L="Object already initialized",H=b.TypeError,J=b.WeakMap,q,X,G,te=function(z){return G(z)?X(z):q(z,{})},oe=function(z){return function(ne){var ie;if(!x(ne)||(ie=X(ne)).type!==z)throw H("Incompatible receiver, "+z+" required");return ie}};if(g||P.state){var R=P.state||(P.state=new J);R.get=R.get,R.has=R.has,R.set=R.set,q=function(z,ne){if(R.has(z))throw H(L);return ne.facade=z,R.set(z,ne),ne},X=function(z){return R.get(z)||{}},G=function(z){return R.has(z)}}else{var ee=N("state");D[ee]=!0,q=function(z,ne){if(O(z,ee))throw H(L);return ne.facade=z,k(z,ee,ne),ne},X=function(z){return O(z,ee)?z[ee]:{}},G=function(z){return O(z,ee)}}v.exports={set:q,get:X,has:G,enforce:te,getterFor:oe}},93053:(v,C,f)=>{var g=f(58310);v.exports=Array.isArray||function(x){return g(x)=="Array"}},43152:(v,C,f)=>{var g=f(51647),b=g.all;v.exports=g.IS_HTMLDDA?function(x){return typeof x=="function"||x===b}:function(x){return typeof x=="function"}},43455:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(43152),k=f(82059),O=f(97080),P=f(41524),N=function(){},D=[],L=O("Reflect","construct"),H=/^\s*(?:class|function)\b/,J=g(H.exec),q=!H.exec(N),X=function(oe){if(!x(oe))return!1;try{return L(N,D,oe),!0}catch{return!1}},G=function(oe){if(!x(oe))return!1;switch(k(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return q||!!J(H,P(oe))}catch{return!0}};G.sham=!0,v.exports=!L||b(function(){var te;return X(X.call)||!X(Object)||!X(function(){te=!0})||te})?G:X},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(L,H){var J=P[O(L)];return J==D?!0:J==N?!1:b(H)?g(H):!!H},O=k.normalize=function(L){return String(L).replace(x,".").toLowerCase()},P=k.data={},N=k.NATIVE="N",D=k.POLYFILL="P";v.exports=k},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,f)=>{var g=f(43152),b=f(51647),x=b.all;v.exports=b.IS_HTMLDDA?function(k){return typeof k=="object"?k!==null:g(k)||k===x}:function(k){return typeof k=="object"?k!==null:g(k)}},39839:v=>{v.exports=!0},28609:(v,C,f)=>{var g=f(97080),b=f(43152),x=f(15166),k=f(27237),O=Object;v.exports=k?function(P){return typeof P=="symbol"}:function(P){var N=g("Symbol");return b(N)&&x(N.prototype,O(P))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),P=function(){return this};v.exports=function(N,D,L,H){var J=D+" Iterator";return N.prototype=b(g,{next:x(+!H,L)}),k(N,J,!1,!0),O[J]=P,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),P=f(41709),N=f(90851),D=f(70738),L=f(98889),H=f(20410),J=f(27519),q=f(33538),X=f(94609),G=f(98488),te=k.PROPER,oe=k.CONFIGURABLE,R=G.IteratorPrototype,ee=G.BUGGY_SAFARI_ITERATORS,z=q("iterator"),ne="keys",ie="values",ae="entries",ue=function(){return this};v.exports=function(V,K,le,ge,me,ve,We){P(le,K,ge);var je=function(Tt){if(Tt===me&&Ot)return Ot;if(!ee&&Tt in lt)return lt[Tt];switch(Tt){case ne:return function(){return new le(this,Tt)};case ie:return function(){return new le(this,Tt)};case ae:return function(){return new le(this,Tt)}}return function(){return new le(this)}},Ke=K+" Iterator",Le=!1,lt=V.prototype,Rt=lt[z]||lt["@@iterator"]||me&<[me],Ot=!ee&&Rt||je(me),rr=K=="Array"&<.entries||Rt,Xe,Et,wt;if(rr&&(Xe=N(rr.call(new V)),Xe!==Object.prototype&&Xe.next&&(!x&&N(Xe)!==R&&(D?D(Xe,R):O(Xe[z])||J(Xe,z,ue)),L(Xe,Ke,!0,!0),x&&(X[Ke]=ue))),te&&me==ie&&Rt&&Rt.name!==ie&&(!x&&oe?H(lt,"name",ie):(Le=!0,Ot=function(){return b(Rt,this)})),me)if(Et={values:je(ie),keys:ve?Ot:je(ne),entries:je(ae)},We)for(wt in Et)(ee||Le||!(wt in lt))&&J(lt,wt,Et[wt]);else g({target:K,proto:!0,forced:ee||Le},Et);return(!x||We)&<[z]!==Ot&&J(lt,z,Ot,{name:me}),X[K]=Ot,Et}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),P=f(27519),N=f(33538),D=f(39839),L=N("iterator"),H=!1,J,q,X;[].keys&&(X=[].keys(),"next"in X?(q=O(O(X)),q!==Object.prototype&&(J=q)):H=!0);var G=!x(J)||g(function(){var te={};return J[L].call(te)!==te});G?J={}:D&&(J=k(J)),b(J[L])||P(J,L,function(){return this}),v.exports={IteratorPrototype:J,BUGGY_SAFARI_ITERATORS:H}},94609:v=>{v.exports={}},53387:(v,C,f)=>{var g=f(62567);v.exports=function(b){return g(b.length)}},99295:v=>{var C=Math.ceil,f=Math.floor;v.exports=Math.trunc||function(b){var x=+b;return(x>0?f:C)(x)}},73270:(v,C,f)=>{var g=f(35970),b=f(98911),x=f(11792),k=f(13477),O=f(19552),P=f(45511),N=f(4580),D=">",L="<",H="prototype",J="script",q=N("IE_PROTO"),X=function(){},G=function(z){return L+J+D+z+L+"/"+J+D},te=function(z){z.write(G("")),z.close();var ne=z.parentWindow.Object;return z=null,ne},oe=function(){var z=P("iframe"),ne="java"+J+":",ie;return z.style.display="none",O.appendChild(z),z.src=String(ne),ie=z.contentWindow.document,ie.open(),ie.write(G("document.F=Object")),ie.close(),ie.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):oe():te(R);for(var z=x.length;z--;)delete ee[H][x[z]];return ee()};k[q]=!0,v.exports=Object.create||function(ne,ie){var ae;return ne!==null?(X[H]=g(ne),ae=new X,X[H]=null,ae[q]=ne):ae=ee(),ie===void 0?ae:b.f(ae,ie)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),P=f(16619);C.f=g&&!b?Object.defineProperties:function(D,L){k(D);for(var H=O(L),J=P(L),q=J.length,X=0,G;q>X;)x.f(D,G=J[X++],H[G]);return D}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),P=TypeError,N=Object.defineProperty,D=Object.getOwnPropertyDescriptor,L="enumerable",H="configurable",J="writable";C.f=g?x?function(X,G,te){if(k(X),G=O(G),k(te),typeof X=="function"&&G==="prototype"&&"value"in te&&J in te&&!te[J]){var oe=D(X,G);oe&&oe[J]&&(X[G]=te.value,te={configurable:H in te?te[H]:oe[H],enumerable:L in te?te[L]:oe[L],writable:!1})}return N(X,G,te)}:N:function(X,G,te){if(k(X),G=O(G),k(te),b)try{return N(X,G,te)}catch{}if("get"in te||"set"in te)throw P("Accessors not supported");return"value"in te&&(X[G]=te.value),X}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),P=f(5135),N=f(18768),D=f(11314),L=Object.getOwnPropertyDescriptor;C.f=g?L:function(J,q){if(J=O(J),q=P(q),D)try{return L(J,q)}catch{}if(N(J,q))return k(!b(x.f,J,q),J[q])}},53515:(v,C,f)=>{var g=f(58310),b=f(88966),x=f(51203).f,k=f(67932),O=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],P=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(D){return O&&g(D)=="Window"?P(D):x(b(D))}},51203:(v,C,f)=>{var g=f(4541),b=f(11792),x=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(O){return g(O,x)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,f)=>{var g=f(18768),b=f(43152),x=f(53254),k=f(4580),O=f(74838),P=k("IE_PROTO"),N=Object,D=N.prototype;v.exports=O?N.getPrototypeOf:function(L){var H=x(L);if(g(H,P))return H[P];var J=H.constructor;return b(J)&&H instanceof J?J.prototype:H instanceof N?D:null}},15166:(v,C,f)=>{var g=f(90406);v.exports=g({}.isPrototypeOf)},4541:(v,C,f)=>{var g=f(90406),b=f(18768),x=f(88966),k=f(66322).indexOf,O=f(13477),P=g([].push);v.exports=function(N,D){var L=x(N),H=0,J=[],q;for(q in L)!b(O,q)&&b(L,q)&&P(J,q);for(;D.length>H;)b(L,q=D[H++])&&(~k(J,q)||P(J,q));return J}},16619:(v,C,f)=>{var g=f(4541),b=f(11792);v.exports=Object.keys||function(k){return g(k,b)}},16457:(v,C)=>{"use strict";var f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b=g&&!f.call({1:2},1);C.f=b?function(k){var O=g(this,k);return!!O&&O.enumerable}:f},70738:(v,C,f)=>{var g=f(54518),b=f(35970),x=f(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var k=!1,O={},P;try{P=g(Object.prototype,"__proto__","set"),P(O,[]),k=O instanceof Array}catch{}return function(D,L){return b(D),x(L),k?P(D,L):D.__proto__=L,D}}():void 0)},68399:(v,C,f)=>{"use strict";var g=f(48448),b=f(82059);v.exports=g?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,f)=>{var g=f(12461),b=f(43152),x=f(92548),k=TypeError;v.exports=function(O,P){var N,D;if(P==="string"&&b(N=O.toString)&&!x(D=g(N,O))||b(N=O.valueOf)&&!x(D=g(N,O))||P!=="string"&&b(N=O.toString)&&!x(D=g(N,O)))return D;throw k("Can't convert object to primitive value")}},47813:(v,C,f)=>{var g=f(97080),b=f(90406),x=f(51203),k=f(97620),O=f(35970),P=b([].concat);v.exports=g("Reflect","ownKeys")||function(D){var L=x.f(O(D)),H=k.f;return H?P(L,H(D)):L}},59921:v=>{v.exports={}},31251:(v,C,f)=>{var g=f(71365),b=TypeError;v.exports=function(x){if(g(x))throw b("Can't call method on "+x);return x}},98889:(v,C,f)=>{var g=f(48448),b=f(36133).f,x=f(20410),k=f(18768),O=f(68399),P=f(33538),N=P("toStringTag");v.exports=function(D,L,H,J){if(D){var q=H?D:D.prototype;k(q,N)||b(q,N,{configurable:!0,value:L}),J&&!g&&x(q,"toString",O)}}},4580:(v,C,f)=>{var g=f(95976),b=f(91248),x=g("keys");v.exports=function(k){return x[k]||(x[k]=b(k))}},70716:(v,C,f)=>{var g=f(62447),b=f(9267),x="__core-js_shared__",k=g[x]||b(x,{});v.exports=k},95976:(v,C,f)=>{var g=f(39839),b=f(70716);(v.exports=function(x,k){return b[x]||(b[x]=k!==void 0?k:{})})("versions",[]).push({version:"3.29.1",mode:g?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},18143:(v,C,f)=>{var g=f(90406),b=f(32041),x=f(46025),k=f(31251),O=g("".charAt),P=g("".charCodeAt),N=g("".slice),D=function(L){return function(H,J){var q=x(k(H)),X=b(J),G=q.length,te,oe;return X<0||X>=G?L?"":void 0:(te=P(q,X),te<55296||te>56319||X+1===G||(oe=P(q,X+1))<56320||oe>57343?L?O(q,X):te:L?N(q,X,X+2):(te-55296<<10)+(oe-56320)+65536)}};v.exports={codeAt:D(!1),charAt:D(!0)}},71775:(v,C,f)=>{var g=f(32438),b=f(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var x=Symbol();return!String(x)||!(Object(x)instanceof Symbol)||!Symbol.sham&&g&&g<41})},95679:(v,C,f)=>{var g=f(12461),b=f(97080),x=f(33538),k=f(27519);v.exports=function(){var O=b("Symbol"),P=O&&O.prototype,N=P&&P.valueOf,D=x("toPrimitive");P&&!P[D]&&k(P,D,function(L){return g(N,this)},{arity:1})}},82294:(v,C,f)=>{var g=f(71775);v.exports=g&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,f)=>{var g=f(32041),b=Math.max,x=Math.min;v.exports=function(k,O){var P=g(k);return P<0?b(P+O,0):x(P,O)}},88966:(v,C,f)=>{var g=f(38622),b=f(31251);v.exports=function(x){return g(b(x))}},32041:(v,C,f)=>{var g=f(99295);v.exports=function(b){var x=+b;return x!==x||x===0?0:g(x)}},62567:(v,C,f)=>{var g=f(32041),b=Math.min;v.exports=function(x){return x>0?b(g(x),9007199254740991):0}},53254:(v,C,f)=>{var g=f(31251),b=Object;v.exports=function(x){return b(g(x))}},37505:(v,C,f)=>{var g=f(12461),b=f(92548),x=f(28609),k=f(27529),O=f(96380),P=f(33538),N=TypeError,D=P("toPrimitive");v.exports=function(L,H){if(!b(L)||x(L))return L;var J=k(L,D),q;if(J){if(H===void 0&&(H="default"),q=g(J,L,H),!b(q)||x(q))return q;throw N("Can't convert object to primitive value")}return H===void 0&&(H="number"),O(L,H)}},5135:(v,C,f)=>{var g=f(37505),b=f(28609);v.exports=function(x){var k=g(x,"string");return b(k)?k:k+""}},48448:(v,C,f)=>{var g=f(33538),b=g("toStringTag"),x={};x[b]="z",v.exports=String(x)==="[object z]"},46025:(v,C,f)=>{var g=f(82059),b=String;v.exports=function(x){if(g(x)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(x)}},18342:v=>{var C=String;v.exports=function(f){try{return C(f)}catch{return"Object"}}},91248:(v,C,f)=>{var g=f(90406),b=0,x=Math.random(),k=g(1 .toString);v.exports=function(O){return"Symbol("+(O===void 0?"":O)+")_"+k(++b+x,36)}},27237:(v,C,f)=>{var g=f(71775);v.exports=g&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,f)=>{var g=f(56049),b=f(31982);v.exports=g&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,f)=>{var g=f(62447),b=f(43152),x=g.WeakMap;v.exports=b(x)&&/native code/.test(String(x))},64832:(v,C,f)=>{var g=f(59921),b=f(18768),x=f(39378),k=f(36133).f;v.exports=function(O){var P=g.Symbol||(g.Symbol={});b(P,O)||k(P,O,{value:x.f(O)})}},39378:(v,C,f)=>{var g=f(33538);C.f=g},33538:(v,C,f)=>{var g=f(62447),b=f(95976),x=f(18768),k=f(91248),O=f(71775),P=f(27237),N=g.Symbol,D=b("wks"),L=P?N.for||N:N&&N.withoutSetter||k;v.exports=function(H){return x(D,H)||(D[H]=O&&x(N,H)?N[H]:L("Symbol."+H)),D[H]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),P=f(53387),N=f(11452),D=f(53437),L=f(69573),H=f(36844),J=f(33538),q=f(32438),X=J("isConcatSpreadable"),G=q>=51||!b(function(){var R=[];return R[X]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[X];return ee!==void 0?!!ee:x(R)},oe=!G||!H("concat");g({target:"Array",proto:!0,arity:1,forced:oe},{concat:function(ee){var z=O(this),ne=L(z,0),ie=0,ae,ue,V,K,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?z:arguments[ae],te(le))for(K=P(le),N(ie+K),ue=0;ue<K;ue++,ie++)ue in le&&D(ne,ie,le[ue]);else N(ie+1),D(ne,ie++,le);return ne.length=ie,ne}})},17802:(v,C,f)=>{"use strict";var g=f(30080),b=f(93935).filter,x=f(36844),k=x("filter");g({target:"Array",proto:!0,forced:!k},{filter:function(P){return b(this,P,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,f)=>{"use strict";var g=f(30080),b=f(24782);g({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,f)=>{"use strict";var g=f(30080),b=f(57953),x=f(66322).indexOf,k=f(10454),O=b([].indexOf),P=!!O&&1/O([1],1,-0)<0,N=P||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(L){var H=arguments.length>1?arguments[1]:void 0;return P?O(this,L,H)||0:x(this,L,H)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,P=f(78107),N=f(10248),D=f(39839),L=f(56049),H="Array Iterator",J=k.set,q=k.getterFor(H);v.exports=P(Array,"Array",function(G,te){J(this,{type:H,target:g(G),index:0,kind:te})},function(){var G=q(this),te=G.target,oe=G.kind,R=G.index++;return!te||R>=te.length?(G.target=void 0,N(void 0,!0)):oe=="keys"?N(R,!1):oe=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var X=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!D&&L&&X.name!=="values")try{O(X,"name",{value:"values"})}catch{}},91667:()=>{},9754:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),P=f(31982),N=f(43152),D=f(28609),L=f(53160),H=f(82850),J=f(71775),q=String,X=b("JSON","stringify"),G=O(/./.exec),te=O("".charAt),oe=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),z=/[\uD800-\uDFFF]/g,ne=/^[\uD800-\uDBFF]$/,ie=/^[\uDC00-\uDFFF]$/,ae=!J||P(function(){var le=b("Symbol")();return X([le])!="[null]"||X({a:le})!="{}"||X(Object(le))!="{}"}),ue=P(function(){return X("\uDF06\uD834")!=='"\\udf06\\ud834"'||X("\uDEAD")!=='"\\udead"'}),V=function(le,ge){var me=L(arguments),ve=H(ge);if(!(!N(ve)&&(le===void 0||D(le))))return me[1]=function(We,je){if(N(ve)&&(je=k(ve,this,q(We),je)),!D(je))return je},x(X,null,me)},K=function(le,ge,me){var ve=te(me,ge-1),We=te(me,ge+1);return G(ne,le)&&!G(ie,We)||G(ie,le)&&!G(ne,ve)?"\\u"+ee(oe(le,0),16):le};X&&g({target:"JSON",stat:!0,arity:3,forced:ae||ue},{stringify:function(ge,me,ve){var We=L(arguments),je=x(ae?V:X,null,We);return ue&&typeof je=="string"?R(je,z,K):je}})},23870:(v,C,f)=>{var g=f(62447),b=f(98889);b(g.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(98911).f;g({target:"Object",stat:!0,forced:Object.defineProperties!==x,sham:!b},{defineProperties:x})},70829:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(36133).f;g({target:"Object",stat:!0,forced:Object.defineProperty!==x,sham:!b},{defineProperty:x})},51964:(v,C,f)=>{var g=f(30080),b=f(31982),x=f(88966),k=f(80016).f,O=f(56049),P=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:P,sham:!O},{getOwnPropertyDescriptor:function(D,L){return k(x(D),L)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),P=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(D){for(var L=k(D),H=O.f,J=x(L),q={},X=0,G,te;J.length>X;)te=H(L,G=J[X++]),te!==void 0&&P(q,G,te);return q}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),P=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:P},{getOwnPropertySymbols:function(D){var L=k.f;return L?L(O(D)):[]}})},38339:(v,C,f)=>{var g=f(30080),b=f(53254),x=f(16619),k=f(31982),O=k(function(){x(1)});g({target:"Object",stat:!0,forced:O},{keys:function(N){return x(b(N))}})},97829:()=>{},5708:()=>{},27626:(v,C,f)=>{"use strict";var g=f(18143).charAt,b=f(46025),x=f(44083),k=f(78107),O=f(10248),P="String Iterator",N=x.set,D=x.getterFor(P);k(String,"String",function(L){N(this,{type:P,string:b(L),index:0})},function(){var H=D(this),J=H.string,q=H.index,X;return q>=J.length?O(void 0,!0):(X=g(J,q),H.index+=X.length,O(X,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),P=f(56049),N=f(71775),D=f(31982),L=f(18768),H=f(15166),J=f(35970),q=f(88966),X=f(5135),G=f(46025),te=f(54686),oe=f(73270),R=f(16619),ee=f(51203),z=f(53515),ne=f(97620),ie=f(80016),ae=f(36133),ue=f(98911),V=f(16457),K=f(27519),le=f(37912),ge=f(95976),me=f(4580),ve=f(13477),We=f(91248),je=f(33538),Ke=f(39378),Le=f(64832),lt=f(95679),Rt=f(98889),Ot=f(44083),rr=f(93935).forEach,Xe=me("hidden"),Et="Symbol",wt="prototype",Tt=Ot.set,hr=Ot.getterFor(Et),De=Object[wt],St=b.Symbol,Ht=St&&St[wt],pt=b.TypeError,Ir=b.QObject,dr=ie.f,Wr=ae.f,Ri=z.f,Dr=V.f,pr=k([].push),gr=ge("symbols"),Jr=ge("op-symbols"),gt=ge("wks"),Dn=!Ir||!Ir[wt]||!Ir[wt].findChild,fi=P&&D(function(){return oe(Wr({},"a",{get:function(){return Wr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Ne){var Te=dr(De,Ce);Te&&delete De[Ce],Wr(Ze,Ce,Ne),Te&&Ze!==De&&Wr(De,Ce,Te)}:Wr,xn=function(Ze,Ce){var Ne=gr[Ze]=oe(Ht);return Tt(Ne,{type:Et,tag:Ze,description:Ce}),P||(Ne.description=Ce),Ne},wn=function(Ce,Ne,Te){Ce===De&&wn(Jr,Ne,Te),J(Ce);var $=X(Ne);return J(Te),L(gr,$)?(Te.enumerable?(L(Ce,Xe)&&Ce[Xe][$]&&(Ce[Xe][$]=!1),Te=oe(Te,{enumerable:te(0,!1)})):(L(Ce,Xe)||Wr(Ce,Xe,te(1,{})),Ce[Xe][$]=!0),fi(Ce,$,Te)):Wr(Ce,$,Te)},Nn=function(Ce,Ne){J(Ce);var Te=q(Ne),$=R(Te).concat(di(Te));return rr($,function(Z){(!P||x(Rn,Te,Z))&&wn(Ce,Z,Te[Z])}),Ce},hi=function(Ce,Ne){return Ne===void 0?oe(Ce):Nn(oe(Ce),Ne)},Rn=function(Ce){var Ne=X(Ce),Te=x(Dr,this,Ne);return this===De&&L(gr,Ne)&&!L(Jr,Ne)?!1:Te||!L(this,Ne)||!L(gr,Ne)||L(this,Xe)&&this[Xe][Ne]?Te:!0},$r=function(Ce,Ne){var Te=q(Ce),$=X(Ne);if(!(Te===De&&L(gr,$)&&!L(Jr,$))){var Z=dr(Te,$);return Z&&L(gr,$)&&!(L(Te,Xe)&&Te[Xe][$])&&(Z.enumerable=!0),Z}},Ln=function(Ce){var Ne=Ri(q(Ce)),Te=[];return rr(Ne,function($){!L(gr,$)&&!L(ve,$)&&pr(Te,$)}),Te},di=function(Ze){var Ce=Ze===De,Ne=Ri(Ce?Jr:q(Ze)),Te=[];return rr(Ne,function($){L(gr,$)&&(!Ce||L(De,$))&&pr(Te,gr[$])}),Te};N||(St=function(){if(H(Ht,this))throw pt("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:G(arguments[0]),Ne=We(Ce),Te=function($){this===De&&x(Te,Jr,$),L(this,Xe)&&L(this[Xe],Ne)&&(this[Xe][Ne]=!1),fi(this,Ne,te(1,$))};return P&&Dn&&fi(De,Ne,{configurable:!0,set:Te}),xn(Ne,Ce)},Ht=St[wt],K(Ht,"toString",function(){return hr(this).tag}),K(St,"withoutSetter",function(Ze){return xn(We(Ze),Ze)}),V.f=Rn,ae.f=wn,ue.f=Nn,ie.f=$r,ee.f=z.f=Ln,ne.f=di,Ke.f=function(Ze){return xn(je(Ze),Ze)},P&&(le(Ht,"description",{configurable:!0,get:function(){return hr(this).description}}),O||K(De,"propertyIsEnumerable",Rn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:St}),rr(R(gt),function(Ze){Le(Ze)}),g({target:Et,stat:!0,forced:!N},{useSetter:function(){Dn=!0},useSimple:function(){Dn=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!P},{create:hi,defineProperty:wn,defineProperties:Nn,getOwnPropertyDescriptor:$r}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Ln}),lt(),Rt(St,Et),ve[Xe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),P=f(82294),N=O("string-to-symbol-registry"),D=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{for:function(L){var H=k(L);if(x(N,H))return N[H];var J=b("Symbol")(H);return N[H]=J,D[J]=H,J}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(9754),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),P=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!P},{keyFor:function(L){if(!x(L))throw TypeError(k(L)+" is not a symbol");if(b(N,L))return N[L]}})},47954:(v,C,f)=>{var g=f(64832);g("matchAll")},88725:(v,C,f)=>{var g=f(64832);g("match")},67703:(v,C,f)=>{var g=f(64832);g("replace")},2220:(v,C,f)=>{var g=f(64832);g("search")},48990:(v,C,f)=>{var g=f(64832);g("species")},50240:(v,C,f)=>{var g=f(64832);g("split")},99921:(v,C,f)=>{var g=f(64832),b=f(95679);g("toPrimitive"),b()},3502:(v,C,f)=>{var g=f(97080),b=f(64832),x=f(98889);b("toStringTag"),x(g("Symbol"),"Symbol")},80220:(v,C,f)=>{var g=f(64832);g("unscopables")},45987:(v,C,f)=>{var g=f(64832);g("asyncDispose")},42319:(v,C,f)=>{var g=f(64832);g("dispose")},58052:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(90406),k=b("Symbol"),O=k.keyFor,P=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(D){try{return O(P(D))!==void 0}catch{return!1}}})},90181:(v,C,f)=>{for(var g=f(30080),b=f(95976),x=f(97080),k=f(90406),O=f(28609),P=f(33538),N=x("Symbol"),D=N.isWellKnown,L=x("Object","getOwnPropertyNames"),H=k(N.prototype.valueOf),J=b("wks"),q=0,X=L(N),G=X.length;q<G;q++)try{var te=X[q];O(N[te])&&P(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(D&&D(R))return!0;try{for(var ee=H(R),z=0,ne=L(J),ie=ne.length;z<ie;z++)if(J[ne[z]]==ee)return!0}catch{}return!1}})},25129:(v,C,f)=>{var g=f(64832);g("matcher")},90397:(v,C,f)=>{var g=f(64832);g("metadataKey")},82793:(v,C,f)=>{var g=f(64832);g("metadata")},18097:(v,C,f)=>{var g=f(64832);g("observable")},52100:(v,C,f)=>{var g=f(64832);g("patternMatch")},99742:(v,C,f)=>{var g=f(64832);g("replaceAll")},48713:(v,C,f)=>{f(44390);var g=f(81595),b=f(62447),x=f(82059),k=f(20410),O=f(94609),P=f(33538),N=P("toStringTag");for(var D in g){var L=b[D],H=L&&L.prototype;H&&x(H)!==N&&k(H,N,D),O[D]=O.Array}},41544:(v,C,f)=>{var g=f(94537);v.exports=g},44928:(v,C,f)=>{var g=f(55794);v.exports=g},26087:(v,C,f)=>{f(48713);var g=f(82059),b=f(18768),x=f(15166),k=f(41544),O=Array.prototype,P={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var D=N.forEach;return N===O||x(O,N)&&D===O.forEach||b(P,g(N))?k:D}},11783:(v,C,f)=>{var g=f(85838);v.exports=g},88462:(v,C,f)=>{var g=f(95617);v.exports=g},83531:(v,C,f)=>{var g=f(11906);v.exports=g},19941:(v,C,f)=>{var g=f(59123);v.exports=g},25081:(v,C,f)=>{var g=f(63332);v.exports=g},22145:(v,C,f)=>{var g=f(83606);v.exports=g},93690:(v,C,f)=>{var g=f(90660);v.exports=g},8429:(v,C,f)=>{var g=f(49198);f(48713),v.exports=g},13099:(v,C,f)=>{var g=f(15413);f(48713),v.exports=g},44931:(v,C,f)=>{var g=f(4793);v.exports=g},81933:function(){(function(v){var C=function(f){var g={searchParams:"URLSearchParams"in v,iterable:"Symbol"in v&&"iterator"in Symbol,blob:"FileReader"in v&&"Blob"in v&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in v,arrayBuffer:"ArrayBuffer"in v};function b(V){return V&&DataView.prototype.isPrototypeOf(V)}if(g.arrayBuffer)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(V){return V&&x.indexOf(Object.prototype.toString.call(V))>-1};function O(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(V))throw new TypeError("Invalid character in header field name");return V.toLowerCase()}function P(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var K={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(K[Symbol.iterator]=function(){return K}),K}function D(V){this.map={},V instanceof D?V.forEach(function(K,le){this.append(le,K)},this):Array.isArray(V)?V.forEach(function(K){this.append(K[0],K[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(K){this.append(K,V[K])},this)}D.prototype.append=function(V,K){V=O(V),K=P(K);var le=this.map[V];this.map[V]=le?le+", "+K:K},D.prototype.delete=function(V){delete this.map[O(V)]},D.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},D.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},D.prototype.set=function(V,K){this.map[O(V)]=P(K)},D.prototype.forEach=function(V,K){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(K,this.map[le],le,this)},D.prototype.keys=function(){var V=[];return this.forEach(function(K,le){V.push(le)}),N(V)},D.prototype.values=function(){var V=[];return this.forEach(function(K){V.push(K)}),N(V)},D.prototype.entries=function(){var V=[];return this.forEach(function(K,le){V.push([le,K])}),N(V)},g.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function L(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function H(V){return new Promise(function(K,le){V.onload=function(){K(V.result)},V.onerror=function(){le(V.error)}})}function J(V){var K=new FileReader,le=H(K);return K.readAsArrayBuffer(V),le}function q(V){var K=new FileReader,le=H(K);return K.readAsText(V),le}function X(V){for(var K=new Uint8Array(V),le=new Array(K.length),ge=0;ge<K.length;ge++)le[ge]=String.fromCharCode(K[ge]);return le.join("")}function G(V){if(V.slice)return V.slice(0);var K=new Uint8Array(V.byteLength);return K.set(new Uint8Array(V)),K.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=G(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=G(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?L(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(J)}),this.text=function(){var V=L(this);if(V)return V;if(this._bodyBlob)return q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(X(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(z)}),this.json=function(){return this.text().then(JSON.parse)},this}var oe=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var K=V.toUpperCase();return oe.indexOf(K)>-1?K:V}function ee(V,K){K=K||{};var le=K.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,K.headers||(this.headers=new D(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new D(K.headers)),this.method=R(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function z(V){var K=new FormData;return V.trim().split("&").forEach(function(le){if(le){var ge=le.split("="),me=ge.shift().replace(/\+/g," "),ve=ge.join("=").replace(/\+/g," ");K.append(decodeURIComponent(me),decodeURIComponent(ve))}}),K}function ne(V){var K=new D,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(ge){var me=ge.split(":"),ve=me.shift().trim();if(ve){var We=me.join(":").trim();K.append(ve,We)}}),K}te.call(ee.prototype);function ie(V,K){K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"OK",this.headers=new D(K.headers),this.url=K.url||"",this._initBody(V)}te.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},ie.error=function(){var V=new ie(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ie.redirect=function(V,K){if(ae.indexOf(K)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:K,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(K,le){this.message=K,this.name=le;var ge=Error(K);this.stack=ge.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ue(V,K){return new Promise(function(le,ge){var me=new ee(V,K);if(me.signal&&me.signal.aborted)return ge(new f.DOMException("Aborted","AbortError"));var ve=new XMLHttpRequest;function We(){ve.abort()}ve.onload=function(){var je={status:ve.status,statusText:ve.statusText,headers:ne(ve.getAllResponseHeaders()||"")};je.url="responseURL"in ve?ve.responseURL:je.headers.get("X-Request-URL");var Ke="response"in ve?ve.response:ve.responseText;le(new ie(Ke,je))},ve.onerror=function(){ge(new TypeError("Network request failed"))},ve.ontimeout=function(){ge(new TypeError("Network request failed"))},ve.onabort=function(){ge(new f.DOMException("Aborted","AbortError"))},ve.open(me.method,me.url,!0),me.credentials==="include"?ve.withCredentials=!0:me.credentials==="omit"&&(ve.withCredentials=!1),"responseType"in ve&&g.blob&&(ve.responseType="blob"),me.headers.forEach(function(je,Ke){ve.setRequestHeader(Ke,je)}),me.signal&&(me.signal.addEventListener("abort",We),ve.onreadystatechange=function(){ve.readyState===4&&me.signal.removeEventListener("abort",We)}),ve.send(typeof me._bodyInit>"u"?null:me._bodyInit)})}return ue.polyfill=!0,v.fetch||(v.fetch=ue,v.Headers=D,v.Request=ee,v.Response=ie),f.Headers=D,f.Request=ee,f.Response=ie,f.fetch=ue,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},17847:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>HI});var g={};f.r(g),f.d(g,{cookie:()=>Wx,header:()=>Vx,path:()=>Bx,query:()=>Fx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),P=f(10017),N=f(86351),D=f(86751),L=f(12953),H=f(55839),J=f(23422);function q(t){return q=typeof H=="function"&&typeof J=="symbol"?function(e){return typeof e}:function(e){return e&&typeof H=="function"&&e.constructor===H&&e!==H.prototype?"symbol":typeof e},q(t)}var X=f(47319);function G(t,e){if(q(t)!=="object"||t===null)return t;var r=t[X];if(r!==void 0){var n=r.call(t,e||"default");if(q(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function te(t){var e=G(t,"string");return q(e)==="symbol"?e:String(e)}function oe(t,e,r){return e=te(e),e in t?L(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t,e){var r=b(t);if(x){var n=x(t);e&&(n=k(n).call(n,function(i){return O(t,i).enumerable})),r.push.apply(r,n)}return r}function ee(t){for(var e=1;e<arguments.length;e++){var r,n,i=arguments[e]!=null?arguments[e]:{};e%2?P(r=R(Object(i),!0)).call(r,function(s){oe(t,s,i[s])}):N?D(t,N(i)):P(n=R(Object(i))).call(n,function(s){L(t,s,O(i,s))})}return t}var z=f(34961);function ne(t,e){if(t==null)return{};var r={},n=b(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(z(e).call(e,i)>=0)&&(r[i]=t[i]);return r}function ie(t,e){if(t==null)return{};var r=ne(t,e),n,i;if(x){var s=x(t);for(i=0;i<s.length;i++)n=s[i],!(z(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var ae=f(13546),ue=f.n(ae),V=f(51121),K=f(26179);/*!
|
|
12
12
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
13
13
|
*
|
|
14
14
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
15
15
|
* Released under the MIT License.
|
|
16
|
-
*/function le(
|
|
16
|
+
*/function le(t){return Object.prototype.toString.call(t)==="[object Object]"}function ge(t){var e,r;return le(t)===!1?!1:(e=t.constructor,e===void 0?!0:(r=e.prototype,!(le(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}var me=f(81933),ve=f(67905),We=f.n(ve);/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function je(t){return typeof t>"u"||t===null}function Ke(t){return typeof t=="object"&&t!==null}function Le(t){return Array.isArray(t)?t:je(t)?[]:[t]}function lt(t,e){var r,n,i,s;if(e)for(s=Object.keys(e),r=0,n=s.length;r<n;r+=1)i=s[r],t[i]=e[i];return t}function Rt(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}function Ot(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}var rr=je,Xe=Ke,Et=Le,wt=Rt,Tt=Ot,hr=lt,De={isNothing:rr,isObject:Xe,toArray:Et,repeat:wt,isNegativeZero:Tt,extend:hr};function St(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
|
|
17
17
|
|
|
18
|
-
`+
|
|
19
|
-
`+a;for(c=
|
|
20
|
-
`,a+=
|
|
21
|
-
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=
|
|
22
|
-
`;return a.replace(/\n$/,"")}var Ri=
|
|
23
|
-
\r`;function
|
|
24
|
-
`:
|
|
25
|
-
`,e-1))}function
|
|
26
|
-
`,s?1+l:l):i===
|
|
27
|
-
`);break}for(n?
|
|
28
|
-
`,s?1+l:l)):c?(c=!1,
|
|
29
|
-
`,l+1)):l===0?s&&(
|
|
30
|
-
`,l):
|
|
31
|
-
`,s?1+l:l),s=!0,o=!0,l=0,t
|
|
32
|
-
`),
|
|
33
|
-
`,n),i===-1?(o=
|
|
34
|
-
`&&(s+=
|
|
35
|
-
`+
|
|
36
|
-
`,i=n&&(
|
|
37
|
-
`||
|
|
38
|
-
`),s=i?"+":n?"":"-";return
|
|
39
|
-
`}function
|
|
40
|
-
`?
|
|
41
|
-
`);return c=c!==-1?c:
|
|
42
|
-
`||
|
|
43
|
-
`:"")+
|
|
44
|
-
`+
|
|
45
|
-
`,
|
|
46
|
-
`+
|
|
47
|
-
`:""}var Y1=K1,J1={dump:Y1};function nc(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=dt,X1=xn,Z1=Wr,_1=Bn,q1=Li,ex=Jl,tx=fh.load,rx=fh.loadAll,nx=J1.dump,ix=ht,sx={binary:Uo,float:Ps,map:Nn,null:Ce,pairs:Qf,set:Xf,timestamp:Fi,bool:Z,int:Ht,merge:ji,omap:Jf,seq:fi,str:Dn},ox=nc("safeLoad","load"),ax=nc("safeLoadAll","loadAll"),lx=nc("safeDump","dump"),cx={Type:Q1,Schema:X1,FAILSAFE_SCHEMA:Z1,JSON_SCHEMA:_1,CORE_SCHEMA:q1,DEFAULT_SCHEMA:ex,load:tx,loadAll:rx,dump:nx,YAMLException:ix,types:sx,safeLoad:ox,safeLoadAll:ax,safeDump:lx};const ux=cx,fx=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Ih,Blob:_o,File:Dh}=fx,hx=r=>":/?#[]@!$&'()*+,;=".indexOf(r)>-1,dx=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(dx(n)||hx(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 ic(r){const{value:e}=r;return Array.isArray(e)?px(r):typeof e=="object"?gx(r):mx(r)}function px(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 gx(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 mx(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 vx=(r,e)=>{e.body=r},sc={serializeRes:wx,mergeInQueryOrForm:Fh};async function yx(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof r=="object"&&(e=r,r=e.url),e.headers=e.headers||{},sc.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 Ih&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await sc.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 bx=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(r)};function xx(r,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(r):ux.load(r)}function wx(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:kx(r.headers)},i=n.headers["content-type"],s=t||bx(i);return(s?r.text:r.blob||r.buffer).call(r).then(a=>{if(n.text=a,n.data=a,s)try{const l=xx(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function Sx(r){return r.includes(", ")?r.split(", "):r}function kx(){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]=Sx(i),e},{})}function oc(r,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(r&&typeof r=="object"&&typeof r.uri=="string"):typeof Dh<"u"&&r instanceof Dh||typeof _o<"u"&&r instanceof _o||ArrayBuffer.isView(r)?!0:r!==null&&typeof r=="object"&&typeof r.pipe=="function"}function Nh(r,e){return Array.isArray(r)&&r.some(t=>oc(t,e))}const Ax={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Cx={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Rh(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(oc(a)||Nh(a))return[[c,a]];if(s)return Lh(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 Lh(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(Cx[n||"csv"])]]:[[c,""]]}function Lh(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(Ax[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 Ox(r){return Object.entries(r).reduce((e,t)=>{let[n,i]=t;for(const[s,o]of Rh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new _o([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new _o([o]);e.append(s,a)}else e.append(s,o);return e},new Ih)}function Bh(r){const e=Object.keys(r).reduce((t,n)=>{for(const[i,s]of Rh(n,r[n]))t[i]=s;return t},{});return $e().stringify(e,{encode:!1,indices:!1})||""}function Fh(){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 oc(l)||Nh(l)}),o=r.headers["content-type"]||r.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Ox(r.form);vx(a,r)}else r.body=Bh(n);delete r.form}if(t){const[s,o]=e.split("?");let a="";if(o){const c=$e().parse(o);Object.keys(t).forEach(h=>delete c[h]),a=$e().stringify(c,{encode:!0})}const l=i(a,Bh(t));r.url=s+l,delete r.query}return r}function GI(r,e,t){return t=t||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),sc.mergeInQueryOrForm(n),n=e(n),t(r(n)))}function Ex(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 Tx={body:Px,header:Ix,query:Nx,path:Dx,formData:Mx};function Px(r){let{req:e,value:t}=r;e.body=t}function Mx(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 Ix(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{},typeof n<"u"&&(e.headers[t.name]=n)}function Dx(r){let{req:e,value:t,parameter:n}=r;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(t))}function Nx(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 qo(r,e){return e.includes("application/json")?typeof r=="string"?r:JSON.stringify(r):r.toString()}function Rx(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(qo(t,c),{escape:!0}));return}const l=ic({key:n.name,value:t,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Lx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=qo(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 Bx=["accept","authorization","content-type"];function Fx(r){let{req:e,parameter:t,value:n}=r;if(e.headers=e.headers||{},!(Bx.indexOf(t.name.toLowerCase())>-1)){if(t.content){const i=Object.keys(t.content)[0];e.headers[t.name]=qo(n,i);return}typeof n<"u"&&(e.headers[t.name]=ic({key:t.name,value:n,style:t.style||"simple",explode:typeof t.explode>"u"?!1:t.explode,escape:!1}))}}function jx(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}=${qo(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+ic({key:t.name,value:n,escape:!1,style:t.style||"form",explode:typeof t.explode>"u"?!1:t.explode})}}const Vx=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Wx}=Vx,jh=Wx;function $x(r,e){const{operation:t,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=r;let{requestContentType:a}=r;e=Hx({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&&pe(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 Hx(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=ce()(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=jh(`${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 P=w.token_type;(!P||P.toLowerCase()==="bearer")&&(P="Bearer"),s.headers.Authorization=`${P} ${T}`}}})}),s)}function zx(r,e){const{spec:t,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=r;if(e=Ux({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 Ux(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",P=m&&m[T];let L=m&&m.token_type;if(p)if(A==="apiKey"){const D=w.in==="query"?"query":"headers";s[D]=s[D]||{},s[D][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const D=y.username||"",j=y.password||"";y.base64=jh(`${D}:${j}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&P&&(L=!L||L.toLowerCase()==="bearer"?"Bearer":L,s.headers.authorization=`${L} ${P}`)})}),s)}function Vh(r,e){return`${e.toLowerCase()}-${r}`}function Gx(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 Kx(r,e){return Gx(r,e,!0)||null}const Wh=r=>r.replace(/\W/gi,"_");function Yx(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()}${Wh(r)}`}function Jx(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?Wh(r.operationId):Yx(e,t,{v2OperationIdCompatibilityMode:n})}function Qx(r,e){return!r||!r.paths?null:Kx(r,t=>{let{pathName:n,method:i,operation:s}=t;if(!s||typeof s!="object")return!1;const o=s.operationId,a=Jx(s,n,i),l=Vh(n,i);return[a,l,o].some(c=>c&&c===e)})}const YI=r=>{try{const{swagger:e}=r;return e==="2.0"}catch{return!1}},Xx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},Zx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},$h=r=>Xx(r)||Zx(r),_x=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Hh=r=>Array.isArray(r)?r:[],qx=Ex("OperationNotFoundError",function(e,t,n){this.originalError=n,Object.assign(this,t||{})}),ew=(r,e)=>e.filter(t=>t.name===r),tw=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},rw={buildRequest:iw};function nw(r){let{http:e,fetch:t,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=r,c=ne(r,_x);const u=e||t||yx;s&&o&&!i&&(i=Vh(s,o));const h=rw.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(pe(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function iw(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=$h(e);m||(y?m=g:m=Tx);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 qx(`Operation ${t} not found`);const{operation:P={},method:L,pathName:D}=T;if(A.url+=sw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:D,method:L}),!t)return delete A.cookies,A;A.url+=D,A.method=`${L}`.toUpperCase(),p=p||{};const j=e.paths[D]||{};n&&(A.headers.accept=n);const W=tw([].concat(Hh(P.parameters)).concat(Hh(j.parameters)));W.forEach(F=>{const H=m[F.in];let Q;if(F.in==="body"&&F.schema&&F.schema.properties&&(Q=p),Q=F&&F.name&&p[F.name],typeof Q>"u"?Q=F&&F.name&&p[`${F.in}.${F.name}`]:ew(F.name,W).length>1&&console.warn(`Parameter '${F.name}' is ambiguous because the defined spec has more than one parameter with the name: '${F.name}' and the passed-in parameter values did not define an 'in' value.`),Q!==null){if(typeof F.default<"u"&&typeof Q>"u"&&(Q=F.default),typeof Q>"u"&&F.required&&!F.allowEmptyValue)throw new Error(`Required parameter ${F.name} is not provided`);if(y&&F.schema&&F.schema.type==="object"&&typeof Q=="string")try{Q=JSON.parse(Q)}catch{throw new Error("Could not parse object parameter value string as JSON")}H&&H({req:A,parameter:F,value:Q,operation:P,spec:e})}});const q=ee(ee({},r),{},{operation:P});if(y?A=$x(q,A):A=zx(q,A),A.cookies&&Object.keys(A.cookies).length){const F=Object.keys(A.cookies).reduce((H,Q)=>{const oe=A.cookies[Q],fe=H?"&":"",be=K.serialize(Q,oe);return H+fe+be},"");A.headers.Cookie=F}return A.cookies&&delete A.cookies,Fh(A),A}const ac=r=>r?r.replace(/\W/g,""):null;function sw(r){return $h(r.spec)?ow(r):cw(r)}function ow(r){let{spec:e,pathName:t,method:n,server:i,contextUrl:s,serverVariables:o={}}=r;const a=ce()(e,["paths",t,(n||"").toLowerCase(),"servers"])||ce()(e,["paths",t,"servers"])||ce()(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&&lw(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)}}),aw(l,s)}function aw(){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=ac(t.protocol)||ac(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 lw(r){const e=[],t=/{([^}]+)}/g;let n;for(;n=t.exec(r);)e.push(n[1]);return e}function cw(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||ac(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(29901),pt=f(20202),$r=f(44411),gt=f(88606),uw=f(81570),fw=f(74025),hw=f(2526),dw=Object.defineProperty,pw=Object.defineProperties,gw=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,mw=Object.prototype.hasOwnProperty,vw=Object.prototype.propertyIsEnumerable,Uh=(r,e,t)=>e in r?dw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yw=(r,e)=>{for(var t in e||(e={}))mw.call(e,t)&&Uh(r,t,e[t]);if(zh)for(var t of zh(e))vw.call(e,t)&&Uh(r,t,e[t]);return r},bw=(r,e)=>pw(r,gw(e)),xw=(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 ww(r,e){return xw(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=bw(yw({},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 fw.Config({}),u=(0,hw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,uw.bundle)(h),o})}var Sw=f(98910),ea=f(84862),Xr=f(53134),Gh=(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 Kh=Object.values(Xr.FileUploadFormats),kw=["application/octet-stream","application/pdf","application/gzip","application/zip"],Yh=["image/","audio/","video/"];function Jh(r){if(Yh.some(e=>r.startsWith(e)))return r}function ta(r){return kw.includes(r)?!0:Yh.some(e=>r.startsWith(e))}function Aw(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||(ta(t)?"binary":"");return e.type===Xr.DefinitionTypes.STRING&&Kh.includes(n)}function Qh(r,e){if(!r||!r.type||r.type==="any")return ta(e);const t=r.format||r.contentEncoding||"";return r.type===Xr.DefinitionTypes.STRING&&Kh.includes(t)}function Xh(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 Zh({format:r,contentEncoding:e,contentMediaType:t}){return[r,e,t].includes(Xr.FileUploadFormats.BASE64)}function Cw(r,e){return Gh(this,null,function*(){const t=Object.values(r);let n=t.length===1?t[0]:t;return e.type===Xr.DefinitionTypes.STRING&&Zh(e)?n=yield Xh(t[0]):e.type===Xr.DefinitionTypes.ARRAY&&e.items&&(Zh(e.items)?n=yield Promise.all(t.map(s=>Gh(this,null,function*(){return yield Xh(s)}))):n=t),n})}var lc=f(84622),je=f(38612),Je=f(97495),Ee=f(85739),Mr=f(71608),Ow=f(64393),Wn=f(60991);function Ew({response:r}){const{jsonSampleExpandLevel:e}=(0,$r.Dv)(Wn.qd);return S.createElement(S.Fragment,null,S.createElement(Mr.EE,null," Body: "),Tw(r,e))}function Tw(r,e){return r.body?S.createElement(pt.JsonViewer,{data:r.body,jsonSampleExpandLevel:e}):r.fileInfo?S.createElement(Ow.s,{fileInfo:r.fileInfo}):r.data!==null?r.data?S.createElement(pt.CodeBlock,{lang:(0,Ee.M)(r.headers["Content-Type"]||"text/plain"),source:r.data,header:{controls:{copy:{}}}}):S.createElement(pt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Pw({headers:r}){const e=(0,$r.Dv)(Wn.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(Mr.EE,null," Headers: "),S.createElement(pt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(_h,null,c,":"),S.createElement("code",null,r[c]))),o&&S.createElement(qh,{onClick:l},t?"Show more...":"Hide headers")))}const _h=Je.ZP.strong`
|
|
18
|
+
`+t.mark.snippet),n+" "+r):n}function Ht(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=St(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ht.prototype=Object.create(Error.prototype),Ht.prototype.constructor=Ht,Ht.prototype.toString=function(e){return this.name+": "+St(this,e)};var pt=Ht;function Ir(t,e,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+t.slice(e,r).replace(/\t/g,"\u2192")+o,pos:n-e+s.length}}function dr(t,e){return De.repeat(" ",e-t.length)+t}function Wr(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",l,c,u=Math.min(t.line+e.linesAfter,i.length).toString().length,h=e.maxLength-(e.indent+u+3);for(l=1;l<=e.linesBefore&&!(o-l<0);l++)c=Ir(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),h),a=De.repeat(" ",e.indent)+dr((t.line-l+1).toString(),u)+" | "+c.str+`
|
|
19
|
+
`+a;for(c=Ir(t.buffer,n[o],i[o],t.position,h),a+=De.repeat(" ",e.indent)+dr((t.line+1).toString(),u)+" | "+c.str+`
|
|
20
|
+
`,a+=De.repeat("-",e.indent+u+3+c.pos)+`^
|
|
21
|
+
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Ir(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),h),a+=De.repeat(" ",e.indent)+dr((t.line+l+1).toString(),u)+" | "+c.str+`
|
|
22
|
+
`;return a.replace(/\n$/,"")}var Ri=Wr,Dr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],pr=["scalar","sequence","mapping"];function gr(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}function Jr(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(Dr.indexOf(r)===-1)throw new pt('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=gr(e.styleAliases||null),pr.indexOf(this.kind)===-1)throw new pt('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}var gt=Jr;function Dn(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}function fi(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}function xn(t){return this.extend(t)}xn.prototype.extend=function(e){var r=[],n=[];if(e instanceof gt)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new pt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof gt))throw new pt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new pt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new pt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof gt))throw new pt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(xn.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Dn(i,"implicit"),i.compiledExplicit=Dn(i,"explicit"),i.compiledTypeMap=fi(i.compiledImplicit,i.compiledExplicit),i};var wn=xn,Nn=new gt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}}),hi=new gt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}}),Rn=new gt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}}),$r=new wn({explicit:[Nn,hi,Rn]});function Ln(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function di(){return null}function Ze(t){return t===null}var Ce=new gt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ln,construct:di,predicate:Ze,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ne(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function Te(t){return t==="true"||t==="True"||t==="TRUE"}function $(t){return Object.prototype.toString.call(t)==="[object Boolean]"}var Z=new gt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ne,construct:Te,predicate:$,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function He(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function _e(t){return 48<=t&&t<=55}function ct(t){return 48<=t&&t<=57}function Pe(t){if(t===null)return!1;var e=t.length,r=0,n=!1,i;if(!e)return!1;if(i=t[r],(i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!He(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!_e(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!ct(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}function Qr(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}function Sn(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!De.isNegativeZero(t)}var zt=new gt("tag:yaml.org,2002:int",{kind:"scalar",resolve:Pe,construct:Qr,predicate:Sn,represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xr=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ps(t){return!(t===null||!Xr.test(t)||t[t.length-1]==="_")}function Bn(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}var mr=/^[-+]?[0-9]+e/;function Wo(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(De.isNegativeZero(t))return"-0.0";return r=t.toString(10),mr.test(r)?r.replace("e",".e"):r}function $o(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||De.isNegativeZero(t))}var Ms=new gt("tag:yaml.org,2002:float",{kind:"scalar",resolve:Ps,construct:Bn,predicate:$o,represent:Wo,defaultStyle:"lowercase"}),Fn=$r.extend({implicit:[Ce,Z,zt,Ms]}),Li=Fn,pi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Bi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Is(t){return t===null?!1:pi.exec(t)!==null||Bi.exec(t)!==null}function Ho(t){var e,r,n,i,s,o,a,l=0,c=null,u,h,d;if(e=pi.exec(t),e===null&&(e=Bi.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],h=+(e[11]||0),c=(u*60+h)*6e4,e[9]==="-"&&(c=-c)),d=new Date(Date.UTC(r,n,i,s,o,a,l)),c&&d.setTime(d.getTime()-c),d}function zo(t){return t.toISOString()}var Fi=new gt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Is,construct:Ho,instanceOf:Date,represent:zo});function Uo(t){return t==="<<"||t===null}var ji=new gt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Uo}),Vi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
23
|
+
\r`;function Jl(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=Vi;for(r=0;r<i;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function Ds(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=Vi,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}function jn(t){var e="",r=0,n,i,s=t.length,o=Vi;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[n];return i=s%3,i===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):i===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):i===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}function Wi(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}var Go=new gt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Jl,construct:Ds,predicate:Wi,represent:jn}),Ko=Object.prototype.hasOwnProperty,Fb=Object.prototype.toString;function jb(t){if(t===null)return!0;var e=[],r,n,i,s,o,a=t;for(r=0,n=a.length;r<n;r+=1){if(i=a[r],o=!1,Fb.call(i)!=="[object Object]")return!1;for(s in i)if(Ko.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 Vb(t){return t!==null?t:[]}var Qf=new gt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:jb,construct:Vb}),Wb=Object.prototype.toString;function $b(t){if(t===null)return!0;var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1){if(n=o[e],Wb.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}function Hb(t){if(t===null)return[];var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}var Xf=new gt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:$b,construct:Hb}),zb=Object.prototype.hasOwnProperty;function Ub(t){if(t===null)return!0;var e,r=t;for(e in r)if(zb.call(r,e)&&r[e]!==null)return!1;return!0}function Gb(t){return t!==null?t:{}}var Zf=new gt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Ub,construct:Gb}),Ql=Li.extend({implicit:[Fi,ji],explicit:[Go,Qf,Xf,Zf]}),Vn=Object.prototype.hasOwnProperty,Yo=1,_f=2,qf=3,Jo=4,Xl=1,Kb=2,eh=3,Yb=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Jb=/[\x85\u2028\u2029]/,Qb=/[,\[\]\{\}]/,th=/^(?:!|!!|![a-z\-]+!)$/i,rh=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function nh(t){return Object.prototype.toString.call(t)}function Zr(t){return t===10||t===13}function gi(t){return t===9||t===32}function ar(t){return t===9||t===32||t===10||t===13}function $i(t){return t===44||t===91||t===93||t===123||t===125}function Xb(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function Zb(t){return t===120?2:t===117?4:t===85?8:0}function _b(t){return 48<=t&&t<=57?t-48:-1}function ih(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
|
|
24
|
+
`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function qb(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}for(var sh=new Array(256),oh=new Array(256),Hi=0;Hi<256;Hi++)sh[Hi]=ih(Hi)?1:0,oh[Hi]=ih(Hi);function e1(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Ql,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ah(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=Ri(r),new pt(e,r)}function Se(t,e){throw ah(t,e)}function Qo(t,e){t.onWarning&&t.onWarning.call(null,ah(t,e))}var lh={YAML:function(e,r,n){var i,s,o;e.version!==null&&Se(e,"duplication of %YAML directive"),n.length!==1&&Se(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Se(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Se(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Qo(e,"unsupported YAML version of the document")},TAG:function(e,r,n){var i,s;n.length!==2&&Se(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],th.test(i)||Se(e,"ill-formed tag handle (first argument) of the TAG directive"),Vn.call(e.tagMap,i)&&Se(e,'there is a previously declared suffix for "'+i+'" tag handle'),rh.test(s)||Se(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Se(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s}};function Wn(t,e,r,n){var i,s,o,a;if(e<r){if(a=t.input.slice(e,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||Se(t,"expected valid JSON character");else Yb.test(a)&&Se(t,"the stream contains non-printable characters");t.result+=a}}function ch(t,e,r,n){var i,s,o,a;for(De.isObject(r)||Se(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],Vn.call(e,s)||(e[s]=r[s],n[s]=!0)}function zi(t,e,r,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&Se(t,"nested arrays are not supported inside keys"),typeof i=="object"&&nh(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&nh(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)ch(t,e,s[c],r);else ch(t,e,s,r);else!t.json&&!Vn.call(r,i)&&Vn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,Se(t,"duplicated mapping key")),i==="__proto__"?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:s}):e[i]=s,delete r[i];return e}function Zl(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):Se(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function kt(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;gi(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(Zr(i))for(Zl(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&Qo(t,"deficient indentation"),n}function Xo(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||ar(r)))}function _l(t,e){e===1?t.result+=" ":e>1&&(t.result+=De.repeat(`
|
|
25
|
+
`,e-1))}function t1(t,e,r){var n,i,s,o,a,l,c,u,h=t.kind,d=t.result,p;if(p=t.input.charCodeAt(t.position),ar(p)||$i(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=t.input.charCodeAt(t.position+1),ar(i)||r&&$i(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;p!==0;){if(p===58){if(i=t.input.charCodeAt(t.position+1),ar(i)||r&&$i(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),ar(n))break}else{if(t.position===t.lineStart&&Xo(t)||r&&$i(p))break;if(Zr(p))if(l=t.line,c=t.lineStart,u=t.lineIndent,kt(t,!1,-1),t.lineIndent>=e){a=!0,p=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=c,t.lineIndent=u;break}}a&&(Wn(t,s,o,!1),_l(t,t.line-l),s=o=t.position,a=!1),gi(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return Wn(t,s,o,!1),t.result?!0:(t.kind=h,t.result=d,!1)}function r1(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(Wn(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else Zr(r)?(Wn(t,n,i,!0),_l(t,kt(t,!1,e)),n=i=t.position):t.position===t.lineStart&&Xo(t)?Se(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);Se(t,"unexpected end of the stream within a single quoted scalar")}function n1(t,e){var r,n,i,s,o,a;if(a=t.input.charCodeAt(t.position),a!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(a=t.input.charCodeAt(t.position))!==0;){if(a===34)return Wn(t,r,t.position,!0),t.position++,!0;if(a===92){if(Wn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),Zr(a))kt(t,!1,e);else if(a<256&&sh[a])t.result+=oh[a],t.position++;else if((o=Zb(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=Xb(a))>=0?s=(s<<4)+o:Se(t,"expected hexadecimal character");t.result+=qb(s),t.position++}else Se(t,"unknown escape sequence");r=n=t.position}else Zr(a)?(Wn(t,r,n,!0),_l(t,kt(t,!1,e)),r=n=t.position):t.position===t.lineStart&&Xo(t)?Se(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}Se(t,"unexpected end of the stream within a double quoted scalar")}function i1(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,c,u,h,d,p,m=Object.create(null),y,w,A,T;if(T=t.input.charCodeAt(t.position),T===91)u=93,p=!1,a=[];else if(T===123)u=125,p=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),T=t.input.charCodeAt(++t.position);T!==0;){if(kt(t,!0,e),T=t.input.charCodeAt(t.position),T===u)return t.position++,t.tag=o,t.anchor=l,t.kind=p?"mapping":"sequence",t.result=a,!0;r?T===44&&Se(t,"expected the node content, but found ','"):Se(t,"missed comma between flow collection entries"),w=y=A=null,h=d=!1,T===63&&(c=t.input.charCodeAt(t.position+1),ar(c)&&(h=d=!0,t.position++,kt(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Ui(t,e,Yo,!1,!0),w=t.tag,y=t.result,kt(t,!0,e),T=t.input.charCodeAt(t.position),(d||t.line===n)&&T===58&&(h=!0,T=t.input.charCodeAt(++t.position),kt(t,!0,e),Ui(t,e,Yo,!1,!0),A=t.result),p?zi(t,a,m,w,y,A,n,i,s):h?a.push(zi(t,null,m,w,y,A,n,i,s)):a.push(y),kt(t,!0,e),T=t.input.charCodeAt(t.position),T===44?(r=!0,T=t.input.charCodeAt(++t.position)):r=!1}Se(t,"unexpected end of the stream within a flow collection")}function s1(t,e){var r,n,i=Xl,s=!1,o=!1,a=e,l=0,c=!1,u,h;if(h=t.input.charCodeAt(t.position),h===124)n=!1;else if(h===62)n=!0;else return!1;for(t.kind="scalar",t.result="";h!==0;)if(h=t.input.charCodeAt(++t.position),h===43||h===45)Xl===i?i=h===43?eh:Kb:Se(t,"repeat of a chomping mode identifier");else if((u=_b(h))>=0)u===0?Se(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Se(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(gi(h)){do h=t.input.charCodeAt(++t.position);while(gi(h));if(h===35)do h=t.input.charCodeAt(++t.position);while(!Zr(h)&&h!==0)}for(;h!==0;){for(Zl(t),t.lineIndent=0,h=t.input.charCodeAt(t.position);(!o||t.lineIndent<a)&&h===32;)t.lineIndent++,h=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>a&&(a=t.lineIndent),Zr(h)){l++;continue}if(t.lineIndent<a){i===eh?t.result+=De.repeat(`
|
|
26
|
+
`,s?1+l:l):i===Xl&&s&&(t.result+=`
|
|
27
|
+
`);break}for(n?gi(h)?(c=!0,t.result+=De.repeat(`
|
|
28
|
+
`,s?1+l:l)):c?(c=!1,t.result+=De.repeat(`
|
|
29
|
+
`,l+1)):l===0?s&&(t.result+=" "):t.result+=De.repeat(`
|
|
30
|
+
`,l):t.result+=De.repeat(`
|
|
31
|
+
`,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!Zr(h)&&h!==0;)h=t.input.charCodeAt(++t.position);Wn(t,r,t.position,!1)}return!0}function uh(t,e){var r,n=t.tag,i=t.anchor,s=[],o,a=!1,l;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),l=t.input.charCodeAt(t.position);l!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Se(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!ar(o))));){if(a=!0,t.position++,kt(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Ui(t,e,qf,!1,!0),s.push(t.result),kt(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)Se(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}function o1(t,e,r){var n,i,s,o,a,l,c=t.tag,u=t.anchor,h={},d=Object.create(null),p=null,m=null,y=null,w=!1,A=!1,T;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=h),T=t.input.charCodeAt(t.position);T!==0;){if(!w&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Se(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(T===63||T===58)&&ar(n))T===63?(w&&(zi(t,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!0,i=!0):w?(w=!1,i=!0):Se(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,T=n;else{if(o=t.line,a=t.lineStart,l=t.position,!Ui(t,r,_f,!1,!0))break;if(t.line===s){for(T=t.input.charCodeAt(t.position);gi(T);)T=t.input.charCodeAt(++t.position);if(T===58)T=t.input.charCodeAt(++t.position),ar(T)||Se(t,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(zi(t,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!1,i=!1,p=t.tag,m=t.result;else if(A)Se(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=u,!0}else if(A)Se(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=c,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(w&&(o=t.line,a=t.lineStart,l=t.position),Ui(t,e,Jo,!0,i)&&(w?m=t.result:y=t.result),w||(zi(t,h,d,p,m,y,o,a,l),p=m=y=null),kt(t,!0,-1),T=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&T!==0)Se(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return w&&zi(t,h,d,p,m,null,o,a,l),A&&(t.tag=c,t.anchor=u,t.kind="mapping",t.result=h),A}function a1(t){var e,r=!1,n=!1,i,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&Se(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,i="!!",o=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):Se(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ar(o);)o===33&&(n?Se(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),th.test(i)||Se(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),Qb.test(s)&&Se(t,"tag suffix cannot contain flow indicator characters")}s&&!rh.test(s)&&Se(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Se(t,"tag name is malformed: "+s)}return r?t.tag=s:Vn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:Se(t,'undeclared tag handle "'+i+'"'),!0}function l1(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Se(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!ar(r)&&!$i(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Se(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function c1(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!ar(n)&&!$i(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&Se(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Vn.call(t.anchorMap,r)||Se(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],kt(t,!0,-1),!0}function Ui(t,e,r,n,i){var s,o,a,l=1,c=!1,u=!1,h,d,p,m,y,w;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,s=o=a=Jo===r||qf===r,n&&kt(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;a1(t)||l1(t);)kt(t,!0,-1)?(c=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||Jo===r)&&(Yo===r||_f===r?y=e:y=e+1,w=t.position-t.lineStart,l===1?a&&(uh(t,w)||o1(t,w,y))||i1(t,y)?u=!0:(o&&s1(t,y)||r1(t,y)||n1(t,y)?u=!0:c1(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&Se(t,"alias node should not have any properties")):t1(t,y,Yo===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&uh(t,w))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&Se(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),h=0,d=t.implicitTypes.length;h<d;h+=1)if(m=t.implicitTypes[h],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Vn.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,p=t.typeMap.multi[t.kind||"fallback"],h=0,d=p.length;h<d;h+=1)if(t.tag.slice(0,p[h].tag.length)===p[h].tag){m=p[h];break}m||Se(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Se(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Se(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}function u1(t){var e=t.position,r,n,i,s=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(kt(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(s=!0,o=t.input.charCodeAt(++t.position),r=t.position;o!==0&&!ar(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&Se(t,"directive name must not be less than one character in length");o!==0;){for(;gi(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Zr(o));break}if(Zr(o))break;for(r=t.position;o!==0&&!ar(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Zl(t),Vn.call(lh,n)?lh[n](t,n,i):Qo(t,'unknown document directive "'+n+'"')}if(kt(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,kt(t,!0,-1)):s&&Se(t,"directives end mark is expected"),Ui(t,t.lineIndent-1,Jo,!1,!0),kt(t,!0,-1),t.checkLineBreaks&&Jb.test(t.input.slice(e,t.position))&&Qo(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Xo(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,kt(t,!0,-1));return}if(t.position<t.length-1)Se(t,"end of the stream or a document separator is expected");else return}function fh(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
32
|
+
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new e1(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Se(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)u1(r);return r.documents}function f1(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=fh(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}function h1(t,e){var r=fh(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new pt("expected a single document in the stream, but found more")}}var d1=f1,p1=h1,hh={loadAll:d1,load:p1},dh=Object.prototype.toString,ph=Object.prototype.hasOwnProperty,ql=65279,g1=9,Ns=10,m1=13,v1=32,y1=33,b1=34,ec=35,x1=37,w1=38,S1=39,k1=42,gh=44,A1=45,Zo=58,C1=61,O1=62,E1=63,T1=64,mh=91,vh=93,P1=96,yh=123,M1=124,bh=125,Ut={};Ut[0]="\\0",Ut[7]="\\a",Ut[8]="\\b",Ut[9]="\\t",Ut[10]="\\n",Ut[11]="\\v",Ut[12]="\\f",Ut[13]="\\r",Ut[27]="\\e",Ut[34]='\\"',Ut[92]="\\\\",Ut[133]="\\N",Ut[160]="\\_",Ut[8232]="\\L",Ut[8233]="\\P";var I1=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],D1=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function N1(t,e){var r,n,i,s,o,a,l;if(e===null)return{};for(r={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=t.compiledTypeMap.fallback[o],l&&ph.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}function R1(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new pt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+De.repeat("0",n-e.length)+e}var L1=1,Rs=2;function B1(t){this.schema=t.schema||Ql,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=De.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=N1(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?Rs:L1,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function xh(t,e){for(var r=De.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
|
|
33
|
+
`,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
34
|
+
`&&(s+=r),s+=o;return s}function tc(t,e){return`
|
|
35
|
+
`+De.repeat(" ",t.indent*e)}function F1(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}function _o(t){return t===v1||t===g1}function Ls(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==ql||65536<=t&&t<=1114111}function wh(t){return Ls(t)&&t!==ql&&t!==m1&&t!==Ns}function Sh(t,e,r){var n=wh(t),i=n&&!_o(t);return(r?n:n&&t!==gh&&t!==mh&&t!==vh&&t!==yh&&t!==bh)&&t!==ec&&!(e===Zo&&!i)||wh(e)&&!_o(e)&&t===ec||e===Zo&&i}function j1(t){return Ls(t)&&t!==ql&&!_o(t)&&t!==A1&&t!==E1&&t!==Zo&&t!==gh&&t!==mh&&t!==vh&&t!==yh&&t!==bh&&t!==ec&&t!==w1&&t!==k1&&t!==y1&&t!==M1&&t!==C1&&t!==O1&&t!==S1&&t!==b1&&t!==x1&&t!==T1&&t!==P1}function V1(t){return!_o(t)&&t!==Zo}function Bs(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function kh(t){var e=/^\n* /;return e.test(t)}var Ah=1,rc=2,Ch=3,Oh=4,Gi=5;function W1(t,e,r,n,i,s,o,a){var l,c=0,u=null,h=!1,d=!1,p=n!==-1,m=-1,y=j1(Bs(t,0))&&V1(Bs(t,t.length-1));if(e||o)for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=Bs(t,l),!Ls(c))return Gi;y=y&&Sh(c,u,a),u=c}else{for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=Bs(t,l),c===Ns)h=!0,p&&(d=d||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Ls(c))return Gi;y=y&&Sh(c,u,a),u=c}d=d||p&&l-m-1>n&&t[m+1]!==" "}return!h&&!d?y&&!o&&!i(t)?Ah:s===Rs?Gi:rc:r>9&&kh(t)?Gi:o?s===Rs?Gi:rc:d?Oh:Ch}function $1(t,e,r,n,i){t.dump=function(){if(e.length===0)return t.quotingType===Rs?'""':"''";if(!t.noCompatMode&&(I1.indexOf(e)!==-1||D1.test(e)))return t.quotingType===Rs?'"'+e+'"':"'"+e+"'";var s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),a=n||t.flowLevel>-1&&r>=t.flowLevel;function l(c){return F1(t,c)}switch(W1(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case Ah:return e;case rc:return"'"+e.replace(/'/g,"''")+"'";case Ch:return"|"+Eh(e,t.indent)+Th(xh(e,s));case Oh:return">"+Eh(e,t.indent)+Th(xh(H1(e,o),s));case Gi:return'"'+z1(e)+'"';default:throw new pt("impossible error: invalid scalar style")}}()}function Eh(t,e){var r=kh(t)?String(e):"",n=t[t.length-1]===`
|
|
36
|
+
`,i=n&&(t[t.length-2]===`
|
|
37
|
+
`||t===`
|
|
38
|
+
`),s=i?"+":n?"":"-";return r+s+`
|
|
39
|
+
`}function Th(t){return t[t.length-1]===`
|
|
40
|
+
`?t.slice(0,-1):t}function H1(t,e){for(var r=/(\n+)([^\n]*)/g,n=function(){var c=t.indexOf(`
|
|
41
|
+
`);return c=c!==-1?c:t.length,r.lastIndex=c,Ph(t.slice(0,c),e)}(),i=t[0]===`
|
|
42
|
+
`||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
43
|
+
`:"")+Ph(l,e),i=s}return n}function Ph(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=r.exec(t);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
|
|
44
|
+
`+t.slice(i,s),i=s+1),o=a;return l+=`
|
|
45
|
+
`,t.length-i>e&&o>i?l+=t.slice(i,o)+`
|
|
46
|
+
`+t.slice(o+1):l+=t.slice(i),l.slice(1)}function z1(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Bs(t,i),n=Ut[r],!n&&Ls(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||R1(r);return e}function U1(t,e,r){var n="",i=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(kn(t,e,a,!1,!1)||typeof a>"u"&&kn(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}function Mh(t,e,r,n){var i="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(kn(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&kn(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=tc(t,e)),t.dump&&Ns===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}function G1(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),kn(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),kn(t,e,c,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}function K1(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,c,u,h,d;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new pt("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)d="",(!n||i!=="")&&(d+=tc(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),kn(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&Ns===t.dump.charCodeAt(0)?d+="?":d+="? "),d+=t.dump,h&&(d+=tc(t,e)),kn(t,e+1,u,!0,h)&&(t.dump&&Ns===t.dump.charCodeAt(0)?d+=":":d+=": ",d+=t.dump,i+=d));t.tag=s,t.dump=i||"{}"}function Ih(t,e,r){var n,i,s,o,a,l;for(i=r?t.explicitTypes:t.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,dh.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(ph.call(a.represent,l))n=a.represent[l](e,l);else throw new pt("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}function kn(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Ih(t,r,!1)||Ih(t,r,!0);var a=dh.call(t.dump),l=n,c;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,d;if(u&&(h=t.duplicates.indexOf(r),d=h!==-1),(t.tag!==null&&t.tag!=="?"||d||t.indent!==2&&e>0)&&(i=!1),d&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&d&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(K1(t,e,t.dump,i),d&&(t.dump="&ref_"+h+t.dump)):(G1(t,e,t.dump),d&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Mh(t,e-1,t.dump,i):Mh(t,e,t.dump,i),d&&(t.dump="&ref_"+h+t.dump)):(U1(t,e,t.dump),d&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&$1(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new pt("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function Y1(t,e){var r=[],n=[],i,s;for(nc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}function nc(t,e,r){var n,i,s;if(t!==null&&typeof t=="object")if(i=e.indexOf(t),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(e.push(t),Array.isArray(t))for(i=0,s=t.length;i<s;i+=1)nc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)nc(t[n[i]],e,r)}function J1(t,e){e=e||{};var r=new B1(e);r.noRefs||Y1(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),kn(r,0,n,!0,!0)?r.dump+`
|
|
47
|
+
`:""}var Q1=J1,X1={dump:Q1};function ic(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var Z1=gt,_1=wn,q1=$r,ex=Fn,tx=Li,rx=Ql,nx=hh.load,ix=hh.loadAll,sx=X1.dump,ox=pt,ax={binary:Go,float:Ms,map:Rn,null:Ce,pairs:Xf,set:Zf,timestamp:Fi,bool:Z,int:zt,merge:ji,omap:Qf,seq:hi,str:Nn},lx=ic("safeLoad","load"),cx=ic("safeLoadAll","loadAll"),ux=ic("safeDump","dump"),fx={Type:Z1,Schema:_1,FAILSAFE_SCHEMA:q1,JSON_SCHEMA:ex,CORE_SCHEMA:tx,DEFAULT_SCHEMA:rx,load:nx,loadAll:ix,dump:sx,YAMLException:ox,types:ax,safeLoad:lx,safeLoadAll:cx,safeDump:ux};const hx=fx,dx=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Dh,Blob:qo,File:Nh}=dx,px=t=>":/?#[]@!$&'()*+,;=".indexOf(t)>-1,gx=t=>/^[a-z0-9\-._~]+$/i.test(t);function Ki(t){let{escape:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return typeof t=="number"&&(t=t.toString()),typeof t!="string"||!t.length||!e?t:r?JSON.parse(t):[...t].map(n=>{if(gx(n)||px(n)&&e==="unsafe")return n;const i=new TextEncoder;return Array.from(i.encode(n)).map(o=>`0${o.toString(16).toUpperCase()}`.slice(-2)).map(o=>`%${o}`).join("")}).join("")}function sc(t){const{value:e}=t;return Array.isArray(e)?mx(t):typeof e=="object"?vx(t):yx(t)}function mx(t){let{key:e,value:r,style:n,explode:i,escape:s}=t;const o=a=>Ki(a,{escape:s});if(n==="simple")return r.map(a=>o(a)).join(",");if(n==="label")return`.${r.map(a=>o(a)).join(".")}`;if(n==="matrix")return r.map(a=>o(a)).reduce((a,l)=>!a||i?`${a||""};${e}=${l}`:`${a},${l}`,"");if(n==="form"){const a=i?`&${e}=`:",";return r.map(l=>o(l)).join(a)}if(n==="spaceDelimited"){const a=i?`${e}=`:"";return r.map(l=>o(l)).join(` ${a}`)}if(n==="pipeDelimited"){const a=i?`${e}=`:"";return r.map(l=>o(l)).join(`|${a}`)}}function vx(t){let{key:e,value:r,style:n,explode:i,escape:s}=t;const o=l=>Ki(l,{escape:s}),a=Object.keys(r);if(n==="simple")return a.reduce((l,c)=>{const u=o(r[c]),h=i?"=":",";return`${l?`${l},`:""}${c}${h}${u}`},"");if(n==="label")return a.reduce((l,c)=>{const u=o(r[c]),h=i?"=":".";return`${l?`${l}.`:"."}${c}${h}${u}`},"");if(n==="matrix"&&i)return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l};`:";"}${c}=${u}`},"");if(n==="matrix")return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l},`:`;${e}=`}${c},${u}`},"");if(n==="form")return a.reduce((l,c)=>{const u=o(r[c]);return`${l?`${l}${i?"&":","}`:""}${c}${i?"=":","}${u}`},"")}function yx(t){let{key:e,value:r,style:n,escape:i}=t;const s=o=>Ki(o,{escape:i});if(n==="simple")return s(r);if(n==="label")return`.${s(r)}`;if(n==="matrix")return`;${e}=${s(r)}`;if(n==="form")return s(r);if(n==="deepObject")return s(r,{},!0)}const bx=(t,e)=>{e.body=t},oc={serializeRes:kx,mergeInQueryOrForm:jh};async function xx(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof t=="object"&&(e=t,t=e.url),e.headers=e.headers||{},oc.mergeInQueryOrForm(e),e.headers&&Object.keys(e.headers).forEach(i=>{const s=e.headers[i];typeof s=="string"&&(e.headers[i]=s.replace(/\n+/g," "))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);const r=e.headers["content-type"]||e.headers["Content-Type"];/multipart\/form-data/i.test(r)&&e.body instanceof Dh&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await oc.serializeRes(n,t,e),e.responseInterceptor&&(n=await e.responseInterceptor(n)||n)}catch(i){if(!n)throw i;const s=new Error(n.statusText||`response status is ${n.status}`);throw s.status=n.status,s.statusCode=n.status,s.responseError=i,s}if(!n.ok){const i=new Error(n.statusText||`response status is ${n.status}`);throw i.status=n.status,i.statusCode=n.status,i.response=n,i}return n}const wx=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(t)};function Sx(t,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(t):hx.load(t)}function kx(t,e){let{loadSpec:r=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n={ok:t.ok,url:t.url||e,status:t.status,statusText:t.statusText,headers:Cx(t.headers)},i=n.headers["content-type"],s=r||wx(i);return(s?t.text:t.blob||t.buffer).call(t).then(a=>{if(n.text=a,n.data=a,s)try{const l=Sx(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function Ax(t){return t.includes(", ")?t.split(", "):t}function Cx(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return typeof t.entries!="function"?{}:Array.from(t.entries()).reduce((e,r)=>{let[n,i]=r;return e[n]=Ax(i),e},{})}function ac(t,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(t&&typeof t=="object"&&typeof t.uri=="string"):typeof Nh<"u"&&t instanceof Nh||typeof qo<"u"&&t instanceof qo||ArrayBuffer.isView(t)?!0:t!==null&&typeof t=="object"&&typeof t.pipe=="function"}function Rh(t,e){return Array.isArray(t)&&t.some(r=>ac(r,e))}const Ox={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Ex={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Lh(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,a=typeof e=="object"&&!Array.isArray(e)?e.value:e,l=r?u=>u.toString():u=>encodeURIComponent(u),c=l(t);if(typeof a>"u"&&i)return[[c,""]];if(ac(a)||Rh(a))return[[c,a]];if(s)return Bh(t,a,r,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:h,allowReserved:d}=o;return Bh(t,a,r,{style:u,explode:h,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof a=="string"?a:JSON.stringify(a);return[[c,l(u)]]}return[[c,l(a.toString())]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)&&a.every(u=>typeof u!="object")?[[c,a.map(l).join(",")]]:[[c,l(JSON.stringify(a))]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)?n==="multi"?[[c,a.map(l)]]:[[c,a.map(l).join(Ex[n||"csv"])]]:[[c,""]]}function Bh(t,e,r,n){const i=n.style||"form",s=typeof n.explode>"u"?i==="form":n.explode,o=r?!1:n&&n.allowReserved?"unsafe":"reserved",a=c=>Ki(c,{escape:o}),l=r?c=>c:c=>Ki(c,{escape:o});return typeof e!="object"?[[l(t),a(e)]]:Array.isArray(e)?s?[[l(t),e.map(a)]]:[[l(t),e.map(a).join(Ox[i])]]:i==="deepObject"?Object.keys(e).map(c=>[l(`${t}[${c}]`),a(e[c])]):s?Object.keys(e).map(c=>[l(c),a(e[c])]):[[l(t),Object.keys(e).map(c=>[`${l(c)},${a(e[c])}`]).join(",")]]}function Tx(t){return Object.entries(t).reduce((e,r)=>{let[n,i]=r;for(const[s,o]of Lh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new qo([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new qo([o]);e.append(s,a)}else e.append(s,o);return e},new Dh)}function Fh(t){const e=Object.keys(t).reduce((r,n)=>{for(const[i,s]of Lh(n,t[n]))r[i]=s;return r},{});return We().stringify(e,{encode:!1,indices:!1})||""}function jh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{url:e="",query:r,form:n}=t,i=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const l=o.filter(c=>c).join("&");return l?`?${l}`:""};if(n){const s=Object.keys(n).some(a=>{const{value:l}=n[a];return ac(l)||Rh(l)}),o=t.headers["content-type"]||t.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Tx(t.form);bx(a,t)}else t.body=Fh(n);delete t.form}if(r){const[s,o]=e.split("?");let a="";if(o){const c=We().parse(o);Object.keys(r).forEach(h=>delete c[h]),a=We().stringify(c,{encode:!0})}const l=i(a,Fh(r));t.url=s+l,delete t.query}return t}function KI(t,e,r){return r=r||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),oc.mergeInQueryOrForm(n),n=e(n),r(t(n)))}function Px(t,e){function r(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack;for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];[this.message]=i,e&&e.apply(this,i)}return r.prototype=new Error,r.prototype.name=t,r.prototype.constructor=r,r}const Mx={body:Ix,header:Nx,query:Lx,path:Rx,formData:Dx};function Ix(t){let{req:e,value:r}=t;e.body=r}function Dx(t){let{req:e,value:r,parameter:n}=t;(r||n.allowEmptyValue)&&(e.form=e.form||{},e.form[n.name]={value:r,allowEmptyValue:n.allowEmptyValue,collectionFormat:n.collectionFormat})}function Nx(t){let{req:e,parameter:r,value:n}=t;e.headers=e.headers||{},typeof n<"u"&&(e.headers[r.name]=n)}function Rx(t){let{req:e,value:r,parameter:n}=t;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(r))}function Lx(t){let{req:e,value:r,parameter:n}=t;if(e.query=e.query||{},r===!1&&n.type==="boolean"&&(r="false"),r===0&&["number","integer"].indexOf(n.type)>-1&&(r="0"),r)e.query[n.name]={collectionFormat:n.collectionFormat,value:r};else if(n.allowEmptyValue&&r!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}function ea(t,e){return e.includes("application/json")?typeof t=="string"?t:JSON.stringify(t):t.toString()}function Bx(t){let{req:e,value:r,parameter:n}=t;const{name:i,style:s,explode:o,content:a}=n;if(a){const c=Object.keys(a)[0];e.url=e.url.split(`{${i}}`).join(Ki(ea(r,c),{escape:!0}));return}const l=sc({key:n.name,value:r,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Fx(t){let{req:e,value:r,parameter:n}=t;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=ea(r,i);if(s)e.query[n.name]=s;else if(n.allowEmptyValue&&r!==void 0){const o=n.name;e.query[o]=e.query[o]||{},e.query[o].allowEmptyValue=!0}return}if(r===!1&&(r="false"),r===0&&(r="0"),r){const{style:i,explode:s,allowReserved:o}=n;e.query[n.name]={value:r,serializationOption:{style:i,explode:s,allowReserved:o}}}else if(n.allowEmptyValue&&r!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}const jx=["accept","authorization","content-type"];function Vx(t){let{req:e,parameter:r,value:n}=t;if(e.headers=e.headers||{},!(jx.indexOf(r.name.toLowerCase())>-1)){if(r.content){const i=Object.keys(r.content)[0];e.headers[r.name]=ea(n,i);return}typeof n<"u"&&(e.headers[r.name]=sc({key:r.name,value:n,style:r.style||"simple",explode:typeof r.explode>"u"?!1:r.explode,escape:!1}))}}function Wx(t){let{req:e,parameter:r,value:n}=t;e.headers=e.headers||{};const i=typeof n;if(r.content){const s=Object.keys(r.content)[0];e.headers.Cookie=`${r.name}=${ea(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&r.explode?"":`${r.name}=`;e.headers.Cookie=s+sc({key:r.name,value:n,escape:!1,style:r.style||"form",explode:typeof r.explode>"u"?!1:r.explode})}}const $x=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Hx}=$x,Vh=Hx;function zx(t,e){const{operation:r,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=t;let{requestContentType:a}=t;e=Ux({request:e,securities:i,operation:r,spec:s});const l=r.requestBody||{},c=Object.keys(l.content||{}),u=a&&c.indexOf(a)>-1;if(n||o){if(a&&u)e.headers["Content-Type"]=a;else if(!a){const h=c[0];h&&(e.headers["Content-Type"]=h,a=h)}}else a&&u&&(e.headers["Content-Type"]=a);if(!t.responseContentType&&r.responses){const h=Object.entries(r.responses).filter(d=>{let[p,m]=d;const y=parseInt(p,10);return y>=200&&y<300&&ge(m.content)}).reduce((d,p)=>{let[,m]=p;return d.concat(Object.keys(m.content))},[]);h.length>0&&(e.headers.accept=h.join(", "))}if(n)if(a){if(c.indexOf(a)>-1)if(a==="application/x-www-form-urlencoded"||a==="multipart/form-data")if(typeof n=="object"){const h=(l.content[a]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:h[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function Ux(t){let{request:e,securities:r={},operation:n={},spec:i}=t;const s=ee({},e),{authorized:o={}}=r,a=n.security||i.security||[],l=o&&!!Object.keys(o).length,c=ue()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(r).length||!l||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(u=>{Object.keys(u).forEach(h=>{const d=o[h],p=c[h];if(!d)return;const m=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=m),p.in==="header"&&(s.headers[p.name]=m),p.in==="cookie"&&(s.cookies[p.name]=m);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const w=m.username||"",A=m.password||"",T=Vh(`${w}:${A}`);s.headers.Authorization=`Basic ${T}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${m}`)}else if(y==="oauth2"||y==="openIdConnect"){const w=d.token||{},A=p["x-tokenName"]||"access_token",T=w[A];let E=w.token_type;(!E||E.toLowerCase()==="bearer")&&(E="Bearer"),s.headers.Authorization=`${E} ${T}`}}})}),s)}function Gx(t,e){const{spec:r,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=t;if(e=Kx({request:e,securities:i,operation:n,spec:r}),e.body||e.form||a)s?e.headers["Content-Type"]=s:Array.isArray(n.consumes)?[e.headers["Content-Type"]]=n.consumes:Array.isArray(r.consumes)?[e.headers["Content-Type"]]=r.consumes:n.parameters&&n.parameters.filter(l=>l.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(l=>l.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const l=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,c=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(l||c)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function Kx(t){let{request:e,securities:r={},operation:n={},spec:i}=t;const s=ee({},e),{authorized:o={},specSecurity:a=[]}=r,l=n.security||a,c=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(r).length||!c||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(h=>{Object.keys(h).forEach(d=>{const p=o[d];if(!p)return;const{token:m}=p,y=p.value||p,w=u[d],{type:A}=w,T=w["x-tokenName"]||"access_token",E=m&&m[T];let B=m&&m.token_type;if(p)if(A==="apiKey"){const I=w.in==="query"?"query":"headers";s[I]=s[I]||{},s[I][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const I=y.username||"",W=y.password||"";y.base64=Vh(`${I}:${W}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&E&&(B=!B||B.toLowerCase()==="bearer"?"Bearer":B,s.headers.authorization=`${B} ${E}`)})}),s)}function Wh(t,e){return`${e.toLowerCase()}-${t}`}function Yx(t,e,r){if(!t||typeof t!="object"||!t.paths||typeof t.paths!="object")return null;const{paths:n}=t;for(const i in n)for(const s in n[i]){if(s.toUpperCase()==="PARAMETERS")continue;const o=n[i][s];if(!o||typeof o!="object")continue;const a={spec:t,pathName:i,method:s.toUpperCase(),operation:o},l=e(a);if(r&&l)return a}}function Jx(t,e){return Yx(t,e,!0)||null}const $h=t=>t.replace(/\W/gi,"_");function Qx(t,e){let{v2OperationIdCompatibilityMode:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(r){let n=`${e.toLowerCase()}_${t}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return n=n||`${t.substring(1)}_${e}`,n.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${e.toLowerCase()}${$h(t)}`}function Xx(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{v2OperationIdCompatibilityMode:n}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return!t||typeof t!="object"?null:(t.operationId||"").replace(/\s/g,"").length?$h(t.operationId):Qx(e,r,{v2OperationIdCompatibilityMode:n})}function Zx(t,e){return!t||!t.paths?null:Jx(t,r=>{let{pathName:n,method:i,operation:s}=r;if(!s||typeof s!="object")return!1;const o=s.operationId,a=Xx(s,n,i),l=Wh(n,i);return[a,l,o].some(c=>c&&c===e)})}const JI=t=>{try{const{swagger:e}=t;return e==="2.0"}catch{return!1}},_x=t=>{try{const{openapi:e}=t;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},qx=t=>{try{const{openapi:e}=t;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},Hh=t=>_x(t)||qx(t),ew=["http","fetch","spec","operationId","pathName","method","parameters","securities"],zh=t=>Array.isArray(t)?t:[],tw=Px("OperationNotFoundError",function(e,r,n){this.originalError=n,Object.assign(this,r||{})}),rw=(t,e)=>e.filter(r=>r.name===t),nw=t=>{const e={};t.forEach(n=>{e[n.in]||(e[n.in]={}),e[n.in][n.name]=n});const r=[];return Object.keys(e).forEach(n=>{Object.keys(e[n]).forEach(i=>{r.push(e[n][i])})}),r},iw={buildRequest:ow};function sw(t){let{http:e,fetch:r,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=t,c=ie(t,ew);const u=e||r||xx;s&&o&&!i&&(i=Wh(s,o));const h=iw.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(ge(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function ow(t){const{spec:e,operationId:r,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:a,userFetch:l,server:c,serverVariables:u,http:h,signal:d}=t;let{parameters:p,parameterBuilders:m}=t;const y=Hh(e);m||(y?m=g:m=Mx);let A={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(A.signal=d),s&&(A.requestInterceptor=s),o&&(A.responseInterceptor=o),l&&(A.userFetch=l);const T=Zx(e,r);if(!T)throw new tw(`Operation ${r} not found`);const{operation:E={},method:B,pathName:I}=T;if(A.url+=aw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:I,method:B}),!r)return delete A.cookies,A;A.url+=I,A.method=`${B}`.toUpperCase(),p=p||{};const W=e.paths[I]||{};n&&(A.headers.accept=n);const F=nw([].concat(zh(E.parameters)).concat(zh(W.parameters)));F.forEach(j=>{const U=m[j.in];let Y;if(j.in==="body"&&j.schema&&j.schema.properties&&(Y=p),Y=j&&j.name&&p[j.name],typeof Y>"u"?Y=j&&j.name&&p[`${j.in}.${j.name}`]:rw(j.name,F).length>1&&console.warn(`Parameter '${j.name}' is ambiguous because the defined spec has more than one parameter with the name: '${j.name}' and the passed-in parameter values did not define an 'in' value.`),Y!==null){if(typeof j.default<"u"&&typeof Y>"u"&&(Y=j.default),typeof Y>"u"&&j.required&&!j.allowEmptyValue)throw new Error(`Required parameter ${j.name} is not provided`);if(y&&j.schema&&j.schema.type==="object"&&typeof Y=="string")try{Y=JSON.parse(Y)}catch{throw new Error("Could not parse object parameter value string as JSON")}U&&U({req:A,parameter:j,value:Y,operation:E,spec:e})}});const _=ee(ee({},t),{},{operation:E});if(y?A=zx(_,A):A=Gx(_,A),A.cookies&&Object.keys(A.cookies).length){const j=Object.keys(A.cookies).reduce((U,Y)=>{const re=A.cookies[Y],ce=U?"&":"",he=K.serialize(Y,re);return U+ce+he},"");A.headers.Cookie=j}return A.cookies&&delete A.cookies,jh(A),A}const lc=t=>t?t.replace(/\W/g,""):null;function aw(t){return Hh(t.spec)?lw(t):fw(t)}function lw(t){let{spec:e,pathName:r,method:n,server:i,contextUrl:s,serverVariables:o={}}=t;const a=ue()(e,["paths",r,(n||"").toLowerCase(),"servers"])||ue()(e,["paths",r,"servers"])||ue()(e,["servers"]);let l="",c=null;if(i&&a&&a.length){const u=a.map(h=>h.url);u.indexOf(i)>-1&&(l=i,c=a[u.indexOf(i)])}return!l&&a&&a.length&&(l=a[0].url,[c]=a),l.indexOf("{")>-1&&uw(l).forEach(h=>{if(c.variables&&c.variables[h]){const d=c.variables[h],p=o[h]||d.default,m=new RegExp(`{${h}}`,"g");l=l.replace(m,p)}}),cw(l,s)}function cw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t&&e?V.parse(V.resolve(e,t)):V.parse(t),n=V.parse(e),i=lc(r.protocol)||lc(n.protocol)||"",s=r.host||n.host,o=r.pathname||"";let a;return i&&s?a=`${i}://${s+o}`:a=o,a[a.length-1]==="/"?a.slice(0,-1):a}function uw(t){const e=[],r=/{([^}]+)}/g;let n;for(;n=r.exec(t);)e.push(n[1]);return e}function fw(t){let{spec:e,scheme:r,contextUrl:n=""}=t;const i=V.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=r||s||lc(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(29901),mt=f(20202),Hr=f(6206),vt=f(61736),hw=f(81570),dw=f(74025),pw=f(2526),gw=Object.defineProperty,mw=Object.defineProperties,vw=Object.getOwnPropertyDescriptors,Uh=Object.getOwnPropertySymbols,yw=Object.prototype.hasOwnProperty,bw=Object.prototype.propertyIsEnumerable,Gh=(t,e,r)=>e in t?gw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xw=(t,e)=>{for(var r in e||(e={}))yw.call(e,r)&&Gh(t,r,e[r]);if(Uh)for(var r of Uh(e))bw.call(e,r)&&Gh(t,r,e[r]);return t},ww=(t,e)=>mw(t,vw(e)),Sw=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function kw(t,e){return Sw(this,null,function*(){var r,n,i,s;const o=JSON.parse(JSON.stringify(e)),a=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},l=ww(xw({},a),{components:o.components,paths:{[t.path]:{[t.httpVerb]:(n=(r=o.paths)==null?void 0:r[t.path])==null?void 0:n[t.httpVerb],parameters:(s=(i=o.paths)==null?void 0:i[t.path])==null?void 0:s.parameters}}}),c=new dw.Config({}),u=(0,pw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,hw.bundle)(h),o})}var Aw=f(98910),ta=f(84862),_r=f(53134),Kh=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const Yh=Object.values(_r.FileUploadFormats),Cw=["application/octet-stream","application/pdf","application/gzip","application/zip"],Jh=["image/","audio/","video/"];function Qh(t){if(Jh.some(e=>t.startsWith(e)))return t}function ra(t){return Cw.includes(t)?!0:Jh.some(e=>t.startsWith(e))}function Ow(t){const e=t.type==="array"?t.items:t;if(!e||!e.type||e?.type==="any")return!0;const r=e.contentMediaType||"",n=e.format||e.contentEncoding||(ra(r)?"binary":"");return e.type===_r.DefinitionTypes.STRING&&Yh.includes(n)}function Xh(t,e){if(!t||!t.type||t.type==="any")return ra(e);const r=t.format||t.contentEncoding||"";return t.type===_r.DefinitionTypes.STRING&&Yh.includes(r)}function Zh(t){return new Promise((e,r)=>{const n=new FileReader;n.onload=()=>{const s=n.result.replace(/data:.*\/.*;base64,/g,"");e(s)},n.onerror=()=>r(n.error),n.readAsDataURL(t)})}function _h({format:t,contentEncoding:e,contentMediaType:r}){return[t,e,r].includes(_r.FileUploadFormats.BASE64)}function Ew(t,e){return Kh(this,null,function*(){const r=Object.values(t);let n=r.length===1?r[0]:r;return e.type===_r.DefinitionTypes.STRING&&_h(e)?n=yield Zh(r[0]):e.type===_r.DefinitionTypes.ARRAY&&e.items&&(_h(e.items)?n=yield Promise.all(r.map(s=>Kh(this,null,function*(){return yield Zh(s)}))):n=r),n})}var cc=f(84622),Be=f(38612),Ye=f(97495),Oe=f(85739),Nr=f(71608),Tw=f(64393),$n=f(60991);function Pw({response:t}){const{jsonSampleExpandLevel:e}=(0,Hr.Dv)($n.qd);return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Body: "),Mw(t,e))}function Mw(t,e){return t.body?S.createElement(mt.JsonViewer,{data:t.body,jsonSampleExpandLevel:e}):t.fileInfo?S.createElement(Tw.s,{fileInfo:t.fileInfo}):t.data!==null?t.data?S.createElement(mt.CodeBlock,{lang:(0,Oe.M)(t.headers["Content-Type"]||"text/plain"),source:t.data,header:{controls:{copy:{}}}}):S.createElement(mt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Iw({headers:t}){const e=(0,Hr.Dv)($n.qd),[r,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(t),o=!!i&&s.length>i,a=o&&r?[...s].splice(0,i):[...s],l=()=>{n(!r)};return S.createElement(S.Fragment,null,S.createElement(Nr.EE,null," Headers: "),S.createElement(mt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(qh,null,c,":"),S.createElement("code",null,t[c]))),o&&S.createElement(ed,{onClick:l},r?"Show more...":"Hide headers")))}const qh=Ye.ZP.strong`
|
|
48
48
|
text-transform: capitalize;
|
|
49
49
|
display: inline-block;
|
|
50
50
|
padding-right: 5px;
|
|
51
|
-
`,
|
|
51
|
+
`,ed=Ye.ZP.div`
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
margin-top: 5px;
|
|
54
54
|
font-size: 14px;
|
|
55
|
-
`;
|
|
55
|
+
`;qh.displayName="HeaderName",ed.displayName="StyledShowMoreLabel";const Dw=Ye.ZP.div`
|
|
56
56
|
margin-bottom: 10px;
|
|
57
|
-
`,
|
|
57
|
+
`,uc=Ye.ZP.div`
|
|
58
58
|
display: inline-block;
|
|
59
59
|
margin-right: 20px;
|
|
60
60
|
padding: 2px 0;
|
|
61
61
|
text-align: center;
|
|
62
62
|
color: var(--text-primary);
|
|
63
|
-
`,
|
|
64
|
-
color: ${({code:
|
|
65
|
-
`,
|
|
63
|
+
`,Nw=(0,Ye.ZP)(uc)`
|
|
64
|
+
color: ${({code:t})=>t>=200&&t<300?"var(--response-success-text-color)":t>=300&&t<400?"var(--response-redirect-text-color)":t>400?"var(--response-error-text-color)":"var(--response-info-text-color)"};
|
|
65
|
+
`,td=Ye.ZP.header`
|
|
66
66
|
font-weight: bold;
|
|
67
67
|
margin-bottom: 10px;
|
|
68
|
-
`,
|
|
68
|
+
`,Rw=Ye.ZP.code`
|
|
69
69
|
border-left: 3px solid #ff4040;
|
|
70
70
|
padding-left: 5px;
|
|
71
|
-
`,
|
|
71
|
+
`,Lw=({error:t,response:e,time:r})=>{const n=e||t&&t.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",t&&!t.response||!n?S.createElement(S.Fragment,null,S.createElement(td,null," Could not get any response "),S.createElement(Rw,null,t&&t.message||"Unknown error"),S.createElement("br",null),S.createElement(td,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(Dw,null,S.createElement(Nw,{code:n.status},S.createElement("span",null," Status: "),n.status," ",n.statusText),S.createElement(uc,null,S.createElement("span",null," Time: "),r,"ms"),S.createElement(uc,null,S.createElement("span",null," Size: "),s)),S.createElement("div",null,S.createElement(Iw,{headers:n.headers}),S.createElement(Pw,{response:n}))):S.createElement(S.Fragment,null,"Something went wrong")},Bw=Ye.ZP.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
button {
|
|
75
75
|
margin: 0;
|
|
76
76
|
}
|
|
77
|
-
`,
|
|
77
|
+
`,rd=Ye.ZP.button`
|
|
78
78
|
outline: none;
|
|
79
79
|
border: none;
|
|
80
80
|
background-color: var(--panel-try-it-tabs-background-color);
|
|
@@ -94,62 +94,63 @@
|
|
|
94
94
|
color: var(--panel-try-it-tabs-hover-text-color);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
${({active:
|
|
97
|
+
${({active:t})=>t&&(0,Ye.iv)`
|
|
98
98
|
background-color: var(--panel-try-it-tabs-active-background-color);
|
|
99
99
|
color: var(--panel-try-it-tabs-active-text-color);
|
|
100
100
|
`||""}
|
|
101
101
|
|
|
102
|
-
${({disabled:
|
|
102
|
+
${({disabled:t})=>t&&(0,Ye.iv)`
|
|
103
103
|
cursor: default;
|
|
104
104
|
background-color: var(--panel-try-it-tabs-disabled-background-color);
|
|
105
105
|
color: var(--panel-try-it-tabs-disabled-text-color);
|
|
106
106
|
`||""}
|
|
107
|
-
`;function
|
|
107
|
+
`;function Fw({onChange:t,active:e,hasResponse:r}){return S.createElement(Bw,null,S.createElement(rd,{onClick:()=>t(0),active:e===0},r?"Edit Request":"Request"),S.createElement(rd,{onClick:()=>r&&t(1),active:e===1,disabled:!r}," ","Response"," "))}var fc=f(82155),nd=f(79198);function jw(t,e,r){const n=e.path||{},i=e.query||{},s=Object.keys(i);let o=(0,Be.v5)(t,n);const a=l=>r.find(c=>c.name===l&&c.in==="query");return s.length&&(o+="?"+s.map(l=>{if(!i[l])return"";const c=a(l);return c?(0,Oe.d$)(c,i[l]):`${l}=${encodeURIComponent(i[l])}`}).filter(Boolean).join("&")),o}const Vw=({loading:t,operation:e,hasResponse:r,onSubmit:n,params:i={}})=>S.createElement(ta.k1,null,S.createElement(fc.__,null,S.createElement(nd.FH,{color:e.httpVerb},e.httpVerb),S.createElement(fc.y$,{wrap:"true"},jw(e.path,i,e.parameters))),S.createElement(Ww,{"data-cy":"send-button",color:"primary",type:"submit",blinking:t,onClick:()=>!t&&n()},t?"Sending...":r?"Resend":"Send")),Ww=(0,Ye.ZP)(fc.ev)`
|
|
108
108
|
width: var(--panel-try-it-action-button-width);
|
|
109
|
-
|
|
109
|
+
`,$w=(0,S.memo)(Vw);var mi=f(26225),Hw=Object.defineProperty,zw=Object.defineProperties,Uw=Object.getOwnPropertyDescriptors,id=Object.getOwnPropertySymbols,Gw=Object.prototype.hasOwnProperty,Kw=Object.prototype.propertyIsEnumerable,sd=(t,e,r)=>e in t?Hw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fs=(t,e)=>{for(var r in e||(e={}))Gw.call(e,r)&&sd(t,r,e[r]);if(id)for(var r of id(e))Kw.call(e,r)&&sd(t,r,e[r]);return t},Yw=(t,e)=>zw(t,Uw(e)),na=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const od="/oauth2-redirect.html";class zr{static authorizeImplicit({authorizationUrl:e,clientId:r,scopes:n,extraParams:i={},routingBasePath:s,redirectUri:o,successCallback:a,errorCallback:l}){const c=(0,mi.p8)({date:new Date().toString()}),u=new URL(e),h=s==="/"?"":s,d=`${window.location.origin}${h}${od}`;u.searchParams.set("client_id",r),u.searchParams.set("redirect_uri",o||d),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(n)&&u.searchParams.set("scope",n.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:r,scopes:n},state:c,successCallback:p=>{a(p),zr.clearRedirectData("implicit")},errorCallback:p=>{l(p),zr.clearRedirectData("implicit")}},window.open(u.toString())}static authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:r,clientId:n,clientSecret:i,codeVerifier:s,codeChallenge:o,scopes:a,extraParams:l={},extraHeaders:c={},routingBasePath:u,redirectUri:h,successCallback:d,errorCallback:p}){const m=new URL(e),y=u==="/"?"":u,w=`${window.location.origin}${y}${od}`,A=(0,mi.p8)({date:new Date().toString()});m.searchParams.set("client_id",n),m.searchParams.set("redirect_uri",h||w),m.searchParams.set("response_type","code"),m.searchParams.set("state",A),Array.isArray(a)&&m.searchParams.set("scope",a.join(" ")),o&&(m.searchParams.set("code_challenge",o),m.searchParams.set("code_challenge_method","S256"));for(const T in l)m.searchParams.set(T,l[T]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:n,scopes:a},state:A,successCallback:T=>na(this,[T],function*({auth_code:E}){try{const B=yield fetch(r,{method:"POST",headers:Fs({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},c),body:Oe.uM.stringify(Fs(Yw(Fs({client_id:n,client_secret:i},s&&{code_verifier:s}),{code:E,grant_type:"authorization_code",redirect_uri:h||w}),l))});yield ad(B,d,p)}catch(B){p(B)}zr.clearRedirectData("authorizationCode")}),errorCallback:T=>{p(T),zr.clearRedirectData("authorizationCode")}},window.open(m.toString())}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static authorizeClientCredentials(e){return na(this,arguments,function*({tokenUrl:r,clientId:n,clientSecret:i,scopes:s=[],extraParams:o={},extraHeaders:a={},successCallback:l,errorCallback:c}){try{const u=JSON.parse(JSON.stringify(Fs({client_id:n,client_secret:i,grant_type:"client_credentials",scope:Array.isArray(s)&&s.length?s.join(" "):void 0},o))),h=yield fetch(r,{method:"POST",headers:Fs({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},a),body:Oe.uM.stringify(u)});yield ad(h,l,c)}catch(u){c(u)}})}}const QI=new zr;function ad(t,e,r){return na(this,null,function*(){if(t.ok){const n=yield t.json();e(n)}else r(new Error((t.headers.get("Content-Type")||"").indexOf("json")>-1?JSON.stringify(yield t.json()):yield t.text()))})}function ld(t){return na(this,null,function*(){return(0,mi.rS)(yield(0,mi.JQ)(t))})}var js=f(95709),ye=f(9612),Jw=f(39012),st=f(54597);function Qw({name:t,value:e,description:r,variableEnum:n,onChange:i,defaultValue:s}){const o=(0,S.useCallback)(c=>i(c.target.value),[i]),a=(0,S.useCallback)(c=>i(c.value),[i]),l=n?n.map((c,u)=>({value:c,idx:u})):[];return S.createElement(ye.NI,null,S.createElement(ye.lX,null,t,":"),l&&l.length?S.createElement(Nr.VD,{fullWidth:!0,variant:"dark",value:e,options:l,onChange:a}):S.createElement(st.nv,{fullWidth:!0,value:e,onChange:o,placeholder:s,panel:"try-it"}),r&&S.createElement(Xw,{source:r}))}const Xw=(0,Ye.ZP)(Jw.Markdown)`
|
|
110
110
|
margin-top: 5px;
|
|
111
111
|
color: #d0d0d0;
|
|
112
|
-
`;var
|
|
113
|
-
${(0,
|
|
114
|
-
- ${(0,
|
|
115
|
-
`})),[o]),h=Object.keys(((
|
|
112
|
+
`;var Zw=Object.defineProperty,_w=Object.defineProperties,qw=Object.getOwnPropertyDescriptors,cd=Object.getOwnPropertySymbols,eS=Object.prototype.hasOwnProperty,tS=Object.prototype.propertyIsEnumerable,ud=(t,e,r)=>e in t?Zw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fd=(t,e)=>{for(var r in e||(e={}))eS.call(e,r)&&ud(t,r,e[r]);if(cd)for(var r of cd(e))tS.call(e,r)&&ud(t,r,e[r]);return t},hd=(t,e)=>_w(t,qw(e));function rS({operation:t,onChange:e}){var r;const{control:n,watch:i}=(0,vt.Gc)(),{events:s}=(0,Hr.Dv)($n.qd),{servers:o}=t,a=i("server");(0,mt.useMount)(()=>{const d=(0,Oe.YQ)("serverUrl"),p=o.findIndex(y=>y.url===d),m=(0,Be.fz)(o,p<0?0:p);e(m)});const l=(0,S.useCallback)(({serverUrl:d=""})=>{var p;const m=o.find(A=>A.url===d),y=(0,Be.mj)(m);e({url:d,variables:y}),(0,Oe.WW)("serverUrl",d);const w=(0,cc.Ze)({operation:t,serverUrl:d});(p=s.targetServerSwitch)==null||p.call(s,w)},[e,s,t,o]),c=(d,p)=>{const m=p||p===""?p:(0,Be.mj)(a)[d],y=hd(fd({},a.variables),{[d]:m});(0,Be.UY)(d,m),e(hd(fd({},a),{variables:y}))},u=(0,S.useMemo)(()=>o.map((d,p)=>({idx:p,serverUrl:d.url,value:`
|
|
113
|
+
${(0,Be.nq)((0,Be.v5)(d.url,d.variables),d.variables)}
|
|
114
|
+
- ${(0,Oe.bG)(d.description)||"Default"}
|
|
115
|
+
`})),[o]),h=Object.keys(((r=o.find(({url:d})=>d===a?.url))==null?void 0:r.variables)||{});return S.createElement(iS,{"data-cy":"console-target-server"},S.createElement(ye.lX,{htmlFor:"server"},"Target server: "),S.createElement(ye.NI,null,S.createElement(vt.Qr,{control:n,name:"server",render:({field:{value:d}})=>{var p;const m=(p=u.find(({serverUrl:y})=>y===d?.url))==null?void 0:p.value;return S.createElement(Nr.VD,{variant:"dark",value:m,options:u,fullWidth:!0,onChange:l})}})),h?.map(d=>{var p;const m=(p=a?.variables)==null?void 0:p[d];return S.createElement(Qw,{key:d,name:d,value:a.variables[d],defaultValue:m.default,onChange:y=>c(d,y),variableEnum:m.enum,description:m.description})}))}const nS=(0,S.memo)(rS),iS=Ye.ZP.div`
|
|
116
116
|
margin-bottom: 20px;
|
|
117
|
-
`;var
|
|
118
|
-
${
|
|
117
|
+
`;var dd=f(86220),sS=Object.defineProperty,oS=Object.defineProperties,aS=Object.getOwnPropertyDescriptors,ia=Object.getOwnPropertySymbols,pd=Object.prototype.hasOwnProperty,gd=Object.prototype.propertyIsEnumerable,md=(t,e,r)=>e in t?sS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lS=(t,e)=>{for(var r in e||(e={}))pd.call(e,r)&&md(t,r,e[r]);if(ia)for(var r of ia(e))gd.call(e,r)&&md(t,r,e[r]);return t},cS=(t,e)=>oS(t,aS(e)),uS=(t,e)=>{var r={};for(var n in t)pd.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&ia)for(var n of ia(t))e.indexOf(n)<0&&gd.call(t,n)&&(r[n]=t[n]);return r};function hc(t){var e=t,{header:r,error:n,success:i}=e,s=uS(e,["header","error","success"]);const o=({toggle:a,expanded:l=!1})=>S.createElement(mt.PanelHeader,{onClick:a,expanded:l,"data-cy":s["data-cy"]},S.createElement(ta.xz,null,S.createElement(mt.PanelHeaderTitle,null,r),S.createElement(mt.ShelfIcon,{direction:l?"down":"right"})),n&&S.createElement(dd.CrossIcon,{size:"14px",color:"--color-error"})||null,i&&S.createElement(dd.LockIcon,{size:"14px",color:"--color-success"})||null);return S.createElement(fS,cS(lS({className:"panel-try-it-nested"},s),{header:o}))}const fS=(0,Ye.ZP)(mt.Panel)`
|
|
118
|
+
${mt.PanelHeader} {
|
|
119
119
|
border: 1px solid
|
|
120
|
-
${({error:
|
|
120
|
+
${({error:t})=>t?"var(--color-error-border)":"var(--panel-try-it-nested-heading-border-color)"};
|
|
121
121
|
padding: 10px;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
${
|
|
124
|
+
${mt.PanelBody} {
|
|
125
125
|
border: 1px solid
|
|
126
|
-
${({error:
|
|
126
|
+
${({error:t})=>t?"var(--color-error-border)":"var(--panel-try-it-nested-body-border-color)"};
|
|
127
127
|
border-top: 0;
|
|
128
128
|
}
|
|
129
|
-
`;var
|
|
129
|
+
`;var hS=f(4296),dS=f(62701),pS=f(18373);const gS=(0,Ye.ZP)(nd.A3)`
|
|
130
130
|
border-radius: var(--panel-border-radius);
|
|
131
131
|
margin-bottom: 10px;
|
|
132
|
-
`;var
|
|
132
|
+
`;var sa=f(42112),dc=f(34716),mS=f(60728),vS=Object.defineProperty,yS=Object.defineProperties,bS=Object.getOwnPropertyDescriptors,vd=Object.getOwnPropertySymbols,xS=Object.prototype.hasOwnProperty,wS=Object.prototype.propertyIsEnumerable,yd=(t,e,r)=>e in t?vS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SS=(t,e)=>{for(var r in e||(e={}))xS.call(e,r)&&yd(t,r,e[r]);if(vd)for(var r of vd(e))wS.call(e,r)&&yd(t,r,e[r]);return t},kS=(t,e)=>yS(t,bS(e)),AS=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const bd=(0,S.forwardRef)(({schema:t,contentName:e,onChange:r,fieldName:n,className:i,accept:s,multiple:o},a)=>{const{register:l}=(0,vt.Gc)(),c=u=>AS(void 0,null,function*(){const h=yield Ew(u.target.files,t);r(e,h)});return S.createElement("input",kS(SS({},l(n)),{"data-cy":"file-upload-input",type:"file",id:n,className:i,name:n,onChange:c,multiple:o,accept:s,ref:a}))});bd.displayName="FileUpload";var pc=f(21156);function CS({mediaType:t,onChange:e}){var r;const{setValue:n}=(0,vt.Gc)(),i=t.examples||{},{exampleKey:s}=(0,dc.C6)(t.operation,i),o=(r=i[s])==null?void 0:r.rawValue,a=ES(t);(0,S.useEffect)(()=>n&&a.forEach(c=>{var u,h;const d=o?.[c.name],p=(h=(u=c.example)!=null?u:d?.example)!=null?h:d,m=typeof p=="object"?JSON.stringify(p):p;p!==void 0&&n("body."+c.name,`${m}`)}),[s]);const l=t.schema||{};return Xh(l,t.name)?S.createElement(xd,null,S.createElement(ye.NI,null,S.createElement(wd,{fullWidth:!0,fieldName:`body.${t.name}`,accept:Qh(t.name),schema:l,contentName:t.name,onChange:e}))):l.type!==_r.DefinitionTypes.OBJECT&&!a?(console.warn(`Invalid schema for request body and mime type: "${t.name}"`,l),null):S.createElement(xd,null,a.map(c=>{const u=c.schema||{contentMediaType:"",type:"",description:""},h=t.name===sa.Tr.MULTIPART&&Ow(u),d=u.contentMediaType||"",p=h?S.createElement(wd,{fullWidth:!0,fieldName:"body."+c.name,accept:Qh(d),multiple:u.type==="array",schema:u,contentName:c.name,onChange:e}):S.createElement(st.Xn,{fullWidth:!0,id:"body."+c.name,fieldName:"body."+c.name,placeholder:(0,Oe.bG)(u.description)||c.name,panel:"try-it"});return S.createElement(ye.NI,{key:c.name},S.createElement(ye.lX,null,c.name,":"),p)}))}const OS=(0,S.memo)(CS);function ES(t){var e,r,n,i,s,o;const{activeOneOf:a}=(0,mS.Sb)((0,pc.N)(t.operation.pointer)),l=(r=a[((e=t.schema)==null?void 0:e.pointer)||""])!=null?r:0;return((i=(n=t.schema)==null?void 0:n.oneOf)!=null&&i.length?((s=t.schema)==null?void 0:s.oneOf[l].fields)||[]:((o=t.schema)==null?void 0:o.fields)||[]).filter(c=>!c.schema.readOnly)}const xd=Ye.ZP.div`
|
|
133
133
|
> div {
|
|
134
134
|
margin-top: 10px;
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
137
|
-
${(0,
|
|
138
|
-
${({inputType:
|
|
139
|
-
${({fullWidth:
|
|
140
|
-
`,wd=1024;let OS=0;class Ir{constructor(e,t){this.from=e,this.to=t}}class Be{constructor(e={}){this.id=OS++,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=er.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Be.closedBy=new Be({deserialize:r=>r.split(" ")}),Be.openedBy=new Be({deserialize:r=>r.split(" ")}),Be.group=new Be({deserialize:r=>r.split(" ")}),Be.contextHash=new Be({perNode:!0}),Be.lookAhead=new Be({perNode:!0}),Be.mounted=new Be({perNode:!0});class js{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Be.mounted.id]}}const ES=Object.create(null);class er{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):ES,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new er(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(Be.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(Be.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}}er.none=new er("",Object.create(null),0,8);class sa{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 er(n.name,i,n.id,n.flags):n)}return new sa(t)}}const oa=new WeakMap,Sd=new WeakMap;var st;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(st||(st={}));class ct{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=js.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 aa(this.topNode,e)}cursorAt(e,t=0,n=0){let i=oa.get(this)||this.topNode,s=new aa(i);return s.moveTo(e,t),oa.set(this,s._tree),s}get topNode(){return new tr(this,0,0,null)}resolve(e,t=0){let n=Vs(oa.get(this)||this.topNode,e,t,!1);return oa.set(this,n),n}resolveInner(e,t=0){let n=Vs(Sd.get(this)||this.topNode,e,t,!0);return Sd.set(this,n),n}resolveStack(e,t=0){return MS(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&st.IncludeAnonymous)>0;for(let l=this.cursor(o|st.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:vc(er.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new ct(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new ct(er.none,t,n,i)))}static build(e){return IS(e)}}ct.empty=new ct(er.none,[],[],0);class pc{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 pc(this.buffer,this.index)}}class mi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return er.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&&!(kd(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 mi(s,o,this.set)}}function kd(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 Vs(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 tr&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:st.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof tr&&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 Ad{cursor(e=0){return new aa(this,e)}getChild(e,t=null,n=null){let i=Cd(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Cd(this,e,t,n)}resolve(e,t=0){return Vs(this,e,t,!1)}resolveInner(e,t=0){return Vs(this,e,t,!0)}matchContext(e){return gc(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 tr extends Ad{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(kd(i,n,h,h+u.length)){if(u instanceof mi){if(s&st.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-h,i);if(d>-1)return new Zr(new TS(o,u,e,h),null,d)}else if(s&st.IncludeAnonymous||!u.type.isAnonymous||mc(u)){let d;if(!(s&st.IgnoreMounts)&&(d=js.get(u))&&!d.overlay)return new tr(d.tree,h,e,o);let p=new tr(u,h,e,o);return s&st.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&st.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&st.IgnoreOverlays)&&(i=js.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 tr(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 Cd(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 gc(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 TS{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Zr extends Ad{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 Zr(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&st.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 Zr(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 Zr(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 Zr(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 ct(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Od(r){if(!r.length)return null;if(r.length==1)return r[0];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 tr&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new PS(i,t)}class PS{constructor(e,t){this.heads=e,this.node=t}get next(){return Od(this.heads)}}function MS(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof tr?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=js.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new tr(o.tree,o.overlay[0].from+s.from,0,null);(i||(i=[n])).push(Vs(a,e,t,!1))}}return i?Od(i):n}class aa{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 tr)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 tr?(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&st.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.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&st.IncludeAnonymous||a instanceof mi||!a.type.isAnonymous||mc(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 Zr(this.buffer,t,this.stack[i]);return this.bufferNode=new Zr(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 gc(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 gc(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 mc(r){return r.children.some(e=>e instanceof mi||!e.type.isAnonymous||mc(e))}function IS(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=wd,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new pc(t,t.length):t,l=n.types,c=0,u=0;function h(L,D,j,W,q){let{id:F,start:H,end:Q,size:oe}=a,fe=u;for(;oe<0;)if(a.next(),oe==-1){let Oe=s[F];j.push(Oe),W.push(H-L);return}else if(oe==-3){c=F;return}else if(oe==-4){u=F;return}else throw new RangeError(`Unrecognized record size: ${oe}`);let be=l[F],ke,Re,Se=H-L;if(Q-H<=i&&(Re=y(a.pos-D,q))){let Oe=new Uint16Array(Re.size-Re.skip),Te=a.pos-Re.size,De=Oe.length;for(;a.pos>Te;)De=w(Re.start,Oe,De);ke=new mi(Oe,Q-Re.start,n),Se=Re.start-L}else{let Oe=a.pos-oe;a.next();let Te=[],De=[],bt=F>=o?F:-1,Rt=0,ir=Q;for(;a.pos>Oe;)bt>=0&&a.id==bt&&a.size>=0?(a.end<=ir-i&&(p(Te,De,H,Rt,a.end,ir,bt,fe),Rt=Te.length,ir=a.end),a.next()):h(H,Oe,Te,De,bt);if(bt>=0&&Rt>0&&Rt<Te.length&&p(Te,De,H,Rt,H,ir,bt,fe),Te.reverse(),De.reverse(),bt>-1&&Rt>0){let jr=d(be);ke=vc(be,Te,De,0,Te.length,0,Q-H,jr,jr)}else ke=m(be,Te,De,Q-H,fe-Q)}j.push(ke),W.push(Se)}function d(L){return(D,j,W)=>{let q=0,F=D.length-1,H,Q;if(F>=0&&(H=D[F])instanceof ct){if(!F&&H.type==L&&H.length==W)return H;(Q=H.prop(Be.lookAhead))&&(q=j[F]+H.length+Q)}return m(L,D,j,W,q)}}function p(L,D,j,W,q,F,H,Q){let oe=[],fe=[];for(;L.length>W;)oe.push(L.pop()),fe.push(D.pop()+j-q);L.push(m(n.types[H],oe,fe,F-q,Q-F)),D.push(q-j)}function m(L,D,j,W,q=0,F){if(c){let H=[Be.contextHash,c];F=F?[H].concat(F):[H]}if(q>25){let H=[Be.lookAhead,q];F=F?[H].concat(F):[H]}return new ct(L,D,j,W,F)}function y(L,D){let j=a.fork(),W=0,q=0,F=0,H=j.end-i,Q={size:0,start:0,skip:0};e:for(let oe=j.pos-L;j.pos>oe;){let fe=j.size;if(j.id==D&&fe>=0){Q.size=W,Q.start=q,Q.skip=F,F+=4,W+=4,j.next();continue}let be=j.pos-fe;if(fe<0||be<oe||j.start<H)break;let ke=j.id>=o?4:0,Re=j.start;for(j.next();j.pos>be;){if(j.size<0)if(j.size==-3)ke+=4;else break e;else j.id>=o&&(ke+=4);j.next()}q=Re,W+=fe,F+=ke}return(D<0||W==L)&&(Q.size=W,Q.start=q,Q.skip=F),Q.size>4?Q:void 0}function w(L,D,j){let{id:W,start:q,end:F,size:H}=a;if(a.next(),H>=0&&W<o){let Q=j;if(H>4){let oe=a.pos-(H-4);for(;a.pos>oe;)j=w(L,D,j)}D[--j]=Q,D[--j]=F-L,D[--j]=q-L,D[--j]=W}else H==-3?c=W:H==-4&&(u=W);return j}let A=[],T=[];for(;a.pos>0;)h(r.start||0,r.bufferStart||0,A,T,-1);let P=(e=r.length)!==null&&e!==void 0?e:A.length?T[0]+A[0].length:0;return new ct(l[r.topID],A.reverse(),T.reverse(),P)}const Ed=new WeakMap;function la(r,e){if(!r.isAnonymous||e instanceof mi||e.type!=r)return 1;let t=Ed.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof ct)){t=1;break}t+=la(r,n)}Ed.set(e,t)}return t}function vc(r,e,t,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=la(r,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let P=w;P<A;){let L=P,D=y[P],j=la(r,m[P]);for(P++;P<A;P++){let W=la(r,m[P]);if(j+W>=u)break;j+=W}if(P==L+1){if(j>u){let W=m[L];p(W.children,W.positions,0,W.children.length,y[L]+T);continue}h.push(m[L])}else{let W=y[P-1]+m[P-1].length-D;h.push(vc(r,m,y,L,P,D,W,null,l))}d.push(D+T-s)}}return p(e,t,n,i,0),(a||l)(h,d,o)}class QI{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 Zr?this.setBuffer(e.context.buffer,e.index,t):e instanceof tr&&this.map.set(e.tree,t)}get(e){return e instanceof Zr?this.getBuffer(e.context.buffer,e.index):e instanceof tr?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 kn{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 kn(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 kn(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 Td{startParse(e,t,n){return typeof e=="string"&&(e=new DS(e)),n=n?n.length?n.map(i=>new Ir(i.from,i.to)):[new Ir(0,0)]:[new Ir(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 DS{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 XI(r){return(e,t,n,i)=>new RS(e,r,t,n,i)}class Pd{constructor(e,t,n,i,s){if(this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.ranges=s,!s.length||s.some(o=>o.from>=o.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}}class NS{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 yc=new Be({perNode:!0});class RS{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 ct(n.type,n.children,n.positions,n.length,n.propValues.concat([[yc,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[Be.mounted.id]=new js(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].ranges[0].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 FS(this.fragments),t=null,n=null,i=new aa(new tr(this.baseTree,this.ranges[0].from,0,null),st.IncludeAnonymous|st.IgnoreMounts);e:for(let s,o;this.stoppedAt==null||i.from<this.stoppedAt;){let a=!0,l;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=LS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&i.from<i.to&&(s=this.nest(i,this.input))){i.tree||BS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new NS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=Dd(this.ranges,s.overlay||[new Ir(i.from,i.to)]);u.length&&this.inner.push(new Pd(s.parser,s.parser.startParse(this.input,Nd(c,u),u),s.overlay?s.overlay.map(h=>new Ir(h.from-i.from,h.to-i.from)):null,i.tree,u)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else t&&(l=t.predicate(i))&&(l===!0&&(l=new Ir(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=Dd(this.ranges,t.ranges);c.length&&this.inner.splice(t.index,0,new Pd(t.parser,t.parser.startParse(this.input,Nd(t.mounts,c),c),t.ranges.map(u=>new Ir(u.from-t.start,u.to-t.start)),t.target,c)),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function LS(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 Md(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 BS(r){let{node:e}=r,t=0;do r.parent(),t++;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;function l(c,u,h,d,p){let m=c;for(;a[m+2]+s<=e.from;)m=a[m+3];let y=[],w=[];Md(o,c,m,y,w,d);let A=a[m+1],T=a[m+2],P=A+s==e.from&&T+s==e.to&&a[m]==e.type.id;return y.push(P?e.toTree():l(m+4,a[m+3],o.set.types[a[m]],A,T-A)),w.push(A-d),Md(o,a[m+3],u,y,w,d),new ct(h,y,w,p)}i.children[n]=l(0,a.length,er.none,0,o.length);for(let c=0;c<=t;c++)r.childAfter(e.from)}class Id{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(st.IncludeAnonymous|st.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,st.IgnoreOverlays|st.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 ct)t=t.children[0];else break}return!1}}class FS{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(yc))!==null&&t!==void 0?t:n.to,this.inner=new Id(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(yc))!==null&&e!==void 0?e:t.to,this.inner=new Id(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(Be.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 Dd(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 Ir(l.from,o),l.to>a&&t.splice(s+1,0,new Ir(a,l.to))):l.to>a?t[s--]=new Ir(a,l.to):t.splice(s--,1))}}return n}function jS(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 Ir(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 Nd(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 Ir(d.from+n,d.to+n)),h=jS(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 kn(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 kn(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return t}class ca{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 ca(e,[],t,n,n,0,[],0,i?new Rd(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 ca(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 VS(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 Rd(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 Rd{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class VS{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 ua{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 ua(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 ua(this.stack,this.pos,this.index)}}function Ws(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 fa{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Ld=new fa;class WS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ld,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=Ld,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;Bd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class $S{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Ws(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Bd(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))}}$S.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class ZI{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Bd(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||HS(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&&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 Fd(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function HS(r,e,t,n){let i=Fd(t,n,e);return i<0||Fd(t,n,r)<i}const mr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let bc=null;function jd(r,e,t){let n=r.cursor(st.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 zS{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?jd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jd(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 ct){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Be.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 US{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new fa)}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 fa,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 fa,{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=An(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(An(a,c+2),t,n,i));break}a[c]==t&&(i=this.putAction(An(a,c+1),t,n,i))}return i}}class GS{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 WS(t,i),this.tokens=new US(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ca.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new zS(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&&YS(i);if(o)return mr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw mr&&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 mr&&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=mr?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(Be.contextHash)||0)==u))return e.useNode(h,d),mr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ct)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ct&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),mr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=9e3)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),mr&&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 Vd(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=mr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),mr&&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&&(mr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)mr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))mr&&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),mr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Vd(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ct.build({buffer:ua.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=(bc||(bc=new WeakMap)).get(e);return t||bc.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Vd(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 KS{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const xc=r=>r;class _I{constructor(e){this.start=e.start,this.shift=e.shift||xc,this.reduce=e.reduce||xc,this.reuse=e.reuse||xc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ha extends Td{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=Be[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 sa(t.map((a,l)=>er.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=wd;let o=Ws(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(Wd),this.states=Ws(e.states,Uint32Array),this.data=Ws(e.stateData),this.goto=Ws(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 GS(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=An(n,s+2)];else{if(n[s+1]==2)return An(n,s+2);break}if(o==t||o==0)return An(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=An(this.data,s+2);else break;i=t(An(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=An(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(ha.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]=Wd(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 KS(e,n,i)}static deserialize(e){return new ha(e)}}function An(r,e){return r[e]|r[e+1]<<16}function YS(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 Wd(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}let JS=0;class _r{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=JS++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new _r([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new da;return t=>t.modified.indexOf(e)>-1?t:da.get(t.base||t,t.modified.concat(e).sort((n,i)=>n.id-i.id))}}let QS=0;class da{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&&XS(t,a.modified));if(n)return n;let i=[],s=new _r(i,e,t);for(let a of t)a.instances.push(s);let o=ZS(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(da.get(a,l));return s}}function XS(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function ZS(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 $d(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 pa(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Hd.add(e)}const Hd=new Be;class pa{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}}pa.empty=new pa([],2,null);function zd(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 _S(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function qS(r,e,t,n=0,i=r.length){let s=new ek(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}class ek{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,s){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=tk(e)||pa.empty,h=_S(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Be.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),y=e.firstChild();for(let w=0,A=a;;w++){let T=w<d.overlay.length?d.overlay[w]:null,P=T?T.from+a:l,L=Math.max(t,A),D=Math.min(n,P);if(L<D&&y)for(;e.from<D&&(this.highlightRange(e,L,D,i,s),this.startSpan(Math.min(D,e.to),c),!(e.to>=P||!e.nextSibling())););if(!T||P>n)break;A=T.to+a,A>t&&(this.highlightRange(p.cursor(),Math.max(t,T.from+a),Math.min(n,A),"",m),this.startSpan(Math.min(n,A),c))}y&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function tk(r){let e=r.type.prop(Hd);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const ue=_r.define,ga=ue(),$n=ue(),Ud=ue($n),Gd=ue($n),Hn=ue(),ma=ue(Hn),wc=ue(Hn),qr=ue(),vi=ue(qr),en=ue(),tn=ue(),Sc=ue(),$s=ue(Sc),va=ue(),M={comment:ga,lineComment:ue(ga),blockComment:ue(ga),docComment:ue(ga),name:$n,variableName:ue($n),typeName:Ud,tagName:ue(Ud),propertyName:Gd,attributeName:ue(Gd),className:ue($n),labelName:ue($n),namespace:ue($n),macroName:ue($n),literal:Hn,string:ma,docString:ue(ma),character:ue(ma),attributeValue:ue(ma),number:wc,integer:ue(wc),float:ue(wc),bool:ue(Hn),regexp:ue(Hn),escape:ue(Hn),color:ue(Hn),url:ue(Hn),keyword:en,self:ue(en),null:ue(en),atom:ue(en),unit:ue(en),modifier:ue(en),operatorKeyword:ue(en),controlKeyword:ue(en),definitionKeyword:ue(en),moduleKeyword:ue(en),operator:tn,derefOperator:ue(tn),arithmeticOperator:ue(tn),logicOperator:ue(tn),bitwiseOperator:ue(tn),compareOperator:ue(tn),updateOperator:ue(tn),definitionOperator:ue(tn),typeOperator:ue(tn),controlOperator:ue(tn),punctuation:Sc,separator:ue(Sc),bracket:$s,angleBracket:ue($s),squareBracket:ue($s),paren:ue($s),brace:ue($s),content:qr,heading:vi,heading1:ue(vi),heading2:ue(vi),heading3:ue(vi),heading4:ue(vi),heading5:ue(vi),heading6:ue(vi),contentSeparator:ue(qr),list:ue(qr),quote:ue(qr),emphasis:ue(qr),strong:ue(qr),link:ue(qr),monospace:ue(qr),strikethrough:ue(qr),inserted:ue(),deleted:ue(),changed:ue(),invalid:ue(),meta:va,documentMeta:ue(va),annotation:ue(va),processingInstruction:ue(va),definition:_r.defineModifier(),constant:_r.defineModifier(),function:_r.defineModifier(),standard:_r.defineModifier(),local:_r.defineModifier(),special:_r.defineModifier()},qI=zd([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]),rk=$d({String:M.string,Number:M.number,"True False":M.bool,PropertyName:M.propertyName,Null:M.null,",":M.separator,"[ ]":M.squareBracket,"{ }":M.brace}),nk=ha.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:[rk],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 Qe{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){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),rn.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let n=[];return this.decompose(e,t,n,0),rn.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 Hs(this),s=new Hs(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}iter(e=1){return new Hs(this,e)}iterRange(e,t=this.length){return new Yd(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 Jd(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]?Qe.empty:e.length<=32?new mt(e):rn.from(mt.split(e,[]))}}class mt extends Qe{constructor(e,t=ik(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?n:a)>=e)return new sk(i,a,n,o);i=a+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new mt(Kd(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),a=ya(s.text,o.text.slice(),0,s.length);if(a.length<=32)n.push(new mt(a,o.length+s.length));else{let l=a.length>>1;n.push(new mt(a.slice(0,l)),new mt(a.slice(l)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof mt))return super.replace(e,t,n);let i=ya(this.text,ya(n.text,Kd(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new mt(i,s):rn.from(mt.split(i,[]),s)}sliceString(e,t=this.length,n=`
|
|
141
|
-
|
|
142
|
-
`){let i="";for(let s=0,o=0;s<this.
|
|
143
|
-
`,this;e--}else if(i instanceof mt){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 mt?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 Yd{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Hs(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 Jd{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.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"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},Hs.prototype[Symbol.iterator]=Yd.prototype[Symbol.iterator]=Jd.prototype[Symbol.iterator]=function(){return this});class sk{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}let Ji="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(r=>r?parseInt(r,36):1);for(let r=1;r<Ji.length;r++)Ji[r]+=Ji[r-1];function ok(r){for(let e=1;e<Ji.length;e+=2)if(Ji[e]>r)return Ji[e-1]<=r;return!1}function Qd(r){return r>=127462&&r<=127487}const Xd=8205;function Ut(r,e,t=!0,n=!0){return(t?Zd:ak)(r,e,n)}function Zd(r,e,t){if(e==r.length)return e;e&&_d(r.charCodeAt(e))&&qd(r.charCodeAt(e-1))&&e--;let n=Lt(r,e);for(e+=Dr(n);e<r.length;){let i=Lt(r,e);if(n==Xd||i==Xd||t&&ok(i))e+=Dr(i),n=i;else if(Qd(i)){let s=0,o=e-2;for(;o>=0&&Qd(Lt(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function ak(r,e,t){for(;e>0;){let n=Zd(r,e-2,t);if(n<e)return n;e--}return 0}function _d(r){return r>=56320&&r<57344}function qd(r){return r>=55296&&r<56320}function Lt(r,e){let t=r.charCodeAt(e);if(!qd(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return _d(n)?(t-55296<<10)+(n-56320)+65536:t}function kc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Dr(r){return r<65536?1:2}const Ac=/\r\n?|\n/;var rr=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(rr||(rr={}));class nn{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){Cc(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 nn(e)}composeDesc(e){return this.empty?e:e.empty?this:ep(this,e)}mapDesc(e,t=!1){return e.empty?this:Oc(this,e,t)}mapPos(e,t=-1,n=rr.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!=rr.Simple&&c>=e&&(n==rr.TrackDel&&i<e&&c>e||n==rr.TrackBefore&&i<e||n==rr.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 nn(e)}static create(e){return new nn(e)}}class Et extends nn{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 Cc(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Oc(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(Qe.empty);n.push(o?e.slice(s,s+o):Qe.empty)}s+=o}return new Et(t,n)}compose(e){return this.empty?e:e.empty?this:ep(this,e,!0)}map(e,t=!1){return e.empty?this:Oc(this,e,t,!0)}iterChanges(e,t=!1){Cc(this,e,t)}get desc(){return nn.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new zs(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);Gt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Gt(t,u,h),h>0&&zn(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);Gt(t,u,-1),Gt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Et(t,n),filtered:nn.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&&Gt(i,t-o,-1);let h=new Et(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 Et){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"?Qe.of(p.split(n||Ac)):p:Qe.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Gt(i,h-o,-1),Gt(i,d-h,y),zn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Et(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(Qe.empty);n[i]=Qe.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new Et(t,n)}static createSet(e,t){return new Et(e,t)}}function Gt(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 zn(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(Qe.empty);r.push(t)}}function Cc(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=Qe.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 Oc(r,e,t,n=!1){let i=[],s=n?[]:null,o=new zs(r),a=new zs(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Gt(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(Gt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Gt(i,0,o.ins),s&&zn(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;Gt(i,c,l<o.i?o.ins:0),s&&l<o.i&&zn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Et.createSet(i,s):nn.create(i);throw new Error("Mismatched change set lengths")}}function ep(r,e,t=!1){let n=[],i=t?[]:null,s=new zs(r),o=new zs(e);for(let a=!1;;){if(s.done&&o.done)return i?Et.createSet(n,i):nn.create(n);if(s.ins==0)Gt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Gt(n,0,o.ins,a),i&&zn(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;Gt(n,l,u,a),i&&u&&zn(i,n,o.text)}else o.ins==-1?(Gt(n,s.off?0:s.len,l,a),i&&zn(i,n,s.textBit(l))):(Gt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&zn(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 zs{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?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Qe.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 ie.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ie.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 ie.range(e.anchor,e.head)}static create(e,t,n){return new yi(e,t,n)}}class ie{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ie.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 ie([this.main],0)}addRange(e,t=!0){return ie.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,ie.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 ie(e.ranges.map(t=>yi.fromJSON(t)),e.main)}static single(e,t=e){return new ie([ie.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 ie.normalized(e.slice(),t);n=s.to}return new ie(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?ie.range(l,a):ie.range(a,l))}}return new ie(e,t)}}function tp(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ec=0;class de{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Ec++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new de(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Tc),!!e.static,e.enables)}of(e){return new ba([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Tc(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class ba{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Ec++}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)||Pc(h,u)){let p=n(h);if(a?!rp(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=Sa(d,m);if(this.dependencies.every(w=>w instanceof de?d.facet(w)===h.facet(w):w instanceof kt?d.field(w,!1)==h.field(w,!1):!0)||(a?rp(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 rp(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 Pc(r,e){let t=!1;for(let n of e)Gs(r,n)&1&&(t=!0);return t}function lk(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=Sa(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)Gs(l,c);return l.values[o]=a(l),1},update(l,c){if(!Pc(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=Pc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Tc(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 np=de.define({static:!0});class kt{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 kt(Ec++,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(np).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,np.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Us(r){return e=>new ip(e,r)}const xi={highest:Us(bi.highest),high:Us(bi.high),default:Us(bi.default),low:Us(bi.low),lowest:Us(bi.lowest)};class ip{constructor(e,t){this.inner=e,this.prec=t}}class xa{of(e){return new Mc(this,e)}reconfigure(e){return xa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Mc{constructor(e,t){this.compartment=e,this.inner=t}}class wa{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 ck(e,t,o))d instanceof kt?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,Tc(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=>lk(w,m,p))}}let h=c.map(d=>d(a));return new wa(e,o,h,a,l,s)}}function ck(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 Mc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Mc){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 ip)s(o.inner,o.prec);else if(o instanceof kt)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof ba)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 Gs(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 Sa(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const sp=de.define(),op=de.define({combine:r=>r.some(e=>e),static:!0}),ap=de.define({combine:r=>r.length?r[0]:void 0,static:!0}),lp=de.define(),cp=de.define(),up=de.define(),fp=de.define({combine:r=>r.length?r[0]:!1});class sn{constructor(e,t){this.type=e,this.value=t}static define(){return new uk}}class uk{of(e){return new sn(this,e)}}class fk{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 fk(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 Tt{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&&tp(n,t.newLength),s.some(a=>a.type==Tt.time)||(this.annotations=s.concat(Tt.time.of(Date.now())))}static create(e,t,n,i,s,o){return new Tt(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(Tt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Tt.time=sn.define(),Tt.userEvent=sn.define(),Tt.addToHistory=sn.define(),Tt.remote=sn.define();function hk(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 hp(r,e,t){var n;let i,s,o;return t?(i=e.changes,s=Et.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 Ic(r,e,t){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Tt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Et?e.changes:Et.of(e.changes||[],t,r.facet(ap)),selection:n&&(n instanceof ie?n:ie.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function dp(r,e,t){let n=Ic(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=hp(n,Ic(r,e[s],o?n.changes.newLength:r.doc.length),o)}let i=Tt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return pk(t?dk(i):i)}function dk(r){let e=r.startState,t=!0;for(let i of e.facet(lp)){let s=i(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:hk(t,s))}if(t!==!0){let i,s;if(t===!1)s=r.changes.invertedDesc,i=Et.empty(e.doc.length);else{let o=r.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=Tt.create(e,i,r.selection&&r.selection.map(s),Ae.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let n=e.facet(cp);for(let i=n.length-1;i>=0;i--){let s=n[i](r);s instanceof Tt?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Tt?r=s[0]:r=dp(e,Qi(s),!1)}return r}function pk(r){let e=r.startState,t=e.facet(up),n=r;for(let i=t.length-1;i>=0;i--){let s=t[i](r);s&&Object.keys(s).length&&(n=hp(n,Ic(e,s,r.changes.newLength),!0))}return n==r?r:Tt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const gk=[];function Qi(r){return r==null?gk:Array.isArray(r)?r:[r]}var ot=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(ot||(ot={}));const mk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dc;try{Dc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vk(r){if(Dc)return Dc.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||mk.test(t)))return!0}return!1}function yk(r){return e=>{if(!/\S/.test(e))return ot.Space;if(vk(e))return ot.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return ot.Word;return ot.Other}}class We{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++)Gs(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 Gs(this,n),Sa(this,n)}update(...e){return dp(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let o of e.effects)o.is(xa.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,l)=>i.set(l,a)),t=null),i.set(o.value.compartment,o.value.extension)):o.is(Ae.reconfigure)?(t=null,n=o.value):o.is(Ae.appendConfig)&&(t=null,n=Qi(n).concat(o.value));let s;t?s=e.startState.values.slice():(t=wa.resolve(n,i,this),s=new We(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new We(t,e.newDoc,e.newSelection,s,(o,a)=>a.update(o,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:ie.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:ie.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Et?e:Et.of(e,this.doc.length,this.facet(We.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(We.lineSeparator)||Ac))}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:(Gs(this,t),Sa(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 kt&&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 We.create({doc:e.doc,selection:ie.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=wa.resolve(e.extensions||[],new Map),n=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet(We.lineSeparator)||Ac)),i=e.selection?e.selection instanceof ie?e.selection:ie.single(e.selection.anchor,e.selection.head):ie.single(0);return tp(i,n.length),t.staticFacet(op)||(i=i.asSingle()),new We(t,n,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(We.tabSize)}get lineBreak(){return this.facet(We.lineSeparator)||`
|
|
144
|
-
`}get readOnly(){return this.facet(fp)}phrase(e,...t){for(let n of this.facet(We.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(sp))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return yk(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=Ut(t,o,!1);if(s(t.slice(l,o))!=ot.Word)break;o=l}for(;a<i;){let l=Ut(t,a);if(s(t.slice(a,l))!=ot.Word)break;a=l}return o==a?null:ie.range(o+n,a+n)}}We.allowMultipleSelections=op,We.tabSize=de.define({combine:r=>r.length?r[0]:4}),We.lineSeparator=ap,We.readOnly=fp,We.phrases=de.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])}}),We.languageData=sp,We.changeFilter=lp,We.transactionFilter=cp,We.transactionExtender=up,xa.reconfigure=Ae.define();function zr(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 Ks.create(e,t,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=rr.TrackDel;class Ks{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ks(e,t,n)}}function Nc(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Rc{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 Rc(i,s,n,a):null,pos:o}}}class Ge{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 Ge(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(Nc)),this.isEmpty)return t.length?Ge.of(t):this;let a=new gp(this,null,-1).goto(0),l=0,c=[],u=new Un;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(Ks.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Ge.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 Ge(n,t,s||Ge.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 Ys.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ys.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=pp(o,a,n),c=new Js(o,l,s),u=new Js(a,l,s);n.iterGaps((h,d,p)=>mp(c,h,u,d,p,i)),n.empty&&n.length==0&&mp(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=pp(s,o),l=new Js(s,a,0).goto(n),c=new Js(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Bc(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 Js(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 Un;for(let i of e instanceof Ks?[e]:t?bk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Ge.empty=new Ge([],[],null,-1);function bk(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Nc(e,n)>0)return r.slice().sort(Nc);e=n}return r}Ge.empty.nextLayer=Ge.empty;class Un{finishChunk(e){this.chunks.push(new Rc(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 Un)).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(Ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pp(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 gp{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 Ys{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 gp(o,t,n,s));return i.length==1?i[0]:new Ys(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--)Lc(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--)Lc(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(),Lc(this.heap,0)}}}function Lc(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 Js{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=Ys.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){ka(this.active,e),ka(this.activeTo,e),ka(this.activeRank,e),this.minActive=vp(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++;Aa(this.active,t,n),Aa(this.activeTo,t,i),Aa(this.activeRank,t,s),e&&Aa(e,t,this.cursor.from),this.minActive=vp(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&&ka(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 mp(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))&&Bc(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(a,h,r.point,t.point):h>a&&!Bc(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 Bc(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 ka(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function Aa(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function vp(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 Xi(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=Ut(r,i));return n}function Fc(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=Ut(r,i)}return n===!0?-1:r.length}const jc="\u037C",yp=typeof Symbol>"u"?"__"+jc:Symbol.for(jc),Vc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gn{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(`
|
|
145
|
-
`)}static newName(){let e=bp[yp]||1;return bp[yp]=e+1,jc+e.toString(36)}static mount(e,t,n){let i=e[Vc],s=n&&n.nonce;i?s&&i.setNonce(s):i=new xk(e,s),i.mount(Array.isArray(t)?t:[t])}}let xp=new Map;class xk{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=xp.get(n);if(s)return e.adoptedStyleSheets=[s.sheet,...e.adoptedStyleSheets],e[Vc]=s;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],xp.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[Vc]=this}mount(e){let t=this.sheet,n=0,i=0;for(let s=0;s<e.length;s++){let o=e[s],a=this.modules.indexOf(o);if(a<i&&a>-1&&(this.modules.splice(a,1),i--,a=-1),a==-1){if(this.modules.splice(i++,0,o),t)for(let l=0;l<o.rules.length;l++)t.insertRule(o.rules[l],n++)}else{for(;i<a;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!t){let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
|
|
146
|
-
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Kn={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:"'"},Qs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wk=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Bt=0;Bt<10;Bt++)Kn[48+Bt]=Kn[96+Bt]=String(Bt);for(var Bt=1;Bt<=24;Bt++)Kn[Bt+111]="F"+Bt;for(var Bt=65;Bt<=90;Bt++)Kn[Bt]=String.fromCharCode(Bt+32),Qs[Bt]=String.fromCharCode(Bt);for(var Wc in Kn)Qs.hasOwnProperty(Wc)||(Qs[Wc]=Kn[Wc]);function kk(r){var e=wk&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||Sk&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Qs:Kn)[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 Ca(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function $c(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function Ak(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Oa(r,e){if(!e.anchorNode)return!1;try{return $c(r,e.anchorNode)}catch{return!1}}function Zi(r){return r.nodeType==3?Si(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Ea(r,e,t,n){return t?wp(r,e,t,n,-1)||wp(r,e,t,n,1):!1}function Xs(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function wp(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Cn(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=Xs(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?Cn(r):0}else return!1}}function Cn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ta(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function Ck(r){return{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Ok(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=Ck(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,P=d.bottom-d.top;A=(i=="center"&&T<=P?e.top+T/2-P/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-P+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,P=0;if(A){let L=u.scrollTop;u.scrollTop+=A/y,P=(u.scrollTop-L)*y}if(w){let L=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-L)*m}e={left:e.left-T,top:e.top-P,right:e.right-T,bottom:e.bottom-P},T&&Math.abs(T-w)<1&&(n="nearest"),P&&Math.abs(P-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ek(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 Tk{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?Cn(t):0),n,Math.min(e.focusOffset,n?Cn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let _i=null;function Sp(r){if(r.setActive)return r.setActive();if(_i)return r.focus(_i);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),!_i){_i=!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 kp;function Si(r,e,t=e){let n=kp||(kp=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function qi(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 Pk(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Ap(r){for(;r.attributes.length;)r.removeAttributeNode(r.attributes[0])}function Mk(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,Cn(t));;)if(n){if(t.nodeType!=1)return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=Cn(t))}else{if(t==r)return!0;n=Xs(t),t=t.parentNode}}function Cp(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}class Kt{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Kt(e.parentNode,Xs(e),t)}static after(e,t){return new Kt(e.parentNode,Xs(e)+1,t)}}const Hc=[];class nt{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=nt.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=Op(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=Op(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=Cn(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&&!nt.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=Hc){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&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 Ep(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(){this.parent=null}}nt.prototype.breakAfter=0;function Op(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Ep{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 Tp(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 Pp(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,Tp(r,c,u,a,l,n,0,i,s)}let vr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document<"u"?document:{documentElement:{style:{}}};const Uc=/Edge\/(\d+)/.exec(vr.userAgent),Mp=/MSIE \d/.test(vr.userAgent),Gc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr.userAgent),Pa=!!(Mp||Gc||Uc),Ip=!Pa&&/gecko\/(\d+)/i.test(vr.userAgent),Kc=!Pa&&/Chrome\/(\d+)/.exec(vr.userAgent),Dp="webkitFontSmoothing"in zc.documentElement.style,Np=!Pa&&/Apple Computer/.test(vr.vendor),Rp=Np&&(/Mobile\/\w+/.test(vr.userAgent)||vr.maxTouchPoints>2);var ye={mac:Rp||/Mac/.test(vr.platform),windows:/Win/.test(vr.platform),linux:/Linux|X11/.test(vr.platform),ie:Pa,ie_version:Mp?zc.documentMode||6:Gc?+Gc[1]:Uc?+Uc[1]:0,gecko:Ip,gecko_version:Ip?+(/Firefox\/(\d+)/.exec(vr.userAgent)||[0,0])[1]:0,chrome:!!Kc,chrome_version:Kc?+Kc[1]:0,ios:Rp,android:/Android\b/.test(vr.userAgent),webkit:Dp,safari:Np,webkit_version:Dp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ik=256;class On extends nt{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 On)||this.length-(t-e)+n.length>Ik||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 On(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 Kt(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 Dk(this.dom,e,t)}}class En extends nt{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(Ap(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 En&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Pp(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 En(this.mark,t,o)}domAtPos(e){return Lp(this,e)}coordsAt(e,t){return Fp(this,e,t)}}function Dk(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?ye.chrome||ye.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 ye.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Ta(l,o<0):l||null}class Yn extends nt{static create(e,t,n){return new Yn(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Yn.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 Yn)||!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 Yn&&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 Qe.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):Qe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Kt.before(this.dom):Kt.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 Ta(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class es extends nt{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof es&&e.side==this.side}split(){return new es(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Kt.before(this.dom):Kt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Qe.empty}get isHidden(){return!0}}On.prototype.children=Yn.prototype.children=es.prototype.children=Hc;function Lp(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 Kt(t,0)}function Bp(r,e,t){let n,{children:i}=r;t>0&&e instanceof En&&i.length&&(n=i[i.length-1])instanceof En&&n.mark.eq(e.mark)?Bp(n,e.children[0],t-1):(i.push(e),e.setParent(r)),r.length+=e.length}function Fp(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):Nk(r)}function Nk(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=Zi(e);return t[t.length-1]||null}function Yc(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 jp=Object.create(null);function Jc(r,e,t){if(r==e)return!0;r||(r=jp),e||(e=jp);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 Qc(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 Rk(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 Pt extends nt{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 Pt))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Pp(this,e,t,n?n.children:[],s,o),!0}split(e){let t=new Pt;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){Jc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Bp(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Yc(t,this.attrs||{})),n&&(this.attrs=Yc({class:n},this.attrs||{}))}domAtPos(e){return Lp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Ap(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&&(Qc(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&&nt.get(i)instanceof En;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=nt.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!ye.ios||!this.children.some(s=>s instanceof On))){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 On)||/[^ -~]/.test(n.text))return null;let i=Zi(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=Fp(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 Pt)return s;if(o>t)break}i=o+s.breakAfter}return null}}class Jn extends nt{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 Jn)||!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?Kt.before(this.dom):Kt.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Jn(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Hc}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):Qe.empty}domBoundsAround(){return null}become(e){return e instanceof Jn&&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 on{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 nr=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(nr||(nr={}));class we 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 Zs(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 Qn(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}=Vp(e,t);n=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Qn(e,n,i,t,e.widget||null,!0)}static line(e){return new _s(e)}static set(e,t=!1){return Ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=Ge.empty;class Zs extends we{constructor(e){let{start:t,end:n}=Vp(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 Zs&&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))&&Jc(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)}}Zs.prototype.point=!1;class _s extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _s&&this.spec.class==e.spec.class&&Jc(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)}}_s.prototype.mapMode=rr.TrackBefore,_s.prototype.point=!0;class Qn extends we{constructor(e,t,n,i,s,o){super(t,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?rr.TrackBefore:rr.TrackAfter:rr.TrackDel}get type(){return this.startSide!=this.endSide?nr.WidgetRange:this.startSide<=0?nr.WidgetBefore:nr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Qn&&Lk(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)}}Qn.prototype.point=!0;function Vp(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 Lk(r,e){return r==e||!!(r&&e&&r.compare(e))}function Xc(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 qs{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 Jn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Pt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ma(new es(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Jn)&&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(Ma(new On(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 Qn){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 Qn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Jn(n.widget||new Wp("div"),a,n));else{let l=Yn.create(n.widget||new Wp("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(Ma(new es(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Ma(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 qs(e,t,n,s);return o.openEnd=Ge.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Ma(r,e){for(let t of e)r=new En(t,[r],r.length);return r}class Wp extends on{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 $p=de.define(),Hp=de.define(),zp=de.define(),Up=de.define(),Zc=de.define(),Gp=de.define(),Kp=de.define(),Yp=de.define({combine:r=>r.some(e=>e)}),Jp=de.define({combine:r=>r.some(e=>e)});class Ia{constructor(e,t="nearest",n="nearest",i=5,s=5){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s}map(e){return e.empty?this:new Ia(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Qp=Ae.define({map:(r,e)=>r.map(e)});function Nr(r,e,t){let n=r.facet(Up);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 Da=de.define({combine:r=>r.length?r[0]:!0});let Bk=0;const eo=de.define();class ut{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 ut(Bk++,e,n,i,a=>{let l=[eo.of(a)];return o&&l.push(to.of(c=>{let u=c.plugin(a);return u?o(u):we.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return ut.define(n=>new e(n),t)}}class _c{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(Nr(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){Nr(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){Nr(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Xp=de.define(),Na=de.define(),to=de.define(),qc=de.define(),Zp=de.define();function _p(r,e,t){let n=r.state.facet(Zp);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(r):o),s=[];return Ge.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 qp=de.define();function eg(r){let e=0,t=0,n=0,i=0;for(let s of r.state.facet(qp)){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 ro=de.define();class yr{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new yr(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 yr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new yr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class Ra{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Et.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 yr(s,o,a,l))),this.changedRanges=i}static create(e,t,n){return new Ra(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 ft=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(ft||(ft={}));const no=ft.LTR,tg=ft.RTL;function rg(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const Fk=rg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),jk=rg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),eu=Object.create(null),an=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);eu[e]=t,eu[t]=-e}function Vk(r){return r<=247?Fk[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?jk[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8203?256:64336<=r&&r<=65023?4:r==8204?256:1}const Wk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Xn{get dir(){return this.level%2?tg:no}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 ng(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||!ng(n.inner,i.inner))return!1}return!0}const qe=[];function $k(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=Vk(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 Hk(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=eu[d=r.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(an[y+1]==-p){let w=an[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[an[y]]=A),a=y;break}}else{if(an.length==189)break;an[a++]=h,an[a++]=d,an[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=an[w+2];if(A&2)break;if(y)an[w+2]|=2;else{if(A&4)break;an[w+2]|=4}}}}}function zk(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 tu(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 Xn(l,y.from,p));let w=y.direction==no!=!(p%2);ru(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?tu(r,l,m,n+1,i,d,o):l<m&&o.push(new Xn(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 Xn(y.to,l,p));let w=y.direction==no!=!(p%2);ru(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?tu(r,m,l,n+1,i,d,o):m<l&&o.push(new Xn(m,l,p)),l=m}}function ru(r,e,t,n,i,s,o){let a=e%2?2:1;$k(r,i,s,n,a),Hk(r,i,s,n,a),zk(i,s,n,a),tu(r,i,s,e,t,n,o)}function ig(r,e,t){if(!r)return[new Xn(0,0,e==tg?1:0)];if(e==no&&!t.length&&!Wk.test(r))return sg(r.length);if(t.length)for(;r.length>qe.length;)qe[qe.length]=256;let n=[],i=e==no?0:1;return ru(r,i,i,t,0,r.length,n),n}function sg(r){return[new Xn(0,r,0)]}let og="";function ag(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=Xn.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=Ut(r.text,o,c);if(og=r.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,t))return ie.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?ie.cursor(i?r.to:r.from,i?-1:1,t):h&&h.level<l.level?ie.cursor(h.side(!i,t)+r.from,i?1:-1,h.level):ie.cursor(u+r.from,i?-1:1,l.level)}class lg extends nt{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 Pt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new yr(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:!Xk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Gk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new yr(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,(ye.ie||ye.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Jk(o,a,e.changes);return n=yr.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=ye.chrome||ye.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 Jn&&o.widget instanceof cg&&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 L=qs.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),D=qs.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=L.breakAtStart,m=L.openStart,y=D.openEnd;let j=this.compositionView(n);D.breakAtStart?j.breakAfter=1:D.content.length&&j.merge(j.length,j.length,D.content[0],!1,D.openStart,0)&&(j.breakAfter=D.content[0].breakAfter,D.content.shift()),L.content.length&&j.merge(0,0,L.content[L.content.length-1],!0,0,L.openEnd)&&L.content.pop(),d=L.content.concat(j).concat(D.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=qs.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:P}=s.findPos(l,-1);Tp(this,T,P,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new On(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new En(i,[t],t.length);let n=new Pt;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=nt.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&&Oa(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(ye.gecko&&a.empty&&!this.hasComposition&&Uk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Kt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Ea(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Ea(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{ye.android&&ye.chrome&&this.dom.contains(u.focusNode)&&Qk(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ca(this.view.root);if(h)if(a.empty){if(ye.gecko){let d=Kk(l.node,l.offset);if(d&&d!=3){let p=fg(l.node,l.offset,d==1?1:-1);p&&(l=new Kt(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 Kt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Kt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ca(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Pt.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=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(s.length))}return n?new Kt(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=nt.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 Pt)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 Pt&&!(n instanceof Pt&&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 Pt))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 On))return null;let s=Ut(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==ft.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?Zi(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ft.RTL:ft.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Pt){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=Zi(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 Ep(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(we.replace({widget:new cg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return we.set(e)}updateDeco(){let e=this.view.state.facet(to).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){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=eg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom};Ok(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==ft.LTR)}}function Uk(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 cg extends on{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 ug(r,e){let t=r.observer.selectionRange,n=t.focusNode&&fg(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 Gk(r,e,t){let n=ug(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 yr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=nt.get(h);if(d instanceof En)u.push({node:h,deco:d.mark});else{if(d instanceof Pt||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 Zs({inclusive:!0,attributes:Rk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function fg(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=Cn(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 Kk(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 Yk=class{constructor(){this.changes=[]}compareRange(e,t){Xc(e,t,this.changes)}comparePoint(e,t){Xc(e,t,this.changes)}};function Jk(r,e,t){let n=new Yk;return Ge.compare(r,e,t,n),n.changes}function Qk(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 Xk(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}function Zk(r,e,t=1){let n=r.charCategorizer(e),i=r.doc.lineAt(e),s=e-i.from;if(i.length==0)return ie.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Ut(i.text,s,!1):a=Ut(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Ut(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ut(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return ie.range(o+i.from,a+i.from)}function _k(r,e){return e.left>r?e.left-r:Math.max(0,r-e.right)}function qk(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function nu(r,e){return r.top<e.bottom-1&&r.bottom>e.top+1}function hg(r,e){return e<r.top?{top:e,left:r.left,right:r.right,bottom:r.bottom}:r}function dg(r,e){return e>r.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function iu(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=Zi(m);for(let w=0;w<y.length;w++){let A=y[w];i&&nu(i,A)&&(A=hg(dg(A,i.bottom),i.top));let T=_k(e,A),P=qk(t,A);if(T==0&&P==0)return m.nodeType==3?pg(m,e,t):iu(m,e,t);if(!n||o>P||o==P&&s>T){n=m,i=A,s=T,o=P;let L=P?t<A.top?-1:1:T?e<A.left?-1:1:0;a=!L||(L>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&&nu(u,A)?u=dg(u,A.bottom):h&&nu(h,A)&&(h=hg(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 pg(n,d,t);if(a&&n.contentEditable!="false")return iu(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 pg(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((ye.chrome||ye.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 gg(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 L=r.viewState.heightOracle.textHeight/2,D=!1;l=r.elementAtHeight(d),l.type!=nr.Text;)for(;d=n>0?l.bottom+L:l.top-L,!(d>=0&&d<=c);){if(D)return t?null:0;D=!0,n=-n}h=a+d;let p=l.from;if(p<r.viewport.from)return r.viewport.from==0?0:t?null:mg(r,o,l,u,h);if(p>r.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:mg(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 L=m.caretPositionFromPoint(u,h);L&&({offsetNode:A,offset:T}=L)}else if(m.caretRangeFromPoint){let L=m.caretRangeFromPoint(u,h);L&&({startContainer:A,startOffset:T}=L,(!r.contentDOM.contains(A)||ye.safari&&eA(A,T,u)||ye.chrome&&tA(A,T,u))&&(A=void 0))}}if(!A||!r.docView.dom.contains(A)){let L=Pt.find(r.docView,p);if(!L)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=iu(L.dom,u,h))}let P=r.docView.nearest(A);if(!P)return null;if(P.isWidget&&((s=P.dom)===null||s===void 0?void 0:s.nodeType)==1){let L=P.dom.getBoundingClientRect();return e.y<L.top||e.y<=L.bottom&&e.x<=(L.left+L.right)/2?P.posAtStart:P.posAtEnd}else return P.localPosFromDOM(A,T)+P.posAtStart}function mg(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+Fc(o,s,r.state.tabSize)}function eA(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 tA(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 su(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==nr.Text))return n}return t}function rA(r,e,t,n){let i=su(r,e.head),s=!n||i.type!=nr.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==ft.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return ie.cursor(l,t?-1:1)}return ie.cursor(t?i.to:i.from,t?-1:1)}function vg(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=ag(i,s,o,a,t),u=og;if(!c){if(i.number==(t?r.state.doc.lines:1))return a;u=`
|
|
147
|
-
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=ie.cursor(t?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function nA(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==ot.Space&&(i=o),i==o}}function iA(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return ie.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=gg(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 ie.cursor(y,A,void 0,o)}}}function La(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 ou(r,e,t){let n=La(r.state.facet(qc).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:ie.cursor(n,n<t.from?1:-1)}class sA{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.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ye.safari&&e.contentDOM.addEventListener("input",()=>null),ye.gecko&&wA(e.contentDOM.ownerDocument)}handleEvent(e){!dA(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=oA(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&&xg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),ye.android&&ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=bg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||aA.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,qi(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ye.safari&&!ye.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),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function yg(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){Nr(t.state,i)}}}function oA(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(yg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&t(s).observers.push(yg(n.value,o))}}for(let n in ln)t(n).handlers.push(ln[n]);for(let n in Ur)t(n).observers.push(Ur[n]);return e}const bg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],aA="dthko",xg=[16,17,18,20,91,92,224,225],Ba=6;function Fa(r){return Math.max(0,r)*.7+8}function lA(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class cA{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=Ek(e.contentDOM),this.atoms=e.state.facet(qc).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(We.allowMultipleSelections)&&uA(e,t),this.dragging=hA(e,t)&&Mg(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&&lA(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=eg(this.view);e.clientX-o.left<=s.left+Ba?n=-Fa(s.left-e.clientX):e.clientX+o.right>=s.right-Ba&&(n=Fa(e.clientX-s.right)),e.clientY-o.top<=s.top+Ba?i=-Fa(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Ba&&(i=Fa(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=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=La(this.atoms,i.from,0);o!=i.from&&(s=ie.cursor(o,-1))}else{let o=La(this.atoms,i.from,-1),a=La(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=ie.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?ie.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){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function uA(r,e){let t=r.state.facet($p);return t.length?t[0](e):ye.mac?e.metaKey:e.ctrlKey}function fA(r,e){let t=r.state.facet(Hp);return t.length?t[0](e):ye.mac?!e.altKey:!e.ctrlKey}function hA(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=Ca(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 dA(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=nt.get(t))&&n.ignoreEvent(e))return!1;return!0}const ln=Object.create(null),Ur=Object.create(null),wg=ye.ie&&ye.ie_version<15||ye.ios&&ye.webkit_version<604;function pA(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(),Sg(r,t.value)},50)}function Sg(r,e){let{state:t}=r,n,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(au!=null&&t.selection.ranges.every(l=>l.empty)&&au==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:ie.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:ie.cursor(l.from+c.length)}}):n=t.replaceSelection(s);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ur.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft},ln.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&(r.inputState.lastEscPress=Date.now()),!1),Ur.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")},Ur.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")},ln.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(zp))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=vA(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new cA(r,e,t,n)),n&&r.observer.ignore(()=>Sp(r.contentDOM));let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function kg(r,e,t,n){if(n==1)return ie.cursor(e,t);if(n==2)return Zk(r.state,e,t);{let i=Pt.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++,ie.range(o,a)}}let Ag=(r,e)=>r>=e.top&&r<=e.bottom,Cg=(r,e,t)=>Ag(e,t)&&r>=t.left&&r<=t.right;function gA(r,e,t,n){let i=Pt.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&&Cg(t,n,o))return-1;let a=i.coordsAt(s,1);return a&&Cg(t,n,a)?1:o&&Ag(n,o)?-1:1}function Og(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:gA(r,t,e.clientX,e.clientY)}}const mA=ye.ie&&ye.ie_version<=11;let Eg=null,Tg=0,Pg=0;function Mg(r){if(!mA)return r.detail;let e=Eg,t=Pg;return Eg=r,Pg=Date.now(),Tg=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(Tg+1)%3:1}function vA(r,e){let t=Og(r,e),n=Mg(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=Og(r,s),c,u=kg(r,l.pos,l.bias,n);if(t.pos!=l.pos&&!o){let h=kg(r,t.pos,t.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?ie.range(d,p):ie.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=yA(i,l.pos))?c:a?i.addRange(u):ie.create([u])}}}function yA(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 ie.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}ln.dragstart=(r,e)=>{let{selection:{main:t}}=r.state,{mouseSelection:n}=r.inputState;return n&&(n.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",r.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};function Ig(r,e,t,n){if(!t)return;let i=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{mouseSelection:s}=r.inputState,o=n&&s&&s.dragging&&fA(r,e)?{from:s.dragging.from,to:s.dragging.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"})}ln.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&&Ig(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 Ig(r,e,n,!0),!0}return!1},ln.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=wg?null:e.clipboardData;return t?(Sg(r,t.getData("text/plain")||t.getData("text/uri-text")),!0):(pA(r),!1)};function bA(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 xA(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 au=null;ln.copy=ln.cut=(r,e)=>{let{text:t,ranges:n,linewise:i}=xA(r.state);if(!t&&!i)return!1;au=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=wg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(bA(r,t),!1)};const Dg=sn.define();function Ng(r,e){let t=[];for(let n of r.facet(Kp)){let i=n(r,e);i&&t.push(i)}return t?r.update({effects:t,annotations:Dg.of(!0)}):null}function Rg(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=Ng(r.state,e);t?r.dispatch(t):r.update([])}},10)}Ur.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),Rg(r)},Ur.blur=r=>{r.observer.clearSelectionRange(),Rg(r)},Ur.compositionstart=Ur.compositionupdate=r=>{r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0)},Ur.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,ye.chrome&&ye.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50)},Ur.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()},ln.beforeinput=(r,e)=>{var t;let n;if(ye.chrome&&ye.android&&(n=bg.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 Lg=new Set;function wA(r){Lg.has(r)||(Lg.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Bg=["pre-wrap","normal","pre-line","break-spaces"];class Fg{constructor(e){this.lineWrapping=e,this.doc=Qe.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 Bg.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=Bg.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 jg{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class cn{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"?nr.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 Qn?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 cn(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 ja=.001;class Yt{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)>ja&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Yt.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=lu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new br(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 SA(Yt.of(e.slice(0,t)),o,Yt.of(e.slice(n)))}}Yt.prototype.size=1;class Vg extends Yt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new cn(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 br extends Vg{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new cn(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof br||i instanceof Ft&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ft?i=new br(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Yt.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 Ft extends Yt{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 cn(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 cn(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 cn(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 cn(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 cn(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 Ft?n[n.length-1]=new Ft(s.length+i):n.push(null,new Ft(i-1))}if(e>0){let s=n[0];s instanceof Ft?n[0]=new Ft(e+s.length):n.unshift(new Ft(e-1),null)}return Yt.of(n)}decomposeLeft(e,t){t.push(new Ft(e-1),null)}decomposeRight(e,t){t.push(null,new Ft(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 Ft(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)>=ja&&(l=-2);let d=new br(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Ft(s-a).updateHeight(e,a));let c=Yt.of(o);return(l<0||Math.abs(c.height-this.height)>=ja||Math.abs(l-this.heightMetrics(e,t).perLine)>=ja)&&(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 SA extends Yt{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&&Wg(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Wg(s,a)}return Yt.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?Yt.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 Wg(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Ft&&(n=r[e+1])instanceof Ft&&r.splice(e-1,3,new Ft(t.length+1+n.length))}const kA=5;class lu{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 br?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new br(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 Vg(o,i,n)):(o||s||i>=kA)&&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 br(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ft(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 br)return e;let t=new br(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 br)&&!this.isCovered?this.nodes.push(new br(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 br&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let s=new lu(n,e);return Ge.spans(t,n,i,s,0),s.finish(n)}}function AA(r,e,t){let n=new CA;return Ge.compare(r,e,t,n,0),n.changes}class CA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&Xc(e,t,this.changes,5)}}function OA(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 EA(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class cu{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 we.replace({widget:new TA(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class TA extends on{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 $g{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=Hg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ft.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Na).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Fg(t),this.stateDeco=e.facet(to).filter(n=>typeof n!="function"),this.heightMap=Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(e.doc),[new yr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.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 Va(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Hg:new IA(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:io(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(to).filter(u=>typeof u!="function");let i=e.changedRanges,s=yr.extendWithRanges(i,AA(n,this.stateDeco,e?e.changes:Et.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(Jp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ft.RTL:ft.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 L=a.width/t.offsetWidth,D=a.height/t.offsetHeight;(L>.995&&L<1.005||!isFinite(L)||Math.abs(a.width-t.offsetWidth)<1)&&(L=1),(D>.995&&D<1.005||!isFinite(D)||Math.abs(a.height-t.offsetHeight)<1)&&(D=1),(this.scaleX!=L||this.scaleY!=D)&&(this.scaleX=L,this.scaleY=D,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=Cp(e.scrollDOM);let m=(this.printing?EA:OA)(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 L=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(L)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:D,charWidth:j,textHeight:W}=e.docView.measureTextSize();o=D>0&&i.refresh(s,D,j,W,T/j,L),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 D of this.viewports){let j=D.from==this.viewport.from?L:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new yr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new jg(D.from,j))}i.heightChanged&&(c|=2)}let P=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return P&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||P)&&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 Va(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 Va(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 Va(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 cu(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!=ft.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=MA(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(ie.cursor(u),!1,!0).head;w>c&&(u=w)}y=new cu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=PA(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=$a(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=Wa(u,y),p=Wa(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=$a(u,h),P=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-P,A=T+P}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=Wa(u,w),p=Wa(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=$a(i,n)-$a(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){cu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.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=[];Ge.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)||io(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return io(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 io(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 Va{constructor(e,t){this.from=e,this.to=t}}function PA(r,e,t){let n=[],i=r,s=0;return Ge.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 Wa({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 $a(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 MA(r,e){for(let t of r)if(e(t))return t}const Hg={toDOM(r){return r},fromDOM(r){return r},scale:1};class IA{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 io(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new cn(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>io(i,e)):r._content)}const Ha=de.define({combine:r=>r.join(" ")}),uu=de.define({combine:r=>r.indexOf(!0)>-1}),fu=Gn.newName(),zg=Gn.newName(),Ug=Gn.newName(),Gg={"&light":"."+zg,"&dark":"."+Ug};function hu(r,e,t){return new Gn(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 DA=hu("."+fu,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Gg),so="\uFFFF";class NA{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(We.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=so}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=nt.get(i),l=nt.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Kg(i))||Kg(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=nt.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+(RA(e,n.node,n.offset)?t:0))}}function RA(r,e,t){for(;;){if(!e||t<Cn(e))return!1;if(e==r)return!0;t=Xs(e)+1,e=e.parentNode}}function Kg(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}class Yg{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class LA{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?[]:jA(e),l=new NA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=VA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!$c(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||!$c(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=ie.single(c,l)}}}function Jg(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||ye.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=FA(r.state.doc.sliceString(o,a,so),e.text,l-o,c);u&&(ye.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==so+so&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Qe.of(e.text.slice(u.from,u.toB).split(so))})}else n&&(!r.hasFocus&&r.state.facet(Da)||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))}:(ye.mac||ye.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=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}):ye.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
|
|
148
|
-
`&&r.lineWrapping&&(n&&(n=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}),t){if(ye.ios&&r.inputState.flushIOSKey()||ye.android&&(t.from==i.from&&t.to==i.to&&t.insert.length==1&&t.insert.lines==2&&qi(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)&&qi(r.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&qi(r.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let a,l=()=>a||(a=BA(r,t,n));return r.state.facet(Gp).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 BA(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&&ug(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?ie.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 FA(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 jA(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 Yg(t,n)),(i!=t||s!=n)&&e.push(new Yg(i,s))),e}function VA(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?ie.single(t+e,n+e):null}const WA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},du=ye.ie&&ye.ie_version<=11;class $A{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Tk,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);(ye.ie&&ye.ie_version<=11||ye.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()}),du&&(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(Da)?n.root.activeElement!=this.dom:!Oa(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ye.ie&&ye.ie_version<=11||ye.android&&ye.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ea(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ye.safari&&e.root.nodeType==11&&Ak(this.dom.ownerDocument)==this.dom&&HA(this.view)||Ca(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Oa(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mk(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,WA),du&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),du&&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&&qi(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&&Oa(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 LA(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=Jg(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=Qg(t,e.previousSibling||e.target.previousSibling,-1),i=Qg(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 Qg(r,e,t){for(;e;){let n=nt.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 HA(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 Ea(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class he{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch: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||Pk(e.parent)||document,this.viewState=new $g(e.state||We.create(e)),this.plugins=this.state.facet(eo).map(n=>new _c(n));for(let n of this.plugins)n.update(this);this.observer=new $A(this),this.inputState=new sA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lg(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 Tt?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(Dg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Ng(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(We.phrases)!=this.state.facet(We.phrases))return this.setState(s);i=Ra.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 Ia(p.empty?p:ie.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Qp)&&(h=p.value)}this.viewState.update(i,h),this.bidiCache=za.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(ro)!=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(Ha)!=i.state.facet(Ha)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(Zc))d(i);(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Jg(this,u)&&c.force&&qi(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new $g(e),this.plugins=e.facet(eo).map(n=>new _c(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new lg(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(eo),n=e.state.facet(eo);if(t!=n){let i=[];for(let s of n){let o=t.indexOf(s);if(o<0)i.push(new _c(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(Cp(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 Nr(this.state,m),Xg}}),h=Ra.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]!=Xg)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){Nr(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(Zc))a(t)}get themeClasses(){return fu+" "+(this.state.facet(uu)?Ug:zg)+" "+this.state.facet(Ha)}updateAttrs(){let e=Zg(this,Xp,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Da)?"true":"false",class:"cm-content",style:`${ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zg(this,Na,t);let n=this.observer.ignore(()=>{let i=Qc(this.contentDOM,this.contentAttrs,t),s=Qc(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(he.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(ro);let e=this.state.facet(he.cspNonce);Gn.mount(this.root,this.styleModules.concat(DA).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 ou(this,e,vg(this,e,t,n))}moveByGroup(e,t){return ou(this,e,vg(this,e,t,n=>nA(this,e.head,n)))}moveToLineBoundary(e,t,n=!0){return rA(this,e,t,n)}moveVertically(e,t,n){return ou(this,e,iA(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(),gg(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[Xn.find(s,e-i.from,-1,t)];return Ta(n,o.dir==ft.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(Yp)||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>zA)return sg(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||ng(s.isolates,n=_p(this,e.from,e.to))))return s.order;n||(n=_p(this,e.from,e.to));let i=ig(e.text,t,n);return this.bidiCache.push(new za(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Sp(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Qp.of(new Ia(typeof e=="number"?ie.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ut.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ut.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Gn.newName(),i=[Ha.of(n),ro.of(hu(`.${n}`,e))];return t&&t.dark&&i.push(uu.of(!0)),i}static baseTheme(e){return xi.lowest(ro.of(hu("."+fu,e,Gg)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&nt.get(n)||nt.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}}he.styleModule=ro,he.inputHandler=Gp,he.focusChangeEffect=Kp,he.perLineTextDirection=Yp,he.exceptionSink=Up,he.updateListener=Zc,he.editable=Da,he.mouseSelectionStyle=zp,he.dragMovesSelection=Hp,he.clickAddsSelectionRange=$p,he.decorations=to,he.atomicRanges=qc,he.bidiIsolatedRanges=Zp,he.scrollMargins=qp,he.darkTheme=uu,he.cspNonce=de.define({combine:r=>r.length?r[0]:""}),he.contentAttributes=Na,he.editorAttributes=Xp,he.lineWrapping=he.contentAttributes.of({class:"cm-lineWrapping"}),he.announce=Ae.define();const zA=4096,Xg={};class za{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:ft.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 za(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Zg(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&&Yc(o,t)}return t}const UA=ye.mac?"mac":ye.windows?"win":ye.linux?"linux":"key";function GA(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 Ua(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 KA=xi.default(he.domEventHandlers({keydown(r,e){return em(qg(e.state),r,e,"editor")}})),oo=de.define({enables:KA}),_g=new WeakMap;function qg(r){let e=r.facet(oo),t=_g.get(e);return t||_g.set(e,t=QA(e.reduce((n,i)=>n.concat(i),[]))),t}function YA(r,e,t){return em(qg(r.state),e,r,t)}let Zn=null;const JA=4e3;function QA(r,e=UA){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=>GA(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:[P=>{let L=Zn={view:P,prefix:T,scope:o};return setTimeout(()=>{Zn==L&&(Zn=null)},JA),!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 em(r,e,t,n){let i=kk(e),s=Lt(i,0),o=Dr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;Zn&&Zn.view==t&&Zn.scope==n&&(a=Zn.prefix+" ",xg.indexOf(e.keyCode)<0&&(c=!0,Zn=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+Ua(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ye.windows&&e.ctrlKey&&e.altKey)&&(m=Kn[e.keyCode])&&m!=i?(d(p[a+Ua(m,e,!0)])||e.shiftKey&&(y=Qs[e.keyCode])!=i&&y!=m&&d(p[a+Ua(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ua(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class ao{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=tm(e);return[new ao(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return XA(e,t,n)}}function tm(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==ft.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function rm(r,e,t){let n=ie.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:nr.Text}}function XA(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==ft.LTR,o=r.contentDOM,a=o.getBoundingClientRect(),l=tm(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=su(r,n),m=su(r,i),y=p.type==nr.Text?p:null,w=m.type==nr.Text?m:null;if(y&&(r.lineWrapping||p.widgetLineBreaks)&&(y=rm(r,n,y)),w&&(r.lineWrapping||m.widgetLineBreaks)&&(w=rm(r,i,w)),y&&w&&y.from==w.from)return T(P(t.from,t.to,y));{let D=y?P(t.from,null,y):L(p,!1),j=w?P(null,t.to,w):L(m,!0),W=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&D.bottom+r.defaultLineHeight/2<j.top?W.push(A(h,D.bottom,d,j.top)):D.bottom<j.top&&r.elementAtHeight((D.bottom+j.top)/2).type==nr.Text&&(D.bottom=j.top=(D.bottom+j.top)/2),T(D).concat(W).concat(T(j))}function A(D,j,W,q){return new ao(e,D-l.left,j-l.top-.01,W-D,q-j+.01)}function T({top:D,bottom:j,horizontal:W}){let q=[];for(let F=0;F<W.length;F+=2)q.push(A(W[F],D,W[F+1],j));return q}function P(D,j,W){let q=1e9,F=-1e9,H=[];function Q(be,ke,Re,Se,Oe){let Te=r.coordsAtPos(be,be==W.to?-2:2),De=r.coordsAtPos(Re,Re==W.from?2:-2);!Te||!De||(q=Math.min(Te.top,De.top,q),F=Math.max(Te.bottom,De.bottom,F),Oe==ft.LTR?H.push(s&&ke?h:Te.left,s&&Se?d:De.right):H.push(!s&&Se?h:De.left,!s&&ke?d:Te.right))}let oe=D??W.from,fe=j??W.to;for(let be of r.visibleRanges)if(be.to>oe&&be.from<fe)for(let ke=Math.max(be.from,oe),Re=Math.min(be.to,fe);;){let Se=r.state.doc.lineAt(ke);for(let Oe of r.bidiSpans(Se)){let Te=Oe.from+Se.from,De=Oe.to+Se.from;if(Te>=Re)break;De>ke&&Q(Math.max(Te,ke),D==null&&Te<=oe,Math.min(De,Re),j==null&&De>=fe,Oe.dir)}if(ke=Se.to+1,ke>=Re)break}return H.length==0&&Q(oe,D==null,fe,j==null,r.textDirection),{top:q,bottom:F,horizontal:H}}function L(D,j){let W=a.top+(j?D.top:D.bottom);return{top:W,bottom:W,horizontal:[]}}}function ZA(r,e){return r.constructor==e.constructor&&r.eq(e)}class _A{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(Ga)!=e.state.facet(Ga)&&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(Ga);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)=>!ZA(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 Ga=de.define();function nm(r){return[ut.define(e=>new _A(e,r)),Ga.of(r)]}const im=!ye.ios,ts=de.define({combine(r){return zr(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function qA(r={}){return[ts.of(r),eC,tC,rC,Jp.of(!0)]}function eD(r){return r.facet(ts)}function sm(r){return r.startState.facet(ts)!=r.state.facet(ts)}const eC=nm({above:!0,markers(r){let{state:e}=r,t=e.facet(ts),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||im:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:ie.cursor(i.head,i.head>i.anchor?-1:1);for(let l of ao.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=sm(r);return t&&om(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){om(e.state,r)},class:"cm-cursorLayer"});function om(r,e){e.style.animationDuration=r.facet(ts).cursorBlinkRate+"ms"}const tC=nm({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:ao.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||sm(r)},class:"cm-selectionLayer"}),am={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};im&&(am[".cm-line"].caretColor="transparent !important");const rC=xi.highest(he.theme(am)),lm=Ae.define({map(r,e){return r==null?null:e.mapPos(r)}}),lo=kt.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(lm)?n.value:t,r)}}),nC=ut.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(lo);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(lo)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(lo),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(lo)!=r&&this.view.dispatch({effects:lm.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 iC(){return[lo,nC]}function cm(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 sC(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 pu{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 Un,n=t.add.bind(t);for(let{from:i,to:s}of sC(e,this.maxLength))cm(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 cm(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 gu=/x/.unicode!=null?"gu":"g",oC=new RegExp(`[\0-\b
|
|
149
|
-
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,gu),aC={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 mu=null;function lC(){var r;if(mu==null&&typeof document<"u"&&document.body){let e=document.body.style;mu=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return mu||!1}const Ka=de.define({combine(r){let e=zr(r,{render:null,specialChars:oC,addSpecialChars:null});return(e.replaceTabs=!lC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gu)),e}});function cC(r={}){return[Ka.of(r),uC()]}let um=null;function uC(){return um||(um=ut.fromClass(class{constructor(r){this.view=r,this.decorations=we.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(Ka)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new pu({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Lt(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=Xi(o.text,a,n-o.from);return we.replace({widget:new pC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=we.replace({widget:new dC(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(Ka);r.startState.facet(Ka)!=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 fC="\u2022";function hC(r){return r>=32?fC:r==10?"\u2424":String.fromCharCode(9216+r)}class dC extends on{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=hC(this.code),n=e.state.phrase("Control character")+" "+(aC[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 pC extends on{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 fm=null;function tD(){return[fm,Na.of(r=>{var e;return((e=r.plugin(fm))===null||e===void 0?void 0:e.attrs)||null})]}function gC(){return vC}const mC=we.line({class:"cm-activeLine"}),vC=ut.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(mC.range(i.from)),e=i.from)}return we.set(t)}},{decorations:r=>r.decorations});class yC extends on{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?Zi(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Ta(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 bC(r){return ut.fromClass(class{constructor(e){this.view=e,this.placeholder=r?we.set([we.widget({widget:new yC(r),side:1}).range(0)]):we.none}get decorations(){return this.view.state.doc.length?we.none:this.placeholder}},{decorations:e=>e.decorations})}const vu=2e3;function xC(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>vu||t.off>vu||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(ie.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=Fc(c.text,o,r.tabSize,!0);if(u<0)s.push(ie.cursor(c.to));else{let h=Fc(c.text,a,r.tabSize);s.push(ie.range(c.from+u,c.from+h))}}}return s}function wC(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function hm(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>vu?-1:i==n.length?wC(r,e.clientX):Xi(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function SC(r,e){let t=hm(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=hm(r,i);if(!a)return n;let l=xC(r.state,t,a);return l.length?o?ie.create(l.concat(n.ranges)):ie.create(l):n}}:null}function kC(r){let e=r?.eventFilter||(t=>t.altKey&&t.button==0);return he.mouseSelectionStyle.of((t,n)=>e(n)?SC(t,n):null)}const AC={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},CC={style:"cursor: crosshair"};function OC(r={}){let[e,t]=AC[r.key||"Alt"],n=ut.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,he.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?CC:null})]}const co="-10000px";class dm{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 rD(r={}){return Ya.of(r)}function EC(r){let{win:e}=r;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ya=de.define({combine:r=>{var e,t,n;return{position:ye.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)||EC}}}),pm=new WeakMap,yu=ut.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(Ya);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 dm(r,Ja,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(Ya);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=co,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(ye.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==co&&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(Ya).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=co;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=pm.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||PC,T=this.view.textDirection==ft.LTR,P=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),L=this.above[a];!l.strictSide&&(L?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&L==n.bottom-h.bottom>h.top-n.top&&(L=this.above[a]=!L);let D=(L?h.top-n.top:n.bottom-h.bottom)-m;if(D<w&&c.resize!==!1){if(D<this.view.defaultLineHeight){u.style.top=co;continue}pm.set(c,w),u.style.height=(w=D)/s+"px"}else u.style.height&&(u.style.height="");let j=L?h.top-w-m-A.y:h.bottom+m+A.y,W=P+y;if(c.overlap!==!0)for(let q of o)q.left<W&&q.right>P&&q.top<j+w&&q.bottom>j&&(j=L?q.top-w-2-m:q.bottom+m+2);if(this.position=="absolute"?(u.style.top=(j-r.parent.top)/s+"px",u.style.left=(P-r.parent.left)/i+"px"):(u.style.top=j/s+"px",u.style.left=P/i+"px"),p){let q=h.left+(T?A.x:-A.x)-(P+14-7);p.style.left=q/i+"px"}c.overlap!==!0&&o.push({left:P,top:j,right:W,bottom:j+w}),u.classList.toggle("cm-tooltip-above",L),u.classList.toggle("cm-tooltip-below",!L),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=co}},{eventObservers:{scroll(){this.maybeMeasure()}}}),TC=he.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"}}}),PC={x:0,y:0},Ja=de.define({enables:[yu,TC]}),uo=de.define();class bu{static create(e){return new bu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new dm(e,uo,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 MC=Ja.compute([uo],r=>{let e=r.facet(uo).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>t.end!=null).map(t=>t.end)),create:bu.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class IC{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 Yn)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==ft.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=>Nr(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}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 n=this.active;if(n&&!gm(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,s=(t=n?.end)!==null&&t!==void 0?t:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!DC(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!gm(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function gm(r){for(let e=r;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function DC(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 NC(r,e={}){let t=Ae.define(),n=kt.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,rr.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(RC)&&(i=null);return i},provide:i=>uo.from(i)});return[n,ut.define(i=>new IC(i,r,n,t,e.hoverTime||300)),MC]}function mm(r,e){let t=r.plugin(yu);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}function nD(r){return r.facet(uo).some(e=>e)}const RC=Ae.define(),iD=null;function sD(r){let e=r.plugin(yu);e&&e.maybeMeasure()}const xu=de.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 oD(r){return r?[xu.of(r)]:[]}function fo(r,e){let t=r.plugin(vm),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const vm=ut.fromClass(class{constructor(r){this.input=r.state.facet(ho),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(xu);this.top=new Qa(r,!0,e.topContainer),this.bottom=new Qa(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(xu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Qa(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Qa(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(ho);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=>he.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Qa{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=ym(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ym(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 ym(r){let e=r.nextSibling;return r.remove(),e}const ho=de.define({enables:vm});class un extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}un.prototype.elementClass="",un.prototype.toDOM=void 0,un.prototype.mapMode=rr.TrackBefore,un.prototype.startSide=un.prototype.endSide=-1,un.prototype.point=!0;const Xa=de.define(),LC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},po=de.define();function bm(r){return[xm(),po.of(Object.assign(Object.assign({},LC),r))]}const wu=de.define({combine:r=>r.some(e=>e)});function xm(r){let e=[BC];return r&&r.fixed===!1&&e.push(wu.of(!0)),e}const BC=ut.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(po).map(e=>new Sm(r,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!r.state.facet(wu),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(wu)!=!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=Ge.iter(this.view.state.facet(Xa),this.view.viewport.from),n=[],i=this.gutters.map(s=>new FC(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==nr.Text&&o){Su(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==nr.Text){Su(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(po),t=r.state.facet(po),n=r.docChanged||r.heightChanged||r.viewportChanged||!Ge.eq(r.startState.facet(Xa),r.state.facet(Xa),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 Sm(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=>he.scrollMargins.of(e=>{let t=e.plugin(r);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==ft.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function wm(r){return Array.isArray(r)?r:[r]}function Su(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class FC{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ge.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 km(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=[];Su(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 Sm{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=wm(t.markers(e)),t.initialSpacer&&(this.spacer=new km(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=wm(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!Ge.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 km{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":""),jC(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 jC(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 VC=de.define(),rs=de.define({combine(r){return zr(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 ku extends un{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Au(r,e){return r.state.facet(rs).formatNumber(e,r.state)}const WC=po.compute([rs],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(VC)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new ku(Au(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(rs)!=e.state.facet(rs),initialSpacer(e){return new ku(Au(e,Am(e.state.doc.lines)))},updateSpacer(e,t){let n=Au(t.view,Am(t.view.state.doc.lines));return n==e.number?e:new ku(n)},domEventHandlers:r.facet(rs).domEventHandlers}));function $C(r={}){return[rs.of(r),xm(),WC]}function Am(r){let e=9;for(;e<r;)e=e*10+9;return e}const HC=new class extends un{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},zC=Xa.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(HC.range(i)))}return Ge.of(e)});function UC(){return zC}const Cm=new Map;function GC(r){let e=Cm.get(r);return e||Cm.set(r,e=we.mark({attributes:r===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":r.replace(/ /g,"\xB7")}})),e}function Om(r){return ut.define(e=>({decorations:r.createDeco(e),update(t){this.decorations=r.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const KC=Om(new pu({regexp:/\t| +/g,decoration:r=>GC(r[0]),boundary:/\S/}));function aD(){return KC}const YC=Om(new pu({regexp:/\s+$/g,decoration:we.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function lD(){return YC}const cD={HeightMap:Yt,HeightOracle:Fg,MeasuredHeights:jg,QueryType:tt,ChangedRange:yr,computeOrder:ig,moveVisually:ag};var Cu;const ki=new Be;function Em(r){return de.define({combine:r?e=>e.concat(r):void 0})}const JC=new Be;class xr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,We.prototype.hasOwnProperty("tree")||Object.defineProperty(We.prototype,"tree",{get(){return Nt(this)}}),this.parser=t,this.extension=[_n.of(this),We.languageData.of((s,o,a)=>{let l=Tm(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(JC);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 Tm(e,t,n).type.prop(ki)==this.data}findRegions(e){let t=e.facet(_n);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(Be.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 ct&&i(c,s.positions[l]+o)}};return i(Nt(e),0),n}get allowsNesting(){return!0}}xr.setState=Ae.define();function Tm(r,e,t){let n=r.facet(_n),i=Nt(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,st.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Za extends xr{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Em(e.languageData);return new Za(t,e.parser.configure({props:[ki.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Za(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Nt(r){let e=r.field(xr.state,!1);return e?e.tree:ct.empty}function QC(r,e,t=50){var n;let i=(n=r.field(xr.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 uD(r,e=r.doc.length){var t;return((t=r.field(xr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function fD(r,e=r.viewport.to,t=100){let n=QC(r.state,e,t);return n!=Nt(r.state)&&r.dispatch({}),!!n}function hD(r){var e;return((e=r.plugin(Im))===null||e===void 0?void 0:e.isWorking())||!1}class XC{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 go=null;class ns{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 ns(e,t,[],ct.empty,0,n,[],null)}startParse(){return this.parser.startParse(new XC(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ct.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(kn.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(kn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=go;go=this;try{return e()}finally{go=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Pm(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=kn.applyChanges(n,l),i=ct.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 ns(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=Pm(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 Td{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=go;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 ct(er.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 go}}function Pm(r,e,t){return kn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class is{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 is(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ns.create(e.facet(_n).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new is(n)}}xr.state=kt.define({create:is.init,update(r,e){for(let t of e.effects)if(t.is(xr.setState))return t.value;return e.startState.facet(_n)!=e.state.facet(_n)?is.init(e.state):r.apply(e)}});let Mm=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Mm=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ou=typeof navigator<"u"&&(!((Cu=navigator.scheduling)===null||Cu===void 0)&&Cu.isInputPending)?()=>navigator.scheduling.isInputPending():null,Im=ut.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(xr.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(xr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Mm(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(xr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ou?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Ou&&Ou()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:xr.setState.of(new is(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=>Nr(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()}}}),_n=de.define({combine(r){return r.length?r[0]:null},enables:r=>[xr.state,Im,he.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class ZC{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Dm{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 Dm(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 Nm=de.define(),_a=de.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(_a);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function ss(r,e){let t="",n=r.tabSize,i=r.facet(_a)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function qa(r,e){r instanceof We&&(r=new mo(r));for(let n of r.state.facet(Nm)){let i=n(r,e);if(i!==void 0)return i}let t=Nt(r.state);return t.length>=e?_C(r,t,e):null}function dD(r,e,t){let n=Object.create(null),i=new mo(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=qa(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=ss(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 mo{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 Xi(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 Rm=new Be;function _C(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 Lm(n,r,t)}function Lm(r,e,t){for(let n=r;n;n=n.next){let i=eO(n.node);if(i)return i(Eu.create(e,t,n))}return 0}function qC(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function eO(r){let e=r.type.prop(Rm);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(Be.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>Bm(o,!0,1,void 0,s&&!qC(o)?i.from:void 0)}return r.parent==null?tO:null}function tO(){return 0}class Eu extends mo{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 Eu(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(rO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Lm(this.context.next,this.base,this.pos)}}function rO(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function nO(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 pD({closing:r,align:e=!0,units:t=1}){return n=>Bm(n,e,t,r)}function Bm(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?nO(r):null;return l?a?r.column(l.from):r.column(l.to):r.baseIndent+(a?0:r.unit*t)}const gD=r=>r.baseIndent;function Fm({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const iO=200;function sO(){return We.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+iO)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=qa(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=ss(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 oO=de.define(),jm=new Be;function aO(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 lO(r,e,t){let n=Nt(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(jm);if(l&&(a.to<n.length-50||n.length==r.doc.length||!cO(a))){let c=l(a,r);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function cO(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(oO)){let i=n(r,e,t);if(i)return i}return lO(r,e,t)}function Vm(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 yo=Ae.define({map:Vm}),os=Ae.define({map:Vm});function Tu(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 qn=kt.define({create(){return we.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(yo)&&!uO(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Mu),i=n?we.replace({widget:new yO(n(e.state,t.value))}):Hm;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(os)&&(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=>he.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(Hm.range(n,i))}return we.set(e,!0)}});function mD(r){return r.field(qn,!1)||RangeSet.empty}function bo(r,e,t){var n;let i=null;return(n=r.field(qn,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function uO(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Pu(r,e){return r.field(qn,!1)?e:e.concat(Ae.appendConfig.of(Wm()))}const fO=r=>{for(let e of Tu(r)){let t=vo(r.state,e.from,e.to);if(t)return r.dispatch({effects:Pu(r.state,[yo.of(t),el(r,t)])}),!0}return!1},hO=r=>{if(!r.state.field(qn,!1))return!1;let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);n&&e.push(os.of(n),el(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function el(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return he.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const dO=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(yo.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Pu(r.state,t)}),!!t.length},pO=r=>{let e=r.state.field(qn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(os.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function gO(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 vD=r=>{let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);if(n)e.push(os.of(n),el(r,n,!1));else{let i=gO(r,t);i&&e.push(yo.of(i),el(r,i))}}return e.length>0&&r.dispatch({effects:Pu(r.state,e)}),!!e.length},mO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:fO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:hO},{key:"Ctrl-Alt-[",run:dO},{key:"Ctrl-Alt-]",run:pO}],vO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Mu=de.define({combine(r){return zr(r,vO)}});function Wm(r){let e=[qn,wO];return r&&e.push(Mu.of(r)),e}function $m(r,e){let{state:t}=r,n=t.facet(Mu),i=o=>{let a=r.lineBlockAt(r.posAtDOM(o.target)),l=bo(r.state,a.from,a.to);l&&r.dispatch({effects:os.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 Hm=we.replace({widget:new class extends on{toDOM(r){return $m(r,null)}}});class yO extends on{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $m(e,this.value)}}const bO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Iu extends un{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 xO(r={}){let e=Object.assign(Object.assign({},bO),r),t=new Iu(e,!0),n=new Iu(e,!1),i=ut.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(_n)!=o.state.facet(_n)||o.startState.field(qn,!1)!=o.state.field(qn,!1)||Nt(o.startState)!=Nt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Un;for(let l of o.viewportLineBlocks){let c=bo(o.state,l.from,l.to)?n:vo(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,bm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Ge.empty},initialSpacer(){return new Iu(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=bo(o.state,a.from,a.to);if(c)return o.dispatch({effects:os.of(c)}),!0;let u=vo(o.state,a.from,a.to);return u?(o.dispatch({effects:yo.of(u)}),!0):!1}})}),Wm()]}const wO=he.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 as{constructor(e,t){this.specs=e;let n;function i(a){let l=Gn.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 xr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=zd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Gn(n):null,this.themeType=t.themeType}static define(e,t){return new as(e,t||{})}}const Du=de.define(),zm=de.define({combine(r){return r.length?[r[0]]:null}});function tl(r){let e=r.facet(Du);return e.length?e:r.facet(zm)}function Nu(r,e){let t=[kO],n;return r instanceof as&&(r.module&&t.push(he.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(zm.of(r)):n?t.push(Du.computeN([he.darkTheme],i=>i.facet(he.darkTheme)==(n=="dark")?[r]:[])):t.push(Du.of(r)),t}function yD(r,e,t){let n=tl(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 SO{constructor(e){this.markCache=Object.create(null),this.tree=Nt(e.state),this.decorations=this.buildDeco(e,tl(e.state))}update(e){let t=Nt(e.state),n=tl(e.state),i=n!=tl(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 we.none;let n=new Un;for(let{from:i,to:s}of e.visibleRanges)qS(this.tree,t,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=we.mark({class:l})))},i,s);return n.finish()}}const kO=xi.high(ut.fromClass(SO,{decorations:r=>r.decorations})),AO=as.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"}]),CO=he.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Um=1e4,Gm="()[]{}",Km=de.define({combine(r){return zr(r,{afterCursor:!0,brackets:Gm,maxScanDistance:Um,renderMatch:TO})}}),OO=we.mark({class:"cm-matchingBracket"}),EO=we.mark({class:"cm-nonmatchingBracket"});function TO(r){let e=[],t=r.matched?OO:EO;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 PO=[kt.define({create(){return we.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(Km);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=fn(e.state,i.head,-1,n)||i.head>0&&fn(e.state,i.head-1,1,n)||n.afterCursor&&(fn(e.state,i.head,1,n)||i.head<e.state.doc.length&&fn(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return we.set(t,!0)},provide:r=>he.decorations.from(r)}),CO];function MO(r={}){return[Km.of(r),PO]}const IO=new Be;function Ru(r,e,t){let n=r.prop(e<0?Be.openedBy:Be.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 Lu(r){let e=r.type.prop(IO);return e?e(r.node):r}function fn(r,e,t,n={}){let i=n.maxScanDistance||Um,s=n.brackets||Gm,o=Nt(r),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Ru(l.type,t,s);if(c&&l.from<l.to){let u=Lu(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return DO(r,e,t,l,u,c,s)}}return NO(r,e,t,o,a.type,i,s)}function DO(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=Lu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Ru(u.type,t,o))c++;else if(Ru(u.type,-t,o)){if(c==0){let h=Lu(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 NO(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 Ym(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 Jm{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=Ym(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:Ym(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 RO(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||LO,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Fu}}function LO(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 Qm=new WeakMap;class Xm extends null{constructor(e){let t=Em(e.languageData),n=RO(e),i,s=new class extends Parser{createParse(o,a,l){return new FO(i,o,a,l)}};super(t,s,[Nm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=WO(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new t0(n.tokenTable):VO}static define(e){return new Xm(e)}getIndent(e,t){let n=Nt(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=Qm.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let a=Bu(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 Jm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)_m(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&&Qm.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Bu(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&&Bu(r,a,l,n,i);if(c)return c}return null}function Zm(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=Zm(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 BO(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&&Bu(r,i.tree,0-i.offset,t,o),l;if(a&&(l=Zm(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 FO{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=ns.get(),o=i[0].from,{state:a,tree:l}=BO(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=ns.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==`
|
|
150
|
-
`&&(t="");else{let n=t.indexOf(`
|
|
151
|
-
`);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 Jm(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=_m(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:jO,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 _m(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 Fu=Object.create(null),xo=[er.none],jO=new sa(xo),qm=[],e0=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"]])e0[r]=r0(Fu,e);class t0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),e0)}resolve(e){return e?this.table[e]||(this.table[e]=r0(this.extra,e)):0}}const VO=new t0(Fu);function ju(r,e){qm.indexOf(r)>-1||(qm.push(r),console.warn(e))}function r0(r,e){let t=[];for(let s of e.split(" ")){let o=[];for(let a of s.split(".")){let l=r[a]||M[a];l?typeof l=="function"?o.length?o=o.map(l):ju(a,`Modifier ${a} used at start of tag`):o.length?ju(a,`Tag ${a} used as modifier`):o=Array.isArray(l)?l:[l]:ju(a,`Unknown highlighting tag ${a}`)}for(let a of o)t.push(a)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=er.define({id:xo.length,name:n,props:[$d({[n]:t})]});return xo.push(i),i.id}function WO(r){let e=NodeType.define({id:xo.length,name:"Document",props:[ki.add(()=>r)],top:!0});return xo.push(e),e}const xD=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=$O(e,r.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function $O(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 HO=Za.define({name:"json",parser:nk.configure({props:[Rm.add({Object:Fm({except:/^\s*\}/}),Array:Fm({except:/^\s*\]/})}),jm.add({"Object Array":aO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function zO(){return new ZC(HO)}function Vu(){return Vu=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},Vu.apply(this,arguments)}function UO(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 GO=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=$u(r.state,t.from);return n.line?KO(r):n.block?JO(r):!1};function Wu(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 KO=Wu(ZO,0),wD=null,SD=null,YO=Wu(n0,0),kD=null,AD=null,JO=Wu((r,e)=>n0(r,e,XO(e)),0);function $u(r,e){let t=r.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const wo=50;function QO(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-wo,n),o=r.sliceDoc(i,i+wo),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*wo?u=h=r.sliceDoc(n,i):(u=r.sliceDoc(n,n+wo),h=r.sliceDoc(i-wo,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 XO(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 n0(r,e,t=e.selection.ranges){let n=t.map(s=>$u(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 ZO(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=$u(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 Hu=sn.define(),_O=sn.define(),qO=de.define(),i0=de.define({combine(r){return zr(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)})}});function e2(r){let e=0;return r.iterChangedRanges((t,n)=>e=n),e}const zu=kt.define({create(){return hn.empty},update(r,e){let t=e.state.facet(i0),n=e.annotation(Hu);if(n){let l=e.docChanged?ie.single(e2(e.changes)):void 0,c=ar.fromTransaction(e,l),u=n.side,h=u==0?r.undone:r.done;return c?h=nl(h,h.length,t.minDepth,c):h=a0(h,e.startState.selection),new hn(u==0?n.rest:h,u==0?h:n.rest)}let i=e.annotation(_O);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(Tt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=ar.fromTransaction(e),o=e.annotation(Tt.time),a=e.annotation(Tt.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 hn(r.done.map(ar.fromJSON),r.undone.map(ar.fromJSON))}});function t2(r={}){return[zu,i0.of(r),he.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?s0:e.inputType=="historyRedo"?Uu:null;return n?(e.preventDefault(),n(t)):!1}})]}const CD=null;function rl(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(zu,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}const s0=rl(0,!1),Uu=rl(1,!1),r2=rl(0,!0),n2=rl(1,!0);function OD(r){return function(e){let t=e.field(zu,!1);if(!t)return 0;let n=r==0?t.done:t.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const ED=null,TD=null;class ar{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 ar(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 ar(e.changes&&Et.fromJSON(e.changes),[],e.mapped&&nn.fromJSON(e.mapped),e.startSelection&&ie.fromJSON(e.startSelection),e.selectionsAfter.map(ie.fromJSON))}static fromTransaction(e,t){let n=Rr;for(let i of e.startState.facet(qO)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new ar(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Rr)}static selection(e){return new ar(void 0,Rr,void 0,void 0,e)}}function nl(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 i2(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 s2(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function o0(r,e){return r.length?e.length?r.concat(e):r:e}const Rr=[],o2=200;function a0(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-o2));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),nl(r,r.length-1,1e9,t.setSelAfter(n)))}else return[ar.selection([e])]}function a2(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 Gu(r,e){if(!r.length)return r;let t=r.length,n=Rr;for(;t;){let i=l2(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?[ar.selection(n)]:Rr}function l2(r,e,t){let n=o0(r.selectionsAfter.length?r.selectionsAfter.map(a=>a.map(e)):Rr,t);if(!r.changes)return ar.selection(n);let i=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new ar(i,Ae.mapEffects(r.effects,e),o,r.startSelection.map(s),n)}const c2=/^(input\.type|delete)($|\.)/;class hn{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 hn(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||c2.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,i2(a.changes,e.changes))||n=="input.type.compose")?o=nl(o,o.length-1,i.minDepth,new ar(e.changes.compose(a.changes),o0(e.effects,a.effects),a.mapped,a.startSelection,Rr)):o=nl(o,o.length,i.minDepth,e),new hn(o,Rr,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Rr;return s.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&s2(s[s.length-1],e)?this:new hn(a0(this.done,e),this.undone,t,n)}addMapping(e){return new hn(Gu(this.done,e),Gu(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];if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Hu.of({side:e,rest:a2(i)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?Rr:i.slice(0,i.length-1);return s.mapped&&(o=Gu(o,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Hu.of({side:e,rest:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}hn.empty=new hn(Rr,Rr);const u2=[{key:"Mod-z",run:s0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Uu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Uu,preventDefault:!0},{key:"Mod-u",run:r2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:n2,preventDefault:!0}];function ls(r,e){return ie.create(r.ranges.map(e),r.mainIndex)}function dn(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Lr({state:r,dispatch:e},t){let n=ls(r.selection,t);return n.eq(r.selection)?!1:(e(dn(r,n)),!0)}function So(r,e){return ie.cursor(e?r.to:r.from)}function il(r,e){return Lr(r,t=>t.empty?r.moveByChar(t,e):So(t,e))}function Jt(r){return r.textDirectionAt(r.state.selection.main.head)==ft.LTR}const l0=r=>il(r,!Jt(r)),c0=r=>il(r,Jt(r)),PD=r=>il(r,!0),MD=r=>il(r,!1);function sl(r,e){return Lr(r,t=>t.empty?r.moveByGroup(t,e):So(t,e))}const f2=r=>sl(r,!Jt(r)),h2=r=>sl(r,Jt(r)),ID=r=>sl(r,!0),DD=r=>sl(r,!1),u0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function f0(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(u0&&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(u0.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 h0(r,e){return Lr(r,t=>t.empty?f0(r,t,e):So(t,e))}const ND=r=>h0(r,!0),RD=r=>h0(r,!1);function d2(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 ol(r,e,t){let n=Nt(r).resolveInner(e.head),i=t?Be.closedBy:Be.openedBy;for(let l=e.head;;){let c=t?n.childAfter(l):n.childBefore(l);if(!c)break;d2(r,c,i)?n=c:l=t?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=t?fn(r,n.from,1):fn(r,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,ie.cursor(a,t?-1:1)}const p2=r=>Lr(r,e=>ol(r.state,e,!Jt(r))),g2=r=>Lr(r,e=>ol(r.state,e,Jt(r)));function d0(r,e){return Lr(r,t=>{if(!t.empty)return So(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const p0=r=>d0(r,!1),g0=r=>d0(r,!0);function m0(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let s of r.state.facet(he.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 v0(r,e){let t=m0(r),{state:n}=r,i=ls(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):So(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=he.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return r.dispatch(dn(n,i),{effects:s}),!0}const y0=r=>v0(r,!1),Ku=r=>v0(r,!0);function ei(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=ie.cursor(n.from+s))}return i}const m2=r=>Lr(r,e=>ei(r,e,!0)),v2=r=>Lr(r,e=>ei(r,e,!1)),y2=r=>Lr(r,e=>ei(r,e,!Jt(r))),b2=r=>Lr(r,e=>ei(r,e,Jt(r))),x2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).from,1)),w2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).to,-1));function b0(r,e,t){let n=!1,i=ls(r.selection,s=>{let o=fn(r,s.head,-1)||fn(r,s.head,1)||s.head>0&&fn(r,s.head-1,1)||s.head<r.doc.length&&fn(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?ie.range(s.anchor,a):ie.cursor(a)});return n?(e(dn(r,i)),!0):!1}const S2=({state:r,dispatch:e})=>b0(r,e,!1),LD=({state:r,dispatch:e})=>b0(r,e,!0);function wr(r,e){let t=ls(r.state.selection,n=>{let i=e(n);return ie.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(r.state.selection)?!1:(r.dispatch(dn(r.state,t)),!0)}function al(r,e){return wr(r,t=>r.moveByChar(t,e))}const x0=r=>al(r,!Jt(r)),w0=r=>al(r,Jt(r)),BD=r=>al(r,!0),FD=r=>al(r,!1);function ll(r,e){return wr(r,t=>r.moveByGroup(t,e))}const k2=r=>ll(r,!Jt(r)),A2=r=>ll(r,Jt(r)),jD=r=>ll(r,!0),VD=r=>ll(r,!1);function S0(r,e){return wr(r,t=>f0(r,t,e))}const WD=r=>S0(r,!0),$D=r=>S0(r,!1),C2=r=>wr(r,e=>ol(r.state,e,!Jt(r))),O2=r=>wr(r,e=>ol(r.state,e,Jt(r)));function k0(r,e){return wr(r,t=>r.moveVertically(t,e))}const A0=r=>k0(r,!1),C0=r=>k0(r,!0);function O0(r,e){return wr(r,t=>r.moveVertically(t,e,m0(r).height))}const E0=r=>O0(r,!1),T0=r=>O0(r,!0),E2=r=>wr(r,e=>ei(r,e,!0)),T2=r=>wr(r,e=>ei(r,e,!1)),P2=r=>wr(r,e=>ei(r,e,!Jt(r))),M2=r=>wr(r,e=>ei(r,e,Jt(r))),I2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).from)),D2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).to)),P0=({state:r,dispatch:e})=>(e(dn(r,{anchor:0})),!0),M0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.doc.length})),!0),I0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:0})),!0),D0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),N2=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),R2=({state:r,dispatch:e})=>{let t=ul(r).map(({from:n,to:i})=>ie.range(n,Math.min(i+1,r.doc.length)));return e(r.update({selection:ie.create(t),userEvent:"select"})),!0},L2=({state:r,dispatch:e})=>{let t=ls(r.selection,n=>{var i;let s=Nt(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 ie.range(a.to,a.from)}return n});return e(dn(r,t)),!0},B2=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=ie.create([t.main]):t.main.empty||(n=ie.create([ie.cursor(t.main.head)])),n?(e(dn(r,n)),!0):!1};function cs(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=cl(r,l,!1)):l>o&&(t="delete.forward",l=cl(r,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=cl(r,o,!1),a=cl(r,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:ie.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"?he.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function cl(r,e,t){if(r instanceof he)for(let n of r.state.facet(he.atomicRanges).map(i=>i(r)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const N0=(r,e)=>cs(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=Xi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Ut(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)&&(a+=e?1:-1);return a}),Yu=r=>N0(r,!1),R0=r=>N0(r,!0),L0=(r,e)=>cs(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=Ut(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}),B0=r=>L0(r,!1),F2=r=>L0(r,!0),j2=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),HD=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).from;return e.head>t?t:Math.max(0,e.head-1)}),V2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),W2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),zD=({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},$2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Qe.of(["",""])},range:ie.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},H2=({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:Ut(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ut(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:ie.cursor(a)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ul(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 F0(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let s of ul(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(ie.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(ie.range(l.anchor-a,l.head-a))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:ie.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const z2=({state:r,dispatch:e})=>F0(r,e,!1),U2=({state:r,dispatch:e})=>F0(r,e,!0);function j0(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of ul(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 G2=({state:r,dispatch:e})=>j0(r,e,!1),K2=({state:r,dispatch:e})=>j0(r,e,!0),Y2=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(ul(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=ls(e.selection,i=>r.moveVertically(i,!0)).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},UD=({state:r,dispatch:e})=>(e(r.update(r.replaceSelection(r.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function J2(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Nt(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(Be.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 Q2=V0(!1),X2=V0(!0);function V0(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&&J2(e,s);r&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new mo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=qa(c,s);for(u==null&&(u=Xi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",ss(e,u)];return l&&h.push(ss(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Qe.of(h)},range:ie.cursor(s+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ju(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:ie.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const Z2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new mo(r,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=Ju(r,(s,o,a)=>{let l=qa(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=ss(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},Qu=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{n.push({from:t.from,insert:r.facet(_a)})}),{userEvent:"input.indent"})),!0),W0=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Xi(i,r.tabSize),o=0,a=ss(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),GD=({state:r,dispatch:e})=>r.selection.ranges.some(t=>!t.empty)?Qu({state:r,dispatch:e}):(e(r.update(r.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),_2=[{key:"Ctrl-b",run:l0,shift:x0,preventDefault:!0},{key:"Ctrl-f",run:c0,shift:w0},{key:"Ctrl-p",run:p0,shift:A0},{key:"Ctrl-n",run:g0,shift:C0},{key:"Ctrl-a",run:x2,shift:I2},{key:"Ctrl-e",run:w2,shift:D2},{key:"Ctrl-d",run:R0},{key:"Ctrl-h",run:Yu},{key:"Ctrl-k",run:j2},{key:"Ctrl-Alt-h",run:B0},{key:"Ctrl-o",run:$2},{key:"Ctrl-t",run:H2},{key:"Ctrl-v",run:Ku}],q2=[{key:"ArrowLeft",run:l0,shift:x0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:f2,shift:k2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:y2,shift:P2,preventDefault:!0},{key:"ArrowRight",run:c0,shift:w0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:h2,shift:A2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:b2,shift:M2,preventDefault:!0},{key:"ArrowUp",run:p0,shift:A0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:P0,shift:I0},{mac:"Ctrl-ArrowUp",run:y0,shift:E0},{key:"ArrowDown",run:g0,shift:C0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:M0,shift:D0},{mac:"Ctrl-ArrowDown",run:Ku,shift:T0},{key:"PageUp",run:y0,shift:E0},{key:"PageDown",run:Ku,shift:T0},{key:"Home",run:v2,shift:T2,preventDefault:!0},{key:"Mod-Home",run:P0,shift:I0},{key:"End",run:m2,shift:E2,preventDefault:!0},{key:"Mod-End",run:M0,shift:D0},{key:"Enter",run:Q2},{key:"Mod-a",run:N2},{key:"Backspace",run:Yu,shift:Yu},{key:"Delete",run:R0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:B0},{key:"Mod-Delete",mac:"Alt-Delete",run:F2},{mac:"Mod-Backspace",run:V2},{mac:"Mod-Delete",run:W2}].concat(_2.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),eE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:p2,shift:C2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:g2,shift:O2},{key:"Alt-ArrowUp",run:z2},{key:"Shift-Alt-ArrowUp",run:G2},{key:"Alt-ArrowDown",run:U2},{key:"Shift-Alt-ArrowDown",run:K2},{key:"Escape",run:B2},{key:"Mod-Enter",run:X2},{key:"Alt-l",mac:"Ctrl-l",run:R2},{key:"Mod-i",run:L2,preventDefault:!0},{key:"Mod-[",run:W0},{key:"Mod-]",run:Qu},{key:"Mod-Alt-\\",run:Z2},{key:"Shift-Mod-k",run:Y2},{key:"Shift-Mod-\\",run:S2},{key:"Mod-/",run:GO},{key:"Alt-A",run:YO}].concat(q2),tE={key:"Tab",run:Qu,shift:W0};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++)$0(r,arguments[e]);return r}function $0(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++)$0(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const H0=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class us{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(H0(a)):H0,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 Lt(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=kc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Dr(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"&&(us.prototype[Symbol.iterator]=function(){return this});const z0={from:-1,to:-1,match:/.*/.exec("")},Xu="gm"+(/x/.unicode==null?"":"u");class U0{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=z0,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new G0(e,t,n,i,s);this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=fl(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=fl(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 Zu=new WeakMap;class fs{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=Zu.get(e);if(!i||i.from>=n||i.to<=t){let a=new fs(t,e.sliceString(t,n));return Zu.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)),Zu.set(e,new fs(o,s)),new fs(t,s.slice(t-o,n-o))}}class G0{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=z0,this.matchPos=fl(e,i),this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=fs.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=fl(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(U0.prototype[Symbol.iterator]=G0.prototype[Symbol.iterator]=function(){return this});function rE(r){try{return new RegExp(r,Xu),!0}catch{return!1}}function fl(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 _u(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:hl.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=ie.cursor(m.from+Math.max(0,Math.min(d,m.length)));r.dispatch({effects:[hl.of(!1),he.scrollIntoView(y.from,{y:"center"})],selection:y}),r.focus()}return{dom:n}}const hl=Ae.define(),K0=kt.define({create(){return!0},update(r,e){for(let t of e.effects)t.is(hl)&&(r=t.value);return r},provide:r=>ho.from(r,e=>e?_u:null)}),nE=r=>{let e=fo(r,_u);if(!e){let t=[hl.of(!0)];r.state.field(K0,!1)==null&&t.push(Ae.appendConfig.of([K0,iE])),r.dispatch({effects:t}),e=fo(r,_u)}return e&&e.dom.querySelector("input").select(),!0},iE=he.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),sE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Y0=de.define({combine(r){return zr(r,sE,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oE(r){let e=[fE,uE];return r&&e.push(Y0.of(r)),e}const aE=we.mark({class:"cm-selectionMatch"}),lE=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function J0(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=ot.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=ot.Word)}function cE(r,e,t,n){return r(e.sliceDoc(t,t+1))==ot.Word&&r(e.sliceDoc(n-1,n))==ot.Word}const uE=ut.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(Y0),{state:t}=r,n=t.selection;if(n.ranges.length>1)return we.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return we.none;let l=t.wordAt(i.head);if(!l)return we.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 we.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(J0(o,t,i.from,i.to)&&cE(o,t,i.from,i.to)))return we.none}else if(s=t.sliceDoc(i.from,i.to).trim(),!s)return we.none}let a=[];for(let l of r.visibleRanges){let c=new us(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||J0(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(lE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(aE.range(u,h)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:r=>r.decorations}),fE=he.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),hE=({state:r,dispatch:e})=>{let{selection:t}=r,n=ie.create(t.ranges.map(i=>r.wordAt(i.head)||ie.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function dE(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 us(r.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new us(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 pE=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return hE({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=dE(r,n);return i?(e(r.update({selection:r.selection.addRange(ie.range(i.from,i.to),!1),effects:he.scrollIntoView(i.to)})),!0):!1},Ci=de.define({combine(r){return zr(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new OE(e),scrollToMatch:e=>he.scrollIntoView(e)})}});function KD(r){return r?[Ci.of(r),nf]:nf}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||rE(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"?`
|
|
152
|
-
`: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 yE(this):new mE(this)}getCursor(e,t=0,n){let i=e.doc?e:We.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ds(this,i,t,n):hs(this,i,t,n)}}class X0{constructor(e){this.spec=e}}function hs(r,e,t,n){return new us(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),r.wholeWord?gE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function gE(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(dl(i,t-s))!=ot.Word||e(pl(i,t-s))!=ot.Word)&&(e(pl(i,n-s))!=ot.Word||e(dl(i,n-s))!=ot.Word))}class mE extends X0{constructor(e){super(e)}nextMatch(e,t,n){let i=hs(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=hs(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=hs(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=hs(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=hs(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 ds(r,e,t,n){return new U0(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:r.wholeWord?vE(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function dl(r,e){return r.slice(Ut(r,e,!1),e)}function pl(r,e){return r.slice(e,Ut(r,e))}function vE(r){return(e,t,n)=>!n[0].length||(r(dl(n.input,n.index))!=ot.Word||r(pl(n.input,n.index))!=ot.Word)&&(r(pl(n.input,n.index+n[0].length))!=ot.Word||r(dl(n.input,n.index+n[0].length))!=ot.Word)}class yE extends X0{nextMatch(e,t,n){let i=ds(this.spec,e,n,e.doc.length).next();return i.done&&(i=ds(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=ds(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=ds(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=ds(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 ko=Ae.define(),qu=Ae.define(),pn=kt.define({create(r){return new ef(vl(r).create(),null)},update(r,e){for(let t of e.effects)t.is(ko)?r=new ef(t.value.create(),r.panel):t.is(qu)&&(r=new ef(r.query,t.value?tf:null));return r},provide:r=>ho.from(r,e=>e.panel)});function YD(r){let e=r.field(pn,!1);return e?e.query.spec:vl(r)}function JD(r){var e;return((e=r.field(pn,!1))===null||e===void 0?void 0:e.panel)!=null}class ef{constructor(e,t){this.query=e,this.panel=t}}const bE=we.mark({class:"cm-searchMatch"}),xE=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),wE=ut.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(pn))}update(r){let e=r.state.field(pn);(e!=r.startState.field(pn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return we.none;let{view:t}=this,n=new Un;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?xE:bE)})}return n.finish()}},{decorations:r=>r.decorations});function Ao(r){return e=>{let t=e.state.field(pn,!1);return t&&t.query.spec.valid?r(e,t):ev(e)}}const gl=Ao((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=ie.single(n.from,n.to),s=r.state.facet(Ci);return r.dispatch({selection:i,effects:[rf(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),q0(r),!0}),ml=Ao((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=ie.single(i.from,i.to),o=r.state.facet(Ci);return r.dispatch({selection:s,effects:[rf(r,i),o.scrollToMatch(s.main,r)],userEvent:"select.search"}),q0(r),!0}),SE=Ao((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:ie.create(t.map(n=>ie.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),kE=({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 us(r.doc,r.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(ie.range(a.value.from,a.value.to))}return e(r.update({selection:ie.create(s,o),userEvent:"select.search.matches"})),!0},Z0=Ao((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(he.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=ie.single(s.from-u,s.to-u),c.push(rf(r,s)),c.push(t.facet(Ci).scrollToMatch(a.main,r))}return r.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),AE=Ao((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:he.announce.of(n),userEvent:"input.replace.all"}),!0});function tf(r){return r.state.facet(Ci).createPanel(r)}function vl(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 _0(r){let e=fo(r,tf);return e&&e.dom.querySelector("[main-field]")}function q0(r){let e=_0(r);e&&e==r.root.activeElement&&e.select()}const ev=r=>{let e=r.state.field(pn,!1);if(e&&e.panel){let t=_0(r);if(t&&t!=r.root.activeElement){let n=vl(r.state,e.query.spec);n.valid&&r.dispatch({effects:ko.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[qu.of(!0),e?ko.of(vl(r.state,e.query.spec)):Ae.appendConfig.of(nf)]});return!0},tv=r=>{let e=r.state.field(pn,!1);if(!e||!e.panel)return!1;let t=fo(r,tf);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:qu.of(!1)}),!0},CE=[{key:"Mod-f",run:ev,scope:"editor search-panel"},{key:"F3",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:kE},{key:"Alt-g",run:nE},{key:"Mod-d",run:pE,preventDefault:!0}];class OE{constructor(e){this.view=e;let t=this.query=e.state.field(pn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Sr(e,"Find"),"aria-label":Sr(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:Sr(e,"Replace"),"aria-label":Sr(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",()=>gl(e),[Sr(e,"next")]),n("prev",()=>ml(e),[Sr(e,"previous")]),n("select",()=>SE(e),[Sr(e,"all")]),rt("label",null,[this.caseField,Sr(e,"match case")]),rt("label",null,[this.reField,Sr(e,"regexp")]),rt("label",null,[this.wordField,Sr(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>Z0(e),[Sr(e,"replace")]),n("replaceAll",()=>AE(e),[Sr(e,"replace all")])],rt("button",{name:"close",onclick:()=>tv(e),"aria-label":Sr(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:ko.of(e)}))}keydown(e){YA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ml:gl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Z0(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(ko)&&!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 Sr(r,e){return r.state.phrase(e)}const yl=30,bl=/[\s\.,:;?!]/;function rf(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-yl),o=Math.min(i,t+yl),a=r.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<yl;l++)if(!bl.test(a[l+1])&&bl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-yl;l--)if(!bl.test(a[l-1])&&bl.test(a[l])){a=a.slice(0,l);break}}return he.announce.of(`${r.state.phrase("current match")}. ${a} ${r.state.phrase("on line")} ${n.number}.`)}const EE=he.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"}}),nf=[pn,xi.low(wE),EE];class rv{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Nt(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(sv(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 nv(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 TE(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=nv(e)+nv(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function PE(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:TE(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 XD(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 iv{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ti(r){return r.selection.main.from}function sv(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 ov=sn.define();function ME(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:ie.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const av=new WeakMap;function IE(r){if(!Array.isArray(r))return r;let e=av.get(r);return e||av.set(r,e=PE(r)),e}const sf=Ae.define(),Co=Ae.define();class DE{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=Lt(e,t),i=Dr(n);this.chars.push(n);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Lt(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=Lt(e,0),P=Dr(T),L=P==e.length?0:-100;if(T!=t[0])if(T==n[0])L+=-200;else return!1;return this.ret(L,[0,P])}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,P=Math.min(e.length,200);T<P&&c<l;){let L=Lt(e,T);(L==t[c]||L==n[c])&&(i[c++]=T),T+=Dr(L)}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,P=Math.min(e.length,200),L=0;T<P&&h<l;){let D=Lt(e,T);a<0&&(u<l&&D==t[u]&&(s[u++]=T),p<l&&(D==t[p]||D==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let j,W=D<255?D>=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(j=kc(D))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!T||W==1&&w||L==0&&W!=0)&&(t[h]==D||n[h]==D&&(d=!0)?o[h++]=T:o.length&&(A=!1)),L=W,T+=Dr(D)}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?Dr(Lt(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 Qt=de.define({combine(r){return zr(r,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:NE,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=>lv(e(n),t(n)),optionClass:(e,t)=>n=>lv(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function lv(r,e){return r?e?r+" "+e:r:e}function NE(r,e,t,n,i,s){let o=r.textDirection==ft.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 RE(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){let s=document.createElement("span");s.className="cm-completionLabel";let o=t.displayLabel||t.label,a=0;for(let l=0;l<i.length;){let c=i[l++],u=i[l++];c>a&&s.appendChild(document.createTextNode(o.slice(a,c)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(c,u))),h.className="cm-completionMatchedText",a=u}return a<o.length&&s.appendChild(document.createTextNode(o.slice(a))),s},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 of(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 LE{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(Qt);this.optionContent=RE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=of(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(Qt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Co.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=of(s.length,o,e.state.facet(Qt).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=of(t.options.length,t.selected,this.view.state.facet(Qt).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=>Nr(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&&FE(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(Qt).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,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 BE(r,e){return t=>new LE(t,r,e)}function FE(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 cv(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function jE(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 iv(u,l.source,c?c(u):[],1e9-t.length));else{let u=new DE(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 iv(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(Qt).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):cv(l.completion)>cv(o)&&(s[s.length-1]=l),o=l.completion}return s}class ps{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 ps(this.options,uv(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s){let o=jE(e,t);if(!o.length)return i&&e.some(l=>l.state==1)?new ps(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=t.facet(Qt).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 ps(o,uv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:zE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new ps(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class xl{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new xl($E,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Qt),s=(n.override||t.languageDataAt("autocomplete",ti(t)).map(IE)).map(a=>(this.active.find(c=>c.source==a)||new lr(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))||!VE(s,this.active)?o=ps.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 lr(a.source,0):a));for(let a of e.effects)a.is(lf)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new xl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:WE}}function VE(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 WE={"aria-autocomplete":"list"};function uv(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const $E=[];function af(r){return r.isUserEvent("input.type")?"input":r.isUserEvent("delete.backward")?"delete":null}class lr{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=af(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new lr(i.source,0));for(let s of e.effects)if(s.is(sf))i=new lr(i.source,1,s.value?ti(e.state):-1);else if(s.is(Co))i=new lr(i.source,0);else if(s.is(fv))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 lr(this.source,1)}handleChange(e){return e.changes.touchesRange(ti(e.startState))?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new lr(this.source,this.state,e.mapPos(this.explicitPos))}}class gs extends lr{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=ti(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||t=="delete"&&ti(e.startState)==this.from)return new lr(this.source,t=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return HE(this.result.validFor,e.state,s,o)?new gs(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new rv(e.state,a,l>=0)))?new gs(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ti(e.state)):new lr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new gs(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function HE(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):sv(r,!0).test(i)}const fv=Ae.define({map(r,e){return r.map(t=>t.map(e))}}),lf=Ae.define(),jt=kt.define({create(){return xl.start()},update(r,e){return r.update(e)},provide:r=>[Ja.from(r,e=>e.tooltip),he.contentAttributes.from(r,e=>e.attrs)]});function hv(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field(jt).active.find(i=>i.source==e.source);return n instanceof gs?(typeof t=="string"?r.dispatch(Object.assign(Object.assign({},ME(r.state,t,n.from,n.to)),{annotations:ov.of(e.completion)})):t(r,e.completion,n.from,n.to),!0):!1}const zE=BE(jt,hv);function wl(r,e="option"){return t=>{let n=t.state.field(jt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Qt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=mm(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:lf.of(a)}),!0}}const UE=r=>{let e=r.state.field(jt,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(Qt).interactionDelay?!1:hv(r,e.open.options[e.open.selected])},GE=r=>r.state.field(jt,!1)?(r.dispatch({effects:sf.of(!0)}),!0):!1,KE=r=>{let e=r.state.field(jt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:Co.of(null)}),!0)};class YE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const JE=50,QE=1e3,XE=ut.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(jt).active)e.state==1&&this.startQuery(e)}update(r){let e=r.state.field(jt);if(!r.selectionSet&&!r.docChanged&&r.startState.field(jt)==e)return;let t=r.transactions.some(n=>(n.selection||n.docChanged)&&!af(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(t||i.updates.length+r.transactions.length>JE&&Date.now()-i.time>QE){for(let s of i.context.abortListeners)try{s()}catch(o){Nr(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)af(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(jt);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=ti(e),n=new rv(e,t,r.explicitPos==t),i=new YE(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:Co.of(null)}),Nr(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(Qt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Qt);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 gs(i.active.source,i.active.explicitPos,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:ti(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(jt).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new lr(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:fv.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(jt,!1);if(e&&e.tooltip&&this.view.state.facet(Qt).closeOnBlur){let t=e.open&&mm(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&this.view.dispatch({effects:Co.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sf.of(!1)}),20),this.composing=0}}}),dv=he.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 ZE{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class cf{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 cf(this.field,t,n)}}class uf{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 cf(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 ZE(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 uf(n,i)}}let _E=we.widget({widget:new class extends on{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),qE=we.mark({class:"cm-snippetField"});class ms{constructor(e,t){this.ranges=e,this.active=t,this.deco=we.set(e.map(n=>(n.from==n.to?_E:qE).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 ms(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 Oo=Ae.define({map(r,e){return r&&r.map(e)}}),eT=Ae.define(),Oi=kt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(Oo))return t.value;if(t.is(eT)&&r)return new ms(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=>he.decorations.from(r,e=>e?e.deco:we.none)});function ff(r,e){return ie.create(r.filter(t=>t.field==e).map(t=>ie.range(t.from,t.to)))}function tT(r){let e=uf.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?ov.of(n):void 0};if(a.length&&(l.selection=ff(a,0)),a.length>1){let c=new ms(a,0),u=l.effects=[Oo.of(c)];t.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,oT,aT,dv]))}t.dispatch(t.state.update(l))}}function pv(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:ff(n.ranges,i),effects:Oo.of(s?null:new ms(n.ranges,i)),scrollIntoView:!0})),!0}}const rT=({state:r,dispatch:e})=>r.field(Oi,!1)?(e(r.update({effects:Oo.of(null)})),!0):!1,nT=pv(1),iT=pv(-1);function ZD(r){let e=r.field(Oi,!1);return!!(e&&e.ranges.some(t=>t.field==e.active+1))}function _D(r){let e=r.field(Oi,!1);return!!(e&&e.active>0)}const sT=[{key:"Tab",run:nT,shift:iT},{key:"Escape",run:rT}],gv=de.define({combine(r){return r.length?r[0]:sT}}),oT=xi.highest(oo.compute([gv],r=>r.facet(gv)));function qD(r,e){return Object.assign(Object.assign({},e),{apply:tT(r)})}const aT=he.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:ff(t.ranges,i.field),effects:Oo.of(t.ranges.some(s=>s.field>i.field)?new ms(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});function lT(r){let e=r.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function mv(r,e){return new RegExp(e(r.source),r.unicode?"u":"")}const vv=null;function cT(r){return vv[r]||(vv[r]=new WeakMap)}function yv(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 bv(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 bv(u,e,t,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else yv(u,t,a,l,i-c);c+=u.length+1}}else yv(r,t,a,l,i);return s&&a.length<2e3&&e.set(r,a),a}const e3=r=>{let e=r.state.languageDataAt("wordChars",r.pos).join(""),t=lT(e),n=r.matchBefore(mv(t,o=>o+"$"));if(!n&&!r.explicit)return null;let i=n?n.from:r.pos,s=bv(r.state.doc,cT(e),t,5e4,i);return{from:i,options:s,validFor:mv(t,o=>"^"+o)}},Eo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(r,e){let t=e.mapPos(r,-1,rr.TrackAfter);return t??void 0}}),hf=new class extends wi{};hf.startSide=1,hf.endSide=-1;const xv=kt.define({create(){return Ge.empty},update(r,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(n,-1)&&(r=Ge.empty)}r=r.map(e.changes);for(let t of e.effects)t.is(Ei)&&(r=r.update({add:[hf.range(t.value,t.value+1)]}));return r}});function uT(){return[hT,xv]}const df="()[]{}<>";function wv(r){for(let e=0;e<df.length;e+=2)if(df.charCodeAt(e)==r)return df.charAt(e+1);return kc(r<128?r:r+1)}function Sv(r,e){return r.languageDataAt("closeBrackets",e)[0]||Eo}const fT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),hT=he.inputHandler.of((r,e,t,n)=>{if((fT?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Dr(Lt(n,0))==1||e!=i.from||t!=i.to)return!1;let s=pT(r.state,n);return s?(r.dispatch(s),!0):!1}),dT=[{key:"Backspace",run:({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Sv(r,r.selection.main.head).brackets||Eo.brackets,i=null,s=r.changeByRange(o=>{if(o.empty){let a=gT(r.doc,o.head);for(let l of n)if(l==a&&Sl(r.doc,o.head)==wv(Lt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:ie.cursor(o.head-l.length)}}return{range:i=o}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function pT(r,e){let t=Sv(r,r.selection.main.head),n=t.brackets||Eo.brackets;for(let i of n){let s=wv(Lt(i,0));if(e==i)return s==i?yT(r,i,n.indexOf(i+i+i)>-1,t):mT(r,i,s,t.before||Eo.before);if(e==s&&kv(r,r.selection.main.from))return vT(r,i,s)}return null}function kv(r,e){let t=!1;return r.field(xv).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Sl(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Dr(Lt(t,0)))}function gT(r,e){let t=r.sliceString(e-2,e);return Dr(Lt(t,0))==t.length?t:t.slice(1)}function mT(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:ie.range(o.anchor+e.length,o.head+e.length)};let a=Sl(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:ie.cursor(o.head+e.length)}:{range:i=o}});return i?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function vT(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&Sl(r.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:ie.cursor(s.head+t.length)}:n={range:s});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function yT(r,e,t,n){let i=n.stringPrefixes||Eo.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:ie.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Sl(r.doc,l),u;if(c==e){if(Av(r,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(kv(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:ie.cursor(l+d.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(u=Cv(r,l-2*e.length,i))>-1&&Av(r,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(r.charCategorizer(l)(c)!=ot.Word&&Cv(r,l,i)>-1&&!bT(r,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)}}return{range:s=a}});return s?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Av(r,e){let t=Nt(r).resolveInner(e+1);return t.parent&&t.from==e}function bT(r,e,t,n){let i=Nt(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 Cv(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=ot.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))!=ot.Word)return s}return-1}function xT(r={}){return[jt,Qt.of(r),XE,wT,dv]}const Ov=[{key:"Ctrl-Space",run:GE},{key:"Escape",run:KE},{key:"ArrowDown",run:wl(!0)},{key:"ArrowUp",run:wl(!1)},{key:"PageDown",run:wl(!0,"page")},{key:"PageUp",run:wl(!1,"page")},{key:"Enter",run:UE}],wT=xi.highest(oo.computeN([Qt],r=>r.facet(Qt).defaultKeymap?[Ov]:[]));function r3(r){let e=r.field(jt,!1);return e&&e.active.some(t=>t.state==1)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}const Ev=new WeakMap;function n3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;if(!t||t.disabled)return[];let n=Ev.get(t.options);return n||Ev.set(t.options,n=t.options.map(i=>i.completion)),n}function i3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.options[t.selected].completion:null}function s3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.selected:null}function o3(r){return lf.of(r)}class ST{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=we.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?we.widget({widget:new MT(a),diagnostic:a}).range(a.from):we.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,vs(o))}}function vs(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 ST(i,s,o.diagnostic),!1}),n}function Tv(r,e){let t=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(n=>n.is(kl))||r.changes.touchesRange(t.from,t.to))}function Pv(r,e){return r.field(Xt,!1)?e:e.concat(Ae.appendConfig.of(Wv))}function kT(r,e){return{effects:Pv(r,[kl.of(e)])}}const kl=Ae.define(),pf=Ae.define(),Mv=Ae.define(),Xt=kt.define({create(){return new Ti(we.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=vs(t,r.selected.diagnostic,i)||vs(t,null,i)}r=new Ti(t,r.panel,n)}for(let t of e.effects)t.is(kl)?r=Ti.init(t.value,r.panel,e.state):t.is(pf)?r=new Ti(r.diagnostics,t.value?Al.open:null,r.selected):t.is(Mv)&&(r=new Ti(r.diagnostics,r.panel,t.value));return r},provide:r=>[ho.from(r,e=>e.panel),he.decorations.from(r,e=>e.diagnostics)]});function a3(r){let e=r.field(Xt,!1);return e?e.diagnostics.size:0}const AT=we.mark({class:"cm-lintRange cm-lintRange-active"});function CT(r,e,t){let{diagnostics:n}=r.state.field(Xt),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:Iv(r,i)}}}:null}function Iv(r,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>Lv(r,t,!1)))}const OT=r=>{let e=r.state.field(Xt,!1);(!e||!e.panel)&&r.dispatch({effects:Pv(r.state,[pf.of(!0)])});let t=fo(r,Al.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Dv=r=>{let e=r.state.field(Xt,!1);return!e||!e.panel?!1:(r.dispatch({effects:pf.of(!1)}),!0)},ET=r=>{let e=r.state.field(Xt,!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)},l3=r=>{let{state:e}=r,t=e.field(Xt,!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)},TT=[{key:"Mod-Shift-m",run:OT,preventDefault:!0},{key:"F8",run:ET}],Nv=ut.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(kT(this.view.state,i))},n=>{Nr(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=de.define({combine(r){return Object.assign({sources:r.map(e=>e.source)},zr(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 PT(r,e={}){return[Pi.of({source:r,config:e}),Nv,Wv]}function c3(r){let e=r.plugin(Nv);e&&e.force()}function Rv(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 Lv(r,e,t){var n;let i=t?Rv(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=vs(r.state.field(Xt).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 MT extends on{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 Bv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Lv(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Al{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Dv(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=Rv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=vs(this.view.state.field(Xt).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:()=>Dv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(Xt).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(Xt),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 Bv(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 Bv(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(Xt),n=vs(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Mv.of(n)})}static open(e){return new Al(e)}}function Cl(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 Ol(r){return Cl(`<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 IT=he.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:Ol("#d11")},".cm-lintRange-warning":{backgroundImage:Ol("orange")},".cm-lintRange-info":{backgroundImage:Ol("#999")},".cm-lintRange-hint":{backgroundImage:Ol("#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 Fv(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}class DT extends un{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>Fv(t)<Fv(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(El).tooltipFilter;return i&&(n=i(n)),n.length&&(t.onmouseover=()=>RT(e,t,n)),t}}function NT(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(Vv)&&r.dispatch({effects:gf.of(null)})}};window.addEventListener("mousemove",t)}function RT(r,e,t){function n(){let o=r.elementAtHeight(e.getBoundingClientRect().top+5-r.documentTop);r.coordsAtPos(o.from)&&r.dispatch({effects:gf.of({pos:o.from,above:!1,create(){return{dom:Iv(r,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,NT(r,e)}let{hoverTime:i}=r.state.facet(El),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function LT(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 DT(t[i]).range(+i));return Ge.of(n,!0)}const BT=bm({class:"cm-gutter-lint",markers:r=>r.state.field(jv)}),jv=kt.define({create(){return Ge.empty},update(r,e){r=r.map(e.changes);let t=e.state.facet(El).markerFilter;for(let n of e.effects)if(n.is(kl)){let i=n.value;t&&(i=t(i||[])),r=LT(e.state.doc,i.slice(0))}return r}}),gf=Ae.define(),Vv=kt.define({create(){return null},update(r,e){return r&&e.docChanged&&(r=Tv(e,r)?null:Object.assign(Object.assign({},r),{pos:e.changes.mapPos(r.pos)})),e.effects.reduce((t,n)=>n.is(gf)?n.value:t,r)},provide:r=>Ja.from(r)}),FT=he.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Cl('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Cl('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Cl('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Wv=[Xt,he.decorations.compute([Xt],r=>{let{selected:e,panel:t}=r.field(Xt);return!e||!t||e.from==e.to?we.none:we.set([AT.range(e.from,e.to)])}),NC(CT,{hideOn:Tv}),IT],El=de.define({combine(r){return zr(r,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function u3(r={}){return[El.of(r),jv,BT,FT,Vv]}function f3(r,e){let t=r.field(Xt,!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 $v=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(dT)),e.defaultKeymap!==!1&&(n=n.concat(eE)),e.searchKeymap!==!1&&(n=n.concat(CE)),e.historyKeymap!==!1&&(n=n.concat(u2)),e.foldKeymap!==!1&&(n=n.concat(mO)),e.completionKeymap!==!1&&(n=n.concat(Ov)),e.lintKeymap!==!1&&(n=n.concat(TT));var i=[];return e.lineNumbers!==!1&&i.push($C()),e.highlightActiveLineGutter!==!1&&i.push(UC()),e.highlightSpecialChars!==!1&&i.push(cC()),e.history!==!1&&i.push(t2()),e.foldGutter!==!1&&i.push(xO()),e.drawSelection!==!1&&i.push(qA()),e.dropCursor!==!1&&i.push(iC()),e.allowMultipleSelections!==!1&&i.push(We.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(sO()),e.syntaxHighlighting!==!1&&i.push(Nu(AO,{fallback:!0})),e.bracketMatching!==!1&&i.push(MO()),e.closeBrackets!==!1&&i.push(uT()),e.autocompletion!==!1&&i.push(xT()),e.rectangularSelection!==!1&&i.push(kC()),t!==!1&&i.push(OC()),e.highlightActiveLine!==!1&&i.push(gC()),e.highlightSelectionMatches!==!1&&i.push(oE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(_a.of(" ".repeat(e.tabSize))),i.concat([oo.of(n.flat())]).filter(Boolean)},h3=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 Hv="#e5c07b",mf="#e06c75",zv="#56b6c2",Uv="#ffffff",To="#abb2bf",Tl="#7d8799",Gv="#61afef",Kv="#98c379",vf="#d19a66",Yv="#c678dd",Jv="#21252b",yf="#2c313a",bf="#282c34",Pl="#353a42",Qv="#3E4451",xf="#528bff",d3={chalky:Hv,coral:mf,cyan:zv,invalid:Uv,ivory:To,stone:Tl,malibu:Gv,sage:Kv,whiskey:vf,violet:Yv,darkBackground:Jv,highlightBackground:yf,background:bf,tooltipBackground:Pl,selection:Qv,cursor:xf},jT=he.theme({"&":{color:To,backgroundColor:bf},".cm-content":{caretColor:xf},".cm-cursor, .cm-dropCursor":{borderLeftColor:xf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qv},".cm-panels":{backgroundColor:Jv,color:To},".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:bf,color:Tl,border:"none"},".cm-activeLineGutter":{backgroundColor:yf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Pl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Pl,borderBottomColor:Pl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:yf,color:To}}},{dark:!0}),VT=as.define([{tag:M.keyword,color:Yv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:mf},{tag:[M.function(M.variableName),M.labelName],color:Gv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:vf},{tag:[M.definition(M.name),M.separator],color:To},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Hv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:zv},{tag:[M.meta,M.comment],color:Tl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Tl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:mf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:vf},{tag:[M.processingInstruction,M.string,M.inserted],color:Kv},{tag:M.invalid,color:Uv}]),WT=[jT,Nu(VT)];var $T=he.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),HT=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(oo.of([tE])),a&&(typeof a=="boolean"?l.unshift($v()):l.unshift($v(a))),o&&l.unshift(bC(o)),s){case"light":l.push($T);break;case"dark":l.push(WT);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(he.editable.of(!1)),i&&l.push(We.readOnly.of(!0)),[...l]},zT=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)}),Xv=sn.define(),UT=[];function GT(r){var{value:e,selection:t,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=UT,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:P=!0,basicSetup:L=!0,root:D,initialState:j}=r,[W,q]=(0,S.useState)(),[F,H]=(0,S.useState)(),[Q,oe]=(0,S.useState)(),fe=he.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),be=he.updateListener.of(Se=>{if(Se.docChanged&&typeof n=="function"&&!Se.transactions.some(De=>De.annotation(Xv))){var Oe=Se.state.doc,Te=Oe.toString();n(Te,Se)}i&&i(zT(Se))}),ke=HT({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:P,basicSetup:L}),Re=[be,fe,...ke];return o&&typeof o=="function"&&Re.push(he.updateListener.of(o)),Re=Re.concat(a),(0,S.useEffect)(()=>{if(W&&!Q){var Se={doc:e,selection:t,extensions:Re},Oe=j?We.fromJSON(j.json,Se,j.fields):We.create(Se);if(oe(Oe),!F){var Te=new he({state:Oe,parent:W,root:D});H(Te),s&&s(Te,Oe)}}return()=>{F&&(oe(void 0),H(void 0))}},[W,Q]),(0,S.useEffect)(()=>q(r.container),[r.container]),(0,S.useEffect)(()=>()=>{F&&(F.destroy(),H(void 0))},[F]),(0,S.useEffect)(()=>{l&&F&&F.focus()},[l,F]),(0,S.useEffect)(()=>{F&&F.dispatch({effects:Ae.reconfigure.of(Re)})},[c,a,u,h,d,p,m,y,w,A,T,P,L,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var Se=F?F.state.doc.toString():"";F&&e!==Se&&F.dispatch({changes:{from:0,to:Se.length,insert:e||""},annotations:[Xv.of(!0)]})}},[e,F]),{state:Q,setState:oe,view:F,setView:H,container:W,setContainer:q}}var KT=f(61250),YT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Zv=(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:P,indentWithTab:L,editable:D,readOnly:j,root:W,initialState:q}=r,F=UO(r,YT),H=(0,S.useRef)(null),{state:Q,view:oe,container:fe}=GT({container:H.current,root:W,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:P,indentWithTab:L,editable:D,readOnly:j,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:q});if((0,S.useImperativeHandle)(e,()=>({editor:H.current,state:Q,view:oe}),[H,fe,Q,oe]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var be=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,KT.jsx)("div",Vu({ref:H,className:""+be+(t?" "+t:"")},F))});Zv.displayName="CodeMirror";const JT=Zv,QT=(0,Je.ZP)(JT)`
|
|
136
|
+
`,wd=(0,Ye.ZP)(bd)`
|
|
137
|
+
${(0,st.Hu)("try-it")};
|
|
138
|
+
${({inputType:t})=>t==="password"?"padding-right: 40px;":""};
|
|
139
|
+
${({fullWidth:t})=>t?"width: 100%;":""}
|
|
140
|
+
`,Sd=1024;let TS=0;class Rr{constructor(e,r){this.from=e,this.to=r}}class Re{constructor(e={}){this.id=TS++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=nr.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}Re.closedBy=new Re({deserialize:t=>t.split(" ")}),Re.openedBy=new Re({deserialize:t=>t.split(" ")}),Re.group=new Re({deserialize:t=>t.split(" ")}),Re.contextHash=new Re({perNode:!0}),Re.lookAhead=new Re({perNode:!0}),Re.mounted=new Re({perNode:!0});class Vs{constructor(e,r,n){this.tree=e,this.overlay=r,this.parser=n}static get(e){return e&&e.props&&e.props[Re.mounted.id]}}const PS=Object.create(null);class nr{constructor(e,r,n,i=0){this.name=e,this.props=r,this.id=n,this.flags=i}static define(e){let r=e.props&&e.props.length?Object.create(null):PS,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new nr(e.name||"",r,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let r=this.prop(Re.group);return r?r.indexOf(e)>-1:!1}return this.id==e}static match(e){let r=Object.create(null);for(let n in e)for(let i of n.split(" "))r[i]=e[n];return n=>{for(let i=n.prop(Re.group),s=-1;s<(i?i.length:0);s++){let o=r[s<0?n.name:i[s]];if(o)return o}}}}nr.none=new nr("",Object.create(null),0,8);class oa{constructor(e){this.types=e;for(let r=0;r<e.length;r++)if(e[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let r=[];for(let n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}r.push(i?new nr(n.name,i,n.id,n.flags):n)}return new oa(r)}}const aa=new WeakMap,kd=new WeakMap;var ot;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(ot||(ot={}));class ut{constructor(e,r,n,i,s){if(this.type=e,this.children=r,this.positions=n,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Vs.get(this);if(e&&!e.overlay)return e.tree.toString();let r="";for(let n of this.children){let i=n.toString();i&&(r&&(r+=","),r+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(e=0){return new la(this.topNode,e)}cursorAt(e,r=0,n=0){let i=aa.get(this)||this.topNode,s=new la(i);return s.moveTo(e,r),aa.set(this,s._tree),s}get topNode(){return new Gt(this,0,0,null)}resolve(e,r=0){let n=Ws(aa.get(this)||this.topNode,e,r,!1);return aa.set(this,n),n}resolveInner(e,r=0){let n=Ws(kd.get(this)||this.topNode,e,r,!0);return kd.set(this,n),n}resolveStack(e,r=0){return DS(this,e,r)}iterate(e){let{enter:r,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&ot.IncludeAnonymous)>0;for(let l=this.cursor(o|ot.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||r(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let r in this.props)e.push([+r,this.props[r]]);return e}balance(e={}){return this.children.length<=8?this:yc(nr.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,i)=>new ut(this.type,r,n,i,this.propValues),e.makeTree||((r,n,i)=>new ut(nr.none,r,n,i)))}static build(e){return NS(e)}}ut.empty=new ut(nr.none,[],[],0);class gc{constructor(e,r){this.buffer=e,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new gc(this.buffer,this.index)}}class Hn{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return nr.none}toString(){let e=[];for(let r=0;r<this.buffer.length;)e.push(this.childString(r)),r=this.buffer[r+3];return e.join(",")}childString(e){let r=this.buffer[e],n=this.buffer[e+3],i=this.set.types[r],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,r,n,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=r&&!(Ad(s,i,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,r,n){let i=this.buffer,s=new Uint16Array(r-e),o=0;for(let a=e,l=0;a<r;){s[l++]=i[a++],s[l++]=i[a++]-n;let c=s[l++]=i[a++]-n;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Hn(s,o,this.set)}}function Ad(t,e,r,n){switch(t){case-2:return r<e;case-1:return n>=e&&r<e;case 0:return r<e&&n>e;case 1:return r<=e&&n>e;case 2:return n>e;case 4:return!0}}function Ws(t,e,r,n){for(var i;t.from==t.to||(r<1?t.from>=e:t.from>e)||(r>-1?t.to<=e:t.to<e);){let o=!n&&t instanceof Gt&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=n?0:ot.IgnoreOverlays;if(n)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Gt&&o.index<0&&((i=a.enter(e,r,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,r,s);if(!o)return t;t=o}}class Cd{cursor(e=0){return new la(this,e)}getChild(e,r=null,n=null){let i=Od(this,e,r,n);return i.length?i[0]:null}getChildren(e,r=null,n=null){return Od(this,e,r,n)}resolve(e,r=0){return Ws(this,e,r,!1)}resolveInner(e,r=0){return Ws(this,e,r,!0)}matchContext(e){return mc(this,e)}enterUnfinishedNodesBefore(e){let r=this.childBefore(e),n=this;for(;r;){let i=r.lastChild;if(!i||i.to!=r.to)break;i.type.isError&&i.from==i.to?(n=r,r=i.prevSibling):r=i}return n}get node(){return this}get next(){return this.parent}}class Gt extends Cd{constructor(e,r,n,i){super(),this._tree=e,this.from=r,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,r,n,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=r>0?a.length:-1;e!=c;e+=r){let u=a[e],h=l[e]+o.from;if(Ad(i,n,h,h+u.length)){if(u instanceof Hn){if(s&ot.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,r,n-h,i);if(d>-1)return new qr(new MS(o,u,e,h),null,d)}else if(s&ot.IncludeAnonymous||!u.type.isAnonymous||vc(u)){let d;if(!(s&ot.IgnoreMounts)&&(d=Vs.get(u))&&!d.overlay)return new Gt(d.tree,h,e,o);let p=new Gt(u,h,e,o);return s&ot.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(r<0?u.children.length-1:0,r,n,i)}}}if(s&ot.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+r:e=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,r,n=0){let i;if(!(n&ot.IgnoreOverlays)&&(i=Vs.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((r>0?o<=s:o<s)&&(r<0?a>=s:a>s))return new Gt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,r,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Od(t,e,r,n){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(r!=null){for(;!i.type.is(r);)if(!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function mc(t,e,r=e.length-1){for(let n=t.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}class MS{constructor(e,r,n,i){this.parent=e,this.buffer=r,this.index=n,this.start=i}}class qr extends Cd{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,r,n){super(),this.context=e,this._parent=r,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,r,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.context.start,n);return s<0?null:new qr(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,r,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],r>0?1:-1,e-this.context.start,r);return s<0?null:new qr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,r=e.buffer[this.index+3];return r<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new qr(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new qr(this.context,this._parent,e.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],r=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),r.push(0)}return new ut(this.type,e,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Ed(t){if(!t.length)return null;let e=0,r=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>r.from||o.to<r.to)&&(r=o,e=s)}let n=r instanceof Gt&&r.index<0?null:r.parent,i=t.slice();return n?i[e]=n:i.splice(e,1),new IS(i,r)}class IS{constructor(e,r){this.heads=e,this.node=r}get next(){return Ed(this.heads)}}function DS(t,e,r){let n=t.resolveInner(e,r),i=null;for(let s=n instanceof Gt?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,r)),s=o}else{let o=Vs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Gt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[n])).push(Ws(a,e,r,!1))}}return i?Ed(i):n}class la{get name(){return this.type.name}constructor(e,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Gt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,r){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=r||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof Gt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,r,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,r-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,r,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(r.findChild(i,this.index,-1,0,4))}else{let i=r.buffer[this.index+3];if(i<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let r,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:r,parent:n}=i)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let s=r+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&ot.IncludeAnonymous||a instanceof Hn||!a.type.isAnonymous||vc(a))return!1}return!0}move(e,r){if(r&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,r=0){for(;(this.from==this.to||(r<1?this.from>=e:this.from>e)||(r>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,r););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,r=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;r=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)r=new qr(this.buffer,r,this.stack[i]);return this.bufferNode=new qr(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,r){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&r&&r(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return mc(this.node,e);let{buffer:r}=this.buffer,{types:n}=r.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return mc(this.node,e,i);let o=n[r.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function vc(t){return t.children.some(e=>e instanceof Hn||!e.type.isAnonymous||vc(e))}function NS(t){var e;let{buffer:r,nodeSet:n,maxBufferLength:i=Sd,reused:s=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(r)?new gc(r,r.length):r,l=n.types,c=0,u=0;function h(I,W,F,_,j,U){let{id:Y,start:re,end:ce,size:he}=a,xe=u;for(;he<0;)if(a.next(),he==-1){let Ie=s[Y];F.push(Ie),_.push(re-I);return}else if(he==-3){c=Y;return}else if(he==-4){u=Y;return}else throw new RangeError(`Unrecognized record size: ${he}`);let Fe=l[Y],we,Ee,Ue=re-I;if(ce-re<=i&&(Ee=w(a.pos-W,j))){let Ie=new Uint16Array(Ee.size-Ee.skip),nt=a.pos-Ee.size,dt=Ie.length;for(;a.pos>nt;)dt=A(Ee.start,Ie,dt);we=new Hn(Ie,ce-Ee.start,n),Ue=Ee.start-I}else{let Ie=a.pos-he;a.next();let nt=[],dt=[],Bt=Y>=o?Y:-1,er=0,Tr=ce;for(;a.pos>Ie;)Bt>=0&&a.id==Bt&&a.size>=0?(a.end<=Tr-i&&(m(nt,dt,re,er,a.end,Tr,Bt,xe),er=nt.length,Tr=a.end),a.next()):U>2500?d(re,Ie,nt,dt):h(re,Ie,nt,dt,Bt,U+1);if(Bt>=0&&er>0&&er<nt.length&&m(nt,dt,re,er,re,Tr,Bt,xe),nt.reverse(),dt.reverse(),Bt>-1&&er>0){let Ct=p(Fe);we=yc(Fe,nt,dt,0,nt.length,0,ce-re,Ct,Ct)}else we=y(Fe,nt,dt,ce-re,xe-ce)}F.push(we),_.push(Ue)}function d(I,W,F,_){let j=[],U=0,Y=-1;for(;a.pos>W;){let{id:re,start:ce,end:he,size:xe}=a;if(xe>4)a.next();else{if(Y>-1&&ce<Y)break;Y<0&&(Y=he-i),j.push(re,ce,he),U++,a.next()}}if(U){let re=new Uint16Array(U*4),ce=j[j.length-2];for(let he=j.length-3,xe=0;he>=0;he-=3)re[xe++]=j[he],re[xe++]=j[he+1]-ce,re[xe++]=j[he+2]-ce,re[xe++]=xe;F.push(new Hn(re,j[2]-ce,n)),_.push(ce-I)}}function p(I){return(W,F,_)=>{let j=0,U=W.length-1,Y,re;if(U>=0&&(Y=W[U])instanceof ut){if(!U&&Y.type==I&&Y.length==_)return Y;(re=Y.prop(Re.lookAhead))&&(j=F[U]+Y.length+re)}return y(I,W,F,_,j)}}function m(I,W,F,_,j,U,Y,re){let ce=[],he=[];for(;I.length>_;)ce.push(I.pop()),he.push(W.pop()+F-j);I.push(y(n.types[Y],ce,he,U-j,re-U)),W.push(j-F)}function y(I,W,F,_,j=0,U){if(c){let Y=[Re.contextHash,c];U=U?[Y].concat(U):[Y]}if(j>25){let Y=[Re.lookAhead,j];U=U?[Y].concat(U):[Y]}return new ut(I,W,F,_,U)}function w(I,W){let F=a.fork(),_=0,j=0,U=0,Y=F.end-i,re={size:0,start:0,skip:0};e:for(let ce=F.pos-I;F.pos>ce;){let he=F.size;if(F.id==W&&he>=0){re.size=_,re.start=j,re.skip=U,U+=4,_+=4,F.next();continue}let xe=F.pos-he;if(he<0||xe<ce||F.start<Y)break;let Fe=F.id>=o?4:0,we=F.start;for(F.next();F.pos>xe;){if(F.size<0)if(F.size==-3)Fe+=4;else break e;else F.id>=o&&(Fe+=4);F.next()}j=we,_+=he,U+=Fe}return(W<0||_==I)&&(re.size=_,re.start=j,re.skip=U),re.size>4?re:void 0}function A(I,W,F){let{id:_,start:j,end:U,size:Y}=a;if(a.next(),Y>=0&&_<o){let re=F;if(Y>4){let ce=a.pos-(Y-4);for(;a.pos>ce;)F=A(I,W,F)}W[--F]=re,W[--F]=U-I,W[--F]=j-I,W[--F]=_}else Y==-3?c=_:Y==-4&&(u=_);return F}let T=[],E=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,T,E,-1,0);let B=(e=t.length)!==null&&e!==void 0?e:T.length?E[0]+T[0].length:0;return new ut(l[t.topID],T.reverse(),E.reverse(),B)}const Td=new WeakMap;function ca(t,e){if(!t.isAnonymous||e instanceof Hn||e.type!=t)return 1;let r=Td.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=t||!(n instanceof ut)){r=1;break}r+=ca(t,n)}Td.set(e,r)}return r}function yc(t,e,r,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=ca(t,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let E=w;E<A;){let B=E,I=y[E],W=ca(t,m[E]);for(E++;E<A;E++){let F=ca(t,m[E]);if(W+F>=u)break;W+=F}if(E==B+1){if(W>u){let F=m[B];p(F.children,F.positions,0,F.children.length,y[B]+T);continue}h.push(m[B])}else{let F=y[E-1]+m[E-1].length-I;h.push(yc(t,m,y,B,E,I,F,null,l))}d.push(I+T-s)}}return p(e,r,n,i,0),(a||l)(h,d,o)}class XI{constructor(){this.map=new WeakMap}setBuffer(e,r,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(r,n)}getBuffer(e,r){let n=this.map.get(e);return n&&n.get(r)}set(e,r){e instanceof qr?this.setBuffer(e.context.buffer,e.index,r):e instanceof Gt&&this.map.set(e.tree,r)}get(e){return e instanceof qr?this.getBuffer(e.context.buffer,e.index):e instanceof Gt?this.map.get(e.tree):void 0}cursorSet(e,r){e.buffer?this.setBuffer(e.buffer.buffer,e.index,r):this.map.set(e.tree,r)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class An{constructor(e,r,n,i,s=!1,o=!1){this.from=e,this.to=r,this.tree=n,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,r=[],n=!1){let i=[new An(0,e.length,e,0,!1,n)];for(let s of r)s.to>e.length&&i.push(s);return i}static applyChanges(e,r,n=128){if(!r.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<r.length?r[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,h)-c;d=p>=m?null:new An(p,m,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class Pd{startParse(e,r,n){return typeof e=="string"&&(e=new RS(e)),n=n?n.length?n.map(i=>new Rr(i.from,i.to)):[new Rr(0,0)]:[new Rr(0,e.length)],this.createParse(e,r||[],n)}parse(e,r,n){let i=this.startParse(e,r,n);for(;;){let s=i.advance();if(s)return s}}}class RS{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,r){return this.string.slice(e,r)}}function ZI(t){return(e,r,n,i)=>new BS(e,t,r,n,i)}class Md{constructor(e,r,n,i,s){this.parser=e,this.parse=r,this.overlay=n,this.target=i,this.from=s}}function Id(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class LS{constructor(e,r,n,i,s,o,a){this.parser=e,this.predicate=r,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const bc=new Re({perNode:!0});class BS{constructor(e,r,n,i,s){this.nest=r,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new ut(n.type,n.children,n.positions,n.length,n.propValues.concat([[bc,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],r=e.parse.advance();if(r){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Re.mounted.id]=new Vs(r,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].from<e&&(e=Math.min(e,this.inner[r].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(e)}startInner(){let e=new VS(this.fragments),r=null,n=null,i=new la(new Gt(this.baseTree,this.ranges[0].from,0,null),ot.IncludeAnonymous|ot.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(r){let c=r.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!r.ranges.some(p=>p.from<d&&p.to>h)&&r.ranges.push({from:h,to:d})}}a=!1}else if(n&&(o=FS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||jS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")r=new LS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,r);else{let u=Rd(this.ranges,s.overlay||(i.from<i.to?[new Rr(i.from,i.to)]:[]));u.length&&Id(u),(u.length||!s.overlay)&&this.inner.push(new Md(s.parser,u.length?s.parser.startParse(this.input,Ld(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new Rr(h.from-i.from,h.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else r&&(l=r.predicate(i))&&(l===!0&&(l=new Rr(i.from,i.to)),l.from<l.to&&r.ranges.push(l));if(a&&i.firstChild())r&&r.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(r&&!--r.depth){let c=Rd(this.ranges,r.ranges);c.length&&(Id(c),this.inner.splice(r.index,0,new Md(r.parser,r.parser.startParse(this.input,Ld(r.mounts,c),c),r.ranges.map(u=>new Rr(u.from-r.start,u.to-r.start)),r.target,c[0].from))),r=r.prev}n&&!--n.depth&&(n=n.prev)}}}}function FS(t,e,r){for(let n of t){if(n.from>=r)break;if(n.to>e)return n.from<=e&&n.to>=r?2:1}return 0}function Dd(t,e,r,n,i,s){if(e<r){let o=t.buffer[e+1];n.push(t.slice(e,r,o)),i.push(o-s)}}function jS(t){let{node:e}=t,r=[];do r.push(t.index),t.parent();while(!t.tree);let n=0,i=t.tree,s=0;for(;s=i.positions[n]+t.from,!(s<=e.from&&s+i.children[n].length>=e.to);n++);let o=i.children[n],a=o.buffer,l=[n];function c(u,h,d,p,m,y){let w=r[y],A=[],T=[];Dd(o,u,w,A,T,p);let E=a[w+1],B=a[w+2];l.push(A.length);let I=y?c(w+4,a[w+3],o.set.types[a[w]],E,B-E,y-1):e.toTree();return A.push(I),T.push(E-p),Dd(o,a[w+3],h,A,T,p),new ut(d,A,T,m)}i.children[n]=c(0,a.length,nr.none,0,o.length,r.length-1);for(let u of l){let h=t.tree.children[u],d=t.tree.positions[u];t.yield(new Gt(h,d+t.from,u,t._tree))}}class Nd{constructor(e,r){this.offset=r,this.done=!1,this.cursor=e.cursor(ot.IncludeAnonymous|ot.IgnoreMounts)}moveTo(e){let{cursor:r}=this,n=e-this.offset;for(;!this.done&&r.from<n;)r.to>=e&&r.enter(n,1,ot.IgnoreOverlays|ot.ExcludeBuffers)||r.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let r=this.cursor.tree;;){if(r==e.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof ut)r=r.children[0];else break}return!1}}class VS{constructor(e){var r;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(r=n.tree.prop(bc))!==null&&r!==void 0?r:n.to,this.inner=new Nd(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let r=this.curFrag=this.fragments[this.fragI];this.curTo=(e=r.tree.prop(bc))!==null&&e!==void 0?e:r.to,this.inner=new Nd(r.tree,-r.offset)}}findMounts(e,r){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Re.mounted);if(o&&o.parser==r)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function Rd(t,e){let r=null,n=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<n.length;s++){let l=n[s];if(l.from>=a)break;l.to<=o||(r||(n=r=e.slice()),l.from<o?(r[s]=new Rr(l.from,o),l.to>a&&r.splice(s+1,0,new Rr(a,l.to))):l.to>a?r[s--]=new Rr(a,l.to):r.splice(s--,1))}}return n}function WS(t,e,r,n){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,r),p=Math.min(u,h,n);d<p&&c.push(new Rr(d,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function Ld(t,e){let r=[];for(let{pos:n,mount:i,frag:s}of t){let o=n+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new Rr(d.from+n,d.to+n)),h=WS(e,u,l,c);for(let d=0,p=l;;d++){let m=d==h.length,y=m?c:h[d].from;if(y>p&&r.push(new An(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),m)break;p=h[d].to}}else r.push(new An(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return r}class ua{constructor(e,r,n,i,s,o,a,l,c,u=0,h){this.p=e,this.stack=r,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new ua(e,[],r,n,n,0,[],0,i?new Bd(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,d,h+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,r,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(r==n)return;if(o.buffer[a-2]>=r){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,r,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=r,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||r<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(r,n),r<=o.maxNode&&this.buffer.push(r,n,i,4)}}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(r,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new ua(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new $S(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if(!(n&65536))return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>4<<1||this.stack.length>=120){let i=[];for(let s=0,o;s<r.length;s+=2)(o=r[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(r[s],o);if(this.stack.length<120)for(let s=0;i.length<4<<1&&s<r.length;s+=2){let o=r[s+1];i.some((a,l)=>l&1&&a==o)||i.push(r[s],o)}r=i}let n=[];for(let i=0;i<r.length&&n.length<4;i+=2){let s=r[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(r[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,r=e.stateSlot(this.state,5);if(!(r&65536))return!1;if(!e.validAction(this.state,r)){let n=r>>19,i=r&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;r=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,s)=>{if(!r.includes(i))return r.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=n(o,s+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=e.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(r)))}reduceContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(r)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let r=new Bd(this.curContext.tracker,e);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}class $S{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}}class fa{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new fa(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new fa(this.stack,this.pos,this.index)}}function $s(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n<t.length;){let s=0;for(;;){let o=t.charCodeAt(n++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}r?r[i++]=s:r=new e(s)}return r}class ha{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Fd=new ha;class HS{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Fd,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;r<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let r of this.ranges)if(r.to>e)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(r);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),r=this.pos+e.length;this.chunk=r>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=Fd,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,r){if(e>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}}class Yi{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;jd(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class zS{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?$s(e):e}token(e,r){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(jd(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}zS.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class _I{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function jd(t,e,r,n,i,s){let o=0,a=1<<n,{dialect:l}=r.p.parser;e:for(;a&t[o];){let c=t[o+1];for(let p=o+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||US(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,h=0,d=t[o+2];if(e.next<0&&d>h&&t[c+d*3-3]==65535){o=t[c+d*3-1];continue e}for(;h<d;){let p=h+d>>1,m=c+p+(p<<1),y=t[m],w=t[m+1]||65536;if(u<y)d=p;else if(u>=w)h=p+1;else{o=t[m+2],e.advance();continue e}}break}}function Vd(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function US(t,e,r,n){let i=Vd(r,n,e);return i<0||Vd(r,n,t)<i}const vr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let xc=null;function Wd(t,e,r){let n=t.cursor(ot.IncludeAnonymous);for(n.moveTo(e);;)if(!(r<0?n.childBefore(e):n.childAfter(e)))for(;;){if((r<0?n.to<e:n.from>e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}class GS{constructor(e,r){this.fragments=e,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Wd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Wd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let n=this.trees[r],i=this.index[r];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[r]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ut){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Re.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[r]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+s.length}}}class KS{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new ha)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if(!(1<<c&o))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let d=r;if(h.extended>-1&&(r=this.addActions(e,h.extended,h.end,r)),r=this.addActions(e,h.value,h.end,r),!u.extend&&(n=h,r>d))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new ha,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new ha,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=r,this.actions[i++]=n,i}addActions(e,r,n,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Cn(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Cn(a,c+2),r,n,i));break}a[c]==r&&(i=this.putAction(Cn(a,c+1),r,n,i))}return i}}class YS{constructor(e,r,n,i){this.parser=e,this.input=r,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new HS(r,i),this.tokens=new KS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ua.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new GS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>r)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let o=i&&QS(i);if(o)return vr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw vr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(o)return vr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,r,n){let i=e.pos,{parser:s}=this,o=vr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!c||(h.prop(Re.contextHash)||0)==u))return e.useNode(h,d),vr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ut)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ut&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),vr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],d=l[c++],p=c==l.length||!n,m=p?e:e.split(),y=this.tokens.mainToken;if(m.apply(u,h,y?y.start:m.pos,d),vr&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?r.push(m):n.push(m)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return $d(e,r),!0}}runRecovery(e,r,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=r[o<<1],c=r[(o<<1)+1],u=vr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),vr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),d=u;for(let p=0;h.forceReduce()&&p<10&&(vr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)vr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))vr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),vr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),$d(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ut.build({buffer:fa.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let r=(xc||(xc=new WeakMap)).get(e);return r||xc.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}}function $d(t,e){for(let r=0;r<e.length;r++){let n=e[r];if(n.pos==t.pos&&n.sameState(t)){e[r].score<t.score&&(e[r]=t);return}}e.push(t)}class JS{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const wc=t=>t;class qI{constructor(e){this.start=e.start,this.shift=e.shift||wc,this.reduce=e.reduce||wc,this.reuse=e.reuse||wc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class da extends Pd{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let a=0;a<e.repeatNodeCount;a++)r.push("");let n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<r.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Re[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let h=a[c+-u];for(let d=-u;d>0;d--)s(a[c++],l,h);c++}}}this.nodeSet=new oa(r.map((a,l)=>nr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Sd;let o=$s(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(Hd),this.states=$s(e.states,Uint32Array),this.data=$s(e.stateData),this.goto=$s(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Yi(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new YS(this,e,r,n);for(let s of this.wrappers)i=s(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let s=i[r+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&n)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,r){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=Cn(n,s+2)];else{if(n[s+1]==2)return Cn(n,s+2);break}if(o==r||o==0)return Cn(n,s+1)}return 0}stateSlot(e,r){return this.states[e*6+r]}stateFlag(e,r){return(this.stateSlot(e,0)&r)>0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Cn(this.data,s+2);else break;i=r(Cn(this.data,s+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Cn(this.data,n+2);else break;if(!(this.data[n+2]&1)){let i=this.data[n+1];r.some((s,o)=>o&1&&s==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(da.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return r.specializers[i]=Hd(o),o})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let s of e.split(" ")){let o=r.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<r.length;s++)if(!n[s])for(let o=this.dialects[r[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new JS(e,n,i)}static deserialize(e){return new da(e)}}function Cn(t,e){return t[e]|t[e+1]<<16}function QS(t){let e=null;for(let r of t){let n=r.p.stoppedAt;(r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.score<r.score)&&(e=r)}return e}function Hd(t){if(t.external){let e=t.extend?1:0;return(r,n)=>t.external(r,n)<<1|e}return t.get}let XS=0;class en{constructor(e,r,n){this.set=e,this.base=r,this.modified=n,this.id=XS++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let r=new en([],null,[]);if(r.set.push(r),e)for(let n of e.set)r.set.push(n);return r}static defineModifier(){let e=new pa;return r=>r.modified.indexOf(e)>-1?r:pa.get(r.base||r,r.modified.concat(e).sort((n,i)=>n.id-i.id))}}let ZS=0;class pa{constructor(){this.instances=[],this.id=ZS++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(a=>a.base==e&&_S(r,a.modified));if(n)return n;let i=[],s=new en(i,e,r);for(let a of r)a.instances.push(s);let o=qS(r);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(pa.get(a,l));return s}}function _S(t,e){return t.length==e.length&&t.every((r,n)=>r==e[n])}function qS(t){let e=[[]];for(let r=0;r<t.length;r++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(t[r]));return e.sort((r,n)=>n.length-r.length)}function zd(t){let e=Object.create(null);for(let r in t){let n=t[r];Array.isArray(n)||(n=[n]);for(let i of r.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new ga(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Ud.add(e)}const Ud=new Re;class ga{constructor(e,r,n,i){this.tags=e,this.mode=r,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ga.empty=new ga([],2,null);function Gd(t,e){let r=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))r[s.tag.id]=s.class;else for(let o of s.tag)r[o.id]=s.class;let{scope:n,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=r[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:n}}function ek(t,e){let r=null;for(let n of t){let i=n.style(e);i&&(r=r?r+" "+i:i)}return r}function Kd(t,e,r,n=0,i=t.length){let s=new tk(n,Array.isArray(e)?e:[e],r);s.highlightRange(t.cursor(),n,i,"",s.highlighters),s.flush(i)}function eD(t,e,r,n,i,s=0,o=t.length){let a=s;function l(c,u){if(!(c<=a)){for(let h=t.slice(a,c),d=0;;){let p=h.indexOf(`
|
|
141
|
+
`,d),m=p<0?h.length:p;if(m>d&&n(h.slice(d,m),u),p<0)break;i(),d=p+1}a=c}}Kd(e,r,(c,u,h)=>{l(c,""),l(u,h)},s,o),l(o,"")}class tk{constructor(e,r,n){this.at=e,this.highlighters=r,this.span=n,this.class=""}startSpan(e,r){r!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=r)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,r,n,i,s){let{type:o,from:a,to:l}=e;if(a>=n||l<=r)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=rk(e)||ga.empty,h=ek(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(r,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Re.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),y=e.firstChild();for(let w=0,A=a;;w++){let T=w<d.overlay.length?d.overlay[w]:null,E=T?T.from+a:l,B=Math.max(r,A),I=Math.min(n,E);if(B<I&&y)for(;e.from<I&&(this.highlightRange(e,B,I,i,s),this.startSpan(Math.min(I,e.to),c),!(e.to>=E||!e.nextSibling())););if(!T||E>n)break;A=T.to+a,A>r&&(this.highlightRange(p.cursor(),Math.max(r,T.from+a),Math.min(n,A),"",m),this.startSpan(Math.min(n,A),c))}y&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=r)){if(e.from>=n)break;this.highlightRange(e,r,n,i,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function rk(t){let e=t.type.prop(Ud);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const fe=en.define,ma=fe(),zn=fe(),Yd=fe(zn),Jd=fe(zn),Un=fe(),va=fe(Un),Sc=fe(Un),tn=fe(),vi=fe(tn),rn=fe(),nn=fe(),kc=fe(),Hs=fe(kc),ya=fe(),M={comment:ma,lineComment:fe(ma),blockComment:fe(ma),docComment:fe(ma),name:zn,variableName:fe(zn),typeName:Yd,tagName:fe(Yd),propertyName:Jd,attributeName:fe(Jd),className:fe(zn),labelName:fe(zn),namespace:fe(zn),macroName:fe(zn),literal:Un,string:va,docString:fe(va),character:fe(va),attributeValue:fe(va),number:Sc,integer:fe(Sc),float:fe(Sc),bool:fe(Un),regexp:fe(Un),escape:fe(Un),color:fe(Un),url:fe(Un),keyword:rn,self:fe(rn),null:fe(rn),atom:fe(rn),unit:fe(rn),modifier:fe(rn),operatorKeyword:fe(rn),controlKeyword:fe(rn),definitionKeyword:fe(rn),moduleKeyword:fe(rn),operator:nn,derefOperator:fe(nn),arithmeticOperator:fe(nn),logicOperator:fe(nn),bitwiseOperator:fe(nn),compareOperator:fe(nn),updateOperator:fe(nn),definitionOperator:fe(nn),typeOperator:fe(nn),controlOperator:fe(nn),punctuation:kc,separator:fe(kc),bracket:Hs,angleBracket:fe(Hs),squareBracket:fe(Hs),paren:fe(Hs),brace:fe(Hs),content:tn,heading:vi,heading1:fe(vi),heading2:fe(vi),heading3:fe(vi),heading4:fe(vi),heading5:fe(vi),heading6:fe(vi),contentSeparator:fe(tn),list:fe(tn),quote:fe(tn),emphasis:fe(tn),strong:fe(tn),link:fe(tn),monospace:fe(tn),strikethrough:fe(tn),inserted:fe(),deleted:fe(),changed:fe(),invalid:fe(),meta:ya,documentMeta:fe(ya),annotation:fe(ya),processingInstruction:fe(ya),definition:en.defineModifier(),constant:en.defineModifier(),function:en.defineModifier(),standard:en.defineModifier(),local:en.defineModifier(),special:en.defineModifier()},tD=Gd([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]),nk=zd({String:M.string,Number:M.number,"True False":M.bool,PropertyName:M.propertyName,Null:M.null,",":M.separator,"[ ]":M.squareBracket,"{ }":M.brace}),ik=da.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:[nk],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,r,n){let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(r,this.length,i,1),sn.from(i,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){let n=[];return this.decompose(e,r,n,0),sn.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new zs(this),s=new zs(e);for(let o=r,a=r;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}iter(e=1){return new zs(this,e)}iterRange(e,r=this.length){return new Xd(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new Zd(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new yt(e):sn.from(yt.split(e,[]))}}class yt extends Je{constructor(e,r=sk(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((r?n:a)>=e)return new ok(i,a,n,o);i=a+1,n++}}decompose(e,r,n,i){let s=e<=0&&r>=this.length?this:new yt(Qd(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),a=ba(s.text,o.text.slice(),0,s.length);if(a.length<=32)n.push(new yt(a,o.length+s.length));else{let l=a.length>>1;n.push(new yt(a.slice(0,l)),new yt(a.slice(l)))}}else n.push(s)}replace(e,r,n){if(!(n instanceof yt))return super.replace(e,r,n);let i=ba(this.text,ba(n.text,Qd(this.text,0,e)),r),s=this.length+n.length-(r-e);return i.length<=32?new yt(i,s):sn.from(yt.split(i,[]),s)}sliceString(e,r=this.length,n=`
|
|
142
|
+
`){let i="";for(let s=0,o=0;s<=r&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=n),e<l&&r>s&&(i+=a.slice(Math.max(0,e-s),r-s)),s=l+1}return i}flatten(e){for(let r of this.text)e.push(r)}scanIdentical(){return 0}static split(e,r){let n=[],i=-1;for(let s of e)n.push(s),i+=s.length+1,n.length==32&&(r.push(new yt(n,i)),n=[],i=-1);return i>-1&&r.push(new yt(n,i)),r}}class sn extends Je{constructor(e,r){super(),this.children=e,this.length=r,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,r,n,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=n+o.lines-1;if((r?l:a)>=e)return o.lineInner(e,r,n,i);i=a+1,n=l+1}}decompose(e,r,n,i){for(let s=0,o=0;o<=r&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&r>=o){let c=i&((o<=e?1:0)|(l>=r?2:0));o>=e&&l<=r&&!c?n.push(a):a.decompose(e-o,r-o,n,c)}o=l+1}}replace(e,r,n){if(n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&r<=a){let l=o.replace(e-s,r-s,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>5-1&&l.lines>c>>5+1){let u=this.children.slice();return u[i]=l,new sn(u,this.length-(r-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,r,n)}sliceString(e,r=this.length,n=`
|
|
143
|
+
`){let i="";for(let s=0,o=0;s<this.children.length&&o<=r;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=n),e<l&&r>o&&(i+=a.sliceString(e-o,r-o,n)),o=l+1}return i}flatten(e){for(let r of this.children)r.flatten(e)}scanIdentical(e,r){if(!(e instanceof sn))return 0;let n=0,[i,s,o,a]=r>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=r,s+=r){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,r);n+=l.length+1}}static from(e,r=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let p of e)n+=p.lines;if(n<32){let p=[];for(let m of e)m.flatten(p);return new yt(p,r)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function h(p){let m;if(p.lines>s&&p instanceof sn)for(let y of p.children)h(y);else p.lines>o&&(l>o||!l)?(d(),a.push(p)):p instanceof yt&&l&&(m=u[u.length-1])instanceof yt&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new yt(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&d(),l+=p.lines,c+=p.length+1,u.push(p))}function d(){l!=0&&(a.push(u.length==1?u[0]:sn.from(u,c)),c=-1,l=u.length=0)}for(let p of e)h(p);return d(),a.length==1?a[0]:new sn(a,r)}}Je.empty=new yt([""],0);function sk(t){let e=-1;for(let r of t)e+=r.length+1;return e}function ba(t,e,r=0,n=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=n;s++){let a=t[s],l=i+a.length;l>=r&&(l>n&&(a=a.slice(0,n-i)),i<r&&(a=a.slice(r-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function Qd(t,e,r){return ba(t,[""],e,r)}class zs{constructor(e,r=1){this.dir=r,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[r>0?1:(e instanceof yt?e.text.length:e.children.length)<<1]}nextInner(e,r){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],o=s>>1,a=i instanceof yt?i.text.length:i.children.length;if(o==(r>0?a:0)){if(n==0)return this.done=!0,this.value="",this;r>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(r>0?0:1)){if(this.offsets[n]+=r,e==0)return this.lineBreak=!0,this.value=`
|
|
144
|
+
`,this;e--}else if(i instanceof yt){let l=i.text[o+(r<0?-1:0)];if(this.offsets[n]+=r,l.length>Math.max(0,e))return this.value=e==0?l:r>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(r<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=r):(r<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(r>0?1:(l instanceof yt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Xd{constructor(e,r,n){this.value="",this.done=!1,this.cursor=new zs(e,r>n?-1:1),this.pos=r>n?e.length:0,this.from=Math.min(r,n),this.to=Math.max(r,n)}nextInner(e,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let n=r<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*r,this.value=i.length<=n?i:r<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Zd{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:r,lineBreak:n,value:i}=this.inner.next(e);return r?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this.iter()},zs.prototype[Symbol.iterator]=Xd.prototype[Symbol.iterator]=Zd.prototype[Symbol.iterator]=function(){return this});class ok{constructor(e,r,n,i){this.from=e,this.to=r,this.number=n,this.text=i}get length(){return this.to-this.from}}let Ji="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;t<Ji.length;t++)Ji[t]+=Ji[t-1];function ak(t){for(let e=1;e<Ji.length;e+=2)if(Ji[e]>t)return Ji[e-1]<=t;return!1}function _d(t){return t>=127462&&t<=127487}const qd=8205;function Kt(t,e,r=!0,n=!0){return(r?ep:lk)(t,e,n)}function ep(t,e,r){if(e==t.length)return e;e&&tp(t.charCodeAt(e))&&rp(t.charCodeAt(e-1))&&e--;let n=Ft(t,e);for(e+=Lr(n);e<t.length;){let i=Ft(t,e);if(n==qd||i==qd||r&&ak(i))e+=Lr(i),n=i;else if(_d(i)){let s=0,o=e-2;for(;o>=0&&_d(Ft(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function lk(t,e,r){for(;e>0;){let n=ep(t,e-2,r);if(n<e)return n;e--}return 0}function tp(t){return t>=56320&&t<57344}function rp(t){return t>=55296&&t<56320}function Ft(t,e){let r=t.charCodeAt(e);if(!rp(r)||e+1==t.length)return r;let n=t.charCodeAt(e+1);return tp(n)?(r-55296<<10)+(n-56320)+65536:r}function Ac(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Lr(t){return t<65536?1:2}const Cc=/\r\n?|\n/;var ir=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ir||(ir={}));class on{constructor(e){this.sections=e}get length(){let e=0;for(let r=0;r<this.sections.length;r+=2)e+=this.sections[r];return e}get newLength(){let e=0;for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r+1];e+=n<0?this.sections[r]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let r=0,n=0,i=0;r<this.sections.length;){let s=this.sections[r++],o=this.sections[r++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,r=!1){Oc(this,e,r)}get invertedDesc(){let e=[];for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];i<0?e.push(n,i):e.push(i,n)}return new on(e)}composeDesc(e){return this.empty?e:e.empty?this:np(this,e)}mapDesc(e,r=!1){return e.empty?this:Ec(this,e,r)}mapPos(e,r=-1,n=ir.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=ir.Simple&&c>=e&&(n==ir.TrackDel&&i<e&&c>e||n==ir.TrackBefore&&i<e||n==ir.TrackAfter&&c>e))return null;if(c>e||c==e&&r<0&&!a)return e==i||r<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,r=e){for(let n=0,i=0;n<this.sections.length&&i<=r;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=r&&a>=e)return i<e&&a>r?"cover":!0;i=a}return!1}toString(){let e="";for(let r=0;r<this.sections.length;){let n=this.sections[r++],i=this.sections[r++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new on(e)}static create(e){return new on(e)}}class Pt extends on{constructor(e,r){super(e),this.inserted=r}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Oc(this,(r,n,i,s,o)=>e=e.replace(i,i+(n-r),o),!1),e}mapDesc(e,r=!1){return Ec(this,e,r,!0)}invert(e){let r=this.sections.slice(),n=[];for(let i=0,s=0;i<r.length;i+=2){let o=r[i],a=r[i+1];if(a>=0){r[i]=a,r[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Je.empty);n.push(o?e.slice(s,s+o):Je.empty)}s+=o}return new Pt(r,n)}compose(e){return this.empty?e:e.empty?this:np(this,e,!0)}map(e,r=!1){return e.empty?this:Ec(this,e,r,!0)}iterChanges(e,r=!1){Oc(this,e,r)}get desc(){return on.create(this.sections)}filter(e){let r=[],n=[],i=[],s=new Us(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);Yt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Yt(r,u,h),h>0&&Gn(n,r,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Yt(r,u,-1),Yt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Pt(r,n),filtered:on.create(i)}}toJSON(){let e=[];for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r],i=this.sections[r+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[r>>1].toJSON()))}return e}static of(e,r,n){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<r&&Yt(i,r-o,-1);let h=new Pt(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Pt){if(u.length!=r)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${r})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:p}=u;if(h>d||h<0||d>r)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${r})`);let m=p?typeof p=="string"?Je.of(p.split(n||Cc)):p:Je.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Yt(i,h-o,-1),Yt(i,d-h,y),Gn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Pt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")r.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)r.push(s[0],0);else{for(;n.length<i;)n.push(Je.empty);n[i]=Je.of(s.slice(1)),r.push(s[0],n[i].length)}}}return new Pt(r,n)}static createSet(e,r){return new Pt(e,r)}}function Yt(t,e,r,n=!1){if(e==0&&r<=0)return;let i=t.length-2;i>=0&&r<=0&&r==t[i+1]?t[i]+=e:e==0&&t[i]==0?t[i+1]+=r:n?(t[i]+=e,t[i+1]+=r):t.push(e,r)}function Gn(t,e,r){if(r.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(r);else{for(;t.length<n;)t.push(Je.empty);t.push(r)}}function Oc(t,e,r){let n=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Je.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(r||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function Ec(t,e,r,n=!1){let i=[],s=n?[]:null,o=new Us(t),a=new Us(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Yt(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!r))){let c=a.len;for(Yt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Yt(i,0,o.ins),s&&Gn(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Yt(i,c,l<o.i?o.ins:0),s&&l<o.i&&Gn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Pt.createSet(i,s):on.create(i);throw new Error("Mismatched change set lengths")}}function np(t,e,r=!1){let n=[],i=r?[]:null,s=new Us(t),o=new Us(e);for(let a=!1;;){if(s.done&&o.done)return i?Pt.createSet(n,i):on.create(n);if(s.ins==0)Yt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Yt(n,0,o.ins,a),i&&Gn(i,n,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Yt(n,l,u,a),i&&u&&Gn(i,n,o.text)}else o.ins==-1?(Yt(n,s.off?0:s.len,l,a),i&&Gn(i,n,s.textBit(l))):(Yt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&Gn(i,n,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),s.forward2(l),o.forward(l)}}}}class Us{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length?Je.empty:e[r]}textBit(e){let{inserted:r}=this.set,n=this.i-2>>1;return n>=r.length&&!e?Je.empty:r[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yi{constructor(e,r,n){this.from=e,this.to=r,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,r=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new yi(n,i,this.flags)}extend(e,r=e){if(e<=this.anchor&&r>=this.anchor)return se.range(e,r);let n=Math.abs(e-this.anchor)>Math.abs(r-this.anchor)?e:r;return se.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return se.range(e.anchor,e.head)}static create(e,r,n){return new yi(e,r,n)}}class se{constructor(e,r){this.ranges=e,this.mainIndex=r}map(e,r=-1){return e.empty?this:se.create(this.ranges.map(n=>n.map(e,r)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new se([this.main],0)}addRange(e,r=!0){return se.create([e].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(e,r=this.mainIndex){let n=this.ranges.slice();return n[r]=e,se.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new se(e.ranges.map(r=>yi.fromJSON(r)),e.main)}static single(e,r=e){return new se([se.range(e,r)],0)}static create(e,r=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return se.normalized(e.slice(),r);n=s.to}return new se(e,r)}static cursor(e,r=0,n,i){return yi.create(e,e,(r==0?0:r<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,r,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return r<e?yi.create(r,e,48|s):yi.create(e,r,(r>e?8:0)|s)}static normalized(e,r=0){let n=e[r];e.sort((i,s)=>i.from-s.from),r=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=r&&r--,e.splice(--i,2,s.anchor>s.head?se.range(l,a):se.range(a,l))}}return new se(e,r)}}function ip(t,e){for(let r of t.ranges)if(r.to>e)throw new RangeError("Selection points outside of document")}let Tc=0;class pe{constructor(e,r,n,i,s){this.combine=e,this.compareInput=r,this.compare=n,this.isStatic=i,this.id=Tc++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new pe(e.combine||(r=>r),e.compareInput||((r,n)=>r===n),e.compare||(e.combine?(r,n)=>r===n:Pc),!!e.static,e.enables)}of(e){return new xa([],this,0,e)}compute(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new xa(e,this,1,r)}computeN(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new xa(e,this,2,r)}from(e,r){return r||(r=n=>n),this.compute([e],n=>r(n.field(e)))}}function Pc(t,e){return t==e||t.length==e.length&&t.every((r,n)=>r===e[n])}class xa{constructor(e,r,n,i){this.dependencies=e,this.facet=r,this.type=n,this.value=i,this.id=Tc++}dynamicSlot(e){var r;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((r=e[h.id])!==null&&r!==void 0?r:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Mc(h,u)){let p=n(h);if(a?!sp(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,m=d.config.address[s];if(m!=null){let y=ka(d,m);if(this.dependencies.every(w=>w instanceof pe?d.facet(w)===h.facet(w):w instanceof At?d.field(w,!1)==h.field(w,!1):!0)||(a?sp(p=n(h),y,i):i(p=n(h),y)))return h.values[o]=y,0}else p=n(h);return h.values[o]=p,1}}}}function sp(t,e,r){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!r(t[n],e[n]))return!1;return!0}function Mc(t,e){let r=!1;for(let n of e)Ks(t,n)&1&&(r=!0);return r}function ck(t,e,r){let n=r.map(l=>t[l.id]),i=r.map(l=>l.type),s=n.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=ka(l,n[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Ks(l,c);return l.values[o]=a(l),1},update(l,c){if(!Mc(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Mc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Pc(r,h))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const op=pe.define({static:!0});class At{constructor(e,r,n,i,s){this.id=e,this.createF=r,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let r=new At(Tc++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(r.provides=e.provide(r)),r}create(e){let r=e.facet(op).find(n=>n.field==this);return(r?.create||this.createF)(e)}slot(e){let r=e[this.id]>>1;return{create:n=>(n.values[r]=this.create(n),1),update:(n,i)=>{let s=n.values[r],o=this.updateF(s,i);return this.compareF(s,o)?0:(n.values[r]=o,1)},reconfigure:(n,i)=>i.config.address[this.id]!=null?(n.values[r]=i.field(this),0):(n.values[r]=this.create(n),1)}}init(e){return[this,op.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Gs(t){return e=>new ap(e,t)}const xi={highest:Gs(bi.highest),high:Gs(bi.high),default:Gs(bi.default),low:Gs(bi.low),lowest:Gs(bi.lowest)};class ap{constructor(e,r){this.inner=e,this.prec=r}}class wa{of(e){return new Ic(this,e)}reconfigure(e){return wa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ic{constructor(e,r){this.compartment=e,this.inner=r}}class Sa{constructor(e,r,n,i,s,o){for(this.base=e,this.compartments=r,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let r=this.address[e.id];return r==null?e.default:this.staticValues[r>>1]}static resolve(e,r,n){let i=[],s=Object.create(null),o=new Map;for(let d of uk(e,r,o))d instanceof At?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],m=p[0].facet,y=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[m.id]=l.length<<1|1,Pc(y,p))l.push(n.facet(m));else{let w=m.combine(p.map(A=>A.value));l.push(n&&m.compare(w,n.facet(m))?n.facet(m):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(A=>w.dynamicSlot(A)));a[m.id]=c.length<<1,c.push(w=>ck(w,m,p))}}let h=c.map(d=>d(a));return new Sa(e,o,h,a,l,s)}}function uk(t,e,r){let n=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof Ic&&r.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Ic){if(r.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;r.set(o.compartment,c),s(c,a)}else if(o instanceof ap)s(o.inner,o.prec);else if(o instanceof At)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof xa)n[a].push(o),o.facet.extensions&&s(o.facet.extensions,bi.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(t,bi.default),n.reduce((o,a)=>o.concat(a))}function Ks(t,e){if(e&1)return 2;let r=e>>1,n=t.status[r];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[r]=4;let i=t.computeSlot(t,t.config.dynamicSlots[r]);return t.status[r]=2|i}function ka(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const lp=pe.define(),cp=pe.define({combine:t=>t.some(e=>e),static:!0}),up=pe.define({combine:t=>t.length?t[0]:void 0,static:!0}),fp=pe.define(),hp=pe.define(),dp=pe.define(),pp=pe.define({combine:t=>t.length?t[0]:!1});class an{constructor(e,r){this.type=e,this.value=r}static define(){return new fk}}class fk{of(e){return new an(this,e)}}class hk{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{constructor(e,r){this.type=e,this.value=r}map(e){let r=this.type.map(this.value,e);return r===void 0?void 0:r==this.value?this:new Ae(this.type,r)}is(e){return this.type==e}static define(e={}){return new hk(e.map||(r=>r))}static mapEffects(e,r){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(r);s&&n.push(s)}return n}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Mt{constructor(e,r,n,i,s,o){this.startState=e,this.changes=r,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&ip(n,r.newLength),s.some(a=>a.type==Mt.time)||(this.annotations=s.concat(Mt.time.of(Date.now())))}static create(e,r,n,i,s,o){return new Mt(e,r,n,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let r of this.annotations)if(r.type==e)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let r=this.annotation(Mt.userEvent);return!!(r&&(r==e||r.length>e.length&&r.slice(0,e.length)==e&&r[e.length]=="."))}}Mt.time=an.define(),Mt.userEvent=an.define(),Mt.addToHistory=an.define(),Mt.remote=an.define();function dk(t,e){let r=[];for(let n=0,i=0;;){let s,o;if(n<t.length&&(i==e.length||e[i]>=t[n]))s=t[n++],o=t[n++];else if(i<e.length)s=e[i++],o=e[i++];else return r;!r.length||r[r.length-1]<s?r.push(s,o):r[r.length-1]<o&&(r[r.length-1]=o)}}function gp(t,e,r){var n;let i,s,o;return r?(i=e.changes,s=Pt.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(n=t.selection)===null||n===void 0?void 0:n.map(i),effects:Ae.mapEffects(t.effects,i).concat(Ae.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Dc(t,e,r){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Mt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Pt?e.changes:Pt.of(e.changes||[],r,t.facet(up)),selection:n&&(n instanceof se?n:se.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function mp(t,e,r){let n=Dc(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(r=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(r=!1);let o=!!e[s].sequential;n=gp(n,Dc(t,e[s],o?n.changes.newLength:t.doc.length),o)}let i=Mt.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return gk(r?pk(i):i)}function pk(t){let e=t.startState,r=!0;for(let i of e.facet(fp)){let s=i(t);if(s===!1){r=!1;break}Array.isArray(s)&&(r=r===!0?s:dk(r,s))}if(r!==!0){let i,s;if(r===!1)s=t.changes.invertedDesc,i=Pt.empty(e.doc.length);else{let o=t.changes.filter(r);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Mt.create(e,i,t.selection&&t.selection.map(s),Ae.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(hp);for(let i=n.length-1;i>=0;i--){let s=n[i](t);s instanceof Mt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mt?t=s[0]:t=mp(e,Qi(s),!1)}return t}function gk(t){let e=t.startState,r=e.facet(dp),n=t;for(let i=r.length-1;i>=0;i--){let s=r[i](t);s&&Object.keys(s).length&&(n=gp(n,Dc(e,s,t.changes.newLength),!0))}return n==t?t:Mt.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const mk=[];function Qi(t){return t==null?mk:Array.isArray(t)?t:[t]}var at=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(at||(at={}));const vk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nc;try{Nc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function yk(t){if(Nc)return Nc.test(t);for(let e=0;e<t.length;e++){let r=t[e];if(/\w/.test(r)||r>"\x80"&&(r.toUpperCase()!=r.toLowerCase()||vk.test(r)))return!0}return!1}function bk(t){return e=>{if(!/\S/.test(e))return at.Space;if(yk(e))return at.Word;for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return at.Word;return at.Other}}class Ve{constructor(e,r,n,i,s,o){this.config=e,this.doc=r,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Ks(this,a<<1);this.computeSlot=null}field(e,r=!0){let n=this.config.address[e.id];if(n==null){if(r)throw new RangeError("Field is not present in this state");return}return Ks(this,n),ka(this,n)}update(...e){return mp(this,e,!0)}applyTransaction(e){let r=this.config,{base:n,compartments:i}=r;for(let o of e.effects)o.is(wa.reconfigure)?(r&&(i=new Map,r.compartments.forEach((a,l)=>i.set(l,a)),r=null),i.set(o.value.compartment,o.value.extension)):o.is(Ae.reconfigure)?(r=null,n=o.value):o.is(Ae.appendConfig)&&(r=null,n=Qi(n).concat(o.value));let s;r?s=e.startState.values.slice():(r=Sa.resolve(n,i,this),s=new Ve(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new Ve(r,e.newDoc,e.newSelection,s,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:e},range:se.cursor(r.from+e.length)}))}changeByRange(e){let r=this.selection,n=e(r.ranges[0]),i=this.changes(n.changes),s=[n.range],o=Qi(n.effects);for(let a=1;a<r.ranges.length;a++){let l=e(r.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=Ae.mapEffects(o,u).concat(Ae.mapEffects(Qi(l.effects),h))}return{changes:i,selection:se.create(s,r.mainIndex),effects:o}}changes(e=[]){return e instanceof Pt?e:Pt.of(e,this.doc.length,this.facet(Ve.lineSeparator))}toText(e){return Je.of(e.split(this.facet(Ve.lineSeparator)||Cc))}sliceDoc(e=0,r=this.doc.length){return this.doc.sliceString(e,r,this.lineBreak)}facet(e){let r=this.config.address[e.id];return r==null?e.default:(Ks(this,r),ka(this,r))}toJSON(e){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof At&&this.config.address[i.id]!=null&&(r[n]=i.spec.toJSON(this.field(e[n]),this))}return r}static fromJSON(e,r={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Ve.create({doc:e.doc,selection:se.fromJSON(e.selection),extensions:r.extensions?i.concat([r.extensions]):i})}static create(e={}){let r=Sa.resolve(e.extensions||[],new Map),n=e.doc instanceof Je?e.doc:Je.of((e.doc||"").split(r.staticFacet(Ve.lineSeparator)||Cc)),i=e.selection?e.selection instanceof se?e.selection:se.single(e.selection.anchor,e.selection.head):se.single(0);return ip(i,n.length),r.staticFacet(cp)||(i=i.asSingle()),new Ve(r,n,i,r.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ve.tabSize)}get lineBreak(){return this.facet(Ve.lineSeparator)||`
|
|
145
|
+
`}get readOnly(){return this.facet(pp)}phrase(e,...r){for(let n of this.facet(Ve.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return r.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>r.length?n:r[s-1]})),e}languageDataAt(e,r,n=-1){let i=[];for(let s of this.facet(lp))for(let o of s(this,r,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return bk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:r,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Kt(r,o,!1);if(s(r.slice(l,o))!=at.Word)break;o=l}for(;a<i;){let l=Kt(r,a);if(s(r.slice(a,l))!=at.Word)break;a=l}return o==a?null:se.range(o+n,a+n)}}Ve.allowMultipleSelections=cp,Ve.tabSize=pe.define({combine:t=>t.length?t[0]:4}),Ve.lineSeparator=up,Ve.readOnly=pp,Ve.phrases=pe.define({compare(t,e){let r=Object.keys(t),n=Object.keys(e);return r.length==n.length&&r.every(i=>t[i]==e[i])}}),Ve.languageData=lp,Ve.changeFilter=fp,Ve.transactionFilter=hp,Ve.transactionExtender=dp,wa.reconfigure=Ae.define();function Ur(t,e,r={}){let n={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(r,s))n[s]=r[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class wi{eq(e){return this==e}range(e,r=e){return Ys.create(e,r,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=ir.TrackDel;class Ys{constructor(e,r,n){this.from=e,this.to=r,this.value=n}static create(e,r,n){return new Ys(e,r,n)}}function Rc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Lc{constructor(e,r,n,i){this.from=e,this.to=r,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,r,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-r;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,r,n,i){for(let s=this.findIndex(r,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,r){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,d,p;if(u==h){let m=r.mapPos(u,c.startSide,c.mapMode);if(m==null||(d=p=m,c.startSide!=c.endSide&&(p=r.mapPos(u,c.endSide),p<d)))continue}else if(d=r.mapPos(u,c.startSide),p=r.mapPos(h,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),n.push(c),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Lc(i,s,n,a):null,pos:o}}}class Qe{constructor(e,r,n,i){this.chunkPos=e,this.chunk=r,this.nextLayer=n,this.maxPoint=i}static create(e,r,n,i){return new Qe(e,r,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let r of this.chunk)e+=r.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:r=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(r.length==0&&!o)return this;if(n&&(r=r.slice().sort(Rc)),this.isEmpty)return r.length?Qe.of(r):this;let a=new yp(this,null,-1).goto(0),l=0,c=[],u=new Kn;for(;a.value||l<r.length;)if(l<r.length&&(a.from-r[l].from||a.startSide-r[l].value.startSide)>=0){let h=r[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==r.length||this.chunkEnd(a.chunkIndex)<r[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Ys.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Qe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let r=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),r.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),r.push(u),n.push(h))}}let s=this.nextLayer.map(e);return r.length==0?s:new Qe(n,r,s||Qe.empty,i)}between(e,r,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(r>=s&&e<=s+o.length&&o.between(s,e-s,r-s,n)===!1)return}this.nextLayer.between(e,r,n)}}iter(e=0){return Js.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,r=0){return Js.from(e).goto(r)}static compare(e,r,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=r.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=vp(o,a,n),c=new Qs(o,l,s),u=new Qs(a,l,s);n.iterGaps((h,d,p)=>bp(c,h,u,d,p,i)),n.empty&&n.length==0&&bp(c,0,u,0,0,i)}static eq(e,r,n=0,i){i==null&&(i=1e9-1);let s=e.filter(u=>!u.isEmpty&&r.indexOf(u)<0),o=r.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=vp(s,o),l=new Qs(s,a,0).goto(n),c=new Qs(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Fc(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,r,n,i,s=-1){let o=new Qs(e,null,s).goto(r),a=r,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<r?u.length+1:Math.min(u.length,l);i.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,r=!1){let n=new Kn;for(let i of e instanceof Ys?[e]:r?xk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Qe.empty=new Qe([],[],null,-1);function xk(t){if(t.length>1)for(let e=t[0],r=1;r<t.length;r++){let n=t[r];if(Rc(e,n)>0)return t.slice().sort(Rc);e=n}return t}Qe.empty.nextLayer=Qe.empty;class Kn{finishChunk(e){this.chunks.push(new Lc(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,r,n){this.addInner(e,r,n)||(this.nextLayer||(this.nextLayer=new Kn)).add(e,r,n)}addInner(e,r,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(r-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=r,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,r-e)),!0)}addChunk(e,r){if((e-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(e);let n=r.value.length-1;return this.last=r.value[n],this.lastFrom=r.from[n]+e,this.lastTo=r.to[n]+e,!0}finish(){return this.finishInner(Qe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let r=Qe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,r}}function vp(t,e,r){let n=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=n.get(s.chunk[o]);a!=null&&(r?r.mapPos(a):a)==s.chunkPos[o]&&!r?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class yp{constructor(e,r,n,i=0){this.layer=e,this.skip=r,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,r,!1),this}gotoInner(e,r,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],r,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,r){(this.to-e||this.endSide-r)<0&&this.gotoInner(e,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],n=e+r.from[this.rangeIndex];if(this.from=n,this.to=e+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Js{constructor(e){this.heap=e}static from(e,r=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new yp(o,r,n,s));return i.length==1?i[0]:new Js(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,r=-1e9){for(let n of this.heap)n.goto(e,r);for(let n=this.heap.length>>1;n>=0;n--)Bc(this.heap,n);return this.next(),this}forward(e,r){for(let n of this.heap)n.forward(e,r);for(let n=this.heap.length>>1;n>=0;n--)Bc(this.heap,n);(this.to-e||this.value.endSide-r)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Bc(this.heap,0)}}}function Bc(t,e){for(let r=t[e];;){let n=(e<<1)+1;if(n>=t.length)break;let i=t[n];if(n+1<t.length&&i.compare(t[n+1])>=0&&(i=t[n+1],n++),r.compare(i)<0)break;t[n]=r,t[e]=i,e=n}}class Qs{constructor(e,r,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Js.from(e,r,n)}goto(e,r=-1e9){return this.cursor.goto(e,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=r,this.openStart=-1,this.next(),this}forward(e,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(e,r)}removeActive(e){Aa(this.active,e),Aa(this.activeTo,e),Aa(this.activeRank,e),this.minActive=xp(this.active,this.activeTo)}addActive(e){let r=0,{value:n,to:i,rank:s}=this.cursor;for(;r<this.activeRank.length&&this.activeRank[r]<=s;)r++;Ca(this.active,r,n),Ca(this.activeTo,r,i),Ca(this.activeRank,r,s),e&&Ca(e,r,this.cursor.from),this.minActive=xp(this.active,this.activeTo)}next(){let e=this.to,r=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Aa(n,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(n),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let r=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&r.push(this.active[n]);return r.reverse()}openEnd(e){let r=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)r++;return r}}function bp(t,e,r,n,i,s){t.goto(e),r.goto(n);let o=n+i,a=n,l=n-e;for(;;){let c=t.to+l-r.to||t.endSide-r.endSide,u=c<0?t.to+l:r.to,h=Math.min(u,o);if(t.point||r.point?t.point&&r.point&&(t.point==r.point||t.point.eq(r.point))&&Fc(t.activeForPoint(t.to),r.activeForPoint(r.to))||s.comparePoint(a,h,t.point,r.point):h>a&&!Fc(t.active,r.active)&&s.compareRange(a,h,t.active,r.active),u>o)break;a=u,c<=0&&t.next(),c>=0&&r.next()}}function Fc(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r]&&!t[r].eq(e[r]))return!1;return!0}function Aa(t,e){for(let r=e,n=t.length-1;r<n;r++)t[r]=t[r+1];t.pop()}function Ca(t,e,r){for(let n=t.length-1;n>=e;n--)t[n+1]=t[n];t[e]=r}function xp(t,e){let r=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||t[i].endSide-t[r].endSide)<0&&(r=i,n=e[i]);return r}function Xi(t,e,r=t.length){let n=0;for(let i=0;i<r;)t.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Kt(t,i));return n}function jc(t,e,r,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?r-s%r:1,i=Kt(t,i)}return n===!0?-1:t.length}const Vc="\u037C",wp=typeof Symbol>"u"?"__"+Vc:Symbol.for(Vc),Wc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Sp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yn{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,u,d)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
146
|
+
`)}static newName(){let e=Sp[wp]||1;return Sp[wp]=e+1,Vc+e.toString(36)}static mount(e,r,n){let i=e[Wc],s=n&&n.nonce;i?s&&i.setNonce(s):i=new wk(e,s),i.mount(Array.isArray(r)?r:[r])}}let kp=new Map;class wk{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=kp.get(n);if(s)return e.adoptedStyleSheets=[s.sheet,...e.adoptedStyleSheets],e[Wc]=s;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],kp.set(n,this)}else{this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);let s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[Wc]=this}mount(e){let r=this.sheet,n=0,i=0;for(let s=0;s<e.length;s++){let o=e[s],a=this.modules.indexOf(o);if(a<i&&a>-1&&(this.modules.splice(a,1),i--,a=-1),a==-1){if(this.modules.splice(i++,0,o),r)for(let l=0;l<o.rules.length;l++)r.insertRule(o.rules[l],n++)}else{for(;i<a;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!r){let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
|
|
147
|
+
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Jn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Sk=typeof navigator<"u"&&/Mac/.test(navigator.platform),kk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),jt=0;jt<10;jt++)Jn[48+jt]=Jn[96+jt]=String(jt);for(var jt=1;jt<=24;jt++)Jn[jt+111]="F"+jt;for(var jt=65;jt<=90;jt++)Jn[jt]=String.fromCharCode(jt+32),Xs[jt]=String.fromCharCode(jt);for(var $c in Jn)Xs.hasOwnProperty($c)||(Xs[$c]=Jn[$c]);function Ak(t){var e=Sk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||kk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",r=!e&&t.key||(t.shiftKey?Xs:Jn)[t.keyCode]||t.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function Oa(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Hc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ck(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ea(t,e){if(!e.anchorNode)return!1;try{return Hc(t,e.anchorNode)}catch{return!1}}function Zi(t){return t.nodeType==3?Si(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ta(t,e,r,n){return r?Ap(t,e,r,n,-1)||Ap(t,e,r,n,1):!1}function Zs(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Ap(t,e,r,n,i){for(;;){if(t==r&&e==n)return!0;if(e==(i<0?0:On(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Zs(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?On(t):0}else return!1}}function On(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Pa(t,e){let r=e?t.left:t.right;return{left:r,right:r,top:t.top,bottom:t.bottom}}function Ok(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Ek(t,e,r,n,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,h=!1;u&&!h;)if(u.nodeType==1){let d,p=u==l.body,m=1,y=1;if(p)d=Ok(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();m=T.width/u.offsetWidth,y=T.height/u.offsetHeight,d={left:T.left,right:T.left+u.clientWidth*m,top:T.top,bottom:T.top+u.clientHeight*y}}let w=0,A=0;if(i=="nearest")e.top<d.top?(A=-(d.top-e.top+o),r>0&&e.bottom>d.bottom+A&&(A=e.bottom-d.bottom+A+o)):e.bottom>d.bottom&&(A=e.bottom-d.bottom+o,r<0&&e.top-A<d.top&&(A=-(d.top+A-e.top+o)));else{let T=e.bottom-e.top,E=d.bottom-d.top;A=(i=="center"&&T<=E?e.top+T/2-E/2:i=="start"||i=="center"&&r<0?e.top-o:e.bottom-E+o)-d.top}if(n=="nearest"?e.left<d.left?(w=-(d.left-e.left+s),r>0&&e.right>d.right+w&&(w=e.right-d.right+w+s)):e.right>d.right&&(w=e.right-d.right+s,r<0&&e.left<d.left+w&&(w=-(d.left+w-e.left+s))):w=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,w||A)if(p)c.scrollBy(w,A);else{let T=0,E=0;if(A){let B=u.scrollTop;u.scrollTop+=A/y,E=(u.scrollTop-B)*y}if(w){let B=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-B)*m}e={left:e.left-T,top:e.top-E,right:e.right-T,bottom:e.bottom-E},T&&Math.abs(T-w)<1&&(n="nearest"),E&&Math.abs(E-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Tk(t){let e=t.ownerDocument;for(let r=t.parentNode;r&&r!=e.body;)if(r.nodeType==1){if(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)return r;r=r.assignedSlot||r.parentNode}else if(r.nodeType==11)r=r.host;else break;return null}class Pk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:r,focusNode:n}=e;this.set(r,Math.min(e.anchorOffset,r?On(r):0),n,Math.min(e.focusOffset,n?On(n):0))}set(e,r,n,i){this.anchorNode=e,this.anchorOffset=r,this.focusNode=n,this.focusOffset=i}}let _i=null;function Cp(t){if(t.setActive)return t.setActive();if(_i)return t.focus(_i);let e=[];for(let r=t;r&&(e.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(t.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),!_i){_i=!1;for(let r=0;r<e.length;){let n=e[r++],i=e[r++],s=e[r++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let Op;function Si(t,e,r=e){let n=Op||(Op=document.createRange());return n.setEnd(t,r),n.setStart(t,e),n}function qi(t,e,r){let n={key:e,code:e,keyCode:r,which:r,cancelable:!0},i=new KeyboardEvent("keydown",n);i.synthetic=!0,t.dispatchEvent(i);let s=new KeyboardEvent("keyup",n);return s.synthetic=!0,t.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function Mk(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Ep(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Ik(t,e){let r=e.focusNode,n=e.focusOffset;if(!r||e.anchorNode!=r||e.anchorOffset!=n)return!1;for(n=Math.min(n,On(r));;)if(n){if(r.nodeType!=1)return!1;let i=r.childNodes[n-1];i.contentEditable=="false"?n--:(r=i,n=On(r))}else{if(r==t)return!0;n=Zs(r),r=r.parentNode}}function Tp(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}class Jt{constructor(e,r,n=!0){this.node=e,this.offset=r,this.precise=n}static before(e,r){return new Jt(e.parentNode,Zs(e),r)}static after(e,r){return new Jt(e.parentNode,Zs(e)+1,r)}}const zc=[];class it{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let r=this.posAtStart;for(let n of this.children){if(n==e)return r;r+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,r){if(this.flags&2){let n=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:n.firstChild)){let a=it.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,r),o.flags&=-8}if(s=i?i.nextSibling:n.firstChild,r&&!r.written&&r.node==n&&s!=o.dom&&(r.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=Pp(s);else n.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:n.firstChild,s&&r&&r.node==n&&(r.written=!0);s;)s=Pp(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,r),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,r){let n;if(e==this.dom)n=this.dom.childNodes[r];else{let i=On(e)==0?0:r==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!it.get(n);)n=n.nextSibling;if(!n)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,r,n=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<this.children.length;l++){let h=this.children[l],d=c+h.length;if(c<e&&d>r)return h.domBoundsAround(e,r,c);if(d>=e&&i==-1&&(i=l,s=c),c>r&&h.dom.parentNode==this.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?n+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let r=this.parent;r;r=r.parent){if(e&&(r.flags|=2),r.flags&1)return;r.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let r=e.parent;if(!r)return e;e=r}}replaceChildren(e,r,n=zc){this.markDirty();for(let i=e;i<r;i++){let s=this.children[i];s.parent==this&&s.destroy()}this.children.splice(e,r-e,...n);for(let i=0;i<n.length;i++)n[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Mp(this.children,e,this.children.length)}childPos(e,r=1){return this.childCursor().findPos(e,r)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,r,n,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}}it.prototype.breakAfter=0;function Pp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Mp{constructor(e,r,n){this.children=e,this.pos=r,this.i=n,this.off=0}findPos(e,r=1){for(;;){if(e>this.pos||e==this.pos&&(r>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Ip(t,e,r,n,i,s,o,a,l){let{children:c}=t,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(r,i,s.length?h:null,r==0,a,l))){if(n<c.length){let p=c[n];p&&(i<p.length||p.breakAfter&&h?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,l)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,l),s.push(p))):p?.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,r>0&&(!o&&s.length&&u.merge(r,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(r<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(r,u.length,null,!1,a,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,a,l)&&e--,(e<n||s.length)&&t.replaceChildren(e,n,s)}}function Dp(t,e,r,n,i,s){let o=t.childCursor(),{i:a,off:l}=o.findPos(r,1),{i:c,off:u}=o.findPos(e,-1),h=e-r;for(let d of n)h+=d.length;t.length+=h,Ip(t,c,u,a,l,n,0,i,s)}let yr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Uc=typeof document<"u"?document:{documentElement:{style:{}}};const Gc=/Edge\/(\d+)/.exec(yr.userAgent),Np=/MSIE \d/.test(yr.userAgent),Kc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yr.userAgent),Ma=!!(Np||Kc||Gc),Rp=!Ma&&/gecko\/(\d+)/i.test(yr.userAgent),Yc=!Ma&&/Chrome\/(\d+)/.exec(yr.userAgent),Lp="webkitFontSmoothing"in Uc.documentElement.style,Bp=!Ma&&/Apple Computer/.test(yr.vendor),Fp=Bp&&(/Mobile\/\w+/.test(yr.userAgent)||yr.maxTouchPoints>2);var be={mac:Fp||/Mac/.test(yr.platform),windows:/Win/.test(yr.platform),linux:/Linux|X11/.test(yr.platform),ie:Ma,ie_version:Np?Uc.documentMode||6:Kc?+Kc[1]:Gc?+Gc[1]:0,gecko:Rp,gecko_version:Rp?+(/Firefox\/(\d+)/.exec(yr.userAgent)||[0,0])[1]:0,chrome:!!Yc,chrome_version:Yc?+Yc[1]:0,ios:Fp,android:/Android\b/.test(yr.userAgent),webkit:Lp,safari:Bp,webkit_version:Lp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Uc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Dk=256;class En extends it{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,r){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(r&&r.node==this.dom&&(r.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,r,n){return this.flags&8||n&&(!(n instanceof En)||this.length-(r-e)+n.length>Dk||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(r),this.markDirty(),!0)}split(e){let r=new En(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),r.flags|=this.flags&8,r}localPosFromDOM(e,r){return e==this.dom?r:r?this.text.length:0}domAtPos(e){return new Jt(this.dom,e)}domBoundsAround(e,r,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,r){return Nk(this.dom,e,r)}}class Tn extends it{constructor(e,r=[],n=0){super(),this.mark=e,this.children=r,this.length=n;for(let i of r)i.setParent(this)}setAttrs(e){if(Ep(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let r in this.mark.attrs)e.setAttribute(r,this.mark.attrs[r]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,r){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,r)}merge(e,r,n,i,s,o){return n&&(!(n instanceof Tn&&n.mark.eq(this.mark))||e&&s<=0||r<this.length&&o<=0)?!1:(Dp(this,e,r,n?n.children:[],s-1,o-1),this.markDirty(),!0)}split(e){let r=[],n=0,i=-1,s=0;for(let a of this.children){let l=n+a.length;l>e&&r.push(n<e?a.split(e-n):a),i<0&&n>=e&&(i=s),n=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Tn(this.mark,r,o)}domAtPos(e){return jp(this,e)}coordsAt(e,r){return Wp(this,e,r)}}function Nk(t,e,r){let n=t.nodeValue.length;e>n&&(e=n);let i=e,s=e,o=0;e==0&&r<0||e==n&&r>=0?be.chrome||be.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):r<0?i--:s<n&&s++;let a=Si(t,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:r>=0)?0:a.length-1];return be.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Pa(l,o<0):l||null}class Qn extends it{static create(e,r,n){return new Qn(e,r,n)}constructor(e,r,n){super(),this.widget=e,this.length=r,this.side=n,this.prevWidget=null}split(e){let r=Qn.create(this.widget,this.length-e,this.side);return this.length-=e,r}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,r,n,i,s,o){return n&&(!(n instanceof Qn)||!this.widget.compare(n.widget)||e>0&&s<=0||r<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}become(e){return e instanceof Qn&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Je.empty;let e=this;for(;e.parent;)e=e.parent;let{view:r}=e,n=r&&r.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Je.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,r){let n=this.widget.coordsAt(this.dom,e,r);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return Pa(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class es extends it{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof es&&e.side==this.side}split(){return new es(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Jt.before(this.dom):Jt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Je.empty}get isHidden(){return!0}}En.prototype.children=Qn.prototype.children=es.prototype.children=zc;function jp(t,e){let r=t.dom,{children:n}=t,i=0;for(let s=0;i<n.length;i++){let o=n[i],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==r)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=i;s>0;s--){let o=n[s-1];if(o.dom.parentNode==r)return o.domAtPos(o.length)}for(let s=i;s<n.length;s++){let o=n[s];if(o.dom.parentNode==r)return o.domAtPos(0)}return new Jt(r,0)}function Vp(t,e,r){let n,{children:i}=t;r>0&&e instanceof Tn&&i.length&&(n=i[i.length-1])instanceof Tn&&n.mark.eq(e.mark)?Vp(n,e.children[0],r-1):(i.push(e),e.setParent(t)),t.length+=e.length}function Wp(t,e,r){let n=null,i=-1,s=null,o=-1;function a(c,u){for(let h=0,d=0;h<c.children.length&&d<=u;h++){let p=c.children[h],m=d+p.length;m>=u&&(p.children.length?a(p,u-d):(!s||s.isHidden&&r>0)&&(m>u||d==m&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==m&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=m}}a(t,e);let l=(r<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?i:o),r):Rk(t)}function Rk(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let r=Zi(e);return r[r.length-1]||null}function Jc(t,e){for(let r in t)r=="class"&&e.class?e.class+=" "+t.class:r=="style"&&e.style?e.style+=";"+t.style:e[r]=t[r];return e}const $p=Object.create(null);function Qc(t,e,r){if(t==e)return!0;t||(t=$p),e||(e=$p);let n=Object.keys(t),i=Object.keys(e);if(n.length-(r&&n.indexOf(r)>-1?1:0)!=i.length-(r&&i.indexOf(r)>-1?1:0))return!1;for(let s of n)if(s!=r&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function Xc(t,e,r){let n=!1;if(e)for(let i in e)r&&i in r||(n=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(r)for(let i in r)e&&e[i]==r[i]||(n=!0,i=="style"?t.style.cssText=r[i]:t.setAttribute(i,r[i]));return n}function Lk(t){let e=Object.create(null);for(let r=0;r<t.attributes.length;r++){let n=t.attributes[r];e[n.name]=n.value}return e}class It extends it{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,r,n,i,s,o){if(n){if(!(n instanceof It))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Dp(this,e,r,n?n.children:[],s,o),!0}split(e){let r=new It;if(r.breakAfter=this.breakAfter,this.length==0)return r;let{i:n,off:i}=this.childPos(e);i&&(r.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)r.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,r}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Qc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,r){Vp(this,e,r)}addLineDeco(e){let r=e.spec.attributes,n=e.spec.class;r&&(this.attrs=Jc(r,this.attrs||{})),n&&(this.attrs=Jc({class:n},this.attrs||{}))}domAtPos(e){return jp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,r){var n;this.dom?this.flags&4&&(Ep(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Xc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,r);let i=this.dom.lastChild;for(;i&&it.get(i)instanceof Tn;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=it.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!be.ios||!this.children.some(s=>s instanceof En))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,r;for(let n of this.children){if(!(n instanceof En)||/[^ -~]/.test(n.text))return null;let i=Zi(n.dom);if(i.length!=1)return null;e+=i[0].width,r=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:r}:null}coordsAt(e,r){let n=Wp(this,e,r);if(!this.children.length&&n&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,r){for(let n=0,i=0;n<e.children.length;n++){let s=e.children[n],o=i+s.length;if(o>=r){if(s instanceof It)return s;if(o>r)break}i=o+s.breakAfter}return null}}class Xn extends it{constructor(e,r,n){super(),this.widget=e,this.length=r,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,r,n,i,s,o){return n&&(!(n instanceof Xn)||!this.widget.compare(n.widget)||e>0&&s<=0||r<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}domAtPos(e){return e==0?Jt.before(this.dom):Jt.after(this.dom,e==this.length)}split(e){let r=this.length-e;this.length=e;let n=new Xn(this.widget,r,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return zc}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Je.empty}domBoundsAround(){return null}become(e){return e instanceof Xn&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,r){return this.widget.coordsAt(this.dom,e,r)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:r,endSide:n}=this.deco;return r==n?!1:e<0?r<0:n>0}}class ln{eq(e){return!1}updateDOM(e,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,r,n){return null}get isHidden(){return!1}destroy(e){}}var sr=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(sr||(sr={}));class ke extends wi{constructor(e,r,n,i){super(),this.startSide=e,this.endSide=r,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new _s(e)}static widget(e){let r=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return r+=n&&!e.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new Zn(e,r,r,n,e.widget||null,!1)}static replace(e){let r=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:s,end:o}=Hp(e,r);n=(s?r?-3e8:-1:5e8)-1,i=(o?r?2e8:1:-6e8)+1}return new Zn(e,n,i,r,e.widget||null,!0)}static line(e){return new qs(e)}static set(e,r=!1){return Qe.of(e,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ke.none=Qe.empty;class _s extends ke{constructor(e){let{start:r,end:n}=Hp(e);super(r?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var r,n;return this==e||e instanceof _s&&this.tagName==e.tagName&&(this.class||((r=this.attrs)===null||r===void 0?void 0:r.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Qc(this.attrs,e.attrs,"class")}range(e,r=e){if(e>=r)throw new RangeError("Mark decorations may not be empty");return super.range(e,r)}}_s.prototype.point=!1;class qs extends ke{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof qs&&this.spec.class==e.spec.class&&Qc(this.spec.attributes,e.spec.attributes)}range(e,r=e){if(r!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,r)}}qs.prototype.mapMode=ir.TrackBefore,qs.prototype.point=!0;class Zn extends ke{constructor(e,r,n,i,s,o){super(r,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?r<=0?ir.TrackBefore:ir.TrackAfter:ir.TrackDel}get type(){return this.startSide!=this.endSide?sr.WidgetRange:this.startSide<=0?sr.WidgetBefore:sr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zn&&Bk(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,r=e){if(this.isReplace&&(e>r||e==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,r)}}Zn.prototype.point=!0;function Hp(t,e=!1){let{inclusiveStart:r,inclusiveEnd:n}=t;return r==null&&(r=t.inclusive),n==null&&(n=t.inclusive),{start:r??e,end:n??e}}function Bk(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zc(t,e,r,n=0){let i=r.length-1;i>=0&&r[i]+n>=t?r[i]=Math.max(r[i],e):r.push(t,e)}class eo{constructor(e,r,n,i){this.doc=e,this.pos=r,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=r}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Xn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new It),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ia(new es(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Xn)&&this.getLine()}buildText(e,r,n){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(r.slice(r.length-n)),this.getLine().append(Ia(new En(this.text.slice(this.textOff,this.textOff+i)),r),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,r,n,i){this.buildText(r-e,n,i),this.pos=r,this.openStart<0&&(this.openStart=i)}point(e,r,n,i,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Zn){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(r>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=r-e;if(n instanceof Zn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Xn(n.widget||new zp("div"),a,n));else{let l=Qn.create(n.widget||new zp("span"),a,a?0:n.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<r||n.startSide>0),u=!l.isEditable&&(e<r||s>i.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Ia(new es(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Ia(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<r||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=r),this.openStart<0&&(this.openStart=s)}static build(e,r,n,i,s){let o=new eo(e,r,n,s);return o.openEnd=Qe.spans(i,r,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Ia(t,e){for(let r of e)t=new Tn(r,[t],t.length);return t}class zp extends ln{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const Up=pe.define(),Gp=pe.define(),Kp=pe.define(),Yp=pe.define(),_c=pe.define(),Jp=pe.define(),Qp=pe.define(),Xp=pe.define({combine:t=>t.some(e=>e)}),Zp=pe.define({combine:t=>t.some(e=>e)});class ts{constructor(e,r="nearest",n="nearest",i=5,s=5,o=!1){this.range=e,this.y=r,this.x=n,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new ts(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ts(se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Da=Ae.define({map:(t,e)=>t.map(e)});function br(t,e,r){let n=t.facet(Yp);n.length?n[0](e):window.onerror?window.onerror(String(e),r,void 0,void 0,e):r?console.error(r+":",e):console.error(e)}const Na=pe.define({combine:t=>t.length?t[0]:!0});let Fk=0;const to=pe.define();class ft{constructor(e,r,n,i,s){this.id=e,this.create=r,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,r){const{eventHandlers:n,eventObservers:i,provide:s,decorations:o}=r||{};return new ft(Fk++,e,n,i,a=>{let l=[to.of(a)];return o&&l.push(ro.of(c=>{let u=c.plugin(a);return u?o(u):ke.none})),s&&l.push(s(a)),l})}static fromClass(e,r){return ft.define(n=>new e(n),r)}}class qc{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(n){if(br(r.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(r){br(e.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(n){br(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const _p=pe.define(),Ra=pe.define(),ro=pe.define(),eu=pe.define(),qp=pe.define();function eg(t,e,r){let n=t.state.facet(qp);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(t):o),s=[];return Qe.spans(i,e,r,{point(){},span(o,a,l,c){let u=s;for(let h=l.length-1;h>=0;h--,c--){let d=l[h].spec.bidiIsolate,p;if(d!=null)if(c>0&&u.length&&(p=u[u.length-1]).to==o&&p.direction==d)p.to=a,u=p.inner;else{let m={from:o,to:a,direction:d,inner:[]};u.push(m),u=m.inner}}}}),s}const tg=pe.define();function rg(t){let e=0,r=0,n=0,i=0;for(let s of t.state.facet(tg)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(r=Math.max(r,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:r,top:n,bottom:i}}const no=pe.define();class xr{constructor(e,r,n,i){this.fromA=e,this.toA=r,this.fromB=n,this.toB=i}join(e){return new xr(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let r=e.length,n=this;for(;r>0;r--){let i=e[r-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(r-1,1)}}return e.splice(r,0,n),e}static extendWithRanges(e,r){if(r.length==0)return e;let n=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<r.length&&r[s]<u;){let h=r[s],d=r[s+1],p=Math.max(a,h),m=Math.min(u,d);if(p<=m&&new xr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new xr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class La{constructor(e,r,n){this.view=e,this.state=r,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Pt.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new xr(s,o,a,l))),this.changedRanges=i}static create(e,r,n){return new La(e,r,n)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var ht=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(ht||(ht={}));const io=ht.LTR,ng=ht.RTL;function ig(t){let e=[];for(let r=0;r<t.length;r++)e.push(1<<+t[r]);return e}const jk=ig("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Vk=ig("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),tu=Object.create(null),cn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),r=t.charCodeAt(1);tu[e]=r,tu[r]=-e}function Wk(t){return t<=247?jk[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Vk[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:t==8204?256:1}const $k=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _n{get dir(){return this.level%2?ng:io}constructor(e,r,n){this.from=e,this.to=r,this.level=n}side(e,r){return this.dir==r==e?this.to:this.from}static find(e,r,n,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=r&&a.to>=r){if(a.level==n)return o;(s<0||(i!=0?i<0?a.from<r:a.to>r:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function sg(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!sg(n.inner,i.inner))return!1}return!0}const qe=[];function Hk(t,e,r,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:r,l=s?256:i;for(let c=o,u=l,h=l;c<a;c++){let d=Wk(t.charCodeAt(c));d==512?d=u:d==8&&h==4&&(d=16),qe[c]=d==4?2:d,d&7&&(h=d),u=d}for(let c=o,u=l,h=l;c<a;c++){let d=qe[c];if(d==128)c<a-1&&u==qe[c+1]&&u&24?d=qe[c]=u:qe[c]=256;else if(d==64){let p=c+1;for(;p<a&&qe[p]==64;)p++;let m=c&&u==8||p<r&&qe[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)qe[y]=m;c=p-1}else d==8&&h==1&&(qe[c]=1);u=d,d&7&&(h=d)}}}function zk(t,e,r,n,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:r;for(let h=c,d,p,m;h<u;h++)if(p=tu[d=t.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(cn[y+1]==-p){let w=cn[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[cn[y]]=A),a=y;break}}else{if(cn.length==189)break;cn[a++]=h,cn[a++]=d,cn[a++]=l}else if((m=qe[h])==2||m==1){let y=m==i;l=y?0:1;for(let w=a-3;w>=0;w-=3){let A=cn[w+2];if(A&2)break;if(y)cn[w+2]|=2;else{if(A&4)break;cn[w+2]|=4}}}}}function Uk(t,e,r,n){for(let i=0,s=n;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:e;for(let l=o;l<a;){let c=qe[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==r.length)break;u=r[i++].to,a=i<r.length?r[i].from:e}else if(qe[u]==256)u++;else break;let h=s==1,d=(u<e?qe[u]:n)==1,p=h==d?h?1:2:n;for(let m=u,y=i,w=y?r[y-1].to:t;m>l;)m==w&&(m=r[--y].from,w=y?r[y-1].to:t),qe[--m]=p;l=u}else s=c,l++}}}function ru(t,e,r,n,i,s,o){let a=n%2?2:1;if(n%2==i%2)for(let l=e,c=0;l<r;){let u=!0,h=!1;if(c==s.length||l<s[c].from){let y=qe[l];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let y=s[c];if(!u)for(let w=y.to,A=c+1;;){if(w==r)break e;if(A<s.length&&s[A].from==w)w=s[A++].to;else{if(qe[w]==a)break e;break}}if(c++,d)d.push(y);else{y.from>l&&o.push(new _n(l,y.from,p));let w=y.direction==io!=!(p%2);nu(t,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.to}m=y.to}else{if(m==r||(u?qe[m]!=a:qe[m]==a))break;m++}d?ru(t,l,m,n+1,i,d,o):l<m&&o.push(new _n(l,m,p)),l=m}else for(let l=r,c=s.length;l>e;){let u=!0,h=!1;if(!c||l>s[c-1].to){let y=qe[l-1];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let y=s[--c];if(!u)for(let w=y.from,A=c;;){if(w==e)break e;if(A&&s[A-1].to==w)w=s[--A].from;else{if(qe[w-1]==a)break e;break}}if(d)d.push(y);else{y.to<l&&o.push(new _n(y.to,l,p));let w=y.direction==io!=!(p%2);nu(t,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.from}m=y.from}else{if(m==e||(u?qe[m-1]!=a:qe[m-1]==a))break;m--}d?ru(t,m,l,n+1,i,d,o):m<l&&o.push(new _n(m,l,p)),l=m}}function nu(t,e,r,n,i,s,o){let a=e%2?2:1;Hk(t,i,s,n,a),zk(t,i,s,n,a),Uk(i,s,n,a),ru(t,i,s,e,r,n,o)}function og(t,e,r){if(!t)return[new _n(0,0,e==ng?1:0)];if(e==io&&!r.length&&!$k.test(t))return ag(t.length);if(r.length)for(;t.length>qe.length;)qe[qe.length]=256;let n=[],i=e==io?0:1;return nu(t,i,i,r,0,t.length,n),n}function ag(t){return[new _n(0,t,0)]}let lg="";function cg(t,e,r,n,i){var s;let o=n.head-t.from,a=-1;if(o==0){if(!i||!t.length)return null;e[0].level!=r&&(o=e[0].side(!1,r),a=0)}else if(o==t.length){if(i)return null;let d=e[e.length-1];d.level!=r&&(o=d.side(!0,r),a=e.length-1)}a<0&&(a=_n.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc));let l=e[a];o==l.side(i,r)&&(l=e[a+=i?1:-1],o=l.side(!i,r));let c=i==(l.dir==r),u=Kt(t.text,o,c);if(lg=t.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,r))return se.cursor(u+t.from,c?-1:1,l.level);let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return!h&&l.level!=r?se.cursor(i?t.to:t.from,i?-1:1,r):h&&h.level<l.level?se.cursor(h.side(!i,r)+t.from,i?1:-1,h.level):se.cursor(u+t.from,i?-1:1,l.level)}class ug extends it{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new It],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xr(0,0,0,e.state.doc.length)],0,null)}update(e){var r;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&(!((r=this.domChanged)===null||r===void 0)&&r.newSel?i=this.domChanged.newSel.head:!Zk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Kk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new xr(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(be.ie||be.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Qk(o,a,e.changes);return n=xr.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,r,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,r,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=be.chrome||be.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Xn&&o.widget instanceof fg&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,r,n){let i=n?n.range.addToSet(e.slice()):e,s=this.childCursor(r);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:h}=a,d,p,m,y;if(n&&n.range.fromB<h&&n.range.toB>u){let B=eo.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),I=eo.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=B.breakAtStart,m=B.openStart,y=I.openEnd;let W=this.compositionView(n);I.breakAtStart?W.breakAfter=1:I.content.length&&W.merge(W.length,W.length,I.content[0],!1,I.openStart,0)&&(W.breakAfter=I.content[0].breakAfter,I.content.shift()),B.content.length&&W.merge(0,0,B.content[B.content.length-1],!0,0,B.openEnd)&&B.content.pop(),d=B.content.concat(W).concat(I.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=eo.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:E}=s.findPos(l,-1);Ip(this,T,E,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let r=new En(e.text.nodeValue);r.flags|=8;for(let{deco:i}of e.marks)r=new Tn(i,[r],r.length);let n=new It;return n.append(r,0),n}fixCompositionDOM(e){let r=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=it.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];r(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],r(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,r=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&Ea(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||r||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(be.gecko&&a.empty&&!this.hasComposition&&Gk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Jt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Ta(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Ta(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{be.android&&be.chrome&&this.dom.contains(u.focusNode)&&Xk(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Oa(this.view.root);if(h)if(a.empty){if(be.gecko){let d=Yk(l.node,l.offset);if(d&&d!=3){let p=dg(l.node,l.offset,d==1?1:-1);p&&(l=new Jt(p.node,p.offset))}}h.collapse(l.node,l.offset),a.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=a.bidiLevel)}else if(h.extend){h.collapse(l.node,l.offset);try{h.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Jt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Jt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,r=e.state.selection.main,n=Oa(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!r.empty||!r.assoc||!n.modify)return;let o=It.find(this,r.head);if(!o)return;let a=o.posAtStart;if(r.head==a||r.head==a+o.length)return;let l=this.coordsAt(r.head,-1),c=this.coordsAt(r.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(r.head+r.assoc);n.collapse(u.node,u.offset),n.modify("move",r.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=r.from&&n.collapse(i,s)}moveToLine(e){let r=this.dom,n;if(e.node!=r)return e;for(let i=e.offset;!n&&i<r.childNodes.length;i++){let s=it.get(r.childNodes[i]);s instanceof It&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=it.get(r.childNodes[i]);s instanceof It&&(n=s.domAtPos(s.length))}return n?new Jt(n.node,n.offset,!0):e}nearest(e){for(let r=e;r;){let n=it.get(r);if(n&&n.rootView==this)return n;r=r.parentNode}return null}posFromDOM(e,r){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,r)+n.posAtStart}domAtPos(e){let{i:r,off:n}=this.childCursor().findPos(e,-1);for(;r<this.children.length-1;){let i=this.children[r];if(n<i.length||i instanceof It)break;r++,n=0}return this.children[r].domAtPos(n)}coordsAt(e,r){let n=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!n||a instanceof It&&!(n instanceof It&&r>=0))&&(n=a,i=c),s=c}return n?n.coordsAt(e-i,r):null}coordsForChar(e){let{i:r,off:n}=this.childPos(e,1),i=this.children[r];if(!(i instanceof It))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(n,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}n=l}if(!(i instanceof En))return null;let s=Kt(i.text,n);if(s==n)return null;let o=Si(i.dom,n,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let r=[],{from:n,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ht.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],d=c+h.length;if(d>i)break;if(c>=n){let p=h.dom.getBoundingClientRect();if(r.push(p.height),o){let m=h.dom.lastChild,y=m?Zi(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return r}textDirectionAt(e){let{i:r}=this.childPos(e,1);return getComputedStyle(this.children[r].dom).direction=="rtl"?ht.RTL:ht.LTR}measureTextSize(){for(let s of this.children)if(s instanceof It){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),r,n,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zi(e.firstChild)[0];r=e.getBoundingClientRect().height,n=s?s.width/27:7,i=s?s.height:r,e.remove()}),{lineHeight:r,charWidth:n,textHeight:i}}childCursor(e=this.length){let r=this.children.length;return r&&(e-=this.children[--r].length),new Mp(this.children,e,r)}computeBlockGapDeco(){let e=[],r=this.view.viewState;for(let n=0,i=0;;i++){let s=i==r.viewports.length?null:r.viewports[i],o=s?s.from-1:this.length;if(o>n){let a=(r.lineBlockAt(o).bottom-r.lineBlockAt(n).top)/this.view.scaleY;e.push(ke.replace({widget:new fg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return ke.set(e)}updateDeco(){let e=this.view.state.facet(ro).map((r,n)=>(this.dynamicDecorationMap[n]=typeof r=="function")?r(this.view):r);for(let r=e.length;r<e.length+3;r++)this.dynamicDecorationMap[r]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}let{range:r}=e,n=this.coordsAt(r.head,r.empty?r.assoc:r.head>r.anchor?-1:1),i;if(!n)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=rg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;Ek(this.view.scrollDOM,o,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==ht.LTR)}}function Gk(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}class fg extends ln{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function hg(t,e){let r=t.observer.selectionRange,n=r.focusNode&&dg(r.focusNode,r.focusOffset,0);if(!n)return null;let i=e-n.offset;return{from:i,to:i+n.node.nodeValue.length,node:n.node}}function Kk(t,e,r){let n=hg(t,r);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,c=new xr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=it.get(h);if(d instanceof Tn)u.push({node:h,deco:d.mark});else{if(d instanceof It||h.nodeName=="DIV"&&h.parentNode==t.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=t.contentDOM)u.push({node:h,deco:new _s({inclusive:!0,attributes:Lk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function dg(t,e,r){if(r<=0)for(let n=t,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i>0)n=n.childNodes[i-1],i=On(n);else break}if(r>=0)for(let n=t,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length&&r>=0)n=n.childNodes[i],i=0;else break}return null}function Yk(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let Jk=class{constructor(){this.changes=[]}compareRange(e,r){Zc(e,r,this.changes)}comparePoint(e,r){Zc(e,r,this.changes)}};function Qk(t,e,r){let n=new Jk;return Qe.compare(t,e,r,n),n.changes}function Xk(t,e){for(let r=t;r&&r!=e;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function Zk(t,e){let r=!1;return e&&t.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(r=!0)}),r}function _k(t,e,r=1){let n=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return se.cursor(e);s==0?r=1:s==i.length&&(r=-1);let o=s,a=s;r<0?o=Kt(i.text,s,!1):a=Kt(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Kt(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Kt(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return se.range(o+i.from,a+i.from)}function qk(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function eA(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function iu(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function pg(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function gg(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function su(t,e,r){let n,i,s,o,a=!1,l,c,u,h;for(let m=t.firstChild;m;m=m.nextSibling){let y=Zi(m);for(let w=0;w<y.length;w++){let A=y[w];i&&iu(i,A)&&(A=pg(gg(A,i.bottom),i.top));let T=qk(e,A),E=eA(r,A);if(T==0&&E==0)return m.nodeType==3?mg(m,e,r):su(m,e,r);if(!n||o>E||o==E&&s>T){n=m,i=A,s=T,o=E;let B=E?r<A.top?-1:1:T?e<A.left?-1:1:0;a=!B||(B>0?w<y.length-1:w>0)}T==0?r>A.bottom&&(!u||u.bottom<A.bottom)?(l=m,u=A):r<A.top&&(!h||h.top>A.top)&&(c=m,h=A):u&&iu(u,A)?u=gg(u,A.bottom):h&&iu(h,A)&&(h=pg(h,A.top))}}if(u&&u.bottom>=r?(n=l,i=u):h&&h.top<=r&&(n=c,i=h),!n)return{node:t,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return mg(n,d,r);if(a&&n.contentEditable!="false")return su(n,d,r);let p=Array.prototype.indexOf.call(t.childNodes,n)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:p}}function mg(t,e,r){let n=t.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<n;a++){let l=Si(t,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>r?u.top-r:r-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let d=e>=(u.left+u.right)/2,p=d;if((be.chrome||be.gecko)&&Si(t,a).getBoundingClientRect().left==u.right&&(p=!d),h<=0)return{node:t,offset:a+(p?1:0)};i=a+(p?1:0),s=h}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function vg(t,e,r,n=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),a=o.top+t.viewState.paddingTop,l,{docHeight:c}=t.viewState,{x:u,y:h}=e,d=h-a;if(d<0)return 0;if(d>c)return t.state.doc.length;for(let B=t.viewState.heightOracle.textHeight/2,I=!1;l=t.elementAtHeight(d),l.type!=sr.Text;)for(;d=n>0?l.bottom+B:l.top-B,!(d>=0&&d<=c);){if(I)return r?null:0;I=!0,n=-n}h=a+d;let p=l.from;if(p<t.viewport.from)return t.viewport.from==0?0:r?null:yg(t,o,l,u,h);if(p>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:r?null:yg(t,o,l,u,h);let m=t.dom.ownerDocument,y=t.root.elementFromPoint?t.root:m,w=y.elementFromPoint(u,h);w&&!t.contentDOM.contains(w)&&(w=null),w||(u=Math.max(o.left+1,Math.min(o.right-1,u)),w=y.elementFromPoint(u,h),w&&!t.contentDOM.contains(w)&&(w=null));let A,T=-1;if(w&&((i=t.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(m.caretPositionFromPoint){let B=m.caretPositionFromPoint(u,h);B&&({offsetNode:A,offset:T}=B)}else if(m.caretRangeFromPoint){let B=m.caretRangeFromPoint(u,h);B&&({startContainer:A,startOffset:T}=B,(!t.contentDOM.contains(A)||be.safari&&tA(A,T,u)||be.chrome&&rA(A,T,u))&&(A=void 0))}}if(!A||!t.docView.dom.contains(A)){let B=It.find(t.docView,p);if(!B)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=su(B.dom,u,h))}let E=t.docView.nearest(A);if(!E)return null;if(E.isWidget&&((s=E.dom)===null||s===void 0?void 0:s.nodeType)==1){let B=E.dom.getBoundingClientRect();return e.y<B.top||e.y<=B.bottom&&e.x<=(B.left+B.right)/2?E.posAtStart:E.posAtEnd}else return E.localPosFromDOM(A,T)+E.posAtStart}function yg(t,e,r,n,i){let s=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&r.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-r.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(r.from,r.to);return r.from+jc(o,s,t.state.tabSize)}function tA(t,e,r){let n;if(t.nodeType!=3||e!=(n=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Si(t,n-1,n).getBoundingClientRect().left>r}function rA(t,e,r){if(e!=0)return!1;for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let n=t.nodeType==1?t.getBoundingClientRect():Si(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return r-n.left>5}function ou(t,e){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){for(let n of r.type)if(n.to>e||n.to==e&&(n.to==r.to||n.type==sr.Text))return n}return r}function nA(t,e,r,n){let i=ou(t,e.head),s=!n||i.type!=sr.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:r==(a==ht.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return se.cursor(l,r?-1:1)}return se.cursor(r?i.to:i.from,r?-1:1)}function bg(t,e,r,n){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=cg(i,s,o,a,r),u=lg;if(!c){if(i.number==(r?t.state.doc.lines:1))return a;u=`
|
|
148
|
+
`,i=t.state.doc.line(i.number+(r?1:-1)),s=t.bidiSpans(i),c=se.cursor(r?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function iA(t,e,r){let n=t.state.charCategorizer(e),i=n(r);return s=>{let o=n(s);return i==at.Space&&(i=o),i==o}}function sA(t,e,r,n){let i=e.head,s=r?1:-1;if(i==(r?t.state.doc.length:0))return se.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||-1),u=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=n??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(d+p)*s,y=vg(t,{x:h,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?y<i:y>i)){let w=t.docView.coordsForChar(y),A=!w||m<w.top?-1:1;return se.cursor(y,A,void 0,o)}}}function Ba(t,e,r){for(;;){let n=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||r||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function au(t,e,r){let n=Ba(t.state.facet(eu).map(i=>i(t)),r.from,e.head>r.from?-1:1);return n==r.from?r:se.cursor(n,n<r.from?1:-1)}class oA{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,be.safari&&e.contentDOM.addEventListener("input",()=>null),be.gecko&&SA(e.contentDOM.ownerDocument)}handleEvent(e){!pA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,r){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,r);for(let i of n.handlers){if(r.defaultPrevented)break;if(i(this.view,r)){r.preventDefault();break}}}}ensureHandlers(e){let r=aA(e),n=this.handlers,i=this.view.contentDOM;for(let s in r)if(s!="scroll"){let o=!r[s].handlers.length,a=n[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!r[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=r}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(e.keyCode!=27&&Sg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),be.android&&be.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let r;return be.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((r=wg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||lA.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=r||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,qi(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:be.safari&&!be.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function xg(t,e){return(r,n)=>{try{return e.call(t,n,r)}catch(i){br(r.state,i)}}}function aA(t){let e=Object.create(null);function r(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of t){let i=n.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&r(s).handlers.push(xg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&r(s).observers.push(xg(n.value,o))}}for(let n in Gr)r(n).handlers.push(Gr[n]);for(let n in Kr)r(n).observers.push(Kr[n]);return e}const wg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],lA="dthko",Sg=[16,17,18,20,91,92,224,225],Fa=6;function ja(t){return Math.max(0,t)*.7+8}function cA(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class uA{constructor(e,r,n,i){this.view=e,this.startEvent=r,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParent=Tk(e.contentDOM),this.atoms=e.state.facet(eu).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=r.shiftKey,this.multiple=e.state.facet(Ve.allowMultipleSelections)&&fA(e,r),this.dragging=dA(e,r)&&Dg(r)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var r;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&cA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=0,s=((r=this.scrollParent)===null||r===void 0?void 0:r.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=rg(this.view);e.clientX-o.left<=s.left+Fa?n=-ja(s.left-e.clientX):e.clientX+o.right>=s.right-Fa&&(n=ja(e.clientX-s.right)),e.clientY-o.top<=s.top+Fa?i=-ja(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Fa&&(i=ja(e.clientY-s.bottom)),this.setScrollSpeed(n,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,r){this.scrollSpeed={x:e,y:r},e||r?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let r=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=Ba(this.atoms,i.from,0);o!=i.from&&(s=se.cursor(o,-1))}else{let o=Ba(this.atoms,i.from,-1),a=Ba(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=se.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(r||(r=e.ranges.slice()),r[n]=s)}return r?se.create(r,e.mainIndex):e}select(e){let{view:r}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(r.state.selection)||n.main.assoc!=r.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function fA(t,e){let r=t.state.facet(Up);return r.length?r[0](e):be.mac?e.metaKey:e.ctrlKey}function hA(t,e){let r=t.state.facet(Gp);return r.length?r[0](e):be.mac?!e.altKey:!e.ctrlKey}function dA(t,e){let{main:r}=t.state.selection;if(r.empty)return!1;let n=Oa(t.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function pA(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target,n;r!=t.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(n=it.get(r))&&n.ignoreEvent(e))return!1;return!0}const Gr=Object.create(null),Kr=Object.create(null),kg=be.ie&&be.ie_version<15||be.ios&&be.webkit_version<604;function gA(t){let e=t.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{t.focus(),r.remove(),Ag(t,r.value)},50)}function Ag(t,e){let{state:r}=t,n,i=1,s=r.toText(e),o=s.lines==r.selection.ranges.length;if(lu!=null&&r.selection.ranges.every(l=>l.empty)&&lu==s.toString()){let l=-1;n=r.changeByRange(c=>{let u=r.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=r.toText((o?s.line(i++).text:e)+r.lineBreak);return{changes:{from:u.from,insert:h},range:se.cursor(c.from+h.length)}})}else o?n=r.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:se.cursor(l.from+c.length)}}):n=r.replaceSelection(s);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Kr.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Gr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1),Kr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Kr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Gr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let r=null;for(let n of t.state.facet(Kp))if(r=n(t,e),r)break;if(!r&&e.button==0&&(r=yA(t,e)),r){let n=!t.hasFocus;t.inputState.startMouseSelection(new uA(t,e,r,n)),n&&t.observer.ignore(()=>Cp(t.contentDOM));let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function Cg(t,e,r,n){if(n==1)return se.cursor(e,r);if(n==2)return _k(t.state,e,r);{let i=It.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,se.range(o,a)}}let Og=(t,e)=>t>=e.top&&t<=e.bottom,Eg=(t,e,r)=>Og(e,r)&&t>=r.left&&t<=r.right;function mA(t,e,r,n){let i=It.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&Eg(r,n,o))return-1;let a=i.coordsAt(s,1);return a&&Eg(r,n,a)?1:o&&Og(n,o)?-1:1}function Tg(t,e){let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:r,bias:mA(t,r,e.clientX,e.clientY)}}const vA=be.ie&&be.ie_version<=11;let Pg=null,Mg=0,Ig=0;function Dg(t){if(!vA)return t.detail;let e=Pg,r=Ig;return Pg=t,Ig=Date.now(),Mg=!e||r>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Mg+1)%3:1}function yA(t,e){let r=Tg(t,e),n=Dg(e),i=t.state.selection;return{update(s){s.docChanged&&(r.pos=s.changes.mapPos(r.pos),i=i.map(s.changes))},get(s,o,a){let l=Tg(t,s),c,u=Cg(t,l.pos,l.bias,n);if(r.pos!=l.pos&&!o){let h=Cg(t,r.pos,r.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?se.range(d,p):se.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=bA(i,l.pos))?c:a?i.addRange(u):se.create([u])}}}function bA(t,e){for(let r=0;r<t.ranges.length;r++){let{from:n,to:i}=t.ranges[r];if(n<=e&&i>=e)return se.create(t.ranges.slice(0,r).concat(t.ranges.slice(r+1)),t.mainIndex==r?0:t.mainIndex-(t.mainIndex>r?1:0))}return null}Gr.dragstart=(t,e)=>{let{selection:{main:r}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=r.to||o<=r.from)&&(r=se.range(s,o))}}let{inputState:n}=t;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=r,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(r.from,r.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Gr.dragend=t=>(t.inputState.draggedContent=null,!1);function Ng(t,e,r,n){if(!r)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=n&&s&&hA(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:r},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Gr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let r=e.dataTransfer.files;if(r&&r.length){let n=Array(r.length),i=0,s=()=>{++i==r.length&&Ng(t,e,n.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<r.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(n[o]=a.result),s()},a.readAsText(r[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ng(t,e,n,!0),!0}return!1},Gr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let r=kg?null:e.clipboardData;return r?(Ag(t,r.getData("text/plain")||r.getData("text/uri-text")),!0):(gA(t),!1)};function xA(t,e){let r=t.dom.parentNode;if(!r)return;let n=r.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),t.focus()},50)}function wA(t){let e=[],r=[],n=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),r.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),r.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}n=!0}return{text:e.join(t.lineBreak),ranges:r,linewise:n}}let lu=null;Gr.copy=Gr.cut=(t,e)=>{let{text:r,ranges:n,linewise:i}=wA(t.state);if(!r&&!i)return!1;lu=i?r:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=kg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(xA(t,r),!1)};const Rg=an.define();function Lg(t,e){let r=[];for(let n of t.facet(Qp)){let i=n(t,e);i&&r.push(i)}return r?t.update({effects:r,annotations:Rg.of(!0)}):null}function Bg(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let r=Lg(t.state,e);r?t.dispatch(r):t.update([])}},10)}Kr.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Bg(t)},Kr.blur=t=>{t.observer.clearSelectionRange(),Bg(t)},Kr.compositionstart=Kr.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Kr.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,be.chrome&&be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)},Kr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Gr.beforeinput=(t,e)=>{var r;let n;if(be.chrome&&be.android&&(n=wg.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return!1};const Fg=new Set;function SA(t){Fg.has(t)||(Fg.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const jg=["pre-wrap","normal","pre-line","break-spaces"];class Vg{constructor(e){this.lineWrapping=e,this.doc=Je.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,r){let n=this.doc.lineAt(r).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((r-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return jg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(r=!0,this.heightSamples[Math.floor(i*10)]=!0)}return r}refresh(e,r,n,i,s,o){let a=jg.indexOf(e)>-1,l=Math.round(r)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=r,this.charWidth=n,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class Wg{constructor(e,r){this.from=e,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class un{constructor(e,r,n,i,s){this.from=e,this.length=r,this.top=n,this.height=i,this._content=s}get type(){return typeof this._content=="number"?sr.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Zn?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new un(this.from,this.length+e.length,this.top,this.height+e.height,r)}}var tt=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(tt||(tt={}));const Va=.001;class Qt{constructor(e,r,n=2){this.length=e,this.height=r,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,r){this.height!=r&&(Math.abs(this.height-r)>Va&&(e.heightChanged=!0),this.height=r)}replace(e,r,n){return Qt.of(n)}decomposeLeft(e,r){r.push(this)}decomposeRight(e,r){r.push(this)}applyChanges(e,r,n,i){let s=this,o=n.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,n.setDoc(r),0,0),p=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,n,0,0));u+=d.from-l,l=d.from;let m=cu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new wr(0,0)}static of(e){if(e.length==1)return e[0];let r=0,n=e.length,i=0,s=0;for(;;)if(r==n)if(i>s*2){let a=e[r-1];a.break?e.splice(--r,1,a.left,null,a.right):e.splice(--r,1,a.left,a.right),n+=1+a.break,i-=a.size}else if(s>i*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[r++];a&&(i+=a.size)}else{let a=e[--n];a&&(s+=a.size)}let o=0;return e[r-1]==null?(o=1,r--):e[r]==null&&(o=1,n++),new kA(Qt.of(e.slice(0,r)),o,Qt.of(e.slice(n)))}}Qt.prototype.size=1;class $g extends Qt{constructor(e,r,n){super(e,r),this.deco=n}blockAt(e,r,n,i){return new un(i,this.length,n,this.height,this.deco||0)}lineAt(e,r,n,i,s){return this.blockAt(0,n,i,s)}forEachLine(e,r,n,i,s,o){e<=s+this.length&&r>=s&&o(this.blockAt(0,n,i,s))}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class wr extends $g{constructor(e,r){super(e,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,r,n,i){return new un(i,this.length,n,this.height,this.breaks)}replace(e,r,n){let i=n[0];return n.length==1&&(i instanceof wr||i instanceof Vt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Vt?i=new wr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Qt.of(n)}updateHeight(e,r=0,n=!1,i){return i&&i.from<=r&&i.more?this.setHeight(e,i.heights[i.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Vt extends Qt{constructor(e){super(e,0)}heightMetrics(e,r){let n=e.doc.lineAt(r).number,i=e.doc.lineAt(r+this.length).number,s=i-n+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:n,lastLine:i,perLine:o,perChar:a}}blockAt(e,r,n,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i);if(r.lineWrapping){let c=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=r.doc.lineAt(c),h=a+u.length*l,d=Math.max(n,e-h/2);return new un(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/a))),{from:u,length:h}=r.doc.line(s+c);return new un(u,h,n+a*c,a,0)}}lineAt(e,r,n,i,s){if(r==tt.ByHeight)return this.blockAt(e,n,i,s);if(r==tt.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(e);return new un(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new un(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,r,n,i,s,o){e=Math.max(e,s),r=Math.min(r,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=i;u<=r;){let d=n.doc.lineAt(u);if(u==e){let m=d.number-a;h+=l*m+c*(e-s-m)}let p=l+c*d.length;o(new un(d.from,d.length,h,p,0)),h+=p,u=d.to+1}}replace(e,r,n){let i=this.length-r;if(i>0){let s=n[n.length-1];s instanceof Vt?n[n.length-1]=new Vt(s.length+i):n.push(null,new Vt(i-1))}if(e>0){let s=n[0];s instanceof Vt?n[0]=new Vt(e+s.length):n.unshift(new Vt(e-1),null)}return Qt.of(n)}decomposeLeft(e,r){r.push(new Vt(e-1),null)}decomposeRight(e,r){r.push(null,new Vt(this.length-e-1))}updateHeight(e,r=0,n=!1,i){let s=r+this.length;if(i&&i.from<=r+this.length&&i.more){let o=[],a=Math.max(r,i.from),l=-1;for(i.from>r&&o.push(new Vt(i.from-r-1).updateHeight(e,r));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=Va&&(l=-2);let d=new wr(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Vt(s-a).updateHeight(e,a));let c=Qt.of(o);return(l<0||Math.abs(c.height-this.height)>=Va||Math.abs(l-this.heightMetrics(e,r).perLine)>=Va)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class kA extends Qt{constructor(e,r,n){super(e.length+r+n.length,e.height+n.height,r|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,r,n,i){let s=n+this.left.height;return e<s?this.left.blockAt(e,r,n,i):this.right.blockAt(e,r,s,i+this.left.length+this.break)}lineAt(e,r,n,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=r==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,r,n,i,s):this.right.lineAt(e,r,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=r==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,s).join(c)}forEachLine(e,r,n,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,r,n,i,s,o),r>=l&&this.right.forEachLine(e,r,n,a,l,o);else{let c=this.lineAt(l,tt.ByPos,n,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,s,o),c.to>=e&&c.from<=r&&o(c),r>c.to&&this.right.forEachLine(c.to+1,r,n,a,l,o)}}replace(e,r,n){let i=this.left.length+this.break;if(r<i)return this.balanced(this.left.replace(e,r,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,r-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of n)s.push(a);if(e>0&&Hg(s,o-1),r<this.length){let a=s.length;this.decomposeRight(r,s),Hg(s,a)}return Qt.of(s)}decomposeLeft(e,r){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,r);r.push(this.left),this.break&&(n++,e>=n&&r.push(null)),e>n&&this.right.decomposeLeft(e-n,r)}decomposeRight(e,r){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,r);e<n&&this.left.decomposeRight(e,r),this.break&&e<i&&r.push(null),r.push(this.right)}balanced(e,r){return e.size>2*r.size||r.size>2*e.size?Qt.of(this.break?[e,null,r]:[e,r]):(this.left=e,this.right=r,this.height=e.height+r.height,this.outdated=e.outdated||r.outdated,this.size=e.size+r.size,this.length=e.length+this.break+r.length,this)}updateHeight(e,r=0,n=!1,i){let{left:s,right:o}=this,a=r+s.length+this.break,l=null;return i&&i.from<=r+s.length&&i.more?l=s=s.updateHeight(e,r,n,i):s.updateHeight(e,r,n),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,n,i):o.updateHeight(e,a,n),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Hg(t,e){let r,n;t[e]==null&&(r=t[e-1])instanceof Vt&&(n=t[e+1])instanceof Vt&&t.splice(e-1,3,new Vt(r.length+1+n.length))}const AA=5;class cu{constructor(e,r){this.pos=e,this.oracle=r,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,r){if(this.lineStart>-1){let n=Math.min(r,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof wr?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new wr(n-this.pos,-1)),this.writtenTo=n,r>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(e,r,n){if(e<r||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=r-e;n.block?this.addBlock(new $g(o,i,n)):(o||s||i>=AA)&&this.addLineDeco(i,s,o)}else r>e&&this.span(e,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=r,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new wr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,r){let n=new Vt(r-e);return this.oracle.doc.lineAt(e).to==r&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof wr)return e;let r=new wr(0,-1);return this.nodes.push(r),r}addBlock(e){this.enterLine();let r=e.deco;r&&r.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,r&&r.endSide>0&&(this.covering=e)}addLineDeco(e,r,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=r,this.writtenTo=this.pos=this.pos+n}finish(e){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof wr)&&!this.isCovered?this.nodes.push(new wr(0,-1)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof wr&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,r,n,i){let s=new cu(n,e);return Qe.spans(r,n,i,s,0),s.finish(n)}}function CA(t,e,r){let n=new OA;return Qe.compare(t,e,r,n,0),n.changes}class OA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,r,n,i){(e<r||n&&n.heightRelevant||i&&i.heightRelevant)&&Zc(e,r,this.changes,5)}}function EA(t,e){let r=t.getBoundingClientRect(),n=t.ownerDocument,i=n.defaultView||window,s=Math.max(0,r.left),o=Math.min(i.innerWidth,r.right),a=Math.max(0,r.top),l=Math.min(i.innerHeight,r.bottom);for(let c=t.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=c==t.parentNode?d.bottom:Math.min(l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-r.left,right:Math.max(s,o)-r.left,top:a-(r.top+e),bottom:Math.max(a,l)-(r.top+e)}}function TA(t,e){let r=t.getBoundingClientRect();return{left:0,right:r.right-r.left,top:e,bottom:r.bottom-(r.top+e)}}class uu{constructor(e,r,n){this.from=e,this.to=r,this.size=n}static same(e,r){if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],s=r[n];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,r){return ke.replace({widget:new PA(this.size*(r?e.scaleY:e.scaleX),r)}).range(this.from,this.to)}}class PA extends ln{constructor(e,r){super(),this.size=e,this.vertical=r}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class zg{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ug,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ht.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=e.facet(Ra).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Vg(r),this.stateDeco=e.facet(ro).filter(n=>typeof n!="function"),this.heightMap=Qt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle.setDoc(e.doc),[new xr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ke.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:r}=this.state.selection;for(let n=0;n<=1;n++){let i=n?r.head:r.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Wa(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Ug:new DA(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:so(e,this.scaler))})}update(e,r=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ro).filter(u=>typeof u!="function");let i=e.changedRanges,s=xr.extendWithRanges(i,CA(n,this.stateDeco,e?e.changes:Pt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(r&&(r.range.head<l.from||r.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,r));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Zp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let r=e.contentDOM,n=window.getComputedStyle(r),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ht.RTL:ht.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=r.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let B=a.width/r.offsetWidth,I=a.height/r.offsetHeight;(B>.995&&B<1.005||!isFinite(B)||Math.abs(a.width-r.offsetWidth)<1)&&(B=1),(I>.995&&I<1.005||!isFinite(I)||Math.abs(a.height-r.offsetHeight)<1)&&(I=1),(this.scaleX!=B||this.scaleY!=I)&&(this.scaleX=B,this.scaleY=I,c|=8,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Tp(e.scrollDOM);let m=(this.printing?TA:EA)(r,this.paddingTop),y=m.top-this.pixelViewport.top,w=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let B=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(B)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:I,charWidth:W,textHeight:F}=e.docView.measureTextSize();o=I>0&&i.refresh(s,I,W,F,T/W,B),o&&(e.docView.minWidth=0,c|=8)}y>0&&w>0?u=Math.max(y,w):y<0&&w<0&&(u=Math.min(y,w)),i.heightChanged=!1;for(let I of this.viewports){let W=I.from==this.viewport.from?B:e.docView.measureVisibleLineHeights(I);this.heightMap=(o?Qt.empty().applyChanges(this.stateDeco,Je.empty,this.heightOracle,[new xr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new Wg(I.from,W))}i.heightChanged&&(c|=2)}let E=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,r){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Wa(i.lineAt(o-n*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-n)*1e3,tt.ByHeight,s,0,0).to);if(r){let{head:c}=r.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;r.y=="center"?d=(h.top+h.bottom)/2-u/2:r.y=="start"||r.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new Wa(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,r){let n=r.mapPos(e.from,-1),i=r.mapPos(e.to,1);return new Wa(this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:r},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(r,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(r==this.state.doc.length||s>=a+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,r){if(!e.length||r.empty)return e;let n=[];for(let i of e)r.touchesRange(i.from,i.to)||n.push(new uu(r.mapPos(i.from),r.mapPos(i.to),i.size));return n}ensureLineGaps(e,r){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=ht.LTR&&!n)return[];let a=[],l=(c,u,h,d)=>{if(u-c<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let w of m)if(w>c&&w<u){l(c,w-10,h,d),l(w+10,u,h,d);return}let y=IA(e,w=>w.from>=h.from&&w.to<=h.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-u)<s&&!m.some(A=>w.from<A&&w.to>A));if(!y){if(u<h.to&&r&&n&&r.visibleRanges.some(w=>w.from<=u&&w.to>=u)){let w=r.moveToLineBoundary(se.cursor(u),!1,!0).head;w>c&&(u=w)}y=new uu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=MA(c.from,c.to,this.stateDeco);if(u.total<o)continue;let h=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,w;if(h!=null){let A=Ha(u,h),T=((this.visibleBottom-this.visibleTop)/2+m)/c.height;y=A-T,w=A+T}else y=(this.visibleTop-c.top-m)/c.height,w=(this.visibleBottom-c.top+m)/c.height;d=$a(u,y),p=$a(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=Ha(u,h),E=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-E,A=T+E}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=$a(u,w),p=$a(u,A)}d>c.from&&l(c.from,d,c,u),p<c.to&&l(p,c.to,c,u)}return a}gapSize(e,r,n,i){let s=Ha(i,n)-Ha(i,r);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){uu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ke.set(e.map(r=>r.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let r=[];Qe.spans(e,this.viewport.from,this.viewport.to,{span(i,s){r.push({from:i,to:s})},point(){}},20);let n=r.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=r[s].from||i.to!=r[s].to);return this.visibleRanges=r,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(r=>r.from<=e&&r.to>=e)||so(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return so(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let r=this.lineBlockAtHeight(e+8);return r.from>=this.viewport.from||this.viewportLines[0].top-e>200?r:this.viewportLines[0]}elementAtHeight(e){return so(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Wa{constructor(e,r){this.from=e,this.to=r}}function MA(t,e,r){let n=[],i=t,s=0;return Qe.spans(r,t,e,{span(){},point(o,a){o>i&&(n.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function $a({total:t,ranges:e},r){if(r<=0)return e[0].from;if(r>=1)return e[e.length-1].to;let n=Math.floor(t*r);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(n<=a)return s+n;n-=a}}function Ha(t,e){let r=0;for(let{from:n,to:i}of t.ranges){if(e<=i){r+=e-n;break}r+=i-n}return r/t.total}function IA(t,e){for(let r of t)if(e(r))return r}const Ug={toDOM(t){return t},fromDOM(t){return t},scale:1};class DA{constructor(e,r,n){let i=0,s=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=r.lineAt(a,tt.ByPos,e,0,0).top,u=r.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(r.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let r=0,n=0,i=0;;r++){let s=r<this.viewports.length?this.viewports[r]:null;if(!s||e<s.top)return i+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,i=s.domBottom}}fromDOM(e){for(let r=0,n=0,i=0;;r++){let s=r<this.viewports.length?this.viewports[r]:null;if(!s||e<s.domTop)return n+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,i=s.domBottom}}}function so(t,e){if(e.scale==1)return t;let r=e.toDOM(t.top),n=e.toDOM(t.bottom);return new un(t.from,t.length,r,n-r,Array.isArray(t._content)?t._content.map(i=>so(i,e)):t._content)}const za=pe.define({combine:t=>t.join(" ")}),fu=pe.define({combine:t=>t.indexOf(!0)>-1}),hu=Yn.newName(),Gg=Yn.newName(),Kg=Yn.newName(),Yg={"&light":"."+Gg,"&dark":"."+Kg};function du(t,e,r){return new Yn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return t;if(!r||!r[i])throw new RangeError(`Unsupported selector: ${i}`);return r[i]}):t+" "+n}})}const NA=du("."+hu,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Yg),oo="\uFFFF";class RA{constructor(e,r){this.points=e,this.text="",this.lineSeparator=r.facet(Ve.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=oo}readRange(e,r){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==r)break;let a=it.get(i),l=it.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Jg(i))||Jg(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(n,r),this}readTextNode(e){let r=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,r.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=r.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=i.exec(r))&&(s=a.index,o=a[0].length),this.append(r.slice(n,s<0?r.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let r=it.get(e),n=r&&r.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,r){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==r&&(n.pos=this.text.length)}findPointInside(e,r){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(LA(e,n.node,n.offset)?r:0))}}function LA(t,e,r){for(;;){if(!e||r<On(e))return!1;if(e==t)return!0;r=Zs(e)+1,e=e.parentNode}}function Jg(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Qg{constructor(e,r){this.node=e,this.offset=r,this.pos=-1}}class BA{constructor(e,r,n,i){this.typeOver=i,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=e.docView.domBoundsAround(r,n,0))){let a=s||o?[]:VA(e),l=new RA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=WA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Hc(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Hc(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=se.single(c,l)}}}function Xg(t,e){let r,{newSel:n}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||be.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=jA(t.state.doc.sliceString(o,a,oo),e.text,l-o,c);u&&(be.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==oo+oo&&u.toB--,r={from:o+u.from,to:o+u.toA,insert:Je.of(e.text.slice(u.from,u.toB).split(oo))})}else n&&(!t.hasFocus&&t.state.facet(Na)||n.main.eq(i))&&(n=null);if(!r&&!n)return!1;if(!r&&e.typeOver&&!i.empty&&n&&n.main.empty?r={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:r&&r.from>=i.from&&r.to<=i.to&&(r.from!=i.from||r.to!=i.to)&&i.to-i.from-(r.to-r.from)<=4?r={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,r.from).append(r.insert).append(t.state.doc.slice(r.to,i.to))}:(be.mac||be.android)&&r&&r.from==r.to&&r.from==i.head-1&&/^\. ?$/.test(r.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(n&&r.insert.length==2&&(n=se.single(n.main.anchor-1,n.main.head-1)),r={from:i.from,to:i.to,insert:Je.of([" "])}):be.chrome&&r&&r.from==r.to&&r.from==i.head&&r.insert.toString()==`
|
|
149
|
+
`&&t.lineWrapping&&(n&&(n=se.single(n.main.anchor-1,n.main.head-1)),r={from:i.from,to:i.to,insert:Je.of([" "])}),r){if(be.ios&&t.inputState.flushIOSKey()||be.android&&(r.from==i.from&&r.to==i.to&&r.insert.length==1&&r.insert.lines==2&&qi(t.contentDOM,"Enter",13)||(r.from==i.from-1&&r.to==i.to&&r.insert.length==0||s==8&&r.insert.length<r.to-r.from&&r.to>i.head)&&qi(t.contentDOM,"Backspace",8)||r.from==i.from&&r.to==i.to+1&&r.insert.length==0&&qi(t.contentDOM,"Delete",46)))return!0;let o=r.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=FA(t,r,n));return t.state.facet(Jp).some(c=>c(t,r.from,r.to,o,l))||t.dispatch(l()),!0}else if(n&&!n.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function FA(t,e,r){let n,i=t.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!r||r.main.empty&&r.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=i.changes(e),l=r&&r.main.to<=a.newLength?r.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),u,h=r&&hg(t,r.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=t.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let y=m.to-d,w=y-c.length;if(m.to-m.from!=p||t.state.sliceDoc(w,y)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let A=i.changes({from:w,to:y,insert:e.insert}),T=m.to-s.to;return{changes:A,range:l?se.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):m.map(A)}})}else n={changes:a,selection:l&&i.selection.replaceRange(l)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:o,scrollIntoView:!0})}function jA(t,e,r,n){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.length<e.length){let l=r<=s&&r>=o?s-r:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function VA(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}=t.observer.selectionRange;return r&&(e.push(new Qg(r,n)),(i!=r||s!=n)&&e.push(new Qg(i,s))),e}function WA(t,e){if(t.length==0)return null;let r=t[0].pos,n=t.length==2?t[1].pos:r;return r>-1&&n>-1?se.single(r+e,n+e):null}const $A={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},pu=be.ie&&be.ie_version<=11;class HA{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Pk,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(r=>{for(let n of r)this.queue.push(n);(be.ie&&be.ie_version<=11||be.ios&&e.composing)&&r.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),pu&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(r=>{r.length>0&&r[r.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((r,n)=>r!=e[n]))){this.gapIntersection.disconnect();for(let r of e)this.gapIntersection.observe(r);this.gaps=e}}onSelectionChange(e){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Na)?n.root.activeElement!=this.dom:!Ea(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){r||(this.selectionChanged=!1);return}(be.ie&&be.ie_version<=11||be.android&&be.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ta(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,r=be.safari&&e.root.nodeType==11&&Ck(this.dom.ownerDocument)==this.dom&&zA(this.view)||Oa(e.root);if(!r||this.selectionRange.eq(r))return!1;let n=Ea(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Ik(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,r){this.selectionRange.set(e.node,e.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,r=null;for(let n=this.dom;n;)if(n.nodeType==1)!r&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:r||(r=this.scrollTargets.slice(0,e)),r&&r.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,e)),r){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=r)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,$A),pu&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),pu&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,r){var n;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&qi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let r=-1,n=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),r==-1?{from:r,to:n}=o:(r=Math.min(o.from,r),n=Math.max(o.to,n)))}return{from:r,to:n,typeOver:i}}readChange(){let{from:e,to:r,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Ea(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new BA(this.view,e,r,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let r=this.readChange();if(!r)return this.view.requestMeasure(),!1;let n=this.view.state,i=Xg(this.view,r);return this.view.state==n&&this.view.update([]),i}readMutation(e){let r=this.view.docView.nearest(e.target);if(!r||r.ignoreMutation(e))return null;if(r.markDirty(e.type=="attributes"),e.type=="attributes"&&(r.flags|=4),e.type=="childList"){let n=Zg(r,e.previousSibling||e.target.previousSibling,-1),i=Zg(r,e.nextSibling||e.target.nextSibling,1);return{from:n?r.posAfter(n):r.posAtStart,to:i?r.posBefore(i):r.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,r,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Zg(t,e,r){for(;e;){let n=it.get(e);if(n&&n.parent==t)return n;let i=e.parentNode;e=i!=t.dom?i:r>0?e.nextSibling:e.previousSibling}return null}function zA(t){let e=null;function r(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),!e)return null;let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Ta(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class de{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(n=>n.forEach(i=>r(i,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Mk(e.parent)||document,this.viewState=new zg(e.state||Ve.create(e)),e.scrollTo&&e.scrollTo.is(Da)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(to).map(n=>new qc(n));for(let n of this.plugins)n.update(this);this.observer=new HA(this),this.inputState=new oA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ug(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let r=e.length==1&&e[0]instanceof Mt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(r,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,n=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Rg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Lg(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Ve.phrases)!=this.state.facet(Ve.phrases))return this.setState(s);i=La.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new ts(p.empty?p:se.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Da)&&(h=p.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Ua.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),r=this.docView.update(i),this.state.facet(no)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(r,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(za)!=i.state.facet(za)&&(this.viewState.mustMeasureContent=!0),(r||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(_c))try{d(i)}catch(p){br(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Xg(this,u)&&c.force&&qi(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let r=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new zg(e),this.plugins=e.facet(to).map(n=>new qc(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new ug(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(e){let r=e.startState.facet(to),n=e.state.facet(to);if(r!=n){let i=[];for(let s of n){let o=r.indexOf(s);if(o<0)i.push(new qc(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);r!=n&&this.inputState.ensureHandlers(this.plugins)}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let r=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Tp(n))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(m){return br(this.state,m),_g}}),h=La.create(this,this.state,[]),d=!1;h.flags|=l,r?r.flags|=l:r=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h));for(let p=0;p<c.length;p++)if(u[p]!=_g)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){br(this.state,m)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let a of this.state.facet(_c))a(r)}get themeClasses(){return hu+" "+(this.state.facet(fu)?Kg:Gg)+" "+this.state.facet(za)}updateAttrs(){let e=qg(this,_p,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Na)?"true":"false",class:"cm-content",style:`${be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),qg(this,Ra,r);let n=this.observer.ignore(()=>{let i=Xc(this.contentDOM,this.contentAttrs,r),s=Xc(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=r,n}showAnnouncements(e){let r=!0;for(let n of e)for(let i of n.effects)if(i.is(de.announce)){r&&(this.announceDOM.textContent=""),r=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(no);let e=this.state.facet(de.cspNonce);Yn.mount(this.root,this.styleModules.concat(NA).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===e.key){this.measureRequests[r]=e;return}}this.measureRequests.push(e)}}plugin(e){let r=this.pluginMap.get(e);return(r===void 0||r&&r.spec!=e)&&this.pluginMap.set(e,r=this.plugins.find(n=>n.spec==e)||null),r&&r.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,r,n){return au(this,e,bg(this,e,r,n))}moveByGroup(e,r){return au(this,e,bg(this,e,r,n=>iA(this,e.head,n)))}moveToLineBoundary(e,r,n=!0){return nA(this,e,r,n)}moveVertically(e,r,n){return au(this,e,sA(this,e,r,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,r=0){return this.docView.posFromDOM(e,r)}posAtCoords(e,r=!0){return this.readMeasured(),vg(this,e,r)}coordsAtPos(e,r=1){this.readMeasured();let n=this.docView.coordsAt(e,r);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[_n.find(s,e-i.from,-1,r)];return Pa(n,o.dir==ht.LTR==r>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Xp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>UA)return ag(e.length);let r=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==r&&(s.fresh||sg(s.isolates,n=eg(this,e.from,e.to))))return s.order;n||(n=eg(this,e.from,e.to));let i=og(e.text,r,n);return this.bidiCache.push(new Ua(e.from,e.to,r,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||be.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Cp(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,r={}){return Da.of(new ts(typeof e=="number"?se.cursor(e):e,r.y,r.x,r.yMargin,r.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:r}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Da.of(new ts(se.cursor(n.from),"start","start",n.top-e,r,!0))}static domEventHandlers(e){return ft.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ft.define(()=>({}),{eventObservers:e})}static theme(e,r){let n=Yn.newName(),i=[za.of(n),no.of(du(`.${n}`,e))];return r&&r.dark&&i.push(fu.of(!0)),i}static baseTheme(e){return xi.lowest(no.of(du("."+hu,e,Yg)))}static findFromDOM(e){var r;let n=e.querySelector(".cm-content"),i=n&&it.get(n)||it.get(e);return((r=i?.rootView)===null||r===void 0?void 0:r.view)||null}}de.styleModule=no,de.inputHandler=Jp,de.focusChangeEffect=Qp,de.perLineTextDirection=Xp,de.exceptionSink=Yp,de.updateListener=_c,de.editable=Na,de.mouseSelectionStyle=Kp,de.dragMovesSelection=Gp,de.clickAddsSelectionRange=Up,de.decorations=ro,de.atomicRanges=eu,de.bidiIsolatedRanges=qp,de.scrollMargins=tg,de.darkTheme=fu,de.cspNonce=pe.define({combine:t=>t.length?t[0]:""}),de.contentAttributes=Ra,de.editorAttributes=_p,de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"}),de.announce=Ae.define();const UA=4096,_g={};class Ua{constructor(e,r,n,i,s,o){this.from=e,this.to=r,this.dir=n,this.isolates=i,this.fresh=s,this.order=o}static update(e,r){if(r.empty&&!e.some(s=>s.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ht.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!r.touchesRange(o.from,o.to)&&n.push(new Ua(r.mapPos(o.from,1),r.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function qg(t,e,r){for(let n=t.state.facet(e),i=n.length-1;i>=0;i--){let s=n[i],o=typeof s=="function"?s(t):s;o&&Jc(o,r)}return r}const GA=be.mac?"mac":be.windows?"win":be.linux?"linux":"key";function KA(t,e){const r=t.split(/-(?!$)/);let n=r[r.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let l=0;l<r.length-1;++l){const c=r[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ga(t,e,r){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),r!==!1&&e.shiftKey&&(t="Shift-"+t),t}const YA=xi.default(de.domEventHandlers({keydown(t,e){return rm(tm(e.state),t,e,"editor")}})),ao=pe.define({enables:YA}),em=new WeakMap;function tm(t){let e=t.facet(ao),r=em.get(e);return r||em.set(e,r=XA(e.reduce((n,i)=>n.concat(i),[]))),r}function JA(t,e,r){return rm(tm(t.state),e,t,r)}let qn=null;const QA=4e3;function XA(t,e=GA){let r=Object.create(null),n=Object.create(null),i=(o,a)=>{let l=n[o];if(l==null)n[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var h,d;let p=r[o]||(r[o]=Object.create(null)),m=a.split(/ (?!$)/).map(A=>KA(A,e));for(let A=1;A<m.length;A++){let T=m.slice(0,A).join(" ");i(T,!0),p[T]||(p[T]={preventDefault:!0,stopPropagation:!1,run:[E=>{let B=qn={view:E,prefix:T,scope:o};return setTimeout(()=>{qn==B&&(qn=null)},QA),!0}]})}let y=m.join(" ");i(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=r[c]||(r[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let h in u)u[h].run.push(o.any)}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return r}function rm(t,e,r,n){let i=Ak(e),s=Ft(i,0),o=Lr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;qn&&qn.view==r&&qn.scope==n&&(a=qn.prefix+" ",Sg.indexOf(e.keyCode)<0&&(c=!0,qn=null));let h=new Set,d=w=>{if(w){for(let A of w.run)if(!h.has(A)&&(h.add(A),A(r,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=t[n],m,y;return p&&(d(p[a+Ga(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(be.windows&&e.ctrlKey&&e.altKey)&&(m=Jn[e.keyCode])&&m!=i?(d(p[a+Ga(m,e,!0)])||e.shiftKey&&(y=Xs[e.keyCode])!=i&&y!=m&&d(p[a+Ga(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ga(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class lo{constructor(e,r,n,i,s){this.className=e,this.left=r,this.top=n,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,r){return r.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,r,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=nm(e);return[new lo(r,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return ZA(e,r,n)}}function nm(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ht.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function im(t,e,r){let n=se.cursor(e);return{from:Math.max(r.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(r.to,t.moveToLineBoundary(n,!0,!0).from),type:sr.Text}}function ZA(t,e,r){if(r.to<=t.viewport.from||r.from>=t.viewport.to)return[];let n=Math.max(r.from,t.viewport.from),i=Math.min(r.to,t.viewport.to),s=t.textDirection==ht.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=nm(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=ou(t,n),m=ou(t,i),y=p.type==sr.Text?p:null,w=m.type==sr.Text?m:null;if(y&&(t.lineWrapping||p.widgetLineBreaks)&&(y=im(t,n,y)),w&&(t.lineWrapping||m.widgetLineBreaks)&&(w=im(t,i,w)),y&&w&&y.from==w.from)return T(E(r.from,r.to,y));{let I=y?E(r.from,null,y):B(p,!1),W=w?E(null,r.to,w):B(m,!0),F=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&I.bottom+t.defaultLineHeight/2<W.top?F.push(A(h,I.bottom,d,W.top)):I.bottom<W.top&&t.elementAtHeight((I.bottom+W.top)/2).type==sr.Text&&(I.bottom=W.top=(I.bottom+W.top)/2),T(I).concat(F).concat(T(W))}function A(I,W,F,_){return new lo(e,I-l.left,W-l.top-.01,F-I,_-W+.01)}function T({top:I,bottom:W,horizontal:F}){let _=[];for(let j=0;j<F.length;j+=2)_.push(A(F[j],I,F[j+1],W));return _}function E(I,W,F){let _=1e9,j=-1e9,U=[];function Y(he,xe,Fe,we,Ee){let Ue=t.coordsAtPos(he,he==F.to?-2:2),Ie=t.coordsAtPos(Fe,Fe==F.from?2:-2);!Ue||!Ie||(_=Math.min(Ue.top,Ie.top,_),j=Math.max(Ue.bottom,Ie.bottom,j),Ee==ht.LTR?U.push(s&&xe?h:Ue.left,s&&we?d:Ie.right):U.push(!s&&we?h:Ie.left,!s&&xe?d:Ue.right))}let re=I??F.from,ce=W??F.to;for(let he of t.visibleRanges)if(he.to>re&&he.from<ce)for(let xe=Math.max(he.from,re),Fe=Math.min(he.to,ce);;){let we=t.state.doc.lineAt(xe);for(let Ee of t.bidiSpans(we)){let Ue=Ee.from+we.from,Ie=Ee.to+we.from;if(Ue>=Fe)break;Ie>xe&&Y(Math.max(Ue,xe),I==null&&Ue<=re,Math.min(Ie,Fe),W==null&&Ie>=ce,Ee.dir)}if(xe=we.to+1,xe>=Fe)break}return U.length==0&&Y(re,I==null,ce,W==null,t.textDirection),{top:_,bottom:j,horizontal:U}}function B(I,W){let F=a.top+(W?I.top:I.bottom);return{top:F,bottom:F,horizontal:[]}}}function _A(t,e){return t.constructor==e.constructor&&t.eq(e)}class qA{constructor(e,r){this.view=e,this.layer=r,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,e)}update(e){e.startState.facet(Ka)!=e.state.facet(Ka)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let r=0,n=e.facet(Ka);for(;r<n.length&&n[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:r}=this.view;(e!=this.scaleX||r!=this.scaleY)&&(this.scaleX=e,this.scaleY=r,this.dom.style.transform=`scale(${1/e}, ${1/r})`)}draw(e){if(e.length!=this.drawn.length||e.some((r,n)=>!_A(r,this.drawn[n]))){let r=this.dom.firstChild,n=0;for(let i of e)i.update&&r&&i.constructor&&this.drawn[n].constructor&&i.update(r,this.drawn[n])?(r=r.nextSibling,n++):this.dom.insertBefore(i.draw(),r);for(;r;){let i=r.nextSibling;r.remove(),r=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ka=pe.define();function sm(t){return[ft.define(e=>new qA(e,t)),Ka.of(t)]}const om=!be.ios,rs=pe.define({combine(t){return Ur(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,r)=>Math.min(e,r),drawRangeCursor:(e,r)=>e||r})}});function eC(t={}){return[rs.of(t),tC,rC,nC,Zp.of(!0)]}function rD(t){return t.facet(rs)}function am(t){return t.startState.facet(rs)!=t.state.facet(rs)}const tC=sm({above:!0,markers(t){let{state:e}=t,r=e.facet(rs),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||om:r.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:se.cursor(i.head,i.head>i.anchor?-1:1);for(let l of lo.forRange(t,o,a))n.push(l)}}return n},update(t,e){t.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=am(t);return r&&lm(t.state,e),t.docChanged||t.selectionSet||r},mount(t,e){lm(e.state,t)},class:"cm-cursorLayer"});function lm(t,e){e.style.animationDuration=t.facet(rs).cursorBlinkRate+"ms"}const rC=sm({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:lo.forRange(t,"cm-selectionBackground",e)).reduce((e,r)=>e.concat(r))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||am(t)},class:"cm-selectionLayer"}),cm={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};om&&(cm[".cm-line"].caretColor="transparent !important");const nC=xi.highest(de.theme(cm)),um=Ae.define({map(t,e){return t==null?null:e.mapPos(t)}}),co=At.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((r,n)=>n.is(um)?n.value:r,t)}}),iC=ft.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let r=t.state.field(co);r==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(co)!=r||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(co),r=e!=null&&t.coordsAtPos(e);if(!r)return null;let n=t.scrollDOM.getBoundingClientRect();return{left:r.left-n.left+t.scrollDOM.scrollLeft*t.scaleX,top:r.top-n.top+t.scrollDOM.scrollTop*t.scaleY,height:r.bottom-r.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:r}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/r+"px",this.cursor.style.height=t.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(co)!=t&&this.view.dispatch({effects:um.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function sC(){return[co,iC]}function fm(t,e,r,n,i){e.lastIndex=0;for(let s=t.iterRange(r,n),o=r,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function oC(t,e){let r=t.visibleRanges;if(r.length==1&&r[0].from==t.viewport.from&&r[0].to==t.viewport.to)return r;let n=[];for(let{from:i,to:s}of r)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}class gu{constructor(e){const{regexp:r,decoration:n,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let r=new Kn,n=r.add.bind(r);for(let{from:i,to:s}of oC(e,this.maxLength))fm(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,n));return r.finish()}updateDeco(e,r){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(n=Math.min(a,n),i=Math.max(l,i))}),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,r.map(e.changes),n,i):r}updateRange(e,r,n,i){for(let s of e.visibleRanges){let o=Math.max(s.from,n),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],p,m=(y,w,A)=>d.push(A.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else fm(e.state.doc,this.regexp,u,h,(y,w)=>this.addMatch(w,e,y,m));r=r.update({filterFrom:u,filterTo:h,filter:(y,w)=>y<u||w>h,add:d})}}return r}}const mu=/x/.unicode!=null?"gu":"g",aC=new RegExp(`[\0-\b
|
|
150
|
+
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,mu),lC={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let vu=null;function cC(){var t;if(vu==null&&typeof document<"u"&&document.body){let e=document.body.style;vu=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return vu||!1}const Ya=pe.define({combine(t){let e=Ur(t,{render:null,specialChars:aC,addSpecialChars:null});return(e.replaceTabs=!cC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,mu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,mu)),e}});function uC(t={}){return[Ya.of(t),fC()]}let hm=null;function fC(){return hm||(hm=ft.fromClass(class{constructor(t){this.view=t,this.decorations=ke.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ya)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new gu({regexp:t.specialChars,decoration:(e,r,n)=>{let{doc:i}=r.state,s=Ft(e[0],0);if(s==9){let o=i.lineAt(n),a=r.state.tabSize,l=Xi(o.text,a,n-o.from);return ke.replace({widget:new gC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ke.replace({widget:new pC(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ya);t.startState.facet(Ya)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const hC="\u2022";function dC(t){return t>=32?hC:t==10?"\u2424":String.fromCharCode(9216+t)}class pC extends ln{constructor(e,r){super(),this.options=e,this.code=r}eq(e){return e.code==this.code}toDOM(e){let r=dC(this.code),n=e.state.phrase("Control character")+" "+(lC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,r);if(i)return i;let s=document.createElement("span");return s.textContent=r,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class gC extends ln{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const dm=null;function nD(){return[dm,Ra.of(t=>{var e;return((e=t.plugin(dm))===null||e===void 0?void 0:e.attrs)||null})]}function mC(){return yC}const vC=ke.line({class:"cm-activeLine"}),yC=ft.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,r=[];for(let n of t.state.selection.ranges){let i=t.lineBlockAt(n.head);i.from>e&&(r.push(vC.range(i.from)),e=i.from)}return ke.set(r)}},{decorations:t=>t.decorations});class bC extends ln{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let r=e.firstChild?Zi(e.firstChild):[];if(!r.length)return null;let n=window.getComputedStyle(e.parentNode),i=Pa(r[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function xC(t){return ft.fromClass(class{constructor(e){this.view=e,this.placeholder=t?ke.set([ke.widget({widget:new bC(t),side:1}).range(0)]):ke.none}get decorations(){return this.view.state.doc.length?ke.none:this.placeholder}},{decorations:e=>e.decorations})}const yu=2e3;function wC(t,e,r){let n=Math.min(e.line,r.line),i=Math.max(e.line,r.line),s=[];if(e.off>yu||r.off>yu||e.col<0||r.col<0){let o=Math.min(e.off,r.off),a=Math.max(e.off,r.off);for(let l=n;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(se.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,r.col),a=Math.max(e.col,r.col);for(let l=n;l<=i;l++){let c=t.doc.line(l),u=jc(c.text,o,t.tabSize,!0);if(u<0)s.push(se.cursor(c.to));else{let h=jc(c.text,a,t.tabSize);s.push(se.range(c.from+u,c.from+h))}}}return s}function SC(t,e){let r=t.coordsAtPos(t.viewport.from);return r?Math.round(Math.abs((r.left-e)/t.defaultCharacterWidth)):-1}function pm(t,e){let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(r),i=r-n.from,s=i>yu?-1:i==n.length?SC(t,e.clientX):Xi(n.text,t.state.tabSize,r-n.from);return{line:n.number,col:s,off:i}}function kC(t,e){let r=pm(t,e),n=t.state.selection;return r?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(r.line).from),o=i.state.doc.lineAt(s);r={line:o.number,col:r.col,off:Math.min(r.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=pm(t,i);if(!a)return n;let l=wC(t.state,r,a);return l.length?o?se.create(l.concat(n.ranges)):se.create(l):n}}:null}function AC(t){let e=t?.eventFilter||(r=>r.altKey&&r.button==0);return de.mouseSelectionStyle.of((r,n)=>e(n)?kC(r,n):null)}const CC={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},OC={style:"cursor: crosshair"};function EC(t={}){let[e,r]=CC[t.key||"Alt"],n=ft.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||r(i))},keyup(i){(i.keyCode==e||!r(i))&&this.set(!1)},mousemove(i){this.set(r(i))}}});return[n,de.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?OC:null})]}const uo="-10000px";class gm{constructor(e,r,n){this.facet=r,this.createTooltipView=n,this.input=e.state.facet(r),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(e,r){var n;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=r?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=r[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(l.dom.remove(),(n=l.destroy)===null||n===void 0||n.call(l));return r&&(a.forEach((l,c)=>r[c]=l),r.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function iD(t={}){return Ja.of(t)}function TC(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ja=pe.define({combine:t=>{var e,r,n;return{position:be.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((r=t.find(i=>i.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((n=t.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||TC}}}),mm=new WeakMap,bu=ft.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Ja);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new gm(t,Qa,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let r=e||t.geometryChanged,n=t.state.facet(Ja);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",e.dom.appendChild(r)}return e.dom.style.position=this.position,e.dom.style.top=uo,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,r=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(be.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(this.view.scaleX!=1||this.view.scaleY!=1)n=!0;else if(i.style.top==uo&&i.style.left=="0px"){let s=i.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,r=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:r}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ja).tooltipSpace(this.view),scaleX:e,scaleY:r,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:r,space:n,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=t.pos[a],d=t.size[a];if(!h||h.bottom<=Math.max(r.top,n.top)||h.top>=Math.min(r.bottom,n.bottom)||h.right<Math.max(r.left,n.left)-.1||h.left>Math.min(r.right,n.right)+.1){u.style.top=uo;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=mm.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||MC,T=this.view.textDirection==ht.LTR,E=d.width>n.right-n.left?T?n.left:n.right-d.width:T?Math.min(h.left-(p?14:0)+A.x,n.right-y):Math.max(n.left,h.left-y+(p?14:0)-A.x),B=this.above[a];!l.strictSide&&(B?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&B==n.bottom-h.bottom>h.top-n.top&&(B=this.above[a]=!B);let I=(B?h.top-n.top:n.bottom-h.bottom)-m;if(I<w&&c.resize!==!1){if(I<this.view.defaultLineHeight){u.style.top=uo;continue}mm.set(c,w),u.style.height=(w=I)/s+"px"}else u.style.height&&(u.style.height="");let W=B?h.top-w-m-A.y:h.bottom+m+A.y,F=E+y;if(c.overlap!==!0)for(let _ of o)_.left<F&&_.right>E&&_.top<W+w&&_.bottom>W&&(W=B?_.top-w-2-m:_.bottom+m+2);if(this.position=="absolute"?(u.style.top=(W-t.parent.top)/s+"px",u.style.left=(E-t.parent.left)/i+"px"):(u.style.top=W/s+"px",u.style.left=E/i+"px"),p){let _=h.left+(T?A.x:-A.x)-(E+14-7);p.style.left=_/i+"px"}c.overlap!==!0&&o.push({left:E,top:W,right:F,bottom:W+w}),u.classList.toggle("cm-tooltip-above",B),u.classList.toggle("cm-tooltip-below",!B),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=uo}},{eventObservers:{scroll(){this.maybeMeasure()}}}),PC=de.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),MC={x:0,y:0},Qa=pe.define({enables:[bu,PC]}),fo=pe.define();class xu{static create(e){return new xu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new gm(e,fo,r=>this.createHostedView(r))}createHostedView(e){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(r.dom),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let r of this.manager.tooltipViews)r.mount&&r.mount(e);this.mounted=!0}positioned(e){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let r of this.manager.tooltipViews)(e=r.destroy)===null||e===void 0||e.call(r)}passProp(e){let r;for(let n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const IC=Qa.compute([fo],t=>{let e=t.facet(fo).filter(r=>r);return e.length===0?null:{pos:Math.min(...e.map(r=>r.pos)),end:Math.max(...e.filter(r=>r.end!=null).map(r=>r.end)),create:xu.create,above:e[0].above,arrow:e.some(r=>r.arrow)}});class DC{constructor(e,r,n,i,s){this.view=e,this.source=r,this.field=n,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:r}=this,n=e.docView.nearest(r.target);if(!n)return;let i,s=1;if(n instanceof Qn)i=n.posAtStart;else{if(i=e.posAtCoords(r),i==null)return;let a=e.coordsAtPos(i);if(!a||r.y<a.top||r.y>a.bottom||r.x<a.left-e.defaultCharacterWidth||r.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ht.RTL?-1:1;s=r.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>br(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}mousemove(e){var r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let n=this.active;if(n&&!vm(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,s=(r=n?.end)!==null&&r!==void 0?r:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!NC(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!vm(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function vm(t){for(let e=t;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function NC(t,e,r,n,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:n,y:i},!1);return l>=e&&l<=r}function RC(t,e={}){let r=Ae.define(),n=At.define({create(){return null},update(i,s){if(i&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,i)))return null;if(i&&s.docChanged){let o=s.changes.mapPos(i.pos,-1,ir.TrackDel);if(o==null)return null;let a=Object.assign(Object.create(null),i);a.pos=o,i.end!=null&&(a.end=s.changes.mapPos(i.end)),i=a}for(let o of s.effects)o.is(r)&&(i=o.value),o.is(LC)&&(i=null);return i},provide:i=>fo.from(i)});return[n,ft.define(i=>new DC(i,t,n,r,e.hoverTime||300)),IC]}function ym(t,e){let r=t.plugin(bu);if(!r)return null;let n=r.manager.tooltips.indexOf(e);return n<0?null:r.manager.tooltipViews[n]}function sD(t){return t.facet(fo).some(e=>e)}const LC=Ae.define(),oD=null;function aD(t){let e=t.plugin(bu);e&&e.maybeMeasure()}const wu=pe.define({combine(t){let e,r;for(let n of t)e=e||n.topContainer,r=r||n.bottomContainer;return{topContainer:e,bottomContainer:r}}});function lD(t){return t?[wu.of(t)]:[]}function ho(t,e){let r=t.plugin(bm),n=r?r.specs.indexOf(e):-1;return n>-1?r.panels[n]:null}const bm=ft.fromClass(class{constructor(t){this.input=t.state.facet(po),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(t));let e=t.state.facet(wu);this.top=new Xa(t,!0,e.topContainer),this.bottom=new Xa(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(t){let e=t.state.facet(wu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Xa(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Xa(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=t.state.facet(po);if(r!=this.input){let n=r.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let n of this.panels)n.update&&n.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>de.scrollMargins.of(e=>{let r=e.plugin(t);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class Xa{constructor(e,r,n){this.view=e,this.top=r,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let r of this.panels)r.destroy&&e.indexOf(r)<0&&r.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let e=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;e!=r.dom;)e=xm(e);e=e.nextSibling}else this.dom.insertBefore(r.dom,e);for(;e;)e=xm(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function xm(t){let e=t.nextSibling;return t.remove(),e}const po=pe.define({enables:bm});class fn extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fn.prototype.elementClass="",fn.prototype.toDOM=void 0,fn.prototype.mapMode=ir.TrackBefore,fn.prototype.startSide=fn.prototype.endSide=-1,fn.prototype.point=!0;const Za=pe.define(),BC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Qe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},go=pe.define();function wm(t){return[Sm(),go.of(Object.assign(Object.assign({},BC),t))]}const Su=pe.define({combine:t=>t.some(e=>e)});function Sm(t){let e=[FC];return t&&t.fixed===!1&&e.push(Su.of(!0)),e}const FC=ft.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(go).map(e=>new Am(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(Su),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,r=t.view.viewport,n=Math.min(e.to,r.to)-Math.max(e.from,r.from);this.syncGutters(n<(r.to-r.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Su)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let r=Qe.iter(this.view.state.facet(Za),this.view.viewport.from),n=[],i=this.gutters.map(s=>new jC(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==sr.Text&&o){ku(r,n,a.from);for(let l of i)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==sr.Text){ku(r,n,s.from);for(let o of i)o.line(this.view,s,n)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(go),r=t.state.facet(go),n=t.docChanged||t.heightChanged||t.viewportChanged||!Qe.eq(t.startState.facet(Za),t.state.facet(Za),t.view.viewport.from,t.view.viewport.to);if(e==r)for(let i of this.gutters)i.update(t)&&(n=!0);else{n=!0;let i=[];for(let s of r){let o=e.indexOf(s);o<0?i.push(new Am(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>de.scrollMargins.of(e=>{let r=e.plugin(t);return!r||r.gutters.length==0||!r.fixed?null:e.textDirection==ht.LTR?{left:r.dom.offsetWidth*e.scaleX}:{right:r.dom.offsetWidth*e.scaleX}})});function km(t){return Array.isArray(t)?t:[t]}function ku(t,e,r){for(;t.value&&t.from<=r;)t.from==r&&e.push(t.value),t.next()}class jC{constructor(e,r,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Qe.iter(e.markers,r.from)}addElement(e,r,n){let{gutter:i}=this,s=(r.top-this.height)/e.scaleY,o=r.height/e.scaleY;if(this.i==i.elements.length){let a=new Cm(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=r.bottom,this.i++}line(e,r,n){let i=[];ku(this.cursor,i,r.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,r,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,r,i)}widget(e,r){let n=this.gutter.config.widgetMarker(e,r.widget,r);n&&this.addElement(e,r,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let r=e.elements.pop();e.dom.removeChild(r.dom),r.destroy()}}}class Am{constructor(e,r){this.view=e,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in r.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);r.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=km(r.markers(e)),r.initialSpacer&&(this.spacer=new Cm(e,0,0,[r.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let r=this.markers;if(this.markers=km(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let n=e.view.viewport;return!Qe.eq(this.markers,r,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Cm{constructor(e,r,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,r,n,i)}update(e,r,n,i){this.height!=r&&(this.height=r,this.dom.style.height=r+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),VC(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,r){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<r.length?r[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=n,this.markers=r}destroy(){this.setMarkers(null,[])}}function VC(t,e){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].compare(e[r]))return!1;return!0}const WC=pe.define(),ns=pe.define({combine(t){return Ur(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,r){let n=Object.assign({},e);for(let i in r){let s=n[i],o=r[i];n[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return n}})}});class Au extends fn{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Cu(t,e){return t.state.facet(ns).formatNumber(e,t.state)}const $C=go.compute([ns],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(WC)},lineMarker(e,r,n){return n.some(i=>i.toDOM)?null:new Au(Cu(e,e.state.doc.lineAt(r.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(ns)!=e.state.facet(ns),initialSpacer(e){return new Au(Cu(e,Om(e.state.doc.lines)))},updateSpacer(e,r){let n=Cu(r.view,Om(r.view.state.doc.lines));return n==e.number?e:new Au(n)},domEventHandlers:t.facet(ns).domEventHandlers}));function HC(t={}){return[ns.of(t),Sm(),$C]}function Om(t){let e=9;for(;e<t;)e=e*10+9;return e}const zC=new class extends fn{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},UC=Za.compute(["selection"],t=>{let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.head).from;i>r&&(r=i,e.push(zC.range(i)))}return Qe.of(e)});function GC(){return UC}const Em=new Map;function KC(t){let e=Em.get(t);return e||Em.set(t,e=ke.mark({attributes:t===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xB7")}})),e}function Tm(t){return ft.define(e=>({decorations:t.createDeco(e),update(r){this.decorations=t.updateDeco(r,this.decorations)}}),{decorations:e=>e.decorations})}const YC=Tm(new gu({regexp:/\t| +/g,decoration:t=>KC(t[0]),boundary:/\S/}));function cD(){return YC}const JC=Tm(new gu({regexp:/\s+$/g,decoration:ke.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function uD(){return JC}const fD={HeightMap:Qt,HeightOracle:Vg,MeasuredHeights:Wg,QueryType:tt,ChangedRange:xr,computeOrder:og,moveVisually:cg};var Ou;const ki=new Re;function Pm(t){return pe.define({combine:t?e=>e.concat(t):void 0})}const QC=new Re;class Sr{constructor(e,r,n=[],i=""){this.data=e,this.name=i,Ve.prototype.hasOwnProperty("tree")||Object.defineProperty(Ve.prototype,"tree",{get(){return Lt(this)}}),this.parser=r,this.extension=[ei.of(this),Ve.languageData.of((s,o,a)=>{let l=Mm(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(QC);if(h){let d=l.resolve(o-l.from,a);for(let p of h)if(p.test(d,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,r,n=-1){return Mm(e,r,n).type.prop(ki)==this.data}findRegions(e){let r=e.facet(ei);if(r?.data==this.data)return[{from:0,to:e.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],i=(s,o)=>{if(s.prop(ki)==this.data){n.push({from:o,to:o+s.length});return}let a=s.prop(Re.mounted);if(a){if(a.tree.prop(ki)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+s.length});return}else if(a.overlay){let l=n.length;if(i(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ut&&i(c,s.positions[l]+o)}};return i(Lt(e),0),n}get allowsNesting(){return!0}}Sr.setState=Ae.define();function Mm(t,e,r){let n=t.facet(ei),i=Lt(t).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,r,ot.ExcludeBuffers))s.type.isTop&&(i=s);return i}class _a extends Sr{constructor(e,r,n){super(e,r,[],n),this.parser=r}static define(e){let r=Pm(e.languageData);return new _a(r,e.parser.configure({props:[ki.add(n=>n.isTop?r:void 0)]}),e.name)}configure(e,r){return new _a(this.data,this.parser.configure(e),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lt(t){let e=t.field(Sr.state,!1);return e?e.tree:ut.empty}function XC(t,e,r=50){var n;let i=(n=t.field(Sr.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(r,e)?i.tree:null;return i.updateViewport(s),o}function hD(t,e=t.doc.length){var r;return((r=t.field(Sr.state,!1))===null||r===void 0?void 0:r.context.isDone(e))||!1}function dD(t,e=t.viewport.to,r=100){let n=XC(t.state,e,r);return n!=Lt(t.state)&&t.dispatch({}),!!n}function pD(t){var e;return((e=t.plugin(Nm))===null||e===void 0?void 0:e.isWorking())||!1}class ZC{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,r){let n=this.cursorPos-this.string.length;return e<n||r>=this.cursorPos?this.doc.sliceString(e,r):this.string.slice(e-n,r-n)}}let mo=null;class is{constructor(e,r,n=[],i,s,o,a,l){this.parser=e,this.state=r,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,r,n){return new is(e,r,[],ut.empty,0,n,[],null)}startParse(){return this.parser.startParse(new ZC(this.state.doc),this.fragments)}work(e,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=ut.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(An.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,r;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=e,this.tree=r,this.fragments=this.withoutTempSkipped(An.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let r=mo;mo=this;try{return e()}finally{mo=r}}withoutTempSkipped(e){for(let r;r=this.tempSkipped.pop();)e=Im(e,r.from,r.to);return e}changes(e,r){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),n=An.applyChanges(n,l),i=ut.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new is(this.parser,r,n,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let r=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Im(this.fragments,i,s),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,r){this.skipped.push({from:e,to:r})}static getSkippingParser(e){return new class extends Pd{createParse(r,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=mo;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ut(nr.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let r=this.fragments;return this.treeLen>=e&&r.length&&r[0].from==0&&r[0].to>=e}static get(){return mo}}function Im(t,e,r){return An.applyChanges(t,[{fromA:e,toA:r,fromB:e,toB:r}])}class ss{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new ss(r)}static init(e){let r=Math.min(3e3,e.doc.length),n=is.create(e.facet(ei).parser,e,{from:0,to:r});return n.work(20,r)||n.takeTree(),new ss(n)}}Sr.state=At.define({create:ss.init,update(t,e){for(let r of e.effects)if(r.is(Sr.setState))return r.value;return e.startState.facet(ei)!=e.state.facet(ei)?ss.init(e.state):t.apply(e)}});let Dm=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Dm=t=>{let e=-1,r=setTimeout(()=>{e=requestIdleCallback(t,{timeout:500-100})},100);return()=>e<0?clearTimeout(r):cancelIdleCallback(e)});const Eu=typeof navigator<"u"&&(!((Ou=navigator.scheduling)===null||Ou===void 0)&&Ou.isInputPending)?()=>navigator.scheduling.isInputPending():null,Nm=ft.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let r=this.view.state.field(Sr.state).context;(r.updateViewport(e.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:e}=this.view,r=e.field(Sr.state);(r.tree!=r.context.tree||!r.context.isDone(e.doc.length))&&(this.working=Dm(this.work))}work(e){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,s=n.field(Sr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Eu?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Eu&&Eu()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-r,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Sr.setState.of(new ss(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(r=>br(this.view.state,r)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ei=pe.define({combine(t){return t.length?t[0]:null},enables:t=>[Sr.state,Nm,de.contentAttributes.compute([t],e=>{let r=e.facet(t);return r&&r.name?{"data-language":r.name}:{}})]});class _C{constructor(e,r=[]){this.language=e,this.support=r,this.extension=[e,r]}}class Rm{constructor(e,r,n,i,s,o=void 0){this.name=e,this.alias=r,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:r,support:n}=e;if(!r){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");r=()=>Promise.resolve(n)}return new Rm(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,r,n)}static matchFilename(e,r){for(let i of e)if(i.filename&&i.filename.test(r))return i;let n=/\.([^.]+)$/.exec(r);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,r,n=!0){r=r.toLowerCase();for(let i of e)if(i.alias.some(s=>s==r))return i;if(n)for(let i of e)for(let s of i.alias){let o=r.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(r[o-1])&&!/\w/.test(r[o+s.length])))return i}return null}}const Lm=pe.define(),qa=pe.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(r=>r!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Ai(t){let e=t.facet(qa);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function os(t,e){let r="",n=t.tabSize,i=t.facet(qa)[0];if(i==" "){for(;e>=n;)r+=" ",e-=n;i=" "}for(let s=0;s<e;s++)r+=i;return r}function el(t,e){t instanceof Ve&&(t=new vo(t));for(let n of t.state.facet(Lm)){let i=n(t,e);if(i!==void 0)return i}let r=Lt(t.state);return r.length>=e?qC(t,r,e):null}function gD(t,e,r){let n=Object.create(null),i=new vo(t,{overrideIndentation:o=>{var a;return(a=n[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=r;){let a=t.doc.lineAt(o);o=a.to+1;let l=el(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=os(t,l);c!=u&&(n[a.from]=l,s.push({from:a.from,to:a.from+c.length,insert:u}))}return t.changes(s)}class vo{constructor(e,r={}){this.state=e,this.options=r,this.unit=Ai(e)}lineAt(e,r=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(r<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,r=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,r);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,r=1){let{text:n,from:i}=this.lineAt(e,r),s=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,r=e.length){return Xi(e,this.state.tabSize,r)}lineIndent(e,r=1){let{text:n,from:i}=this.lineAt(e,r),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Bm=new Re;function qC(t,e,r){let n=e.resolveStack(r),i=n.node.enterUnfinishedNodesBefore(r);if(i!=n.node){let s=[];for(let o=i;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return Fm(n,t,r)}function Fm(t,e,r){for(let n=t;n;n=n.next){let i=tO(n.node);if(i)return i(Tu.create(e,r,n))}return 0}function eO(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function tO(t){let e=t.type.prop(Bm);if(e)return e;let r=t.firstChild,n;if(r&&(n=r.type.prop(Re.closedBy))){let i=t.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>jm(o,!0,1,void 0,s&&!eO(o)?i.from:void 0)}return t.parent==null?rO:null}function rO(){return 0}class Tu extends vo{constructor(e,r,n){super(e.state,e.options),this.base=e,this.pos=r,this.context=n}get node(){return this.context.node}static create(e,r,n){return new Tu(e,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let r=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(nO(n,e))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){return Fm(this.context.next,this.base,this.pos)}}function nO(t,e){for(let r=e;r;r=r.parent)if(t==r)return!0;return!1}function iO(t){let e=t.node,r=e.childAfter(e.from),n=e.lastChild;if(!r)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(r.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=r.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from<o?r:null;a=l.to}}function mD({closing:t,align:e=!0,units:r=1}){return n=>jm(n,e,r,t)}function jm(t,e,r,n,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==t.pos+o,l=e?iO(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*r)}const vD=t=>t.baseIndent;function Vm({except:t,units:e=1}={}){return r=>{let n=t&&t.test(r.textAfter);return r.baseIndent+(n?0:e*r.unit)}}const sO=200;function oO(){return Ve.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let r=t.newDoc,{head:n}=t.newSelection.main,i=r.lineAt(n);if(n>i.from+sO)return t;let s=r.sliceString(i.from,n);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=el(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=os(o,h);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}const aO=pe.define(),Wm=new Re;function lO(t){let e=t.firstChild,r=t.lastChild;return e&&e.to<r.from?{from:e.to,to:r.type.isError?t.to:r.from}:null}function cO(t,e,r){let n=Lt(t);if(n.length<r)return null;let i=n.resolveStack(r,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=r||a.from>r)continue;if(s&&a.from<e)break;let l=a.type.prop(Wm);if(l&&(a.to<n.length-50||n.length==t.doc.length||!uO(a))){let c=l(a,t);c&&c.from<=r&&c.from>=e&&c.to>r&&(s=c)}}return s}function uO(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function yo(t,e,r){for(let n of t.facet(aO)){let i=n(t,e,r);if(i)return i}return cO(t,e,r)}function $m(t,e){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return r>=n?void 0:{from:r,to:n}}const bo=Ae.define({map:$m}),as=Ae.define({map:$m});function Pu(t){let e=[];for(let{head:r}of t.state.selection.ranges)e.some(n=>n.from<=r&&n.to>=r)||e.push(t.lineBlockAt(r));return e}const ti=At.define({create(){return ke.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)if(r.is(bo)&&!fO(t,r.value.from,r.value.to)){let{preparePlaceholder:n}=e.state.facet(Iu),i=n?ke.replace({widget:new bO(n(e.state,r.value))}):Um;t=t.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(as)&&(t=t.update({filter:(n,i)=>r.value.from!=n||r.value.to!=i,filterFrom:r.value.from,filterTo:r.value.to}));if(e.selection){let r=!1,{head:n}=e.selection.main;t.between(n,n,(i,s)=>{i<n&&s>n&&(r=!0)}),r&&(t=t.update({filterFrom:n,filterTo:n,filter:(i,s)=>s<=n||i>=n}))}return t},provide:t=>de.decorations.from(t),toJSON(t,e){let r=[];return t.between(0,e.doc.length,(n,i)=>{r.push(n,i)}),r},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let r=0;r<t.length;){let n=t[r++],i=t[r++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Um.range(n,i))}return ke.set(e,!0)}});function yD(t){return t.field(ti,!1)||RangeSet.empty}function xo(t,e,r){var n;let i=null;return(n=t.field(ti,!1))===null||n===void 0||n.between(e,r,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function fO(t,e,r){let n=!1;return t.between(e,e,(i,s)=>{i==e&&s==r&&(n=!0)}),n}function Mu(t,e){return t.field(ti,!1)?e:e.concat(Ae.appendConfig.of(Hm()))}const hO=t=>{for(let e of Pu(t)){let r=yo(t.state,e.from,e.to);if(r)return t.dispatch({effects:Mu(t.state,[bo.of(r),tl(t,r)])}),!0}return!1},dO=t=>{if(!t.state.field(ti,!1))return!1;let e=[];for(let r of Pu(t)){let n=xo(t.state,r.from,r.to);n&&e.push(as.of(n),tl(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function tl(t,e,r=!0){let n=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return de.announce.of(`${t.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${i}.`)}const pO=t=>{let{state:e}=t,r=[];for(let n=0;n<e.doc.length;){let i=t.lineBlockAt(n),s=yo(e,i.from,i.to);s&&r.push(bo.of(s)),n=(s?t.lineBlockAt(s.to):i).to+1}return r.length&&t.dispatch({effects:Mu(t.state,r)}),!!r.length},gO=t=>{let e=t.state.field(ti,!1);if(!e||!e.size)return!1;let r=[];return e.between(0,t.state.doc.length,(n,i)=>{r.push(as.of({from:n,to:i}))}),t.dispatch({effects:r}),!0};function mO(t,e){for(let r=e;;){let n=yo(t.state,r.from,r.to);if(n&&n.to>e.from)return n;if(!r.from)return null;r=t.lineBlockAt(r.from-1)}}const bD=t=>{let e=[];for(let r of Pu(t)){let n=xo(t.state,r.from,r.to);if(n)e.push(as.of(n),tl(t,n,!1));else{let i=mO(t,r);i&&e.push(bo.of(i),tl(t,i))}}return e.length>0&&t.dispatch({effects:Mu(t.state,e)}),!!e.length},vO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:hO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:dO},{key:"Ctrl-Alt-[",run:pO},{key:"Ctrl-Alt-]",run:gO}],yO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Iu=pe.define({combine(t){return Ur(t,yO)}});function Hm(t){let e=[ti,SO];return t&&e.push(Iu.of(t)),e}function zm(t,e){let{state:r}=t,n=r.facet(Iu),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=xo(t.state,a.from,a.to);l&&t.dispatch({effects:as.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",r.phrase("folded code")),s.title=r.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Um=ke.replace({widget:new class extends ln{toDOM(t){return zm(t,null)}}});class bO extends ln{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return zm(e,this.value)}}const xO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Du extends fn{constructor(e,r){super(),this.config=e,this.open=r}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=e.state.phrase(this.open?"Fold line":"Unfold line"),r}}function wO(t={}){let e=Object.assign(Object.assign({},xO),t),r=new Du(e,!0),n=new Du(e,!1),i=ft.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ei)!=o.state.facet(ei)||o.startState.field(ti,!1)!=o.state.field(ti,!1)||Lt(o.startState)!=Lt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Kn;for(let l of o.viewportLineBlocks){let c=xo(o.state,l.from,l.to)?n:yo(o.state,l.from,l.to)?r:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,wm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Qe.empty},initialSpacer(){return new Du(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=xo(o.state,a.from,a.to);if(c)return o.dispatch({effects:as.of(c)}),!0;let u=yo(o.state,a.from,a.to);return u?(o.dispatch({effects:bo.of(u)}),!0):!1}})}),Hm()]}const SO=de.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ls{constructor(e,r){this.specs=e;let n;function i(a){let l=Yn.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const s=typeof r.all=="string"?r.all:r.all?i(r.all):void 0,o=r.scope;this.scope=o instanceof Sr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=Gd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Yn(n):null,this.themeType=r.themeType}static define(e,r){return new ls(e,r||{})}}const Nu=pe.define(),Gm=pe.define({combine(t){return t.length?[t[0]]:null}});function rl(t){let e=t.facet(Nu);return e.length?e:t.facet(Gm)}function Ru(t,e){let r=[AO],n;return t instanceof ls&&(t.module&&r.push(de.styleModule.of(t.module)),n=t.themeType),e?.fallback?r.push(Gm.of(t)):n?r.push(Nu.computeN([de.darkTheme],i=>i.facet(de.darkTheme)==(n=="dark")?[t]:[])):r.push(Nu.of(t)),r}function xD(t,e,r){let n=rl(t),i=null;if(n){for(let s of n)if(!s.scope||r&&s.scope(r)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class kO{constructor(e){this.markCache=Object.create(null),this.tree=Lt(e.state),this.decorations=this.buildDeco(e,rl(e.state))}update(e){let r=Lt(e.state),n=rl(e.state),i=n!=rl(e.startState);r.length<e.view.viewport.to&&!i&&r.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(r!=this.tree||e.viewportChanged||i)&&(this.tree=r,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,r){if(!r||!this.tree.length)return ke.none;let n=new Kn;for(let{from:i,to:s}of e.visibleRanges)Kd(this.tree,r,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=ke.mark({class:l})))},i,s);return n.finish()}}const AO=xi.high(ft.fromClass(kO,{decorations:t=>t.decorations})),CO=ls.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),OO=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Km=1e4,Ym="()[]{}",Jm=pe.define({combine(t){return Ur(t,{afterCursor:!0,brackets:Ym,maxScanDistance:Km,renderMatch:PO})}}),EO=ke.mark({class:"cm-matchingBracket"}),TO=ke.mark({class:"cm-nonmatchingBracket"});function PO(t){let e=[],r=t.matched?EO:TO;return e.push(r.range(t.start.from,t.start.to)),t.end&&e.push(r.range(t.end.from,t.end.to)),e}const MO=[At.define({create(){return ke.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let r=[],n=e.state.facet(Jm);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=hn(e.state,i.head,-1,n)||i.head>0&&hn(e.state,i.head-1,1,n)||n.afterCursor&&(hn(e.state,i.head,1,n)||i.head<e.state.doc.length&&hn(e.state,i.head+1,-1,n));s&&(r=r.concat(n.renderMatch(s,e.state)))}return ke.set(r,!0)},provide:t=>de.decorations.from(t)}),OO];function IO(t={}){return[Jm.of(t),MO]}const DO=new Re;function Lu(t,e,r){let n=t.prop(e<0?Re.openedBy:Re.closedBy);if(n)return n;if(t.name.length==1){let i=r.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[r[i+e]]}return null}function Bu(t){let e=t.type.prop(DO);return e?e(t.node):t}function hn(t,e,r,n={}){let i=n.maxScanDistance||Km,s=n.brackets||Ym,o=Lt(t),a=o.resolveInner(e,r);for(let l=a;l;l=l.parent){let c=Lu(l.type,r,s);if(c&&l.from<l.to){let u=Bu(l);if(u&&(r>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return NO(t,e,r,l,u,c,s)}}return RO(t,e,r,o,a.type,i,s)}function NO(t,e,r,n,i,s,o){let a=n.parent,l={from:i.from,to:i.to},c=0,u=a?.cursor();if(u&&(r<0?u.childBefore(n.from):u.childAfter(n.to)))do if(r<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Bu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Lu(u.type,r,o))c++;else if(Lu(u.type,-r,o)){if(c==0){let h=Bu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(r<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function RO(t,e,r,n,i,s,o){let a=r<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=r>0)return null;let c={from:r<0?e-1:e,to:r>0?e+1:e},u=t.doc.iterRange(e,r>0?t.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;r<0&&(d+=p.length);let m=e+d*r;for(let y=r>0?0:p.length-1,w=r>0?p.length:-1;y!=w;y+=r){let A=o.indexOf(p[y]);if(!(A<0||n.resolveInner(m+y,1).type!=i))if(A%2==0==r>0)h++;else{if(h==1)return{start:c,end:{from:m+y,to:m+y+1},matched:A>>1==l>>1};h--}}r>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function Qm(t,e,r,n=0,i=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let s=i;for(let o=n;o<e;o++)t.charCodeAt(o)==9?s+=r-s%r:s++;return s}class Xm{constructor(e,r,n,i){this.string=e,this.tabSize=r,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let r=this.string.charAt(this.pos),n;if(typeof e=="string"?n=r==e:n=r&&(e instanceof RegExp?e.test(r):e(r)),n)return++this.pos,r}eatWhile(e){let r=this.pos;for(;this.eat(e););return this.pos>r}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let r=this.string.indexOf(e,this.pos);if(r>-1)return this.pos=r,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Qm(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Qm(this.string,null,this.tabSize)}match(e,r,n){if(typeof e=="string"){let i=o=>n?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(r!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&r!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function LO(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||BO,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||ju}}function BO(t){if(typeof t!="object")return t;let e={};for(let r in t){let n=t[r];e[r]=n instanceof Array?n.slice():n}return e}const Zm=new WeakMap;class _m extends null{constructor(e){let r=Pm(e.languageData),n=LO(e),i,s=new class extends Parser{createParse(o,a,l){return new jO(i,o,a,l)}};super(r,s,[Lm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=$O(r),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new n0(n.tokenTable):WO}static define(e){return new _m(e)}getIndent(e,r){let n=Lt(e.state),i=n.resolve(r);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let s,{overrideIndentation:o}=e.options;o&&(s=Zm.get(e.state),s!=null&&s<r-1e4&&(s=void 0));let a=Fu(this,n,0,i.from,s??r),l,c;if(a?(c=a.state,l=a.pos+1):(c=this.streamParser.startState(e.unit),l=0),r-l>1e4)return null;for(;l<r;){let h=e.state.doc.lineAt(l),d=Math.min(r,h.to);if(h.length){let p=o?o(h.from):-1,m=new Xm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)e0(this.streamParser.token,m,c)}else this.streamParser.blankLine(c,e.unit);if(d==r)break;l=h.to+1}let u=e.lineAt(r);return o&&s==null&&Zm.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Fu(t,e,r,n,i){let s=r>=n&&r+e.length<=i&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:r+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=r+e.positions[o],c=a instanceof Tree&&l<i&&Fu(t,a,l,n,i);if(c)return c}return null}function qm(t,e,r,n,i){if(i&&r<=0&&n>=e.length)return e;!i&&e.type==t.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<n&&a instanceof Tree){if(!(l=qm(t,a,r-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function FO(t,e,r,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),a=s<=r&&o>r&&Fu(t,i.tree,0-i.offset,r,o),l;if(a&&(l=qm(t,i.tree,r+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:t.streamParser.startState(n?Ai(n):4),tree:Tree.empty}}class jO{constructor(e,r,n,i){this.lang=e,this.input=r,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=is.get(),o=i[0].from,{state:a,tree:l}=FO(e,n,o,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ai(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=is.get(),r=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(r,this.chunkStart+2048);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=r?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,r),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let r=this.input.chunk(e);if(this.input.lineChunks)r==`
|
|
151
|
+
`&&(r="");else{let n=r.indexOf(`
|
|
152
|
+
`);n>-1&&(r=r.slice(0,n))}return e+r.length<=this.to?r:r.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,r=this.lineAfter(e),n=e+r.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(r=r.slice(0,s-(n-r.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);r+=a,n=o+a.length}return{line:r,end:n}}skipGapsTo(e,r,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+r;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;r+=o-i}return r}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,r,n,i,s){if(this.ranges.length>1){s=this.skipGapsTo(r,s,1),r+=s;let o=this.chunk.length;s=this.skipGapsTo(n,s,-1),n+=s,i+=this.chunk.length-o}return this.chunk.push(e,r,n,i),s}parseLine(e){let{line:r,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Xm(r,e?e.state.tabSize:4,e?Ai(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=e0(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:VO,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function e0(t,e,r){e.start=e.pos;for(let n=0;n<10;n++){let i=t(e,r);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const ju=Object.create(null),wo=[nr.none],VO=new oa(wo),t0=[],r0=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])r0[t]=i0(ju,e);class n0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),r0)}resolve(e){return e?this.table[e]||(this.table[e]=i0(this.extra,e)):0}}const WO=new n0(ju);function Vu(t,e){t0.indexOf(t)>-1||(t0.push(t),console.warn(e))}function i0(t,e){let r=[];for(let s of e.split(" ")){let o=[];for(let a of s.split(".")){let l=t[a]||M[a];l?typeof l=="function"?o.length?o=o.map(l):Vu(a,`Modifier ${a} used at start of tag`):o.length?Vu(a,`Tag ${a} used as modifier`):o=Array.isArray(l)?l:[l]:Vu(a,`Unknown highlighting tag ${a}`)}for(let a of o)r.push(a)}if(!r.length)return 0;let n=e.replace(/ /g,"_"),i=nr.define({id:wo.length,name:n,props:[zd({[n]:r})]});return wo.push(i),i.id}function $O(t){let e=NodeType.define({id:wo.length,name:"Document",props:[ki.add(()=>t)],top:!0});return wo.push(e),e}const SD=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const r=HO(e,t.state.doc);return[{from:r,message:e.message,severity:"error",to:r}]}return[]};function HO(t,e){let r;return(r=t.message.match(/at position (\d+)/))?Math.min(+r[1],e.length):(r=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+r[1]).from+ +r[2]-1,e.length):0}const zO=_a.define({name:"json",parser:ik.configure({props:[Bm.add({Object:Vm({except:/^\s*\}/}),Array:Vm({except:/^\s*\]/})}),Wm.add({"Object Array":lO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function UO(){return new _C(zO)}function Wu(){return Wu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Wu.apply(this,arguments)}function GO(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}const KO=t=>{let{state:e}=t,r=e.doc.lineAt(e.selection.main.from),n=Hu(t.state,r.from);return n.line?YO(t):n.block?QO(t):!1};function $u(t,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let i=t(e,r);return i?(n(r.update(i)),!0):!1}}const YO=$u(_O,0),kD=null,AD=null,JO=$u(s0,0),CD=null,OD=null,QO=$u((t,e)=>s0(t,e,ZO(e)),0);function Hu(t,e){let r=t.languageDataAt("commentTokens",e);return r.length?r[0]:{}}const So=50;function XO(t,{open:e,close:r},n,i){let s=t.sliceDoc(n-So,n),o=t.sliceDoc(i,i+So),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+r.length)==r)return{open:{pos:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-n<=2*So?u=h=t.sliceDoc(n,i):(u=t.sliceDoc(n,n+So),h=t.sliceDoc(i-So,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-r.length;return u.slice(d,d+e.length)==e&&h.slice(m,m+r.length)==r?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-p-r.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function ZO(t){let e=[];for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),i=r.to<=n.to?n:t.doc.lineAt(r.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function s0(t,e,r=e.selection.ranges){let n=r.map(s=>Hu(e,s.from).block);if(!n.every(s=>s))return null;let i=r.map((s,o)=>XO(e,n[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(r.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function _O(t,e,r=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of r){let a=n.length,l=1e9,c=Hu(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,m=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),n.push({line:h,comment:m,token:c,indent:d,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}}if(t!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const zu=an.define(),qO=an.define(),e2=pe.define(),o0=pe.define({combine(t){return Ur(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,r)=>(n,i)=>e(n,i)||r(n,i)})}});function t2(t){let e=0;return t.iterChangedRanges((r,n)=>e=n),e}const Uu=At.define({create(){return dn.empty},update(t,e){let r=e.state.facet(o0),n=e.annotation(zu);if(n){let l=e.docChanged?se.single(t2(e.changes)):void 0,c=lr.fromTransaction(e,l),u=n.side,h=u==0?t.undone:t.done;return c?h=il(h,h.length,r.minDepth,c):h=c0(h,e.startState.selection),new dn(u==0?n.rest:h,u==0?h:n.rest)}let i=e.annotation(qO);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Mt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=lr.fromTransaction(e),o=e.annotation(Mt.time),a=e.annotation(Mt.userEvent);return s?t=t.addChanges(s,o,a,r,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,r.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new dn(t.done.map(lr.fromJSON),t.undone.map(lr.fromJSON))}});function r2(t={}){return[Uu,o0.of(t),de.domEventHandlers({beforeinput(e,r){let n=e.inputType=="historyUndo"?a0:e.inputType=="historyRedo"?Gu:null;return n?(e.preventDefault(),n(r)):!1}})]}const ED=null;function nl(t,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let i=r.field(Uu,!1);if(!i)return!1;let s=i.pop(t,r,e);return s?(n(s),!0):!1}}const a0=nl(0,!1),Gu=nl(1,!1),n2=nl(0,!0),i2=nl(1,!0);function TD(t){return function(e){let r=e.field(Uu,!1);if(!r)return 0;let n=t==0?r.done:r.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const PD=null,MD=null;class lr{constructor(e,r,n,i,s){this.changes=e,this.effects=r,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new lr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,r,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new lr(e.changes&&Pt.fromJSON(e.changes),[],e.mapped&&on.fromJSON(e.mapped),e.startSelection&&se.fromJSON(e.startSelection),e.selectionsAfter.map(se.fromJSON))}static fromTransaction(e,r){let n=Br;for(let i of e.startState.facet(e2)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new lr(e.changes.invert(e.startState.doc),n,void 0,r||e.startState.selection,Br)}static selection(e){return new lr(void 0,Br,void 0,void 0,e)}}function il(t,e,r,n){let i=e+1>r+20?e-r-1:0,s=t.slice(i,e);return s.push(n),s}function s2(t,e){let r=[],n=!1;return t.iterChangedRanges((i,s)=>r.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<r.length;){let c=r[l++],u=r[l++];a>=c&&o<=u&&(n=!0)}}),n}function o2(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((r,n)=>r.empty!=e.ranges[n].empty).length===0}function l0(t,e){return t.length?e.length?t.concat(e):t:e}const Br=[],a2=200;function c0(t,e){if(t.length){let r=t[t.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-a2));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),il(t,t.length-1,1e9,r.setSelAfter(n)))}else return[lr.selection([e])]}function l2(t){let e=t[t.length-1],r=t.slice();return r[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function Ku(t,e){if(!t.length)return t;let r=t.length,n=Br;for(;r;){let i=c2(t[r-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,r);return s[r-1]=i,s}else e=i.mapped,r--,n=i.selectionsAfter}return n.length?[lr.selection(n)]:Br}function c2(t,e,r){let n=l0(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Br,r);if(!t.changes)return lr.selection(n);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new lr(i,Ae.mapEffects(t.effects,e),o,t.startSelection.map(s),n)}const u2=/^(input\.type|delete)($|\.)/;class dn{constructor(e,r,n=0,i=void 0){this.done=e,this.undone=r,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new dn(this.done,this.undone):this}addChanges(e,r,n,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||u2.test(n))&&(!a.selectionsAfter.length&&r-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,s2(a.changes,e.changes))||n=="input.type.compose")?o=il(o,o.length-1,i.minDepth,new lr(e.changes.compose(a.changes),l0(e.effects,a.effects),a.mapped,a.startSelection,Br)):o=il(o,o.length,i.minDepth,e),new dn(o,Br,r,n)}addSelection(e,r,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Br;return s.length>0&&r-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&o2(s[s.length-1],e)?this:new dn(c0(this.done,e),this.undone,r,n)}addMapping(e){return new dn(Ku(this.done,e),Ku(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,r,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1];if(n&&s.selectionsAfter.length)return r.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:zu.of({side:e,rest:l2(i)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?Br:i.slice(0,i.length-1);return s.mapped&&(o=Ku(o,s.mapped)),r.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:zu.of({side:e,rest:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}dn.empty=new dn(Br,Br);const f2=[{key:"Mod-z",run:a0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Gu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Gu,preventDefault:!0},{key:"Mod-u",run:n2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:i2,preventDefault:!0}];function cs(t,e){return se.create(t.ranges.map(e),t.mainIndex)}function pn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Fr({state:t,dispatch:e},r){let n=cs(t.selection,r);return n.eq(t.selection)?!1:(e(pn(t,n)),!0)}function ko(t,e){return se.cursor(e?t.to:t.from)}function sl(t,e){return Fr(t,r=>r.empty?t.moveByChar(r,e):ko(r,e))}function Xt(t){return t.textDirectionAt(t.state.selection.main.head)==ht.LTR}const u0=t=>sl(t,!Xt(t)),f0=t=>sl(t,Xt(t)),ID=t=>sl(t,!0),DD=t=>sl(t,!1);function ol(t,e){return Fr(t,r=>r.empty?t.moveByGroup(r,e):ko(r,e))}const h2=t=>ol(t,!Xt(t)),d2=t=>ol(t,Xt(t)),ND=t=>ol(t,!0),RD=t=>ol(t,!1),h0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function d0(t,e,r){let n=t.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,a=!1,l=!1,c=!1,u=d=>{if(a)return!1;s+=r?d.length:-d.length;let p=n(d),m;if(p==CharCategory.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(p=-1),i==CharCategory.Space&&(i=p),i!=p)return!1;if(i==CharCategory.Word)if(d.toLowerCase()==d){if(!r&&l)return!1;c=!0}else if(c){if(r)return!1;a=!0}else{if(l&&r&&n(m=t.state.sliceDoc(s,s+1))==CharCategory.Word&&m.toLowerCase()==m)return!1;l=!0}return o++,!0},h=t.moveByChar(e,r,d=>(u(d),u));if(h0&&i==CharCategory.Word&&h.from==e.from+o*(r?1:-1)){let d=Math.min(e.head,h.head),p=Math.max(e.head,h.head),m=t.state.sliceDoc(d,p);if(m.length>1&&/[\u4E00-\uffff]/.test(m)){let y=Array.from(h0.segment(m));if(y.length>1)return r?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(h.head+y[y.length-1].index,1)}}return h}function p0(t,e){return Fr(t,r=>r.empty?d0(t,r,e):ko(r,e))}const LD=t=>p0(t,!0),BD=t=>p0(t,!1);function p2(t,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function al(t,e,r){let n=Lt(t).resolveInner(e.head),i=r?Re.closedBy:Re.openedBy;for(let l=e.head;;){let c=r?n.childAfter(l):n.childBefore(l);if(!c)break;p2(t,c,i)?n=c:l=r?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=r?hn(t,n.from,1):hn(t,n.to,-1))&&o.matched?a=r?o.end.to:o.end.from:a=r?n.to:n.from,se.cursor(a,r?-1:1)}const g2=t=>Fr(t,e=>al(t.state,e,!Xt(t))),m2=t=>Fr(t,e=>al(t.state,e,Xt(t)));function g0(t,e){return Fr(t,r=>{if(!r.empty)return ko(r,e);let n=t.moveVertically(r,e);return n.head!=r.head?n:t.moveToLineBoundary(r,e)})}const m0=t=>g0(t,!1),v0=t=>g0(t,!0);function y0(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,r=0,n=0,i;if(e){for(let s of t.state.facet(de.scrollMargins)){let o=s(t);o?.top&&(r=Math.max(o?.top,r)),o?.bottom&&(n=Math.max(o?.bottom,n))}i=t.scrollDOM.clientHeight-r-n}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function b0(t,e){let r=y0(t),{state:n}=t,i=cs(n.selection,o=>o.empty?t.moveVertically(o,e,r.height):ko(o,e));if(i.eq(n.selection))return!1;let s;if(r.selfScroll){let o=t.coordsAtPos(n.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+r.marginTop,c=a.bottom-r.marginBottom;o&&o.top>l&&o.bottom<c&&(s=de.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(pn(n,i),{effects:s}),!0}const x0=t=>b0(t,!1),Yu=t=>b0(t,!0);function ri(t,e,r){let n=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,r);if(i.head==e.head&&i.head!=(r?n.to:n.from)&&(i=t.moveToLineBoundary(e,r,!1)),!r&&i.head==n.from&&n.length){let s=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(i=se.cursor(n.from+s))}return i}const v2=t=>Fr(t,e=>ri(t,e,!0)),y2=t=>Fr(t,e=>ri(t,e,!1)),b2=t=>Fr(t,e=>ri(t,e,!Xt(t))),x2=t=>Fr(t,e=>ri(t,e,Xt(t))),w2=t=>Fr(t,e=>se.cursor(t.lineBlockAt(e.head).from,1)),S2=t=>Fr(t,e=>se.cursor(t.lineBlockAt(e.head).to,-1));function w0(t,e,r){let n=!1,i=cs(t.selection,s=>{let o=hn(t,s.head,-1)||hn(t,s.head,1)||s.head>0&&hn(t,s.head-1,1)||s.head<t.doc.length&&hn(t,s.head+1,-1);if(!o||!o.end)return s;n=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return r?se.range(s.anchor,a):se.cursor(a)});return n?(e(pn(t,i)),!0):!1}const k2=({state:t,dispatch:e})=>w0(t,e,!1),FD=({state:t,dispatch:e})=>w0(t,e,!0);function kr(t,e){let r=cs(t.state.selection,n=>{let i=e(n);return se.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return r.eq(t.state.selection)?!1:(t.dispatch(pn(t.state,r)),!0)}function ll(t,e){return kr(t,r=>t.moveByChar(r,e))}const S0=t=>ll(t,!Xt(t)),k0=t=>ll(t,Xt(t)),jD=t=>ll(t,!0),VD=t=>ll(t,!1);function cl(t,e){return kr(t,r=>t.moveByGroup(r,e))}const A2=t=>cl(t,!Xt(t)),C2=t=>cl(t,Xt(t)),WD=t=>cl(t,!0),$D=t=>cl(t,!1);function A0(t,e){return kr(t,r=>d0(t,r,e))}const HD=t=>A0(t,!0),zD=t=>A0(t,!1),O2=t=>kr(t,e=>al(t.state,e,!Xt(t))),E2=t=>kr(t,e=>al(t.state,e,Xt(t)));function C0(t,e){return kr(t,r=>t.moveVertically(r,e))}const O0=t=>C0(t,!1),E0=t=>C0(t,!0);function T0(t,e){return kr(t,r=>t.moveVertically(r,e,y0(t).height))}const P0=t=>T0(t,!1),M0=t=>T0(t,!0),T2=t=>kr(t,e=>ri(t,e,!0)),P2=t=>kr(t,e=>ri(t,e,!1)),M2=t=>kr(t,e=>ri(t,e,!Xt(t))),I2=t=>kr(t,e=>ri(t,e,Xt(t))),D2=t=>kr(t,e=>se.cursor(t.lineBlockAt(e.head).from)),N2=t=>kr(t,e=>se.cursor(t.lineBlockAt(e.head).to)),I0=({state:t,dispatch:e})=>(e(pn(t,{anchor:0})),!0),D0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.doc.length})),!0),N0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.selection.main.anchor,head:0})),!0),R0=({state:t,dispatch:e})=>(e(pn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),R2=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),L2=({state:t,dispatch:e})=>{let r=fl(t).map(({from:n,to:i})=>se.range(n,Math.min(i+1,t.doc.length)));return e(t.update({selection:se.create(r),userEvent:"select"})),!0},B2=({state:t,dispatch:e})=>{let r=cs(t.selection,n=>{var i;let s=Lt(t).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return se.range(a.to,a.from)}return n});return e(pn(t,r)),!0},F2=({state:t,dispatch:e})=>{let r=t.selection,n=null;return r.ranges.length>1?n=se.create([r.main]):r.main.empty||(n=se.create([se.cursor(r.main.head)])),n?(e(pn(t,n)),!0):!1};function us(t,e){if(t.state.readOnly)return!1;let r="delete.selection",{state:n}=t,i=n.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(r="delete.backward",l=ul(t,l,!1)):l>o&&(r="delete.forward",l=ul(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ul(t,o,!1),a=ul(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:se.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(n.update(i,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?de.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ul(t,e,r){if(t instanceof de)for(let n of t.state.facet(de.atomicRanges).map(i=>i(t)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=r?s:i)});return e}const L0=(t,e)=>us(t,r=>{let n=r.from,{state:i}=t,s=i.doc.lineAt(n),o,a;if(!e&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(o=s.text.slice(0,n-s.from))){if(o[o.length-1]==" ")return n-1;let l=Xi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Kt(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)&&(a+=e?1:-1);return a}),Ju=t=>L0(t,!1),B0=t=>L0(t,!0),F0=(t,e)=>us(t,r=>{let n=r.head,{state:i}=t,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let a=null;;){if(n==(e?s.to:s.from)){n==r.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let l=Kt(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=r.head)&&(a=u),n=l}return n}),j0=t=>F0(t,!1),j2=t=>F0(t,!0),V2=t=>us(t,e=>{let r=t.lineBlockAt(e.head).to;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),UD=t=>us(t,e=>{let r=t.lineBlockAt(e.head).from;return e.head>r?r:Math.max(0,e.head-1)}),W2=t=>us(t,e=>{let r=t.moveToLineBoundary(e,!1).head;return e.head>r?r:Math.max(0,e.head-1)}),$2=t=>us(t,e=>{let r=t.moveToLineBoundary(e,!0).head;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)}),GD=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=[];for(let n=0,i="",s=t.doc.iter();;){if(s.next(),s.lineBreak||s.done){let o=i.search(/\s+$/);if(o>-1&&r.push({from:n-(i.length-o),to:n}),s.done)break;i=""}else i=s.value;n+=s.value.length}return r.length?(e(t.update({changes:r,userEvent:"delete"})),!0):!1},H2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Je.of(["",""])},range:se.cursor(n.from)}));return e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},z2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let i=n.from,s=t.doc.lineAt(i),o=i==s.from?i-1:Kt(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Kt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:se.cursor(a)}});return r.changes.empty?!1:(e(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function fl(t){let e=[],r=-1;for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),s=t.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=t.doc.lineAt(n.to-1)),r>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:i.from,to:s.to,ranges:[n]});r=s.number+1}return e}function V0(t,e,r){if(t.readOnly)return!1;let n=[],i=[];for(let s of fl(t)){if(r?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(r?s.to+1:s.from-1),a=o.length+1;if(r){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(se.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(se.range(l.anchor-a,l.head-a))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:se.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const U2=({state:t,dispatch:e})=>V0(t,e,!1),G2=({state:t,dispatch:e})=>V0(t,e,!0);function W0(t,e,r){if(t.readOnly)return!1;let n=[];for(let i of fl(t))r?n.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):n.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const K2=({state:t,dispatch:e})=>W0(t,e,!1),Y2=({state:t,dispatch:e})=>W0(t,e,!0),J2=t=>{if(t.state.readOnly)return!1;let{state:e}=t,r=e.changes(fl(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=cs(e.selection,i=>t.moveVertically(i,!0)).map(r);return t.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},KD=({state:t,dispatch:e})=>(e(t.update(t.replaceSelection(t.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function Q2(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let r=Lt(t).resolveInner(e),n=r.childBefore(e),i=r.childAfter(e),s;return n&&i&&n.to<=e&&i.from>=e&&(s=n.type.prop(Re.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const X2=$0(!1),Z2=$0(!0);function $0(t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&Q2(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new vo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=el(c,s);for(u==null&&(u=Xi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",os(e,u)];return l&&h.push(os(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Je.of(h)},range:se.cursor(s+1+h[1].length)}});return r(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Qu(t,e){let r=-1;return t.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let a=t.doc.lineAt(o);a.number>r&&(n.empty||n.to>a.from)&&(e(a,i,n),r=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:se.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const _2=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Object.create(null),n=new vo(t,{overrideIndentation:s=>{let o=r[s];return o??-1}}),i=Qu(t,(s,o,a)=>{let l=el(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=os(t,l);(c!=u||a.from<s.from+c.length)&&(r[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},Xu=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qu(t,(r,n)=>{n.push({from:r.from,insert:t.facet(qa)})}),{userEvent:"input.indent"})),!0),H0=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Qu(t,(r,n)=>{let i=/^\s*/.exec(r.text)[0];if(!i)return;let s=Xi(i,t.tabSize),o=0,a=os(t,Math.max(0,s-Ai(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:r.from+o,to:r.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),YD=({state:t,dispatch:e})=>t.selection.ranges.some(r=>!r.empty)?Xu({state:t,dispatch:e}):(e(t.update(t.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),q2=[{key:"Ctrl-b",run:u0,shift:S0,preventDefault:!0},{key:"Ctrl-f",run:f0,shift:k0},{key:"Ctrl-p",run:m0,shift:O0},{key:"Ctrl-n",run:v0,shift:E0},{key:"Ctrl-a",run:w2,shift:D2},{key:"Ctrl-e",run:S2,shift:N2},{key:"Ctrl-d",run:B0},{key:"Ctrl-h",run:Ju},{key:"Ctrl-k",run:V2},{key:"Ctrl-Alt-h",run:j0},{key:"Ctrl-o",run:H2},{key:"Ctrl-t",run:z2},{key:"Ctrl-v",run:Yu}],eE=[{key:"ArrowLeft",run:u0,shift:S0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:h2,shift:A2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:b2,shift:M2,preventDefault:!0},{key:"ArrowRight",run:f0,shift:k0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:d2,shift:C2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:x2,shift:I2,preventDefault:!0},{key:"ArrowUp",run:m0,shift:O0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:I0,shift:N0},{mac:"Ctrl-ArrowUp",run:x0,shift:P0},{key:"ArrowDown",run:v0,shift:E0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:D0,shift:R0},{mac:"Ctrl-ArrowDown",run:Yu,shift:M0},{key:"PageUp",run:x0,shift:P0},{key:"PageDown",run:Yu,shift:M0},{key:"Home",run:y2,shift:P2,preventDefault:!0},{key:"Mod-Home",run:I0,shift:N0},{key:"End",run:v2,shift:T2,preventDefault:!0},{key:"Mod-End",run:D0,shift:R0},{key:"Enter",run:X2},{key:"Mod-a",run:R2},{key:"Backspace",run:Ju,shift:Ju},{key:"Delete",run:B0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:j0},{key:"Mod-Delete",mac:"Alt-Delete",run:j2},{mac:"Mod-Backspace",run:W2},{mac:"Mod-Delete",run:$2}].concat(q2.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),tE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:g2,shift:O2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:m2,shift:E2},{key:"Alt-ArrowUp",run:U2},{key:"Shift-Alt-ArrowUp",run:K2},{key:"Alt-ArrowDown",run:G2},{key:"Shift-Alt-ArrowDown",run:Y2},{key:"Escape",run:F2},{key:"Mod-Enter",run:Z2},{key:"Alt-l",mac:"Ctrl-l",run:L2},{key:"Mod-i",run:B2,preventDefault:!0},{key:"Mod-[",run:H0},{key:"Mod-]",run:Xu},{key:"Mod-Alt-\\",run:_2},{key:"Shift-Mod-k",run:J2},{key:"Shift-Mod-\\",run:k2},{key:"Mod-/",run:KO},{key:"Alt-A",run:JO}].concat(eE),rE={key:"Tab",run:Xu,shift:H0};function rt(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var i=r[n];typeof i=="string"?t.setAttribute(n,i):i!=null&&(t[n]=i)}e++}for(;e<arguments.length;e++)z0(t,arguments[e]);return t}function z0(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var r=0;r<e.length;r++)z0(t,e[r]);else throw new RangeError("Unsupported child node: "+e)}const U0=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class fs{constructor(e,r,n=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?a=>s(U0(a)):U0,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ft(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=Ac(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Lr(e);let i=this.normalize(r);for(let s=0,o=n;;s++){let a=i.charCodeAt(s),l=this.match(a,o);if(s==i.length-1){if(l)return this.value=l,this;break}o==n&&s<r.length&&r.charCodeAt(s)==a&&o++}}}match(e,r){let n=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],o=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?n={from:this.matches[i+1],to:r+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:r,to:r+1}:this.matches.push(1,r)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}typeof Symbol<"u"&&(fs.prototype[Symbol.iterator]=function(){return this});const G0={from:-1,to:-1,match:/.*/.exec("")},Zu="gm"+(/x/.unicode==null?"":"u");class K0{constructor(e,r,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=G0,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Y0(e,r,n,i,s);this.re=new RegExp(r,Zu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=hl(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=hl(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const _u=new WeakMap;class hs{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let i=_u.get(e);if(!i||i.from>=n||i.to<=r){let a=new hs(r,e.sliceString(r,n));return _u.set(e,a),a}if(i.from==r&&i.to==n)return i;let{text:s,from:o}=i;return o>r&&(s=e.sliceString(r,o)+s,o=r),i.to<n&&(s+=e.sliceString(i.to,n)),_u.set(e,new hs(o,s)),new hs(r,s.slice(r-o,n-o))}}class Y0{constructor(e,r,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=G0,this.matchPos=hl(e,i),this.re=new RegExp(r,Zu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=hs.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,match:r},this.matchPos=hl(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=hs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(K0.prototype[Symbol.iterator]=Y0.prototype[Symbol.iterator]=function(){return this});function nE(t){try{return new RegExp(t,Zu),!0}catch{return!1}}function hl(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}function qu(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),r=rt("input",{class:"cm-textfield",name:"line",value:e}),n=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:dl.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",t.state.phrase("Go to line"),": ",r)," ",rt("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!s)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,h]=s,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=se.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[dl.of(!1),de.scrollIntoView(y.from,{y:"center"})],selection:y}),t.focus()}return{dom:n}}const dl=Ae.define(),J0=At.define({create(){return!0},update(t,e){for(let r of e.effects)r.is(dl)&&(t=r.value);return t},provide:t=>po.from(t,e=>e?qu:null)}),iE=t=>{let e=ho(t,qu);if(!e){let r=[dl.of(!0)];t.state.field(J0,!1)==null&&r.push(Ae.appendConfig.of([J0,sE])),t.dispatch({effects:r}),e=ho(t,qu)}return e&&e.dom.querySelector("input").select(),!0},sE=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),oE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Q0=pe.define({combine(t){return Ur(t,oE,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function aE(t){let e=[hE,fE];return t&&e.push(Q0.of(t)),e}const lE=ke.mark({class:"cm-selectionMatch"}),cE=ke.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function X0(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=at.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=at.Word)}function uE(t,e,r,n){return t(e.sliceDoc(r,r+1))==at.Word&&t(e.sliceDoc(n-1,n))==at.Word}const fE=ft.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Q0),{state:r}=t,n=r.selection;if(n.ranges.length>1)return ke.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ke.none;let l=r.wordAt(i.head);if(!l)return ke.none;o=r.charCategorizer(i.head),s=r.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ke.none;if(e.wholeWords){if(s=r.sliceDoc(i.from,i.to),o=r.charCategorizer(i.head),!(X0(o,r,i.from,i.to)&&uE(o,r,i.from,i.to)))return ke.none}else if(s=r.sliceDoc(i.from,i.to).trim(),!s)return ke.none}let a=[];for(let l of t.visibleRanges){let c=new fs(r.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||X0(o,r,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(cE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(lE.range(u,h)),a.length>e.maxMatches))return ke.none}}return ke.set(a)}},{decorations:t=>t.decorations}),hE=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),dE=({state:t,dispatch:e})=>{let{selection:r}=t,n=se.create(r.ranges.map(i=>t.wordAt(i.head)||se.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function pE(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let o=!1,a=new fs(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new fs(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const gE=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(s=>s.from===s.to))return dE({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=n))return!1;let i=pE(t,n);return i?(e(t.update({selection:t.selection.addRange(se.range(i.from,i.to),!1),effects:de.scrollIntoView(i.to)})),!0):!1},Ci=pe.define({combine(t){return Ur(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new EE(e),scrollToMatch:e=>de.scrollIntoView(e)})}});function JD(t){return t?[Ci.of(t),sf]:sf}class Z0{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||nE(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
153
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new bE(this):new vE(this)}getCursor(e,r=0,n){let i=e.doc?e:Ve.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ps(this,i,r,n):ds(this,i,r,n)}}class _0{constructor(e){this.spec=e}}function ds(t,e,r,n){return new fs(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?mE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function mE(t,e){return(r,n,i,s)=>((s>r||s+i.length<n)&&(s=Math.max(0,r-2),i=t.sliceString(s,Math.min(t.length,n+2))),(e(pl(i,r-s))!=at.Word||e(gl(i,r-s))!=at.Word)&&(e(gl(i,n-s))!=at.Word||e(pl(i,n-s))!=at.Word))}class vE extends _0{constructor(e){super(e)}nextMatch(e,r,n){let i=ds(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=ds(this.spec,e,0,r).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=n;;){let s=Math.max(r,i-1e4-this.spec.unquoted.length),o=ds(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==r)return null;i-=1e4}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=ds(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=ds(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ps(t,e,r,n){return new K0(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?yE(e.charCategorizer(e.selection.main.head)):void 0},r,n)}function pl(t,e){return t.slice(Kt(t,e,!1),e)}function gl(t,e){return t.slice(e,Kt(t,e))}function yE(t){return(e,r,n)=>!n[0].length||(t(pl(n.input,n.index))!=at.Word||t(gl(n.input,n.index))!=at.Word)&&(t(gl(n.input,n.index+n[0].length))!=at.Word||t(pl(n.input,n.index+n[0].length))!=at.Word)}class bE extends _0{nextMatch(e,r,n){let i=ps(this.spec,e,n,e.doc.length).next();return i.done&&(i=ps(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let s=Math.max(r,n-i*1e4),o=ps(this.spec,e,s,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==r||a.from>s+10))return a;if(s==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(r,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:r))}matchAll(e,r){let n=ps(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=ps(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ao=Ae.define(),ef=Ae.define(),gn=At.define({create(t){return new tf(yl(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Ao)?t=new tf(r.value.create(),t.panel):r.is(ef)&&(t=new tf(t.query,r.value?rf:null));return t},provide:t=>po.from(t,e=>e.panel)});function QD(t){let e=t.field(gn,!1);return e?e.query.spec:yl(t)}function XD(t){var e;return((e=t.field(gn,!1))===null||e===void 0?void 0:e.panel)!=null}class tf{constructor(e,r){this.query=e,this.panel=r}}const xE=ke.mark({class:"cm-searchMatch"}),wE=ke.mark({class:"cm-searchMatch cm-searchMatch-selected"}),SE=ft.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(gn))}update(t){let e=t.state.field(gn);(e!=t.startState.field(gn)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ke.none;let{view:r}=this,n=new Kn;for(let i=0,s=r.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(r.state,a,l,(c,u)=>{let h=r.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,h?wE:xE)})}return n.finish()}},{decorations:t=>t.decorations});function Co(t){return e=>{let r=e.state.field(gn,!1);return r&&r.query.spec.valid?t(e,r):rv(e)}}const ml=Co((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=se.single(n.from,n.to),s=t.state.facet(Ci);return t.dispatch({selection:i,effects:[nf(t,n),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),tv(t),!0}),vl=Co((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let s=se.single(i.from,i.to),o=t.state.facet(Ci);return t.dispatch({selection:s,effects:[nf(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),tv(t),!0}),kE=Co((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:se.create(r.map(n=>se.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),AE=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],o=0;for(let a=new fs(t.doc,t.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(se.range(a.value.from,a.value.to))}return e(t.update({selection:se.create(s,o),userEvent:"select.search.matches"})),!0},q0=Co((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=e.nextMatch(r,n,n);if(!s)return!1;let o=[],a,l,c=[];if(s.from==n&&s.to==i&&(l=r.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(r,s.from,s.to),c.push(de.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=se.single(s.from-u,s.to-u),c.push(nf(t,s)),c.push(r.facet(Ci).scrollToMatch(a.main,t))}return t.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),CE=Co((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:de.announce.of(n),userEvent:"input.replace.all"}),!0});function rf(t){return t.state.facet(Ci).createPanel(t)}function yl(t,e){var r,n,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Ci);return new Z0({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function ev(t){let e=ho(t,rf);return e&&e.dom.querySelector("[main-field]")}function tv(t){let e=ev(t);e&&e==t.root.activeElement&&e.select()}const rv=t=>{let e=t.state.field(gn,!1);if(e&&e.panel){let r=ev(t);if(r&&r!=t.root.activeElement){let n=yl(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ao.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[ef.of(!0),e?Ao.of(yl(t.state,e.query.spec)):Ae.appendConfig.of(sf)]});return!0},nv=t=>{let e=t.state.field(gn,!1);if(!e||!e.panel)return!1;let r=ho(t,rf);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ef.of(!1)}),!0},OE=[{key:"Mod-f",run:rv,scope:"editor search-panel"},{key:"F3",run:ml,shift:vl,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ml,shift:vl,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:nv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:AE},{key:"Alt-g",run:iE},{key:"Mod-d",run:gE,preventDefault:!0}];class EE{constructor(e){this.view=e;let r=this.query=e.state.field(gn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:r.search,placeholder:Ar(e,"Find"),"aria-label":Ar(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:r.replace,placeholder:Ar(e,"Replace"),"aria-label":Ar(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>ml(e),[Ar(e,"next")]),n("prev",()=>vl(e),[Ar(e,"previous")]),n("select",()=>kE(e),[Ar(e,"all")]),rt("label",null,[this.caseField,Ar(e,"match case")]),rt("label",null,[this.reField,Ar(e,"regexp")]),rt("label",null,[this.wordField,Ar(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>q0(e),[Ar(e,"replace")]),n("replaceAll",()=>CE(e),[Ar(e,"replace all")])],rt("button",{name:"close",onclick:()=>nv(e),"aria-label":Ar(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Z0({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ao.of(e)}))}keydown(e){JA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vl:ml)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),q0(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Ao)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ci).top}}function Ar(t,e){return t.state.phrase(e)}const bl=30,xl=/[\s\.,:;?!]/;function nf(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,s=Math.max(n.from,e-bl),o=Math.min(i,r+bl),a=t.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<bl;l++)if(!xl.test(a[l+1])&&xl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-bl;l--)if(!xl.test(a[l-1])&&xl.test(a[l])){a=a.slice(0,l);break}}return de.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const TE=de.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sf=[gn,xi.low(SE),TE];class iv{constructor(e,r,n){this.state=e,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let r=Lt(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),s=i.search(av(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,r){e=="abort"&&this.abortListeners&&this.abortListeners.push(r)}}function sv(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PE(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)r[i[s]]=!0}let n=sv(e)+sv(r)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function ME(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:PE(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:r}:null}}function ZD(t,e){return r=>{for(let n=syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return e(r);if(n.type.isTop)break}return null}}function _D(t,e){return r=>{for(let n=syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}class ov{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}}function ni(t){return t.selection.main.from}function av(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}const lv=an.define();function IE(t,e,r,n){let{main:i}=t.selection,s=r-i.from,o=n-i.from;return Object.assign(Object.assign({},t.changeByRange(a=>a!=i&&r!=n&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(r,n)?{range:a}:{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:e},range:se.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const cv=new WeakMap;function DE(t){if(!Array.isArray(t))return t;let e=cv.get(t);return e||cv.set(t,e=ME(t)),e}const of=Ae.define(),Oo=Ae.define();class NE{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<e.length;){let n=Ft(e,r),i=Lr(n);this.chars.push(n);let s=e.slice(r,r+i),o=s.toUpperCase();this.folded.push(Ft(o==s?s.toLowerCase():o,0)),r+=i}this.astral=e.length!=this.chars.length}ret(e,r){return this.score=e,this.matched=r,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:r,folded:n,any:i,precise:s,byWord:o}=this;if(r.length==1){let T=Ft(e,0),E=Lr(T),B=E==e.length?0:-100;if(T!=r[0])if(T==n[0])B+=-200;else return!1;return this.ret(B,[0,E])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=r.length,c=0;if(a<0){for(let T=0,E=Math.min(e.length,200);T<E&&c<l;){let B=Ft(e,T);(B==r[c]||B==n[c])&&(i[c++]=T),T+=Lr(B)}if(c<l)return!1}let u=0,h=0,d=!1,p=0,m=-1,y=-1,w=/[a-z]/.test(e),A=!0;for(let T=0,E=Math.min(e.length,200),B=0;T<E&&h<l;){let I=Ft(e,T);a<0&&(u<l&&I==r[u]&&(s[u++]=T),p<l&&(I==r[p]||I==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let W,F=I<255?I>=48&&I<=57||I>=97&&I<=122?2:I>=65&&I<=90?1:0:(W=Ac(I))!=W.toLowerCase()?1:W!=W.toUpperCase()?2:0;(!T||F==1&&w||B==0&&F!=0)&&(r[h]==I||n[h]==I&&(d=!0)?o[h++]=T:o.length&&(A=!1)),B=F,T+=Lr(I)}return h==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-200+-700-e.length,[m,y]):h==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,e):r.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],s=0;for(let o of r){let a=o+(this.astral?Lr(Ft(n,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-n.length,i)}}const Zt=pe.define({combine(t){return Ur(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RE,compareCompletions:(e,r)=>e.label.localeCompare(r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>uv(e(n),r(n)),optionClass:(e,r)=>n=>uv(e(n),r(n)),addToOptions:(e,r)=>e.concat(r)})}});function uv(t,e){return t?e?t+" "+e:t:e}function RE(t,e,r,n,i,s){let o=t.textDirection==ht.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,p=i.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&d<Math.min(m,p)?a=!1:!a&&p<Math.min(m,d)&&(a=!0),m<=(a?d:p))u=Math.max(i.top,Math.min(r.top,i.bottom-y))-e.top,h=Math.min(400,a?d:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=y||T>e.top?u=r.bottom-e.top:(c="bottom",u=e.bottom-r.top)}let w=(e.bottom-e.top)/s.offsetHeight,A=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${h/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function LE(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=r.displayLabel||r.label,l=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,h))),d.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(r){if(!r.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=r.detail,n},position:80}),e.sort((r,n)=>r.position-n.position).map(r=>r.render)}function af(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.floor((t-e)/r);return{from:t-(n+1)*r,to:t-n*r}}class BE{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:s,selected:o}=i.open,a=e.state.facet(Zt);this.optionContent=LE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=af(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(r).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Zt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Oo.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:o,disabled:a}=n.open;(!i.open||i.open.options!=s)&&(this.range=af(s.length,o,e.state.facet(Zt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;if((r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=af(r.options.length,r.selected,this.view.state.facet(Zt).maxRenderedOptions),this.showOptions(r.options,e.id)),this.updateSelectedOption(r.selected)){this.destroyInfo();let{completion:n}=r.options[r.selected],{info:i}=n;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>br(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return r&&jE(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(s.bottom,r.bottom)-10||i.bottom<Math.max(s.top,r.top)+10?null:this.view.state.facet(Zt).positionInfo(this.view,r,i,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,r,n){const i=document.createElement("ul");i.id=r,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=r+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let p=d(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function FE(t,e){return r=>new BE(r,t,e)}function jE(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.top<r.top?t.scrollTop-=(r.top-n.top)/i:n.bottom>r.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function fv(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function VE(t,e){let r=[],n=null,i=l=>{r.push(l);let{section:c}=l.completion;if(c){n||(n=[]);let u=typeof c=="string"?c:c.name;n.some(h=>h.name==u)||n.push(typeof c=="string"?{name:u}:c)}};for(let l of t)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let u of l.result.options)i(new ov(u,l.source,c?c(u):[],1e9-r.length));else{let u=new NE(e.sliceDoc(l.from,l.to));for(let h of l.result.options)if(u.match(h.label)){let d=h.displayLabel?c?c(h,u.matched):[]:u.matched;i(new ov(h,l.source,d,u.score+(h.boost||0)))}}}if(n){let l=Object.create(null),c=0,u=(h,d)=>{var p,m;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(h.name<d.name?-1:1)};for(let h of n.sort(u))c-=1e5,l[h.name]=c;for(let h of r){let{section:d}=h.completion;d&&(h.score+=l[typeof d=="string"?d:d.name])}}let s=[],o=null,a=e.facet(Zt).compareCompletions;for(let l of r.sort((c,u)=>u.score-c.score||a(c.completion,u.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?s.push(l):fv(l.completion)>fv(o)&&(s[s.length-1]=l),o=l.completion}return s}class gs{constructor(e,r,n,i,s,o){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new gs(this.options,hv(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,s){let o=VE(e,r);if(!o.length)return i&&e.some(l=>l.state==1)?new gs(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=r.facet(Zt).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new gs(o,hv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:UE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new gs(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class wl{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new wl(HE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Zt),s=(n.override||r.languageDataAt("autocomplete",ni(r)).map(DE)).map(a=>(this.active.find(c=>c.source==a)||new cr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!WE(s,this.active)?o=gs.build(s,r,this.id,o,n):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new cr(a.source,0):a));for(let a of e.effects)a.is(cf)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new wl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:$E}}function WE(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r<t.length&&!t[r].hasResult;)r++;for(;n<e.length&&!e[n].hasResult;)n++;let i=r==t.length,s=n==e.length;if(i||s)return i==s;if(t[r++].result!=e[n++].result)return!1}}const $E={"aria-autocomplete":"list"};function hv(t,e){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(r["aria-activedescendant"]=t+"-"+e),r}const HE=[];function lf(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class cr{constructor(e,r,n=-1){this.source=e,this.state=r,this.explicitPos=n}hasResult(){return!1}update(e,r){let n=lf(e),i=this;n?i=i.handleUserEvent(e,n,r):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new cr(i.source,0));for(let s of e.effects)if(s.is(of))i=new cr(i.source,1,s.value?ni(e.state):-1);else if(s.is(Oo))i=new cr(i.source,0);else if(s.is(dv))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,r,n){return r=="delete"||!n.activateOnTyping?this.map(e.changes):new cr(this.source,1)}handleChange(e){return e.changes.touchesRange(ni(e.startState))?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new cr(this.source,this.state,e.mapPos(this.explicitPos))}}class ms extends cr{constructor(e,r,n,i,s){super(e,2,r),this.result=n,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,r,n){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ni(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||r=="delete"&&ni(e.startState)==this.from)return new cr(this.source,r=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return zE(this.result.validFor,e.state,s,o)?new ms(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new iv(e.state,a,l>=0)))?new ms(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ni(e.state)):new cr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new cr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ms(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function zE(t,e,r,n){if(!t)return!1;let i=e.sliceDoc(r,n);return typeof t=="function"?t(i,r,n,e):av(t,!0).test(i)}const dv=Ae.define({map(t,e){return t.map(r=>r.map(e))}}),cf=Ae.define(),Wt=At.define({create(){return wl.start()},update(t,e){return t.update(e)},provide:t=>[Qa.from(t,e=>e.tooltip),de.contentAttributes.from(t,e=>e.attrs)]});function pv(t,e){const r=e.completion.apply||e.completion.label;let n=t.state.field(Wt).active.find(i=>i.source==e.source);return n instanceof ms?(typeof r=="string"?t.dispatch(Object.assign(Object.assign({},IE(t.state,r,n.from,n.to)),{annotations:lv.of(e.completion)})):r(t,e.completion,n.from,n.to),!0):!1}const UE=FE(Wt,pv);function Sl(t,e="option"){return r=>{let n=r.state.field(Wt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<r.state.facet(Zt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=ym(r,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),r.dispatch({effects:cf.of(a)}),!0}}const GE=t=>{let e=t.state.field(Wt,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Zt).interactionDelay?!1:pv(t,e.open.options[e.open.selected])},KE=t=>t.state.field(Wt,!1)?(t.dispatch({effects:of.of(!0)}),!0):!1,YE=t=>{let e=t.state.field(Wt,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:Oo.of(null)}),!0)};class JE{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const QE=50,XE=1e3,ZE=ft.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(Wt).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(Wt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Wt)==e)return;let r=t.transactions.some(n=>(n.selection||n.docChanged)&&!lf(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(r||i.updates.length+t.transactions.length>QE&&Date.now()-i.time>XE){for(let s of i.context.abortListeners)try{s()}catch(o){br(this.view.state,o)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(i=>i.active.source==n.source))?setTimeout(()=>this.startUpdate(),50):-1,this.composing!=0)for(let n of t.transactions)lf(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Wt);for(let r of e.active)r.state==1&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r)}startQuery(t){let{state:e}=this.view,r=ni(e),n=new iv(e,r,t.explicitPos==r),i=new JE(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Oo.of(null)}),br(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Zt);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;if(this.running.splice(n--,1),i.done){let o=new ms(i.active.source,i.active.explicitPos,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:ni(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,r);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(Wt).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new cr(i.active.source,0);for(let a of i.updates)o=o.update(a,r);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:dv.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Wt,!1);if(e&&e.tooltip&&this.view.state.facet(Zt).closeOnBlur){let r=e.open&&ym(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&this.view.dispatch({effects:Oo.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:of.of(!1)}),20),this.composing=0}}}),gv=de.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class _E{constructor(e,r,n,i){this.field=e,this.line=r,this.from=n,this.to=i}}class uf{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return r==null||n==null?null:new uf(this.field,r,n)}}class ff{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],i=[r],s=e.doc.lineAt(r),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(indentUnit);i.push(r+c.length-u),l=c+l.slice(u)}n.push(l),r+=l.length+1}let a=this.fieldPositions.map(l=>new uf(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let r=[],n=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1;for(let u=0;u<r.length;u++)(a!=null?r[u].seq==a:l&&r[u].name==l)&&(c=u);if(c<0){let u=0;for(;u<r.length&&(a==null||r[u].seq!=null&&r[u].seq<a);)u++;r.splice(u,0,{seq:a,name:l}),c=u;for(let h of i)h.field>=c&&h.field++}i.push(new _E(c,n.length,s.index,s.index+l.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of i)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(o)}return new ff(n,i)}}let qE=ke.widget({widget:new class extends ln{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),eT=ke.mark({class:"cm-snippetField"});class vs{constructor(e,r){this.ranges=e,this.active=r,this.deco=ke.set(e.map(n=>(n.from==n.to?qE:eT).range(n.from,n.to)))}map(e){let r=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;r.push(i)}return new vs(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}}const Eo=Ae.define({map(t,e){return t&&t.map(e)}}),tT=Ae.define(),Oi=At.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(Eo))return r.value;if(r.is(tT)&&t)return new vs(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>de.decorations.from(t,e=>e?e.deco:ke.none)});function hf(t,e){return se.create(t.filter(r=>r.field==e).map(r=>se.range(r.from,r.to)))}function rT(t){let e=ff.parse(t);return(r,n,i,s)=>{let{text:o,ranges:a}=e.instantiate(r.state,i),l={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?lv.of(n):void 0};if(a.length&&(l.selection=hf(a,0)),a.length>1){let c=new vs(a,0),u=l.effects=[Eo.of(c)];r.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,aT,lT,gv]))}r.dispatch(r.state.update(l))}}function mv(t){return({state:e,dispatch:r})=>{let n=e.field(Oi,!1);if(!n||t<0&&n.active==0)return!1;let i=n.active+t,s=t>0&&!n.ranges.some(o=>o.field==i+t);return r(e.update({selection:hf(n.ranges,i),effects:Eo.of(s?null:new vs(n.ranges,i)),scrollIntoView:!0})),!0}}const nT=({state:t,dispatch:e})=>t.field(Oi,!1)?(e(t.update({effects:Eo.of(null)})),!0):!1,iT=mv(1),sT=mv(-1);function qD(t){let e=t.field(Oi,!1);return!!(e&&e.ranges.some(r=>r.field==e.active+1))}function e3(t){let e=t.field(Oi,!1);return!!(e&&e.active>0)}const oT=[{key:"Tab",run:iT,shift:sT},{key:"Escape",run:nT}],vv=pe.define({combine(t){return t.length?t[0]:oT}}),aT=xi.highest(ao.compute([vv],t=>t.facet(vv)));function t3(t,e){return Object.assign(Object.assign({},e),{apply:rT(t)})}const lT=de.domEventHandlers({mousedown(t,e){let r=e.state.field(Oi,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=r.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==r.active?!1:(e.dispatch({selection:hf(r.ranges,i.field),effects:Eo.of(r.ranges.some(s=>s.field>i.field)?new vs(r.ranges,i.field):null),scrollIntoView:!0}),!0)}});function cT(t){let e=t.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function yv(t,e){return new RegExp(e(t.source),t.unicode?"u":"")}const bv=null;function uT(t){return bv[t]||(bv[t]=new WeakMap)}function xv(t,e,r,n,i){for(let s=t.iterLines(),o=0;!s.next().done;){let{value:a}=s,l;for(e.lastIndex=0;l=e.exec(a);)if(!n[l[0]]&&o+l.index!=i&&(r.push({type:"text",label:l[0]}),n[l[0]]=!0,r.length>=2e3))return;o+=a.length+1}}function wv(t,e,r,n,i){let s=t.length>=1e3,o=s&&e.get(t);if(o)return o;let a=[],l=Object.create(null);if(t.children){let c=0;for(let u of t.children){if(u.length>=1e3)for(let h of wv(u,e,r,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else xv(u,r,a,l,i-c);c+=u.length+1}}else xv(t,r,a,l,i);return s&&a.length<2e3&&e.set(t,a),a}const r3=t=>{let e=t.state.languageDataAt("wordChars",t.pos).join(""),r=cT(e),n=t.matchBefore(yv(r,o=>o+"$"));if(!n&&!t.explicit)return null;let i=n?n.from:t.pos,s=wv(t.state.doc,uT(e),r,5e4,i);return{from:i,options:s,validFor:yv(r,o=>"^"+o)}},To={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(t,e){let r=e.mapPos(t,-1,ir.TrackAfter);return r??void 0}}),df=new class extends wi{};df.startSide=1,df.endSide=-1;const Sv=At.define({create(){return Qe.empty},update(t,e){if(e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}t=t.map(e.changes);for(let r of e.effects)r.is(Ei)&&(t=t.update({add:[df.range(r.value,r.value+1)]}));return t}});function fT(){return[dT,Sv]}const pf="()[]{}<>";function kv(t){for(let e=0;e<pf.length;e+=2)if(pf.charCodeAt(e)==t)return pf.charAt(e+1);return Ac(t<128?t:t+1)}function Av(t,e){return t.languageDataAt("closeBrackets",e)[0]||To}const hT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),dT=de.inputHandler.of((t,e,r,n)=>{if((hT?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&Lr(Ft(n,0))==1||e!=i.from||r!=i.to)return!1;let s=gT(t.state,n);return s?(t.dispatch(s),!0):!1}),pT=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Av(t,t.selection.main.head).brackets||To.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=mT(t.doc,o.head);for(let l of n)if(l==a&&kl(t.doc,o.head)==kv(Ft(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:se.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function gT(t,e){let r=Av(t,t.selection.main.head),n=r.brackets||To.brackets;for(let i of n){let s=kv(Ft(i,0));if(e==i)return s==i?bT(t,i,n.indexOf(i+i+i)>-1,r):vT(t,i,s,r.before||To.before);if(e==s&&Cv(t,t.selection.main.from))return yT(t,i,s)}return null}function Cv(t,e){let r=!1;return t.field(Sv).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function kl(t,e){let r=t.sliceString(e,e+2);return r.slice(0,Lr(Ft(r,0)))}function mT(t,e){let r=t.sliceString(e-2,e);return Lr(Ft(r,0))==r.length?r:r.slice(1)}function vT(t,e,r,n){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:r,from:o.to}],effects:Ei.of(o.to+e.length),range:se.range(o.anchor+e.length,o.head+e.length)};let a=kl(t.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+r,from:o.head},effects:Ei.of(o.head+e.length),range:se.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function yT(t,e,r){let n=null,i=t.changeByRange(s=>s.empty&&kl(t.doc,s.head)==r?{changes:{from:s.head,to:s.head+r.length,insert:r},range:se.cursor(s.head+r.length)}:n={range:s});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function bT(t,e,r,n){let i=n.stringPrefixes||To.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ei.of(a.to+e.length),range:se.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=kl(t.doc,l),u;if(c==e){if(Ov(t,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(Cv(t,l)){let d=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:se.cursor(l+d.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=Ev(t,l-2*e.length,i))>-1&&Ov(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=at.Word&&Ev(t,l,i)>-1&&!xT(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:se.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ov(t,e){let r=Lt(t).resolveInner(e+1);return r.parent&&r.from==e}function xT(t,e,r,n){let i=Lt(t).resolveInner(e,-1),s=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),l=a.indexOf(r);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>r.length+l;){if(t.sliceDoc(u.to-r.length,u.to)==r)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Ev(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=at.Word)return e;for(let i of r){let s=e-i.length;if(t.sliceDoc(s,e)==i&&n(t.sliceDoc(s-1,s))!=at.Word)return s}return-1}function wT(t={}){return[Wt,Zt.of(t),ZE,ST,gv]}const Tv=[{key:"Ctrl-Space",run:KE},{key:"Escape",run:YE},{key:"ArrowDown",run:Sl(!0)},{key:"ArrowUp",run:Sl(!1)},{key:"PageDown",run:Sl(!0,"page")},{key:"PageUp",run:Sl(!1,"page")},{key:"Enter",run:GE}],ST=xi.highest(ao.computeN([Zt],t=>t.facet(Zt).defaultKeymap?[Tv]:[]));function i3(t){let e=t.field(Wt,!1);return e&&e.active.some(r=>r.state==1)?"pending":e&&e.active.some(r=>r.state!=0)?"active":null}const Pv=new WeakMap;function s3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;if(!r||r.disabled)return[];let n=Pv.get(r.options);return n||Pv.set(r.options,n=r.options.map(i=>i.completion)),n}function o3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;return r&&!r.disabled&&r.selected>=0?r.options[r.selected].completion:null}function a3(t){var e;let r=(e=t.field(Wt,!1))===null||e===void 0?void 0:e.open;return r&&!r.disabled&&r.selected>=0?r.selected:null}function l3(t){return cf.of(t)}class kT{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class Ti{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let i=e,s=n.facet(Pi).markerFilter;s&&(i=s(i));let o=ke.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?ke.widget({widget:new IT(a),diagnostic:a}).range(a.from):ke.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ti(o,r,ys(o))}}function ys(t,e=null,r=0){let n=null;return t.between(r,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new kT(i,s,o.diagnostic),!1}),n}function Mv(t,e){let r=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(n=>n.is(Al))||t.changes.touchesRange(r.from,r.to))}function Iv(t,e){return t.field(_t,!1)?e:e.concat(Ae.appendConfig.of(Hv))}function AT(t,e){return{effects:Iv(t,[Al.of(e)])}}const Al=Ae.define(),gf=Ae.define(),Dv=Ae.define(),_t=At.define({create(){return new Ti(ke.none,null,null)},update(t,e){if(e.docChanged){let r=t.diagnostics.map(e.changes),n=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);n=ys(r,t.selected.diagnostic,i)||ys(r,null,i)}t=new Ti(r,t.panel,n)}for(let r of e.effects)r.is(Al)?t=Ti.init(r.value,t.panel,e.state):r.is(gf)?t=new Ti(t.diagnostics,r.value?Cl.open:null,t.selected):r.is(Dv)&&(t=new Ti(t.diagnostics,t.panel,r.value));return t},provide:t=>[po.from(t,e=>e.panel),de.decorations.from(t,e=>e.diagnostics)]});function c3(t){let e=t.field(_t,!1);return e?e.diagnostics.size:0}const CT=ke.mark({class:"cm-lintRange cm-lintRange-active"});function OT(t,e,r){let{diagnostics:n}=t.state.field(_t),i=[],s=2e8,o=0;n.between(e-(r<0?1:0),e+(r>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||r>0)&&(e<c||r<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=t.state.facet(Pi).tooltipFilter;return a&&(i=a(i)),i.length?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:Nv(t,i)}}}:null}function Nv(t,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(r=>Fv(t,r,!1)))}const ET=t=>{let e=t.state.field(_t,!1);(!e||!e.panel)&&t.dispatch({effects:Iv(t.state,[gf.of(!0)])});let r=ho(t,Cl.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Rv=t=>{let e=t.state.field(_t,!1);return!e||!e.panel?!1:(t.dispatch({effects:gf.of(!1)}),!0)},TT=t=>{let e=t.state.field(_t,!1);if(!e)return!1;let r=t.state.selection.main,n=e.diagnostics.iter(r.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},u3=t=>{let{state:e}=t,r=e.field(_t,!1);if(!r)return!1;let n=e.selection.main,i,s,o,a;return r.diagnostics.between(0,e.doc.length,(l,c)=>{c<n.to&&(i==null||i<l)&&(i=l,s=c),(o==null||l>o)&&(o=l,a=c)}),o==null||i==null&&o==n.from?!1:(t.dispatch({selection:{anchor:i??o,head:s??a},scrollIntoView:!0}),!0)},PT=[{key:"Mod-Shift-m",run:ET,preventDefault:!0},{key:"F8",run:TT}],Lv=ft.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(Pi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:r}=e.facet(Pi);Promise.all(r.map(n=>Promise.resolve(n(this.view)))).then(n=>{let i=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(AT(this.view.state,i))},n=>{br(this.view.state,n)})}}update(t){let e=t.state.facet(Pi);(t.docChanged||e!=t.startState.facet(Pi)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Pi=pe.define({combine(t){return Object.assign({sources:t.map(e=>e.source)},Ur(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r}))}});function MT(t,e={}){return[Pi.of({source:t,config:e}),Lv,Hv]}function f3(t){let e=t.plugin(Lv);e&&e.force()}function Bv(t){let e=[];if(t)e:for(let{name:r}of t){for(let n=0;n<r.length;n++){let i=r[n];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Fv(t,e,r){var n;let i=r?Bv(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=ys(t.state.field(_t).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),rt("u",c.slice(u,u+1)),c.slice(u+1)];return rt("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class IT extends ln{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class jv{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Fv(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Cl{constructor(e){this.view=e,this.items=[];let r=i=>{if(i.keyCode==27)Rv(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Bv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=ys(this.view.state.field(_t).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},n=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Rv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(_t).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(_t),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==l.diagnostic){c=h;break}c<0?(u=new jv(this.view,l.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),i=!0)),r&&u.diagnostic==r.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new jv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(_t),n=ys(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Dv.of(n)})}static open(e){return new Cl(e)}}function Ol(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function El(t){return Ol(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const DT=de.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:El("#d11")},".cm-lintRange-warning":{backgroundImage:El("orange")},".cm-lintRange-info":{backgroundImage:El("#999")},".cm-lintRange-hint":{backgroundImage:El("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Vv(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}class NT extends fn{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((r,n)=>Vv(r)<Vv(n.severity)?n.severity:r,"hint")}toDOM(e){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(Tl).tooltipFilter;return i&&(n=i(n)),n.length&&(r.onmouseover=()=>LT(e,r,n)),r}}function RT(t,e){let r=n=>{let i=e.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),t.state.field($v)&&t.dispatch({effects:mf.of(null)})}};window.addEventListener("mousemove",r)}function LT(t,e,r){function n(){let o=t.elementAtHeight(e.getBoundingClientRect().top+5-t.documentTop);t.coordsAtPos(o.from)&&t.dispatch({effects:mf.of({pos:o.from,above:!1,create(){return{dom:Nv(t,r),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,RT(t,e)}let{hoverTime:i}=t.state.facet(Tl),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function BT(t,e){let r=Object.create(null);for(let i of e){let s=t.lineAt(i.from);(r[s.from]||(r[s.from]=[])).push(i)}let n=[];for(let i in r)n.push(new NT(r[i]).range(+i));return Qe.of(n,!0)}const FT=wm({class:"cm-gutter-lint",markers:t=>t.state.field(Wv)}),Wv=At.define({create(){return Qe.empty},update(t,e){t=t.map(e.changes);let r=e.state.facet(Tl).markerFilter;for(let n of e.effects)if(n.is(Al)){let i=n.value;r&&(i=r(i||[])),t=BT(e.state.doc,i.slice(0))}return t}}),mf=Ae.define(),$v=At.define({create(){return null},update(t,e){return t&&e.docChanged&&(t=Mv(e,t)?null:Object.assign(Object.assign({},t),{pos:e.changes.mapPos(t.pos)})),e.effects.reduce((r,n)=>n.is(mf)?n.value:r,t)},provide:t=>Qa.from(t)}),jT=de.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Ol('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Ol('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Ol('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Hv=[_t,de.decorations.compute([_t],t=>{let{selected:e,panel:r}=t.field(_t);return!e||!r||e.from==e.to?ke.none:ke.set([CT.range(e.from,e.to)])}),RC(OT,{hideOn:Mv}),DT],Tl=pe.define({combine(t){return Ur(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function h3(t={}){return[Tl.of(t),Wv,FT,jT,$v]}function d3(t,e){let r=t.field(_t,!1);if(r&&r.diagnostics.size)for(let n=RangeSet.iter([r.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}var zv=function(e){e===void 0&&(e={});var{crosshairCursor:r=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(pT)),e.defaultKeymap!==!1&&(n=n.concat(tE)),e.searchKeymap!==!1&&(n=n.concat(OE)),e.historyKeymap!==!1&&(n=n.concat(f2)),e.foldKeymap!==!1&&(n=n.concat(vO)),e.completionKeymap!==!1&&(n=n.concat(Tv)),e.lintKeymap!==!1&&(n=n.concat(PT));var i=[];return e.lineNumbers!==!1&&i.push(HC()),e.highlightActiveLineGutter!==!1&&i.push(GC()),e.highlightSpecialChars!==!1&&i.push(uC()),e.history!==!1&&i.push(r2()),e.foldGutter!==!1&&i.push(wO()),e.drawSelection!==!1&&i.push(eC()),e.dropCursor!==!1&&i.push(sC()),e.allowMultipleSelections!==!1&&i.push(Ve.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(oO()),e.syntaxHighlighting!==!1&&i.push(Ru(CO,{fallback:!0})),e.bracketMatching!==!1&&i.push(IO()),e.closeBrackets!==!1&&i.push(fT()),e.autocompletion!==!1&&i.push(wT()),e.rectangularSelection!==!1&&i.push(AC()),r!==!1&&i.push(EC()),e.highlightActiveLine!==!1&&i.push(mC()),e.highlightSelectionMatches!==!1&&i.push(aE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(qa.of(" ".repeat(e.tabSize))),i.concat([ao.of(n.flat())]).filter(Boolean)},p3=function(e){e===void 0&&(e={});var r=[];e.defaultKeymap!==!1&&(r=r.concat(defaultKeymap)),e.historyKeymap!==!1&&(r=r.concat(historyKeymap));var n=[];return e.highlightSpecialChars!==!1&&n.push(highlightSpecialChars()),e.history!==!1&&n.push(history()),e.drawSelection!==!1&&n.push(drawSelection()),e.syntaxHighlighting!==!1&&n.push(syntaxHighlighting(defaultHighlightStyle,{fallback:!0})),n.concat([keymap.of(r.flat())]).filter(Boolean)};const Uv="#e5c07b",vf="#e06c75",Gv="#56b6c2",Kv="#ffffff",Po="#abb2bf",Pl="#7d8799",Yv="#61afef",Jv="#98c379",yf="#d19a66",Qv="#c678dd",Xv="#21252b",bf="#2c313a",xf="#282c34",Ml="#353a42",Zv="#3E4451",wf="#528bff",g3={chalky:Uv,coral:vf,cyan:Gv,invalid:Kv,ivory:Po,stone:Pl,malibu:Yv,sage:Jv,whiskey:yf,violet:Qv,darkBackground:Xv,highlightBackground:bf,background:xf,tooltipBackground:Ml,selection:Zv,cursor:wf},VT=de.theme({"&":{color:Po,backgroundColor:xf},".cm-content":{caretColor:wf},".cm-cursor, .cm-dropCursor":{borderLeftColor:wf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Zv},".cm-panels":{backgroundColor:Xv,color:Po},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:xf,color:Pl,border:"none"},".cm-activeLineGutter":{backgroundColor:bf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ml},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ml,borderBottomColor:Ml},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:bf,color:Po}}},{dark:!0}),WT=ls.define([{tag:M.keyword,color:Qv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:vf},{tag:[M.function(M.variableName),M.labelName],color:Yv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:yf},{tag:[M.definition(M.name),M.separator],color:Po},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Uv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:Gv},{tag:[M.meta,M.comment],color:Pl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Pl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:vf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:yf},{tag:[M.processingInstruction,M.string,M.inserted],color:Jv},{tag:M.invalid,color:Kv}]),$T=[VT,Ru(WT)];var HT=de.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),zT=function(e){e===void 0&&(e={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(r&&l.unshift(ao.of([rE])),a&&(typeof a=="boolean"?l.unshift(zv()):l.unshift(zv(a))),o&&l.unshift(xC(o)),s){case"light":l.push(HT);break;case"dark":l.push($T);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(de.editable.of(!1)),i&&l.push(Ve.readOnly.of(!0)),[...l]},UT=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)}),_v=an.define(),GT=[];function KT(t){var{value:e,selection:r,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=GT,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:y=null,placeholder:w="",editable:A=!0,readOnly:T=!1,indentWithTab:E=!0,basicSetup:B=!0,root:I,initialState:W}=t,[F,_]=(0,S.useState)(),[j,U]=(0,S.useState)(),[Y,re]=(0,S.useState)(),ce=de.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),he=de.updateListener.of(we=>{if(we.docChanged&&typeof n=="function"&&!we.transactions.some(Ie=>Ie.annotation(_v))){var Ee=we.state.doc,Ue=Ee.toString();n(Ue,we)}i&&i(UT(we))}),xe=zT({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:E,basicSetup:B}),Fe=[he,ce,...xe];return o&&typeof o=="function"&&Fe.push(de.updateListener.of(o)),Fe=Fe.concat(a),(0,S.useEffect)(()=>{if(F&&!Y){var we={doc:e,selection:r,extensions:Fe},Ee=W?Ve.fromJSON(W.json,we,W.fields):Ve.create(we);if(re(Ee),!j){var Ue=new de({state:Ee,parent:F,root:I});U(Ue),s&&s(Ue,Ee)}}return()=>{j&&(re(void 0),U(void 0))}},[F,Y]),(0,S.useEffect)(()=>_(t.container),[t.container]),(0,S.useEffect)(()=>()=>{j&&(j.destroy(),U(void 0))},[j]),(0,S.useEffect)(()=>{l&&j&&j.focus()},[l,j]),(0,S.useEffect)(()=>{j&&j.dispatch({effects:Ae.reconfigure.of(Fe)})},[c,a,u,h,d,p,m,y,w,A,T,E,B,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var we=j?j.state.doc.toString():"";j&&e!==we&&j.dispatch({changes:{from:0,to:we.length,insert:e||""},annotations:[_v.of(!0)]})}},[e,j]),{state:Y,setState:re,view:j,setView:U,container:F,setContainer:_}}var YT=f(61250),JT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],qv=(0,S.forwardRef)((t,e)=>{var{className:r,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:B,editable:I,readOnly:W,root:F,initialState:_}=t,j=GO(t,JT),U=(0,S.useRef)(null),{state:Y,view:re,container:ce}=KT({container:U.current,root:F,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:E,indentWithTab:B,editable:I,readOnly:W,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:_});if((0,S.useImperativeHandle)(e,()=>({editor:U.current,state:Y,view:re}),[U,ce,Y,re]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var he=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,YT.jsx)("div",Wu({ref:U,className:""+he+(r?" "+r:"")},j))});qv.displayName="CodeMirror";const QT=qv,XT=(0,Ye.ZP)(QT)`
|
|
153
154
|
display: flex;
|
|
154
155
|
flex-direction: column;
|
|
155
156
|
justify-content: flex-start;
|
|
@@ -200,34 +201,34 @@
|
|
|
200
201
|
background: none;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
`;function
|
|
204
|
-
`;break;case 114:
|
|
205
|
-
`),a++,c=n,o=14;switch(
|
|
204
|
+
`;function Il(){return Il=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Il.apply(this,arguments)}var ey=t=>{var{theme:e,settings:r={},styles:n=[]}=t,i={".cm-gutters":{}},s={};r.background&&(s.backgroundColor=r.background),r.backgroundImage&&(s.backgroundImage=r.backgroundImage),r.foreground&&(s.color=r.foreground),(r.background||r.foreground)&&(i["&"]=s),r.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(i[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(i[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(i[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(i[".cm-content"]={caretColor:r.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var o={};r.gutterActiveForeground&&(o.color=r.gutterActiveForeground),r.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:r.lineHighlight},o.backgroundColor=r.lineHighlight),i[".cm-activeLineGutter"]=o,r.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var a=de.theme(i,{dark:e==="dark"}),l=ls.define(n),c=[a,Ru(l)];return c};const m3=null;var ZT={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f0",selectionMatch:"#d7d4f0",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b61"},v3=null,Sf=t=>{var{theme:e="dark",settings:r={},styles:n=[]}=t||{};return ey({theme:e,settings:Il({},ZT,r),styles:[{tag:M.keyword,color:"#cf6edf"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#56c8d8"},{tag:[M.propertyName],color:"#facf4e"},{tag:[M.variableName],color:"#bdbdbd"},{tag:[M.function(M.variableName)],color:"#56c8d8"},{tag:[M.labelName],color:"#cf6edf"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#facf4e"},{tag:[M.definition(M.name),M.separator],color:"#fa5788"},{tag:[M.brace],color:"#cf6edf"},{tag:[M.annotation],color:"#ff5f52"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#ffad42"},{tag:[M.typeName,M.className],color:"#ffad42"},{tag:[M.operator,M.operatorKeyword],color:"#7186f0"},{tag:[M.tagName],color:"#99d066"},{tag:[M.squareBracket],color:"#ff5f52"},{tag:[M.angleBracket],color:"#606f7a"},{tag:[M.attributeName],color:"#bdbdbd"},{tag:[M.regexp],color:"#ff5f52"},{tag:[M.quote],color:"#6abf69"},{tag:[M.string],color:"#99d066"},{tag:M.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[M.url,M.escape,M.special(M.string)],color:"#facf4e"},{tag:[M.meta],color:"#707d8b"},{tag:[M.comment],color:"#707d8b",fontStyle:"italic"},{tag:M.monospace,color:"#bdbdbd"},{tag:M.strong,fontWeight:"bold",color:"#ff5f52"},{tag:M.emphasis,fontStyle:"italic",color:"#99d066"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.heading,fontWeight:"bold",color:"#facf4e"},{tag:M.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[M.heading2,M.heading3,M.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[M.heading5,M.heading6],color:"#facf4e"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#56c8d8"},{tag:[M.processingInstruction,M.inserted],color:"#ff5f52"},{tag:[M.contentSeparator],color:"#56c8d8"},{tag:M.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"},...n]})},_T=Sf,y3=Sf(),b3=Sf(),qT={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#FAFAFA",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},kf=t=>{var{theme:e="light",settings:r={},styles:n=[]}=t||{};return ey({theme:e,settings:Il({},qT,r),styles:[{tag:M.keyword,color:"#39ADB5"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#90A4AE"},{tag:[M.propertyName],color:"#6182B8"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"#91B859"},{tag:[M.function(M.variableName),M.labelName],color:"#6182B8"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#39ADB5"},{tag:[M.definition(M.name),M.separator],color:"#90A4AE"},{tag:[M.className],color:"#E2931D"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#F76D47"},{tag:[M.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[M.operator,M.operatorKeyword],color:"#39ADB5"},{tag:[M.url,M.escape,M.regexp,M.link],color:"#91B859"},{tag:[M.meta,M.comment],color:"#90A4AE"},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#90A4AE"},{tag:M.invalid,color:"#E5393570"},{tag:M.strikethrough,textDecoration:"line-through"},...n]})},x3=kf();function Dl(t,e){e===void 0&&(e=!1);var r=t.length,n=0,i="",s=0,o=16,a=0,l=0,c=0,u=0,h=0;function d(E,B){for(var I=0,W=0;I<E||!B;){var F=t.charCodeAt(n);if(F>=48&&F<=57)W=W*16+F-48;else if(F>=65&&F<=70)W=W*16+F-65+10;else if(F>=97&&F<=102)W=W*16+F-97+10;else break;n++,I++}return I<E&&(W=-1),W}function p(E){n=E,i="",s=0,o=16,h=0}function m(){var E=n;if(t.charCodeAt(n)===48)n++;else for(n++;n<t.length&&bs(t.charCodeAt(n));)n++;if(n<t.length&&t.charCodeAt(n)===46)if(n++,n<t.length&&bs(t.charCodeAt(n)))for(n++;n<t.length&&bs(t.charCodeAt(n));)n++;else return h=3,t.substring(E,n);var B=n;if(n<t.length&&(t.charCodeAt(n)===69||t.charCodeAt(n)===101))if(n++,(n<t.length&&t.charCodeAt(n)===43||t.charCodeAt(n)===45)&&n++,n<t.length&&bs(t.charCodeAt(n))){for(n++;n<t.length&&bs(t.charCodeAt(n));)n++;B=n}else h=3;return t.substring(E,B)}function y(){for(var E="",B=n;;){if(n>=r){E+=t.substring(B,n),h=2;break}var I=t.charCodeAt(n);if(I===34){E+=t.substring(B,n),n++;break}if(I===92){if(E+=t.substring(B,n),n++,n>=r){h=2;break}var W=t.charCodeAt(n++);switch(W){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
|
|
205
|
+
`;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:var F=d(4,!0);F>=0?E+=String.fromCharCode(F):h=4;break;default:h=5}B=n;continue}if(I>=0&&I<=31)if(Mo(I)){E+=t.substring(B,n),h=2;break}else h=6;n++}return E}function w(){if(i="",h=0,s=n,l=a,u=c,n>=r)return s=r,o=17;var E=t.charCodeAt(n);if(Af(E)){do n++,i+=String.fromCharCode(E),E=t.charCodeAt(n);while(Af(E));return o=15}if(Mo(E))return n++,i+=String.fromCharCode(E),E===13&&t.charCodeAt(n)===10&&(n++,i+=`
|
|
206
|
+
`),a++,c=n,o=14;switch(E){case 123:return n++,o=1;case 125:return n++,o=2;case 91:return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=y(),o=10;case 47:var B=n-1;if(t.charCodeAt(n+1)===47){for(n+=2;n<r&&!Mo(t.charCodeAt(n));)n++;return i=t.substring(B,n),o=12}if(t.charCodeAt(n+1)===42){n+=2;for(var I=r-1,W=!1;n<I;){var F=t.charCodeAt(n);if(F===42&&t.charCodeAt(n+1)===47){n+=2,W=!0;break}n++,Mo(F)&&(F===13&&t.charCodeAt(n)===10&&n++,a++,c=n)}return W||(n++,h=1),i=t.substring(B,n),o=13}return i+=String.fromCharCode(E),n++,o=16;case 45:if(i+=String.fromCharCode(E),n++,n===r||!bs(t.charCodeAt(n)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;n<r&&A(E);)n++,E=t.charCodeAt(n);if(s!==n){switch(i=t.substring(s,n),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(E),n++,o=16}}function A(E){if(Af(E)||Mo(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function T(){var E;do E=w();while(E>=12&&E<=15);return E}return{setPosition:p,getPosition:function(){return n},scan:e?T:w,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return n-s},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return s-u},getTokenError:function(){return h}}}function Af(t){return t===32||t===9||t===11||t===12||t===160||t===5760||t>=8192&&t<=8203||t===8239||t===8287||t===12288||t===65279}function Mo(t){return t===10||t===13||t===8232||t===8233}function bs(t){return t>=48&&t<=57}function eP(t,e,r){var n,i,s,o,a;if(e){for(o=e.offset,a=o+e.length,s=o;s>0&&!ty(t,s-1);)s--;for(var l=a;l<t.length&&!ty(t,l);)l++;i=t.substring(s,l),n=tP(i,r)}else i=t,n=0,s=0,o=0,a=t.length;var c=rP(r,t),u=!1,h=0,d;r.insertSpaces?d=Cf(" ",r.tabSize||4):d=" ";var p=Dl(i,!1),m=!1;function y(){return c+Cf(d,n+h)}function w(){var Y=p.scan();for(u=!1;Y===15||Y===14;)u=u||Y===14,Y=p.scan();return m=Y===16||p.getTokenError()!==0,Y}var A=[];function T(Y,re,ce){!m&&re<a&&ce>o&&t.substring(re,ce)!==Y&&A.push({offset:re,length:ce-re,content:Y})}var E=w();if(E!==17){var B=p.getTokenOffset()+s,I=Cf(d,n);T(I,s,B)}for(;E!==17;){for(var W=p.getTokenOffset()+p.getTokenLength()+s,F=w(),_="";!u&&(F===12||F===13);){var j=p.getTokenOffset()+s;T(" ",W,j),W=p.getTokenOffset()+p.getTokenLength()+s,_=F===12?y():"",F=w()}if(F===2)E!==1&&(h--,_=y());else if(F===4)E!==3&&(h--,_=y());else{switch(E){case 3:case 1:h++,_=y();break;case 5:case 12:_=y();break;case 13:u?_=y():_=" ";break;case 6:_=" ";break;case 10:if(F===6){_="";break}case 7:case 8:case 9:case 11:case 2:case 4:F===12||F===13?_=" ":F!==5&&F!==17&&(m=!0);break;case 16:m=!0;break}u&&(F===12||F===13)&&(_=y())}var U=p.getTokenOffset()+s;T(_,W,U),E=F}return A}function Cf(t,e){for(var r="",n=0;n<e;n++)r+=t;return r}function tP(t,e){for(var r=0,n=0,i=e.tabSize||4;r<t.length;){var s=t.charAt(r);if(s===" ")n++;else if(s===" ")n+=i;else break;r++}return Math.floor(n/i)}function rP(t,e){for(var r=0;r<e.length;r++){var n=e.charAt(r);if(n==="\r")return r+1<e.length&&e.charAt(r+1)===`
|
|
206
207
|
`?`\r
|
|
207
208
|
`:"\r";if(n===`
|
|
208
209
|
`)return`
|
|
209
|
-
`}return
|
|
210
|
-
`}function
|
|
211
|
-
`.indexOf(
|
|
212
|
-
`.indexOf(r.charAt(e))!==-1}var bs=Il,w3=rP,cP=nP,S3=iP,k3=sP,uP=ty,fP=ey,hP=Cf,A3=Dl,C3=aP;function O3(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 dP(r,e,t){return qT(r,e,t)}function E3(r,e,t,n){return edit.setProperty(r,e,t,n)}function T3(r,e){for(var t=e.length-1;t>=0;t--)r=edit.applyEdit(r,e[t]);return r}function Io(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(!Io(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(),!Io(i,s))return!1;for(t=0;t<i.length;t++)if(!Io(r[i[t]],e[i[t]]))return!1}return!0}function kr(r){return typeof r=="number"}function Tn(r){return typeof r<"u"}function gn(r){return typeof r=="boolean"}function pP(r){return typeof r=="string"}var iy;(function(r){function e(t){return typeof t=="string"}r.is=e})(iy||(iy={}));var Of;(function(r){function e(t){return typeof t=="string"}r.is=e})(Of||(Of={}));var sy;(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})(sy||(sy={}));var Nl;(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})(Nl||(Nl={}));var Br;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=Nl.MAX_VALUE),i===Number.MAX_VALUE&&(i=Nl.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.line)&&J.uinteger(i.character)}r.is=t})(Br||(Br={}));var Ue;(function(r){function e(n,i,s,o){if(J.uinteger(n)&&J.uinteger(i)&&J.uinteger(s)&&J.uinteger(o))return{start:Br.create(n,i),end:Br.create(s,o)};if(Br.is(n)&&Br.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 J.objectLiteral(i)&&Br.is(i.start)&&Br.is(i.end)}r.is=t})(Ue||(Ue={}));var xs;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(J.string(i.uri)||J.undefined(i.uri))}r.is=t})(xs||(xs={}));var oy;(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 J.objectLiteral(i)&&Ue.is(i.targetRange)&&J.string(i.targetUri)&&Ue.is(i.targetSelectionRange)&&(Ue.is(i.originSelectionRange)||J.undefined(i.originSelectionRange))}r.is=t})(oy||(oy={}));var Ef;(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 J.objectLiteral(i)&&J.numberRange(i.red,0,1)&&J.numberRange(i.green,0,1)&&J.numberRange(i.blue,0,1)&&J.numberRange(i.alpha,0,1)}r.is=t})(Ef||(Ef={}));var ay;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&Ef.is(i.color)}r.is=t})(ay||(ay={}));var ly;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.string(i.label)&&(J.undefined(i.textEdit)||Fr.is(i))&&(J.undefined(i.additionalTextEdits)||J.typedArray(i.additionalTextEdits,Fr.is))}r.is=t})(ly||(ly={}));var Do;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(Do||(Do={}));var cy;(function(r){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return J.defined(s)&&(c.startCharacter=s),J.defined(o)&&(c.endCharacter=o),J.defined(a)&&(c.kind=a),J.defined(l)&&(c.collapsedText=l),c}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.startLine)&&J.uinteger(i.startLine)&&(J.undefined(i.startCharacter)||J.uinteger(i.startCharacter))&&(J.undefined(i.endCharacter)||J.uinteger(i.endCharacter))&&(J.undefined(i.kind)||J.string(i.kind))}r.is=t})(cy||(cy={}));var Tf;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&xs.is(i.location)&&J.string(i.message)}r.is=t})(Tf||(Tf={}));var Ie;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(Ie||(Ie={}));var uy;(function(r){r.Unnecessary=1,r.Deprecated=2})(uy||(uy={}));var fy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&J.string(n.href)}r.is=e})(fy||(fy={}));var Pn;(function(r){function e(n,i,s,o,a,l){var c={range:n,message:i};return J.defined(s)&&(c.severity=s),J.defined(o)&&(c.code=o),J.defined(a)&&(c.source=a),J.defined(l)&&(c.relatedInformation=l),c}r.create=e;function t(n){var i,s=n;return J.defined(s)&&Ue.is(s.range)&&J.string(s.message)&&(J.number(s.severity)||J.undefined(s.severity))&&(J.integer(s.code)||J.string(s.code)||J.undefined(s.code))&&(J.undefined(s.codeDescription)||J.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(J.string(s.source)||J.undefined(s.source))&&(J.undefined(s.relatedInformation)||J.typedArray(s.relatedInformation,Tf.is))}r.is=t})(Pn||(Pn={}));var ws;(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 J.defined(s)&&s.length>0&&(a.arguments=s),a}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.title)&&J.string(i.command)}r.is=t})(ws||(ws={}));var Fr;(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 J.objectLiteral(o)&&J.string(o.newText)&&Ue.is(o.range)}r.is=i})(Fr||(Fr={}));var Ss;(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 J.objectLiteral(i)&&J.string(i.label)&&(J.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(J.string(i.description)||i.description===void 0)}r.is=t})(Ss||(Ss={}));var Zt;(function(r){function e(t){var n=t;return J.string(n)}r.is=e})(Zt||(Zt={}));var ri;(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 Fr.is(o)&&(Ss.is(o.annotationId)||Zt.is(o.annotationId))}r.is=i})(ri||(ri={}));var Rl;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Bl.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(Rl||(Rl={}));var No;(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"&&J.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(No||(No={}));var Ro;(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"&&J.string(i.oldUri)&&J.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Ro||(Ro={}));var Lo;(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"&&J.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||J.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||J.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Lo||(Lo={}));var Pf;(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 J.string(i.kind)?No.is(i)||Ro.is(i)||Lo.is(i):Rl.is(i)}))}r.is=e})(Pf||(Pf={}));var Ll=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=Fr.insert(e,t):Zt.is(n)?(s=n,i=ri.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.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=Fr.replace(e,t):Zt.is(n)?(s=n,i=ri.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.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=Fr.del(e):Zt.is(t)?(i=t,n=ri.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),n=ri.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}(),hy=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(Zt.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}(),P3=function(){function r(e){var t=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new hy(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Rl.is(n)){var i=new Ll(n.edits,t._changeAnnotations);t._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Ll(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(Bl.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 Ll(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 Ll(i),this._textEditChanges[e]=n}return n}},r.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new hy,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;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=No.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=No.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;Ss.is(n)||Zt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Ro.create(e,t,i):(a=Zt.is(s)?s:this._changeAnnotations.manage(s),o=Ro.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;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=Lo.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=Lo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r}(),dy;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)}r.is=t})(dy||(dy={}));var py;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&J.integer(i.version)}r.is=t})(py||(py={}));var Bl;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&(i.version===null||J.integer(i.version))}r.is=t})(Bl||(Bl={}));var gy;(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 J.defined(i)&&J.string(i.uri)&&J.string(i.languageId)&&J.integer(i.version)&&J.string(i.text)}r.is=t})(gy||(gy={}));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 Bo;(function(r){function e(t){var n=t;return J.objectLiteral(t)&&Ii.is(n.kind)&&J.string(n.value)}r.is=e})(Bo||(Bo={}));var Ar;(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})(Ar||(Ar={}));var Mt;(function(r){r.PlainText=1,r.Snippet=2})(Mt||(Mt={}));var my;(function(r){r.Deprecated=1})(my||(my={}));var vy;(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&&J.string(i.newText)&&Ue.is(i.insert)&&Ue.is(i.replace)}r.is=t})(vy||(vy={}));var yy;(function(r){r.asIs=1,r.adjustIndentation=2})(yy||(yy={}));var by;(function(r){function e(t){var n=t;return n&&(J.string(n.detail)||n.detail===void 0)&&(J.string(n.description)||n.description===void 0)}r.is=e})(by||(by={}));var Mf;(function(r){function e(t){return{label:t}}r.create=e})(Mf||(Mf={}));var xy;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(xy||(xy={}));var Fl;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){var i=n;return J.string(i)||J.objectLiteral(i)&&J.string(i.language)&&J.string(i.value)}r.is=t})(Fl||(Fl={}));var wy;(function(r){function e(t){var n=t;return!!n&&J.objectLiteral(n)&&(Bo.is(n.contents)||Fl.is(n.contents)||J.typedArray(n.contents,Fl.is))&&(t.range===void 0||Ue.is(t.range))}r.is=e})(wy||(wy={}));var Sy;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(Sy||(Sy={}));var ky;(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 J.defined(n)&&(o.documentation=n),J.defined(i)?o.parameters=i:o.parameters=[],o}r.create=e})(ky||(ky={}));var Ay;(function(r){r.Text=1,r.Read=2,r.Write=3})(Ay||(Ay={}));var Cy;(function(r){function e(t,n){var i={range:t};return J.number(n)&&(i.kind=n),i}r.create=e})(Cy||(Cy={}));var mn;(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})(mn||(mn={}));var Oy;(function(r){r.Deprecated=1})(Oy||(Oy={}));var Ey;(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})(Ey||(Ey={}));var Ty;(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})(Ty||(Ty={}));var Py;(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&&J.string(i.name)&&J.number(i.kind)&&Ue.is(i.range)&&Ue.is(i.selectionRange)&&(i.detail===void 0||J.string(i.detail))&&(i.deprecated===void 0||J.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}r.is=t})(Py||(Py={}));var My;(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"})(My||(My={}));var jl;(function(r){r.Invoked=1,r.Automatic=2})(jl||(jl={}));var Iy;(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 J.defined(i)&&J.typedArray(i.diagnostics,Pn.is)&&(i.only===void 0||J.typedArray(i.only,J.string))&&(i.triggerKind===void 0||i.triggerKind===jl.Invoked||i.triggerKind===jl.Automatic)}r.is=t})(Iy||(Iy={}));var Dy;(function(r){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ws.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&&J.string(i.title)&&(i.diagnostics===void 0||J.typedArray(i.diagnostics,Pn.is))&&(i.kind===void 0||J.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ws.is(i.command))&&(i.isPreferred===void 0||J.boolean(i.isPreferred))&&(i.edit===void 0||Pf.is(i.edit))}r.is=t})(Dy||(Dy={}));var Ny;(function(r){function e(n,i){var s={range:n};return J.defined(i)&&(s.data=i),s}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.command)||ws.is(i.command))}r.is=t})(Ny||(Ny={}));var Ry;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.uinteger(i.tabSize)&&J.boolean(i.insertSpaces)}r.is=t})(Ry||(Ry={}));var Ly;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.target)||J.string(i.target))}r.is=t})(Ly||(Ly={}));var Vl;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Vl||(Vl={}));var By;(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"})(By||(By={}));var Fy;(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"})(Fy||(Fy={}));var jy;(function(r){function e(t){var n=t;return J.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})(jy||(jy={}));var Vy;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&J.string(i.text)}r.is=t})(Vy||(Vy={}));var Wy;(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&&Ue.is(i.range)&&J.boolean(i.caseSensitiveLookup)&&(J.string(i.variableName)||i.variableName===void 0)}r.is=t})(Wy||(Wy={}));var $y;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&(J.string(i.expression)||i.expression===void 0)}r.is=t})($y||($y={}));var Hy;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(n.stoppedLocation)}r.is=t})(Hy||(Hy={}));var If;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(If||(If={}));var Df;(function(r){function e(n){return{value:n}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.location===void 0||xs.is(i.location))&&(i.command===void 0||ws.is(i.command))}r.is=t})(Df||(Df={}));var zy;(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 J.objectLiteral(i)&&Br.is(i.position)&&(J.string(i.label)||J.typedArray(i.label,Df.is))&&(i.kind===void 0||If.is(i.kind))&&i.textEdits===void 0||J.typedArray(i.textEdits,Fr.is)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.paddingLeft===void 0||J.boolean(i.paddingLeft))&&(i.paddingRight===void 0||J.boolean(i.paddingRight))}r.is=t})(zy||(zy={}));var Uy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&Of.is(n.uri)&&J.string(n.name)}r.is=e})(Uy||(Uy={}));var M3=null,Gy;(function(r){function e(s,o,a,l){return new gP(s,o,a,l)}r.create=e;function t(s){var o=s;return!!(J.defined(o)&&J.string(o.uri)&&(J.undefined(o.languageId)||J.string(o.languageId))&&J.uinteger(o.lineCount)&&J.func(o.getText)&&J.func(o.positionAt)&&J.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}})(Gy||(Gy={}));var gP=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
|
-
`,s==="\r"&&i+1<
|
|
214
|
-
`&&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 Br.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 Br.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}(),J;(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})(J||(J={}));var mP=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))},Ky=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=Jy(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=Yy(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,mP([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=Yy(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}(),Nf;(function(r){function e(i,s,o,a){return new Ky(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof Ky)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=Rf(s.map(vP),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})(Nf||(Nf={}));function Rf(r,e){if(r.length<=1)return r;var t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Rf(n,e),Rf(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 Yy(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 Jy(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 vP(r){var e=Jy(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var He;(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"})(He||(He={}));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)}}(),yP={"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}(),bP=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),Xy=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),xP=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),wP=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),Zy=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),SP=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),kP=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 cr(r){return gn(r)?r?{}:{not:{}}:r}var _y;(function(r){r[r.Key=0]="Key",r[r.Enum=1]="Enum"})(_y||(_y={}));var AP=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||qy(e,this.focusOffset))&&e!==this.exclude},r.prototype.newSub=function(){return new r(-1,this.exclude)},r}(),Lf=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}(),ur=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===He.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 CP(r,e){return e===void 0&&(e=[]),new eb(r,e,[])}function ni(r){return hP(r)}function Bf(r){return fP(r)}function qy(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}var eb=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 uP(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 ur;return Vt(this.root,t,n,Lf.instance),n.problems.map(function(i){var s=Ue.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Pn.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 AP(t,n);return this.root&&e&&Vt(this.root,e,new ur,i),i.schemas},r}();function Vt(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 Vt(r.valueNode,e,t,n)}i(),n.add({node:r,schema:e});function i(){function c(oe){return r.type===oe||oe==="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:Ie.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:Ie.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];Vt(r,cr(d),t,n)}var p=cr(e.not);if(p){var m=new ur,y=n.newSub();Vt(r,p,m,y),m.hasProblems()||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.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 P=function(oe,fe){for(var be=[],ke=null,Re=0,Se=oe;Re<Se.length;Re++){var Oe=Se[Re],Te=cr(Oe),De=new ur,bt=n.newSub();if(Vt(r,Te,De,bt),De.hasProblems()||be.push(Te),!ke)ke={schema:Te,validationResult:De,matchingSchemas:bt};else if(!fe&&!De.hasProblems()&&!ke.validationResult.hasProblems())ke.matchingSchemas.merge(bt),ke.validationResult.propertiesMatches+=De.propertiesMatches,ke.validationResult.propertiesValueMatches+=De.propertiesValueMatches;else{var Rt=De.compare(ke.validationResult);Rt>0?ke={schema:Te,validationResult:De,matchingSchemas:bt}:Rt===0&&(ke.matchingSchemas.merge(bt),ke.validationResult.mergeEnumValues(De))}}return be.length>1&&fe&&t.problems.push({location:{offset:r.offset,length:1},severity:Ie.Warning,message:"Matches multiple schemas when only one must validate."}),ke!==null&&(t.merge(ke.validationResult),t.propertiesMatches+=ke.validationResult.propertiesMatches,t.propertiesValueMatches+=ke.validationResult.propertiesValueMatches,n.merge(ke.matchingSchemas)),be.length};Array.isArray(e.anyOf)&&P(e.anyOf,!1),Array.isArray(e.oneOf)&&P(e.oneOf,!0);var L=function(oe){var fe=new ur,be=n.newSub();Vt(r,cr(oe),fe,be),t.merge(fe),t.propertiesMatches+=fe.propertiesMatches,t.propertiesValueMatches+=fe.propertiesValueMatches,n.merge(be)},D=function(oe,fe,be){var ke=cr(oe),Re=new ur,Se=n.newSub();Vt(r,ke,Re,Se),n.merge(Se),Re.hasProblems()?be&&L(be):fe&&L(fe)},j=cr(e.if);if(j&&D(j,cr(e.then),cr(e.else)),Array.isArray(e.enum)){for(var W=ni(r),q=!1,F=0,H=e.enum;F<H.length;F++){var Q=H[F];if(Io(W,Q)){q=!0;break}}t.enumValues=e.enum,t.enumValueMatch=q,q||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(oe){return JSON.stringify(oe)}).join(", ")+"."})}if(Tn(e.const)){var W=ni(r);Io(W,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.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:Ie.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;kr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(L,D){if(kr(D))return D;if(gn(D)&&D)return L}function y(L,D){if(!gn(D)||!D)return L}var w=m(u.minimum,u.exclusiveMinimum);kr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);kr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);kr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the minimum of "+T+"."});var P=y(u.maximum,u.exclusiveMaximum);kr(P)&&p>P&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the maximum of "+P+"."})}function o(c,u,h,d){if(kr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),kr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),pP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.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:Ie.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=yP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.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=cr(y),A=new ur,T=c.items[m];T?(Vt(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 P=p.length;P<c.items.length;P++){var A=new ur;Vt(c.items[P],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var L=cr(u.items);if(L)for(var D=0,j=c.items;D<j.length;D++){var T=j[D],A=new ur;Vt(T,L,A,d),h.mergePropertyMatch(A)}}var W=cr(u.contains);if(W){var q=c.items.some(function(Q){var oe=new ur;return Vt(Q,W,oe,Lf.instance),!oe.hasProblems()});q||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.errorMessage||"Array does not contain required item."})}if(kr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),kr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var F=ni(c),H=F.some(function(Q,oe){return oe!==F.lastIndexOf(Q)});H&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.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 P=0,L=u.required;P<L.length;P++){var D=L[P];if(!p[D]){var j=c.parent&&c.parent.type==="property"&&c.parent.keyNode,W=j?{offset:j.offset,length:j.length}:{offset:c.offset,length:1};h.problems.push({location:W,severity:Ie.Warning,message:'Missing property "'+D+'".'})}}var q=function(sr){for(var Es=m.indexOf(sr);Es>=0;)m.splice(Es,1),Es=m.indexOf(sr)};if(u.properties)for(var F=0,H=Object.keys(u.properties);F<H.length;F++){var D=H[F];q(D);var Q=u.properties[D],oe=p[D];if(oe)if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}if(u.patternProperties)for(var be=0,ke=Object.keys(u.patternProperties);be<ke.length;be++)for(var Re=ke[be],Se=new RegExp(Re),Oe=0,Te=m.slice(0);Oe<Te.length;Oe++){var D=Te[Oe];if(Se.test(D)){q(D);var oe=p[D];if(oe){var Q=u.patternProperties[Re];if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}}}if(typeof u.additionalProperties=="object")for(var De=0,bt=m;De<bt.length;De++){var D=bt[De],oe=p[D];if(oe){var fe=new ur;Vt(oe,u.additionalProperties,fe,d),h.mergePropertyMatch(fe)}}else if(u.additionalProperties===!1&&m.length>0)for(var Rt=0,ir=m;Rt<ir.length;Rt++){var D=ir[Rt],oe=p[D];if(oe){var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}}if(kr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),kr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var jr=0,si=Object.keys(u.dependencies);jr<si.length;jr++){var T=si[jr],Wt=p[T];if(Wt){var _t=u.dependencies[T];if(Array.isArray(_t))for(var Or=0,oi=_t;Or<oi.length;Or++){var ai=oi[Or];p[ai]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object is missing property "+ai+" required by property {$key}."})}else{var Q=cr(_t);if(Q){var fe=new ur;Vt(c,Q,fe,d),h.mergePropertyMatch(fe)}}}}var Er=cr(u.propertyNames);if(Er)for(var vn=0,Gl=c.properties;vn<Gl.length;vn++){var li=Gl[vn],T=li.keyNode;T&&Vt(T,Er,h,Lf.instance)}}}function OP(r,e){var t=[],n=-1,i=r.getText(),s=bs(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var j=s.scan();switch(h(),j){case 12:case 13:Array.isArray(o)&&o.push(Ue.create(r.positionAt(s.getTokenOffset()),r.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return j}}}function l(j){return s.getToken()===j?(a(),!0):!1}function c(j,W,q,F,H){if(H===void 0&&(H=Ie.Error),t.length===0||q!==n){var Q=Ue.create(r.positionAt(q),r.positionAt(F));t.push(Pn.create(Q,j,H,W,r.languageId)),n=q}}function u(j,W,q,F,H){q===void 0&&(q=null),F===void 0&&(F=[]),H===void 0&&(H=[]);var Q=s.getTokenOffset(),oe=s.getTokenOffset()+s.getTokenLength();if(Q===oe&&Q>0){for(Q--;Q>0&&/\s/.test(i.charAt(Q));)Q--;oe=Q+1}if(c(j,W,Q,oe),q&&d(q,!1),F.length+H.length>0)for(var fe=s.getToken();fe!==17;){if(F.indexOf(fe)!==-1){a();break}else if(H.indexOf(fe)!==-1)break;fe=a()}return q}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",He.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",He.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",He.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",He.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",He.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",He.InvalidCharacter),!0}return!1}function d(j,W){return j.length=s.getTokenOffset()+s.getTokenLength()-j.offset,W&&a(),j}function p(j){if(s.getToken()!==3)return null;var W=new xP(j,s.getTokenOffset());a();for(var q=0,F=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){F||u("Value expected",He.ValueExpected);var H=s.getTokenOffset();if(a(),s.getToken()===4){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=P(W,q++);Q?W.items.push(Q):u("Value expected",He.ValueExpected,null,[],[4,5]),F=!0}return s.getToken()!==4?u("Expected comma or closing bracket",He.CommaOrCloseBacketExpected,W):d(W,!0)}function m(j,W){var q=new SP(j,s.getTokenOffset()),F=w(q);if(!F)if(s.getToken()===16){u("Property keys must be doublequoted",He.Undefined);var H=new Zy(q,s.getTokenOffset(),s.getTokenLength());H.value=s.getTokenValue(),F=H,a()}else return null;q.keyNode=F;var Q=W[F.value];if(Q?(c("Duplicate object key",He.DuplicateKey,q.keyNode.offset,q.keyNode.offset+q.keyNode.length,Ie.Warning),typeof Q=="object"&&c("DuplicateKeyWarning",He.DuplicateKey,Q.keyNode.offset,Q.keyNode.offset+Q.keyNode.length,Ie.Warning),W[F.value]=!0):W[F.value]=q,s.getToken()===6)q.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",He.ColonExpected),s.getToken()===10&&r.positionAt(F.offset+F.length).line<r.positionAt(s.getTokenOffset()).line)return q.length=F.length,q;var oe=P(q,F.value);return oe?(q.valueNode=oe,q.length=oe.offset+oe.length-q.offset,q):u("Value expected",He.ValueExpected,q,[],[2,5])}function y(j){if(s.getToken()!==1)return null;var W=new kP(j,s.getTokenOffset()),q=Object.create(null);a();for(var F=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){F||u("Property expected",He.PropertyExpected);var H=s.getTokenOffset();if(a(),s.getToken()===2){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=m(W,q);Q?W.properties.push(Q):u("Property expected",He.PropertyExpected,null,[],[2,5]),F=!0}return s.getToken()!==2?u("Expected comma or closing brace",He.CommaOrCloseBraceExpected,W):d(W,!0)}function w(j){if(s.getToken()!==10)return null;var W=new Zy(j,s.getTokenOffset());return W.value=s.getTokenValue(),d(W,!0)}function A(j){if(s.getToken()!==11)return null;var W=new wP(j,s.getTokenOffset());if(s.getTokenError()===0){var q=s.getTokenValue();try{var F=JSON.parse(q);if(!kr(F))return u("Invalid number format.",He.Undefined,W);W.value=F}catch{return u("Invalid number format.",He.Undefined,W)}W.isInteger=q.indexOf(".")===-1}return d(W,!0)}function T(j){var W;switch(s.getToken()){case 7:return d(new bP(j,s.getTokenOffset()),!0);case 8:return d(new Xy(j,!0,s.getTokenOffset()),!0);case 9:return d(new Xy(j,!1,s.getTokenOffset()),!0);default:return null}}function P(j,W){return p(j)||y(j)||w(j)||A(j)||T(j)}var L=null,D=a();return D!==17&&(L=P(null,null),L?s.getToken()!==17&&u("End of file expected.",He.Undefined):u("Expected a JSON object, array or literal.",He.Undefined)),new eb(L,t,o)}function Ff(r,e,t){if(r!==null&&typeof r=="object"){var n=e+" ";if(Array.isArray(r)){if(r.length===0)return"[]";for(var i=`[
|
|
215
|
-
`,s=0;s<
|
|
216
|
-
`;return i+=e+"]",i}else{var o=Object.keys(
|
|
217
|
-
`,s=0;s<o.length;s++){var a=o[s];i+=n+JSON.stringify(a)+": "+
|
|
218
|
-
`}return i+=e+"}",i}}return t
|
|
219
|
-
`,
|
|
220
|
-
`+
|
|
210
|
+
`}return t&&t.eol||`
|
|
211
|
+
`}function ty(t,e){return`\r
|
|
212
|
+
`.indexOf(t.charAt(e))!==-1}var Io;(function(t){t.DEFAULT={allowTrailingComma:!1}})(Io||(Io={}));function nP(t,e){var r=[],n=new Object,i=void 0,s={value:{},offset:0,length:0,type:"object",parent:void 0},o=!1;function a(l,c,u,h){s.value=l,s.offset=c,s.length=u,s.type=h,s.colonOffset=void 0,i=s}try{Nl(t,{onObjectBegin:function(l,c){if(e<=l)throw n;i=void 0,o=e>l,r.push("")},onObjectProperty:function(l,c,u){if(e<c||(a(l,c,u,"property"),r[r.length-1]=l,e<=c+u))throw n},onObjectEnd:function(l,c){if(e<=l)throw n;i=void 0,r.pop()},onArrayBegin:function(l,c){if(e<=l)throw n;i=void 0,r.push(0)},onArrayEnd:function(l,c){if(e<=l)throw n;i=void 0,r.pop()},onLiteralValue:function(l,c,u){if(e<c||(a(l,c,u,iy(l)),e<=c+u))throw n},onSeparator:function(l,c,u){if(e<=c)throw n;if(l===":"&&i&&i.type==="property")i.colonOffset=c,o=!1,i=void 0;else if(l===","){var h=r[r.length-1];typeof h=="number"?r[r.length-1]=h+1:(o=!0,r[r.length-1]=""),i=void 0}}})}catch(l){if(l!==n)throw l}return{path:r,previousNode:i,isAtPropertyKey:o,matches:function(l){for(var c=0,u=0;c<l.length&&u<r.length;u++)if(l[c]===r[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function iP(t,e,r){e===void 0&&(e=[]),r===void 0&&(r=Io.DEFAULT);var n=null,i=[],s=[];function o(l){Array.isArray(i)?i.push(l):n!==null&&(i[n]=l)}var a={onObjectBegin:function(){var l={};o(l),s.push(i),i=l,n=null},onObjectProperty:function(l){n=l},onObjectEnd:function(){i=s.pop()},onArrayBegin:function(){var l=[];o(l),s.push(i),i=l,n=null},onArrayEnd:function(){i=s.pop()},onLiteralValue:o,onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};return Nl(t,a,r),i[0]}function sP(t,e,r){e===void 0&&(e=[]),r===void 0&&(r=Io.DEFAULT);var n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function s(l){return n.children.push(l),l}var o={onObjectBegin:function(l){n=s({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:function(l,c,u){n=s({type:"property",offset:c,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:c,length:u,parent:n})},onObjectEnd:function(l,c){i(l+c),n.length=l+c-n.offset,n=n.parent,i(l+c)},onArrayBegin:function(l,c){n=s({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:function(l,c){n.length=l+c-n.offset,n=n.parent,i(l+c)},onLiteralValue:function(l,c,u){s({type:iy(l),offset:c,length:u,parent:n,value:l}),i(c+u)},onSeparator:function(l,c,u){n.type==="property"&&(l===":"?n.colonOffset=c:l===","&&i(c))},onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};Nl(t,o,r);var a=n.children[0];return a&&delete a.parent,a}function oP(t,e){if(t){for(var r=t,n=0,i=e;n<i.length;n++){var s=i[n];if(typeof s=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;for(var o=!1,a=0,l=r.children;a<l.length;a++){var c=l[a];if(Array.isArray(c.children)&&c.children[0].value===s){r=c.children[1],o=!0;break}}if(!o)return}else{var u=s;if(r.type!=="array"||u<0||!Array.isArray(r.children)||u>=r.children.length)return;r=r.children[u]}}return r}}function ry(t){if(!t.parent||!t.parent.children)return[];var e=ry(t.parent);if(t.parent.type==="property"){var r=t.parent.children[0].value;e.push(r)}else if(t.parent.type==="array"){var n=t.parent.children.indexOf(t);n!==-1&&e.push(n)}return e}function Of(t){switch(t.type){case"array":return t.children.map(Of);case"object":for(var e=Object.create(null),r=0,n=t.children;r<n.length;r++){var i=n[r],s=i.children[1];s&&(e[i.children[0].value]=Of(s))}return e;case"null":case"string":case"number":case"boolean":return t.value;default:return}}function aP(t,e,r){return r===void 0&&(r=!1),e>=t.offset&&e<t.offset+t.length||r&&e===t.offset+t.length}function ny(t,e,r){if(r===void 0&&(r=!1),aP(t,e,r)){var n=t.children;if(Array.isArray(n))for(var i=0;i<n.length&&n[i].offset<=e;i++){var s=ny(n[i],e,r);if(s)return s}return t}}function Nl(t,e,r){r===void 0&&(r=Io.DEFAULT);var n=Dl(t,!1);function i(j){return j?function(){return j(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}function s(j){return j?function(U){return j(U,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}var o=i(e.onObjectBegin),a=s(e.onObjectProperty),l=i(e.onObjectEnd),c=i(e.onArrayBegin),u=i(e.onArrayEnd),h=s(e.onLiteralValue),d=s(e.onSeparator),p=i(e.onComment),m=s(e.onError),y=r&&r.disallowComments,w=r&&r.allowTrailingComma;function A(){for(;;){var j=n.scan();switch(n.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:y||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(j){case 12:case 13:y?T(10):p();break;case 16:T(1);break;case 15:case 14:break;default:return j}}}function T(j,U,Y){if(U===void 0&&(U=[]),Y===void 0&&(Y=[]),m(j),U.length+Y.length>0)for(var re=n.getToken();re!==17;){if(U.indexOf(re)!==-1){A();break}else if(Y.indexOf(re)!==-1)break;re=A()}}function E(j){var U=n.getTokenValue();return j?h(U):a(U),A(),!0}function B(){switch(n.getToken()){case 11:var j=n.getTokenValue(),U=Number(j);isNaN(U)&&(T(2),U=0),h(U);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return A(),!0}function I(){return n.getToken()!==10?(T(3,[],[2,5]),!1):(E(!1),n.getToken()===6?(d(":"),A(),_()||T(4,[],[2,5])):T(5,[],[2,5]),!0)}function W(){o(),A();for(var j=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(j||T(4,[],[]),d(","),A(),n.getToken()===2&&w)break}else j&&T(6,[],[]);I()||T(4,[],[2,5]),j=!0}return l(),n.getToken()!==2?T(7,[2],[]):A(),!0}function F(){c(),A();for(var j=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(j||T(4,[],[]),d(","),A(),n.getToken()===4&&w)break}else j&&T(6,[],[]);_()||T(4,[],[4,5]),j=!0}return u(),n.getToken()!==4?T(8,[4],[]):A(),!0}function _(){switch(n.getToken()){case 3:return F();case 1:return W();case 10:return E(!0);default:return B()}}return A(),n.getToken()===17?r.allowEmptyContent?!0:(T(4,[],[]),!1):_()?(n.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}function lP(t,e){var r=Dl(t),n=[],i,s=0,o;do switch(o=r.getPosition(),i=r.scan(),i){case 12:case 13:case 17:s!==o&&n.push(t.substring(s,o)),e!==void 0&&n.push(r.getTokenValue().replace(/[^\r\n]/g,e)),s=r.getPosition();break}while(i!==17);return n.join("")}function iy(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}function w3(t,e,r){return cP(t,e,void 0,r)}function cP(t,e,r,n){for(var i,s=e.slice(),o=[],a=parseTree(t,o),l=void 0,c=void 0;s.length>0&&(c=s.pop(),l=findNodeAtLocation(a,s),l===void 0&&r!==void 0);)typeof c=="string"?r=(i={},i[c]=r,i):r=[r];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){var u=findNodeAtLocation(l,[c]);if(u!==void 0)if(r===void 0){if(!u.parent)throw new Error("Malformed AST");var h=l.children.indexOf(u.parent),d=void 0,p=u.parent.offset+u.parent.length;if(h>0){var m=l.children[h-1];d=m.offset+m.length}else if(d=l.offset+1,l.children.length>1){var y=l.children[1];p=y.offset}return Mi(t,{offset:d,length:p-d,content:""},n)}else return Mi(t,{offset:u.offset,length:u.length,content:JSON.stringify(r)},n);else{if(r===void 0)return[];var w=JSON.stringify(c)+": "+JSON.stringify(r),A=n.getInsertionIndex?n.getInsertionIndex(l.children.map(function(j){return j.children[0].value})):l.children.length,T=void 0;if(A>0){var m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}else l.children.length===0?T={offset:l.offset+1,length:0,content:w}:T={offset:l.offset+1,length:0,content:w+","};return Mi(t,T,n)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children)){var E=c;if(E===-1){var w=""+JSON.stringify(r),T=void 0;if(l.children.length===0)T={offset:l.offset+1,length:0,content:w};else{var m=l.children[l.children.length-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(t,T,n)}else if(r===void 0&&l.children.length>=0){var B=c,I=l.children[B],T=void 0;if(l.children.length===1)T={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===B){var m=l.children[B-1],W=m.offset+m.length,F=l.offset+l.length;T={offset:W,length:F-2-W,content:""}}else T={offset:I.offset,length:l.children[B+1].offset-I.offset,content:""};return Mi(t,T,n)}else if(r!==void 0){var T=void 0,w=""+JSON.stringify(r);if(!n.isArrayInsertion&&l.children.length>c){var _=l.children[c];T={offset:_.offset,length:_.length,content:w}}else if(l.children.length===0||c===0)T={offset:l.offset+1,length:0,content:l.children.length===0?w:w+","};else{var A=c>l.children.length?l.children.length:c,m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(t,T,n)}else throw new Error("Can not "+(r===void 0?"remove":n.isArrayInsertion?"insert":"modify")+" Array index "+E+" as length is not sufficient")}else throw new Error("Can not add "+(typeof c!="number"?"index":"property")+" to parent of type "+l.type);else{if(r===void 0)throw new Error("Can not delete in empty document");return Mi(t,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(r)},n)}}function Mi(t,e,r){if(!r.formattingOptions)return[e];var n=sy(t,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},r.formattingOptions),a=o.length-1;a>=0;a--){var l=o[a];n=sy(n,l),i=Math.min(i,l.offset),s=Math.max(s,l.offset+l.length),s+=l.content.length-l.length}var c=t.length-(n.length-s)-i;return[{offset:i,length:c,content:n.substring(i,s)}]}function sy(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}function S3(t,e){return`\r
|
|
213
|
+
`.indexOf(t.charAt(e))!==-1}var xs=Dl,k3=nP,uP=iP,A3=sP,C3=oP,fP=ny,hP=ry,dP=Of,O3=Nl,E3=lP;function T3(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function pP(t,e,r){return eP(t,e,r)}function P3(t,e,r,n){return edit.setProperty(t,e,r,n)}function M3(t,e){for(var r=e.length-1;r>=0;r--)t=edit.applyEdit(t,e[r]);return t}function Do(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0||typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;var r,n;if(Array.isArray(t)){if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(!Do(t[r],e[r]))return!1}else{var i=[];for(n in t)i.push(n);i.sort();var s=[];for(n in e)s.push(n);if(s.sort(),!Do(i,s))return!1;for(r=0;r<i.length;r++)if(!Do(t[i[r]],e[i[r]]))return!1}return!0}function Cr(t){return typeof t=="number"}function Pn(t){return typeof t<"u"}function mn(t){return typeof t=="boolean"}function gP(t){return typeof t=="string"}var oy;(function(t){function e(r){return typeof r=="string"}t.is=e})(oy||(oy={}));var Ef;(function(t){function e(r){return typeof r=="string"}t.is=e})(Ef||(Ef={}));var ay;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(ay||(ay={}));var Rl;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Rl||(Rl={}));var jr;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Rl.MAX_VALUE),i===Number.MAX_VALUE&&(i=Rl.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.uinteger(i.line)&&Q.uinteger(i.character)}t.is=r})(jr||(jr={}));var ze;(function(t){function e(n,i,s,o){if(Q.uinteger(n)&&Q.uinteger(i)&&Q.uinteger(s)&&Q.uinteger(o))return{start:jr.create(n,i),end:jr.create(s,o)};if(jr.is(n)&&jr.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments[".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,"]"))}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&jr.is(i.start)&&jr.is(i.end)}t.is=r})(ze||(ze={}));var ws;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&(Q.string(i.uri)||Q.undefined(i.uri))}t.is=r})(ws||(ws={}));var ly;(function(t){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.targetRange)&&Q.string(i.targetUri)&&ze.is(i.targetSelectionRange)&&(ze.is(i.originSelectionRange)||Q.undefined(i.originSelectionRange))}t.is=r})(ly||(ly={}));var Tf;(function(t){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.numberRange(i.red,0,1)&&Q.numberRange(i.green,0,1)&&Q.numberRange(i.blue,0,1)&&Q.numberRange(i.alpha,0,1)}t.is=r})(Tf||(Tf={}));var cy;(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&Tf.is(i.color)}t.is=r})(cy||(cy={}));var uy;(function(t){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.string(i.label)&&(Q.undefined(i.textEdit)||Vr.is(i))&&(Q.undefined(i.additionalTextEdits)||Q.typedArray(i.additionalTextEdits,Vr.is))}t.is=r})(uy||(uy={}));var No;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(No||(No={}));var fy;(function(t){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return Q.defined(s)&&(c.startCharacter=s),Q.defined(o)&&(c.endCharacter=o),Q.defined(a)&&(c.kind=a),Q.defined(l)&&(c.collapsedText=l),c}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.uinteger(i.startLine)&&Q.uinteger(i.startLine)&&(Q.undefined(i.startCharacter)||Q.uinteger(i.startCharacter))&&(Q.undefined(i.endCharacter)||Q.uinteger(i.endCharacter))&&(Q.undefined(i.kind)||Q.string(i.kind))}t.is=r})(fy||(fy={}));var Pf;(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ws.is(i.location)&&Q.string(i.message)}t.is=r})(Pf||(Pf={}));var Me;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Me||(Me={}));var hy;(function(t){t.Unnecessary=1,t.Deprecated=2})(hy||(hy={}));var dy;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&Q.string(n.href)}t.is=e})(dy||(dy={}));var Mn;(function(t){function e(n,i,s,o,a,l){var c={range:n,message:i};return Q.defined(s)&&(c.severity=s),Q.defined(o)&&(c.code=o),Q.defined(a)&&(c.source=a),Q.defined(l)&&(c.relatedInformation=l),c}t.create=e;function r(n){var i,s=n;return Q.defined(s)&&ze.is(s.range)&&Q.string(s.message)&&(Q.number(s.severity)||Q.undefined(s.severity))&&(Q.integer(s.code)||Q.string(s.code)||Q.undefined(s.code))&&(Q.undefined(s.codeDescription)||Q.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(Q.string(s.source)||Q.undefined(s.source))&&(Q.undefined(s.relatedInformation)||Q.typedArray(s.relatedInformation,Pf.is))}t.is=r})(Mn||(Mn={}));var Ss;(function(t){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a={title:n,command:i};return Q.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.title)&&Q.string(i.command)}t.is=r})(Ss||(Ss={}));var Vr;(function(t){function e(s,o){return{range:s,newText:o}}t.replace=e;function r(s,o){return{range:{start:s,end:s},newText:o}}t.insert=r;function n(s){return{range:s,newText:""}}t.del=n;function i(s){var o=s;return Q.objectLiteral(o)&&Q.string(o.newText)&&ze.is(o.range)}t.is=i})(Vr||(Vr={}));var ks;(function(t){function e(n,i,s){var o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&Q.string(i.label)&&(Q.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(Q.string(i.description)||i.description===void 0)}t.is=r})(ks||(ks={}));var qt;(function(t){function e(r){var n=r;return Q.string(n)}t.is=e})(qt||(qt={}));var ii;(function(t){function e(s,o,a){return{range:s,newText:o,annotationId:a}}t.replace=e;function r(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}t.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}t.del=n;function i(s){var o=s;return Vr.is(o)&&(ks.is(o.annotationId)||qt.is(o.annotationId))}t.is=i})(ii||(ii={}));var Ll;(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Fl.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(Ll||(Ll={}));var Ro;(function(t){function e(n,i,s){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){var i=n;return i&&i.kind==="create"&&Q.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||Q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Ro||(Ro={}));var Lo;(function(t){function e(n,i,s,o){var a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}t.create=e;function r(n){var i=n;return i&&i.kind==="rename"&&Q.string(i.oldUri)&&Q.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||Q.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||Q.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Lo||(Lo={}));var Bo;(function(t){function e(n,i,s){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){var i=n;return i&&i.kind==="delete"&&Q.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||Q.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||Q.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||qt.is(i.annotationId))}t.is=r})(Bo||(Bo={}));var Mf;(function(t){function e(r){var n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return Q.string(i.kind)?Ro.is(i)||Lo.is(i)||Bo.is(i):Ll.is(i)}))}t.is=e})(Mf||(Mf={}));var Bl=function(){function t(e,r){this.edits=e,this.changeAnnotations=r}return t.prototype.insert=function(e,r,n){var i,s;if(n===void 0?i=Vr.insert(e,r):qt.is(n)?(s=n,i=ii.insert(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.insert(e,r,s)),this.edits.push(i),s!==void 0)return s},t.prototype.replace=function(e,r,n){var i,s;if(n===void 0?i=Vr.replace(e,r):qt.is(n)?(s=n,i=ii.replace(e,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ii.replace(e,r,s)),this.edits.push(i),s!==void 0)return s},t.prototype.delete=function(e,r){var n,i;if(r===void 0?n=Vr.del(e):qt.is(r)?(i=r,n=ii.del(e,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=ii.del(e,i)),this.edits.push(n),i!==void 0)return i},t.prototype.add=function(e){this.edits.push(e)},t.prototype.all=function(){return this.edits},t.prototype.clear=function(){this.edits.splice(0,this.edits.length)},t.prototype.assertChangeAnnotations=function(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},t}(),py=function(){function t(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(e,r){var n;if(qt.is(e)?n=e:(n=this.nextId(),r=e),this._annotations[n]!==void 0)throw new Error("Id ".concat(n," is already in use."));if(r===void 0)throw new Error("No annotation provided for id ".concat(n));return this._annotations[n]=r,this._size++,n},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),I3=function(){function t(e){var r=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new py(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Ll.is(n)){var i=new Bl(n.edits,r._changeAnnotations);r._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Bl(e.changes[n]);r._textEditChanges[n]=i})):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(e){if(Fl.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var r={uri:e.uri,version:e.version},n=this._textEditChanges[r.uri];if(!n){var i=[],s={textDocument:r,edits:i};this._workspaceEdit.documentChanges.push(s),n=new Bl(i,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[e];if(!n){var i=[];this._workspaceEdit.changes[e]=i,n=new Bl(i),this._textEditChanges[e]=n}return n}},t.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new py,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;ks.is(r)||qt.is(r)?i=r:n=r;var s,o;if(i===void 0?s=Ro.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Ro.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},t.prototype.renameFile=function(e,r,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;ks.is(n)||qt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Lo.create(e,r,i):(a=qt.is(s)?s:this._changeAnnotations.manage(s),o=Lo.create(e,r,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a},t.prototype.deleteFile=function(e,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;ks.is(r)||qt.is(r)?i=r:n=r;var s,o;if(i===void 0?s=Bo.create(e,n):(o=qt.is(i)?i:this._changeAnnotations.manage(i),s=Bo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},t}(),gy;(function(t){function e(n){return{uri:n}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)}t.is=r})(gy||(gy={}));var my;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&Q.integer(i.version)}t.is=r})(my||(my={}));var Fl;(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&(i.version===null||Q.integer(i.version))}t.is=r})(Fl||(Fl={}));var vy;(function(t){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.string(i.uri)&&Q.string(i.languageId)&&Q.integer(i.version)&&Q.string(i.text)}t.is=r})(vy||(vy={}));var Ii;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){var n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(Ii||(Ii={}));var Fo;(function(t){function e(r){var n=r;return Q.objectLiteral(r)&&Ii.is(n.kind)&&Q.string(n.value)}t.is=e})(Fo||(Fo={}));var Or;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Or||(Or={}));var Dt;(function(t){t.PlainText=1,t.Snippet=2})(Dt||(Dt={}));var yy;(function(t){t.Deprecated=1})(yy||(yy={}));var by;(function(t){function e(n,i,s){return{newText:n,insert:i,replace:s}}t.create=e;function r(n){var i=n;return i&&Q.string(i.newText)&&ze.is(i.insert)&&ze.is(i.replace)}t.is=r})(by||(by={}));var xy;(function(t){t.asIs=1,t.adjustIndentation=2})(xy||(xy={}));var wy;(function(t){function e(r){var n=r;return n&&(Q.string(n.detail)||n.detail===void 0)&&(Q.string(n.description)||n.description===void 0)}t.is=e})(wy||(wy={}));var If;(function(t){function e(r){return{label:r}}t.create=e})(If||(If={}));var Sy;(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(Sy||(Sy={}));var jl;(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){var i=n;return Q.string(i)||Q.objectLiteral(i)&&Q.string(i.language)&&Q.string(i.value)}t.is=r})(jl||(jl={}));var ky;(function(t){function e(r){var n=r;return!!n&&Q.objectLiteral(n)&&(Fo.is(n.contents)||jl.is(n.contents)||Q.typedArray(n.contents,jl.is))&&(r.range===void 0||ze.is(r.range))}t.is=e})(ky||(ky={}));var Ay;(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Ay||(Ay={}));var Cy;(function(t){function e(r,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var o={label:r};return Q.defined(n)&&(o.documentation=n),Q.defined(i)?o.parameters=i:o.parameters=[],o}t.create=e})(Cy||(Cy={}));var Oy;(function(t){t.Text=1,t.Read=2,t.Write=3})(Oy||(Oy={}));var Ey;(function(t){function e(r,n){var i={range:r};return Q.number(n)&&(i.kind=n),i}t.create=e})(Ey||(Ey={}));var vn;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(vn||(vn={}));var Ty;(function(t){t.Deprecated=1})(Ty||(Ty={}));var Py;(function(t){function e(r,n,i,s,o){var a={name:r,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}t.create=e})(Py||(Py={}));var My;(function(t){function e(r,n,i,s){return s!==void 0?{name:r,kind:n,location:{uri:i,range:s}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(My||(My={}));var Iy;(function(t){function e(n,i,s,o,a,l){var c={name:n,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}t.create=e;function r(n){var i=n;return i&&Q.string(i.name)&&Q.number(i.kind)&&ze.is(i.range)&&ze.is(i.selectionRange)&&(i.detail===void 0||Q.string(i.detail))&&(i.deprecated===void 0||Q.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Iy||(Iy={}));var Dy;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(Dy||(Dy={}));var Vl;(function(t){t.Invoked=1,t.Automatic=2})(Vl||(Vl={}));var Ny;(function(t){function e(n,i,s){var o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.typedArray(i.diagnostics,Mn.is)&&(i.only===void 0||Q.typedArray(i.only,Q.string))&&(i.triggerKind===void 0||i.triggerKind===Vl.Invoked||i.triggerKind===Vl.Automatic)}t.is=r})(Ny||(Ny={}));var Ry;(function(t){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):Ss.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}t.create=e;function r(n){var i=n;return i&&Q.string(i.title)&&(i.diagnostics===void 0||Q.typedArray(i.diagnostics,Mn.is))&&(i.kind===void 0||Q.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Ss.is(i.command))&&(i.isPreferred===void 0||Q.boolean(i.isPreferred))&&(i.edit===void 0||Mf.is(i.edit))}t.is=r})(Ry||(Ry={}));var Ly;(function(t){function e(n,i){var s={range:n};return Q.defined(i)&&(s.data=i),s}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(i.range)&&(Q.undefined(i.command)||Ss.is(i.command))}t.is=r})(Ly||(Ly={}));var By;(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&Q.uinteger(i.tabSize)&&Q.boolean(i.insertSpaces)}t.is=r})(By||(By={}));var Fy;(function(t){function e(n,i,s){return{range:n,target:i,data:s}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(i.range)&&(Q.undefined(i.target)||Q.string(i.target))}t.is=r})(Fy||(Fy={}));var Wl;(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&ze.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Wl||(Wl={}));var jy;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(jy||(jy={}));var Vy;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Vy||(Vy={}));var Wy;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(Wy||(Wy={}));var $y;(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&Q.string(i.text)}t.is=r})($y||($y={}));var Hy;(function(t){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&Q.boolean(i.caseSensitiveLookup)&&(Q.string(i.variableName)||i.variableName===void 0)}t.is=r})(Hy||(Hy={}));var zy;(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){var i=n;return i!=null&&ze.is(i.range)&&(Q.string(i.expression)||i.expression===void 0)}t.is=r})(zy||(zy={}));var Uy;(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){var i=n;return Q.defined(i)&&ze.is(n.stoppedLocation)}t.is=r})(Uy||(Uy={}));var Df;(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(Df||(Df={}));var Nf;(function(t){function e(n){return{value:n}}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&(i.tooltip===void 0||Q.string(i.tooltip)||Fo.is(i.tooltip))&&(i.location===void 0||ws.is(i.location))&&(i.command===void 0||Ss.is(i.command))}t.is=r})(Nf||(Nf={}));var Gy;(function(t){function e(n,i,s){var o={position:n,label:i};return s!==void 0&&(o.kind=s),o}t.create=e;function r(n){var i=n;return Q.objectLiteral(i)&&jr.is(i.position)&&(Q.string(i.label)||Q.typedArray(i.label,Nf.is))&&(i.kind===void 0||Df.is(i.kind))&&i.textEdits===void 0||Q.typedArray(i.textEdits,Vr.is)&&(i.tooltip===void 0||Q.string(i.tooltip)||Fo.is(i.tooltip))&&(i.paddingLeft===void 0||Q.boolean(i.paddingLeft))&&(i.paddingRight===void 0||Q.boolean(i.paddingRight))}t.is=r})(Gy||(Gy={}));var Ky;(function(t){function e(r){var n=r;return Q.objectLiteral(n)&&Ef.is(n.uri)&&Q.string(n.name)}t.is=e})(Ky||(Ky={}));var D3=null,Yy;(function(t){function e(s,o,a,l){return new mP(s,o,a,l)}t.create=e;function r(s){var o=s;return!!(Q.defined(o)&&Q.string(o.uri)&&(Q.undefined(o.languageId)||Q.string(o.languageId))&&Q.uinteger(o.lineCount)&&Q.func(o.getText)&&Q.func(o.positionAt)&&Q.func(o.offsetAt))}t.is=r;function n(s,o){for(var a=s.getText(),l=i(o,function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),c=a.length,u=l.length-1;u>=0;u--){var h=l[u],d=s.offsetAt(h.range.start),p=s.offsetAt(h.range.end);if(p<=c)a=a.substring(0,d)+h.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}t.applyEdits=n;function i(s,o){if(s.length<=1)return s;var a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);for(var u=0,h=0,d=0;u<l.length&&h<c.length;){var p=o(l[u],c[h]);p<=0?s[d++]=l[u++]:s[d++]=c[h++]}for(;u<l.length;)s[d++]=l[u++];for(;h<c.length;)s[d++]=c[h++];return s}})(Yy||(Yy={}));var mP=function(){function t(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(e){if(e){var r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content},t.prototype.update=function(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0},t.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],r=this._content,n=!0,i=0;i<r.length;i++){n&&(e.push(i),n=!1);var s=r.charAt(i);n=s==="\r"||s===`
|
|
214
|
+
`,s==="\r"&&i+1<r.length&&r.charAt(i+1)===`
|
|
215
|
+
`&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets},t.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return jr.create(0,e);for(;n<i;){var s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}var o=n-1;return jr.create(o,e-r[o])},t.prototype.offsetAt=function(e){var r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;var n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t}(),Q;(function(t){var e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function o(p){return e.call(p)==="[object Number]"}t.number=o;function a(p,m,y){return e.call(p)==="[object Number]"&&m<=p&&p<=y}t.numberRange=a;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=c;function u(p){return e.call(p)==="[object Function]"}t.func=u;function h(p){return p!==null&&typeof p=="object"}t.objectLiteral=h;function d(p,m){return Array.isArray(p)&&p.every(m)}t.typedArray=d})(Q||(Q={}));var vP=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},Jy=function(){function t(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(e){if(e){var r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content},t.prototype.update=function(e,r){for(var n=0,i=e;n<i.length;n++){var s=i[n];if(t.isIncremental(s)){var o=Xy(s.range),a=this.offsetAt(o.start),l=this.offsetAt(o.end);this._content=this._content.substring(0,a)+s.text+this._content.substring(l,this._content.length);var c=Math.max(o.start.line,0),u=Math.max(o.end.line,0),h=this._lineOffsets,d=Qy(s.text,!1,a);if(u-c===d.length)for(var p=0,m=d.length;p<m;p++)h[p+c+1]=d[p];else d.length<1e4?h.splice.apply(h,vP([c+1,u-c],d,!1)):this._lineOffsets=h=h.slice(0,c+1).concat(d,h.slice(u+1));var y=s.text.length-(l-a);if(y!==0)for(var p=c+1+d.length,m=h.length;p<m;p++)h[p]=h[p]+y}else if(t.isFull(s))this._content=s.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received")}this._version=r},t.prototype.getLineOffsets=function(){return this._lineOffsets===void 0&&(this._lineOffsets=Qy(this._content,!0)),this._lineOffsets},t.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){var s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}var o=n-1;return{line:o,character:e-r[o]}},t.prototype.offsetAt=function(e){var r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;var n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t.isIncremental=function(e){var r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")},t.isFull=function(e){var r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0},t}(),Rf;(function(t){function e(i,s,o,a){return new Jy(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof Jy)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,s){for(var o=i.getText(),a=Lf(s.map(yP),function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),l=0,c=[],u=0,h=a;u<h.length;u++){var d=h[u],p=i.offsetAt(d.range.start);if(p<l)throw new Error("Overlapping edit");p>l&&c.push(o.substring(l,p)),d.newText.length&&c.push(d.newText),l=i.offsetAt(d.range.end)}return c.push(o.substr(l)),c.join("")}t.applyEdits=n})(Rf||(Rf={}));function Lf(t,e){if(t.length<=1)return t;var r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);Lf(n,e),Lf(i,e);for(var s=0,o=0,a=0;s<n.length&&o<i.length;){var l=e(n[s],i[o]);l<=0?t[a++]=n[s++]:t[a++]=i[o++]}for(;s<n.length;)t[a++]=n[s++];for(;o<i.length;)t[a++]=i[o++];return t}function Qy(t,e,r){r===void 0&&(r=0);for(var n=e?[r]:[],i=0;i<t.length;i++){var s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function Xy(t){var e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function yP(t){var e=Xy(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var $e;(function(t){t[t.Undefined=0]="Undefined",t[t.EnumValueMismatch=1]="EnumValueMismatch",t[t.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=258]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",t[t.InvalidUnicode=260]="InvalidUnicode",t[t.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",t[t.InvalidCharacter=262]="InvalidCharacter",t[t.PropertyExpected=513]="PropertyExpected",t[t.CommaExpected=514]="CommaExpected",t[t.ColonExpected=515]="ColonExpected",t[t.ValueExpected=516]="ValueExpected",t[t.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",t[t.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",t[t.TrailingComma=519]="TrailingComma",t[t.DuplicateKey=520]="DuplicateKey",t[t.CommentNotPermitted=521]="CommentNotPermitted",t[t.SchemaResolveError=768]="SchemaResolveError"})($e||($e={}));var Zy;(function(t){t.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Ii.Markdown,Ii.PlainText],commitCharactersSupport:!0}}}}})(Zy||(Zy={}));var Di=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),bP={"color-hex":{errorMessage:"Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.",pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:"String is not a RFC3339 date-time.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:"String is not a RFC3339 date.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:"String is not a RFC3339 time.",pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:"String is not an e-mail address.",pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Ni=function(){function t(e,r,n){this.offset=r,this.length=n,this.parent=e}return Object.defineProperty(t.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},t}(),xP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="null",i.value=null,i}return e}(Ni),_y=function(t){Di(e,t);function e(r,n,i){var s=t.call(this,r,i)||this;return s.type="boolean",s.value=n,s}return e}(Ni),wP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(Ni),SP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return e}(Ni),qy=function(t){Di(e,t);function e(r,n,i){var s=t.call(this,r,n,i)||this;return s.type="string",s.value="",s}return e}(Ni),kP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="property",i.colonOffset=-1,i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(Ni),AP=function(t){Di(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(Ni);function ur(t){return mn(t)?t?{}:{not:{}}:t}var eb;(function(t){t[t.Key=0]="Key",t[t.Enum=1]="Enum"})(eb||(eb={}));var CP=function(){function t(e,r){e===void 0&&(e=-1),r===void 0&&(r=null),this.focusOffset=e,this.exclude=r,this.schemas=[]}return t.prototype.add=function(e){this.schemas.push(e)},t.prototype.merge=function(e){var r;(r=this.schemas).push.apply(r,e.schemas)},t.prototype.include=function(e){return(this.focusOffset===-1||tb(e,this.focusOffset))&&e!==this.exclude},t.prototype.newSub=function(){return new t(-1,this.exclude)},t}(),Bf=function(){function t(){}return Object.defineProperty(t.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.add=function(e){},t.prototype.merge=function(e){},t.prototype.include=function(e){return!0},t.prototype.newSub=function(){return this},t.instance=new t,t}(),fr=function(){function t(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return t.prototype.hasProblems=function(){return!!this.problems.length},t.prototype.mergeAll=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r];this.merge(i)}},t.prototype.merge=function(e){this.problems=this.problems.concat(e.problems)},t.prototype.mergeEnumValues=function(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(var r=0,n=this.problems;r<n.length;r++){var i=n[r];i.code===$e.EnumValueMismatch&&(i.message="Value is not accepted. Valid values: "+this.enumValues.map(function(s){return JSON.stringify(s)}).join(", ")+".")}}},t.prototype.mergePropertyMatch=function(e){this.merge(e),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++},t.prototype.compare=function(e){var r=this.hasProblems();return r!==e.hasProblems()?r?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches},t}();function OP(t,e){return e===void 0&&(e=[]),new rb(t,e,[])}function si(t){return dP(t)}function Ff(t){return hP(t)}function tb(t,e,r){return r===void 0&&(r=!1),e>=t.offset&&e<t.offset+t.length||r&&e===t.offset+t.length}var rb=function(){function t(e,r,n){r===void 0&&(r=[]),n===void 0&&(n=[]),this.root=e,this.syntaxErrors=r,this.comments=n}return t.prototype.getNodeFromOffset=function(e,r){if(r===void 0&&(r=!1),this.root)return fP(this.root,e,r)},t.prototype.visit=function(e){if(this.root){var r=function(n){var i=e(n),s=n.children;if(Array.isArray(s))for(var o=0;o<s.length&&i;o++)i=r(s[o]);return i};r(this.root)}},t.prototype.validate=function(e,r){if(this.root&&r){var n=new fr;return $t(this.root,r,n,Bf.instance),n.problems.map(function(i){var s=ze.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Mn.create(s,i.message,i.severity,i.code)})}return null},t.prototype.getMatchingSchemas=function(e,r,n){r===void 0&&(r=-1),n===void 0&&(n=null);var i=new CP(r,n);return this.root&&e&&$t(this.root,e,new fr,i),i.schemas},t}();function $t(t,e,r,n){if(!t||!n.include(t))return;switch(t.type){case"object":l(t,e,r,n);break;case"array":a(t,e,r,n);break;case"string":o(t,e,r,n);break;case"number":s(t,e,r,n);break;case"property":return $t(t.valueNode,e,r,n)}i(),n.add({node:t,schema:e});function i(){function c(re){return t.type===re||re==="integer"&&t.type==="number"&&t.isInteger||e.nullable&&t.value===null}if(Array.isArray(e.type)?e.type.some(c)||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(c(e.type)||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,h=e.allOf;u<h.length;u++){var d=h[u];$t(t,ur(d),r,n)}var p=ur(e.not);if(p){var m=new fr,y=n.newSub();$t(t,p,m,y),m.hasProblems()||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,message:"Matches a schema that is not allowed."});for(var w=0,A=y.schemas;w<A.length;w++){var T=A[w];T.inverted=!T.inverted,n.add(T)}}var E=function(re,ce){for(var he=[],xe=null,Fe=0,we=re;Fe<we.length;Fe++){var Ee=we[Fe],Ue=ur(Ee),Ie=new fr,nt=n.newSub();if($t(t,Ue,Ie,nt),Ie.hasProblems()||he.push(Ue),!xe)xe={schema:Ue,validationResult:Ie,matchingSchemas:nt};else if(!ce&&!Ie.hasProblems()&&!xe.validationResult.hasProblems())xe.matchingSchemas.merge(nt),xe.validationResult.propertiesMatches+=Ie.propertiesMatches,xe.validationResult.propertiesValueMatches+=Ie.propertiesValueMatches;else{var dt=Ie.compare(xe.validationResult);dt>0?xe={schema:Ue,validationResult:Ie,matchingSchemas:nt}:dt===0&&(xe.matchingSchemas.merge(nt),xe.validationResult.mergeEnumValues(Ie))}}return he.length>1&&ce&&r.problems.push({location:{offset:t.offset,length:1},severity:Me.Warning,message:"Matches multiple schemas when only one must validate."}),xe!==null&&(r.merge(xe.validationResult),r.propertiesMatches+=xe.validationResult.propertiesMatches,r.propertiesValueMatches+=xe.validationResult.propertiesValueMatches,n.merge(xe.matchingSchemas)),he.length};Array.isArray(e.anyOf)&&E(e.anyOf,!1),Array.isArray(e.oneOf)&&E(e.oneOf,!0);var B=function(re){var ce=new fr,he=n.newSub();$t(t,ur(re),ce,he),r.merge(ce),r.propertiesMatches+=ce.propertiesMatches,r.propertiesValueMatches+=ce.propertiesValueMatches,n.merge(he)},I=function(re,ce,he){var xe=ur(re),Fe=new fr,we=n.newSub();$t(t,xe,Fe,we),n.merge(we),Fe.hasProblems()?he&&B(he):ce&&B(ce)},W=ur(e.if);if(W&&I(W,ur(e.then),ur(e.else)),Array.isArray(e.enum)){for(var F=si(t),_=!1,j=0,U=e.enum;j<U.length;j++){var Y=U[j];if(Do(F,Y)){_=!0;break}}r.enumValues=e.enum,r.enumValueMatch=_,_||r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(re){return JSON.stringify(re)}).join(", ")+"."})}if(Pn(e.const)){var F=si(t);Do(F,e.const)?r.enumValueMatch=!0:(r.problems.push({location:{offset:t.offset,length:t.length},severity:Me.Warning,code:$e.EnumValueMismatch,message:e.errorMessage||"Value must be "+JSON.stringify(e.const)+"."}),r.enumValueMatch=!1),r.enumValues=[e.const]}e.deprecationMessage&&t.parent&&r.problems.push({location:{offset:t.parent.offset,length:t.parent.length},severity:Me.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;Cr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(B,I){if(Cr(I))return I;if(mn(I)&&I)return B}function y(B,I){if(!mn(I)||!I)return B}var w=m(u.minimum,u.exclusiveMinimum);Cr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);Cr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);Cr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is below the minimum of "+T+"."});var E=y(u.maximum,u.exclusiveMaximum);Cr(E)&&p>E&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Value is above the maximum of "+E+"."})}function o(c,u,h,d){if(Cr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),Cr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),gP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||'String does not match the pattern of "'+u.pattern+'".'})}if(u.format)switch(u.format){case"uri":case"uri-reference":{var m=void 0;if(!c.value)m="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(c.value);y?!y[2]&&u.format==="uri"&&(m="URI with a scheme is expected."):m="URI is expected."}m&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+m})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var w=bP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.patternErrorMessage||u.errorMessage||w.errorMessage});break;default:}}function a(c,u,h,d){if(Array.isArray(u.items)){for(var p=u.items,m=0;m<p.length;m++){var y=p[m],w=ur(y),A=new fr,T=c.items[m];T?($t(T,w,A,d),h.mergePropertyMatch(A)):c.items.length>=p.length&&h.propertiesValueMatches++}if(c.items.length>p.length)if(typeof u.additionalItems=="object")for(var E=p.length;E<c.items.length;E++){var A=new fr;$t(c.items[E],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var B=ur(u.items);if(B)for(var I=0,W=c.items;I<W.length;I++){var T=W[I],A=new fr;$t(T,B,A,d),h.mergePropertyMatch(A)}}var F=ur(u.contains);if(F){var _=c.items.some(function(Y){var re=new fr;return $t(Y,F,re,Bf.instance),!re.hasProblems()});_||h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:u.errorMessage||"Array does not contain required item."})}if(Cr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),Cr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var j=si(c),U=j.some(function(Y,re){return re!==j.lastIndexOf(Y)});U&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Array has duplicate items."})}}function l(c,u,h,d){for(var p=Object.create(null),m=[],y=0,w=c.properties;y<w.length;y++){var A=w[y],T=A.keyNode.value;p[T]=A.valueNode,m.push(T)}if(Array.isArray(u.required))for(var E=0,B=u.required;E<B.length;E++){var I=B[E];if(!p[I]){var W=c.parent&&c.parent.type==="property"&&c.parent.keyNode,F=W?{offset:W.offset,length:W.length}:{offset:c.offset,length:1};h.problems.push({location:F,severity:Me.Warning,message:'Missing property "'+I+'".'})}}var _=function(or){for(var Ts=m.indexOf(or);Ts>=0;)m.splice(Ts,1),Ts=m.indexOf(or)};if(u.properties)for(var j=0,U=Object.keys(u.properties);j<U.length;j++){var I=U[j];_(I);var Y=u.properties[I],re=p[I];if(re)if(mn(Y))if(Y)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;$t(re,Y,ce,d),h.mergePropertyMatch(ce)}}if(u.patternProperties)for(var he=0,xe=Object.keys(u.patternProperties);he<xe.length;he++)for(var Fe=xe[he],we=new RegExp(Fe),Ee=0,Ue=m.slice(0);Ee<Ue.length;Ee++){var I=Ue[Ee];if(we.test(I)){_(I);var re=p[I];if(re){var Y=u.patternProperties[Fe];if(mn(Y))if(Y)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}else{var ce=new fr;$t(re,Y,ce,d),h.mergePropertyMatch(ce)}}}}if(typeof u.additionalProperties=="object")for(var Ie=0,nt=m;Ie<nt.length;Ie++){var I=nt[Ie],re=p[I];if(re){var ce=new fr;$t(re,u.additionalProperties,ce,d),h.mergePropertyMatch(ce)}}else if(u.additionalProperties===!1&&m.length>0)for(var dt=0,Bt=m;dt<Bt.length;dt++){var I=Bt[dt],re=p[I];if(re){var A=re.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Me.Warning,message:u.errorMessage||"Property "+I+" is not allowed."})}}if(Cr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),Cr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var er=0,Tr=Object.keys(u.dependencies);er<Tr.length;er++){var T=Tr[er],Ct=p[T];if(Ct){var tr=u.dependencies[T];if(Array.isArray(tr))for(var Pr=0,ai=tr;Pr<ai.length;Pr++){var li=ai[Pr];p[li]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Me.Warning,message:"Object is missing property "+li+" required by property {$key}."})}else{var Y=ur(tr);if(Y){var ce=new fr;$t(c,Y,ce,d),h.mergePropertyMatch(ce)}}}}var Mr=ur(u.propertyNames);if(Mr)for(var yn=0,Kl=c.properties;yn<Kl.length;yn++){var ci=Kl[yn],T=ci.keyNode;T&&$t(T,Mr,h,Bf.instance)}}}function EP(t,e){var r=[],n=-1,i=t.getText(),s=xs(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var W=s.scan();switch(h(),W){case 12:case 13:Array.isArray(o)&&o.push(ze.create(t.positionAt(s.getTokenOffset()),t.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return W}}}function l(W){return s.getToken()===W?(a(),!0):!1}function c(W,F,_,j,U){if(U===void 0&&(U=Me.Error),r.length===0||_!==n){var Y=ze.create(t.positionAt(_),t.positionAt(j));r.push(Mn.create(Y,W,U,F,t.languageId)),n=_}}function u(W,F,_,j,U){_===void 0&&(_=null),j===void 0&&(j=[]),U===void 0&&(U=[]);var Y=s.getTokenOffset(),re=s.getTokenOffset()+s.getTokenLength();if(Y===re&&Y>0){for(Y--;Y>0&&/\s/.test(i.charAt(Y));)Y--;re=Y+1}if(c(W,F,Y,re),_&&d(_,!1),j.length+U.length>0)for(var ce=s.getToken();ce!==17;){if(j.indexOf(ce)!==-1){a();break}else if(U.indexOf(ce)!==-1)break;ce=a()}return _}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",$e.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",$e.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",$e.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",$e.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",$e.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",$e.InvalidCharacter),!0}return!1}function d(W,F){return W.length=s.getTokenOffset()+s.getTokenLength()-W.offset,F&&a(),W}function p(W){if(s.getToken()!==3)return null;var F=new wP(W,s.getTokenOffset());a();for(var _=0,j=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){j||u("Value expected",$e.ValueExpected);var U=s.getTokenOffset();if(a(),s.getToken()===4){j&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else j&&u("Expected comma",$e.CommaExpected);var Y=E(F,_++);Y?F.items.push(Y):u("Value expected",$e.ValueExpected,null,[],[4,5]),j=!0}return s.getToken()!==4?u("Expected comma or closing bracket",$e.CommaOrCloseBacketExpected,F):d(F,!0)}function m(W,F){var _=new kP(W,s.getTokenOffset()),j=w(_);if(!j)if(s.getToken()===16){u("Property keys must be doublequoted",$e.Undefined);var U=new qy(_,s.getTokenOffset(),s.getTokenLength());U.value=s.getTokenValue(),j=U,a()}else return null;_.keyNode=j;var Y=F[j.value];if(Y?(c("Duplicate object key",$e.DuplicateKey,_.keyNode.offset,_.keyNode.offset+_.keyNode.length,Me.Warning),typeof Y=="object"&&c("DuplicateKeyWarning",$e.DuplicateKey,Y.keyNode.offset,Y.keyNode.offset+Y.keyNode.length,Me.Warning),F[j.value]=!0):F[j.value]=_,s.getToken()===6)_.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",$e.ColonExpected),s.getToken()===10&&t.positionAt(j.offset+j.length).line<t.positionAt(s.getTokenOffset()).line)return _.length=j.length,_;var re=E(_,j.value);return re?(_.valueNode=re,_.length=re.offset+re.length-_.offset,_):u("Value expected",$e.ValueExpected,_,[],[2,5])}function y(W){if(s.getToken()!==1)return null;var F=new AP(W,s.getTokenOffset()),_=Object.create(null);a();for(var j=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){j||u("Property expected",$e.PropertyExpected);var U=s.getTokenOffset();if(a(),s.getToken()===2){j&&c("Trailing comma",$e.TrailingComma,U,U+1);continue}}else j&&u("Expected comma",$e.CommaExpected);var Y=m(F,_);Y?F.properties.push(Y):u("Property expected",$e.PropertyExpected,null,[],[2,5]),j=!0}return s.getToken()!==2?u("Expected comma or closing brace",$e.CommaOrCloseBraceExpected,F):d(F,!0)}function w(W){if(s.getToken()!==10)return null;var F=new qy(W,s.getTokenOffset());return F.value=s.getTokenValue(),d(F,!0)}function A(W){if(s.getToken()!==11)return null;var F=new SP(W,s.getTokenOffset());if(s.getTokenError()===0){var _=s.getTokenValue();try{var j=JSON.parse(_);if(!Cr(j))return u("Invalid number format.",$e.Undefined,F);F.value=j}catch{return u("Invalid number format.",$e.Undefined,F)}F.isInteger=_.indexOf(".")===-1}return d(F,!0)}function T(W){var F;switch(s.getToken()){case 7:return d(new xP(W,s.getTokenOffset()),!0);case 8:return d(new _y(W,!0,s.getTokenOffset()),!0);case 9:return d(new _y(W,!1,s.getTokenOffset()),!0);default:return null}}function E(W,F){return p(W)||y(W)||w(W)||A(W)||T(W)}var B=null,I=a();return I!==17&&(B=E(null,null),B?s.getToken()!==17&&u("End of file expected.",$e.Undefined):u("Expected a JSON object, array or literal.",$e.Undefined)),new rb(B,r,o)}function jf(t,e,r){if(t!==null&&typeof t=="object"){var n=e+" ";if(Array.isArray(t)){if(t.length===0)return"[]";for(var i=`[
|
|
216
|
+
`,s=0;s<t.length;s++)i+=n+jf(t[s],n,r),s<t.length-1&&(i+=","),i+=`
|
|
217
|
+
`;return i+=e+"]",i}else{var o=Object.keys(t);if(o.length===0)return"{}";for(var i=`{
|
|
218
|
+
`,s=0;s<o.length;s++){var a=o[s];i+=n+JSON.stringify(a)+": "+jf(t[a],n,r),s<o.length-1&&(i+=","),i+=`
|
|
219
|
+
`}return i+=e+"}",i}}return r(t)}function TP(t,e){if(t.length<e.length)return!1;for(var r=0;r<e.length;r++)if(t[r]!==e[r])return!1;return!0}function Vf(t,e){var r=t.length-e.length;return r>0?t.lastIndexOf(e)===r:r===0?t===e:!1}function PP(t){return t.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function N3(t,e){for(var r="";e>0;)(e&1)===1&&(r+=t),t+=t,e=e>>>1;return r}var MP=[",","}","]"],IP=[":"],DP=function(){function t(e,r,n,i){r===void 0&&(r=[]),n===void 0&&(n=Promise),i===void 0&&(i={}),this.schemaService=e,this.contributions=r,this.promiseConstructor=n,this.clientCapabilities=i,this.templateVarIdCounter=0}return t.prototype.doResolve=function(e){for(var r=this.contributions.length-1;r>=0;r--)if(this.contributions[r].resolveCompletion){var n=this.contributions[r].resolveCompletion(e);if(n)return n}return this.promiseConstructor.resolve(e)},t.prototype.doComplete=function(e,r,n){var i=this,s={items:[],isIncomplete:!1},o=e.getText(),a=e.offsetAt(r),l=n.getNodeFromOffset(a,!0);if(this.isInComment(e,l?l.offset:0,a))return Promise.resolve(s);if(l&&a===l.offset+l.length&&a>0){var c=o[a-1];(l.type==="object"&&c==="}"||l.type==="array"&&c==="]")&&(l=l.parent)}var u=this.getCurrentWord(e,a),h=null;if(l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null"))h=ze.create(e.positionAt(l.offset),e.positionAt(l.offset+l.length));else{var d=a-u.length;d>0&&o[d-1]==='"'&&d--,h=ze.create(e.positionAt(d),r)}var p=this.doesSupportsCommitCharacters(),m={},y={add:function(w){var A=m[w.label];A?A.documentation||(A.documentation=w.documentation):(m[w.label]=w,h&&(w.textEdit=Vr.replace(h,w.insertText)),p&&(w.commitCharacters=w.kind===Or.Property?IP:MP),s.items.push(w))},setAsIncomplete:function(){s.isIncomplete=!0},error:function(w){console.error(w)},log:function(w){console.log(w)},getNumberOfProposals:function(){return s.items.length}};return this.schemaService.getSchemaForResource(e.uri,n).then(function(w){var A=[],T=!0,E="",B=null;if(l&&l.type==="string"){var I=l.parent;I&&I.type==="property"&&I.keyNode===l&&(T=!I.valueNode,B=I,E=o.substr(l.offset+1,l.length-2),I&&(l=I.parent))}if(l&&l.type==="object"){if(l.offset===a)return s;var W=l.properties;W.forEach(function(U){(!B||B!==U)&&(m[U.keyNode.value]=If.create("__"))});var F="";T&&(F=i.evaluateSeparatorAfter(e,e.offsetAt(h.end))),w?i.getPropertyCompletions(w,n,l,T,F,y):i.getSchemaLessPropertyCompletions(n,l,E,y);var _=Ff(l);i.contributions.forEach(function(U){var Y=U.collectPropertyCompletions(e.uri,_,u,T,F==="",y);Y&&A.push(Y)}),!w&&u.length>0&&o.charAt(a-u.length-1)!=='"'&&(y.add({kind:Or.Property,label:i.getLabelForValue(u),insertText:i.getInsertTextForProperty(u,null,!1,F),insertTextFormat:Dt.Snippet,documentation:""}),y.setAsIncomplete())}var j={};return w?i.getValueCompletions(w,n,l,a,e,y,j):i.getSchemaLessValueCompletions(n,l,a,e,y),i.contributions.length>0&&i.getContributedValueCompletions(n,l,a,e,y,A),i.promiseConstructor.all(A).then(function(){if(y.getNumberOfProposals()===0){var U=a;l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null")&&(U=l.offset+l.length);var Y=i.evaluateSeparatorAfter(e,U);i.addFillerValueCompletions(j,Y,y)}return s})})},t.prototype.getPropertyCompletions=function(e,r,n,i,s,o){var a=this,l=r.getMatchingSchemas(e.schema,n.offset);l.forEach(function(c){if(c.node===n&&!c.inverted){var u=c.schema.properties;u&&Object.keys(u).forEach(function(h){var d=u[h],p=!1;if(typeof d=="object"&&d.allOf)for(var m=0,y=d.allOf;m<y.length;m++){var w=y[m];if(w.readOnly){p=!0;break}}if(typeof d=="object"&&!d.deprecationMessage&&!d.doNotSuggest&&!p){var A={kind:Or.Property,label:a.sanitizeLabel(h),insertText:a.getInsertTextForProperty(h,d,i,s),insertTextFormat:Dt.Snippet,filterText:a.getFilterTextForValue(h),documentation:a.fromMarkup(d.markdownDescription)||d.description||""};Vf(A.insertText,"$1"+s)&&(A.command={title:"Suggest",command:"editor.action.triggerSuggest"}),o.add(A)}})}})},t.prototype.getSchemaLessPropertyCompletions=function(e,r,n,i){var s=this,o=function(l){l.properties.forEach(function(c){var u=c.keyNode.value;i.add({kind:Or.Property,label:s.sanitizeLabel(u),insertText:s.getInsertTextForValue(u,""),insertTextFormat:Dt.Snippet,filterText:s.getFilterTextForValue(u),documentation:""})})};if(r.parent)if(r.parent.type==="property"){var a=r.parent.keyNode.value;e.visit(function(l){return l.type==="property"&&l!==r.parent&&l.keyNode.value===a&&l.valueNode&&l.valueNode.type==="object"&&o(l.valueNode),!0})}else r.parent.type==="array"&&r.parent.items.forEach(function(l){l.type==="object"&&l!==r&&o(l)});else r.type==="object"&&i.add({kind:Or.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",null,!0,""),insertTextFormat:Dt.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})},t.prototype.getSchemaLessValueCompletions=function(e,r,n,i,s){var o=this,a=n;if(r&&(r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null")&&(a=r.offset+r.length,r=r.parent),!r){s.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:Dt.Snippet,documentation:""}),s.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:Dt.Snippet,documentation:""});return}var l=this.evaluateSeparatorAfter(i,a),c=function(p){tb(p.parent,n,!0)||s.add({kind:o.getSuggestionKind(p.type),label:o.getLabelTextForMatchingNode(p,i),insertText:o.getInsertTextForMatchingNode(p,i,l),insertTextFormat:Dt.Snippet,documentation:""}),p.type==="boolean"&&o.addBooleanValueCompletion(!p.value,l,s)};if(r.type==="property"&&n>r.colonOffset){var u=r.valueNode;if(u&&(n>u.offset+u.length||u.type==="object"||u.type==="array"))return;var h=r.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===h&&p.valueNode&&c(p.valueNode),!0}),h==="$schema"&&r.parent&&!r.parent.parent&&this.addDollarSchemaCompletions(l,s)}if(r.type==="array")if(r.parent&&r.parent.type==="property"){var d=r.parent.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===d&&p.valueNode&&p.valueNode.type==="array"&&p.valueNode.items.forEach(c),!0})}else r.items.forEach(c)},t.prototype.getValueCompletions=function(e,r,n,i,s,o,a){var l=this,c=i,u=null,h=null;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(c=n.offset+n.length,h=n,n=n.parent),!n){this.addSchemaValueCompletions(e.schema,"",o,a);return}if(n.type==="property"&&i>n.colonOffset){var d=n.valueNode;if(d&&i>d.offset+d.length)return;u=n.keyNode.value,n=n.parent}if(n&&(u!==null||n.type==="array")){var p=this.evaluateSeparatorAfter(s,c),m=r.getMatchingSchemas(e.schema,n.offset,h);m.forEach(function(y){if(y.node===n&&!y.inverted&&y.schema){if(n.type==="array"&&y.schema.items)if(Array.isArray(y.schema.items)){var w=l.findItemAtOffset(n,s,i);w<y.schema.items.length&&l.addSchemaValueCompletions(y.schema.items[w],p,o,a)}else l.addSchemaValueCompletions(y.schema.items,p,o,a);if(y.schema.properties){var A=y.schema.properties[u];A&&l.addSchemaValueCompletions(A,p,o,a)}}}),u==="$schema"&&!n.parent&&this.addDollarSchemaCompletions(p,o),a.boolean&&(this.addBooleanValueCompletion(!0,p,o),this.addBooleanValueCompletion(!1,p,o)),a.null&&this.addNullValueCompletion(p,o)}},t.prototype.getContributedValueCompletions=function(e,r,n,i,s,o){if(!r)this.contributions.forEach(function(u){var h=u.collectDefaultCompletions(i.uri,s);h&&o.push(h)});else if((r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null")&&(r=r.parent),r.type==="property"&&n>r.colonOffset){var a=r.keyNode.value,l=r.valueNode;if(!l||n<=l.offset+l.length){var c=Ff(r.parent);this.contributions.forEach(function(u){var h=u.collectValueCompletions(i.uri,c,a,s);h&&o.push(h)})}}},t.prototype.addSchemaValueCompletions=function(e,r,n,i){var s=this;typeof e=="object"&&(this.addEnumValueCompletions(e,r,n),this.addDefaultValueCompletions(e,r,n),this.collectTypes(e,i),Array.isArray(e.allOf)&&e.allOf.forEach(function(o){return s.addSchemaValueCompletions(o,r,n,i)}),Array.isArray(e.anyOf)&&e.anyOf.forEach(function(o){return s.addSchemaValueCompletions(o,r,n,i)}),Array.isArray(e.oneOf)&&e.oneOf.forEach(function(o){return s.addSchemaValueCompletions(o,r,n,i)}))},t.prototype.addDefaultValueCompletions=function(e,r,n,i){var s=this;i===void 0&&(i=0);var o=!1;if(Pn(e.default)){for(var a=e.type,l=e.default,c=i;c>0;c--)l=[l],a="array";n.add({kind:this.getSuggestionKind(a),label:this.getLabelForValue(l),insertText:this.getInsertTextForValue(l,r),insertTextFormat:Dt.Snippet}),o=!0}Array.isArray(e.examples)&&e.examples.forEach(function(u){for(var h=e.type,d=u,p=i;p>0;p--)d=[d],h="array";n.add({kind:s.getSuggestionKind(h),label:s.getLabelForValue(d),insertText:s.getInsertTextForValue(d,r),insertTextFormat:Dt.Snippet}),o=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(function(u){var h=e.type,d=u.body,p=u.label,m,y;if(Pn(d)){for(var w=e.type,A=i;A>0;A--)d=[d],w="array";m=s.getInsertTextForSnippetValue(d,r),y=s.getFilterTextForSnippetValue(d),p=p||s.getLabelForSnippetValue(d)}else if(typeof u.bodyText=="string"){for(var T="",E="",B="",A=i;A>0;A--)T=T+B+`[
|
|
220
|
+
`,E=E+`
|
|
221
|
+
`+B+"]",B+=" ",h="array";m=T+B+u.bodyText.split(`
|
|
221
222
|
`).join(`
|
|
222
|
-
`+
|
|
223
|
-
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,
|
|
223
|
+
`+B)+E+r,p=p||s.sanitizeLabel(m),y=m.replace(/[\n]/g,"")}n.add({kind:s.getSuggestionKind(h),label:p,documentation:s.fromMarkup(u.markdownDescription)||u.description,insertText:m,insertTextFormat:Dt.Snippet,filterText:y}),o=!0}),!o&&typeof e.items=="object"&&!Array.isArray(e.items)&&this.addDefaultValueCompletions(e.items,r,n,i+1)},t.prototype.addEnumValueCompletions=function(e,r,n){if(Pn(e.const)&&n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,r),insertTextFormat:Dt.Snippet,documentation:this.fromMarkup(e.markdownDescription)||e.description}),Array.isArray(e.enum))for(var i=0,s=e.enum.length;i<s;i++){var o=e.enum[i],a=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&i<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?a=this.fromMarkup(e.markdownEnumDescriptions[i]):e.enumDescriptions&&i<e.enumDescriptions.length&&(a=e.enumDescriptions[i]),n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(o),insertText:this.getInsertTextForValue(o,r),insertTextFormat:Dt.Snippet,documentation:a})}},t.prototype.collectTypes=function(e,r){if(!(Array.isArray(e.enum)||Pn(e.const))){var n=e.type;Array.isArray(n)?n.forEach(function(i){return r[i]=!0}):r[n]=!0}},t.prototype.addFillerValueCompletions=function(e,r,n){e.object&&n.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},r),insertTextFormat:Dt.Snippet,detail:"New object",documentation:""}),e.array&&n.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],r),insertTextFormat:Dt.Snippet,detail:"New array",documentation:""})},t.prototype.addBooleanValueCompletion=function(e,r,n){n.add({kind:this.getSuggestionKind("boolean"),label:e?"true":"false",insertText:this.getInsertTextForValue(e,r),insertTextFormat:Dt.Snippet,documentation:""})},t.prototype.addNullValueCompletion=function(e,r){r.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:Dt.Snippet,documentation:""})},t.prototype.addDollarSchemaCompletions=function(e,r){var n=this,i=this.schemaService.getRegisteredSchemaIds(function(s){return s==="http"||s==="https"});i.forEach(function(s){return r.add({kind:Or.Module,label:n.getLabelForValue(s),filterText:n.getFilterTextForValue(s),insertText:n.getInsertTextForValue(s,e),insertTextFormat:Dt.Snippet,documentation:""})})},t.prototype.sanitizeLabel=function(e){return e=e.replace(/[\n]/g,"\u21B5"),e.length>57&&(e=e.substr(0,57).trim()+"..."),e},t.prototype.getLabelForValue=function(e){return this.sanitizeLabel(JSON.stringify(e))},t.prototype.getFilterTextForValue=function(e){return JSON.stringify(e)},t.prototype.getFilterTextForSnippetValue=function(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")},t.prototype.getLabelForSnippetValue=function(e){var r=JSON.stringify(e);return r=r.replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1"),this.sanitizeLabel(r)},t.prototype.getInsertTextForPlainText=function(e){return e.replace(/[\\\$\}]/g,"\\$&")},t.prototype.getInsertTextForValue=function(e,r){var n=JSON.stringify(e,null," ");return n==="{}"?"{$1}"+r:n==="[]"?"[$1]"+r:this.getInsertTextForPlainText(n+r)},t.prototype.getInsertTextForSnippetValue=function(e,r){var n=function(i){return typeof i=="string"&&i[0]==="^"?i.substr(1):JSON.stringify(i)};return jf(e,"",n)+r},t.prototype.getInsertTextForGuessedValue=function(e,r){switch(typeof e){case"object":return e===null?"${1:null}"+r:this.getInsertTextForValue(e,r);case"string":var n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),'"${1:'+n+'}"'+r;case"number":case"boolean":return"${1:"+JSON.stringify(e)+"}"+r}return this.getInsertTextForValue(e,r)},t.prototype.getSuggestionKind=function(e){if(Array.isArray(e)){var r=e;e=r.length>0?r[0]:null}if(!e)return Or.Value;switch(e){case"string":return Or.Value;case"object":return Or.Module;case"property":return Or.Property;default:return Or.Value}},t.prototype.getLabelTextForMatchingNode=function(e,r){switch(e.type){case"array":return"[]";case"object":return"{}";default:var n=r.getText().substr(e.offset,e.length);return n}},t.prototype.getInsertTextForMatchingNode=function(e,r,n){switch(e.type){case"array":return this.getInsertTextForValue([],n);case"object":return this.getInsertTextForValue({},n);default:var i=r.getText().substr(e.offset,e.length)+n;return this.getInsertTextForPlainText(i)}},t.prototype.getInsertTextForProperty=function(e,r,n,i){var s=this.getInsertTextForValue(e,"");if(!n)return s;var o=s+": ",a,l=0;if(r){if(Array.isArray(r.defaultSnippets)){if(r.defaultSnippets.length===1){var c=r.defaultSnippets[0].body;Pn(c)&&(a=this.getInsertTextForSnippetValue(c,""))}l+=r.defaultSnippets.length}if(r.enum&&(!a&&r.enum.length===1&&(a=this.getInsertTextForGuessedValue(r.enum[0],"")),l+=r.enum.length),Pn(r.default)&&(a||(a=this.getInsertTextForGuessedValue(r.default,"")),l++),l===0){var u=Array.isArray(r.type)?r.type[0]:r.type;switch(u||(r.properties?u="object":r.items&&(u="array")),u){case"boolean":a="$1";break;case"string":a='"$1"';break;case"object":a="{$1}";break;case"array":a="[$1]";break;case"number":case"integer":a="${1:0}";break;case"null":a="${1:null}";break;default:return s}}}return(!a||l>1)&&(a="$1"),o+a+i},t.prototype.getCurrentWord=function(e,r){for(var n=r-1,i=e.getText();n>=0&&`
|
|
224
|
+
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,r)},t.prototype.evaluateSeparatorAfter=function(e,r){var n=xs(e.getText(),!0);n.setPosition(r);var i=n.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},t.prototype.findItemAtOffset=function(e,r,n){for(var i=xs(r.getText(),!0),s=e.items,o=s.length-1;o>=0;o--){var a=s[o];if(n>a.offset+a.length){i.setPosition(a.offset+a.length);var l=i.scan();return l===5&&n>=i.getTokenOffset()+i.getTokenLength()?o+1:o}else if(n>=a.offset)return o}return 0},t.prototype.isInComment=function(e,r,n){var i=xs(e.getText(),!1);i.setPosition(r);for(var s=i.scan();s!==17&&i.getTokenOffset()+i.getTokenLength()<n;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=n},t.prototype.fromMarkup=function(e){if(e&&this.doesSupportMarkdown())return{kind:Ii.Markdown,value:e}},t.prototype.doesSupportMarkdown=function(){if(!Pn(this.supportsMarkdown)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsMarkdown=e&&e.completionItem&&Array.isArray(e.completionItem.documentationFormat)&&e.completionItem.documentationFormat.indexOf(Ii.Markdown)!==-1}return this.supportsMarkdown},t.prototype.doesSupportsCommitCharacters=function(){if(!Pn(this.supportsCommitCharacters)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=e&&e.completionItem&&!!e.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},t}(),NP=function(){function t(e,r,n){r===void 0&&(r=[]),this.schemaService=e,this.contributions=r,this.promise=n||Promise}return t.prototype.doHover=function(e,r,n){var i=e.offsetAt(r),s=n.getNodeFromOffset(i);if(!s||(s.type==="object"||s.type==="array")&&i>s.offset+1&&i<s.offset+s.length-1)return this.promise.resolve(null);var o=s;if(s.type==="string"){var a=s.parent;if(a&&a.type==="property"&&a.keyNode===s&&(s=a.valueNode,!s))return this.promise.resolve(null)}for(var l=ze.create(e.positionAt(o.offset),e.positionAt(o.offset+o.length)),c=function(m){var y={contents:m,range:l};return y},u=Ff(s),h=this.contributions.length-1;h>=0;h--){var d=this.contributions[h],p=d.getInfoContribution(e.uri,u);if(p)return p.then(function(m){return c(m)})}return this.schemaService.getSchemaForResource(e.uri,n).then(function(m){if(m){var y=n.getMatchingSchemas(m.schema,s.offset),w=null,A=null,T=null,E=null;y.every(function(I){if(I.node===s&&!I.inverted&&I.schema&&(w=w||I.schema.title,A=A||I.schema.markdownDescription||Wf(I.schema.description),I.schema.enum)){var W=I.schema.enum.indexOf(si(s));I.schema.markdownEnumDescriptions?T=I.schema.markdownEnumDescriptions[W]:I.schema.enumDescriptions&&(T=Wf(I.schema.enumDescriptions[W])),T&&(E=I.schema.enum[W],typeof E!="string"&&(E=JSON.stringify(E)))}return!0});var B="";return w&&(B=Wf(w)),A&&(B.length>0&&(B+=`
|
|
224
225
|
|
|
225
|
-
`),
|
|
226
|
+
`),B+=A),T&&(B.length>0&&(B+=`
|
|
226
227
|
|
|
227
|
-
`),
|
|
228
|
+
`),B+="`"+RP(E)+"`: "+T),c([B])}return null})},t}();function Wf(t){if(t){var e=t.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
|
|
228
229
|
|
|
229
|
-
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.indexOf("`")!==-1?"`` "+r+" ``":r}var RP=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)}}(),vt,Fo;if(typeof process=="object")Fo=!1;else if(typeof navigator=="object"){var LP=navigator.userAgent;Fo=LP.indexOf("Windows")>=0}function D3(r){return 55296<=r&&r<=56319}function N3(r){return 56320<=r&&r<=57343}function R3(r){return r>=97&&r<=102}function BP(r){return r>=97&&r<=122}function FP(r){return r>=65&&r<=90}function L3(r){return BP(r)||FP(r)}var jP=/^\w[\w\d+.-]*$/,VP=/^\//,WP=/^\/\//;function $P(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&&!jP.test(r.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(r.path){if(r.authority){if(!VP.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(WP.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 HP(r,e){return!r&&!e?"file":r}function zP(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==Gr&&(e=Gr+e):e=Gr;break}return e}var et="",Gr="/",UP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Wf=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=HP(e,o),this.authority=t||et,this.path=zP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,$P(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 ib(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 ks(t,n,i,s,o)},r.parse=function(e,t){t===void 0&&(t=!1);var n=UP.exec(e);return n?new ks(n[2]||et,Wl(n[4]||et),Wl(n[5]||et),Wl(n[7]||et),Wl(n[9]||et),t):new ks(et,et,et,et,et)},r.file=function(e){var t=et;if(Fo&&(e=e.replace(/\\/g,Gr)),e[0]===Gr&&e[1]===Gr){var n=e.indexOf(Gr,2);n===-1?(t=e.substring(2),e=Gr):(t=e.substring(2,n),e=e.substring(n)||Gr)}return new ks("file",t,e,et,et)},r.from=function(e){return new ks(e.scheme,e.authority,e.path,e.query,e.fragment)},r.prototype.toString=function(e){return e===void 0&&(e=!1),$f(this,e)},r.prototype.toJSON=function(){return this},r.revive=function(e){if(e){if(e instanceof r)return e;var t=new ks(e);return t._formatted=e.external,t._fsPath=e._sep===tb?e.fsPath:null,t}else return e},r}(),tb=Fo?1:void 0,ks=function(r){RP(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=ib(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){return t===void 0&&(t=!1),t?$f(this,!0):(this._formatted||(this._formatted=$f(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=tb),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}(Wf),rb=(vt={},vt[58]="%3A",vt[47]="%2F",vt[63]="%3F",vt[35]="%23",vt[91]="%5B",vt[93]="%5D",vt[64]="%40",vt[33]="%21",vt[36]="%24",vt[38]="%26",vt[39]="%27",vt[40]="%28",vt[41]="%29",vt[42]="%2A",vt[43]="%2B",vt[44]="%2C",vt[59]="%3B",vt[61]="%3D",vt[32]="%20",vt);function nb(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=rb[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 GP(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+=rb[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function ib(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,Fo&&(t=t.replace(/\//g,"\\")),t}function $f(r,e){var t=e?GP:nb,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+=Gr,n+=Gr),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:nb(l,!1)),n}function sb(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+sb(r.substr(3)):r}}var ob=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Wl(r){return r.match(ob)?r.replace(ob,function(e){return sb(e)}):r}var KP=function(){function r(e){try{this.patternRegExp=new RegExp(TP(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}(),YP=function(){function r(e,t,n){this.service=e,this.url=t,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new As(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}(),As=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r}(),ab=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r.prototype.getSection=function(e){return cr(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}(),JP=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=Wf.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 Wf.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 YP(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 KP(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 '"+$l(e)+"'. No schema request service available";return this.promise.resolve(new As({},[t]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+$l(e)+"': No content.";return new As({},[i])}var s={},o=[];s=cP(n,o);var a=o.length?["Unable to parse content from '"+$l(e)+"': Parse error at offset "+o[0].offset]:[];return new As(s,a)},function(n){var i="Unable to load schema from '"+$l(e)+"': "+n.toString();return new As({},[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 ab({},["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(P){if(A[m]=!0,P.errors.length){var L=y?m+"#"+y:m;s.push("Problems loading reference '"+L+"': "+P.errors[0]+".")}return u(p,P.schema,m,y),d(p,P.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],P=[],L=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];typeof fe=="object"&&A.push(fe)}},D=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(typeof fe=="object")for(var be in fe){var ke=fe[be];typeof ke=="object"&&A.push(ke)}}},j=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(Array.isArray(fe))for(var be=0,ke=fe;be<ke.length;be++){var Re=ke[be];typeof Re=="object"&&A.push(Re)}}},W=function(F){for(var H=[];F.$ref;){var Q=F.$ref,oe=Q.split("#",2);if(delete F.$ref,oe[0].length>0){P.push(h(F,oe[0],oe[1],y,w));return}else H.indexOf(Q)===-1&&(u(F,m,y,oe[1]),H.push(Q))}L(F.items,F.additionalProperties,F.not,F.contains,F.propertyNames,F.if,F.then,F.else),D(F.definitions,F.properties,F.patternProperties,F.dependencies),j(F.anyOf,F.allOf,F.oneOf,F.items)};A.length;){var q=A.pop();T.indexOf(q)>=0||(T.push(q),W(q))}return i.promise.all(P)};return d(o,o,t,n).then(function(p){return new ab(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=ni(n[0].valueNode);if(i&&EP(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 $l(r){try{}catch{}return r}var QP=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:Ie.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?ub(n.trailingCommas):Ie.Error,p=n?ub(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=Ue.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}else{var A=Ue.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}}else{var T=t.validate(e,h.schema);T&&T.forEach(l)}lb(h.schema)&&(p=void 0),cb(h.schema)&&(d=void 0)}for(var P=0,L=t.syntaxErrors;P<L.length;P++){var D=L[P];if(D.code===He.TrailingComma){if(typeof d!="number")continue;D.severity=d}l(D)}if(typeof p=="number"){var j="Comments are not permitted in JSON.";t.comments.forEach(function(W){l(Pn.create(W,j,p,He.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+XP++;return this.jsonSchemaService.resolveSchemaContent(new As(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(function(h){return c(h)})},r}(),XP=0;function lb(r){if(r&&typeof r=="object"){if(gn(r.allowComments))return r.allowComments;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=lb(n);if(gn(i))return i}}}function cb(r){if(r&&typeof r=="object"){if(gn(r.allowTrailingCommas))return r.allowTrailingCommas;if(gn(r.allowsTrailingCommas))return r.allowsTrailingCommas;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=cb(n);if(gn(i))return i}}}function ub(r){switch(r){case"error":return Ie.Error;case"warning":return Ie.Warning;case"ignore":return}}var fb=48,ZP=57,_P=65,Hl=97,qP=102;function yt(r){return r<fb?0:r<=ZP?r-fb:(r<Hl&&(r+=Hl-_P),r>=Hl&&r<=qP?r-Hl+10:0)}function eM(r){if(r[0]!=="#")return null;switch(r.length){case 4:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:1};case 5:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:yt(r.charCodeAt(4))*17/255};case 7:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:1};case 9:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:(yt(r.charCodeAt(7))*16+yt(r.charCodeAt(8)))/255}}return null}function B3(r,e,t,n){return n===void 0&&(n=1),{red:r/255,green:e/255,blue:t/255,alpha:n}}var tM=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"||jf(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=xs.create(e.uri,ii(e,h));if(l.push({name:ni(m.valueNode),kind:mn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,P,L){return o>=0&&(P.type==="array"?P.items.forEach(function(D){return w(T,D,L)}):P.type==="object"&&P.properties.forEach(function(D){if(o>=0){var j=D.valueNode;if(j){o--;var W=xs.create(e.uri,ii(e,D)),q=L?L+"."+D.keyNode.value:D.keyNode.value;T.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),location:W,containerName:L}),w(T,j,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"||jf(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=ii(e,h),w=ii(e,m.keyNode);if(l.push({name:ni(m.valueNode),kind:mn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(P,L){return o>=0&&(L.type==="array"?L.items.forEach(function(D,j){if(D&&o>=0){o--;var W=ii(e,D),q=W,F=String(j),H=A([],D);P.push({name:F,kind:i.getSymbolKind(D.type),range:W,selectionRange:q,children:H})}}):L.type==="object"&&L.properties.forEach(function(D){var j=D.valueNode;if(j&&o>=0){o--;var W=ii(e,D),q=ii(e,D.keyNode),F=A([],j);P.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),range:W,selectionRange:q,children:F})}})),P},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 mn.Module;case"string":return mn.String;case"number":return mn.Number;case"array":return mn.Array;case"boolean":return mn.Boolean;default:return mn.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=eM(ni(h.node));if(p){var m=ii(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:Fr.replace(i,JSON.stringify(u))}),s},r}();function ii(r,e){return Ue.create(r.positionAt(e.offset),r.positionAt(e.offset+e.length))}var rM={schemaAssociations:{},schemas:{}};function nM(r,e){var t=[],n=[],i=[],s=-1,o=bs(r.getText(),!1),a=o.scan();function l(H){t.push(H),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(Br.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:Do.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:Do.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==Do.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=[],P=0,L=n;P<L.length;P++){var D=L[P];D<30&&(T[D]=(T[D]||0)+1)}for(var j=0,W=0,w=0;w<T.length;w++){var q=T[w];if(q){if(q+j>A){W=w;break}j+=q}}for(var F=[],w=0;w<t.length;w++){var D=n[w];typeof D=="number"&&(D<W||D===W&&j++<A)&&F.push(t[w])}return F}function iM(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=Vl.create(u[y],m);return m||(m=Vl.create(Ue.create(a,a))),m}function i(a,l){return Ue.create(r.positionAt(a),r.positionAt(l))}var s=bs(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 sM(r){var e=r.promiseConstructor||Promise,t=new JP(r.schemaRequestService,r.workspaceContext,e);t.setSchemaContributions(rM);var n=new IP(t,r.contributions,e,r.clientCapabilities),i=new DP(t,r.contributions,e),s=new tM(t),o=new QP(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 OP(a,{collectComments:!0})},newJSONDocument:function(a,l){return CP(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:nM,getSelectionRanges:iM,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:`
|
|
230
|
-
`};return
|
|
230
|
+
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function RP(t){return t.indexOf("`")!==-1?"`` "+t+" ``":t}var LP=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),bt,jo;if(typeof process=="object")jo=!1;else if(typeof navigator=="object"){var BP=navigator.userAgent;jo=BP.indexOf("Windows")>=0}function R3(t){return 55296<=t&&t<=56319}function L3(t){return 56320<=t&&t<=57343}function B3(t){return t>=97&&t<=102}function FP(t){return t>=97&&t<=122}function jP(t){return t>=65&&t<=90}function F3(t){return FP(t)||jP(t)}var VP=/^\w[\w\d+.-]*$/,WP=/^\//,$P=/^\/\//;function HP(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!VP.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path){if(t.authority){if(!WP.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if($P.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function zP(t,e){return!t&&!e?"file":t}function UP(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==Yr&&(e=Yr+e):e=Yr;break}return e}var et="",Yr="/",GP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,$f=function(){function t(e,r,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||et,this.authority=e.authority||et,this.path=e.path||et,this.query=e.query||et,this.fragment=e.fragment||et):(this.scheme=zP(e,o),this.authority=r||et,this.path=UP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,HP(this,o))}return t.isUri=function(e){return e instanceof t?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(t.prototype,"fsPath",{get:function(){return ob(this,!1)},enumerable:!0,configurable:!0}),t.prototype.with=function(e){if(!e)return this;var r=e.scheme,n=e.authority,i=e.path,s=e.query,o=e.fragment;return r===void 0?r=this.scheme:r===null&&(r=et),n===void 0?n=this.authority:n===null&&(n=et),i===void 0?i=this.path:i===null&&(i=et),s===void 0?s=this.query:s===null&&(s=et),o===void 0?o=this.fragment:o===null&&(o=et),r===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new As(r,n,i,s,o)},t.parse=function(e,r){r===void 0&&(r=!1);var n=GP.exec(e);return n?new As(n[2]||et,$l(n[4]||et),$l(n[5]||et),$l(n[7]||et),$l(n[9]||et),r):new As(et,et,et,et,et)},t.file=function(e){var r=et;if(jo&&(e=e.replace(/\\/g,Yr)),e[0]===Yr&&e[1]===Yr){var n=e.indexOf(Yr,2);n===-1?(r=e.substring(2),e=Yr):(r=e.substring(2,n),e=e.substring(n)||Yr)}return new As("file",r,e,et,et)},t.from=function(e){return new As(e.scheme,e.authority,e.path,e.query,e.fragment)},t.prototype.toString=function(e){return e===void 0&&(e=!1),Hf(this,e)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new As(e);return r._formatted=e.external,r._fsPath=e._sep===nb?e.fsPath:null,r}else return e},t}(),nb=jo?1:void 0,As=function(t){LP(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._formatted=null,r._fsPath=null,r}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=ob(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(r){return r===void 0&&(r=!1),r?Hf(this,!0):(this._formatted||(this._formatted=Hf(this,!1)),this._formatted)},e.prototype.toJSON=function(){var r={$mid:1};return this._fsPath&&(r.fsPath=this._fsPath,r._sep=nb),this._formatted&&(r.external=this._formatted),this.path&&(r.path=this.path),this.scheme&&(r.scheme=this.scheme),this.authority&&(r.authority=this.authority),this.query&&(r.query=this.query),this.fragment&&(r.fragment=this.fragment),r},e}($f),ib=(bt={},bt[58]="%3A",bt[47]="%2F",bt[63]="%3F",bt[35]="%23",bt[91]="%5B",bt[93]="%5D",bt[64]="%40",bt[33]="%21",bt[36]="%24",bt[38]="%26",bt[39]="%27",bt[40]="%28",bt[41]="%29",bt[42]="%2A",bt[43]="%2B",bt[44]="%2C",bt[59]="%3B",bt[61]="%3D",bt[32]="%20",bt);function sb(t,e){for(var r=void 0,n=-1,i=0;i<t.length;i++){var s=t.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47)n!==-1&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),r!==void 0&&(r+=t.charAt(i));else{r===void 0&&(r=t.substr(0,i));var o=ib[s];o!==void 0?(n!==-1&&(r+=encodeURIComponent(t.substring(n,i)),n=-1),r+=o):n===-1&&(n=i)}}return n!==-1&&(r+=encodeURIComponent(t.substring(n))),r!==void 0?r:t}function KP(t){for(var e=void 0,r=0;r<t.length;r++){var n=t.charCodeAt(r);n===35||n===63?(e===void 0&&(e=t.substr(0,r)),e+=ib[n]):e!==void 0&&(e+=t[r])}return e!==void 0?e:t}function ob(t,e){var r;return t.authority&&t.path.length>1&&t.scheme==="file"?r="//"+t.authority+t.path:t.path.charCodeAt(0)===47&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&t.path.charCodeAt(2)===58?e?r=t.path.substr(1):r=t.path[1].toLowerCase()+t.path.substr(2):r=t.path,jo&&(r=r.replace(/\//g,"\\")),r}function Hf(t,e){var r=e?KP:sb,n="",i=t.scheme,s=t.authority,o=t.path,a=t.query,l=t.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=Yr,n+=Yr),s){var c=s.indexOf("@");if(c!==-1){var u=s.substr(0,c);s=s.substr(c+1),c=u.indexOf(":"),c===-1?n+=r(u,!1):(n+=r(u.substr(0,c),!1),n+=":",n+=r(u.substr(c+1),!1)),n+="@"}s=s.toLowerCase(),c=s.indexOf(":"),c===-1?n+=r(s,!1):(n+=r(s.substr(0,c),!1),n+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var h=o.charCodeAt(1);h>=65&&h<=90&&(o="/"+String.fromCharCode(h+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var h=o.charCodeAt(0);h>=65&&h<=90&&(o=String.fromCharCode(h+32)+":"+o.substr(2))}n+=r(o,!0)}return a&&(n+="?",n+=r(a,!1)),l&&(n+="#",n+=e?l:sb(l,!1)),n}function ab(t){try{return decodeURIComponent(t)}catch{return t.length>3?t.substr(0,3)+ab(t.substr(3)):t}}var lb=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function $l(t){return t.match(lb)?t.replace(lb,function(e){return ab(e)}):t}var YP=function(){function t(e){try{this.patternRegExp=new RegExp(PP(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return t.prototype.addSchema=function(e){this.schemas.push(e)},t.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},t.prototype.getSchemas=function(){return this.schemas},t}(),JP=function(){function t(e,r,n){this.service=e,this.url=r,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new Cs(n)))}return t.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},t.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(r){return e.service.resolveSchemaContent(r,e.url,e.dependencies)})),this.resolvedSchema},t.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},t}(),Cs=function(){function t(e,r){r===void 0&&(r=[]),this.schema=e,this.errors=r}return t}(),cb=function(){function t(e,r){r===void 0&&(r=[]),this.schema=e,this.errors=r}return t.prototype.getSection=function(e){return ur(this.getSectionRecursive(e,this.schema))},t.prototype.getSectionRecursive=function(e,r){if(!r||typeof r=="boolean"||e.length===0)return r;var n=e.shift();if(r.properties&&typeof r.properties[n])return this.getSectionRecursive(e,r.properties[n]);if(r.patternProperties)for(var i=0,s=Object.keys(r.patternProperties);i<s.length;i++){var o=s[i],a=new RegExp(o);if(a.test(n))return this.getSectionRecursive(e,r.patternProperties[o])}else{if(typeof r.additionalProperties=="object")return this.getSectionRecursive(e,r.additionalProperties);if(n.match("[0-9]+")){if(Array.isArray(r.items)){var l=parseInt(n,10);if(!isNaN(l)&&r.items[l])return this.getSectionRecursive(e,r.items[l])}else if(r.items)return this.getSectionRecursive(e,r.items)}}return null},t}(),QP=function(){function t(e,r,n){this.contextService=r,this.requestService=e,this.promiseConstructor=n||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return t.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(r){var n=$f.parse(r).scheme;return n!=="schemaservice"&&(!e||e(n))})},Object.defineProperty(t.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},t.prototype.onResourceChange=function(e){var r=this,n=!1;e=this.normalizeId(e);for(var i=[e],s=Object.keys(this.schemasById).map(function(c){return r.schemasById[c]});i.length;)for(var o=i.pop(),a=0;a<s.length;a++){var l=s[a];l&&(l.url===o||l.dependencies[o])&&(l.url!==o&&i.push(l.url),l.clearSchema(),s[a]=void 0,n=!0)}return n},t.prototype.normalizeId=function(e){try{return $f.parse(e).toString()}catch{return e}},t.prototype.setSchemaContributions=function(e){if(e.schemas){var r=e.schemas;for(var n in r){var i=this.normalizeId(n);this.contributionSchemas[i]=this.addSchemaHandle(i,r[n])}}if(e.schemaAssociations){var s=e.schemaAssociations;for(var o in s){var a=s[o];this.contributionAssociations[o]=a;for(var l=this.getOrAddFilePatternAssociation(o),c=0,u=a;c<u.length;c++){var h=u[c],n=this.normalizeId(h);l.addSchema(n)}}}},t.prototype.addSchemaHandle=function(e,r){var n=new JP(this,e,r);return this.schemasById[e]=n,n},t.prototype.getOrAddSchemaHandle=function(e,r){return this.schemasById[e]||this.addSchemaHandle(e,r)},t.prototype.getOrAddFilePatternAssociation=function(e){var r=this.filePatternAssociationById[e];return r||(r=new YP(e),this.filePatternAssociationById[e]=r,this.filePatternAssociations.push(r)),r},t.prototype.registerExternalSchema=function(e,r,n){r===void 0&&(r=null);var i=this.normalizeId(e);if(this.registeredSchemasIds[i]=!0,r)for(var s=0,o=r;s<o.length;s++){var a=o[s];this.getOrAddFilePatternAssociation(a).addSchema(i)}return n?this.addSchemaHandle(i,n):this.getOrAddSchemaHandle(i)},t.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var r in this.contributionAssociations)for(var n=this.getOrAddFilePatternAssociation(r),i=0,s=this.contributionAssociations[r];i<s.length;i++){var o=s[i],e=this.normalizeId(o);n.addSchema(e)}},t.prototype.getResolvedSchema=function(e){var r=this.normalizeId(e),n=this.schemasById[r];return n?n.getResolvedSchema():this.promise.resolve(null)},t.prototype.loadSchema=function(e){if(!this.requestService){var r="Unable to load schema from '"+Hl(e)+"'. No schema request service available";return this.promise.resolve(new Cs({},[r]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+Hl(e)+"': No content.";return new Cs({},[i])}var s={},o=[];s=uP(n,o);var a=o.length?["Unable to parse content from '"+Hl(e)+"': Parse error at offset "+o[0].offset]:[];return new Cs(s,a)},function(n){var i="Unable to load schema from '"+Hl(e)+"': "+n.toString();return new Cs({},[i])})},t.prototype.resolveSchemaContent=function(e,r,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var a=this.normalizeId(o.$schema);if(a==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new cb({},["Draft-03 schemas are not supported."]));a==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var l=this.contextService,c=function(p,m){if(!m)return p;var y=p;return m[0]==="/"&&(m=m.substr(1)),m.split("/").some(function(w){return y=y[w],!y}),y},u=function(p,m,y,w){var A=c(m,w);if(A)for(var T in A)A.hasOwnProperty(T)&&!p.hasOwnProperty(T)&&(p[T]=A[T]);else s.push("$ref '"+w+"' in '"+y+"' can not be resolved.")},h=function(p,m,y,w,A){l&&!/^\w+:\/\/.*/.test(m)&&(m=l.resolveRelativePath(m,w)),m=i.normalizeId(m);var T=i.getOrAddSchemaHandle(m);return T.getUnresolvedSchema().then(function(E){if(A[m]=!0,E.errors.length){var B=y?m+"#"+y:m;s.push("Problems loading reference '"+B+"': "+E.errors[0]+".")}return u(p,E.schema,m,y),d(p,E.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],E=[],B=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];typeof ce=="object"&&A.push(ce)}},I=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];if(typeof ce=="object")for(var he in ce){var xe=ce[he];typeof xe=="object"&&A.push(xe)}}},W=function(){for(var j=[],U=0;U<arguments.length;U++)j[U]=arguments[U];for(var Y=0,re=j;Y<re.length;Y++){var ce=re[Y];if(Array.isArray(ce))for(var he=0,xe=ce;he<xe.length;he++){var Fe=xe[he];typeof Fe=="object"&&A.push(Fe)}}},F=function(j){for(var U=[];j.$ref;){var Y=j.$ref,re=Y.split("#",2);if(delete j.$ref,re[0].length>0){E.push(h(j,re[0],re[1],y,w));return}else U.indexOf(Y)===-1&&(u(j,m,y,re[1]),U.push(Y))}B(j.items,j.additionalProperties,j.not,j.contains,j.propertyNames,j.if,j.then,j.else),I(j.definitions,j.properties,j.patternProperties,j.dependencies),W(j.anyOf,j.allOf,j.oneOf,j.items)};A.length;){var _=A.pop();T.indexOf(_)>=0||(T.push(_),F(_))}return i.promise.all(E)};return d(o,o,r,n).then(function(p){return new cb(o,s)})},t.prototype.getSchemaForResource=function(e,r){if(r&&r.root&&r.root.type==="object"){var n=r.root.properties.filter(function(m){return m.keyNode.value==="$schema"&&m.valueNode&&m.valueNode.type==="string"});if(n.length>0){var i=si(n[0].valueNode);if(i&&TP(i,".")&&this.contextService&&(i=this.contextService.resolveRelativePath(i,e)),i){var s=this.normalizeId(i);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}for(var o=Object.create(null),a=[],l=0,c=this.filePatternAssociations;l<c.length;l++){var u=c[l];if(u.matchesPattern(e))for(var h=0,d=u.getSchemas();h<d.length;h++){var p=d[h];o[p]||(a.push(p),o[p]=!0)}}return a.length>0?this.createCombinedSchema(e,a).getResolvedSchema():this.promise.resolve(null)},t.prototype.createCombinedSchema=function(e,r){if(r.length===1)return this.getOrAddSchemaHandle(r[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(e),i={allOf:r.map(function(s){return{$ref:s}})};return this.addSchemaHandle(n,i)},t}();function Hl(t){try{}catch{}return t}var XP=function(){function t(e,r){this.jsonSchemaService=e,this.promise=r,this.validationEnabled=!0}return t.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:Me.Error)},t.prototype.doValidation=function(e,r,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],a={},l=function(h){var d=h.range.start.line+" "+h.range.start.character+" "+h.message;a[d]||(a[d]=!0,o.push(h))},c=function(h){var d=n?hb(n.trailingCommas):Me.Error,p=n?hb(n.comments):s.commentSeverity;if(h){if(h.errors.length&&r.root){var m=r.root,y=m.type==="object"?m.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var w=y.valueNode||y,A=ze.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}else{var A=ze.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Mn.create(A,h.errors[0],Me.Warning,$e.SchemaResolveError))}}else{var T=r.validate(e,h.schema);T&&T.forEach(l)}ub(h.schema)&&(p=void 0),fb(h.schema)&&(d=void 0)}for(var E=0,B=r.syntaxErrors;E<B.length;E++){var I=B[E];if(I.code===$e.TrailingComma){if(typeof d!="number")continue;I.severity=d}l(I)}if(typeof p=="number"){var W="Comments are not permitted in JSON.";r.comments.forEach(function(F){l(Mn.create(F,W,p,$e.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+ZP++;return this.jsonSchemaService.resolveSchemaContent(new Cs(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,r).then(function(h){return c(h)})},t}(),ZP=0;function ub(t){if(t&&typeof t=="object"){if(mn(t.allowComments))return t.allowComments;if(t.allOf)for(var e=0,r=t.allOf;e<r.length;e++){var n=r[e],i=ub(n);if(mn(i))return i}}}function fb(t){if(t&&typeof t=="object"){if(mn(t.allowTrailingCommas))return t.allowTrailingCommas;if(mn(t.allowsTrailingCommas))return t.allowsTrailingCommas;if(t.allOf)for(var e=0,r=t.allOf;e<r.length;e++){var n=r[e],i=fb(n);if(mn(i))return i}}}function hb(t){switch(t){case"error":return Me.Error;case"warning":return Me.Warning;case"ignore":return}}var db=48,_P=57,qP=65,zl=97,eM=102;function xt(t){return t<db?0:t<=_P?t-db:(t<zl&&(t+=zl-qP),t>=zl&&t<=eM?t-zl+10:0)}function tM(t){if(t[0]!=="#")return null;switch(t.length){case 4:return{red:xt(t.charCodeAt(1))*17/255,green:xt(t.charCodeAt(2))*17/255,blue:xt(t.charCodeAt(3))*17/255,alpha:1};case 5:return{red:xt(t.charCodeAt(1))*17/255,green:xt(t.charCodeAt(2))*17/255,blue:xt(t.charCodeAt(3))*17/255,alpha:xt(t.charCodeAt(4))*17/255};case 7:return{red:(xt(t.charCodeAt(1))*16+xt(t.charCodeAt(2)))/255,green:(xt(t.charCodeAt(3))*16+xt(t.charCodeAt(4)))/255,blue:(xt(t.charCodeAt(5))*16+xt(t.charCodeAt(6)))/255,alpha:1};case 9:return{red:(xt(t.charCodeAt(1))*16+xt(t.charCodeAt(2)))/255,green:(xt(t.charCodeAt(3))*16+xt(t.charCodeAt(4)))/255,blue:(xt(t.charCodeAt(5))*16+xt(t.charCodeAt(6)))/255,alpha:(xt(t.charCodeAt(7))*16+xt(t.charCodeAt(8)))/255}}return null}function j3(t,e,r,n){return n===void 0&&(n=1),{red:t/255,green:e/255,blue:r/255,alpha:n}}var rM=function(){function t(e){this.schemaService=e}return t.prototype.findDocumentSymbols=function(e,r,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=r.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||Vf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=ws.create(e.uri,oi(e,h));if(l.push({name:si(m.valueNode),kind:vn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,E,B){return o>=0&&(E.type==="array"?E.items.forEach(function(I){return w(T,I,B)}):E.type==="object"&&E.properties.forEach(function(I){if(o>=0){var W=I.valueNode;if(W){o--;var F=ws.create(e.uri,oi(e,I)),_=B?B+"."+I.keyNode.value:I.keyNode.value;T.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),location:F,containerName:B}),w(T,W,_)}}})),T},A=w([],s,void 0);return o<0&&(A.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),A},t.prototype.findDocumentSymbols2=function(e,r,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=r.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||Vf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=oi(e,h),w=oi(e,m.keyNode);if(l.push({name:si(m.valueNode),kind:vn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(E,B){return o>=0&&(B.type==="array"?B.items.forEach(function(I,W){if(I&&o>=0){o--;var F=oi(e,I),_=F,j=String(W),U=A([],I);E.push({name:j,kind:i.getSymbolKind(I.type),range:F,selectionRange:_,children:U})}}):B.type==="object"&&B.properties.forEach(function(I){var W=I.valueNode;if(W&&o>=0){o--;var F=oi(e,I),_=oi(e,I.keyNode),j=A([],W);E.push({name:i.getKeyLabel(I),kind:i.getSymbolKind(W.type),range:F,selectionRange:_,children:j})}})),E},T=A([],s);return o<0&&(T.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),T},t.prototype.getSymbolKind=function(e){switch(e){case"object":return vn.Module;case"string":return vn.String;case"number":return vn.Number;case"array":return vn.Array;case"boolean":return vn.Boolean;default:return vn.Variable}},t.prototype.getKeyLabel=function(e){var r=e.keyNode.value;return r&&(r=r.replace(/[\n]/g,"\u21B5")),r&&r.trim()?r:'"'+r+'"'},t.prototype.findDocumentColors=function(e,r,n){return this.schemaService.getSchemaForResource(e.uri,r).then(function(i){var s=[];if(i)for(var o=n&&typeof n.resultLimit=="number"?n.resultLimit:Number.MAX_VALUE,a=r.getMatchingSchemas(i.schema),l={},c=0,u=a;c<u.length;c++){var h=u[c];if(!h.inverted&&h.schema&&(h.schema.format==="color"||h.schema.format==="color-hex")&&h.node&&h.node.type==="string"){var d=String(h.node.offset);if(!l[d]){var p=tM(si(h.node));if(p){var m=oi(e,h.node);s.push({color:p,range:m})}if(l[d]=!0,o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(e.uri),s}}}return s})},t.prototype.getColorPresentations=function(e,r,n,i){var s=[],o=Math.round(n.red*255),a=Math.round(n.green*255),l=Math.round(n.blue*255);function c(h){var d=h.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+c(o)+c(a)+c(l):u="#"+c(o)+c(a)+c(l)+c(Math.round(n.alpha*255)),s.push({label:u,textEdit:Vr.replace(i,JSON.stringify(u))}),s},t}();function oi(t,e){return ze.create(t.positionAt(e.offset),t.positionAt(e.offset+e.length))}var nM={schemaAssociations:{},schemas:{}};function iM(t,e){var r=[],n=[],i=[],s=-1,o=xs(t.getText(),!1),a=o.scan();function l(U){r.push(U),n.push(i.length)}for(;a!==17;){switch(a){case 1:case 3:{var c=t.positionAt(o.getTokenOffset()).line,u={startLine:c,endLine:c,kind:a===1?"object":"array"};i.push(u);break}case 2:case 4:{var h=a===2?"object":"array";if(i.length>0&&i[i.length-1].kind===h){var u=i.pop(),d=t.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,l(u),s=u.startLine)}break}case 13:{var c=t.positionAt(o.getTokenOffset()).line,p=t.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&c+1<t.lineCount?o.setPosition(t.offsetAt(jr.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:No.Comment}),s=c);break}case 12:{var m=t.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=m.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(y){var d=t.positionAt(o.getTokenOffset()).line;if(y[1]){var u={startLine:d,endLine:d,kind:No.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==No.Region;)w--;if(w>=0){var u=i[w];i.length=w,d>u.startLine&&s!==u.startLine&&(u.endLine=d,l(u),s=u.startLine)}}}break}}a=o.scan()}var A=e&&e.rangeLimit;if(typeof A!="number"||r.length<=A)return r;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(t.uri);for(var T=[],E=0,B=n;E<B.length;E++){var I=B[E];I<30&&(T[I]=(T[I]||0)+1)}for(var W=0,F=0,w=0;w<T.length;w++){var _=T[w];if(_){if(_+W>A){F=w;break}W+=_}}for(var j=[],w=0;w<r.length;w++){var I=n[w];typeof I=="number"&&(I<F||I===F&&W++<A)&&j.push(r[w])}return j}function sM(t,e,r){function n(a){for(var l=t.offsetAt(a),c=r.getNodeFromOffset(l,!0),u=[];c;){switch(c.type){case"string":case"object":case"array":var h=c.offset+1,d=c.offset+c.length-1;h<d&&l>=h&&l<=d&&u.push(i(h,d)),u.push(i(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":u.push(i(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){var p=o(c.offset+c.length,5);p!==-1&&u.push(i(c.offset,p))}c=c.parent}for(var m=void 0,y=u.length-1;y>=0;y--)m=Wl.create(u[y],m);return m||(m=Wl.create(ze.create(a,a))),m}function i(a,l){return ze.create(t.positionAt(a),t.positionAt(l))}var s=xs(t.getText(),!0);function o(a,l){s.setPosition(a);var c=s.scan();return c===l?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function oM(t){var e=t.promiseConstructor||Promise,r=new QP(t.schemaRequestService,t.workspaceContext,e);r.setSchemaContributions(nM);var n=new DP(r,t.contributions,e,t.clientCapabilities),i=new NP(r,t.contributions,e),s=new rM(r),o=new XP(r,e);return{configure:function(a){r.clearExternalSchemas(),a.schemas&&a.schemas.forEach(function(l){r.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),o.configure(a)},resetSchema:function(a){return r.onResourceChange(a)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(a){return EP(a,{collectComments:!0})},newJSONDocument:function(a,l){return OP(a,l)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(a,l){return s.findDocumentColors(a,l).then(function(c){return c.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:iM,getSelectionRanges:sM,format:function(a,l,c){var u=void 0;if(l){var h=a.offsetAt(l.start),d=a.offsetAt(l.end)-h;u={offset:h,length:d}}var p={tabSize:c?c.tabSize:4,insertSpaces:c?c.insertSpaces:!0,eol:`
|
|
231
|
+
`};return pP(a.getText(),u,p).map(function(m){return Vr.replace(ze.create(a.positionAt(m.offset),a.positionAt(m.offset+m.length)),m.content)})}}}var aM=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function lM(t){const e={settings:{background:"var(--bg-overlay)",fontFamily:"var(--code-block-font-family)"},styles:[{tag:[M.propertyName],color:"var(--code-block-tokens-property-string-color)"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"var(--code-block-tokens-string-color)"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"var(--text-secondary)"}]};switch(t){case"light":return kf(e);case"dark":return _T(e);default:return kf(e)}}const zf=oM({});function cM({id:t,schema:e,handleErrors:r}){return zf.configure({validate:!0,schemas:[{uri:"stub://"+t,fileMatch:["*"],schema:e}]}),MT(n=>aM(this,null,function*(){var i;const s=n.state.doc,o=Rf.create(t+".json","json",0,s.toString()),a=zf.parseJSONDocument(o),l=yield zf.doValidation(o,a);return r((i=l?.[0])==null?void 0:i.message),l?.map(c=>({from:pb(s,c.range.start.line,c.range.start.character),to:pb(s,c.range.end.line,c.range.end.character),message:c.message,severity:uM[c.severity||3]}))}))}const uM={1:"error",2:"warning",3:"info",4:"hint"};function pb(t,e,r){return t.line(e+1).from+r}const fM=({onChange:t,onBlur:e,id:r,schema:n,fieldName:i,validate:s,defaultValue:o,mode:a})=>{const{setValue:l,control:c,setError:u,clearErrors:h,getFieldState:d}=(0,vt.Gc)(),p=(0,S.useCallback)(A=>{const{error:T}=d(i);A&&!T?u(i,{message:A}):T&&h(i)},[h,i,d,u]),m=(0,S.useCallback)(A=>{l(i,A),t?.(A)},[i,t,l]),y=(0,S.useCallback)(A=>{e?.(A)},[e]),w=(0,S.useMemo)(()=>[UO(),cM({id:r,schema:n,handleErrors:p})],[p,r,n]);return S.createElement(vt.Qr,{control:c,name:i,rules:{validate:s},defaultValue:o,render:({field:{value:A,ref:T}})=>S.createElement(XT,{ref:T,className:"codemirror-container",value:A||"",onChange:m,onBlur:y,lang:a||sa.Tr.JSON,theme:lM("light"),extensions:w,basicSetup:{bracketMatching:!0,closeBrackets:!0,tabSize:2,foldGutter:!1,lineNumbers:!1,lintKeymap:!0,drawSelection:!1}})})},hM=(0,S.memo)(fM);var Uf=f(91582);function dM({mediaType:t,mediaContent:e,properties:r,id:n,resolvedBody:i,getActiveSample:s,validate:o}){const{setValue:a}=(0,vt.Gc)(),l=(0,Uf.yN)(e),c=t.examples||{},u=Object.keys(c),h=t.schema,d=Xh(h||{},t.name)||t.name===sa.Tr.MULTIPART||t.name===sa.Tr.URL_ENCODED,{exampleKey:p}=(0,dc.C6)(t.operation,c),m=(0,Oe.YQ)((0,Be.P6)(n,t.name,p,c))||(0,Be.oY)(c[p],r),y=(0,S.useCallback)((E="",B="",I=[])=>W=>{(0,Oe.WW)((0,Be.P6)(n,E,B,I),W)},[n]),w=(0,S.useCallback)(E=>{l?.(E),a("body",s(E))},[a,s,l]),A=(0,S.useCallback)((E,B)=>{a(`body.${E}`,B)},[a]),T=(0,S.useMemo)(()=>(i?.content[t.name]||{}).schema,[t.name,i?.content]);return S.createElement(S.Fragment,null,u.length&&u.length!==1&&S.createElement(dc.b_,{examples:c,onChange:w,exampleKey:p,panel:"try-it"})||null,d?S.createElement(OS,{mediaType:t,onChange:A}):S.createElement(hM,{id:"body"+n,fieldName:"body",defaultValue:m,schema:T,mode:t.name,validate:o,onChange:y(t.name,p,c)}))}const pM=(0,S.memo)(dM);var gM=f(60821),mM=Object.defineProperty,vM=Object.defineProperties,yM=Object.getOwnPropertyDescriptors,gb=Object.getOwnPropertySymbols,bM=Object.prototype.hasOwnProperty,xM=Object.prototype.propertyIsEnumerable,mb=(t,e,r)=>e in t?mM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wM=(t,e)=>{for(var r in e||(e={}))bM.call(e,r)&&mb(t,r,e[r]);if(gb)for(var r of gb(e))xM.call(e,r)&&mb(t,r,e[r]);return t},SM=(t,e)=>vM(t,yM(e));function kM({body:{content:t},resolvedBody:e,properties:r,mergeExampleBody:n,id:i,validate:s,pointer:o}){const{setValue:a}=(0,vt.Gc)(),l=(0,Hr.Dv)(gM.J8),{examples:c,name:u}=t&&(0,_r.getActiveMediaType)(t,l)||{},h=(0,S.useCallback)(m=>{if(!t||!t.hasSample||!c?.[m])return"";const y=u&&(0,Oe.YQ)((0,Be.P6)(i,u,m,c)),w=y?JSON.parse(y):c?.[m];return(0,Be.oY)(w,r)},[u,c,i,t,r]),{activeExampleName:d}=(0,Hr.Dv)((0,pc.N)(o));(0,S.useEffect)(()=>{if(r&&!n){a("body",JSON.stringify(r||{},null,2));return}const m=(0,Be.P6)(i,u,d,c),y=(0,Oe.YQ)(m)||h(d||"");a("body",typeof y=="object"?JSON.stringify(y,null,2):y)},[c,d,u,a,h,i,r,n]);const p=m=>S.createElement(hS.C,SM(wM({},m),{variant:"dark",fullWidth:!0,Label:gS,Dropdown:pS.Lt}));return S.createElement(S.Fragment,null,S.createElement(dS.d,{content:t,renderDropdown:p},m=>S.createElement(pM,{mediaType:m,mediaContent:t,resolvedBody:e,id:i,properties:r,getActiveSample:h,validate:s})))}const AM=(0,S.memo)(kM),CM=({paramEnum:t,fieldName:e,defaultValue:r})=>{const{control:n,setValue:i}=(0,vt.Gc)(),s=t.map((l,c)=>({idx:c,value:l})),o=l=>{i(e,l.value)},a=()=>{i(e,"")};return S.createElement(vt.Qr,{control:n,name:e,defaultValue:Array.isArray(r)?r[0]:r,render:({field:{value:l}})=>S.createElement(Nr.VD,{clearable:!0,fullWidth:!0,variant:"dark",value:l,options:s,handleClear:a,onChange:o})})},OM=(0,S.memo)(CM),EM=({name:t,param:e,place:r,renderParameter:n})=>{var i,s,o,a,l;const[c,u]=S.useState([]),h=()=>{u([...c,c.length?c[c.length-1]+1:0])},d=m=>{u(c.filter(y=>y!==m))},p=(i=e.schema.items)!=null&&i.fields?(s=e.schema.items)==null?void 0:s.fields:[{schema:((o=e.schema.items)==null?void 0:o.schema)||e.schema.items,name:"",required:e.required,description:(a=e.schema.items)==null?void 0:a.description,externalDocs:(l=e.schema.items)==null?void 0:l.externalDocs,deprecated:!1,toggle:()=>null,expanded:!1}];return S.createElement(S.Fragment,null,S.createElement(vb,null,S.createElement(ye.lX,{required:e.required},t,"(",c.length," items)"),S.createElement("span",{onClick:h},"Add item +")),c?.map((m,y)=>S.createElement(vb,{key:m},p.map(w=>n(w,r,`${t}.[${m}]`,`[${y}]${w.name&&"."+w.name}`,S.createElement(TM,{onClick:()=>d(m)},"Delete"))))))},vb=Ye.ZP.div`
|
|
231
232
|
display: flex;
|
|
232
233
|
width: 100%;
|
|
233
234
|
align-items: center;
|
|
@@ -248,14 +249,14 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.i
|
|
|
248
249
|
color: #fff;
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
|
-
`,
|
|
252
|
+
`,TM=Ye.ZP.span`
|
|
252
253
|
background: transparent;
|
|
253
254
|
border: none;
|
|
254
255
|
cursor: pointer;
|
|
255
256
|
position: relative;
|
|
256
257
|
margin-left: 5px;
|
|
257
258
|
display: inline-block;
|
|
258
|
-
`;var
|
|
259
|
+
`;var Vo=(t=>(t.ARRAY="array",t.OBJECT="object",t))(Vo||{});function PM({schema:t,example:e}){return`(${t.type})`+(e?` ${e}`:"")}function MM(t){const e={};return t.forEach(r=>{r.in&&(e[r.in]||(e[r.in]=[]),e[r.in].push(r))}),e}function IM({schema:t,required:e}){return r=>{if(e&&!r)return"Field is required";if(e&&t.type===Vo.ARRAY&&Array.isArray(r)){if(r.length>(t.rawSchema&&t.rawSchema.maxItems||1/0))return`Too many items selected, maximum ${t.rawSchema.maxItems}`;if(r.length<(t.rawSchema&&t.rawSchema.minItems||0)){const n=t.rawSchema.minItems;return`You should select at least ${n===1?`${n} item`:`${n} items`}`}}}}function DM(t){if(t.type===Vo.ARRAY){const e=t.default||t.example;if(!e&&typeof t.rawSchema.items!="boolean"&&Array.isArray(t.rawSchema.items)){if(t.rawSchema.items[0].default)return[t.rawSchema.items[0].default];if(t.rawSchema.items[0].example)return[t.rawSchema.items[0].example]}if(!e&&typeof t.rawSchema.items!="boolean"&&!Array.isArray(t.rawSchema.items)&&(0,Oe.Kn)(t.rawSchema.items)){if(t.rawSchema.items.default)return[t.rawSchema.items.default];if(t.rawSchema.items.example)return[t.rawSchema.items.example]}return e||[]}else return(Number.isInteger(t.default)?t.default.toString():t.default)||t.example}function NM({oneOfType:t}){return t}const RM=["path","query","cookie","header"];function LM({id:t,param:e,values:r}){const n=(0,S.useMemo)(()=>IM(e),[e]),i=Array.isArray(e.schema.enum)&&e.schema.enum.length?e.schema.enum:void 0,s=DM(e.schema),o=t.split(".").map(a=>(0,Oe.dw)(a));return i?S.createElement(ye.NI,null,S.createElement(OM,{defaultValue:s,paramEnum:i,fieldName:t})):S.createElement(st.Xn,{fullWidth:!0,"data-cy":"parameter-input",id:t,fieldName:t,placeholder:PM(e),rules:{validate:n},defaultValue:s||(0,Oe.U2)(r,o),validateOnBlur:!0,validateOnChange:!0})}function BM({values:t,operation:e}){const r=(0,S.useMemo)(()=>MM(e.parameters||[]),[e]),n=(s,o,a,l,c)=>{var u;const h=a?(0,Oe.s1)(a,s.name):s.name,d=NM(s.schema),p=a?[o,a]:[s.in],m=(0,Oe.s1)(...p,(0,Oe.A8)(s.name));return d&&console.warn(`Unsupported parameter definition: "${d}"`),(Array.isArray(s.schema.type)?s.schema.type:[s.schema.type]).includes(Vo.ARRAY)?S.createElement(EM,{key:m,name:h,param:s,place:o,renderParameter:n}):s.schema.type===Vo.OBJECT?(u=s.schema.fields)==null?void 0:u.map(w=>n(w,o,h)):S.createElement(ye.NI,{key:m},S.createElement(ye.lX,{required:s.required},l||h,": ",c),d?S.createElement(ye.GE,null,"Unsupported field schema definition"):S.createElement(LM,{id:m,param:s,values:t}))},i=s=>{const o=r[s];return!o||!o.length?null:S.createElement(S.Fragment,{key:s},S.createElement(ye.NI,null,S.createElement(ye.iG,null," # ",s," parameters "),S.createElement("span",null,"\xA0")),o.map(a=>n(a,s)))};return S.createElement(ye.iA,null,RM.map(i))}var FM=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function jM(t){return FM(this,null,function*(){return(yield fetch(t)).json()})}const VM=Ye.ZP.div`
|
|
259
260
|
position: relative;
|
|
260
261
|
height: 4px;
|
|
261
262
|
display: block;
|
|
@@ -357,19 +358,19 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.i
|
|
|
357
358
|
right: -8%;
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
|
-
`,
|
|
361
|
+
`,yb=()=>S.createElement(VM,null,S.createElement("div",{className:"indeterminate"})),WM=Ye.ZP.div`
|
|
361
362
|
font-family: var(--font-family-monospaced);
|
|
362
363
|
margin-top: 10px;
|
|
363
364
|
line-height: 1;
|
|
364
365
|
padding-left: 10px;
|
|
365
366
|
border-left: 1px solid gray;
|
|
366
|
-
|
|
367
|
+
`,$M=Ye.ZP.div`
|
|
367
368
|
margin-bottom: 15px;
|
|
368
|
-
|
|
369
|
+
`,HM=Ye.ZP.div`
|
|
369
370
|
padding: 8px 0 20px;
|
|
370
|
-
`,
|
|
371
|
+
`,zM=Ye.ZP.div`
|
|
371
372
|
padding: 4px 0;
|
|
372
|
-
`;var
|
|
373
|
+
`;var UM=Object.defineProperty,GM=Object.defineProperties,KM=Object.getOwnPropertyDescriptors,bb=Object.getOwnPropertySymbols,YM=Object.prototype.hasOwnProperty,JM=Object.prototype.propertyIsEnumerable,xb=(t,e,r)=>e in t?UM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QM=(t,e)=>{for(var r in e||(e={}))YM.call(e,r)&&xb(t,r,e[r]);if(bb)for(var r of bb(e))JM.call(e,r)&&xb(t,r,e[r]);return t},XM=(t,e)=>GM(t,KM(e));const ZM=Ye.ZP.input`
|
|
373
374
|
cursor: pointer;
|
|
374
375
|
margin-left: 0;
|
|
375
376
|
margin-right: 5px;
|
|
@@ -378,7 +379,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.i
|
|
|
378
379
|
align-self: baseline;
|
|
379
380
|
margin-top: 0;
|
|
380
381
|
margin-bottom: 0;
|
|
381
|
-
`,
|
|
382
|
+
`,_M=Ye.ZP.label`
|
|
382
383
|
display: inline-block;
|
|
383
384
|
cursor: pointer;
|
|
384
385
|
vertical-align: middle;
|
|
@@ -388,34 +389,34 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.i
|
|
|
388
389
|
|
|
389
390
|
overflow-wrap: break-word;
|
|
390
391
|
line-height: 20px;
|
|
391
|
-
`,
|
|
392
|
-
width: ${({fullWidth:
|
|
392
|
+
`,qM=Ye.ZP.div`
|
|
393
|
+
width: ${({fullWidth:t})=>t?"100%":"50%"};
|
|
393
394
|
display: inline-flex;
|
|
394
395
|
align-items: center;
|
|
395
396
|
|
|
396
397
|
& > label {
|
|
397
|
-
white-space: ${({nowrap:
|
|
398
|
+
white-space: ${({nowrap:t})=>t?"nowrap":"normal"};
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
${({nowrap:
|
|
401
|
+
${({nowrap:t})=>t?"":`
|
|
401
402
|
:not(:first-child) {
|
|
402
403
|
margin-top: 5px;
|
|
403
404
|
}
|
|
404
405
|
`}
|
|
405
|
-
`;function
|
|
406
|
+
`;function eI(t,e){const{fullWidth:r,id:n,label:i,nowrap:s}=t;return S.createElement(qM,{fullWidth:r,nowrap:s},S.createElement(ZM,XM(QM({},t),{type:"checkbox",ref:e})),S.createElement(_M,{htmlFor:n},i))}const wb=(0,S.forwardRef)(eI),tI=11,rI=({fieldName:t,defaultValue:e,items:r,validateOnChange:n,maxDisplayedItems:i,showControls:s,trimItemsLength:o})=>{var a;const{control:l,setValue:c,getValues:u,formState:h,trigger:d}=(0,vt.Gc)(),[p,m]=(0,S.useState)(!0),y=F=>{const _=F.target.value,j=F.target.checked,U=u(t)||[];let Y;if(j)Y=[...U,_];else{const re=U.indexOf(_);Y=[...U.slice(0,re),...U.slice(re+1)]}c(t,Y)},w=F=>u(t).includes(F),A=()=>{m(F=>!F)},T=()=>{c(t,r)},E=()=>{c(t,[])},B=(a=h.errors[t])==null?void 0:a.message,I=i||tI,W=o&&p?r.slice(0,I):r;return S.createElement("div",null,s?S.createElement(mt.CodeBlockControls,{controls:{select:{onClick:T,label:"Select all",tooltipText:"Select all checkboxes"},deselect:{onClick:E,label:"Deselect all",tooltipText:"Deselect all checkboxes"}}}):null,S.createElement(iI,null,S.createElement(vt.Qr,{control:l,name:t,defaultValue:e,render:()=>S.createElement(S.Fragment,null,W.map(F=>S.createElement(wb,{fullWidth:!0,id:F,value:F,checked:w(F),label:F,key:F,onChange:_=>{y(_),n&&d(t)}})))}),r.length>I&&o?S.createElement(sI,{onClick:()=>{A()}},p?"Show all":"Collapse"):null),B?S.createElement(ye.Xq,null,B):"")},nI=(0,S.memo)(rI),iI=Ye.ZP.div`
|
|
406
407
|
padding: 10px;
|
|
407
408
|
border: 1px solid var(--border-primary);
|
|
408
409
|
border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
|
|
409
|
-
`,
|
|
410
|
+
`,sI=(0,Ye.ZP)(mt.CodeBlockControlButton)`
|
|
410
411
|
float: right;
|
|
411
|
-
`;function xb(r){const{scopes:e,id:t}=r;let n=[];try{n=JSON.parse((0,Ee.YQ)(`auth.${t}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ve.NI,null,S.createElement(ve.lX,null," Scopes: "),S.createElement(rI,{fieldName:`auth.${t}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const sI=({token:r,loading:e,error:t})=>e?S.createElement(ve.GE,null,"Please, finish your authorization flow or cancel authorization."):t?S.createElement(VM,null,S.createElement(ve.Xq,null,t)):r?.access_token?null:S.createElement(ve.GE,null," No Access Token. Please, Authorize. ");var oI=Object.defineProperty,aI=Object.defineProperties,lI=Object.getOwnPropertyDescriptors,wb=Object.getOwnPropertySymbols,cI=Object.prototype.hasOwnProperty,uI=Object.prototype.propertyIsEnumerable,Sb=(r,e,t)=>e in r?oI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zl=(r,e)=>{for(var t in e||(e={}))cI.call(e,t)&&Sb(r,t,e[t]);if(wb)for(var t of wb(e))uI.call(e,t)&&Sb(r,t,e[t]);return r},Uf=(r,e)=>aI(r,lI(e)),kb=(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 Ul=({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,$r.Dv)(Wn.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,gt.Gc)(),[T,P]=(0,S.useState)(null),[L,D]=(0,S.useState)(!1),[j,W]=(0,S.useState)(!1),[q,F]=(0,S.useState)(void 0),[H,Q]=(0,S.useState)(void 0),[oe,fe]=(0,S.useState)(void 0),be=((h=y("auth"))==null?void 0:h[e])||{},ke=A.errors||{},Re=q!==void 0&&H!==oe?{label:"sync",onClick:()=>{q&&Q(oe)}}:void 0;(0,S.useEffect)(()=>{if(r){const Wt=(0,gi.CY)(43);ad(Wt).then(_t=>{F(Wt),Q(_t),fe(_t)})}},[r]);const Se=Wt=>kb(void 0,null,function*(){if(!Wt||(yield w(),!(0,gi.Qr)(ke)))return;D(!0),P(null);const _t=i?i+(0,je.jg)(Wt):Wt,Or=i&&n?i+(0,je.jg)(n):n,oi=y(`auth.${e}.scopes`),ai={authorizationUrl:_t.startsWith("http")?_t:o+_t,clientId:be.client_id,scopes:oi,redirectUri:d,routingBasePath:p,successCallback:Er=>{m(`auth.${e}.token`,Er),D(!1),P(null)},errorCallback:Er=>{D(!1),P(Er?.message||"Failed to retrieve the access token")}};if(t==="implicit"&&Hr.authorizeImplicit(ai),!(0,je.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}t==="authorizationCode"&&Hr.authorizeAuthorizationCode(zl(Uf(zl({},ai),{tokenUrl:Or?.startsWith("http")?Or:o+Or,clientSecret:be.client_secret,extraHeaders:(0,je.Or)({authMethod:s,clientId:be.client_id,clientSecret:be.client_secret})}),r&&{codeVerifier:q,codeChallenge:H}))}),Oe=()=>{De(),P(null)},Te=()=>{D(!1),P(null),Hr.clearRedirectData(t)},De=()=>{m(`auth.${e}.token`,"")},bt=()=>{W(Wt=>!Wt)},Rt=Wt=>kb(void 0,[Wt],function*({target:{value:_t}}){const Or=yield ad(_t);F(_t),fe(Or)});if(!l)return S.createElement(ve.Xq,null,"No flow info");let ir=(0,Ee.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);ir=ir?JSON.parse(ir):"";const jr=(0,Ee.Al)(e,"client_id"),si={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null," Client ID: "),jr?S.createElement(it.F0,Uf(zl({},si),{options:jr})):S.createElement(it.Xn,Uf(zl({},si),{"data-cy":"client-id-input",panel:"try-it"}))),t==="authorizationCode"&&S.createElement(S.Fragment,null,(!r?.hideClientSecretInput||!r)&&S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Ee.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($M,null,S.createElement(bb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:j,onChange:bt,"data-cy":"pkce-options-toggle"}),j&&S.createElement(HM,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Verifier"),S.createElement(it.nv,{fullWidth:!0,value:q,onChange:Rt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Challenge"),S.createElement(it.nv,{fullWidth:!0,value:H,onChange:({target:{value:Wt}})=>{Q(Wt)},inputActionButton:Re,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:ir,panel:"try-it"}),S.createElement(xb,{id:e,scopes:a}),be.token&&be.token.access_token?S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.nv,{disabled:!0,type:"password",fullWidth:!0,value:be.token.access_token,panel:"try-it"})):null),S.createElement(WM,null,be.token&&be.token.access_token?S.createElement(pt.Button,{fullWidth:!0,onClick:Oe},"Log out"):L?S.createElement(S.Fragment,null,S.createElement(pt.Button,{fullWidth:!0,onClick:Te},"Cancel"),S.createElement(mb,null)):S.createElement(pt.Button,{fullWidth:!0,disabled:!(0,gi.Qr)(ke),onClick:()=>{Se(l)}},"Authorize")),L||T||!be.token||!be.token.access_token&&S.createElement(sI,{loading:L,error:T,token:be.token}))};var fI=(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 hI(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=>fI(this,null,function*(){u(!0),l("");try{const p=yield FM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(dI,null):a?S.createElement(Ab,{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(Mr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Ul,{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(Mr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Ul,{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 dI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(mb,null)))}function Ab({message:r}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ve.Xq,null,r)))}var pI=Object.defineProperty,gI=Object.defineProperties,mI=Object.getOwnPropertyDescriptors,Cb=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,yI=Object.prototype.propertyIsEnumerable,Ob=(r,e,t)=>e in r?pI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Eb=(r,e)=>{for(var t in e||(e={}))vI.call(e,t)&&Ob(r,t,e[t]);if(Cb)for(var t of Cb(e))yI.call(e,t)&&Ob(r,t,e[t]);return r},Tb=(r,e)=>gI(r,mI(e)),bI=(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 xI(r){if(!r)return"Token is required"}const wI=({id:r,server:e,flow:t,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,gt.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)||{},P=()=>{l(`auth.${r}.token`,""),(0,Ee.WW)(`auth.${r}.token`,"")},L=()=>{w(H=>!H)},D=()=>bI(void 0,null,function*(){if(p)return;const H=n&&t.tokenUrl?n+(0,je.jg)(t.tokenUrl):t.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const Q=A.client_id,oe=A.client_secret;if(!Q||!oe){console.log("Provide client_id and client_secret");return}m(!0);const fe=t["x-tokenEndpointAuthMethod"];if(!(0,je.xl)(fe)){console.log(`Unsupported token endpoint auth method: ${fe}`);return}yield Hr.authorizeClientCredentials({tokenUrl:H.startsWith("http")?H:e+H,clientId:Q,clientSecret:oe,scopes:A.scopes,extraHeaders:(0,je.Or)({authMethod:fe,clientId:Q,clientSecret:oe}),successCallback:be=>{l(`auth.${r}.token`,be),m(!1)},errorCallback:be=>{P(),d(be.message),m(!1)}})}),j=Object.keys(t.scopes);let W=(0,Ee.YQ)(`auth.${r}.token`)||JSON.stringify(i?.token);W=W?JSON.parse(W):"";const q=(0,Ee.Al)(r,"client_id"),F={fieldName:`auth.${r}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${r}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client ID:"),q?S.createElement(it.F0,Tb(Eb({},F),{options:q})):S.createElement(it.Xn,Tb(Eb({},F),{type:"password",panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${r}.client_secret`,defaultValue:(0,Ee.YQ)(`auth.${r}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${r}.token`,type:"hidden",defaultValue:W,rules:{validate:xI}}),S.createElement(xb,{id:r,scopes:j})),S.createElement(pt.Button,{color:"primary",onClick:D,blinking:p},p?"Loading...":"Request Token"),S.createElement(ve.ph,null," Access Token "),h?S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ve.TR,null,S.createElement(ve.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ve.lf,{onClick:L},y?"Show":"Hide"," "),S.createElement(ve.h,{onClick:P}," Clear ")):S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"No token"))};var SI=Object.defineProperty,kI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Pb=Object.getOwnPropertySymbols,CI=Object.prototype.hasOwnProperty,OI=Object.prototype.propertyIsEnumerable,Mb=(r,e,t)=>e in r?SI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cs=(r,e)=>{for(var t in e||(e={}))CI.call(e,t)&&Mb(r,t,e[t]);if(Pb)for(var t of Pb(e))OI.call(e,t)&&Mb(r,t,e[t]);return r},Os=(r,e)=>kI(r,AI(e));const EI=({securityDefaults:r,operation:e,activeServer:t,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,gt.Gc)(),{parser:c}=(0,$r.Dv)(Wn.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(P=>P.schemes.map(L=>L.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const P=h.findIndex(L=>L===d);return P<0?0:P},[h,d]);(0,S.useEffect)(()=>{const P=(0,Ee.YQ)("securityRequirementName"),L=h.findIndex(D=>D===P);a("securityScheme",h[L<0?0:L])},[h,e,a]);const m=(0,S.useCallback)(P=>{a("securityScheme",P.value),(0,Ee.WW)("securityRequirementName",P.value)},[a]),y=(0,S.useMemo)(()=>h.map((P,L)=>({value:P,idx:L})),[h]);if(y.length===0)return S.createElement(Ab,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Ee.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,y.length>1&&S.createElement(ve.NI,null,S.createElement(ve.lX,null," Security scheme: "),S.createElement(gt.Qr,{control:o,name:"securityScheme",render:({field:{value:P}})=>S.createElement(Mr.VD,{variant:"dark",fullWidth:!0,options:y,value:P,onChange:m})}))||null,S.createElement(pt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:P=>{a(`auth.${A}`,P)}}),w.schemes.map(P=>{var L,D,j,W,q,F;const H=(0,Ee.A8)(P.id);if(P.type==="apiKey"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,je.NG)(P)||(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ve.NI,{key:H},S.createElement(ve.lX,null," ",P.name,": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(P.type==="http"){if(P.scheme==="basic"){const Q=(0,Ee.Al)(H,"username"),oe={fieldName:`auth.${H}.username`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}.username`)||((L=r?.[H])==null?void 0:L.username),validate:je.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicUsername"),": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicPassword"),": "),S.createElement(it.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${H}.password`,defaultValue:(0,Ee.YQ)(`auth.${H}.password`)||((D=r?.[H])==null?void 0:D.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.scheme==="bearer"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Bearer Token: "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(P.type==="oauth2"&&P.flows&&P.flows.clientCredentials)return S.createElement(wI,{key:H,flow:P.flows.clientCredentials,server:t,authCorsProxyUrl:n,id:H,clientId:P.flows.clientCredentials["x-defaultClientId"]||P["x-defaultClientId"],defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.implicit)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((W=(j=P?.flows)==null?void 0:j.implicit)==null?void 0:W.scopes)||{}),server:t,id:H,clientId:P.flows.implicit["x-defaultClientId"]||P["x-defaultClientId"],flow:"implicit",defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.authorizationCode)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.authorizationCode.authorizationUrl,tokenUrl:P.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((q=P.flows.authorizationCode)==null?void 0:q.scopes)||{}),server:t,id:H,clientId:P.flows.authorizationCode["x-defaultClientId"]||P["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:P.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:P.flows.authorizationCode["x-usePkce"],defaultValues:r?.[H]});if(P.type==="oauth2"){let Q=(0,Ee.YQ)(`auth.${H}.token`)||JSON.stringify((F=r?.[H])==null?void 0:F.token);return Q=Q?JSON.parse(Q):{},S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token Type: "),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${H}.token.token_type`,defaultValue:Q.token_type||"Bearer",panel:"try-it"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${H}.token.access_token`,rules:{validate:je.np},defaultValue:Q.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.type==="openIdConnect")return S.createElement(hI,{key:H,server:t,authCorsProxyUrl:n,id:H,scheme:P,clientId:P["x-defaultClientId"],defaultValues:r?.[H]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var TI=f(55919);function PI({operation:r,properties:e,mergeExampleBody:t,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,gt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,$r.Dv)(Wn.qd),p=i&&Ee.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(tS,{operation:r,onChange:o}),S.createElement(ea.UQ,{initialActiveIdx:r.security.length&&y?1:0},r.security.length&&S.createElement(fc,{header:(0,Fs.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(MI,{fieldName:"auth",validate:je.np},A=>S.createElement(TI.Q,{Hook:pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:r,onChange:A,OAuth2:Hr}})):S.createElement(EI,{operation:r,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,r.requestBody&&S.createElement(fc,{header:(0,Fs.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(kM,{validate:II,body:r.requestBody,pointer:r.pointer,id:r.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:t}))||null,w.length&&S.createElement(fc,{header:(0,Fs.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(LM,{operation:r,values:m}))||null))}function MI({fieldName:r,validate:e,children:t}){const{control:n,setValue:i}=(0,gt.Gc)();return S.createElement(gt.Qr,{control:n,name:r,rules:{validate:e},render:()=>t(i)})}function II(){}const DI=(0,S.memo)(PI);function NI({shaking:r,className:e,children:t,rootElement:n}){const[i]=(0,zf.Bs)(n),s=(0,$r.Dv)(Wn.qd);return S.createElement(Mr.q2,{scrollYOffset:s.scrollYOffset,shaking:r,className:e,"data-cy":"console",fullWidth:i?.width},t)}const RI=(0,S.memo)(NI);var LI=Object.defineProperty,BI=Object.defineProperties,FI=Object.getOwnPropertyDescriptors,Ib=Object.getOwnPropertySymbols,jI=Object.prototype.hasOwnProperty,VI=Object.prototype.propertyIsEnumerable,Db=(r,e,t)=>e in r?LI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e)=>{for(var t in e||(e={}))jI.call(e,t)&&Db(r,t,e[t]);if(Ib)for(var t of Ib(e))VI.call(e,t)&&Db(r,t,e[t]);return r},Cr=(r,e)=>BI(r,FI(e)),Nb=(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 Rb(r){return r.startsWith("//")?"https:"+r:r}function WI({operation:r,onResponse:e,className:t,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,gt.cI)({defaultValues:{path:(0,je.ZS)(r.parameters,"path"),cookie:(0,je.ZS)(r.parameters,"cookie"),header:(0,je.ZS)(r.parameters,"header"),query:(0,je.ZS)(r.parameters,"query")}}),[{activeServer:c},u]=(0,$r.KO)((0,dc.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)(),[P,L]=(0,S.useState)(),[D,j]=(0,S.useState)(),[W,q]=(0,S.useState)(),F=(0,zf.D9)(r),{parser:H,options:Q}=(0,$r.Dv)(Wn.eG);(0,S.useEffect)(()=>{const{unsubscribe:Se}=l.watch((Oe={})=>{u(Te=>Cr(It({},Te),{requestValues:JSON.parse(JSON.stringify(Oe))})),(0,je.Hc)(Cr(It({},Oe),{query:(0,je.FU)(Oe.query||{})}))});return()=>Se()},[l,u]);const oe=(0,S.useCallback)(Se=>{d(Se)},[]),fe=(0,S.useCallback)(Se=>{u(Oe=>Cr(It({},Oe),{activeServer:Se})),l.setValue("server",Se)},[u,l]),be=l.handleSubmit(Se=>Nb(this,null,function*(){var Oe,Te,De,bt,Rt,ir,jr,si,Wt,_t,Or,oi,ai;const{servers:Er,requestBody:vn}=r,Gl=vn&&vn.content&&((Oe=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:Oe.name)||"";let li=Se.body;if(/json/.test(Gl))try{li=JSON.parse(li)}catch(Ke){console.error(Ke)}m(!0);const sr=A,Es=(r.httpVerb||"").toLowerCase();if(!Er)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 Gf=Er.find(Ke=>c?.url.endsWith(Ke.url.endsWith("/")?Ke.url.substring(0,Ke.url.length-1):Ke.url)),HI=Date.now();let Mn,ci=Se.auth;if(ci){const Ke=Object.keys(ci)[0],yn=(0,Sw.dw)(Ke);Mn=Cr(It({},sr),{components:Cr(It({},sr?.components),{securitySchemes:Cr(It({},(Te=sr?.components)==null?void 0:Te.securitySchemes),{[yn]:Cr(It({},(bt=(De=sr?.components)==null?void 0:De.securitySchemes)==null?void 0:bt[yn]),{type:((jr=(ir=(Rt=sr?.components)==null?void 0:Rt.securitySchemes)==null?void 0:ir[yn])==null?void 0:jr.type)==="openIdConnect"?"oauth2":((Wt=(si=sr?.components)==null?void 0:si.securitySchemes)==null?void 0:Wt[yn]).type})})})}),ci=Cr(It({},ci),{[yn]:ci[Ke]})}else Mn=It({},sr);Mn.servers=Er;const Kl=Q.corsProxyUrl;Kl&&Er.length&&(Mn.servers=Er.map(Ke=>Cr(It({},Ke),{url:Kl+Rb(Ke.url)})),Mn.paths=Cr(It({},Mn.paths),{[r.path]:Cr(It({},Mn.paths[r.path]),{[Es]:Cr(It({},Mn.paths[r.path][Es]),{servers:void 0}),servers:void 0})}));const Kf=vn?.content&&((_t=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:_t.name)||null;if(Kf&&li&&ta(Kf)){const Ke=Object.values(li);li=Ke.length>1?Ke:Ke[0]}const zI=(0,je.FU)(Se.query||{}),Yf={server:Kl?Kl+Rb(Gf.url):Gf.url,serverVariables:(0,je.mj)(Gf),spec:Mn,pathName:r.path,method:r.httpVerb,parameters:It(It(It(It({},Se.path),zI),Se.header),Se.cookie),securities:{authorized:ci},requestBody:li,requestContentType:Kf,responseContentType:((Or=Se.header)==null?void 0:Or.Accept)||null,requestInterceptor:(0,je.Tz)(Q,r,ci?.Authorization)};try{const Ke=yield nw(Yf),yn=Ke?.data;yn instanceof Blob&&(ta(yn.type)&&(Ke.fileInfo={rawData:yn,fileName:(0,je.AM)(Ke.headers)}),Ke.data=yield yn.text()),e?.({request:Yf,response:Ke}),q(Ke),j(void 0)}catch(Ke){Ke&&Ke.response&&Ke.response.data instanceof Blob&&(Ke.response.data=yield Ke.response.data.text(),e?.({request:Yf,response:Ke.response})),q(void 0),j(Ke)}finally{m(!1),d(1),L(Date.now()-HI),(ai=(oi=Q.events)==null?void 0:oi.tryItSent)==null||ai.call(oi,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})}}),()=>{var Se,Oe;w(!0),setTimeout(()=>w(!1),1e3),(Oe=(Se=Q.events)==null?void 0:Se.tryItSent)==null||Oe.call(Se,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})});(0,pt.useMount)(()=>Nb(this,null,function*(){const Se=yield ww(r,H.definition);T(Se),r.activeServer&&!c&&u(Oe=>Cr(It({},Oe),{activeServer:r.activeServer}))})),(0,S.useEffect)(()=>{F&&F!==r&&(q(void 0),j(void 0),d(0))},[r,F]);const ke=!!(W||D),Re=l.getValues();return S.createElement(gt.RV,It({},l),S.createElement(RI,{shaking:y,className:t,rootElement:n},S.createElement(ea.Hc,null,S.createElement(Lw,{active:h,hasResponse:ke,onChange:oe}),a&&S.createElement(Mr.PZ,{onClick:a}," \u2715 ")),S.createElement(Mr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(DI,{operation:r,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||r.activeServer,onServerChange:fe})),S.createElement(Mr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Nw,{response:W,error:D,time:P})),S.createElement(Vw,{hasResponse:ke,params:Re,operation:r,loading:p,onSubmit:be})))}const $I=(0,S.memo)(WI)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},72887:(v,C,f)=>{var g=f(65234),b=f(83250),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},70861:(v,C,f)=>{var g=f(83250),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var E=0,N=O.length;k!=null&&E<N;)k=k[b(O[E++])];return E&&E==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]",E=g?g.toStringTag:void 0;function N(I){return I==null?I===void 0?O:k:E&&E in Object(I)?b(I):x(I)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,E=/^\[object .+?Constructor\]$/,N=Function.prototype,I=Object.prototype,B=N.toString,z=I.hasOwnProperty,Y=RegExp("^"+B.call(z).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _(X){if(!x(X)||b(X))return!1;var G=g(X)?Y:E;return G.test(k(X))}v.exports=_},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,E=g?g.prototype:void 0,N=E?E.toString:void 0;function I(B){if(typeof B=="string")return B;if(x(B))return b(B,I)+"";if(k(B))return N?N.call(B):"";var z=B+"";return z=="0"&&1/B==-O?"-0":z}v.exports=I},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(E,N){return g(E)?E:b(E,N)?[E]:x(k(E))}v.exports=O},1622:(v,C,f)=>{var g=f(83250),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var E=b(k,O);return g(E)?E: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 E(N){var I=x.call(N,O),B=N[O];try{N[O]=void 0;var z=!0}catch{}var Y=k.call(N);return z&&(I?N[O]=B:delete N[O]),Y}v.exports=E},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(E){var N=this.__data__;if(g){var I=N[E];return I===b?void 0:I}return k.call(N,E)?N[E]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var E=this.__data__;return g?E[O]!==void 0:x.call(E,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var E=this.__data__;return this.size+=this.has(k)?0:1,E[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(E,N){if(g(E))return!1;var I=typeof E;return I=="number"||I=="symbol"||I=="boolean"||E==null||b(E)?!0:k.test(E)||!x.test(E)||N!=null&&E 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 E=this.__data__,N=g(E,O);if(N<0)return!1;var I=E.length-1;return N==I?E.pop():x.call(E,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__,E=g(O,x);return E<0?(++this.size,O.push([x,k])):O[E][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),E=O.size;return O.set(x,k),this.size+=O.size==E?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 E.size===b&&E.clear(),N}),E=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},83250:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var E=[];return O.charCodeAt(0)===46&&E.push(""),O.replace(b,function(N,I,B,z){E.push(B?z.replace(x,"$1"):I||N)}),E});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 E=x==null?void 0:g(x,k);return E===void 0?O:E}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]",E="[object Proxy]";function N(I){if(!b(I))return!1;var B=g(I);return B==k||B==O||B==x||B==E}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 E=function(){var N=arguments,I=O?O.apply(this,N):N[0],B=E.cache;if(B.has(I))return B.get(I);var z=k.apply(this,N);return E.cache=B.set(I,z)||B,z};return E.cache=new(x.Cache||g),E}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,E=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&E&&typeof E.get=="function"?E.get:null,I=O&&Set.prototype.forEach,B=typeof WeakMap=="function"&&WeakMap.prototype,z=B?WeakMap.prototype.has:null,Y=typeof WeakSet=="function"&&WeakSet.prototype,_=Y?WeakSet.prototype.has:null,X=typeof WeakRef=="function"&&WeakRef.prototype,G=X?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,se=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,U=String.prototype.slice,re=String.prototype.replace,ne=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ce=RegExp.prototype.test,V=Array.prototype.concat,K=Array.prototype.join,le=Array.prototype.slice,pe=Math.floor,ge=typeof BigInt=="function"?BigInt.prototype.valueOf:null,me=Object.getOwnPropertySymbols,$e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ve||"symbol")?Symbol.toStringTag:null,Fe=Object.prototype.propertyIsEnumerable,at=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Dt($,Z){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ce.call(/e/,Z))return Z;var ze=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-pe(-$):pe($);if(_e!==$){var lt=String(_e),Me=U.call(Z,lt.length+1);return re.call(lt,ze,"$&_")+"."+re.call(re.call(Me,/([0-9]{3})/g,"$&_"),/_$/,"")}}return re.call(Z,ze,"$&_")}var At=f(65710),qt=At.custom,Xe=hr(qt)?qt:null;v.exports=function $(Z,ze,_e,lt){var Me=ze||{};if(Pr(Me,"quoteStyle")&&Me.quoteStyle!=="single"&&Me.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Pr(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 Yr=Pr(Me,"customInspect")?Me.customInspect:!0;if(typeof Yr!="boolean"&&Yr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Pr(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(Pr(Me,"numericSeparator")&&typeof Me.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var wn=Me.numericSeparator;if(typeof Z>"u")return"undefined";if(Z===null)return"null";if(typeof Z=="boolean")return Z?"true":"false";if(typeof Z=="string")return fi(Z,Me);if(typeof Z=="number"){if(Z===0)return 1/0/Z>0?"0":"-0";var Ht=String(Z);return wn?Dt(Z,Ht):Ht}if(typeof Z=="bigint"){var Jr=String(Z)+"n";return wn?Dt(Z,Jr):Jr}var Ts=typeof Me.depth>"u"?5:Me.depth;if(typeof _e>"u"&&(_e=0),_e>=Ts&&Ts>0&&typeof Z=="object")return Ot(Z)?"[Array]":"[Object]";var Ln=Ce(Me,_e);if(typeof lt>"u")lt=[];else if(Kr(lt,Z)>=0)return"[Circular]";function gr(Fn,Wi,Uo){if(Wi&&(lt=le.call(lt),lt.push(Wi)),Uo){var Go={depth:Me.depth};return Pr(Me,"quoteStyle")&&(Go.quoteStyle=Me.quoteStyle),$(Fn,Go,_e+1,lt)}return $(Fn,Me,_e+1,lt)}if(typeof Z=="function"&&!Ne(Z)){var Vo=pr(Z),Wo=Pe(Z,gr);return"[Function"+(Vo?": "+Vo:" (anonymous)")+"]"+(Wo.length>0?" { "+K.call(Wo,", ")+" }":"")}if(hr(Z)){var Ps=Ve?re.call(String(Z),/^(Symbol\(.*\))_[^)]*$/,"$1"):$e.call(Z);return typeof Z=="object"&&!Ve?Wr(Ps):Ps}if(Dn(Z)){for(var Bn="<"+ae.call(String(Z.nodeName)),Li=Z.attributes||[],di=0;di<Li.length;di++)Bn+=" "+Li[di].name+"="+Ct(xt(Li[di].value),"double",Me);return Bn+=">",Z.childNodes&&Z.childNodes.length&&(Bn+="..."),Bn+="</"+ae.call(String(Z.nodeName))+">",Bn}if(Ot(Z)){if(Z.length===0)return"[]";var Bi=Pe(Z,gr);return Ln&&!Ze(Bi)?"["+Le(Bi,Ln)+"]":"[ "+K.call(Bi,", ")+" ]"}if(wt(Z)){var Ms=Pe(Z,gr);return!("cause"in Error.prototype)&&"cause"in Z&&!Fe.call(Z,"cause")?"{ ["+String(Z)+"] "+K.call(V.call("[cause]: "+gr(Z.cause),Ms),", ")+" }":Ms.length===0?"["+String(Z)+"]":"{ ["+String(Z)+"] "+K.call(Ms,", ")+" }"}if(typeof Z=="object"&&Yr){if(Xe&&typeof Z[Xe]=="function"&&At)return At(Z,{depth:Ts-_e});if(Yr!=="symbol"&&typeof Z.inspect=="function")return Z.inspect()}if(dt(Z)){var $o=[];return k&&k.call(Z,function(Fn,Wi){$o.push(gr(Wi,Z,!0)+" => "+gr(Fn,Z))}),hi("Map",x.call(Z),$o,Ln)}if(bn(Z)){var Ho=[];return I&&I.call(Z,function(Fn){Ho.push(gr(Fn,Z))}),hi("Set",N.call(Z),Ho,Ln)}if(In(Z))return Rn("WeakMap");if(xn(Z))return Rn("WeakSet");if(ui(Z))return Rn("WeakRef");if(ht(Z))return Wr(gr(Number(Z)));if(Vr(Z))return Wr(gr(ge.call(Z)));if(Tr(Z))return Wr(te.call(Z));if($t(Z))return Wr(gr(String(Z)));if(!fr(Z)&&!Ne(Z)){var Fi=Pe(Z,gr),zo=at?at(Z)===Object.prototype:Z instanceof Object||Z.constructor===Object,ji=Z instanceof Object?"":"null prototype",Vi=!zo&&Ye&&Object(Z)===Z&&Ye in Z?U.call(dr(Z),8,-1):ji?"Object":"",Yl=zo||typeof Z.constructor!="function"?"":Z.constructor.name?Z.constructor.name+" ":"",Is=Yl+(Vi||ji?"["+K.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Is+"{}":Ln?Is+"{"+Le(Fi,Ln)+"}":Is+"{ "+K.call(Fi,", ")+" }"}return String(Z)};function Ct($,Z,ze){var _e=(ze.quoteStyle||Z)==="double"?'"':"'";return _e+$+_e}function xt($){return re.call(String($),/"/g,""")}function Ot($){return dr($)==="[object Array]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function fr($){return dr($)==="[object Date]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Ne($){return dr($)==="[object RegExp]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function wt($){return dr($)==="[object Error]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function $t($){return dr($)==="[object String]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function ht($){return dr($)==="[object Number]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Tr($){return dr($)==="[object Boolean]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function hr($){if(Ve)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!$e)return!1;try{return $e.call($),!0}catch{}return!1}function Vr($){if(!$||typeof $!="object"||!ge)return!1;try{return ge.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Pr($,Z){return Ri.call($,Z)}function dr($){return se.call($)}function pr($){if($.name)return $.name;var Z=ee.call(R.call($),/^function\s*([\w$]+)/);return Z?Z[1]:null}function Kr($,Z){if($.indexOf)return $.indexOf(Z);for(var ze=0,_e=$.length;ze<_e;ze++)if($[ze]===Z)return ze;return-1}function dt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function In($){if(!z||!$||typeof $!="object")return!1;try{z.call($,z);try{_.call($,_)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function ui($){if(!G||!$||typeof $!="object")return!1;try{return G.call($),!0}catch{}return!1}function bn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function xn($){if(!_||!$||typeof $!="object")return!1;try{_.call($,_);try{z.call($,z)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Dn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function fi($,Z){if($.length>Z.maxStringLength){var ze=$.length-Z.maxStringLength,_e="... "+ze+" more character"+(ze>1?"s":"");return fi(U.call($,0,Z.maxStringLength),Z)+_e}var lt=re.call(re.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Nn);return Ct(lt,"single",Z)}function Nn($){var Z=$.charCodeAt(0),ze={8:"b",9:"t",10:"n",12:"f",13:"r"}[Z];return ze?"\\"+ze:"\\x"+(Z<16?"0":"")+ne.call(Z.toString(16))}function Wr($){return"Object("+$+")"}function Rn($){return $+" { ? }"}function hi($,Z,ze,_e){var lt=_e?Le(ze,_e):K.call(ze,", ");return $+" ("+Z+") {"+lt+"}"}function Ze($){for(var Z=0;Z<$.length;Z++)if(Kr($[Z],`
|
|
412
|
-
`)>=0)return!1;return!0}function Ce($,Z){var
|
|
413
|
-
`+Z.prev+Z.base;return
|
|
414
|
-
`+Z.prev}function Pe($,Z){var ze=Ot($),_e=[];if(ze){_e.length=$.length;for(var lt=0;lt<$.length;lt++)_e[lt]=Pr($,lt)?Z($[lt],$):""}var Me=typeof me=="function"?me($):[],Yr;if(Ve){Yr={};for(var wn=0;wn<Me.length;wn++)Yr["$"+Me[wn]]=Me[wn]}for(var Ht in $)Pr($,Ht)&&(ze&&String(Number(Ht))===Ht&&Ht<$.length||Ve&&Yr["$"+Ht]instanceof Symbol||(ce.call(/[^\w$]/,Ht)?_e.push(Z(Ht,$)+": "+Z($[Ht],$)):_e.push(Ht+": "+Z($[Ht],$))));if(typeof me=="function")for(var Jr=0;Jr<Me.length;Jr++)Fe.call($,Me[Jr])&&_e.push("["+Z(Me[Jr])+"]: "+Z($[Me[Jr]],$));return _e}},83949:v=>{"use strict";var C=String.prototype.replace,f=/%20/g,g={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:g.RFC3986,formatters:{RFC1738:function(b){return C.call(b,f,"+")},RFC3986:function(b){return String(b)}},RFC1738:g.RFC1738,RFC3986:g.RFC3986}},67905:(v,C,f)=>{"use strict";var g=f(85095),b=f(95990),x=f(83949);v.exports={formats:x,parse:b,stringify:g}},95990:(v,C,f)=>{"use strict";var g=f(37748),b=Object.prototype.hasOwnProperty,x=Array.isArray,k={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:g.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O=function(X){return X.replace(/&#(\d+);/g,function(G,te){return String.fromCharCode(parseInt(te,10))})},E=function(X,G){return X&&typeof X=="string"&&G.comma&&X.indexOf(",")>-1?X.split(","):X},N="utf8=%26%2310003%3B",I="utf8=%E2%9C%93",B=function(G,te){var se={__proto__:null},R=te.ignoreQueryPrefix?G.replace(/^\?/,""):G,ee=te.parameterLimit===1/0?void 0:te.parameterLimit,U=R.split(te.delimiter,ee),re=-1,ne,ae=te.charset;if(te.charsetSentinel)for(ne=0;ne<U.length;++ne)U[ne].indexOf("utf8=")===0&&(U[ne]===I?ae="utf-8":U[ne]===N&&(ae="iso-8859-1"),re=ne,ne=U.length);for(ne=0;ne<U.length;++ne)if(ne!==re){var ce=U[ne],V=ce.indexOf("]="),K=V===-1?ce.indexOf("="):V+1,le,pe;K===-1?(le=te.decoder(ce,k.decoder,ae,"key"),pe=te.strictNullHandling?null:""):(le=te.decoder(ce.slice(0,K),k.decoder,ae,"key"),pe=g.maybeMap(E(ce.slice(K+1),te),function(ge){return te.decoder(ge,k.decoder,ae,"value")})),pe&&te.interpretNumericEntities&&ae==="iso-8859-1"&&(pe=O(pe)),ce.indexOf("[]=")>-1&&(pe=x(pe)?[pe]:pe),b.call(se,le)?se[le]=g.combine(se[le],pe):se[le]=pe}return se},z=function(X,G,te,se){for(var R=se?G:E(G,te),ee=X.length-1;ee>=0;--ee){var U,re=X[ee];if(re==="[]"&&te.parseArrays)U=[].concat(R);else{U=te.plainObjects?Object.create(null):{};var ne=re.charAt(0)==="["&&re.charAt(re.length-1)==="]"?re.slice(1,-1):re,ae=parseInt(ne,10);!te.parseArrays&&ne===""?U={0:R}:!isNaN(ae)&&re!==ne&&String(ae)===ne&&ae>=0&&te.parseArrays&&ae<=te.arrayLimit?(U=[],U[ae]=R):ne!=="__proto__"&&(U[ne]=R)}R=U}return R},Y=function(G,te,se,R){if(G){var ee=se.allowDots?G.replace(/\.([^.[]+)/g,"[$1]"):G,U=/(\[[^[\]]*])/,re=/(\[[^[\]]*])/g,ne=se.depth>0&&U.exec(ee),ae=ne?ee.slice(0,ne.index):ee,ce=[];if(ae){if(!se.plainObjects&&b.call(Object.prototype,ae)&&!se.allowPrototypes)return;ce.push(ae)}for(var V=0;se.depth>0&&(ne=re.exec(ee))!==null&&V<se.depth;){if(V+=1,!se.plainObjects&&b.call(Object.prototype,ne[1].slice(1,-1))&&!se.allowPrototypes)return;ce.push(ne[1])}return ne&&ce.push("["+ee.slice(ne.index)+"]"),z(ce,te,se,R)}},_=function(G){if(!G)return k;if(G.decoder!==null&&G.decoder!==void 0&&typeof G.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof G.charset<"u"&&G.charset!=="utf-8"&&G.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var te=typeof G.charset>"u"?k.charset:G.charset;return{allowDots:typeof G.allowDots>"u"?k.allowDots:!!G.allowDots,allowPrototypes:typeof G.allowPrototypes=="boolean"?G.allowPrototypes:k.allowPrototypes,allowSparse:typeof G.allowSparse=="boolean"?G.allowSparse:k.allowSparse,arrayLimit:typeof G.arrayLimit=="number"?G.arrayLimit:k.arrayLimit,charset:te,charsetSentinel:typeof G.charsetSentinel=="boolean"?G.charsetSentinel:k.charsetSentinel,comma:typeof G.comma=="boolean"?G.comma:k.comma,decoder:typeof G.decoder=="function"?G.decoder:k.decoder,delimiter:typeof G.delimiter=="string"||g.isRegExp(G.delimiter)?G.delimiter:k.delimiter,depth:typeof G.depth=="number"||G.depth===!1?+G.depth:k.depth,ignoreQueryPrefix:G.ignoreQueryPrefix===!0,interpretNumericEntities:typeof G.interpretNumericEntities=="boolean"?G.interpretNumericEntities:k.interpretNumericEntities,parameterLimit:typeof G.parameterLimit=="number"?G.parameterLimit:k.parameterLimit,parseArrays:G.parseArrays!==!1,plainObjects:typeof G.plainObjects=="boolean"?G.plainObjects:k.plainObjects,strictNullHandling:typeof G.strictNullHandling=="boolean"?G.strictNullHandling:k.strictNullHandling}};v.exports=function(X,G){var te=_(G);if(X===""||X===null||typeof X>"u")return te.plainObjects?Object.create(null):{};for(var se=typeof X=="string"?B(X,te):X,R=te.plainObjects?Object.create(null):{},ee=Object.keys(se),U=0;U<ee.length;++U){var re=ee[U],ne=Y(re,se[re],te,typeof X=="string");R=g.merge(R,ne,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}},E=Array.isArray,N=Array.prototype.push,I=function(se,R){N.apply(se,E(R)?R:[R])},B=Date.prototype.toISOString,z=x.default,Y={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:z,formatter:x.formatters[z],indices:!1,serializeDate:function(R){return B.call(R)},skipNulls:!1,strictNullHandling:!1},_=function(R){return typeof R=="string"||typeof R=="number"||typeof R=="boolean"||typeof R=="symbol"||typeof R=="bigint"},X={},G=function se(R,ee,U,re,ne,ae,ce,V,K,le,pe,ge,me,$e,Ve,Ye){for(var Fe=R,at=Ye,Dt=0,At=!1;(at=at.get(X))!==void 0&&!At;){var qt=at.get(R);if(Dt+=1,typeof qt<"u"){if(qt===Dt)throw new RangeError("Cyclic object value");At=!0}typeof at.get(X)>"u"&&(Dt=0)}if(typeof V=="function"?Fe=V(ee,Fe):Fe instanceof Date?Fe=pe(Fe):U==="comma"&&E(Fe)&&(Fe=b.maybeMap(Fe,function(hr){return hr instanceof Date?pe(hr):hr})),Fe===null){if(ne)return ce&&!$e?ce(ee,Y.encoder,Ve,"key",ge):ee;Fe=""}if(_(Fe)||b.isBuffer(Fe)){if(ce){var Xe=$e?ee:ce(ee,Y.encoder,Ve,"key",ge);return[me(Xe)+"="+me(ce(Fe,Y.encoder,Ve,"value",ge))]}return[me(ee)+"="+me(String(Fe))]}var Ct=[];if(typeof Fe>"u")return Ct;var xt;if(U==="comma"&&E(Fe))$e&&ce&&(Fe=b.maybeMap(Fe,ce)),xt=[{value:Fe.length>0?Fe.join(",")||null:void 0}];else if(E(V))xt=V;else{var Ot=Object.keys(Fe);xt=K?Ot.sort(K):Ot}for(var fr=re&&E(Fe)&&Fe.length===1?ee+"[]":ee,Ne=0;Ne<xt.length;++Ne){var wt=xt[Ne],$t=typeof wt=="object"&&typeof wt.value<"u"?wt.value:Fe[wt];if(!(ae&&$t===null)){var ht=E(Fe)?typeof U=="function"?U(fr,wt):fr:fr+(le?"."+wt:"["+wt+"]");Ye.set(R,Dt);var Tr=g();Tr.set(X,Ye),I(Ct,se($t,ht,U,re,ne,ae,U==="comma"&&$e&&E(Fe)?null:ce,V,K,le,pe,ge,me,$e,Ve,Tr))}}return Ct},te=function(R){if(!R)return Y;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||Y.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 U=x.default;if(typeof R.format<"u"){if(!k.call(x.formatters,R.format))throw new TypeError("Unknown format option provided.");U=R.format}var re=x.formatters[U],ne=Y.filter;return(typeof R.filter=="function"||E(R.filter))&&(ne=R.filter),{addQueryPrefix:typeof R.addQueryPrefix=="boolean"?R.addQueryPrefix:Y.addQueryPrefix,allowDots:typeof R.allowDots>"u"?Y.allowDots:!!R.allowDots,charset:ee,charsetSentinel:typeof R.charsetSentinel=="boolean"?R.charsetSentinel:Y.charsetSentinel,delimiter:typeof R.delimiter>"u"?Y.delimiter:R.delimiter,encode:typeof R.encode=="boolean"?R.encode:Y.encode,encoder:typeof R.encoder=="function"?R.encoder:Y.encoder,encodeValuesOnly:typeof R.encodeValuesOnly=="boolean"?R.encodeValuesOnly:Y.encodeValuesOnly,filter:ne,format:U,formatter:re,serializeDate:typeof R.serializeDate=="function"?R.serializeDate:Y.serializeDate,skipNulls:typeof R.skipNulls=="boolean"?R.skipNulls:Y.skipNulls,sort:typeof R.sort=="function"?R.sort:null,strictNullHandling:typeof R.strictNullHandling=="boolean"?R.strictNullHandling:Y.strictNullHandling}};v.exports=function(se,R){var ee=se,U=te(R),re,ne;typeof U.filter=="function"?(ne=U.filter,ee=ne("",ee)):E(U.filter)&&(ne=U.filter,re=ne);var ae=[];if(typeof ee!="object"||ee===null)return"";var ce;R&&R.arrayFormat in O?ce=R.arrayFormat:R&&"indices"in R?ce=R.indices?"indices":"repeat":ce="indices";var V=O[ce];if(R&&"commaRoundTrip"in R&&typeof R.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var K=V==="comma"&&R&&R.commaRoundTrip;re||(re=Object.keys(ee)),U.sort&&re.sort(U.sort);for(var le=g(),pe=0;pe<re.length;++pe){var ge=re[pe];U.skipNulls&&ee[ge]===null||I(ae,G(ee[ge],ge,V,K,U.strictNullHandling,U.skipNulls,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,le))}var me=ae.join(U.delimiter),$e=U.addQueryPrefix===!0?"?":"";return U.charsetSentinel&&(U.charset==="iso-8859-1"?$e+="utf8=%26%2310003%3B&":$e+="utf8=%E2%9C%93&"),me.length>0?$e+me:""}},37748:(v,C,f)=>{"use strict";var g=f(83949),b=Object.prototype.hasOwnProperty,x=Array.isArray,k=function(){for(var se=[],R=0;R<256;++R)se.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return se}(),O=function(R){for(;R.length>1;){var ee=R.pop(),U=ee.obj[ee.prop];if(x(U)){for(var re=[],ne=0;ne<U.length;++ne)typeof U[ne]<"u"&&re.push(U[ne]);ee.obj[ee.prop]=re}}},E=function(R,ee){for(var U=ee&&ee.plainObjects?Object.create(null):{},re=0;re<R.length;++re)typeof R[re]<"u"&&(U[re]=R[re]);return U},N=function se(R,ee,U){if(!ee)return R;if(typeof ee!="object"){if(x(R))R.push(ee);else if(R&&typeof R=="object")(U&&(U.plainObjects||U.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 re=R;return x(R)&&!x(ee)&&(re=E(R,U)),x(R)&&x(ee)?(ee.forEach(function(ne,ae){if(b.call(R,ae)){var ce=R[ae];ce&&typeof ce=="object"&&ne&&typeof ne=="object"?R[ae]=se(ce,ne,U):R.push(ne)}else R[ae]=ne}),R):Object.keys(ee).reduce(function(ne,ae){var ce=ee[ae];return b.call(ne,ae)?ne[ae]=se(ne[ae],ce,U):ne[ae]=ce,ne},re)},I=function(R,ee){return Object.keys(ee).reduce(function(U,re){return U[re]=ee[re],U},R)},B=function(se,R,ee){var U=se.replace(/\+/g," ");if(ee==="iso-8859-1")return U.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(U)}catch{return U}},z=function(R,ee,U,re,ne){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)),U==="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 ce="",V=0;V<ae.length;++V){var K=ae.charCodeAt(V);if(K===45||K===46||K===95||K===126||K>=48&&K<=57||K>=65&&K<=90||K>=97&&K<=122||ne===g.RFC1738&&(K===40||K===41)){ce+=ae.charAt(V);continue}if(K<128){ce=ce+k[K];continue}if(K<2048){ce=ce+(k[192|K>>6]+k[128|K&63]);continue}if(K<55296||K>=57344){ce=ce+(k[224|K>>12]+k[128|K>>6&63]+k[128|K&63]);continue}V+=1,K=65536+((K&1023)<<10|ae.charCodeAt(V)&1023),ce+=k[240|K>>18]+k[128|K>>12&63]+k[128|K>>6&63]+k[128|K&63]}return ce},Y=function(R){for(var ee=[{obj:{o:R},prop:"o"}],U=[],re=0;re<ee.length;++re)for(var ne=ee[re],ae=ne.obj[ne.prop],ce=Object.keys(ae),V=0;V<ce.length;++V){var K=ce[V],le=ae[K];typeof le=="object"&&le!==null&&U.indexOf(le)===-1&&(ee.push({obj:ae,prop:K}),U.push(le))}return O(ee),R},_=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},X=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},G=function(R,ee){return[].concat(R,ee)},te=function(R,ee){if(x(R)){for(var U=[],re=0;re<R.length;re+=1)U.push(ee(R[re]));return U}return ee(R)};v.exports={arrayToObject:E,assign:I,combine:G,compact:Y,decode:B,encode:z,isBuffer:X,isRegExp:_,maybeMap:te,merge:N}},95472:(v,C,f)=>{"use strict";var g;/** @license React v17.0.2
|
|
412
|
+
`;function Sb(t){const{scopes:e,id:r}=t;let n=[];try{n=JSON.parse((0,Oe.YQ)(`auth.${r}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ye.NI,null,S.createElement(ye.lX,null," Scopes: "),S.createElement(nI,{fieldName:`auth.${r}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const oI=({token:t,loading:e,error:r})=>e?S.createElement(ye.GE,null,"Please, finish your authorization flow or cancel authorization."):r?S.createElement(WM,null,S.createElement(ye.Xq,null,r)):t?.access_token?null:S.createElement(ye.GE,null," No Access Token. Please, Authorize. ");var aI=Object.defineProperty,lI=Object.defineProperties,cI=Object.getOwnPropertyDescriptors,kb=Object.getOwnPropertySymbols,uI=Object.prototype.hasOwnProperty,fI=Object.prototype.propertyIsEnumerable,Ab=(t,e,r)=>e in t?aI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ul=(t,e)=>{for(var r in e||(e={}))uI.call(e,r)&&Ab(t,r,e[r]);if(kb)for(var r of kb(e))fI.call(e,r)&&Ab(t,r,e[r]);return t},Gf=(t,e)=>lI(t,cI(e)),Cb=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});const Gl=({usePkce:t,id:e,flow:r,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:a,authorizationUrl:l,defaultValues:c,clientId:u})=>{var h;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,Hr.Dv)($n.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,vt.Gc)(),[T,E]=(0,S.useState)(null),[B,I]=(0,S.useState)(!1),[W,F]=(0,S.useState)(!1),[_,j]=(0,S.useState)(void 0),[U,Y]=(0,S.useState)(void 0),[re,ce]=(0,S.useState)(void 0),he=((h=y("auth"))==null?void 0:h[e])||{},xe=A.errors||{},Fe=_!==void 0&&U!==re?{label:"sync",onClick:()=>{_&&Y(re)}}:void 0;(0,S.useEffect)(()=>{if(t){const Ct=(0,mi.CY)(43);ld(Ct).then(tr=>{j(Ct),Y(tr),ce(tr)})}},[t]);const we=Ct=>Cb(void 0,null,function*(){if(!Ct||(yield w(),!(0,mi.Qr)(xe)))return;I(!0),E(null);const tr=i?i+(0,Be.jg)(Ct):Ct,Pr=i&&n?i+(0,Be.jg)(n):n,ai=y(`auth.${e}.scopes`),li={authorizationUrl:tr.startsWith("http")?tr:o+tr,clientId:he.client_id,scopes:ai,redirectUri:d,routingBasePath:p,successCallback:Mr=>{m(`auth.${e}.token`,Mr),I(!1),E(null)},errorCallback:Mr=>{I(!1),E(Mr?.message||"Failed to retrieve the access token")}};if(r==="implicit"&&zr.authorizeImplicit(li),!(0,Be.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}r==="authorizationCode"&&zr.authorizeAuthorizationCode(Ul(Gf(Ul({},li),{tokenUrl:Pr?.startsWith("http")?Pr:o+Pr,clientSecret:he.client_secret,extraHeaders:(0,Be.Or)({authMethod:s,clientId:he.client_id,clientSecret:he.client_secret})}),t&&{codeVerifier:_,codeChallenge:U}))}),Ee=()=>{Ie(),E(null)},Ue=()=>{I(!1),E(null),zr.clearRedirectData(r)},Ie=()=>{m(`auth.${e}.token`,"")},nt=()=>{F(Ct=>!Ct)},dt=Ct=>Cb(void 0,[Ct],function*({target:{value:tr}}){const Pr=yield ld(tr);j(tr),ce(Pr)});if(!l)return S.createElement(ye.Xq,null,"No flow info");let Bt=(0,Oe.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);Bt=Bt?JSON.parse(Bt):"";const er=(0,Oe.Al)(e,"client_id"),Tr={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null," Client ID: "),er?S.createElement(st.F0,Gf(Ul({},Tr),{options:er})):S.createElement(st.Xn,Gf(Ul({},Tr),{"data-cy":"client-id-input",panel:"try-it"}))),r==="authorizationCode"&&S.createElement(S.Fragment,null,(!t?.hideClientSecretInput||!t)&&S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${e}.client_secret`)||c?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),t&&!t.disableManualConfiguration&&S.createElement(HM,null,S.createElement(wb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:W,onChange:nt,"data-cy":"pkce-options-toggle"}),W&&S.createElement(zM,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Verifier"),S.createElement(st.nv,{fullWidth:!0,value:_,onChange:dt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Code Challenge"),S.createElement(st.nv,{fullWidth:!0,value:U,onChange:({target:{value:Ct}})=>{Y(Ct)},inputActionButton:Fe,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:Bt,panel:"try-it"}),S.createElement(Sb,{id:e,scopes:a}),he.token&&he.token.access_token?S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.nv,{disabled:!0,type:"password",fullWidth:!0,value:he.token.access_token,panel:"try-it"})):null),S.createElement($M,null,he.token&&he.token.access_token?S.createElement(mt.Button,{fullWidth:!0,onClick:Ee},"Log out"):B?S.createElement(S.Fragment,null,S.createElement(mt.Button,{fullWidth:!0,onClick:Ue},"Cancel"),S.createElement(yb,null)):S.createElement(mt.Button,{fullWidth:!0,disabled:!(0,mi.Qr)(xe),onClick:()=>{we(l)}},"Authorize")),B||T||!he.token||!he.token.access_token&&S.createElement(oI,{loading:B,error:T,token:he.token}))};var hI=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function dI(t){var e,r;const{scheme:n,defaultValues:i}=t,[s,o]=(0,S.useState)({}),[a,l]=(0,S.useState)(),[c,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{h(n.openIdConnectUrl)},[n.openIdConnectUrl]);const h=d=>hI(this,null,function*(){u(!0),l("");try{const p=yield jM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(pI,null):a?S.createElement(Ob,{message:a}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Gl,{key:t.id,authorizationUrl:s.authorization_endpoint,authCorsProxyUrl:t.authCorsProxyUrl,scopes:s.scopes_supported,server:t.server,id:t.id,clientId:t.clientId,flow:"implicit",defaultValues:i})):(r=s?.response_types_supported)!=null&&r.includes("code")?S.createElement(S.Fragment,null,S.createElement(Nr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Gl,{key:t.id,authorizationUrl:s.authorization_endpoint,tokenUrl:s.token_endpoint,authCorsProxyUrl:t.authCorsProxyUrl,scopes:s.scopes_supported,server:t.server,id:t.id,clientId:t.clientId,tokenEndpointAuthMethod:s?.token_endpoint_auth_methods_supported,flow:"authorizationCode",defaultValues:i})):S.createElement("div",null,"Unsupported flow")))}function pI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(yb,null)))}function Ob({message:t}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ye.Xq,null,t)))}var gI=Object.defineProperty,mI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,Eb=Object.getOwnPropertySymbols,yI=Object.prototype.hasOwnProperty,bI=Object.prototype.propertyIsEnumerable,Tb=(t,e,r)=>e in t?gI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pb=(t,e)=>{for(var r in e||(e={}))yI.call(e,r)&&Tb(t,r,e[r]);if(Eb)for(var r of Eb(e))bI.call(e,r)&&Tb(t,r,e[r]);return t},Mb=(t,e)=>mI(t,vI(e)),xI=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function wI(t){if(!t)return"Token is required"}const SI=({id:t,server:e,flow:r,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,vt.Gc)(),[h,d]=(0,S.useState)(""),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!0),A=((o=c("auth"))==null?void 0:o[t])||{},T=((a=u.errors)==null?void 0:a.auth)||{},E=()=>{l(`auth.${t}.token`,""),(0,Oe.WW)(`auth.${t}.token`,"")},B=()=>{w(U=>!U)},I=()=>xI(void 0,null,function*(){if(p)return;const U=n&&r.tokenUrl?n+(0,Be.jg)(r.tokenUrl):r.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const Y=A.client_id,re=A.client_secret;if(!Y||!re){console.log("Provide client_id and client_secret");return}m(!0);const ce=r["x-tokenEndpointAuthMethod"];if(!(0,Be.xl)(ce)){console.log(`Unsupported token endpoint auth method: ${ce}`);return}yield zr.authorizeClientCredentials({tokenUrl:U.startsWith("http")?U:e+U,clientId:Y,clientSecret:re,scopes:A.scopes,extraHeaders:(0,Be.Or)({authMethod:ce,clientId:Y,clientSecret:re}),successCallback:he=>{l(`auth.${t}.token`,he),m(!1)},errorCallback:he=>{E(),d(he.message),m(!1)}})}),W=Object.keys(r.scopes);let F=(0,Oe.YQ)(`auth.${t}.token`)||JSON.stringify(i?.token);F=F?JSON.parse(F):"";const _=(0,Oe.Al)(t,"client_id"),j={fieldName:`auth.${t}.client_id`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${t}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client ID:"),_?S.createElement(st.F0,Mb(Pb({},j),{options:_})):S.createElement(st.Xn,Mb(Pb({},j),{type:"password",panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null,"Client Secret:"),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${t}.client_secret`,defaultValue:(0,Oe.YQ)(`auth.${t}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${t}.token`,type:"hidden",defaultValue:F,rules:{validate:wI}}),S.createElement(Sb,{id:t,scopes:W})),S.createElement(mt.Button,{color:"primary",onClick:I,blinking:p},p?"Loading...":"Request Token"),S.createElement(ye.ph,null," Access Token "),h?S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ye.TR,null,S.createElement(ye.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ye.lf,{onClick:B},y?"Show":"Hide"," "),S.createElement(ye.h,{onClick:E}," Clear ")):S.createElement(ye.Xq,{style:{marginBottom:"1em"}},"No token"))};var kI=Object.defineProperty,AI=Object.defineProperties,CI=Object.getOwnPropertyDescriptors,Ib=Object.getOwnPropertySymbols,OI=Object.prototype.hasOwnProperty,EI=Object.prototype.propertyIsEnumerable,Db=(t,e,r)=>e in t?kI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Os=(t,e)=>{for(var r in e||(e={}))OI.call(e,r)&&Db(t,r,e[r]);if(Ib)for(var r of Ib(e))EI.call(e,r)&&Db(t,r,e[r]);return t},Es=(t,e)=>AI(t,CI(e));const TI=({securityDefaults:t,operation:e,activeServer:r,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,vt.Gc)(),{parser:c}=(0,Hr.Dv)($n.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(E=>E.schemes.map(B=>B.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const E=h.findIndex(B=>B===d);return E<0?0:E},[h,d]);(0,S.useEffect)(()=>{const E=(0,Oe.YQ)("securityRequirementName"),B=h.findIndex(I=>I===E);a("securityScheme",h[B<0?0:B])},[h,e,a]);const m=(0,S.useCallback)(E=>{a("securityScheme",E.value),(0,Oe.WW)("securityRequirementName",E.value)},[a]),y=(0,S.useMemo)(()=>h.map((E,B)=>({value:E,idx:B})),[h]);if(y.length===0)return S.createElement(Ob,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Oe.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ye.n5,null,y.length>1&&S.createElement(ye.NI,null,S.createElement(ye.lX,null," Security scheme: "),S.createElement(vt.Qr,{control:o,name:"securityScheme",render:({field:{value:E}})=>S.createElement(Nr.VD,{variant:"dark",fullWidth:!0,options:y,value:E,onChange:m})}))||null,S.createElement(mt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:E=>{a(`auth.${A}`,E)}}),w.schemes.map(E=>{var B,I,W,F,_,j;const U=(0,Oe.A8)(E.id);if(E.type==="apiKey"){const Y=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Be.NG)(E)||(0,Oe.YQ)(`auth.${U}`)||t?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ye.NI,{key:U},S.createElement(ye.lX,null," ",E.name,": "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(E.type==="http"){if(E.scheme==="basic"){const Y=(0,Oe.Al)(U,"username"),re={fieldName:`auth.${U}.username`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}.username`)||((B=t?.[U])==null?void 0:B.username),validate:Be.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,js.l)("tryItAuthBasicUsername"),": "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{panel:"try-it"}))),S.createElement(ye.NI,null,S.createElement(ye.lX,null," ",(0,js.l)("tryItAuthBasicPassword"),": "),S.createElement(st.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${U}.password`,defaultValue:(0,Oe.YQ)(`auth.${U}.password`)||((I=t?.[U])==null?void 0:I.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.scheme==="bearer"){const Y=(0,Oe.Al)(U,""),re={fieldName:`auth.${U}`,fullWidth:!0,defaultValue:(0,Oe.YQ)(`auth.${U}`)||t?.[U],rules:{validate:Be.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Bearer Token: "),Y?S.createElement(st.F0,Es(Os({},re),{options:Y})):S.createElement(st.Xn,Es(Os({},re),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(E.type==="oauth2"&&E.flows&&E.flows.clientCredentials)return S.createElement(SI,{key:U,flow:E.flows.clientCredentials,server:r,authCorsProxyUrl:n,id:U,clientId:E.flows.clientCredentials["x-defaultClientId"]||E["x-defaultClientId"],defaultValues:t?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.implicit)return S.createElement(Gl,{key:U,authorizationUrl:E.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((F=(W=E?.flows)==null?void 0:W.implicit)==null?void 0:F.scopes)||{}),server:r,id:U,clientId:E.flows.implicit["x-defaultClientId"]||E["x-defaultClientId"],flow:"implicit",defaultValues:t?.[U]});if(E.type==="oauth2"&&E.flows&&E.flows.authorizationCode)return S.createElement(Gl,{key:U,authorizationUrl:E.flows.authorizationCode.authorizationUrl,tokenUrl:E.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((_=E.flows.authorizationCode)==null?void 0:_.scopes)||{}),server:r,id:U,clientId:E.flows.authorizationCode["x-defaultClientId"]||E["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:E.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:E.flows.authorizationCode["x-usePkce"],defaultValues:t?.[U]});if(E.type==="oauth2"){let Y=(0,Oe.YQ)(`auth.${U}.token`)||JSON.stringify((j=t?.[U])==null?void 0:j.token);return Y=Y?JSON.parse(Y):{},S.createElement(S.Fragment,{key:U},S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token Type: "),S.createElement(st.Xn,{fullWidth:!0,fieldName:`auth.${U}.token.token_type`,defaultValue:Y.token_type||"Bearer",panel:"try-it"})),S.createElement(ye.NI,null,S.createElement(ye.lX,null," Access Token: "),S.createElement(st.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${U}.token.access_token`,rules:{validate:Be.np},defaultValue:Y.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(E.type==="openIdConnect")return S.createElement(dI,{key:U,server:r,authCorsProxyUrl:n,id:U,scheme:E,clientId:E["x-defaultClientId"],defaultValues:t?.[U]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var PI=f(55919);function MI({operation:t,properties:e,mergeExampleBody:r,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,vt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,Hr.Dv)($n.qd),p=i&&Oe.IB.get(i,t.pointer),m=a();let y=m&&m.auth&&Object.keys(m.auth)[0];(!y||!m.auth[y])&&(y=void 0),y&&(m.auth[y].token!==void 0||m.auth[y].client_id!==void 0||m.auth[y].client_secret!==void 0)&&(!m.auth[y].token||!m.auth[y].token.access_token)&&(y=void 0),y&&m.auth[y].username!=null&&(!m.auth[y].username||!m.auth[y].password)&&(y=void 0);const w=t.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(nS,{operation:t,onChange:o}),S.createElement(ta.UQ,{initialActiveIdx:t.security.length&&y?1:0},t.security.length&&S.createElement(hc,{header:(0,js.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(II,{fieldName:"auth",validate:Be.np},A=>S.createElement(PI.Q,{Hook:mt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:t,onChange:A,OAuth2:zr}})):S.createElement(TI,{operation:t,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,t.requestBody&&S.createElement(hc,{header:(0,js.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(AM,{validate:DI,body:t.requestBody,pointer:t.pointer,id:t.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:r}))||null,w.length&&S.createElement(hc,{header:(0,js.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(BM,{operation:t,values:m}))||null))}function II({fieldName:t,validate:e,children:r}){const{control:n,setValue:i}=(0,vt.Gc)();return S.createElement(vt.Qr,{control:n,name:t,rules:{validate:e},render:()=>r(i)})}function DI(){}const NI=(0,S.memo)(MI);function RI({shaking:t,className:e,children:r,rootElement:n}){const[i]=(0,Uf.Bs)(n),s=(0,Hr.Dv)($n.qd);return S.createElement(Nr.q2,{scrollYOffset:s.scrollYOffset,shaking:t,className:e,"data-cy":"console",fullWidth:i?.width},r)}const LI=(0,S.memo)(RI);var BI=Object.defineProperty,FI=Object.defineProperties,jI=Object.getOwnPropertyDescriptors,Nb=Object.getOwnPropertySymbols,VI=Object.prototype.hasOwnProperty,WI=Object.prototype.propertyIsEnumerable,Rb=(t,e,r)=>e in t?BI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nt=(t,e)=>{for(var r in e||(e={}))VI.call(e,r)&&Rb(t,r,e[r]);if(Nb)for(var r of Nb(e))WI.call(e,r)&&Rb(t,r,e[r]);return t},Er=(t,e)=>FI(t,jI(e)),Lb=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{a(r.next(l))}catch(c){i(c)}},o=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((r=r.apply(t,e)).next())});function Bb(t){return t.startsWith("//")?"https:"+t:t}function $I({operation:t,onResponse:e,className:r,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,vt.cI)({defaultValues:{path:(0,Be.ZS)(t.parameters,"path"),cookie:(0,Be.ZS)(t.parameters,"cookie"),header:(0,Be.ZS)(t.parameters,"header"),query:(0,Be.ZS)(t.parameters,"query")}}),[{activeServer:c},u]=(0,Hr.KO)((0,pc.N)(t.pointer)),[h,d]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!1),[A,T]=(0,S.useState)(),[E,B]=(0,S.useState)(),[I,W]=(0,S.useState)(),[F,_]=(0,S.useState)(),j=(0,Uf.D9)(t),{parser:U,options:Y}=(0,Hr.Dv)($n.eG);(0,S.useEffect)(()=>{const{unsubscribe:we}=l.watch((Ee={})=>{u(Ue=>Er(Nt({},Ue),{requestValues:JSON.parse(JSON.stringify(Ee))})),(0,Be.Hc)(Er(Nt({},Ee),{query:(0,Be.FU)(Ee.query||{})}))});return()=>we()},[l,u]);const re=(0,S.useCallback)(we=>{d(we)},[]),ce=(0,S.useCallback)(we=>{u(Ee=>Er(Nt({},Ee),{activeServer:we})),l.setValue("server",we)},[u,l]),he=l.handleSubmit(we=>Lb(this,null,function*(){var Ee,Ue,Ie,nt,dt,Bt,er,Tr,Ct,tr,Pr,ai,li;const{servers:Mr,requestBody:yn}=t,Kl=yn&&yn.content&&((Ee=(0,_r.getActiveMediaType)(yn.content))==null?void 0:Ee.name)||"";let ci=we.body;if(/json/.test(Kl))try{ci=JSON.parse(ci)}catch(Ge){console.error(Ge)}m(!0);const or=A,Ts=(t.httpVerb||"").toLowerCase();if(!Mr)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");const Kf=Mr.find(Ge=>c?.url.endsWith(Ge.url.endsWith("/")?Ge.url.substring(0,Ge.url.length-1):Ge.url)),zI=Date.now();let In,ui=we.auth;if(ui){const Ge=Object.keys(ui)[0],bn=(0,Aw.dw)(Ge);In=Er(Nt({},or),{components:Er(Nt({},or?.components),{securitySchemes:Er(Nt({},(Ue=or?.components)==null?void 0:Ue.securitySchemes),{[bn]:Er(Nt({},(nt=(Ie=or?.components)==null?void 0:Ie.securitySchemes)==null?void 0:nt[bn]),{type:((er=(Bt=(dt=or?.components)==null?void 0:dt.securitySchemes)==null?void 0:Bt[bn])==null?void 0:er.type)==="openIdConnect"?"oauth2":((Ct=(Tr=or?.components)==null?void 0:Tr.securitySchemes)==null?void 0:Ct[bn]).type})})})}),ui=Er(Nt({},ui),{[bn]:ui[Ge]})}else In=Nt({},or);In.servers=Mr;const Yl=Y.corsProxyUrl;Yl&&Mr.length&&(In.servers=Mr.map(Ge=>Er(Nt({},Ge),{url:Yl+Bb(Ge.url)})),In.paths=Er(Nt({},In.paths),{[t.path]:Er(Nt({},In.paths[t.path]),{[Ts]:Er(Nt({},In.paths[t.path][Ts]),{servers:void 0}),servers:void 0})}));const Yf=yn?.content&&((tr=(0,_r.getActiveMediaType)(yn.content))==null?void 0:tr.name)||null;if(Yf&&ci&&ra(Yf)){const Ge=Object.values(ci);ci=Ge.length>1?Ge:Ge[0]}const UI=(0,Be.FU)(we.query||{}),Jf={server:Yl?Yl+Bb(Kf.url):Kf.url,serverVariables:(0,Be.mj)(Kf),spec:In,pathName:t.path,method:t.httpVerb,parameters:Nt(Nt(Nt(Nt({},we.path),UI),we.header),we.cookie),securities:{authorized:ui},requestBody:ci,requestContentType:Yf,responseContentType:((Pr=we.header)==null?void 0:Pr.Accept)||null,requestInterceptor:(0,Be.Tz)(Y,t,ui?.Authorization)};try{const Ge=yield sw(Jf),bn=Ge?.data;bn instanceof Blob&&(ra(bn.type)&&(Ge.fileInfo={rawData:bn,fileName:(0,Be.AM)(Ge.headers)}),Ge.data=yield bn.text()),e?.({request:Jf,response:Ge}),_(Ge),W(void 0)}catch(Ge){Ge&&Ge.response&&Ge.response.data instanceof Blob&&(Ge.response.data=yield Ge.response.data.text(),e?.({request:Jf,response:Ge.response})),_(void 0),W(Ge)}finally{m(!1),d(1),B(Date.now()-zI),(li=(ai=Y.events)==null?void 0:ai.tryItSent)==null||li.call(ai,{eventType:cc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})}}),()=>{var we,Ee;w(!0),setTimeout(()=>w(!1),1e3),(Ee=(we=Y.events)==null?void 0:we.tryItSent)==null||Ee.call(we,{eventType:cc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:t.operationId,operationPath:t.path,operationHttpVerb:t.httpVerb,operationSummary:t.description})});(0,mt.useMount)(()=>Lb(this,null,function*(){const we=yield kw(t,U.definition);T(we),t.activeServer&&!c&&u(Ee=>Er(Nt({},Ee),{activeServer:t.activeServer}))})),(0,S.useEffect)(()=>{j&&j!==t&&(_(void 0),W(void 0),d(0))},[t,j]);const xe=!!(F||I),Fe=l.getValues();return S.createElement(vt.RV,Nt({},l),S.createElement(LI,{shaking:y,className:r,rootElement:n},S.createElement(ta.Hc,null,S.createElement(Fw,{active:h,hasResponse:xe,onChange:re}),a&&S.createElement(Nr.PZ,{onClick:a}," \u2715 ")),S.createElement(Nr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(NI,{operation:t,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||t.activeServer,onServerChange:ce})),S.createElement(Nr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Lw,{response:F,error:I,time:E})),S.createElement($w,{hasResponse:xe,params:Fe,operation:t,loading:p,onSubmit:he})))}const HI=(0,S.memo)($I)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},72887:(v,C,f)=>{var g=f(65234),b=f(83250),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function P(N){var D=-1,L=N==null?0:N.length;for(this.clear();++D<L;){var H=N[D];this.set(H[0],H[1])}}P.prototype.clear=g,P.prototype.delete=b,P.prototype.get=x,P.prototype.has=k,P.prototype.set=O,v.exports=P},70861:(v,C,f)=>{var g=f(83250),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var P=0,N=O.length;k!=null&&P<N;)k=k[b(O[P++])];return P&&P==N?k:void 0}v.exports=x},69823:(v,C,f)=>{var g=f(70861),b=f(91339),x=f(25151),k="[object Null]",O="[object Undefined]",P=g?g.toStringTag:void 0;function N(D){return D==null?D===void 0?O:k:P&&P in Object(D)?b(D):x(D)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,P=/^\[object .+?Constructor\]$/,N=Function.prototype,D=Object.prototype,L=N.toString,H=D.hasOwnProperty,J=RegExp("^"+L.call(H).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q(X){if(!x(X)||b(X))return!1;var G=g(X)?J:P;return G.test(k(X))}v.exports=q},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,P=g?g.prototype:void 0,N=P?P.toString:void 0;function D(L){if(typeof L=="string")return L;if(x(L))return b(L,D)+"";if(k(L))return N?N.call(L):"";var H=L+"";return H=="0"&&1/L==-O?"-0":H}v.exports=D},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(P,N){return g(P)?P:b(P,N)?[P]:x(k(P))}v.exports=O},1622:(v,C,f)=>{var g=f(83250),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var P=b(k,O);return g(P)?P:void 0}v.exports=x},91339:(v,C,f)=>{var g=f(70861),b=Object.prototype,x=b.hasOwnProperty,k=b.toString,O=g?g.toStringTag:void 0;function P(N){var D=x.call(N,O),L=N[O];try{N[O]=void 0;var H=!0}catch{}var J=k.call(N);return H&&(D?N[O]=L:delete N[O]),J}v.exports=P},67736:v=>{function C(f,g){return f?.[g]}v.exports=C},34440:(v,C,f)=>{var g=f(24545);function b(){this.__data__=g?g(null):{},this.size=0}v.exports=b},84108:v=>{function C(f){var g=this.has(f)&&delete this.__data__[f];return this.size-=g?1:0,g}v.exports=C},61085:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__",x=Object.prototype,k=x.hasOwnProperty;function O(P){var N=this.__data__;if(g){var D=N[P];return D===b?void 0:D}return k.call(N,P)?N[P]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var P=this.__data__;return g?P[O]!==void 0:x.call(P,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var P=this.__data__;return this.size+=this.has(k)?0:1,P[k]=g&&O===void 0?b:O,this}v.exports=x},5130:(v,C,f)=>{var g=f(55589),b=f(52624),x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/;function O(P,N){if(g(P))return!1;var D=typeof P;return D=="number"||D=="symbol"||D=="boolean"||P==null||b(P)?!0:k.test(P)||!x.test(P)||N!=null&&P in Object(N)}v.exports=O},58949:v=>{function C(f){var g=typeof f;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?f!=="__proto__":f===null}v.exports=C},28597:(v,C,f)=>{var g=f(1622),b=function(){var k=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}();function x(k){return!!b&&b in k}v.exports=x},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,f)=>{var g=f(18498),b=Array.prototype,x=b.splice;function k(O){var P=this.__data__,N=g(P,O);if(N<0)return!1;var D=P.length-1;return N==D?P.pop():x.call(P,N,1),--this.size,!0}v.exports=k},45828:(v,C,f)=>{var g=f(18498);function b(x){var k=this.__data__,O=g(k,x);return O<0?void 0:k[O][1]}v.exports=b},24115:(v,C,f)=>{var g=f(18498);function b(x){return g(this.__data__,x)>-1}v.exports=b},67690:(v,C,f)=>{var g=f(18498);function b(x,k){var O=this.__data__,P=g(O,x);return P<0?(++this.size,O.push([x,k])):O[P][1]=k,this}v.exports=b},39016:(v,C,f)=>{var g=f(85208),b=f(81998),x=f(72887);function k(){this.size=0,this.__data__={hash:new g,map:new(x||b),string:new g}}v.exports=k},62363:(v,C,f)=>{var g=f(77570);function b(x){var k=g(this,x).delete(x);return this.size-=k?1:0,k}v.exports=b},64348:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).get(x)}v.exports=b},53062:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).has(x)}v.exports=b},30262:(v,C,f)=>{var g=f(77570);function b(x,k){var O=g(this,x),P=O.size;return O.set(x,k),this.size+=O.size==P?0:1,this}v.exports=b},32924:(v,C,f)=>{var g=f(67997),b=500;function x(k){var O=g(k,function(N){return P.size===b&&P.clear(),N}),P=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},83250:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var P=[];return O.charCodeAt(0)===46&&P.push(""),O.replace(b,function(N,D,L,H){P.push(L?H.replace(x,"$1"):D||N)}),P});v.exports=k},86040:(v,C,f)=>{var g=f(52624),b=1/0;function x(k){if(typeof k=="string"||g(k))return k;var O=k+"";return O=="0"&&1/k==-b?"-0":O}v.exports=x},55784:v=>{var C=Function.prototype,f=C.toString;function g(b){if(b!=null){try{return f.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=g},58260:v=>{function C(f,g){return f===g||f!==f&&g!==g}v.exports=C},13546:(v,C,f)=>{var g=f(40548);function b(x,k,O){var P=x==null?void 0:g(x,k);return P===void 0?O:P}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,f)=>{var g=f(69823),b=f(93702),x="[object AsyncFunction]",k="[object Function]",O="[object GeneratorFunction]",P="[object Proxy]";function N(D){if(!b(D))return!1;var L=g(D);return L==k||L==O||L==x||L==P}v.exports=N},93702:v=>{function C(f){var g=typeof f;return f!=null&&(g=="object"||g=="function")}v.exports=C},50440:v=>{function C(f){return f!=null&&typeof f=="object"}v.exports=C},52624:(v,C,f)=>{var g=f(69823),b=f(50440),x="[object Symbol]";function k(O){return typeof O=="symbol"||b(O)&&g(O)==x}v.exports=k},67997:(v,C,f)=>{var g=f(95678),b="Expected a function";function x(k,O){if(typeof k!="function"||O!=null&&typeof O!="function")throw new TypeError(b);var P=function(){var N=arguments,D=O?O.apply(this,N):N[0],L=P.cache;if(L.has(D))return L.get(D);var H=k.apply(this,N);return P.cache=L.set(D,H)||L,H};return P.cache=new(x.Cache||g),P}x.Cache=g,v.exports=x},99835:(v,C,f)=>{var g=f(86245);function b(x){return x==null?"":g(x)}v.exports=b},14927:(v,C,f)=>{var g=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,x=g&&b&&typeof b.get=="function"?b.get:null,k=g&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,P=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&P&&typeof P.get=="function"?P.get:null,D=O&&Set.prototype.forEach,L=typeof WeakMap=="function"&&WeakMap.prototype,H=L?WeakMap.prototype.has:null,J=typeof WeakSet=="function"&&WeakSet.prototype,q=J?WeakSet.prototype.has:null,X=typeof WeakRef=="function"&&WeakRef.prototype,G=X?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,oe=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,z=String.prototype.slice,ne=String.prototype.replace,ie=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ue=RegExp.prototype.test,V=Array.prototype.concat,K=Array.prototype.join,le=Array.prototype.slice,ge=Math.floor,me=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ve=Object.getOwnPropertySymbols,We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,je=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ke=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===je||"symbol")?Symbol.toStringTag:null,Le=Object.prototype.propertyIsEnumerable,lt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Rt($,Z){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ue.call(/e/,Z))return Z;var He=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-ge(-$):ge($);if(_e!==$){var ct=String(_e),Pe=z.call(Z,ct.length+1);return ne.call(ct,He,"$&_")+"."+ne.call(ne.call(Pe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ne.call(Z,He,"$&_")}var Ot=f(65710),rr=Ot.custom,Xe=dr(rr)?rr:null;v.exports=function $(Z,He,_e,ct){var Pe=He||{};if(Dr(Pe,"quoteStyle")&&Pe.quoteStyle!=="single"&&Pe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Dr(Pe,"maxStringLength")&&(typeof Pe.maxStringLength=="number"?Pe.maxStringLength<0&&Pe.maxStringLength!==1/0:Pe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Qr=Dr(Pe,"customInspect")?Pe.customInspect:!0;if(typeof Qr!="boolean"&&Qr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Dr(Pe,"indent")&&Pe.indent!==null&&Pe.indent!==" "&&!(parseInt(Pe.indent,10)===Pe.indent&&Pe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Dr(Pe,"numericSeparator")&&typeof Pe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Sn=Pe.numericSeparator;if(typeof Z>"u")return"undefined";if(Z===null)return"null";if(typeof Z=="boolean")return Z?"true":"false";if(typeof Z=="string")return hi(Z,Pe);if(typeof Z=="number"){if(Z===0)return 1/0/Z>0?"0":"-0";var zt=String(Z);return Sn?Rt(Z,zt):zt}if(typeof Z=="bigint"){var Xr=String(Z)+"n";return Sn?Rt(Z,Xr):Xr}var Ps=typeof Pe.depth>"u"?5:Pe.depth;if(typeof _e>"u"&&(_e=0),_e>=Ps&&Ps>0&&typeof Z=="object")return Tt(Z)?"[Array]":"[Object]";var Bn=Ce(Pe,_e);if(typeof ct>"u")ct=[];else if(Jr(ct,Z)>=0)return"[Circular]";function mr(jn,Wi,Go){if(Wi&&(ct=le.call(ct),ct.push(Wi)),Go){var Ko={depth:Pe.depth};return Dr(Pe,"quoteStyle")&&(Ko.quoteStyle=Pe.quoteStyle),$(jn,Ko,_e+1,ct)}return $(jn,Pe,_e+1,ct)}if(typeof Z=="function"&&!De(Z)){var Wo=gr(Z),$o=Te(Z,mr);return"[Function"+(Wo?": "+Wo:" (anonymous)")+"]"+($o.length>0?" { "+K.call($o,", ")+" }":"")}if(dr(Z)){var Ms=je?ne.call(String(Z),/^(Symbol\(.*\))_[^)]*$/,"$1"):We.call(Z);return typeof Z=="object"&&!je?$r(Ms):Ms}if(Nn(Z)){for(var Fn="<"+ae.call(String(Z.nodeName)),Li=Z.attributes||[],pi=0;pi<Li.length;pi++)Fn+=" "+Li[pi].name+"="+Et(wt(Li[pi].value),"double",Pe);return Fn+=">",Z.childNodes&&Z.childNodes.length&&(Fn+="..."),Fn+="</"+ae.call(String(Z.nodeName))+">",Fn}if(Tt(Z)){if(Z.length===0)return"[]";var Bi=Te(Z,mr);return Bn&&!Ze(Bi)?"["+Ne(Bi,Bn)+"]":"[ "+K.call(Bi,", ")+" ]"}if(St(Z)){var Is=Te(Z,mr);return!("cause"in Error.prototype)&&"cause"in Z&&!Le.call(Z,"cause")?"{ ["+String(Z)+"] "+K.call(V.call("[cause]: "+mr(Z.cause),Is),", ")+" }":Is.length===0?"["+String(Z)+"]":"{ ["+String(Z)+"] "+K.call(Is,", ")+" }"}if(typeof Z=="object"&&Qr){if(Xe&&typeof Z[Xe]=="function"&&Ot)return Ot(Z,{depth:Ps-_e});if(Qr!=="symbol"&&typeof Z.inspect=="function")return Z.inspect()}if(gt(Z)){var Ho=[];return k&&k.call(Z,function(jn,Wi){Ho.push(mr(Wi,Z,!0)+" => "+mr(jn,Z))}),di("Map",x.call(Z),Ho,Bn)}if(xn(Z)){var zo=[];return D&&D.call(Z,function(jn){zo.push(mr(jn,Z))}),di("Set",N.call(Z),zo,Bn)}if(Dn(Z))return Ln("WeakMap");if(wn(Z))return Ln("WeakSet");if(fi(Z))return Ln("WeakRef");if(pt(Z))return $r(mr(Number(Z)));if(Wr(Z))return $r(mr(me.call(Z)));if(Ir(Z))return $r(te.call(Z));if(Ht(Z))return $r(mr(String(Z)));if(!hr(Z)&&!De(Z)){var Fi=Te(Z,mr),Uo=lt?lt(Z)===Object.prototype:Z instanceof Object||Z.constructor===Object,ji=Z instanceof Object?"":"null prototype",Vi=!Uo&&Ke&&Object(Z)===Z&&Ke in Z?z.call(pr(Z),8,-1):ji?"Object":"",Jl=Uo||typeof Z.constructor!="function"?"":Z.constructor.name?Z.constructor.name+" ":"",Ds=Jl+(Vi||ji?"["+K.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Ds+"{}":Bn?Ds+"{"+Ne(Fi,Bn)+"}":Ds+"{ "+K.call(Fi,", ")+" }"}return String(Z)};function Et($,Z,He){var _e=(He.quoteStyle||Z)==="double"?'"':"'";return _e+$+_e}function wt($){return ne.call(String($),/"/g,""")}function Tt($){return pr($)==="[object Array]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function hr($){return pr($)==="[object Date]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function De($){return pr($)==="[object RegExp]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function St($){return pr($)==="[object Error]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function Ht($){return pr($)==="[object String]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function pt($){return pr($)==="[object Number]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function Ir($){return pr($)==="[object Boolean]"&&(!Ke||!(typeof $=="object"&&Ke in $))}function dr($){if(je)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!We)return!1;try{return We.call($),!0}catch{}return!1}function Wr($){if(!$||typeof $!="object"||!me)return!1;try{return me.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Dr($,Z){return Ri.call($,Z)}function pr($){return oe.call($)}function gr($){if($.name)return $.name;var Z=ee.call(R.call($),/^function\s*([\w$]+)/);return Z?Z[1]:null}function Jr($,Z){if($.indexOf)return $.indexOf(Z);for(var He=0,_e=$.length;He<_e;He++)if($[He]===Z)return He;return-1}function gt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function Dn($){if(!H||!$||typeof $!="object")return!1;try{H.call($,H);try{q.call($,q)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function fi($){if(!G||!$||typeof $!="object")return!1;try{return G.call($),!0}catch{}return!1}function xn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function wn($){if(!q||!$||typeof $!="object")return!1;try{q.call($,q);try{H.call($,H)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Nn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function hi($,Z){if($.length>Z.maxStringLength){var He=$.length-Z.maxStringLength,_e="... "+He+" more character"+(He>1?"s":"");return hi(z.call($,0,Z.maxStringLength),Z)+_e}var ct=ne.call(ne.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Rn);return Et(ct,"single",Z)}function Rn($){var Z=$.charCodeAt(0),He={8:"b",9:"t",10:"n",12:"f",13:"r"}[Z];return He?"\\"+He:"\\x"+(Z<16?"0":"")+ie.call(Z.toString(16))}function $r($){return"Object("+$+")"}function Ln($){return $+" { ? }"}function di($,Z,He,_e){var ct=_e?Ne(He,_e):K.call(He,", ");return $+" ("+Z+") {"+ct+"}"}function Ze($){for(var Z=0;Z<$.length;Z++)if(Jr($[Z],`
|
|
413
|
+
`)>=0)return!1;return!0}function Ce($,Z){var He;if($.indent===" ")He=" ";else if(typeof $.indent=="number"&&$.indent>0)He=K.call(Array($.indent+1)," ");else return null;return{base:He,prev:K.call(Array(Z+1),He)}}function Ne($,Z){if($.length===0)return"";var He=`
|
|
414
|
+
`+Z.prev+Z.base;return He+K.call($,","+He)+`
|
|
415
|
+
`+Z.prev}function Te($,Z){var He=Tt($),_e=[];if(He){_e.length=$.length;for(var ct=0;ct<$.length;ct++)_e[ct]=Dr($,ct)?Z($[ct],$):""}var Pe=typeof ve=="function"?ve($):[],Qr;if(je){Qr={};for(var Sn=0;Sn<Pe.length;Sn++)Qr["$"+Pe[Sn]]=Pe[Sn]}for(var zt in $)Dr($,zt)&&(He&&String(Number(zt))===zt&&zt<$.length||je&&Qr["$"+zt]instanceof Symbol||(ue.call(/[^\w$]/,zt)?_e.push(Z(zt,$)+": "+Z($[zt],$)):_e.push(zt+": "+Z($[zt],$))));if(typeof ve=="function")for(var Xr=0;Xr<Pe.length;Xr++)Le.call($,Pe[Xr])&&_e.push("["+Z(Pe[Xr])+"]: "+Z($[Pe[Xr]],$));return _e}},83949:v=>{"use strict";var C=String.prototype.replace,f=/%20/g,g={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:g.RFC3986,formatters:{RFC1738:function(b){return C.call(b,f,"+")},RFC3986:function(b){return String(b)}},RFC1738:g.RFC1738,RFC3986:g.RFC3986}},67905:(v,C,f)=>{"use strict";var g=f(85095),b=f(95990),x=f(83949);v.exports={formats:x,parse:b,stringify:g}},95990:(v,C,f)=>{"use strict";var g=f(37748),b=Object.prototype.hasOwnProperty,x=Array.isArray,k={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:g.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O=function(X){return X.replace(/&#(\d+);/g,function(G,te){return String.fromCharCode(parseInt(te,10))})},P=function(X,G){return X&&typeof X=="string"&&G.comma&&X.indexOf(",")>-1?X.split(","):X},N="utf8=%26%2310003%3B",D="utf8=%E2%9C%93",L=function(G,te){var oe={__proto__:null},R=te.ignoreQueryPrefix?G.replace(/^\?/,""):G,ee=te.parameterLimit===1/0?void 0:te.parameterLimit,z=R.split(te.delimiter,ee),ne=-1,ie,ae=te.charset;if(te.charsetSentinel)for(ie=0;ie<z.length;++ie)z[ie].indexOf("utf8=")===0&&(z[ie]===D?ae="utf-8":z[ie]===N&&(ae="iso-8859-1"),ne=ie,ie=z.length);for(ie=0;ie<z.length;++ie)if(ie!==ne){var ue=z[ie],V=ue.indexOf("]="),K=V===-1?ue.indexOf("="):V+1,le,ge;K===-1?(le=te.decoder(ue,k.decoder,ae,"key"),ge=te.strictNullHandling?null:""):(le=te.decoder(ue.slice(0,K),k.decoder,ae,"key"),ge=g.maybeMap(P(ue.slice(K+1),te),function(me){return te.decoder(me,k.decoder,ae,"value")})),ge&&te.interpretNumericEntities&&ae==="iso-8859-1"&&(ge=O(ge)),ue.indexOf("[]=")>-1&&(ge=x(ge)?[ge]:ge),b.call(oe,le)?oe[le]=g.combine(oe[le],ge):oe[le]=ge}return oe},H=function(X,G,te,oe){for(var R=oe?G:P(G,te),ee=X.length-1;ee>=0;--ee){var z,ne=X[ee];if(ne==="[]"&&te.parseArrays)z=[].concat(R);else{z=te.plainObjects?Object.create(null):{};var ie=ne.charAt(0)==="["&&ne.charAt(ne.length-1)==="]"?ne.slice(1,-1):ne,ae=parseInt(ie,10);!te.parseArrays&&ie===""?z={0:R}:!isNaN(ae)&&ne!==ie&&String(ae)===ie&&ae>=0&&te.parseArrays&&ae<=te.arrayLimit?(z=[],z[ae]=R):ie!=="__proto__"&&(z[ie]=R)}R=z}return R},J=function(G,te,oe,R){if(G){var ee=oe.allowDots?G.replace(/\.([^.[]+)/g,"[$1]"):G,z=/(\[[^[\]]*])/,ne=/(\[[^[\]]*])/g,ie=oe.depth>0&&z.exec(ee),ae=ie?ee.slice(0,ie.index):ee,ue=[];if(ae){if(!oe.plainObjects&&b.call(Object.prototype,ae)&&!oe.allowPrototypes)return;ue.push(ae)}for(var V=0;oe.depth>0&&(ie=ne.exec(ee))!==null&&V<oe.depth;){if(V+=1,!oe.plainObjects&&b.call(Object.prototype,ie[1].slice(1,-1))&&!oe.allowPrototypes)return;ue.push(ie[1])}return ie&&ue.push("["+ee.slice(ie.index)+"]"),H(ue,te,oe,R)}},q=function(G){if(!G)return k;if(G.decoder!==null&&G.decoder!==void 0&&typeof G.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof G.charset<"u"&&G.charset!=="utf-8"&&G.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var te=typeof G.charset>"u"?k.charset:G.charset;return{allowDots:typeof G.allowDots>"u"?k.allowDots:!!G.allowDots,allowPrototypes:typeof G.allowPrototypes=="boolean"?G.allowPrototypes:k.allowPrototypes,allowSparse:typeof G.allowSparse=="boolean"?G.allowSparse:k.allowSparse,arrayLimit:typeof G.arrayLimit=="number"?G.arrayLimit:k.arrayLimit,charset:te,charsetSentinel:typeof G.charsetSentinel=="boolean"?G.charsetSentinel:k.charsetSentinel,comma:typeof G.comma=="boolean"?G.comma:k.comma,decoder:typeof G.decoder=="function"?G.decoder:k.decoder,delimiter:typeof G.delimiter=="string"||g.isRegExp(G.delimiter)?G.delimiter:k.delimiter,depth:typeof G.depth=="number"||G.depth===!1?+G.depth:k.depth,ignoreQueryPrefix:G.ignoreQueryPrefix===!0,interpretNumericEntities:typeof G.interpretNumericEntities=="boolean"?G.interpretNumericEntities:k.interpretNumericEntities,parameterLimit:typeof G.parameterLimit=="number"?G.parameterLimit:k.parameterLimit,parseArrays:G.parseArrays!==!1,plainObjects:typeof G.plainObjects=="boolean"?G.plainObjects:k.plainObjects,strictNullHandling:typeof G.strictNullHandling=="boolean"?G.strictNullHandling:k.strictNullHandling}};v.exports=function(X,G){var te=q(G);if(X===""||X===null||typeof X>"u")return te.plainObjects?Object.create(null):{};for(var oe=typeof X=="string"?L(X,te):X,R=te.plainObjects?Object.create(null):{},ee=Object.keys(oe),z=0;z<ee.length;++z){var ne=ee[z],ie=J(ne,oe[ne],te,typeof X=="string");R=g.merge(R,ie,te)}return te.allowSparse===!0?R:g.compact(R)}},85095:(v,C,f)=>{"use strict";var g=f(44852),b=f(37748),x=f(83949),k=Object.prototype.hasOwnProperty,O={brackets:function(R){return R+"[]"},comma:"comma",indices:function(R,ee){return R+"["+ee+"]"},repeat:function(R){return R}},P=Array.isArray,N=Array.prototype.push,D=function(oe,R){N.apply(oe,P(R)?R:[R])},L=Date.prototype.toISOString,H=x.default,J={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:H,formatter:x.formatters[H],indices:!1,serializeDate:function(R){return L.call(R)},skipNulls:!1,strictNullHandling:!1},q=function(R){return typeof R=="string"||typeof R=="number"||typeof R=="boolean"||typeof R=="symbol"||typeof R=="bigint"},X={},G=function oe(R,ee,z,ne,ie,ae,ue,V,K,le,ge,me,ve,We,je,Ke){for(var Le=R,lt=Ke,Rt=0,Ot=!1;(lt=lt.get(X))!==void 0&&!Ot;){var rr=lt.get(R);if(Rt+=1,typeof rr<"u"){if(rr===Rt)throw new RangeError("Cyclic object value");Ot=!0}typeof lt.get(X)>"u"&&(Rt=0)}if(typeof V=="function"?Le=V(ee,Le):Le instanceof Date?Le=ge(Le):z==="comma"&&P(Le)&&(Le=b.maybeMap(Le,function(dr){return dr instanceof Date?ge(dr):dr})),Le===null){if(ie)return ue&&!We?ue(ee,J.encoder,je,"key",me):ee;Le=""}if(q(Le)||b.isBuffer(Le)){if(ue){var Xe=We?ee:ue(ee,J.encoder,je,"key",me);return[ve(Xe)+"="+ve(ue(Le,J.encoder,je,"value",me))]}return[ve(ee)+"="+ve(String(Le))]}var Et=[];if(typeof Le>"u")return Et;var wt;if(z==="comma"&&P(Le))We&&ue&&(Le=b.maybeMap(Le,ue)),wt=[{value:Le.length>0?Le.join(",")||null:void 0}];else if(P(V))wt=V;else{var Tt=Object.keys(Le);wt=K?Tt.sort(K):Tt}for(var hr=ne&&P(Le)&&Le.length===1?ee+"[]":ee,De=0;De<wt.length;++De){var St=wt[De],Ht=typeof St=="object"&&typeof St.value<"u"?St.value:Le[St];if(!(ae&&Ht===null)){var pt=P(Le)?typeof z=="function"?z(hr,St):hr:hr+(le?"."+St:"["+St+"]");Ke.set(R,Rt);var Ir=g();Ir.set(X,Ke),D(Et,oe(Ht,pt,z,ne,ie,ae,z==="comma"&&We&&P(Le)?null:ue,V,K,le,ge,me,ve,We,je,Ir))}}return Et},te=function(R){if(!R)return J;if(R.encoder!==null&&typeof R.encoder<"u"&&typeof R.encoder!="function")throw new TypeError("Encoder has to be a function.");var ee=R.charset||J.charset;if(typeof R.charset<"u"&&R.charset!=="utf-8"&&R.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var z=x.default;if(typeof R.format<"u"){if(!k.call(x.formatters,R.format))throw new TypeError("Unknown format option provided.");z=R.format}var ne=x.formatters[z],ie=J.filter;return(typeof R.filter=="function"||P(R.filter))&&(ie=R.filter),{addQueryPrefix:typeof R.addQueryPrefix=="boolean"?R.addQueryPrefix:J.addQueryPrefix,allowDots:typeof R.allowDots>"u"?J.allowDots:!!R.allowDots,charset:ee,charsetSentinel:typeof R.charsetSentinel=="boolean"?R.charsetSentinel:J.charsetSentinel,delimiter:typeof R.delimiter>"u"?J.delimiter:R.delimiter,encode:typeof R.encode=="boolean"?R.encode:J.encode,encoder:typeof R.encoder=="function"?R.encoder:J.encoder,encodeValuesOnly:typeof R.encodeValuesOnly=="boolean"?R.encodeValuesOnly:J.encodeValuesOnly,filter:ie,format:z,formatter:ne,serializeDate:typeof R.serializeDate=="function"?R.serializeDate:J.serializeDate,skipNulls:typeof R.skipNulls=="boolean"?R.skipNulls:J.skipNulls,sort:typeof R.sort=="function"?R.sort:null,strictNullHandling:typeof R.strictNullHandling=="boolean"?R.strictNullHandling:J.strictNullHandling}};v.exports=function(oe,R){var ee=oe,z=te(R),ne,ie;typeof z.filter=="function"?(ie=z.filter,ee=ie("",ee)):P(z.filter)&&(ie=z.filter,ne=ie);var ae=[];if(typeof ee!="object"||ee===null)return"";var ue;R&&R.arrayFormat in O?ue=R.arrayFormat:R&&"indices"in R?ue=R.indices?"indices":"repeat":ue="indices";var V=O[ue];if(R&&"commaRoundTrip"in R&&typeof R.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var K=V==="comma"&&R&&R.commaRoundTrip;ne||(ne=Object.keys(ee)),z.sort&&ne.sort(z.sort);for(var le=g(),ge=0;ge<ne.length;++ge){var me=ne[ge];z.skipNulls&&ee[me]===null||D(ae,G(ee[me],me,V,K,z.strictNullHandling,z.skipNulls,z.encode?z.encoder:null,z.filter,z.sort,z.allowDots,z.serializeDate,z.format,z.formatter,z.encodeValuesOnly,z.charset,le))}var ve=ae.join(z.delimiter),We=z.addQueryPrefix===!0?"?":"";return z.charsetSentinel&&(z.charset==="iso-8859-1"?We+="utf8=%26%2310003%3B&":We+="utf8=%E2%9C%93&"),ve.length>0?We+ve:""}},37748:(v,C,f)=>{"use strict";var g=f(83949),b=Object.prototype.hasOwnProperty,x=Array.isArray,k=function(){for(var oe=[],R=0;R<256;++R)oe.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return oe}(),O=function(R){for(;R.length>1;){var ee=R.pop(),z=ee.obj[ee.prop];if(x(z)){for(var ne=[],ie=0;ie<z.length;++ie)typeof z[ie]<"u"&&ne.push(z[ie]);ee.obj[ee.prop]=ne}}},P=function(R,ee){for(var z=ee&&ee.plainObjects?Object.create(null):{},ne=0;ne<R.length;++ne)typeof R[ne]<"u"&&(z[ne]=R[ne]);return z},N=function oe(R,ee,z){if(!ee)return R;if(typeof ee!="object"){if(x(R))R.push(ee);else if(R&&typeof R=="object")(z&&(z.plainObjects||z.allowPrototypes)||!b.call(Object.prototype,ee))&&(R[ee]=!0);else return[R,ee];return R}if(!R||typeof R!="object")return[R].concat(ee);var ne=R;return x(R)&&!x(ee)&&(ne=P(R,z)),x(R)&&x(ee)?(ee.forEach(function(ie,ae){if(b.call(R,ae)){var ue=R[ae];ue&&typeof ue=="object"&&ie&&typeof ie=="object"?R[ae]=oe(ue,ie,z):R.push(ie)}else R[ae]=ie}),R):Object.keys(ee).reduce(function(ie,ae){var ue=ee[ae];return b.call(ie,ae)?ie[ae]=oe(ie[ae],ue,z):ie[ae]=ue,ie},ne)},D=function(R,ee){return Object.keys(ee).reduce(function(z,ne){return z[ne]=ee[ne],z},R)},L=function(oe,R,ee){var z=oe.replace(/\+/g," ");if(ee==="iso-8859-1")return z.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(z)}catch{return z}},H=function(R,ee,z,ne,ie){if(R.length===0)return R;var ae=R;if(typeof R=="symbol"?ae=Symbol.prototype.toString.call(R):typeof R!="string"&&(ae=String(R)),z==="iso-8859-1")return escape(ae).replace(/%u[0-9a-f]{4}/gi,function(le){return"%26%23"+parseInt(le.slice(2),16)+"%3B"});for(var ue="",V=0;V<ae.length;++V){var K=ae.charCodeAt(V);if(K===45||K===46||K===95||K===126||K>=48&&K<=57||K>=65&&K<=90||K>=97&&K<=122||ie===g.RFC1738&&(K===40||K===41)){ue+=ae.charAt(V);continue}if(K<128){ue=ue+k[K];continue}if(K<2048){ue=ue+(k[192|K>>6]+k[128|K&63]);continue}if(K<55296||K>=57344){ue=ue+(k[224|K>>12]+k[128|K>>6&63]+k[128|K&63]);continue}V+=1,K=65536+((K&1023)<<10|ae.charCodeAt(V)&1023),ue+=k[240|K>>18]+k[128|K>>12&63]+k[128|K>>6&63]+k[128|K&63]}return ue},J=function(R){for(var ee=[{obj:{o:R},prop:"o"}],z=[],ne=0;ne<ee.length;++ne)for(var ie=ee[ne],ae=ie.obj[ie.prop],ue=Object.keys(ae),V=0;V<ue.length;++V){var K=ue[V],le=ae[K];typeof le=="object"&&le!==null&&z.indexOf(le)===-1&&(ee.push({obj:ae,prop:K}),z.push(le))}return O(ee),R},q=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},X=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},G=function(R,ee){return[].concat(R,ee)},te=function(R,ee){if(x(R)){for(var z=[],ne=0;ne<R.length;ne+=1)z.push(ee(R[ne]));return z}return ee(R)};v.exports={arrayToObject:P,assign:D,combine:G,compact:J,decode:L,encode:H,isBuffer:X,isRegExp:q,maybeMap:te,merge:N}},95472:(v,C,f)=>{"use strict";var g;/** @license React v17.0.2
|
|
415
416
|
* react-jsx-runtime.production.min.js
|
|
416
417
|
*
|
|
417
418
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
418
419
|
*
|
|
419
420
|
* This source code is licensed under the MIT license found in the
|
|
420
421
|
* LICENSE file in the root directory of this source tree.
|
|
421
|
-
*/f(52458);var b=f(29901),x=60103;if(g=60107,typeof Symbol=="function"&&Symbol.for){var k=Symbol.for;x=k("react.element"),g=k("react.fragment")}var O=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
422
|
+
*/f(52458);var b=f(29901),x=60103;if(g=60107,typeof Symbol=="function"&&Symbol.for){var k=Symbol.for;x=k("react.element"),g=k("react.fragment")}var O=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,P=Object.prototype.hasOwnProperty,N={key:!0,ref:!0,__self:!0,__source:!0};function D(L,H,J){var q,X={},G=null,te=null;J!==void 0&&(G=""+J),H.key!==void 0&&(G=""+H.key),H.ref!==void 0&&(te=H.ref);for(q in H)P.call(H,q)&&!N.hasOwnProperty(q)&&(X[q]=H[q]);if(L&&L.defaultProps)for(q in H=L.defaultProps,H)X[q]===void 0&&(X[q]=H[q]);return{$$typeof:x,type:L,key:G,ref:te,props:X,_owner:O.current}}C.jsx=D,g=D},61250:(v,C,f)=>{"use strict";v.exports=f(95472)},44852:(v,C,f)=>{"use strict";var g=f(71013),b=f(2864),x=f(14927),k=g("%TypeError%"),O=g("%WeakMap%",!0),P=g("%Map%",!0),N=b("WeakMap.prototype.get",!0),D=b("WeakMap.prototype.set",!0),L=b("WeakMap.prototype.has",!0),H=b("Map.prototype.get",!0),J=b("Map.prototype.set",!0),q=b("Map.prototype.has",!0),X=function(R,ee){for(var z=R,ne;(ne=z.next)!==null;z=ne)if(ne.key===ee)return z.next=ne.next,ne.next=R.next,R.next=ne,ne},G=function(R,ee){var z=X(R,ee);return z&&z.value},te=function(R,ee,z){var ne=X(R,ee);ne?ne.value=z:R.next={key:ee,next:R.next,value:z}},oe=function(R,ee){return!!X(R,ee)};v.exports=function(){var ee,z,ne,ie={assert:function(ae){if(!ie.has(ae))throw new k("Side channel does not contain "+x(ae))},get:function(ae){if(O&&ae&&(typeof ae=="object"||typeof ae=="function")){if(ee)return N(ee,ae)}else if(P){if(z)return H(z,ae)}else if(ne)return G(ne,ae)},has:function(ae){if(O&&ae&&(typeof ae=="object"||typeof ae=="function")){if(ee)return L(ee,ae)}else if(P){if(z)return q(z,ae)}else if(ne)return oe(ne,ae);return!1},set:function(ae,ue){O&&ae&&(typeof ae=="object"||typeof ae=="function")?(ee||(ee=new O),D(ee,ae,ue)):P?(z||(z=new P),J(z,ae,ue)):(ne||(ne={key:{},next:null}),te(ne,ae,ue))}};return ie}},65710:()=>{},93652:(v,C,f)=>{v.exports=f(24018)},10017:(v,C,f)=>{v.exports=f(27411)},34961:(v,C,f)=>{v.exports=f(79155)},86751:(v,C,f)=>{v.exports=f(13375)},12953:(v,C,f)=>{v.exports=f(95442)},11099:(v,C,f)=>{v.exports=f(55334)},86351:(v,C,f)=>{v.exports=f(48261)},70762:(v,C,f)=>{v.exports=f(92864)},10954:(v,C,f)=>{v.exports=f(27923)},55839:(v,C,f)=>{v.exports=f(89225)},23422:(v,C,f)=>{v.exports=f(95281)},47319:(v,C,f)=>{v.exports=f(55468)}}]);
|