@matdata/yasr 5.20.3 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/yasr.min.js CHANGED
@@ -1,50 +1,62 @@
1
- "use strict";var Yasr=(()=>{var mb=Object.create;var ka=Object.defineProperty;var bb=Object.getOwnPropertyDescriptor;var vb=Object.getOwnPropertyNames;var yb=Object.getPrototypeOf,xb=Object.prototype.hasOwnProperty;var at=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports),Tb=(r,n)=>{for(var a in n)ka(r,a,{get:n[a],enumerable:!0})},Uc=(r,n,a,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of vb(n))!xb.call(r,c)&&c!==a&&ka(r,c,{get:()=>n[c],enumerable:!(l=bb(n,c))||l.enumerable});return r};var Ar=(r,n,a)=>(a=r!=null?mb(yb(r)):{},Uc(n||!r||!r.__esModule?ka(a,"default",{value:r,enumerable:!0}):a,r)),Ib=r=>Uc(ka({},"__esModule",{value:!0}),r);var Hc=at((NR,Ll)=>{"use strict";var Si=typeof Reflect=="object"?Reflect:null,kc=Si&&typeof Si.apply=="function"?Si.apply:function(n,a,l){return Function.prototype.apply.call(n,a,l)},Ma;Si&&typeof Si.ownKeys=="function"?Ma=Si.ownKeys:Object.getOwnPropertySymbols?Ma=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Ma=function(n){return Object.getOwnPropertyNames(n)};function Eb(r){console&&console.warn&&console.warn(r)}var Gc=Number.isNaN||function(n){return n!==n};function tt(){tt.init.call(this)}Ll.exports=tt;Ll.exports.once=_b;tt.EventEmitter=tt;tt.prototype._events=void 0;tt.prototype._eventsCount=0;tt.prototype._maxListeners=void 0;var Mc=10;function Ga(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(tt,"defaultMaxListeners",{enumerable:!0,get:function(){return Mc},set:function(r){if(typeof r!="number"||r<0||Gc(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Mc=r}});tt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};tt.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||Gc(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function Oc(r){return r._maxListeners===void 0?tt.defaultMaxListeners:r._maxListeners}tt.prototype.getMaxListeners=function(){return Oc(this)};tt.prototype.emit=function(n){for(var a=[],l=1;l<arguments.length;l++)a.push(arguments[l]);var c=n==="error",p=this._events;if(p!==void 0)c=c&&p.error===void 0;else if(!c)return!1;if(c){var g;if(a.length>0&&(g=a[0]),g instanceof Error)throw g;var y=new Error("Unhandled error."+(g?" ("+g.message+")":""));throw y.context=g,y}var T=p[n];if(T===void 0)return!1;if(typeof T=="function")kc(T,this,a);else for(var U=T.length,A=Qc(T,U),l=0;l<U;++l)kc(A[l],this,a);return!0};function Wc(r,n,a,l){var c,p,g;if(Ga(a),p=r._events,p===void 0?(p=r._events=Object.create(null),r._eventsCount=0):(p.newListener!==void 0&&(r.emit("newListener",n,a.listener?a.listener:a),p=r._events),g=p[n]),g===void 0)g=p[n]=a,++r._eventsCount;else if(typeof g=="function"?g=p[n]=l?[a,g]:[g,a]:l?g.unshift(a):g.push(a),c=Oc(r),c>0&&g.length>c&&!g.warned){g.warned=!0;var y=new Error("Possible EventEmitter memory leak detected. "+g.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");y.name="MaxListenersExceededWarning",y.emitter=r,y.type=n,y.count=g.length,Eb(y)}return r}tt.prototype.addListener=function(n,a){return Wc(this,n,a,!1)};tt.prototype.on=tt.prototype.addListener;tt.prototype.prependListener=function(n,a){return Wc(this,n,a,!0)};function Cb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Dc(r,n,a){var l={fired:!1,wrapFn:void 0,target:r,type:n,listener:a},c=Cb.bind(l);return c.listener=a,l.wrapFn=c,c}tt.prototype.once=function(n,a){return Ga(a),this.on(n,Dc(this,n,a)),this};tt.prototype.prependOnceListener=function(n,a){return Ga(a),this.prependListener(n,Dc(this,n,a)),this};tt.prototype.removeListener=function(n,a){var l,c,p,g,y;if(Ga(a),c=this._events,c===void 0)return this;if(l=c[n],l===void 0)return this;if(l===a||l.listener===a)--this._eventsCount===0?this._events=Object.create(null):(delete c[n],c.removeListener&&this.emit("removeListener",n,l.listener||a));else if(typeof l!="function"){for(p=-1,g=l.length-1;g>=0;g--)if(l[g]===a||l[g].listener===a){y=l[g].listener,p=g;break}if(p<0)return this;p===0?l.shift():Ab(l,p),l.length===1&&(c[n]=l[0]),c.removeListener!==void 0&&this.emit("removeListener",n,y||a)}return this};tt.prototype.off=tt.prototype.removeListener;tt.prototype.removeAllListeners=function(n){var a,l,c;if(l=this._events,l===void 0)return this;if(l.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):l[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete l[n]),this;if(arguments.length===0){var p=Object.keys(l),g;for(c=0;c<p.length;++c)g=p[c],g!=="removeListener"&&this.removeAllListeners(g);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(a=l[n],typeof a=="function")this.removeListener(n,a);else if(a!==void 0)for(c=a.length-1;c>=0;c--)this.removeListener(n,a[c]);return this};function Zc(r,n,a){var l=r._events;if(l===void 0)return[];var c=l[n];return c===void 0?[]:typeof c=="function"?a?[c.listener||c]:[c]:a?Rb(c):Qc(c,c.length)}tt.prototype.listeners=function(n){return Zc(this,n,!0)};tt.prototype.rawListeners=function(n){return Zc(this,n,!1)};tt.listenerCount=function(r,n){return typeof r.listenerCount=="function"?r.listenerCount(n):Vc.call(r,n)};tt.prototype.listenerCount=Vc;function Vc(r){var n=this._events;if(n!==void 0){var a=n[r];if(typeof a=="function")return 1;if(a!==void 0)return a.length}return 0}tt.prototype.eventNames=function(){return this._eventsCount>0?Ma(this._events):[]};function Qc(r,n){for(var a=new Array(n),l=0;l<n;++l)a[l]=r[l];return a}function Ab(r,n){for(;n+1<r.length;n++)r[n]=r[n+1];r.pop()}function Rb(r){for(var n=new Array(r.length),a=0;a<n.length;++a)n[a]=r[a].listener||r[a];return n}function _b(r,n){return new Promise(function(a,l){function c(g){r.removeListener(n,p),l(g)}function p(){typeof r.removeListener=="function"&&r.removeListener("error",c),a([].slice.call(arguments))}Pc(r,n,p,{once:!0}),n!=="error"&&Nb(r,c,{once:!0})})}function Nb(r,n,a){typeof r.on=="function"&&Pc(r,"error",n,a)}function Pc(r,n,a,l){if(typeof r.on=="function")l.once?r.once(n,a):r.on(n,a);else if(typeof r.addEventListener=="function")r.addEventListener(n,function c(p){l.once&&r.removeEventListener(n,c),a(p)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}});var $n=at((ck,Lp)=>{var ql=IC(),yC=EC(),xC=CC(),TC=typeof window<"u"?window:global;Lp.exports={assign:ql,create:yC,trim:xC,bind:AC,slice:Kl,each:wp,map:RC,pluck:$l,isList:eu,isFunction:_C,isObject:NC,Global:TC};function IC(){return Object.assign?Object.assign:function(n,a,l,c){for(var p=1;p<arguments.length;p++)wp(Object(arguments[p]),function(g,y){n[y]=g});return n}}function EC(){if(Object.create)return function(a,l,c,p){var g=Kl(arguments,1);return ql.apply(this,[Object.create(a)].concat(g))};{let n=function(){};var r=n;return function(l,c,p,g){var y=Kl(arguments,1);return n.prototype=l,ql.apply(this,[new n].concat(y))}}}function CC(){return String.prototype.trim?function(n){return String.prototype.trim.call(n)}:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function AC(r,n){return function(){return n.apply(r,Array.prototype.slice.call(arguments,0))}}function Kl(r,n){return Array.prototype.slice.call(r,n||0)}function wp(r,n){$l(r,function(a,l){return n(a,l),!1})}function RC(r,n){var a=eu(r)?[]:{};return $l(r,function(l,c){return a[c]=n(l,c),!1}),a}function $l(r,n){if(eu(r)){for(var a=0;a<r.length;a++)if(n(r[a],a))return r[a]}else for(var l in r)if(r.hasOwnProperty(l)&&n(r[l],l))return r[l]}function eu(r){return r!=null&&typeof r!="function"&&typeof r.length=="number"}function _C(r){return r&&{}.toString.call(r)==="[object Function]"}function NC(r){return r&&{}.toString.call(r)==="[object Object]"}});var Bp=at((dk,Fp)=>{var Wn=$n(),SC=Wn.slice,wC=Wn.pluck,Xi=Wn.each,LC=Wn.bind,FC=Wn.create,tu=Wn.isList,ru=Wn.isFunction,BC=Wn.isObject;Fp.exports={createStore:nu};var UC={version:"2.0.12",enabled:!1,get:function(r,n){var a=this.storage.read(this._namespacePrefix+r);return this._deserialize(a,n)},set:function(r,n){return n===void 0?this.remove(r):(this.storage.write(this._namespacePrefix+r,this._serialize(n)),n)},remove:function(r){this.storage.remove(this._namespacePrefix+r)},each:function(r){var n=this;this.storage.each(function(a,l){r.call(n,n._deserialize(a),(l||"").replace(n._namespaceRegexp,""))})},clearAll:function(){this.storage.clearAll()},hasNamespace:function(r){return this._namespacePrefix=="__storejs_"+r+"_"},createStore:function(){return nu.apply(this,arguments)},addPlugin:function(r){this._addPlugin(r)},namespace:function(r){return nu(this.storage,this.plugins,r)}};function kC(){var r=typeof console>"u"?null:console;if(r){var n=r.warn?r.warn:r.log;n.apply(r,arguments)}}function nu(r,n,a){a||(a=""),r&&!tu(r)&&(r=[r]),n&&!tu(n)&&(n=[n]);var l=a?"__storejs_"+a+"_":"",c=a?new RegExp("^"+l):null,p=/^[a-zA-Z0-9_\-]*$/;if(!p.test(a))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var g={_namespacePrefix:l,_namespaceRegexp:c,_testStorage:function(T){try{var U="__storejs__test__";T.write(U,U);var A=T.read(U)===U;return T.remove(U),A}catch{return!1}},_assignPluginFnProp:function(T,U){var A=this[U];this[U]=function(){var M=SC(arguments,0),X=this;function S(){if(A)return Xi(arguments,function(_,G){M[G]=_}),A.apply(X,M)}var Z=[S].concat(M);return T.apply(X,Z)}},_serialize:function(T){return JSON.stringify(T)},_deserialize:function(T,U){if(!T)return U;var A="";try{A=JSON.parse(T)}catch{A=T}return A!==void 0?A:U},_addStorage:function(T){this.enabled||this._testStorage(T)&&(this.storage=T,this.enabled=!0)},_addPlugin:function(T){var U=this;if(tu(T)){Xi(T,function(M){U._addPlugin(M)});return}var A=wC(this.plugins,function(M){return T===M});if(!A){if(this.plugins.push(T),!ru(T))throw new Error("Plugins must be function values that return objects");var F=T.call(this);if(!BC(F))throw new Error("Plugins must return an object of function properties");Xi(F,function(M,X){if(!ru(M))throw new Error("Bad plugin property: "+X+" from plugin "+T.name+". Plugins should only return functions.");U._assignPluginFnProp(M,X)})}},addStorage:function(T){kC("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(T)}},y=FC(g,UC,{plugins:[]});return y.raw={},Xi(y,function(T,U){ru(T)&&(y.raw[U]=LC(y,T))}),Xi(r,function(T){y._addStorage(T)}),Xi(n,function(T){y._addPlugin(T)}),y}});var Mp=at((hk,kp)=>{var MC=$n(),GC=MC.Global;kp.exports={name:"localStorage",read:Up,write:OC,each:WC,remove:DC,clearAll:ZC};function Yi(){return GC.localStorage}function Up(r){return Yi().getItem(r)}function OC(r,n){return Yi().setItem(r,n)}function WC(r){for(var n=Yi().length-1;n>=0;n--){var a=Yi().key(n);r(Up(a),a)}}function DC(r){return Yi().removeItem(r)}function ZC(){return Yi().clear()}});var Wp=at((pk,Op)=>{var VC=$n(),QC=VC.Global;Op.exports={name:"oldFF-globalStorage",read:PC,write:HC,each:Gp,remove:JC,clearAll:XC};var ei=QC.globalStorage;function PC(r){return ei[r]}function HC(r,n){ei[r]=n}function Gp(r){for(var n=ei.length-1;n>=0;n--){var a=ei.key(n);r(ei[a],a)}}function JC(r){return ei.removeItem(r)}function XC(){Gp(function(r,n){delete ei[r]})}});var Vp=at((gk,Zp)=>{var YC=$n(),iu=YC.Global;Zp.exports={name:"oldIE-userDataStorage",write:jC,read:zC,each:qC,remove:KC,clearAll:$C};var Po="storejs",Qo=iu.document,Ho=tA(),Dp=(iu.navigator?iu.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function jC(r,n){if(!Dp){var a=ou(r);Ho(function(l){l.setAttribute(a,n),l.save(Po)})}}function zC(r){if(!Dp){var n=ou(r),a=null;return Ho(function(l){a=l.getAttribute(n)}),a}}function qC(r){Ho(function(n){for(var a=n.XMLDocument.documentElement.attributes,l=a.length-1;l>=0;l--){var c=a[l];r(n.getAttribute(c.name),c.name)}})}function KC(r){var n=ou(r);Ho(function(a){a.removeAttribute(n),a.save(Po)})}function $C(){Ho(function(r){var n=r.XMLDocument.documentElement.attributes;r.load(Po);for(var a=n.length-1;a>=0;a--)r.removeAttribute(n[a].name);r.save(Po)})}var eA=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function ou(r){return r.replace(/^\d/,"___$&").replace(eA,"___")}function tA(){if(!Qo||!Qo.documentElement||!Qo.documentElement.addBehavior)return null;var r="script",n,a,l;try{a=new ActiveXObject("htmlfile"),a.open(),a.write("<"+r+">document.w=window</"+r+'><iframe src="/favicon.ico"></iframe>'),a.close(),n=a.w.frames[0].document,l=n.createElement("div")}catch{l=Qo.createElement("div"),n=Qo.body}return function(c){var p=[].slice.call(arguments,0);p.unshift(l),n.appendChild(l),l.addBehavior("#default#userData"),l.load(Po),c.apply(this,p),n.removeChild(l)}}});var Yp=at((mk,Xp)=>{var Qp=$n(),rA=Qp.Global,nA=Qp.trim;Xp.exports={name:"cookieStorage",read:iA,write:oA,each:Pp,remove:Hp,clearAll:aA};var Jo=rA.document;function iA(r){if(!r||!Jp(r))return null;var n="(?:^|.*;\\s*)"+escape(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(Jo.cookie.replace(new RegExp(n),"$1"))}function Pp(r){for(var n=Jo.cookie.split(/; ?/g),a=n.length-1;a>=0;a--)if(nA(n[a])){var l=n[a].split("="),c=unescape(l[0]),p=unescape(l[1]);r(p,c)}}function oA(r,n){r&&(Jo.cookie=escape(r)+"="+escape(n)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function Hp(r){!r||!Jp(r)||(Jo.cookie=escape(r)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function aA(){Pp(function(r,n){Hp(n)})}function Jp(r){return new RegExp("(?:^|;\\s*)"+escape(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(Jo.cookie)}});var qp=at((bk,zp)=>{var sA=$n(),lA=sA.Global;zp.exports={name:"sessionStorage",read:jp,write:uA,each:fA,remove:cA,clearAll:dA};function ji(){return lA.sessionStorage}function jp(r){return ji().getItem(r)}function uA(r,n){return ji().setItem(r,n)}function fA(r){for(var n=ji().length-1;n>=0;n--){var a=ji().key(n);r(jp(a),a)}}function cA(r){return ji().removeItem(r)}function dA(){return ji().clear()}});var $p=at((vk,Kp)=>{Kp.exports={name:"memoryStorage",read:hA,write:pA,each:gA,remove:mA,clearAll:bA};var ti={};function hA(r){return ti[r]}function pA(r,n){ti[r]=n}function gA(r){for(var n in ti)ti.hasOwnProperty(n)&&r(ti[n],n)}function mA(r){delete ti[r]}function bA(r){ti={}}});var tg=at((yk,eg)=>{eg.exports=[Mp(),Wp(),Vp(),Yp(),qp(),$p()]});var rg=at((exports,module)=>{typeof JSON!="object"&&(JSON={});(function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(r){return r<10?"0"+r:r}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(r){return rx_escapable.lastIndex=0,rx_escapable.test(r)?'"'+r.replace(rx_escapable,function(n){var a=meta[n];return typeof a=="string"?a:"\\u"+("0000"+n.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+r+'"'}function str(r,n){var a,l,c,p,g=gap,y,T=n[r];switch(T&&typeof T=="object"&&typeof T.toJSON=="function"&&(T=T.toJSON(r)),typeof rep=="function"&&(T=rep.call(n,r,T)),typeof T){case"string":return quote(T);case"number":return isFinite(T)?String(T):"null";case"boolean":case"null":return String(T);case"object":if(!T)return"null";if(gap+=indent,y=[],Object.prototype.toString.apply(T)==="[object Array]"){for(p=T.length,a=0;a<p;a+=1)y[a]=str(a,T)||"null";return c=y.length===0?"[]":gap?`[
2
- `+gap+y.join(`,
1
+ "use strict";var Yasr=(()=>{var bx=Object.create;var co=Object.defineProperty;var xx=Object.getOwnPropertyDescriptor;var yx=Object.getOwnPropertyNames;var Sx=Object.getPrototypeOf,Tx=Object.prototype.hasOwnProperty;var st=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Ix=(i,e)=>{for(var t in e)co(i,t,{get:e[t],enumerable:!0})},$f=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yx(e))!Tx.call(i,n)&&n!==t&&co(i,n,{get:()=>e[n],enumerable:!(r=xx(e,n))||r.enumerable});return i};var po=(i,e,t)=>(t=i!=null?bx(Sx(i)):{},$f(e||!i||!i.__esModule?co(t,"default",{value:i,enumerable:!0}):t,i)),Ox=i=>$f(co({},"__esModule",{value:!0}),i);var lc=st((_k,Ol)=>{"use strict";var Hr=typeof Reflect=="object"?Reflect:null,qf=Hr&&typeof Hr.apply=="function"?Hr.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},go;Hr&&typeof Hr.ownKeys=="function"?go=Hr.ownKeys:Object.getOwnPropertySymbols?go=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:go=function(e){return Object.getOwnPropertyNames(e)};function Ax(i){console&&console.warn&&console.warn(i)}var ec=Number.isNaN||function(e){return e!==e};function Ne(){Ne.init.call(this)}Ol.exports=Ne;Ol.exports.once=Ex;Ne.EventEmitter=Ne;Ne.prototype._events=void 0;Ne.prototype._eventsCount=0;Ne.prototype._maxListeners=void 0;var Kf=10;function mo(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Kf},set:function(i){if(typeof i!="number"||i<0||ec(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");Kf=i}});Ne.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Ne.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ec(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function tc(i){return i._maxListeners===void 0?Ne.defaultMaxListeners:i._maxListeners}Ne.prototype.getMaxListeners=function(){return tc(this)};Ne.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")qf(l,this,t);else for(var h=l.length,u=oc(l,h),r=0;r<h;++r)qf(u[r],this,t);return!0};function ic(i,e,t,r){var n,s,o;if(mo(t),s=i._events,s===void 0?(s=i._events=Object.create(null),i._eventsCount=0):(s.newListener!==void 0&&(i.emit("newListener",e,t.listener?t.listener:t),s=i._events),o=s[e]),o===void 0)o=s[e]=t,++i._eventsCount;else if(typeof o=="function"?o=s[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),n=tc(i),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=i,a.type=e,a.count=o.length,Ax(a)}return i}Ne.prototype.addListener=function(e,t){return ic(this,e,t,!1)};Ne.prototype.on=Ne.prototype.addListener;Ne.prototype.prependListener=function(e,t){return ic(this,e,t,!0)};function wx(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function rc(i,e,t){var r={fired:!1,wrapFn:void 0,target:i,type:e,listener:t},n=wx.bind(r);return n.listener=t,r.wrapFn=n,n}Ne.prototype.once=function(e,t){return mo(t),this.on(e,rc(this,e,t)),this};Ne.prototype.prependOnceListener=function(e,t){return mo(t),this.prependListener(e,rc(this,e,t)),this};Ne.prototype.removeListener=function(e,t){var r,n,s,o,a;if(mo(t),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():Rx(r,s),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};Ne.prototype.off=Ne.prototype.removeListener;Ne.prototype.removeAllListeners=function(e){var t,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this};function nc(i,e,t){var r=i._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?Cx(n):oc(n,n.length)}Ne.prototype.listeners=function(e){return nc(this,e,!0)};Ne.prototype.rawListeners=function(e){return nc(this,e,!1)};Ne.listenerCount=function(i,e){return typeof i.listenerCount=="function"?i.listenerCount(e):sc.call(i,e)};Ne.prototype.listenerCount=sc;function sc(i){var e=this._events;if(e!==void 0){var t=e[i];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Ne.prototype.eventNames=function(){return this._eventsCount>0?go(this._events):[]};function oc(i,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=i[r];return t}function Rx(i,e){for(;e+1<i.length;e++)i[e]=i[e+1];i.pop()}function Cx(i){for(var e=new Array(i.length),t=0;t<e.length;++t)e[t]=i[t].listener||i[t];return e}function Ex(i,e){return new Promise(function(t,r){function n(o){i.removeListener(e,s),r(o)}function s(){typeof i.removeListener=="function"&&i.removeListener("error",n),t([].slice.call(arguments))}ac(i,e,s,{once:!0}),e!=="error"&&kx(i,n,{once:!0})})}function kx(i,e,t){typeof i.on=="function"&&ac(i,"error",e,t)}function ac(i,e,t,r){if(typeof i.on=="function")r.once?i.once(e,t):i.on(e,t);else if(typeof i.addEventListener=="function")i.addEventListener(e,function n(s){r.once&&i.removeEventListener(e,n),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}});var Ir=st((g2,Jp)=>{var Ql=OA(),SA=AA(),TA=wA(),IA=typeof window<"u"?window:global;Jp.exports={assign:Ql,create:SA,trim:TA,bind:RA,slice:Dl,each:jp,map:CA,pluck:Xl,isList:Yl,isFunction:EA,isObject:kA,Global:IA};function OA(){return Object.assign?Object.assign:function(e,t,r,n){for(var s=1;s<arguments.length;s++)jp(Object(arguments[s]),function(o,a){e[a]=o});return e}}function AA(){if(Object.create)return function(t,r,n,s){var o=Dl(arguments,1);return Ql.apply(this,[Object.create(t)].concat(o))};{let e=function(){};var i=e;return function(r,n,s,o){var a=Dl(arguments,1);return e.prototype=r,Ql.apply(this,[new e].concat(a))}}}function wA(){return String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function RA(i,e){return function(){return e.apply(i,Array.prototype.slice.call(arguments,0))}}function Dl(i,e){return Array.prototype.slice.call(i,e||0)}function jp(i,e){Xl(i,function(t,r){return e(t,r),!1})}function CA(i,e){var t=Yl(i)?[]:{};return Xl(i,function(r,n){return t[n]=e(r,n),!1}),t}function Xl(i,e){if(Yl(i)){for(var t=0;t<i.length;t++)if(e(i[t],t))return i[t]}else for(var r in i)if(i.hasOwnProperty(r)&&e(i[r],r))return i[r]}function Yl(i){return i!=null&&typeof i!="function"&&typeof i.length=="number"}function EA(i){return i&&{}.toString.call(i)==="[object Function]"}function kA(i){return i&&{}.toString.call(i)==="[object Object]"}});var zp=st((m2,Hp)=>{var ir=Ir(),NA=ir.slice,vA=ir.pluck,pn=ir.each,_A=ir.bind,BA=ir.create,jl=ir.isList,Jl=ir.isFunction,GA=ir.isObject;Hp.exports={createStore:Hl};var FA={version:"2.0.12",enabled:!1,get:function(i,e){var t=this.storage.read(this._namespacePrefix+i);return this._deserialize(t,e)},set:function(i,e){return e===void 0?this.remove(i):(this.storage.write(this._namespacePrefix+i,this._serialize(e)),e)},remove:function(i){this.storage.remove(this._namespacePrefix+i)},each:function(i){var e=this;this.storage.each(function(t,r){i.call(e,e._deserialize(t),(r||"").replace(e._namespaceRegexp,""))})},clearAll:function(){this.storage.clearAll()},hasNamespace:function(i){return this._namespacePrefix=="__storejs_"+i+"_"},createStore:function(){return Hl.apply(this,arguments)},addPlugin:function(i){this._addPlugin(i)},namespace:function(i){return Hl(this.storage,this.plugins,i)}};function UA(){var i=typeof console>"u"?null:console;if(i){var e=i.warn?i.warn:i.log;e.apply(i,arguments)}}function Hl(i,e,t){t||(t=""),i&&!jl(i)&&(i=[i]),e&&!jl(e)&&(e=[e]);var r=t?"__storejs_"+t+"_":"",n=t?new RegExp("^"+r):null,s=/^[a-zA-Z0-9_\-]*$/;if(!s.test(t))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var o={_namespacePrefix:r,_namespaceRegexp:n,_testStorage:function(l){try{var h="__storejs__test__";l.write(h,h);var u=l.read(h)===h;return l.remove(h),u}catch{return!1}},_assignPluginFnProp:function(l,h){var u=this[h];this[h]=function(){var d=NA(arguments,0),g=this;function m(){if(u)return pn(arguments,function(O,w){d[w]=O}),u.apply(g,d)}var x=[m].concat(d);return l.apply(g,x)}},_serialize:function(l){return JSON.stringify(l)},_deserialize:function(l,h){if(!l)return h;var u="";try{u=JSON.parse(l)}catch{u=l}return u!==void 0?u:h},_addStorage:function(l){this.enabled||this._testStorage(l)&&(this.storage=l,this.enabled=!0)},_addPlugin:function(l){var h=this;if(jl(l)){pn(l,function(d){h._addPlugin(d)});return}var u=vA(this.plugins,function(d){return l===d});if(!u){if(this.plugins.push(l),!Jl(l))throw new Error("Plugins must be function values that return objects");var c=l.call(this);if(!GA(c))throw new Error("Plugins must return an object of function properties");pn(c,function(d,g){if(!Jl(d))throw new Error("Bad plugin property: "+g+" from plugin "+l.name+". Plugins should only return functions.");h._assignPluginFnProp(d,g)})}},addStorage:function(l){UA("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(l)}},a=BA(o,FA,{plugins:[]});return a.raw={},pn(a,function(l,h){Jl(l)&&(a.raw[h]=_A(a,l))}),pn(i,function(l){a._addStorage(l)}),pn(e,function(l){a._addPlugin(l)}),a}});var Kp=st((b2,qp)=>{var PA=Ir(),WA=PA.Global;qp.exports={name:"localStorage",read:$p,write:LA,each:MA,remove:VA,clearAll:ZA};function gn(){return WA.localStorage}function $p(i){return gn().getItem(i)}function LA(i,e){return gn().setItem(i,e)}function MA(i){for(var e=gn().length-1;e>=0;e--){var t=gn().key(e);i($p(t),t)}}function VA(i){return gn().removeItem(i)}function ZA(){return gn().clear()}});var ig=st((x2,tg)=>{var QA=Ir(),DA=QA.Global;tg.exports={name:"oldFF-globalStorage",read:XA,write:YA,each:eg,remove:jA,clearAll:JA};var Or=DA.globalStorage;function XA(i){return Or[i]}function YA(i,e){Or[i]=e}function eg(i){for(var e=Or.length-1;e>=0;e--){var t=Or.key(e);i(Or[t],t)}}function jA(i){return Or.removeItem(i)}function JA(){eg(function(i,e){delete Or[i]})}});var sg=st((y2,ng)=>{var HA=Ir(),zl=HA.Global;ng.exports={name:"oldIE-userDataStorage",write:zA,read:$A,each:qA,remove:KA,clearAll:ew};var ls="storejs",as=zl.document,hs=iw(),rg=(zl.navigator?zl.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function zA(i,e){if(!rg){var t=$l(i);hs(function(r){r.setAttribute(t,e),r.save(ls)})}}function $A(i){if(!rg){var e=$l(i),t=null;return hs(function(r){t=r.getAttribute(e)}),t}}function qA(i){hs(function(e){for(var t=e.XMLDocument.documentElement.attributes,r=t.length-1;r>=0;r--){var n=t[r];i(e.getAttribute(n.name),n.name)}})}function KA(i){var e=$l(i);hs(function(t){t.removeAttribute(e),t.save(ls)})}function ew(){hs(function(i){var e=i.XMLDocument.documentElement.attributes;i.load(ls);for(var t=e.length-1;t>=0;t--)i.removeAttribute(e[t].name);i.save(ls)})}var tw=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function $l(i){return i.replace(/^\d/,"___$&").replace(tw,"___")}function iw(){if(!as||!as.documentElement||!as.documentElement.addBehavior)return null;var i="script",e,t,r;try{t=new ActiveXObject("htmlfile"),t.open(),t.write("<"+i+">document.w=window</"+i+'><iframe src="/favicon.ico"></iframe>'),t.close(),e=t.w.frames[0].document,r=e.createElement("div")}catch{r=as.createElement("div"),e=as.body}return function(n){var s=[].slice.call(arguments,0);s.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(ls),n.apply(this,s),e.removeChild(r)}}});var fg=st((S2,ug)=>{var og=Ir(),rw=og.Global,nw=og.trim;ug.exports={name:"cookieStorage",read:sw,write:ow,each:ag,remove:lg,clearAll:aw};var us=rw.document;function sw(i){if(!i||!hg(i))return null;var e="(?:^|.*;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(us.cookie.replace(new RegExp(e),"$1"))}function ag(i){for(var e=us.cookie.split(/; ?/g),t=e.length-1;t>=0;t--)if(nw(e[t])){var r=e[t].split("="),n=unescape(r[0]),s=unescape(r[1]);i(s,n)}}function ow(i,e){i&&(us.cookie=escape(i)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function lg(i){!i||!hg(i)||(us.cookie=escape(i)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function aw(){ag(function(i,e){lg(e)})}function hg(i){return new RegExp("(?:^|;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(us.cookie)}});var pg=st((T2,dg)=>{var lw=Ir(),hw=lw.Global;dg.exports={name:"sessionStorage",read:cg,write:uw,each:fw,remove:cw,clearAll:dw};function mn(){return hw.sessionStorage}function cg(i){return mn().getItem(i)}function uw(i,e){return mn().setItem(i,e)}function fw(i){for(var e=mn().length-1;e>=0;e--){var t=mn().key(e);i(cg(t),t)}}function cw(i){return mn().removeItem(i)}function dw(){return mn().clear()}});var mg=st((I2,gg)=>{gg.exports={name:"memoryStorage",read:pw,write:gw,each:mw,remove:bw,clearAll:xw};var Ar={};function pw(i){return Ar[i]}function gw(i,e){Ar[i]=e}function mw(i){for(var e in Ar)Ar.hasOwnProperty(e)&&i(Ar[e],e)}function bw(i){delete Ar[i]}function xw(i){Ar={}}});var xg=st((O2,bg)=>{bg.exports=[Kp(),ig(),sg(),fg(),pg(),mg()]});var yg=st((exports,module)=>{typeof JSON!="object"&&(JSON={});(function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(i){return i<10?"0"+i:i}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(i){return rx_escapable.lastIndex=0,rx_escapable.test(i)?'"'+i.replace(rx_escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'}function str(i,e){var t,r,n,s,o=gap,a,l=e[i];switch(l&&typeof l=="object"&&typeof l.toJSON=="function"&&(l=l.toJSON(i)),typeof rep=="function"&&(l=rep.call(e,i,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,a=[],Object.prototype.toString.apply(l)==="[object Array]"){for(s=l.length,t=0;t<s;t+=1)a[t]=str(t,l)||"null";return n=a.length===0?"[]":gap?`[
2
+ `+gap+a.join(`,
3
3
  `+gap)+`
4
- `+g+"]":"["+y.join(",")+"]",gap=g,c}if(rep&&typeof rep=="object")for(p=rep.length,a=0;a<p;a+=1)typeof rep[a]=="string"&&(l=rep[a],c=str(l,T),c&&y.push(quote(l)+(gap?": ":":")+c));else for(l in T)Object.prototype.hasOwnProperty.call(T,l)&&(c=str(l,T),c&&y.push(quote(l)+(gap?": ":":")+c));return c=y.length===0?"{}":gap?`{
5
- `+gap+y.join(`,
4
+ `+o+"]":"["+a.join(",")+"]",gap=o,n}if(rep&&typeof rep=="object")for(s=rep.length,t=0;t<s;t+=1)typeof rep[t]=="string"&&(r=rep[t],n=str(r,l),n&&a.push(quote(r)+(gap?": ":":")+n));else for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(n=str(r,l),n&&a.push(quote(r)+(gap?": ":":")+n));return n=a.length===0?"{}":gap?`{
5
+ `+gap+a.join(`,
6
6
  `+gap)+`
7
- `+g+"}":"{"+y.join(",")+"}",gap=g,c}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(r,n,a){var l;if(gap="",indent="",typeof a=="number")for(l=0;l<a;l+=1)indent+=" ";else typeof a=="string"&&(indent=a);if(rep=n,n&&typeof n!="function"&&(typeof n!="object"||typeof n.length!="number"))throw new Error("JSON.stringify");return str("",{"":r})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){var j;function walk(r,n){var a,l,c=r[n];if(c&&typeof c=="object")for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(l=walk(c,a),l!==void 0?c[a]=l:delete c[a]);return reviver.call(r,n,c)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(r){return"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})})()});var ig=at((xk,ng)=>{ng.exports=vA;function vA(){return rg(),{}}});var ag=at((Tk,og)=>{var yA=Bp(),xA=tg(),TA=[ig()];og.exports=yA.createStore(xA,TA)});var ug=at(xs=>{"use strict";xs.byteLength=CA;xs.toByteArray=RA;xs.fromByteArray=SA;var qr=[],Nr=[],EA=typeof Uint8Array<"u"?Uint8Array:Array,su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ni=0,sg=su.length;ni<sg;++ni)qr[ni]=su[ni],Nr[su.charCodeAt(ni)]=ni;var ni,sg;Nr[45]=62;Nr[95]=63;function lg(r){var n=r.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=r.indexOf("=");a===-1&&(a=n);var l=a===n?0:4-a%4;return[a,l]}function CA(r){var n=lg(r),a=n[0],l=n[1];return(a+l)*3/4-l}function AA(r,n,a){return(n+a)*3/4-a}function RA(r){var n,a=lg(r),l=a[0],c=a[1],p=new EA(AA(r,l,c)),g=0,y=c>0?l-4:l,T;for(T=0;T<y;T+=4)n=Nr[r.charCodeAt(T)]<<18|Nr[r.charCodeAt(T+1)]<<12|Nr[r.charCodeAt(T+2)]<<6|Nr[r.charCodeAt(T+3)],p[g++]=n>>16&255,p[g++]=n>>8&255,p[g++]=n&255;return c===2&&(n=Nr[r.charCodeAt(T)]<<2|Nr[r.charCodeAt(T+1)]>>4,p[g++]=n&255),c===1&&(n=Nr[r.charCodeAt(T)]<<10|Nr[r.charCodeAt(T+1)]<<4|Nr[r.charCodeAt(T+2)]>>2,p[g++]=n>>8&255,p[g++]=n&255),p}function _A(r){return qr[r>>18&63]+qr[r>>12&63]+qr[r>>6&63]+qr[r&63]}function NA(r,n,a){for(var l,c=[],p=n;p<a;p+=3)l=(r[p]<<16&16711680)+(r[p+1]<<8&65280)+(r[p+2]&255),c.push(_A(l));return c.join("")}function SA(r){for(var n,a=r.length,l=a%3,c=[],p=16383,g=0,y=a-l;g<y;g+=p)c.push(NA(r,g,g+p>y?y:g+p));return l===1?(n=r[a-1],c.push(qr[n>>2]+qr[n<<4&63]+"==")):l===2&&(n=(r[a-2]<<8)+r[a-1],c.push(qr[n>>10]+qr[n>>4&63]+qr[n<<2&63]+"=")),c.join("")}});var fg=at(lu=>{lu.read=function(r,n,a,l,c){var p,g,y=c*8-l-1,T=(1<<y)-1,U=T>>1,A=-7,F=a?c-1:0,M=a?-1:1,X=r[n+F];for(F+=M,p=X&(1<<-A)-1,X>>=-A,A+=y;A>0;p=p*256+r[n+F],F+=M,A-=8);for(g=p&(1<<-A)-1,p>>=-A,A+=l;A>0;g=g*256+r[n+F],F+=M,A-=8);if(p===0)p=1-U;else{if(p===T)return g?NaN:(X?-1:1)*(1/0);g=g+Math.pow(2,l),p=p-U}return(X?-1:1)*g*Math.pow(2,p-l)};lu.write=function(r,n,a,l,c,p){var g,y,T,U=p*8-c-1,A=(1<<U)-1,F=A>>1,M=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,X=l?0:p-1,S=l?1:-1,Z=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(y=isNaN(n)?1:0,g=A):(g=Math.floor(Math.log(n)/Math.LN2),n*(T=Math.pow(2,-g))<1&&(g--,T*=2),g+F>=1?n+=M/T:n+=M*Math.pow(2,1-F),n*T>=2&&(g++,T/=2),g+F>=A?(y=0,g=A):g+F>=1?(y=(n*T-1)*Math.pow(2,c),g=g+F):(y=n*Math.pow(2,F-1)*Math.pow(2,c),g=0));c>=8;r[a+X]=y&255,X+=S,y/=256,c-=8);for(g=g<<c|y,U+=c;U>0;r[a+X]=g&255,X+=S,g/=256,U-=8);r[a+X-S]|=Z*128}});var _g=at($i=>{"use strict";var uu=ug(),qi=fg(),cg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;$i.Buffer=Q;$i.SlowBuffer=kA;$i.INSPECT_MAX_BYTES=50;var Ts=2147483647;$i.kMaxLength=Ts;Q.TYPED_ARRAY_SUPPORT=wA();!Q.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function wA(){try{let r=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(r,n),r.foo()===42}catch{return!1}}Object.defineProperty(Q.prototype,"parent",{enumerable:!0,get:function(){if(Q.isBuffer(this))return this.buffer}});Object.defineProperty(Q.prototype,"offset",{enumerable:!0,get:function(){if(Q.isBuffer(this))return this.byteOffset}});function pn(r){if(r>Ts)throw new RangeError('The value "'+r+'" is invalid for option "size"');let n=new Uint8Array(r);return Object.setPrototypeOf(n,Q.prototype),n}function Q(r,n,a){if(typeof r=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return hu(r)}return gg(r,n,a)}Q.poolSize=8192;function gg(r,n,a){if(typeof r=="string")return FA(r,n);if(ArrayBuffer.isView(r))return BA(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Kr(r,ArrayBuffer)||r&&Kr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Kr(r,SharedArrayBuffer)||r&&Kr(r.buffer,SharedArrayBuffer)))return cu(r,n,a);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let l=r.valueOf&&r.valueOf();if(l!=null&&l!==r)return Q.from(l,n,a);let c=UA(r);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return Q.from(r[Symbol.toPrimitive]("string"),n,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}Q.from=function(r,n,a){return gg(r,n,a)};Object.setPrototypeOf(Q.prototype,Uint8Array.prototype);Object.setPrototypeOf(Q,Uint8Array);function mg(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function LA(r,n,a){return mg(r),r<=0?pn(r):n!==void 0?typeof a=="string"?pn(r).fill(n,a):pn(r).fill(n):pn(r)}Q.alloc=function(r,n,a){return LA(r,n,a)};function hu(r){return mg(r),pn(r<0?0:pu(r)|0)}Q.allocUnsafe=function(r){return hu(r)};Q.allocUnsafeSlow=function(r){return hu(r)};function FA(r,n){if((typeof n!="string"||n==="")&&(n="utf8"),!Q.isEncoding(n))throw new TypeError("Unknown encoding: "+n);let a=bg(r,n)|0,l=pn(a),c=l.write(r,n);return c!==a&&(l=l.slice(0,c)),l}function fu(r){let n=r.length<0?0:pu(r.length)|0,a=pn(n);for(let l=0;l<n;l+=1)a[l]=r[l]&255;return a}function BA(r){if(Kr(r,Uint8Array)){let n=new Uint8Array(r);return cu(n.buffer,n.byteOffset,n.byteLength)}return fu(r)}function cu(r,n,a){if(n<0||r.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<n+(a||0))throw new RangeError('"length" is outside of buffer bounds');let l;return n===void 0&&a===void 0?l=new Uint8Array(r):a===void 0?l=new Uint8Array(r,n):l=new Uint8Array(r,n,a),Object.setPrototypeOf(l,Q.prototype),l}function UA(r){if(Q.isBuffer(r)){let n=pu(r.length)|0,a=pn(n);return a.length===0||r.copy(a,0,0,n),a}if(r.length!==void 0)return typeof r.length!="number"||mu(r.length)?pn(0):fu(r);if(r.type==="Buffer"&&Array.isArray(r.data))return fu(r.data)}function pu(r){if(r>=Ts)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ts.toString(16)+" bytes");return r|0}function kA(r){return+r!=r&&(r=0),Q.alloc(+r)}Q.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==Q.prototype};Q.compare=function(n,a){if(Kr(n,Uint8Array)&&(n=Q.from(n,n.offset,n.byteLength)),Kr(a,Uint8Array)&&(a=Q.from(a,a.offset,a.byteLength)),!Q.isBuffer(n)||!Q.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===a)return 0;let l=n.length,c=a.length;for(let p=0,g=Math.min(l,c);p<g;++p)if(n[p]!==a[p]){l=n[p],c=a[p];break}return l<c?-1:c<l?1:0};Q.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};Q.concat=function(n,a){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return Q.alloc(0);let l;if(a===void 0)for(a=0,l=0;l<n.length;++l)a+=n[l].length;let c=Q.allocUnsafe(a),p=0;for(l=0;l<n.length;++l){let g=n[l];if(Kr(g,Uint8Array))p+g.length>c.length?(Q.isBuffer(g)||(g=Q.from(g)),g.copy(c,p)):Uint8Array.prototype.set.call(c,g,p);else if(Q.isBuffer(g))g.copy(c,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=g.length}return c};function bg(r,n){if(Q.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Kr(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let a=r.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&a===0)return 0;let c=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return du(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return Rg(r).length;default:if(c)return l?-1:du(r).length;n=(""+n).toLowerCase(),c=!0}}Q.byteLength=bg;function MA(r,n,a){let l=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,n>>>=0,a<=n))return"";for(r||(r="utf8");;)switch(r){case"hex":return JA(this,n,a);case"utf8":case"utf-8":return yg(this,n,a);case"ascii":return PA(this,n,a);case"latin1":case"binary":return HA(this,n,a);case"base64":return VA(this,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XA(this,n,a);default:if(l)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),l=!0}}Q.prototype._isBuffer=!0;function ii(r,n,a){let l=r[n];r[n]=r[a],r[a]=l}Q.prototype.swap16=function(){let n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;a<n;a+=2)ii(this,a,a+1);return this};Q.prototype.swap32=function(){let n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let a=0;a<n;a+=4)ii(this,a,a+3),ii(this,a+1,a+2);return this};Q.prototype.swap64=function(){let n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let a=0;a<n;a+=8)ii(this,a,a+7),ii(this,a+1,a+6),ii(this,a+2,a+5),ii(this,a+3,a+4);return this};Q.prototype.toString=function(){let n=this.length;return n===0?"":arguments.length===0?yg(this,0,n):MA.apply(this,arguments)};Q.prototype.toLocaleString=Q.prototype.toString;Q.prototype.equals=function(n){if(!Q.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:Q.compare(this,n)===0};Q.prototype.inspect=function(){let n="",a=$i.INSPECT_MAX_BYTES;return n=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(n+=" ... "),"<Buffer "+n+">"};cg&&(Q.prototype[cg]=Q.prototype.inspect);Q.prototype.compare=function(n,a,l,c,p){if(Kr(n,Uint8Array)&&(n=Q.from(n,n.offset,n.byteLength)),!Q.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(a===void 0&&(a=0),l===void 0&&(l=n?n.length:0),c===void 0&&(c=0),p===void 0&&(p=this.length),a<0||l>n.length||c<0||p>this.length)throw new RangeError("out of range index");if(c>=p&&a>=l)return 0;if(c>=p)return-1;if(a>=l)return 1;if(a>>>=0,l>>>=0,c>>>=0,p>>>=0,this===n)return 0;let g=p-c,y=l-a,T=Math.min(g,y),U=this.slice(c,p),A=n.slice(a,l);for(let F=0;F<T;++F)if(U[F]!==A[F]){g=U[F],y=A[F];break}return g<y?-1:y<g?1:0};function vg(r,n,a,l,c){if(r.length===0)return-1;if(typeof a=="string"?(l=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,mu(a)&&(a=c?0:r.length-1),a<0&&(a=r.length+a),a>=r.length){if(c)return-1;a=r.length-1}else if(a<0)if(c)a=0;else return-1;if(typeof n=="string"&&(n=Q.from(n,l)),Q.isBuffer(n))return n.length===0?-1:dg(r,n,a,l,c);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(r,n,a):Uint8Array.prototype.lastIndexOf.call(r,n,a):dg(r,[n],a,l,c);throw new TypeError("val must be string, number or Buffer")}function dg(r,n,a,l,c){let p=1,g=r.length,y=n.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(r.length<2||n.length<2)return-1;p=2,g/=2,y/=2,a/=2}function T(A,F){return p===1?A[F]:A.readUInt16BE(F*p)}let U;if(c){let A=-1;for(U=a;U<g;U++)if(T(r,U)===T(n,A===-1?0:U-A)){if(A===-1&&(A=U),U-A+1===y)return A*p}else A!==-1&&(U-=U-A),A=-1}else for(a+y>g&&(a=g-y),U=a;U>=0;U--){let A=!0;for(let F=0;F<y;F++)if(T(r,U+F)!==T(n,F)){A=!1;break}if(A)return U}return-1}Q.prototype.includes=function(n,a,l){return this.indexOf(n,a,l)!==-1};Q.prototype.indexOf=function(n,a,l){return vg(this,n,a,l,!0)};Q.prototype.lastIndexOf=function(n,a,l){return vg(this,n,a,l,!1)};function GA(r,n,a,l){a=Number(a)||0;let c=r.length-a;l?(l=Number(l),l>c&&(l=c)):l=c;let p=n.length;l>p/2&&(l=p/2);let g;for(g=0;g<l;++g){let y=parseInt(n.substr(g*2,2),16);if(mu(y))return g;r[a+g]=y}return g}function OA(r,n,a,l){return Is(du(n,r.length-a),r,a,l)}function WA(r,n,a,l){return Is(qA(n),r,a,l)}function DA(r,n,a,l){return Is(Rg(n),r,a,l)}function ZA(r,n,a,l){return Is(KA(n,r.length-a),r,a,l)}Q.prototype.write=function(n,a,l,c){if(a===void 0)c="utf8",l=this.length,a=0;else if(l===void 0&&typeof a=="string")c=a,l=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(l)?(l=l>>>0,c===void 0&&(c="utf8")):(c=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let p=this.length-a;if((l===void 0||l>p)&&(l=p),n.length>0&&(l<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let g=!1;for(;;)switch(c){case"hex":return GA(this,n,a,l);case"utf8":case"utf-8":return OA(this,n,a,l);case"ascii":case"latin1":case"binary":return WA(this,n,a,l);case"base64":return DA(this,n,a,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZA(this,n,a,l);default:if(g)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),g=!0}};Q.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function VA(r,n,a){return n===0&&a===r.length?uu.fromByteArray(r):uu.fromByteArray(r.slice(n,a))}function yg(r,n,a){a=Math.min(r.length,a);let l=[],c=n;for(;c<a;){let p=r[c],g=null,y=p>239?4:p>223?3:p>191?2:1;if(c+y<=a){let T,U,A,F;switch(y){case 1:p<128&&(g=p);break;case 2:T=r[c+1],(T&192)===128&&(F=(p&31)<<6|T&63,F>127&&(g=F));break;case 3:T=r[c+1],U=r[c+2],(T&192)===128&&(U&192)===128&&(F=(p&15)<<12|(T&63)<<6|U&63,F>2047&&(F<55296||F>57343)&&(g=F));break;case 4:T=r[c+1],U=r[c+2],A=r[c+3],(T&192)===128&&(U&192)===128&&(A&192)===128&&(F=(p&15)<<18|(T&63)<<12|(U&63)<<6|A&63,F>65535&&F<1114112&&(g=F))}}g===null?(g=65533,y=1):g>65535&&(g-=65536,l.push(g>>>10&1023|55296),g=56320|g&1023),l.push(g),c+=y}return QA(l)}var hg=4096;function QA(r){let n=r.length;if(n<=hg)return String.fromCharCode.apply(String,r);let a="",l=0;for(;l<n;)a+=String.fromCharCode.apply(String,r.slice(l,l+=hg));return a}function PA(r,n,a){let l="";a=Math.min(r.length,a);for(let c=n;c<a;++c)l+=String.fromCharCode(r[c]&127);return l}function HA(r,n,a){let l="";a=Math.min(r.length,a);for(let c=n;c<a;++c)l+=String.fromCharCode(r[c]);return l}function JA(r,n,a){let l=r.length;(!n||n<0)&&(n=0),(!a||a<0||a>l)&&(a=l);let c="";for(let p=n;p<a;++p)c+=$A[r[p]];return c}function XA(r,n,a){let l=r.slice(n,a),c="";for(let p=0;p<l.length-1;p+=2)c+=String.fromCharCode(l[p]+l[p+1]*256);return c}Q.prototype.slice=function(n,a){let l=this.length;n=~~n,a=a===void 0?l:~~a,n<0?(n+=l,n<0&&(n=0)):n>l&&(n=l),a<0?(a+=l,a<0&&(a=0)):a>l&&(a=l),a<n&&(a=n);let c=this.subarray(n,a);return Object.setPrototypeOf(c,Q.prototype),c};function Wt(r,n,a){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+n>a)throw new RangeError("Trying to access beyond buffer length")}Q.prototype.readUintLE=Q.prototype.readUIntLE=function(n,a,l){n=n>>>0,a=a>>>0,l||Wt(n,a,this.length);let c=this[n],p=1,g=0;for(;++g<a&&(p*=256);)c+=this[n+g]*p;return c};Q.prototype.readUintBE=Q.prototype.readUIntBE=function(n,a,l){n=n>>>0,a=a>>>0,l||Wt(n,a,this.length);let c=this[n+--a],p=1;for(;a>0&&(p*=256);)c+=this[n+--a]*p;return c};Q.prototype.readUint8=Q.prototype.readUInt8=function(n,a){return n=n>>>0,a||Wt(n,1,this.length),this[n]};Q.prototype.readUint16LE=Q.prototype.readUInt16LE=function(n,a){return n=n>>>0,a||Wt(n,2,this.length),this[n]|this[n+1]<<8};Q.prototype.readUint16BE=Q.prototype.readUInt16BE=function(n,a){return n=n>>>0,a||Wt(n,2,this.length),this[n]<<8|this[n+1]};Q.prototype.readUint32LE=Q.prototype.readUInt32LE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216};Q.prototype.readUint32BE=Q.prototype.readUInt32BE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])};Q.prototype.readBigUInt64LE=Dn(function(n){n=n>>>0,Ki(n,"offset");let a=this[n],l=this[n+7];(a===void 0||l===void 0)&&Yo(n,this.length-8);let c=a+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,p=this[++n]+this[++n]*2**8+this[++n]*2**16+l*2**24;return BigInt(c)+(BigInt(p)<<BigInt(32))});Q.prototype.readBigUInt64BE=Dn(function(n){n=n>>>0,Ki(n,"offset");let a=this[n],l=this[n+7];(a===void 0||l===void 0)&&Yo(n,this.length-8);let c=a*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],p=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+l;return(BigInt(c)<<BigInt(32))+BigInt(p)});Q.prototype.readIntLE=function(n,a,l){n=n>>>0,a=a>>>0,l||Wt(n,a,this.length);let c=this[n],p=1,g=0;for(;++g<a&&(p*=256);)c+=this[n+g]*p;return p*=128,c>=p&&(c-=Math.pow(2,8*a)),c};Q.prototype.readIntBE=function(n,a,l){n=n>>>0,a=a>>>0,l||Wt(n,a,this.length);let c=a,p=1,g=this[n+--c];for(;c>0&&(p*=256);)g+=this[n+--c]*p;return p*=128,g>=p&&(g-=Math.pow(2,8*a)),g};Q.prototype.readInt8=function(n,a){return n=n>>>0,a||Wt(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]};Q.prototype.readInt16LE=function(n,a){n=n>>>0,a||Wt(n,2,this.length);let l=this[n]|this[n+1]<<8;return l&32768?l|4294901760:l};Q.prototype.readInt16BE=function(n,a){n=n>>>0,a||Wt(n,2,this.length);let l=this[n+1]|this[n]<<8;return l&32768?l|4294901760:l};Q.prototype.readInt32LE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24};Q.prototype.readInt32BE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]};Q.prototype.readBigInt64LE=Dn(function(n){n=n>>>0,Ki(n,"offset");let a=this[n],l=this[n+7];(a===void 0||l===void 0)&&Yo(n,this.length-8);let c=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(l<<24);return(BigInt(c)<<BigInt(32))+BigInt(a+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)});Q.prototype.readBigInt64BE=Dn(function(n){n=n>>>0,Ki(n,"offset");let a=this[n],l=this[n+7];(a===void 0||l===void 0)&&Yo(n,this.length-8);let c=(a<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(c)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+l)});Q.prototype.readFloatLE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),qi.read(this,n,!0,23,4)};Q.prototype.readFloatBE=function(n,a){return n=n>>>0,a||Wt(n,4,this.length),qi.read(this,n,!1,23,4)};Q.prototype.readDoubleLE=function(n,a){return n=n>>>0,a||Wt(n,8,this.length),qi.read(this,n,!0,52,8)};Q.prototype.readDoubleBE=function(n,a){return n=n>>>0,a||Wt(n,8,this.length),qi.read(this,n,!1,52,8)};function pr(r,n,a,l,c,p){if(!Q.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>c||n<p)throw new RangeError('"value" argument is out of bounds');if(a+l>r.length)throw new RangeError("Index out of range")}Q.prototype.writeUintLE=Q.prototype.writeUIntLE=function(n,a,l,c){if(n=+n,a=a>>>0,l=l>>>0,!c){let y=Math.pow(2,8*l)-1;pr(this,n,a,l,y,0)}let p=1,g=0;for(this[a]=n&255;++g<l&&(p*=256);)this[a+g]=n/p&255;return a+l};Q.prototype.writeUintBE=Q.prototype.writeUIntBE=function(n,a,l,c){if(n=+n,a=a>>>0,l=l>>>0,!c){let y=Math.pow(2,8*l)-1;pr(this,n,a,l,y,0)}let p=l-1,g=1;for(this[a+p]=n&255;--p>=0&&(g*=256);)this[a+p]=n/g&255;return a+l};Q.prototype.writeUint8=Q.prototype.writeUInt8=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,1,255,0),this[a]=n&255,a+1};Q.prototype.writeUint16LE=Q.prototype.writeUInt16LE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,2,65535,0),this[a]=n&255,this[a+1]=n>>>8,a+2};Q.prototype.writeUint16BE=Q.prototype.writeUInt16BE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,2,65535,0),this[a]=n>>>8,this[a+1]=n&255,a+2};Q.prototype.writeUint32LE=Q.prototype.writeUInt32LE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,4,4294967295,0),this[a+3]=n>>>24,this[a+2]=n>>>16,this[a+1]=n>>>8,this[a]=n&255,a+4};Q.prototype.writeUint32BE=Q.prototype.writeUInt32BE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,4,4294967295,0),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4};function xg(r,n,a,l,c){Ag(n,l,c,r,a,7);let p=Number(n&BigInt(4294967295));r[a++]=p,p=p>>8,r[a++]=p,p=p>>8,r[a++]=p,p=p>>8,r[a++]=p;let g=Number(n>>BigInt(32)&BigInt(4294967295));return r[a++]=g,g=g>>8,r[a++]=g,g=g>>8,r[a++]=g,g=g>>8,r[a++]=g,a}function Tg(r,n,a,l,c){Ag(n,l,c,r,a,7);let p=Number(n&BigInt(4294967295));r[a+7]=p,p=p>>8,r[a+6]=p,p=p>>8,r[a+5]=p,p=p>>8,r[a+4]=p;let g=Number(n>>BigInt(32)&BigInt(4294967295));return r[a+3]=g,g=g>>8,r[a+2]=g,g=g>>8,r[a+1]=g,g=g>>8,r[a]=g,a+8}Q.prototype.writeBigUInt64LE=Dn(function(n,a=0){return xg(this,n,a,BigInt(0),BigInt("0xffffffffffffffff"))});Q.prototype.writeBigUInt64BE=Dn(function(n,a=0){return Tg(this,n,a,BigInt(0),BigInt("0xffffffffffffffff"))});Q.prototype.writeIntLE=function(n,a,l,c){if(n=+n,a=a>>>0,!c){let T=Math.pow(2,8*l-1);pr(this,n,a,l,T-1,-T)}let p=0,g=1,y=0;for(this[a]=n&255;++p<l&&(g*=256);)n<0&&y===0&&this[a+p-1]!==0&&(y=1),this[a+p]=(n/g>>0)-y&255;return a+l};Q.prototype.writeIntBE=function(n,a,l,c){if(n=+n,a=a>>>0,!c){let T=Math.pow(2,8*l-1);pr(this,n,a,l,T-1,-T)}let p=l-1,g=1,y=0;for(this[a+p]=n&255;--p>=0&&(g*=256);)n<0&&y===0&&this[a+p+1]!==0&&(y=1),this[a+p]=(n/g>>0)-y&255;return a+l};Q.prototype.writeInt8=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,1,127,-128),n<0&&(n=255+n+1),this[a]=n&255,a+1};Q.prototype.writeInt16LE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,2,32767,-32768),this[a]=n&255,this[a+1]=n>>>8,a+2};Q.prototype.writeInt16BE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,2,32767,-32768),this[a]=n>>>8,this[a+1]=n&255,a+2};Q.prototype.writeInt32LE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,4,2147483647,-2147483648),this[a]=n&255,this[a+1]=n>>>8,this[a+2]=n>>>16,this[a+3]=n>>>24,a+4};Q.prototype.writeInt32BE=function(n,a,l){return n=+n,a=a>>>0,l||pr(this,n,a,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4};Q.prototype.writeBigInt64LE=Dn(function(n,a=0){return xg(this,n,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Q.prototype.writeBigInt64BE=Dn(function(n,a=0){return Tg(this,n,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ig(r,n,a,l,c,p){if(a+l>r.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function Eg(r,n,a,l,c){return n=+n,a=a>>>0,c||Ig(r,n,a,4,34028234663852886e22,-34028234663852886e22),qi.write(r,n,a,l,23,4),a+4}Q.prototype.writeFloatLE=function(n,a,l){return Eg(this,n,a,!0,l)};Q.prototype.writeFloatBE=function(n,a,l){return Eg(this,n,a,!1,l)};function Cg(r,n,a,l,c){return n=+n,a=a>>>0,c||Ig(r,n,a,8,17976931348623157e292,-17976931348623157e292),qi.write(r,n,a,l,52,8),a+8}Q.prototype.writeDoubleLE=function(n,a,l){return Cg(this,n,a,!0,l)};Q.prototype.writeDoubleBE=function(n,a,l){return Cg(this,n,a,!1,l)};Q.prototype.copy=function(n,a,l,c){if(!Q.isBuffer(n))throw new TypeError("argument should be a Buffer");if(l||(l=0),!c&&c!==0&&(c=this.length),a>=n.length&&(a=n.length),a||(a=0),c>0&&c<l&&(c=l),c===l||n.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),n.length-a<c-l&&(c=n.length-a+l);let p=c-l;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(a,l,c):Uint8Array.prototype.set.call(n,this.subarray(l,c),a),p};Q.prototype.fill=function(n,a,l,c){if(typeof n=="string"){if(typeof a=="string"?(c=a,a=0,l=this.length):typeof l=="string"&&(c=l,l=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!Q.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(n.length===1){let g=n.charCodeAt(0);(c==="utf8"&&g<128||c==="latin1")&&(n=g)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(a<0||this.length<a||this.length<l)throw new RangeError("Out of range index");if(l<=a)return this;a=a>>>0,l=l===void 0?this.length:l>>>0,n||(n=0);let p;if(typeof n=="number")for(p=a;p<l;++p)this[p]=n;else{let g=Q.isBuffer(n)?n:Q.from(n,c),y=g.length;if(y===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(p=0;p<l-a;++p)this[p+a]=g[p%y]}return this};var zi={};function gu(r,n,a){zi[r]=class extends a{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}gu("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);gu("ERR_INVALID_ARG_TYPE",function(r,n){return`The "${r}" argument must be of type number. Received type ${typeof n}`},TypeError);gu("ERR_OUT_OF_RANGE",function(r,n,a){let l=`The value of "${r}" is out of range.`,c=a;return Number.isInteger(a)&&Math.abs(a)>2**32?c=pg(String(a)):typeof a=="bigint"&&(c=String(a),(a>BigInt(2)**BigInt(32)||a<-(BigInt(2)**BigInt(32)))&&(c=pg(c)),c+="n"),l+=` It must be ${n}. Received ${c}`,l},RangeError);function pg(r){let n="",a=r.length,l=r[0]==="-"?1:0;for(;a>=l+4;a-=3)n=`_${r.slice(a-3,a)}${n}`;return`${r.slice(0,a)}${n}`}function YA(r,n,a){Ki(n,"offset"),(r[n]===void 0||r[n+a]===void 0)&&Yo(n,r.length-(a+1))}function Ag(r,n,a,l,c,p){if(r>a||r<n){let g=typeof n=="bigint"?"n":"",y;throw p>3?n===0||n===BigInt(0)?y=`>= 0${g} and < 2${g} ** ${(p+1)*8}${g}`:y=`>= -(2${g} ** ${(p+1)*8-1}${g}) and < 2 ** ${(p+1)*8-1}${g}`:y=`>= ${n}${g} and <= ${a}${g}`,new zi.ERR_OUT_OF_RANGE("value",y,r)}YA(l,c,p)}function Ki(r,n){if(typeof r!="number")throw new zi.ERR_INVALID_ARG_TYPE(n,"number",r)}function Yo(r,n,a){throw Math.floor(r)!==r?(Ki(r,a),new zi.ERR_OUT_OF_RANGE(a||"offset","an integer",r)):n<0?new zi.ERR_BUFFER_OUT_OF_BOUNDS:new zi.ERR_OUT_OF_RANGE(a||"offset",`>= ${a?1:0} and <= ${n}`,r)}var jA=/[^+/0-9A-Za-z-_]/g;function zA(r){if(r=r.split("=")[0],r=r.trim().replace(jA,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function du(r,n){n=n||1/0;let a,l=r.length,c=null,p=[];for(let g=0;g<l;++g){if(a=r.charCodeAt(g),a>55295&&a<57344){if(!c){if(a>56319){(n-=3)>-1&&p.push(239,191,189);continue}else if(g+1===l){(n-=3)>-1&&p.push(239,191,189);continue}c=a;continue}if(a<56320){(n-=3)>-1&&p.push(239,191,189),c=a;continue}a=(c-55296<<10|a-56320)+65536}else c&&(n-=3)>-1&&p.push(239,191,189);if(c=null,a<128){if((n-=1)<0)break;p.push(a)}else if(a<2048){if((n-=2)<0)break;p.push(a>>6|192,a&63|128)}else if(a<65536){if((n-=3)<0)break;p.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((n-=4)<0)break;p.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return p}function qA(r){let n=[];for(let a=0;a<r.length;++a)n.push(r.charCodeAt(a)&255);return n}function KA(r,n){let a,l,c,p=[];for(let g=0;g<r.length&&!((n-=2)<0);++g)a=r.charCodeAt(g),l=a>>8,c=a%256,p.push(c),p.push(l);return p}function Rg(r){return uu.toByteArray(zA(r))}function Is(r,n,a,l){let c;for(c=0;c<l&&!(c+a>=n.length||c>=r.length);++c)n[c+a]=r[c];return c}function Kr(r,n){return r instanceof n||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===n.name}function mu(r){return r!==r}var $A=function(){let r="0123456789abcdef",n=new Array(256);for(let a=0;a<16;++a){let l=a*16;for(let c=0;c<16;++c)n[l+c]=r[a]+r[c]}return n}();function Dn(r){return typeof BigInt>"u"?eR:r}function eR(){throw new Error("BigInt not supported")}});var Wg=at((Cu,Au)=>{((r,n)=>{typeof define=="function"&&define.amd?define([],n):typeof Au=="object"&&typeof Cu<"u"?Au.exports=n():r.Papa=n()})(Cu,function r(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},a,l=!n.document&&!!n.postMessage,c=n.IS_PAPA_WORKER||!1,p={},g=0,y={};function T(R){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(w){var P=q(w);P.chunkSize=parseInt(P.chunkSize),w.step||w.chunk||(P.chunkSize=null),this._handle=new X(P),(this._handle.streamer=this)._config=P}.call(this,R),this.parseChunk=function(w,P){var $=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<$){let k=this._config.newline;k||(fe=this._config.quoteChar||'"',k=this._handle.guessLineEndings(w,fe)),w=[...w.split(k).slice($)].join(k)}this.isFirstChunk&&ae(this._config.beforeFirstChunk)&&(fe=this._config.beforeFirstChunk(w))!==void 0&&(w=fe),this.isFirstChunk=!1,this._halted=!1;var $=this._partialLine+w,fe=(this._partialLine="",this._handle.parse($,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(w=fe.meta.cursor,$=(this._finished||(this._partialLine=$.substring(w-this._baseIndex),this._baseIndex=w),fe&&fe.data&&(this._rowCount+=fe.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),c)n.postMessage({results:fe,workerId:y.WORKER_ID,finished:$});else if(ae(this._config.chunk)&&!P){if(this._config.chunk(fe,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=fe=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(fe.data),this._completeResults.errors=this._completeResults.errors.concat(fe.errors),this._completeResults.meta=fe.meta),this._completed||!$||!ae(this._config.complete)||fe&&fe.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),$||fe&&fe.meta.paused||this._nextChunk(),fe}this._halted=!0},this._sendError=function(w){ae(this._config.error)?this._config.error(w):c&&this._config.error&&n.postMessage({workerId:y.WORKER_ID,error:w,finished:!1})}}function U(R){var w;(R=R||{}).chunkSize||(R.chunkSize=y.RemoteChunkSize),T.call(this,R),this._nextChunk=l?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(P){this._input=P,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(w=new XMLHttpRequest,this._config.withCredentials&&(w.withCredentials=this._config.withCredentials),l||(w.onload=te(this._chunkLoaded,this),w.onerror=te(this._chunkError,this)),w.open(this._config.downloadRequestBody?"POST":"GET",this._input,!l),this._config.downloadRequestHeaders){var P,$=this._config.downloadRequestHeaders;for(P in $)w.setRequestHeader(P,$[P])}var fe;this._config.chunkSize&&(fe=this._start+this._config.chunkSize-1,w.setRequestHeader("Range","bytes="+this._start+"-"+fe));try{w.send(this._config.downloadRequestBody)}catch(k){this._chunkError(k.message)}l&&w.status===0&&this._chunkError()}},this._chunkLoaded=function(){w.readyState===4&&(w.status<200||400<=w.status?this._chunkError():(this._start+=this._config.chunkSize||w.responseText.length,this._finished=!this._config.chunkSize||this._start>=(P=>(P=P.getResponseHeader("Content-Range"))!==null?parseInt(P.substring(P.lastIndexOf("/")+1)):-1)(w),this.parseChunk(w.responseText)))},this._chunkError=function(P){P=w.statusText||P,this._sendError(new Error(P))}}function A(R){(R=R||{}).chunkSize||(R.chunkSize=y.LocalChunkSize),T.call(this,R);var w,P,$=typeof FileReader<"u";this.stream=function(fe){this._input=fe,P=fe.slice||fe.webkitSlice||fe.mozSlice,$?((w=new FileReader).onload=te(this._chunkLoaded,this),w.onerror=te(this._chunkError,this)):w=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var fe=this._input,k=(this._config.chunkSize&&(k=Math.min(this._start+this._config.chunkSize,this._input.size),fe=P.call(fe,this._start,k)),w.readAsText(fe,this._config.encoding));$||this._chunkLoaded({target:{result:k}})},this._chunkLoaded=function(fe){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(fe.target.result)},this._chunkError=function(){this._sendError(w.error)}}function F(R){var w;T.call(this,R=R||{}),this.stream=function(P){return w=P,this._nextChunk()},this._nextChunk=function(){var P,$;if(!this._finished)return P=this._config.chunkSize,w=P?($=w.substring(0,P),w.substring(P)):($=w,""),this._finished=!w,this.parseChunk($)}}function M(R){T.call(this,R=R||{});var w=[],P=!0,$=!1;this.pause=function(){T.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){T.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(fe){this._input=fe,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){$&&w.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),w.length?this.parseChunk(w.shift()):P=!0},this._streamData=te(function(fe){try{w.push(typeof fe=="string"?fe:fe.toString(this._config.encoding)),P&&(P=!1,this._checkIsFinished(),this.parseChunk(w.shift()))}catch(k){this._streamError(k)}},this),this._streamError=te(function(fe){this._streamCleanUp(),this._sendError(fe)},this),this._streamEnd=te(function(){this._streamCleanUp(),$=!0,this._streamData("")},this),this._streamCleanUp=te(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function X(R){var w,P,$,fe,k=Math.pow(2,53),oe=-k,x=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ee=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,D=this,de=0,ge=0,Oe=!1,_e=!1,we=[],re={data:[],errors:[],meta:{}};function Ze(le){return R.skipEmptyLines==="greedy"?le.join("").trim()==="":le.length===1&&le[0].length===0}function Ce(){if(re&&$&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+y.DefaultDelimiter+"'"),$=!1),R.skipEmptyLines&&(re.data=re.data.filter(function(Fe){return!Ze(Fe)})),ve()){let Fe=function(Je,Me){ae(R.transformHeader)&&(Je=R.transformHeader(Je,Me)),we.push(Je)};var ue=Fe;if(re)if(Array.isArray(re.data[0])){for(var le=0;ve()&&le<re.data.length;le++)re.data[le].forEach(Fe);re.data.splice(0,1)}else re.data.forEach(Fe)}function ye(Fe,Je){for(var Me=R.header?{}:[],Le=0;Le<Fe.length;Le++){var Re=Le,De=Fe[Le],De=((Be,Ve)=>(Te=>(R.dynamicTypingFunction&&R.dynamicTyping[Te]===void 0&&(R.dynamicTyping[Te]=R.dynamicTypingFunction(Te)),(R.dynamicTyping[Te]||R.dynamicTyping)===!0))(Be)?Ve==="true"||Ve==="TRUE"||Ve!=="false"&&Ve!=="FALSE"&&((Te=>{if(x.test(Te)&&(Te=parseFloat(Te),oe<Te&&Te<k))return 1})(Ve)?parseFloat(Ve):ee.test(Ve)?new Date(Ve):Ve===""?null:Ve):Ve)(Re=R.header?Le>=we.length?"__parsed_extra":we[Le]:Re,De=R.transform?R.transform(De,Re):De);Re==="__parsed_extra"?(Me[Re]=Me[Re]||[],Me[Re].push(De)):Me[Re]=De}return R.header&&(Le>we.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+we.length+" fields but parsed "+Le,ge+Je):Le<we.length&&se("FieldMismatch","TooFewFields","Too few fields: expected "+we.length+" fields but parsed "+Le,ge+Je)),Me}var Ge;re&&(R.header||R.dynamicTyping||R.transform)&&(Ge=1,!re.data.length||Array.isArray(re.data[0])?(re.data=re.data.map(ye),Ge=re.data.length):re.data=ye(re.data,0),R.header&&re.meta&&(re.meta.fields=we),ge+=Ge)}function ve(){return R.header&&we.length===0}function se(le,ye,Ge,ue){le={type:le,code:ye,message:Ge},ue!==void 0&&(le.row=ue),re.errors.push(le)}ae(R.step)&&(fe=R.step,R.step=function(le){re=le,ve()?Ce():(Ce(),re.data.length!==0&&(de+=le.data.length,R.preview&&de>R.preview?P.abort():(re.data=re.data[0],fe(re,D))))}),this.parse=function(le,ye,Ge){var ue=R.quoteChar||'"',ue=(R.newline||(R.newline=this.guessLineEndings(le,ue)),$=!1,R.delimiter?ae(R.delimiter)&&(R.delimiter=R.delimiter(le),re.meta.delimiter=R.delimiter):((ue=((Fe,Je,Me,Le,Re)=>{var De,Be,Ve,Te;Re=Re||[","," ","|",";",y.RECORD_SEP,y.UNIT_SEP];for(var It=0;It<Re.length;It++){for(var Et,mr=Re[It],lt=0,Qt=0,ze=0,Xe=(Ve=void 0,new Z({comments:Le,delimiter:mr,newline:Je,preview:10}).parse(Fe)),mt=0;mt<Xe.data.length;mt++)Me&&Ze(Xe.data[mt])?ze++:(Et=Xe.data[mt].length,Qt+=Et,Ve===void 0?Ve=Et:0<Et&&(lt+=Math.abs(Et-Ve),Ve=Et));0<Xe.data.length&&(Qt/=Xe.data.length-ze),(Be===void 0||lt<=Be)&&(Te===void 0||Te<Qt)&&1.99<Qt&&(Be=lt,De=mr,Te=Qt)}return{successful:!!(R.delimiter=De),bestDelimiter:De}})(le,R.newline,R.skipEmptyLines,R.comments,R.delimitersToGuess)).successful?R.delimiter=ue.bestDelimiter:($=!0,R.delimiter=y.DefaultDelimiter),re.meta.delimiter=R.delimiter),q(R));return R.preview&&R.header&&ue.preview++,w=le,P=new Z(ue),re=P.parse(w,ye,Ge),Ce(),Oe?{meta:{paused:!0}}:re||{meta:{paused:!1}}},this.paused=function(){return Oe},this.pause=function(){Oe=!0,P.abort(),w=ae(R.chunk)?"":w.substring(P.getCharIndex())},this.resume=function(){D.streamer._halted?(Oe=!1,D.streamer.parseChunk(w,!0)):setTimeout(D.resume,3)},this.aborted=function(){return _e},this.abort=function(){_e=!0,P.abort(),re.meta.aborted=!0,ae(R.complete)&&R.complete(re),w=""},this.guessLineEndings=function(Fe,ue){Fe=Fe.substring(0,1048576);var ue=new RegExp(S(ue)+"([^]*?)"+S(ue),"gm"),Ge=(Fe=Fe.replace(ue,"")).split("\r"),ue=Fe.split(`
8
- `),Fe=1<ue.length&&ue[0].length<Ge[0].length;if(Ge.length===1||Fe)return`
9
- `;for(var Je=0,Me=0;Me<Ge.length;Me++)Ge[Me][0]===`
10
- `&&Je++;return Je>=Ge.length/2?`\r
11
- `:"\r"}}function S(R){return R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(R){var w=(R=R||{}).delimiter,P=R.newline,$=R.comments,fe=R.step,k=R.preview,oe=R.fastMode,x=null,ee=!1,D=R.quoteChar==null?'"':R.quoteChar,de=D;if(R.escapeChar!==void 0&&(de=R.escapeChar),(typeof w!="string"||-1<y.BAD_DELIMITERS.indexOf(w))&&(w=","),$===w)throw new Error("Comment character same as delimiter");$===!0?$="#":(typeof $!="string"||-1<y.BAD_DELIMITERS.indexOf($))&&($=!1),P!==`
12
- `&&P!=="\r"&&P!==`\r
13
- `&&(P=`
14
- `);var ge=0,Oe=!1;this.parse=function(_e,we,re){if(typeof _e!="string")throw new Error("Input must be a string");var Ze=_e.length,Ce=w.length,ve=P.length,se=$.length,le=ae(fe),ye=[],Ge=[],ue=[],Fe=ge=0;if(!_e)return lt();if(oe||oe!==!1&&_e.indexOf(D)===-1){for(var Je=_e.split(P),Me=0;Me<Je.length;Me++){if(ue=Je[Me],ge+=ue.length,Me!==Je.length-1)ge+=P.length;else if(re)return lt();if(!$||ue.substring(0,se)!==$){if(le){if(ye=[],Te(ue.split(w)),Qt(),Oe)return lt()}else Te(ue.split(w));if(k&&k<=Me)return ye=ye.slice(0,k),lt(!0)}}return lt()}for(var Le=_e.indexOf(w,ge),Re=_e.indexOf(P,ge),De=new RegExp(S(de)+S(D),"g"),Be=_e.indexOf(D,ge);;)if(_e[ge]===D)for(Be=ge,ge++;;){if((Be=_e.indexOf(D,Be+1))===-1)return re||Ge.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ye.length,index:ge}),Et();if(Be===Ze-1)return Et(_e.substring(ge,Be).replace(De,D));if(D===de&&_e[Be+1]===de)Be++;else if(D===de||Be===0||_e[Be-1]!==de){Le!==-1&&Le<Be+1&&(Le=_e.indexOf(w,Be+1));var Ve=It((Re=Re!==-1&&Re<Be+1?_e.indexOf(P,Be+1):Re)===-1?Le:Math.min(Le,Re));if(_e.substr(Be+1+Ve,Ce)===w){ue.push(_e.substring(ge,Be).replace(De,D)),_e[ge=Be+1+Ve+Ce]!==D&&(Be=_e.indexOf(D,ge)),Le=_e.indexOf(w,ge),Re=_e.indexOf(P,ge);break}if(Ve=It(Re),_e.substring(Be+1+Ve,Be+1+Ve+ve)===P){if(ue.push(_e.substring(ge,Be).replace(De,D)),mr(Be+1+Ve+ve),Le=_e.indexOf(w,ge),Be=_e.indexOf(D,ge),le&&(Qt(),Oe))return lt();if(k&&ye.length>=k)return lt(!0);break}Ge.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ye.length,index:ge}),Be++}}else if($&&ue.length===0&&_e.substring(ge,ge+se)===$){if(Re===-1)return lt();ge=Re+ve,Re=_e.indexOf(P,ge),Le=_e.indexOf(w,ge)}else if(Le!==-1&&(Le<Re||Re===-1))ue.push(_e.substring(ge,Le)),ge=Le+Ce,Le=_e.indexOf(w,ge);else{if(Re===-1)break;if(ue.push(_e.substring(ge,Re)),mr(Re+ve),le&&(Qt(),Oe))return lt();if(k&&ye.length>=k)return lt(!0)}return Et();function Te(ze){ye.push(ze),Fe=ge}function It(ze){var Xe=0;return Xe=ze!==-1&&(ze=_e.substring(Be+1,ze))&&ze.trim()===""?ze.length:Xe}function Et(ze){return re||(ze===void 0&&(ze=_e.substring(ge)),ue.push(ze),ge=Ze,Te(ue),le&&Qt()),lt()}function mr(ze){ge=ze,Te(ue),ue=[],Re=_e.indexOf(P,ge)}function lt(ze){if(R.header&&!we&&ye.length&&!ee){var Xe=ye[0],mt=Object.create(null),ut=new Set(Xe);let qe=!1;for(let kt=0;kt<Xe.length;kt++){let ft=Xe[kt];if(mt[ft=ae(R.transformHeader)?R.transformHeader(ft,kt):ft]){let Mt,br=mt[ft];for(;Mt=ft+"_"+br,br++,ut.has(Mt););ut.add(Mt),Xe[kt]=Mt,mt[ft]++,qe=!0,(x=x===null?{}:x)[Mt]=ft}else mt[ft]=1,Xe[kt]=ft;ut.add(ft)}qe&&console.warn("Duplicate headers found and renamed."),ee=!0}return{data:ye,errors:Ge,meta:{delimiter:w,linebreak:P,aborted:Oe,truncated:!!ze,cursor:Fe+(we||0),renamedHeaders:x}}}function Qt(){fe(lt()),ye=[],Ge=[]}},this.abort=function(){Oe=!0},this.getCharIndex=function(){return ge}}function _(R){var w=R.data,P=p[w.workerId],$=!1;if(w.error)P.userError(w.error,w.file);else if(w.results&&w.results.data){var fe={abort:function(){$=!0,G(w.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:J,resume:J};if(ae(P.userStep)){for(var k=0;k<w.results.data.length&&(P.userStep({data:w.results.data[k],errors:w.results.errors,meta:w.results.meta},fe),!$);k++);delete w.results}else ae(P.userChunk)&&(P.userChunk(w.results,fe,w.file),delete w.results)}w.finished&&!$&&G(w.workerId,w.results)}function G(R,w){var P=p[R];ae(P.userComplete)&&P.userComplete(w),P.terminate(),delete p[R]}function J(){throw new Error("Not implemented.")}function q(R){if(typeof R!="object"||R===null)return R;var w,P=Array.isArray(R)?[]:{};for(w in R)P[w]=q(R[w]);return P}function te(R,w){return function(){R.apply(w,arguments)}}function ae(R){return typeof R=="function"}return y.parse=function(R,w){var P=(w=w||{}).dynamicTyping||!1;if(ae(P)&&(w.dynamicTypingFunction=P,P={}),w.dynamicTyping=P,w.transform=!!ae(w.transform)&&w.transform,!w.worker||!y.WORKERS_SUPPORTED)return P=null,y.NODE_STREAM_INPUT,typeof R=="string"?(R=($=>$.charCodeAt(0)!==65279?$:$.slice(1))(R),P=new(w.download?U:F)(w)):R.readable===!0&&ae(R.read)&&ae(R.on)?P=new M(w):(n.File&&R instanceof File||R instanceof Object)&&(P=new A(w)),P.stream(R);(P=(()=>{var $;return!!y.WORKERS_SUPPORTED&&($=(()=>{var fe=n.URL||n.webkitURL||null,k=r.toString();return y.BLOB_URL||(y.BLOB_URL=fe.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",k,")();"],{type:"text/javascript"})))})(),($=new n.Worker($)).onmessage=_,$.id=g++,p[$.id]=$)})()).userStep=w.step,P.userChunk=w.chunk,P.userComplete=w.complete,P.userError=w.error,w.step=ae(w.step),w.chunk=ae(w.chunk),w.complete=ae(w.complete),w.error=ae(w.error),delete w.worker,P.postMessage({input:R,config:w,workerId:P.id})},y.unparse=function(R,w){var P=!1,$=!0,fe=",",k=`\r
15
- `,oe='"',x=oe+oe,ee=!1,D=null,de=!1,ge=((()=>{if(typeof w=="object"){if(typeof w.delimiter!="string"||y.BAD_DELIMITERS.filter(function(we){return w.delimiter.indexOf(we)!==-1}).length||(fe=w.delimiter),typeof w.quotes!="boolean"&&typeof w.quotes!="function"&&!Array.isArray(w.quotes)||(P=w.quotes),typeof w.skipEmptyLines!="boolean"&&typeof w.skipEmptyLines!="string"||(ee=w.skipEmptyLines),typeof w.newline=="string"&&(k=w.newline),typeof w.quoteChar=="string"&&(oe=w.quoteChar),typeof w.header=="boolean"&&($=w.header),Array.isArray(w.columns)){if(w.columns.length===0)throw new Error("Option columns is empty");D=w.columns}w.escapeChar!==void 0&&(x=w.escapeChar+oe),w.escapeFormulae instanceof RegExp?de=w.escapeFormulae:typeof w.escapeFormulae=="boolean"&&w.escapeFormulae&&(de=/^[=+\-@\t\r].*$/)}})(),new RegExp(S(oe),"g"));if(typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(R)){if(!R.length||Array.isArray(R[0]))return Oe(null,R,ee);if(typeof R[0]=="object")return Oe(D||Object.keys(R[0]),R,ee)}else if(typeof R=="object")return typeof R.data=="string"&&(R.data=JSON.parse(R.data)),Array.isArray(R.data)&&(R.fields||(R.fields=R.meta&&R.meta.fields||D),R.fields||(R.fields=Array.isArray(R.data[0])?R.fields:typeof R.data[0]=="object"?Object.keys(R.data[0]):[]),Array.isArray(R.data[0])||typeof R.data[0]=="object"||(R.data=[R.data])),Oe(R.fields||[],R.data||[],ee);throw new Error("Unable to serialize unrecognized input");function Oe(we,re,Ze){var Ce="",ve=(typeof we=="string"&&(we=JSON.parse(we)),typeof re=="string"&&(re=JSON.parse(re)),Array.isArray(we)&&0<we.length),se=!Array.isArray(re[0]);if(ve&&$){for(var le=0;le<we.length;le++)0<le&&(Ce+=fe),Ce+=_e(we[le],le);0<re.length&&(Ce+=k)}for(var ye=0;ye<re.length;ye++){var Ge=(ve?we:re[ye]).length,ue=!1,Fe=ve?Object.keys(re[ye]).length===0:re[ye].length===0;if(Ze&&!ve&&(ue=Ze==="greedy"?re[ye].join("").trim()==="":re[ye].length===1&&re[ye][0].length===0),Ze==="greedy"&&ve){for(var Je=[],Me=0;Me<Ge;Me++){var Le=se?we[Me]:Me;Je.push(re[ye][Le])}ue=Je.join("").trim()===""}if(!ue){for(var Re=0;Re<Ge;Re++){0<Re&&!Fe&&(Ce+=fe);var De=ve&&se?we[Re]:Re;Ce+=_e(re[ye][De],Re)}ye<re.length-1&&(!Ze||0<Ge&&!Fe)&&(Ce+=k)}}return Ce}function _e(we,re){var Ze,Ce;return we==null?"":we.constructor===Date?JSON.stringify(we).slice(1,25):(Ce=!1,de&&typeof we=="string"&&de.test(we)&&(we="'"+we,Ce=!0),Ze=we.toString().replace(ge,x),(Ce=Ce||P===!0||typeof P=="function"&&P(we,re)||Array.isArray(P)&&P[re]||((ve,se)=>{for(var le=0;le<se.length;le++)if(-1<ve.indexOf(se[le]))return!0;return!1})(Ze,y.BAD_DELIMITERS)||-1<Ze.indexOf(fe)||Ze.charAt(0)===" "||Ze.charAt(Ze.length-1)===" ")?oe+Ze+oe:Ze)}},y.RECORD_SEP="",y.UNIT_SEP="",y.BYTE_ORDER_MARK="\uFEFF",y.BAD_DELIMITERS=["\r",`
16
- `,'"',y.BYTE_ORDER_MARK],y.WORKERS_SUPPORTED=!l&&!!n.Worker,y.NODE_STREAM_INPUT=1,y.LocalChunkSize=10485760,y.RemoteChunkSize=5242880,y.DefaultDelimiter=",",y.Parser=Z,y.ParserHandle=X,y.NetworkStreamer=U,y.FileStreamer=A,y.StringStreamer=F,y.ReadableStreamStreamer=M,n.jQuery&&((a=n.jQuery).fn.parse=function(R){var w=R.config||{},P=[];return this.each(function(k){if(!(a(this).prop("tagName").toUpperCase()==="INPUT"&&a(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var oe=0;oe<this.files.length;oe++)P.push({file:this.files[oe],inputElem:this,instanceConfig:a.extend({},w)})}),$(),this;function $(){if(P.length===0)ae(R.complete)&&R.complete();else{var k,oe,x,ee,D=P[0];if(ae(R.before)){var de=R.before(D.file,D.inputElem);if(typeof de=="object"){if(de.action==="abort")return k="AbortError",oe=D.file,x=D.inputElem,ee=de.reason,void(ae(R.error)&&R.error({name:k},oe,x,ee));if(de.action==="skip")return void fe();typeof de.config=="object"&&(D.instanceConfig=a.extend(D.instanceConfig,de.config))}else if(de==="skip")return void fe()}var ge=D.instanceConfig.complete;D.instanceConfig.complete=function(Oe){ae(ge)&&ge(Oe,D.file,D.inputElem),fe()},y.parse(D.file,D.instanceConfig)}}function fe(){P.splice(0,1),$()}}),c&&(n.onmessage=function(R){R=R.data,y.WORKER_ID===void 0&&R&&(y.WORKER_ID=R.workerId),typeof R.input=="string"?n.postMessage({workerId:y.WORKER_ID,results:y.parse(R.input,R.config),finished:!0}):(n.File&&R.input instanceof File||R.input instanceof Object)&&(R=y.parse(R.input,R.config))&&n.postMessage({workerId:y.WORKER_ID,results:R,finished:!0})}),(U.prototype=Object.create(T.prototype)).constructor=U,(A.prototype=Object.create(T.prototype)).constructor=A,(F.prototype=Object.create(F.prototype)).constructor=F,(M.prototype=Object.create(T.prototype)).constructor=M,y})});var bn=at((Lu,Fu)=>{(function(r,n){typeof Lu=="object"&&typeof Fu<"u"?Fu.exports=n():typeof define=="function"&&define.amd?define(n):(r=r||self,r.CodeMirror=n())})(Lu,function(){"use strict";var r=navigator.userAgent,n=navigator.platform,a=/gecko\/\d/i.test(r),l=/MSIE \d/.test(r),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(r),p=/Edge\/(\d+)/.exec(r),g=l||c||p,y=g&&(l?document.documentMode||6:+(p||c)[1]),T=!p&&/WebKit\//.test(r),U=T&&/Qt\/\d+\.\d+/.test(r),A=!p&&/Chrome\/(\d+)/.exec(r),F=A&&+A[1],M=/Opera\//.test(r),X=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(r),Z=/PhantomJS/.test(r),_=X&&(/Mobile\/\w+/.test(r)||navigator.maxTouchPoints>2),G=/Android/.test(r),J=_||G||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(r),q=_||/Mac/.test(n),te=/\bCrOS\b/.test(r),ae=/win/i.test(n),R=M&&r.match(/Version\/(\d*\.\d*)/);R&&(R=Number(R[1])),R&&R>=15&&(M=!1,T=!0);var w=q&&(U||M&&(R==null||R<12.11)),P=a||g&&y>=9;function $(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var fe=function(e,t){var o=e.className,i=$(t).exec(o);if(i){var s=o.slice(i.index+i[0].length);e.className=o.slice(0,i.index)+(s?i[1]+s:"")}};function k(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function oe(e,t){return k(e).appendChild(t)}function x(e,t,o,i){var s=document.createElement(e);if(o&&(s.className=o),i&&(s.style.cssText=i),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var u=0;u<t.length;++u)s.appendChild(t[u]);return s}function ee(e,t,o,i){var s=x(e,t,o,i);return s.setAttribute("role","presentation"),s}var D;document.createRange?D=function(e,t,o,i){var s=document.createRange();return s.setEnd(i||e,o),s.setStart(e,t),s}:D=function(e,t,o){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch{return i}return i.collapse(!0),i.moveEnd("character",o),i.moveStart("character",t),i};function de(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function ge(e){var t=e.ownerDocument||e,o;try{o=e.activeElement}catch{o=t.body||null}for(;o&&o.shadowRoot&&o.shadowRoot.activeElement;)o=o.shadowRoot.activeElement;return o}function Oe(e,t){var o=e.className;$(t).test(o)||(e.className+=(o?" ":"")+t)}function _e(e,t){for(var o=e.split(" "),i=0;i<o.length;i++)o[i]&&!$(o[i]).test(t)&&(t+=" "+o[i]);return t}var we=function(e){e.select()};_?we=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:g&&(we=function(e){try{e.select()}catch{}});function re(e){return e.display.wrapper.ownerDocument}function Ze(e){return Ce(e.display.wrapper)}function Ce(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function ve(e){return re(e).defaultView}function se(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function le(e,t,o){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(o!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function ye(e,t,o,i,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var u=i||0,d=s||0;;){var h=e.indexOf(" ",u);if(h<0||h>=t)return d+(t-u);d+=h-u,d+=o-d%o,u=h+1}}var Ge=function(){this.id=null,this.f=null,this.time=0,this.handler=se(this.onTimeout,this)};Ge.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ge.prototype.set=function(e,t){this.f=t;var o=+new Date+e;(!this.id||o<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=o)};function ue(e,t){for(var o=0;o<e.length;++o)if(e[o]==t)return o;return-1}var Fe=50,Je={toString:function(){return"CodeMirror.Pass"}},Me={scroll:!1},Le={origin:"*mouse"},Re={origin:"+move"};function De(e,t,o){for(var i=0,s=0;;){var u=e.indexOf(" ",i);u==-1&&(u=e.length);var d=u-i;if(u==e.length||s+d>=t)return i+Math.min(d,t-s);if(s+=u-i,s+=o-s%o,i=u+1,s>=t)return i}}var Be=[""];function Ve(e){for(;Be.length<=e;)Be.push(Te(Be)+" ");return Be[e]}function Te(e){return e[e.length-1]}function It(e,t){for(var o=[],i=0;i<e.length;i++)o[i]=t(e[i],i);return o}function Et(e,t,o){for(var i=0,s=o(t);i<e.length&&o(e[i])<=s;)i++;e.splice(i,0,t)}function mr(){}function lt(e,t){var o;return Object.create?o=Object.create(e):(mr.prototype=e,o=new mr),t&&le(t,o),o}var Qt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ze(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Qt.test(e))}function Xe(e,t){return t?t.source.indexOf("\\w")>-1&&ze(e)?!0:t.test(e):ze(e)}function mt(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ut=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function qe(e){return e.charCodeAt(0)>=768&&ut.test(e)}function kt(e,t,o){for(;(o<0?t>0:t<e.length)&&qe(e.charAt(t));)t+=o;return t}function ft(e,t,o){for(var i=t>o?-1:1;;){if(t==o)return t;var s=(t+o)/2,u=i<0?Math.ceil(s):Math.floor(s);if(u==t)return e(u)?t:o;e(u)?o=u:t=u+i}}function Mt(e,t,o,i){if(!e)return i(t,o,"ltr",0);for(var s=!1,u=0;u<e.length;++u){var d=e[u];(d.from<o&&d.to>t||t==o&&d.to==t)&&(i(Math.max(d.from,t),Math.min(d.to,o),d.level==1?"rtl":"ltr",u),s=!0)}s||i(t,o,"ltr")}var br=null;function vr(e,t,o){var i;br=null;for(var s=0;s<e.length;++s){var u=e[s];if(u.from<t&&u.to>t)return s;u.to==t&&(u.from!=u.to&&o=="before"?i=s:br=s),u.from==t&&(u.from!=u.to&&o!="before"?i=s:br=s)}return i??br}var vn=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function o(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,u=/[LRr]/,d=/[Lb1n]/,h=/[1n]/;function m(b,I,C){this.level=b,this.from=I,this.to=C}return function(b,I){var C=I=="ltr"?"L":"R";if(b.length==0||I=="ltr"&&!i.test(b))return!1;for(var B=b.length,L=[],W=0;W<B;++W)L.push(o(b.charCodeAt(W)));for(var H=0,z=C;H<B;++H){var ne=L[H];ne=="m"?L[H]=z:z=ne}for(var pe=0,ie=C;pe<B;++pe){var me=L[pe];me=="1"&&ie=="r"?L[pe]="n":u.test(me)&&(ie=me,me=="r"&&(L[pe]="R"))}for(var Ae=1,Ee=L[0];Ae<B-1;++Ae){var ke=L[Ae];ke=="+"&&Ee=="1"&&L[Ae+1]=="1"?L[Ae]="1":ke==","&&Ee==L[Ae+1]&&(Ee=="1"||Ee=="n")&&(L[Ae]=Ee),Ee=ke}for(var et=0;et<B;++et){var Lt=L[et];if(Lt==",")L[et]="N";else if(Lt=="%"){var ct=void 0;for(ct=et+1;ct<B&&L[ct]=="%";++ct);for(var dr=et&&L[et-1]=="!"||ct<B&&L[ct]=="1"?"1":"N",$t=et;$t<ct;++$t)L[$t]=dr;et=ct-1}}for(var bt=0,er=C;bt<B;++bt){var Gt=L[bt];er=="L"&&Gt=="1"?L[bt]="L":u.test(Gt)&&(er=Gt)}for(var xt=0;xt<B;++xt)if(s.test(L[xt])){var vt=void 0;for(vt=xt+1;vt<B&&s.test(L[vt]);++vt);for(var ht=(xt?L[xt-1]:C)=="L",tr=(vt<B?L[vt]:C)=="L",_i=ht==tr?ht?"L":"R":C,wn=xt;wn<vt;++wn)L[wn]=_i;xt=vt-1}for(var Vt=[],Pr,Ft=0;Ft<B;)if(d.test(L[Ft])){var Sl=Ft;for(++Ft;Ft<B&&d.test(L[Ft]);++Ft);Vt.push(new m(0,Sl,Ft))}else{var ln=Ft,jn=Vt.length,zn=I=="rtl"?1:0;for(++Ft;Ft<B&&L[Ft]!="L";++Ft);for(var Xt=ln;Xt<Ft;)if(h.test(L[Xt])){ln<Xt&&(Vt.splice(jn,0,new m(1,ln,Xt)),jn+=zn);var Ni=Xt;for(++Xt;Xt<Ft&&h.test(L[Xt]);++Xt);Vt.splice(jn,0,new m(2,Ni,Xt)),jn+=zn,ln=Xt}else++Xt;ln<Ft&&Vt.splice(jn,0,new m(1,ln,Ft))}return I=="ltr"&&(Vt[0].level==1&&(Pr=b.match(/^\s+/))&&(Vt[0].from=Pr[0].length,Vt.unshift(new m(0,0,Pr[0].length))),Te(Vt).level==1&&(Pr=b.match(/\s+$/))&&(Te(Vt).to-=Pr[0].length,Vt.push(new m(0,B-Pr[0].length,B)))),I=="rtl"?Vt.reverse():Vt}}();function Ne(e,t){var o=e.order;return o==null&&(o=e.order=vn(e.text,t)),o}var Sr=[],Ie=function(e,t,o){if(e.addEventListener)e.addEventListener(t,o,!1);else if(e.attachEvent)e.attachEvent("on"+t,o);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Sr).concat(o)}};function yr(e,t){return e._handlers&&e._handlers[t]||Sr}function Ct(e,t,o){if(e.removeEventListener)e.removeEventListener(t,o,!1);else if(e.detachEvent)e.detachEvent("on"+t,o);else{var i=e._handlers,s=i&&i[t];if(s){var u=ue(s,o);u>-1&&(i[t]=s.slice(0,u).concat(s.slice(u+1)))}}}function Ke(e,t){var o=yr(e,t);if(o.length)for(var i=Array.prototype.slice.call(arguments,2),s=0;s<o.length;++s)o[s].apply(null,i)}function $e(e,t,o){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ke(e,o||t.type,e,t),pt(t)||t.codemirrorIgnore}function sr(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var o=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ue(o,t[i])==-1&&o.push(t[i])}function yt(e,t){return yr(e,t).length>0}function xr(e){e.prototype.on=function(t,o){Ie(this,t,o)},e.prototype.off=function(t,o){Ct(this,t,o)}}function At(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function rt(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function pt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Wr(e){At(e),rt(e)}function yn(e){return e.target||e.srcElement}function Yt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),q&&e.ctrlKey&&t==1&&(t=3),t}var si=function(){if(g&&y<9)return!1;var e=x("div");return"draggable"in e||"dragDrop"in e}(),en;function li(e){if(en==null){var t=x("span","\u200B");oe(e,x("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(en=t.offsetWidth<=1&&t.offsetHeight>2&&!(g&&y<8))}var o=en?x("span","\u200B"):x("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return o.setAttribute("cm-text",""),o}var Pt;function Ht(e){if(Pt!=null)return Pt;var t=oe(e,document.createTextNode("A\u062EA")),o=D(t,0,1).getBoundingClientRect(),i=D(t,1,2).getBoundingClientRect();return k(e),!o||o.left==o.right?!1:Pt=i.right-o.right<3}var jt=`
7
+ `+o+"}":"{"+a.join(",")+"}",gap=o,n}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(i,e,t){var r;if(gap="",indent="",typeof t=="number")for(r=0;r<t;r+=1)indent+=" ";else typeof t=="string"&&(indent=t);if(rep=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("JSON.stringify");return str("",{"":i})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){var j;function walk(i,e){var t,r,n=i[e];if(n&&typeof n=="object")for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r=walk(n,t),r!==void 0?n[t]=r:delete n[t]);return reviver.call(i,e,n)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(i){return"\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})})()});var Tg=st((A2,Sg)=>{Sg.exports=yw;function yw(){return yg(),{}}});var Og=st((w2,Ig)=>{var Sw=zp(),Tw=xg(),Iw=[Tg()];Ig.exports=Sw.createStore(Tw,Iw)});var Rg=st(Ko=>{"use strict";Ko.byteLength=ww;Ko.toByteArray=Cw;Ko.fromByteArray=Nw;var pi=[],Vt=[],Aw=typeof Uint8Array<"u"?Uint8Array:Array,Kl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rr=0,Ag=Kl.length;Rr<Ag;++Rr)pi[Rr]=Kl[Rr],Vt[Kl.charCodeAt(Rr)]=Rr;var Rr,Ag;Vt[45]=62;Vt[95]=63;function wg(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function ww(i){var e=wg(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Rw(i,e,t){return(e+t)*3/4-t}function Cw(i){var e,t=wg(i),r=t[0],n=t[1],s=new Aw(Rw(i,r,n)),o=0,a=n>0?r-4:r,l;for(l=0;l<a;l+=4)e=Vt[i.charCodeAt(l)]<<18|Vt[i.charCodeAt(l+1)]<<12|Vt[i.charCodeAt(l+2)]<<6|Vt[i.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=Vt[i.charCodeAt(l)]<<2|Vt[i.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=Vt[i.charCodeAt(l)]<<10|Vt[i.charCodeAt(l+1)]<<4|Vt[i.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Ew(i){return pi[i>>18&63]+pi[i>>12&63]+pi[i>>6&63]+pi[i&63]}function kw(i,e,t){for(var r,n=[],s=e;s<t;s+=3)r=(i[s]<<16&16711680)+(i[s+1]<<8&65280)+(i[s+2]&255),n.push(Ew(r));return n.join("")}function Nw(i){for(var e,t=i.length,r=t%3,n=[],s=16383,o=0,a=t-r;o<a;o+=s)n.push(kw(i,o,o+s>a?a:o+s));return r===1?(e=i[t-1],n.push(pi[e>>2]+pi[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(pi[e>>10]+pi[e>>4&63]+pi[e<<2&63]+"=")),n.join("")}});var Cg=st(eh=>{eh.read=function(i,e,t,r,n){var s,o,a=n*8-r-1,l=(1<<a)-1,h=l>>1,u=-7,c=t?n-1:0,d=t?-1:1,g=i[e+c];for(c+=d,s=g&(1<<-u)-1,g>>=-u,u+=a;u>0;s=s*256+i[e+c],c+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=r;u>0;o=o*256+i[e+c],c+=d,u-=8);if(s===0)s=1-h;else{if(s===l)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-h}return(g?-1:1)*o*Math.pow(2,s-r)};eh.write=function(i,e,t,r,n,s){var o,a,l,h=s*8-n-1,u=(1<<h)-1,c=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:s-1,m=r?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=d/l:e+=d*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*l-1)*Math.pow(2,n),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;i[t+g]=a&255,g+=m,a/=256,n-=8);for(o=o<<n|a,h+=n;h>0;i[t+g]=o&255,g+=m,o/=256,h-=8);i[t+g-m]|=x*128}});var Dg=st(Sn=>{"use strict";var th=Rg(),xn=Cg(),Eg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Sn.Buffer=E;Sn.SlowBuffer=Uw;Sn.INSPECT_MAX_BYTES=50;var ea=2147483647;Sn.kMaxLength=ea;E.TYPED_ARRAY_SUPPORT=vw();!E.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function vw(){try{let i=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(i,e),i.foo()===42}catch{return!1}}Object.defineProperty(E.prototype,"parent",{enumerable:!0,get:function(){if(E.isBuffer(this))return this.buffer}});Object.defineProperty(E.prototype,"offset",{enumerable:!0,get:function(){if(E.isBuffer(this))return this.byteOffset}});function Gi(i){if(i>ea)throw new RangeError('The value "'+i+'" is invalid for option "size"');let e=new Uint8Array(i);return Object.setPrototypeOf(e,E.prototype),e}function E(i,e,t){if(typeof i=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return sh(i)}return _g(i,e,t)}E.poolSize=8192;function _g(i,e,t){if(typeof i=="string")return Bw(i,e);if(ArrayBuffer.isView(i))return Gw(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(gi(i,ArrayBuffer)||i&&gi(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(gi(i,SharedArrayBuffer)||i&&gi(i.buffer,SharedArrayBuffer)))return rh(i,e,t);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=i.valueOf&&i.valueOf();if(r!=null&&r!==i)return E.from(r,e,t);let n=Fw(i);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return E.from(i[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}E.from=function(i,e,t){return _g(i,e,t)};Object.setPrototypeOf(E.prototype,Uint8Array.prototype);Object.setPrototypeOf(E,Uint8Array);function Bg(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function _w(i,e,t){return Bg(i),i<=0?Gi(i):e!==void 0?typeof t=="string"?Gi(i).fill(e,t):Gi(i).fill(e):Gi(i)}E.alloc=function(i,e,t){return _w(i,e,t)};function sh(i){return Bg(i),Gi(i<0?0:oh(i)|0)}E.allocUnsafe=function(i){return sh(i)};E.allocUnsafeSlow=function(i){return sh(i)};function Bw(i,e){if((typeof e!="string"||e==="")&&(e="utf8"),!E.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Gg(i,e)|0,r=Gi(t),n=r.write(i,e);return n!==t&&(r=r.slice(0,n)),r}function ih(i){let e=i.length<0?0:oh(i.length)|0,t=Gi(e);for(let r=0;r<e;r+=1)t[r]=i[r]&255;return t}function Gw(i){if(gi(i,Uint8Array)){let e=new Uint8Array(i);return rh(e.buffer,e.byteOffset,e.byteLength)}return ih(i)}function rh(i,e,t){if(e<0||i.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&t===void 0?r=new Uint8Array(i):t===void 0?r=new Uint8Array(i,e):r=new Uint8Array(i,e,t),Object.setPrototypeOf(r,E.prototype),r}function Fw(i){if(E.isBuffer(i)){let e=oh(i.length)|0,t=Gi(e);return t.length===0||i.copy(t,0,0,e),t}if(i.length!==void 0)return typeof i.length!="number"||lh(i.length)?Gi(0):ih(i);if(i.type==="Buffer"&&Array.isArray(i.data))return ih(i.data)}function oh(i){if(i>=ea)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ea.toString(16)+" bytes");return i|0}function Uw(i){return+i!=i&&(i=0),E.alloc(+i)}E.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==E.prototype};E.compare=function(e,t){if(gi(e,Uint8Array)&&(e=E.from(e,e.offset,e.byteLength)),gi(t,Uint8Array)&&(t=E.from(t,t.offset,t.byteLength)),!E.isBuffer(e)||!E.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let s=0,o=Math.min(r,n);s<o;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0};E.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};E.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return E.alloc(0);let r;if(t===void 0)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let n=E.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){let o=e[r];if(gi(o,Uint8Array))s+o.length>n.length?(E.isBuffer(o)||(o=E.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(E.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function Gg(i,e){if(E.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||gi(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let t=i.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return nh(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Qg(i).length;default:if(n)return r?-1:nh(i).length;e=(""+e).toLowerCase(),n=!0}}E.byteLength=Gg;function Pw(i,e,t){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(i||(i="utf8");;)switch(i){case"hex":return jw(this,e,t);case"utf8":case"utf-8":return Ug(this,e,t);case"ascii":return Xw(this,e,t);case"latin1":case"binary":return Yw(this,e,t);case"base64":return Qw(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jw(this,e,t);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),r=!0}}E.prototype._isBuffer=!0;function Cr(i,e,t){let r=i[e];i[e]=i[t],i[t]=r}E.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)Cr(this,t,t+1);return this};E.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)Cr(this,t,t+3),Cr(this,t+1,t+2);return this};E.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)Cr(this,t,t+7),Cr(this,t+1,t+6),Cr(this,t+2,t+5),Cr(this,t+3,t+4);return this};E.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ug(this,0,e):Pw.apply(this,arguments)};E.prototype.toLocaleString=E.prototype.toString;E.prototype.equals=function(e){if(!E.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:E.compare(this,e)===0};E.prototype.inspect=function(){let e="",t=Sn.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Eg&&(E.prototype[Eg]=E.prototype.inspect);E.prototype.compare=function(e,t,r,n,s){if(gi(e,Uint8Array)&&(e=E.from(e,e.offset,e.byteLength)),!E.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),r===void 0&&(r=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=r-t,l=Math.min(o,a),h=this.slice(n,s),u=e.slice(t,r);for(let c=0;c<l;++c)if(h[c]!==u[c]){o=h[c],a=u[c];break}return o<a?-1:a<o?1:0};function Fg(i,e,t,r,n){if(i.length===0)return-1;if(typeof t=="string"?(r=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,lh(t)&&(t=n?0:i.length-1),t<0&&(t=i.length+t),t>=i.length){if(n)return-1;t=i.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=E.from(e,r)),E.isBuffer(e))return e.length===0?-1:kg(i,e,t,r,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(i,e,t):Uint8Array.prototype.lastIndexOf.call(i,e,t):kg(i,[e],t,r,n);throw new TypeError("val must be string, number or Buffer")}function kg(i,e,t,r,n){let s=1,o=i.length,a=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(i.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function l(u,c){return s===1?u[c]:u.readUInt16BE(c*s)}let h;if(n){let u=-1;for(h=t;h<o;h++)if(l(i,h)===l(e,u===-1?0:h-u)){if(u===-1&&(u=h),h-u+1===a)return u*s}else u!==-1&&(h-=h-u),u=-1}else for(t+a>o&&(t=o-a),h=t;h>=0;h--){let u=!0;for(let c=0;c<a;c++)if(l(i,h+c)!==l(e,c)){u=!1;break}if(u)return h}return-1}E.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};E.prototype.indexOf=function(e,t,r){return Fg(this,e,t,r,!0)};E.prototype.lastIndexOf=function(e,t,r){return Fg(this,e,t,r,!1)};function Ww(i,e,t,r){t=Number(t)||0;let n=i.length-t;r?(r=Number(r),r>n&&(r=n)):r=n;let s=e.length;r>s/2&&(r=s/2);let o;for(o=0;o<r;++o){let a=parseInt(e.substr(o*2,2),16);if(lh(a))return o;i[t+o]=a}return o}function Lw(i,e,t,r){return ta(nh(e,i.length-t),i,t,r)}function Mw(i,e,t,r){return ta(qw(e),i,t,r)}function Vw(i,e,t,r){return ta(Qg(e),i,t,r)}function Zw(i,e,t,r){return ta(Kw(e,i.length-t),i,t,r)}E.prototype.write=function(e,t,r,n){if(t===void 0)n="utf8",r=this.length,t=0;else if(r===void 0&&typeof t=="string")n=t,r=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(r)?(r=r>>>0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((r===void 0||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return Ww(this,e,t,r);case"utf8":case"utf-8":return Lw(this,e,t,r);case"ascii":case"latin1":case"binary":return Mw(this,e,t,r);case"base64":return Vw(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zw(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Qw(i,e,t){return e===0&&t===i.length?th.fromByteArray(i):th.fromByteArray(i.slice(e,t))}function Ug(i,e,t){t=Math.min(i.length,t);let r=[],n=e;for(;n<t;){let s=i[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=t){let l,h,u,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=i[n+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=i[n+1],h=i[n+2],(l&192)===128&&(h&192)===128&&(c=(s&15)<<12|(l&63)<<6|h&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=i[n+1],h=i[n+2],u=i[n+3],(l&192)===128&&(h&192)===128&&(u&192)===128&&(c=(s&15)<<18|(l&63)<<12|(h&63)<<6|u&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),n+=a}return Dw(r)}var Ng=4096;function Dw(i){let e=i.length;if(e<=Ng)return String.fromCharCode.apply(String,i);let t="",r=0;for(;r<e;)t+=String.fromCharCode.apply(String,i.slice(r,r+=Ng));return t}function Xw(i,e,t){let r="";t=Math.min(i.length,t);for(let n=e;n<t;++n)r+=String.fromCharCode(i[n]&127);return r}function Yw(i,e,t){let r="";t=Math.min(i.length,t);for(let n=e;n<t;++n)r+=String.fromCharCode(i[n]);return r}function jw(i,e,t){let r=i.length;(!e||e<0)&&(e=0),(!t||t<0||t>r)&&(t=r);let n="";for(let s=e;s<t;++s)n+=eR[i[s]];return n}function Jw(i,e,t){let r=i.slice(e,t),n="";for(let s=0;s<r.length-1;s+=2)n+=String.fromCharCode(r[s]+r[s+1]*256);return n}E.prototype.slice=function(e,t){let r=this.length;e=~~e,t=t===void 0?r:~~t,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,E.prototype),n};function tt(i,e,t){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+e>t)throw new RangeError("Trying to access beyond buffer length")}E.prototype.readUintLE=E.prototype.readUIntLE=function(e,t,r){e=e>>>0,t=t>>>0,r||tt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return n};E.prototype.readUintBE=E.prototype.readUIntBE=function(e,t,r){e=e>>>0,t=t>>>0,r||tt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};E.prototype.readUint8=E.prototype.readUInt8=function(e,t){return e=e>>>0,t||tt(e,1,this.length),this[e]};E.prototype.readUint16LE=E.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||tt(e,2,this.length),this[e]|this[e+1]<<8};E.prototype.readUint16BE=E.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||tt(e,2,this.length),this[e]<<8|this[e+1]};E.prototype.readUint32LE=E.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};E.prototype.readUint32BE=E.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};E.prototype.readBigUInt64LE=rr(function(e){e=e>>>0,yn(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&cs(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});E.prototype.readBigUInt64BE=rr(function(e){e=e>>>0,yn(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&cs(e,this.length-8);let n=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(n)<<BigInt(32))+BigInt(s)});E.prototype.readIntLE=function(e,t,r){e=e>>>0,t=t>>>0,r||tt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*t)),n};E.prototype.readIntBE=function(e,t,r){e=e>>>0,t=t>>>0,r||tt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};E.prototype.readInt8=function(e,t){return e=e>>>0,t||tt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};E.prototype.readInt16LE=function(e,t){e=e>>>0,t||tt(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};E.prototype.readInt16BE=function(e,t){e=e>>>0,t||tt(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};E.prototype.readInt32LE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};E.prototype.readInt32BE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};E.prototype.readBigInt64LE=rr(function(e){e=e>>>0,yn(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&cs(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});E.prototype.readBigInt64BE=rr(function(e){e=e>>>0,yn(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&cs(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r)});E.prototype.readFloatLE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),xn.read(this,e,!0,23,4)};E.prototype.readFloatBE=function(e,t){return e=e>>>0,t||tt(e,4,this.length),xn.read(this,e,!1,23,4)};E.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||tt(e,8,this.length),xn.read(this,e,!0,52,8)};E.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||tt(e,8,this.length),xn.read(this,e,!1,52,8)};function xt(i,e,t,r,n,s){if(!E.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(t+r>i.length)throw new RangeError("Index out of range")}E.prototype.writeUintLE=E.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=t>>>0,r=r>>>0,!n){let a=Math.pow(2,8*r)-1;xt(this,e,t,r,a,0)}let s=1,o=0;for(this[t]=e&255;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r};E.prototype.writeUintBE=E.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t=t>>>0,r=r>>>0,!n){let a=Math.pow(2,8*r)-1;xt(this,e,t,r,a,0)}let s=r-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r};E.prototype.writeUint8=E.prototype.writeUInt8=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,1,255,0),this[t]=e&255,t+1};E.prototype.writeUint16LE=E.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};E.prototype.writeUint16BE=E.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};E.prototype.writeUint32LE=E.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};E.prototype.writeUint32BE=E.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Pg(i,e,t,r,n){Zg(e,r,n,i,t,7);let s=Number(e&BigInt(4294967295));i[t++]=s,s=s>>8,i[t++]=s,s=s>>8,i[t++]=s,s=s>>8,i[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o,o=o>>8,i[t++]=o,t}function Wg(i,e,t,r,n){Zg(e,r,n,i,t,7);let s=Number(e&BigInt(4294967295));i[t+7]=s,s=s>>8,i[t+6]=s,s=s>>8,i[t+5]=s,s=s>>8,i[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return i[t+3]=o,o=o>>8,i[t+2]=o,o=o>>8,i[t+1]=o,o=o>>8,i[t]=o,t+8}E.prototype.writeBigUInt64LE=rr(function(e,t=0){return Pg(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});E.prototype.writeBigUInt64BE=rr(function(e,t=0){return Wg(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});E.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=t>>>0,!n){let l=Math.pow(2,8*r-1);xt(this,e,t,r,l-1,-l)}let s=0,o=1,a=0;for(this[t]=e&255;++s<r&&(o*=256);)e<0&&a===0&&this[t+s-1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r};E.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=t>>>0,!n){let l=Math.pow(2,8*r-1);xt(this,e,t,r,l-1,-l)}let s=r-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r};E.prototype.writeInt8=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};E.prototype.writeInt16LE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};E.prototype.writeInt16BE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};E.prototype.writeInt32LE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};E.prototype.writeInt32BE=function(e,t,r){return e=+e,t=t>>>0,r||xt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};E.prototype.writeBigInt64LE=rr(function(e,t=0){return Pg(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});E.prototype.writeBigInt64BE=rr(function(e,t=0){return Wg(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Lg(i,e,t,r,n,s){if(t+r>i.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Mg(i,e,t,r,n){return e=+e,t=t>>>0,n||Lg(i,e,t,4,34028234663852886e22,-34028234663852886e22),xn.write(i,e,t,r,23,4),t+4}E.prototype.writeFloatLE=function(e,t,r){return Mg(this,e,t,!0,r)};E.prototype.writeFloatBE=function(e,t,r){return Mg(this,e,t,!1,r)};function Vg(i,e,t,r,n){return e=+e,t=t>>>0,n||Lg(i,e,t,8,17976931348623157e292,-17976931348623157e292),xn.write(i,e,t,r,52,8),t+8}E.prototype.writeDoubleLE=function(e,t,r){return Vg(this,e,t,!0,r)};E.prototype.writeDoubleBE=function(e,t,r){return Vg(this,e,t,!1,r)};E.prototype.copy=function(e,t,r,n){if(!E.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let s=n-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),s};E.prototype.fill=function(e,t,r,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!E.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t=t>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s<r;++s)this[s]=e;else{let o=E.isBuffer(e)?e:E.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=o[s%a]}return this};var bn={};function ah(i,e,t){bn[i]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}ah("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ah("ERR_INVALID_ARG_TYPE",function(i,e){return`The "${i}" argument must be of type number. Received type ${typeof e}`},TypeError);ah("ERR_OUT_OF_RANGE",function(i,e,t){let r=`The value of "${i}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=vg(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=vg(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r},RangeError);function vg(i){let e="",t=i.length,r=i[0]==="-"?1:0;for(;t>=r+4;t-=3)e=`_${i.slice(t-3,t)}${e}`;return`${i.slice(0,t)}${e}`}function Hw(i,e,t){yn(e,"offset"),(i[e]===void 0||i[e+t]===void 0)&&cs(e,i.length-(t+1))}function Zg(i,e,t,r,n,s){if(i>t||i<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${t}${o}`,new bn.ERR_OUT_OF_RANGE("value",a,i)}Hw(r,n,s)}function yn(i,e){if(typeof i!="number")throw new bn.ERR_INVALID_ARG_TYPE(e,"number",i)}function cs(i,e,t){throw Math.floor(i)!==i?(yn(i,t),new bn.ERR_OUT_OF_RANGE(t||"offset","an integer",i)):e<0?new bn.ERR_BUFFER_OUT_OF_BOUNDS:new bn.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,i)}var zw=/[^+/0-9A-Za-z-_]/g;function $w(i){if(i=i.split("=")[0],i=i.trim().replace(zw,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function nh(i,e){e=e||1/0;let t,r=i.length,n=null,s=[];for(let o=0;o<r;++o){if(t=i.charCodeAt(o),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function qw(i){let e=[];for(let t=0;t<i.length;++t)e.push(i.charCodeAt(t)&255);return e}function Kw(i,e){let t,r,n,s=[];for(let o=0;o<i.length&&!((e-=2)<0);++o)t=i.charCodeAt(o),r=t>>8,n=t%256,s.push(n),s.push(r);return s}function Qg(i){return th.toByteArray($w(i))}function ta(i,e,t,r){let n;for(n=0;n<r&&!(n+t>=e.length||n>=i.length);++n)e[n+t]=i[n];return n}function gi(i,e){return i instanceof e||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===e.name}function lh(i){return i!==i}var eR=function(){let i="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let r=t*16;for(let n=0;n<16;++n)e[r+n]=i[t]+i[n]}return e}();function rr(i){return typeof BigInt>"u"?tR:i}function tR(){throw new Error("BigInt not supported")}});var im=st((mh,bh)=>{((i,e)=>{typeof define=="function"&&define.amd?define([],e):typeof bh=="object"&&typeof mh<"u"?bh.exports=e():i.Papa=e()})(mh,function i(){var e=typeof self<"u"?self:typeof window<"u"?window:e!==void 0?e:{},t,r=!e.document&&!!e.postMessage,n=e.IS_PAPA_WORKER||!1,s={},o=0,a={};function l(T){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(b){var A=F(b);A.chunkSize=parseInt(A.chunkSize),b.step||b.chunk||(A.chunkSize=null),this._handle=new g(A),(this._handle.streamer=this)._config=A}.call(this,T),this.parseChunk=function(b,A){var y=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<y){let N=this._config.newline;N||(v=this._config.quoteChar||'"',N=this._handle.guessLineEndings(b,v)),b=[...b.split(N).slice(y)].join(N)}this.isFirstChunk&&G(this._config.beforeFirstChunk)&&(v=this._config.beforeFirstChunk(b))!==void 0&&(b=v),this.isFirstChunk=!1,this._halted=!1;var y=this._partialLine+b,v=(this._partialLine="",this._handle.parse(y,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(b=v.meta.cursor,y=(this._finished||(this._partialLine=y.substring(b-this._baseIndex),this._baseIndex=b),v&&v.data&&(this._rowCount+=v.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),n)e.postMessage({results:v,workerId:a.WORKER_ID,finished:y});else if(G(this._config.chunk)&&!A){if(this._config.chunk(v,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=v=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(v.data),this._completeResults.errors=this._completeResults.errors.concat(v.errors),this._completeResults.meta=v.meta),this._completed||!y||!G(this._config.complete)||v&&v.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),y||v&&v.meta.paused||this._nextChunk(),v}this._halted=!0},this._sendError=function(b){G(this._config.error)?this._config.error(b):n&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:b,finished:!1})}}function h(T){var b;(T=T||{}).chunkSize||(T.chunkSize=a.RemoteChunkSize),l.call(this,T),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(A){this._input=A,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(b=new XMLHttpRequest,this._config.withCredentials&&(b.withCredentials=this._config.withCredentials),r||(b.onload=M(this._chunkLoaded,this),b.onerror=M(this._chunkError,this)),b.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var A,y=this._config.downloadRequestHeaders;for(A in y)b.setRequestHeader(A,y[A])}var v;this._config.chunkSize&&(v=this._start+this._config.chunkSize-1,b.setRequestHeader("Range","bytes="+this._start+"-"+v));try{b.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}r&&b.status===0&&this._chunkError()}},this._chunkLoaded=function(){b.readyState===4&&(b.status<200||400<=b.status?this._chunkError():(this._start+=this._config.chunkSize||b.responseText.length,this._finished=!this._config.chunkSize||this._start>=(A=>(A=A.getResponseHeader("Content-Range"))!==null?parseInt(A.substring(A.lastIndexOf("/")+1)):-1)(b),this.parseChunk(b.responseText)))},this._chunkError=function(A){A=b.statusText||A,this._sendError(new Error(A))}}function u(T){(T=T||{}).chunkSize||(T.chunkSize=a.LocalChunkSize),l.call(this,T);var b,A,y=typeof FileReader<"u";this.stream=function(v){this._input=v,A=v.slice||v.webkitSlice||v.mozSlice,y?((b=new FileReader).onload=M(this._chunkLoaded,this),b.onerror=M(this._chunkError,this)):b=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var v=this._input,N=(this._config.chunkSize&&(N=Math.min(this._start+this._config.chunkSize,this._input.size),v=A.call(v,this._start,N)),b.readAsText(v,this._config.encoding));y||this._chunkLoaded({target:{result:N}})},this._chunkLoaded=function(v){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(v.target.result)},this._chunkError=function(){this._sendError(b.error)}}function c(T){var b;l.call(this,T=T||{}),this.stream=function(A){return b=A,this._nextChunk()},this._nextChunk=function(){var A,y;if(!this._finished)return A=this._config.chunkSize,b=A?(y=b.substring(0,A),b.substring(A)):(y=b,""),this._finished=!b,this.parseChunk(y)}}function d(T){l.call(this,T=T||{});var b=[],A=!0,y=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(v){this._input=v,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){y&&b.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),b.length?this.parseChunk(b.shift()):A=!0},this._streamData=M(function(v){try{b.push(typeof v=="string"?v:v.toString(this._config.encoding)),A&&(A=!1,this._checkIsFinished(),this.parseChunk(b.shift()))}catch(N){this._streamError(N)}},this),this._streamError=M(function(v){this._streamCleanUp(),this._sendError(v)},this),this._streamEnd=M(function(){this._streamCleanUp(),y=!0,this._streamData("")},this),this._streamCleanUp=M(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function g(T){var b,A,y,v,N=Math.pow(2,53),V=-N,re=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ne=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,J=this,me=0,z=0,we=!1,H=!1,U=[],C={data:[],errors:[],meta:{}};function Z($){return T.skipEmptyLines==="greedy"?$.join("").trim()==="":$.length===1&&$[0].length===0}function D(){if(C&&y&&(X("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),y=!1),T.skipEmptyLines&&(C.data=C.data.filter(function(ce){return!Z(ce)})),Ie()){let ce=function(Ce,xe){G(T.transformHeader)&&(Ce=T.transformHeader(Ce,xe)),U.push(Ce)};var te=ce;if(C)if(Array.isArray(C.data[0])){for(var $=0;Ie()&&$<C.data.length;$++)C.data[$].forEach(ce);C.data.splice(0,1)}else C.data.forEach(ce)}function oe(ce,Ce){for(var xe=T.header?{}:[],fe=0;fe<ce.length;fe++){var se=fe,ve=ce[fe],ve=((de,Oe)=>(Ee=>(T.dynamicTypingFunction&&T.dynamicTyping[Ee]===void 0&&(T.dynamicTyping[Ee]=T.dynamicTypingFunction(Ee)),(T.dynamicTyping[Ee]||T.dynamicTyping)===!0))(de)?Oe==="true"||Oe==="TRUE"||Oe!=="false"&&Oe!=="FALSE"&&((Ee=>{if(re.test(Ee)&&(Ee=parseFloat(Ee),V<Ee&&Ee<N))return 1})(Oe)?parseFloat(Oe):ne.test(Oe)?new Date(Oe):Oe===""?null:Oe):Oe)(se=T.header?fe>=U.length?"__parsed_extra":U[fe]:se,ve=T.transform?T.transform(ve,se):ve);se==="__parsed_extra"?(xe[se]=xe[se]||[],xe[se].push(ve)):xe[se]=ve}return T.header&&(fe>U.length?X("FieldMismatch","TooManyFields","Too many fields: expected "+U.length+" fields but parsed "+fe,z+Ce):fe<U.length&&X("FieldMismatch","TooFewFields","Too few fields: expected "+U.length+" fields but parsed "+fe,z+Ce)),xe}var be;C&&(T.header||T.dynamicTyping||T.transform)&&(be=1,!C.data.length||Array.isArray(C.data[0])?(C.data=C.data.map(oe),be=C.data.length):C.data=oe(C.data,0),T.header&&C.meta&&(C.meta.fields=U),z+=be)}function Ie(){return T.header&&U.length===0}function X($,oe,be,te){$={type:$,code:oe,message:be},te!==void 0&&($.row=te),C.errors.push($)}G(T.step)&&(v=T.step,T.step=function($){C=$,Ie()?D():(D(),C.data.length!==0&&(me+=$.data.length,T.preview&&me>T.preview?A.abort():(C.data=C.data[0],v(C,J))))}),this.parse=function($,oe,be){var te=T.quoteChar||'"',te=(T.newline||(T.newline=this.guessLineEndings($,te)),y=!1,T.delimiter?G(T.delimiter)&&(T.delimiter=T.delimiter($),C.meta.delimiter=T.delimiter):((te=((ce,Ce,xe,fe,se)=>{var ve,de,Oe,Ee;se=se||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var wt=0;wt<se.length;wt++){for(var rt,Rt=se[wt],De=0,Je=0,ae=0,Be=(Oe=void 0,new x({comments:fe,delimiter:Rt,newline:Ce,preview:10}).parse(ce)),Xe=0;Xe<Be.data.length;Xe++)xe&&Z(Be.data[Xe])?ae++:(rt=Be.data[Xe].length,Je+=rt,Oe===void 0?Oe=rt:0<rt&&(De+=Math.abs(rt-Oe),Oe=rt));0<Be.data.length&&(Je/=Be.data.length-ae),(de===void 0||De<=de)&&(Ee===void 0||Ee<Je)&&1.99<Je&&(de=De,ve=Rt,Ee=Je)}return{successful:!!(T.delimiter=ve),bestDelimiter:ve}})($,T.newline,T.skipEmptyLines,T.comments,T.delimitersToGuess)).successful?T.delimiter=te.bestDelimiter:(y=!0,T.delimiter=a.DefaultDelimiter),C.meta.delimiter=T.delimiter),F(T));return T.preview&&T.header&&te.preview++,b=$,A=new x(te),C=A.parse(b,oe,be),D(),we?{meta:{paused:!0}}:C||{meta:{paused:!1}}},this.paused=function(){return we},this.pause=function(){we=!0,A.abort(),b=G(T.chunk)?"":b.substring(A.getCharIndex())},this.resume=function(){J.streamer._halted?(we=!1,J.streamer.parseChunk(b,!0)):setTimeout(J.resume,3)},this.aborted=function(){return H},this.abort=function(){H=!0,A.abort(),C.meta.aborted=!0,G(T.complete)&&T.complete(C),b=""},this.guessLineEndings=function(ce,te){ce=ce.substring(0,1048576);var te=new RegExp(m(te)+"([^]*?)"+m(te),"gm"),be=(ce=ce.replace(te,"")).split("\r"),te=ce.split(`
8
+ `),ce=1<te.length&&te[0].length<be[0].length;if(be.length===1||ce)return`
9
+ `;for(var Ce=0,xe=0;xe<be.length;xe++)be[xe][0]===`
10
+ `&&Ce++;return Ce>=be.length/2?`\r
11
+ `:"\r"}}function m(T){return T.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(T){var b=(T=T||{}).delimiter,A=T.newline,y=T.comments,v=T.step,N=T.preview,V=T.fastMode,re=null,ne=!1,J=T.quoteChar==null?'"':T.quoteChar,me=J;if(T.escapeChar!==void 0&&(me=T.escapeChar),(typeof b!="string"||-1<a.BAD_DELIMITERS.indexOf(b))&&(b=","),y===b)throw new Error("Comment character same as delimiter");y===!0?y="#":(typeof y!="string"||-1<a.BAD_DELIMITERS.indexOf(y))&&(y=!1),A!==`
12
+ `&&A!=="\r"&&A!==`\r
13
+ `&&(A=`
14
+ `);var z=0,we=!1;this.parse=function(H,U,C){if(typeof H!="string")throw new Error("Input must be a string");var Z=H.length,D=b.length,Ie=A.length,X=y.length,$=G(v),oe=[],be=[],te=[],ce=z=0;if(!H)return De();if(V||V!==!1&&H.indexOf(J)===-1){for(var Ce=H.split(A),xe=0;xe<Ce.length;xe++){if(te=Ce[xe],z+=te.length,xe!==Ce.length-1)z+=A.length;else if(C)return De();if(!y||te.substring(0,X)!==y){if($){if(oe=[],Ee(te.split(b)),Je(),we)return De()}else Ee(te.split(b));if(N&&N<=xe)return oe=oe.slice(0,N),De(!0)}}return De()}for(var fe=H.indexOf(b,z),se=H.indexOf(A,z),ve=new RegExp(m(me)+m(J),"g"),de=H.indexOf(J,z);;)if(H[z]===J)for(de=z,z++;;){if((de=H.indexOf(J,de+1))===-1)return C||be.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:oe.length,index:z}),rt();if(de===Z-1)return rt(H.substring(z,de).replace(ve,J));if(J===me&&H[de+1]===me)de++;else if(J===me||de===0||H[de-1]!==me){fe!==-1&&fe<de+1&&(fe=H.indexOf(b,de+1));var Oe=wt((se=se!==-1&&se<de+1?H.indexOf(A,de+1):se)===-1?fe:Math.min(fe,se));if(H.substr(de+1+Oe,D)===b){te.push(H.substring(z,de).replace(ve,J)),H[z=de+1+Oe+D]!==J&&(de=H.indexOf(J,z)),fe=H.indexOf(b,z),se=H.indexOf(A,z);break}if(Oe=wt(se),H.substring(de+1+Oe,de+1+Oe+Ie)===A){if(te.push(H.substring(z,de).replace(ve,J)),Rt(de+1+Oe+Ie),fe=H.indexOf(b,z),de=H.indexOf(J,z),$&&(Je(),we))return De();if(N&&oe.length>=N)return De(!0);break}be.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:oe.length,index:z}),de++}}else if(y&&te.length===0&&H.substring(z,z+X)===y){if(se===-1)return De();z=se+Ie,se=H.indexOf(A,z),fe=H.indexOf(b,z)}else if(fe!==-1&&(fe<se||se===-1))te.push(H.substring(z,fe)),z=fe+D,fe=H.indexOf(b,z);else{if(se===-1)break;if(te.push(H.substring(z,se)),Rt(se+Ie),$&&(Je(),we))return De();if(N&&oe.length>=N)return De(!0)}return rt();function Ee(ae){oe.push(ae),ce=z}function wt(ae){var Be=0;return Be=ae!==-1&&(ae=H.substring(de+1,ae))&&ae.trim()===""?ae.length:Be}function rt(ae){return C||(ae===void 0&&(ae=H.substring(z)),te.push(ae),z=Z,Ee(te),$&&Je()),De()}function Rt(ae){z=ae,Ee(te),te=[],se=H.indexOf(A,z)}function De(ae){if(T.header&&!U&&oe.length&&!ne){var Be=oe[0],Xe=Object.create(null),Ye=new Set(Be);let Zi=!1;for(let Ut=0;Ut<Be.length;Ut++){let lt=Be[Ut];if(Xe[lt=G(T.transformHeader)?T.transformHeader(lt,Ut):lt]){let he,br=Xe[lt];for(;he=lt+"_"+br,br++,Ye.has(he););Ye.add(he),Be[Ut]=he,Xe[lt]++,Zi=!0,(re=re===null?{}:re)[he]=lt}else Xe[lt]=1,Be[Ut]=lt;Ye.add(lt)}Zi&&console.warn("Duplicate headers found and renamed."),ne=!0}return{data:oe,errors:be,meta:{delimiter:b,linebreak:A,aborted:we,truncated:!!ae,cursor:ce+(U||0),renamedHeaders:re}}}function Je(){v(De()),oe=[],be=[]}},this.abort=function(){we=!0},this.getCharIndex=function(){return z}}function O(T){var b=T.data,A=s[b.workerId],y=!1;if(b.error)A.userError(b.error,b.file);else if(b.results&&b.results.data){var v={abort:function(){y=!0,w(b.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:B,resume:B};if(G(A.userStep)){for(var N=0;N<b.results.data.length&&(A.userStep({data:b.results.data[N],errors:b.results.errors,meta:b.results.meta},v),!y);N++);delete b.results}else G(A.userChunk)&&(A.userChunk(b.results,v,b.file),delete b.results)}b.finished&&!y&&w(b.workerId,b.results)}function w(T,b){var A=s[T];G(A.userComplete)&&A.userComplete(b),A.terminate(),delete s[T]}function B(){throw new Error("Not implemented.")}function F(T){if(typeof T!="object"||T===null)return T;var b,A=Array.isArray(T)?[]:{};for(b in T)A[b]=F(T[b]);return A}function M(T,b){return function(){T.apply(b,arguments)}}function G(T){return typeof T=="function"}return a.parse=function(T,b){var A=(b=b||{}).dynamicTyping||!1;if(G(A)&&(b.dynamicTypingFunction=A,A={}),b.dynamicTyping=A,b.transform=!!G(b.transform)&&b.transform,!b.worker||!a.WORKERS_SUPPORTED)return A=null,a.NODE_STREAM_INPUT,typeof T=="string"?(T=(y=>y.charCodeAt(0)!==65279?y:y.slice(1))(T),A=new(b.download?h:c)(b)):T.readable===!0&&G(T.read)&&G(T.on)?A=new d(b):(e.File&&T instanceof File||T instanceof Object)&&(A=new u(b)),A.stream(T);(A=(()=>{var y;return!!a.WORKERS_SUPPORTED&&(y=(()=>{var v=e.URL||e.webkitURL||null,N=i.toString();return a.BLOB_URL||(a.BLOB_URL=v.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",N,")();"],{type:"text/javascript"})))})(),(y=new e.Worker(y)).onmessage=O,y.id=o++,s[y.id]=y)})()).userStep=b.step,A.userChunk=b.chunk,A.userComplete=b.complete,A.userError=b.error,b.step=G(b.step),b.chunk=G(b.chunk),b.complete=G(b.complete),b.error=G(b.error),delete b.worker,A.postMessage({input:T,config:b,workerId:A.id})},a.unparse=function(T,b){var A=!1,y=!0,v=",",N=`\r
15
+ `,V='"',re=V+V,ne=!1,J=null,me=!1,z=((()=>{if(typeof b=="object"){if(typeof b.delimiter!="string"||a.BAD_DELIMITERS.filter(function(U){return b.delimiter.indexOf(U)!==-1}).length||(v=b.delimiter),typeof b.quotes!="boolean"&&typeof b.quotes!="function"&&!Array.isArray(b.quotes)||(A=b.quotes),typeof b.skipEmptyLines!="boolean"&&typeof b.skipEmptyLines!="string"||(ne=b.skipEmptyLines),typeof b.newline=="string"&&(N=b.newline),typeof b.quoteChar=="string"&&(V=b.quoteChar),typeof b.header=="boolean"&&(y=b.header),Array.isArray(b.columns)){if(b.columns.length===0)throw new Error("Option columns is empty");J=b.columns}b.escapeChar!==void 0&&(re=b.escapeChar+V),b.escapeFormulae instanceof RegExp?me=b.escapeFormulae:typeof b.escapeFormulae=="boolean"&&b.escapeFormulae&&(me=/^[=+\-@\t\r].*$/)}})(),new RegExp(m(V),"g"));if(typeof T=="string"&&(T=JSON.parse(T)),Array.isArray(T)){if(!T.length||Array.isArray(T[0]))return we(null,T,ne);if(typeof T[0]=="object")return we(J||Object.keys(T[0]),T,ne)}else if(typeof T=="object")return typeof T.data=="string"&&(T.data=JSON.parse(T.data)),Array.isArray(T.data)&&(T.fields||(T.fields=T.meta&&T.meta.fields||J),T.fields||(T.fields=Array.isArray(T.data[0])?T.fields:typeof T.data[0]=="object"?Object.keys(T.data[0]):[]),Array.isArray(T.data[0])||typeof T.data[0]=="object"||(T.data=[T.data])),we(T.fields||[],T.data||[],ne);throw new Error("Unable to serialize unrecognized input");function we(U,C,Z){var D="",Ie=(typeof U=="string"&&(U=JSON.parse(U)),typeof C=="string"&&(C=JSON.parse(C)),Array.isArray(U)&&0<U.length),X=!Array.isArray(C[0]);if(Ie&&y){for(var $=0;$<U.length;$++)0<$&&(D+=v),D+=H(U[$],$);0<C.length&&(D+=N)}for(var oe=0;oe<C.length;oe++){var be=(Ie?U:C[oe]).length,te=!1,ce=Ie?Object.keys(C[oe]).length===0:C[oe].length===0;if(Z&&!Ie&&(te=Z==="greedy"?C[oe].join("").trim()==="":C[oe].length===1&&C[oe][0].length===0),Z==="greedy"&&Ie){for(var Ce=[],xe=0;xe<be;xe++){var fe=X?U[xe]:xe;Ce.push(C[oe][fe])}te=Ce.join("").trim()===""}if(!te){for(var se=0;se<be;se++){0<se&&!ce&&(D+=v);var ve=Ie&&X?U[se]:se;D+=H(C[oe][ve],se)}oe<C.length-1&&(!Z||0<be&&!ce)&&(D+=N)}}return D}function H(U,C){var Z,D;return U==null?"":U.constructor===Date?JSON.stringify(U).slice(1,25):(D=!1,me&&typeof U=="string"&&me.test(U)&&(U="'"+U,D=!0),Z=U.toString().replace(z,re),(D=D||A===!0||typeof A=="function"&&A(U,C)||Array.isArray(A)&&A[C]||((Ie,X)=>{for(var $=0;$<X.length;$++)if(-1<Ie.indexOf(X[$]))return!0;return!1})(Z,a.BAD_DELIMITERS)||-1<Z.indexOf(v)||Z.charAt(0)===" "||Z.charAt(Z.length-1)===" ")?V+Z+V:Z)}},a.RECORD_SEP="",a.UNIT_SEP="",a.BYTE_ORDER_MARK="\uFEFF",a.BAD_DELIMITERS=["\r",`
16
+ `,'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!r&&!!e.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=x,a.ParserHandle=g,a.NetworkStreamer=h,a.FileStreamer=u,a.StringStreamer=c,a.ReadableStreamStreamer=d,e.jQuery&&((t=e.jQuery).fn.parse=function(T){var b=T.config||{},A=[];return this.each(function(N){if(!(t(this).prop("tagName").toUpperCase()==="INPUT"&&t(this).attr("type").toLowerCase()==="file"&&e.FileReader)||!this.files||this.files.length===0)return!0;for(var V=0;V<this.files.length;V++)A.push({file:this.files[V],inputElem:this,instanceConfig:t.extend({},b)})}),y(),this;function y(){if(A.length===0)G(T.complete)&&T.complete();else{var N,V,re,ne,J=A[0];if(G(T.before)){var me=T.before(J.file,J.inputElem);if(typeof me=="object"){if(me.action==="abort")return N="AbortError",V=J.file,re=J.inputElem,ne=me.reason,void(G(T.error)&&T.error({name:N},V,re,ne));if(me.action==="skip")return void v();typeof me.config=="object"&&(J.instanceConfig=t.extend(J.instanceConfig,me.config))}else if(me==="skip")return void v()}var z=J.instanceConfig.complete;J.instanceConfig.complete=function(we){G(z)&&z(we,J.file,J.inputElem),v()},a.parse(J.file,J.instanceConfig)}}function v(){A.splice(0,1),y()}}),n&&(e.onmessage=function(T){T=T.data,a.WORKER_ID===void 0&&T&&(a.WORKER_ID=T.workerId),typeof T.input=="string"?e.postMessage({workerId:a.WORKER_ID,results:a.parse(T.input,T.config),finished:!0}):(e.File&&T.input instanceof File||T.input instanceof Object)&&(T=a.parse(T.input,T.config))&&e.postMessage({workerId:a.WORKER_ID,results:T,finished:!0})}),(h.prototype=Object.create(l.prototype)).constructor=h,(u.prototype=Object.create(l.prototype)).constructor=u,(c.prototype=Object.create(c.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,a})});var Nk={};Ix(Nk,{Parser:()=>Ss,Yasr:()=>Ri,buildObjectOfQuery:()=>yl,buildSubjectOfQuery:()=>xl,default:()=>kk,registerPlugin:()=>Ek});var mx=po(lc());var Nx=typeof global=="object"&&global&&global.Object===Object&&global,bo=Nx;var vx=typeof self=="object"&&self&&self.Object===Object&&self,_x=bo||vx||Function("return this")(),He=_x;var Bx=He.Symbol,ut=Bx;var hc=Object.prototype,Gx=hc.hasOwnProperty,Fx=hc.toString,Hn=ut?ut.toStringTag:void 0;function Ux(i){var e=Gx.call(i,Hn),t=i[Hn];try{i[Hn]=void 0;var r=!0}catch{}var n=Fx.call(i);return r&&(e?i[Hn]=t:delete i[Hn]),n}var uc=Ux;var Px=Object.prototype,Wx=Px.toString;function Lx(i){return Wx.call(i)}var fc=Lx;var Mx="[object Null]",Vx="[object Undefined]",cc=ut?ut.toStringTag:void 0;function Zx(i){return i==null?i===void 0?Vx:Mx:cc&&cc in Object(i)?uc(i):fc(i)}var vt=Zx;function Qx(i){return i!=null&&typeof i=="object"}var $e=Qx;var Dx="[object Symbol]";function Xx(i){return typeof i=="symbol"||$e(i)&&vt(i)==Dx}var zr=Xx;function Yx(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var dc=Yx;var jx=Array.isArray,Fe=jx;var Jx=1/0,pc=ut?ut.prototype:void 0,gc=pc?pc.toString:void 0;function mc(i){if(typeof i=="string")return i;if(Fe(i))return dc(i,mc)+"";if(zr(i))return gc?gc.call(i):"";var e=i+"";return e=="0"&&1/i==-Jx?"-0":e}var bc=mc;function Hx(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var et=Hx;function zx(i){return i}var $r=zx;var $x="[object AsyncFunction]",qx="[object Function]",Kx="[object GeneratorFunction]",ey="[object Proxy]";function ty(i){if(!et(i))return!1;var e=vt(i);return e==qx||e==Kx||e==$x||e==ey}var qr=ty;var iy=He["__core-js_shared__"],xo=iy;var xc=function(){var i=/[^.]+$/.exec(xo&&xo.keys&&xo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function ry(i){return!!xc&&xc in i}var yc=ry;var ny=Function.prototype,sy=ny.toString;function oy(i){if(i!=null){try{return sy.call(i)}catch{}try{return i+""}catch{}}return""}var ki=oy;var ay=/[\\^$.*+?()[\]{}|]/g,ly=/^\[object .+?Constructor\]$/,hy=Function.prototype,uy=Object.prototype,fy=hy.toString,cy=uy.hasOwnProperty,dy=RegExp("^"+fy.call(cy).replace(ay,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function py(i){if(!et(i)||yc(i))return!1;var e=qr(i)?dy:ly;return e.test(ki(i))}var Sc=py;function gy(i,e){return i?.[e]}var Tc=gy;function my(i,e){var t=Tc(i,e);return Sc(t)?t:void 0}var bt=my;var by=bt(He,"WeakMap"),yo=by;var Ic=Object.create,xy=function(){function i(){}return function(e){if(!et(e))return{};if(Ic)return Ic(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),Oc=xy;function yy(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var Ac=yy;function Sy(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var So=Sy;var Ty=800,Iy=16,Oy=Date.now;function Ay(i){var e=0,t=0;return function(){var r=Oy(),n=Iy-(r-t);if(t=r,n>0){if(++e>=Ty)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var wc=Ay;function wy(i){return function(){return i}}var Rc=wy;var Ry=function(){try{var i=bt(Object,"defineProperty");return i({},"",{}),i}catch{}}(),Kr=Ry;var Cy=Kr?function(i,e){return Kr(i,"toString",{configurable:!0,enumerable:!1,value:Rc(e),writable:!0})}:$r,Cc=Cy;var Ey=wc(Cc),Ec=Ey;function ky(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var kc=ky;var Ny=9007199254740991,vy=/^(?:0|[1-9]\d*)$/;function _y(i,e){var t=typeof i;return e=e??Ny,!!e&&(t=="number"||t!="symbol"&&vy.test(i))&&i>-1&&i%1==0&&i<e}var en=_y;function By(i,e,t){e=="__proto__"&&Kr?Kr(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var Ji=By;function Gy(i,e){return i===e||i!==i&&e!==e}var li=Gy;var Fy=Object.prototype,Uy=Fy.hasOwnProperty;function Py(i,e,t){var r=i[e];(!(Uy.call(i,e)&&li(r,t))||t===void 0&&!(e in i))&&Ji(i,e,t)}var To=Py;function Wy(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?Ji(t,a,l):To(t,a,l)}return t}var hi=Wy;var Nc=Math.max;function Ly(i,e,t){return e=Nc(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Nc(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),Ac(i,this,a)}}var vc=Ly;function My(i,e){return Ec(vc(i,e,$r),i+"")}var _c=My;var Vy=9007199254740991;function Zy(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Vy}var tn=Zy;function Qy(i){return i!=null&&tn(i.length)&&!qr(i)}var Lt=Qy;function Dy(i,e,t){if(!et(t))return!1;var r=typeof e;return(r=="number"?Lt(t)&&en(e,t.length):r=="string"&&e in t)?li(t[e],i):!1}var Bc=Dy;function Xy(i){return _c(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&Bc(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var Gc=Xy;var Yy=Object.prototype;function jy(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||Yy;return i===t}var Hi=jy;function Jy(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var Fc=Jy;var Hy="[object Arguments]";function zy(i){return $e(i)&&vt(i)==Hy}var Al=zy;var Uc=Object.prototype,$y=Uc.hasOwnProperty,qy=Uc.propertyIsEnumerable,Ky=Al(function(){return arguments}())?Al:function(i){return $e(i)&&$y.call(i,"callee")&&!qy.call(i,"callee")},Ni=Ky;function e1(){return!1}var Pc=e1;var Mc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wc=Mc&&typeof module=="object"&&module&&!module.nodeType&&module,t1=Wc&&Wc.exports===Mc,Lc=t1?He.Buffer:void 0,i1=Lc?Lc.isBuffer:void 0,r1=i1||Pc,Ht=r1;var n1="[object Arguments]",s1="[object Array]",o1="[object Boolean]",a1="[object Date]",l1="[object Error]",h1="[object Function]",u1="[object Map]",f1="[object Number]",c1="[object Object]",d1="[object RegExp]",p1="[object Set]",g1="[object String]",m1="[object WeakMap]",b1="[object ArrayBuffer]",x1="[object DataView]",y1="[object Float32Array]",S1="[object Float64Array]",T1="[object Int8Array]",I1="[object Int16Array]",O1="[object Int32Array]",A1="[object Uint8Array]",w1="[object Uint8ClampedArray]",R1="[object Uint16Array]",C1="[object Uint32Array]",We={};We[y1]=We[S1]=We[T1]=We[I1]=We[O1]=We[A1]=We[w1]=We[R1]=We[C1]=!0;We[n1]=We[s1]=We[b1]=We[o1]=We[x1]=We[a1]=We[l1]=We[h1]=We[u1]=We[f1]=We[c1]=We[d1]=We[p1]=We[g1]=We[m1]=!1;function E1(i){return $e(i)&&tn(i.length)&&!!We[vt(i)]}var Vc=E1;function k1(i){return function(e){return i(e)}}var rn=k1;var Zc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zn=Zc&&typeof module=="object"&&module&&!module.nodeType&&module,N1=zn&&zn.exports===Zc,wl=N1&&bo.process,v1=function(){try{var i=zn&&zn.require&&zn.require("util").types;return i||wl&&wl.binding&&wl.binding("util")}catch{}}(),vi=v1;var Qc=vi&&vi.isTypedArray,_1=Qc?rn(Qc):Vc,zi=_1;var B1=Object.prototype,G1=B1.hasOwnProperty;function F1(i,e){var t=Fe(i),r=!t&&Ni(i),n=!t&&!r&&Ht(i),s=!t&&!r&&!n&&zi(i),o=t||r||n||s,a=o?Fc(i.length,String):[],l=a.length;for(var h in i)(e||G1.call(i,h))&&!(o&&(h=="length"||n&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||en(h,l)))&&a.push(h);return a}var Io=F1;function U1(i,e){return function(t){return i(e(t))}}var Oo=U1;var P1=Oo(Object.keys,Object),Dc=P1;var W1=Object.prototype,L1=W1.hasOwnProperty;function M1(i){if(!Hi(i))return Dc(i);var e=[];for(var t in Object(i))L1.call(i,t)&&t!="constructor"&&e.push(t);return e}var Ao=M1;function V1(i){return Lt(i)?Io(i):Ao(i)}var ui=V1;function Z1(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Xc=Z1;var Q1=Object.prototype,D1=Q1.hasOwnProperty;function X1(i){if(!et(i))return Xc(i);var e=Hi(i),t=[];for(var r in i)r=="constructor"&&(e||!D1.call(i,r))||t.push(r);return t}var Yc=X1;function Y1(i){return Lt(i)?Io(i,!0):Yc(i)}var fi=Y1;var j1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J1=/^\w*$/;function H1(i,e){if(Fe(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||zr(i)?!0:J1.test(i)||!j1.test(i)||e!=null&&i in Object(e)}var nn=H1;var z1=bt(Object,"create"),_i=z1;function $1(){this.__data__=_i?_i(null):{},this.size=0}var jc=$1;function q1(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Jc=q1;var K1="__lodash_hash_undefined__",eS=Object.prototype,tS=eS.hasOwnProperty;function iS(i){var e=this.__data__;if(_i){var t=e[i];return t===K1?void 0:t}return tS.call(e,i)?e[i]:void 0}var Hc=iS;var rS=Object.prototype,nS=rS.hasOwnProperty;function sS(i){var e=this.__data__;return _i?e[i]!==void 0:nS.call(e,i)}var zc=sS;var oS="__lodash_hash_undefined__";function aS(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=_i&&e===void 0?oS:e,this}var $c=aS;function sn(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}sn.prototype.clear=jc;sn.prototype.delete=Jc;sn.prototype.get=Hc;sn.prototype.has=zc;sn.prototype.set=$c;var Rl=sn;function lS(){this.__data__=[],this.size=0}var qc=lS;function hS(i,e){for(var t=i.length;t--;)if(li(i[t][0],e))return t;return-1}var $i=hS;var uS=Array.prototype,fS=uS.splice;function cS(i){var e=this.__data__,t=$i(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():fS.call(e,t,1),--this.size,!0}var Kc=cS;function dS(i){var e=this.__data__,t=$i(e,i);return t<0?void 0:e[t][1]}var ed=dS;function pS(i){return $i(this.__data__,i)>-1}var td=pS;function gS(i,e){var t=this.__data__,r=$i(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var id=gS;function on(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}on.prototype.clear=qc;on.prototype.delete=Kc;on.prototype.get=ed;on.prototype.has=td;on.prototype.set=id;var qi=on;var mS=bt(He,"Map"),Ki=mS;function bS(){this.size=0,this.__data__={hash:new Rl,map:new(Ki||qi),string:new Rl}}var rd=bS;function xS(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var nd=xS;function yS(i,e){var t=i.__data__;return nd(e)?t[typeof e=="string"?"string":"hash"]:t.map}var er=yS;function SS(i){var e=er(this,i).delete(i);return this.size-=e?1:0,e}var sd=SS;function TS(i){return er(this,i).get(i)}var od=TS;function IS(i){return er(this,i).has(i)}var ad=IS;function OS(i,e){var t=er(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var ld=OS;function an(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}an.prototype.clear=rd;an.prototype.delete=sd;an.prototype.get=od;an.prototype.has=ad;an.prototype.set=ld;var Sr=an;var AS="Expected a function";function Cl(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(AS);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(Cl.Cache||Sr),t}Cl.Cache=Sr;var hd=Cl;var wS=500;function RS(i){var e=hd(i,function(r){return t.size===wS&&t.clear(),r}),t=e.cache;return e}var ud=RS;var CS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ES=/\\(\\)?/g,kS=ud(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(CS,function(t,r,n,s){e.push(n?s.replace(ES,"$1"):r||t)}),e}),fd=kS;function NS(i){return i==null?"":bc(i)}var ln=NS;function vS(i,e){return Fe(i)?i:nn(i,e)?[i]:fd(ln(i))}var wo=vS;var _S=1/0;function BS(i){if(typeof i=="string"||zr(i))return i;var e=i+"";return e=="0"&&1/i==-_S?"-0":e}var tr=BS;function GS(i,e){e=wo(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[tr(e[t++])];return t&&t==r?i:void 0}var Ro=GS;function FS(i,e,t){var r=i==null?void 0:Ro(i,e);return r===void 0?t:r}var cd=FS;function US(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var Co=US;var PS=Oo(Object.getPrototypeOf,Object),hn=PS;var WS="[object Object]",LS=Function.prototype,MS=Object.prototype,dd=LS.toString,VS=MS.hasOwnProperty,ZS=dd.call(Object);function QS(i){if(!$e(i)||vt(i)!=WS)return!1;var e=hn(i);if(e===null)return!0;var t=VS.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&dd.call(t)==ZS}var pd=QS;function DS(i){return function(e){return i?.[e]}}var gd=DS;function XS(){this.__data__=new qi,this.size=0}var md=XS;function YS(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var bd=YS;function jS(i){return this.__data__.get(i)}var xd=jS;function JS(i){return this.__data__.has(i)}var yd=JS;var HS=200;function zS(i,e){var t=this.__data__;if(t instanceof qi){var r=t.__data__;if(!Ki||r.length<HS-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new Sr(r)}return t.set(i,e),this.size=t.size,this}var Sd=zS;function un(i){var e=this.__data__=new qi(i);this.size=e.size}un.prototype.clear=md;un.prototype.delete=bd;un.prototype.get=xd;un.prototype.has=yd;un.prototype.set=Sd;var ci=un;function $S(i,e){return i&&hi(e,ui(e),i)}var Td=$S;function qS(i,e){return i&&hi(e,fi(e),i)}var Id=qS;var Rd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Od=Rd&&typeof module=="object"&&module&&!module.nodeType&&module,KS=Od&&Od.exports===Rd,Ad=KS?He.Buffer:void 0,wd=Ad?Ad.allocUnsafe:void 0;function eT(i,e){if(e)return i.slice();var t=i.length,r=wd?wd(t):new i.constructor(t);return i.copy(r),r}var Eo=eT;function tT(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var ko=tT;function iT(){return[]}var No=iT;var rT=Object.prototype,nT=rT.propertyIsEnumerable,Cd=Object.getOwnPropertySymbols,sT=Cd?function(i){return i==null?[]:(i=Object(i),ko(Cd(i),function(e){return nT.call(i,e)}))}:No,fn=sT;function oT(i,e){return hi(i,fn(i),e)}var Ed=oT;var aT=Object.getOwnPropertySymbols,lT=aT?function(i){for(var e=[];i;)Co(e,fn(i)),i=hn(i);return e}:No,vo=lT;function hT(i,e){return hi(i,vo(i),e)}var kd=hT;function uT(i,e,t){var r=e(i);return Fe(i)?r:Co(r,t(i))}var _o=uT;function fT(i){return _o(i,ui,fn)}var $n=fT;function cT(i){return _o(i,fi,vo)}var Nd=cT;var dT=bt(He,"DataView"),Bo=dT;var pT=bt(He,"Promise"),Go=pT;var gT=bt(He,"Set"),Fo=gT;var vd="[object Map]",mT="[object Object]",_d="[object Promise]",Bd="[object Set]",Gd="[object WeakMap]",Fd="[object DataView]",bT=ki(Bo),xT=ki(Ki),yT=ki(Go),ST=ki(Fo),TT=ki(yo),Tr=vt;(Bo&&Tr(new Bo(new ArrayBuffer(1)))!=Fd||Ki&&Tr(new Ki)!=vd||Go&&Tr(Go.resolve())!=_d||Fo&&Tr(new Fo)!=Bd||yo&&Tr(new yo)!=Gd)&&(Tr=function(i){var e=vt(i),t=e==mT?i.constructor:void 0,r=t?ki(t):"";if(r)switch(r){case bT:return Fd;case xT:return vd;case yT:return _d;case ST:return Bd;case TT:return Gd}return e});var zt=Tr;var IT=Object.prototype,OT=IT.hasOwnProperty;function AT(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OT.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var Ud=AT;var wT=He.Uint8Array,cn=wT;function RT(i){var e=new i.constructor(i.byteLength);return new cn(e).set(new cn(i)),e}var dn=RT;function CT(i,e){var t=e?dn(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var Pd=CT;var ET=/\w*$/;function kT(i){var e=new i.constructor(i.source,ET.exec(i));return e.lastIndex=i.lastIndex,e}var Wd=kT;var Ld=ut?ut.prototype:void 0,Md=Ld?Ld.valueOf:void 0;function NT(i){return Md?Object(Md.call(i)):{}}var Vd=NT;function vT(i,e){var t=e?dn(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Uo=vT;var _T="[object Boolean]",BT="[object Date]",GT="[object Map]",FT="[object Number]",UT="[object RegExp]",PT="[object Set]",WT="[object String]",LT="[object Symbol]",MT="[object ArrayBuffer]",VT="[object DataView]",ZT="[object Float32Array]",QT="[object Float64Array]",DT="[object Int8Array]",XT="[object Int16Array]",YT="[object Int32Array]",jT="[object Uint8Array]",JT="[object Uint8ClampedArray]",HT="[object Uint16Array]",zT="[object Uint32Array]";function $T(i,e,t){var r=i.constructor;switch(e){case MT:return dn(i);case _T:case BT:return new r(+i);case VT:return Pd(i,t);case ZT:case QT:case DT:case XT:case YT:case jT:case JT:case HT:case zT:return Uo(i,t);case GT:return new r;case FT:case WT:return new r(i);case UT:return Wd(i);case PT:return new r;case LT:return Vd(i)}}var Zd=$T;function qT(i){return typeof i.constructor=="function"&&!Hi(i)?Oc(hn(i)):{}}var Po=qT;var KT="[object Map]";function eI(i){return $e(i)&&zt(i)==KT}var Qd=eI;var Dd=vi&&vi.isMap,tI=Dd?rn(Dd):Qd,Xd=tI;var iI="[object Set]";function rI(i){return $e(i)&&zt(i)==iI}var Yd=rI;var jd=vi&&vi.isSet,nI=jd?rn(jd):Yd,Jd=nI;var sI=1,oI=2,aI=4,Hd="[object Arguments]",lI="[object Array]",hI="[object Boolean]",uI="[object Date]",fI="[object Error]",zd="[object Function]",cI="[object GeneratorFunction]",dI="[object Map]",pI="[object Number]",$d="[object Object]",gI="[object RegExp]",mI="[object Set]",bI="[object String]",xI="[object Symbol]",yI="[object WeakMap]",SI="[object ArrayBuffer]",TI="[object DataView]",II="[object Float32Array]",OI="[object Float64Array]",AI="[object Int8Array]",wI="[object Int16Array]",RI="[object Int32Array]",CI="[object Uint8Array]",EI="[object Uint8ClampedArray]",kI="[object Uint16Array]",NI="[object Uint32Array]",Ue={};Ue[Hd]=Ue[lI]=Ue[SI]=Ue[TI]=Ue[hI]=Ue[uI]=Ue[II]=Ue[OI]=Ue[AI]=Ue[wI]=Ue[RI]=Ue[dI]=Ue[pI]=Ue[$d]=Ue[gI]=Ue[mI]=Ue[bI]=Ue[xI]=Ue[CI]=Ue[EI]=Ue[kI]=Ue[NI]=!0;Ue[fI]=Ue[zd]=Ue[yI]=!1;function Wo(i,e,t,r,n,s){var o,a=e&sI,l=e&oI,h=e&aI;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!et(i))return i;var u=Fe(i);if(u){if(o=Ud(i),!a)return So(i,o)}else{var c=zt(i),d=c==zd||c==cI;if(Ht(i))return Eo(i,a);if(c==$d||c==Hd||d&&!n){if(o=l||d?{}:Po(i),!a)return l?kd(i,Id(o,i)):Ed(i,Td(o,i))}else{if(!Ue[c])return n?i:{};o=Zd(i,c,a)}}s||(s=new ci);var g=s.get(i);if(g)return g;s.set(i,o),Jd(i)?i.forEach(function(O){o.add(Wo(O,e,t,O,i,s))}):Xd(i)&&i.forEach(function(O,w){o.set(w,Wo(O,e,t,w,i,s))});var m=h?l?Nd:$n:l?fi:ui,x=u?void 0:m(i);return kc(x||i,function(O,w){x&&(w=O,O=i[w]),To(o,w,Wo(O,e,t,w,i,s))}),o}var qd=Wo;var vI=1,_I=4;function BI(i){return qd(i,vI|_I)}var Lo=BI;var GI="__lodash_hash_undefined__";function FI(i){return this.__data__.set(i,GI),this}var Kd=FI;function UI(i){return this.__data__.has(i)}var ep=UI;function Mo(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new Sr;++e<t;)this.add(i[e])}Mo.prototype.add=Mo.prototype.push=Kd;Mo.prototype.has=ep;var tp=Mo;function PI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r;)if(e(i[t],t,i))return!0;return!1}var ip=PI;function WI(i,e){return i.has(e)}var rp=WI;var LI=1,MI=2;function VI(i,e,t,r,n,s){var o=t&LI,a=i.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var h=s.get(i),u=s.get(e);if(h&&u)return h==e&&u==i;var c=-1,d=!0,g=t&MI?new tp:void 0;for(s.set(i,e),s.set(e,i);++c<a;){var m=i[c],x=e[c];if(r)var O=o?r(x,m,c,e,i,s):r(m,x,c,i,e,s);if(O!==void 0){if(O)continue;d=!1;break}if(g){if(!ip(e,function(w,B){if(!rp(g,B)&&(m===w||n(m,w,t,r,s)))return g.push(B)})){d=!1;break}}else if(!(m===x||n(m,x,t,r,s))){d=!1;break}}return s.delete(i),s.delete(e),d}var Vo=VI;function ZI(i){var e=-1,t=Array(i.size);return i.forEach(function(r,n){t[++e]=[n,r]}),t}var np=ZI;function QI(i){var e=-1,t=Array(i.size);return i.forEach(function(r){t[++e]=r}),t}var sp=QI;var DI=1,XI=2,YI="[object Boolean]",jI="[object Date]",JI="[object Error]",HI="[object Map]",zI="[object Number]",$I="[object RegExp]",qI="[object Set]",KI="[object String]",eO="[object Symbol]",tO="[object ArrayBuffer]",iO="[object DataView]",op=ut?ut.prototype:void 0,El=op?op.valueOf:void 0;function rO(i,e,t,r,n,s,o){switch(t){case iO:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case tO:return!(i.byteLength!=e.byteLength||!s(new cn(i),new cn(e)));case YI:case jI:case zI:return li(+i,+e);case JI:return i.name==e.name&&i.message==e.message;case $I:case KI:return i==e+"";case HI:var a=np;case qI:var l=r&DI;if(a||(a=sp),i.size!=e.size&&!l)return!1;var h=o.get(i);if(h)return h==e;r|=XI,o.set(i,e);var u=Vo(a(i),a(e),r,n,s,o);return o.delete(i),u;case eO:if(El)return El.call(i)==El.call(e)}return!1}var ap=rO;var nO=1,sO=Object.prototype,oO=sO.hasOwnProperty;function aO(i,e,t,r,n,s){var o=t&nO,a=$n(i),l=a.length,h=$n(e),u=h.length;if(l!=u&&!o)return!1;for(var c=l;c--;){var d=a[c];if(!(o?d in e:oO.call(e,d)))return!1}var g=s.get(i),m=s.get(e);if(g&&m)return g==e&&m==i;var x=!0;s.set(i,e),s.set(e,i);for(var O=o;++c<l;){d=a[c];var w=i[d],B=e[d];if(r)var F=o?r(B,w,d,e,i,s):r(w,B,d,i,e,s);if(!(F===void 0?w===B||n(w,B,t,r,s):F)){x=!1;break}O||(O=d=="constructor")}if(x&&!O){var M=i.constructor,G=e.constructor;M!=G&&"constructor"in i&&"constructor"in e&&!(typeof M=="function"&&M instanceof M&&typeof G=="function"&&G instanceof G)&&(x=!1)}return s.delete(i),s.delete(e),x}var lp=aO;var lO=1,hp="[object Arguments]",up="[object Array]",Zo="[object Object]",hO=Object.prototype,fp=hO.hasOwnProperty;function uO(i,e,t,r,n,s){var o=Fe(i),a=Fe(e),l=o?up:zt(i),h=a?up:zt(e);l=l==hp?Zo:l,h=h==hp?Zo:h;var u=l==Zo,c=h==Zo,d=l==h;if(d&&Ht(i)){if(!Ht(e))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new ci),o||zi(i)?Vo(i,e,t,r,n,s):ap(i,e,l,t,r,n,s);if(!(t&lO)){var g=u&&fp.call(i,"__wrapped__"),m=c&&fp.call(e,"__wrapped__");if(g||m){var x=g?i.value():i,O=m?e.value():e;return s||(s=new ci),n(x,O,t,r,s)}}return d?(s||(s=new ci),lp(i,e,t,r,n,s)):!1}var cp=uO;function dp(i,e,t,r,n){return i===e?!0:i==null||e==null||!$e(i)&&!$e(e)?i!==i&&e!==e:cp(i,e,t,r,dp,n)}var Qo=dp;var fO=1,cO=2;function dO(i,e,t,r){var n=t.length,s=n,o=!r;if(i==null)return!s;for(i=Object(i);n--;){var a=t[n];if(o&&a[2]?a[1]!==i[a[0]]:!(a[0]in i))return!1}for(;++n<s;){a=t[n];var l=a[0],h=i[l],u=a[1];if(o&&a[2]){if(h===void 0&&!(l in i))return!1}else{var c=new ci;if(r)var d=r(h,u,l,i,e,c);if(!(d===void 0?Qo(u,h,fO|cO,r,c):d))return!1}}return!0}var pp=dO;function pO(i){return i===i&&!et(i)}var Do=pO;function gO(i){for(var e=ui(i),t=e.length;t--;){var r=e[t],n=i[r];e[t]=[r,n,Do(n)]}return e}var gp=gO;function mO(i,e){return function(t){return t==null?!1:t[i]===e&&(e!==void 0||i in Object(t))}}var Xo=mO;function bO(i){var e=gp(i);return e.length==1&&e[0][2]?Xo(e[0][0],e[0][1]):function(t){return t===i||pp(t,i,e)}}var mp=bO;function xO(i,e){return i!=null&&e in Object(i)}var bp=xO;function yO(i,e,t){e=wo(e,i);for(var r=-1,n=e.length,s=!1;++r<n;){var o=tr(e[r]);if(!(s=i!=null&&t(i,o)))break;i=i[o]}return s||++r!=n?s:(n=i==null?0:i.length,!!n&&tn(n)&&en(o,n)&&(Fe(i)||Ni(i)))}var xp=yO;function SO(i,e){return i!=null&&xp(i,e,bp)}var yp=SO;var TO=1,IO=2;function OO(i,e){return nn(i)&&Do(e)?Xo(tr(i),e):function(t){var r=cd(t,i);return r===void 0&&r===e?yp(t,i):Qo(e,r,TO|IO)}}var Sp=OO;function AO(i){return function(e){return e?.[i]}}var Tp=AO;function wO(i){return function(e){return Ro(e,i)}}var Ip=wO;function RO(i){return nn(i)?Tp(tr(i)):Ip(i)}var Op=RO;function CO(i){return typeof i=="function"?i:i==null?$r:typeof i=="object"?Fe(i)?Sp(i[0],i[1]):mp(i):Op(i)}var Yo=CO;function EO(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var Ap=EO;var kO=Ap(),jo=kO;function NO(i,e){return i&&jo(i,e,ui)}var Jo=NO;function vO(i,e){return function(t,r){if(t==null)return t;if(!Lt(t))return i(t,r);for(var n=t.length,s=e?n:-1,o=Object(t);(e?s--:++s<n)&&r(o[s],s,o)!==!1;);return t}}var wp=vO;var _O=wp(Jo),Rp=_O;function BO(i,e,t){(t!==void 0&&!li(i[e],t)||t===void 0&&!(e in i))&&Ji(i,e,t)}var qn=BO;function GO(i){return $e(i)&&Lt(i)}var Cp=GO;function FO(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Kn=FO;function UO(i){return hi(i,fi(i))}var Ep=UO;function PO(i,e,t,r,n,s,o){var a=Kn(i,t),l=Kn(e,t),h=o.get(l);if(h){qn(i,t,h);return}var u=s?s(a,l,t+"",i,e,o):void 0,c=u===void 0;if(c){var d=Fe(l),g=!d&&Ht(l),m=!d&&!g&&zi(l);u=l,d||g||m?Fe(a)?u=a:Cp(a)?u=So(a):g?(c=!1,u=Eo(l,!0)):m?(c=!1,u=Uo(l,!0)):u=[]:pd(l)||Ni(l)?(u=a,Ni(a)?u=Ep(a):(!et(a)||qr(a))&&(u=Po(l))):c=!1}c&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),qn(i,t,u)}var kp=PO;function Np(i,e,t,r,n){i!==e&&jo(e,function(s,o){if(n||(n=new ci),et(s))kp(i,e,o,t,Np,r,n);else{var a=r?r(Kn(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),qn(i,o,a)}},fi)}var vp=Np;function WO(i,e){var t=[];return Rp(i,function(r,n,s){e(r,n,s)&&t.push(r)}),t}var _p=WO;function LO(i,e){var t=Fe(i)?ko:_p;return t(i,Yo(e,3))}var kl=LO;var MO="[object Map]",VO="[object Set]",ZO=Object.prototype,QO=ZO.hasOwnProperty;function DO(i){if(i==null)return!0;if(Lt(i)&&(Fe(i)||typeof i=="string"||typeof i.splice=="function"||Ht(i)||zi(i)||Ni(i)))return!i.length;var e=zt(i);if(e==MO||e==VO)return!i.size;if(Hi(i))return!Ao(i).length;for(var t in i)if(QO.call(i,t))return!1;return!0}var Ho=DO;function XO(i,e){var t={};return e=Yo(e,3),Jo(i,function(r,n,s){Ji(t,n,e(r,n,s))}),t}var es=XO;var YO=Gc(function(i,e,t){vp(i,e,t)}),Nl=YO;var jO={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},JO=gd(jO),Bp=JO;var Gp=/&(?:amp|lt|gt|quot|#39);/g,HO=RegExp(Gp.source);function zO(i){return i=ln(i),i&&HO.test(i)?i.replace(Gp,Bp):i}var vl=zO;var $O=0;function qO(i){var e=++$O;return ln(i)+e}var _l=qO;function Bl(){return{persistenceId:function(i){var e="",t=i.rootEl;for(t.id&&(e=t.id);t&&t!==document;t=t.parentNode)if(t){t.id&&(e=t.id);break}return"yasr_"+e},getPlainQueryLinkToEndpoint:void 0,persistencyExpire:60*60*24*30,persistenceLabelResponse:"response",persistenceLabelConfig:"config",maxPersistentResponseSize:1e5,prefixes:{},plugins:{},pluginOrder:["Table","response","Geo","Graph"],defaultPlugin:"Table"}}var{entries:Qp,setPrototypeOf:Fp,isFrozen:KO,getPrototypeOf:eA,getOwnPropertyDescriptor:tA}=Object,{freeze:ct,seal:Mt,create:Ml}=Object,{apply:Vl,construct:Zl}=typeof Reflect<"u"&&Reflect;ct||(ct=function(e){return e});Mt||(Mt=function(e){return e});Vl||(Vl=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];return e.apply(t,n)});Zl||(Zl=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new e(...r)});var zo=dt(Array.prototype.forEach),iA=dt(Array.prototype.lastIndexOf),Up=dt(Array.prototype.pop),ts=dt(Array.prototype.push),rA=dt(Array.prototype.splice),qo=dt(String.prototype.toLowerCase),Gl=dt(String.prototype.toString),Fl=dt(String.prototype.match),is=dt(String.prototype.replace),nA=dt(String.prototype.indexOf),sA=dt(String.prototype.trim),$t=dt(Object.prototype.hasOwnProperty),ft=dt(RegExp.prototype.test),rs=oA(TypeError);function dt(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Vl(i,e,r)}}function oA(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Zl(i,t)}}function ue(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qo;Fp&&Fp(i,null);let r=e.length;for(;r--;){let n=e[r];if(typeof n=="string"){let s=t(n);s!==n&&(KO(e)||(e[r]=s),n=s)}i[n]=!0}return i}function aA(i){for(let e=0;e<i.length;e++)$t(i,e)||(i[e]=null);return i}function di(i){let e=Ml(null);for(let[t,r]of Qp(i))$t(i,t)&&(Array.isArray(r)?e[t]=aA(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=di(r):e[t]=r);return e}function ns(i,e){for(;i!==null;){let r=tA(i,e);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}i=eA(i)}function t(){return null}return t}var Pp=ct(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ul=ct(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Pl=ct(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),lA=ct(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Wl=ct(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),hA=ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Wp=ct(["#text"]),Lp=ct(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ll=ct(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Mp=ct(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),$o=ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uA=Mt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fA=Mt(/<%[\w\W]*|[\w\W]*%>/gm),cA=Mt(/\$\{[\w\W]*/gm),dA=Mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),pA=Mt(/^aria-[\-\w]+$/),Dp=Mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gA=Mt(/^(?:\w+script|data):/i),mA=Mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xp=Mt(/^html$/i),bA=Mt(/^[a-z][.\w]*(-[.\w]+)+$/i),Vp=Object.freeze({__proto__:null,ARIA_ATTR:pA,ATTR_WHITESPACE:mA,CUSTOM_ELEMENT:bA,DATA_ATTR:dA,DOCTYPE_NAME:Xp,ERB_EXPR:fA,IS_ALLOWED_URI:Dp,IS_SCRIPT_OR_DATA:gA,MUSTACHE_EXPR:uA,TMPLIT_EXPR:cA}),ss={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},xA=function(){return typeof window>"u"?null:window},yA=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(r=t.getAttribute(n));let s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Zp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Yp(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xA(),e=K=>Yp(K);if(e.version="3.3.1",e.removed=[],!i||!i.document||i.document.nodeType!==ss.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i,r=t,n=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:h,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:c,DOMParser:d,trustedTypes:g}=i,m=l.prototype,x=ns(m,"cloneNode"),O=ns(m,"remove"),w=ns(m,"nextSibling"),B=ns(m,"childNodes"),F=ns(m,"parentNode");if(typeof o=="function"){let K=t.createElement("template");K.content&&K.content.ownerDocument&&(t=K.content.ownerDocument)}let M,G="",{implementation:T,createNodeIterator:b,createDocumentFragment:A,getElementsByTagName:y}=t,{importNode:v}=r,N=Zp();e.isSupported=typeof Qp=="function"&&typeof F=="function"&&T&&T.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:V,ERB_EXPR:re,TMPLIT_EXPR:ne,DATA_ATTR:J,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:z,ATTR_WHITESPACE:we,CUSTOM_ELEMENT:H}=Vp,{IS_ALLOWED_URI:U}=Vp,C=null,Z=ue({},[...Pp,...Ul,...Pl,...Wl,...Wp]),D=null,Ie=ue({},[...Lp,...Ll,...Mp,...$o]),X=Object.seal(Ml(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,oe=null,be=Object.seal(Ml(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),te=!0,ce=!0,Ce=!1,xe=!0,fe=!1,se=!0,ve=!1,de=!1,Oe=!1,Ee=!1,wt=!1,rt=!1,Rt=!0,De=!1,Je="user-content-",ae=!0,Be=!1,Xe={},Ye=null,Zi=ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ut=null,lt=ue({},["audio","video","img","source","image","track"]),he=null,br=ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qi="http://www.w3.org/1998/Math/MathML",ai="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml",Di=Ct,xr=!1,Et=null,Tl=ue({},[Qi,ai,Ct],Gl),Ci=ue({},["mi","mo","mn","ms","mtext"]),Jr=ue({},["annotation-xml"]),Qn=ue({},["title","style","font","a","script"]),nt=null,oo=["application/xhtml+xml","text/html"],Il="text/html",ke=null,Xi=null,ao=t.createElement("form"),Dn=function(I){return I instanceof RegExp||I instanceof Function},Xn=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xi&&Xi===I)){if((!I||typeof I!="object")&&(I={}),I=di(I),nt=oo.indexOf(I.PARSER_MEDIA_TYPE)===-1?Il:I.PARSER_MEDIA_TYPE,ke=nt==="application/xhtml+xml"?Gl:qo,C=$t(I,"ALLOWED_TAGS")?ue({},I.ALLOWED_TAGS,ke):Z,D=$t(I,"ALLOWED_ATTR")?ue({},I.ALLOWED_ATTR,ke):Ie,Et=$t(I,"ALLOWED_NAMESPACES")?ue({},I.ALLOWED_NAMESPACES,Gl):Tl,he=$t(I,"ADD_URI_SAFE_ATTR")?ue(di(br),I.ADD_URI_SAFE_ATTR,ke):br,Ut=$t(I,"ADD_DATA_URI_TAGS")?ue(di(lt),I.ADD_DATA_URI_TAGS,ke):lt,Ye=$t(I,"FORBID_CONTENTS")?ue({},I.FORBID_CONTENTS,ke):Zi,$=$t(I,"FORBID_TAGS")?ue({},I.FORBID_TAGS,ke):di({}),oe=$t(I,"FORBID_ATTR")?ue({},I.FORBID_ATTR,ke):di({}),Xe=$t(I,"USE_PROFILES")?I.USE_PROFILES:!1,te=I.ALLOW_ARIA_ATTR!==!1,ce=I.ALLOW_DATA_ATTR!==!1,Ce=I.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=I.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=I.SAFE_FOR_TEMPLATES||!1,se=I.SAFE_FOR_XML!==!1,ve=I.WHOLE_DOCUMENT||!1,Ee=I.RETURN_DOM||!1,wt=I.RETURN_DOM_FRAGMENT||!1,rt=I.RETURN_TRUSTED_TYPE||!1,Oe=I.FORCE_BODY||!1,Rt=I.SANITIZE_DOM!==!1,De=I.SANITIZE_NAMED_PROPS||!1,ae=I.KEEP_CONTENT!==!1,Be=I.IN_PLACE||!1,U=I.ALLOWED_URI_REGEXP||Dp,Di=I.NAMESPACE||Ct,Ci=I.MATHML_TEXT_INTEGRATION_POINTS||Ci,Jr=I.HTML_INTEGRATION_POINTS||Jr,X=I.CUSTOM_ELEMENT_HANDLING||{},I.CUSTOM_ELEMENT_HANDLING&&Dn(I.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=I.CUSTOM_ELEMENT_HANDLING.tagNameCheck),I.CUSTOM_ELEMENT_HANDLING&&Dn(I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),I.CUSTOM_ELEMENT_HANDLING&&typeof I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),fe&&(ce=!1),wt&&(Ee=!0),Xe&&(C=ue({},Wp),D=[],Xe.html===!0&&(ue(C,Pp),ue(D,Lp)),Xe.svg===!0&&(ue(C,Ul),ue(D,Ll),ue(D,$o)),Xe.svgFilters===!0&&(ue(C,Pl),ue(D,Ll),ue(D,$o)),Xe.mathMl===!0&&(ue(C,Wl),ue(D,Mp),ue(D,$o))),I.ADD_TAGS&&(typeof I.ADD_TAGS=="function"?be.tagCheck=I.ADD_TAGS:(C===Z&&(C=di(C)),ue(C,I.ADD_TAGS,ke))),I.ADD_ATTR&&(typeof I.ADD_ATTR=="function"?be.attributeCheck=I.ADD_ATTR:(D===Ie&&(D=di(D)),ue(D,I.ADD_ATTR,ke))),I.ADD_URI_SAFE_ATTR&&ue(he,I.ADD_URI_SAFE_ATTR,ke),I.FORBID_CONTENTS&&(Ye===Zi&&(Ye=di(Ye)),ue(Ye,I.FORBID_CONTENTS,ke)),I.ADD_FORBID_CONTENTS&&(Ye===Zi&&(Ye=di(Ye)),ue(Ye,I.ADD_FORBID_CONTENTS,ke)),ae&&(C["#text"]=!0),ve&&ue(C,["html","head","body"]),C.table&&(ue(C,["tbody"]),delete $.tbody),I.TRUSTED_TYPES_POLICY){if(typeof I.TRUSTED_TYPES_POLICY.createHTML!="function")throw rs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof I.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw rs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=I.TRUSTED_TYPES_POLICY,G=M.createHTML("")}else M===void 0&&(M=yA(g,n)),M!==null&&typeof G=="string"&&(G=M.createHTML(""));ct&&ct(I),Xi=I}},Ei=ue({},[...Ul,...Pl,...lA]),Jt=ue({},[...Wl,...hA]),Yi=function(I){let _=F(I);(!_||!_.tagName)&&(_={namespaceURI:Di,tagName:"template"});let Y=qo(I.tagName),Ge=qo(_.tagName);return Et[I.namespaceURI]?I.namespaceURI===ai?_.namespaceURI===Ct?Y==="svg":_.namespaceURI===Qi?Y==="svg"&&(Ge==="annotation-xml"||Ci[Ge]):!!Ei[Y]:I.namespaceURI===Qi?_.namespaceURI===Ct?Y==="math":_.namespaceURI===ai?Y==="math"&&Jr[Ge]:!!Jt[Y]:I.namespaceURI===Ct?_.namespaceURI===ai&&!Jr[Ge]||_.namespaceURI===Qi&&!Ci[Ge]?!1:!Jt[Y]&&(Qn[Y]||!Ei[Y]):!!(nt==="application/xhtml+xml"&&Et[I.namespaceURI]):!1},kt=function(I){ts(e.removed,{element:I});try{F(I).removeChild(I)}catch{O(I)}},ht=function(I,_){try{ts(e.removed,{attribute:_.getAttributeNode(I),from:_})}catch{ts(e.removed,{attribute:null,from:_})}if(_.removeAttribute(I),I==="is")if(Ee||wt)try{kt(_)}catch{}else try{_.setAttribute(I,"")}catch{}},lo=function(I){let _=null,Y=null;if(Oe)I="<remove></remove>"+I;else{let Qe=Fl(I,/^[\r\n\t ]+/);Y=Qe&&Qe[0]}nt==="application/xhtml+xml"&&Di===Ct&&(I='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+I+"</body></html>");let Ge=M?M.createHTML(I):I;if(Di===Ct)try{_=new d().parseFromString(Ge,nt)}catch{}if(!_||!_.documentElement){_=T.createDocument(Di,"template",null);try{_.documentElement.innerHTML=xr?G:Ge}catch{}}let Ke=_.body||_.documentElement;return I&&Y&&Ke.insertBefore(t.createTextNode(Y),Ke.childNodes[0]||null),Di===Ct?y.call(_,ve?"html":"body")[0]:ve?_.documentElement:Ke},Yn=function(I){return b.call(I.ownerDocument||I,I,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ji=function(I){return I instanceof c&&(typeof I.nodeName!="string"||typeof I.textContent!="string"||typeof I.removeChild!="function"||!(I.attributes instanceof u)||typeof I.removeAttribute!="function"||typeof I.setAttribute!="function"||typeof I.namespaceURI!="string"||typeof I.insertBefore!="function"||typeof I.hasChildNodes!="function")},Pt=function(I){return typeof a=="function"&&I instanceof a};function mt(K,I,_){zo(K,Y=>{Y.call(e,I,_,Xi)})}let ho=function(I){let _=null;if(mt(N.beforeSanitizeElements,I,null),ji(I))return kt(I),!0;let Y=ke(I.nodeName);if(mt(N.uponSanitizeElement,I,{tagName:Y,allowedTags:C}),se&&I.hasChildNodes()&&!Pt(I.firstElementChild)&&ft(/<[/\w!]/g,I.innerHTML)&&ft(/<[/\w!]/g,I.textContent)||I.nodeType===ss.progressingInstruction||se&&I.nodeType===ss.comment&&ft(/<[/\w]/g,I.data))return kt(I),!0;if(!(be.tagCheck instanceof Function&&be.tagCheck(Y))&&(!C[Y]||$[Y])){if(!$[Y]&&uo(Y)&&(X.tagNameCheck instanceof RegExp&&ft(X.tagNameCheck,Y)||X.tagNameCheck instanceof Function&&X.tagNameCheck(Y)))return!1;if(ae&&!Ye[Y]){let Ge=F(I)||I.parentNode,Ke=B(I)||I.childNodes;if(Ke&&Ge){let Qe=Ke.length;for(let p=Qe-1;p>=0;--p){let S=x(Ke[p],!0);S.__removalCount=(I.__removalCount||0)+1,Ge.insertBefore(S,w(I))}}}return kt(I),!0}return I instanceof l&&!Yi(I)||(Y==="noscript"||Y==="noembed"||Y==="noframes")&&ft(/<\/no(script|embed|frames)/i,I.innerHTML)?(kt(I),!0):(fe&&I.nodeType===ss.text&&(_=I.textContent,zo([V,re,ne],Ge=>{_=is(_,Ge," ")}),I.textContent!==_&&(ts(e.removed,{element:I.cloneNode()}),I.textContent=_)),mt(N.afterSanitizeElements,I,null),!1)},jn=function(I,_,Y){if(Rt&&(_==="id"||_==="name")&&(Y in t||Y in ao))return!1;if(!(ce&&!oe[_]&&ft(J,_))){if(!(te&&ft(me,_))){if(!(be.attributeCheck instanceof Function&&be.attributeCheck(_,I))){if(!D[_]||oe[_]){if(!(uo(I)&&(X.tagNameCheck instanceof RegExp&&ft(X.tagNameCheck,I)||X.tagNameCheck instanceof Function&&X.tagNameCheck(I))&&(X.attributeNameCheck instanceof RegExp&&ft(X.attributeNameCheck,_)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(_,I))||_==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&ft(X.tagNameCheck,Y)||X.tagNameCheck instanceof Function&&X.tagNameCheck(Y))))return!1}else if(!he[_]){if(!ft(U,is(Y,we,""))){if(!((_==="src"||_==="xlink:href"||_==="href")&&I!=="script"&&nA(Y,"data:")===0&&Ut[I])){if(!(Ce&&!ft(z,is(Y,we,"")))){if(Y)return!1}}}}}}}return!0},uo=function(I){return I!=="annotation-xml"&&Fl(I,H)},yr=function(I){mt(N.beforeSanitizeAttributes,I,null);let{attributes:_}=I;if(!_||ji(I))return;let Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0},Ge=_.length;for(;Ge--;){let Ke=_[Ge],{name:Qe,namespaceURI:p,value:S}=Ke,R=ke(Qe),P=S,W=Qe==="value"?P:sA(P);if(Y.attrName=R,Y.attrValue=W,Y.keepAttr=!0,Y.forceKeepAttr=void 0,mt(N.uponSanitizeAttribute,I,Y),W=Y.attrValue,De&&(R==="id"||R==="name")&&(ht(Qe,I),W=Je+W),se&&ft(/((--!?|])>)|<\/(style|title|textarea)/i,W)){ht(Qe,I);continue}if(R==="attributename"&&Fl(W,"href")){ht(Qe,I);continue}if(Y.forceKeepAttr)continue;if(!Y.keepAttr){ht(Qe,I);continue}if(!xe&&ft(/\/>/i,W)){ht(Qe,I);continue}fe&&zo([V,re,ne],Te=>{W=is(W,Te," ")});let pe=ke(I.nodeName);if(!jn(pe,R,W)){ht(Qe,I);continue}if(M&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!p)switch(g.getAttributeType(pe,R)){case"TrustedHTML":{W=M.createHTML(W);break}case"TrustedScriptURL":{W=M.createScriptURL(W);break}}if(W!==P)try{p?I.setAttributeNS(p,Qe,W):I.setAttribute(Qe,W),ji(I)?kt(I):Up(e.removed)}catch{ht(Qe,I)}}mt(N.afterSanitizeAttributes,I,null)},fo=function K(I){let _=null,Y=Yn(I);for(mt(N.beforeSanitizeShadowDOM,I,null);_=Y.nextNode();)mt(N.uponSanitizeShadowNode,_,null),ho(_),yr(_),_.content instanceof s&&K(_.content);mt(N.afterSanitizeShadowDOM,I,null)};return e.sanitize=function(K){let I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=null,Y=null,Ge=null,Ke=null;if(xr=!K,xr&&(K="<!-->"),typeof K!="string"&&!Pt(K))if(typeof K.toString=="function"){if(K=K.toString(),typeof K!="string")throw rs("dirty is not a string, aborting")}else throw rs("toString is not a function");if(!e.isSupported)return K;if(de||Xn(I),e.removed=[],typeof K=="string"&&(Be=!1),Be){if(K.nodeName){let S=ke(K.nodeName);if(!C[S]||$[S])throw rs("root node is forbidden and cannot be sanitized in-place")}}else if(K instanceof a)_=lo("<!---->"),Y=_.ownerDocument.importNode(K,!0),Y.nodeType===ss.element&&Y.nodeName==="BODY"||Y.nodeName==="HTML"?_=Y:_.appendChild(Y);else{if(!Ee&&!fe&&!ve&&K.indexOf("<")===-1)return M&&rt?M.createHTML(K):K;if(_=lo(K),!_)return Ee?null:rt?G:""}_&&Oe&&kt(_.firstChild);let Qe=Yn(Be?K:_);for(;Ge=Qe.nextNode();)ho(Ge),yr(Ge),Ge.content instanceof s&&fo(Ge.content);if(Be)return K;if(Ee){if(wt)for(Ke=A.call(_.ownerDocument);_.firstChild;)Ke.appendChild(_.firstChild);else Ke=_;return(D.shadowroot||D.shadowrootmode)&&(Ke=v.call(r,Ke,!0)),Ke}let p=ve?_.outerHTML:_.innerHTML;return ve&&C["!doctype"]&&_.ownerDocument&&_.ownerDocument.doctype&&_.ownerDocument.doctype.name&&ft(Xp,_.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+_.ownerDocument.doctype.name+`>
17
+ `+p),fe&&zo([V,re,ne],S=>{p=is(p,S," ")}),M&&rt?M.createHTML(p):p},e.setConfig=function(){let K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(K),de=!0},e.clearConfig=function(){Xi=null,de=!1},e.isValidAttribute=function(K,I,_){Xi||Xn({});let Y=ke(K),Ge=ke(I);return jn(Y,Ge,_)},e.addHook=function(K,I){typeof I=="function"&&ts(N[K],I)},e.removeHook=function(K,I){if(I!==void 0){let _=iA(N[K],I);return _===-1?void 0:rA(N[K],_,1)[0]}return Up(N[K])},e.removeHooks=function(K){N[K]=[]},e.removeAllHooks=function(){N=Zp()},e}var os=Yp();var qt=po(Og()),wr=class{constructor(e){this.namespace=e}set(e,t,r,n){if(qt.default.enabled&&(this.removeExpiredKeys(),e&&t!==void 0)){t.documentElement&&(t=new XMLSerializer().serializeToString(t.documentElement));try{qt.default.set(e,{namespace:this.namespace,val:t,exp:r,time:new Date().getTime()/1e3})}catch(s){if(s instanceof Error){let o=s;if(o.quotaExceeded=Ow(s),o.quotaExceeded&&n)n(s);else throw o}throw s}}}remove(e){qt.default.enabled&&e&&qt.default.remove(e)}removeExpiredKeys(){qt.default.enabled&&qt.default.each((e,t)=>{e&&e.exp&&new Date().getTime()/1e3-e.time>e.exp&&this.remove(t)})}removeAll(){qt.default.enabled}removeNamespace(){qt.default.each((e,t)=>{e.namespace&&e.namespace===this.namespace&&this.remove(t)})}get(e){if(qt.default.enabled&&e)if(this.removeExpiredKeys(),e){var t=qt.default.get(e);return t?t.val:void 0}else return}};function Ow(i){var e=!1;if(i)if(i.code)switch(i.code){case 22:e=!0;break;case 1014:i.name==="NS_ERROR_DOM_QUOTA_REACHED"&&(e=!0);break}else i.number===-2147024882&&(e=!0);return e}var{sanitize:E2}=os;function fs(i,e){if(i)return i.classList?i.classList.contains(e):!!i.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function ge(i,...e){if(i)for(let t of e)i.classList?i.classList.add(t):fs(i,t)||(i.className+=" "+t)}function Bi(i,e){if(i){if(i.classList)i.classList.remove(e);else if(fs(i,e)){var t=new RegExp("(\\s|^)"+e+"(\\s|$)");i.className=i.className.replace(t," ")}}}function ql(i,e){if(typeof i=="string"){let t=JSON.parse(i);if(e&&t.results)for(let r in t.results.bindings)t.results.bindings[r]=e(t.results.bindings[r]);return t}if(typeof i=="object"&&i.constructor==={}.constructor){if(e&&i.results)for(let t in i.results.bindings)i.results.bindings[t]=e(i.results.bindings[t]);return i}throw new Error("Could not parse json")}var Yg=po(Dg());var ds="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ps="http://www.w3.org/2001/XMLSchema#",ia="http://www.w3.org/2000/10/swap/",yt={xsd:{decimal:`${ps}decimal`,boolean:`${ps}boolean`,double:`${ps}double`,integer:`${ps}integer`,string:`${ps}string`},rdf:{type:`${ds}type`,nil:`${ds}nil`,first:`${ds}first`,rest:`${ds}rest`,langString:`${ds}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${ia}reify#forSome`,forAll:`${ia}reify#forAll`},log:{implies:`${ia}log#implies`,isImpliedBy:`${ia}log#isImpliedBy`}};var{xsd:ra}=yt,iR=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Xg={"\\":"\\","'":"'",'"':'"',n:`
18
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},rR=/[\x00-\x20<>\\"\{\}\|\^\`]/,nR={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},sR=/$0^/,gs=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let t in this)!(t in nR)&&this[t]instanceof RegExp&&(this[t]=sR)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let a,l;for(;a=this._newline.exec(r);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),r=r.substr(a[0].length,r.length),n=r.length,this._line++;if(!a&&(a=this._whitespace.exec(r))&&(r=r.substr(a[0].length,r.length)),this._endOfFile.test(r))return t&&(this.comments&&(l=this._comment.exec(r))&&s("comment",l[1],"",this._line,r.length),r=null,s("eof","","",this._line,0)),this._input=r;let h=this._line,u=r[0],c="",d="",g="",m=null,x=0,O=!1;switch(u){case"^":if(r.length<3)break;if(r[1]==="^"){if(this._previousMarker="^^",r=r.substr(2),r[0]!=="<"){O=!0;break}}else{this._n3Mode&&(x=1,c="^");break}case"<":if(m=this._unescapedIri.exec(r))c="IRI",d=m[1];else if(m=this._iri.exec(r)){if(d=this._unescape(m[1]),d===null||rR.test(d))return o(this);c="IRI"}else r.length>1&&r[1]==="<"?(c="<<",x=2):this._n3Mode&&r.length>1&&r[1]==="="&&(x=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">"));break;case">":r.length>1&&r[1]===">"&&(c=">>",x=2);break;case"_":((m=this._blank.exec(r))||t&&(m=this._blank.exec(`${r} `)))&&(c="blank",g="_",d=m[1]);break;case'"':if(m=this._simpleQuotedString.exec(r))d=m[1];else if({value:d,matchLength:x}=this._parseLiteral(r),d===null)return o(this);(m!==null||x!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(m=this._simpleApostropheString.exec(r))d=m[1];else if({value:d,matchLength:x}=this._parseLiteral(r),d===null)return o(this);(m!==null||x!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(m=this._variable.exec(r))&&(c="var",d=m[0]);break;case"@":this._previousMarker==="literal"&&(m=this._langcode.exec(r))?(c="langcode",d=m[1]):(m=this._keyword.exec(r))&&(c=m[0]);break;case".":if(r.length===1?t:r[1]<"0"||r[1]>"9"){c=".",x=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(m=this._number.exec(r)||t&&(m=this._number.exec(`${r} `)))&&(c="literal",d=m[0],g=typeof m[1]=="string"?ra.double:typeof m[2]=="string"?ra.decimal:ra.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(m=this._sparqlKeyword.exec(r))?c=m[0].toUpperCase():O=!0;break;case"f":case"t":(m=this._boolean.exec(r))?(c="literal",d=m[0],g=ra.boolean):O=!0;break;case"a":(m=this._shortPredicates.exec(r))?(c="abbreviation",d="a"):O=!0;break;case"=":this._n3Mode&&r.length>1&&(c="abbreviation",r[1]!==">"?(x=1,d="="):(x=2,d=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(x=1,c=u);break;case"{":!this._lineMode&&r.length>=2&&(r[1]==="|"?(c="{|",x=2):(c=u,x=1));break;case"|":r.length>=2&&r[1]==="}"&&(c="|}",x=2);break;default:O=!0}if(O&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(m=this._prefix.exec(r))?(c="prefix",d=m[1]||""):((m=this._prefixed.exec(r))||t&&(m=this._prefixed.exec(`${r} `)))&&(c="prefixed",g=m[1]||"",d=this._unescape(m[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;let w=x||m[0].length,B=s(c,d,g,h,w);this.previousToken=B,this._previousMarker=c,r=r.substr(w,r.length)}function s(a,l,h,u,c){let d=r?n-r.length:n,g=d+c,m={type:a,value:l,prefix:h,line:u,start:d,end:g};return e(null,m),m}function o(a){e(a._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let t=!1,r=e.replace(iR,(n,s,o,a)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof o=="string"){let l=Number.parseInt(o,16);return l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return a in Xg?Xg[a]:(t=!0,"")});return t?null:r}_parseLiteral(e){if(e.length>=3){let t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length,n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let s=0;for(;e[n-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(r,n),a=o.split(/\r\n|\r|\n/).length-1,l=n+r;if(r===1&&a!==0||r===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}n++}this._literalClosingPos=e.length-r+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{let r=[],n;if(this._tokenizeToEnd((s,o)=>s?n=s:r.push(o),!0),n)throw n;return r}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",r=>{this._input!==null&&r.length!==0&&(this._pendingBuffer&&(r=Yg.Buffer.concat([this._pendingBuffer,r]),this._pendingBuffer=null),r[r.length-1]&128?this._pendingBuffer=r:(typeof this._input>"u"?this._input=this._readStartingBom(typeof r=="string"?r:r.toString()):this._input+=r,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}};var{rdf:oR,xsd:Tn}=yt,xs,aR=0;var lR={namedNode:Jg,blankNode:Hg,variable:$g,literal:zg,defaultGraph:hR,quad:ch,triple:ch,fromTerm:ms,fromQuad:qg},jg=lR,Fi=class i{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof i?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},na=class extends Fi{get termType(){return"NamedNode"}},bs=class i extends Fi{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,t=e.lastIndexOf('"')+1;return t<e.length&&e[t++]==="@"?e.substr(t).toLowerCase():""}get datatype(){return new na(this.datatypeString)}get datatypeString(){let e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return r==="^"?e.substr(t+2):r!=="@"?Tn.string:oR.langString}equals(e){return e instanceof i?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},hh=class extends Fi{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},uh=class extends Fi{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},fh=class extends Fi{constructor(){return super(""),xs||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};xs=new fh;var sa=class extends Fi{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||xs}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function Jg(i){return new na(i)}function Hg(i){return new hh(i||`n3-${aR++}`)}function zg(i,e){if(typeof e=="string")return new bs(`"${i}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof i=="boolean"?t=Tn.boolean:typeof i=="number"&&(Number.isFinite(i)?t=Number.isInteger(i)?Tn.integer:Tn.double:(t=Tn.double,Number.isNaN(i)||(i=i>0?"INF":"-INF")))),t===""||t===Tn.string?new bs(`"${i}"`):new bs(`"${i}"^^${t}`)}function $g(i){return new uh(i)}function hR(){return xs}function ch(i,e,t,r){return new sa(i,e,t,r)}function ms(i){if(i instanceof Fi)return i;switch(i.termType){case"NamedNode":return Jg(i.value);case"BlankNode":return Hg(i.value);case"Variable":return $g(i.value);case"DefaultGraph":return xs;case"Literal":return zg(i.value,i.language||i.datatype);case"Quad":return qg(i);default:throw new Error(`Unexpected termType: ${i.termType}`)}}function qg(i){if(i instanceof sa)return i;if(i.termType!=="Quad")throw new Error(`Unexpected termType: ${i.termType}`);return ch(ms(i.subject),ms(i.predicate),ms(i.object),ms(i.graph))}var Kg=0,Er=class{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&em(this,e.factory);let t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),n=/trig/.test(t),s=/triple/.test(t),o=/quad/.test(t),a=this._n3Mode=/n3/.test(t),l=s||o;(this._supportsNamedGraphs=!(r||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||n||s||a),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=h=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new gs({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Kg=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,r,n,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:s,graph:t,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){let r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":let n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);r=this._factory.namedNode(n);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._factory.namedNode(s+e.value);break;case"blank":r=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(r===null&&(this._subject=r=this._factory.blankNode()),s===null?a.predicate===null?a.subject=r:a.object=r:this._emit(s,this.RDF_REST,r,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":let r=this._readEntity(e);if(r===void 0)return;t=this._factory.literal(this._literalValue,r),e=null;break;case"langcode":t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){let r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),r.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph,n=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);let o=this._predicate,a=this._object;this._subject=this._factory.quad(n,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(r=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(n!==null){let o=this._predicate,a=this._object;s?this._emit(a,o,n,r):this._emit(n,o,a,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){let t=e.type==="IRI"&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let t=this._contextStack,r=t.length&&t[t.length-1];if(r&&r.type==="item"){let n=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,n,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r,n=this._factory.blankNode();if((r=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){let t=this._factory.blankNode(),r,n;if((r=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);let t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._factory.quad(e,t,r,n||this.DEFAULTGRAPH))}_error(e,t){let r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=oa}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let t=e.length,r="",n=-1,s=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<t&&e[s]!=="/";)n=s;break;case"?":case"#":n=t;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=s&&(r=r.substr(0,o)),a!=="/")return`${r}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return r+e.substring(o)}parse(e,t,r){let n,s,o;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(n=t.onQuad,s=t.onPrefix,o=t.onComment):(n=t,s=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Kg++}_`,this._prefixCallback=s||oa,this._inversePredicate=!1,this._quantified=Object.create(null),!n){let l=[],h;if(this._callback=(u,c)=>{u?h=u:c&&l.push(c)},this._lexer.tokenize(e).every(u=>this._readCallback=this._readCallback(u)),h)throw h;return l}let a=(l,h)=>{l!==null?(this._callback(l),this._callback=oa):this._readCallback&&(this._readCallback=this._readCallback(h))};o&&(this._lexer.comments=!0,a=(l,h)=>{l!==null?(this._callback(l),this._callback=oa):this._readCallback&&(h.type==="comment"?o(h.value):this._readCallback=this._readCallback(h))}),this._callback=n,this._lexer.tokenize(e,a)}};function oa(){}function em(i,e){i._factory=e,i.DEFAULTGRAPH=e.defaultGraph(),i.RDF_FIRST=e.namedNode(yt.rdf.first),i.RDF_REST=e.namedNode(yt.rdf.rest),i.RDF_NIL=e.namedNode(yt.rdf.nil),i.N3_FORALL=e.namedNode(yt.r.forAll),i.N3_FORSOME=e.namedNode(yt.r.forSome),i.ABBREVIATIONS={a:e.namedNode(yt.rdf.type),"=":e.namedNode(yt.owl.sameAs),">":e.namedNode(yt.log.implies),"<":e.namedNode(yt.log.isImpliedBy)},i.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}em(Er.prototype,jg);function dh(i){if(i.termType==="NamedNode")return{value:i.value,type:"uri"};if(i.termType==="Literal"){let e={value:i.value,type:"literal"},t=i.language;t&&(e["xml:lang"]=t);let r=i.datatypeString;return r&&(e.datatype=r),e}return i.termType==="BlankNode"?{value:i.value,type:"bnode"}:{value:i.value,type:"uri"}}function tm(i){let e=ph(i),t=["subject","predicate","object"],r=e.map(n=>({subject:dh(n.subject),predicate:dh(n.predicate),object:dh(n.object)}));return{head:{vars:t},results:{bindings:r}}}function ph(i){return new Er().parse(i||"")}function fR(i){let e={vars:[]};for(let t=0;t<i.childNodes.length;t++){let r=i.childNodes[t];if(r.nodeName=="variable"){let n=r.getAttribute("name");n&&e.vars.push(n)}}return e}var cR=["uri","literal","bnode","typed-literal"];function dR(i,e){let t={bindings:[]};for(let r=0;r<i.childNodes.length;r++){let n=i.childNodes[r],s={};for(let o=0;o<n.childNodes.length;o++){let a=n.childNodes[o];if(a.nodeName=="binding"){let l=a.getAttribute("name");if(l)for(let h=0;h<a.childNodes.length;h++){let u=a.childNodes[h];if(u.nodeName==="#text"||cR.indexOf(u.nodeName)<0)continue;let c={type:u.nodeName,value:vl(u.innerHTML)},d=u.getAttribute("datatype");d&&(c.datatype=d),s[l]=c}}}Ho(s)||t.bindings.push(e(s))}return t}function pR(i){return i.innerHTML==="true"}function gh(i,e){if(typeof i!="string")return;let r=new DOMParser().parseFromString(i,"text/xml");if(!r.childNodes.length)return;let n=r.childNodes[0],s={};for(let o=0;o<n.childNodes.length;o++){let a=n.childNodes[o];a.nodeName=="head"&&(s.head=fR(a)),a.nodeName=="results"&&(s.results=dR(a,e)),a.nodeName=="boolean"&&(s.boolean=pR(a))}return s}var rm=po(im());function nm(i){let e=rm.parse(i,{header:!0,skipEmptyLines:!0});if(e.meta.fields===void 0)throw new Error("Could not parse CSV, no headers found!");let t=e.meta.fields,n=e.data.map(o=>{let a={};for(let l in o)a[l]={value:o[l],type:"literal"};return a});return{head:{vars:t},results:{bindings:n}}}function sm(i){let e=i.split(`
19
+ `);e.pop();let[t,...r]=e,n=t.split(" ").map(a=>a.substring(1)),s=r.map(a=>{let l={};for(let[h,u]of a.split(" ").entries()){let c=n[h];if(u[0]==="<")l[c]={value:u.substring(1,u.length-1),type:"uri"};else if(u[0]==='"'){let d=u.lastIndexOf('"'),g=u.substring(1,d);if(d===u.length-1)l[c]={value:g,type:"literal"};else if(d<u.lastIndexOf("@")){let m=u.substring(u.lastIndexOf("@")+1);l[c]={value:g,type:"literal","xml:lang":m}}else if(d<u.lastIndexOf("^^")){let m=u.substring(u.lastIndexOf("^^")+2);l[c]={value:g,type:"typed-literal",datatype:m}}}}return l});return{head:{vars:n},results:{bindings:s}}}function In(i){return i==null?"":`${i}`}function aa(i={}){let{separator:e,decimals:t}=i;return e?t?r=>r.toFixed(t).replace(".",e):r=>`${r}`.replace(".",e):t?r=>r.toFixed(t):r=>`${r}`}function Ui(i={}){let e=typeof i.quote=="string"?i.quote:'"',t=typeof i.escapedQuote=="string"?i.escapedQuote:`${e}${e}`;if(!e||e===t)return n=>n;let r=new RegExp(e,"g");return n=>(n.includes(e)&&(n=n.replace(r,t)),`${e}${n}${e}`)}var gR='"';var iL=new RegExp(gR,"g");function la(i={stringFormatter:Ui()}){return e=>i.stringFormatter(e.toString().slice(7,-1))}function ha(i={stringFormatter:Ui()}){return e=>{if(e===null)return"";let t=JSON.stringify(e);return t===void 0?"":(t[0]==='"'&&(t=t.replace(/^"(.+)"$/,"$1")),i.stringFormatter(t))}}var mR=RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,"g");function bR(i){var e,t,r;let n=[],s;for(;s=mR.exec(i);)n.push((r=(e=s[3])!==null&&e!==void 0?e:(t=s[1])===null||t===void 0?void 0:t.trim())!==null&&r!==void 0?r:s[0]);return n}function xh(i,e,t){if(e in i){let s=i[e];return s===void 0?t:s}let r=Array.isArray(e)?e:bR(e,i),n=i;for(let s of r)if(n=n?.[s],n===void 0)return t;return n}function ua(i,e){try{return Array.isArray(e)?i.push(...e):i.push(e),i}catch{return i.concat(e)}}function ys(i,e){let t=!0;return i.reduce((r,n)=>(n==null&&(n=""),t?(t=!1,`${n}`):`${r}${e}${n}`),"")}var yh;(function(i){i.header="header",i.undefined="undefined",i.boolean="boolean",i.number="number",i.bigint="bigint",i.string="string",i.symbol="symbol",i.function="function",i.object="object"})(yh||(yh={}));var kr=class{constructor(e){this.opts=this.preprocessOpts(e)}preprocessOpts(e){let t=Object.assign({},e);t.fields&&(t.fields=this.preprocessFieldsInfo(t.fields,t.defaultValue)),t.transforms=t.transforms||[];let r=t.formatters&&t.formatters.string||Ui(),n=ha({stringFormatter:r}),s={header:r,undefined:In,boolean:In,number:aa(),bigint:In,string:r,symbol:la({stringFormatter:r}),function:n,object:n};return t.formatters=Object.assign(Object.assign({},s),t.formatters),t.delimiter=t.delimiter||",",t.eol=t.eol||`
20
+ `,t.header=t.header!==!1,t.includeEmptyRows=t.includeEmptyRows||!1,t.withBOM=t.withBOM||!1,t}preprocessFieldsInfo(e,t){return e.map(r=>{if(typeof r=="string")return{label:r,value:n=>xh(n,r,t)};if(typeof r=="object"){let n="default"in r?r.default:t;if(typeof r.value=="string"){let s=r.value;return{label:r.label||r.value,value:o=>xh(o,s,n)}}if(typeof r.value=="function"){let s=r.label||r.value.name||"",o={label:s,default:n},a=r.value;return{label:s,value(l){let h=a(l,o);return h===void 0?n:h}}}}throw new Error("Invalid field info option. "+JSON.stringify(r))})}getHeader(){return ys(this.opts.fields.map(e=>this.opts.formatters.header(e.label)),this.opts.delimiter)}preprocessRow(e){return this.opts.transforms.reduce((t,r)=>t.map(n=>r(n)).reduce(ua,[]),[e])}processRow(e){if(!e)return;let t=this.opts.fields.map(r=>this.processCell(e,r));if(!(!this.opts.includeEmptyRows&&t.every(r=>r==="")))return ys(t,this.opts.delimiter)}processCell(e,t){return this.processValue(t.value(e))}processValue(e){let t=this.opts.formatters[typeof e];return t(e)}};var On=class extends kr{constructor(e){super(e)}parse(e){let t=this.preprocessData(e);this.opts.fields=this.opts.fields||this.preprocessFieldsInfo(t.reduce((o,a)=>(Object.keys(a).forEach(l=>{o.includes(l)||o.push(l)}),o),[]),this.opts.defaultValue);let r=this.opts.header?this.getHeader():"",n=this.processData(t);return(this.opts.withBOM?"\uFEFF":"")+r+(r&&n?this.opts.eol:"")+n}preprocessData(e){let t=Array.isArray(e)?e:[e];if(!this.opts.fields){if(e==null||t.length===0)throw new Error('Data should not be empty or the "fields" option should be included');if(typeof t[0]!="object")throw new Error('Data items should be objects or the "fields" option should be included')}return this.opts.transforms.length===0?t:t.map(r=>this.preprocessRow(r)).reduce(ua,[])}processData(e){return ys(e.map(t=>this.processRow(t)).filter(t=>t),this.opts.eol)}};var qe;(function(i){i[i.BACKSPACE=8]="BACKSPACE",i[i.FORM_FEED=12]="FORM_FEED",i[i.NEWLINE=10]="NEWLINE",i[i.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",i[i.TAB=9]="TAB",i[i.SPACE=32]="SPACE",i[i.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",i[i.QUOTATION_MARK=34]="QUOTATION_MARK",i[i.NUMBER_SIGN=35]="NUMBER_SIGN",i[i.DOLLAR_SIGN=36]="DOLLAR_SIGN",i[i.PERCENT_SIGN=37]="PERCENT_SIGN",i[i.AMPERSAND=38]="AMPERSAND",i[i.APOSTROPHE=39]="APOSTROPHE",i[i.LEFT_PARENTHESIS=40]="LEFT_PARENTHESIS",i[i.RIGHT_PARENTHESIS=41]="RIGHT_PARENTHESIS",i[i.ASTERISK=42]="ASTERISK",i[i.PLUS_SIGN=43]="PLUS_SIGN",i[i.COMMA=44]="COMMA",i[i.HYPHEN_MINUS=45]="HYPHEN_MINUS",i[i.FULL_STOP=46]="FULL_STOP",i[i.SOLIDUS=47]="SOLIDUS",i[i.DIGIT_ZERO=48]="DIGIT_ZERO",i[i.DIGIT_ONE=49]="DIGIT_ONE",i[i.DIGIT_TWO=50]="DIGIT_TWO",i[i.DIGIT_THREE=51]="DIGIT_THREE",i[i.DIGIT_FOUR=52]="DIGIT_FOUR",i[i.DIGIT_FIVE=53]="DIGIT_FIVE",i[i.DIGIT_SIX=54]="DIGIT_SIX",i[i.DIGIT_SEVEN=55]="DIGIT_SEVEN",i[i.DIGIT_EIGHT=56]="DIGIT_EIGHT",i[i.DIGIT_NINE=57]="DIGIT_NINE",i[i.COLON=58]="COLON",i[i.SEMICOLON=59]="SEMICOLON",i[i.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",i[i.EQUALS_SIGN=61]="EQUALS_SIGN",i[i.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",i[i.QUESTION_MARK=63]="QUESTION_MARK",i[i.COMMERCIAL_AT=64]="COMMERCIAL_AT",i[i.LATIN_CAPITAL_LETTER_A=65]="LATIN_CAPITAL_LETTER_A",i[i.LATIN_CAPITAL_LETTER_B=66]="LATIN_CAPITAL_LETTER_B",i[i.LATIN_CAPITAL_LETTER_C=67]="LATIN_CAPITAL_LETTER_C",i[i.LATIN_CAPITAL_LETTER_D=68]="LATIN_CAPITAL_LETTER_D",i[i.LATIN_CAPITAL_LETTER_E=69]="LATIN_CAPITAL_LETTER_E",i[i.LATIN_CAPITAL_LETTER_F=70]="LATIN_CAPITAL_LETTER_F",i[i.LATIN_CAPITAL_LETTER_G=71]="LATIN_CAPITAL_LETTER_G",i[i.LATIN_CAPITAL_LETTER_H=72]="LATIN_CAPITAL_LETTER_H",i[i.LATIN_CAPITAL_LETTER_I=73]="LATIN_CAPITAL_LETTER_I",i[i.LATIN_CAPITAL_LETTER_J=74]="LATIN_CAPITAL_LETTER_J",i[i.LATIN_CAPITAL_LETTER_K=75]="LATIN_CAPITAL_LETTER_K",i[i.LATIN_CAPITAL_LETTER_L=76]="LATIN_CAPITAL_LETTER_L",i[i.LATIN_CAPITAL_LETTER_M=77]="LATIN_CAPITAL_LETTER_M",i[i.LATIN_CAPITAL_LETTER_N=78]="LATIN_CAPITAL_LETTER_N",i[i.LATIN_CAPITAL_LETTER_O=79]="LATIN_CAPITAL_LETTER_O",i[i.LATIN_CAPITAL_LETTER_P=80]="LATIN_CAPITAL_LETTER_P",i[i.LATIN_CAPITAL_LETTER_Q=81]="LATIN_CAPITAL_LETTER_Q",i[i.LATIN_CAPITAL_LETTER_R=82]="LATIN_CAPITAL_LETTER_R",i[i.LATIN_CAPITAL_LETTER_S=83]="LATIN_CAPITAL_LETTER_S",i[i.LATIN_CAPITAL_LETTER_T=84]="LATIN_CAPITAL_LETTER_T",i[i.LATIN_CAPITAL_LETTER_U=85]="LATIN_CAPITAL_LETTER_U",i[i.LATIN_CAPITAL_LETTER_V=86]="LATIN_CAPITAL_LETTER_V",i[i.LATIN_CAPITAL_LETTER_W=87]="LATIN_CAPITAL_LETTER_W",i[i.LATIN_CAPITAL_LETTER_X=88]="LATIN_CAPITAL_LETTER_X",i[i.LATIN_CAPITAL_LETTER_Y=89]="LATIN_CAPITAL_LETTER_Y",i[i.LATIN_CAPITAL_LETTER_Z=90]="LATIN_CAPITAL_LETTER_Z",i[i.LEFT_SQUARE_BRACKET=91]="LEFT_SQUARE_BRACKET",i[i.REVERSE_SOLIDUS=92]="REVERSE_SOLIDUS",i[i.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",i[i.CIRCUMFLEX_ACCENT=94]="CIRCUMFLEX_ACCENT",i[i.LOW_LINE=95]="LOW_LINE",i[i.GRAVE_ACCENT=96]="GRAVE_ACCENT",i[i.LATIN_SMALL_LETTER_A=97]="LATIN_SMALL_LETTER_A",i[i.LATIN_SMALL_LETTER_B=98]="LATIN_SMALL_LETTER_B",i[i.LATIN_SMALL_LETTER_C=99]="LATIN_SMALL_LETTER_C",i[i.LATIN_SMALL_LETTER_D=100]="LATIN_SMALL_LETTER_D",i[i.LATIN_SMALL_LETTER_E=101]="LATIN_SMALL_LETTER_E",i[i.LATIN_SMALL_LETTER_F=102]="LATIN_SMALL_LETTER_F",i[i.LATIN_SMALL_LETTER_G=103]="LATIN_SMALL_LETTER_G",i[i.LATIN_SMALL_LETTER_H=104]="LATIN_SMALL_LETTER_H",i[i.LATIN_SMALL_LETTER_I=105]="LATIN_SMALL_LETTER_I",i[i.LATIN_SMALL_LETTER_J=106]="LATIN_SMALL_LETTER_J",i[i.LATIN_SMALL_LETTER_K=107]="LATIN_SMALL_LETTER_K",i[i.LATIN_SMALL_LETTER_L=108]="LATIN_SMALL_LETTER_L",i[i.LATIN_SMALL_LETTER_M=109]="LATIN_SMALL_LETTER_M",i[i.LATIN_SMALL_LETTER_N=110]="LATIN_SMALL_LETTER_N",i[i.LATIN_SMALL_LETTER_O=111]="LATIN_SMALL_LETTER_O",i[i.LATIN_SMALL_LETTER_P=112]="LATIN_SMALL_LETTER_P",i[i.LATIN_SMALL_LETTER_Q=113]="LATIN_SMALL_LETTER_Q",i[i.LATIN_SMALL_LETTER_R=114]="LATIN_SMALL_LETTER_R",i[i.LATIN_SMALL_LETTER_S=115]="LATIN_SMALL_LETTER_S",i[i.LATIN_SMALL_LETTER_T=116]="LATIN_SMALL_LETTER_T",i[i.LATIN_SMALL_LETTER_U=117]="LATIN_SMALL_LETTER_U",i[i.LATIN_SMALL_LETTER_V=118]="LATIN_SMALL_LETTER_V",i[i.LATIN_SMALL_LETTER_W=119]="LATIN_SMALL_LETTER_W",i[i.LATIN_SMALL_LETTER_X=120]="LATIN_SMALL_LETTER_X",i[i.LATIN_SMALL_LETTER_Y=121]="LATIN_SMALL_LETTER_Y",i[i.LATIN_SMALL_LETTER_Z=122]="LATIN_SMALL_LETTER_Z",i[i.LEFT_CURLY_BRACKET=123]="LEFT_CURLY_BRACKET",i[i.VERTICAL_LINE=124]="VERTICAL_LINE",i[i.RIGHT_CURLY_BRACKET=125]="RIGHT_CURLY_BRACKET",i[i.TILDE=126]="TILDE"})(qe||(qe={}));var xR={[qe.QUOTATION_MARK]:qe.QUOTATION_MARK,[qe.REVERSE_SOLIDUS]:qe.REVERSE_SOLIDUS,[qe.SOLIDUS]:qe.SOLIDUS,[qe.LATIN_SMALL_LETTER_B]:qe.BACKSPACE,[qe.LATIN_SMALL_LETTER_F]:qe.FORM_FEED,[qe.LATIN_SMALL_LETTER_N]:qe.NEWLINE,[qe.LATIN_SMALL_LETTER_R]:qe.CARRIAGE_RETURN,[qe.LATIN_SMALL_LETTER_T]:qe.TAB};var om;(function(i){i[i.LEFT_BRACE=0]="LEFT_BRACE",i[i.RIGHT_BRACE=1]="RIGHT_BRACE",i[i.LEFT_BRACKET=2]="LEFT_BRACKET",i[i.RIGHT_BRACKET=3]="RIGHT_BRACKET",i[i.COLON=4]="COLON",i[i.COMMA=5]="COMMA",i[i.TRUE=6]="TRUE",i[i.FALSE=7]="FALSE",i[i.NULL=8]="NULL",i[i.STRING=9]="STRING",i[i.NUMBER=10]="NUMBER",i[i.SEPARATOR=11]="SEPARATOR"})(om||(om={}));var am;(function(i){i[i.START=0]="START",i[i.ENDED=1]="ENDED",i[i.ERROR=2]="ERROR",i[i.TRUE1=3]="TRUE1",i[i.TRUE2=4]="TRUE2",i[i.TRUE3=5]="TRUE3",i[i.FALSE1=6]="FALSE1",i[i.FALSE2=7]="FALSE2",i[i.FALSE3=8]="FALSE3",i[i.FALSE4=9]="FALSE4",i[i.NULL1=10]="NULL1",i[i.NULL2=11]="NULL2",i[i.NULL3=12]="NULL3",i[i.STRING_DEFAULT=13]="STRING_DEFAULT",i[i.STRING_AFTER_BACKSLASH=14]="STRING_AFTER_BACKSLASH",i[i.STRING_UNICODE_DIGIT_1=15]="STRING_UNICODE_DIGIT_1",i[i.STRING_UNICODE_DIGIT_2=16]="STRING_UNICODE_DIGIT_2",i[i.STRING_UNICODE_DIGIT_3=17]="STRING_UNICODE_DIGIT_3",i[i.STRING_UNICODE_DIGIT_4=18]="STRING_UNICODE_DIGIT_4",i[i.STRING_INCOMPLETE_CHAR=19]="STRING_INCOMPLETE_CHAR",i[i.NUMBER_AFTER_INITIAL_MINUS=20]="NUMBER_AFTER_INITIAL_MINUS",i[i.NUMBER_AFTER_INITIAL_ZERO=21]="NUMBER_AFTER_INITIAL_ZERO",i[i.NUMBER_AFTER_INITIAL_NON_ZERO=22]="NUMBER_AFTER_INITIAL_NON_ZERO",i[i.NUMBER_AFTER_FULL_STOP=23]="NUMBER_AFTER_FULL_STOP",i[i.NUMBER_AFTER_DECIMAL=24]="NUMBER_AFTER_DECIMAL",i[i.NUMBER_AFTER_E=25]="NUMBER_AFTER_E",i[i.NUMBER_AFTER_E_AND_SIGN=26]="NUMBER_AFTER_E_AND_SIGN",i[i.NUMBER_AFTER_E_AND_DIGIT=27]="NUMBER_AFTER_E_AND_DIGIT",i[i.SEPARATOR=28]="SEPARATOR",i[i.BOM_OR_START=29]="BOM_OR_START",i[i.BOM=30]="BOM"})(am||(am={}));var fa;(function(i){i[i.OBJECT=0]="OBJECT",i[i.ARRAY=1]="ARRAY"})(fa||(fa={}));var lm;(function(i){i[i.VALUE=0]="VALUE",i[i.KEY=1]="KEY",i[i.COLON=2]="COLON",i[i.COMMA=3]="COMMA",i[i.ENDED=4]="ENDED",i[i.ERROR=5]="ERROR",i[i.SEPARATOR=6]="SEPARATOR"})(lm||(lm={}));function fm(i){let e=i.head.vars,t=i.results?.bindings;return new On({fields:e}).parse(t?t.map(n=>es(n,s=>s.value)):[])}var ca=i=>{for(let e in i)i[e].type!=="uri"&&(i[e].value=i[e].value.replace(/{{(.*?)}}/g,t=>(t=t.substring(2,t.length-2).trim(),i[t]?i[t].value:t)));return i},Th=class{constructor(e,t){e.executionTime&&(this.executionTime=e.executionTime),t&&(this.executionTime=t),e instanceof Error?this.error=e:e.content?this.setResponse(e):this.setSummary(e)}setResponse(e){this.res=e}setSummary(e){!e.data&&!e.error?this.summary={data:e}:this.summary=e}hasError(){return!!(this.res&&this.res.status>=400||this.errorSummary||this.error||this.summary&&this.summary.error)}getError(){if(!this.errorSummary){if(this.res&&this.res.status>=400){let e=this.res.content||this.res.statusText;this.errorSummary={text:e,status:this.res.status,statusText:this.res.ok?void 0:this.res.statusText}}if(this.summary&&this.summary.error&&(this.errorSummary=this.summary.error),this.error){let e=this.error;this.errorSummary={text:this.error.message,status:e.status,statusText:e.statusText}}}return this.errorSummary}getContentType(){if(this.res)return this.res.headers.get("content-type")||void 0;if(this.summary)return this.summary.contentType}getAsJson(){if(this.json)return this.json;if(!(this.json===!1||this.hasError()))return this.getParserFromContentType()?this.json:this.doLuckyGuess()?this.json:(this.json||(this.json=!1),this.json)}getData(){if(this.res){if(this.res.content)return this.res.content;if(this.res.body)return this.res.body;if(this.res.text)return this.res.text}if(this.summary)return this.summary.data}getResponseTime(){return this.executionTime}getParserFromContentType(){let e=this.getContentType();if(e){let t=Lo(this.getData());try{if(e.indexOf("json")>-1){if(e.indexOf("sparql-results+json")>=0)return this.json=ql(t,ca),this.type="json",!0;if(e.indexOf("application/rdf+json")>-1)return this.type="json",!0;this.type="json"}else{if(e.indexOf("xml")>-1)return this.json=gh(t,ca),this.type="xml",!0;if(e.indexOf("csv")>-1)return this.json=nm(t),this.type="csv",!0;if(e.indexOf("tab-separated")>-1)return this.json=sm(t),this.type="tsv",!0;if(e.indexOf("turtle")>0||e.indexOf("trig")>0||e.indexOf("triple")>0||e.indexOf("quad")>0)return this.json=tm(t),this.type="ttl",!0}}catch(r){r instanceof Error?this.errorSummary={text:r.message}:this.errorSummary={text:r}}}return!1}doLuckyGuess(){let e=Lo(this.getData());try{return this.json=ql(e,ca),this.type="json",!0}catch{}try{return this.json=gh(e,ca),this.type="xml",!0}catch{}return!1}getVariables(){let e=this.getAsJson();return e&&e.head?e.head.vars:[]}getBoolean(){let e=this.getAsJson();if(e&&"boolean"in e)return e.boolean}getBindings(){let e=this.getAsJson();return e&&e.results?e.results.bindings:null}getStatements(){return!this.statements&&this.type==="ttl"&&(this.statements=ph(this.getData())),this.statements?this.statements:null}getOriginalResponseAsString(){let e=this.getData();return typeof e=="string"?e:this.type==="json"?JSON.stringify(e,void 0,2):e}getType(){return this.type||this.getAsJson(),this.type}getStatus(){if(this.res)return this.res.status;if(this.summary)return this.summary.status}getAsStoreObject(e){let t=this.summary;if(!t&&this.res&&(t={contentType:this.getContentType(),data:this.getOriginalResponseAsString(),error:this.getError(),status:this.getStatus(),executionTime:this.getResponseTime()}),t){if(t.data!==void 0){let r=0;if(typeof t.data=="string")r=t.data.length;else try{r=JSON.stringify(t.data).length}catch{return}if(r>e)return}return t}if(this.error)return{error:this.getError(),executionTime:this.getResponseTime()}}asCsv(){let e=this.getAsJson();if(this.type==="csv")return this.getOriginalResponseAsString();if(e&&e.results)return fm(e)}},Ss=Th;function da(i){var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",i),document.getElementsByTagName("head")[0].appendChild(e)}function pa(i,e){return new Promise((t,r)=>{var n=document.createElement("script");n.setAttribute("type","text/javascript"),n.setAttribute("async",""),n.setAttribute("src",i),e&&(n.innerHTML=e),n.onload=()=>t(),document.getElementsByTagName("head")[0].appendChild(n)})}os.addHook("afterSanitizeAttributes",i=>{i instanceof HTMLAnchorElement&&(i.target="_blank",i.rel="noopener noreferrer")});var Ih=os.sanitize;var Ts=class{constructor(e){this.priority=10;this.hideFromSelection=!0;this.yasr=e}draw(){let e=document.createElement("div");e.className="booleanResult";let t=this.yasr.results?.getBoolean(),r=document.createElement("i");r.className=t?"fas fa-check":"fas fa-xmark",e.appendChild(r);let n=document.createElement("span");n.textContent=t?"True":"False",e.appendChild(n),this.yasr.resultsEl.appendChild(e)}canHandleResults(){return!!this.yasr.results?.getBoolean&&(this.yasr.results.getBoolean()===!0||this.yasr.results.getBoolean()==!1)}getIcon(){return document.createElement("")}};var Ah=[],gm=[];(()=>{let i="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?gm:Ah).push(t=t+i[e])})();function OR(i){if(i<768)return!1;for(let e=0,t=Ah.length;;){let r=e+t>>1;if(i<Ah[r])t=r;else if(i>=gm[r])e=r+1;else return!0;if(e==t)return!1}}function cm(i){return i>=127462&&i<=127487}var dm=8205;function mm(i,e,t=!0,r=!0){return(t?bm:AR)(i,e,r)}function bm(i,e,t){if(e==i.length)return e;e&&xm(i.charCodeAt(e))&&ym(i.charCodeAt(e-1))&&e--;let r=Oh(i,e);for(e+=pm(r);e<i.length;){let n=Oh(i,e);if(r==dm||n==dm||t&&OR(n))e+=pm(n),r=n;else if(cm(n)){let s=0,o=e-2;for(;o>=0&&cm(Oh(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function AR(i,e,t){for(;e>1;){let r=bm(i,e-2,t);if(r<e)return r;e--}return 0}function Oh(i,e){let t=i.charCodeAt(e);if(!ym(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return xm(r)?(t-55296<<10)+(r-56320)+65536:t}function xm(i){return i>=56320&&i<57344}function ym(i){return i>=55296&&i<56320}function pm(i){return i<65536?1:2}var ye=class i{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,r){[e,t]=En(this,e,t);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(t,this.length,n,1),wn.from(n,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=En(this,e,t);let r=[];return this.decompose(e,t,r,0),wn.from(r,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),r=this.length-this.scanIdentical(e,-1),n=new Br(this),s=new Br(e);for(let o=t,a=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(a+=n.value.length,n.done||a>=r)return!0}}iter(e=1){return new Br(this,e)}iterRange(e,t=this.length){return new ya(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Sa(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?i.empty:e.length<=32?new _t(e):wn.from(_t.split(e,[]))}},_t=class i extends ye{constructor(e,t=wR(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.text[s],a=n+o.length;if((t?r:a)>=e)return new Rh(n,a,r,o);n=a+1,r++}}decompose(e,t,r,n){let s=e<=0&&t>=this.length?this:new i(Sm(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=r.pop(),a=xa(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new i(a,o.length+s.length));else{let l=a.length>>1;r.push(new i(a.slice(0,l)),new i(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof i))return super.replace(e,t,r);[e,t]=En(this,e,t);let n=xa(this.text,xa(r.text,Sm(this.text,0,e)),t),s=this.length+r.length-(t-e);return n.length<=32?new i(n,s):wn.from(i.split(n,[]),s)}sliceString(e,t=this.length,r=`
21
+ `){[e,t]=En(this,e,t);let n="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(n+=r),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r.length==32&&(t.push(new i(r,n)),r=[],n=-1);return n>-1&&t.push(new i(r,n)),t}},wn=class i extends ye{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,n);n=a+1,r=l+1}}decompose(e,t,r,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let h=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!h?r.push(a):a.decompose(e-o,t-o,r,h)}o=l+1}}replace(e,t,r){if([e,t]=En(this,e,t),r.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),h=this.lines-o.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let u=this.children.slice();return u[n]=l,new i(u,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
22
+ `){[e,t]=En(this,e,t);let n="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(n+=r),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,r)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let l=this.children[n],h=e.children[s];if(l!=h)return r+l.scanIdentical(h,t);r+=l.length+1}}static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let g of e)r+=g.lines;if(r<32){let g=[];for(let m of e)m.flatten(g);return new _t(g,t)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,a=[],l=0,h=-1,u=[];function c(g){let m;if(g.lines>s&&g instanceof i)for(let x of g.children)c(x);else g.lines>o&&(l>o||!l)?(d(),a.push(g)):g instanceof _t&&l&&(m=u[u.length-1])instanceof _t&&g.lines+m.lines<=32?(l+=g.lines,h+=g.length+1,u[u.length-1]=new _t(m.text.concat(g.text),m.length+1+g.length)):(l+g.lines>n&&d(),l+=g.lines,h+=g.length+1,u.push(g))}function d(){l!=0&&(a.push(u.length==1?u[0]:i.from(u,h)),h=-1,l=u.length=0)}for(let g of e)c(g);return d(),a.length==1?a[0]:new i(a,t)}};ye.empty=new _t([""],0);function wR(i){let e=-1;for(let t of i)e+=t.length+1;return e}function xa(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){let a=i[s],l=n+a.length;l>=t&&(l>r&&(a=a.slice(0,r-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function Sm(i,e,t){return xa(i,[""],e,t)}var Br=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof _t?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,a=n instanceof _t?n.text.length:n.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
23
+ `,this;e--}else if(n instanceof _t){let l=n.text[o+(t<0?-1:0)];if(this.offsets[r]+=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=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof _t?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)}},ya=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Br(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}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 r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Sa=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(ye.prototype[Symbol.iterator]=function(){return this.iter()},Br.prototype[Symbol.iterator]=ya.prototype[Symbol.iterator]=Sa.prototype[Symbol.iterator]=function(){return this});var Rh=class{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}};function En(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function Zt(i,e,t=!0,r=!0){return mm(i,e,t,r)}function RR(i){return i>=56320&&i<57344}function CR(i){return i>=55296&&i<56320}function wm(i,e){let t=i.charCodeAt(e);if(!CR(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return RR(r)?(t-55296<<10)+(r-56320)+65536:t}var Ch=/\r\n?|\n/,St=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(St||(St={})),Gr=class i{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 r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,n,s),n+=s):n+=o,r+=s}}iterChangedRanges(e,t=!1){Eh(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:Rm(this,e)}mapDesc(e,t=!1){return e.empty?this:kh(this,e,t)}mapPos(e,t=-1,r=St.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],h=n+a;if(l<0){if(h>e)return s+(e-n);s+=a}else{if(r!=St.Simple&&h>=e&&(r==St.TrackDel&&n<e&&h>e||r==St.TrackBefore&&n<e||r==St.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s=this.sections[r++],o=this.sections[r++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>=0?":"+n:"")}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 i(e)}static create(e){return new i(e)}},Bt=class i extends Gr{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 Eh(this,(t,r,n,s,o)=>e=e.replace(n,n+(r-t),o),!1),e}mapDesc(e,t=!1){return kh(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;r.length<l;)r.push(ye.empty);r.push(o?e.slice(s,s+o):ye.empty)}s+=o}return new i(t,r)}compose(e){return this.empty?e:e.empty?this:Rm(this,e,!0)}map(e,t=!1){return e.empty?this:kh(this,e,t,!0)}iterChanges(e,t=!1){Eh(this,e,t)}get desc(){return Gr.create(this.sections)}filter(e){let t=[],r=[],n=[],s=new Fr(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);at(n,u,-1);let c=s.ins==-1?-1:s.off==0?s.ins:0;at(t,u,c),c>0&&nr(r,t,s.text),s.forward(u),a+=u}let h=e[o++];for(;a<h;){if(s.done)break e;let u=Math.min(s.len,h-a);at(t,u,-1),at(n,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new i(t,r),filtered:Gr.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],n=this.sections[t+1];n<0?e.push(r):n==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let n=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!n.length)return;o<t&&at(n,t-o,-1);let c=new i(n,s);a=a?a.compose(c.map(a)):c,n=[],s=[],o=0}function h(u){if(Array.isArray(u))for(let c of u)h(c);else if(u instanceof i){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:c,to:d=c,insert:g}=u;if(c>d||c<0||d>t)throw new RangeError(`Invalid change range ${c} to ${d} (in doc of length ${t})`);let m=g?typeof g=="string"?ye.of(g.split(r||Ch)):g:ye.empty,x=m.length;if(c==d&&x==0)return;c<o&&l(),c>o&&at(n,c-o,-1),at(n,d-c,x),nr(s,n,m),o=d}}return h(e),l(!a),a}static empty(e){return new i(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let n=0;n<e.length;n++){let s=e[n];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(;r.length<n;)r.push(ye.empty);r[n]=ye.of(s.slice(1)),t.push(s[0],r[n].length)}}}return new i(t,r)}static createSet(e,t){return new i(e,t)}};function at(i,e,t,r=!1){if(e==0&&t<=0)return;let n=i.length-2;n>=0&&t<=0&&t==i[n+1]?i[n]+=e:n>=0&&e==0&&i[n]==0?i[n+1]+=t:r?(i[n]+=e,i[n+1]+=t):i.push(e,t)}function nr(i,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<r;)i.push(ye.empty);i.push(t)}}function Eh(i,e,t){let r=i.inserted;for(let n=0,s=0,o=0;o<i.sections.length;){let a=i.sections[o++],l=i.sections[o++];if(l<0)n+=a,s+=a;else{let h=n,u=s,c=ye.empty;for(;h+=a,u+=l,l&&r&&(c=c.append(r[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],l=i.sections[o++];e(n,h,s,u,c),n=h,s=u}}}function kh(i,e,t,r=!1){let n=[],s=r?[]:null,o=new Fr(i),a=new Fr(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);at(n,h,-1),o.forward(h),a.forward(h)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let h=a.len;for(at(n,a.ins,-1);h;){let u=Math.min(o.len,h);o.ins>=0&&l<o.i&&o.len<=u&&(at(n,0,o.ins),s&&nr(s,n,o.text),l=o.i),o.forward(u),h-=u}a.next()}else if(o.ins>=0){let h=0,u=o.len;for(;u;)if(a.ins==-1){let c=Math.min(u,a.len);h+=c,u-=c,a.forward(c)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;at(n,h,l<o.i?o.ins:0),s&&l<o.i&&nr(s,n,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Bt.createSet(n,s):Gr.create(n);throw new Error("Mismatched change set lengths")}}}function Rm(i,e,t=!1){let r=[],n=t?[]:null,s=new Fr(i),o=new Fr(e);for(let a=!1;;){if(s.done&&o.done)return n?Bt.createSet(r,n):Gr.create(r);if(s.ins==0)at(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)at(r,0,o.ins,a),n&&nr(n,r,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),h=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;at(r,l,u,a),n&&u&&nr(n,r,o.text)}else o.ins==-1?(at(r,s.off?0:s.len,l,a),n&&nr(n,r,s.textBit(l))):(at(r,s.off?0:s.len,o.off?0:o.ins,a),n&&!o.off&&nr(n,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>h),s.forward2(l),o.forward(l)}}}}var Fr=class{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?ye.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?ye.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Nr=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.flags=r,this.goalColumn=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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags,this.goalColumn)}extend(e,t=e,r=0){if(e<=this.anchor&&t>=this.anchor)return ee.range(e,t,void 0,void 0,r);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ee.range(this.anchor,n,void 0,void 0,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ee.range(e.anchor,e.head)}static create(e,t,r,n){return new i(e,t,r,n)}},ee=class i{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:i.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){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],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new i([this.main],0)}addRange(e,t=!0){return i.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,i.create(r,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 i(e.ranges.map(t=>Nr.fromJSON(t)),e.main)}static single(e,t=e){return new i([i.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 r=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=r:s.from<r)return i.normalized(e.slice(),t);r=s.to}return new i(e,t)}static cursor(e,t=0,r,n){return Nr.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r)),n)}static range(e,t,r,n,s){let o=n==null?7:Math.min(6,n);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?Nr.create(t,e,o|32,r):Nr.create(e,t,o,r)}static undirectionalRange(e,t){return Nr.create(e,t,64,void 0)}static normalized(e,t=0){let r=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(r);for(let n=1;n<e.length;n++){let s=e[n],o=e[n-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?i.range(l,a):i.range(a,l))}}return new i(e,t)}};function Cm(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var Lh=0,q=class i{constructor(e,t,r,n,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=n,this.id=Lh++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new i(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Mh),!!e.static,e.enables)}of(e){return new Rn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}};function Mh(i,e){return i==e||i.length==e.length&&i.every((t,r)=>t===e[r])}var Rn=class{constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.value=n,this.id=Lh++}dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,h=!1,u=[];for(let c of this.dependencies)c=="doc"?l=!0:c=="selection"?h=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||u.push(e[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,d){if(l&&d.docChanged||h&&(d.docChanged||d.selection)||Nh(c,u)){let g=r(c);if(a?!Tm(g,c.values[o],n):!n(g,c.values[o]))return c.values[o]=g,1}return 0},reconfigure:(c,d)=>{let g,m=d.config.address[s];if(m!=null){let x=Aa(d,m);if(this.dependencies.every(O=>O instanceof q?d.facet(O)===c.facet(O):O instanceof xi?d.field(O,!1)==c.field(O,!1):!0)||(a?Tm(g=r(c),x,n):n(g=r(c),x)))return c.values[o]=x,0}else g=r(c);return c.values[o]=g,1}}}get extension(){return this}};function Tm(i,e,t){if(i.length!=e.length)return!1;for(let r=0;r<i.length;r++)if(!t(i[r],e[r]))return!1;return!0}function Nh(i,e){let t=!1;for(let r of e)Os(i,r)&1&&(t=!0);return t}function ER(i,e,t){let r=t.map(l=>i[l.id]),n=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=i[e.id]>>1;function a(l){let h=[];for(let u=0;u<r.length;u++){let c=Aa(l,r[u]);if(n[u]==2)for(let d of c)h.push(d);else h.push(c)}return e.combine(h)}return{create(l){for(let h of r)Os(l,h);return l.values[o]=a(l),1},update(l,h){if(!Nh(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,h){let u=Nh(l,r),c=h.config.facets[e.id],d=h.facet(e);if(c&&!u&&Mh(t,c))return l.values[o]=d,0;let g=a(l);return e.compare(g,d)?(l.values[o]=d,0):(l.values[o]=g,1)}}}var ga=q.define({static:!0}),xi=class i{constructor(e,t,r,n,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new i(Lh++,e.create,e.update,e.compare||((r,n)=>r===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ga).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,n)=>{let s=r.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,n)=>{let s=r.facet(ga),o=n.facet(ga),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[t]=a.create(r),1):n.config.address[this.id]!=null?(r.values[t]=n.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,ga.of({field:this,create:e})]}get extension(){return this}},vr={lowest:4,low:3,default:2,high:1,highest:0};function Is(i){return e=>new Ta(e,i)}var Cs={highest:Is(vr.highest),high:Is(vr.high),default:Is(vr.default),low:Is(vr.low),lowest:Is(vr.lowest)},Ta=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Ia=class i{of(e){return new As(this,e)}reconfigure(e){return i.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},As=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Oa=class i{constructor(e,t,r,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.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,r){let n=[],s=Object.create(null),o=new Map;for(let d of kR(e,t,o))d instanceof xi?n.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],h=[];for(let d of n)a[d.id]=h.length<<1,h.push(g=>d.slot(g));let u=r?.config.facets;for(let d in s){let g=s[d],m=g[0].facet,x=u&&u[d]||[];if(g.every(O=>O.type==0))if(a[m.id]=l.length<<1|1,Mh(x,g))l.push(r.facet(m));else{let O=m.combine(g.map(w=>w.value));l.push(r&&m.compare(O,r.facet(m))?r.facet(m):O)}else{for(let O of g)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=h.length<<1,h.push(w=>O.dynamicSlot(w)));a[m.id]=h.length<<1,h.push(O=>ER(O,m,g))}}let c=h.map(d=>d(a));return new i(e,o,c,a,l,s)}};function kR(i,e,t){let r=[[],[],[],[],[]],n=new Map;function s(o,a){let l=n.get(o);if(l!=null){if(l<=a)return;let h=r[l].indexOf(o);h>-1&&r[l].splice(h,1),o instanceof As&&t.delete(o.compartment)}if(n.set(o,a),Array.isArray(o))for(let h of o)s(h,a);else if(o instanceof As){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,a)}else if(o instanceof Ta)s(o.inner,o.prec);else if(o instanceof xi)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Rn)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,vr.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)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(h,a)}}return s(i,vr.default),r.reduce((o,a)=>o.concat(a))}function Os(i,e){if(e&1)return 2;let t=e>>1,r=i.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;i.status[t]=4;let n=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|n}function Aa(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}var Em=q.define(),vh=q.define({combine:i=>i.some(e=>e),static:!0}),km=q.define({combine:i=>i.length?i[0]:void 0,static:!0}),Nm=q.define(),vm=q.define(),_m=q.define(),Bm=q.define({combine:i=>i.length?i[0]:!1}),Pi=class{constructor(e,t){this.type=e,this.value=t}static define(){return new _h}},_h=class{of(e){return new Pi(this,e)}},Bh=class{constructor(e){this.map=e}of(e){return new Ze(this,e)}},Ze=class i{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 i(this.type,t)}is(e){return this.type==e}static define(e={}){return new Bh(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){let s=n.map(t);s&&r.push(s)}return r}};Ze.reconfigure=Ze.define();Ze.appendConfig=Ze.define();var Tt=class i{constructor(e,t,r,n,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Cm(r,t.newLength),s.some(a=>a.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(e,t,r,n,s,o){return new i(e,t,r,n,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(i.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Tt.time=Pi.define();Tt.userEvent=Pi.define();Tt.addToHistory=Pi.define();Tt.remote=Pi.define();function NR(i,e){let t=[];for(let r=0,n=0;;){let s,o;if(r<i.length&&(n==e.length||e[n]>=i[r]))s=i[r++],o=i[r++];else if(n<e.length)s=e[n++],o=e[n++];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 Gm(i,e,t){var r;let n,s,o;return t?(n=e.changes,s=Bt.empty(e.changes.length),o=i.changes.compose(e.changes)):(n=e.changes.map(i.changes),s=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(s):(r=i.selection)===null||r===void 0?void 0:r.map(n),effects:Ze.mapEffects(i.effects,n).concat(Ze.mapEffects(e.effects,s)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Gh(i,e,t){let r=e.selection,n=Cn(e.annotations);return e.userEvent&&(n=n.concat(Tt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Bt?e.changes:Bt.of(e.changes||[],t,i.facet(km)),selection:r&&(r instanceof ee?r:ee.single(r.anchor,r.head)),effects:Cn(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function Fm(i,e,t){let r=Gh(i,e.length?e[0]:{},i.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;r=Gm(r,Gh(i,e[s],o?r.changes.newLength:i.doc.length),o)}let n=Tt.create(i,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return _R(t?vR(n):n)}function vR(i){let e=i.startState,t=!0;for(let n of e.facet(Nm)){let s=n(i);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:NR(t,s))}if(t!==!0){let n,s;if(t===!1)s=i.changes.invertedDesc,n=Bt.empty(e.doc.length);else{let o=i.changes.filter(t);n=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}i=Tt.create(e,n,i.selection&&i.selection.map(s),Ze.mapEffects(i.effects,s),i.annotations,i.scrollIntoView)}let r=e.facet(vm);for(let n=r.length-1;n>=0;n--){let s=r[n](i);s instanceof Tt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Tt?i=s[0]:i=Fm(e,Cn(s),!1)}return i}function _R(i){let e=i.startState,t=e.facet(_m),r=i;for(let n=t.length-1;n>=0;n--){let s=t[n](i);s&&Object.keys(s).length&&(r=Gm(r,Gh(e,s,i.changes.newLength),!0))}return r==i?i:Tt.create(e,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var BR=[];function Cn(i){return i==null?BR:Array.isArray(i)?i:[i]}var mi=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(mi||(mi={})),GR=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Fh;try{Fh=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function FR(i){if(Fh)return Fh.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||GR.test(t)))return!0}return!1}function UR(i){return e=>{if(!/\S/.test(e))return mi.Space;if(FR(e))return mi.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return mi.Word;return mi.Other}}var Le=class i{constructor(e,t,r,n,s,o){this.config=e,this.doc=t,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Os(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Os(this,r),Aa(this,r)}update(...e){return Fm(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:n}=t;for(let a of e.effects)a.is(Ia.reconfigure)?(t&&(n=new Map,t.compartments.forEach((l,h)=>n.set(h,l)),t=null),n.set(a.value.compartment,a.value.extension)):a.is(Ze.reconfigure)?(t=null,r=a.value):a.is(Ze.appendConfig)&&(t=null,r=Cn(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=Oa.resolve(r,n,this),s=new i(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values);let o=e.startState.facet(vh)?e.newSelection:e.newSelection.asSingle();new i(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ee.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Cn(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),h=this.changes(l.changes),u=h.map(n);for(let d=0;d<a;d++)s[d]=s[d].map(u);let c=n.mapDesc(h,!0);s.push(l.range.map(c)),n=n.compose(u),o=Ze.mapEffects(o,u).concat(Ze.mapEffects(Cn(l.effects),c))}return{changes:n,selection:ee.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Bt?e:Bt.of(e,this.doc.length,this.facet(i.lineSeparator))}toText(e){return ye.of(e.split(this.facet(i.lineSeparator)||Ch))}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:(Os(this,t),Aa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let n=e[r];n instanceof xi&&this.config.address[n.id]!=null&&(t[r]=n.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];n.push(o.init(l=>o.spec.fromJSON(a,l)))}}return i.create({doc:e.doc,selection:ee.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=Oa.resolve(e.extensions||[],new Map),r=e.doc instanceof ye?e.doc:ye.of((e.doc||"").split(t.staticFacet(i.lineSeparator)||Ch)),n=e.selection?e.selection instanceof ee?e.selection:ee.single(e.selection.anchor,e.selection.head):ee.single(0);return Cm(n,r.length),t.staticFacet(vh)||(n=n.asSingle()),new i(t,r,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`
24
+ `}get readOnly(){return this.facet(Bm)}phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(Em))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return UR(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Zt(t,o,!1);if(s(t.slice(l,o))!=mi.Word)break;o=l}for(;a<n;){let l=Zt(t,a);if(s(t.slice(a,l))!=mi.Word)break;a=l}return o==a?null:ee.range(o+r,a+r)}};Le.allowMultipleSelections=vh;Le.tabSize=q.define({combine:i=>i.length?i[0]:4});Le.lineSeparator=km;Le.readOnly=Bm;Le.phrases=q.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(n=>i[n]==e[n])}});Le.languageData=Em;Le.changeFilter=Nm;Le.transactionFilter=vm;Le.transactionExtender=_m;Ia.reconfigure=Ze.define();function kn(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var yi=class{eq(e){return this==e}range(e,t=e){return ws.create(e,t,this)}};yi.prototype.startSide=yi.prototype.endSide=0;yi.prototype.point=!1;yi.prototype.mapMode=St.TrackDel;function Vh(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}var ws=class i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new i(e,t,r)}};function Uh(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var Ph=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return An(this.to)}findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,h=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return h>=0?o:a;h>=0?a=l:o=l+1}}between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t,r,n,s){let o=[],a=[],l=[],h=-1,u=-1;e:for(let c=0;c<this.value.length;c++){let d=this.value[c],g=this.from[c]+e,m=this.to[c]+e,x,O;if(g==m){let w=t.mapPos(g,d.startSide,d.mapMode);if(w==null||(x=O=w,d.startSide!=d.endSide&&(O=t.mapPos(g,d.endSide),O<x)))continue}else if(x=t.mapPos(g,d.startSide),O=t.mapPos(m,d.endSide),x>O||x==O&&d.startSide>0&&d.endSide<=0)continue;if(!((O-x||d.endSide-d.startSide)<0))if(h<0&&(h=x),d.point&&(u=Math.max(u,O-x)),(x-r||d.startSide-n)>=0)o.push(d),a.push(x-h),l.push(O-h),r=O,n=d.endSide;else{if(x==O){for(let w=o.length-1;w>0;w--)if((x-l[w-1]||d.startSide-o[w-1].endSide)<=0){o.splice(w,0,d),a.splice(w,0,x),l.splice(w,0,O);continue e}}s(x,O,d)}}return{mapped:o.length?new i(a,l,o,u):null,pos:h}}},Ae=class i{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new i(e,t,r,n)}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:r=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Uh)),this.isEmpty)return t.length?i.of(t):this;let a=new wa(this,null,-1).goto(0),l=0,h=[],u=new bi;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let c=t[l++];u.addInner(c.from,c.to,c.value)||h.push(c)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||h.push(ws.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!h.length?i.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1,s,o=(l,h,u)=>{s||(s=new bi),s.add(l,h,u)};for(let l=0;l<this.chunk.length;l++){let h=this.chunkPos[l],u=this.chunk[l],c=e.touchesRange(h,h+u.length);if(c===!1)n=Math.max(n,u.maxPoint),t.push(u),r.push(e.mapPos(h));else if(c===!0){let[d,g]=t.length?[An(r)+An(t).length,An(An(t).value).endSide]:[-1,-1],{mapped:m,pos:x}=u.map(h,e,d,g,o);m&&(n=Math.max(n,m.maxPoint),t.push(m),r.push(x))}}let a=this.nextLayer.map(e);return s&&(a=s.finishInner(a)),t.length==0?a:new i(r,t,a||i.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Rs.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Rs.from(e).goto(t)}static compare(e,t,r,n,s=-1){let o=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=Im(o,a,r),h=new _r(o,l,s),u=new _r(a,l,s);r.iterGaps((c,d,g)=>Om(h,c,u,d,g,n)),r.empty&&r.length==0&&Om(h,0,u,0,0,n)}static eq(e,t,r=0,n){n==null&&(n=999999999);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=Im(s,o),l=new _r(s,a,0).goto(r),h=new _r(o,a,0).goto(r);for(;;){if(l.to!=h.to||!Wh(l.active,h.active)||l.point&&(!h.point||!Vh(l.point,h.point)))return!1;if(l.to>n)return!0;l.next(),h.next()}}static spans(e,t,r,n,s=-1){let o=new _r(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),c=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);n.point(a,h,o.point,u,c,o.pointRank),l=Math.min(o.openEnd(h),u.length)}else h>a&&(n.span(a,h,o.active,l),l=o.openEnd(h));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new bi;for(let n of e instanceof ws?[e]:t?PR(e):e)r.add(n.from,n.to,n.value);return r.finish()}static join(e){if(!e.length)return i.empty;let t=An(e);for(let r=e.length-2;r>=0;r--)for(let n=e[r];n!=i.empty;n=n.nextLayer)t=new i(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}};Ae.empty=new Ae([],[],null,-1);function An(i){return i[i.length-1]}function PR(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let r=i[t];if(Uh(e,r)>0)return i.slice().sort(Uh);e=r}return i}Ae.empty.nextLayer=Ae.empty;var bi=class i{finishChunk(e){this.chunks.push(new Ph(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,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new i)).add(e,t,r)}addInner(e,t,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<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=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.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 r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(Ae.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ae.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Im(i,e,t){let r=new Map;for(let s of i)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let n=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&n.add(s.chunk[o])}return n}var wa=class{constructor(e,t,r,n=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=n}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,r){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<e||n.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<n)&&this.setRangeIndex(n)}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],r=e+t.from[this.rangeIndex];if(this.from=r,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}},Rs=class i{constructor(e){this.heap=e}static from(e,t=null,r=-1){let n=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&n.push(new wa(o,t,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)wh(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)wh(this.heap,r);(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(),wh(this.heap,0)}}};function wh(i,e){for(let t=i[e];;){let r=(e<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1<i.length&&n.compare(i[r+1])>=0&&(n=i[r+1],r++),t.compare(n)<0)break;i[r]=t,i[e]=n,e=r}}var _r=class{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Rs.from(e,t,r)}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){ma(this.active,e),ma(this.activeTo,e),ma(this.activeRank,e),this.minActive=Am(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:n,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||n-this.activeTo[t])>0;)t++;ba(this.active,t,r),ba(this.activeTo,t,n),ba(this.activeRank,t,s),e&&ba(e,t,this.cursor.from),this.minActive=Am(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&ma(r,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(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(r){this.openStart=0;for(let n=r.length-1;n>=0&&r[n]<e;n--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}};function Om(i,e,t,r,n,s){i.goto(e),t.goto(r);let o=r+n,a=r,l=r-e,h=!!s.boundChange;for(let u=!1;;){let c=i.to+l-t.to,d=c||i.endSide-t.endSide,g=d<0?i.to+l:t.to,m=Math.min(g,o);if(i.point||t.point?(i.point&&t.point&&Vh(i.point,t.point)&&Wh(i.activeForPoint(i.to),t.activeForPoint(t.to))||s.comparePoint(a,m,i.point,t.point),u=!1):(u&&s.boundChange(a),m>a&&!Wh(i.active,t.active)&&s.compareRange(a,m,i.active,t.active),h&&m<o&&(c||i.openEnd(g)!=t.openEnd(g))&&(u=!0)),g>o)break;a=g,d<=0&&i.next(),d>=0&&t.next()}}function Wh(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!Vh(i[t],e[t]))return!1;return!0}function ma(i,e){for(let t=e,r=i.length-1;t<r;t++)i[t]=i[t+1];i.pop()}function ba(i,e,t){for(let r=i.length-1;r>=e;r--)i[r+1]=i[r];i[e]=t}function Am(i,e){let t=-1,r=1e9;for(let n=0;n<e.length;n++)(e[n]-r||i[n].endSide-i[t].endSide)<0&&(t=n,r=e[n]);return t}function Zh(i,e,t=i.length){let r=0;for(let n=0;n<t&&n<i.length;)i.charCodeAt(n)==9?(r+=e-r%e,n++):(r++,n=Zt(i,n));return r}function Um(i,e,t,r){for(let n=0,s=0;;){if(s>=e)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?t-s%t:1,n=Zt(i,n)}return r===!0?-1:i.length}var Qh="\u037C",Pm=typeof Symbol>"u"?"__"+Qh:Symbol.for(Qh),Dh=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Wm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Qt=class{constructor(e,t){this.rules=[];let{finish:r}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,h){let u=[],c=/^@(\w+)\b/.exec(o[0]),d=c&&c[1]=="keyframes";if(c&&a==null)return l.push(o[0]+";");for(let g in a){let m=a[g];if(/&/.test(g))s(g.split(/,\s*/).map(x=>o.map(O=>x.replace(/&/,O))).reduce((x,O)=>x.concat(O)),m,l);else if(m&&typeof m=="object"){if(!c)throw new RangeError("The value of a property ("+g+") should be a primitive value.");s(n(g),m,u,d)}else m!=null&&u.push(g.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((r&&!c&&!h?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(n(o),e[o],this.rules)}getRules(){return this.rules.join(`
25
+ `)}static newName(){let e=Wm[Pm]||1;return Wm[Pm]=e+1,Qh+e.toString(36)}static mount(e,t,r){let n=e[Dh],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xh(e,s),n.mount(Array.isArray(t)?t:[t],e)}},Lm=new Map,Xh=class{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=Lm.get(r);if(s)return e[Dh]=s;this.sheet=new n.CSSStyleSheet,Lm.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Dh]=this}mount(e,t){let r=this.sheet,n=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let h=0;h<a.rules.length;h++)r.insertRule(a.rules[h],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
26
+ `;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Ur={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:"'"},Ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},FM=typeof navigator<"u"&&/Mac/.test(navigator.platform),UM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ze=0;ze<10;ze++)Ur[48+ze]=Ur[96+ze]=String(ze);var ze;for(ze=1;ze<=24;ze++)Ur[ze+111]="F"+ze;var ze;for(ze=65;ze<=90;ze++)Ur[ze]=String.fromCharCode(ze+32),Ca[ze]=String.fromCharCode(ze);var ze;for(Ra in Ur)Ca.hasOwnProperty(Ra)||(Ca[Ra]=Ur[Ra]);var Ra;var pt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},eu=typeof document<"u"?document:{documentElement:{style:{}}},tu=/Edge\/(\d+)/.exec(pt.userAgent),m0=/MSIE \d/.test(pt.userAgent),iu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pt.userAgent),qa=!!(m0||iu||tu),Mm=!qa&&/gecko\/(\d+)/i.test(pt.userAgent),Yh=!qa&&/Chrome\/(\d+)/.exec(pt.userAgent),Vm="webkitFontSmoothing"in eu.documentElement.style,ru=!qa&&/Apple Computer/.test(pt.vendor),Zm=ru&&(/Mobile\/\w+/.test(pt.userAgent)||pt.maxTouchPoints>2),Q={mac:Zm||/Mac/.test(pt.platform),windows:/Win/.test(pt.platform),linux:/Linux|X11/.test(pt.platform),ie:qa,ie_version:m0?eu.documentMode||6:iu?+iu[1]:tu?+tu[1]:0,gecko:Mm,gecko_version:Mm?+(/Firefox\/(\d+)/.exec(pt.userAgent)||[0,0])[1]:0,chrome:!!Yh,chrome_version:Yh?+Yh[1]:0,ios:Zm,android:/Android\b/.test(pt.userAgent),webkit:Vm,webkit_version:Vm?+(/\bAppleWebKit\/(\d+)/.exec(pt.userAgent)||[0,0])[1]:0,safari:ru,safari_version:ru?+(/\bVersion\/(\d+(\.\d+)?)/.exec(pt.userAgent)||[0,0])[1]:0,tabSize:eu.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Du(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var Pa=Object.create(null);function Xu(i,e,t){if(i==e)return!0;i||(i=Pa),e||(e=Pa);let r=Object.keys(i),n=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(n.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function WR(i,e){for(let t=i.attributes.length-1;t>=0;t--){let r=i.attributes[t].name;e[r]==null&&i.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?i.style.cssText=r:i.getAttribute(t)!=r&&i.setAttribute(t,r)}}function Qm(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="style"?i.style.cssText="":i.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(r=!0,n=="style"?i.style.cssText=t[n]:i.setAttribute(n,t[n]));return r}function LR(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}var ii=class{eq(e){return!1}updateDOM(e,t,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,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Ot=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(Ot||(Ot={})),Se=class extends yi{constructor(e,t,r,n){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Ls(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Lr(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=b0(e,t);r=(s?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new Lr(e,r,n,t,e.widget||null,!0)}static line(e){return new Ms(e)}static set(e,t=!1){return Ae.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Se.none=Ae.empty;var Ls=class i extends Se{constructor(e){let{start:t,end:r}=b0(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Du(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Pa}eq(e){return this==e||e instanceof i&&this.tagName==e.tagName&&Xu(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};Ls.prototype.point=!1;var Ms=class i extends Se{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof i&&this.spec.class==e.spec.class&&Xu(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)}};Ms.prototype.mapMode=St.TrackBefore;Ms.prototype.point=!0;var Lr=class i extends Se{constructor(e,t,r,n,s,o){super(t,r,s,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?St.TrackBefore:St.TrackAfter:St.TrackDel}get type(){return this.startSide!=this.endSide?Ot.WidgetRange:this.startSide<=0?Ot.WidgetBefore:Ot.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof i&&MR(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)}};Lr.prototype.point=!0;function b0(i,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=i;return t==null&&(t=i.inclusive),r==null&&(r=i.inclusive),{start:t??e,end:r??e}}function MR(i,e){return i==e||!!(i&&e&&i.compare(e))}function Gn(i,e,t,r=0){let n=t.length-1;n>=0&&t[n]+r>=i?t[n]=Math.max(t[n],e):t.push(i,e)}var Wa=class i extends yi{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.rank=r}eq(e){return e==this||e instanceof i&&this.tagName==e.tagName&&Xu(this.attributes,e.attributes)}static create(e){return new i(e.tagName,e.attributes||Pa,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return Ae.of(e,t)}};Wa.prototype.startSide=Wa.prototype.endSide=-1;function Vs(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function nu(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Ns(i,e){if(!e.anchorNode)return!1;try{return nu(i,e.anchorNode)}catch{return!1}}function Ga(i){return i.nodeType==3?Zs(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function vs(i,e,t,r){return t?Dm(i,e,t,r,-1)||Dm(i,e,t,r,1):!1}function or(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function La(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Dm(i,e,t,r,n){for(;;){if(i==t&&e==r)return!0;if(e==(n<0?0:Mi(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=or(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(n<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=n<0?Mi(i):0}else return!1}}function Mi(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Ma(i,e){let{left:t,right:r}=i;if(t==r)return i;let n=e?t:r;return{left:n,right:n,top:i.top,bottom:i.bottom}}function VR(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function x0(i,e){let t=e.width/i.offsetWidth,r=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-i.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function ZR(i,e,t,r,n,s,o,a){let l=i.ownerDocument,h=l.defaultView||window;for(let u=i,c=!1;u&&!c;)if(u.nodeType==1){let d,g=u==l.body,m=1,x=1;if(g)d=VR(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(c=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let B=u.getBoundingClientRect();({scaleX:m,scaleY:x}=x0(u,B)),d={left:B.left,right:B.left+u.clientWidth*m,top:B.top,bottom:B.top+u.clientHeight*x}}let O=0,w=0;if(n=="nearest")e.top<d.top+o?(w=e.top-(d.top+o),t>0&&e.bottom>d.bottom+w&&(w=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(w=e.bottom-d.bottom+o,t<0&&e.top-w<d.top&&(w=e.top-(d.top+o)));else{let B=e.bottom-e.top,F=d.bottom-d.top;w=(n=="center"&&B<=F?e.top+B/2-F/2:n=="start"||n=="center"&&t<0?e.top-o:e.bottom-F+o)-d.top}if(r=="nearest"?e.left<d.left+s?(O=e.left-(d.left+s),t>0&&e.right>d.right+O&&(O=e.right-d.right+s)):e.right>d.right-s&&(O=e.right-d.right+s,t<0&&e.left<d.left+O&&(O=e.left-(d.left+s))):O=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,O||w)if(g)h.scrollBy(O,w);else{let B=0,F=0;if(w){let M=u.scrollTop;u.scrollTop+=w/x,F=(u.scrollTop-M)*x}if(O){let M=u.scrollLeft;u.scrollLeft+=O/m,B=(u.scrollLeft-M)*m}e={left:e.left-B,top:e.top-F,right:e.right-B,bottom:e.bottom-F},B&&Math.abs(B-O)<1&&(r="nearest"),F&&Math.abs(F-w)<1&&(n="nearest")}if(g)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function y0(i,e=!0){let t=i.ownerDocument,r=null,n=null;for(let s=i.parentNode;s&&!(s==t.body||(!e||r)&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:n}}var su=class{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:r}=e;this.set(t,Math.min(e.anchorOffset,t?Mi(t):0),r,Math.min(e.focusOffset,r?Mi(r):0))}set(e,t,r,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=n}};function S0(i){let e=[];for(let t=i;t;t=t.nodeType==11?t.host:t.parentNode)t.nodeType==1&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function T0(i,e=!0){for(let{node:t,left:r,top:n}of i)e&&t.scrollTop!=n&&(t.scrollTop=n),t.scrollLeft!=r&&(t.scrollLeft=r)}var Pr=null;Q.safari&&Q.safari_version>=26&&(Pr=!1);function I0(i){if(i.setActive)return i.setActive();if(Pr)return i.focus(Pr);let e=S0(i);i.focus(Pr==null?{get preventScroll(){return Pr={preventScroll:!0},!0}}:void 0),Pr||(Pr=!1,T0(e))}var Xm;function Zs(i,e,t=e){let r=Xm||(Xm=document.createRange());return r.setEnd(i,t),r.setStart(i,e),r}function Fn(i,e,t,r){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=r);let s=new KeyboardEvent("keydown",n);s.synthetic=!0,i.dispatchEvent(s);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,i.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function QR(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function DR(i,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Mi(t));;)if(r){if(t.nodeType!=1)return!1;let n=t.childNodes[r-1];n.contentEditable=="false"?r--:(t=n,r=Mi(t))}else{if(t==i)return!0;r=or(t),t=t.parentNode}}function O0(i){return i instanceof Window?i.pageYOffset>Math.max(0,i.document.documentElement.scrollHeight-i.innerHeight-4):i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function A0(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Mi(t)}else if(t.parentNode&&!La(t))r=or(t),t=t.parentNode;else return null}}function w0(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!La(t))r=or(t)+1,t=t.parentNode;else return null}}var Ti=class i{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new i(e.parentNode,or(e),t)}static after(e,t){return new i(e.parentNode,or(e)+1,t)}},je=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(je||(je={})),Mr=je.LTR,Yu=je.RTL;function R0(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}var XR=R0("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),YR=R0("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ou=Object.create(null),Si=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);ou[e]=t,ou[t]=-e}function C0(i){return i<=247?XR[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?YR[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}var jR=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Yt=class{get dir(){return this.level%2?Yu:Mr}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,n){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==r)return o;(s<0||(n!=0?n<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 E0(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let r=i[t],n=e[t];if(r.from!=n.from||r.to!=n.to||r.direction!=n.direction||!E0(r.inner,n.inner))return!1}return!0}var _e=[];function JR(i,e,t,r,n){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:n;for(let h=o,u=l,c=l;h<a;h++){let d=C0(i.charCodeAt(h));d==512?d=u:d==8&&c==4&&(d=16),_e[h]=d==4?2:d,d&7&&(c=d),u=d}for(let h=o,u=l,c=l;h<a;h++){let d=_e[h];if(d==128)h<a-1&&u==_e[h+1]&&u&24?d=_e[h]=u:_e[h]=256;else if(d==64){let g=h+1;for(;g<a&&_e[g]==64;)g++;let m=h&&u==8||g<t&&_e[g]==8?c==1?1:8:256;for(let x=h;x<g;x++)_e[x]=m;h=g-1}else d==8&&c==1&&(_e[h]=1);u=d,d&7&&(c=d)}}}function HR(i,e,t,r,n){let s=n==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let h=o?r[o-1].to:e,u=o<r.length?r[o].from:t;for(let c=h,d,g,m;c<u;c++)if(g=ou[d=i.charCodeAt(c)])if(g<0){for(let x=a-3;x>=0;x-=3)if(Si[x+1]==-g){let O=Si[x+2],w=O&2?n:O&4?O&1?s:n:0;w&&(_e[c]=_e[Si[x]]=w),a=x;break}}else{if(Si.length==189)break;Si[a++]=c,Si[a++]=d,Si[a++]=l}else if((m=_e[c])==2||m==1){let x=m==n;l=x?0:1;for(let O=a-3;O>=0;O-=3){let w=Si[O+2];if(w&2)break;if(x)Si[O+2]|=2;else{if(w&4)break;Si[O+2]|=4}}}}}function zR(i,e,t,r){for(let n=0,s=r;n<=t.length;n++){let o=n?t[n-1].to:i,a=n<t.length?t[n].from:e;for(let l=o;l<a;){let h=_e[l];if(h==256){let u=l+1;for(;;)if(u==a){if(n==t.length)break;u=t[n++].to,a=n<t.length?t[n].from:e}else if(_e[u]==256)u++;else break;let c=s==1,d=(u<e?_e[u]:r)==1,g=c==d?c?1:2:r;for(let m=u,x=n,O=x?t[x-1].to:i;m>l;)m==O&&(m=t[--x].from,O=x?t[x-1].to:i),_e[--m]=g;l=u}else s=h,l++}}}function au(i,e,t,r,n,s,o){let a=r%2?2:1;if(r%2==n%2)for(let l=e,h=0;l<t;){let u=!0,c=!1;if(h==s.length||l<s[h].from){let x=_e[l];x!=a&&(u=!1,c=x==16)}let d=!u&&a==1?[]:null,g=u?r:r+1,m=l;e:for(;;)if(h<s.length&&m==s[h].from){if(c)break e;let x=s[h];if(!u)for(let O=x.to,w=h+1;;){if(O==t)break e;if(w<s.length&&s[w].from==O)O=s[w++].to;else{if(_e[O]==a)break e;break}}if(h++,d)d.push(x);else{x.from>l&&o.push(new Yt(l,x.from,g));let O=x.direction==Mr!=!(g%2);lu(i,O?r+1:r,n,x.inner,x.from,x.to,o),l=x.to}m=x.to}else{if(m==t||(u?_e[m]!=a:_e[m]==a))break;m++}d?au(i,l,m,r+1,n,d,o):l<m&&o.push(new Yt(l,m,g)),l=m}else for(let l=t,h=s.length;l>e;){let u=!0,c=!1;if(!h||l>s[h-1].to){let x=_e[l-1];x!=a&&(u=!1,c=x==16)}let d=!u&&a==1?[]:null,g=u?r:r+1,m=l;e:for(;;)if(h&&m==s[h-1].to){if(c)break e;let x=s[--h];if(!u)for(let O=x.from,w=h;;){if(O==e)break e;if(w&&s[w-1].to==O)O=s[--w].from;else{if(_e[O-1]==a)break e;break}}if(d)d.push(x);else{x.to<l&&o.push(new Yt(x.to,l,g));let O=x.direction==Mr!=!(g%2);lu(i,O?r+1:r,n,x.inner,x.from,x.to,o),l=x.from}m=x.from}else{if(m==e||(u?_e[m-1]!=a:_e[m-1]==a))break;m--}d?au(i,m,l,r+1,n,d,o):m<l&&o.push(new Yt(m,l,g)),l=m}}function lu(i,e,t,r,n,s,o){let a=e%2?2:1;JR(i,n,s,r,a),HR(i,n,s,r,a),zR(n,s,r,a),au(i,n,s,e,t,r,o)}function $R(i,e,t){if(!i)return[new Yt(0,0,e==Yu?1:0)];if(e==Mr&&!t.length&&!jR.test(i))return k0(i.length);if(t.length)for(;i.length>_e.length;)_e[_e.length]=256;let r=[],n=e==Mr?0:1;return lu(i,n,n,t,0,i.length,r),r}function k0(i){return[new Yt(0,i,0)]}var N0="";function qR(i,e,t,r,n){var s;let o=r.head-i.from,a=Yt.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],h=l.side(n,t);if(o==h){let d=a+=n?1:-1;if(d<0||d>=e.length)return null;l=e[a=d],o=l.side(!n,t),h=l.side(n,t)}let u=Zt(i.text,o,l.forward(n,t));(u<l.from||u>l.to)&&(u=h),N0=i.text.slice(Math.min(o,u),Math.max(o,u));let c=a==(n?e.length-1:0)?null:e[a+(n?1:-1)];return c&&u==h&&c.level+(n?0:1)<l.level?ee.cursor(c.side(!n,t)+i.from,c.forward(n,t)?1:-1,c.level):ee.cursor(u+i.from,l.forward(n,t)?-1:1,l.level)}function KR(i,e,t){for(let r=e;r<t;r++){let n=C0(i.charCodeAt(r));if(n==1)return Mr;if(n==2||n==4)return Yu}return Mr}var v0=q.define(),_0=q.define(),B0=q.define(),G0=q.define(),hu=q.define(),F0=q.define(),U0=q.define(),ju=q.define(),Ju=q.define(),P0=q.define({combine:i=>i.some(e=>e)}),eC=q.define({combine:i=>i.some(e=>e)}),W0=q.define(),_s=class i{constructor(e,t,r,n,s,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new i(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 i(ee.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Ea=Ze.define({map:(i,e)=>i.map(e)}),L0=Ze.define();function ei(i,e,t){let r=i.facet(G0);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}var Wi=q.define({combine:i=>i.length?i[0]:!0}),tC=0,vn=q.define({combine(i){return i.filter((e,t)=>{for(let r=0;r<t;r++)if(i[r].plugin==e.plugin)return!1;return!0})}}),ri=class i{constructor(e,t,r,n,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=n,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(vn.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(vn.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=t||{};return new i(tC++,e,r,n,a=>{let l=[];return o&&l.push(Ka.of(h=>{let u=h.plugin(a);return u?o(u):Se.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return i.define((r,n)=>new e(r,n),t)}},Bs=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(ei(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){ei(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(r){ei(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},M0=q.define(),Hu=q.define(),Ka=q.define(),V0=q.define(),zu=q.define(),Qs=q.define(),Z0=q.define();function Ym(i,e){let t=i.state.facet(Z0);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(i):s),n=[];return Ae.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let h=s-e.from,u=o-e.from,c=n;for(let d=a.length-1;d>=0;d--,l--){let g=a[d].spec.bidiIsolate,m;if(g==null&&(g=KR(e.text,h,u)),l>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==g)m.to=u,c=m.inner;else{let x={from:h,to:u,direction:g,inner:[]};c.push(x),c=x.inner}}}}),n}var Q0=q.define();function D0(i){let e=0,t=0,r=0,n=0;for(let s of i.state.facet(Q0)){let o=s(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:r,bottom:n}}var Es=q.define(),ti=class i{constructor(e,t,r,n){this.fromA=e,this.toA=t,this.fromB=r,this.toB=n}join(e){return new i(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,r=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>r.toA)){if(n.toA<r.fromA)break;r=r.join(n),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let n=0,s=0,o=0;;){let a=n<e.length?e[n].fromB:1e9,l=s<t.length?t[s]:1e9,h=Math.min(a,l);if(h==1e9)break;let u=h+o,c=h,d=u;for(;;)if(s<t.length&&t[s]<=c){let g=t[s+1];s+=2,c=Math.max(c,g);for(let m=n;m<e.length&&e[m].fromB<=c;m++)o=e[m].toA-e[m].toB;d=Math.max(d,g+o)}else if(n<e.length&&e[n].fromB<=c){let g=e[n++];c=Math.max(c,g.toB),d=Math.max(d,g.toA),o=g.toA-g.toB}else break;r.push(new i(u,d,h,c))}return r}},Va=class i{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Bt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,a,l)=>n.push(new ti(s,o,a,l))),this.changedRanges=n}static create(e,t,r){return new i(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},iC=[],Me=class{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return iC}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&WR(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let r=t;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}covers(e){return!0}coordsIn(e,t,r){return null}domPosFor(e,t){let r=or(this.dom),n=this.length?e>0:t>0;return new Ti(this.parent.dom,r+(n?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Pn)return e;return null}static get(e){return e.cmTile}},Un=class extends Me{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,r=null,n,s=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,n=r?r.nextSibling:t.firstChild,s&&n!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;n&&n!=a.dom;)n=jm(n);else t.insertBefore(a.dom,n);r=a.dom}for(n=r?r.nextSibling:t.firstChild,s&&n&&(s.written=!0);n;)n=jm(n);this.length=o}};function jm(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}var Pn=class extends Un{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Me.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,n=0,s=0;;)if(n==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,n=t.pop()}else{let o=r.children[n++];if(o instanceof Li)t.push(n),r=o,n=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,t){let r,n=-1,s,o=-1;if(this.blockTiles((a,l)=>{let h=l+a.length;if(e>=l&&e<=h){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==h&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,n=e-l),(h>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:n}:{tile:s,offset:o}}},Li=class i extends Un{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let r=new i(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}},Wn=class i extends Un{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let n=new i(t||document.createElement("div"),e);return(!t||!r)&&(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(e,t,r){let n=null,s=-1,o=null,a=-1;function l(u,c){for(let d=0,g=0;d<u.children.length&&g<=c;d++){let m=u.children[d],x=g+m.length;x>=c&&(m.isComposite()?l(m,c-g):(!o||o.isHidden&&(t>0&&!(o.flags&32)||r&&nC(o,m)))&&(x>c||m.flags&32&&t<=1)?(o=m,a=c-g):(g<c||m.flags&16&&!m.isHidden&&t>=-1)&&(n=m,s=c-g)),g=x}}l(this,e);let h=(t<0?n:o)||n||o;return h?{tile:h,offset:h==n?s:a}:null}coordsIn(e,t,r){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t,r):rC(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:n,offset:s}=r;if(this.dom.contains(n.dom))return n.isText()?new Ti(n.dom,Math.min(n.dom.nodeValue.length,s)):n.domPosFor(s,n.flags&16?1:n.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Ti(l.dom,0);l==r.tile&&(a=!0)}}return new Ti(this.dom,0)}};function rC(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Ga(e);return t[t.length-1]||null}function nC(i,e){let t=i.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}var It=class i extends Un{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new i(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}},Wr=class i extends Me{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,r){let n=this.dom.nodeValue.length;e>n&&(e=n);let s=e,o=e,a=0;e==0&&t<0||e==n&&t>=0?Q.chrome||Q.gecko||(e?(s--,a=1):o<n&&(o++,a=-1)):t<0?s--:o<n&&o++;let l=Zs(this.dom,s,o).getClientRects();if(!l.length)return null;let h=l[(a?a<0:t>=0)?0:l.length-1];return Q.safari&&!a&&h.width==0&&(h=Array.prototype.find.call(l,u=>u.width)||h),r==null?h:Ma(h,(a?a>0:t<0)==r)}static of(e,t){let r=new i(t||document.createTextNode(e),e);return t||(r.flags|=2),r}},Vr=class i extends Me{constructor(e,t,r,n){super(e,t,n),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;if(r)return Ma(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return Ma(o,!a)}}get overrideDOMText(){if(!this.length)return ye.empty;let{root:e}=this;if(!e)return ye.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,n,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new i(s,r,e,n)}},Ln=class extends Me{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ye.empty}coordsIn(e,t,r){let n=this.dom.getBoundingClientRect();return r==null?n:Ma(n,t>0==r)}},uu=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:n,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(n.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==n.children.length){if(!e&&!a.length)break;r&&r.leave(n),o=!!n.breakAfter,{tile:n,index:s}=a.pop(),s++}else{let l=n.children[s],h=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!h,s++,e-=l.length):(a.push({tile:n,index:s}),n=l,s=0,r&&l.isComposite()&&r.enter(l))}else{let l=n.length;if(s<l&&e){let h=Math.min(e,l-s);r&&r.skip(n,s,s+h),e-=h,s+=h}if(s==l)o=!!n.breakAfter,{tile:n,index:s}=a.pop(),s++;else if(!e)break}return this.tile=n,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},fu=class{constructor(e,t,r,n){this.from=e,this.to=t,this.wrapper=r,this.rank=n}},cu=class{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,n){var s;this.flushBuffer();let o=this.ensureMarks(t,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Wr(a.dom,a.text+e);l.parent=o}else o.append(n||Wr.of(e,(s=this.cache.find(Wr))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?jh(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let n=r;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],h=n.lastChild;if(h instanceof It&&h.mark.eq(l.mark))h.dom!=l.dom&&h.setDOM(jh(l.dom)),n=h;else{if(this.cache.reused.get(l)){let c=Me.get(l.dom);c&&c.setDOM(jh(l.dom))}let u=It.of(l.mark,l.dom);n.append(u),n=u}this.cache.reused.set(l,2)}let s=Me.get(e.text);s&&this.cache.reused.set(s,2);let o=new Wr(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,n.append(o)}addInlineWidget(e,t,r){let n=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);n||this.flushBuffer();let s=this.ensureMarks(t,r);!n&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=X0);let n=Wn.start(e,t||((r=this.cache.find(Wn))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var r;let n=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=n.lastChild)&&a instanceof It&&a.mark.eq(o))n=a,t--;else{let l=It.of(o,(r=this.cache.find(It,h=>h.mark.eq(o)))===null||r===void 0?void 0:r.dom);n.append(l),n=l,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Jm(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Q.ios&&Jm(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Jh,0,32)||new Vr(Jh.toDOM(),0,Jh,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,r=new fu(e.from,e.to,e.value,t),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-r.rank||this.wrappers[n-1].to-r.to)<0;)n--;this.wrappers.splice(n,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let n=t.lastChild;if(r.from<this.pos&&n instanceof Li&&n.wrapper.eq(r.wrapper))t=n;else{let s=Li.of(r.wrapper,(e=this.cache.find(Li,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(Ln,void 0,1);return r&&(r.flags=t),r||new Ln(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},du=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:n,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=n;let a=this.textOff=Math.min(e,n.length);return s?null:n.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}},Za=[Vr,Wn,Wr,It,Ln,Li,Pn];for(let i=0;i<Za.length;i++)Za[i].bucket=i;var pu=class{constructor(e){this.view=e,this.buckets=Za.map(()=>[]),this.index=Za.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let n=e.bucket,s=this.buckets[n],o=this.index[n];for(let a=0;a<s.length;a++){let l=(a+o)%s.length,h=s[l];if((!t||t(h))&&!this.reused.has(h))return s.splice(l,1),l<o&&this.index[n]--,this.reused.set(h,r),h}return null}findWidget(e,t,r){let n=this.buckets[0];if(n.length)for(let s=0,o=0;;s++){if(s==n.length){if(o)return null;o=1,s=0}let a=n[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return n.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Vr(a.dom,t,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},gu=class{constructor(e,t,r,n,s){this.view=e,this.decorations=n,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new pu(e),this.text=new du(e.state.doc),this.builder=new cu(this.cache,new Pn(e,e.contentDOM),Ae.iter(r)),this.cache.reused.set(t,2),this.old=new uu(t),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let n=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>n){let h=l-n;this.preserve(h,!o,!a),n=l,s+=h}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,n=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let n=aC(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let h=l>0||a<o.length?Vr.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,n,s),s=n.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,n,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),n,s)),s=n.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Ln)this.cache.add(o);else if(o instanceof It)this.builder.ensureLine(null),this.builder.addMark(o,n,s),this.cache.reused.set(o,1),s=n.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof It&&n.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?n.length&&(n.length=s=0):o instanceof It&&(n.shift(),s=Math.min(s,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,n=this.builder,s=-1,o=Ae.spans(this.decorations,e,t,{point:(a,l,h,u,c,d)=>{if(h instanceof Lr){if(this.disallowBlockEffectsFor[d]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=u.length,c>u.length)n.continueWidget(l-a);else{let g=h.widget||(h.block?ar.block:ar.inline),m=sC(h),x=this.cache.findWidget(g,l-a,m)||Vr.of(g,this.view,l-a,m);h.block?(h.startSide>0&&n.addLineStartIfNotCovered(r),n.addBlockWidget(x)):(n.ensureLine(r),n.addInlineWidget(x,u,c))}r=null}else r=oC(r,h);l>a&&this.text.skip(l-a)},span:(a,l,h,u)=>{for(let c=a;c<l;){let d=this.text.next(Math.min(512,l-c));d==null?(n.addLineStartIfNotCovered(r),n.addBreak(),c++):(n.ensureLine(r),n.addText(d,h,c==a?u:h.length),c+=d.length),r=null}s=h.length}});s>-1&&(this.openWidget=o>s),this.openWidget||n.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let n=e.parentNode;;n=n.parentNode){let s=Me.get(n);if(n==this.view.contentDOM)break;s instanceof It?t.push(s):s?.isLine()?r=s:s instanceof Li||(n.nodeName=="DIV"&&!r&&n!=this.view.contentDOM?r=new Wn(n,X0):r||t.push(It.of(new Ls({tagName:n.nodeName.toLowerCase(),attributes:LR(n)}),n)))}return{line:r,marks:t}}};function Jm(i,e){let t=r=>{for(let n of r.children)if((e?n.isText():n.length)||t(n))return!0;return!1};return t(i)}function sC(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;return i.block&&(e|=256),e}var X0={class:"cm-line"};function oC(i,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(i||(i={class:"cm-line"}),t&&Du(t,i),r&&(i.class+=" "+r)),i}function aC(i){let e=[];for(let t=i.parents.length;t>1;t--){let r=t==i.parents.length?i.tile:i.parents[t].tile;r instanceof It&&e.push(r.mark)}return e}function jh(i){let e=Me.get(i);return e&&e.setDOM(i.cloneNode()),i}var ar=class extends ii{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}};ar.inline=new ar("span");ar.block=new ar("div");var Jh=new class extends ii{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Qa=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Se.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Pn(e,e.contentDOM),this.updateInner([new ti(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:c})=>c<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!gC(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let s=n>-1?hC(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:c}=this.hasComposition;r=new ti(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=cC(o,this.decorations,e.changes);l.length&&(r=ti.extendWithRanges(r,l));let h=dC(a,this.blockWrappers,e.changes);return h.length&&(r=ti.extendWithRanges(r,h)),s&&!r.some(u=>u.fromA<=s.range.fromA&&u.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new gu(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Me.get(t.text)&&a.cache.reused.set(Me.get(t.text),2),this.tile=a.run(e,t),mu(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Q.chrome||Q.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Gs&&n.push(s.dom);r.updateGaps(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(L0)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,n=this.view.root.activeElement,s=n==r,o=!s&&!(this.view.state.facet(Wi)||r.tabIndex>-1)&&Ns(r,this.view.observer.selectionRange)&&!(n&&r.contains(n));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,h,u;if(l.empty?u=h=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),h=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Q.gecko&&l.empty&&!this.hasComposition&&lC(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=u=new Ti(d,0),a=!0}let c=this.view.observer.selectionRange;(a||!c.focusNode||(!vs(h.node,h.offset,c.anchorNode,c.anchorOffset)||!vs(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&r.contains(c.focusNode)&&pC(c.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Vs(this.view.root);if(d)if(l.empty){if(Q.gecko){let g=uC(h.node,h.offset);if(g&&g!=3){let m=(g==1?A0:w0)(h.node,h.offset);m&&(h=new Ti(m.node,m.offset))}}d.collapse(h.node,h.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(u.node,u.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([h,u]=[u,h]),g.setEnd(u.node,u.offset),g.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(g)}o&&this.view.root.activeElement==r&&(r.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(h,u)),this.impreciseAnchor=h.precise?null:new Ti(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new Ti(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&vs(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=Vs(e.root),{anchorNode:n,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!l||!h||l.bottom>h.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(u.node,u.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&r.collapse(n,s)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let n=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[t];else{let o=Mi(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return n;for(;s&&!Me.get(s);)s=s.nextSibling;if(!s)return n+r.length;for(let o=0,a=n;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?n+t:n+(t?r.length:0):n}domAtPos(e,t){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(n,t):r.domIn(n,t)}inlineDOMNearPos(e,t){let r,n=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((h,u)=>{if(h.isWidget()){if(h.flags&32&&u>=e)return!0;h.flags&16&&(s=!0)}else{let c=u+h.length;if(u<=e&&(r=h,n=e-u,s=c<e),c>=e&&!o&&(o=h,a=e-u,l=u>e),u>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:l&&r&&(o=null),r&&t<0||!o?r.domIn(n,t):o.domIn(a,t))}coordsAt(e,t,r){let{tile:n,offset:s}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Gs?null:n.coordsInWidget(s,t,!0):n.coordsIn(s,t,r)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function n(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=n(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Zt(s.text,o);if(a==o)return null;let l=Zs(s.dom,o,a).getClientRects();for(let h=0;h<l.length;h++){let u=l[h];if(h==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return n(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:n}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==je.LTR,h=0,u=(c,d,g)=>{for(let m=0;m<c.children.length&&!(d>n);m++){let x=c.children[m],O=d+x.length,w=x.dom.getBoundingClientRect(),{height:B}=w;if(g&&!m&&(h+=w.top-g.top),x instanceof Li)O>r&&u(x,d,w);else if(d>=r&&(h>0&&t.push(-h),t.push(B+h),h=0,o)){let F=x.dom.lastChild,M=F?Ga(F):[];if(M.length){let G=M[M.length-1],T=l?G.right-w.left:w.right-G.left;T>a&&(a=T,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=O)}}g&&m==c.children.length-1&&(h+=g.bottom-w.bottom),d=O+x.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?je.RTL:je.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let u=Ga(h.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),r,n,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Ga(t.firstChild)[0];r=t.getBoundingClientRect().height,n=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:n,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,n=0;;n++){let s=n==t.viewports.length?null:t.viewports[n],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Se.replace({widget:new Gs(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Se.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ka).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,n=this.view.state.facet(zu).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(n.length&&(this.dynamicDecorationMap[e++]=r,t.push(Ae.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(V0).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(W0))try{if(h(this.view,e.range,e))return!0}catch(u){ei(this.view.state,u,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),n;if(!r)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=D0(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(ZR(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==je.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(t.head,1);if(h){let u=S0(h.dom);h.dom.scrollIntoView({block:"nearest"}),T0(u,!1)}}}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){mu(this.tile)}};function mu(i,e){let t=e?.get(i);if(t!=1){t==null&&i.destroy();for(let r of i.children)mu(r,e)}}function lC(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function Y0(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let r=A0(t.focusNode,t.focusOffset),n=w0(t.focusNode,t.focusOffset),s=r||n;if(n&&r&&n.node!=r.node){let a=Me.get(n.node);if(!a||a.isText()&&a.text!=n.node.nodeValue)s=n;else if(i.docView.lastCompositionAfterCursor){let l=Me.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=n)}}if(i.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function hC(i,e,t){let r=Y0(i,t);if(!r)return null;let{node:n,from:s,to:o}=r,a=n.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new ti(l.mapPos(s),l.mapPos(o),s,o),text:n}}function uC(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}var fC=class{constructor(){this.changes=[]}compareRange(e,t){Gn(e,t,this.changes)}comparePoint(e,t){Gn(e,t,this.changes)}boundChange(e){Gn(e,e,this.changes)}};function cC(i,e,t){let r=new fC;return Ae.compare(i,e,t,r),r.changes}var bu=class{constructor(){this.changes=[]}compareRange(e,t){Gn(e,t,this.changes)}comparePoint(){}boundChange(e){Gn(e,e,this.changes)}};function dC(i,e,t){let r=new bu;return Ae.compare(i,e,t,r),r.changes}function pC(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function gC(i,e){let t=!1;return e&&i.iterChangedRanges((r,n)=>{r<e.to&&n>e.from&&(t=!0)}),t}var Gs=class extends ii{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function mC(i,e,t=1){let r=i.charCategorizer(e),n=i.doc.lineAt(e),s=e-n.from;if(n.length==0)return ee.cursor(e);s==0?t=1:s==n.length&&(t=-1);let o=s,a=s;t<0?o=Zt(n.text,s,!1):a=Zt(n.text,s);let l=r(n.text.slice(o,a));for(;o>0;){let h=Zt(n.text,o,!1);if(r(n.text.slice(h,o))!=l)break;o=h}for(;a<n.length;){let h=Zt(n.text,a);if(r(n.text.slice(a,h))!=l)break;a=h}return ee.undirectionalRange(o+n.from,a+n.from)}function bC(i,e,t,r,n){let s=Math.round((r-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((n-t.top-(i.defaultLineHeight-a)*.5)/a);s+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Um(o,s,i.state.tabSize)}function xC(i,e,t){let r=i.lineBlockAt(e);if(Array.isArray(r.type)){let n;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!n||s.type==Ot.Text&&(n.type!=s.type||(t<0?s.from<e:s.to>e)))&&(n=s)}}return n||r}return r}function yC(i,e,t,r){let n=xC(i,e.head,e.assoc||-1),s=!r||n.type!=Ot.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(s){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(n.from),l=i.posAtCoords({x:t==(a==je.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return ee.cursor(l,t?-1:1)}return ee.cursor(t?n.to:n.from,t?-1:1)}function Hm(i,e,t,r){let n=i.state.doc.lineAt(e.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let a=e,l=null;;){let h=qR(n,s,o,a,t),u=N0;if(!h){if(n.number==(t?i.state.doc.lines:1))return a;u=`
27
+ `,n=i.state.doc.line(n.number+(t?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!t)}if(l){if(!l(u))return a}else{if(!r)return h;l=r(u)}a=h}}function SC(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{let o=r(s);return n==mi.Space&&(n=o),n==o}}function TC(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0))return ee.cursor(n,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),u=i.documentTop;if(h)o==null&&(o=h.left-l.left),a=s<0?h.top:h.bottom;else{let m=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(n-m.from))),a=(s<0?m.top:m.bottom)+u}let c=l.left+o,d=i.viewState.heightOracle.textHeight>>1,g=r??d;for(let m=0;;m+=d){let x=a+(g+m)*s,O=xu(i,{x:c,y:x},!1,s);if(t?x>l.bottom:x<l.top)return ee.cursor(O.pos,O.assoc);let w=i.coordsAtPos(O.pos,O.assoc),B=w?(w.top+w.bottom)/2:0;if(!w||(t?B>a:B<a))return ee.cursor(O.pos,O.assoc,void 0,o)}}function Fs(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function j0(i,e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.ranges[r],s=null;if(n.empty){let o=Fs(i,n.from,0);o!=n.from&&(s=ee.cursor(o,-1))}else{let o=Fs(i,n.from,-1),a=Fs(i,n.to,1);(o!=n.from||a!=n.to)&&(n.undirectional?s=ee.undirectionalRange(n.from,n.to):s=ee.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?ee.create(t,e.mainIndex):e}function Hh(i,e,t){let r=Fs(i.state.facet(Qs).map(n=>n(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:ee.cursor(r,r<t.from?1:-1)}var Xt=class{constructor(e,t){this.pos=e,this.assoc=t}};function xu(i,e,t,r){let n=i.contentDOM.getBoundingClientRect(),s=n.top+i.viewState.paddingTop,{x:o,y:a}=e,l=a-s,h;for(;;){if(l<0)return new Xt(0,1);if(l>i.viewState.docHeight)return new Xt(i.state.doc.length,-1);if(h=i.elementAtHeight(l),r==null)break;if(h.type==Ot.Text){if(r<0?h.to<i.viewport.from:h.from>i.viewport.to)break;let d=i.docView.coordsAt(r<0?h.from:h.to,r>0?-1:1);if(d&&(r<0?d.top<=l+s:d.bottom>=l+s))break}let c=i.viewState.heightOracle.textHeight/2;l=r>0?h.bottom+c:h.top-c}if(i.viewport.from>=h.to||i.viewport.to<=h.from){if(t)return null;if(h.type==Ot.Text){let c=bC(i,n,h,o,a);return new Xt(c,c==h.from?1:-1)}}if(h.type!=Ot.Text)return l<(h.top+h.bottom)/2?new Xt(h.from,1):new Xt(h.to,-1);let u=i.docView.lineAt(h.from,2);return(!u||u.length!=h.length)&&(u=i.docView.lineAt(h.from,-2)),new yu(i,o,a,i.textDirectionAt(h.from)).scanTile(u,h.from)}var yu=class{constructor(e,t,r,n){this.view=e,this.x=t,this.y=r,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[Yt.find(n,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[Yt.find(n,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:n}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+n.from<t)}scan(e,t,r=!1){let n=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,h,u=-1,c=1e9,d;e:for(;n<s;){let m=s-n,x=n+s>>1;t:if(o.has(x)){for(let B=1;B<m;B++){let F=x+B;if(F>=s&&(F-=m),!o.has(F)){x=F;break t}}break e}o.add(x);let O=t(x),w=0;if(O)for(let B=0;B<O.length;B++){let F=O[B];if(!(F.width==0&&O.length>1))if(F.bottom<this.y)(!l||l.bottom<F.bottom)&&(l=F),w=1;else if(F.top>this.y)(!h||h.top>F.top)&&(h=F),w=-1;else{let M=F.left>this.x?this.x-F.left:F.right<this.x?this.x-F.right:0,G=Math.abs(M);G<c&&(u=x,c=G,d=F),M&&(w=M<0==(this.baseDir==je.LTR)?-1:1)}}w==-1&&(!a||this.baseDirAt(e[x],1))?s=x:w==1&&(!a||this.baseDirAt(e[x+1],-1))&&(n=x+1)}if(!d){if(!h&&!l)return{i:e[0],after:!1};let m=l&&(!h||this.y-l.bottom<h.top-this.y)?l:h;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(c&&!r){let{top:m,bottom:x}=d;if(l&&l.bottom>(m+m+x)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(h&&h.top<(m+x+x)/3)return this.y=h.top+1,this.scan(e,t,!0)}let g=(a?this.dirAt(e[u],1):this.baseDir)==je.LTR;return{i:u,after:this.x>(d.left+d.right)/2==g}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Zt(e.text,s))r.push(t+s);r.push(t+e.length);let n=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return Zs(e.dom,o,a).getClientRects()});return n.after?new Xt(r[n.i+1],-1):new Xt(r[n.i],1)}scanTile(e,t){if(!e.length)return new Xt(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let n=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Zs(l.dom,0,l.length)).getClientRects()}),s=e.children[n.i],o=r[n.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):n.after?new Xt(r[n.i+1],-1):new Xt(o,1)}},Nn="\uFFFF",Su=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Le.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Nn}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=Me.get(n),a=n.nextSibling;if(a==t){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Me.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:La(n))||La(a)&&(n.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!OC(a,t)&&this.lineBreak(),n=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=n.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,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);r=s+o}}readNode(e){let t=Me.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.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 r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(IC(e,r.node,r.offset)?t:0))}};function IC(i,e,t){for(;;){if(!e||t<Mi(e))return!1;if(e==i)return!0;t=or(e)+1,e=e.parentNode}}function OC(i,e){let t;for(;!(i==e||!i);i=i.nextSibling){let r=Me.get(i);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let n=r.overrideDOMText;if(n?.length)return!1}return!0}var Da=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Tu=class{constructor(e,t,r,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=J0(e.docView.tile,t,r,0))){let l=s||o?[]:wC(e),h=new Su(l,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=RC(l,this.bounds.from)}else{let l=e.observer.selectionRange,h=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!nu(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!nu(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((Q.ios||Q.chrome)&&h!=u&&Math.min(h,u)<=a.main.from&&Math.max(h,u)>=a.main.to&&(c.from>0||c.to<e.state.doc.length)){let d=Math.min(h,u),g=Math.max(h,u),m=c.from-d,x=c.to-g;(m==0||m==1||d==0)&&(x==0||x==-1||g==e.state.doc.length)&&(h=0,u=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(ee.range(u,h));else if(e.lineWrapping&&u==h&&!(a.main.empty&&a.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(h,-1),g=0;d&&(g=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=ee.create([ee.cursor(h,g)])}else this.newSel=ee.single(u,h)}}};function J0(i,e,t,r){if(i.isComposite()){let n=-1,s=-1,o=-1,a=-1;for(let l=0,h=r,u=r;l<i.children.length;l++){let c=i.children[l],d=h+c.length;if(h<e&&d>t)return J0(c,e,t,h);if(d>=e&&n==-1&&(n=l,s=h),h>t&&c.dom.parentNode==i.dom){o=l,a=u;break}u=d,h=d+c.breakAfter}return{from:s,to:a<0?r+i.length:a,startDOM:(n?i.children[n-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o<i.children.length&&o>=0?i.children[o].dom:null}}else return i.isText()?{from:r,to:r+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}:null}function H0(i,e){let t,{newSel:r}=e,{state:n}=i,s=n.selection.main,o=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,h=s.from,u=null;(o===8||Q.android&&e.text.length<l-a)&&(h=s.to,u="end");let c=n.doc.sliceString(a,l,Nn),d,g;!s.empty&&s.from>=a&&s.to<=l&&(e.typeOver||c!=e.text)&&c.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&c.slice(s.to-a)==e.text.slice(d=e.text.length-(c.length-(s.to-a)))?t={from:s.from,to:s.to,insert:ye.of(e.text.slice(s.from-a,d).split(Nn))}:(g=z0(c,e.text,h-a,u))&&(Q.chrome&&o==13&&g.toB==g.from+2&&e.text.slice(g.from,g.toB)==Nn+Nn&&g.toB--,t={from:a+g.from,to:a+g.toA,insert:ye.of(e.text.slice(g.from,g.toB).split(Nn))})}else r&&(!i.hasFocus&&n.facet(Wi)||Xa(r,s))&&(r=null);if(!t&&!r)return!1;if((Q.mac||Q.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=ee.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:ye.of([t.insert.toString().replace("."," ")])}):n.doc.lineAt(s.from).to<s.to&&i.docView.lineHasWidget(s.to)&&i.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:n.toText(i.inputState.insertingText)}:Q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
28
+ `&&i.lineWrapping&&(r&&(r=ee.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:ye.of([" "])}),t)return $u(i,t,r,o);if(r&&!Xa(r,s)){let a=!1,l="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(a=!0),l=i.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=j0(n.facet(Qs).map(h=>h(i)),r))),i.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function $u(i,e,t,r=-1){if(Q.ios&&i.inputState.flushIOSKey(e))return!0;let n=i.state.selection.main;if(Q.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&i.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Fn(i.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Fn(i.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Fn(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=AC(i,e,t));return i.state.facet(F0).some(l=>l(i,e.from,e.to,s,a))||i.dispatch(a()),!0}function AC(i,e,t){let r,n=i.state,s=n.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,h=l<0?s.from:s.to,u=Fs(n.facet(Qs).map(c=>c(i)),h,l);e.from==u&&(o=u)}if(o>-1)r={changes:e,selection:ee.cursor(e.from+e.insert.length,-1)};else 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)&&i.inputState.composing<0){let l=s.from<e.from?n.sliceDoc(s.from,e.from):"",h=s.to>e.to?n.sliceDoc(e.to,s.to):"";r=n.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+h))}else{let l=n.changes(e),h=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=i.state.sliceDoc(e.from,e.to),c,d=t&&Y0(i,t.main.head);if(d){let m=e.insert.length-(e.to-e.from);c={from:d.from,to:d.to-m}}else c=i.state.doc.lineAt(s.head);let g=s.to-e.to;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:h||m.map(l)};let x=m.to-g,O=x-u.length;if(i.state.sliceDoc(O,x)!=u||x>=c.from&&O<=c.to)return{range:m};let w=n.changes({from:O,to:x,insert:e.insert}),B=m.to-s.to;return{changes:w,range:h?ee.range(Math.max(0,h.anchor+B),Math.max(0,h.head+B)):m.map(w)}})}else r={changes:l,selection:h&&n.selection.replaceRange(h)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:a,scrollIntoView:!0})}function z0(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&i.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 wC(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new Da(t,r)),(n!=t||s!=r)&&e.push(new Da(n,s))),e}function RC(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?ee.single(t+e,r+e):null}function Xa(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}var Iu=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null),Q.gecko&&ZC(e.contentDOM.ownerDocument)}handleEvent(e){!FC(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,t);for(let n of r.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=EC(e),r=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(n.removeEventListener(s,this.handleEvent),a=null),a||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&NC.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&($0.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||kC.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&Q.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&CC(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Fn(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function CC(i){return i.visualViewport?i.visualViewport.height*i.visualViewport.scale/i.document.documentElement.clientHeight<.85:!1}function zm(i,e){return(t,r)=>{try{return e.call(i,r,t)}catch(n){ei(t.state,n)}}}function EC(i){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec,s=n&&n.plugin.domEventHandlers,o=n&&n.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&t(a).handlers.push(zm(r.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push(zm(r.value,l))}}for(let r in ni)t(r).handlers.push(ni[r]);for(let r in gt)t(r).observers.push(gt[r]);return e}var $0=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],kC="dthko",NC=[16,17,18,20,91,92,224,225],ka=6;function Na(i){return Math.max(0,i)*.7+8}function vC(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}var Ou=class{constructor(e,t,r,n){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=y0(e.contentDOM),this.atoms=e.state.facet(Qs).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(Le.allowMultipleSelections)&&_C(e,t),this.dragging=GC(e,t)&&eb(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&vC(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,n=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:n,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=D0(this.view);e.clientX-l.left<=n+ka?t=-Na(n-e.clientX):e.clientX+l.right>=o-ka&&(t=Na(e.clientX-o)),e.clientY-l.top<=s+ka?r=-Na(s-e.clientY):e.clientY+l.bottom>=a-ka&&(r=Na(e.clientY-a)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=j0(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function _C(i,e){let t=i.state.facet(v0);return t.length?t[0](e):Q.mac?e.metaKey:e.ctrlKey}function BC(i,e){let t=i.state.facet(_0);return t.length?t[0](e):Q.mac?!e.altKey:!e.ctrlKey}function GC(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let r=Vs(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s<n.length;s++){let o=n[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function FC(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Me.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}var ni=Object.create(null),gt=Object.create(null),q0=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function UC(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),K0(i,t.value)},50)}function el(i,e,t){for(let r of i.facet(e))t=r(t,i);return t}function K0(i,e){e=el(i.state,ju,e);let{state:t}=i,r,n=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;r=t.changeByRange(h=>{let u=t.doc.lineAt(h.from);if(u.from==l)return{range:h};l=u.from;let c=t.toText((o?s.line(n++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:c},range:ee.cursor(h.from+c.length)}})}else o?r=t.changeByRange(l=>{let h=s.line(n++);return{changes:{from:l.from,to:l.to,insert:h.text},range:ee.cursor(l.from+h.length)}}):r=t.replaceSelection(s);i.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}gt.scroll=i=>{let e=i.inputState;e.lastScrollTop=i.scrollDOM.scrollTop,e.lastScrollLeft=i.scrollDOM.scrollLeft,Q.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};gt.wheel=gt.mousewheel=i=>{i.inputState.lastWheelEvent=Date.now()};ni.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);gt.touchstart=(i,e)=>{let t=i.inputState,r=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),r&&(t.lastTouchX=r.clientX,t.lastTouchY=r.clientY),t.setSelectionOrigin("select.pointer")};gt.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};gt.touchend=(i,e)=>{i.inputState.touchActive=!1};ni.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of i.state.facet(B0))if(t=r(i,e),t)break;if(!t&&e.button==0&&(t=WC(i,e)),t){let r=!i.hasFocus;i.inputState.startMouseSelection(new Ou(i,e,t,r)),r&&i.observer.ignore(()=>{I0(i.contentDOM);let s=i.root.activeElement;s&&!s.contains(i.contentDOM)&&s.blur()});let n=i.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function $m(i,e,t,r){if(r==1)return ee.cursor(e,t);if(r==2)return mC(i.state,e,t);{let n=i.docView.lineAt(e,t),s=i.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:s.from,a=n?n.posAtEnd:s.to;return a<i.state.doc.length&&a==s.to&&a++,ee.undirectionalRange(o,a)}}var PC=Q.ie&&Q.ie_version<=11,qm=null,Km=0,e0=0;function eb(i){if(!PC)return i.detail;let e=qm,t=e0;return qm=i,e0=Date.now(),Km=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Km+1)%3:1}function WC(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=eb(e),n=i.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),n=n.map(s.changes))},get(s,o,a){let l=i.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,u=$m(i,l.pos,l.assoc,r);if(t.pos!=l.pos&&!o){let c=$m(i,t.pos,t.assoc,r),d=Math.min(c.from,u.from),g=Math.max(c.to,u.to);u=d<u.from?ee.range(d,g,u.assoc):ee.range(g,d,u.assoc)}return o?n.replaceRange(n.main.extend(u.from,u.to,u.assoc)):a&&r==1&&n.ranges.length>1&&(h=LC(n,l.pos))?h:a?n.addRange(u):ee.create([u])}}}function LC(i,e){for(let t=0;t<i.ranges.length;t++){let{from:r,to:n}=i.ranges[t];if(r<=e&&n>=e)return ee.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}ni.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let n=i.docView.tile.nearest(e.target);if(n&&n.isWidget()){let s=n.posAtStart,o=s+n.length;(s>=t.to||o<=t.from)&&(t=ee.undirectionalRange(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",el(i.state,Ju,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ni.dragend=i=>(i.inputState.draggedContent=null,!1);function t0(i,e,t,r){if(t=el(i.state,ju,t),!t)return;let n=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&BC(i,e)?{from:s.from,to:s.to}:null,a={from:n,insert:t},l=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(n,-1),head:l.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}ni.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),n=0,s=()=>{++n==t.length&&t0(i,e,r.filter(o=>o!=null).join(i.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)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return t0(i,e,r,!0),!0}return!1};ni.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=q0?null:e.clipboardData;return t?(K0(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(UC(i),!1)};function MC(i,e){let t=i.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function VC(i){let e=[],t=[],r=!1;for(let n of i.selection.ranges)n.empty||(e.push(i.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:el(i,Ju,e.join(i.lineBreak)),ranges:t,linewise:r}}var Au=null;ni.copy=ni.cut=(i,e)=>{if(!Ns(i.contentDOM,i.observer.selectionRange))return!1;let{text:t,ranges:r,linewise:n}=VC(i.state);if(!t&&!n)return!1;Au=n?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=q0?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(MC(i,t),!1)};var tb=Pi.define();function ib(i,e){let t=[];for(let r of i.facet(U0)){let n=r(i,e);n&&t.push(n)}return t.length?i.update({effects:t,annotations:tb.of(!0)}):null}function rb(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=ib(i.state,e);t?i.dispatch(t):i.update([])}},10)}gt.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),rb(i)};gt.blur=i=>{i.observer.clearSelectionRange(),rb(i)};gt.compositionstart=gt.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};gt.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};gt.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};ni.beforeinput=(i,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=i.posAtDOM(a.startContainer,a.startOffset),h=i.posAtDOM(a.endContainer,a.endOffset);return $u(i,{from:l,to:h,insert:i.state.toText(s)},null),!0}}let n;if(Q.chrome&&Q.android&&(n=$0.find(s=>s.inputType==e.inputType))&&(i.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Q.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),Q.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>gt.compositionend(i,e),20),!1};var i0=new Set;function ZC(i){i0.has(i)||(i0.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}var r0=["pre-wrap","normal","pre-line","break-spaces"],Mn=!1;function n0(){Mn=!1}var wu=class{constructor(e){this.lineWrapping=e,this.doc=ye.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return r0.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];n<0?r++:this.heightSamples[Math.floor(n*10)]||(t=!0,this.heightSamples[Math.floor(n*10)]=!0)}return t}refresh(e,t,r,n,s,o){let a=r0.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let h=0;h<o.length;h++){let u=o[h];u<0?h++:this.heightSamples[Math.floor(u*10)]=!0}}return l}},Ru=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Kt=class i{constructor(e,t,r,n,s){this.from=e,this.length=t,this.top=r,this.height=n,this._content=s}get type(){return typeof this._content=="number"?Ot.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 Lr?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 i(this.from,this.length+e.length,this.top,this.height+e.height,t)}},Pe=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Pe||(Pe={})),Fa=.001,Gt=class i{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Fa&&(Mn=!0),this.height=e)}replace(e,t,r){return i.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,n){let s=this,o=r.doc;for(let a=n.length-1;a>=0;a--){let{fromA:l,toA:h,fromB:u,toB:c}=n[a],d=s.lineAt(l,Pe.ByPosNoHeight,r.setDoc(t),0,0),g=d.to>=h?d:s.lineAt(h,Pe.ByPosNoHeight,r,0,0);for(c+=g.to-h,h=g.to;a>0&&d.from<=n[a-1].toA;)l=n[a-1].fromA,u=n[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,Pe.ByPosNoHeight,r,0,0));u+=d.from-l,l=d.from;let m=Eu.build(r.setDoc(o),e,u,c);s=Ya(s,s.replace(l,h,m))}return s.updateHeight(r,0)}static empty(){return new Dt(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,n=0,s=0;for(;;)if(t==r)if(n>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),r+=1+a.break,n-=a.size}else if(s>n*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(n<s){let a=e[t++];a&&(n+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new Cu(i.of(e.slice(0,t)),o,i.of(e.slice(r)))}};function Ya(i,e){return i==e?i:(i.constructor!=e.constructor&&(Mn=!0),e)}Gt.prototype.size=1;var QC=Se.replace({}),ja=class extends Gt{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new Kt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,n){return this.spaceAbove&&e<r+this.spaceAbove?new Kt(n,0,r,this.spaceAbove,QC):this.mainBlock(r,n)}lineAt(e,t,r,n,s){let o=this.mainBlock(n,s);return this.spaceAbove?this.blockAt(0,r,n,s).join(o):o}forEachLine(e,t,r,n,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,Pe.ByPos,r,n,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}},Dt=class i extends ja{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new Kt(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof sr&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof sr?n=new i(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):Gt.of(r)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more?this.setMeasuredHeight(n):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},sr=class i extends Gt{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,s=n-r+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:r,lastLine:n,perLine:o,perChar:a}}blockAt(e,t,r,n){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,n);if(t.lineWrapping){let h=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=t.doc.lineAt(h),c=a+u.length*l,d=Math.max(r,e-c/2);return new Kt(u.from,u.length,d,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:u,length:c}=t.doc.line(s+h);return new Kt(u,c,r+a*h,a,0)}}lineAt(e,t,r,n,s){if(t==Pe.ByHeight)return this.blockAt(e,r,n,s);if(t==Pe.ByPosNoHeight){let{from:g,to:m}=r.doc.lineAt(e);return new Kt(g,m-g,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),h=r.doc.lineAt(e),u=a+h.length*l,c=h.number-o,d=n+a*c+l*(h.from-s-c);return new Kt(h.from,h.length,Math.max(n,Math.min(d,n+this.height-u)),u,0)}forEachLine(e,t,r,n,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:h}=this.heightMetrics(r,s);for(let u=e,c=n;u<=t;){let d=r.doc.lineAt(u);if(u==e){let m=d.number-a;c+=l*m+h*(e-s-m)}let g=l+h*d.length;o(new Kt(d.from,d.length,c,g,0)),c+=g,u=d.to+1}}replace(e,t,r){let n=this.length-t;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(e>0){let s=r[0];s instanceof i?r[0]=new i(e+s.length):r.unshift(new i(e-1),null)}return Gt.of(r)}decomposeLeft(e,t){t.push(new i(e-1),null)}decomposeRight(e,t){t.push(null,new i(this.length-e-1))}updateHeight(e,t=0,r=!1,n){let s=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],a=Math.max(t,n.from),l=-1;for(n.from>t&&o.push(new i(n.from-t-1).updateHeight(e,t));a<=s&&n.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let c=n.heights[n.index++],d=0;c<0&&(d=-c,c=n.heights[n.index++]),l==-1?l=c:Math.abs(c-l)>=Fa&&(l=-2);let g=new Dt(u,c,d);g.outdated=!1,o.push(g),a+=u+1}a<=s&&o.push(null,new i(s-a).updateHeight(e,a));let h=Gt.of(o);return(l<0||Math.abs(h.height-this.height)>=Fa||Math.abs(l-this.heightMetrics(e,t).perLine)>=Fa)&&(Mn=!0),Ya(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Cu=class extends Gt{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,n){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,n):this.right.blockAt(e,t,s,n+this.left.length+this.break)}lineAt(e,t,r,n,s){let o=n+this.left.height,a=s+this.left.length+this.break,l=t==Pe.ByHeight?e<o:e<a,h=l?this.left.lineAt(e,t,r,n,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?h.to<a:h.from>a))return h;let u=t==Pe.ByPosNoHeight?Pe.ByPosNoHeight:Pe.ByPos;return l?h.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,n,s).join(h)}forEachLine(e,t,r,n,s,o){let a=n+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,n,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let h=this.lineAt(l,Pe.ByPos,r,n,s);e<h.from&&this.left.forEachLine(e,h.from-1,r,n,s,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,r,a,l,o)}}replace(e,t,r){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&s0(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),s0(s,a)}return Gt.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,n=r+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Gt.of(this.break?[e,null,t]:[e,t]):(this.left=Ya(this.left,e),this.right=Ya(this.right,t),this.setHeight(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,r=!1,n){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return n&&n.from<=t+s.length&&n.more?l=s=s.updateHeight(e,t,r,n):s.updateHeight(e,t,r),n&&n.from<=a+o.length&&n.more?l=o=o.updateHeight(e,a,r,n):o.updateHeight(e,a,r),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 s0(i,e){let t,r;i[e]==null&&(t=i[e-1])instanceof sr&&(r=i[e+1])instanceof sr&&i.splice(e-1,3,new sr(t.length+1+r.length))}var DC=5,Eu=class i{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 r=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Dt?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Dt(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let n=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new ja(o,n,r)):(o||s||n>=DC)&&this.addLineDeco(n,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 Dt(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new sr(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Dt)return e;let t=new Dt(0,-1,0);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,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Dt)&&!this.isCovered?this.nodes.push(new Dt(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let n of this.nodes)n instanceof Dt&&n.updateHeight(this.oracle,r),r+=n?n.length:1;return this.nodes}static build(e,t,r,n){let s=new i(r,e);return Ae.spans(t,r,n,s,0),s.finish(r)}};function XC(i,e,t){let r=new ku;return Ae.compare(i,e,t,r,0),r.changes}var ku=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,n){(e<t||r&&r.heightRelevant||n&&n.heightRelevant)&&Gn(e,t,this.changes,5)}};function YC(i,e){let t=i.getBoundingClientRect(),r=i.ownerDocument,n=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(n.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(n.innerHeight,t.bottom);for(let h=i.parentNode;h&&h!=r.body;)if(h.nodeType==1){let u=h,c=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&c.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(h==i.parentNode?n.innerHeight:l,d.bottom)}h=c.position=="absolute"||c.position=="fixed"?u.offsetParent:u.parentNode}else if(h.nodeType==11)h=h.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 jC(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function JC(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var Us=class{constructor(e,t,r,n){this.from=e,this.to=t,this.size=r,this.displaySize=n}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],s=t[r];if(n.from!=s.from||n.to!=s.to||n.size!=s.size)return!1}return!0}draw(e,t){return Se.replace({widget:new Nu(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Nu=class extends ii{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}},Ja=class{constructor(e,t){this.view=e,this.state=t,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.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=o0,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=je.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=t.facet(Hu).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new wu(r),this.stateDeco=a0(t),this.heightMap=Gt.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle.setDoc(t.doc),[new ti(0,0,0,t.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Se.set(this.lineGaps.map(n=>n.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let n=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);e.push(new _n(s,o))}}return this.viewports=e.sort((r,n)=>r.from-n.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?o0:new vu(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ks(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=a0(this.state);let n=e.changedRanges,s=ti.extendWithRanges(n,XC(r,this.stateDeco,e?e.changes:Bt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);n0(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Mn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);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 h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(eC)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,r=window.getComputedStyle(t),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?je.RTL:je.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,u=0;if(a.width&&a.height){let{scaleX:G,scaleY:T}=x0(t,a);(G>.005&&Math.abs(this.scaleX-G)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=G,this.scaleY=T,h|=16,o=l=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=d)&&(this.paddingTop=c,this.paddingBottom=d,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let g=y0(this.view.contentDOM,!1).y;g!=this.scrollParent&&(this.scrollParent=g,this.scrollAnchorHeight=-1,this.scrollOffset=0);let m=this.getScrollOffset();this.scrollOffset!=m&&(this.scrollAnchorHeight=-1,this.scrollOffset=m),this.scrolledToBottom=O0(this.scrollParent||e.win);let x=(this.printing?JC:YC)(t,this.paddingTop),O=x.top-this.pixelViewport.top,w=x.bottom-this.pixelViewport.bottom;this.pixelViewport=x;let B=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(B!=this.inView&&(this.inView=B,B&&(l=!0)),!this.inView&&!this.scrollTarget&&!jC(e.dom))return 0;let F=a.width;if((this.contentDOMWidth!=F||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),l){let G=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(G)&&(o=!0),o||n.lineWrapping&&Math.abs(F-this.contentDOMWidth)>n.charWidth){let{lineHeight:T,charWidth:b,textHeight:A}=e.docView.measureTextSize();o=T>0&&n.refresh(s,T,b,A,Math.max(5,F/b),G),o&&(e.docView.minWidth=0,h|=16)}O>0&&w>0?u=Math.max(O,w):O<0&&w<0&&(u=Math.min(O,w)),n0();for(let T of this.viewports){let b=T.from==this.viewport.from?G:e.docView.measureVisibleLineHeights(T);this.heightMap=(o?Gt.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle,[new ti(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Ru(T.from,b))}Mn&&(h|=2)}let M=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return M&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),h|=this.updateForViewport()),(h&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new _n(n.lineAt(o-r*1e3,Pe.ByHeight,s,0,0).from,n.lineAt(a+(1-r)*1e3,Pe.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(h<l.from||h>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,Pe.ByPos,s,0,0),d;t.y=="center"?d=(c.top+c.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&h<l.from?d=c.top:d=c.bottom-u,l=new _n(n.lineAt(d-1e3/2,Pe.ByHeight,s,0,0).from,n.lineAt(d+u+1e3/2,Pe.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new _n(this.heightMap.lineAt(r,Pe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,Pe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,Pe.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Pe.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||n<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let n of e)t.touchesRange(n.from,n.to)||r.push(new Us(t.mapPos(n.from),t.mapPos(n.to),n.size,n.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,n=r?1e4:2e3,s=n>>1,o=n<<1;if(this.defaultTextDirection!=je.LTR&&!r)return[];let a=[],l=(u,c,d,g)=>{if(c-u<s)return;let m=this.state.selection.main,x=[m.from];m.empty||x.push(m.to);for(let w of x)if(w>u&&w<c){l(u,w-10,d,g),l(w+10,c,d,g);return}let O=zC(e,w=>w.from>=d.from&&w.to<=d.to&&Math.abs(w.from-u)<s&&Math.abs(w.to-c)<s&&!x.some(B=>w.from<B&&w.to>B));if(!O){if(c<d.to&&t&&r&&t.visibleRanges.some(F=>F.from<=c&&F.to>=c)){let F=t.moveToLineBoundary(ee.cursor(c),!1,!0).head;F>u&&(c=F)}let w=this.gapSize(d,u,c,g),B=r||w<2e6?w:2e6;O=new Us(u,c,w,B)}a.push(O)},h=u=>{if(u.length<o||u.type!=Ot.Text)return;let c=HC(u.from,u.to,this.stateDeco);if(c.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,g,m;if(r){let x=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,O,w;if(d!=null){let B=_a(c,d),F=((this.visibleBottom-this.visibleTop)/2+x)/u.height;O=B-F,w=B+F}else O=(this.visibleTop-u.top-x)/u.height,w=(this.visibleBottom-u.top+x)/u.height;g=va(c,O),m=va(c,w)}else{let x=c.total*this.heightOracle.charWidth,O=n*this.heightOracle.charWidth,w=0;if(x>2e6)for(let T of e)T.from>=u.from&&T.from<u.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=T.size-T.displaySize);let B=this.pixelViewport.left+w,F=this.pixelViewport.right+w,M,G;if(d!=null){let T=_a(c,d),b=((F-B)/2+O)/x;M=T-b,G=T+b}else M=(B-O)/x,G=(F+O)/x;g=va(c,M),m=va(c,G)}g>u.from&&l(u.from,g,u,c),m<u.to&&l(m,u.to,u,c)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(h):h(u);return a}gapSize(e,t,r,n){let s=_a(n,r)-_a(n,t);return this.heightOracle.lineWrapping?e.height*s:n.total*this.heightOracle.charWidth*s}updateLineGaps(e){Us.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Se.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];Ae.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let n=0;if(r.length!=this.visibleRanges.length)n=12;else for(let s=0;s<r.length&&!(n&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(n|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(n|=8))}return this.visibleRanges=r,n}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ks(this.heightMap.lineAt(e,Pe.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ks(this.heightMap.lineAt(this.scaler.fromDOM(e),Pe.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}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 ks(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}},_n=class{constructor(e,t){this.from=e,this.to=t}};function HC(i,e,t){let r=[],n=i,s=0;return Ae.spans(t,i,e,{span(){},point(o,a){o>n&&(r.push({from:n,to:o}),s+=o-n),n=a}},20),n<e&&(r.push({from:n,to:e}),s+=e-n),{total:s,ranges:r}}function va({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(i*t);for(let n=0;;n++){let{from:s,to:o}=e[n],a=o-s;if(r<=a)return s+r;r-=a}}function _a(i,e){let t=0;for(let{from:r,to:n}of i.ranges){if(e<=n){t+=e-r;break}t+=n-r}return t/i.total}function zC(i,e){for(let t of i)if(e(t))return t}var o0={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function a0(i){let e=i.facet(Ka).filter(r=>typeof r!="function"),t=i.facet(zu).filter(r=>typeof r!="function");return t.length&&e.push(Ae.join(t)),e}var vu=class i{constructor(e,t,r){let n=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let h=t.lineAt(a,Pe.ByPos,e,0,0).top,u=t.lineAt(l,Pe.ByPos,e,0,0).bottom;return n+=u-h,{from:a,to:l,top:h,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);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,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return n+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,n=s.domBottom}}fromDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-n)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,n=s.domBottom}}eq(e){return e instanceof i?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}};function ks(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),r=e.toDOM(i.bottom);return new Kt(i.from,i.length,t,r-t,Array.isArray(i._content)?i._content.map(n=>ks(n,e)):i._content)}var Ba=q.define({combine:i=>i.join(" ")}),_u=q.define({combine:i=>i.indexOf(!0)>-1}),Bu=Qt.newName(),nb=Qt.newName(),sb=Qt.newName(),ob={"&light":"."+nb,"&dark":"."+sb};function Gu(i,e,t){return new Qt(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,n=>{if(n=="&")return i;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):i+" "+r}})}var $C=Gu("."+Bu,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ob),qC={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zh=Q.ie&&Q.ie_version<=11,Fu=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new su,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Q.chrome&&Q.chrome_version<126)&&(this.editContext=new Uu(e),e.state.facet(Wi)&&(e.contentDOM.editContext=this.editContext.editContext)),zh&&(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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),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.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){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:r}=this,n=this.selectionRange;if(r.state.facet(Wi)?r.root.activeElement!=this.dom:!Ns(this.dom,n))return;let s=n.anchorNode&&r.docView.tile.nearest(n.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&vs(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Vs(e.root);if(!t)return!1;let r=Q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&KC(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let n=Ns(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&DR(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),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 r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.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,qC),zh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),zh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let n=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Fn(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.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,r=-1,n=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:n}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Ns(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Tu(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,n=H0(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!Xa(this.view.state.selection,t.newSel.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=l0(t,e.previousSibling||e.target.previousSibling,-1),n=l0(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:n?t.posBefore(n):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),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Wi)!=e.state.facet(Wi)&&(e.view.contentDOM.editContext=e.state.facet(Wi)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function l0(i,e,t){for(;e;){let r=Me.get(e);if(r&&r.parent==i)return r;let n=e.parentNode;e=n!=i.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function h0(i,e){let t=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor,1);return vs(o.node,o.offset,n,s)&&([t,r,n,s]=[n,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}}function KC(i,e){if(e.getComposedRanges){let n=e.getComposedRanges(i.root)[0];if(n)return h0(i,n)}let t=null;function r(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",r,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",r,!0),t?h0(i,t):null}var Uu=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let n=e.state.selection.main,{anchor:s,head:o}=n,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let h=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let u=z0(e.state.sliceDoc(a,l),r.text,(h?n.from:n.to)-a,h?"end":null);if(!u){let d=ee.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Xa(d,n)||e.dispatch({selection:d,userEvent:"select"});return}let c={from:u.from+a,to:u.toA+a,insert:ye.of(r.text.slice(u.from,u.toB).split(`
29
+ `))};if((Q.mac||Q.android)&&c.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:a,to:l,insert:ye.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let d=this.to-this.from+(c.to-c.from+c.insert.length);$u(e,c,ee.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let n=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,n.push(s)}t.updateCharacterBounds(r.rangeStart,n)},this.handlers.textformatupdate=r=>{let n=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(l<h){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;n.push(Se.mark({attributes:{style:u}}).range(l,h))}}}e.dispatch({effects:L0.of(Se.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let n=Vs(r.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,h)=>{if(r)return;let u=h.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,t+=u,this.to+=u;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=u}t+=u}),n&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},ie=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(n=>n.forEach(s=>r(s,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||QR(e.parent)||document,this.viewState=new Ja(this,e.state||Le.create(e)),e.scrollTo&&e.scrollTo.is(Ea)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(vn).map(n=>new Bs(n));for(let n of this.plugins)n.update(this);this.observer=new Fu(this),this.inputState=new Iu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Qa(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}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,r=!1,n,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(tb))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=ib(s,o),l||(a=1));let h=this.observer.delayedAndroidKey,u=null;if(h?(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(Le.phrases)!=this.state.facet(Le.phrases))return this.setState(s);n=Va.create(this,s,e),n.flags|=a;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(c&&(c=c.map(d.changes)),d.scrollIntoView){let{main:g}=d.state.selection,{x:m,y:x}=this.state.facet(i.cursorScrollMargin);c=new _s(g.empty?g:ee.cursor(g.head,g.head>g.anchor?-1:1),"nearest","nearest",x,m)}for(let g of d.effects)g.is(Ea)&&(c=g.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Ha.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(Es)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(Ba)!=n.state.facet(Ba)&&(this.viewState.mustMeasureContent=!0),(t||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let d of this.state.facet(hu))try{d(n)}catch(g){ei(this.state,g,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!H0(this,u)&&h.force&&Fn(this.contentDOM,h.key,h.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 r of this.plugins)r.destroy(this);this.viewState=new Ja(this,e),this.plugins=e.facet(vn).map(r=>new Bs(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Qa(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(vn),r=e.state.facet(vn);if(t!=r){let n=[];for(let s of r){let o=t.indexOf(s);if(o<0)n.push(new Bs(s));else{let a=this.plugins[o];a.mustUpdate=e,n.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){ei(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o,scaleY:a}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(O0(r||this.win))s=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let m=this.viewState.scrollAnchorAt(n);s=m.from,o=m.top}a=this.viewState.scaleY}this.updateState=1;let h=this.viewState.measure();if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];h&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(m=>{try{return m.read(this)}catch(x){return ei(this.state,x),u0}}),d=Va.create(this,this.state,[]),g=!1;d.flags|=h,t?t.flags|=h:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),g=this.docView.update(d),g&&this.docViewUpdate());for(let m=0;m<u.length;m++)if(c[m]!=u0)try{let x=u[m];x.write&&x.write(c[m],this)}catch(x){ei(this.state,x)}if(g&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let x=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)/this.viewState.scaleY-o/a;if((x>1||x<-1)&&!(Q.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n=n+x,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=x:this.win.scrollBy(0,x),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(hu))l(t)}get themeClasses(){return Bu+" "+(this.state.facet(_u)?sb:nb)+" "+this.state.facet(Ba)}updateAttrs(){let e=f0(this,M0,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Wi)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),f0(this,Hu,t);let r=this.observer.ignore(()=>{let n=Qm(this.contentDOM,this.contentAttrs,t),s=Qm(this.dom,this.editorAttrs,e);return n||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let n of r.effects)if(n.is(i.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Es);let e=this.state.facet(i.cspNonce);Qt.mount(this.root,this.styleModules.concat($C).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.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==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,r){return Hh(this,e,Hm(this,e,t,r))}moveByGroup(e,t){return Hh(this,e,Hm(this,e,t,r=>SC(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return ee.cursor(s.side(t,n)+e.from,s.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,r=!0){return yC(this,e,t,r)}moveVertically(e,t,r){return Hh(this,e,TC(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=xu(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),xu(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.state.doc.lineAt(e),n=this.bidiSpans(r),s=n[Yt.find(n,e-r.from,-1,t)];return this.docView.coordsAt(e,t,s.dir==je.RTL)}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(P0)||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>eE)return k0(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||E0(s.isolates,r=Ym(this,e))))return s.order;r||(r=Ym(this,e));let n=$R(e.text,t,r);return this.bidiCache.push(new Ha(e.from,e.to,t,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{I0(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var r,n,s,o;return Ea.of(new _s(typeof e=="number"?ee.cursor(e):e,(r=t.y)!==null&&r!==void 0?r:"nearest",(n=t.x)!==null&&n!==void 0?n:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Ea.of(new _s(ee.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ri.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ri.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=Qt.newName(),n=[Ba.of(r),Es.of(Gu(`.${r}`,e))];return t&&t.dark&&n.push(_u.of(!0)),n}static baseTheme(e){return Cs.lowest(Es.of(Gu("."+Bu,e,ob)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),n=r&&Me.get(r)||Me.get(e);return((t=n?.root)===null||t===void 0?void 0:t.view)||null}};ie.styleModule=Es;ie.inputHandler=F0;ie.clipboardInputFilter=ju;ie.clipboardOutputFilter=Ju;ie.scrollHandler=W0;ie.focusChangeEffect=U0;ie.perLineTextDirection=P0;ie.exceptionSink=G0;ie.updateListener=hu;ie.editable=Wi;ie.mouseSelectionStyle=B0;ie.dragMovesSelection=_0;ie.clickAddsSelectionRange=v0;ie.decorations=Ka;ie.blockWrappers=V0;ie.outerDecorations=zu;ie.atomicRanges=Qs;ie.bidiIsolatedRanges=Z0;ie.cursorScrollMargin=q.define({combine:i=>{let e=5,t=5;for(let r of i)typeof r=="number"?e=t=r:{x:e,y:t}=r;return{x:e,y:t}}});ie.scrollMargins=Q0;ie.darkTheme=_u;ie.cspNonce=q.define({combine:i=>i.length?i[0]:""});ie.contentAttributes=Hu;ie.editorAttributes=M0;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=Ze.define();var eE=4096,u0={},Ha=class i{constructor(e,t,r,n,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:je.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==n&&!t.touchesRange(o.from,o.to)&&r.push(new i(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function f0(i,e,t){for(let r=i.state.facet(e),n=r.length-1;n>=0;n--){let s=r[n],o=typeof s=="function"?s(i):s;o&&Du(o,t)}return t}var jM=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";var tE=Q.gecko&&Q.gecko_version==153?"#ffffff01":"transparent",JM=Cs.highest(ie.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${tE} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function c0(i,e,t,r,n){e.lastIndex=0;for(let s=i.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)n(o+a.index,a)}function iE(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let r=[];for(let{from:n,to:s}of t)n=Math.max(i.state.doc.lineAt(n).from,n-e),s=Math.min(i.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=n?r[r.length-1].to=s:r.push({from:n,to:s});return r}var Pu=class{constructor(e){let{regexp:t,decoration:r,decorate:n,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,n)this.addMatch=(a,l,h,u)=>n(u,h,h+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,h,u)=>{let c=r(a,l,h);c&&u(h,h+a[0].length,c)};else if(r)this.addMatch=(a,l,h,u)=>u(h,h+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new bi,r=t.add.bind(t);for(let{from:n,to:s}of iE(e,this.maxLength))c0(e.state.doc,this.regexp,n,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),n=Math.max(l,n))}),e.viewportMoved||n-r>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),r,n):t}updateRange(e,t,r,n){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,n);if(a>=o){let l=e.state.doc.lineAt(o),h=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),c=Math.min(s.to,h.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<h.to;a++)if(this.boundary.test(h.text[a-h.from])){c=a;break}}let d=[],g,m=(x,O,w)=>d.push(w.range(x,O));if(l==h)for(this.regexp.lastIndex=u-l.from;(g=this.regexp.exec(l.text))&&g.index<c-l.from;)this.addMatch(g,e,g.index+l.from,m);else c0(e.state.doc,this.regexp,u,c,(x,O)=>this.addMatch(O,e,x,m));t=t.update({filterFrom:u,filterTo:c,filter:(x,O)=>x<u||O>c,add:d})}}return t}},Wu=/x/.unicode!=null?"gu":"g",rE=new RegExp(`[\0-\b
30
+ -\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Wu),nE={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"},$h=null;function sE(){var i;if($h==null&&typeof document<"u"&&document.body){let e=document.body.style;$h=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return $h||!1}var Ua=q.define({combine(i){let e=kn(i,{render:null,specialChars:rE,addSpecialChars:null});return(e.replaceTabs=!sE())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Wu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Wu)),e}});function ab(i={}){return[Ua.of(i),oE()]}var d0=null;function oE(){return d0||(d0=ri.fromClass(class{constructor(i){this.view=i,this.decorations=Se.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Ua)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new Pu({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:n}=t.state,s=wm(e[0],0);if(s==9){let o=n.lineAt(r),a=t.state.tabSize,l=Zh(o.text,a,r-o.from);return Se.replace({widget:new Mu((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Se.replace({widget:new Lu(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Ua);i.startState.facet(Ua)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var aE="\u2022";function lE(i){return i>=32?aE:i==10?"\u2424":String.fromCharCode(9216+i)}var Lu=class extends ii{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=lE(this.code),r=e.state.phrase("Control character")+" "+(nE[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Mu=class extends ii{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}};var HM=ie.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${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"}}});var si=class extends yi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};si.prototype.elementClass="";si.prototype.toDOM=void 0;si.prototype.mapMode=St.TrackBefore;si.prototype.startSide=si.prototype.endSide=-1;si.prototype.point=!0;var qh=q.define(),hE=q.define(),uE={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ae.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ps=q.define();function lb(i){return[hb(),Ps.of({...uE,...i})]}var Vu=q.define({combine:i=>i.some(e=>e)});function hb(i){let e=[fE];return i&&i.fixed===!1&&e.push(Vu.of(!0)),e}var fE=ri.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Ps).map(e=>new za(i,e)),this.fixed=!i.state.facet(Vu);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Vu)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ae.iter(this.view.state.facet(qh),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Qu(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Ot.Text&&o){Zu(t,r,a.from);for(let l of n)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of n)l.widget(this.view,a)}else if(s.type==Ot.Text){Zu(t,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet(Ps),t=i.state.facet(Ps),r=i.docChanged||i.heightChanged||i.viewportChanged||!Ae.eq(i.startState.facet(qh),i.state.facet(qh),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of t){let o=e.indexOf(s);o<0?n.push(new za(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>ie.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,n=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==je.LTR?{left:r,right:n}:{right:r,left:n}})});function p0(i){return Array.isArray(i)?i:[i]}function Zu(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}var Qu=class{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ae.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:n}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==n.elements.length){let a=new $a(e,o,s,r);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let n=[];Zu(this.cursor,n,t.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(e,t,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),n=r?[r]:null;for(let s of e.state.facet(hE)){let o=s(e,t.widget,t);o&&(n||(n=[])).push(o)}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()}}},za=class{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 r in t.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.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=n.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,n)&&n.preventDefault()});this.markers=p0(t.markers(e)),t.initialSpacer&&(this.spacer=new $a(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=p0(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let r=e.view.viewport;return!Ae.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},$a=class{constructor(e,t,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,n)}update(e,t,r,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),cE(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let r="cm-gutterElement",n=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,h=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let c=o;c<this.markers.length;c++)if(this.markers[c].compare(l)){a=c,h=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(n);let c=n.nextSibling;n.remove(),n=c}}if(!l)break;l.toDOM&&(h?n=n.nextSibling:this.dom.insertBefore(l.toDOM(e),n)),h&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}};function cE(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}var dE=q.define(),pE=q.define(),Bn=q.define({combine(i){return kn(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let n in t){let s=r[n],o=t[n];r[n]=s?(a,l,h)=>s(a,l,h)||o(a,l,h):o}return r}})}}),Ws=class extends si{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Kh(i,e){return i.state.facet(Bn).formatNumber(e,i.state)}var gE=Ps.compute([Bn],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(dE)},lineMarker(e,t,r){return r.some(n=>n.toDOM)?null:new Ws(Kh(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let n of e.state.facet(pE)){let s=n(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Bn)!=e.state.facet(Bn),initialSpacer(e){return new Ws(Kh(e,g0(e.state.doc.lines)))},updateSpacer(e,t){let r=Kh(t.view,g0(t.view.state.doc.lines));return r==e.number?e:new Ws(r)},domEventHandlers:i.facet(Bn).domEventHandlers,side:"before"}));function ub(i={}){return[Bn.of(i),hb(),gE]}function g0(i){let e=9;for(;e<i;)e=e*10+9;return e}var mE=0,Ds=class{constructor(e,t){this.from=e,this.to=t}},le=class{constructor(e={}){this.id=mE++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ot.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}};le.closedBy=new le({deserialize:i=>i.split(" ")});le.openedBy=new le({deserialize:i=>i.split(" ")});le.group=new le({deserialize:i=>i.split(" ")});le.isolate=new le({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});le.contextHash=new le({perNode:!0});le.lookAhead=new le({perNode:!0});le.mounted=new le({perNode:!0});var Zr=class{constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[le.mounted.id]}},bE=Object.create(null),ot=class i{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):bE,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new i(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),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 n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(le.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return r=>{for(let n=r.prop(le.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?r.name:n[s]];if(o)return o}}}};ot.none=new ot("",Object.create(null),0,8);var Vn=class i{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 r of this.types){let n=null;for(let s of e){let o=s(r);if(o){n||(n=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in n&&(a=l.combine(n[l.id],a)),n[l.id]=a}}t.push(n?new ot(r.name,n,r.id,r.flags):r)}return new i(t)}},tl=new WeakMap,fb=new WeakMap,Ve;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays",i[i.EnterBracketed=16]="EnterBracketed"})(Ve||(Ve={}));var Re=class i{constructor(e,t,r,n,s){if(this.type=e,this.children=t,this.positions=r,this.length=n,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=Zr.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let n=r.toString();n&&(t&&(t+=","),t+=n)}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 js(this.topNode,e)}cursorAt(e,t=0,r=0){let n=tl.get(this)||this.topNode,s=new js(n);return s.moveTo(e,t),tl.set(this,s._tree),s}get topNode(){return new Ii(this,0,0,null)}resolve(e,t=0){let r=Xs(tl.get(this)||this.topNode,e,t,!1);return tl.set(this,r),r}resolveInner(e,t=0){let r=Xs(fb.get(this)||this.topNode,e,t,!0);return fb.set(this,r),r}resolveStack(e,t=0){return xE(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:s=this.length}=e,o=e.mode||0,a=(o&Ve.IncludeAnonymous)>0;for(let l=this.cursor(o|Ve.IncludeAnonymous);;){let h=!1;if(l.from<=s&&l.to>=n&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;h=!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:sf(ot.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new i(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new i(ot.none,t,r,n)))}static build(e){return yE(e)}};Re.empty=new Re(ot.none,[],[],0);var qu=class i{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 i(this.buffer,this.index)}},lr=class i{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return ot.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],r=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,n,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(pb(s,n,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=n[a++],s[l++]=n[a++]-r;let h=s[l++]=n[a++]-r;s[l++]=n[a++]-e,o=Math.max(o,h)}return new i(s,o,this.set)}};function pb(i,e,t,r){switch(i){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Xs(i,e,t,r){for(var n;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!r&&i instanceof Ii&&i.index<0?null:i.parent;if(!o)return i;i=o}let s=r?0:Ve.IgnoreOverlays;if(r)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof Ii&&o.index<0&&((n=a.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,s);if(!o)return i;i=o}}var rl=class{cursor(e=0){return new js(this,e)}getChild(e,t=null,r=null){let n=cb(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return cb(this,e,t,r)}resolve(e,t=0){return Xs(this,e,t,!1)}resolveInner(e,t=0){return Xs(this,e,t,!0)}matchContext(e){return Ku(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}get node(){return this}get next(){return this.parent}},Ii=class i extends rl{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=t>0?a.length:-1;e!=h;e+=t){let u=a[e],c=l[e]+o.from,d;if(!(!(s&Ve.EnterBracketed&&u instanceof Re&&(d=Zr.get(u))&&!d.overlay&&d.bracketed&&r>=c&&r<=c+u.length)&&!pb(n,r,c,c+u.length))){if(u instanceof lr){if(s&Ve.ExcludeBuffers)continue;let g=u.findChild(0,u.buffer.length,t,r-c,n);if(g>-1)return new Ys(new ef(o,u,e,c),null,g)}else if(s&Ve.IncludeAnonymous||!u.type.isAnonymous||nf(u)){let g;if(!(s&Ve.IgnoreMounts)&&(g=Zr.get(u))&&!g.overlay)return new i(g.tree,c,e,o);let m=new i(u,c,e,o);return s&Ve.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?u.children.length-1:0,t,r,n,s)}}}if(s&Ve.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)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let n;if(!(r&Ve.IgnoreOverlays)&&(n=Zr.get(this._tree))&&n.overlay){let s=e-this.from,o=r&Ve.EnterBracketed&&n.bracketed;for(let{from:a,to:l}of n.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?l>=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function cb(i,e,t,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function Ku(i,e,t=e.length-1){for(let r=i;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}var ef=class{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}},Ys=class i extends rl{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,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new i(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)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&Ve.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new i(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 i(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 i(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];e.push(r.slice(n,s,o)),t.push(0)}return new Re(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function gb(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;s<i.length;s++){let o=i[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Ii&&t.index<0?null:t.parent,n=i.slice();return r?n[e]=r:n.splice(e,1),new tf(n,t)}var tf=class{constructor(e,t){this.heads=e,this.node=t}get next(){return gb(this.heads)}};function xE(i,e,t){let r=i.resolveInner(e,t),n=null;for(let s=r instanceof Ii?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[r])).push(o.resolve(e,t)),s=o}else{let o=Zr.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Ii(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Xs(a,e,t,!1))}}return n?gb(n):r}var js=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Ve.EnterBracketed,e instanceof Ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof Ii?(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,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&Ve.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ve.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ve.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,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Ve.IncludeAnonymous||a instanceof lr||!a.type.isAnonymous||nf(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,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,r=s+1;break e}n=this.stack[--s]}for(let n=r;n<this.stack.length;n++)t=new Ys(this.buffer,t,this.stack[n]);return this.bufferNode=new Ys(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return Ku(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return Ku(this._tree,e,n);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function nf(i){return i.children.some(e=>e instanceof lr||!e.type.isAnonymous||nf(e))}function yE(i){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,a=Array.isArray(t)?new qu(t,t.length):t,l=r.types,h=0,u=0;function c(G,T,b,A,y,v){let{id:N,start:V,end:re,size:ne}=a,J=u,me=h;if(ne<0)if(a.next(),ne==-1){let C=s[N];b.push(C),A.push(V-G);return}else if(ne==-3){h=N;return}else if(ne==-4){u=N;return}else throw new RangeError(`Unrecognized record size: ${ne}`);let z=l[N],we,H,U=V-G;if(re-V<=n&&(H=O(a.pos-T,y))){let C=new Uint16Array(H.size-H.skip),Z=a.pos-H.size,D=C.length;for(;a.pos>Z;)D=w(H.start,C,D);we=new lr(C,re-H.start,r),U=H.start-G}else{let C=a.pos-ne;a.next();let Z=[],D=[],Ie=N>=o?N:-1,X=0,$=re;for(;a.pos>C;)Ie>=0&&a.id==Ie&&a.size>=0?(a.end<=$-n&&(m(Z,D,V,X,a.end,$,Ie,J,me),X=Z.length,$=a.end),a.next()):v>2500?d(V,C,Z,D):c(V,C,Z,D,Ie,v+1);if(Ie>=0&&X>0&&X<Z.length&&m(Z,D,V,X,V,$,Ie,J,me),Z.reverse(),D.reverse(),Ie>-1&&X>0){let oe=g(z,me);we=sf(z,Z,D,0,Z.length,0,re-V,oe,oe)}else we=x(z,Z,D,re-V,J-re,me)}b.push(we),A.push(U)}function d(G,T,b,A){let y=[],v=0,N=-1;for(;a.pos>T;){let{id:V,start:re,end:ne,size:J}=a;if(J>4)a.next();else{if(N>-1&&re<N)break;N<0&&(N=ne-n),y.push(V,re,ne),v++,a.next()}}if(v){let V=new Uint16Array(v*4),re=y[y.length-2];for(let ne=y.length-3,J=0;ne>=0;ne-=3)V[J++]=y[ne],V[J++]=y[ne+1]-re,V[J++]=y[ne+2]-re,V[J++]=J;b.push(new lr(V,y[2]-re,r)),A.push(re-G)}}function g(G,T){return(b,A,y)=>{let v=0,N=b.length-1,V,re;if(N>=0&&(V=b[N])instanceof Re){if(!N&&V.type==G&&V.length==y)return V;(re=V.prop(le.lookAhead))&&(v=A[N]+V.length+re)}return x(G,b,A,y,v,T)}}function m(G,T,b,A,y,v,N,V,re){let ne=[],J=[];for(;G.length>A;)ne.push(G.pop()),J.push(T.pop()+b-y);G.push(x(r.types[N],ne,J,v-y,V-v,re)),T.push(y-b)}function x(G,T,b,A,y,v,N){if(v){let V=[le.contextHash,v];N=N?[V].concat(N):[V]}if(y>25){let V=[le.lookAhead,y];N=N?[V].concat(N):[V]}return new Re(G,T,b,A,N)}function O(G,T){let b=a.fork(),A=0,y=0,v=0,N=b.end-n,V={size:0,start:0,skip:0};e:for(let re=b.pos-G;b.pos>re;){let ne=b.size;if(b.id==T&&ne>=0){V.size=A,V.start=y,V.skip=v,v+=4,A+=4,b.next();continue}let J=b.pos-ne;if(ne<0||J<re||b.start<N)break;let me=b.id>=o?4:0,z=b.start;for(b.next();b.pos>J;){if(b.size<0)if(b.size==-3||b.size==-4)me+=4;else break e;else b.id>=o&&(me+=4);b.next()}y=z,A+=ne,v+=me}return(T<0||A==G)&&(V.size=A,V.start=y,V.skip=v),V.size>4?V:void 0}function w(G,T,b){let{id:A,start:y,end:v,size:N}=a;if(a.next(),N>=0&&A<o){let V=b;if(N>4){let re=a.pos-(N-4);for(;a.pos>re;)b=w(G,T,b)}T[--b]=V,T[--b]=v-G,T[--b]=y-G,T[--b]=A}else N==-3?h=A:N==-4&&(u=A);return b}let B=[],F=[];for(;a.pos>0;)c(i.start||0,i.bufferStart||0,B,F,-1,0);let M=(e=i.length)!==null&&e!==void 0?e:B.length?F[0]+B[0].length:0;return new Re(l[i.topID],B.reverse(),F.reverse(),M)}var db=new WeakMap;function il(i,e){if(!i.isAnonymous||e instanceof lr||e.type!=i)return 1;let t=db.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=i||!(r instanceof Re)){t=1;break}t+=il(i,r)}db.set(e,t)}return t}function sf(i,e,t,r,n,s,o,a,l){let h=0;for(let m=r;m<n;m++)h+=il(i,e[m]);let u=Math.ceil(h*1.5/8),c=[],d=[];function g(m,x,O,w,B){for(let F=O;F<w;){let M=F,G=x[F],T=il(i,m[F]);for(F++;F<w;F++){let b=il(i,m[F]);if(T+b>=u)break;T+=b}if(F==M+1){if(T>u){let b=m[M];g(b.children,b.positions,0,b.children.length,x[M]+B);continue}c.push(m[M])}else{let b=x[F-1]+m[F-1].length-G;c.push(sf(i,m,x,M,F,G,b,null,l))}d.push(G+B-s)}}return g(e,t,r,n,0),(a||l)(c,d,o)}var Qr=class i{constructor(e,t,r,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,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=[],r=!1){let n=[new i(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,h=0;;a++){let u=a<t.length?t[a]:null,c=u?u.fromA:1e9;if(c-l>=r)for(;o&&o.from<c;){let d=o;if(l>=d.from||c<=d.to||h){let g=Math.max(d.from,l)-h,m=Math.min(d.to,c)-h;d=g>=m?null:new i(g,m,d.tree,d.offset+h,a>0,!!u)}if(d&&n.push(d),o.to>c)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,h=u.toA-u.toB}return n}},Dr=class{startParse(e,t,r){return typeof e=="string"&&(e=new rf(e)),r=r?r.length?r.map(n=>new Ds(n.from,n.to)):[new Ds(0,0)]:[new Ds(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let s=n.advance();if(s)return s}}},rf=class{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)}};var eV=new le({perNode:!0});var SE=0,oi=class i{constructor(e,t,r,n){this.name=e,this.set=t,this.base=r,this.modified=n,this.id=SE++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof i&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let n=new i(r,[],null,[]);if(n.set.push(n),t)for(let s of t.set)n.set.push(s);return n}static defineModifier(e){let t=new al(e);return r=>r.modified.indexOf(t)>-1?r:al.get(r.base||r,r.modified.concat(t).sort((n,s)=>n.id-s.id))}},TE=0,al=class i{constructor(e){this.name=e,this.instances=[],this.id=TE++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&IE(t,a.modified));if(r)return r;let n=[],s=new oi(e.name,n,e,t);for(let a of t)a.instances.push(s);let o=OE(t);for(let a of e.set)if(!a.modified.length)for(let l of o)n.push(i.get(a,l));return s}};function IE(i,e){return i.length==e.length&&i.every((t,r)=>t==e[r])}function OE(i){let e=[[]];for(let t=0;t<i.length;t++)for(let r=0,n=e.length;r<n;r++)e.push(e[r].concat(i[t]));return e.sort((t,r)=>r.length-t.length)}function fr(i){let e=Object.create(null);for(let t in i){let r=i[t];Array.isArray(r)||(r=[r]);for(let n of t.split(" "))if(n){let s=[],o=2,a=n;for(let c=0;;){if(a=="..."&&c>0&&c+3==n.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+n);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),c+=d[0].length,c==n.length)break;let g=n[c++];if(c==n.length&&g=="!"){o=0;break}if(g!="/")throw new RangeError("Invalid path: "+n);a=n.slice(c)}let l=s.length-1,h=s[l];if(!h)throw new RangeError("Invalid path: "+n);let u=new Yr(r,o,l>0?s.slice(0,l):null);e[h]=u.sort(e[h])}}return xb.add(e)}var xb=new le({combine(i,e){let t,r,n;for(;i||e;){if(!i||e&&i.depth>=e.depth?(n=e,e=e.next):(n=i,i=i.next),t&&t.mode==n.mode&&!n.context&&!t.context)continue;let s=new Yr(n.tags,n.mode,n.context);t?t.next=s:r=s,t=s}return r}}),Yr=class{constructor(e,t,r,n){this.tags=e,this.mode=t,this.context=r,this.next=n}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}};Yr.empty=new Yr([],2,null);function hf(i,e){let t=Object.create(null);for(let s of i)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:r,all:n=null}=e||{};return{style:s=>{let o=n;for(let a of s)for(let l of a.set){let h=t[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:r}}function AE(i,e){let t=null;for(let r of i){let n=r.style(e);n&&(t=t?t+" "+n:n)}return t}function yb(i,e,t,r=0,n=i.length){let s=new af(r,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),r,n,"",s.highlighters),s.flush(n)}var af=class{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,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,r,n,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(g=>!g.scope||g.scope(o)));let h=n,u=wE(e)||Yr.empty,c=AE(s,u.tags);if(c&&(h&&(h+=" "),h+=c,u.mode==1&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(t,a),h),u.opaque)return;let d=e.tree&&e.tree.prop(le.mounted);if(d&&d.overlay){let g=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(O=>!O.scope||O.scope(d.tree.type)),x=e.firstChild();for(let O=0,w=a;;O++){let B=O<d.overlay.length?d.overlay[O]:null,F=B?B.from+a:l,M=Math.max(t,w),G=Math.min(r,F);if(M<G&&x)for(;e.from<G&&(this.highlightRange(e,M,G,n,s),this.startSpan(Math.min(G,e.to),h),!(e.to>=F||!e.nextSibling())););if(!B||F>r)break;w=B.to+a,w>t&&(this.highlightRange(g.cursor(),Math.max(t,B.from+a),Math.min(r,w),"",m),this.startSpan(Math.min(r,w),h))}x&&e.parent()}else if(e.firstChild()){d&&(n="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,n,s),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}};function wE(i){let e=i.type.prop(xb);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}var L=oi.define,nl=L(),hr=L(),mb=L(hr),bb=L(hr),ur=L(),sl=L(ur),of=L(ur),wi=L(),Xr=L(wi),Oi=L(),Ai=L(),lf=L(),Js=L(lf),ol=L(),k={comment:nl,lineComment:L(nl),blockComment:L(nl),docComment:L(nl),name:hr,variableName:L(hr),typeName:mb,tagName:L(mb),propertyName:bb,attributeName:L(bb),className:L(hr),labelName:L(hr),namespace:L(hr),macroName:L(hr),literal:ur,string:sl,docString:L(sl),character:L(sl),attributeValue:L(sl),number:of,integer:L(of),float:L(of),bool:L(ur),regexp:L(ur),escape:L(ur),color:L(ur),url:L(ur),keyword:Oi,self:L(Oi),null:L(Oi),atom:L(Oi),unit:L(Oi),modifier:L(Oi),operatorKeyword:L(Oi),controlKeyword:L(Oi),definitionKeyword:L(Oi),moduleKeyword:L(Oi),operator:Ai,derefOperator:L(Ai),arithmeticOperator:L(Ai),logicOperator:L(Ai),bitwiseOperator:L(Ai),compareOperator:L(Ai),updateOperator:L(Ai),definitionOperator:L(Ai),typeOperator:L(Ai),controlOperator:L(Ai),punctuation:lf,separator:L(lf),bracket:Js,angleBracket:L(Js),squareBracket:L(Js),paren:L(Js),brace:L(Js),content:wi,heading:Xr,heading1:L(Xr),heading2:L(Xr),heading3:L(Xr),heading4:L(Xr),heading5:L(Xr),heading6:L(Xr),contentSeparator:L(wi),list:L(wi),quote:L(wi),emphasis:L(wi),strong:L(wi),link:L(wi),monospace:L(wi),strikethrough:L(wi),inserted:L(),deleted:L(),changed:L(),invalid:L(),meta:ol,documentMeta:L(ol),annotation:L(ol),processingInstruction:L(ol),definition:oi.defineModifier("definition"),constant:oi.defineModifier("constant"),function:oi.defineModifier("function"),standard:oi.defineModifier("standard"),local:oi.defineModifier("local"),special:oi.defineModifier("special")};for(let i in k){let e=k[i];e instanceof oi&&(e.name=i)}var Sb=hf([{tag:k.link,class:"tok-link"},{tag:k.heading,class:"tok-heading"},{tag:k.emphasis,class:"tok-emphasis"},{tag:k.strong,class:"tok-strong"},{tag:k.keyword,class:"tok-keyword"},{tag:k.atom,class:"tok-atom"},{tag:k.bool,class:"tok-bool"},{tag:k.url,class:"tok-url"},{tag:k.labelName,class:"tok-labelName"},{tag:k.inserted,class:"tok-inserted"},{tag:k.deleted,class:"tok-deleted"},{tag:k.literal,class:"tok-literal"},{tag:k.string,class:"tok-string"},{tag:k.number,class:"tok-number"},{tag:[k.regexp,k.escape,k.special(k.string)],class:"tok-string2"},{tag:k.variableName,class:"tok-variableName"},{tag:k.local(k.variableName),class:"tok-variableName tok-local"},{tag:k.definition(k.variableName),class:"tok-variableName tok-definition"},{tag:k.special(k.variableName),class:"tok-variableName2"},{tag:k.definition(k.propertyName),class:"tok-propertyName tok-definition"},{tag:k.typeName,class:"tok-typeName"},{tag:k.namespace,class:"tok-namespace"},{tag:k.className,class:"tok-className"},{tag:k.macroName,class:"tok-macroName"},{tag:k.propertyName,class:"tok-propertyName"},{tag:k.operator,class:"tok-operator"},{tag:k.comment,class:"tok-comment"},{tag:k.meta,class:"tok-meta"},{tag:k.invalid,class:"tok-invalid"},{tag:k.punctuation,class:"tok-punctuation"}]);var uf,jr=new le;function vb(i){return q.define({combine:i?e=>e.concat(i):void 0})}var RE=new le,At=class{constructor(e,t,r=[],n=""){this.data=e,this.name=n,Le.prototype.hasOwnProperty("tree")||Object.defineProperty(Le.prototype,"tree",{get(){return jt(this)}}),this.parser=t,this.extension=[dr.of(this),Le.languageData.of((s,o,a)=>{let l=Tb(s,o,a),h=l.type.prop(jr);if(!h)return[];let u=s.facet(h),c=l.type.prop(RE);if(c){let d=l.resolve(o-l.from,a);for(let g of c)if(g.test(d,s)){let m=s.facet(g.facet);return g.type=="replace"?m:m.concat(u)}}return u})].concat(r)}isActiveAt(e,t,r=-1){return Tb(e,t,r).type.prop(jr)==this.data}findRegions(e){let t=e.facet(dr);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(jr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(le.mounted);if(a){if(a.tree.prop(jr)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(n(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let h=s.children[l];h instanceof Re&&n(h,s.positions[l]+o)}};return n(jt(e),0),r}get allowsNesting(){return!0}};At.setState=Ze.define();function Tb(i,e,t){let r=i.facet(dr),n=jt(i).topNode;if(!r||r.allowsNesting)for(let s=n;s;s=s.enter(e,t,Ve.ExcludeBuffers|Ve.EnterBracketed))s.type.isTop&&(n=s);return n}var cr=class i extends At{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=vb(e.languageData);return new i(t,e.parser.configure({props:[jr.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new i(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function jt(i){let e=i.field(At.state,!1);return e?e.tree:Re.empty}var pf=class{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 r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}},Hs=null,$s=class i{constructor(e,t,r=[],n,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new i(e,t,[],Re.empty,0,r,[],null)}startParse(){return this.parser.startParse(new pf(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Re.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}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 n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(Qr.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=n,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(Qr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Hs;Hs=this;try{return e()}finally{Hs=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ib(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((h,u,c,d)=>l.push({fromA:h,toA:u,fromB:c,toB:d})),r=Qr.applyChanges(r,l),n=Re.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let h of this.skipped){let u=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);u<c&&a.push({from:u,to:c})}}}return new i(this.parser,t,r,n,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 r=0;r<this.skipped.length;r++){let{from:n,to:s}=this.skipped[r];n<e.to&&s>e.from&&(this.fragments=Ib(this.fragments,n,s),this.skipped.splice(r--,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 Dr{createParse(t,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let l=Hs;if(l){for(let h of n)l.tempSkipped.push(h);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Re(ot.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 Hs}};function Ib(i,e,t){return Qr.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}var qs=class i{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),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new i(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=$s.create(e.facet(dr).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new i(r)}};At.state=xi.define({create:qs.init,update(i,e){for(let t of e.effects)if(t.is(At.setState))return t.value;return e.startState.facet(dr)!=e.state.facet(dr)?qs.init(e.state):i.apply(e)}});var _b=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(_b=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var ff=typeof navigator<"u"&&(!((uf=navigator.scheduling)===null||uf===void 0)&&uf.isInputPending)?()=>navigator.scheduling.isInputPending():null,CE=ri.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(At.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(At.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=_b(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:r,viewport:{to:n}}=this.view,s=r.field(At.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!ff?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<n&&r.doc.length>n+1e3,l=s.context.work(()=>ff&&ff()||Date.now()>o,n+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:At.setState.of(new qs(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=>ei(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()}}}),dr=q.define({combine(i){return i.length?i[0]:null},enables:i=>[At.state,CE,ie.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]}),pr=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}};var EE=q.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function gf(i){let e=i.facet(EE);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}var eo=new le;function Of({except:i,units:e=1}={}){return t=>{let r=i&&i.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}var kE=q.define(),to=new le;function Bb(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function NE(i,e,t){let r=jt(i);if(r.length<t)return null;let n=r.resolveStack(t,1),s=null;for(let o=n;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(to);if(l&&(a.to<r.length-50||r.length==i.doc.length||!vE(a))){let h=l(a,i);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h)}}return s}function vE(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function Ob(i,e,t){for(let r of i.facet(kE)){let n=r(i,e,t);if(n)return n}return NE(i,e,t)}function Gb(i,e){let t=e.mapPos(i.from,1),r=e.mapPos(i.to,-1);return t>=r?void 0:{from:t,to:r}}var Fb=Ze.define({map:Gb}),Af=Ze.define({map:Gb});var hl=xi.define({create(){return Se.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,n)=>i=Ab(i,r,n)),i=i.map(e.changes);let t=[];for(let r of e.effects)r.is(Fb)&&!_E(i,r.value.from,r.value.to)?t.push(r.value):r.is(Af)&&(i=i.update({filter:(n,s)=>r.value.from!=n||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(t.length){let{preparePlaceholder:r}=e.state.facet(wf),n=t.map(s=>(r?Se.replace({widget:new bf(r(e.state,s))}):wb).range(s.from,s.to));i=i.update({add:n})}return e.selection&&(i=Ab(i,e.selection.main.head)),i},provide:i=>ie.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(r,n)=>{t.push(r,n)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let r=i[t++],n=i[t++];if(typeof r!="number"||typeof n!="number")throw new RangeError("Invalid JSON for fold state");e.push(wb.range(r,n))}return Se.set(e,!0)}});function Ab(i,e,t=e){let r=!1;return i.between(e,t,(n,s)=>{n<t&&s>e&&(r=!0)}),r?i.update({filterFrom:e,filterTo:t,filter:(n,s)=>n>=t||s<=e}):i}function mf(i,e,t){var r;let n=null;return(r=i.field(hl,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!n||n.from>s)&&(n={from:s,to:o})}),n}function _E(i,e,t){let r=!1;return i.between(e,e,(n,s)=>{n==e&&s==t&&(r=!0)}),r}var BE={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},wf=q.define({combine(i){return kn(i,BE)}});function GE(i){let e=[hl,UE];return i&&e.push(wf.of(i)),e}function Ub(i,e){let{state:t}=i,r=t.facet(wf),n=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),l=mf(i.state,a.from,a.to);l&&i.dispatch({effects:Af.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}var wb=Se.replace({widget:new class extends ii{toDOM(i){return Ub(i,null)}}}),bf=class extends ii{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ub(e,this.value)}},FE={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},zs=class extends si{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 Pb(i={}){let e={...FE,...i},t=new zs(e,!0),r=new zs(e,!1),n=ri.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(dr)!=o.state.facet(dr)||o.startState.field(hl,!1)!=o.state.field(hl,!1)||jt(o.startState)!=jt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new bi;for(let l of o.viewportLineBlocks){let h=mf(o.state,l.from,l.to)?r:Ob(o.state,l.from,l.to)?t:null;h&&a.add(l.from,l.from,h)}return a.finish()}}),{domEventHandlers:s}=e;return[n,lb({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(n))===null||a===void 0?void 0:a.markers)||Ae.empty},initialSpacer(){return new zs(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let h=mf(o.state,a.from,a.to);if(h)return o.dispatch({effects:Af.of(h)}),!0;let u=Ob(o.state,a.from,a.to);return u?(o.dispatch({effects:Fb.of(u)}),!0):!1}}}),GE()]}var UE=ie.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),ul=class i{constructor(e,t){this.specs=e;let r;function n(a){let l=Qt.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let s=typeof t.all=="string"?t.all:t.all?n(t.all):void 0,o=t.scope;this.scope=o instanceof At?a=>a.prop(jr)==o.data:o?a=>a==o:void 0,this.style=hf(e.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new Qt(r):null,this.themeType=t.themeType}static define(e,t){return new i(e,t||{})}},xf=q.define(),Wb=q.define({combine(i){return i.length?[i[0]]:null}});function cf(i){let e=i.facet(xf);return e.length?e:i.facet(Wb)}function Lb(i,e){let t=[PE],r;return i instanceof ul&&(i.module&&t.push(ie.styleModule.of(i.module)),r=i.themeType),e?.fallback?t.push(Wb.of(i)):r?t.push(xf.computeN([ie.darkTheme],n=>n.facet(ie.darkTheme)==(r=="dark")?[i]:[])):t.push(xf.of(i)),t}var yf=class{constructor(e){this.markCache=Object.create(null),this.tree=jt(e.state),this.decorations=this.buildDeco(e,cf(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=jt(e.state),r=cf(e.state),n=r!=cf(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!n&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Se.none;let r=new bi;for(let{from:n,to:s}of e.visibleRanges)yb(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=Se.mark({class:l})))},n,s);return r.finish()}},PE=Cs.high(ri.fromClass(yf,{decorations:i=>i.decorations})),uV=ul.define([{tag:k.meta,color:"#404740"},{tag:k.link,textDecoration:"underline"},{tag:k.heading,textDecoration:"underline",fontWeight:"bold"},{tag:k.emphasis,fontStyle:"italic"},{tag:k.strong,fontWeight:"bold"},{tag:k.strikethrough,textDecoration:"line-through"},{tag:k.keyword,color:"#708"},{tag:[k.atom,k.bool,k.url,k.contentSeparator,k.labelName],color:"#219"},{tag:[k.literal,k.inserted],color:"#164"},{tag:[k.string,k.deleted],color:"#a11"},{tag:[k.regexp,k.escape,k.special(k.string)],color:"#e40"},{tag:k.definition(k.variableName),color:"#00f"},{tag:k.local(k.variableName),color:"#30a"},{tag:[k.typeName,k.namespace],color:"#085"},{tag:k.className,color:"#167"},{tag:[k.special(k.variableName),k.macroName],color:"#256"},{tag:k.definition(k.propertyName),color:"#00c"},{tag:k.comment,color:"#940"},{tag:k.invalid,color:"#f00"}]),WE=ie.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Mb=1e4,Vb="()[]{}",Zb=q.define({combine(i){return kn(i,{afterCursor:!0,brackets:Vb,maxScanDistance:Mb,renderMatch:VE})}}),LE=Se.mark({class:"cm-matchingBracket"}),ME=Se.mark({class:"cm-nonmatchingBracket"});function VE(i){let e=[],t=i.matched?LE:ME;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}function Rb(i){let e=[],t=i.facet(Zb);for(let r of i.selection.ranges){if(!r.empty)continue;let n=ll(i,r.head,-1,t)||r.head>0&&ll(i,r.head-1,1,t)||t.afterCursor&&(ll(i,r.head,1,t)||r.head<i.doc.length&&ll(i,r.head+1,-1,t));n&&(e=e.concat(t.renderMatch(n,i)))}return Se.set(e,!0)}var ZE=ri.fromClass(class{constructor(i){this.paused=!1,this.decorations=Rb(i.state)}update(i){(i.docChanged||i.selectionSet||this.paused)&&(i.view.composing?(this.decorations=this.decorations.map(i.changes),this.paused=!0):(this.decorations=Rb(i.state),this.paused=!1))}},{decorations:i=>i.decorations}),QE=[ZE,WE];function Qb(i={}){return[Zb.of(i),QE]}var Rf=new le;function Sf(i,e,t){let r=i.prop(e<0?le.openedBy:le.closedBy);if(r)return r;if(i.name.length==1){let n=t.indexOf(i.name);if(n>-1&&n%2==(e<0?1:0))return[t[n+e]]}return null}function Tf(i){let e=i.type.prop(Rf);return e?e(i.node):i}function ll(i,e,t,r={}){let n=r.maxScanDistance||Mb,s=r.brackets||Vb,o=jt(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let h=Sf(l.type,t,s);if(h&&l.from<l.to){let u=Tf(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return DE(i,e,t,l,u,h,s)}}return XE(i,e,t,o,a.type,n,s)}function DE(i,e,t,r,n,s,o){let a=r.parent,l={from:n.from,to:n.to},h=0,u=a?.cursor();if(u&&(t<0?u.childBefore(r.from):u.childAfter(r.to)))do if(t<0?u.to<=r.from:u.from>=r.to){if(h==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let c=Tf(u);return{start:l,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(Sf(u.type,t,o))h++;else if(Sf(u.type,-t,o)){if(h==0){let c=Tf(u);return{start:l,end:c&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1}}h--}}while(t<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function XE(i,e,t,r,n,s,o){if(t<0?!e:e==i.doc.length)return null;let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},u=i.doc.iterRange(e,t>0?i.doc.length:0),c=0;for(let d=0;!u.next().done&&d<=s;){let g=u.value;t<0&&(d+=g.length);let m=e+d*t;for(let x=t>0?0:g.length-1,O=t>0?g.length:-1;x!=O;x+=t){let w=o.indexOf(g[x]);if(!(w<0||r.resolveInner(m+x,1).type!=n))if(w%2==0==t>0)c++;else{if(c==1)return{start:h,end:{from:m+x,to:m+x+1},matched:w>>1==l>>1};c--}}t>0&&(d+=g.length)}return u.done?{start:h,matched:!1}:null}function Cb(i,e,t,r=0,n=0){e==null&&(e=i.search(/[^\s\u00a0]/),e==-1&&(e=i.length));let s=n;for(let o=r;o<e;o++)i.charCodeAt(o)==9?s+=t-s%t:s++;return s}var fl=class{constructor(e,t,r,n){this.string=e,this.tabSize=t,this.indentUnit=r,this.overrideIndent=n,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),r;if(typeof e=="string"?r=t==e:r=t&&(e instanceof RegExp?e.test(t):e(t)),r)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=Cb(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:Cb(this.string,null,this.tabSize)}match(e,t,r){if(typeof e=="string"){let n=o=>r?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return n(s)==n(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}};function YE(i){return{name:i.name||"",token:i.token,blankLine:i.blankLine||(()=>{}),startState:i.startState||(()=>!0),copyState:i.copyState||jE,indent:i.indent||(()=>null),languageData:i.languageData||{},tokenTable:i.tokenTable||Ef,mergeTokens:i.mergeTokens!==!1}}function jE(i){if(typeof i!="object")return i;let e={};for(let t in i){let r=i[t];e[t]=r instanceof Array?r.slice():r}return e}var Eb=new WeakMap,cl=class i extends At{constructor(e){let t=vb(e.languageData),r=YE(e),n,s=new class extends Dr{createParse(o,a,l){return new If(n,o,a,l)}};super(t,s,[],e.name),this.topNode=$E(t,this),n=this,this.streamParser=r,this.stateAfter=new le({perNode:!0}),this.tokenTable=e.tokenTable?new dl(r.tokenTable):zE}static define(e){return new i(e)}getIndent(e){let t,{overrideIndentation:r}=e.options;r&&(t=Eb.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let n=Cf(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(n?(o=n.state,s=n.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let l=e.state.doc.lineAt(s),h=Math.min(e.pos,l.to);if(l.length){let u=r?r(l.from):-1,c=new fl(l.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;c.pos<h-l.from;)Xb(this.streamParser.token,c,o)}else this.streamParser.blankLine(o,e.unit);if(h==e.pos)break;s=l.to+1}let a=e.lineAt(e.pos);return r&&t==null&&Eb.set(e.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],e)}get allowsNesting(){return!1}};function Cf(i,e,t,r,n){let s=t>=r&&t+e.length<=n&&e.prop(i.stateAfter);if(s)return{state:i.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],h=a instanceof Re&&l<n&&Cf(i,a,l,r,n);if(h)return h}return null}function Db(i,e,t,r,n){if(n&&t<=0&&r>=e.length)return e;!n&&t==0&&e.type==i.topNode&&(n=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<r&&a instanceof Re){if(!(l=Db(i,a,t-o,r-o,n)))break;return n?new Re(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function JE(i,e,t,r,n){for(let s of e){let o=s.from+(s.openStart?25:0),a=s.to-(s.openEnd?25:0),l=o<=t&&a>t&&Cf(i,s.tree,0-s.offset,t,a),h;if(l&&l.pos<=r&&(h=Db(i,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:i.streamParser.startState(n?gf(n):4),tree:Re.empty}}var If=class{constructor(e,t,r,n){this.lang=e,this.input=t,this.fragments=r,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let s=$s.get(),o=n[0].from,{state:a,tree:l}=JE(e,r,o,this.to,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let h=0;h<l.children.length;h++)this.chunks.push(l.children[h]),this.chunkPos.push(l.positions[h]);s&&this.parsedPos<s.viewport.from-1e5&&n.some(h=>h.from<=s.viewport.from&&h.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(gf(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=$s.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(t,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)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==`
31
+ `&&(t="");else{let r=t.indexOf(`
32
+ `);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let n=this.rangeIndex;;){let s=this.ranges[n].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let n=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?n>s:n>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,n){let s=4;if(this.ranges.length>1){n=this.skipGapsTo(t,n,1),t+=n;let a=this.chunk.length;n=this.skipGapsTo(r,n,-1),r+=n,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),n}parseLine(e){let{line:t,end:r}=this.nextLine(),n=0,{streamParser:s}=this.lang,o=new fl(t,e?e.state.tabSize:4,e?gf(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=Xb(s.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Re.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:HE,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Re(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 Re(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Xb(i,e,t){e.start=e.pos;for(let r=0;r<10;r++){let n=i(e,t);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}var Ef=Object.create(null),Ks=[ot.none],HE=new Vn(Ks),kb=[],Nb=Object.create(null),Yb=Object.create(null);for(let[i,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"]])Yb[i]=jb(Ef,e);var dl=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Yb)}resolve(e){return e?this.table[e]||(this.table[e]=jb(this.extra,e)):0}},zE=new dl(Ef);function df(i,e){kb.indexOf(i)>-1||(kb.push(i),console.warn(e))}function jb(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let h of a.split(".")){let u=i[h]||k[h];u?typeof u=="function"?l.length?l=l.map(u):df(h,`Modifier ${h} used at start of tag`):l.length?df(h,`Tag ${h} used as modifier`):l=Array.isArray(u)?u:[u]:df(h,`Unknown highlighting tag ${h}`)}for(let h of l)t.push(h)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+t.map(a=>a.id),s=Nb[n];if(s)return s.id;let o=Nb[n]=ot.define({id:Ks.length,name:r,props:[fr({[r]:t})]});return Ks.push(o),o.id}function $E(i,e){let t=ot.define({id:Ks.length,name:"Document",props:[jr.add(()=>i),eo.add(()=>r=>e.getIndent(r))],top:!0});return Ks.push(t),t}var fV={rtl:Se.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:je.RTL}),ltr:Se.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:je.LTR}),auto:Se.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var vf=class i{constructor(e,t,r,n,s,o,a,l,h,u=0,c){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=h,this.lookAhead=u,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new i(e,[],t,r,r,0,[],0,n?new pl(n,n.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 r=e>>19,n=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(n);if(a&&(this.score+=a),r==0){n<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),h=l?this.stack[l-2]:this.p.ranges[0].from;n<s.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-h;u>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=u));let c=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-c;if(n<s.minRepeatTerm||e&131072){let g=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,g,d+4,!0)}if(e&262144)this.state=this.stack[l];else{let g=this.stack[l-3];this.state=s.getGoto(g,n,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(n,h)}storeNode(e,t,r,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==r)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(e,t,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4);else{let s=e,{parser:o}=this.p;this.pos=n;let a=o.stateFlag(s,1);!a&&(n>r||t<=o.maxNode)&&(this.reducePos=n),this.pushState(s,a?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,n,4)}}apply(e,t,r,n){e&65536?this.reduce(e):this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,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&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new _f(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if(!(r&65536))return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((a,l)=>l&1&&a==o)||n.push(t[s],o)}t=n}let r=[];for(let n=0;n<t.length&&r.length<4;n+=2){let s=t[n+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[n],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],n,!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=[],r=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&e.getGoto(this.stack[h],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let 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 pl(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},pl=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},_f=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}},Bf=class i{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new i(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 i(this.stack,this.pos,this.index)}};function io(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let r=0,n=0;r<i.length;){let s=0;for(;;){let o=i.charCodeAt(r++),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[n++]=s:t=new e(s)}return t}var Zn=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Jb=new Zn,Gf=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jb,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 r=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!n)return null;let o=this.ranges[--n];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=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,r,n;if(t>=0&&t<this.chunk.length)r=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}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=Jb,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 r="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return r}},gr=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;Kb(this.data,e,t,this.id,r.data,r.tokenPrecTable)}};gr.prototype.contextual=gr.prototype.fallback=gr.prototype.extend=!1;var Ff=class{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?io(e):e}token(e,t){let r=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Kb(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}};Ff.prototype.contextual=gr.prototype.fallback=gr.prototype.extend=!1;var ro=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function Kb(i,e,t,r,n,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;a&i[o];){let h=i[o+1];for(let g=o+3;g<h;g+=2)if((i[g+1]&a)>0){let m=i[g];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||KE(m,e.token.value,n,s))){e.acceptToken(m);break}}let u=e.next,c=0,d=i[o+2];if(e.next<0&&d>c&&i[h+d*3-3]==65535){o=i[h+d*3-1];continue e}for(;c<d;){let g=c+d>>1,m=h+g+(g<<1),x=i[m],O=i[m+1]||65536;if(u<x)d=g;else if(u>=O)c=g+1;else{o=i[m+2],e.advance();continue e}}break}}function Hb(i,e,t){for(let r=e,n;(n=i[r])!=65535;r++)if(n==t)return r-e;return-1}function KE(i,e,t,r){let n=Hb(t,r,e);return n<0||Hb(t,r,i)<n}var Ft=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),kf=null;function zb(i,e,t){let r=i.cursor(Ve.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(i.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:i.length}}var Uf=class{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?zb(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?zb(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 r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[n],o=this.start[t]+r.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof Re){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(le.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}},Pf=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Zn)}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let h=0;h<s.length;h++){if(!(1<<h&o))continue;let u=s[h],c=this.tokens[h];if(!(r&&!u.fallback)&&((u.contextual||c.start!=e.pos||c.mask!=o||c.context!=a)&&(this.updateCachedToken(c,u,e),c.mask=o,c.context=a),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),c.value!=0)){let d=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!u.extend&&(r=c,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Zn,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Zn,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:s}=r.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),r);if(a>=0&&r.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(n+1)}putAction(e,t,r,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(s,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=Vi(a,h+2);else{n==0&&a[h+1]==2&&(n=this.putAction(Vi(a,h+2),t,r,n));break}a[h]==t&&(n=this.putAction(Vi(a,h+1),t,r,n))}return n}},Wf=class{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,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 Gf(t,n),this.tokens=new Pf(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[vf.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new Uf(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],n,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)r.push(a);else{if(this.advanceStack(a,r,e))continue;{n||(n=[],s=[]),n.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=n&&ek(n);if(o)return Ft&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ft&&n&&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&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Ft&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let h=r[l];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[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,r){let n=e.pos,{parser:s}=this,o=Ft?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,u=h?e.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let d=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(d>-1&&c.length&&(!h||(c.prop(le.contextHash)||0)==u))return e.useNode(c,d),Ft&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof Re)||c.children.length==0||c.positions[0]>0)break;let g=c.children[0];if(g instanceof Re&&c.positions[0]==0)c=g;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ft&&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 h=0;h<l.length;){let u=l[h++],c=l[h++],d=l[h++],g=h==l.length||!r,m=g?e:e.split(),x=this.tokens.mainToken;if(m.apply(u,c,x?x.start:m.pos,d),Ft&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(c)} @ ${n}${m==e?"":", split"})`),g)return!0;m.pos>n?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return $b(e,t),!0}}runRecovery(e,t,r){let n=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],h=t[(o<<1)+1],u=Ft?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Ft&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let c=a.split(),d=u;for(let g=0;g<10&&c.forceReduce()&&(Ft&&console.log(d+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,r));g++)Ft&&(d=this.stackID(c)+" -> ");for(let g of a.recoverByInsert(l))Ft&&console.log(u+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,r);this.stream.end>a.pos?(h==a.pos&&(h++,l=0),a.recoverByDelete(l,h),Ft&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),$b(a,r)):(!n||n.score<c.score)&&(n=c)}return n}stackToTree(e){return e.close(),Re.build({buffer:Bf.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=(kf||(kf=new WeakMap)).get(e);return t||kf.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function $b(i,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==i.pos&&r.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}var Lf=class{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}},Nf=i=>i,gl=class{constructor(e){this.start=e.start,this.shift=e.shift||Nf,this.reduce=e.reduce||Nf,this.reuse=e.reuse||Nf,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},mr=class i extends Dr{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 r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),n=[];for(let a=0;a<t.length;a++)n.push([]);function s(a,l,h){n[a].push([l,l.deserialize(String(h))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=le[l]);for(let h=1;h<a.length;){let u=a[h++];if(u>=0)s(u,l,a[h++]);else{let c=a[h+-u];for(let d=-u;d>0;d--)s(a[h++],l,c);h++}}}this.nodeSet=new Vn(t.map((a,l)=>ot.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:r.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=1024;let o=io(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(qb),this.states=io(e.states,Uint32Array),this.data=io(e.stateData),this.goto=io(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new gr(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,r){let n=new Wf(this,e,t,r);for(let s of this.wrappers)n=s(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],a=o&1,l=n[s++];if(a&&r)return l;for(let h=s+(o>>1);s<h;s++)if(n[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Vi(r,s+2)];else{if(r[s+1]==2)return Vi(r,s+2);break}if(o==t||o==0)return Vi(r,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,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Vi(this.data,s+2);else break;n=t(Vi(this.data,s+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Vi(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[r],n)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let n=e.tokenizers.find(s=>s.from==r);return n?n.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[n]=qb(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),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new Lf(e,r,n)}static deserialize(e){return new i(e)}};function Vi(i,e){return i[e]|i[e+1]<<16}function ek(i){let e=null;for(let t of i){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function qb(i){if(i.external){let e=i.extend?1:0;return(t,r)=>i.external(t,r)<<1|e}return i.get}var tk=fr({String:k.string,Number:k.number,"True False":k.bool,PropertyName:k.propertyName,Null:k.null,", :":k.separator,"[ ]":k.squareBracket,"{ }":k.brace}),ex=mr.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[tk],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});var ik=cr.define({name:"json",parser:ex.configure({props:[eo.add({Object:Of({except:/^\s*\}/}),Array:Of({except:/^\s*\]/})}),to.add({"Object Array":Bb})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Mf(){return new pr(ik)}var Vf=1,rk=2,nk=3,sk=4,ok=5,ak=36,lk=37,hk=38,uk=11,fk=13;function ck(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}function dk(i){return i==9||i==10||i==13||i==32}var tx=null,ix=null,rx=0;function Zf(i,e){let t=i.pos+e;if(ix==i&&rx==t)return tx;for(;dk(i.peek(e));)e++;let r="";for(;;){let n=i.peek(e);if(!ck(n))break;r+=String.fromCharCode(n),e++}return ix=i,rx=t,tx=r||null}function nx(i,e){this.name=i,this.parent=e}var pk=new gl({start:null,shift(i,e,t,r){return e==Vf?new nx(Zf(r,1)||"",i):i},reduce(i,e){return e==uk&&i?i.parent:i},reuse(i,e,t,r){let n=e.type.id;return n==Vf||n==fk?new nx(Zf(r,1)||"",i):i},strict:!1}),gk=new ro((i,e)=>{if(i.next==60){if(i.advance(),i.next==47){i.advance();let t=Zf(i,0);if(!t)return i.acceptToken(ok);if(e.context&&t==e.context.name)return i.acceptToken(rk);for(let r=e.context;r;r=r.parent)if(r.name==t)return i.acceptToken(nk,-2);i.acceptToken(sk)}else if(i.next!=33&&i.next!=63)return i.acceptToken(Vf)}},{contextual:!0});function Qf(i,e){return new ro(t=>{let r=0,n=e.charCodeAt(0);e:for(;!(t.next<0);t.advance(),r++)if(t.next==n){for(let s=1;s<e.length;s++)if(t.peek(s)!=e.charCodeAt(s))continue e;break}r&&t.acceptToken(i)})}var mk=Qf(ak,"-->"),bk=Qf(lk,"?>"),xk=Qf(hk,"]]>"),yk=fr({Text:k.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":k.angleBracket,TagName:k.tagName,"MismatchedCloseTag/TagName":[k.tagName,k.invalid],AttributeName:k.attributeName,AttributeValue:k.attributeValue,Is:k.definitionOperator,"EntityReference CharacterReference":k.character,Comment:k.blockComment,ProcessingInst:k.processingInstruction,DoctypeDecl:k.documentMeta,Cdata:k.special(k.string)}),sx=mr.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"\u26A0 StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:pk,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[yk],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%gP&YTVPOv&Tw!^&T!_;'S&T;'S;=`&i<%lO&TP&lP;=`<%l&T`&tS!O`Ov&ox;'S&o;'S;=`'Q<%lO&o`'TP;=`<%l&oa'ZP;=`<%l%gX'eWVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^W(ST|WOr'}sv'}w;'S'};'S;=`(c<%lO'}W(fP;=`<%l'}X(lP;=`<%l'^h(vV|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oh)`P;=`<%l(oi)fP;=`<%l$qo)t`VP|W!O`zUOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk+PV{YVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%g~+iast,n![!]-r!c!}-r#R#S-r#T#o-r%W%o-r%p&a-r&b1p-r4U4d-r4e$IS-r$I`$Ib-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~,qQ!Q![,w#l#m-V~,zQ!Q![,w!]!^-Q~-VOX~~-YR!Q![-c!c!i-c#T#Z-c~-fS!Q![-c!]!^-Q!c!i-c#T#Z-c~-ug}!O-r!O!P-r!Q![-r![!]-r!]!^/^!c!}-r#R#S-r#T#o-r$}%O-r%W%o-r%p&a-r&b1p-r1p4U-r4U4d-r4e$IS-r$I`$Ib-r$Je$Jg-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~/cOW~~/fP;=`<%l-rk/rW}bVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^k0eZVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O1W!O!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk1aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a2S!a;'S$q;'S;=`)c<%lO$qk2_X!PQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qm3TZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a3v!a;'S$q;'S;=`)c<%lO$qm4RXdSVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo4{!P`S^QVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O4n!O!P4n!P!Q$q!Q![4n![!]4n!]!^$q!^!_(o!_!c$q!c!}4n!}#R$q#R#S4n#S#T$q#T#o4n#o$}$q$}%O4n%O%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U4n4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Je$q$Je$Jg4n$Jg$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qo8RP;=`<%l4ni8]Y|W!O`Oq(oqr8{rs&osv(owx'}x!a(o!a!b!#U!b;'S(o;'S;=`)]<%lO(oi9S_|W!O`Or(ors&osv(owx'}x}(o}!O:R!O!f(o!f!g;e!g!}(o!}#ODh#O#W(o#W#XLp#X;'S(o;'S;=`)]<%lO(oi:YX|W!O`Or(ors&osv(owx'}x}(o}!O:u!O;'S(o;'S;=`)]<%lO(oi;OV!QP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oi;lX|W!O`Or(ors&osv(owx'}x!q(o!q!r<X!r;'S(o;'S;=`)]<%lO(oi<`X|W!O`Or(ors&osv(owx'}x!e(o!e!f<{!f;'S(o;'S;=`)]<%lO(oi=SX|W!O`Or(ors&osv(owx'}x!v(o!v!w=o!w;'S(o;'S;=`)]<%lO(oi=vX|W!O`Or(ors&osv(owx'}x!{(o!{!|>c!|;'S(o;'S;=`)]<%lO(oi>jX|W!O`Or(ors&osv(owx'}x!r(o!r!s?V!s;'S(o;'S;=`)]<%lO(oi?^X|W!O`Or(ors&osv(owx'}x!g(o!g!h?y!h;'S(o;'S;=`)]<%lO(oi@QY|W!O`Or?yrs@psv?yvwA[wxBdx!`?y!`!aCr!a;'S?y;'S;=`Db<%lO?ya@uV!O`Ov@pvxA[x!`@p!`!aAy!a;'S@p;'S;=`B^<%lO@pPA_TO!`A[!`!aAn!a;'SA[;'S;=`As<%lOA[PAsOiPPAvP;=`<%lA[aBQSiP!O`Ov&ox;'S&o;'S;=`'Q<%lO&oaBaP;=`<%l@pXBiX|WOrBdrsA[svBdvwA[w!`Bd!`!aCU!a;'SBd;'S;=`Cl<%lOBdXC]TiP|WOr'}sv'}w;'S'};'S;=`(c<%lO'}XCoP;=`<%lBdiC{ViP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiDeP;=`<%l?yiDoZ|W!O`Or(ors&osv(owx'}x!e(o!e!fEb!f#V(o#V#WIr#W;'S(o;'S;=`)]<%lO(oiEiX|W!O`Or(ors&osv(owx'}x!f(o!f!gFU!g;'S(o;'S;=`)]<%lO(oiF]X|W!O`Or(ors&osv(owx'}x!c(o!c!dFx!d;'S(o;'S;=`)]<%lO(oiGPX|W!O`Or(ors&osv(owx'}x!v(o!v!wGl!w;'S(o;'S;=`)]<%lO(oiGsX|W!O`Or(ors&osv(owx'}x!c(o!c!dH`!d;'S(o;'S;=`)]<%lO(oiHgX|W!O`Or(ors&osv(owx'}x!}(o!}#OIS#O;'S(o;'S;=`)]<%lO(oiI]V|W!O`yPOr(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiIyX|W!O`Or(ors&osv(owx'}x#W(o#W#XJf#X;'S(o;'S;=`)]<%lO(oiJmX|W!O`Or(ors&osv(owx'}x#T(o#T#UKY#U;'S(o;'S;=`)]<%lO(oiKaX|W!O`Or(ors&osv(owx'}x#h(o#h#iK|#i;'S(o;'S;=`)]<%lO(oiLTX|W!O`Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[gk,mk,bk,xk,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function ml(i,e){let t=e&&e.getChild("TagName");return t?i.sliceString(t.from,t.to):""}function Df(i,e){let t=e&&e.firstChild;return!t||t.name!="OpenTag"?"":ml(i,t)}function Sk(i,e,t){let r=e&&e.getChildren("Attribute").find(s=>s.from<=t&&s.to>=t),n=r&&r.getChild("AttributeName");return n?i.sliceString(n.from,n.to):""}function Xf(i){for(let e=i&&i.parent;e;e=e.parent)if(e.name=="Element")return e;return null}function Tk(i,e){var t;let r=jt(i).resolveInner(e,-1),n=null;for(let s=r;!n&&s.parent;s=s.parent)(s.name=="OpenTag"||s.name=="CloseTag"||s.name=="SelfClosingTag"||s.name=="MismatchedCloseTag")&&(n=s);if(n&&(n.to>e||n.lastChild.type.isError)){let s=n.parent;if(r.name=="TagName")return n.name=="CloseTag"||n.name=="MismatchedCloseTag"?{type:"closeTag",from:r.from,context:s}:{type:"openTag",from:r.from,context:Xf(s)};if(r.name=="AttributeName")return{type:"attrName",from:r.from,context:n};if(r.name=="AttributeValue")return{type:"attrValue",from:r.from,context:n};let o=r==n||r.name=="Attribute"?r.childBefore(e):r;return o?.name=="StartTag"?{type:"openTag",from:e,context:Xf(s)}:o?.name=="StartCloseTag"&&o.to<=e?{type:"closeTag",from:e,context:s}:o?.name=="Is"?{type:"attrValue",from:e,context:n}:o?{type:"attrName",from:e,context:n}:null}else if(r.name=="StartCloseTag")return{type:"closeTag",from:e,context:r.parent};for(;r.parent&&r.to==e&&!(!((t=r.lastChild)===null||t===void 0)&&t.type.isError);)r=r.parent;return r.name=="Element"||r.name=="Text"||r.name=="Document"?{type:"tag",from:e,context:r.name=="Element"?r:Xf(r)}:null}var jf=class{constructor(e,t,r){this.attrs=t,this.attrValues=r,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:"type"},e.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=e.textContent?e.textContent.map(n=>({label:n,type:"text"})):[]}},Yf=/^[:\-\.\w\u00b7-\uffff]*$/;function ox(i){return Object.assign(Object.assign({type:"property"},i.completion||{}),{label:i.name})}function ax(i){return typeof i=="string"?{label:`"${i}"`,type:"constant"}:/^"/.test(i.label)?i:Object.assign(Object.assign({},i),{label:`"${i.label}"`})}function Ik(i,e){let t=[],r=[],n=Object.create(null);for(let l of e){let h=ox(l);t.push(h),l.global&&r.push(h),l.values&&(n[l.name]=l.values.map(ax))}let s=[],o=[],a=Object.create(null);for(let l of i){let h=r,u=n;l.attributes&&(h=h.concat(l.attributes.map(d=>typeof d=="string"?t.find(g=>g.label==d)||{label:d,type:"property"}:(d.values&&(u==n&&(u=Object.create(u)),u[d.name]=d.values.map(ax)),ox(d)))));let c=new jf(l,h,u);a[c.name]=c,s.push(c),l.top&&o.push(c)}o.length||(o=s);for(let l=0;l<s.length;l++){let h=i[l],u=s[l];if(h.children)for(let c of h.children)a[c]&&u.children.push(a[c]);else u.children=s}return l=>{var h;let{doc:u}=l.state,c=Tk(l.state,l.pos);if(!c||c.type=="tag"&&!l.explicit)return null;let{type:d,from:g,context:m}=c;if(d=="openTag"){let x=o,O=Df(u,m);if(O){let w=a[O];x=w?.children||s}return{from:g,options:x.map(w=>w.completion),validFor:Yf}}else if(d=="closeTag"){let x=Df(u,m);return x?{from:g,to:l.pos+(u.sliceString(l.pos,l.pos+1)==">"?1:0),options:[((h=a[x])===null||h===void 0?void 0:h.closeNameCompletion)||{label:x+">",type:"type"}],validFor:Yf}:null}else if(d=="attrName"){let x=a[ml(u,m)];return{from:g,options:x?.attrs||r,validFor:Yf}}else if(d=="attrValue"){let x=Sk(u,m,g);if(!x)return null;let O=a[ml(u,m)],w=(O?.attrValues||n)[x];return!w||!w.length?null:{from:g,to:l.pos+(u.sliceString(l.pos,l.pos+1)=='"'?1:0),options:w,validFor:/^"[^"]*"?$/}}else if(d=="tag"){let x=Df(u,m),O=a[x],w=[],B=m&&m.lastChild;x&&(!B||B.name!="CloseTag"||ml(u,B)!=x)&&w.push(O?O.closeCompletion:{label:"</"+x+">",type:"type",boost:2});let F=w.concat((O?.children||(m?s:o)).map(M=>M.openCompletion));if(m&&O?.text.length){let M=m.firstChild;M.to>l.pos-20&&!/\S/.test(l.state.sliceDoc(M.to,l.pos))&&(F=F.concat(O.text))}return{from:g,options:F,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}var Jf=cr.define({name:"xml",parser:sx.configure({props:[eo.add({Element(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),to.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),Rf.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function Hf(i={}){let e=[Jf.data.of({autocomplete:Ik(i.elements||[],i.attributes||[])})];return i.autoCloseTags!==!1&&e.push(Ok),new pr(Jf,e)}function lx(i,e,t=i.length){if(!e)return"";let r=e.firstChild,n=r&&r.getChild("TagName");return n?i.sliceString(n.from,Math.min(n.to,t)):""}var Ok=ie.inputHandler.of((i,e,t,r,n)=>{if(i.composing||i.state.readOnly||e!=t||r!=">"&&r!="/"||!Jf.isActiveAt(i.state,e,-1))return!1;let s=n(),{state:o}=s,a=o.changeByRange(l=>{var h,u,c;let{head:d}=l,g=o.doc.sliceString(d-1,d)==r,m=jt(o).resolveInner(d,-1),x;if(g&&r==">"&&m.name=="EndTag"){let O=m.parent;if(((u=(h=O.parent)===null||h===void 0?void 0:h.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(x=lx(o.doc,O.parent,d))){let w=d+(o.doc.sliceString(d,d+1)===">"?1:0),B=`</${x}>`;return{range:l,changes:{from:d,to:w,insert:B}}}}else if(g&&r=="/"&&m.name=="StartCloseTag"){let O=m.parent;if(m.from==d-2&&((c=O.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(x=lx(o.doc,O,d))){let w=d+(o.doc.sliceString(d,d+1)===">"?1:0),B=`${x}>`;return{range:ee.cursor(d+B.length,-1),changes:{from:d,to:w,insert:B}}}}return{range:l}});return a.changes.empty?!1:(i.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Ak=mr.deserialize({version:14,states:")rQYQPOOOzQPO'#CbO!PQPO'#CfO!UQPO'#ChO!ZQPO'#CjOOQO'#C`'#C`OOQO'#Co'#CoOOQO'#Cn'#CnOOQO'#Cq'#CqO#dQPO'#CtOOQO'#Cm'#CmO#kQPO'#ClOOQO'#C_'#C_O#|QQO'#C_OOQO'#D_'#D_QYQPOOO$RQPO,58|O$WQQO,59QO$]QPO,59SOOQO,59U,59UO$bQPO'#CxOOQO'#DR'#DRO%RQSO'#DQOOQO'#DY'#DYOOQO'#D^'#D^OOQO'#DP'#DPOOQO'#Cu'#CuOOQO'#D`'#D`O&RQPO,59`OOQO,59`,59`OOQO'#C{'#C{OOQO'#Cz'#CzO!`QPO'#CyO&YQQO,59WOOQO,58y,58yOOQO-E7]-E7]O&kQQO1G.hOOQO1G.l1G.lOOQO1G.n1G.nO&pQPO,59dOOQO,59l,59lO&uQPO,59lOOQO-E7^-E7^OOQO1G.z1G.zO'QQQO'#C|O'iQQO,59eO'}QQO'#DQOOQO1G.r1G.rOOQO7+$S7+$SO(bQPO'#C|O(mQPO,59eOOQO1G/O1G/OOOQO1G/W1G/WO!`QPO'#DaO(uQQO,59hO$bQPO'#DbO)^QQO1G/PO)rQPO,59hO)}QPO1G/POOQO,59{,59{OOQO-E7_-E7_O!`QPO,59|OOQO-E7`-E7`OOQO1G/h1G/hO!`QPO'#CyO!`QPO,59|O$bQPO'#Db",stateData:"*f~O!XOSPOS~OVPOWUOXVOZQO]RO_SOdUOfWOgWO!ZXO~OW`O~OXaO~OWbO~OXcO~OWUOXVOdUOfWOgWOkdOveOweOxeOyeO}gO!OgO!PgO!ZXO!]hO!^hO~O!YmO~P!`OWUOXVOdUOkdO![oO~OTrO~OXtO~OTuO~OXvO~OWUOXVOdUO![oO~OzxO{yOWtXXtXdtX~OftXgtXktXvtXwtXxtXytX}tX!OtX!PtX!YtX!ZtX!]tX!^tX~P$pO!Y{O~P!`OWUOXVOdUO![oOT`a~OT!QO~Oj!TO~OWUOXVOdUO~Oq!VOTpXWpXXpXdpXrpX![pX~Or!XOTmaWmaXmadma![ma~OTtXqtXrtX![tXjtX~P$pOq!VOjpXrpX~Or!dOjma~Oq!VOTpaWpaXpadparpa![pa~Or!XOTmiWmiXmidmi![mi~Oq!VOjparpa~Or!dOjmi~OdW_]!^!]yv![!P!O}!Xy~",goto:"&_!VPPP!W![P!`PPP!`P!`P!`P!d!h!l#TP#fPP#f#sPP$S$`$i$v$}PP#j%X%bPPPPPP%XPPP%X%m%s%y&TT^O_T[O_TTO_T]O_TZO_SYO_^jXlp!V!_!b!cYnZdq!X!dR!UyoVOXZ_dlpqy!V!X!_!b!c!dSYO__jXlp!V!_!b!cSkXlS|p!_S!R!b!cR!]!V^jXlp!V!_!b!cRqZQqZQwdR!PqSpZqQ!_!XQ!bdR!c!dZoZdq!X!dQ}pQ!S!bT!a!_!c_iXlp!V!_!b!cSfXlZ!Op!V!_!b!cQ_ORs_QlXRzlQ!W|Q!Z!RT!^!W!ZQ!Y}Q![!ST!`!Y![",nodeNames:"\u26A0 Comment TurtleDoc Statement Directive . PrefixID @prefix Pname_ns Iriref Base @base SparqlPrefix PREFIX SparqlBase BASE Triples Subject Iri PrefixedName Pname_ln BlankNode Blank_node_label Anon Collection Object ] [ BlankNodePropertyList PredicateObjectList Verb Predicate ObjectList , ; Literal RdfLiteral String String_literal_quote String_literal_single_quote String_literal_long_single_quote String_literal_long_quote Langtag ^^ NumericLiteral Integer Decimal Double BooleanLiteral",maxTerm:60,nodeProps:[["openedBy",26,"["],["closedBy",27,"]"]],skippedNodes:[0,1],repeatNodeCount:4,tokenData:"#C|~R!UX^$epq$ers%YstD`wxF[xy!7byz!7g{|!7l|}!9d}!O!7l!O!P!9i!Q![!8u![!]!9q!]!^!@b!^!_!@g!b!c!Ah!c!d!GP!d!e!JS!e!r!GP!r!s#!e!s!}!GP!}#O#,V#P#Q#-S#Q#R#-X#R#S#-d#T#U#1q#U#Y!GP#Y#Z#3[#Z#h!GP#h#i#;[#i#o!GP#y#z$e$f$g$e%W%o!GP%p&a!GP&b1p!GP4U4d!GP4e#BY!GP#BY#BZ#Ap#BZ$IS!GP$IS$I_$e$I`$Ib!GP$I|$JO$e$JT$JU$e$KV$KW$e$Kh%#t!GP&/x&Et!GP&FU&FV$e&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~$jY!X~X^$epq$e#y#z$e$f$g$e#BY#BZ$e$IS$I_$e$I|$JO$e$JT$JU$e$KV$KW$e&FU&FV$e~%]]OY&UZ]&U^r&Urs4^s!w&U!w!x'V!x#O&U#O#P1k#P#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~&X]OY&UZ]&U^r&Urs'Qs!w&U!w!x'V!x#O&U#O#P1k#P#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~'VOv~~'YcOY&UZ]&U^r&Urs'Qs!Q&U!Q![(e![!c&U!c!i(e!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z(e#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~(hcOY&UZ]&U^r&Urs'Qs!Q&U!Q![)s![!c&U!c!i)s!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z)s#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~)vcOY&UZ]&U^r&Urs'Qs!Q&U!Q![+R![!c&U!c!i+R!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z+R#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~+UcOY&UZ]&U^r&Urs'Qs!Q&U!Q![,a![!c&U!c!i,a!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z,a#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~,dcOY&UZ]&U^r&Urs'Qs!Q&U!Q![-o![!c&U!c!i-o!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z-o#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~-rcOY&UZ]&U^r&Urs'Qs!Q&U!Q![.}![!c&U!c!i.}!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z.}#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~/QcOY&UZ]&U^r&Urs'Qs!Q&U!Q![0]![!c&U!c!i0]!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z0]#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~0`cOY&UZ]&U^r&Urs'Qs!Q&U!Q![&U![!c&U!c!i&U!i!w&U!w!x'V!x#O&U#O#P1k#P#T&U#T#Z&U#Z#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~1nhOY&UZ]&U^r&Urs3Ysw&Uwx&Ux!w&U!w!x'V!x#O&U#O#P1k#P#U&U#U#V&U#V#Y&U#Y#Z&U#Z#b&U#b#c&U#c#f&U#f#g&U#g#h&U#h#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~3_]v~OY&UZ]&U^r&Urs'Qs!w&U!w!x'V!x#O&U#O#P1k#P#i&U#i#j,a#j;'S&U;'S;=`4W<%lO&U~4ZP;=`<%l&U~4cPv~rs4f~4iZOr4frs5[s!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~5_ZOr4frs6Qs!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~6TZOr4frs6vs!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~6{Oy~~7OaOr4frs5[s!Q4f!Q![8T![!c4f!c!i8T!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z8T#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~8WaOr4frs5[s!Q4f!Q![9]![!c4f!c!i9]!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z9]#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~9`aOr4frs5[s!Q4f!Q![:e![!c4f!c!i:e!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z:e#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~:haOr4frs5[s!Q4f!Q![;m![!c4f!c!i;m!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z;m#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~;paOr4frs5[s!Q4f!Q![<u![!c4f!c!i<u!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z<u#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~<xaOr4frs5[s!Q4f!Q![=}![!c4f!c!i=}!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z=}#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~>QaOr4frs5[s!Q4f!Q![?V![!c4f!c!i?V!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z?V#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~?YaOr4frs5[s!Q4f!Q![4f![!c4f!c!i4f!i!w4f!w!x6{!x#O4f#O#P@_#P#T4f#T#Z4f#Z#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~@bfOr4frsAvsw4fwx4fx!w4f!w!x6{!x#O4f#O#P@_#P#U4f#U#V4f#V#Y4f#Y#Z4f#Z#b4f#b#c4f#c#f4f#f#g4f#g#h4f#h#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~AyZOr4frsBls!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~BoZOr4frsCbs!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~CgZy~Or4frs6vs!w4f!w!x6{!x#O4f#O#P@_#P#i4f#i#j;m#j;'S4f;'S;=`DY<%lO4f~D]P;=`<%l4f~DeVP~OYD`YZDzZsD`stD`t;'SD`;'S;=`FU<%lOD`~EPPP~stES~EVVOYElYZDzZsElstESt;'SEl;'S;=`FO<%lOEl~EoTOYElYZDzZ;'SEl;'S;=`FO<%lOEl~FRP;=`<%lEl~FXP;=`<%lD`~F_]OYGWZ]GW^wGWwx!'`x!wGW!w!xHX!x#OGW#O#P!$m#P#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~GZ]OYGWZ]GW^wGWwxHSx!wGW!w!xHX!x#OGW#O#P!$m#P#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~HXOw~~H[cOYGWZ]GW^wGWwxHSx!QGW!Q![Ig![!cGW!c!iIg!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZIg#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~IjcOYGWZ]GW^wGWwxHSx!QGW!Q![Ju![!cGW!c!iJu!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZJu#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~JxcOYGWZ]GW^wGWwxHSx!QGW!Q![LT![!cGW!c!iLT!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZLT#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~LWcOYGWZ]GW^wGWwxHSx!QGW!Q![Mc![!cGW!c!iMc!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZMc#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~MfcOYGWZ]GW^wGWwxHSx!QGW!Q![Nq![!cGW!c!iNq!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZNq#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~NtcOYGWZ]GW^wGWwxHSx!QGW!Q![!!P![!cGW!c!i!!P!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#Z!!P#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~!!ScOYGWZ]GW^wGWwxHSx!QGW!Q![!#_![!cGW!c!i!#_!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#Z!#_#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~!#bcOYGWZ]GW^wGWwxHSx!QGW!Q![GW![!cGW!c!iGW!i!wGW!w!xHX!x#OGW#O#P!$m#P#TGW#T#ZGW#Z#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~!$phOYGWZ]GW^rGWrsGWswGWwx!&[x!wGW!w!xHX!x#OGW#O#P!$m#P#UGW#U#VGW#V#YGW#Y#ZGW#Z#bGW#b#cGW#c#fGW#f#gGW#g#hGW#h#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~!&a]w~OYGWZ]GW^wGWwxHSx!wGW!w!xHX!x#OGW#O#P!$m#P#iGW#i#jMc#j;'SGW;'S;=`!'Y<%lOGW~!']P;=`<%lGW~!'ePw~wx!'h~!'kZOw!'hwx!(^x!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!(aZOw!'hwx!)Sx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!)VZOw!'hwx!)xx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!)}Ox~~!*QaOw!'hwx!(^x!Q!'h!Q![!+V![!c!'h!c!i!+V!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!+V#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!+YaOw!'hwx!(^x!Q!'h!Q![!,_![!c!'h!c!i!,_!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!,_#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!,baOw!'hwx!(^x!Q!'h!Q![!-g![!c!'h!c!i!-g!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!-g#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!-jaOw!'hwx!(^x!Q!'h!Q![!.o![!c!'h!c!i!.o!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!.o#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!.raOw!'hwx!(^x!Q!'h!Q![!/w![!c!'h!c!i!/w!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!/w#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!/zaOw!'hwx!(^x!Q!'h!Q![!1P![!c!'h!c!i!1P!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!1P#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!1SaOw!'hwx!(^x!Q!'h!Q![!2X![!c!'h!c!i!2X!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!2X#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!2[aOw!'hwx!(^x!Q!'h!Q![!'h![!c!'h!c!i!'h!i!w!'h!w!x!)}!x#O!'h#O#P!3a#P#T!'h#T#Z!'h#Z#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!3dfOr!'hrs!'hsw!'hwx!4xx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#U!'h#U#V!'h#V#Y!'h#Y#Z!'h#Z#b!'h#b#c!'h#c#f!'h#f#g!'h#g#h!'h#h#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!4{ZOw!'hwx!5nx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!5qZOw!'hwx!6dx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!6iZx~Ow!'hwx!)xx!w!'h!w!x!)}!x#O!'h#O#P!3a#P#i!'h#i#j!.o#j;'S!'h;'S;=`!7[<%lO!'h~!7_P;=`<%l!'h~!7gO!Z~~!7lO!Y~~!7oQ!O!P!7u!Q![!8uT!7xP!Q![!7{T!8QR!OT!Q![!7{!g!h!8Z#X#Y!8ZT!8^R{|!8g}!O!8g!Q![!8mT!8jP!Q![!8mT!8rP!PT!Q![!8m~!8zS}~!O!P!9W!Q![!8u!g!h!8Z#X#Y!8ZT!9ZR!Q![!7{!g!h!8Z#X#Y!8Z~!9iOq~V!9nPTQ!Q![!7{~!9vcW~uv!;R!Q![!;k![!]!;k!c!}!;k#O#P!>y#R#S!;k#T#o!;k%W%o!;k%p&a!;k&b1p!;k4U4d!;k4e$IS!;k$I`$Ib!;k$Kh%#t!;k&/x&Et!;k&FV;'S!;k;'S;:j!@[?&r?Ah!;k?BY?Mn!;k~!;UR!Q![!;_!c!i!;_#T#Z!;_~!;bR!Q![!;k!c!i!;k#T#Z!;k~!;phd~uv!;R}!O!;k!O!P!=[!Q![!;k![!]!;k!c!}!;k#O#P!>y#R#S!;k#T#o!;k$}%O!;k%W%o!;k%p&a!;k&b1p!;k1p4U!;k4U4d!;k4e$IS!;k$I`$Ib!;k$Je$Jg!;k$Kh%#t!;k&/x&Et!;k&FV;'S!;k;'S;:j!@[?&r?Ah!;k?BY?Mn!;k~!=_huv!;R}!O!;k!O!P!=[!Q![!;k![!]!;k!c!}!;k#O#P!>y#R#S!;k#T#o!;k$}%O!;k%W%o!;k%p&a!;k&b1p!;k1p4U!;k4U4d!;k4e$IS!;k$I`$Ib!;k$Je$Jg!;k$Kh%#t!;k&/x&Et!;k&FV;'S!;k;'S;:j!@[?&r?Ah!;k?BY?Mn!;k~!>|dqr!;kst!;ktu!;kuv!;kvw!;kwx!;kxy!;kyz!;kz{!;k{|!;k|}!;k}!O!;k!O!P!;k!P!Q!;k!]!^!;k!_!`!;k!a!b!;k!b!c!;k#R#S!;k#r#s!;k~!@_P;=`<%l!;k~!@gOr~~!@jZqr!@gs!^!@g!_!`!@g!`!a!A]!a#O!@g#P#Q!@g#R#S!@g#T#o!@g#r;'S!@g;'S;=`!Ab<%lO!@g~!AbOX~~!AeP;=`<%l!@gV!AkU!c!}!A}#T#U!A}#U#V!Bz#V#d!A}#d#e!Dg#e#o!A}U!BSRzU}!O!B]!c!}!A}#T#o!A}U!B`R!Q![!Bi!c!}!Bi#T#o!BiU!BnSzU}!O!B]!Q![!Bi!c!}!Bi#T#o!BiV!CPSzU}!O!B]!c!}!A}#T#U!C]#U#o!A}V!CbTzU}!O!B]!c!}!A}#T#g!A}#g#h!Cq#h#o!A}V!CvTzU}!O!B]!c!}!A}#T#X!A}#X#Y!DV#Y#o!A}V!D^RZPzU}!O!B]!c!}!A}#T#o!A}V!DlTzU}!O!B]!c!}!A}#T#f!A}#f#g!D{#g#o!A}V!EQTzU}!O!B]!c!}!A}#T#X!A}#X#Y!Ea#Y#o!A}V!EfTzU}!O!B]!c!}!A}#T#Y!A}#Y#Z!Eu#Z#o!A}V!EzTzU}!O!B]!c!}!A}#T#]!A}#]#^!FZ#^#o!A}V!F`TzU}!O!B]!c!}!A}#T#l!A}#l#m!Fo#m#o!A}V!FvRVPzU}!O!B]!c!}!A}#T#o!A}~!GSf}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~!Hke}!O!GP!O!P!Hh!Q![!GP!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~!JPP;=`<%l!GP~!JVg}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!d!Kn!d!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~!Kqh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!u!GP!u!v!M]!v!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~!M`h}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!g!GP!g!h!Nz!h!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~# Pf_~}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#!hh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!t!GP!t!u#$S!u!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#$Vh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!g!GP!g!h#%q!h!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#%th}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!h!GP!h!i#'`!i!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#'ch}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!k!GP!k!l#(}!l!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#)Qh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!z!GP!z!{#*l!{!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#*qf]~}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#,[Tk~XY#,kYZ#,k]^#,kpq#,k#P#Q#,}~#,nTXY#,kYZ#,k]^#,kpq#,k#P#Q#,}~#-SOg~~#-XOj~~#-[P#Q#R#-_~#-dO{~~#-gP![!]#-j~#-m`!Q![#.o!c!}#.o#R#S#.o#T#o#.o%W%o#.o%p&a#.o&b1p#.o4U4d#.o4e$IS#.o$I`$Ib#.o$Kh%#t#.o&/x&Et#.o&FV;'S#.o;'S;:j#1k?&r?Ah#.o?BY?Mn#.o~#.tef~}!O#.o!O!P#0V!Q![#.o!c!}#.o#R#S#.o#T#o#.o$}%O#.o%W%o#.o%p&a#.o&b1p#.o1p4U#.o4U4d#.o4e$IS#.o$I`$Ib#.o$Je$Jg#.o$Kh%#t#.o&/x&Et#.o&FV;'S#.o;'S;:j#1k?&r?Ah#.o?BY?Mn#.o~#0Ye}!O#.o!O!P#0V!Q![#.o!c!}#.o#R#S#.o#T#o#.o$}%O#.o%W%o#.o%p&a#.o&b1p#.o1p4U#.o4U4d#.o4e$IS#.o$I`$Ib#.o$Je$Jg#.o$Kh%#t#.o&/x&Et#.o&FV;'S#.o;'S;:j#1k?&r?Ah#.o?BY?Mn#.o~#1nP;=`<%l#.o~#1vf![~}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#3_g}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#U#4v#U#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#4yh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#`!GP#`#a#6e#a#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#6hh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#g!GP#g#h#8S#h#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#8Vh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#X!GP#X#Y#9q#Y#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#9vf!^~}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#;_h}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#f!GP#f#g#<y#g#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#<|h}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#i!GP#i#j#>h#j#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#>kh}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#X!GP#X#Y#@V#Y#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#@[f!]~}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e$IS!GP$I`$Ib!GP$Je$Jg!GP$Kh%#t!GP&/x&Et!GP&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP~#Auq!X~X^$epq$e}!O!GP!O!P!Hh!Q![!GP![!]!9q!c!}!GP#R#S!GP#T#o!GP#y#z$e$f$g$e$}%O!GP%W%o!GP%p&a!GP&b1p!GP1p4U!GP4U4d!GP4e#BY!GP#BY#BZ#Ap#BZ$IS!GP$IS$I_$e$I`$Ib!GP$I|$JO$e$JT$JU$e$Je$Jg!GP$KV$KW$e$Kh%#t!GP&/x&Et!GP&FU&FV$e&FV;'S!GP;'S;:j!I|?&r?Ah!GP?BY?Mn!GP",tokenizers:[0,1,2],topRules:{TurtleDoc:[0,2]},tokenPrec:421}),wk=cr.define({parser:Ak.configure({props:[fr({Comment:k.comment,"@prefix @base PREFIX BASE":k.keyword,"String!":k.string,Integer:k.integer,"Double Decimal":k.float,"[ ]":k.squareBracket,Langtag:k.annotation,"; . ,":k.separator,"BlankNode!":k.propertyName,"true false":k.bool,"VerbPath Pname_ns Pname_ln Iriref":k.namespace,Iri:k.url,"RDFLiteral/Iri! ^^":k.typeName})]})});function zf(){return new pr(wk)}function bl(i){var e=i.statementIndent,t=i.jsonld,r=i.json||t,n=i.typescript,s=i.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function p(Nt){return{type:Nt,style:"keyword"}}var S=p("keyword a"),R=p("keyword b"),P=p("keyword c"),W=p("keyword d"),pe=p("operator"),Te={type:"atom",style:"atom"};return{if:p("if"),while:S,with:S,else:R,do:R,try:R,finally:R,return:W,break:W,continue:W,new:p("new"),delete:P,void:P,throw:P,debugger:p("debugger"),var:p("var"),const:p("var"),let:p("var"),function:p("function"),catch:p("catch"),for:p("for"),switch:p("switch"),case:p("case"),default:p("default"),in:pe,typeof:pe,instanceof:pe,true:Te,false:Te,null:Te,undefined:Te,NaN:Te,Infinity:Te,this:p("this"),class:p("class"),super:p("atom"),yield:P,export:p("export"),import:p("import"),extends:P,await:P}}(),a=/[+\-*&%=<>!?|~^@]/,l=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function h(p){for(var S=!1,R,P=!1;(R=p.next())!=null;){if(!S){if(R=="/"&&!P)return;R=="["?P=!0:P&&R=="]"&&(P=!1)}S=!S&&R=="\\"}}var u,c;function d(p,S,R){return u=p,c=R,S}function g(p,S){var R=p.next();if(R=='"'||R=="'")return S.tokenize=m(R),S.tokenize(p,S);if(R=="."&&p.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return d("number","number");if(R=="."&&p.match(".."))return d("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(R))return d(R);if(R=="="&&p.eat(">"))return d("=>","operator");if(R=="0"&&p.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return d("number","number");if(/\d/.test(R))return p.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),d("number","number");if(R=="/")return p.eat("*")?(S.tokenize=x,x(p,S)):p.eat("/")?(p.skipToEnd(),d("comment","comment")):Qe(p,S,1)?(h(p),p.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),d("regexp","string.special")):(p.eat("="),d("operator","operator",p.current()));if(R=="`")return S.tokenize=O,O(p,S);if(R=="#"&&p.peek()=="!")return p.skipToEnd(),d("meta","meta");if(R=="#"&&p.eatWhile(s))return d("variable","property");if(R=="<"&&p.match("!--")||R=="-"&&p.match("->")&&!/\S/.test(p.string.slice(0,p.start)))return p.skipToEnd(),d("comment","comment");if(a.test(R))return(R!=">"||!S.lexical||S.lexical.type!=">")&&(p.eat("=")?(R=="!"||R=="=")&&p.eat("="):/[<>*+\-|&?]/.test(R)&&(p.eat(R),R==">"&&p.eat(R))),R=="?"&&p.eat(".")?d("."):d("operator","operator",p.current());if(s.test(R)){p.eatWhile(s);var P=p.current();if(S.lastType!="."){if(o.propertyIsEnumerable(P)){var W=o[P];return d(W.type,W.style,P)}if(P=="async"&&p.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return d("async","keyword",P)}return d("variable","variable",P)}}function m(p){return function(S,R){var P=!1,W;if(t&&S.peek()=="@"&&S.match(l))return R.tokenize=g,d("jsonld-keyword","meta");for(;(W=S.next())!=null&&!(W==p&&!P);)P=!P&&W=="\\";return P||(R.tokenize=g),d("string","string")}}function x(p,S){for(var R=!1,P;P=p.next();){if(P=="/"&&R){S.tokenize=g;break}R=P=="*"}return d("comment","comment")}function O(p,S){for(var R=!1,P;(P=p.next())!=null;){if(!R&&(P=="`"||P=="$"&&p.eat("{"))){S.tokenize=g;break}R=!R&&P=="\\"}return d("quasi","string.special",p.current())}var w="([{}])";function B(p,S){S.fatArrowAt&&(S.fatArrowAt=null);var R=p.string.indexOf("=>",p.start);if(!(R<0)){if(n){var P=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(p.string.slice(p.start,R));P&&(R=P.index)}for(var W=0,pe=!1,Te=R-1;Te>=0;--Te){var Nt=p.string.charAt(Te),Wt=w.indexOf(Nt);if(Wt>=0&&Wt<3){if(!W){++Te;break}if(--W==0){Nt=="("&&(pe=!0);break}}else if(Wt>=3&&Wt<6)++W;else if(s.test(Nt))pe=!0;else if(/["'\/`]/.test(Nt))for(;;--Te){if(Te==0)return;var Jn=p.string.charAt(Te-1);if(Jn==Nt&&p.string.charAt(Te-2)!="\\"){Te--;break}}else if(pe&&!W){++Te;break}}pe&&!W&&(S.fatArrowAt=Te)}}var F={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function M(p,S,R,P,W,pe){this.indented=p,this.column=S,this.type=R,this.prev=W,this.info=pe,P!=null&&(this.align=P)}function G(p,S){for(var R=p.localVars;R;R=R.next)if(R.name==S)return!0;for(var P=p.context;P;P=P.prev)for(var R=P.vars;R;R=R.next)if(R.name==S)return!0}function T(p,S,R,P,W){var pe=p.cc;for(b.state=p,b.stream=W,b.marked=null,b.cc=pe,b.style=S,p.lexical.hasOwnProperty("align")||(p.lexical.align=!0);;){var Te=pe.length?pe.pop():r?X:D;if(Te(R,P)){for(;pe.length&&pe[pe.length-1].lex;)pe.pop()();return b.marked?b.marked:R=="variable"&&G(p,P)?"variableName.local":S}}}var b={state:null,column:null,marked:null,cc:null};function A(){for(var p=arguments.length-1;p>=0;p--)b.cc.push(arguments[p])}function y(){return A.apply(null,arguments),!0}function v(p,S){for(var R=S;R;R=R.next)if(R.name==p)return!0;return!1}function N(p){var S=b.state;if(b.marked="def",S.context){if(S.lexical.info=="var"&&S.context&&S.context.block){var R=V(p,S.context);if(R!=null){S.context=R;return}}else if(!v(p,S.localVars)){S.localVars=new J(p,S.localVars);return}}i.globalVars&&!v(p,S.globalVars)&&(S.globalVars=new J(p,S.globalVars))}function V(p,S){if(S)if(S.block){var R=V(p,S.prev);return R?R==S.prev?S:new ne(R,S.vars,!0):null}else return v(p,S.vars)?S:new ne(S.prev,new J(p,S.vars),!1);else return null}function re(p){return p=="public"||p=="private"||p=="protected"||p=="abstract"||p=="readonly"}function ne(p,S,R){this.prev=p,this.vars=S,this.block=R}function J(p,S){this.name=p,this.next=S}var me=new J("this",new J("arguments",null));function z(){b.state.context=new ne(b.state.context,b.state.localVars,!1),b.state.localVars=me}function we(){b.state.context=new ne(b.state.context,b.state.localVars,!0),b.state.localVars=null}z.lex=we.lex=!0;function H(){b.state.localVars=b.state.context.vars,b.state.context=b.state.context.prev}H.lex=!0;function U(p,S){var R=function(){var P=b.state,W=P.indented;if(P.lexical.type=="stat")W=P.lexical.indented;else for(var pe=P.lexical;pe&&pe.type==")"&&pe.align;pe=pe.prev)W=pe.indented;P.lexical=new M(W,b.stream.column(),p,null,P.lexical,S)};return R.lex=!0,R}function C(){var p=b.state;p.lexical.prev&&(p.lexical.type==")"&&(p.indented=p.lexical.indented),p.lexical=p.lexical.prev)}C.lex=!0;function Z(p){function S(R){return R==p?y():p==";"||R=="}"||R==")"||R=="]"?A():y(S)}return S}function D(p,S){return p=="var"?y(U("vardef",S),Qn,Z(";"),C):p=="keyword a"?y(U("form"),oe,D,C):p=="keyword b"?y(U("form"),D,C):p=="keyword d"?b.stream.match(/^\s*$/,!1)?y():y(U("stat"),te,Z(";"),C):p=="debugger"?y(Z(";")):p=="{"?y(U("}"),we,Xe,C,H):p==";"?y():p=="if"?(b.state.lexical.info=="else"&&b.state.cc[b.state.cc.length-1]==C&&b.state.cc.pop()(),y(U("form"),oe,D,C,ao)):p=="function"?y(Jt):p=="for"?y(U("form"),we,Dn,D,H,C):p=="class"||n&&S=="interface"?(b.marked="keyword",y(U("form",p=="class"?p:S),Yn,C)):p=="variable"?n&&S=="declare"?(b.marked="keyword",y(D)):n&&(S=="module"||S=="enum"||S=="type")&&b.stream.match(/^\s*\w/,!1)?(b.marked="keyword",S=="enum"?y(Y):S=="type"?y(kt,Z("operator"),he,Z(";")):y(U("form"),nt,Z("{"),U("}"),Xe,C,C)):n&&S=="namespace"?(b.marked="keyword",y(U("form"),X,D,C)):n&&S=="abstract"?(b.marked="keyword",y(D)):y(U("stat"),wt):p=="switch"?y(U("form"),oe,Z("{"),U("}","switch"),we,Xe,C,C,H):p=="case"?y(X,Z(":")):p=="default"?y(Z(":")):p=="catch"?y(U("form"),z,Ie,D,C,H):p=="export"?y(U("stat"),ho,C):p=="import"?y(U("stat"),uo,C):p=="async"?y(D):S=="@"?y(X,D):A(U("stat"),X,Z(";"),C)}function Ie(p){if(p=="(")return y(ht,Z(")"))}function X(p,S){return be(p,S,!1)}function $(p,S){return be(p,S,!0)}function oe(p){return p!="("?A():y(U(")"),te,Z(")"),C)}function be(p,S,R){if(b.state.fatArrowAt==b.stream.start){var P=R?ve:se;if(p=="(")return y(z,U(")"),ae(ht,")"),C,Z("=>"),P,H);if(p=="variable")return A(z,nt,Z("=>"),P,H)}var W=R?Ce:ce;return F.hasOwnProperty(p)?y(W):p=="function"?y(Jt,W):p=="class"||n&&S=="interface"?(b.marked="keyword",y(U("form"),lo,C)):p=="keyword c"||p=="async"?y(R?$:X):p=="("?y(U(")"),te,Z(")"),C,W):p=="operator"||p=="spread"?y(R?$:X):p=="["?y(U("]"),_,C,W):p=="{"?Be(Rt,"}",null,W):p=="quasi"?A(xe,W):p=="new"?y(de(R)):y()}function te(p){return p.match(/[;\}\)\],]/)?A():A(X)}function ce(p,S){return p==","?y(te):Ce(p,S,!1)}function Ce(p,S,R){var P=R==!1?ce:Ce,W=R==!1?X:$;if(p=="=>")return y(z,R?ve:se,H);if(p=="operator")return/\+\+|--/.test(S)||n&&S=="!"?y(P):n&&S=="<"&&b.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?y(U(">"),ae(he,">"),C,P):S=="?"?y(X,Z(":"),W):y(W);if(p=="quasi")return A(xe,P);if(p!=";"){if(p=="(")return Be($,")","call",P);if(p==".")return y(rt,P);if(p=="[")return y(U("]"),te,Z("]"),C,P);if(n&&S=="as")return b.marked="keyword",y(he,P);if(p=="regexp")return b.state.lastType=b.marked="operator",b.stream.backUp(b.stream.pos-b.stream.start-1),y(W)}}function xe(p,S){return p!="quasi"?A():S.slice(S.length-2)!="${"?y(xe):y(te,fe)}function fe(p){if(p=="}")return b.marked="string.special",b.state.tokenize=O,y(xe)}function se(p){return B(b.stream,b.state),A(p=="{"?D:X)}function ve(p){return B(b.stream,b.state),A(p=="{"?D:$)}function de(p){return function(S){return S=="."?y(p?Ee:Oe):S=="variable"&&n?y(Tl,p?Ce:ce):A(p?$:X)}}function Oe(p,S){if(S=="target")return b.marked="keyword",y(ce)}function Ee(p,S){if(S=="target")return b.marked="keyword",y(Ce)}function wt(p){return p==":"?y(C,D):A(ce,Z(";"),C)}function rt(p){if(p=="variable")return b.marked="property",y()}function Rt(p,S){if(p=="async")return b.marked="property",y(Rt);if(p=="variable"||b.style=="keyword"){if(b.marked="property",S=="get"||S=="set")return y(De);var R;return n&&b.state.fatArrowAt==b.stream.start&&(R=b.stream.match(/^\s*:\s*/,!1))&&(b.state.fatArrowAt=b.stream.pos+R[0].length),y(Je)}else{if(p=="number"||p=="string")return b.marked=t?"property":b.style+" property",y(Je);if(p=="jsonld-keyword")return y(Je);if(n&&re(S))return b.marked="keyword",y(Rt);if(p=="[")return y(X,Ye,Z("]"),Je);if(p=="spread")return y($,Je);if(S=="*")return b.marked="keyword",y(Rt);if(p==":")return A(Je)}}function De(p){return p!="variable"?A(Je):(b.marked="property",y(Jt))}function Je(p){if(p==":")return y($);if(p=="(")return A(Jt)}function ae(p,S,R){function P(W,pe){if(R?R.indexOf(W)>-1:W==","){var Te=b.state.lexical;return Te.info=="call"&&(Te.pos=(Te.pos||0)+1),y(function(Nt,Wt){return Nt==S||Wt==S?A():A(p)},P)}return W==S||pe==S?y():R&&R.indexOf(";")>-1?A(p):y(Z(S))}return function(W,pe){return W==S||pe==S?y():A(p,P)}}function Be(p,S,R){for(var P=3;P<arguments.length;P++)b.cc.push(arguments[P]);return y(U(S,R),ae(p,S),C)}function Xe(p){return p=="}"?y():A(D,Xe)}function Ye(p,S){if(n){if(p==":")return y(he);if(S=="?")return y(Ye)}}function Zi(p,S){if(n&&(p==":"||S=="in"))return y(he)}function Ut(p){if(n&&p==":")return b.stream.match(/^\s*\w+\s+is\b/,!1)?y(X,lt,he):y(he)}function lt(p,S){if(S=="is")return b.marked="keyword",y()}function he(p,S){if(S=="keyof"||S=="typeof"||S=="infer"||S=="readonly")return b.marked="keyword",y(S=="typeof"?$:he);if(p=="variable"||S=="void")return b.marked="type",y(Et);if(S=="|"||S=="&")return y(he);if(p=="string"||p=="number"||p=="atom")return y(Et);if(p=="[")return y(U("]"),ae(he,"]",","),C,Et);if(p=="{")return y(U("}"),Qi,C,Et);if(p=="(")return y(ae(xr,")"),br,Et);if(p=="<")return y(ae(he,">"),he);if(p=="quasi")return A(Ct,Et)}function br(p){if(p=="=>")return y(he)}function Qi(p){return p.match(/[\}\)\]]/)?y():p==","||p==";"?y(Qi):A(ai,Qi)}function ai(p,S){if(p=="variable"||b.style=="keyword")return b.marked="property",y(ai);if(S=="?"||p=="number"||p=="string")return y(ai);if(p==":")return y(he);if(p=="[")return y(Z("variable"),Zi,Z("]"),ai);if(p=="(")return A(Yi,ai);if(!p.match(/[;\}\)\],]/))return y()}function Ct(p,S){return p!="quasi"?A():S.slice(S.length-2)!="${"?y(Ct):y(he,Di)}function Di(p){if(p=="}")return b.marked="string.special",b.state.tokenize=O,y(Ct)}function xr(p,S){return p=="variable"&&b.stream.match(/^\s*[?:]/,!1)||S=="?"?y(xr):p==":"?y(he):p=="spread"?y(xr):A(he)}function Et(p,S){if(S=="<")return y(U(">"),ae(he,">"),C,Et);if(S=="|"||p=="."||S=="&")return y(he);if(p=="[")return y(he,Z("]"),Et);if(S=="extends"||S=="implements")return b.marked="keyword",y(he);if(S=="?")return y(he,Z(":"),he)}function Tl(p,S){if(S=="<")return y(U(">"),ae(he,">"),C,Et)}function Ci(){return A(he,Jr)}function Jr(p,S){if(S=="=")return y(he)}function Qn(p,S){return S=="enum"?(b.marked="keyword",y(Y)):A(nt,Ye,ke,Xi)}function nt(p,S){if(n&&re(S))return b.marked="keyword",y(nt);if(p=="variable")return N(S),y();if(p=="spread")return y(nt);if(p=="[")return Be(Il,"]");if(p=="{")return Be(oo,"}")}function oo(p,S){return p=="variable"&&!b.stream.match(/^\s*:/,!1)?(N(S),y(ke)):(p=="variable"&&(b.marked="property"),p=="spread"?y(nt):p=="}"?A():p=="["?y(X,Z("]"),Z(":"),oo):y(Z(":"),nt,ke))}function Il(){return A(nt,ke)}function ke(p,S){if(S=="=")return y($)}function Xi(p){if(p==",")return y(Qn)}function ao(p,S){if(p=="keyword b"&&S=="else")return y(U("form","else"),D,C)}function Dn(p,S){if(S=="await")return y(Dn);if(p=="(")return y(U(")"),Xn,C)}function Xn(p){return p=="var"?y(Qn,Ei):p=="variable"?y(Ei):A(Ei)}function Ei(p,S){return p==")"?y():p==";"?y(Ei):S=="in"||S=="of"?(b.marked="keyword",y(X,Ei)):A(X,Ei)}function Jt(p,S){if(S=="*")return b.marked="keyword",y(Jt);if(p=="variable")return N(S),y(Jt);if(p=="(")return y(z,U(")"),ae(ht,")"),C,Ut,D,H);if(n&&S=="<")return y(U(">"),ae(Ci,">"),C,Jt)}function Yi(p,S){if(S=="*")return b.marked="keyword",y(Yi);if(p=="variable")return N(S),y(Yi);if(p=="(")return y(z,U(")"),ae(ht,")"),C,Ut,H);if(n&&S=="<")return y(U(">"),ae(Ci,">"),C,Yi)}function kt(p,S){if(p=="keyword"||p=="variable")return b.marked="type",y(kt);if(S=="<")return y(U(">"),ae(Ci,">"),C)}function ht(p,S){return S=="@"&&y(X,ht),p=="spread"?y(ht):n&&re(S)?(b.marked="keyword",y(ht)):n&&p=="this"?y(Ye,ke):A(nt,Ye,ke)}function lo(p,S){return p=="variable"?Yn(p,S):ji(p,S)}function Yn(p,S){if(p=="variable")return N(S),y(ji)}function ji(p,S){if(S=="<")return y(U(">"),ae(Ci,">"),C,ji);if(S=="extends"||S=="implements"||n&&p==",")return S=="implements"&&(b.marked="keyword"),y(n?he:X,ji);if(p=="{")return y(U("}"),Pt,C)}function Pt(p,S){if(p=="async"||p=="variable"&&(S=="static"||S=="get"||S=="set"||n&&re(S))&&b.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return b.marked="keyword",y(Pt);if(p=="variable"||b.style=="keyword")return b.marked="property",y(mt,Pt);if(p=="number"||p=="string")return y(mt,Pt);if(p=="[")return y(X,Ye,Z("]"),mt,Pt);if(S=="*")return b.marked="keyword",y(Pt);if(n&&p=="(")return A(Yi,Pt);if(p==";"||p==",")return y(Pt);if(p=="}")return y();if(S=="@")return y(X,Pt)}function mt(p,S){if(S=="!"||S=="?")return y(mt);if(p==":")return y(he,ke);if(S=="=")return y($);var R=b.state.lexical.prev,P=R&&R.info=="interface";return A(P?Yi:Jt)}function ho(p,S){return S=="*"?(b.marked="keyword",y(I,Z(";"))):S=="default"?(b.marked="keyword",y(X,Z(";"))):p=="{"?y(ae(jn,"}"),I,Z(";")):A(D)}function jn(p,S){if(S=="as")return b.marked="keyword",y(Z("variable"));if(p=="variable")return A($,jn)}function uo(p){return p=="string"?y():p=="("?A(X):p=="."?A(ce):A(yr,fo,I)}function yr(p,S){return p=="{"?Be(yr,"}"):(p=="variable"&&N(S),S=="*"&&(b.marked="keyword"),y(K))}function fo(p){if(p==",")return y(yr,fo)}function K(p,S){if(S=="as")return b.marked="keyword",y(yr)}function I(p,S){if(S=="from")return b.marked="keyword",y(X)}function _(p){return p=="]"?y():A(ae($,"]"))}function Y(){return A(U("form"),nt,Z("{"),U("}"),ae(Ge,"}"),C,C)}function Ge(){return A(nt,ke)}function Ke(p,S){return p.lastType=="operator"||p.lastType==","||a.test(S.charAt(0))||/[,.]/.test(S.charAt(0))}function Qe(p,S,R){return S.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(S.lastType)||S.lastType=="quasi"&&/\{\s*$/.test(p.string.slice(0,p.pos-(R||0)))}return{name:i.name,startState:function(p){var S={tokenize:g,lastType:"sof",cc:[],lexical:new M(-p,0,"block",!1),localVars:i.localVars,context:i.localVars&&new ne(null,null,!1),indented:0};return i.globalVars&&typeof i.globalVars=="object"&&(S.globalVars=i.globalVars),S},token:function(p,S){if(p.sol()&&(S.lexical.hasOwnProperty("align")||(S.lexical.align=!1),S.indented=p.indentation(),B(p,S)),S.tokenize!=x&&p.eatSpace())return null;var R=S.tokenize(p,S);return u=="comment"?R:(S.lastType=u=="operator"&&(c=="++"||c=="--")?"incdec":u,T(S,R,u,c,p))},indent:function(p,S,R){if(p.tokenize==x||p.tokenize==O)return null;if(p.tokenize!=g)return 0;var P=S&&S.charAt(0),W=p.lexical,pe;if(!/^\s*else\b/.test(S))for(var Te=p.cc.length-1;Te>=0;--Te){var Nt=p.cc[Te];if(Nt==C)W=W.prev;else if(Nt!=ao&&Nt!=H)break}for(;(W.type=="stat"||W.type=="form")&&(P=="}"||(pe=p.cc[p.cc.length-1])&&(pe==ce||pe==Ce)&&!/^[,\.=+\-*:?[\(]/.test(S));)W=W.prev;e&&W.type==")"&&W.prev.type=="stat"&&(W=W.prev);var Wt=W.type,Jn=P==Wt;return Wt=="vardef"?W.indented+(p.lastType=="operator"||p.lastType==","?W.info.length+1:0):Wt=="form"&&P=="{"?W.indented:Wt=="form"?W.indented+R.unit:Wt=="stat"?W.indented+(Ke(p,S)?e||R.unit:0):W.info=="switch"&&!Jn&&i.doubleIndentSwitch!=!1?W.indented+(/^(?:case|default)\b/.test(S)?R.unit:2*R.unit):W.align?W.column+(Jn?0:1):W.indented+(Jn?0:R.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:r?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var hx=bl({name:"javascript"}),WV=bl({name:"json",json:!0}),LV=bl({name:"json",jsonld:!0}),MV=bl({name:"typescript",typescript:!0});var ux=/<([^<>\s"{}|\\^`]+)>/g,fx=/(?:https?|urn|ftp|mailto):[^\s<>"'`{}|\\^[\]]+/g,cx=/^\s*(?:@prefix|PREFIX)\s+(\w*):\s*<[^>]+>\s*\.?\s*$/i;function dx(i){return i.replace(/[.,;)\]]+$/,"").trim()}function px(i,e){if(!i||e<0||e>=i.length)return;let t;for(ux.lastIndex=0;(t=ux.exec(i))!==null;){let r=t.index,n=r+t[0].length;if(e>=r&&e<=n){let s=dx(t[1]);return s.length>0?s:void 0}}for(fx.lastIndex=0;(t=fx.exec(i))!==null;){let r=t.index,n=r+t[0].length;if(e>=r&&e<=n){let s=dx(t[0]);return s.length>0?s:void 0}}}function xl(i){return`CONSTRUCT { <${i}> ?p ?o } WHERE { <${i}> ?p ?o }`}function yl(i){return`CONSTRUCT { ?s ?p <${i}> } WHERE { ?s ?p <${i}> } LIMIT 1000`}function gx(i,e=""){if(!i)return i;let t=new Set;(s=>{for(let o of s.split(`
33
+ `)){let a=o.match(cx);a&&t.add(a[1].toLowerCase())}})(e);let n=[];for(let s of i.split(`
34
+ `)){let o=s.match(cx);if(!o){n.push(s);continue}let a=o[1].toLowerCase();t.has(a)||(t.add(a),n.push(s))}return n.join(`
35
+ `)}var Sl=class Sl{constructor(e){this.label="Response";this.priority=2;this.helpReference="https://matgui-doc.matdata.eu/docs/user-guide#response-plugin";this.appendedContent="";this.handleMouseDown=e=>{if(!e.ctrlKey&&!e.metaKey||e.button!==0||!this.cm||!this.yasr.config.executeQuery)return;let t=this.cm.posAtCoords({x:e.clientX,y:e.clientY});if(t===null)return;let r=px(this.cm.state.doc.toString(),t);r&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?this.runObjectOfQuery(r):this.runSubjectOfQuery(r))};this.yasr=e,this.config=Sl.defaults,e.config.plugins.response&&e.config.plugins.response.dynamicConfig&&(this.config={...this.config,...e.config.plugins.response.dynamicConfig})}canHandleResults(){if(!this.yasr.results||!this.yasr.results.getOriginalResponseAsString)return!1;var e=this.yasr.results.getOriginalResponseAsString();return!((!e||e.length==0)&&this.yasr.results.getError())}getIcon(){let e=document.createElement("i");return e.className="fas fa-align-left",e}download(e){if(!this.yasr.results)return;let t=this.yasr.results.getContentType(),r=this.yasr.results.getType(),n=r==="xml"?"rdf":r;return{getData:()=>this.yasr.results?.getOriginalResponseAsString()||"",filename:`${e||"queryResults"}${n?"."+n:""}`,contentType:t||"text/plain",title:"Download result"}}draw(e){let t={...this.config,...e},r=this.yasr.results?.getOriginalResponseAsString()||"",n=r.split(`
36
+ `);n.length>t.maxLines&&(r=n.slice(0,t.maxLines).join(`
37
+ `));let s=document.documentElement.getAttribute("data-theme")==="dark",o=[Le.readOnly.of(!0),ie.editable.of(!1),ub(),Pb(),ab(),Qb(),ie.lineWrapping,Lb(Sb),ie.editorAttributes.of({class:`CodeMirror cm-s-${s?"yasgui-dark":"default"}`})],a=this.getLanguageExtension();a&&o.push(a),this.destroyEditor(),this.appendedContent="",this.cm=new ie({state:Le.create({doc:r,extensions:o}),parent:this.yasr.resultsEl}),this.cm.dom.addEventListener("mousedown",this.handleMouseDown),n.length>t.maxLines&&this.showLess(!1)}getLanguageExtension(){let e=this.yasr.results?.getType();if(e==="json")return Mf();if(e==="xml")return Hf();if(e==="ttl")return zf();if(e==="n-triples")return zf();let t=this.yasr.results?.getContentType()||"";if(t.indexOf("json")>=0)return Mf();if(t.indexOf("xml")>=0||t.indexOf("html")>=0)return Hf();if(t.indexOf("javascript")>=0)return cl.define(hx)}destroyEditor(){this.cm&&(this.cm.dom.removeEventListener("mousedown",this.handleMouseDown),this.cm.destroy(),this.cm=void 0),this.overLay?.remove(),this.overLay=void 0}async runSubjectOfQuery(e){if(!this.yasr.config.executeQuery)return;let t=this.cm;if(!t)return;let r=xl(e);try{this.yasr.showLoading();let n=await this.yasr.executeQuery(r,{acceptHeader:this.getConstructAcceptHeader()});if(this.cm!==t)return;let s=this.getResponseContent(n);s?this.appendToView(`
17
38
 
18
- b`.split(/\n/).length!=3?function(e){for(var t=0,o=[],i=e.length;t<=i;){var s=e.indexOf(`
19
- `,t);s==-1&&(s=e.length);var u=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),d=u.indexOf("\r");d!=-1?(o.push(u.slice(0,d)),t+=d+1):(o.push(u),t=s+1)}return o}:function(e){return e.split(/\r\n?|\n/)},wr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},xn=function(){var e=x("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),lr=null;function Tr(e){if(lr!=null)return lr;var t=oe(e,x("span","x")),o=t.getBoundingClientRect(),i=D(t,0,1).getBoundingClientRect();return lr=Math.abs(o.left-i.left)>1}var tn={},ur={};function fr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),tn[e]=t}function Dr(e,t){ur[e]=t}function Tn(e){if(typeof e=="string"&&ur.hasOwnProperty(e))e=ur[e];else if(e&&typeof e.name=="string"&&ur.hasOwnProperty(e.name)){var t=ur[e.name];typeof t=="string"&&(t={name:t}),e=lt(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function xe(e,t){t=Tn(t);var o=tn[t.name];if(!o)return xe(e,"text/plain");var i=o(e,t);if(N.hasOwnProperty(t.name)){var s=N[t.name];for(var u in s)s.hasOwnProperty(u)&&(i.hasOwnProperty(u)&&(i["_"+u]=i[u]),i[u]=s[u])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var d in t.modeProps)i[d]=t.modeProps[d];return i}var N={};function K(e,t){var o=N.hasOwnProperty(e)?N[e]:N[e]={};le(t,o)}function be(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var o={};for(var i in t){var s=t[i];s instanceof Array&&(s=s.concat([])),o[i]=s}return o}function Ye(e,t){for(var o;e.innerMode&&(o=e.innerMode(t),!(!o||o.mode==e));)t=o.state,e=o.mode;return o||{mode:e,state:t}}function dt(e,t,o){return e.startState?e.startState(t,o):!0}var Ue=function(e,t,o){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=o};Ue.prototype.eol=function(){return this.pos>=this.string.length},Ue.prototype.sol=function(){return this.pos==this.lineStart},Ue.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ue.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ue.prototype.eat=function(e){var t=this.string.charAt(this.pos),o;if(typeof e=="string"?o=t==e:o=t&&(e.test?e.test(t):e(t)),o)return++this.pos,t},Ue.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ue.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ue.prototype.skipToEnd=function(){this.pos=this.string.length},Ue.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ue.prototype.backUp=function(e){this.pos-=e},Ue.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ye(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ye(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.indentation=function(){return ye(this.string,null,this.tabSize)-(this.lineStart?ye(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.match=function(e,t,o){if(typeof e=="string"){var i=function(d){return o?d.toLowerCase():d},s=this.string.substr(this.pos,e.length);if(i(s)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var u=this.string.slice(this.pos).match(e);return u&&u.index>0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ue.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ue.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ue.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ue.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function he(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var o=e;!o.lines;)for(var i=0;;++i){var s=o.children[i],u=s.chunkSize();if(t<u){o=s;break}t-=u}return o.lines[t]}function Rt(e,t,o){var i=[],s=t.line;return e.iter(t.line,o.line+1,function(u){var d=u.text;s==o.line&&(d=d.slice(0,o.ch)),s==t.line&&(d=d.slice(t.ch)),i.push(d),++s}),i}function Cr(e,t,o){var i=[];return e.iter(t,o,function(s){i.push(s.text)}),i}function Dt(e,t){var o=t-e.height;if(o)for(var i=e;i;i=i.parent)i.height+=o}function v(e){if(e.parent==null)return null;for(var t=e.parent,o=ue(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var s=0;i.children[s]!=t;++s)o+=i.children[s].chunkSize();return o+t.first}function E(e,t){var o=e.first;e:do{for(var i=0;i<e.children.length;++i){var s=e.children[i],u=s.height;if(t<u){e=s;continue e}t-=u,o+=s.chunkSize()}return o}while(!e.lines);for(var d=0;d<e.lines.length;++d){var h=e.lines[d],m=h.height;if(t<m)break;t-=m}return o+d}function V(e,t){return t>=e.first&&t<e.first+e.size}function Y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function O(e,t,o){if(o===void 0&&(o=null),!(this instanceof O))return new O(e,t,o);this.line=e,this.ch=t,this.sticky=o}function ce(e,t){return e.line-t.line||e.ch-t.ch}function Pe(e,t){return e.sticky==t.sticky&&ce(e,t)==0}function _t(e){return O(e.line,e.ch)}function zt(e,t){return ce(e,t)<0?t:e}function ui(e,t){return ce(e,t)<0?e:t}function Uu(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return O(e.first,0);var o=e.first+e.size-1;return t.line>o?O(o,he(e,o).text.length):bm(t,he(e,t.line).text.length)}function bm(e,t){var o=e.ch;return o==null||o>t?O(e.line,t):o<0?O(e.line,0):e}function ku(e,t){for(var o=[],i=0;i<t.length;i++)o[i]=Se(e,t[i]);return o}var oa=function(e,t){this.state=e,this.lookAhead=t},Zr=function(e,t,o,i){this.state=t,this.doc=e,this.line=o,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};Zr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Zr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zr.fromSaved=function(e,t,o){return t instanceof oa?new Zr(e,be(e.mode,t.state),o,t.lookAhead):new Zr(e,be(e.mode,t),o)},Zr.prototype.save=function(e){var t=e!==!1?be(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new oa(t,this.maxLookAhead):t};function Mu(e,t,o,i){var s=[e.state.modeGen],u={};Vu(e,t.text,e.doc.mode,o,function(b,I){return s.push(b,I)},u,i);for(var d=o.state,h=function(b){o.baseTokens=s;var I=e.state.overlays[b],C=1,B=0;o.state=!0,Vu(e,t.text,I.mode,o,function(L,W){for(var H=C;B<L;){var z=s[C];z>L&&s.splice(C,1,L,s[C+1],z),C+=2,B=Math.min(L,z)}if(W)if(I.opaque)s.splice(H,C-H,L,"overlay "+W),C=H+2;else for(;H<C;H+=2){var ne=s[H+1];s[H+1]=(ne?ne+" ":"")+"overlay "+W}},u),o.state=d,o.baseTokens=null,o.baseTokenPos=1},m=0;m<e.state.overlays.length;++m)h(m);return{styles:s,classes:u.bgClass||u.textClass?u:null}}function Gu(e,t,o){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=no(e,v(t)),s=t.text.length>e.options.maxHighlightLength&&be(e.doc.mode,i.state),u=Mu(e,t,i);s&&(i.state=s),t.stateAfter=i.save(!s),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),o===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function no(e,t,o){var i=e.doc,s=e.display;if(!i.mode.startState)return new Zr(i,!0,t);var u=vm(e,t,o),d=u>i.first&&he(i,u-1).stateAfter,h=d?Zr.fromSaved(i,d,u):new Zr(i,dt(i.mode),u);return i.iter(u,t,function(m){Os(e,m.text,h);var b=h.line;m.stateAfter=b==t-1||b%5==0||b>=s.viewFrom&&b<s.viewTo?h.save():null,h.nextLine()}),o&&(i.modeFrontier=h.line),h}function Os(e,t,o,i){var s=e.doc.mode,u=new Ue(t,e.options.tabSize,o);for(u.start=u.pos=i||0,t==""&&Ou(s,o.state);!u.eol();)Ws(s,u,o.state),u.start=u.pos}function Ou(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var o=Ye(e,t);if(o.mode.blankLine)return o.mode.blankLine(o.state)}}function Ws(e,t,o,i){for(var s=0;s<10;s++){i&&(i[0]=Ye(e,o).mode);var u=e.token(t,o);if(t.pos>t.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wu=function(e,t,o){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=o};function Du(e,t,o,i){var s=e.doc,u=s.mode,d;t=Se(s,t);var h=he(s,t.line),m=no(e,t.line,o),b=new Ue(h.text,e.options.tabSize,m),I;for(i&&(I=[]);(i||b.pos<t.ch)&&!b.eol();)b.start=b.pos,d=Ws(u,b,m.state),i&&I.push(new Wu(b,d,be(s.mode,m.state)));return i?I:new Wu(b,d,m.state)}function Zu(e,t){if(e)for(;;){var o=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!o)break;e=e.slice(0,o.index)+e.slice(o.index+o[0].length);var i=o[1]?"bgClass":"textClass";t[i]==null?t[i]=o[2]:new RegExp("(?:^|\\s)"+o[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+o[2])}return e}function Vu(e,t,o,i,s,u,d){var h=o.flattenSpans;h==null&&(h=e.options.flattenSpans);var m=0,b=null,I=new Ue(t,e.options.tabSize,i),C,B=e.options.addModeClass&&[null];for(t==""&&Zu(Ou(o,i.state),u);!I.eol();){if(I.pos>e.options.maxHighlightLength?(h=!1,d&&Os(e,t,i,I.pos),I.pos=t.length,C=null):C=Zu(Ws(o,I,i.state,B),u),B){var L=B[0].name;L&&(C="m-"+(C?L+" "+C:L))}if(!h||b!=C){for(;m<I.start;)m=Math.min(I.start,m+5e3),s(m,b);b=C}I.start=I.pos}for(;m<I.pos;){var W=Math.min(I.pos,m+5e3);s(W,b),m=W}}function vm(e,t,o){for(var i,s,u=e.doc,d=o?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>d;--h){if(h<=u.first)return u.first;var m=he(u,h-1),b=m.stateAfter;if(b&&(!o||h+(b instanceof oa?b.lookAhead:0)<=u.modeFrontier))return h;var I=ye(m.text,null,e.options.tabSize);(s==null||i>I)&&(s=h-1,i=I)}return s}function ym(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var o=e.first,i=t-1;i>o;i--){var s=he(e,i).stateAfter;if(s&&(!(s instanceof oa)||i+s.lookAhead<t)){o=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,o)}}var Qu=!1,rn=!1;function xm(){Qu=!0}function Tm(){rn=!0}function aa(e,t,o){this.marker=e,this.from=t,this.to=o}function io(e,t){if(e)for(var o=0;o<e.length;++o){var i=e[o];if(i.marker==t)return i}}function Im(e,t){for(var o,i=0;i<e.length;++i)e[i]!=t&&(o||(o=[])).push(e[i]);return o}function Em(e,t,o){var i=o&&window.WeakSet&&(o.markedSpans||(o.markedSpans=new WeakSet));i&&e.markedSpans&&i.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],i&&i.add(e.markedSpans)),t.marker.attachLine(e)}function Cm(e,t,o){var i;if(e)for(var s=0;s<e.length;++s){var u=e[s],d=u.marker,h=u.from==null||(d.inclusiveLeft?u.from<=t:u.from<t);if(h||u.from==t&&d.type=="bookmark"&&(!o||!u.marker.insertLeft)){var m=u.to==null||(d.inclusiveRight?u.to>=t:u.to>t);(i||(i=[])).push(new aa(d,u.from,m?null:u.to))}}return i}function Am(e,t,o){var i;if(e)for(var s=0;s<e.length;++s){var u=e[s],d=u.marker,h=u.to==null||(d.inclusiveRight?u.to>=t:u.to>t);if(h||u.from==t&&d.type=="bookmark"&&(!o||u.marker.insertLeft)){var m=u.from==null||(d.inclusiveLeft?u.from<=t:u.from<t);(i||(i=[])).push(new aa(d,m?null:u.from-t,u.to==null?null:u.to-t))}}return i}function Ds(e,t){if(t.full)return null;var o=V(e,t.from.line)&&he(e,t.from.line).markedSpans,i=V(e,t.to.line)&&he(e,t.to.line).markedSpans;if(!o&&!i)return null;var s=t.from.ch,u=t.to.ch,d=ce(t.from,t.to)==0,h=Cm(o,s,d),m=Am(i,u,d),b=t.text.length==1,I=Te(t.text).length+(b?s:0);if(h)for(var C=0;C<h.length;++C){var B=h[C];if(B.to==null){var L=io(m,B.marker);L?b&&(B.to=L.to==null?null:L.to+I):B.to=s}}if(m)for(var W=0;W<m.length;++W){var H=m[W];if(H.to!=null&&(H.to+=I),H.from==null){var z=io(h,H.marker);z||(H.from=I,b&&(h||(h=[])).push(H))}else H.from+=I,b&&(h||(h=[])).push(H)}h&&(h=Pu(h)),m&&m!=h&&(m=Pu(m));var ne=[h];if(!b){var pe=t.text.length-2,ie;if(pe>0&&h)for(var me=0;me<h.length;++me)h[me].to==null&&(ie||(ie=[])).push(new aa(h[me].marker,null,null));for(var Ae=0;Ae<pe;++Ae)ne.push(ie);ne.push(m)}return ne}function Pu(e){for(var t=0;t<e.length;++t){var o=e[t];o.from!=null&&o.from==o.to&&o.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Rm(e,t,o){var i=null;if(e.iter(t.line,o.line+1,function(L){if(L.markedSpans)for(var W=0;W<L.markedSpans.length;++W){var H=L.markedSpans[W].marker;H.readOnly&&(!i||ue(i,H)==-1)&&(i||(i=[])).push(H)}}),!i)return null;for(var s=[{from:t,to:o}],u=0;u<i.length;++u)for(var d=i[u],h=d.find(0),m=0;m<s.length;++m){var b=s[m];if(!(ce(b.to,h.from)<0||ce(b.from,h.to)>0)){var I=[m,1],C=ce(b.from,h.from),B=ce(b.to,h.to);(C<0||!d.inclusiveLeft&&!C)&&I.push({from:b.from,to:h.from}),(B>0||!d.inclusiveRight&&!B)&&I.push({from:h.to,to:b.to}),s.splice.apply(s,I),m+=I.length-3}}return s}function Hu(e){var t=e.markedSpans;if(t){for(var o=0;o<t.length;++o)t[o].marker.detachLine(e);e.markedSpans=null}}function Ju(e,t){if(t){for(var o=0;o<t.length;++o)t[o].marker.attachLine(e);e.markedSpans=t}}function sa(e){return e.inclusiveLeft?-1:0}function la(e){return e.inclusiveRight?1:0}function Zs(e,t){var o=e.lines.length-t.lines.length;if(o!=0)return o;var i=e.find(),s=t.find(),u=ce(i.from,s.from)||sa(e)-sa(t);if(u)return-u;var d=ce(i.to,s.to)||la(e)-la(t);return d||t.id-e.id}function Xu(e,t){var o=rn&&e.markedSpans,i;if(o)for(var s=void 0,u=0;u<o.length;++u)s=o[u],s.marker.collapsed&&(t?s.from:s.to)==null&&(!i||Zs(i,s.marker)<0)&&(i=s.marker);return i}function Yu(e){return Xu(e,!0)}function ua(e){return Xu(e,!1)}function _m(e,t){var o=rn&&e.markedSpans,i;if(o)for(var s=0;s<o.length;++s){var u=o[s];u.marker.collapsed&&(u.from==null||u.from<t)&&(u.to==null||u.to>t)&&(!i||Zs(i,u.marker)<0)&&(i=u.marker)}return i}function ju(e,t,o,i,s){var u=he(e,t),d=rn&&u.markedSpans;if(d)for(var h=0;h<d.length;++h){var m=d[h];if(m.marker.collapsed){var b=m.marker.find(0),I=ce(b.from,o)||sa(m.marker)-sa(s),C=ce(b.to,i)||la(m.marker)-la(s);if(!(I>=0&&C<=0||I<=0&&C>=0)&&(I<=0&&(m.marker.inclusiveRight&&s.inclusiveLeft?ce(b.to,o)>=0:ce(b.to,o)>0)||I>=0&&(m.marker.inclusiveRight&&s.inclusiveLeft?ce(b.from,i)<=0:ce(b.from,i)<0)))return!0}}}function Lr(e){for(var t;t=Yu(e);)e=t.find(-1,!0).line;return e}function Nm(e){for(var t;t=ua(e);)e=t.find(1,!0).line;return e}function Sm(e){for(var t,o;t=ua(e);)e=t.find(1,!0).line,(o||(o=[])).push(e);return o}function Vs(e,t){var o=he(e,t),i=Lr(o);return o==i?t:v(i)}function zu(e,t){if(t>e.lastLine())return t;var o=he(e,t),i;if(!In(e,o))return t;for(;i=ua(o);)o=i.find(1,!0).line;return v(o)+1}function In(e,t){var o=rn&&t.markedSpans;if(o){for(var i=void 0,s=0;s<o.length;++s)if(i=o[s],!!i.marker.collapsed){if(i.from==null)return!0;if(!i.marker.widgetNode&&i.from==0&&i.marker.inclusiveLeft&&Qs(e,t,i))return!0}}}function Qs(e,t,o){if(o.to==null){var i=o.marker.find(1,!0);return Qs(e,i.line,io(i.line.markedSpans,o.marker))}if(o.marker.inclusiveRight&&o.to==t.text.length)return!0;for(var s=void 0,u=0;u<t.markedSpans.length;++u)if(s=t.markedSpans[u],s.marker.collapsed&&!s.marker.widgetNode&&s.from==o.to&&(s.to==null||s.to!=o.from)&&(s.marker.inclusiveLeft||o.marker.inclusiveRight)&&Qs(e,t,s))return!0}function nn(e){e=Lr(e);for(var t=0,o=e.parent,i=0;i<o.lines.length;++i){var s=o.lines[i];if(s==e)break;t+=s.height}for(var u=o.parent;u;o=u,u=o.parent)for(var d=0;d<u.children.length;++d){var h=u.children[d];if(h==o)break;t+=h.height}return t}function fa(e){if(e.height==0)return 0;for(var t=e.text.length,o,i=e;o=Yu(i);){var s=o.find(0,!0);i=s.from.line,t+=s.from.ch-s.to.ch}for(i=e;o=ua(i);){var u=o.find(0,!0);t-=i.text.length-u.from.ch,i=u.to.line,t+=i.text.length-u.to.ch}return t}function Ps(e){var t=e.display,o=e.doc;t.maxLine=he(o,o.first),t.maxLineLength=fa(t.maxLine),t.maxLineChanged=!0,o.iter(function(i){var s=fa(i);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=i)})}var fi=function(e,t,o){this.text=e,Ju(this,t),this.height=o?o(this):1};fi.prototype.lineNo=function(){return v(this)},xr(fi);function wm(e,t,o,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Hu(e),Ju(e,o);var s=i?i(e):1;s!=e.height&&Dt(e,s)}function Lm(e){e.parent=null,Hu(e)}var Fm={},Bm={};function qu(e,t){if(!e||/^\s*$/.test(e))return null;var o=t.addModeClass?Bm:Fm;return o[e]||(o[e]=e.replace(/\S+/g,"cm-$&"))}function Ku(e,t){var o=ee("span",null,null,T?"padding-right: .1px":null),i={pre:ee("pre",[o],"CodeMirror-line"),content:o,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var u=s?t.rest[s-1]:t.line,d=void 0;i.pos=0,i.addToken=km,Ht(e.display.measure)&&(d=Ne(u,e.doc.direction))&&(i.addToken=Gm(i.addToken,d)),i.map=[];var h=t!=e.display.externalMeasured&&v(u);Om(u,i,Gu(e,u,h)),u.styleClasses&&(u.styleClasses.bgClass&&(i.bgClass=_e(u.styleClasses.bgClass,i.bgClass||"")),u.styleClasses.textClass&&(i.textClass=_e(u.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(li(e.display.measure))),s==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(T){var m=i.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Ke(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=_e(i.pre.className,i.textClass||"")),i}function Um(e){var t=x("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function km(e,t,o,i,s,u,d){if(t){var h=e.splitSpaces?Mm(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,I;if(!m.test(t))e.col+=t.length,I=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,I),g&&y<9&&(b=!0),e.pos+=t.length;else{I=document.createDocumentFragment();for(var C=0;;){m.lastIndex=C;var B=m.exec(t),L=B?B.index-C:t.length-C;if(L){var W=document.createTextNode(h.slice(C,C+L));g&&y<9?I.appendChild(x("span",[W])):I.appendChild(W),e.map.push(e.pos,e.pos+L,W),e.col+=L,e.pos+=L}if(!B)break;C+=L+1;var H=void 0;if(B[0]==" "){var z=e.cm.options.tabSize,ne=z-e.col%z;H=I.appendChild(x("span",Ve(ne),"cm-tab")),H.setAttribute("role","presentation"),H.setAttribute("cm-text"," "),e.col+=ne}else B[0]=="\r"||B[0]==`
20
- `?(H=I.appendChild(x("span",B[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),H.setAttribute("cm-text",B[0]),e.col+=1):(H=e.cm.options.specialCharPlaceholder(B[0]),H.setAttribute("cm-text",B[0]),g&&y<9?I.appendChild(x("span",[H])):I.appendChild(H),e.col+=1);e.map.push(e.pos,e.pos+1,H),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,o||i||s||b||u||d){var pe=o||"";i&&(pe+=i),s&&(pe+=s);var ie=x("span",[I],pe,u);if(d)for(var me in d)d.hasOwnProperty(me)&&me!="style"&&me!="class"&&ie.setAttribute(me,d[me]);return e.content.appendChild(ie)}e.content.appendChild(I)}}function Mm(e,t){if(e.length>1&&!/ /.test(e))return e;for(var o=t,i="",s=0;s<e.length;s++){var u=e.charAt(s);u==" "&&o&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(u="\xA0"),i+=u,o=u==" "}return i}function Gm(e,t){return function(o,i,s,u,d,h,m){s=s?s+" cm-force-border":"cm-force-border";for(var b=o.pos,I=b+i.length;;){for(var C=void 0,B=0;B<t.length&&(C=t[B],!(C.to>b&&C.from<=b));B++);if(C.to>=I)return e(o,i,s,u,d,h,m);e(o,i.slice(0,C.to-b),s,u,null,h,m),u=null,i=i.slice(C.to-b),b=C.to}}}function $u(e,t,o,i){var s=!i&&o.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!i&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",o.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function Om(e,t,o){var i=e.markedSpans,s=e.text,u=0;if(!i){for(var d=1;d<o.length;d+=2)t.addToken(t,s.slice(u,u=o[d]),qu(o[d+1],t.cm.options));return}for(var h=s.length,m=0,b=1,I="",C,B,L=0,W,H,z,ne,pe;;){if(L==m){W=H=z=B="",pe=null,ne=null,L=1/0;for(var ie=[],me=void 0,Ae=0;Ae<i.length;++Ae){var Ee=i[Ae],ke=Ee.marker;if(ke.type=="bookmark"&&Ee.from==m&&ke.widgetNode)ie.push(ke);else if(Ee.from<=m&&(Ee.to==null||Ee.to>m||ke.collapsed&&Ee.to==m&&Ee.from==m)){if(Ee.to!=null&&Ee.to!=m&&L>Ee.to&&(L=Ee.to,H=""),ke.className&&(W+=" "+ke.className),ke.css&&(B=(B?B+";":"")+ke.css),ke.startStyle&&Ee.from==m&&(z+=" "+ke.startStyle),ke.endStyle&&Ee.to==L&&(me||(me=[])).push(ke.endStyle,Ee.to),ke.title&&((pe||(pe={})).title=ke.title),ke.attributes)for(var et in ke.attributes)(pe||(pe={}))[et]=ke.attributes[et];ke.collapsed&&(!ne||Zs(ne.marker,ke)<0)&&(ne=Ee)}else Ee.from>m&&L>Ee.from&&(L=Ee.from)}if(me)for(var Lt=0;Lt<me.length;Lt+=2)me[Lt+1]==L&&(H+=" "+me[Lt]);if(!ne||ne.from==m)for(var ct=0;ct<ie.length;++ct)$u(t,0,ie[ct]);if(ne&&(ne.from||0)==m){if($u(t,(ne.to==null?h+1:ne.to)-m,ne.marker,ne.from==null),ne.to==null)return;ne.to==m&&(ne=!1)}}if(m>=h)break;for(var dr=Math.min(h,L);;){if(I){var $t=m+I.length;if(!ne){var bt=$t>dr?I.slice(0,dr-m):I;t.addToken(t,bt,C?C+W:W,z,m+bt.length==L?H:"",B,pe)}if($t>=dr){I=I.slice(dr-m),m=dr;break}m=$t,z=""}I=s.slice(u,u=o[b++]),C=qu(o[b++],t.cm.options)}}}function ef(e,t,o){this.line=t,this.rest=Sm(t),this.size=this.rest?v(Te(this.rest))-o+1:1,this.node=this.text=null,this.hidden=In(e,t)}function ca(e,t,o){for(var i=[],s,u=t;u<o;u=s){var d=new ef(e.doc,he(e.doc,u),u);s=u+d.size,i.push(d)}return i}var ci=null;function Wm(e){ci?ci.ops.push(e):e.ownsGroup=ci={ops:[e],delayedCallbacks:[]}}function Dm(e){var t=e.delayedCallbacks,o=0;do{for(;o<t.length;o++)t[o].call(null);for(var i=0;i<e.ops.length;i++){var s=e.ops[i];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(o<t.length)}function Zm(e,t){var o=e.ownsGroup;if(o)try{Dm(o)}finally{ci=null,t(o)}}var oo=null;function Nt(e,t){var o=yr(e,t);if(o.length){var i=Array.prototype.slice.call(arguments,2),s;ci?s=ci.delayedCallbacks:oo?s=oo:(s=oo=[],setTimeout(Vm,0));for(var u=function(h){s.push(function(){return o[h].apply(null,i)})},d=0;d<o.length;++d)u(d)}}function Vm(){var e=oo;oo=null;for(var t=0;t<e.length;++t)e[t]()}function tf(e,t,o,i){for(var s=0;s<t.changes.length;s++){var u=t.changes[s];u=="text"?Pm(e,t):u=="gutter"?nf(e,t,o,i):u=="class"?Hs(e,t):u=="widget"&&Hm(e,t,i)}t.changes=null}function ao(e){return e.node==e.text&&(e.node=x("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),g&&y<8&&(e.node.style.zIndex=2)),e.node}function Qm(e,t){var o=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(o&&(o+=" CodeMirror-linebackground"),t.background)o?t.background.className=o:(t.background.parentNode.removeChild(t.background),t.background=null);else if(o){var i=ao(t);t.background=i.insertBefore(x("div",null,o),i.firstChild),e.display.input.setUneditable(t.background)}}function rf(e,t){var o=e.display.externalMeasured;return o&&o.line==t.line?(e.display.externalMeasured=null,t.measure=o.measure,o.built):Ku(e,t)}function Pm(e,t){var o=t.text.className,i=rf(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,Hs(e,t)):o&&(t.text.className=o)}function Hs(e,t){Qm(e,t),t.line.wrapClass?ao(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var o=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=o||""}function nf(e,t,o,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var s=ao(t);t.gutterBackground=x("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),s.insertBefore(t.gutterBackground,t.text)}var u=t.line.gutterMarkers;if(e.options.lineNumbers||u){var d=ao(t),h=t.gutter=x("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(h.setAttribute("aria-hidden","true"),e.display.input.setUneditable(h),d.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!u||!u["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(x("div",Y(e.options,o),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),u)for(var m=0;m<e.display.gutterSpecs.length;++m){var b=e.display.gutterSpecs[m].className,I=u.hasOwnProperty(b)&&u[b];I&&h.appendChild(x("div",[I],"CodeMirror-gutter-elt","left: "+i.gutterLeft[b]+"px; width: "+i.gutterWidth[b]+"px"))}}}function Hm(e,t,o){t.alignable&&(t.alignable=null);for(var i=$("CodeMirror-linewidget"),s=t.node.firstChild,u=void 0;s;s=u)u=s.nextSibling,i.test(s.className)&&t.node.removeChild(s);of(e,t,o)}function Jm(e,t,o,i){var s=rf(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),Hs(e,t),nf(e,t,o,i),of(e,t,i),t.node}function of(e,t,o){if(af(e,t.line,t,o,!0),t.rest)for(var i=0;i<t.rest.length;i++)af(e,t.rest[i],t,o,!1)}function af(e,t,o,i,s){if(t.widgets)for(var u=ao(o),d=0,h=t.widgets;d<h.length;++d){var m=h[d],b=x("div",[m.node],"CodeMirror-linewidget"+(m.className?" "+m.className:""));m.handleMouseEvents||b.setAttribute("cm-ignore-events","true"),Xm(m,b,o,i),e.display.input.setUneditable(b),s&&m.above?u.insertBefore(b,o.gutter||o.text):u.appendChild(b),Nt(m,"redraw")}}function Xm(e,t,o,i){if(e.noHScroll){(o.alignable||(o.alignable=[])).push(t);var s=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(s-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function so(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!de(document.body,e.node)){var o="position: relative;";e.coverGutter&&(o+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(o+="width: "+t.display.wrapper.clientWidth+"px;"),oe(t.display.measure,x("div",[e.node],null,o))}return e.height=e.node.parentNode.offsetHeight}function on(e,t){for(var o=yn(t);o!=e.wrapper;o=o.parentNode)if(!o||o.nodeType==1&&o.getAttribute("cm-ignore-events")=="true"||o.parentNode==e.sizer&&o!=e.mover)return!0}function da(e){return e.lineSpace.offsetTop}function Js(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function sf(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=oe(e.measure,x("pre","x","CodeMirror-line-like")),o=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(o.paddingLeft),right:parseInt(o.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function Vr(e){return Fe-e.display.nativeBarWidth}function Zn(e){return e.display.scroller.clientWidth-Vr(e)-e.display.barWidth}function Xs(e){return e.display.scroller.clientHeight-Vr(e)-e.display.barHeight}function Ym(e,t,o){var i=e.options.lineWrapping,s=i&&Zn(e);if(!t.measure.heights||i&&t.measure.width!=s){var u=t.measure.heights=[];if(i){t.measure.width=s;for(var d=t.text.firstChild.getClientRects(),h=0;h<d.length-1;h++){var m=d[h],b=d[h+1];Math.abs(m.bottom-b.bottom)>2&&u.push((m.bottom+b.top)/2-o.top)}}u.push(o.bottom-o.top)}}function lf(e,t,o){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var s=0;s<e.rest.length;s++)if(v(e.rest[s])>o)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}}function jm(e,t){t=Lr(t);var o=v(t),i=e.display.externalMeasured=new ef(e.doc,t,o);i.lineN=o;var s=i.built=Ku(e,i);return i.text=s.pre,oe(e.display.lineMeasure,s.pre),i}function uf(e,t,o,i){return Qr(e,di(e,t),o,i)}function Ys(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pn(e,t)];var o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size)return o}function di(e,t){var o=v(t),i=Ys(e,o);i&&!i.text?i=null:i&&i.changes&&(tf(e,i,o,$s(e)),e.curOp.forceUpdate=!0),i||(i=jm(e,t));var s=lf(i,t,o);return{line:t,view:i,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function Qr(e,t,o,i,s){t.before&&(o=-1);var u=o+(i||""),d;return t.cache.hasOwnProperty(u)?d=t.cache[u]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ym(e,t.view,t.rect),t.hasHeights=!0),d=qm(e,t,o,i),d.bogus||(t.cache[u]=d)),{left:d.left,right:d.right,top:s?d.rtop:d.top,bottom:s?d.rbottom:d.bottom}}var ff={left:0,right:0,top:0,bottom:0};function cf(e,t,o){for(var i,s,u,d,h,m,b=0;b<e.length;b+=3)if(h=e[b],m=e[b+1],t<h?(s=0,u=1,d="left"):t<m?(s=t-h,u=s+1):(b==e.length-3||t==m&&e[b+3]>t)&&(u=m-h,s=u-1,t>=m&&(d="right")),s!=null){if(i=e[b+2],h==m&&o==(i.insertLeft?"left":"right")&&(d=o),o=="left"&&s==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)i=e[(b-=3)+2],d="left";if(o=="right"&&s==m-h)for(;b<e.length-3&&e[b+3]==e[b+4]&&!e[b+5].insertLeft;)i=e[(b+=3)+2],d="right";break}return{node:i,start:s,end:u,collapse:d,coverStart:h,coverEnd:m}}function zm(e,t){var o=ff;if(t=="left")for(var i=0;i<e.length&&(o=e[i]).left==o.right;i++);else for(var s=e.length-1;s>=0&&(o=e[s]).left==o.right;s--);return o}function qm(e,t,o,i){var s=cf(t.map,o,i),u=s.node,d=s.start,h=s.end,m=s.collapse,b;if(u.nodeType==3){for(var I=0;I<4;I++){for(;d&&qe(t.line.text.charAt(s.coverStart+d));)--d;for(;s.coverStart+h<s.coverEnd&&qe(t.line.text.charAt(s.coverStart+h));)++h;if(g&&y<9&&d==0&&h==s.coverEnd-s.coverStart?b=u.parentNode.getBoundingClientRect():b=zm(D(u,d,h).getClientRects(),i),b.left||b.right||d==0)break;h=d,d=d-1,m="right"}g&&y<11&&(b=Km(e.display.measure,b))}else{d>0&&(m=i="right");var C;e.options.lineWrapping&&(C=u.getClientRects()).length>1?b=C[i=="right"?C.length-1:0]:b=u.getBoundingClientRect()}if(g&&y<9&&!d&&(!b||!b.left&&!b.right)){var B=u.parentNode.getClientRects()[0];B?b={left:B.left,right:B.left+pi(e.display),top:B.top,bottom:B.bottom}:b=ff}for(var L=b.top-t.rect.top,W=b.bottom-t.rect.top,H=(L+W)/2,z=t.view.measure.heights,ne=0;ne<z.length-1&&!(H<z[ne]);ne++);var pe=ne?z[ne-1]:0,ie=z[ne],me={left:(m=="right"?b.right:b.left)-t.rect.left,right:(m=="left"?b.left:b.right)-t.rect.left,top:pe,bottom:ie};return!b.left&&!b.right&&(me.bogus=!0),e.options.singleCursorHeightPerLine||(me.rtop=L,me.rbottom=W),me}function Km(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Tr(e))return t;var o=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*o,right:t.right*o,top:t.top*i,bottom:t.bottom*i}}function df(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function hf(e){e.display.externalMeasure=null,k(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)df(e.display.view[t])}function lo(e){hf(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function pf(e){return A&&G?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function gf(e){return A&&G?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function js(e){var t=Lr(e),o=t.widgets,i=0;if(o)for(var s=0;s<o.length;++s)o[s].above&&(i+=so(o[s]));return i}function ha(e,t,o,i,s){if(!s){var u=js(t);o.top+=u,o.bottom+=u}if(i=="line")return o;i||(i="local");var d=nn(t);if(i=="local"?d+=da(e.display):d-=e.display.viewOffset,i=="page"||i=="window"){var h=e.display.lineSpace.getBoundingClientRect();d+=h.top+(i=="window"?0:gf(re(e)));var m=h.left+(i=="window"?0:pf(re(e)));o.left+=m,o.right+=m}return o.top+=d,o.bottom+=d,o}function mf(e,t,o){if(o=="div")return t;var i=t.left,s=t.top;if(o=="page")i-=pf(re(e)),s-=gf(re(e));else if(o=="local"||!o){var u=e.display.sizer.getBoundingClientRect();i+=u.left,s+=u.top}var d=e.display.lineSpace.getBoundingClientRect();return{left:i-d.left,top:s-d.top}}function pa(e,t,o,i,s){return i||(i=he(e.doc,t.line)),ha(e,i,uf(e,i,t.ch,s),o)}function Fr(e,t,o,i,s,u){i=i||he(e.doc,t.line),s||(s=di(e,i));function d(W,H){var z=Qr(e,s,W,H?"right":"left",u);return H?z.left=z.right:z.right=z.left,ha(e,i,z,o)}var h=Ne(i,e.doc.direction),m=t.ch,b=t.sticky;if(m>=i.text.length?(m=i.text.length,b="before"):m<=0&&(m=0,b="after"),!h)return d(b=="before"?m-1:m,b=="before");function I(W,H,z){var ne=h[H],pe=ne.level==1;return d(z?W-1:W,pe!=z)}var C=vr(h,m,b),B=br,L=I(m,C,b=="before");return B!=null&&(L.other=I(m,B,b!="before")),L}function bf(e,t){var o=0;t=Se(e.doc,t),e.options.lineWrapping||(o=pi(e.display)*t.ch);var i=he(e.doc,t.line),s=nn(i)+da(e.display);return{left:o,right:o,top:s,bottom:s+i.height}}function zs(e,t,o,i,s){var u=O(e,t,o);return u.xRel=s,i&&(u.outside=i),u}function qs(e,t,o){var i=e.doc;if(o+=e.display.viewOffset,o<0)return zs(i.first,0,null,-1,-1);var s=E(i,o),u=i.first+i.size-1;if(s>u)return zs(i.first+i.size-1,he(i,u).text.length,null,1,1);t<0&&(t=0);for(var d=he(i,s);;){var h=$m(e,d,s,t,o),m=_m(d,h.ch+(h.xRel>0||h.outside>0?1:0));if(!m)return h;var b=m.find(1);if(b.line==s)return b;d=he(i,s=b.line)}}function vf(e,t,o,i){i-=js(t);var s=t.text.length,u=ft(function(d){return Qr(e,o,d-1).bottom<=i},s,0);return s=ft(function(d){return Qr(e,o,d).top>i},u,s),{begin:u,end:s}}function yf(e,t,o,i){o||(o=di(e,t));var s=ha(e,t,Qr(e,o,i),"line").top;return vf(e,t,o,s)}function Ks(e,t,o,i){return e.bottom<=o?!1:e.top>o?!0:(i?e.left:e.right)>t}function $m(e,t,o,i,s){s-=nn(t);var u=di(e,t),d=js(t),h=0,m=t.text.length,b=!0,I=Ne(t,e.doc.direction);if(I){var C=(e.options.lineWrapping?t0:e0)(e,t,o,u,I,i,s);b=C.level!=1,h=b?C.from:C.to-1,m=b?C.to:C.from-1}var B=null,L=null,W=ft(function(Ae){var Ee=Qr(e,u,Ae);return Ee.top+=d,Ee.bottom+=d,Ks(Ee,i,s,!1)?(Ee.top<=s&&Ee.left<=i&&(B=Ae,L=Ee),!0):!1},h,m),H,z,ne=!1;if(L){var pe=i-L.left<L.right-i,ie=pe==b;W=B+(ie?0:1),z=ie?"after":"before",H=pe?L.left:L.right}else{!b&&(W==m||W==h)&&W++,z=W==0?"after":W==t.text.length?"before":Qr(e,u,W-(b?1:0)).bottom+d<=s==b?"after":"before";var me=Fr(e,O(o,W,z),"line",t,u);H=me.left,ne=s<me.top?-1:s>=me.bottom?1:0}return W=kt(t.text,W,1),zs(o,W,z,ne,i-H)}function e0(e,t,o,i,s,u,d){var h=ft(function(C){var B=s[C],L=B.level!=1;return Ks(Fr(e,O(o,L?B.to:B.from,L?"before":"after"),"line",t,i),u,d,!0)},0,s.length-1),m=s[h];if(h>0){var b=m.level!=1,I=Fr(e,O(o,b?m.from:m.to,b?"after":"before"),"line",t,i);Ks(I,u,d,!0)&&I.top>d&&(m=s[h-1])}return m}function t0(e,t,o,i,s,u,d){var h=vf(e,t,i,d),m=h.begin,b=h.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var I=null,C=null,B=0;B<s.length;B++){var L=s[B];if(!(L.from>=b||L.to<=m)){var W=L.level!=1,H=Qr(e,i,W?Math.min(b,L.to)-1:Math.max(m,L.from)).right,z=H<u?u-H+1e9:H-u;(!I||C>z)&&(I=L,C=z)}}return I||(I=s[s.length-1]),I.from<m&&(I={from:m,to:I.to,level:I.level}),I.to>b&&(I={from:I.from,to:b,level:I.level}),I}var Vn;function hi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Vn==null){Vn=x("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Vn.appendChild(document.createTextNode("x")),Vn.appendChild(x("br"));Vn.appendChild(document.createTextNode("x"))}oe(e.measure,Vn);var o=Vn.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),k(e.measure),o||1}function pi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=x("span","xxxxxxxxxx"),o=x("pre",[t],"CodeMirror-line-like");oe(e.measure,o);var i=t.getBoundingClientRect(),s=(i.right-i.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function $s(e){for(var t=e.display,o={},i={},s=t.gutters.clientLeft,u=t.gutters.firstChild,d=0;u;u=u.nextSibling,++d){var h=e.display.gutterSpecs[d].className;o[h]=u.offsetLeft+u.clientLeft+s,i[h]=u.clientWidth}return{fixedPos:el(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:o,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function el(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function xf(e){var t=hi(e.display),o=e.options.lineWrapping,i=o&&Math.max(5,e.display.scroller.clientWidth/pi(e.display)-3);return function(s){if(In(e.doc,s))return 0;var u=0;if(s.widgets)for(var d=0;d<s.widgets.length;d++)s.widgets[d].height&&(u+=s.widgets[d].height);return o?u+(Math.ceil(s.text.length/i)||1)*t:u+t}}function tl(e){var t=e.doc,o=xf(e);t.iter(function(i){var s=o(i);s!=i.height&&Dt(i,s)})}function Qn(e,t,o,i){var s=e.display;if(!o&&yn(t).getAttribute("cm-not-content")=="true")return null;var u,d,h=s.lineSpace.getBoundingClientRect();try{u=t.clientX-h.left,d=t.clientY-h.top}catch{return null}var m=qs(e,u,d),b;if(i&&m.xRel>0&&(b=he(e.doc,m.line).text).length==m.ch){var I=ye(b,b.length,e.options.tabSize)-b.length;m=O(m.line,Math.max(0,Math.round((u-sf(e.display).left)/pi(e.display))-I))}return m}function Pn(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var o=e.display.view,i=0;i<o.length;i++)if(t-=o[i].size,t<0)return i}function qt(e,t,o,i){t==null&&(t=e.doc.first),o==null&&(o=e.doc.first+e.doc.size),i||(i=0);var s=e.display;if(i&&o<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)rn&&Vs(e.doc,t)<s.viewTo&&Cn(e);else if(o<=s.viewFrom)rn&&zu(e.doc,o+i)>s.viewFrom?Cn(e):(s.viewFrom+=i,s.viewTo+=i);else if(t<=s.viewFrom&&o>=s.viewTo)Cn(e);else if(t<=s.viewFrom){var u=ga(e,o,o+i,1);u?(s.view=s.view.slice(u.index),s.viewFrom=u.lineN,s.viewTo+=i):Cn(e)}else if(o>=s.viewTo){var d=ga(e,t,t,-1);d?(s.view=s.view.slice(0,d.index),s.viewTo=d.lineN):Cn(e)}else{var h=ga(e,t,t,-1),m=ga(e,o,o+i,1);h&&m?(s.view=s.view.slice(0,h.index).concat(ca(e,h.lineN,m.lineN)).concat(s.view.slice(m.index)),s.viewTo+=i):Cn(e)}var b=s.externalMeasured;b&&(o<b.lineN?b.lineN+=i:t<b.lineN+b.size&&(s.externalMeasured=null))}function En(e,t,o){e.curOp.viewChanged=!0;var i=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(i.externalMeasured=null),!(t<i.viewFrom||t>=i.viewTo)){var u=i.view[Pn(e,t)];if(u.node!=null){var d=u.changes||(u.changes=[]);ue(d,o)==-1&&d.push(o)}}}function Cn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ga(e,t,o,i){var s=Pn(e,t),u,d=e.display.view;if(!rn||o==e.doc.first+e.doc.size)return{index:s,lineN:o};for(var h=e.display.viewFrom,m=0;m<s;m++)h+=d[m].size;if(h!=t){if(i>0){if(s==d.length-1)return null;u=h+d[s].size-t,s++}else u=h-t;t+=u,o+=u}for(;Vs(e.doc,o)!=o;){if(s==(i<0?0:d.length-1))return null;o+=i*d[s-(i<0?1:0)].size,s+=i}return{index:s,lineN:o}}function r0(e,t,o){var i=e.display,s=i.view;s.length==0||t>=i.viewTo||o<=i.viewFrom?(i.view=ca(e,t,o),i.viewFrom=t):(i.viewFrom>t?i.view=ca(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Pn(e,t))),i.viewFrom=t,i.viewTo<o?i.view=i.view.concat(ca(e,i.viewTo,o)):i.viewTo>o&&(i.view=i.view.slice(0,Pn(e,o)))),i.viewTo=o}function Tf(e){for(var t=e.display.view,o=0,i=0;i<t.length;i++){var s=t[i];!s.hidden&&(!s.node||s.changes)&&++o}return o}function uo(e){e.display.input.showSelection(e.display.input.prepareSelection())}function If(e,t){t===void 0&&(t=!0);var o=e.doc,i={},s=i.cursors=document.createDocumentFragment(),u=i.selection=document.createDocumentFragment(),d=e.options.$customCursor;d&&(t=!0);for(var h=0;h<o.sel.ranges.length;h++)if(!(!t&&h==o.sel.primIndex)){var m=o.sel.ranges[h];if(!(m.from().line>=e.display.viewTo||m.to().line<e.display.viewFrom)){var b=m.empty();if(d){var I=d(e,m);I&&rl(e,I,s)}else(b||e.options.showCursorWhenSelecting)&&rl(e,m.head,s);b||n0(e,m,u)}}return i}function rl(e,t,o){var i=Fr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=o.appendChild(x("div","\xA0","CodeMirror-cursor"));if(s.style.left=i.left+"px",s.style.top=i.top+"px",s.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var u=pa(e,t,"div",null,null),d=u.right-u.left;s.style.width=(d>0?d:e.defaultCharWidth())+"px"}if(i.other){var h=o.appendChild(x("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));h.style.display="",h.style.left=i.other.left+"px",h.style.top=i.other.top+"px",h.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function ma(e,t){return e.top-t.top||e.left-t.left}function n0(e,t,o){var i=e.display,s=e.doc,u=document.createDocumentFragment(),d=sf(e.display),h=d.left,m=Math.max(i.sizerWidth,Zn(e)-i.sizer.offsetLeft)-d.right,b=s.direction=="ltr";function I(ie,me,Ae,Ee){me<0&&(me=0),me=Math.round(me),Ee=Math.round(Ee),u.appendChild(x("div",null,"CodeMirror-selected","position: absolute; left: "+ie+`px;
21
- top: `+me+"px; width: "+(Ae??m-ie)+`px;
22
- height: `+(Ee-me)+"px"))}function C(ie,me,Ae){var Ee=he(s,ie),ke=Ee.text.length,et,Lt;function ct(bt,er){return pa(e,O(ie,bt),"div",Ee,er)}function dr(bt,er,Gt){var xt=yf(e,Ee,null,bt),vt=er=="ltr"==(Gt=="after")?"left":"right",ht=Gt=="after"?xt.begin:xt.end-(/\s/.test(Ee.text.charAt(xt.end-1))?2:1);return ct(ht,vt)[vt]}var $t=Ne(Ee,s.direction);return Mt($t,me||0,Ae??ke,function(bt,er,Gt,xt){var vt=Gt=="ltr",ht=ct(bt,vt?"left":"right"),tr=ct(er-1,vt?"right":"left"),_i=me==null&&bt==0,wn=Ae==null&&er==ke,Vt=xt==0,Pr=!$t||xt==$t.length-1;if(tr.top-ht.top<=3){var Ft=(b?_i:wn)&&Vt,Sl=(b?wn:_i)&&Pr,ln=Ft?h:(vt?ht:tr).left,jn=Sl?m:(vt?tr:ht).right;I(ln,ht.top,jn-ln,ht.bottom)}else{var zn,Xt,Ni,wl;vt?(zn=b&&_i&&Vt?h:ht.left,Xt=b?m:dr(bt,Gt,"before"),Ni=b?h:dr(er,Gt,"after"),wl=b&&wn&&Pr?m:tr.right):(zn=b?dr(bt,Gt,"before"):h,Xt=!b&&_i&&Vt?m:ht.right,Ni=!b&&wn&&Pr?h:tr.left,wl=b?dr(er,Gt,"after"):m),I(zn,ht.top,Xt-zn,ht.bottom),ht.bottom<tr.top&&I(h,ht.bottom,null,tr.top),I(Ni,tr.top,wl-Ni,tr.bottom)}(!et||ma(ht,et)<0)&&(et=ht),ma(tr,et)<0&&(et=tr),(!Lt||ma(ht,Lt)<0)&&(Lt=ht),ma(tr,Lt)<0&&(Lt=tr)}),{start:et,end:Lt}}var B=t.from(),L=t.to();if(B.line==L.line)C(B.line,B.ch,L.ch);else{var W=he(s,B.line),H=he(s,L.line),z=Lr(W)==Lr(H),ne=C(B.line,B.ch,z?W.text.length+1:null).end,pe=C(L.line,z?0:null,L.ch).start;z&&(ne.top<pe.top-2?(I(ne.right,ne.top,null,ne.bottom),I(h,pe.top,pe.left,pe.bottom)):I(ne.right,ne.top,pe.left-ne.right,ne.bottom)),ne.bottom<pe.top&&I(h,ne.bottom,null,pe.top)}o.appendChild(u)}function nl(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var o=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||gi(e),t.cursorDiv.style.visibility=(o=!o)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ef(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ol(e))}function il(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&gi(e))},100)}function ol(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ke(e,"focus",e,t),e.state.focused=!0,Oe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),T&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),nl(e))}function gi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ke(e,"blur",e,t),e.state.focused=!1,fe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ba(e){for(var t=e.display,o=t.lineDiv.offsetTop,i=Math.max(0,t.scroller.getBoundingClientRect().top),s=t.lineDiv.getBoundingClientRect().top,u=0,d=0;d<t.view.length;d++){var h=t.view[d],m=e.options.lineWrapping,b=void 0,I=0;if(!h.hidden){if(s+=h.line.height,g&&y<8){var C=h.node.offsetTop+h.node.offsetHeight;b=C-o,o=C}else{var B=h.node.getBoundingClientRect();b=B.bottom-B.top,!m&&h.text.firstChild&&(I=h.text.firstChild.getBoundingClientRect().right-B.left-1)}var L=h.line.height-b;if((L>.005||L<-.005)&&(s<i&&(u-=L),Dt(h.line,b),Cf(h.line),h.rest))for(var W=0;W<h.rest.length;W++)Cf(h.rest[W]);if(I>e.display.sizerWidth){var H=Math.ceil(I/pi(e.display));H>e.display.maxLineLength&&(e.display.maxLineLength=H,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Cf(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var o=e.widgets[t],i=o.node.parentNode;i&&(o.height=i.offsetHeight)}}function va(e,t,o){var i=o&&o.top!=null?Math.max(0,o.top):e.scroller.scrollTop;i=Math.floor(i-da(e));var s=o&&o.bottom!=null?o.bottom:i+e.wrapper.clientHeight,u=E(t,i),d=E(t,s);if(o&&o.ensure){var h=o.ensure.from.line,m=o.ensure.to.line;h<u?(u=h,d=E(t,nn(he(t,h))+e.wrapper.clientHeight)):Math.min(m,t.lastLine())>=d&&(u=E(t,nn(he(t,m))-e.wrapper.clientHeight),d=m)}return{from:u,to:Math.max(d,u+1)}}function i0(e,t){if(!$e(e,"scrollCursorIntoView")){var o=e.display,i=o.sizer.getBoundingClientRect(),s=null,u=o.wrapper.ownerDocument;if(t.top+i.top<0?s=!0:t.bottom+i.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(s=!1),s!=null&&!Z){var d=x("div","\u200B",null,`position: absolute;
23
- top: `+(t.top-o.viewOffset-da(e.display))+`px;
24
- height: `+(t.bottom-t.top+Vr(e)+o.barHeight)+`px;
25
- left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(d),d.scrollIntoView(s),e.display.lineSpace.removeChild(d)}}}function o0(e,t,o,i){i==null&&(i=0);var s;!e.options.lineWrapping&&t==o&&(o=t.sticky=="before"?O(t.line,t.ch+1,"before"):t,t=t.ch?O(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var d=!1,h=Fr(e,t),m=!o||o==t?h:Fr(e,o);s={left:Math.min(h.left,m.left),top:Math.min(h.top,m.top)-i,right:Math.max(h.left,m.left),bottom:Math.max(h.bottom,m.bottom)+i};var b=al(e,s),I=e.doc.scrollTop,C=e.doc.scrollLeft;if(b.scrollTop!=null&&(co(e,b.scrollTop),Math.abs(e.doc.scrollTop-I)>1&&(d=!0)),b.scrollLeft!=null&&(Hn(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-C)>1&&(d=!0)),!d)break}return s}function a0(e,t){var o=al(e,t);o.scrollTop!=null&&co(e,o.scrollTop),o.scrollLeft!=null&&Hn(e,o.scrollLeft)}function al(e,t){var o=e.display,i=hi(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:o.scroller.scrollTop,u=Xs(e),d={};t.bottom-t.top>u&&(t.bottom=t.top+u);var h=e.doc.height+Js(o),m=t.top<i,b=t.bottom>h-i;if(t.top<s)d.scrollTop=m?0:t.top;else if(t.bottom>s+u){var I=Math.min(t.top,(b?h:t.bottom)-u);I!=s&&(d.scrollTop=I)}var C=e.options.fixedGutter?0:o.gutters.offsetWidth,B=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:o.scroller.scrollLeft-C,L=Zn(e)-o.gutters.offsetWidth,W=t.right-t.left>L;return W&&(t.right=t.left+L),t.left<10?d.scrollLeft=0:t.left<B?d.scrollLeft=Math.max(0,t.left+C-(W?0:10)):t.right>L+B-3&&(d.scrollLeft=t.right+(W?0:10)-L),d}function sl(e,t){t!=null&&(ya(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function mi(e){ya(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function fo(e,t,o){(t!=null||o!=null)&&ya(e),t!=null&&(e.curOp.scrollLeft=t),o!=null&&(e.curOp.scrollTop=o)}function s0(e,t){ya(e),e.curOp.scrollToPos=t}function ya(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var o=bf(e,t.from),i=bf(e,t.to);Af(e,o,i,t.margin)}}function Af(e,t,o,i){var s=al(e,{left:Math.min(t.left,o.left),top:Math.min(t.top,o.top)-i,right:Math.max(t.right,o.right),bottom:Math.max(t.bottom,o.bottom)+i});fo(e,s.scrollLeft,s.scrollTop)}function co(e,t){Math.abs(e.doc.scrollTop-t)<2||(a||ul(e,{top:t}),Rf(e,t,!0),a&&ul(e),go(e,100))}function Rf(e,t,o){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!o)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Hn(e,t,o,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((o?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)&&(e.doc.scrollLeft=t,Lf(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ho(e){var t=e.display,o=t.gutters.offsetWidth,i=Math.round(e.doc.height+Js(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?o:0,docHeight:i,scrollHeight:i+Vr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:o}}var Jn=function(e,t,o){this.cm=o;var i=this.vert=x("div",[x("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=x("div",[x("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=s.tabIndex=-1,e(i),e(s),Ie(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ie(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,g&&y<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Jn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,o=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(o){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var s=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=o?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(o?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:o?i:0,bottom:t?i:0}},Jn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Jn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Jn.prototype.zeroWidthHack=function(){var e=q&&!S?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Ge,this.disableVert=new Ge},Jn.prototype.enableZeroWidthBar=function(e,t,o){e.style.visibility="";function i(){var s=e.getBoundingClientRect(),u=o=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,i)}t.set(1e3,i)},Jn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var po=function(){};po.prototype.update=function(){return{bottom:0,right:0}},po.prototype.setScrollLeft=function(){},po.prototype.setScrollTop=function(){},po.prototype.clear=function(){};function bi(e,t){t||(t=ho(e));var o=e.display.barWidth,i=e.display.barHeight;_f(e,t);for(var s=0;s<4&&o!=e.display.barWidth||i!=e.display.barHeight;s++)o!=e.display.barWidth&&e.options.lineWrapping&&ba(e),_f(e,ho(e)),o=e.display.barWidth,i=e.display.barHeight}function _f(e,t){var o=e.display,i=o.scrollbars.update(t);o.sizer.style.paddingRight=(o.barWidth=i.right)+"px",o.sizer.style.paddingBottom=(o.barHeight=i.bottom)+"px",o.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(o.scrollbarFiller.style.display="block",o.scrollbarFiller.style.height=i.bottom+"px",o.scrollbarFiller.style.width=i.right+"px"):o.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(o.gutterFiller.style.display="block",o.gutterFiller.style.height=i.bottom+"px",o.gutterFiller.style.width=t.gutterWidth+"px"):o.gutterFiller.style.display=""}var Nf={native:Jn,null:po};function Sf(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&fe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Nf[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,o){o=="horizontal"?Hn(e,t):co(e,t)},e),e.display.scrollbars.addClass&&Oe(e.display.wrapper,e.display.scrollbars.addClass)}var l0=0;function Xn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++l0,markArrays:null},Wm(e.curOp)}function Yn(e){var t=e.curOp;t&&Zm(t,function(o){for(var i=0;i<o.ops.length;i++)o.ops[i].cm.curOp=null;u0(o)})}function u0(e){for(var t=e.ops,o=0;o<t.length;o++)f0(t[o]);for(var i=0;i<t.length;i++)c0(t[i]);for(var s=0;s<t.length;s++)d0(t[s]);for(var u=0;u<t.length;u++)h0(t[u]);for(var d=0;d<t.length;d++)p0(t[d])}function f0(e){var t=e.cm,o=t.display;m0(t),e.updateMaxLine&&Ps(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<o.viewFrom||e.scrollToPos.to.line>=o.viewTo)||o.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xa(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function c0(e){e.updatedDisplay=e.mustUpdate&&ll(e.cm,e.update)}function d0(e){var t=e.cm,o=t.display;e.updatedDisplay&&ba(t),e.barMeasure=ho(t),o.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=uf(t,o.maxLine,o.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(o.scroller.clientWidth,o.sizer.offsetLeft+e.adjustWidthTo+Vr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,o.sizer.offsetLeft+e.adjustWidthTo-Zn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=o.input.prepareSelection())}function h0(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Hn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var o=e.focus&&e.focus==ge(Ze(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,o),(e.updatedDisplay||e.startHeight!=t.doc.height)&&bi(t,e.barMeasure),e.updatedDisplay&&cl(t,e.barMeasure),e.selectionChanged&&nl(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),o&&Ef(e.cm)}function p0(e){var t=e.cm,o=t.display,i=t.doc;if(e.updatedDisplay&&wf(t,e.update),o.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(o.wheelStartX=o.wheelStartY=null),e.scrollTop!=null&&Rf(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Hn(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=o0(t,Se(i,e.scrollToPos.from),Se(i,e.scrollToPos.to),e.scrollToPos.margin);i0(t,s)}var u=e.maybeHiddenMarkers,d=e.maybeUnhiddenMarkers;if(u)for(var h=0;h<u.length;++h)u[h].lines.length||Ke(u[h],"hide");if(d)for(var m=0;m<d.length;++m)d[m].lines.length&&Ke(d[m],"unhide");o.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ke(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function cr(e,t){if(e.curOp)return t();Xn(e);try{return t()}finally{Yn(e)}}function St(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xn(e);try{return t.apply(e,arguments)}finally{Yn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);Xn(this);try{return e.apply(this,arguments)}finally{Yn(this)}}}function wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Xn(t);try{return e.apply(this,arguments)}finally{Yn(t)}}}function go(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,se(g0,e))}function g0(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var o=+new Date+e.options.workTime,i=no(e,t.highlightFrontier),s=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(i.line>=e.display.viewFrom){var d=u.styles,h=u.text.length>e.options.maxHighlightLength?be(t.mode,i.state):null,m=Mu(e,u,i,!0);h&&(i.state=h),u.styles=m.styles;var b=u.styleClasses,I=m.classes;I?u.styleClasses=I:b&&(u.styleClasses=null);for(var C=!d||d.length!=u.styles.length||b!=I&&(!b||!I||b.bgClass!=I.bgClass||b.textClass!=I.textClass),B=0;!C&&B<d.length;++B)C=d[B]!=u.styles[B];C&&s.push(i.line),u.stateAfter=i.save(),i.nextLine()}else u.text.length<=e.options.maxHighlightLength&&Os(e,u.text,i),u.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>o)return go(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),s.length&&cr(e,function(){for(var u=0;u<s.length;u++)En(e,s[u],"text")})}}var xa=function(e,t,o){var i=e.display;this.viewport=t,this.visible=va(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Zn(e),this.force=o,this.dims=$s(e),this.events=[]};xa.prototype.signal=function(e,t){yt(e,t)&&this.events.push(arguments)},xa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ke.apply(null,this.events[e])};function m0(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Vr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Vr(e)+"px",t.scrollbarsClipped=!0)}function b0(e){if(e.hasFocus())return null;var t=ge(Ze(e));if(!t||!de(e.display.lineDiv,t))return null;var o={activeElt:t};if(window.getSelection){var i=ve(e).getSelection();i.anchorNode&&i.extend&&de(e.display.lineDiv,i.anchorNode)&&(o.anchorNode=i.anchorNode,o.anchorOffset=i.anchorOffset,o.focusNode=i.focusNode,o.focusOffset=i.focusOffset)}return o}function v0(e){if(!(!e||!e.activeElt||e.activeElt==ge(Ce(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&de(document.body,e.anchorNode)&&de(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,o=t.defaultView.getSelection(),i=t.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),o.removeAllRanges(),o.addRange(i),o.extend(e.focusNode,e.focusOffset)}}function ll(e,t){var o=e.display,i=e.doc;if(t.editorIsHidden)return Cn(e),!1;if(!t.force&&t.visible.from>=o.viewFrom&&t.visible.to<=o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>=o.viewTo)&&o.renderedView==o.view&&Tf(e)==0)return!1;Ff(e)&&(Cn(e),t.dims=$s(e));var s=i.first+i.size,u=Math.max(t.visible.from-e.options.viewportMargin,i.first),d=Math.min(s,t.visible.to+e.options.viewportMargin);o.viewFrom<u&&u-o.viewFrom<20&&(u=Math.max(i.first,o.viewFrom)),o.viewTo>d&&o.viewTo-d<20&&(d=Math.min(s,o.viewTo)),rn&&(u=Vs(e.doc,u),d=zu(e.doc,d));var h=u!=o.viewFrom||d!=o.viewTo||o.lastWrapHeight!=t.wrapperHeight||o.lastWrapWidth!=t.wrapperWidth;r0(e,u,d),o.viewOffset=nn(he(e.doc,o.viewFrom)),e.display.mover.style.top=o.viewOffset+"px";var m=Tf(e);if(!h&&m==0&&!t.force&&o.renderedView==o.view&&(o.updateLineNumbers==null||o.updateLineNumbers>=o.viewTo))return!1;var b=b0(e);return m>4&&(o.lineDiv.style.display="none"),y0(e,o.updateLineNumbers,t.dims),m>4&&(o.lineDiv.style.display=""),o.renderedView=o.view,v0(b),k(o.cursorDiv),k(o.selectionDiv),o.gutters.style.height=o.sizer.style.minHeight=0,h&&(o.lastWrapHeight=t.wrapperHeight,o.lastWrapWidth=t.wrapperWidth,go(e,400)),o.updateLineNumbers=null,!0}function wf(e,t){for(var o=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Zn(e)){if(o&&o.top!=null&&(o={top:Math.min(e.doc.height+Js(e.display)-Xs(e),o.top)}),t.visible=va(e.display,e.doc,o),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=va(e.display,e.doc,o));if(!ll(e,t))break;ba(e);var s=ho(e);uo(e),bi(e,s),cl(e,s),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ul(e,t){var o=new xa(e,t);if(ll(e,o)){ba(e),wf(e,o);var i=ho(e);uo(e),bi(e,i),cl(e,i),o.finish()}}function y0(e,t,o){var i=e.display,s=e.options.lineNumbers,u=i.lineDiv,d=u.firstChild;function h(W){var H=W.nextSibling;return T&&q&&e.display.currentWheelTarget==W?W.style.display="none":W.parentNode.removeChild(W),H}for(var m=i.view,b=i.viewFrom,I=0;I<m.length;I++){var C=m[I];if(!C.hidden)if(!C.node||C.node.parentNode!=u){var B=Jm(e,C,b,o);u.insertBefore(B,d)}else{for(;d!=C.node;)d=h(d);var L=s&&t!=null&&t<=b&&C.lineNumber;C.changes&&(ue(C.changes,"gutter")>-1&&(L=!1),tf(e,C,b,o)),L&&(k(C.lineNumber),C.lineNumber.appendChild(document.createTextNode(Y(e.options,b)))),d=C.node.nextSibling}b+=C.size}for(;d;)d=h(d)}function fl(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Nt(e,"gutterChanged",e)}function cl(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Vr(e)+"px"}function Lf(e){var t=e.display,o=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var i=el(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,u=i+"px",d=0;d<o.length;d++)if(!o[d].hidden){e.options.fixedGutter&&(o[d].gutter&&(o[d].gutter.style.left=u),o[d].gutterBackground&&(o[d].gutterBackground.style.left=u));var h=o[d].alignable;if(h)for(var m=0;m<h.length;m++)h[m].style.left=u}e.options.fixedGutter&&(t.gutters.style.left=i+s+"px")}}function Ff(e){if(!e.options.lineNumbers)return!1;var t=e.doc,o=Y(e.options,t.first+t.size-1),i=e.display;if(o.length!=i.lineNumChars){var s=i.measure.appendChild(x("div",[x("div",o)],"CodeMirror-linenumber CodeMirror-gutter-elt")),u=s.firstChild.offsetWidth,d=s.offsetWidth-u;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(u,i.lineGutter.offsetWidth-d)+1,i.lineNumWidth=i.lineNumInnerWidth+d,i.lineNumChars=i.lineNumInnerWidth?o.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",fl(e.display),!0}return!1}function dl(e,t){for(var o=[],i=!1,s=0;s<e.length;s++){var u=e[s],d=null;if(typeof u!="string"&&(d=u.style,u=u.className),u=="CodeMirror-linenumbers")if(t)i=!0;else continue;o.push({className:u,style:d})}return t&&!i&&o.push({className:"CodeMirror-linenumbers",style:null}),o}function Bf(e){var t=e.gutters,o=e.gutterSpecs;k(t),e.lineGutter=null;for(var i=0;i<o.length;++i){var s=o[i],u=s.className,d=s.style,h=t.appendChild(x("div",null,"CodeMirror-gutter "+u));d&&(h.style.cssText=d),u=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=o.length?"":"none",fl(e)}function mo(e){Bf(e.display),qt(e),Lf(e)}function x0(e,t,o,i){var s=this;this.input=o,s.scrollbarFiller=x("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=x("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=ee("div",null,"CodeMirror-code"),s.selectionDiv=x("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=x("div",null,"CodeMirror-cursors"),s.measure=x("div",null,"CodeMirror-measure"),s.lineMeasure=x("div",null,"CodeMirror-measure"),s.lineSpace=ee("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var u=ee("div",[s.lineSpace],"CodeMirror-lines");s.mover=x("div",[u],null,"position: relative"),s.sizer=x("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=x("div",null,null,"position: absolute; height: "+Fe+"px; width: 1px;"),s.gutters=x("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=x("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=x("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),A&&F===105&&(s.wrapper.style.clipPath="inset(0px)"),s.wrapper.setAttribute("translate","no"),g&&y<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!T&&!(a&&J)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=dl(i.gutters,i.lineNumbers),Bf(s),o.init(s)}var Ta=0,an=null;g?an=-.53:a?an=15:A?an=-.7:X&&(an=-1/3);function Uf(e){var t=e.wheelDeltaX,o=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),o==null&&e.detail&&e.axis==e.VERTICAL_AXIS?o=e.detail:o==null&&(o=e.wheelDelta),{x:t,y:o}}function T0(e){var t=Uf(e);return t.x*=an,t.y*=an,t}function kf(e,t){A&&F==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var o=Uf(t),i=o.x,s=o.y,u=an;t.deltaMode===0&&(i=t.deltaX,s=t.deltaY,u=1);var d=e.display,h=d.scroller,m=h.scrollWidth>h.clientWidth,b=h.scrollHeight>h.clientHeight;if(i&&m||s&&b){if(s&&q&&T){e:for(var I=t.target,C=d.view;I!=h;I=I.parentNode)for(var B=0;B<C.length;B++)if(C[B].node==I){e.display.currentWheelTarget=I;break e}}if(i&&!a&&!M&&u!=null){s&&b&&co(e,Math.max(0,h.scrollTop+s*u)),Hn(e,Math.max(0,h.scrollLeft+i*u)),(!s||s&&b)&&At(t),d.wheelStartX=null;return}if(s&&u!=null){var L=s*u,W=e.doc.scrollTop,H=W+d.wrapper.clientHeight;L<0?W=Math.max(0,W+L-50):H=Math.min(e.doc.height,H+L+50),ul(e,{top:W,bottom:H})}Ta<20&&t.deltaMode!==0&&(d.wheelStartX==null?(d.wheelStartX=h.scrollLeft,d.wheelStartY=h.scrollTop,d.wheelDX=i,d.wheelDY=s,setTimeout(function(){if(d.wheelStartX!=null){var z=h.scrollLeft-d.wheelStartX,ne=h.scrollTop-d.wheelStartY,pe=ne&&d.wheelDY&&ne/d.wheelDY||z&&d.wheelDX&&z/d.wheelDX;d.wheelStartX=d.wheelStartY=null,pe&&(an=(an*Ta+pe)/(Ta+1),++Ta)}},200)):(d.wheelDX+=i,d.wheelDY+=s))}}var Ir=function(e,t){this.ranges=e,this.primIndex=t};Ir.prototype.primary=function(){return this.ranges[this.primIndex]},Ir.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var o=this.ranges[t],i=e.ranges[t];if(!Pe(o.anchor,i.anchor)||!Pe(o.head,i.head))return!1}return!0},Ir.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new He(_t(this.ranges[t].anchor),_t(this.ranges[t].head));return new Ir(e,this.primIndex)},Ir.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ir.prototype.contains=function(e,t){t||(t=e);for(var o=0;o<this.ranges.length;o++){var i=this.ranges[o];if(ce(t,i.from())>=0&&ce(e,i.to())<=0)return o}return-1};var He=function(e,t){this.anchor=e,this.head=t};He.prototype.from=function(){return ui(this.anchor,this.head)},He.prototype.to=function(){return zt(this.anchor,this.head)},He.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Br(e,t,o){var i=e&&e.options.selectionsMayTouch,s=t[o];t.sort(function(B,L){return ce(B.from(),L.from())}),o=ue(t,s);for(var u=1;u<t.length;u++){var d=t[u],h=t[u-1],m=ce(h.to(),d.from());if(i&&!d.empty()?m>0:m>=0){var b=ui(h.from(),d.from()),I=zt(h.to(),d.to()),C=h.empty()?d.from()==d.head:h.from()==h.head;u<=o&&--o,t.splice(--u,2,new He(C?I:b,C?b:I))}}return new Ir(t,o)}function An(e,t){return new Ir([new He(e,t||e)],0)}function Rn(e){return e.text?O(e.from.line+e.text.length-1,Te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mf(e,t){if(ce(e,t.from)<0)return e;if(ce(e,t.to)<=0)return Rn(t);var o=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Rn(t).ch-t.to.ch),O(o,i)}function hl(e,t){for(var o=[],i=0;i<e.sel.ranges.length;i++){var s=e.sel.ranges[i];o.push(new He(Mf(s.anchor,t),Mf(s.head,t)))}return Br(e.cm,o,e.sel.primIndex)}function Gf(e,t,o){return e.line==t.line?O(o.line,e.ch-t.ch+o.ch):O(o.line+(e.line-t.line),e.ch)}function I0(e,t,o){for(var i=[],s=O(e.first,0),u=s,d=0;d<t.length;d++){var h=t[d],m=Gf(h.from,s,u),b=Gf(Rn(h),s,u);if(s=h.to,u=b,o=="around"){var I=e.sel.ranges[d],C=ce(I.head,I.anchor)<0;i[d]=new He(C?b:m,C?m:b)}else i[d]=new He(m,m)}return new Ir(i,e.sel.primIndex)}function pl(e){e.doc.mode=xe(e.options,e.doc.modeOption),bo(e)}function bo(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,go(e,100),e.state.modeGen++,e.curOp&&qt(e)}function Of(e,t){return t.from.ch==0&&t.to.ch==0&&Te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function gl(e,t,o,i){function s(pe){return o?o[pe]:null}function u(pe,ie,me){wm(pe,ie,me,i),Nt(pe,"change",pe,t)}function d(pe,ie){for(var me=[],Ae=pe;Ae<ie;++Ae)me.push(new fi(b[Ae],s(Ae),i));return me}var h=t.from,m=t.to,b=t.text,I=he(e,h.line),C=he(e,m.line),B=Te(b),L=s(b.length-1),W=m.line-h.line;if(t.full)e.insert(0,d(0,b.length)),e.remove(b.length,e.size-b.length);else if(Of(e,t)){var H=d(0,b.length-1);u(C,C.text,L),W&&e.remove(h.line,W),H.length&&e.insert(h.line,H)}else if(I==C)if(b.length==1)u(I,I.text.slice(0,h.ch)+B+I.text.slice(m.ch),L);else{var z=d(1,b.length-1);z.push(new fi(B+I.text.slice(m.ch),L,i)),u(I,I.text.slice(0,h.ch)+b[0],s(0)),e.insert(h.line+1,z)}else if(b.length==1)u(I,I.text.slice(0,h.ch)+b[0]+C.text.slice(m.ch),s(0)),e.remove(h.line+1,W);else{u(I,I.text.slice(0,h.ch)+b[0],s(0)),u(C,B+C.text.slice(m.ch),L);var ne=d(1,b.length-1);W>1&&e.remove(h.line+1,W-1),e.insert(h.line+1,ne)}Nt(e,"change",e,t)}function _n(e,t,o){function i(s,u,d){if(s.linked)for(var h=0;h<s.linked.length;++h){var m=s.linked[h];if(m.doc!=u){var b=d&&m.sharedHist;o&&!b||(t(m.doc,b),i(m.doc,s,b))}}}i(e,null,!0)}function Wf(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,tl(e),pl(e),Df(e),e.options.direction=t.direction,e.options.lineWrapping||Ps(e),e.options.mode=t.modeOption,qt(e)}function Df(e){(e.doc.direction=="rtl"?Oe:fe)(e.display.lineDiv,"CodeMirror-rtl")}function E0(e){cr(e,function(){Df(e),qt(e)})}function Ia(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function ml(e,t){var o={from:_t(t.from),to:Rn(t),text:Rt(e,t.from,t.to)};return Qf(e,o,t.from.line,t.to.line+1),_n(e,function(i){return Qf(i,o,t.from.line,t.to.line+1)},!0),o}function Zf(e){for(;e.length;){var t=Te(e);if(t.ranges)e.pop();else break}}function C0(e,t){if(t)return Zf(e.done),Te(e.done);if(e.done.length&&!Te(e.done).ranges)return Te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Te(e.done)}function Vf(e,t,o,i){var s=e.history;s.undone.length=0;var u=+new Date,d,h;if((s.lastOp==i||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(d=C0(s,s.lastOp==i)))h=Te(d.changes),ce(t.from,t.to)==0&&ce(t.from,h.to)==0?h.to=Rn(t):d.changes.push(ml(e,t));else{var m=Te(s.done);for((!m||!m.ranges)&&Ea(e.sel,s.done),d={changes:[ml(e,t)],generation:s.generation},s.done.push(d);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(o),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=u,s.lastOp=s.lastSelOp=i,s.lastOrigin=s.lastSelOrigin=t.origin,h||Ke(e,"historyAdded")}function A0(e,t,o,i){var s=t.charAt(0);return s=="*"||s=="+"&&o.ranges.length==i.ranges.length&&o.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function R0(e,t,o,i){var s=e.history,u=i&&i.origin;o==s.lastSelOp||u&&s.lastSelOrigin==u&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==u||A0(e,u,Te(s.done),t))?s.done[s.done.length-1]=t:Ea(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=u,s.lastSelOp=o,i&&i.clearRedo!==!1&&Zf(s.undone)}function Ea(e,t){var o=Te(t);o&&o.ranges&&o.equals(e)||t.push(e)}function Qf(e,t,o,i){var s=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,o),Math.min(e.first+e.size,i),function(d){d.markedSpans&&((s||(s=t["spans_"+e.id]={}))[u]=d.markedSpans),++u})}function _0(e){if(!e)return null;for(var t,o=0;o<e.length;++o)e[o].marker.explicitlyCleared?t||(t=e.slice(0,o)):t&&t.push(e[o]);return t?t.length?t:null:e}function N0(e,t){var o=t["spans_"+e.id];if(!o)return null;for(var i=[],s=0;s<t.text.length;++s)i.push(_0(o[s]));return i}function Pf(e,t){var o=N0(e,t),i=Ds(e,t);if(!o)return i;if(!i)return o;for(var s=0;s<o.length;++s){var u=o[s],d=i[s];if(u&&d)e:for(var h=0;h<d.length;++h){for(var m=d[h],b=0;b<u.length;++b)if(u[b].marker==m.marker)continue e;u.push(m)}else d&&(o[s]=d)}return o}function vi(e,t,o){for(var i=[],s=0;s<e.length;++s){var u=e[s];if(u.ranges){i.push(o?Ir.prototype.deepCopy.call(u):u);continue}var d=u.changes,h=[];i.push({changes:h});for(var m=0;m<d.length;++m){var b=d[m],I=void 0;if(h.push({from:b.from,to:b.to,text:b.text}),t)for(var C in b)(I=C.match(/^spans_(\d+)$/))&&ue(t,Number(I[1]))>-1&&(Te(h)[C]=b[C],delete b[C])}}return i}function bl(e,t,o,i){if(i){var s=e.anchor;if(o){var u=ce(t,s)<0;u!=ce(o,s)<0?(s=t,t=o):u!=ce(t,o)<0&&(t=o)}return new He(s,t)}else return new He(o||t,t)}function Ca(e,t,o,i,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),Zt(e,new Ir([bl(e.sel.primary(),t,o,s)],0),i)}function Hf(e,t,o){for(var i=[],s=e.cm&&(e.cm.display.shift||e.extend),u=0;u<e.sel.ranges.length;u++)i[u]=bl(e.sel.ranges[u],t[u],null,s);var d=Br(e.cm,i,e.sel.primIndex);Zt(e,d,o)}function vl(e,t,o,i){var s=e.sel.ranges.slice(0);s[t]=o,Zt(e,Br(e.cm,s,e.sel.primIndex),i)}function Jf(e,t,o,i){Zt(e,An(t,o),i)}function S0(e,t,o){var i={ranges:t.ranges,update:function(s){this.ranges=[];for(var u=0;u<s.length;u++)this.ranges[u]=new He(Se(e,s[u].anchor),Se(e,s[u].head))},origin:o&&o.origin};return Ke(e,"beforeSelectionChange",e,i),e.cm&&Ke(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Br(e.cm,i.ranges,i.ranges.length-1):t}function Xf(e,t,o){var i=e.history.done,s=Te(i);s&&s.ranges?(i[i.length-1]=t,Aa(e,t,o)):Zt(e,t,o)}function Zt(e,t,o){Aa(e,t,o),R0(e,e.sel,e.cm?e.cm.curOp.id:NaN,o)}function Aa(e,t,o){(yt(e,"beforeSelectionChange")||e.cm&&yt(e.cm,"beforeSelectionChange"))&&(t=S0(e,t,o));var i=o&&o.bias||(ce(t.primary().head,e.sel.primary().head)<0?-1:1);Yf(e,zf(e,t,i,!0)),!(o&&o.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&mi(e.cm)}function Yf(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,sr(e.cm)),Nt(e,"cursorActivity",e))}function jf(e){Yf(e,zf(e,e.sel,null,!1))}function zf(e,t,o,i){for(var s,u=0;u<t.ranges.length;u++){var d=t.ranges[u],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[u],m=Ra(e,d.anchor,h&&h.anchor,o,i),b=d.head==d.anchor?m:Ra(e,d.head,h&&h.head,o,i);(s||m!=d.anchor||b!=d.head)&&(s||(s=t.ranges.slice(0,u)),s[u]=new He(m,b))}return s?Br(e.cm,s,t.primIndex):t}function yi(e,t,o,i,s){var u=he(e,t.line);if(u.markedSpans)for(var d=0;d<u.markedSpans.length;++d){var h=u.markedSpans[d],m=h.marker,b="selectLeft"in m?!m.selectLeft:m.inclusiveLeft,I="selectRight"in m?!m.selectRight:m.inclusiveRight;if((h.from==null||(b?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(I?h.to>=t.ch:h.to>t.ch))){if(s&&(Ke(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--d;continue}else break;if(!m.atomic)continue;if(o){var C=m.find(i<0?1:-1),B=void 0;if((i<0?I:b)&&(C=qf(e,C,-i,C&&C.line==t.line?u:null)),C&&C.line==t.line&&(B=ce(C,o))&&(i<0?B<0:B>0))return yi(e,C,t,i,s)}var L=m.find(i<0?-1:1);return(i<0?b:I)&&(L=qf(e,L,i,L.line==t.line?u:null)),L?yi(e,L,t,i,s):null}}return t}function Ra(e,t,o,i,s){var u=i||1,d=yi(e,t,o,u,s)||!s&&yi(e,t,o,u,!0)||yi(e,t,o,-u,s)||!s&&yi(e,t,o,-u,!0);return d||(e.cantEdit=!0,O(e.first,0))}function qf(e,t,o,i){return o<0&&t.ch==0?t.line>e.first?Se(e,O(t.line-1)):null:o>0&&t.ch==(i||he(e,t.line)).text.length?t.line<e.first+e.size-1?O(t.line+1,0):null:new O(t.line,t.ch+o)}function Kf(e){e.setSelection(O(e.firstLine(),0),O(e.lastLine()),Me)}function $f(e,t,o){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return o&&(i.update=function(s,u,d,h){s&&(i.from=Se(e,s)),u&&(i.to=Se(e,u)),d&&(i.text=d),h!==void 0&&(i.origin=h)}),Ke(e,"beforeChange",e,i),e.cm&&Ke(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function xi(e,t,o){if(e.cm){if(!e.cm.curOp)return St(e.cm,xi)(e,t,o);if(e.cm.state.suppressEdits)return}if(!((yt(e,"beforeChange")||e.cm&&yt(e.cm,"beforeChange"))&&(t=$f(e,t,!0),!t))){var i=Qu&&!o&&Rm(e,t.from,t.to);if(i)for(var s=i.length-1;s>=0;--s)ec(e,{from:i[s].from,to:i[s].to,text:s?[""]:t.text,origin:t.origin});else ec(e,t)}}function ec(e,t){if(!(t.text.length==1&&t.text[0]==""&&ce(t.from,t.to)==0)){var o=hl(e,t);Vf(e,t,o,e.cm?e.cm.curOp.id:NaN),vo(e,t,o,Ds(e,t));var i=[];_n(e,function(s,u){!u&&ue(i,s.history)==-1&&(ic(s.history,t),i.push(s.history)),vo(s,t,null,Ds(s,t))})}}function _a(e,t,o){var i=e.cm&&e.cm.state.suppressEdits;if(!(i&&!o)){for(var s=e.history,u,d=e.sel,h=t=="undo"?s.done:s.undone,m=t=="undo"?s.undone:s.done,b=0;b<h.length&&(u=h[b],!(o?u.ranges&&!u.equals(e.sel):!u.ranges));b++);if(b!=h.length){for(s.lastOrigin=s.lastSelOrigin=null;;)if(u=h.pop(),u.ranges){if(Ea(u,m),o&&!u.equals(e.sel)){Zt(e,u,{clearRedo:!1});return}d=u}else if(i){h.push(u);return}else break;var I=[];Ea(d,m),m.push({changes:I,generation:s.generation}),s.generation=u.generation||++s.maxGeneration;for(var C=yt(e,"beforeChange")||e.cm&&yt(e.cm,"beforeChange"),B=function(H){var z=u.changes[H];if(z.origin=t,C&&!$f(e,z,!1))return h.length=0,{};I.push(ml(e,z));var ne=H?hl(e,z):Te(h);vo(e,z,ne,Pf(e,z)),!H&&e.cm&&e.cm.scrollIntoView({from:z.from,to:Rn(z)});var pe=[];_n(e,function(ie,me){!me&&ue(pe,ie.history)==-1&&(ic(ie.history,z),pe.push(ie.history)),vo(ie,z,null,Pf(ie,z))})},L=u.changes.length-1;L>=0;--L){var W=B(L);if(W)return W.v}}}}function tc(e,t){if(t!=0&&(e.first+=t,e.sel=new Ir(It(e.sel.ranges,function(s){return new He(O(s.anchor.line+t,s.anchor.ch),O(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm)){qt(e.cm,e.first,e.first-t,t);for(var o=e.cm.display,i=o.viewFrom;i<o.viewTo;i++)En(e.cm,i,"gutter")}}function vo(e,t,o,i){if(e.cm&&!e.cm.curOp)return St(e.cm,vo)(e,t,o,i);if(t.to.line<e.first){tc(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var s=t.text.length-1-(e.first-t.from.line);tc(e,s),t={from:O(e.first,0),to:O(t.to.line+s,t.to.ch),text:[Te(t.text)],origin:t.origin}}var u=e.lastLine();t.to.line>u&&(t={from:t.from,to:O(u,he(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Rt(e,t.from,t.to),o||(o=hl(e,t)),e.cm?w0(e.cm,t,i):gl(e,t,i),Aa(e,o,Me),e.cantEdit&&Ra(e,O(e.firstLine(),0))&&(e.cantEdit=!1)}}function w0(e,t,o){var i=e.doc,s=e.display,u=t.from,d=t.to,h=!1,m=u.line;e.options.lineWrapping||(m=v(Lr(he(i,u.line))),i.iter(m,d.line+1,function(L){if(L==s.maxLine)return h=!0,!0})),i.sel.contains(t.from,t.to)>-1&&sr(e),gl(i,t,o,xf(e)),e.options.lineWrapping||(i.iter(m,u.line+t.text.length,function(L){var W=fa(L);W>s.maxLineLength&&(s.maxLine=L,s.maxLineLength=W,s.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),ym(i,u.line),go(e,400);var b=t.text.length-(d.line-u.line)-1;t.full?qt(e):u.line==d.line&&t.text.length==1&&!Of(e.doc,t)?En(e,u.line,"text"):qt(e,u.line,d.line+1,b);var I=yt(e,"changes"),C=yt(e,"change");if(C||I){var B={from:u,to:d,text:t.text,removed:t.removed,origin:t.origin};C&&Nt(e,"change",e,B),I&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(B)}e.display.selForContextMenu=null}function Ti(e,t,o,i,s){var u;i||(i=o),ce(i,o)<0&&(u=[i,o],o=u[0],i=u[1]),typeof t=="string"&&(t=e.splitLines(t)),xi(e,{from:o,to:i,text:t,origin:s})}function rc(e,t,o,i){o<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function nc(e,t,o,i){for(var s=0;s<e.length;++s){var u=e[s],d=!0;if(u.ranges){u.copied||(u=e[s]=u.deepCopy(),u.copied=!0);for(var h=0;h<u.ranges.length;h++)rc(u.ranges[h].anchor,t,o,i),rc(u.ranges[h].head,t,o,i);continue}for(var m=0;m<u.changes.length;++m){var b=u.changes[m];if(o<b.from.line)b.from=O(b.from.line+i,b.from.ch),b.to=O(b.to.line+i,b.to.ch);else if(t<=b.to.line){d=!1;break}}d||(e.splice(0,s+1),s=0)}}function ic(e,t){var o=t.from.line,i=t.to.line,s=t.text.length-(i-o)-1;nc(e.done,o,i,s),nc(e.undone,o,i,s)}function yo(e,t,o,i){var s=t,u=t;return typeof t=="number"?u=he(e,Uu(e,t)):s=v(t),s==null?null:(i(u,s)&&e.cm&&En(e.cm,s,o),u)}function xo(e){this.lines=e,this.parent=null;for(var t=0,o=0;o<e.length;++o)e[o].parent=this,t+=e[o].height;this.height=t}xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var o=e,i=e+t;o<i;++o){var s=this.lines[o];this.height-=s.height,Lm(s),Nt(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,o){this.height+=o,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,o){for(var i=e+t;e<i;++e)if(o(this.lines[e]))return!0}};function To(e){this.children=e;for(var t=0,o=0,i=0;i<e.length;++i){var s=e[i];t+=s.chunkSize(),o+=s.height,s.parent=this}this.size=t,this.height=o,this.parent=null}To.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var o=0;o<this.children.length;++o){var i=this.children[o],s=i.chunkSize();if(e<s){var u=Math.min(t,s-e),d=i.height;if(i.removeInner(e,u),this.height-=d-i.height,s==u&&(this.children.splice(o--,1),i.parent=null),(t-=u)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var h=[];this.collapse(h),this.children=[new xo(h)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,o){this.size+=t.length,this.height+=o;for(var i=0;i<this.children.length;++i){var s=this.children[i],u=s.chunkSize();if(e<=u){if(s.insertInner(e,t,o),s.lines&&s.lines.length>50){for(var d=s.lines.length%25+25,h=d;h<s.lines.length;){var m=new xo(s.lines.slice(h,h+=25));s.height-=m.height,this.children.splice(++i,0,m),m.parent=this}s.lines=s.lines.slice(0,d),this.maybeSpill()}break}e-=u}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),o=new To(t);if(e.parent){e.size-=o.size,e.height-=o.height;var s=ue(e.parent.children,e);e.parent.children.splice(s+1,0,o)}else{var i=new To(e.children);i.parent=e,e.children=[i,o],e=i}o.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,o){for(var i=0;i<this.children.length;++i){var s=this.children[i],u=s.chunkSize();if(e<u){var d=Math.min(t,u-e);if(s.iterN(e,d,o))return!0;if((t-=d)==0)break;e=0}else e-=u}}};var Io=function(e,t,o){if(o)for(var i in o)o.hasOwnProperty(i)&&(this[i]=o[i]);this.doc=e,this.node=t};Io.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,o=this.line,i=v(o);if(!(i==null||!t)){for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(o.widgets=null);var u=so(this);Dt(o,Math.max(0,o.height-u)),e&&(cr(e,function(){oc(e,o,-u),En(e,i,"widget")}),Nt(e,"lineWidgetCleared",e,this,i))}},Io.prototype.changed=function(){var e=this,t=this.height,o=this.doc.cm,i=this.line;this.height=null;var s=so(this)-t;s&&(In(this.doc,i)||Dt(i,i.height+s),o&&cr(o,function(){o.curOp.forceUpdate=!0,oc(o,i,s),Nt(o,"lineWidgetChanged",o,e,v(i))}))},xr(Io);function oc(e,t,o){nn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&sl(e,o)}function L0(e,t,o,i){var s=new Io(e,o,i),u=e.cm;return u&&s.noHScroll&&(u.display.alignWidgets=!0),yo(e,t,"widget",function(d){var h=d.widgets||(d.widgets=[]);if(s.insertAt==null?h.push(s):h.splice(Math.min(h.length,Math.max(0,s.insertAt)),0,s),s.line=d,u&&!In(e,d)){var m=nn(d)<e.scrollTop;Dt(d,d.height+so(s)),m&&sl(u,s.height),u.curOp.forceUpdate=!0}return!0}),u&&Nt(u,"lineWidgetAdded",u,s,typeof t=="number"?t:v(t)),s}var ac=0,Nn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ac};Nn.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Xn(e),yt(this,"clear")){var o=this.find();o&&Nt(this,"clear",o.from,o.to)}for(var i=null,s=null,u=0;u<this.lines.length;++u){var d=this.lines[u],h=io(d.markedSpans,this);e&&!this.collapsed?En(e,v(d),"text"):e&&(h.to!=null&&(s=v(d)),h.from!=null&&(i=v(d))),d.markedSpans=Im(d.markedSpans,h),h.from==null&&this.collapsed&&!In(this.doc,d)&&e&&Dt(d,hi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var m=0;m<this.lines.length;++m){var b=Lr(this.lines[m]),I=fa(b);I>e.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=I,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&qt(e,i,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&jf(e.doc)),e&&Nt(e,"markerCleared",e,this,i,s),t&&Yn(e),this.parent&&this.parent.clear()}},Nn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var o,i,s=0;s<this.lines.length;++s){var u=this.lines[s],d=io(u.markedSpans,this);if(d.from!=null&&(o=O(t?u:v(u),d.from),e==-1))return o;if(d.to!=null&&(i=O(t?u:v(u),d.to),e==1))return i}return o&&{from:o,to:i}},Nn.prototype.changed=function(){var e=this,t=this.find(-1,!0),o=this,i=this.doc.cm;!t||!i||cr(i,function(){var s=t.line,u=v(t.line),d=Ys(i,u);if(d&&(df(d),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!In(o.doc,s)&&o.height!=null){var h=o.height;o.height=null;var m=so(o)-h;m&&Dt(s,s.height+m)}Nt(i,"markerChanged",i,e)})},Nn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ue(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Nn.prototype.detachLine=function(e){if(this.lines.splice(ue(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xr(Nn);function Ii(e,t,o,i,s){if(i&&i.shared)return F0(e,t,o,i,s);if(e.cm&&!e.cm.curOp)return St(e.cm,Ii)(e,t,o,i,s);var u=new Nn(e,s),d=ce(t,o);if(i&&le(i,u,!1),d>0||d==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=ee("span",[u.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ju(e,t.line,t,o,u)||t.line!=o.line&&ju(e,o.line,t,o,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");Tm()}u.addToHistory&&Vf(e,{from:t,to:o,origin:"markText"},e.sel,NaN);var h=t.line,m=e.cm,b;if(e.iter(h,o.line+1,function(C){m&&u.collapsed&&!m.options.lineWrapping&&Lr(C)==m.display.maxLine&&(b=!0),u.collapsed&&h!=t.line&&Dt(C,0),Em(C,new aa(u,h==t.line?t.ch:null,h==o.line?o.ch:null),e.cm&&e.cm.curOp),++h}),u.collapsed&&e.iter(t.line,o.line+1,function(C){In(e,C)&&Dt(C,0)}),u.clearOnEnter&&Ie(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(xm(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++ac,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)qt(m,t.line,o.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var I=t.line;I<=o.line;I++)En(m,I,"text");u.atomic&&jf(m.doc),Nt(m,"markerAdded",m,u)}return u}var Eo=function(e,t){this.markers=e,this.primary=t;for(var o=0;o<e.length;++o)e[o].parent=this};Eo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Nt(this,"clear")}},Eo.prototype.find=function(e,t){return this.primary.find(e,t)},xr(Eo);function F0(e,t,o,i,s){i=le(i),i.shared=!1;var u=[Ii(e,t,o,i,s)],d=u[0],h=i.widgetNode;return _n(e,function(m){h&&(i.widgetNode=h.cloneNode(!0)),u.push(Ii(m,Se(m,t),Se(m,o),i,s));for(var b=0;b<m.linked.length;++b)if(m.linked[b].isParent)return;d=Te(u)}),new Eo(u,d)}function sc(e){return e.findMarks(O(e.first,0),e.clipPos(O(e.lastLine())),function(t){return t.parent})}function B0(e,t){for(var o=0;o<t.length;o++){var i=t[o],s=i.find(),u=e.clipPos(s.from),d=e.clipPos(s.to);if(ce(u,d)){var h=Ii(e,u,d,i.primary,i.primary.type);i.markers.push(h),h.parent=i}}}function U0(e){for(var t=function(i){var s=e[i],u=[s.primary.doc];_n(s.primary.doc,function(m){return u.push(m)});for(var d=0;d<s.markers.length;d++){var h=s.markers[d];ue(u,h.doc)==-1&&(h.parent=null,s.markers.splice(d--,1))}},o=0;o<e.length;o++)t(o)}var k0=0,Kt=function(e,t,o,i,s){if(!(this instanceof Kt))return new Kt(e,t,o,i,s);o==null&&(o=0),To.call(this,[new xo([new fi("",null)])]),this.first=o,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=o;var u=O(o,0);this.sel=An(u),this.history=new Ia(null),this.id=++k0,this.modeOption=t,this.lineSep=i,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),gl(this,{from:u,to:u,text:e}),Zt(this,An(u),Me)};Kt.prototype=lt(To.prototype,{constructor:Kt,iter:function(e,t,o){o?this.iterN(e-this.first,t-e,o):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var o=0,i=0;i<t.length;++i)o+=t[i].height;this.insertInner(e-this.first,t,o)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Cr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:wt(function(e){var t=O(this.first,0),o=this.first+this.size-1;xi(this,{from:t,to:O(o,he(this,o).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&fo(this.cm,0,0),Zt(this,An(t),Me)}),replaceRange:function(e,t,o,i){t=Se(this,t),o=o?Se(this,o):t,Ti(this,e,t,o,i)},getRange:function(e,t,o){var i=Rt(this,Se(this,e),Se(this,t));return o===!1?i:o===""?i.join(""):i.join(o||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(V(this,e))return he(this,e)},getLineNumber:function(e){return v(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=he(this,e)),Lr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),o;return e==null||e=="head"?o=t.head:e=="anchor"?o=t.anchor:e=="end"||e=="to"||e===!1?o=t.to():o=t.from(),o},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:wt(function(e,t,o){Jf(this,Se(this,typeof e=="number"?O(e,t||0):e),null,o)}),setSelection:wt(function(e,t,o){Jf(this,Se(this,e),Se(this,t||e),o)}),extendSelection:wt(function(e,t,o){Ca(this,Se(this,e),t&&Se(this,t),o)}),extendSelections:wt(function(e,t){Hf(this,ku(this,e),t)}),extendSelectionsBy:wt(function(e,t){var o=It(this.sel.ranges,e);Hf(this,ku(this,o),t)}),setSelections:wt(function(e,t,o){if(e.length){for(var i=[],s=0;s<e.length;s++)i[s]=new He(Se(this,e[s].anchor),Se(this,e[s].head||e[s].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zt(this,Br(this.cm,i,t),o)}}),addSelection:wt(function(e,t,o){var i=this.sel.ranges.slice(0);i.push(new He(Se(this,e),Se(this,t||e))),Zt(this,Br(this.cm,i,i.length-1),o)}),getSelection:function(e){for(var t=this.sel.ranges,o,i=0;i<t.length;i++){var s=Rt(this,t[i].from(),t[i].to());o=o?o.concat(s):s}return e===!1?o:o.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],o=this.sel.ranges,i=0;i<o.length;i++){var s=Rt(this,o[i].from(),o[i].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[i]=s}return t},replaceSelection:function(e,t,o){for(var i=[],s=0;s<this.sel.ranges.length;s++)i[s]=e;this.replaceSelections(i,t,o||"+input")},replaceSelections:wt(function(e,t,o){for(var i=[],s=this.sel,u=0;u<s.ranges.length;u++){var d=s.ranges[u];i[u]={from:d.from(),to:d.to(),text:this.splitLines(e[u]),origin:o}}for(var h=t&&t!="end"&&I0(this,i,t),m=i.length-1;m>=0;m--)xi(this,i[m]);h?Xf(this,h):this.cm&&mi(this.cm)}),undo:wt(function(){_a(this,"undo")}),redo:wt(function(){_a(this,"redo")}),undoSelection:wt(function(){_a(this,"undo",!0)}),redoSelection:wt(function(){_a(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,o=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++o;return{undo:t,redo:o}},clearHistory:function(){var e=this;this.history=new Ia(this.history),_n(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:vi(this.history.done),undone:vi(this.history.undone)}},setHistory:function(e){var t=this.history=new Ia(this.history);t.done=vi(e.done.slice(0),null,!0),t.undone=vi(e.undone.slice(0),null,!0)},setGutterMarker:wt(function(e,t,o){return yo(this,e,"gutter",function(i){var s=i.gutterMarkers||(i.gutterMarkers={});return s[t]=o,!o&&mt(s)&&(i.gutterMarkers=null),!0})}),clearGutter:wt(function(e){var t=this;this.iter(function(o){o.gutterMarkers&&o.gutterMarkers[e]&&yo(t,o,"gutter",function(){return o.gutterMarkers[e]=null,mt(o.gutterMarkers)&&(o.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!V(this,e)||(t=e,e=he(this,e),!e))return null}else if(t=v(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:wt(function(e,t,o){return yo(this,e,t=="gutter"?"gutter":"class",function(i){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[s])i[s]=o;else{if($(o).test(i[s]))return!1;i[s]+=" "+o}return!0})}),removeLineClass:wt(function(e,t,o){return yo(this,e,t=="gutter"?"gutter":"class",function(i){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=i[s];if(u)if(o==null)i[s]=null;else{var d=u.match($(o));if(!d)return!1;var h=d.index+d[0].length;i[s]=u.slice(0,d.index)+(!d.index||h==u.length?"":" ")+u.slice(h)||null}else return!1;return!0})}),addLineWidget:wt(function(e,t,o){return L0(this,e,t,o)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,o){return Ii(this,Se(this,e),Se(this,t),o,o&&o.type||"range")},setBookmark:function(e,t){var o={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Se(this,e),Ii(this,e,e,o,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],o=he(this,e.line).markedSpans;if(o)for(var i=0;i<o.length;++i){var s=o[i];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,o){e=Se(this,e),t=Se(this,t);var i=[],s=e.line;return this.iter(e.line,t.line+1,function(u){var d=u.markedSpans;if(d)for(var h=0;h<d.length;h++){var m=d[h];!(m.to!=null&&s==e.line&&e.ch>=m.to||m.from==null&&s!=e.line||m.from!=null&&s==t.line&&m.from>=t.ch)&&(!o||o(m.marker))&&i.push(m.marker.parent||m.marker)}++s}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var o=t.markedSpans;if(o)for(var i=0;i<o.length;++i)o[i].from!=null&&e.push(o[i].marker)}),e},posFromIndex:function(e){var t,o=this.first,i=this.lineSeparator().length;return this.iter(function(s){var u=s.text.length+i;if(u>e)return t=e,!0;e-=u,++o}),Se(this,O(o,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var o=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+o}),t},copy:function(e){var t=new Kt(Cr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,o=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<o&&(o=e.to);var i=new Kt(Cr(this,t,o),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],B0(i,sc(this)),i},unlinkDoc:function(e){if(e instanceof ot&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var o=this.linked[t];if(o.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),U0(sc(this));break}}if(e.history==this.history){var i=[e.id];_n(e,function(s){return i.push(s.id)},!0),e.history=new Ia(null),e.history.done=vi(this.history.done,i),e.history.undone=vi(this.history.undone,i)}},iterLinkedDocs:function(e){_n(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):jt(e)},lineSeparator:function(){return this.lineSep||`
26
- `},setDirection:wt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&E0(this.cm))})}),Kt.prototype.eachLine=Kt.prototype.iter;var lc=0;function M0(e){var t=this;if(uc(t),!($e(t,e)||on(t.display,e))){At(e),g&&(lc=+new Date);var o=Qn(t,e,!0),i=e.dataTransfer.files;if(!(!o||t.isReadOnly()))if(i&&i.length&&window.FileReader&&window.File)for(var s=i.length,u=Array(s),d=0,h=function(){++d==s&&St(t,function(){o=Se(t.doc,o);var L={from:o,to:o,text:t.doc.splitLines(u.filter(function(W){return W!=null}).join(t.doc.lineSeparator())),origin:"paste"};xi(t.doc,L),Xf(t.doc,An(Se(t.doc,o),Se(t.doc,Rn(L))))})()},m=function(L,W){if(t.options.allowDropFileTypes&&ue(t.options.allowDropFileTypes,L.type)==-1){h();return}var H=new FileReader;H.onerror=function(){return h()},H.onload=function(){var z=H.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(z)){h();return}u[W]=z,h()},H.readAsText(L)},b=0;b<i.length;b++)m(i[b],b);else{if(t.state.draggingText&&t.doc.sel.contains(o)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var I=e.dataTransfer.getData("Text");if(I){var C;if(t.state.draggingText&&!t.state.draggingText.copy&&(C=t.listSelections()),Aa(t.doc,An(o,o)),C)for(var B=0;B<C.length;++B)Ti(t.doc,"",C[B].anchor,C[B].head,"drag");t.replaceSelection(I,"around","paste"),t.display.input.focus()}}catch{}}}}function G0(e,t){if(g&&(!e.state.draggingText||+new Date-lc<100)){Wr(t);return}if(!($e(e,t)||on(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!X)){var o=x("img",null,null,"position: fixed; left: 0; top: 0;");o.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",M&&(o.width=o.height=1,e.display.wrapper.appendChild(o),o._top=o.offsetTop),t.dataTransfer.setDragImage(o,0,0),M&&o.parentNode.removeChild(o)}}function O0(e,t){var o=Qn(e,t);if(o){var i=document.createDocumentFragment();rl(e,o,i),e.display.dragCursor||(e.display.dragCursor=x("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),oe(e.display.dragCursor,i)}}function uc(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function fc(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),o=[],i=0;i<t.length;i++){var s=t[i].CodeMirror;s&&o.push(s)}o.length&&o[0].operation(function(){for(var u=0;u<o.length;u++)e(o[u])})}}var cc=!1;function W0(){cc||(D0(),cc=!0)}function D0(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,fc(Z0)},100))}),Ie(window,"blur",function(){return fc(gi)})}function Z0(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Sn={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Co=0;Co<10;Co++)Sn[Co+48]=Sn[Co+96]=String(Co);for(var Na=65;Na<=90;Na++)Sn[Na]=String.fromCharCode(Na);for(var Ao=1;Ao<=12;Ao++)Sn[Ao+111]=Sn[Ao+63235]="F"+Ao;var sn={};sn.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},sn.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},sn.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},sn.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},sn.default=q?sn.macDefault:sn.pcDefault;function V0(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var o,i,s,u,d=0;d<t.length-1;d++){var h=t[d];if(/^(cmd|meta|m)$/i.test(h))u=!0;else if(/^a(lt)?$/i.test(h))o=!0;else if(/^(c|ctrl|control)$/i.test(h))i=!0;else if(/^s(hift)?$/i.test(h))s=!0;else throw new Error("Unrecognized modifier name: "+h)}return o&&(e="Alt-"+e),i&&(e="Ctrl-"+e),u&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function Q0(e){var t={};for(var o in e)if(e.hasOwnProperty(o)){var i=e[o];if(/^(name|fallthrough|(de|at)tach)$/.test(o))continue;if(i=="..."){delete e[o];continue}for(var s=It(o.split(" "),V0),u=0;u<s.length;u++){var d=void 0,h=void 0;u==s.length-1?(h=s.join(" "),d=i):(h=s.slice(0,u+1).join(" "),d="...");var m=t[h];if(!m)t[h]=d;else if(m!=d)throw new Error("Inconsistent bindings for "+h)}delete e[o]}for(var b in t)e[b]=t[b];return e}function Ei(e,t,o,i){t=Sa(t);var s=t.call?t.call(e,i):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&o(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ei(e,t.fallthrough,o,i);for(var u=0;u<t.fallthrough.length;u++){var d=Ei(e,t.fallthrough[u],o,i);if(d)return d}}}function dc(e){var t=typeof e=="string"?e:Sn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function hc(e,t,o){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(w?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(w?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!o&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function pc(e,t){if(M&&e.keyCode==34&&e.char)return!1;var o=Sn[e.keyCode];return o==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(o=e.code),hc(o,e,t))}function Sa(e){return typeof e=="string"?sn[e]:e}function Ci(e,t){for(var o=e.doc.sel.ranges,i=[],s=0;s<o.length;s++){for(var u=t(o[s]);i.length&&ce(u.from,Te(i).to)<=0;){var d=i.pop();if(ce(d.from,u.from)<0){u.from=d.from;break}}i.push(u)}cr(e,function(){for(var h=i.length-1;h>=0;h--)Ti(e.doc,"",i[h].from,i[h].to,"+delete");mi(e)})}function yl(e,t,o){var i=kt(e.text,t+o,o);return i<0||i>e.text.length?null:i}function xl(e,t,o){var i=yl(e,t.ch,o);return i==null?null:new O(t.line,i,o<0?"after":"before")}function Tl(e,t,o,i,s){if(e){t.doc.direction=="rtl"&&(s=-s);var u=Ne(o,t.doc.direction);if(u){var d=s<0?Te(u):u[0],h=s<0==(d.level==1),m=h?"after":"before",b;if(d.level>0||t.doc.direction=="rtl"){var I=di(t,o);b=s<0?o.text.length-1:0;var C=Qr(t,I,b).top;b=ft(function(B){return Qr(t,I,B).top==C},s<0==(d.level==1)?d.from:d.to-1,b),m=="before"&&(b=yl(o,b,1))}else b=s<0?d.to:d.from;return new O(i,b,m)}}return new O(i,s<0?o.text.length:0,s<0?"before":"after")}function P0(e,t,o,i){var s=Ne(t,e.doc.direction);if(!s)return xl(t,o,i);o.ch>=t.text.length?(o.ch=t.text.length,o.sticky="before"):o.ch<=0&&(o.ch=0,o.sticky="after");var u=vr(s,o.ch,o.sticky),d=s[u];if(e.doc.direction=="ltr"&&d.level%2==0&&(i>0?d.to>o.ch:d.from<o.ch))return xl(t,o,i);var h=function(ne,pe){return yl(t,ne instanceof O?ne.ch:ne,pe)},m,b=function(ne){return e.options.lineWrapping?(m=m||di(e,t),yf(e,t,m,ne)):{begin:0,end:t.text.length}},I=b(o.sticky=="before"?h(o,-1):o.ch);if(e.doc.direction=="rtl"||d.level==1){var C=d.level==1==i<0,B=h(o,C?1:-1);if(B!=null&&(C?B<=d.to&&B<=I.end:B>=d.from&&B>=I.begin)){var L=C?"before":"after";return new O(o.line,B,L)}}var W=function(ne,pe,ie){for(var me=function(et,Lt){return Lt?new O(o.line,h(et,1),"before"):new O(o.line,et,"after")};ne>=0&&ne<s.length;ne+=pe){var Ae=s[ne],Ee=pe>0==(Ae.level!=1),ke=Ee?ie.begin:h(ie.end,-1);if(Ae.from<=ke&&ke<Ae.to||(ke=Ee?Ae.from:h(Ae.to,-1),ie.begin<=ke&&ke<ie.end))return me(ke,Ee)}},H=W(u+i,i,I);if(H)return H;var z=i>0?I.end:h(I.begin,-1);return z!=null&&!(i>0&&z==t.text.length)&&(H=W(i>0?0:s.length-1,i,b(z)),H)?H:null}var Ro={selectAll:Kf,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Me)},killLine:function(e){return Ci(e,function(t){if(t.empty()){var o=he(e.doc,t.head.line).text.length;return t.head.ch==o&&t.head.line<e.lastLine()?{from:t.head,to:O(t.head.line+1,0)}:{from:t.head,to:O(t.head.line,o)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ci(e,function(t){return{from:O(t.from().line,0),to:Se(e.doc,O(t.to().line+1,0))}})},delLineLeft:function(e){return Ci(e,function(t){return{from:O(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ci(e,function(t){var o=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:o},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return Ci(e,function(t){var o=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:o},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(O(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(O(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return gc(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return mc(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return H0(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:o},"div")},Re)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:o},"div")},Re)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var o=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:o},"div");return i.ch<e.getLine(i.line).search(/\S/)?mc(e,t.head):i},Re)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],o=e.listSelections(),i=e.options.tabSize,s=0;s<o.length;s++){var u=o[s].from(),d=ye(e.getLine(u.line),u.ch,i);t.push(Ve(i-d%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return cr(e,function(){for(var t=e.listSelections(),o=[],i=0;i<t.length;i++)if(t[i].empty()){var s=t[i].head,u=he(e.doc,s.line).text;if(u){if(s.ch==u.length&&(s=new O(s.line,s.ch-1)),s.ch>0)s=new O(s.line,s.ch+1),e.replaceRange(u.charAt(s.ch-1)+u.charAt(s.ch-2),O(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var d=he(e.doc,s.line-1).text;d&&(s=new O(s.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+d.charAt(d.length-1),O(s.line-1,d.length-1),s,"+transpose"))}}o.push(new He(s,s))}e.setSelections(o)})},newlineAndIndent:function(e){return cr(e,function(){for(var t=e.listSelections(),o=t.length-1;o>=0;o--)e.replaceRange(e.doc.lineSeparator(),t[o].anchor,t[o].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);mi(e)})},openLine:function(e){return e.replaceSelection(`
27
- `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function gc(e,t){var o=he(e.doc,t),i=Lr(o);return i!=o&&(t=v(i)),Tl(!0,e,i,t,1)}function H0(e,t){var o=he(e.doc,t),i=Nm(o);return i!=o&&(t=v(i)),Tl(!0,e,o,t,-1)}function mc(e,t){var o=gc(e,t.line),i=he(e.doc,o.line),s=Ne(i,e.doc.direction);if(!s||s[0].level==0){var u=Math.max(o.ch,i.text.search(/\S/)),d=t.line==o.line&&t.ch<=u&&t.ch;return O(o.line,d?0:u,o.sticky)}return o}function wa(e,t,o){if(typeof t=="string"&&(t=Ro[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o&&(e.display.shift=!1),s=t(e)!=Je}finally{e.display.shift=i,e.state.suppressEdits=!1}return s}function J0(e,t,o){for(var i=0;i<e.state.keyMaps.length;i++){var s=Ei(t,e.state.keyMaps[i],o,e);if(s)return s}return e.options.extraKeys&&Ei(t,e.options.extraKeys,o,e)||Ei(t,e.options.keyMap,o,e)}var X0=new Ge;function _o(e,t,o,i){var s=e.state.keySeq;if(s){if(dc(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:X0.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),bc(e,s+" "+t,o,i))return!0}return bc(e,t,o,i)}function bc(e,t,o,i){var s=J0(e,t,i);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&Nt(e,"keyHandled",e,t,o),(s=="handled"||s=="multi")&&(At(o),nl(e)),!!s}function vc(e,t){var o=pc(t,!0);return o?t.shiftKey&&!e.state.keySeq?_o(e,"Shift-"+o,t,function(i){return wa(e,i,!0)})||_o(e,o,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return wa(e,i)}):_o(e,o,t,function(i){return wa(e,i)}):!1}function Y0(e,t,o){return _o(e,"'"+o+"'",t,function(i){return wa(e,i,!0)})}var Il=null;function yc(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=ge(Ze(t)),!$e(t,e))){g&&y<11&&e.keyCode==27&&(e.returnValue=!1);var o=e.keyCode;t.display.shift=o==16||e.shiftKey;var i=vc(t,e);M&&(Il=i?o:null,!i&&o==88&&!xn&&(q?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),a&&!q&&!i&&o==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),o==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&j0(t)}}function j0(e){var t=e.display.lineDiv;Oe(t,"CodeMirror-crosshair");function o(i){(i.keyCode==18||!i.altKey)&&(fe(t,"CodeMirror-crosshair"),Ct(document,"keyup",o),Ct(document,"mouseover",o))}Ie(document,"keyup",o),Ie(document,"mouseover",o)}function xc(e){e.keyCode==16&&(this.doc.sel.shift=!1),$e(this,e)}function Tc(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(on(t.display,e)||$e(t,e)||e.ctrlKey&&!e.altKey||q&&e.metaKey)){var o=e.keyCode,i=e.charCode;if(M&&o==Il){Il=null,At(e);return}if(!(M&&(!e.which||e.which<10)&&vc(t,e))){var s=String.fromCharCode(i??o);s!="\b"&&(Y0(t,e,s)||t.display.input.onKeyPress(e))}}}var z0=400,El=function(e,t,o){this.time=e,this.pos=t,this.button=o};El.prototype.compare=function(e,t,o){return this.time+z0>e&&ce(t,this.pos)==0&&o==this.button};var No,So;function q0(e,t){var o=+new Date;return So&&So.compare(o,e,t)?(No=So=null,"triple"):No&&No.compare(o,e,t)?(So=new El(o,e,t),No=null,"double"):(No=new El(o,e,t),So=null,"single")}function Ic(e){var t=this,o=t.display;if(!($e(t,e)||o.activeTouch&&o.input.supportsTouch())){if(o.input.ensurePolled(),o.shift=e.shiftKey,on(o,e)){T||(o.scroller.draggable=!1,setTimeout(function(){return o.scroller.draggable=!0},100));return}if(!Cl(t,e)){var i=Qn(t,e),s=Yt(e),u=i?q0(i,s):"single";ve(t).focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),!(i&&K0(t,s,i,u,e))&&(s==1?i?eb(t,i,u,e):yn(e)==o.scroller&&At(e):s==2?(i&&Ca(t.doc,i),setTimeout(function(){return o.input.focus()},20)):s==3&&(P?t.display.input.onContextMenu(e):il(t)))}}}function K0(e,t,o,i,s){var u="Click";return i=="double"?u="Double"+u:i=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,_o(e,hc(u,s),s,function(d){if(typeof d=="string"&&(d=Ro[d]),!d)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=d(e,o)!=Je}finally{e.state.suppressEdits=!1}return h})}function $0(e,t,o){var i=e.getOption("configureMouse"),s=i?i(e,t,o):{};if(s.unit==null){var u=te?o.shiftKey&&o.metaKey:o.altKey;s.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||o.shiftKey),s.addNew==null&&(s.addNew=q?o.metaKey:o.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(q?o.altKey:o.ctrlKey)),s}function eb(e,t,o,i){g?setTimeout(se(Ef,e),0):e.curOp.focus=ge(Ze(e));var s=$0(e,o,i),u=e.doc.sel,d;e.options.dragDrop&&si&&!e.isReadOnly()&&o=="single"&&(d=u.contains(t))>-1&&(ce((d=u.ranges[d]).from(),t)<0||t.xRel>0)&&(ce(d.to(),t)>0||t.xRel<0)?tb(e,i,t,s):rb(e,i,t,s)}function tb(e,t,o,i){var s=e.display,u=!1,d=St(e,function(b){T&&(s.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:il(e)),Ct(s.wrapper.ownerDocument,"mouseup",d),Ct(s.wrapper.ownerDocument,"mousemove",h),Ct(s.scroller,"dragstart",m),Ct(s.scroller,"drop",d),u||(At(b),i.addNew||Ca(e.doc,o,null,null,i.extend),T&&!X||g&&y==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),h=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};T&&(s.scroller.draggable=!0),e.state.draggingText=d,d.copy=!i.moveOnDrag,Ie(s.wrapper.ownerDocument,"mouseup",d),Ie(s.wrapper.ownerDocument,"mousemove",h),Ie(s.scroller,"dragstart",m),Ie(s.scroller,"drop",d),e.state.delayingBlurEvent=!0,setTimeout(function(){return s.input.focus()},20),s.scroller.dragDrop&&s.scroller.dragDrop()}function Ec(e,t,o){if(o=="char")return new He(t,t);if(o=="word")return e.findWordAt(t);if(o=="line")return new He(O(t.line,0),Se(e.doc,O(t.line+1,0)));var i=o(e,t);return new He(i.from,i.to)}function rb(e,t,o,i){g&&il(e);var s=e.display,u=e.doc;At(t);var d,h,m=u.sel,b=m.ranges;if(i.addNew&&!i.extend?(h=u.sel.contains(o),h>-1?d=b[h]:d=new He(o,o)):(d=u.sel.primary(),h=u.sel.primIndex),i.unit=="rectangle")i.addNew||(d=new He(o,o)),o=Qn(e,t,!0,!0),h=-1;else{var I=Ec(e,o,i.unit);i.extend?d=bl(d,I.anchor,I.head,i.extend):d=I}i.addNew?h==-1?(h=b.length,Zt(u,Br(e,b.concat([d]),h),{scroll:!1,origin:"*mouse"})):b.length>1&&b[h].empty()&&i.unit=="char"&&!i.extend?(Zt(u,Br(e,b.slice(0,h).concat(b.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):vl(u,h,d,Le):(h=0,Zt(u,new Ir([d],0),Le),m=u.sel);var C=o;function B(ie){if(ce(C,ie)!=0)if(C=ie,i.unit=="rectangle"){for(var me=[],Ae=e.options.tabSize,Ee=ye(he(u,o.line).text,o.ch,Ae),ke=ye(he(u,ie.line).text,ie.ch,Ae),et=Math.min(Ee,ke),Lt=Math.max(Ee,ke),ct=Math.min(o.line,ie.line),dr=Math.min(e.lastLine(),Math.max(o.line,ie.line));ct<=dr;ct++){var $t=he(u,ct).text,bt=De($t,et,Ae);et==Lt?me.push(new He(O(ct,bt),O(ct,bt))):$t.length>bt&&me.push(new He(O(ct,bt),O(ct,De($t,Lt,Ae))))}me.length||me.push(new He(o,o)),Zt(u,Br(e,m.ranges.slice(0,h).concat(me),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ie)}else{var er=d,Gt=Ec(e,ie,i.unit),xt=er.anchor,vt;ce(Gt.anchor,xt)>0?(vt=Gt.head,xt=ui(er.from(),Gt.anchor)):(vt=Gt.anchor,xt=zt(er.to(),Gt.head));var ht=m.ranges.slice(0);ht[h]=nb(e,new He(Se(u,xt),vt)),Zt(u,Br(e,ht,h),Le)}}var L=s.wrapper.getBoundingClientRect(),W=0;function H(ie){var me=++W,Ae=Qn(e,ie,!0,i.unit=="rectangle");if(Ae)if(ce(Ae,C)!=0){e.curOp.focus=ge(Ze(e)),B(Ae);var Ee=va(s,u);(Ae.line>=Ee.to||Ae.line<Ee.from)&&setTimeout(St(e,function(){W==me&&H(ie)}),150)}else{var ke=ie.clientY<L.top?-20:ie.clientY>L.bottom?20:0;ke&&setTimeout(St(e,function(){W==me&&(s.scroller.scrollTop+=ke,H(ie))}),50)}}function z(ie){e.state.selectingText=!1,W=1/0,ie&&(At(ie),s.input.focus()),Ct(s.wrapper.ownerDocument,"mousemove",ne),Ct(s.wrapper.ownerDocument,"mouseup",pe),u.history.lastSelOrigin=null}var ne=St(e,function(ie){ie.buttons===0||!Yt(ie)?z(ie):H(ie)}),pe=St(e,z);e.state.selectingText=pe,Ie(s.wrapper.ownerDocument,"mousemove",ne),Ie(s.wrapper.ownerDocument,"mouseup",pe)}function nb(e,t){var o=t.anchor,i=t.head,s=he(e.doc,o.line);if(ce(o,i)==0&&o.sticky==i.sticky)return t;var u=Ne(s);if(!u)return t;var d=vr(u,o.ch,o.sticky),h=u[d];if(h.from!=o.ch&&h.to!=o.ch)return t;var m=d+(h.from==o.ch==(h.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(i.line!=o.line)b=(i.line-o.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var I=vr(u,i.ch,i.sticky),C=I-d||(i.ch-o.ch)*(h.level==1?-1:1);I==m-1||I==m?b=C<0:b=C>0}var B=u[m+(b?-1:0)],L=b==(B.level==1),W=L?B.from:B.to,H=L?"after":"before";return o.ch==W&&o.sticky==H?t:new He(new O(o.line,W,H),i)}function Cc(e,t,o,i){var s,u;if(t.touches)s=t.touches[0].clientX,u=t.touches[0].clientY;else try{s=t.clientX,u=t.clientY}catch{return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&At(t);var d=e.display,h=d.lineDiv.getBoundingClientRect();if(u>h.bottom||!yt(e,o))return pt(t);u-=h.top-d.viewOffset;for(var m=0;m<e.display.gutterSpecs.length;++m){var b=d.gutters.childNodes[m];if(b&&b.getBoundingClientRect().right>=s){var I=E(e.doc,u),C=e.display.gutterSpecs[m];return Ke(e,o,e,I,C.className,t),pt(t)}}}function Cl(e,t){return Cc(e,t,"gutterClick",!0)}function Ac(e,t){on(e.display,t)||ib(e,t)||$e(e,t,"contextmenu")||P||e.display.input.onContextMenu(t)}function ib(e,t){return yt(e,"gutterContextMenu")?Cc(e,t,"gutterContextMenu",!1):!1}function Rc(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),lo(e)}var Ai={toString:function(){return"CodeMirror.Init"}},_c={},La={};function ob(e){var t=e.optionHandlers;function o(i,s,u,d){e.defaults[i]=s,u&&(t[i]=d?function(h,m,b){b!=Ai&&u(h,m,b)}:u)}e.defineOption=o,e.Init=Ai,o("value","",function(i,s){return i.setValue(s)},!0),o("mode",null,function(i,s){i.doc.modeOption=s,pl(i)},!0),o("indentUnit",2,pl,!0),o("indentWithTabs",!1),o("smartIndent",!0),o("tabSize",4,function(i){bo(i),lo(i),qt(i)},!0),o("lineSeparator",null,function(i,s){if(i.doc.lineSep=s,!!s){var u=[],d=i.doc.first;i.doc.iter(function(m){for(var b=0;;){var I=m.text.indexOf(s,b);if(I==-1)break;b=I+s.length,u.push(O(d,I))}d++});for(var h=u.length-1;h>=0;h--)Ti(i.doc,s,u[h],O(u[h].line,u[h].ch+s.length))}}),o("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(i,s,u){i.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),u!=Ai&&i.refresh()}),o("specialCharPlaceholder",Um,function(i){return i.refresh()},!0),o("electricChars",!0),o("inputStyle",J?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),o("spellcheck",!1,function(i,s){return i.getInputField().spellcheck=s},!0),o("autocorrect",!1,function(i,s){return i.getInputField().autocorrect=s},!0),o("autocapitalize",!1,function(i,s){return i.getInputField().autocapitalize=s},!0),o("rtlMoveVisually",!ae),o("wholeLineUpdateBefore",!0),o("theme","default",function(i){Rc(i),mo(i)},!0),o("keyMap","default",function(i,s,u){var d=Sa(s),h=u!=Ai&&Sa(u);h&&h.detach&&h.detach(i,d),d.attach&&d.attach(i,h||null)}),o("extraKeys",null),o("configureMouse",null),o("lineWrapping",!1,sb,!0),o("gutters",[],function(i,s){i.display.gutterSpecs=dl(s,i.options.lineNumbers),mo(i)},!0),o("fixedGutter",!0,function(i,s){i.display.gutters.style.left=s?el(i.display)+"px":"0",i.refresh()},!0),o("coverGutterNextToScrollbar",!1,function(i){return bi(i)},!0),o("scrollbarStyle","native",function(i){Sf(i),bi(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),o("lineNumbers",!1,function(i,s){i.display.gutterSpecs=dl(i.options.gutters,s),mo(i)},!0),o("firstLineNumber",1,mo,!0),o("lineNumberFormatter",function(i){return i},mo,!0),o("showCursorWhenSelecting",!1,uo,!0),o("resetSelectionOnContextMenu",!0),o("lineWiseCopyCut",!0),o("pasteLinesPerSelection",!0),o("selectionsMayTouch",!1),o("readOnly",!1,function(i,s){s=="nocursor"&&(gi(i),i.display.input.blur()),i.display.input.readOnlyChanged(s)}),o("screenReaderLabel",null,function(i,s){s=s===""?null:s,i.display.input.screenReaderLabelChanged(s)}),o("disableInput",!1,function(i,s){s||i.display.input.reset()},!0),o("dragDrop",!0,ab),o("allowDropFileTypes",null),o("cursorBlinkRate",530),o("cursorScrollMargin",0),o("cursorHeight",1,uo,!0),o("singleCursorHeightPerLine",!0,uo,!0),o("workTime",100),o("workDelay",100),o("flattenSpans",!0,bo,!0),o("addModeClass",!1,bo,!0),o("pollInterval",100),o("undoDepth",200,function(i,s){return i.doc.history.undoDepth=s}),o("historyEventDelay",1250),o("viewportMargin",10,function(i){return i.refresh()},!0),o("maxHighlightLength",1e4,bo,!0),o("moveInputWithCursor",!0,function(i,s){s||i.display.input.resetPosition()}),o("tabindex",null,function(i,s){return i.display.input.getField().tabIndex=s||""}),o("autofocus",null),o("direction","ltr",function(i,s){return i.doc.setDirection(s)},!0),o("phrases",null)}function ab(e,t,o){var i=o&&o!=Ai;if(!t!=!i){var s=e.display.dragFunctions,u=t?Ie:Ct;u(e.display.scroller,"dragstart",s.start),u(e.display.scroller,"dragenter",s.enter),u(e.display.scroller,"dragover",s.over),u(e.display.scroller,"dragleave",s.leave),u(e.display.scroller,"drop",s.drop)}}function sb(e){e.options.lineWrapping?(Oe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(fe(e.display.wrapper,"CodeMirror-wrap"),Ps(e)),tl(e),qt(e),lo(e),setTimeout(function(){return bi(e)},100)}function ot(e,t){var o=this;if(!(this instanceof ot))return new ot(e,t);this.options=t=t?le(t):{},le(_c,t,!1);var i=t.value;typeof i=="string"?i=new Kt(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var s=new ot.inputStyles[t.inputStyle](this),u=this.display=new x0(e,i,s,t);u.wrapper.CodeMirror=this,Rc(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Sf(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Ge,keySeq:null,specialChars:null},t.autofocus&&!J&&u.input.focus(),g&&y<11&&setTimeout(function(){return o.display.input.reset(!0)},20),lb(this),W0(),Xn(this),this.curOp.forceUpdate=!0,Wf(this,i),t.autofocus&&!J||this.hasFocus()?setTimeout(function(){o.hasFocus()&&!o.state.focused&&ol(o)},20):gi(this);for(var d in La)La.hasOwnProperty(d)&&La[d](this,t[d],Ai);Ff(this),t.finishInit&&t.finishInit(this);for(var h=0;h<Al.length;++h)Al[h](this);Yn(this),T&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}ot.defaults=_c,ot.optionHandlers=La;function lb(e){var t=e.display;Ie(t.scroller,"mousedown",St(e,Ic)),g&&y<11?Ie(t.scroller,"dblclick",St(e,function(m){if(!$e(e,m)){var b=Qn(e,m);if(!(!b||Cl(e,m)||on(e.display,m))){At(m);var I=e.findWordAt(b);Ca(e.doc,I.anchor,I.head)}}})):Ie(t.scroller,"dblclick",function(m){return $e(e,m)||At(m)}),Ie(t.scroller,"contextmenu",function(m){return Ac(e,m)}),Ie(t.input.getField(),"contextmenu",function(m){t.scroller.contains(m.target)||Ac(e,m)});var o,i={end:0};function s(){t.activeTouch&&(o=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function u(m){if(m.touches.length!=1)return!1;var b=m.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(m,b){if(b.left==null)return!0;var I=b.left-m.left,C=b.top-m.top;return I*I+C*C>20*20}Ie(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Cl(e,m)){t.input.ensurePolled(),clearTimeout(o);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-i.end<=300?i:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!on(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var I=e.coordsChar(t.activeTouch,"page"),C;!b.prev||d(b,b.prev)?C=new He(I,I):!b.prev.prev||d(b,b.prev.prev)?C=e.findWordAt(I):C=new He(O(I.line,0),Se(e.doc,O(I.line+1,0))),e.setSelection(C.anchor,C.head),e.focus(),At(m)}s()}),Ie(t.scroller,"touchcancel",s),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(co(e,t.scroller.scrollTop),Hn(e,t.scroller.scrollLeft,!0),Ke(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(m){return kf(e,m)}),Ie(t.scroller,"DOMMouseScroll",function(m){return kf(e,m)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||Wr(m)},over:function(m){$e(e,m)||(O0(e,m),Wr(m))},start:function(m){return G0(e,m)},drop:St(e,M0),leave:function(m){$e(e,m)||uc(e)}};var h=t.input.getField();Ie(h,"keyup",function(m){return xc.call(e,m)}),Ie(h,"keydown",St(e,yc)),Ie(h,"keypress",St(e,Tc)),Ie(h,"focus",function(m){return ol(e,m)}),Ie(h,"blur",function(m){return gi(e,m)})}var Al=[];ot.defineInitHook=function(e){return Al.push(e)};function wo(e,t,o,i){var s=e.doc,u;o==null&&(o="add"),o=="smart"&&(s.mode.indent?u=no(e,t).state:o="prev");var d=e.options.tabSize,h=he(s,t),m=ye(h.text,null,d);h.stateAfter&&(h.stateAfter=null);var b=h.text.match(/^\s*/)[0],I;if(!i&&!/\S/.test(h.text))I=0,o="not";else if(o=="smart"&&(I=s.mode.indent(u,h.text.slice(b.length),h.text),I==Je||I>150)){if(!i)return;o="prev"}o=="prev"?t>s.first?I=ye(he(s,t-1).text,null,d):I=0:o=="add"?I=m+e.options.indentUnit:o=="subtract"?I=m-e.options.indentUnit:typeof o=="number"&&(I=m+o),I=Math.max(0,I);var C="",B=0;if(e.options.indentWithTabs)for(var L=Math.floor(I/d);L;--L)B+=d,C+=" ";if(B<I&&(C+=Ve(I-B)),C!=b)return Ti(s,C,O(t,0),O(t,b.length),"+input"),h.stateAfter=null,!0;for(var W=0;W<s.sel.ranges.length;W++){var H=s.sel.ranges[W];if(H.head.line==t&&H.head.ch<b.length){var z=O(t,b.length);vl(s,W,new He(z,z));break}}}var Ur=null;function Fa(e){Ur=e}function Rl(e,t,o,i,s){var u=e.doc;e.display.shift=!1,i||(i=u.sel);var d=+new Date-200,h=s=="paste"||e.state.pasteIncoming>d,m=jt(t),b=null;if(h&&i.ranges.length>1)if(Ur&&Ur.text.join(`
28
- `)==t){if(i.ranges.length%Ur.text.length==0){b=[];for(var I=0;I<Ur.text.length;I++)b.push(u.splitLines(Ur.text[I]))}}else m.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(b=It(m,function(ne){return[ne]}));for(var C=e.curOp.updateInput,B=i.ranges.length-1;B>=0;B--){var L=i.ranges[B],W=L.from(),H=L.to();L.empty()&&(o&&o>0?W=O(W.line,W.ch-o):e.state.overwrite&&!h?H=O(H.line,Math.min(he(u,H.line).text.length,H.ch+Te(m).length)):h&&Ur&&Ur.lineWise&&Ur.text.join(`
29
- `)==m.join(`
30
- `)&&(W=H=O(W.line,0)));var z={from:W,to:H,text:b?b[B%b.length]:m,origin:s||(h?"paste":e.state.cutIncoming>d?"cut":"+input")};xi(e.doc,z),Nt(e,"inputRead",e,z)}t&&!h&&Sc(e,t),mi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=C),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Nc(e,t){var o=e.clipboardData&&e.clipboardData.getData("Text");if(o)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&cr(t,function(){return Rl(t,o,0,null,"paste")}),!0}function Sc(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var o=e.doc.sel,i=o.ranges.length-1;i>=0;i--){var s=o.ranges[i];if(!(s.head.ch>100||i&&o.ranges[i-1].head.line==s.head.line)){var u=e.getModeAt(s.head),d=!1;if(u.electricChars){for(var h=0;h<u.electricChars.length;h++)if(t.indexOf(u.electricChars.charAt(h))>-1){d=wo(e,s.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(he(e.doc,s.head.line).text.slice(0,s.head.ch))&&(d=wo(e,s.head.line,"smart"));d&&Nt(e,"electricInput",e,s.head.line)}}}function wc(e){for(var t=[],o=[],i=0;i<e.doc.sel.ranges.length;i++){var s=e.doc.sel.ranges[i].head.line,u={anchor:O(s,0),head:O(s+1,0)};o.push(u),t.push(e.getRange(u.anchor,u.head))}return{text:t,ranges:o}}function _l(e,t,o,i){e.setAttribute("autocorrect",o?"on":"off"),e.setAttribute("autocapitalize",i?"on":"off"),e.setAttribute("spellcheck",!!t)}function Lc(){var e=x("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=x("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return T?e.style.width="1000px":e.setAttribute("wrap","off"),_&&(e.style.border="1px solid black"),t}function ub(e){var t=e.optionHandlers,o=e.helpers={};e.prototype={constructor:e,focus:function(){ve(this).focus(),this.display.input.focus()},setOption:function(i,s){var u=this.options,d=u[i];u[i]==s&&i!="mode"||(u[i]=s,t.hasOwnProperty(i)&&St(this,t[i])(this,s,d),Ke(this,"optionChange",this,i))},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,s){this.state.keyMaps[s?"push":"unshift"](Sa(i))},removeKeyMap:function(i){for(var s=this.state.keyMaps,u=0;u<s.length;++u)if(s[u]==i||s[u].name==i)return s.splice(u,1),!0},addOverlay:Jt(function(i,s){var u=i.token?i:e.getMode(this.options,i);if(u.startState)throw new Error("Overlays may not be stateful.");Et(this.state.overlays,{mode:u,modeSpec:i,opaque:s&&s.opaque,priority:s&&s.priority||0},function(d){return d.priority}),this.state.modeGen++,qt(this)}),removeOverlay:Jt(function(i){for(var s=this.state.overlays,u=0;u<s.length;++u){var d=s[u].modeSpec;if(d==i||typeof i=="string"&&d.name==i){s.splice(u,1),this.state.modeGen++,qt(this);return}}}),indentLine:Jt(function(i,s,u){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),V(this.doc,i)&&wo(this,i,s,u)}),indentSelection:Jt(function(i){for(var s=this.doc.sel.ranges,u=-1,d=0;d<s.length;d++){var h=s[d];if(h.empty())h.head.line>u&&(wo(this,h.head.line,i,!0),u=h.head.line,d==this.doc.sel.primIndex&&mi(this));else{var m=h.from(),b=h.to(),I=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var C=I;C<u;++C)wo(this,C,i);var B=this.doc.sel.ranges;m.ch==0&&s.length==B.length&&B[d].from().ch>0&&vl(this.doc,d,new He(m,B[d].to()),Me)}}}),getTokenAt:function(i,s){return Du(this,i,s)},getLineTokens:function(i,s){return Du(this,O(i),s,!0)},getTokenTypeAt:function(i){i=Se(this.doc,i);var s=Gu(this,he(this.doc,i.line)),u=0,d=(s.length-1)/2,h=i.ch,m;if(h==0)m=s[2];else for(;;){var b=u+d>>1;if((b?s[b*2-1]:0)>=h)d=b;else if(s[b*2+1]<h)u=b+1;else{m=s[b*2+2];break}}var I=m?m.indexOf("overlay "):-1;return I<0?m:I==0?null:m.slice(0,I-1)},getModeAt:function(i){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(i).state).mode:s},getHelper:function(i,s){return this.getHelpers(i,s)[0]},getHelpers:function(i,s){var u=[];if(!o.hasOwnProperty(s))return u;var d=o[s],h=this.getModeAt(i);if(typeof h[s]=="string")d[h[s]]&&u.push(d[h[s]]);else if(h[s])for(var m=0;m<h[s].length;m++){var b=d[h[s][m]];b&&u.push(b)}else h.helperType&&d[h.helperType]?u.push(d[h.helperType]):d[h.name]&&u.push(d[h.name]);for(var I=0;I<d._global.length;I++){var C=d._global[I];C.pred(h,this)&&ue(u,C.val)==-1&&u.push(C.val)}return u},getStateAfter:function(i,s){var u=this.doc;return i=Uu(u,i??u.first+u.size-1),no(this,i+1,s).state},cursorCoords:function(i,s){var u,d=this.doc.sel.primary();return i==null?u=d.head:typeof i=="object"?u=Se(this.doc,i):u=i?d.from():d.to(),Fr(this,u,s||"page")},charCoords:function(i,s){return pa(this,Se(this.doc,i),s||"page")},coordsChar:function(i,s){return i=mf(this,i,s||"page"),qs(this,i.left,i.top)},lineAtHeight:function(i,s){return i=mf(this,{top:i,left:0},s||"page").top,E(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,s,u){var d=!1,h;if(typeof i=="number"){var m=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>m&&(i=m,d=!0),h=he(this.doc,i)}else h=i;return ha(this,h,{top:0,left:0},s||"page",u||d).top+(d?this.doc.height-nn(h):0)},defaultTextHeight:function(){return hi(this.display)},defaultCharWidth:function(){return pi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,s,u,d,h){var m=this.display;i=Fr(this,Se(this.doc,i));var b=i.bottom,I=i.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),m.sizer.appendChild(s),d=="over")b=i.top;else if(d=="above"||d=="near"){var C=Math.max(m.wrapper.clientHeight,this.doc.height),B=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(d=="above"||i.bottom+s.offsetHeight>C)&&i.top>s.offsetHeight?b=i.top-s.offsetHeight:i.bottom+s.offsetHeight<=C&&(b=i.bottom),I+s.offsetWidth>B&&(I=B-s.offsetWidth)}s.style.top=b+"px",s.style.left=s.style.right="",h=="right"?(I=m.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(h=="left"?I=0:h=="middle"&&(I=(m.sizer.clientWidth-s.offsetWidth)/2),s.style.left=I+"px"),u&&a0(this,{left:I,top:b,right:I+s.offsetWidth,bottom:b+s.offsetHeight})},triggerOnKeyDown:Jt(yc),triggerOnKeyPress:Jt(Tc),triggerOnKeyUp:xc,triggerOnMouseDown:Jt(Ic),execCommand:function(i){if(Ro.hasOwnProperty(i))return Ro[i].call(null,this)},triggerElectric:Jt(function(i){Sc(this,i)}),findPosH:function(i,s,u,d){var h=1;s<0&&(h=-1,s=-s);for(var m=Se(this.doc,i),b=0;b<s&&(m=Nl(this.doc,m,h,u,d),!m.hitSide);++b);return m},moveH:Jt(function(i,s){var u=this;this.extendSelectionsBy(function(d){return u.display.shift||u.doc.extend||d.empty()?Nl(u.doc,d.head,i,s,u.options.rtlMoveVisually):i<0?d.from():d.to()},Re)}),deleteH:Jt(function(i,s){var u=this.doc.sel,d=this.doc;u.somethingSelected()?d.replaceSelection("",null,"+delete"):Ci(this,function(h){var m=Nl(d,h.head,i,s,!1);return i<0?{from:m,to:h.head}:{from:h.head,to:m}})}),findPosV:function(i,s,u,d){var h=1,m=d;s<0&&(h=-1,s=-s);for(var b=Se(this.doc,i),I=0;I<s;++I){var C=Fr(this,b,"div");if(m==null?m=C.left:C.left=m,b=Fc(this,C,h,u),b.hitSide)break}return b},moveV:Jt(function(i,s){var u=this,d=this.doc,h=[],m=!this.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(I){if(m)return i<0?I.from():I.to();var C=Fr(u,I.head,"div");I.goalColumn!=null&&(C.left=I.goalColumn),h.push(C.left);var B=Fc(u,C,i,s);return s=="page"&&I==d.sel.primary()&&sl(u,pa(u,B,"div").top-C.top),B},Re),h.length)for(var b=0;b<d.sel.ranges.length;b++)d.sel.ranges[b].goalColumn=h[b]}),findWordAt:function(i){var s=this.doc,u=he(s,i.line).text,d=i.ch,h=i.ch;if(u){var m=this.getHelper(i,"wordChars");(i.sticky=="before"||h==u.length)&&d?--d:++h;for(var b=u.charAt(d),I=Xe(b,m)?function(C){return Xe(C,m)}:/\s/.test(b)?function(C){return/\s/.test(C)}:function(C){return!/\s/.test(C)&&!Xe(C)};d>0&&I(u.charAt(d-1));)--d;for(;h<u.length&&I(u.charAt(h));)++h}return new He(O(i.line,d),O(i.line,h))},toggleOverwrite:function(i){i!=null&&i==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Oe(this.display.cursorDiv,"CodeMirror-overwrite"):fe(this.display.cursorDiv,"CodeMirror-overwrite"),Ke(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==ge(Ze(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(i,s){fo(this,i,s)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-Vr(this)-this.display.barHeight,width:i.scrollWidth-Vr(this)-this.display.barWidth,clientHeight:Xs(this),clientWidth:Zn(this)}},scrollIntoView:Jt(function(i,s){i==null?(i={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof i=="number"?i={from:O(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=s||0,i.from.line!=null?s0(this,i):Af(this,i.from,i.to,i.margin)}),setSize:Jt(function(i,s){var u=this,d=function(m){return typeof m=="number"||/^\d+$/.test(String(m))?m+"px":m};i!=null&&(this.display.wrapper.style.width=d(i)),s!=null&&(this.display.wrapper.style.height=d(s)),this.options.lineWrapping&&hf(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(m){if(m.widgets){for(var b=0;b<m.widgets.length;b++)if(m.widgets[b].noHScroll){En(u,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,Ke(this,"refresh",this)}),operation:function(i){return cr(this,i)},startOperation:function(){return Xn(this)},endOperation:function(){return Yn(this)},refresh:Jt(function(){var i=this.display.cachedTextHeight;qt(this),this.curOp.forceUpdate=!0,lo(this),fo(this,this.doc.scrollLeft,this.doc.scrollTop),fl(this.display),(i==null||Math.abs(i-hi(this.display))>.5||this.options.lineWrapping)&&tl(this),Ke(this,"refresh",this)}),swapDoc:Jt(function(i){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Wf(this,i),lo(this),this.display.input.reset(),fo(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,Nt(this,"swapDoc",this,s),s}),phrase:function(i){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,i)?s[i]:i},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},xr(e),e.registerHelper=function(i,s,u){o.hasOwnProperty(i)||(o[i]=e[i]={_global:[]}),o[i][s]=u},e.registerGlobalHelper=function(i,s,u,d){e.registerHelper(i,s,d),o[i]._global.push({pred:u,val:d})}}function Nl(e,t,o,i,s){var u=t,d=o,h=he(e,t.line),m=s&&e.direction=="rtl"?-o:o;function b(){var pe=t.line+m;return pe<e.first||pe>=e.first+e.size?!1:(t=new O(pe,t.ch,t.sticky),h=he(e,pe))}function I(pe){var ie;if(i=="codepoint"){var me=h.text.charCodeAt(t.ch+(o>0?0:-1));if(isNaN(me))ie=null;else{var Ae=o>0?me>=55296&&me<56320:me>=56320&&me<57343;ie=new O(t.line,Math.max(0,Math.min(h.text.length,t.ch+o*(Ae?2:1))),-o)}}else s?ie=P0(e.cm,h,t,o):ie=xl(h,t,o);if(ie==null)if(!pe&&b())t=Tl(s,e.cm,h,t.line,m);else return!1;else t=ie;return!0}if(i=="char"||i=="codepoint")I();else if(i=="column")I(!0);else if(i=="word"||i=="group")for(var C=null,B=i=="group",L=e.cm&&e.cm.getHelper(t,"wordChars"),W=!0;!(o<0&&!I(!W));W=!1){var H=h.text.charAt(t.ch)||`
31
- `,z=Xe(H,L)?"w":B&&H==`
32
- `?"n":!B||/\s/.test(H)?null:"p";if(B&&!W&&!z&&(z="s"),C&&C!=z){o<0&&(o=1,I(),t.sticky="after");break}if(z&&(C=z),o>0&&!I(!W))break}var ne=Ra(e,t,u,d,!0);return Pe(u,ne)&&(ne.hitSide=!0),ne}function Fc(e,t,o,i){var s=e.doc,u=t.left,d;if(i=="page"){var h=Math.min(e.display.wrapper.clientHeight,ve(e).innerHeight||s(e).documentElement.clientHeight),m=Math.max(h-.5*hi(e.display),3);d=(o>0?t.bottom:t.top)+o*m}else i=="line"&&(d=o>0?t.bottom+3:t.top-3);for(var b;b=qs(e,u,d),!!b.outside;){if(o<0?d<=0:d>=s.height){b.hitSide=!0;break}d+=o*5}return b}var je=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ge,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};je.prototype.init=function(e){var t=this,o=this,i=o.cm,s=o.div=e.lineDiv;s.contentEditable=!0,_l(s,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function u(h){for(var m=h.target;m;m=m.parentNode){if(m==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}Ie(s,"paste",function(h){!u(h)||$e(i,h)||Nc(h,i)||y<=11&&setTimeout(St(i,function(){return t.updateFromDOM()}),20)}),Ie(s,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),Ie(s,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),Ie(s,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(s,"touchstart",function(){return o.forceCompositionEnd()}),Ie(s,"input",function(){t.composing||t.readFromDOMSoon()});function d(h){if(!(!u(h)||$e(i,h))){if(i.somethingSelected())Fa({lineWise:!1,text:i.getSelections()}),h.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var m=wc(i);Fa({lineWise:!0,text:m.text}),h.type=="cut"&&i.operation(function(){i.setSelections(m.ranges,0,Me),i.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var b=Ur.text.join(`
33
- `);if(h.clipboardData.setData("Text",b),h.clipboardData.getData("Text")==b){h.preventDefault();return}}var I=Lc(),C=I.firstChild;_l(C),i.display.lineSpace.insertBefore(I,i.display.lineSpace.firstChild),C.value=Ur.text.join(`
34
- `);var B=ge(Ce(s));we(C),setTimeout(function(){i.display.lineSpace.removeChild(I),B.focus(),B==s&&o.showPrimarySelection()},50)}}Ie(s,"copy",d),Ie(s,"cut",d)},je.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},je.prototype.prepareSelection=function(){var e=If(this.cm,!1);return e.focus=ge(Ce(this.div))==this.div,e},je.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},je.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},je.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,o=t.doc.sel.primary(),i=o.from(),s=o.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var u=Ba(t,e.anchorNode,e.anchorOffset),d=Ba(t,e.focusNode,e.focusOffset);if(!(u&&!u.bad&&d&&!d.bad&&ce(ui(u,d),i)==0&&ce(zt(u,d),s)==0)){var h=t.display.view,m=i.line>=t.display.viewFrom&&Bc(t,i)||{node:h[0].measure.map[2],offset:0},b=s.line<t.display.viewTo&&Bc(t,s);if(!b){var I=h[h.length-1].measure,C=I.maps?I.maps[I.maps.length-1]:I.map;b={node:C[C.length-1],offset:C[C.length-2]-C[C.length-3]}}if(!m||!b){e.removeAllRanges();return}var B=e.rangeCount&&e.getRangeAt(0),L;try{L=D(m.node,m.offset,b.offset,b.node)}catch{}L&&(!a&&t.state.focused?(e.collapse(m.node,m.offset),L.collapsed||(e.removeAllRanges(),e.addRange(L))):(e.removeAllRanges(),e.addRange(L)),B&&e.anchorNode==null?e.addRange(B):a&&this.startGracePeriod()),this.rememberSelection()}},je.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},je.prototype.showMultipleSelections=function(e){oe(this.cm.display.cursorDiv,e.cursors),oe(this.cm.display.selectionDiv,e.selection)},je.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},je.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return de(this.div,t)},je.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||ge(Ce(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},je.prototype.blur=function(){this.div.blur()},je.prototype.getField=function(){return this.div},je.prototype.supportsTouch=function(){return!0},je.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):cr(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function o(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,o))}this.polling.set(this.cm.options.pollInterval,o)},je.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},je.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(G&&A&&this.cm.display.gutterSpecs.length&&fb(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var o=Ba(t,e.anchorNode,e.anchorOffset),i=Ba(t,e.focusNode,e.focusOffset);o&&i&&cr(t,function(){Zt(t.doc,An(o,i),Me),(o.bad||i.bad)&&(t.curOp.selectionChanged=!0)})}}},je.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,o=e.doc.sel.primary(),i=o.from(),s=o.to();if(i.ch==0&&i.line>e.firstLine()&&(i=O(i.line-1,he(e.doc,i.line-1).length)),s.ch==he(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=O(s.line+1,0)),i.line<t.viewFrom||s.line>t.viewTo-1)return!1;var u,d,h;i.line==t.viewFrom||(u=Pn(e,i.line))==0?(d=v(t.view[0].line),h=t.view[0].node):(d=v(t.view[u].line),h=t.view[u-1].node.nextSibling);var m=Pn(e,s.line),b,I;if(m==t.view.length-1?(b=t.viewTo-1,I=t.lineDiv.lastChild):(b=v(t.view[m+1].line)-1,I=t.view[m+1].node.previousSibling),!h)return!1;for(var C=e.doc.splitLines(cb(e,h,I,d,b)),B=Rt(e.doc,O(d,0),O(b,he(e.doc,b).text.length));C.length>1&&B.length>1;)if(Te(C)==Te(B))C.pop(),B.pop(),b--;else if(C[0]==B[0])C.shift(),B.shift(),d++;else break;for(var L=0,W=0,H=C[0],z=B[0],ne=Math.min(H.length,z.length);L<ne&&H.charCodeAt(L)==z.charCodeAt(L);)++L;for(var pe=Te(C),ie=Te(B),me=Math.min(pe.length-(C.length==1?L:0),ie.length-(B.length==1?L:0));W<me&&pe.charCodeAt(pe.length-W-1)==ie.charCodeAt(ie.length-W-1);)++W;if(C.length==1&&B.length==1&&d==i.line)for(;L&&L>i.ch&&pe.charCodeAt(pe.length-W-1)==ie.charCodeAt(ie.length-W-1);)L--,W++;C[C.length-1]=pe.slice(0,pe.length-W).replace(/^\u200b+/,""),C[0]=C[0].slice(L).replace(/\u200b+$/,"");var Ae=O(d,L),Ee=O(b,B.length?Te(B).length-W:0);if(C.length>1||C[0]||ce(Ae,Ee))return Ti(e.doc,C,Ae,Ee,"+input"),!0},je.prototype.ensurePolled=function(){this.forceCompositionEnd()},je.prototype.reset=function(){this.forceCompositionEnd()},je.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},je.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},je.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&cr(this.cm,function(){return qt(e.cm)})},je.prototype.setUneditable=function(e){e.contentEditable="false"},je.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||St(this.cm,Rl)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},je.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},je.prototype.onContextMenu=function(){},je.prototype.resetPosition=function(){},je.prototype.needsContentAttribute=!0;function Bc(e,t){var o=Ys(e,t.line);if(!o||o.hidden)return null;var i=he(e.doc,t.line),s=lf(o,i,t.line),u=Ne(i,e.doc.direction),d="left";if(u){var h=vr(u,t.ch);d=h%2?"right":"left"}var m=cf(s.map,t.ch,d);return m.offset=m.collapse=="right"?m.end:m.start,m}function fb(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ri(e,t){return t&&(e.bad=!0),e}function cb(e,t,o,i,s){var u="",d=!1,h=e.doc.lineSeparator(),m=!1;function b(L){return function(W){return W.id==L}}function I(){d&&(u+=h,m&&(u+=h),d=m=!1)}function C(L){L&&(I(),u+=L)}function B(L){if(L.nodeType==1){var W=L.getAttribute("cm-text");if(W){C(W);return}var H=L.getAttribute("cm-marker"),z;if(H){var ne=e.findMarks(O(i,0),O(s+1,0),b(+H));ne.length&&(z=ne[0].find(0))&&C(Rt(e.doc,z.from,z.to).join(h));return}if(L.getAttribute("contenteditable")=="false")return;var pe=/^(pre|div|p|li|table|br)$/i.test(L.nodeName);if(!/^br$/i.test(L.nodeName)&&L.textContent.length==0)return;pe&&I();for(var ie=0;ie<L.childNodes.length;ie++)B(L.childNodes[ie]);/^(pre|p)$/i.test(L.nodeName)&&(m=!0),pe&&(d=!0)}else L.nodeType==3&&C(L.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;B(t),t!=o;)t=t.nextSibling,m=!1;return u}function Ba(e,t,o){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[o],!i)return Ri(e.clipPos(O(e.display.viewTo-1)),!0);t=null,o=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var s=0;s<e.display.view.length;s++){var u=e.display.view[s];if(u.node==i)return db(u,t,o)}}function db(e,t,o){var i=e.text.firstChild,s=!1;if(!t||!de(i,t))return Ri(O(v(e.line),0),!0);if(t==i&&(s=!0,t=i.childNodes[o],o=0,!t)){var u=e.rest?Te(e.rest):e.line;return Ri(O(v(u),u.text.length),s)}var d=t.nodeType==3?t:null,h=t;for(!d&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(d=t.firstChild,o&&(o=d.nodeValue.length));h.parentNode!=i;)h=h.parentNode;var m=e.measure,b=m.maps;function I(z,ne,pe){for(var ie=-1;ie<(b?b.length:0);ie++)for(var me=ie<0?m.map:b[ie],Ae=0;Ae<me.length;Ae+=3){var Ee=me[Ae+2];if(Ee==z||Ee==ne){var ke=v(ie<0?e.line:e.rest[ie]),et=me[Ae]+pe;return(pe<0||Ee!=z)&&(et=me[Ae+(pe?1:0)]),O(ke,et)}}}var C=I(d,h,o);if(C)return Ri(C,s);for(var B=h.nextSibling,L=d?d.nodeValue.length-o:0;B;B=B.nextSibling){if(C=I(B,B.firstChild,0),C)return Ri(O(C.line,C.ch-L),s);L+=B.textContent.length}for(var W=h.previousSibling,H=o;W;W=W.previousSibling){if(C=I(W,W.firstChild,-1),C)return Ri(O(C.line,C.ch+H),s);H+=W.textContent.length}}var gt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ge,this.hasSelection=!1,this.composing=null,this.resetting=!1};gt.prototype.init=function(e){var t=this,o=this,i=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),_&&(s.style.width="0px"),Ie(s,"input",function(){g&&y>=9&&t.hasSelection&&(t.hasSelection=null),o.poll()}),Ie(s,"paste",function(d){$e(i,d)||Nc(d,i)||(i.state.pasteIncoming=+new Date,o.fastPoll())});function u(d){if(!$e(i,d)){if(i.somethingSelected())Fa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var h=wc(i);Fa({lineWise:!0,text:h.text}),d.type=="cut"?i.setSelections(h.ranges,null,Me):(o.prevInput="",s.value=h.text.join(`
35
- `),we(s))}else return;d.type=="cut"&&(i.state.cutIncoming=+new Date)}}Ie(s,"cut",u),Ie(s,"copy",u),Ie(e.scroller,"paste",function(d){if(!(on(e,d)||$e(i,d))){if(!s.dispatchEvent){i.state.pasteIncoming=+new Date,o.focus();return}var h=new Event("paste");h.clipboardData=d.clipboardData,s.dispatchEvent(h)}}),Ie(e.lineSpace,"selectstart",function(d){on(e,d)||At(d)}),Ie(s,"compositionstart",function(){var d=i.getCursor("from");o.composing&&o.composing.range.clear(),o.composing={start:d,range:i.markText(d,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(s,"compositionend",function(){o.composing&&(o.poll(),o.composing.range.clear(),o.composing=null)})},gt.prototype.createField=function(e){this.wrapper=Lc(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;_l(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},gt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},gt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,o=e.doc,i=If(e);if(e.options.moveInputWithCursor){var s=Fr(e,o.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),d=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+d.top-u.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+d.left-u.left))}return i},gt.prototype.showSelection=function(e){var t=this.cm,o=t.display;oe(o.cursorDiv,e.cursors),oe(o.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},gt.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var o=t.getSelection();this.textarea.value=o,t.state.focused&&we(this.textarea),g&&y>=9&&(this.hasSelection=o)}else e||(this.prevInput=this.textarea.value="",g&&y>=9&&(this.hasSelection=null));this.resetting=!1}},gt.prototype.getField=function(){return this.textarea},gt.prototype.supportsTouch=function(){return!1},gt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!J||ge(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},gt.prototype.blur=function(){this.textarea.blur()},gt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},gt.prototype.receivedFocus=function(){this.slowPoll()},gt.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},gt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function o(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,o)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,o)},gt.prototype.poll=function(){var e=this,t=this.cm,o=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||wr(o)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=o.value;if(s==i&&!t.somethingSelected())return!1;if(g&&y>=9&&this.hasSelection===s||q&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=s.charCodeAt(0);if(u==8203&&!i&&(i="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var d=0,h=Math.min(i.length,s.length);d<h&&i.charCodeAt(d)==s.charCodeAt(d);)++d;return cr(t,function(){Rl(t,s.slice(d),i.length-d,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
36
- `)>-1?o.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},gt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},gt.prototype.onKeyPress=function(){g&&y>=9&&(this.hasSelection=null),this.fastPoll()},gt.prototype.onContextMenu=function(e){var t=this,o=t.cm,i=o.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Qn(o,e),d=i.scroller.scrollTop;if(!u||M)return;var h=o.options.resetSelectionOnContextMenu;h&&o.doc.sel.contains(u)==-1&&St(o,Zt)(o.doc,An(u),Me);var m=s.style.cssText,b=t.wrapper.style.cssText,I=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.style.cssText=`position: absolute; width: 30px; height: 30px;
37
- top: `+(e.clientY-I.top-5)+"px; left: "+(e.clientX-I.left-5)+`px;
38
- z-index: 1000; background: `+(g?"rgba(255, 255, 255, .05)":"transparent")+`;
39
- outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var C;T&&(C=s.ownerDocument.defaultView.scrollY),i.input.focus(),T&&s.ownerDocument.defaultView.scrollTo(null,C),i.input.reset(),o.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=L,i.selForContextMenu=o.doc.sel,clearTimeout(i.detectingSelectAll);function B(){if(s.selectionStart!=null){var H=o.somethingSelected(),z="\u200B"+(H?s.value:"");s.value="\u21DA",s.value=z,t.prevInput=H?"":"\u200B",s.selectionStart=1,s.selectionEnd=z.length,i.selForContextMenu=o.doc.sel}}function L(){if(t.contextMenuPending==L&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,s.style.cssText=m,g&&y<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=d),s.selectionStart!=null)){(!g||g&&y<9)&&B();var H=0,z=function(){i.selForContextMenu==o.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="\u200B"?St(o,Kf)(o):H++<10?i.detectingSelectAll=setTimeout(z,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(z,200)}}if(g&&y>=9&&B(),P){Wr(e);var W=function(){Ct(window,"mouseup",W),setTimeout(L,20)};Ie(window,"mouseup",W)}else setTimeout(L,50)},gt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},gt.prototype.setUneditable=function(){},gt.prototype.needsContentAttribute=!1;function hb(e,t){if(t=t?le(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var o=ge(Ce(e));t.autofocus=o==e||e.getAttribute("autofocus")!=null&&o==document.body}function i(){e.value=h.getValue()}var s;if(e.form&&(Ie(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var u=e.form;s=u.submit;try{var d=u.submit=function(){i(),u.submit=s,u.submit(),u.submit=d}}catch{}}t.finishInit=function(m){m.save=i,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,i(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Ct(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var h=ot(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return h}function pb(e){e.off=Ct,e.on=Ie,e.wheelEventPixels=T0,e.Doc=Kt,e.splitLines=jt,e.countColumn=ye,e.findColumn=De,e.isWordChar=ze,e.Pass=Je,e.signal=Ke,e.Line=fi,e.changeEnd=Rn,e.scrollbarModel=Nf,e.Pos=O,e.cmpPos=ce,e.modes=tn,e.mimeModes=ur,e.resolveMode=Tn,e.getMode=xe,e.modeExtensions=N,e.extendMode=K,e.copyState=be,e.startState=dt,e.innerMode=Ye,e.commands=Ro,e.keyMap=sn,e.keyName=pc,e.isModifierKey=dc,e.lookupKey=Ei,e.normalizeKeyMap=Q0,e.StringStream=Ue,e.SharedTextMarker=Eo,e.TextMarker=Nn,e.LineWidget=Io,e.e_preventDefault=At,e.e_stopPropagation=rt,e.e_stop=Wr,e.addClass=Oe,e.contains=de,e.rmClass=fe,e.keyNames=Sn}ob(ot),ub(ot);var gb="iter insert remove copy getEditor constructor".split(" ");for(var Ua in Kt.prototype)Kt.prototype.hasOwnProperty(Ua)&&ue(gb,Ua)<0&&(ot.prototype[Ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Kt.prototype[Ua]));return xr(Kt),ot.inputStyles={textarea:gt,contenteditable:je},ot.defineMode=function(e){!ot.defaults.mode&&e!="null"&&(ot.defaults.mode=e),fr.apply(this,arguments)},ot.defineMIME=Dr,ot.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ot.defineMIME("text/plain","null"),ot.defineExtension=function(e,t){ot.prototype[e]=t},ot.defineDocExtension=function(e,t){Kt.prototype[e]=t},ot.fromTextArea=hb,pb(ot),ot.version="5.65.20",ot})});var Bu=at((jg,zg)=>{(function(r){typeof jg=="object"&&typeof zg=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";function n(p,g,y,T){if(y&&y.call){var U=y;y=null}else var U=c(p,y,"rangeFinder");typeof g=="number"&&(g=r.Pos(g,0));var A=c(p,y,"minFoldSize");function F(Z){var _=U(p,g);if(!_||_.to.line-_.from.line<A)return null;if(T==="fold")return _;for(var G=p.findMarksAt(_.from),J=0;J<G.length;++J)if(G[J].__isFold){if(!Z)return null;_.cleared=!0,G[J].clear()}return _}var M=F(!0);if(c(p,y,"scanUp"))for(;!M&&g.line>p.firstLine();)g=r.Pos(g.line-1,0),M=F(!1);if(!(!M||M.cleared||T==="unfold")){var X=a(p,y,M);r.on(X,"mousedown",function(Z){S.clear(),r.e_preventDefault(Z)});var S=p.markText(M.from,M.to,{replacedWith:X,clearOnEnter:c(p,y,"clearOnEnter"),__isFold:!0});S.on("clear",function(Z,_){r.signal(p,"unfold",p,Z,_)}),r.signal(p,"fold",p,M.from,M.to)}}function a(p,g,y){var T=c(p,g,"widget");if(typeof T=="function"&&(T=T(y.from,y.to)),typeof T=="string"){var U=document.createTextNode(T);T=document.createElement("span"),T.appendChild(U),T.className="CodeMirror-foldmarker"}else T&&(T=T.cloneNode(!0));return T}r.newFoldFunction=function(p,g){return function(y,T){n(y,T,{rangeFinder:p,widget:g})}},r.defineExtension("foldCode",function(p,g,y){n(this,p,g,y)}),r.defineExtension("isFolded",function(p){for(var g=this.findMarksAt(p),y=0;y<g.length;++y)if(g[y].__isFold)return!0}),r.commands.toggleFold=function(p){p.foldCode(p.getCursor())},r.commands.fold=function(p){p.foldCode(p.getCursor(),null,"fold")},r.commands.unfold=function(p){p.foldCode(p.getCursor(),{scanUp:!1},"unfold")},r.commands.foldAll=function(p){p.operation(function(){for(var g=p.firstLine(),y=p.lastLine();g<=y;g++)p.foldCode(r.Pos(g,0),{scanUp:!1},"fold")})},r.commands.unfoldAll=function(p){p.operation(function(){for(var g=p.firstLine(),y=p.lastLine();g<=y;g++)p.foldCode(r.Pos(g,0),{scanUp:!1},"unfold")})},r.registerHelper("fold","combine",function(){var p=Array.prototype.slice.call(arguments,0);return function(g,y){for(var T=0;T<p.length;++T){var U=p[T](g,y);if(U)return U}}}),r.registerHelper("fold","auto",function(p,g){for(var y=p.getHelpers(g,"fold"),T=0;T<y.length;T++){var U=y[T](p,g);if(U)return U}});var l={rangeFinder:r.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1,clearOnEnter:!0};r.defineOption("foldOptions",null);function c(p,g,y){if(g&&g[y]!==void 0)return g[y];var T=p.options.foldOptions;return T&&T[y]!==void 0?T[y]:l[y]}r.defineExtension("foldOption",function(p,g){return c(this,p,g)})})});var $g=at((qg,Kg)=>{(function(r){typeof qg=="object"&&typeof Kg=="object"?r(bn(),Bu()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],r):r(CodeMirror)})(function(r){"use strict";r.defineOption("foldGutter",!1,function(S,Z,_){_&&_!=r.Init&&(S.clearGutter(S.state.foldGutter.options.gutter),S.state.foldGutter=null,S.off("gutterClick",U),S.off("changes",F),S.off("viewportChange",M),S.off("fold",X),S.off("unfold",X),S.off("swapDoc",F),S.off("optionChange",A)),Z&&(S.state.foldGutter=new a(l(Z)),T(S),S.on("gutterClick",U),S.on("changes",F),S.on("viewportChange",M),S.on("fold",X),S.on("unfold",X),S.on("swapDoc",F),S.on("optionChange",A))});var n=r.Pos;function a(S){this.options=S,this.from=this.to=0}function l(S){return S===!0&&(S={}),S.gutter==null&&(S.gutter="CodeMirror-foldgutter"),S.indicatorOpen==null&&(S.indicatorOpen="CodeMirror-foldgutter-open"),S.indicatorFolded==null&&(S.indicatorFolded="CodeMirror-foldgutter-folded"),S}function c(S,Z){for(var _=S.findMarks(n(Z,0),n(Z+1,0)),G=0;G<_.length;++G)if(_[G].__isFold){var J=_[G].find(-1);if(J&&J.line===Z)return _[G]}}function p(S){if(typeof S=="string"){var Z=document.createElement("div");return Z.className=S+" CodeMirror-guttermarker-subtle",Z}else return S.cloneNode(!0)}function g(S,Z,_){var G=S.state.foldGutter.options,J=Z-1,q=S.foldOption(G,"minFoldSize"),te=S.foldOption(G,"rangeFinder"),ae=typeof G.indicatorFolded=="string"&&y(G.indicatorFolded),R=typeof G.indicatorOpen=="string"&&y(G.indicatorOpen);S.eachLine(Z,_,function(w){++J;var P=null,$=w.gutterMarkers;if($&&($=$[G.gutter]),c(S,J)){if(ae&&$&&ae.test($.className))return;P=p(G.indicatorFolded)}else{var fe=n(J,0),k=te&&te(S,fe);if(k&&k.to.line-k.from.line>=q){if(R&&$&&R.test($.className))return;P=p(G.indicatorOpen)}}!P&&!$||S.setGutterMarker(w,G.gutter,P)})}function y(S){return new RegExp("(^|\\s)"+S+"(?:$|\\s)\\s*")}function T(S){var Z=S.getViewport(),_=S.state.foldGutter;_&&(S.operation(function(){g(S,Z.from,Z.to)}),_.from=Z.from,_.to=Z.to)}function U(S,Z,_){var G=S.state.foldGutter;if(G){var J=G.options;if(_==J.gutter){var q=c(S,Z);q?q.clear():S.foldCode(n(Z,0),J)}}}function A(S,Z){Z=="mode"&&F(S)}function F(S){var Z=S.state.foldGutter;if(Z){var _=Z.options;Z.from=Z.to=0,clearTimeout(Z.changeUpdate),Z.changeUpdate=setTimeout(function(){T(S)},_.foldOnChangeTimeSpan||600)}}function M(S){var Z=S.state.foldGutter;if(Z){var _=Z.options;clearTimeout(Z.changeUpdate),Z.changeUpdate=setTimeout(function(){var G=S.getViewport();Z.from==Z.to||G.from-Z.to>20||Z.from-G.to>20?T(S):S.operation(function(){G.from<Z.from&&(g(S,G.from,Z.from),Z.from=G.from),G.to>Z.to&&(g(S,Z.to,G.to),Z.to=G.to)})},_.updateViewportTimeSpan||400)}}function X(S,Z){var _=S.state.foldGutter;if(_){var G=Z.line;G>=_.from&&G<_.to&&g(S,G,G+1)}}})});var rm=at((em,tm)=>{(function(r){typeof em=="object"&&typeof tm=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";var n=r.Pos;function a(_,G){return _.line-G.line||_.ch-G.ch}var l="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",c=l+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+l+"]["+c+"]*)","g");function g(_,G,J,q){this.line=G,this.ch=J,this.cm=_,this.text=_.getLine(G),this.min=q?Math.max(q.from,_.firstLine()):_.firstLine(),this.max=q?Math.min(q.to-1,_.lastLine()):_.lastLine()}function y(_,G){var J=_.cm.getTokenTypeAt(n(_.line,G));return J&&/\btag\b/.test(J)}function T(_){if(!(_.line>=_.max))return _.ch=0,_.text=_.cm.getLine(++_.line),!0}function U(_){if(!(_.line<=_.min))return _.text=_.cm.getLine(--_.line),_.ch=_.text.length,!0}function A(_){for(;;){var G=_.text.indexOf(">",_.ch);if(G==-1){if(T(_))continue;return}if(!y(_,G+1)){_.ch=G+1;continue}var J=_.text.lastIndexOf("/",G),q=J>-1&&!/\S/.test(_.text.slice(J+1,G));return _.ch=G+1,q?"selfClose":"regular"}}function F(_){for(;;){var G=_.ch?_.text.lastIndexOf("<",_.ch-1):-1;if(G==-1){if(U(_))continue;return}if(!y(_,G+1)){_.ch=G;continue}p.lastIndex=G,_.ch=G;var J=p.exec(_.text);if(J&&J.index==G)return J}}function M(_){for(;;){p.lastIndex=_.ch;var G=p.exec(_.text);if(!G){if(T(_))continue;return}if(!y(_,G.index+1)){_.ch=G.index+1;continue}return _.ch=G.index+G[0].length,G}}function X(_){for(;;){var G=_.ch?_.text.lastIndexOf(">",_.ch-1):-1;if(G==-1){if(U(_))continue;return}if(!y(_,G+1)){_.ch=G;continue}var J=_.text.lastIndexOf("/",G),q=J>-1&&!/\S/.test(_.text.slice(J+1,G));return _.ch=G+1,q?"selfClose":"regular"}}function S(_,G){for(var J=[];;){var q=M(_),te,ae=_.line,R=_.ch-(q?q[0].length:0);if(!q||!(te=A(_)))return;if(te!="selfClose")if(q[1]){for(var w=J.length-1;w>=0;--w)if(J[w]==q[2]){J.length=w;break}if(w<0&&(!G||G==q[2]))return{tag:q[2],from:n(ae,R),to:n(_.line,_.ch)}}else J.push(q[2])}}function Z(_,G){for(var J=[];;){var q=X(_);if(!q)return;if(q=="selfClose"){F(_);continue}var te=_.line,ae=_.ch,R=F(_);if(!R)return;if(R[1])J.push(R[2]);else{for(var w=J.length-1;w>=0;--w)if(J[w]==R[2]){J.length=w;break}if(w<0&&(!G||G==R[2]))return{tag:R[2],from:n(_.line,_.ch),to:n(te,ae)}}}}r.registerHelper("fold","xml",function(_,G){for(var J=new g(_,G.line,0);;){var q=M(J);if(!q||J.line!=G.line)return;var te=A(J);if(!te)return;if(!q[1]&&te!="selfClose"){var ae=n(J.line,J.ch),R=S(J,q[2]);return R&&a(R.from,ae)>0?{from:ae,to:R.from}:null}}}),r.findMatchingTag=function(_,G,J){var q=new g(_,G.line,G.ch,J);if(!(q.text.indexOf(">")==-1&&q.text.indexOf("<")==-1)){var te=A(q),ae=te&&n(q.line,q.ch),R=te&&F(q);if(!(!te||!R||a(q,G)>0)){var w={from:n(q.line,q.ch),to:ae,tag:R[2]};return te=="selfClose"?{open:w,close:null,at:"open"}:R[1]?{open:Z(q,R[2]),close:w,at:"close"}:(q=new g(_,ae.line,ae.ch,J),{open:w,close:S(q,R[2]),at:"open"})}}},r.findEnclosingTag=function(_,G,J,q){for(var te=new g(_,G.line,G.ch,J);;){var ae=Z(te,q);if(!ae)break;var R=new g(_,G.line,G.ch,J),w=S(R,ae.tag);if(w)return{open:ae,close:w}}},r.scanForClosingTag=function(_,G,J,q){var te=new g(_,G.line,G.ch,q?{from:0,to:q}:null);return S(te,J)}})});var om=at((nm,im)=>{(function(r){typeof nm=="object"&&typeof im=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";function n(a){return function(l,c){var p=c.line,g=l.getLine(p);function y(X){for(var S,Z=c.ch,_=0;;){var G=Z<=0?-1:g.lastIndexOf(X[0],Z-1);if(G==-1){if(_==1)break;_=1,Z=g.length;continue}if(_==1&&G<c.ch)break;if(S=l.getTokenTypeAt(r.Pos(p,G+1)),!/^(comment|string)/.test(S))return{ch:G+1,tokenType:S,pair:X};Z=G-1}}function T(X){var S=1,Z=l.lastLine(),_,G=X.ch,J;e:for(var q=p;q<=Z;++q)for(var te=l.getLine(q),ae=q==p?G:0;;){var R=te.indexOf(X.pair[0],ae),w=te.indexOf(X.pair[1],ae);if(R<0&&(R=te.length),w<0&&(w=te.length),ae=Math.min(R,w),ae==te.length)break;if(l.getTokenTypeAt(r.Pos(q,ae+1))==X.tokenType){if(ae==R)++S;else if(!--S){_=q,J=ae;break e}}++ae}return _==null||p==_?null:{from:r.Pos(p,G),to:r.Pos(_,J)}}for(var U=[],A=0;A<a.length;A++){var F=y(a[A]);F&&U.push(F)}U.sort(function(X,S){return X.ch-S.ch});for(var A=0;A<U.length;A++){var M=T(U[A]);if(M)return M}return null}}r.registerHelper("fold","brace",n([["{","}"],["[","]"]])),r.registerHelper("fold","brace-paren",n([["{","}"],["[","]"],["(",")"]])),r.registerHelper("fold","import",function(a,l){function c(A){if(A<a.firstLine()||A>a.lastLine())return null;var F=a.getTokenAt(r.Pos(A,1));if(/\S/.test(F.string)||(F=a.getTokenAt(r.Pos(A,F.end+1))),F.type!="keyword"||F.string!="import")return null;for(var M=A,X=Math.min(a.lastLine(),A+10);M<=X;++M){var S=a.getLine(M),Z=S.indexOf(";");if(Z!=-1)return{startCh:F.end,end:r.Pos(M,Z)}}}var p=l.line,g=c(p),y;if(!g||c(p-1)||(y=c(p-2))&&y.end.line==p-1)return null;for(var T=g.end;;){var U=c(T.line+1);if(U==null)break;T=U.end}return{from:a.clipPos(r.Pos(p,g.startCh+1)),to:T}}),r.registerHelper("fold","include",function(a,l){function c(U){if(U<a.firstLine()||U>a.lastLine())return null;var A=a.getTokenAt(r.Pos(U,1));if(/\S/.test(A.string)||(A=a.getTokenAt(r.Pos(U,A.end+1))),A.type=="meta"&&A.string.slice(0,8)=="#include")return A.start+8}var p=l.line,g=c(p);if(g==null||c(p-1)!=null)return null;for(var y=p;;){var T=c(y+1);if(T==null)break;++y}return{from:r.Pos(p,g+1),to:a.clipPos(r.Pos(y))}})})});var lm=at((am,sm)=>{(function(r){typeof am=="object"&&typeof sm=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){var n=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),a=r.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function c(A){return A&&A.bracketRegex||/[(){}[\]]/}function p(A,F,M){var X=A.getLineHandle(F.line),S=F.ch-1,Z=M&&M.afterCursor;Z==null&&(Z=/(^| )cm-fat-cursor($| )/.test(A.getWrapperElement().className));var _=c(M),G=!Z&&S>=0&&_.test(X.text.charAt(S))&&l[X.text.charAt(S)]||_.test(X.text.charAt(S+1))&&l[X.text.charAt(++S)];if(!G)return null;var J=G.charAt(1)==">"?1:-1;if(M&&M.strict&&J>0!=(S==F.ch))return null;var q=A.getTokenTypeAt(a(F.line,S+1)),te=g(A,a(F.line,S+(J>0?1:0)),J,q,M);return te==null?null:{from:a(F.line,S),to:te&&te.pos,match:te&&te.ch==G.charAt(0),forward:J>0}}function g(A,F,M,X,S){for(var Z=S&&S.maxScanLineLength||1e4,_=S&&S.maxScanLines||1e3,G=[],J=c(S),q=M>0?Math.min(F.line+_,A.lastLine()+1):Math.max(A.firstLine()-1,F.line-_),te=F.line;te!=q;te+=M){var ae=A.getLine(te);if(ae){var R=M>0?0:ae.length-1,w=M>0?ae.length:-1;if(!(ae.length>Z))for(te==F.line&&(R=F.ch-(M<0?1:0));R!=w;R+=M){var P=ae.charAt(R);if(J.test(P)&&(X===void 0||(A.getTokenTypeAt(a(te,R+1))||"")==(X||""))){var $=l[P];if($&&$.charAt(1)==">"==M>0)G.push(P);else if(G.length)G.pop();else return{pos:a(te,R),ch:P}}}}}return te-M==(M>0?A.lastLine():A.firstLine())?!1:null}function y(A,F,M){for(var X=A.state.matchBrackets.maxHighlightLineLength||1e3,S=M&&M.highlightNonMatching,Z=[],_=A.listSelections(),G=0;G<_.length;G++){var J=_[G].empty()&&p(A,_[G].head,M);if(J&&(J.match||S!==!1)&&A.getLine(J.from.line).length<=X){var q=J.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";Z.push(A.markText(J.from,a(J.from.line,J.from.ch+1),{className:q})),J.to&&A.getLine(J.to.line).length<=X&&Z.push(A.markText(J.to,a(J.to.line,J.to.ch+1),{className:q}))}}if(Z.length){n&&A.state.focused&&A.focus();var te=function(){A.operation(function(){for(var ae=0;ae<Z.length;ae++)Z[ae].clear()})};if(F)setTimeout(te,800);else return te}}function T(A){A.operation(function(){A.state.matchBrackets.currentlyHighlighted&&(A.state.matchBrackets.currentlyHighlighted(),A.state.matchBrackets.currentlyHighlighted=null),A.state.matchBrackets.currentlyHighlighted=y(A,!1,A.state.matchBrackets)})}function U(A){A.state.matchBrackets&&A.state.matchBrackets.currentlyHighlighted&&(A.state.matchBrackets.currentlyHighlighted(),A.state.matchBrackets.currentlyHighlighted=null)}r.defineOption("matchBrackets",!1,function(A,F,M){M&&M!=r.Init&&(A.off("cursorActivity",T),A.off("focus",T),A.off("blur",U),U(A)),F&&(A.state.matchBrackets=typeof F=="object"?F:{},A.on("cursorActivity",T),A.on("focus",T),A.on("blur",U))}),r.defineExtension("matchBrackets",function(){y(this,!0)}),r.defineExtension("findMatchingBracket",function(A,F,M){return(M||typeof F=="boolean")&&(M?(M.strict=F,F=M):F=F?{strict:!0}:null),p(this,A,F)}),r.defineExtension("scanForBracket",function(A,F,M,X){return g(this,A,F,M,X)})})});var cm=at((um,fm)=>{(function(r){typeof um=="object"&&typeof fm=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";var n={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},a={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};r.defineMode("xml",function(l,c){var p=l.indentUnit,g={},y=c.htmlMode?n:a;for(var T in y)g[T]=y[T];for(var T in c)g[T]=c[T];var U,A;function F(x,ee){function D(Oe){return ee.tokenize=Oe,Oe(x,ee)}var de=x.next();if(de=="<")return x.eat("!")?x.eat("[")?x.match("CDATA[")?D(S("atom","]]>")):null:x.match("--")?D(S("comment","-->")):x.match("DOCTYPE",!0,!0)?(x.eatWhile(/[\w\._\-]/),D(Z(1))):null:x.eat("?")?(x.eatWhile(/[\w\._\-]/),ee.tokenize=S("meta","?>"),"meta"):(U=x.eat("/")?"closeTag":"openTag",ee.tokenize=M,"tag bracket");if(de=="&"){var ge;return x.eat("#")?x.eat("x")?ge=x.eatWhile(/[a-fA-F\d]/)&&x.eat(";"):ge=x.eatWhile(/[\d]/)&&x.eat(";"):ge=x.eatWhile(/[\w\.\-:]/)&&x.eat(";"),ge?"atom":"error"}else return x.eatWhile(/[^&<]/),null}F.isInText=!0;function M(x,ee){var D=x.next();if(D==">"||D=="/"&&x.eat(">"))return ee.tokenize=F,U=D==">"?"endTag":"selfcloseTag","tag bracket";if(D=="=")return U="equals",null;if(D=="<"){ee.tokenize=F,ee.state=te,ee.tagName=ee.tagStart=null;var de=ee.tokenize(x,ee);return de?de+" tag error":"tag error"}else return/[\'\"]/.test(D)?(ee.tokenize=X(D),ee.stringStartCol=x.column(),ee.tokenize(x,ee)):(x.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function X(x){var ee=function(D,de){for(;!D.eol();)if(D.next()==x){de.tokenize=M;break}return"string"};return ee.isInAttribute=!0,ee}function S(x,ee){return function(D,de){for(;!D.eol();){if(D.match(ee)){de.tokenize=F;break}D.next()}return x}}function Z(x){return function(ee,D){for(var de;(de=ee.next())!=null;){if(de=="<")return D.tokenize=Z(x+1),D.tokenize(ee,D);if(de==">")if(x==1){D.tokenize=F;break}else return D.tokenize=Z(x-1),D.tokenize(ee,D)}return"meta"}}function _(x){return x&&x.toLowerCase()}function G(x,ee,D){this.prev=x.context,this.tagName=ee||"",this.indent=x.indented,this.startOfLine=D,(g.doNotIndent.hasOwnProperty(ee)||x.context&&x.context.noIndent)&&(this.noIndent=!0)}function J(x){x.context&&(x.context=x.context.prev)}function q(x,ee){for(var D;;){if(!x.context||(D=x.context.tagName,!g.contextGrabbers.hasOwnProperty(_(D))||!g.contextGrabbers[_(D)].hasOwnProperty(_(ee))))return;J(x)}}function te(x,ee,D){return x=="openTag"?(D.tagStart=ee.column(),ae):x=="closeTag"?R:te}function ae(x,ee,D){return x=="word"?(D.tagName=ee.current(),A="tag",$):g.allowMissingTagName&&x=="endTag"?(A="tag bracket",$(x,ee,D)):(A="error",ae)}function R(x,ee,D){if(x=="word"){var de=ee.current();return D.context&&D.context.tagName!=de&&g.implicitlyClosed.hasOwnProperty(_(D.context.tagName))&&J(D),D.context&&D.context.tagName==de||g.matchClosing===!1?(A="tag",w):(A="tag error",P)}else return g.allowMissingTagName&&x=="endTag"?(A="tag bracket",w(x,ee,D)):(A="error",P)}function w(x,ee,D){return x!="endTag"?(A="error",w):(J(D),te)}function P(x,ee,D){return A="error",w(x,ee,D)}function $(x,ee,D){if(x=="word")return A="attribute",fe;if(x=="endTag"||x=="selfcloseTag"){var de=D.tagName,ge=D.tagStart;return D.tagName=D.tagStart=null,x=="selfcloseTag"||g.autoSelfClosers.hasOwnProperty(_(de))?q(D,de):(q(D,de),D.context=new G(D,de,ge==D.indented)),te}return A="error",$}function fe(x,ee,D){return x=="equals"?k:(g.allowMissing||(A="error"),$(x,ee,D))}function k(x,ee,D){return x=="string"?oe:x=="word"&&g.allowUnquoted?(A="string",$):(A="error",$(x,ee,D))}function oe(x,ee,D){return x=="string"?oe:$(x,ee,D)}return{startState:function(x){var ee={tokenize:F,state:te,indented:x||0,tagName:null,tagStart:null,context:null};return x!=null&&(ee.baseIndent=x),ee},token:function(x,ee){if(!ee.tagName&&x.sol()&&(ee.indented=x.indentation()),x.eatSpace())return null;U=null;var D=ee.tokenize(x,ee);return(D||U)&&D!="comment"&&(A=null,ee.state=ee.state(U||D,x,ee),A&&(D=A=="error"?D+" error":A)),D},indent:function(x,ee,D){var de=x.context;if(x.tokenize.isInAttribute)return x.tagStart==x.indented?x.stringStartCol+1:x.indented+p;if(de&&de.noIndent)return r.Pass;if(x.tokenize!=M&&x.tokenize!=F)return D?D.match(/^(\s*)/)[0].length:0;if(x.tagName)return g.multilineTagIndentPastTag!==!1?x.tagStart+x.tagName.length+2:x.tagStart+p*(g.multilineTagIndentFactor||1);if(g.alignCDATA&&/<!\[CDATA\[/.test(ee))return 0;var ge=ee&&/^<(\/)?([\w_:\.-]*)/.exec(ee);if(ge&&ge[1])for(;de;)if(de.tagName==ge[2]){de=de.prev;break}else if(g.implicitlyClosed.hasOwnProperty(_(de.tagName)))de=de.prev;else break;else if(ge)for(;de;){var Oe=g.contextGrabbers[_(de.tagName)];if(Oe&&Oe.hasOwnProperty(_(ge[2])))de=de.prev;else break}for(;de&&de.prev&&!de.startOfLine;)de=de.prev;return de?de.indent+p:x.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:g.htmlMode?"html":"xml",helperType:g.htmlMode?"html":"xml",skipAttribute:function(x){x.state==k&&(x.state=$)},xmlCurrentTag:function(x){return x.tagName?{name:x.tagName,close:x.type=="closeTag"}:null},xmlCurrentContext:function(x){for(var ee=[],D=x.context;D;D=D.prev)ee.push(D.tagName);return ee.reverse()}}}),r.defineMIME("text/xml","xml"),r.defineMIME("application/xml","xml"),r.mimeModes.hasOwnProperty("text/html")||r.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var pm=at((dm,hm)=>{(function(r){typeof dm=="object"&&typeof hm=="object"?r(bn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";r.defineMode("javascript",function(n,a){var l=n.indentUnit,c=a.statementIndent,p=a.jsonld,g=a.json||p,y=a.trackScope!==!1,T=a.typescript,U=a.wordCharacters||/[\w$\xa1-\uffff]/,A=function(){function v(_t){return{type:_t,style:"keyword"}}var E=v("keyword a"),V=v("keyword b"),Y=v("keyword c"),O=v("keyword d"),ce=v("operator"),Pe={type:"atom",style:"atom"};return{if:v("if"),while:E,with:E,else:V,do:V,try:V,finally:V,return:O,break:O,continue:O,new:v("new"),delete:Y,void:Y,throw:Y,debugger:v("debugger"),var:v("var"),const:v("var"),let:v("var"),function:v("function"),catch:v("catch"),for:v("for"),switch:v("switch"),case:v("case"),default:v("default"),in:ce,typeof:ce,instanceof:ce,true:Pe,false:Pe,null:Pe,undefined:Pe,NaN:Pe,Infinity:Pe,this:v("this"),class:v("class"),super:v("atom"),yield:Y,export:v("export"),import:v("import"),extends:Y,await:Y}}(),F=/[+\-*&%=<>!?|~^@]/,M=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function X(v){for(var E=!1,V,Y=!1;(V=v.next())!=null;){if(!E){if(V=="/"&&!Y)return;V=="["?Y=!0:Y&&V=="]"&&(Y=!1)}E=!E&&V=="\\"}}var S,Z;function _(v,E,V){return S=v,Z=V,E}function G(v,E){var V=v.next();if(V=='"'||V=="'")return E.tokenize=J(V),E.tokenize(v,E);if(V=="."&&v.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return _("number","number");if(V=="."&&v.match(".."))return _("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(V))return _(V);if(V=="="&&v.eat(">"))return _("=>","operator");if(V=="0"&&v.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return _("number","number");if(/\d/.test(V))return v.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),_("number","number");if(V=="/")return v.eat("*")?(E.tokenize=q,q(v,E)):v.eat("/")?(v.skipToEnd(),_("comment","comment")):Dt(v,E,1)?(X(v),v.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),_("regexp","string-2")):(v.eat("="),_("operator","operator",v.current()));if(V=="`")return E.tokenize=te,te(v,E);if(V=="#"&&v.peek()=="!")return v.skipToEnd(),_("meta","meta");if(V=="#"&&v.eatWhile(U))return _("variable","property");if(V=="<"&&v.match("!--")||V=="-"&&v.match("->")&&!/\S/.test(v.string.slice(0,v.start)))return v.skipToEnd(),_("comment","comment");if(F.test(V))return(V!=">"||!E.lexical||E.lexical.type!=">")&&(v.eat("=")?(V=="!"||V=="=")&&v.eat("="):/[<>*+\-|&?]/.test(V)&&(v.eat(V),V==">"&&v.eat(V))),V=="?"&&v.eat(".")?_("."):_("operator","operator",v.current());if(U.test(V)){v.eatWhile(U);var Y=v.current();if(E.lastType!="."){if(A.propertyIsEnumerable(Y)){var O=A[Y];return _(O.type,O.style,Y)}if(Y=="async"&&v.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return _("async","keyword",Y)}return _("variable","variable",Y)}}function J(v){return function(E,V){var Y=!1,O;if(p&&E.peek()=="@"&&E.match(M))return V.tokenize=G,_("jsonld-keyword","meta");for(;(O=E.next())!=null&&!(O==v&&!Y);)Y=!Y&&O=="\\";return Y||(V.tokenize=G),_("string","string")}}function q(v,E){for(var V=!1,Y;Y=v.next();){if(Y=="/"&&V){E.tokenize=G;break}V=Y=="*"}return _("comment","comment")}function te(v,E){for(var V=!1,Y;(Y=v.next())!=null;){if(!V&&(Y=="`"||Y=="$"&&v.eat("{"))){E.tokenize=G;break}V=!V&&Y=="\\"}return _("quasi","string-2",v.current())}var ae="([{}])";function R(v,E){E.fatArrowAt&&(E.fatArrowAt=null);var V=v.string.indexOf("=>",v.start);if(!(V<0)){if(T){var Y=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(v.string.slice(v.start,V));Y&&(V=Y.index)}for(var O=0,ce=!1,Pe=V-1;Pe>=0;--Pe){var _t=v.string.charAt(Pe),zt=ae.indexOf(_t);if(zt>=0&&zt<3){if(!O){++Pe;break}if(--O==0){_t=="("&&(ce=!0);break}}else if(zt>=3&&zt<6)++O;else if(U.test(_t))ce=!0;else if(/["'\/`]/.test(_t))for(;;--Pe){if(Pe==0)return;var ui=v.string.charAt(Pe-1);if(ui==_t&&v.string.charAt(Pe-2)!="\\"){Pe--;break}}else if(ce&&!O){++Pe;break}}ce&&!O&&(E.fatArrowAt=Pe)}}var w={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function P(v,E,V,Y,O,ce){this.indented=v,this.column=E,this.type=V,this.prev=O,this.info=ce,Y!=null&&(this.align=Y)}function $(v,E){if(!y)return!1;for(var V=v.localVars;V;V=V.next)if(V.name==E)return!0;for(var Y=v.context;Y;Y=Y.prev)for(var V=Y.vars;V;V=V.next)if(V.name==E)return!0}function fe(v,E,V,Y,O){var ce=v.cc;for(k.state=v,k.stream=O,k.marked=null,k.cc=ce,k.style=E,v.lexical.hasOwnProperty("align")||(v.lexical.align=!0);;){var Pe=ce.length?ce.pop():g?ue:ye;if(Pe(V,Y)){for(;ce.length&&ce[ce.length-1].lex;)ce.pop()();return k.marked?k.marked:V=="variable"&&$(v,Y)?"variable-2":E}}}var k={state:null,column:null,marked:null,cc:null};function oe(){for(var v=arguments.length-1;v>=0;v--)k.cc.push(arguments[v])}function x(){return oe.apply(null,arguments),!0}function ee(v,E){for(var V=E;V;V=V.next)if(V.name==v)return!0;return!1}function D(v){var E=k.state;if(k.marked="def",!!y){if(E.context){if(E.lexical.info=="var"&&E.context&&E.context.block){var V=de(v,E.context);if(V!=null){E.context=V;return}}else if(!ee(v,E.localVars)){E.localVars=new _e(v,E.localVars);return}}a.globalVars&&!ee(v,E.globalVars)&&(E.globalVars=new _e(v,E.globalVars))}}function de(v,E){if(E)if(E.block){var V=de(v,E.prev);return V?V==E.prev?E:new Oe(V,E.vars,!0):null}else return ee(v,E.vars)?E:new Oe(E.prev,new _e(v,E.vars),!1);else return null}function ge(v){return v=="public"||v=="private"||v=="protected"||v=="abstract"||v=="readonly"}function Oe(v,E,V){this.prev=v,this.vars=E,this.block=V}function _e(v,E){this.name=v,this.next=E}var we=new _e("this",new _e("arguments",null));function re(){k.state.context=new Oe(k.state.context,k.state.localVars,!1),k.state.localVars=we}function Ze(){k.state.context=new Oe(k.state.context,k.state.localVars,!0),k.state.localVars=null}re.lex=Ze.lex=!0;function Ce(){k.state.localVars=k.state.context.vars,k.state.context=k.state.context.prev}Ce.lex=!0;function ve(v,E){var V=function(){var Y=k.state,O=Y.indented;if(Y.lexical.type=="stat")O=Y.lexical.indented;else for(var ce=Y.lexical;ce&&ce.type==")"&&ce.align;ce=ce.prev)O=ce.indented;Y.lexical=new P(O,k.stream.column(),v,null,Y.lexical,E)};return V.lex=!0,V}function se(){var v=k.state;v.lexical.prev&&(v.lexical.type==")"&&(v.indented=v.lexical.indented),v.lexical=v.lexical.prev)}se.lex=!0;function le(v){function E(V){return V==v?x():v==";"||V=="}"||V==")"||V=="]"?oe():x(E)}return E}function ye(v,E){return v=="var"?x(ve("vardef",E),rt,le(";"),se):v=="keyword a"?x(ve("form"),Je,ye,se):v=="keyword b"?x(ve("form"),ye,se):v=="keyword d"?k.stream.match(/^\s*$/,!1)?x():x(ve("stat"),Le,le(";"),se):v=="debugger"?x(le(";")):v=="{"?x(ve("}"),Ze,ft,se,Ce):v==";"?x():v=="if"?(k.state.lexical.info=="else"&&k.state.cc[k.state.cc.length-1]==se&&k.state.cc.pop()(),x(ve("form"),Je,ye,se,en)):v=="function"?x(jt):v=="for"?x(ve("form"),Ze,li,ye,Ce,se):v=="class"||T&&E=="interface"?(k.marked="keyword",x(ve("form",v=="class"?v:E),tn,se)):v=="variable"?T&&E=="declare"?(k.marked="keyword",x(ye)):T&&(E=="module"||E=="enum"||E=="type")&&k.stream.match(/^\s*\w/,!1)?(k.marked="keyword",E=="enum"?x(he):E=="type"?x(xn,le("operator"),Ne,le(";")):x(ve("form"),pt,le("{"),ve("}"),ft,se,se)):T&&E=="namespace"?(k.marked="keyword",x(ve("form"),ue,ye,se)):T&&E=="abstract"?(k.marked="keyword",x(ye)):x(ve("stat"),Qt):v=="switch"?x(ve("form"),Je,le("{"),ve("}","switch"),Ze,ft,se,se,Ce):v=="case"?x(ue,le(":")):v=="default"?x(le(":")):v=="catch"?x(ve("form"),re,Ge,ye,se,Ce):v=="export"?x(ve("stat"),Tn,se):v=="import"?x(ve("stat"),N,se):v=="async"?x(ye):E=="@"?x(ue,ye):oe(ve("stat"),ue,le(";"),se)}function Ge(v){if(v=="(")return x(lr,le(")"))}function ue(v,E){return Me(v,E,!1)}function Fe(v,E){return Me(v,E,!0)}function Je(v){return v!="("?oe():x(ve(")"),Le,le(")"),se)}function Me(v,E,V){if(k.state.fatArrowAt==k.stream.start){var Y=V?It:Te;if(v=="(")return x(re,ve(")"),qe(lr,")"),se,le("=>"),Y,Ce);if(v=="variable")return oe(re,pt,le("=>"),Y,Ce)}var O=V?De:Re;return w.hasOwnProperty(v)?x(O):v=="function"?x(jt,O):v=="class"||T&&E=="interface"?(k.marked="keyword",x(ve("form"),Tr,se)):v=="keyword c"||v=="async"?x(V?Fe:ue):v=="("?x(ve(")"),Le,le(")"),se,O):v=="operator"||v=="spread"?x(V?Fe:ue):v=="["?x(ve("]"),Ue,se,O):v=="{"?kt(Xe,"}",null,O):v=="quasi"?oe(Be,O):v=="new"?x(Et(V)):x()}function Le(v){return v.match(/[;\}\)\],]/)?oe():oe(ue)}function Re(v,E){return v==","?x(Le):De(v,E,!1)}function De(v,E,V){var Y=V==!1?Re:De,O=V==!1?ue:Fe;if(v=="=>")return x(re,V?It:Te,Ce);if(v=="operator")return/\+\+|--/.test(E)||T&&E=="!"?x(Y):T&&E=="<"&&k.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?x(ve(">"),qe(Ne,">"),se,Y):E=="?"?x(ue,le(":"),O):x(O);if(v=="quasi")return oe(Be,Y);if(v!=";"){if(v=="(")return kt(Fe,")","call",Y);if(v==".")return x(ze,Y);if(v=="[")return x(ve("]"),Le,le("]"),se,Y);if(T&&E=="as")return k.marked="keyword",x(Ne,Y);if(v=="regexp")return k.state.lastType=k.marked="operator",k.stream.backUp(k.stream.pos-k.stream.start-1),x(O)}}function Be(v,E){return v!="quasi"?oe():E.slice(E.length-2)!="${"?x(Be):x(Le,Ve)}function Ve(v){if(v=="}")return k.marked="string-2",k.state.tokenize=te,x(Be)}function Te(v){return R(k.stream,k.state),oe(v=="{"?ye:ue)}function It(v){return R(k.stream,k.state),oe(v=="{"?ye:Fe)}function Et(v){return function(E){return E=="."?x(v?lt:mr):E=="variable"&&T?x(yt,v?De:Re):oe(v?Fe:ue)}}function mr(v,E){if(E=="target")return k.marked="keyword",x(Re)}function lt(v,E){if(E=="target")return k.marked="keyword",x(De)}function Qt(v){return v==":"?x(se,ye):oe(Re,le(";"),se)}function ze(v){if(v=="variable")return k.marked="property",x()}function Xe(v,E){if(v=="async")return k.marked="property",x(Xe);if(v=="variable"||k.style=="keyword"){if(k.marked="property",E=="get"||E=="set")return x(mt);var V;return T&&k.state.fatArrowAt==k.stream.start&&(V=k.stream.match(/^\s*:\s*/,!1))&&(k.state.fatArrowAt=k.stream.pos+V[0].length),x(ut)}else{if(v=="number"||v=="string")return k.marked=p?"property":k.style+" property",x(ut);if(v=="jsonld-keyword")return x(ut);if(T&&ge(E))return k.marked="keyword",x(Xe);if(v=="[")return x(ue,Mt,le("]"),ut);if(v=="spread")return x(Fe,ut);if(E=="*")return k.marked="keyword",x(Xe);if(v==":")return oe(ut)}}function mt(v){return v!="variable"?oe(ut):(k.marked="property",x(jt))}function ut(v){if(v==":")return x(Fe);if(v=="(")return oe(jt)}function qe(v,E,V){function Y(O,ce){if(V?V.indexOf(O)>-1:O==","){var Pe=k.state.lexical;return Pe.info=="call"&&(Pe.pos=(Pe.pos||0)+1),x(function(_t,zt){return _t==E||zt==E?oe():oe(v)},Y)}return O==E||ce==E?x():V&&V.indexOf(";")>-1?oe(v):x(le(E))}return function(O,ce){return O==E||ce==E?x():oe(v,Y)}}function kt(v,E,V){for(var Y=3;Y<arguments.length;Y++)k.cc.push(arguments[Y]);return x(ve(E,V),qe(v,E),se)}function ft(v){return v=="}"?x():oe(ye,ft)}function Mt(v,E){if(T){if(v==":")return x(Ne);if(E=="?")return x(Mt)}}function br(v,E){if(T&&(v==":"||E=="in"))return x(Ne)}function vr(v){if(T&&v==":")return k.stream.match(/^\s*\w+\s+is\b/,!1)?x(ue,vn,Ne):x(Ne)}function vn(v,E){if(E=="is")return k.marked="keyword",x()}function Ne(v,E){if(E=="keyof"||E=="typeof"||E=="infer"||E=="readonly")return k.marked="keyword",x(E=="typeof"?Fe:Ne);if(v=="variable"||E=="void")return k.marked="type",x(sr);if(E=="|"||E=="&")return x(Ne);if(v=="string"||v=="number"||v=="atom")return x(sr);if(v=="[")return x(ve("]"),qe(Ne,"]",","),se,sr);if(v=="{")return x(ve("}"),Ie,se,sr);if(v=="(")return x(qe($e,")"),Sr,sr);if(v=="<")return x(qe(Ne,">"),Ne);if(v=="quasi")return oe(Ct,sr)}function Sr(v){if(v=="=>")return x(Ne)}function Ie(v){return v.match(/[\}\)\]]/)?x():v==","||v==";"?x(Ie):oe(yr,Ie)}function yr(v,E){if(v=="variable"||k.style=="keyword")return k.marked="property",x(yr);if(E=="?"||v=="number"||v=="string")return x(yr);if(v==":")return x(Ne);if(v=="[")return x(le("variable"),br,le("]"),yr);if(v=="(")return oe(wr,yr);if(!v.match(/[;\}\)\],]/))return x()}function Ct(v,E){return v!="quasi"?oe():E.slice(E.length-2)!="${"?x(Ct):x(Ne,Ke)}function Ke(v){if(v=="}")return k.marked="string-2",k.state.tokenize=te,x(Ct)}function $e(v,E){return v=="variable"&&k.stream.match(/^\s*[?:]/,!1)||E=="?"?x($e):v==":"?x(Ne):v=="spread"?x($e):oe(Ne)}function sr(v,E){if(E=="<")return x(ve(">"),qe(Ne,">"),se,sr);if(E=="|"||v=="."||E=="&")return x(Ne);if(v=="[")return x(Ne,le("]"),sr);if(E=="extends"||E=="implements")return k.marked="keyword",x(Ne);if(E=="?")return x(Ne,le(":"),Ne)}function yt(v,E){if(E=="<")return x(ve(">"),qe(Ne,">"),se,sr)}function xr(){return oe(Ne,At)}function At(v,E){if(E=="=")return x(Ne)}function rt(v,E){return E=="enum"?(k.marked="keyword",x(he)):oe(pt,Mt,Yt,si)}function pt(v,E){if(T&&ge(E))return k.marked="keyword",x(pt);if(v=="variable")return D(E),x();if(v=="spread")return x(pt);if(v=="[")return kt(yn,"]");if(v=="{")return kt(Wr,"}")}function Wr(v,E){return v=="variable"&&!k.stream.match(/^\s*:/,!1)?(D(E),x(Yt)):(v=="variable"&&(k.marked="property"),v=="spread"?x(pt):v=="}"?oe():v=="["?x(ue,le("]"),le(":"),Wr):x(le(":"),pt,Yt))}function yn(){return oe(pt,Yt)}function Yt(v,E){if(E=="=")return x(Fe)}function si(v){if(v==",")return x(rt)}function en(v,E){if(v=="keyword b"&&E=="else")return x(ve("form","else"),ye,se)}function li(v,E){if(E=="await")return x(li);if(v=="(")return x(ve(")"),Pt,se)}function Pt(v){return v=="var"?x(rt,Ht):v=="variable"?x(Ht):oe(Ht)}function Ht(v,E){return v==")"?x():v==";"?x(Ht):E=="in"||E=="of"?(k.marked="keyword",x(ue,Ht)):oe(ue,Ht)}function jt(v,E){if(E=="*")return k.marked="keyword",x(jt);if(v=="variable")return D(E),x(jt);if(v=="(")return x(re,ve(")"),qe(lr,")"),se,vr,ye,Ce);if(T&&E=="<")return x(ve(">"),qe(xr,">"),se,jt)}function wr(v,E){if(E=="*")return k.marked="keyword",x(wr);if(v=="variable")return D(E),x(wr);if(v=="(")return x(re,ve(")"),qe(lr,")"),se,vr,Ce);if(T&&E=="<")return x(ve(">"),qe(xr,">"),se,wr)}function xn(v,E){if(v=="keyword"||v=="variable")return k.marked="type",x(xn);if(E=="<")return x(ve(">"),qe(xr,">"),se)}function lr(v,E){return E=="@"&&x(ue,lr),v=="spread"?x(lr):T&&ge(E)?(k.marked="keyword",x(lr)):T&&v=="this"?x(Mt,Yt):oe(pt,Mt,Yt)}function Tr(v,E){return v=="variable"?tn(v,E):ur(v,E)}function tn(v,E){if(v=="variable")return D(E),x(ur)}function ur(v,E){if(E=="<")return x(ve(">"),qe(xr,">"),se,ur);if(E=="extends"||E=="implements"||T&&v==",")return E=="implements"&&(k.marked="keyword"),x(T?Ne:ue,ur);if(v=="{")return x(ve("}"),fr,se)}function fr(v,E){if(v=="async"||v=="variable"&&(E=="static"||E=="get"||E=="set"||T&&ge(E))&&k.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return k.marked="keyword",x(fr);if(v=="variable"||k.style=="keyword")return k.marked="property",x(Dr,fr);if(v=="number"||v=="string")return x(Dr,fr);if(v=="[")return x(ue,Mt,le("]"),Dr,fr);if(E=="*")return k.marked="keyword",x(fr);if(T&&v=="(")return oe(wr,fr);if(v==";"||v==",")return x(fr);if(v=="}")return x();if(E=="@")return x(ue,fr)}function Dr(v,E){if(E=="!"||E=="?")return x(Dr);if(v==":")return x(Ne,Yt);if(E=="=")return x(Fe);var V=k.state.lexical.prev,Y=V&&V.info=="interface";return oe(Y?wr:jt)}function Tn(v,E){return E=="*"?(k.marked="keyword",x(dt,le(";"))):E=="default"?(k.marked="keyword",x(ue,le(";"))):v=="{"?x(qe(xe,"}"),dt,le(";")):oe(ye)}function xe(v,E){if(E=="as")return k.marked="keyword",x(le("variable"));if(v=="variable")return oe(Fe,xe)}function N(v){return v=="string"?x():v=="("?oe(ue):v=="."?oe(Re):oe(K,be,dt)}function K(v,E){return v=="{"?kt(K,"}"):(v=="variable"&&D(E),E=="*"&&(k.marked="keyword"),x(Ye))}function be(v){if(v==",")return x(K,be)}function Ye(v,E){if(E=="as")return k.marked="keyword",x(K)}function dt(v,E){if(E=="from")return k.marked="keyword",x(ue)}function Ue(v){return v=="]"?x():oe(qe(Fe,"]"))}function he(){return oe(ve("form"),pt,le("{"),ve("}"),qe(Rt,"}"),se,se)}function Rt(){return oe(pt,Yt)}function Cr(v,E){return v.lastType=="operator"||v.lastType==","||F.test(E.charAt(0))||/[,.]/.test(E.charAt(0))}function Dt(v,E,V){return E.tokenize==G&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(E.lastType)||E.lastType=="quasi"&&/\{\s*$/.test(v.string.slice(0,v.pos-(V||0)))}return{startState:function(v){var E={tokenize:G,lastType:"sof",cc:[],lexical:new P((v||0)-l,0,"block",!1),localVars:a.localVars,context:a.localVars&&new Oe(null,null,!1),indented:v||0};return a.globalVars&&typeof a.globalVars=="object"&&(E.globalVars=a.globalVars),E},token:function(v,E){if(v.sol()&&(E.lexical.hasOwnProperty("align")||(E.lexical.align=!1),E.indented=v.indentation(),R(v,E)),E.tokenize!=q&&v.eatSpace())return null;var V=E.tokenize(v,E);return S=="comment"?V:(E.lastType=S=="operator"&&(Z=="++"||Z=="--")?"incdec":S,fe(E,V,S,Z,v))},indent:function(v,E){if(v.tokenize==q||v.tokenize==te)return r.Pass;if(v.tokenize!=G)return 0;var V=E&&E.charAt(0),Y=v.lexical,O;if(!/^\s*else\b/.test(E))for(var ce=v.cc.length-1;ce>=0;--ce){var Pe=v.cc[ce];if(Pe==se)Y=Y.prev;else if(Pe!=en&&Pe!=Ce)break}for(;(Y.type=="stat"||Y.type=="form")&&(V=="}"||(O=v.cc[v.cc.length-1])&&(O==Re||O==De)&&!/^[,\.=+\-*:?[\(]/.test(E));)Y=Y.prev;c&&Y.type==")"&&Y.prev.type=="stat"&&(Y=Y.prev);var _t=Y.type,zt=V==_t;return _t=="vardef"?Y.indented+(v.lastType=="operator"||v.lastType==","?Y.info.length+1:0):_t=="form"&&V=="{"?Y.indented:_t=="form"?Y.indented+l:_t=="stat"?Y.indented+(Cr(v,E)?c||l:0):Y.info=="switch"&&!zt&&a.doubleIndentSwitch!=!1?Y.indented+(/^(?:case|default)\b/.test(E)?l:2*l):Y.align?Y.column+(zt?0:1):Y.indented+(zt?0:l)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:g?null:"/*",blockCommentEnd:g?null:"*/",blockCommentContinue:g?null:" * ",lineComment:g?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:g?"json":"javascript",jsonldMode:p,jsonMode:g,expressionAllowed:Dt,skipExpression:function(v){fe(v,"atom","atom","true",new r.StringStream("",2,null))}}}),r.registerHelper("wordChars","javascript",/[\w$]/),r.defineMIME("text/javascript","javascript"),r.defineMIME("text/ecmascript","javascript"),r.defineMIME("application/javascript","javascript"),r.defineMIME("application/x-javascript","javascript"),r.defineMIME("application/ecmascript","javascript"),r.defineMIME("application/json",{name:"javascript",json:!0}),r.defineMIME("application/x-json",{name:"javascript",json:!0}),r.defineMIME("application/manifest+json",{name:"javascript",json:!0}),r.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),r.defineMIME("text/typescript",{name:"javascript",typescript:!0}),r.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var RR={};Tb(RR,{Parser:()=>Us,Yasr:()=>$r,default:()=>AR,registerPlugin:()=>CR});var mm=Ar(Hc());var Sb=typeof global=="object"&&global&&global.Object===Object&&global,Oa=Sb;var wb=typeof self=="object"&&self&&self.Object===Object&&self,Lb=Oa||wb||Function("return this")(),Tt=Lb;var Fb=Tt.Symbol,rr=Fb;var Jc=Object.prototype,Bb=Jc.hasOwnProperty,Ub=Jc.toString,Lo=rr?rr.toStringTag:void 0;function kb(r){var n=Bb.call(r,Lo),a=r[Lo];try{r[Lo]=void 0;var l=!0}catch{}var c=Ub.call(r);return l&&(n?r[Lo]=a:delete r[Lo]),c}var Xc=kb;var Mb=Object.prototype,Gb=Mb.toString;function Ob(r){return Gb.call(r)}var Yc=Ob;var Wb="[object Null]",Db="[object Undefined]",jc=rr?rr.toStringTag:void 0;function Zb(r){return r==null?r===void 0?Db:Wb:jc&&jc in Object(r)?Xc(r):Yc(r)}var Er=Zb;function Vb(r){return r!=null&&typeof r=="object"}var Bt=Vb;var Qb="[object Symbol]";function Pb(r){return typeof r=="symbol"||Bt(r)&&Er(r)==Qb}var wi=Pb;function Hb(r,n){for(var a=-1,l=r==null?0:r.length,c=Array(l);++a<l;)c[a]=n(r[a],a,r);return c}var zc=Hb;var Jb=Array.isArray,nt=Jb;var Xb=1/0,qc=rr?rr.prototype:void 0,Kc=qc?qc.toString:void 0;function $c(r){if(typeof r=="string")return r;if(nt(r))return zc(r,$c)+"";if(wi(r))return Kc?Kc.call(r):"";var n=r+"";return n=="0"&&1/r==-Xb?"-0":n}var ed=$c;function Yb(r){var n=typeof r;return r!=null&&(n=="object"||n=="function")}var Ot=Yb;function jb(r){return r}var Li=jb;var zb="[object AsyncFunction]",qb="[object Function]",Kb="[object GeneratorFunction]",$b="[object Proxy]";function ev(r){if(!Ot(r))return!1;var n=Er(r);return n==qb||n==Kb||n==zb||n==$b}var Fi=ev;var tv=Tt["__core-js_shared__"],Wa=tv;var td=function(){var r=/[^.]+$/.exec(Wa&&Wa.keys&&Wa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function rv(r){return!!td&&td in r}var rd=rv;var nv=Function.prototype,iv=nv.toString;function ov(r){if(r!=null){try{return iv.call(r)}catch{}try{return r+""}catch{}}return""}var un=ov;var av=/[\\^$.*+?()[\]{}|]/g,sv=/^\[object .+?Constructor\]$/,lv=Function.prototype,uv=Object.prototype,fv=lv.toString,cv=uv.hasOwnProperty,dv=RegExp("^"+fv.call(cv).replace(av,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hv(r){if(!Ot(r)||rd(r))return!1;var n=Fi(r)?dv:sv;return n.test(un(r))}var nd=hv;function pv(r,n){return r?.[n]}var id=pv;function gv(r,n){var a=id(r,n);return nd(a)?a:void 0}var hr=gv;var mv=hr(Tt,"WeakMap"),Da=mv;var od=Object.create,bv=function(){function r(){}return function(n){if(!Ot(n))return{};if(od)return od(n);r.prototype=n;var a=new r;return r.prototype=void 0,a}}(),ad=bv;function vv(r,n,a){switch(a.length){case 0:return r.call(n);case 1:return r.call(n,a[0]);case 2:return r.call(n,a[0],a[1]);case 3:return r.call(n,a[0],a[1],a[2])}return r.apply(n,a)}var sd=vv;function yv(r,n){var a=-1,l=r.length;for(n||(n=Array(l));++a<l;)n[a]=r[a];return n}var Za=yv;var xv=800,Tv=16,Iv=Date.now;function Ev(r){var n=0,a=0;return function(){var l=Iv(),c=Tv-(l-a);if(a=l,c>0){if(++n>=xv)return arguments[0]}else n=0;return r.apply(void 0,arguments)}}var ld=Ev;function Cv(r){return function(){return r}}var ud=Cv;var Av=function(){try{var r=hr(Object,"defineProperty");return r({},"",{}),r}catch{}}(),Bi=Av;var Rv=Bi?function(r,n){return Bi(r,"toString",{configurable:!0,enumerable:!1,value:ud(n),writable:!0})}:Li,fd=Rv;var _v=ld(fd),cd=_v;function Nv(r,n){for(var a=-1,l=r==null?0:r.length;++a<l&&n(r[a],a,r)!==!1;);return r}var dd=Nv;var Sv=9007199254740991,wv=/^(?:0|[1-9]\d*)$/;function Lv(r,n){var a=typeof r;return n=n??Sv,!!n&&(a=="number"||a!="symbol"&&wv.test(r))&&r>-1&&r%1==0&&r<n}var Ui=Lv;function Fv(r,n,a){n=="__proto__"&&Bi?Bi(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}var Ln=Fv;function Bv(r,n){return r===n||r!==r&&n!==n}var Hr=Bv;var Uv=Object.prototype,kv=Uv.hasOwnProperty;function Mv(r,n,a){var l=r[n];(!(kv.call(r,n)&&Hr(l,a))||a===void 0&&!(n in r))&&Ln(r,n,a)}var Va=Mv;function Gv(r,n,a,l){var c=!a;a||(a={});for(var p=-1,g=n.length;++p<g;){var y=n[p],T=l?l(a[y],r[y],y,a,r):void 0;T===void 0&&(T=r[y]),c?Ln(a,y,T):Va(a,y,T)}return a}var Jr=Gv;var hd=Math.max;function Ov(r,n,a){return n=hd(n===void 0?r.length-1:n,0),function(){for(var l=arguments,c=-1,p=hd(l.length-n,0),g=Array(p);++c<p;)g[c]=l[n+c];c=-1;for(var y=Array(n+1);++c<n;)y[c]=l[c];return y[n]=a(g),sd(r,this,y)}}var pd=Ov;function Wv(r,n){return cd(pd(r,n,Li),r+"")}var gd=Wv;var Dv=9007199254740991;function Zv(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Dv}var ki=Zv;function Vv(r){return r!=null&&ki(r.length)&&!Fi(r)}var Rr=Vv;function Qv(r,n,a){if(!Ot(a))return!1;var l=typeof n;return(l=="number"?Rr(a)&&Ui(n,a.length):l=="string"&&n in a)?Hr(a[n],r):!1}var md=Qv;function Pv(r){return gd(function(n,a){var l=-1,c=a.length,p=c>1?a[c-1]:void 0,g=c>2?a[2]:void 0;for(p=r.length>3&&typeof p=="function"?(c--,p):void 0,g&&md(a[0],a[1],g)&&(p=c<3?void 0:p,c=1),n=Object(n);++l<c;){var y=a[l];y&&r(n,y,l,p)}return n})}var bd=Pv;var Hv=Object.prototype;function Jv(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||Hv;return r===a}var Fn=Jv;function Xv(r,n){for(var a=-1,l=Array(r);++a<r;)l[a]=n(a);return l}var vd=Xv;var Yv="[object Arguments]";function jv(r){return Bt(r)&&Er(r)==Yv}var Fl=jv;var yd=Object.prototype,zv=yd.hasOwnProperty,qv=yd.propertyIsEnumerable,Kv=Fl(function(){return arguments}())?Fl:function(r){return Bt(r)&&zv.call(r,"callee")&&!qv.call(r,"callee")},fn=Kv;function $v(){return!1}var xd=$v;var Ed=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Td=Ed&&typeof module=="object"&&module&&!module.nodeType&&module,ey=Td&&Td.exports===Ed,Id=ey?Tt.Buffer:void 0,ty=Id?Id.isBuffer:void 0,ry=ty||xd,kr=ry;var ny="[object Arguments]",iy="[object Array]",oy="[object Boolean]",ay="[object Date]",sy="[object Error]",ly="[object Function]",uy="[object Map]",fy="[object Number]",cy="[object Object]",dy="[object RegExp]",hy="[object Set]",py="[object String]",gy="[object WeakMap]",my="[object ArrayBuffer]",by="[object DataView]",vy="[object Float32Array]",yy="[object Float64Array]",xy="[object Int8Array]",Ty="[object Int16Array]",Iy="[object Int32Array]",Ey="[object Uint8Array]",Cy="[object Uint8ClampedArray]",Ay="[object Uint16Array]",Ry="[object Uint32Array]",st={};st[vy]=st[yy]=st[xy]=st[Ty]=st[Iy]=st[Ey]=st[Cy]=st[Ay]=st[Ry]=!0;st[ny]=st[iy]=st[my]=st[oy]=st[by]=st[ay]=st[sy]=st[ly]=st[uy]=st[fy]=st[cy]=st[dy]=st[hy]=st[py]=st[gy]=!1;function _y(r){return Bt(r)&&ki(r.length)&&!!st[Er(r)]}var Cd=_y;function Ny(r){return function(n){return r(n)}}var Mi=Ny;var Ad=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fo=Ad&&typeof module=="object"&&module&&!module.nodeType&&module,Sy=Fo&&Fo.exports===Ad,Bl=Sy&&Oa.process,wy=function(){try{var r=Fo&&Fo.require&&Fo.require("util").types;return r||Bl&&Bl.binding&&Bl.binding("util")}catch{}}(),cn=wy;var Rd=cn&&cn.isTypedArray,Ly=Rd?Mi(Rd):Cd,Bn=Ly;var Fy=Object.prototype,By=Fy.hasOwnProperty;function Uy(r,n){var a=nt(r),l=!a&&fn(r),c=!a&&!l&&kr(r),p=!a&&!l&&!c&&Bn(r),g=a||l||c||p,y=g?vd(r.length,String):[],T=y.length;for(var U in r)(n||By.call(r,U))&&!(g&&(U=="length"||c&&(U=="offset"||U=="parent")||p&&(U=="buffer"||U=="byteLength"||U=="byteOffset")||Ui(U,T)))&&y.push(U);return y}var Qa=Uy;function ky(r,n){return function(a){return r(n(a))}}var Pa=ky;var My=Pa(Object.keys,Object),_d=My;var Gy=Object.prototype,Oy=Gy.hasOwnProperty;function Wy(r){if(!Fn(r))return _d(r);var n=[];for(var a in Object(r))Oy.call(r,a)&&a!="constructor"&&n.push(a);return n}var Ha=Wy;function Dy(r){return Rr(r)?Qa(r):Ha(r)}var Xr=Dy;function Zy(r){var n=[];if(r!=null)for(var a in Object(r))n.push(a);return n}var Nd=Zy;var Vy=Object.prototype,Qy=Vy.hasOwnProperty;function Py(r){if(!Ot(r))return Nd(r);var n=Fn(r),a=[];for(var l in r)l=="constructor"&&(n||!Qy.call(r,l))||a.push(l);return a}var Sd=Py;function Hy(r){return Rr(r)?Qa(r,!0):Sd(r)}var Yr=Hy;var Jy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xy=/^\w*$/;function Yy(r,n){if(nt(r))return!1;var a=typeof r;return a=="number"||a=="symbol"||a=="boolean"||r==null||wi(r)?!0:Xy.test(r)||!Jy.test(r)||n!=null&&r in Object(n)}var Gi=Yy;var jy=hr(Object,"create"),dn=jy;function zy(){this.__data__=dn?dn(null):{},this.size=0}var wd=zy;function qy(r){var n=this.has(r)&&delete this.__data__[r];return this.size-=n?1:0,n}var Ld=qy;var Ky="__lodash_hash_undefined__",$y=Object.prototype,ex=$y.hasOwnProperty;function tx(r){var n=this.__data__;if(dn){var a=n[r];return a===Ky?void 0:a}return ex.call(n,r)?n[r]:void 0}var Fd=tx;var rx=Object.prototype,nx=rx.hasOwnProperty;function ix(r){var n=this.__data__;return dn?n[r]!==void 0:nx.call(n,r)}var Bd=ix;var ox="__lodash_hash_undefined__";function ax(r,n){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=dn&&n===void 0?ox:n,this}var Ud=ax;function Oi(r){var n=-1,a=r==null?0:r.length;for(this.clear();++n<a;){var l=r[n];this.set(l[0],l[1])}}Oi.prototype.clear=wd;Oi.prototype.delete=Ld;Oi.prototype.get=Fd;Oi.prototype.has=Bd;Oi.prototype.set=Ud;var Ul=Oi;function sx(){this.__data__=[],this.size=0}var kd=sx;function lx(r,n){for(var a=r.length;a--;)if(Hr(r[a][0],n))return a;return-1}var Un=lx;var ux=Array.prototype,fx=ux.splice;function cx(r){var n=this.__data__,a=Un(n,r);if(a<0)return!1;var l=n.length-1;return a==l?n.pop():fx.call(n,a,1),--this.size,!0}var Md=cx;function dx(r){var n=this.__data__,a=Un(n,r);return a<0?void 0:n[a][1]}var Gd=dx;function hx(r){return Un(this.__data__,r)>-1}var Od=hx;function px(r,n){var a=this.__data__,l=Un(a,r);return l<0?(++this.size,a.push([r,n])):a[l][1]=n,this}var Wd=px;function Wi(r){var n=-1,a=r==null?0:r.length;for(this.clear();++n<a;){var l=r[n];this.set(l[0],l[1])}}Wi.prototype.clear=kd;Wi.prototype.delete=Md;Wi.prototype.get=Gd;Wi.prototype.has=Od;Wi.prototype.set=Wd;var kn=Wi;var gx=hr(Tt,"Map"),Mn=gx;function mx(){this.size=0,this.__data__={hash:new Ul,map:new(Mn||kn),string:new Ul}}var Dd=mx;function bx(r){var n=typeof r;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?r!=="__proto__":r===null}var Zd=bx;function vx(r,n){var a=r.__data__;return Zd(n)?a[typeof n=="string"?"string":"hash"]:a.map}var Gn=vx;function yx(r){var n=Gn(this,r).delete(r);return this.size-=n?1:0,n}var Vd=yx;function xx(r){return Gn(this,r).get(r)}var Qd=xx;function Tx(r){return Gn(this,r).has(r)}var Pd=Tx;function Ix(r,n){var a=Gn(this,r),l=a.size;return a.set(r,n),this.size+=a.size==l?0:1,this}var Hd=Ix;function Di(r){var n=-1,a=r==null?0:r.length;for(this.clear();++n<a;){var l=r[n];this.set(l[0],l[1])}}Di.prototype.clear=Dd;Di.prototype.delete=Vd;Di.prototype.get=Qd;Di.prototype.has=Pd;Di.prototype.set=Hd;var qn=Di;var Ex="Expected a function";function kl(r,n){if(typeof r!="function"||n!=null&&typeof n!="function")throw new TypeError(Ex);var a=function(){var l=arguments,c=n?n.apply(this,l):l[0],p=a.cache;if(p.has(c))return p.get(c);var g=r.apply(this,l);return a.cache=p.set(c,g)||p,g};return a.cache=new(kl.Cache||qn),a}kl.Cache=qn;var Jd=kl;var Cx=500;function Ax(r){var n=Jd(r,function(l){return a.size===Cx&&a.clear(),l}),a=n.cache;return n}var Xd=Ax;var Rx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_x=/\\(\\)?/g,Nx=Xd(function(r){var n=[];return r.charCodeAt(0)===46&&n.push(""),r.replace(Rx,function(a,l,c,p){n.push(c?p.replace(_x,"$1"):l||a)}),n}),Yd=Nx;function Sx(r){return r==null?"":ed(r)}var Zi=Sx;function wx(r,n){return nt(r)?r:Gi(r,n)?[r]:Yd(Zi(r))}var Ja=wx;var Lx=1/0;function Fx(r){if(typeof r=="string"||wi(r))return r;var n=r+"";return n=="0"&&1/r==-Lx?"-0":n}var On=Fx;function Bx(r,n){n=Ja(n,r);for(var a=0,l=n.length;r!=null&&a<l;)r=r[On(n[a++])];return a&&a==l?r:void 0}var Xa=Bx;function Ux(r,n,a){var l=r==null?void 0:Xa(r,n);return l===void 0?a:l}var jd=Ux;function kx(r,n){for(var a=-1,l=n.length,c=r.length;++a<l;)r[c+a]=n[a];return r}var Ya=kx;var Mx=Pa(Object.getPrototypeOf,Object),Vi=Mx;var Gx="[object Object]",Ox=Function.prototype,Wx=Object.prototype,zd=Ox.toString,Dx=Wx.hasOwnProperty,Zx=zd.call(Object);function Vx(r){if(!Bt(r)||Er(r)!=Gx)return!1;var n=Vi(r);if(n===null)return!0;var a=Dx.call(n,"constructor")&&n.constructor;return typeof a=="function"&&a instanceof a&&zd.call(a)==Zx}var qd=Vx;function Qx(r){return function(n){return r?.[n]}}var Kd=Qx;function Px(){this.__data__=new kn,this.size=0}var $d=Px;function Hx(r){var n=this.__data__,a=n.delete(r);return this.size=n.size,a}var eh=Hx;function Jx(r){return this.__data__.get(r)}var th=Jx;function Xx(r){return this.__data__.has(r)}var rh=Xx;var Yx=200;function jx(r,n){var a=this.__data__;if(a instanceof kn){var l=a.__data__;if(!Mn||l.length<Yx-1)return l.push([r,n]),this.size=++a.size,this;a=this.__data__=new qn(l)}return a.set(r,n),this.size=a.size,this}var nh=jx;function Qi(r){var n=this.__data__=new kn(r);this.size=n.size}Qi.prototype.clear=$d;Qi.prototype.delete=eh;Qi.prototype.get=th;Qi.prototype.has=rh;Qi.prototype.set=nh;var jr=Qi;function zx(r,n){return r&&Jr(n,Xr(n),r)}var ih=zx;function qx(r,n){return r&&Jr(n,Yr(n),r)}var oh=qx;var uh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ah=uh&&typeof module=="object"&&module&&!module.nodeType&&module,Kx=ah&&ah.exports===uh,sh=Kx?Tt.Buffer:void 0,lh=sh?sh.allocUnsafe:void 0;function $x(r,n){if(n)return r.slice();var a=r.length,l=lh?lh(a):new r.constructor(a);return r.copy(l),l}var ja=$x;function eT(r,n){for(var a=-1,l=r==null?0:r.length,c=0,p=[];++a<l;){var g=r[a];n(g,a,r)&&(p[c++]=g)}return p}var za=eT;function tT(){return[]}var qa=tT;var rT=Object.prototype,nT=rT.propertyIsEnumerable,fh=Object.getOwnPropertySymbols,iT=fh?function(r){return r==null?[]:(r=Object(r),za(fh(r),function(n){return nT.call(r,n)}))}:qa,Pi=iT;function oT(r,n){return Jr(r,Pi(r),n)}var ch=oT;var aT=Object.getOwnPropertySymbols,sT=aT?function(r){for(var n=[];r;)Ya(n,Pi(r)),r=Vi(r);return n}:qa,Ka=sT;function lT(r,n){return Jr(r,Ka(r),n)}var dh=lT;function uT(r,n,a){var l=n(r);return nt(r)?l:Ya(l,a(r))}var $a=uT;function fT(r){return $a(r,Xr,Pi)}var Bo=fT;function cT(r){return $a(r,Yr,Ka)}var hh=cT;var dT=hr(Tt,"DataView"),es=dT;var hT=hr(Tt,"Promise"),ts=hT;var pT=hr(Tt,"Set"),rs=pT;var ph="[object Map]",gT="[object Object]",gh="[object Promise]",mh="[object Set]",bh="[object WeakMap]",vh="[object DataView]",mT=un(es),bT=un(Mn),vT=un(ts),yT=un(rs),xT=un(Da),Kn=Er;(es&&Kn(new es(new ArrayBuffer(1)))!=vh||Mn&&Kn(new Mn)!=ph||ts&&Kn(ts.resolve())!=gh||rs&&Kn(new rs)!=mh||Da&&Kn(new Da)!=bh)&&(Kn=function(r){var n=Er(r),a=n==gT?r.constructor:void 0,l=a?un(a):"";if(l)switch(l){case mT:return vh;case bT:return ph;case vT:return gh;case yT:return mh;case xT:return bh}return n});var Mr=Kn;var TT=Object.prototype,IT=TT.hasOwnProperty;function ET(r){var n=r.length,a=new r.constructor(n);return n&&typeof r[0]=="string"&&IT.call(r,"index")&&(a.index=r.index,a.input=r.input),a}var yh=ET;var CT=Tt.Uint8Array,Hi=CT;function AT(r){var n=new r.constructor(r.byteLength);return new Hi(n).set(new Hi(r)),n}var Ji=AT;function RT(r,n){var a=n?Ji(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}var xh=RT;var _T=/\w*$/;function NT(r){var n=new r.constructor(r.source,_T.exec(r));return n.lastIndex=r.lastIndex,n}var Th=NT;var Ih=rr?rr.prototype:void 0,Eh=Ih?Ih.valueOf:void 0;function ST(r){return Eh?Object(Eh.call(r)):{}}var Ch=ST;function wT(r,n){var a=n?Ji(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}var ns=wT;var LT="[object Boolean]",FT="[object Date]",BT="[object Map]",UT="[object Number]",kT="[object RegExp]",MT="[object Set]",GT="[object String]",OT="[object Symbol]",WT="[object ArrayBuffer]",DT="[object DataView]",ZT="[object Float32Array]",VT="[object Float64Array]",QT="[object Int8Array]",PT="[object Int16Array]",HT="[object Int32Array]",JT="[object Uint8Array]",XT="[object Uint8ClampedArray]",YT="[object Uint16Array]",jT="[object Uint32Array]";function zT(r,n,a){var l=r.constructor;switch(n){case WT:return Ji(r);case LT:case FT:return new l(+r);case DT:return xh(r,a);case ZT:case VT:case QT:case PT:case HT:case JT:case XT:case YT:case jT:return ns(r,a);case BT:return new l;case UT:case GT:return new l(r);case kT:return Th(r);case MT:return new l;case OT:return Ch(r)}}var Ah=zT;function qT(r){return typeof r.constructor=="function"&&!Fn(r)?ad(Vi(r)):{}}var is=qT;var KT="[object Map]";function $T(r){return Bt(r)&&Mr(r)==KT}var Rh=$T;var _h=cn&&cn.isMap,eI=_h?Mi(_h):Rh,Nh=eI;var tI="[object Set]";function rI(r){return Bt(r)&&Mr(r)==tI}var Sh=rI;var wh=cn&&cn.isSet,nI=wh?Mi(wh):Sh,Lh=nI;var iI=1,oI=2,aI=4,Fh="[object Arguments]",sI="[object Array]",lI="[object Boolean]",uI="[object Date]",fI="[object Error]",Bh="[object Function]",cI="[object GeneratorFunction]",dI="[object Map]",hI="[object Number]",Uh="[object Object]",pI="[object RegExp]",gI="[object Set]",mI="[object String]",bI="[object Symbol]",vI="[object WeakMap]",yI="[object ArrayBuffer]",xI="[object DataView]",TI="[object Float32Array]",II="[object Float64Array]",EI="[object Int8Array]",CI="[object Int16Array]",AI="[object Int32Array]",RI="[object Uint8Array]",_I="[object Uint8ClampedArray]",NI="[object Uint16Array]",SI="[object Uint32Array]",it={};it[Fh]=it[sI]=it[yI]=it[xI]=it[lI]=it[uI]=it[TI]=it[II]=it[EI]=it[CI]=it[AI]=it[dI]=it[hI]=it[Uh]=it[pI]=it[gI]=it[mI]=it[bI]=it[RI]=it[_I]=it[NI]=it[SI]=!0;it[fI]=it[Bh]=it[vI]=!1;function os(r,n,a,l,c,p){var g,y=n&iI,T=n&oI,U=n&aI;if(a&&(g=c?a(r,l,c,p):a(r)),g!==void 0)return g;if(!Ot(r))return r;var A=nt(r);if(A){if(g=yh(r),!y)return Za(r,g)}else{var F=Mr(r),M=F==Bh||F==cI;if(kr(r))return ja(r,y);if(F==Uh||F==Fh||M&&!c){if(g=T||M?{}:is(r),!y)return T?dh(r,oh(g,r)):ch(r,ih(g,r))}else{if(!it[F])return c?r:{};g=Ah(r,F,y)}}p||(p=new jr);var X=p.get(r);if(X)return X;p.set(r,g),Lh(r)?r.forEach(function(_){g.add(os(_,n,a,_,r,p))}):Nh(r)&&r.forEach(function(_,G){g.set(G,os(_,n,a,G,r,p))});var S=U?T?hh:Bo:T?Yr:Xr,Z=A?void 0:S(r);return dd(Z||r,function(_,G){Z&&(G=_,_=r[G]),Va(g,G,os(_,n,a,G,r,p))}),g}var kh=os;var wI=1,LI=4;function FI(r){return kh(r,wI|LI)}var as=FI;var BI="__lodash_hash_undefined__";function UI(r){return this.__data__.set(r,BI),this}var Mh=UI;function kI(r){return this.__data__.has(r)}var Gh=kI;function ss(r){var n=-1,a=r==null?0:r.length;for(this.__data__=new qn;++n<a;)this.add(r[n])}ss.prototype.add=ss.prototype.push=Mh;ss.prototype.has=Gh;var Oh=ss;function MI(r,n){for(var a=-1,l=r==null?0:r.length;++a<l;)if(n(r[a],a,r))return!0;return!1}var Wh=MI;function GI(r,n){return r.has(n)}var Dh=GI;var OI=1,WI=2;function DI(r,n,a,l,c,p){var g=a&OI,y=r.length,T=n.length;if(y!=T&&!(g&&T>y))return!1;var U=p.get(r),A=p.get(n);if(U&&A)return U==n&&A==r;var F=-1,M=!0,X=a&WI?new Oh:void 0;for(p.set(r,n),p.set(n,r);++F<y;){var S=r[F],Z=n[F];if(l)var _=g?l(Z,S,F,n,r,p):l(S,Z,F,r,n,p);if(_!==void 0){if(_)continue;M=!1;break}if(X){if(!Wh(n,function(G,J){if(!Dh(X,J)&&(S===G||c(S,G,a,l,p)))return X.push(J)})){M=!1;break}}else if(!(S===Z||c(S,Z,a,l,p))){M=!1;break}}return p.delete(r),p.delete(n),M}var ls=DI;function ZI(r){var n=-1,a=Array(r.size);return r.forEach(function(l,c){a[++n]=[c,l]}),a}var Zh=ZI;function VI(r){var n=-1,a=Array(r.size);return r.forEach(function(l){a[++n]=l}),a}var Vh=VI;var QI=1,PI=2,HI="[object Boolean]",JI="[object Date]",XI="[object Error]",YI="[object Map]",jI="[object Number]",zI="[object RegExp]",qI="[object Set]",KI="[object String]",$I="[object Symbol]",eE="[object ArrayBuffer]",tE="[object DataView]",Qh=rr?rr.prototype:void 0,Ml=Qh?Qh.valueOf:void 0;function rE(r,n,a,l,c,p,g){switch(a){case tE:if(r.byteLength!=n.byteLength||r.byteOffset!=n.byteOffset)return!1;r=r.buffer,n=n.buffer;case eE:return!(r.byteLength!=n.byteLength||!p(new Hi(r),new Hi(n)));case HI:case JI:case jI:return Hr(+r,+n);case XI:return r.name==n.name&&r.message==n.message;case zI:case KI:return r==n+"";case YI:var y=Zh;case qI:var T=l&QI;if(y||(y=Vh),r.size!=n.size&&!T)return!1;var U=g.get(r);if(U)return U==n;l|=PI,g.set(r,n);var A=ls(y(r),y(n),l,c,p,g);return g.delete(r),A;case $I:if(Ml)return Ml.call(r)==Ml.call(n)}return!1}var Ph=rE;var nE=1,iE=Object.prototype,oE=iE.hasOwnProperty;function aE(r,n,a,l,c,p){var g=a&nE,y=Bo(r),T=y.length,U=Bo(n),A=U.length;if(T!=A&&!g)return!1;for(var F=T;F--;){var M=y[F];if(!(g?M in n:oE.call(n,M)))return!1}var X=p.get(r),S=p.get(n);if(X&&S)return X==n&&S==r;var Z=!0;p.set(r,n),p.set(n,r);for(var _=g;++F<T;){M=y[F];var G=r[M],J=n[M];if(l)var q=g?l(J,G,M,n,r,p):l(G,J,M,r,n,p);if(!(q===void 0?G===J||c(G,J,a,l,p):q)){Z=!1;break}_||(_=M=="constructor")}if(Z&&!_){var te=r.constructor,ae=n.constructor;te!=ae&&"constructor"in r&&"constructor"in n&&!(typeof te=="function"&&te instanceof te&&typeof ae=="function"&&ae instanceof ae)&&(Z=!1)}return p.delete(r),p.delete(n),Z}var Hh=aE;var sE=1,Jh="[object Arguments]",Xh="[object Array]",us="[object Object]",lE=Object.prototype,Yh=lE.hasOwnProperty;function uE(r,n,a,l,c,p){var g=nt(r),y=nt(n),T=g?Xh:Mr(r),U=y?Xh:Mr(n);T=T==Jh?us:T,U=U==Jh?us:U;var A=T==us,F=U==us,M=T==U;if(M&&kr(r)){if(!kr(n))return!1;g=!0,A=!1}if(M&&!A)return p||(p=new jr),g||Bn(r)?ls(r,n,a,l,c,p):Ph(r,n,T,a,l,c,p);if(!(a&sE)){var X=A&&Yh.call(r,"__wrapped__"),S=F&&Yh.call(n,"__wrapped__");if(X||S){var Z=X?r.value():r,_=S?n.value():n;return p||(p=new jr),c(Z,_,a,l,p)}}return M?(p||(p=new jr),Hh(r,n,a,l,c,p)):!1}var jh=uE;function zh(r,n,a,l,c){return r===n?!0:r==null||n==null||!Bt(r)&&!Bt(n)?r!==r&&n!==n:jh(r,n,a,l,zh,c)}var fs=zh;var fE=1,cE=2;function dE(r,n,a,l){var c=a.length,p=c,g=!l;if(r==null)return!p;for(r=Object(r);c--;){var y=a[c];if(g&&y[2]?y[1]!==r[y[0]]:!(y[0]in r))return!1}for(;++c<p;){y=a[c];var T=y[0],U=r[T],A=y[1];if(g&&y[2]){if(U===void 0&&!(T in r))return!1}else{var F=new jr;if(l)var M=l(U,A,T,r,n,F);if(!(M===void 0?fs(A,U,fE|cE,l,F):M))return!1}}return!0}var qh=dE;function hE(r){return r===r&&!Ot(r)}var cs=hE;function pE(r){for(var n=Xr(r),a=n.length;a--;){var l=n[a],c=r[l];n[a]=[l,c,cs(c)]}return n}var Kh=pE;function gE(r,n){return function(a){return a==null?!1:a[r]===n&&(n!==void 0||r in Object(a))}}var ds=gE;function mE(r){var n=Kh(r);return n.length==1&&n[0][2]?ds(n[0][0],n[0][1]):function(a){return a===r||qh(a,r,n)}}var $h=mE;function bE(r,n){return r!=null&&n in Object(r)}var ep=bE;function vE(r,n,a){n=Ja(n,r);for(var l=-1,c=n.length,p=!1;++l<c;){var g=On(n[l]);if(!(p=r!=null&&a(r,g)))break;r=r[g]}return p||++l!=c?p:(c=r==null?0:r.length,!!c&&ki(c)&&Ui(g,c)&&(nt(r)||fn(r)))}var tp=vE;function yE(r,n){return r!=null&&tp(r,n,ep)}var rp=yE;var xE=1,TE=2;function IE(r,n){return Gi(r)&&cs(n)?ds(On(r),n):function(a){var l=jd(a,r);return l===void 0&&l===n?rp(a,r):fs(n,l,xE|TE)}}var np=IE;function EE(r){return function(n){return n?.[r]}}var ip=EE;function CE(r){return function(n){return Xa(n,r)}}var op=CE;function AE(r){return Gi(r)?ip(On(r)):op(r)}var ap=AE;function RE(r){return typeof r=="function"?r:r==null?Li:typeof r=="object"?nt(r)?np(r[0],r[1]):$h(r):ap(r)}var hs=RE;function _E(r){return function(n,a,l){for(var c=-1,p=Object(n),g=l(n),y=g.length;y--;){var T=g[r?y:++c];if(a(p[T],T,p)===!1)break}return n}}var sp=_E;var NE=sp(),ps=NE;function SE(r,n){return r&&ps(r,n,Xr)}var gs=SE;function wE(r,n){return function(a,l){if(a==null)return a;if(!Rr(a))return r(a,l);for(var c=a.length,p=n?c:-1,g=Object(a);(n?p--:++p<c)&&l(g[p],p,g)!==!1;);return a}}var lp=wE;var LE=lp(gs),up=LE;function FE(r,n,a){(a!==void 0&&!Hr(r[n],a)||a===void 0&&!(n in r))&&Ln(r,n,a)}var Uo=FE;function BE(r){return Bt(r)&&Rr(r)}var fp=BE;function UE(r,n){if(!(n==="constructor"&&typeof r[n]=="function")&&n!="__proto__")return r[n]}var ko=UE;function kE(r){return Jr(r,Yr(r))}var cp=kE;function ME(r,n,a,l,c,p,g){var y=ko(r,a),T=ko(n,a),U=g.get(T);if(U){Uo(r,a,U);return}var A=p?p(y,T,a+"",r,n,g):void 0,F=A===void 0;if(F){var M=nt(T),X=!M&&kr(T),S=!M&&!X&&Bn(T);A=T,M||X||S?nt(y)?A=y:fp(y)?A=Za(y):X?(F=!1,A=ja(T,!0)):S?(F=!1,A=ns(T,!0)):A=[]:qd(T)||fn(T)?(A=y,fn(y)?A=cp(y):(!Ot(y)||Fi(y))&&(A=is(T))):F=!1}F&&(g.set(T,A),c(A,T,l,p,g),g.delete(T)),Uo(r,a,A)}var dp=ME;function hp(r,n,a,l,c){r!==n&&ps(n,function(p,g){if(c||(c=new jr),Ot(p))dp(r,n,g,a,hp,l,c);else{var y=l?l(ko(r,g),p,g+"",r,n,c):void 0;y===void 0&&(y=p),Uo(r,g,y)}},Yr)}var pp=hp;function GE(r,n){var a=[];return up(r,function(l,c,p){n(l,c,p)&&a.push(l)}),a}var gp=GE;function OE(r,n){var a=nt(r)?za:gp;return a(r,hs(n,3))}var Gl=OE;var WE="[object Map]",DE="[object Set]",ZE=Object.prototype,VE=ZE.hasOwnProperty;function QE(r){if(r==null)return!0;if(Rr(r)&&(nt(r)||typeof r=="string"||typeof r.splice=="function"||kr(r)||Bn(r)||fn(r)))return!r.length;var n=Mr(r);if(n==WE||n==DE)return!r.size;if(Fn(r))return!Ha(r).length;for(var a in r)if(VE.call(r,a))return!1;return!0}var ms=QE;function PE(r,n){var a={};return n=hs(n,3),gs(r,function(l,c,p){Ln(a,c,n(l,c,p))}),a}var Mo=PE;var HE=bd(function(r,n,a){pp(r,n,a)}),Ol=HE;var JE={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},XE=Kd(JE),mp=XE;var bp=/&(?:amp|lt|gt|quot|#39);/g,YE=RegExp(bp.source);function jE(r){return r=Zi(r),r&&YE.test(r)?r.replace(bp,mp):r}var Wl=jE;var zE=0;function qE(r){var n=++zE;return Zi(r)+n}var Dl=qE;function Zl(){return{persistenceId:function(r){var n="",a=r.rootEl;for(a.id&&(n=a.id);a&&a!==document;a=a.parentNode)if(a){a.id&&(n=a.id);break}return"yasr_"+n},getPlainQueryLinkToEndpoint:void 0,persistencyExpire:60*60*24*30,persistenceLabelResponse:"response",persistenceLabelConfig:"config",maxPersistentResponseSize:1e5,prefixes:{},plugins:{},pluginOrder:["Table","response","Geo","Graph"],defaultPlugin:"Table"}}var{entries:Rp,setPrototypeOf:vp,isFrozen:KE,getPrototypeOf:$E,getOwnPropertyDescriptor:eC}=Object,{freeze:ir,seal:_r,create:Yl}=Object,{apply:jl,construct:zl}=typeof Reflect<"u"&&Reflect;ir||(ir=function(n){return n});_r||(_r=function(n){return n});jl||(jl=function(n,a){for(var l=arguments.length,c=new Array(l>2?l-2:0),p=2;p<l;p++)c[p-2]=arguments[p];return n.apply(a,c)});zl||(zl=function(n){for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return new n(...l)});var bs=or(Array.prototype.forEach),tC=or(Array.prototype.lastIndexOf),yp=or(Array.prototype.pop),Go=or(Array.prototype.push),rC=or(Array.prototype.splice),ys=or(String.prototype.toLowerCase),Vl=or(String.prototype.toString),Ql=or(String.prototype.match),Oo=or(String.prototype.replace),nC=or(String.prototype.indexOf),iC=or(String.prototype.trim),Gr=or(Object.prototype.hasOwnProperty),nr=or(RegExp.prototype.test),Wo=oC(TypeError);function or(r){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return jl(r,n,l)}}function oC(r){return function(){for(var n=arguments.length,a=new Array(n),l=0;l<n;l++)a[l]=arguments[l];return zl(r,a)}}function We(r,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ys;vp&&vp(r,null);let l=n.length;for(;l--;){let c=n[l];if(typeof c=="string"){let p=a(c);p!==c&&(KE(n)||(n[l]=p),c=p)}r[c]=!0}return r}function aC(r){for(let n=0;n<r.length;n++)Gr(r,n)||(r[n]=null);return r}function zr(r){let n=Yl(null);for(let[a,l]of Rp(r))Gr(r,a)&&(Array.isArray(l)?n[a]=aC(l):l&&typeof l=="object"&&l.constructor===Object?n[a]=zr(l):n[a]=l);return n}function Do(r,n){for(;r!==null;){let l=eC(r,n);if(l){if(l.get)return or(l.get);if(typeof l.value=="function")return or(l.value)}r=$E(r)}function a(){return null}return a}var xp=ir(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Pl=ir(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hl=ir(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sC=ir(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Jl=ir(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),lC=ir(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tp=ir(["#text"]),Ip=ir(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xl=ir(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ep=ir(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),vs=ir(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uC=_r(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fC=_r(/<%[\w\W]*|[\w\W]*%>/gm),cC=_r(/\$\{[\w\W]*/gm),dC=_r(/^data-[\-\w.\u00B7-\uFFFF]+$/),hC=_r(/^aria-[\-\w]+$/),_p=_r(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pC=_r(/^(?:\w+script|data):/i),gC=_r(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Np=_r(/^html$/i),mC=_r(/^[a-z][.\w]*(-[.\w]+)+$/i),Cp=Object.freeze({__proto__:null,ARIA_ATTR:hC,ATTR_WHITESPACE:gC,CUSTOM_ELEMENT:mC,DATA_ATTR:dC,DOCTYPE_NAME:Np,ERB_EXPR:fC,IS_ALLOWED_URI:_p,IS_SCRIPT_OR_DATA:pC,MUSTACHE_EXPR:uC,TMPLIT_EXPR:cC}),Zo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bC=function(){return typeof window>"u"?null:window},vC=function(n,a){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let l=null,c="data-tt-policy-suffix";a&&a.hasAttribute(c)&&(l=a.getAttribute(c));let p="dompurify"+(l?"#"+l:"");try{return n.createPolicy(p,{createHTML(g){return g},createScriptURL(g){return g}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},Ap=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Sp(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bC(),n=xe=>Sp(xe);if(n.version="3.3.1",n.removed=[],!r||!r.document||r.document.nodeType!==Zo.document||!r.Element)return n.isSupported=!1,n;let{document:a}=r,l=a,c=l.currentScript,{DocumentFragment:p,HTMLTemplateElement:g,Node:y,Element:T,NodeFilter:U,NamedNodeMap:A=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:F,DOMParser:M,trustedTypes:X}=r,S=T.prototype,Z=Do(S,"cloneNode"),_=Do(S,"remove"),G=Do(S,"nextSibling"),J=Do(S,"childNodes"),q=Do(S,"parentNode");if(typeof g=="function"){let xe=a.createElement("template");xe.content&&xe.content.ownerDocument&&(a=xe.content.ownerDocument)}let te,ae="",{implementation:R,createNodeIterator:w,createDocumentFragment:P,getElementsByTagName:$}=a,{importNode:fe}=l,k=Ap();n.isSupported=typeof Rp=="function"&&typeof q=="function"&&R&&R.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:oe,ERB_EXPR:x,TMPLIT_EXPR:ee,DATA_ATTR:D,ARIA_ATTR:de,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:Oe,CUSTOM_ELEMENT:_e}=Cp,{IS_ALLOWED_URI:we}=Cp,re=null,Ze=We({},[...xp,...Pl,...Hl,...Jl,...Tp]),Ce=null,ve=We({},[...Ip,...Xl,...Ep,...vs]),se=Object.seal(Yl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ye=null,Ge=Object.seal(Yl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,Fe=!0,Je=!1,Me=!0,Le=!1,Re=!0,De=!1,Be=!1,Ve=!1,Te=!1,It=!1,Et=!1,mr=!0,lt=!1,Qt="user-content-",ze=!0,Xe=!1,mt={},ut=null,qe=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),kt=null,ft=We({},["audio","video","img","source","image","track"]),Mt=null,br=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vr="http://www.w3.org/1998/Math/MathML",vn="http://www.w3.org/2000/svg",Ne="http://www.w3.org/1999/xhtml",Sr=Ne,Ie=!1,yr=null,Ct=We({},[vr,vn,Ne],Vl),Ke=We({},["mi","mo","mn","ms","mtext"]),$e=We({},["annotation-xml"]),sr=We({},["title","style","font","a","script"]),yt=null,xr=["application/xhtml+xml","text/html"],At="text/html",rt=null,pt=null,Wr=a.createElement("form"),yn=function(N){return N instanceof RegExp||N instanceof Function},Yt=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pt&&pt===N)){if((!N||typeof N!="object")&&(N={}),N=zr(N),yt=xr.indexOf(N.PARSER_MEDIA_TYPE)===-1?At:N.PARSER_MEDIA_TYPE,rt=yt==="application/xhtml+xml"?Vl:ys,re=Gr(N,"ALLOWED_TAGS")?We({},N.ALLOWED_TAGS,rt):Ze,Ce=Gr(N,"ALLOWED_ATTR")?We({},N.ALLOWED_ATTR,rt):ve,yr=Gr(N,"ALLOWED_NAMESPACES")?We({},N.ALLOWED_NAMESPACES,Vl):Ct,Mt=Gr(N,"ADD_URI_SAFE_ATTR")?We(zr(br),N.ADD_URI_SAFE_ATTR,rt):br,kt=Gr(N,"ADD_DATA_URI_TAGS")?We(zr(ft),N.ADD_DATA_URI_TAGS,rt):ft,ut=Gr(N,"FORBID_CONTENTS")?We({},N.FORBID_CONTENTS,rt):qe,le=Gr(N,"FORBID_TAGS")?We({},N.FORBID_TAGS,rt):zr({}),ye=Gr(N,"FORBID_ATTR")?We({},N.FORBID_ATTR,rt):zr({}),mt=Gr(N,"USE_PROFILES")?N.USE_PROFILES:!1,ue=N.ALLOW_ARIA_ATTR!==!1,Fe=N.ALLOW_DATA_ATTR!==!1,Je=N.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Le=N.SAFE_FOR_TEMPLATES||!1,Re=N.SAFE_FOR_XML!==!1,De=N.WHOLE_DOCUMENT||!1,Te=N.RETURN_DOM||!1,It=N.RETURN_DOM_FRAGMENT||!1,Et=N.RETURN_TRUSTED_TYPE||!1,Ve=N.FORCE_BODY||!1,mr=N.SANITIZE_DOM!==!1,lt=N.SANITIZE_NAMED_PROPS||!1,ze=N.KEEP_CONTENT!==!1,Xe=N.IN_PLACE||!1,we=N.ALLOWED_URI_REGEXP||_p,Sr=N.NAMESPACE||Ne,Ke=N.MATHML_TEXT_INTEGRATION_POINTS||Ke,$e=N.HTML_INTEGRATION_POINTS||$e,se=N.CUSTOM_ELEMENT_HANDLING||{},N.CUSTOM_ELEMENT_HANDLING&&yn(N.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=N.CUSTOM_ELEMENT_HANDLING.tagNameCheck),N.CUSTOM_ELEMENT_HANDLING&&yn(N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(Fe=!1),It&&(Te=!0),mt&&(re=We({},Tp),Ce=[],mt.html===!0&&(We(re,xp),We(Ce,Ip)),mt.svg===!0&&(We(re,Pl),We(Ce,Xl),We(Ce,vs)),mt.svgFilters===!0&&(We(re,Hl),We(Ce,Xl),We(Ce,vs)),mt.mathMl===!0&&(We(re,Jl),We(Ce,Ep),We(Ce,vs))),N.ADD_TAGS&&(typeof N.ADD_TAGS=="function"?Ge.tagCheck=N.ADD_TAGS:(re===Ze&&(re=zr(re)),We(re,N.ADD_TAGS,rt))),N.ADD_ATTR&&(typeof N.ADD_ATTR=="function"?Ge.attributeCheck=N.ADD_ATTR:(Ce===ve&&(Ce=zr(Ce)),We(Ce,N.ADD_ATTR,rt))),N.ADD_URI_SAFE_ATTR&&We(Mt,N.ADD_URI_SAFE_ATTR,rt),N.FORBID_CONTENTS&&(ut===qe&&(ut=zr(ut)),We(ut,N.FORBID_CONTENTS,rt)),N.ADD_FORBID_CONTENTS&&(ut===qe&&(ut=zr(ut)),We(ut,N.ADD_FORBID_CONTENTS,rt)),ze&&(re["#text"]=!0),De&&We(re,["html","head","body"]),re.table&&(We(re,["tbody"]),delete le.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw Wo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Wo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');te=N.TRUSTED_TYPES_POLICY,ae=te.createHTML("")}else te===void 0&&(te=vC(X,c)),te!==null&&typeof ae=="string"&&(ae=te.createHTML(""));ir&&ir(N),pt=N}},si=We({},[...Pl,...Hl,...sC]),en=We({},[...Jl,...lC]),li=function(N){let K=q(N);(!K||!K.tagName)&&(K={namespaceURI:Sr,tagName:"template"});let be=ys(N.tagName),Ye=ys(K.tagName);return yr[N.namespaceURI]?N.namespaceURI===vn?K.namespaceURI===Ne?be==="svg":K.namespaceURI===vr?be==="svg"&&(Ye==="annotation-xml"||Ke[Ye]):!!si[be]:N.namespaceURI===vr?K.namespaceURI===Ne?be==="math":K.namespaceURI===vn?be==="math"&&$e[Ye]:!!en[be]:N.namespaceURI===Ne?K.namespaceURI===vn&&!$e[Ye]||K.namespaceURI===vr&&!Ke[Ye]?!1:!en[be]&&(sr[be]||!si[be]):!!(yt==="application/xhtml+xml"&&yr[N.namespaceURI]):!1},Pt=function(N){Go(n.removed,{element:N});try{q(N).removeChild(N)}catch{_(N)}},Ht=function(N,K){try{Go(n.removed,{attribute:K.getAttributeNode(N),from:K})}catch{Go(n.removed,{attribute:null,from:K})}if(K.removeAttribute(N),N==="is")if(Te||It)try{Pt(K)}catch{}else try{K.setAttribute(N,"")}catch{}},jt=function(N){let K=null,be=null;if(Ve)N="<remove></remove>"+N;else{let Ue=Ql(N,/^[\r\n\t ]+/);be=Ue&&Ue[0]}yt==="application/xhtml+xml"&&Sr===Ne&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");let Ye=te?te.createHTML(N):N;if(Sr===Ne)try{K=new M().parseFromString(Ye,yt)}catch{}if(!K||!K.documentElement){K=R.createDocument(Sr,"template",null);try{K.documentElement.innerHTML=Ie?ae:Ye}catch{}}let dt=K.body||K.documentElement;return N&&be&&dt.insertBefore(a.createTextNode(be),dt.childNodes[0]||null),Sr===Ne?$.call(K,De?"html":"body")[0]:De?K.documentElement:dt},wr=function(N){return w.call(N.ownerDocument||N,N,U.SHOW_ELEMENT|U.SHOW_COMMENT|U.SHOW_TEXT|U.SHOW_PROCESSING_INSTRUCTION|U.SHOW_CDATA_SECTION,null)},xn=function(N){return N instanceof F&&(typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||!(N.attributes instanceof A)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function")},lr=function(N){return typeof y=="function"&&N instanceof y};function Tr(xe,N,K){bs(xe,be=>{be.call(n,N,K,pt)})}let tn=function(N){let K=null;if(Tr(k.beforeSanitizeElements,N,null),xn(N))return Pt(N),!0;let be=rt(N.nodeName);if(Tr(k.uponSanitizeElement,N,{tagName:be,allowedTags:re}),Re&&N.hasChildNodes()&&!lr(N.firstElementChild)&&nr(/<[/\w!]/g,N.innerHTML)&&nr(/<[/\w!]/g,N.textContent)||N.nodeType===Zo.progressingInstruction||Re&&N.nodeType===Zo.comment&&nr(/<[/\w]/g,N.data))return Pt(N),!0;if(!(Ge.tagCheck instanceof Function&&Ge.tagCheck(be))&&(!re[be]||le[be])){if(!le[be]&&fr(be)&&(se.tagNameCheck instanceof RegExp&&nr(se.tagNameCheck,be)||se.tagNameCheck instanceof Function&&se.tagNameCheck(be)))return!1;if(ze&&!ut[be]){let Ye=q(N)||N.parentNode,dt=J(N)||N.childNodes;if(dt&&Ye){let Ue=dt.length;for(let he=Ue-1;he>=0;--he){let Rt=Z(dt[he],!0);Rt.__removalCount=(N.__removalCount||0)+1,Ye.insertBefore(Rt,G(N))}}}return Pt(N),!0}return N instanceof T&&!li(N)||(be==="noscript"||be==="noembed"||be==="noframes")&&nr(/<\/no(script|embed|frames)/i,N.innerHTML)?(Pt(N),!0):(Le&&N.nodeType===Zo.text&&(K=N.textContent,bs([oe,x,ee],Ye=>{K=Oo(K,Ye," ")}),N.textContent!==K&&(Go(n.removed,{element:N.cloneNode()}),N.textContent=K)),Tr(k.afterSanitizeElements,N,null),!1)},ur=function(N,K,be){if(mr&&(K==="id"||K==="name")&&(be in a||be in Wr))return!1;if(!(Fe&&!ye[K]&&nr(D,K))){if(!(ue&&nr(de,K))){if(!(Ge.attributeCheck instanceof Function&&Ge.attributeCheck(K,N))){if(!Ce[K]||ye[K]){if(!(fr(N)&&(se.tagNameCheck instanceof RegExp&&nr(se.tagNameCheck,N)||se.tagNameCheck instanceof Function&&se.tagNameCheck(N))&&(se.attributeNameCheck instanceof RegExp&&nr(se.attributeNameCheck,K)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(K,N))||K==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&nr(se.tagNameCheck,be)||se.tagNameCheck instanceof Function&&se.tagNameCheck(be))))return!1}else if(!Mt[K]){if(!nr(we,Oo(be,Oe,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&N!=="script"&&nC(be,"data:")===0&&kt[N])){if(!(Je&&!nr(ge,Oo(be,Oe,"")))){if(be)return!1}}}}}}}return!0},fr=function(N){return N!=="annotation-xml"&&Ql(N,_e)},Dr=function(N){Tr(k.beforeSanitizeAttributes,N,null);let{attributes:K}=N;if(!K||xn(N))return;let be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0},Ye=K.length;for(;Ye--;){let dt=K[Ye],{name:Ue,namespaceURI:he,value:Rt}=dt,Cr=rt(Ue),Dt=Rt,v=Ue==="value"?Dt:iC(Dt);if(be.attrName=Cr,be.attrValue=v,be.keepAttr=!0,be.forceKeepAttr=void 0,Tr(k.uponSanitizeAttribute,N,be),v=be.attrValue,lt&&(Cr==="id"||Cr==="name")&&(Ht(Ue,N),v=Qt+v),Re&&nr(/((--!?|])>)|<\/(style|title|textarea)/i,v)){Ht(Ue,N);continue}if(Cr==="attributename"&&Ql(v,"href")){Ht(Ue,N);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){Ht(Ue,N);continue}if(!Me&&nr(/\/>/i,v)){Ht(Ue,N);continue}Le&&bs([oe,x,ee],V=>{v=Oo(v,V," ")});let E=rt(N.nodeName);if(!ur(E,Cr,v)){Ht(Ue,N);continue}if(te&&typeof X=="object"&&typeof X.getAttributeType=="function"&&!he)switch(X.getAttributeType(E,Cr)){case"TrustedHTML":{v=te.createHTML(v);break}case"TrustedScriptURL":{v=te.createScriptURL(v);break}}if(v!==Dt)try{he?N.setAttributeNS(he,Ue,v):N.setAttribute(Ue,v),xn(N)?Pt(N):yp(n.removed)}catch{Ht(Ue,N)}}Tr(k.afterSanitizeAttributes,N,null)},Tn=function xe(N){let K=null,be=wr(N);for(Tr(k.beforeSanitizeShadowDOM,N,null);K=be.nextNode();)Tr(k.uponSanitizeShadowNode,K,null),tn(K),Dr(K),K.content instanceof p&&xe(K.content);Tr(k.afterSanitizeShadowDOM,N,null)};return n.sanitize=function(xe){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,be=null,Ye=null,dt=null;if(Ie=!xe,Ie&&(xe="<!-->"),typeof xe!="string"&&!lr(xe))if(typeof xe.toString=="function"){if(xe=xe.toString(),typeof xe!="string")throw Wo("dirty is not a string, aborting")}else throw Wo("toString is not a function");if(!n.isSupported)return xe;if(Be||Yt(N),n.removed=[],typeof xe=="string"&&(Xe=!1),Xe){if(xe.nodeName){let Rt=rt(xe.nodeName);if(!re[Rt]||le[Rt])throw Wo("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof y)K=jt("<!---->"),be=K.ownerDocument.importNode(xe,!0),be.nodeType===Zo.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?K=be:K.appendChild(be);else{if(!Te&&!Le&&!De&&xe.indexOf("<")===-1)return te&&Et?te.createHTML(xe):xe;if(K=jt(xe),!K)return Te?null:Et?ae:""}K&&Ve&&Pt(K.firstChild);let Ue=wr(Xe?xe:K);for(;Ye=Ue.nextNode();)tn(Ye),Dr(Ye),Ye.content instanceof p&&Tn(Ye.content);if(Xe)return xe;if(Te){if(It)for(dt=P.call(K.ownerDocument);K.firstChild;)dt.appendChild(K.firstChild);else dt=K;return(Ce.shadowroot||Ce.shadowrootmode)&&(dt=fe.call(l,dt,!0)),dt}let he=De?K.outerHTML:K.innerHTML;return De&&re["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&nr(Np,K.ownerDocument.doctype.name)&&(he="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
40
- `+he),Le&&bs([oe,x,ee],Rt=>{he=Oo(he,Rt," ")}),te&&Et?te.createHTML(he):he},n.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yt(xe),Be=!0},n.clearConfig=function(){pt=null,Be=!1},n.isValidAttribute=function(xe,N,K){pt||Yt({});let be=rt(xe),Ye=rt(N);return ur(be,Ye,K)},n.addHook=function(xe,N){typeof N=="function"&&Go(k[xe],N)},n.removeHook=function(xe,N){if(N!==void 0){let K=tC(k[xe],N);return K===-1?void 0:rC(k[xe],K,1)[0]}return yp(k[xe])},n.removeHooks=function(xe){k[xe]=[]},n.removeAllHooks=function(){k=Ap()},n}var Vo=Sp();var Or=Ar(ag()),ri=class{constructor(n){this.namespace=n}set(n,a,l,c){if(Or.default.enabled&&(this.removeExpiredKeys(),n&&a!==void 0)){a.documentElement&&(a=new XMLSerializer().serializeToString(a.documentElement));try{Or.default.set(n,{namespace:this.namespace,val:a,exp:l,time:new Date().getTime()/1e3})}catch(p){if(p instanceof Error){let g=p;if(g.quotaExceeded=IA(p),g.quotaExceeded&&c)c(p);else throw g}throw p}}}remove(n){Or.default.enabled&&n&&Or.default.remove(n)}removeExpiredKeys(){Or.default.enabled&&Or.default.each((n,a)=>{n&&n.exp&&new Date().getTime()/1e3-n.time>n.exp&&this.remove(a)})}removeAll(){Or.default.enabled}removeNamespace(){Or.default.each((n,a)=>{n.namespace&&n.namespace===this.namespace&&this.remove(a)})}get(n){if(Or.default.enabled&&n)if(this.removeExpiredKeys(),n){var a=Or.default.get(n);return a?a.val:void 0}else return}};function IA(r){var n=!1;if(r)if(r.code)switch(r.code){case 22:n=!0;break;case 1014:r.name==="NS_ERROR_DOM_QUOTA_REACHED"&&(n=!0);break}else r.number===-2147024882&&(n=!0);return n}var{sanitize:Ck}=Vo;function Xo(r,n){if(r)return r.classList?r.classList.contains(n):!!r.className.match(new RegExp("(\\s|^)"+n+"(\\s|$)"))}function Qe(r,...n){if(r)for(let a of n)r.classList?r.classList.add(a):Xo(r,a)||(r.className+=" "+a)}function hn(r,n){if(r){if(r.classList)r.classList.remove(n);else if(Xo(r,n)){var a=new RegExp("(\\s|^)"+n+"(\\s|$)");r.className=r.className.replace(a," ")}}}function au(r,n){if(typeof r=="string"){let a=JSON.parse(r);if(n&&a.results)for(let l in a.results.bindings)a.results.bindings[l]=n(a.results.bindings[l]);return a}if(typeof r=="object"&&r.constructor==={}.constructor){if(n&&r.results)for(let a in r.results.bindings)r.results.bindings[a]=n(r.results.bindings[a]);return r}throw new Error("Could not parse json")}var Sg=Ar(_g());var jo="http://www.w3.org/1999/02/22-rdf-syntax-ns#",zo="http://www.w3.org/2001/XMLSchema#",Es="http://www.w3.org/2000/10/swap/",gr={xsd:{decimal:`${zo}decimal`,boolean:`${zo}boolean`,double:`${zo}double`,integer:`${zo}integer`,string:`${zo}string`},rdf:{type:`${jo}type`,nil:`${jo}nil`,first:`${jo}first`,rest:`${jo}rest`,langString:`${jo}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Es}reify#forSome`,forAll:`${Es}reify#forAll`},log:{implies:`${Es}log#implies`,isImpliedBy:`${Es}log#isImpliedBy`}};var{xsd:Cs}=gr,tR=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ng={"\\":"\\","'":"'",'"':'"',n:`
41
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},rR=/[\x00-\x20<>\\"\{\}\|\^\`]/,nR={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},iR=/$0^/,qo=class{constructor(n){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,n=n||{},this._isImpliedBy=n.isImpliedBy,this._lineMode=!!n.lineMode){this._n3Mode=!1;for(let a in this)!(a in nR)&&this[a]instanceof RegExp&&(this[a]=iR)}else this._n3Mode=n.n3!==!1;this.comments=!!n.comments,this._literalClosingPos=0}_tokenizeToEnd(n,a){let l=this._input,c=l.length;for(;;){let y,T;for(;y=this._newline.exec(l);)this.comments&&(T=this._comment.exec(y[0]))&&p("comment",T[1],"",this._line,y[0].length),l=l.substr(y[0].length,l.length),c=l.length,this._line++;if(!y&&(y=this._whitespace.exec(l))&&(l=l.substr(y[0].length,l.length)),this._endOfFile.test(l))return a&&(this.comments&&(T=this._comment.exec(l))&&p("comment",T[1],"",this._line,l.length),l=null,p("eof","","",this._line,0)),this._input=l;let U=this._line,A=l[0],F="",M="",X="",S=null,Z=0,_=!1;switch(A){case"^":if(l.length<3)break;if(l[1]==="^"){if(this._previousMarker="^^",l=l.substr(2),l[0]!=="<"){_=!0;break}}else{this._n3Mode&&(Z=1,F="^");break}case"<":if(S=this._unescapedIri.exec(l))F="IRI",M=S[1];else if(S=this._iri.exec(l)){if(M=this._unescape(S[1]),M===null||rR.test(M))return g(this);F="IRI"}else l.length>1&&l[1]==="<"?(F="<<",Z=2):this._n3Mode&&l.length>1&&l[1]==="="&&(Z=2,this._isImpliedBy?(F="abbreviation",M="<"):(F="inverse",M=">"));break;case">":l.length>1&&l[1]===">"&&(F=">>",Z=2);break;case"_":((S=this._blank.exec(l))||a&&(S=this._blank.exec(`${l} `)))&&(F="blank",X="_",M=S[1]);break;case'"':if(S=this._simpleQuotedString.exec(l))M=S[1];else if({value:M,matchLength:Z}=this._parseLiteral(l),M===null)return g(this);(S!==null||Z!==0)&&(F="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(S=this._simpleApostropheString.exec(l))M=S[1];else if({value:M,matchLength:Z}=this._parseLiteral(l),M===null)return g(this);(S!==null||Z!==0)&&(F="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(S=this._variable.exec(l))&&(F="var",M=S[0]);break;case"@":this._previousMarker==="literal"&&(S=this._langcode.exec(l))?(F="langcode",M=S[1]):(S=this._keyword.exec(l))&&(F=S[0]);break;case".":if(l.length===1?a:l[1]<"0"||l[1]>"9"){F=".",Z=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(S=this._number.exec(l)||a&&(S=this._number.exec(`${l} `)))&&(F="literal",M=S[0],X=typeof S[1]=="string"?Cs.double:typeof S[2]=="string"?Cs.decimal:Cs.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(S=this._sparqlKeyword.exec(l))?F=S[0].toUpperCase():_=!0;break;case"f":case"t":(S=this._boolean.exec(l))?(F="literal",M=S[0],X=Cs.boolean):_=!0;break;case"a":(S=this._shortPredicates.exec(l))?(F="abbreviation",M="a"):_=!0;break;case"=":this._n3Mode&&l.length>1&&(F="abbreviation",l[1]!==">"?(Z=1,M="="):(Z=2,M=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(Z=1,F=A);break;case"{":!this._lineMode&&l.length>=2&&(l[1]==="|"?(F="{|",Z=2):(F=A,Z=1));break;case"|":l.length>=2&&l[1]==="}"&&(F="|}",Z=2);break;default:_=!0}if(_&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(S=this._prefix.exec(l))?(F="prefix",M=S[1]||""):((S=this._prefixed.exec(l))||a&&(S=this._prefixed.exec(`${l} `)))&&(F="prefixed",X=S[1]||"",M=this._unescape(S[2]))),this._previousMarker==="^^")switch(F){case"prefixed":F="type";break;case"IRI":F="typeIRI";break;default:F=""}if(!F)return a||!/^'''|^"""/.test(l)&&/\n|\r/.test(l)?g(this):this._input=l;let G=Z||S[0].length,J=p(F,M,X,U,G);this.previousToken=J,this._previousMarker=F,l=l.substr(G,l.length)}function p(y,T,U,A,F){let M=l?c-l.length:c,X=M+F,S={type:y,value:T,prefix:U,line:A,start:M,end:X};return n(null,S),S}function g(y){n(y._syntaxError(/^\S*/.exec(l)[0]))}}_unescape(n){let a=!1,l=n.replace(tR,(c,p,g,y)=>{if(typeof p=="string")return String.fromCharCode(Number.parseInt(p,16));if(typeof g=="string"){let T=Number.parseInt(g,16);return T<=65535?String.fromCharCode(Number.parseInt(g,16)):String.fromCharCode(55296+((T-=65536)>>10),56320+(T&1023))}return y in Ng?Ng[y]:(a=!0,"")});return a?null:l}_parseLiteral(n){if(n.length>=3){let a=n.match(/^(?:"""|"|'''|'|)/)[0],l=a.length,c=Math.max(this._literalClosingPos,l);for(;(c=n.indexOf(a,c))>0;){let p=0;for(;n[c-p-1]==="\\";)p++;if(p%2===0){let g=n.substring(l,c),y=g.split(/\r\n|\r|\n/).length-1,T=c+l;if(l===1&&y!==0||l===3&&this._lineMode)break;return this._line+=y,{value:this._unescape(g),matchLength:T}}c++}this._literalClosingPos=n.length-l+1}return{value:"",matchLength:0}}_syntaxError(n){this._input=null;let a=new Error(`Unexpected "${n}" on line ${this._line}.`);return a.context={token:void 0,line:this._line,previousToken:this.previousToken},a}_readStartingBom(n){return n.startsWith("\uFEFF")?n.substr(1):n}tokenize(n,a){if(this._line=1,typeof n=="string")if(this._input=this._readStartingBom(n),typeof a=="function")queueMicrotask(()=>this._tokenizeToEnd(a,!0));else{let l=[],c;if(this._tokenizeToEnd((p,g)=>p?c=p:l.push(g),!0),c)throw c;return l}else this._pendingBuffer=null,typeof n.setEncoding=="function"&&n.setEncoding("utf8"),n.on("data",l=>{this._input!==null&&l.length!==0&&(this._pendingBuffer&&(l=Sg.Buffer.concat([this._pendingBuffer,l]),this._pendingBuffer=null),l[l.length-1]&128?this._pendingBuffer=l:(typeof this._input>"u"?this._input=this._readStartingBom(typeof l=="string"?l:l.toString()):this._input+=l,this._tokenizeToEnd(a,!1)))}),n.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(a,!0)}),n.on("error",a)}};var{rdf:oR,xsd:eo}=gr,ea,aR=0;var sR={namedNode:Lg,blankNode:Fg,variable:Ug,literal:Bg,defaultGraph:lR,quad:xu,triple:xu,fromTerm:Ko,fromQuad:kg},wg=sR,gn=class r{constructor(n){this.id=n}get value(){return this.id}equals(n){return n instanceof r?this.id===n.id:!!n&&this.termType===n.termType&&this.value===n.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},As=class extends gn{get termType(){return"NamedNode"}},$o=class r extends gn{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let n=this.id,a=n.lastIndexOf('"')+1;return a<n.length&&n[a++]==="@"?n.substr(a).toLowerCase():""}get datatype(){return new As(this.datatypeString)}get datatypeString(){let n=this.id,a=n.lastIndexOf('"')+1,l=a<n.length?n[a]:"";return l==="^"?n.substr(a+2):l!=="@"?eo.string:oR.langString}equals(n){return n instanceof r?this.id===n.id:!!n&&!!n.datatype&&this.termType===n.termType&&this.value===n.value&&this.language===n.language&&this.datatype.value===n.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},bu=class extends gn{constructor(n){super(`_:${n}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},vu=class extends gn{constructor(n){super(`?${n}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},yu=class extends gn{constructor(){return super(""),ea||this}get termType(){return"DefaultGraph"}equals(n){return this===n||!!n&&this.termType===n.termType}};ea=new yu;var Rs=class extends gn{constructor(n,a,l,c){super(""),this._subject=n,this._predicate=a,this._object=l,this._graph=c||ea}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(n){return!!n&&this._subject.equals(n.subject)&&this._predicate.equals(n.predicate)&&this._object.equals(n.object)&&this._graph.equals(n.graph)}};function Lg(r){return new As(r)}function Fg(r){return new bu(r||`n3-${aR++}`)}function Bg(r,n){if(typeof n=="string")return new $o(`"${r}"@${n.toLowerCase()}`);let a=n?n.value:"";return a===""&&(typeof r=="boolean"?a=eo.boolean:typeof r=="number"&&(Number.isFinite(r)?a=Number.isInteger(r)?eo.integer:eo.double:(a=eo.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),a===""||a===eo.string?new $o(`"${r}"`):new $o(`"${r}"^^${a}`)}function Ug(r){return new vu(r)}function lR(){return ea}function xu(r,n,a,l){return new Rs(r,n,a,l)}function Ko(r){if(r instanceof gn)return r;switch(r.termType){case"NamedNode":return Lg(r.value);case"BlankNode":return Fg(r.value);case"Variable":return Ug(r.value);case"DefaultGraph":return ea;case"Literal":return Bg(r.value,r.language||r.datatype);case"Quad":return kg(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function kg(r){if(r instanceof Rs)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return xu(Ko(r.subject),Ko(r.predicate),Ko(r.object),Ko(r.graph))}var Mg=0,oi=class{constructor(n){this._contextStack=[],this._graph=null,n=n||{},this._setBase(n.baseIRI),n.factory&&Gg(this,n.factory);let a=typeof n.format=="string"?n.format.match(/\w*$/)[0].toLowerCase():"",l=/turtle/.test(a),c=/trig/.test(a),p=/triple/.test(a),g=/quad/.test(a),y=this._n3Mode=/n3/.test(a),T=p||g;(this._supportsNamedGraphs=!(l||y))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(l||c||p||y),this._isImpliedBy=n.isImpliedBy,this._supportsRDFStar=a===""||/star|\*$/.test(a),T&&(this._resolveRelativeIRI=U=>null),this._blankNodePrefix=typeof n.blankNodePrefix!="string"?"":n.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=n.lexer||new qo({lineMode:T,n3:y,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!n.explicitQuantifiers}static _resetBlankNodePrefix(){Mg=0}_setBase(n){if(!n)this._base="",this._basePath="";else{let a=n.indexOf("#");a>=0&&(n=n.substr(0,a)),this._base=n,this._basePath=n.indexOf("/")<0?n:n.replace(/[^\/?]*(?:\?.*)?$/,""),n=n.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=n[0],this._baseScheme=n[1]}}_saveContext(n,a,l,c,p){let g=this._n3Mode;this._contextStack.push({type:n,subject:l,predicate:c,object:p,graph:a,inverse:g?this._inversePredicate:!1,blankPrefix:g?this._prefixes._:"",quantified:g?this._quantified:null}),g&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(n,a){let l=this._contextStack.pop();if(!l||l.type!==n)return this._error(`Unexpected ${a.type}`,a);this._subject=l.subject,this._predicate=l.predicate,this._object=l.object,this._graph=l.graph,this._n3Mode&&(this._inversePredicate=l.inverse,this._prefixes._=l.blankPrefix,this._quantified=l.quantified)}_readInTopContext(n){switch(n.type){case"eof":return this._graph!==null?this._error("Unclosed graph",n):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(n)}}_readEntity(n,a){let l;switch(n.type){case"IRI":case"typeIRI":let c=this._resolveIRI(n.value);if(c===null)return this._error("Invalid IRI",n);l=this._factory.namedNode(c);break;case"type":case"prefixed":let p=this._prefixes[n.prefix];if(p===void 0)return this._error(`Undefined prefix "${n.prefix}:"`,n);l=this._factory.namedNode(p+n.value);break;case"blank":l=this._factory.blankNode(this._prefixes[n.prefix]+n.value);break;case"var":l=this._factory.variable(n.value.substr(1));break;default:return this._error(`Expected entity but got ${n.type}`,n)}return!a&&this._n3Mode&&l.id in this._quantified&&(l=this._quantified[l.id]),l}_readSubject(n){switch(this._predicate=null,n.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",n);case"}":return this._readPunctuation(n);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',n);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',n);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",n);if(n.prefix.length===0)return this._literalValue=n.value,this._completeSubjectLiteral;this._subject=this._factory.literal(n.value,this._factory.namedNode(n.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",n);default:if((this._subject=this._readEntity(n))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(n){let a=n.type;switch(a){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[n.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${a}`,n):(this._subject=null,a==="]"?this._readBlankNodeTail(n):this._readPunctuation(n));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",n);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",n);default:if((this._predicate=this._readEntity(n))===void 0)return}return this._readObject}_readObject(n){switch(n.type){case"literal":if(n.prefix.length===0)return this._literalValue=n.value,this._readDataTypeOrLang;this._object=this._factory.literal(n.value,this._factory.namedNode(n.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",n);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",n);default:if((this._object=this._readEntity(n))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(n){return n.type==="{"?this._readGraph(n):this._readPredicate(n)}_readGraph(n){return n.type!=="{"?this._error(`Expected graph but got ${n.type}`,n):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(n){return n.type==="]"?(this._subject=null,this._readBlankNodeTail(n)):(this._predicate=null,this._readPredicate(n))}_readBlankNodeTail(n){if(n.type!=="]")return this._readBlankNodePunctuation(n);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let a=this._predicate===null;return this._restoreContext("blank",n),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:a?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(n){switch(n.type){case".":case"}":return this._subject=null,this._readPunctuation(n);default:return this._readPredicate(n)}}_readListItem(n){let a=null,l=null,c=this._readListItem,p=this._subject,g=this._contextStack,y=g[g.length-1];switch(n.type){case"[":this._saveContext("blank",this._graph,l=this._factory.blankNode(),this.RDF_FIRST,this._subject=a=this._factory.blankNode()),c=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,l=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",n),g.length!==0&&g[g.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(c=this._readPredicate,this._subject===this.RDF_NIL)return c}else if(c=this._getContextEndReader(),this._object===this.RDF_NIL)return c;l=this.RDF_NIL;break;case"literal":n.prefix.length===0?(this._literalValue=n.value,c=this._readListItemDataTypeOrLang):(a=this._factory.literal(n.value,this._factory.namedNode(n.prefix)),c=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",n);default:if((a=this._readEntity(n))===void 0)return}if(l===null&&(this._subject=l=this._factory.blankNode()),p===null?y.predicate===null?y.subject=l:y.object=l:this._emit(p,this.RDF_REST,l,this._graph),a!==null){if(this._n3Mode&&(n.type==="IRI"||n.type==="prefixed"))return this._saveContext("item",this._graph,l,this.RDF_FIRST,a),this._subject=a,this._predicate=null,this._getPathReader(this._readListItem);this._emit(l,this.RDF_FIRST,a,this._graph)}return c}_readDataTypeOrLang(n){return this._completeObjectLiteral(n,!1)}_readListItemDataTypeOrLang(n){return this._completeObjectLiteral(n,!0)}_completeLiteral(n){let a=this._factory.literal(this._literalValue);switch(n.type){case"type":case"typeIRI":let l=this._readEntity(n);if(l===void 0)return;a=this._factory.literal(this._literalValue,l),n=null;break;case"langcode":a=this._factory.literal(this._literalValue,n.value),n=null;break}return{token:n,literal:a}}_completeSubjectLiteral(n){return this._subject=this._completeLiteral(n).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(n,a){let l=this._completeLiteral(n);if(l)return this._object=l.literal,a&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),l.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(l.token))}_readFormulaTail(n){return n.type!=="}"?this._readPunctuation(n):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",n),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(n){let a,l=this._graph,c=this._subject,p=this._inversePredicate;switch(n.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",n);if(this._n3Mode)return this._readFormulaTail(n);this._graph=null;case".":this._subject=null,a=this._contextStack.length?this._readSubject:this._readInTopContext,p&&(this._inversePredicate=!1);break;case";":a=this._readPredicate;break;case",":a=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",n);let g=this._predicate,y=this._object;this._subject=this._factory.quad(c,g,y,this.DEFAULTGRAPH),a=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",n);this._subject=null,a=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(l=this._readEntity(n))!==void 0){a=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,n)}if(c!==null){let g=this._predicate,y=this._object;p?this._emit(y,g,c,l):this._emit(c,g,y,l)}return a}_readBlankNodePunctuation(n){let a;switch(n.type){case";":a=this._readPredicate;break;case",":a=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,n)}return this._emit(this._subject,this._predicate,this._object,this._graph),a}_readQuadPunctuation(n){return n.type!=="."?this._error("Expected dot to follow quad",n):this._readInTopContext}_readPrefix(n){return n.type!=="prefix"?this._error("Expected prefix to follow @prefix",n):(this._prefix=n.value,this._readPrefixIRI)}_readPrefixIRI(n){if(n.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,n);let a=this._readEntity(n);return this._prefixes[this._prefix]=a.value,this._prefixCallback(this._prefix,a),this._readDeclarationPunctuation}_readBaseIRI(n){let a=n.type==="IRI"&&this._resolveIRI(n.value);return a?(this._setBase(a),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",n)}_readNamedGraphLabel(n){switch(n.type){case"IRI":case"blank":case"prefixed":return this._readSubject(n),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",n)}}_readNamedGraphBlankLabel(n){return n.type!=="]"?this._error("Invalid graph label",n):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(n){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(n)):n.type!=="."?this._error("Expected declaration to end with a dot",n):this._readInTopContext}_readQuantifierList(n){let a;switch(n.type){case"IRI":case"prefixed":if((a=this._readEntity(n,!0))!==void 0)break;default:return this._error(`Unexpected ${n.type}`,n)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,a,this.QUANTIFIERS_GRAPH)):this._quantified[a.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(n){return n.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(n))}_getPathReader(n){return this._afterPath=n,this._readPath}_readPath(n){switch(n.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let a=this._contextStack,l=a.length&&a[a.length-1];if(l&&l.type==="item"){let c=this._subject;this._restoreContext("item",n),this._emit(this._subject,this.RDF_FIRST,c,this._graph)}return this._afterPath(n)}}_readForwardPath(n){let a,l,c=this._factory.blankNode();if((l=this._readEntity(n))!==void 0)return this._predicate===null?(a=this._subject,this._subject=c):(a=this._object,this._object=c),this._emit(a,l,c,this._graph),this._readPath}_readBackwardPath(n){let a=this._factory.blankNode(),l,c;if((l=this._readEntity(n))!==void 0)return this._predicate===null?(c=this._subject,this._subject=a):(c=this._object,this._object=a),this._emit(a,l,c,this._graph),this._readPath}_readRDFStarTailOrGraph(n){return n.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(n))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,n):this._readRDFStarTail(n)}_readRDFStarTail(n){if(n.type!==">>")return this._error(`Expected >> but got ${n.type}`,n);let a=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",n),this._subject===null?(this._subject=a,this._readPredicate):(this._object=a,this._getContextEndReader())}_getContextEndReader(){let n=this._contextStack;if(!n.length)return this._readPunctuation;switch(n[n.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(n,a,l,c){this._callback(null,this._factory.quad(n,a,l,c||this.DEFAULTGRAPH))}_error(n,a){let l=new Error(`${n} on line ${a.line}.`);l.context={token:a,line:a.line,previousToken:this._lexer.previousToken},this._callback(l),this._callback=_s}_resolveIRI(n){return/^[a-z][a-z0-9+.-]*:/i.test(n)?n:this._resolveRelativeIRI(n)}_resolveRelativeIRI(n){if(!n.length)return this._base;switch(n[0]){case"#":return this._base+n;case"?":return this._base.replace(/(?:\?.*)?$/,n);case"/":return(n[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(n);default:return/^[^/:]*:/.test(n)?null:this._removeDotSegments(this._basePath+n)}}_removeDotSegments(n){if(!/(^|\/)\.\.?($|[/#?])/.test(n))return n;let a=n.length,l="",c=-1,p=-1,g=0,y="/";for(;c<a;){switch(y){case":":if(p<0&&n[++c]==="/"&&n[++c]==="/")for(;(p=c+1)<a&&n[p]!=="/";)c=p;break;case"?":case"#":c=a;break;case"/":if(n[c+1]===".")switch(y=n[++c+1],y){case"/":l+=n.substring(g,c-1),g=c+1;break;case void 0:case"?":case"#":return l+n.substring(g,c)+n.substr(c+1);case".":if(y=n[++c+1],y===void 0||y==="/"||y==="?"||y==="#"){if(l+=n.substring(g,c-2),(g=l.lastIndexOf("/"))>=p&&(l=l.substr(0,g)),y!=="/")return`${l}/${n.substr(c+1)}`;g=c+1}}}y=n[++c]}return l+n.substring(g)}parse(n,a,l){let c,p,g;if(a&&(a.onQuad||a.onPrefix||a.onComment)?(c=a.onQuad,p=a.onPrefix,g=a.onComment):(c=a,p=l),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Mg++}_`,this._prefixCallback=p||_s,this._inversePredicate=!1,this._quantified=Object.create(null),!c){let T=[],U;if(this._callback=(A,F)=>{A?U=A:F&&T.push(F)},this._lexer.tokenize(n).every(A=>this._readCallback=this._readCallback(A)),U)throw U;return T}let y=(T,U)=>{T!==null?(this._callback(T),this._callback=_s):this._readCallback&&(this._readCallback=this._readCallback(U))};g&&(this._lexer.comments=!0,y=(T,U)=>{T!==null?(this._callback(T),this._callback=_s):this._readCallback&&(U.type==="comment"?g(U.value):this._readCallback=this._readCallback(U))}),this._callback=c,this._lexer.tokenize(n,y)}};function _s(){}function Gg(r,n){r._factory=n,r.DEFAULTGRAPH=n.defaultGraph(),r.RDF_FIRST=n.namedNode(gr.rdf.first),r.RDF_REST=n.namedNode(gr.rdf.rest),r.RDF_NIL=n.namedNode(gr.rdf.nil),r.N3_FORALL=n.namedNode(gr.r.forAll),r.N3_FORSOME=n.namedNode(gr.r.forSome),r.ABBREVIATIONS={a:n.namedNode(gr.rdf.type),"=":n.namedNode(gr.owl.sameAs),">":n.namedNode(gr.log.implies),"<":n.namedNode(gr.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=n.namedNode("urn:n3:quantifiers")}Gg(oi.prototype,wg);function Tu(r){if(r.termType==="NamedNode")return{value:r.value,type:"uri"};if(r.termType==="Literal"){let n={value:r.value,type:"literal"},a=r.language;a&&(n["xml:lang"]=a);let l=r.datatypeString;return l&&(n.datatype=l),n}return r.termType==="BlankNode"?{value:r.value,type:"bnode"}:{value:r.value,type:"uri"}}function Og(r){let n=Iu(r),a=["subject","predicate","object"],l=n.map(c=>({subject:Tu(c.subject),predicate:Tu(c.predicate),object:Tu(c.object)}));return{head:{vars:a},results:{bindings:l}}}function Iu(r){return new oi().parse(r||"")}function fR(r){let n={vars:[]};for(let a=0;a<r.childNodes.length;a++){let l=r.childNodes[a];if(l.nodeName=="variable"){let c=l.getAttribute("name");c&&n.vars.push(c)}}return n}var cR=["uri","literal","bnode","typed-literal"];function dR(r,n){let a={bindings:[]};for(let l=0;l<r.childNodes.length;l++){let c=r.childNodes[l],p={};for(let g=0;g<c.childNodes.length;g++){let y=c.childNodes[g];if(y.nodeName=="binding"){let T=y.getAttribute("name");if(T)for(let U=0;U<y.childNodes.length;U++){let A=y.childNodes[U];if(A.nodeName==="#text"||cR.indexOf(A.nodeName)<0)continue;let F={type:A.nodeName,value:Wl(A.innerHTML)},M=A.getAttribute("datatype");M&&(F.datatype=M),p[T]=F}}}ms(p)||a.bindings.push(n(p))}return a}function hR(r){return r.innerHTML==="true"}function Eu(r,n){if(typeof r!="string")return;let l=new DOMParser().parseFromString(r,"text/xml");if(!l.childNodes.length)return;let c=l.childNodes[0],p={};for(let g=0;g<c.childNodes.length;g++){let y=c.childNodes[g];y.nodeName=="head"&&(p.head=fR(y)),y.nodeName=="results"&&(p.results=dR(y,n)),y.nodeName=="boolean"&&(p.boolean=hR(y))}return p}var Dg=Ar(Wg());function Zg(r){let n=Dg.parse(r,{header:!0,skipEmptyLines:!0});if(n.meta.fields===void 0)throw new Error("Could not parse CSV, no headers found!");let a=n.meta.fields,c=n.data.map(g=>{let y={};for(let T in g)y[T]={value:g[T],type:"literal"};return y});return{head:{vars:a},results:{bindings:c}}}function Vg(r){let n=r.split(`
42
- `);n.pop();let[a,...l]=n,c=a.split(" ").map(y=>y.substring(1)),p=l.map(y=>{let T={};for(let[U,A]of y.split(" ").entries()){let F=c[U];if(A[0]==="<")T[F]={value:A.substring(1,A.length-1),type:"uri"};else if(A[0]==='"'){let M=A.lastIndexOf('"'),X=A.substring(1,M);if(M===A.length-1)T[F]={value:X,type:"literal"};else if(M<A.lastIndexOf("@")){let S=A.substring(A.lastIndexOf("@")+1);T[F]={value:X,type:"literal","xml:lang":S}}else if(M<A.lastIndexOf("^^")){let S=A.substring(A.lastIndexOf("^^")+2);T[F]={value:X,type:"typed-literal",datatype:S}}}}return T});return{head:{vars:c},results:{bindings:p}}}function to(r){return r==null?"":`${r}`}function Ns(r={}){let{separator:n,decimals:a}=r;return n?a?l=>l.toFixed(a).replace(".",n):l=>`${l}`.replace(".",n):a?l=>l.toFixed(a):l=>`${l}`}function mn(r={}){let n=typeof r.quote=="string"?r.quote:'"',a=typeof r.escapedQuote=="string"?r.escapedQuote:`${n}${n}`;if(!n||n===a)return c=>c;let l=new RegExp(n,"g");return c=>(c.includes(n)&&(c=c.replace(l,a)),`${n}${c}${n}`)}var pR='"';var Kk=new RegExp(pR,"g");function Ss(r={stringFormatter:mn()}){return n=>r.stringFormatter(n.toString().slice(7,-1))}function ws(r={stringFormatter:mn()}){return n=>{if(n===null)return"";let a=JSON.stringify(n);return a===void 0?"":(a[0]==='"'&&(a=a.replace(/^"(.+)"$/,"$1")),r.stringFormatter(a))}}var gR=RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,"g");function mR(r){var n,a,l;let c=[],p;for(;p=gR.exec(r);)c.push((l=(n=p[3])!==null&&n!==void 0?n:(a=p[1])===null||a===void 0?void 0:a.trim())!==null&&l!==void 0?l:p[0]);return c}function Ru(r,n,a){if(n in r){let p=r[n];return p===void 0?a:p}let l=Array.isArray(n)?n:mR(n,r),c=r;for(let p of l)if(c=c?.[p],c===void 0)return a;return c}function Ls(r,n){try{return Array.isArray(n)?r.push(...n):r.push(n),r}catch{return r.concat(n)}}function ta(r,n){let a=!0;return r.reduce((l,c)=>(c==null&&(c=""),a?(a=!1,`${c}`):`${l}${n}${c}`),"")}var _u;(function(r){r.header="header",r.undefined="undefined",r.boolean="boolean",r.number="number",r.bigint="bigint",r.string="string",r.symbol="symbol",r.function="function",r.object="object"})(_u||(_u={}));var ai=class{constructor(n){this.opts=this.preprocessOpts(n)}preprocessOpts(n){let a=Object.assign({},n);a.fields&&(a.fields=this.preprocessFieldsInfo(a.fields,a.defaultValue)),a.transforms=a.transforms||[];let l=a.formatters&&a.formatters.string||mn(),c=ws({stringFormatter:l}),p={header:l,undefined:to,boolean:to,number:Ns(),bigint:to,string:l,symbol:Ss({stringFormatter:l}),function:c,object:c};return a.formatters=Object.assign(Object.assign({},p),a.formatters),a.delimiter=a.delimiter||",",a.eol=a.eol||`
43
- `,a.header=a.header!==!1,a.includeEmptyRows=a.includeEmptyRows||!1,a.withBOM=a.withBOM||!1,a}preprocessFieldsInfo(n,a){return n.map(l=>{if(typeof l=="string")return{label:l,value:c=>Ru(c,l,a)};if(typeof l=="object"){let c="default"in l?l.default:a;if(typeof l.value=="string"){let p=l.value;return{label:l.label||l.value,value:g=>Ru(g,p,c)}}if(typeof l.value=="function"){let p=l.label||l.value.name||"",g={label:p,default:c},y=l.value;return{label:p,value(T){let U=y(T,g);return U===void 0?c:U}}}}throw new Error("Invalid field info option. "+JSON.stringify(l))})}getHeader(){return ta(this.opts.fields.map(n=>this.opts.formatters.header(n.label)),this.opts.delimiter)}preprocessRow(n){return this.opts.transforms.reduce((a,l)=>a.map(c=>l(c)).reduce(Ls,[]),[n])}processRow(n){if(!n)return;let a=this.opts.fields.map(l=>this.processCell(n,l));if(!(!this.opts.includeEmptyRows&&a.every(l=>l==="")))return ta(a,this.opts.delimiter)}processCell(n,a){return this.processValue(a.value(n))}processValue(n){let a=this.opts.formatters[typeof n];return a(n)}};var ro=class extends ai{constructor(n){super(n)}parse(n){let a=this.preprocessData(n);this.opts.fields=this.opts.fields||this.preprocessFieldsInfo(a.reduce((g,y)=>(Object.keys(y).forEach(T=>{g.includes(T)||g.push(T)}),g),[]),this.opts.defaultValue);let l=this.opts.header?this.getHeader():"",c=this.processData(a);return(this.opts.withBOM?"\uFEFF":"")+l+(l&&c?this.opts.eol:"")+c}preprocessData(n){let a=Array.isArray(n)?n:[n];if(!this.opts.fields){if(n==null||a.length===0)throw new Error('Data should not be empty or the "fields" option should be included');if(typeof a[0]!="object")throw new Error('Data items should be objects or the "fields" option should be included')}return this.opts.transforms.length===0?a:a.map(l=>this.preprocessRow(l)).reduce(Ls,[])}processData(n){return ta(n.map(a=>this.processRow(a)).filter(a=>a),this.opts.eol)}};var Ut;(function(r){r[r.BACKSPACE=8]="BACKSPACE",r[r.FORM_FEED=12]="FORM_FEED",r[r.NEWLINE=10]="NEWLINE",r[r.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",r[r.TAB=9]="TAB",r[r.SPACE=32]="SPACE",r[r.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",r[r.QUOTATION_MARK=34]="QUOTATION_MARK",r[r.NUMBER_SIGN=35]="NUMBER_SIGN",r[r.DOLLAR_SIGN=36]="DOLLAR_SIGN",r[r.PERCENT_SIGN=37]="PERCENT_SIGN",r[r.AMPERSAND=38]="AMPERSAND",r[r.APOSTROPHE=39]="APOSTROPHE",r[r.LEFT_PARENTHESIS=40]="LEFT_PARENTHESIS",r[r.RIGHT_PARENTHESIS=41]="RIGHT_PARENTHESIS",r[r.ASTERISK=42]="ASTERISK",r[r.PLUS_SIGN=43]="PLUS_SIGN",r[r.COMMA=44]="COMMA",r[r.HYPHEN_MINUS=45]="HYPHEN_MINUS",r[r.FULL_STOP=46]="FULL_STOP",r[r.SOLIDUS=47]="SOLIDUS",r[r.DIGIT_ZERO=48]="DIGIT_ZERO",r[r.DIGIT_ONE=49]="DIGIT_ONE",r[r.DIGIT_TWO=50]="DIGIT_TWO",r[r.DIGIT_THREE=51]="DIGIT_THREE",r[r.DIGIT_FOUR=52]="DIGIT_FOUR",r[r.DIGIT_FIVE=53]="DIGIT_FIVE",r[r.DIGIT_SIX=54]="DIGIT_SIX",r[r.DIGIT_SEVEN=55]="DIGIT_SEVEN",r[r.DIGIT_EIGHT=56]="DIGIT_EIGHT",r[r.DIGIT_NINE=57]="DIGIT_NINE",r[r.COLON=58]="COLON",r[r.SEMICOLON=59]="SEMICOLON",r[r.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",r[r.EQUALS_SIGN=61]="EQUALS_SIGN",r[r.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",r[r.QUESTION_MARK=63]="QUESTION_MARK",r[r.COMMERCIAL_AT=64]="COMMERCIAL_AT",r[r.LATIN_CAPITAL_LETTER_A=65]="LATIN_CAPITAL_LETTER_A",r[r.LATIN_CAPITAL_LETTER_B=66]="LATIN_CAPITAL_LETTER_B",r[r.LATIN_CAPITAL_LETTER_C=67]="LATIN_CAPITAL_LETTER_C",r[r.LATIN_CAPITAL_LETTER_D=68]="LATIN_CAPITAL_LETTER_D",r[r.LATIN_CAPITAL_LETTER_E=69]="LATIN_CAPITAL_LETTER_E",r[r.LATIN_CAPITAL_LETTER_F=70]="LATIN_CAPITAL_LETTER_F",r[r.LATIN_CAPITAL_LETTER_G=71]="LATIN_CAPITAL_LETTER_G",r[r.LATIN_CAPITAL_LETTER_H=72]="LATIN_CAPITAL_LETTER_H",r[r.LATIN_CAPITAL_LETTER_I=73]="LATIN_CAPITAL_LETTER_I",r[r.LATIN_CAPITAL_LETTER_J=74]="LATIN_CAPITAL_LETTER_J",r[r.LATIN_CAPITAL_LETTER_K=75]="LATIN_CAPITAL_LETTER_K",r[r.LATIN_CAPITAL_LETTER_L=76]="LATIN_CAPITAL_LETTER_L",r[r.LATIN_CAPITAL_LETTER_M=77]="LATIN_CAPITAL_LETTER_M",r[r.LATIN_CAPITAL_LETTER_N=78]="LATIN_CAPITAL_LETTER_N",r[r.LATIN_CAPITAL_LETTER_O=79]="LATIN_CAPITAL_LETTER_O",r[r.LATIN_CAPITAL_LETTER_P=80]="LATIN_CAPITAL_LETTER_P",r[r.LATIN_CAPITAL_LETTER_Q=81]="LATIN_CAPITAL_LETTER_Q",r[r.LATIN_CAPITAL_LETTER_R=82]="LATIN_CAPITAL_LETTER_R",r[r.LATIN_CAPITAL_LETTER_S=83]="LATIN_CAPITAL_LETTER_S",r[r.LATIN_CAPITAL_LETTER_T=84]="LATIN_CAPITAL_LETTER_T",r[r.LATIN_CAPITAL_LETTER_U=85]="LATIN_CAPITAL_LETTER_U",r[r.LATIN_CAPITAL_LETTER_V=86]="LATIN_CAPITAL_LETTER_V",r[r.LATIN_CAPITAL_LETTER_W=87]="LATIN_CAPITAL_LETTER_W",r[r.LATIN_CAPITAL_LETTER_X=88]="LATIN_CAPITAL_LETTER_X",r[r.LATIN_CAPITAL_LETTER_Y=89]="LATIN_CAPITAL_LETTER_Y",r[r.LATIN_CAPITAL_LETTER_Z=90]="LATIN_CAPITAL_LETTER_Z",r[r.LEFT_SQUARE_BRACKET=91]="LEFT_SQUARE_BRACKET",r[r.REVERSE_SOLIDUS=92]="REVERSE_SOLIDUS",r[r.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",r[r.CIRCUMFLEX_ACCENT=94]="CIRCUMFLEX_ACCENT",r[r.LOW_LINE=95]="LOW_LINE",r[r.GRAVE_ACCENT=96]="GRAVE_ACCENT",r[r.LATIN_SMALL_LETTER_A=97]="LATIN_SMALL_LETTER_A",r[r.LATIN_SMALL_LETTER_B=98]="LATIN_SMALL_LETTER_B",r[r.LATIN_SMALL_LETTER_C=99]="LATIN_SMALL_LETTER_C",r[r.LATIN_SMALL_LETTER_D=100]="LATIN_SMALL_LETTER_D",r[r.LATIN_SMALL_LETTER_E=101]="LATIN_SMALL_LETTER_E",r[r.LATIN_SMALL_LETTER_F=102]="LATIN_SMALL_LETTER_F",r[r.LATIN_SMALL_LETTER_G=103]="LATIN_SMALL_LETTER_G",r[r.LATIN_SMALL_LETTER_H=104]="LATIN_SMALL_LETTER_H",r[r.LATIN_SMALL_LETTER_I=105]="LATIN_SMALL_LETTER_I",r[r.LATIN_SMALL_LETTER_J=106]="LATIN_SMALL_LETTER_J",r[r.LATIN_SMALL_LETTER_K=107]="LATIN_SMALL_LETTER_K",r[r.LATIN_SMALL_LETTER_L=108]="LATIN_SMALL_LETTER_L",r[r.LATIN_SMALL_LETTER_M=109]="LATIN_SMALL_LETTER_M",r[r.LATIN_SMALL_LETTER_N=110]="LATIN_SMALL_LETTER_N",r[r.LATIN_SMALL_LETTER_O=111]="LATIN_SMALL_LETTER_O",r[r.LATIN_SMALL_LETTER_P=112]="LATIN_SMALL_LETTER_P",r[r.LATIN_SMALL_LETTER_Q=113]="LATIN_SMALL_LETTER_Q",r[r.LATIN_SMALL_LETTER_R=114]="LATIN_SMALL_LETTER_R",r[r.LATIN_SMALL_LETTER_S=115]="LATIN_SMALL_LETTER_S",r[r.LATIN_SMALL_LETTER_T=116]="LATIN_SMALL_LETTER_T",r[r.LATIN_SMALL_LETTER_U=117]="LATIN_SMALL_LETTER_U",r[r.LATIN_SMALL_LETTER_V=118]="LATIN_SMALL_LETTER_V",r[r.LATIN_SMALL_LETTER_W=119]="LATIN_SMALL_LETTER_W",r[r.LATIN_SMALL_LETTER_X=120]="LATIN_SMALL_LETTER_X",r[r.LATIN_SMALL_LETTER_Y=121]="LATIN_SMALL_LETTER_Y",r[r.LATIN_SMALL_LETTER_Z=122]="LATIN_SMALL_LETTER_Z",r[r.LEFT_CURLY_BRACKET=123]="LEFT_CURLY_BRACKET",r[r.VERTICAL_LINE=124]="VERTICAL_LINE",r[r.RIGHT_CURLY_BRACKET=125]="RIGHT_CURLY_BRACKET",r[r.TILDE=126]="TILDE"})(Ut||(Ut={}));var bR={[Ut.QUOTATION_MARK]:Ut.QUOTATION_MARK,[Ut.REVERSE_SOLIDUS]:Ut.REVERSE_SOLIDUS,[Ut.SOLIDUS]:Ut.SOLIDUS,[Ut.LATIN_SMALL_LETTER_B]:Ut.BACKSPACE,[Ut.LATIN_SMALL_LETTER_F]:Ut.FORM_FEED,[Ut.LATIN_SMALL_LETTER_N]:Ut.NEWLINE,[Ut.LATIN_SMALL_LETTER_R]:Ut.CARRIAGE_RETURN,[Ut.LATIN_SMALL_LETTER_T]:Ut.TAB};var Qg;(function(r){r[r.LEFT_BRACE=0]="LEFT_BRACE",r[r.RIGHT_BRACE=1]="RIGHT_BRACE",r[r.LEFT_BRACKET=2]="LEFT_BRACKET",r[r.RIGHT_BRACKET=3]="RIGHT_BRACKET",r[r.COLON=4]="COLON",r[r.COMMA=5]="COMMA",r[r.TRUE=6]="TRUE",r[r.FALSE=7]="FALSE",r[r.NULL=8]="NULL",r[r.STRING=9]="STRING",r[r.NUMBER=10]="NUMBER",r[r.SEPARATOR=11]="SEPARATOR"})(Qg||(Qg={}));var Pg;(function(r){r[r.START=0]="START",r[r.ENDED=1]="ENDED",r[r.ERROR=2]="ERROR",r[r.TRUE1=3]="TRUE1",r[r.TRUE2=4]="TRUE2",r[r.TRUE3=5]="TRUE3",r[r.FALSE1=6]="FALSE1",r[r.FALSE2=7]="FALSE2",r[r.FALSE3=8]="FALSE3",r[r.FALSE4=9]="FALSE4",r[r.NULL1=10]="NULL1",r[r.NULL2=11]="NULL2",r[r.NULL3=12]="NULL3",r[r.STRING_DEFAULT=13]="STRING_DEFAULT",r[r.STRING_AFTER_BACKSLASH=14]="STRING_AFTER_BACKSLASH",r[r.STRING_UNICODE_DIGIT_1=15]="STRING_UNICODE_DIGIT_1",r[r.STRING_UNICODE_DIGIT_2=16]="STRING_UNICODE_DIGIT_2",r[r.STRING_UNICODE_DIGIT_3=17]="STRING_UNICODE_DIGIT_3",r[r.STRING_UNICODE_DIGIT_4=18]="STRING_UNICODE_DIGIT_4",r[r.STRING_INCOMPLETE_CHAR=19]="STRING_INCOMPLETE_CHAR",r[r.NUMBER_AFTER_INITIAL_MINUS=20]="NUMBER_AFTER_INITIAL_MINUS",r[r.NUMBER_AFTER_INITIAL_ZERO=21]="NUMBER_AFTER_INITIAL_ZERO",r[r.NUMBER_AFTER_INITIAL_NON_ZERO=22]="NUMBER_AFTER_INITIAL_NON_ZERO",r[r.NUMBER_AFTER_FULL_STOP=23]="NUMBER_AFTER_FULL_STOP",r[r.NUMBER_AFTER_DECIMAL=24]="NUMBER_AFTER_DECIMAL",r[r.NUMBER_AFTER_E=25]="NUMBER_AFTER_E",r[r.NUMBER_AFTER_E_AND_SIGN=26]="NUMBER_AFTER_E_AND_SIGN",r[r.NUMBER_AFTER_E_AND_DIGIT=27]="NUMBER_AFTER_E_AND_DIGIT",r[r.SEPARATOR=28]="SEPARATOR",r[r.BOM_OR_START=29]="BOM_OR_START",r[r.BOM=30]="BOM"})(Pg||(Pg={}));var Fs;(function(r){r[r.OBJECT=0]="OBJECT",r[r.ARRAY=1]="ARRAY"})(Fs||(Fs={}));var Hg;(function(r){r[r.VALUE=0]="VALUE",r[r.KEY=1]="KEY",r[r.COLON=2]="COLON",r[r.COMMA=3]="COMMA",r[r.ENDED=4]="ENDED",r[r.ERROR=5]="ERROR",r[r.SEPARATOR=6]="SEPARATOR"})(Hg||(Hg={}));function Yg(r){let n=r.head.vars,a=r.results?.bindings;return new ro({fields:n}).parse(a?a.map(c=>Mo(c,p=>p.value)):[])}var Bs=r=>{for(let n in r)r[n].type!=="uri"&&(r[n].value=r[n].value.replace(/{{(.*?)}}/g,a=>(a=a.substring(2,a.length-2).trim(),r[a]?r[a].value:a)));return r},Su=class{constructor(n,a){n.executionTime&&(this.executionTime=n.executionTime),a&&(this.executionTime=a),n instanceof Error?this.error=n:n.content?this.setResponse(n):this.setSummary(n)}setResponse(n){this.res=n}setSummary(n){!n.data&&!n.error?this.summary={data:n}:this.summary=n}hasError(){return!!(this.res&&this.res.status>=400||this.errorSummary||this.error||this.summary&&this.summary.error)}getError(){if(!this.errorSummary){if(this.res&&this.res.status>=400){let n=this.res.content||this.res.statusText;this.errorSummary={text:n,status:this.res.status,statusText:this.res.ok?void 0:this.res.statusText}}if(this.summary&&this.summary.error&&(this.errorSummary=this.summary.error),this.error){let n=this.error;this.errorSummary={text:this.error.message,status:n.status,statusText:n.statusText}}}return this.errorSummary}getContentType(){if(this.res)return this.res.headers.get("content-type")||void 0;if(this.summary)return this.summary.contentType}getAsJson(){if(this.json)return this.json;if(!(this.json===!1||this.hasError()))return this.getParserFromContentType()?this.json:this.doLuckyGuess()?this.json:(this.json||(this.json=!1),this.json)}getData(){if(this.res){if(this.res.content)return this.res.content;if(this.res.body)return this.res.body;if(this.res.text)return this.res.text}if(this.summary)return this.summary.data}getResponseTime(){return this.executionTime}getParserFromContentType(){let n=this.getContentType();if(n){let a=as(this.getData());try{if(n.indexOf("json")>-1){if(n.indexOf("sparql-results+json")>=0)return this.json=au(a,Bs),this.type="json",!0;if(n.indexOf("application/rdf+json")>-1)return this.type="json",!0;this.type="json"}else{if(n.indexOf("xml")>-1)return this.json=Eu(a,Bs),this.type="xml",!0;if(n.indexOf("csv")>-1)return this.json=Zg(a),this.type="csv",!0;if(n.indexOf("tab-separated")>-1)return this.json=Vg(a),this.type="tsv",!0;if(n.indexOf("turtle")>0||n.indexOf("trig")>0||n.indexOf("triple")>0||n.indexOf("quad")>0)return this.json=Og(a),this.type="ttl",!0}}catch(l){l instanceof Error?this.errorSummary={text:l.message}:this.errorSummary={text:l}}}return!1}doLuckyGuess(){let n=as(this.getData());try{return this.json=au(n,Bs),this.type="json",!0}catch{}try{return this.json=Eu(n,Bs),this.type="xml",!0}catch{}return!1}getVariables(){let n=this.getAsJson();return n&&n.head?n.head.vars:[]}getBoolean(){let n=this.getAsJson();if(n&&"boolean"in n)return n.boolean}getBindings(){let n=this.getAsJson();return n&&n.results?n.results.bindings:null}getStatements(){return!this.statements&&this.type==="ttl"&&(this.statements=Iu(this.getData())),this.statements?this.statements:null}getOriginalResponseAsString(){let n=this.getData();return typeof n=="string"?n:this.type==="json"?JSON.stringify(n,void 0,2):n}getType(){return this.type||this.getAsJson(),this.type}getStatus(){if(this.res)return this.res.status;if(this.summary)return this.summary.status}getAsStoreObject(n){let a=this.summary;if(!a&&this.res&&(a={contentType:this.getContentType(),data:this.getOriginalResponseAsString(),error:this.getError(),status:this.getStatus(),executionTime:this.getResponseTime()}),a){if(a.data!==void 0){let l=0;if(typeof a.data=="string")l=a.data.length;else try{l=JSON.stringify(a.data).length}catch{return}if(l>n)return}return a}if(this.error)return{error:this.getError(),executionTime:this.getResponseTime()}}asCsv(){let n=this.getAsJson();if(this.type==="csv")return this.getOriginalResponseAsString();if(n&&n.results)return Yg(n)}},Us=Su;function ks(r){var n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href",r),document.getElementsByTagName("head")[0].appendChild(n)}function Ms(r,n){return new Promise((a,l)=>{var c=document.createElement("script");c.setAttribute("type","text/javascript"),c.setAttribute("async",""),c.setAttribute("src",r),n&&(c.innerHTML=n),c.onload=()=>a(),document.getElementsByTagName("head")[0].appendChild(c)})}Vo.addHook("afterSanitizeAttributes",r=>{r instanceof HTMLAnchorElement&&(r.target="_blank",r.rel="noopener noreferrer")});var wu=Vo.sanitize;var ra=class{constructor(n){this.priority=10;this.hideFromSelection=!0;this.yasr=n}draw(){let n=document.createElement("div");n.className="booleanResult";let a=this.yasr.results?.getBoolean(),l=document.createElement("i");l.className=a?"fas fa-check":"fas fa-xmark",n.appendChild(l);let c=document.createElement("span");c.textContent=a?"True":"False",n.appendChild(c),this.yasr.resultsEl.appendChild(n)}canHandleResults(){return!!this.yasr.results?.getBoolean&&(this.yasr.results.getBoolean()===!0||this.yasr.results.getBoolean()==!1)}getIcon(){return document.createElement("")}};var gm=Ar(bn()),FG=Ar(Bu()),BG=Ar($g()),UG=Ar(rm()),kG=Ar(om()),MG=Ar(lm()),GG=Ar(cm()),OG=Ar(pm());var Gs=class Gs{constructor(n){this.label="Response";this.priority=2;this.helpReference="https://yasgui-doc.matdata.eu/docs/user-guide#response-plugin";this.yasr=n,this.config=Gs.defaults,n.config.plugins.response&&n.config.plugins.response.dynamicConfig&&(this.config={...this.config,...n.config.plugins.response.dynamicConfig})}canHandleResults(){if(!this.yasr.results||!this.yasr.results.getOriginalResponseAsString)return!1;var n=this.yasr.results.getOriginalResponseAsString();return!((!n||n.length==0)&&this.yasr.results.getError())}getIcon(){let n=document.createElement("i");return n.className="fas fa-align-left",n}download(n){if(!this.yasr.results)return;let a=this.yasr.results.getContentType(),l=this.yasr.results.getType(),c=l==="xml"?"rdf":l;return{getData:()=>this.yasr.results?.getOriginalResponseAsString()||"",filename:`${n||"queryResults"}${c?"."+c:""}`,contentType:a||"text/plain",title:"Download result"}}draw(n){let a={...this.config,...n},l=this.yasr.results?.getOriginalResponseAsString()||"",c=l.split(`
44
- `);c.length>a.maxLines&&(l=c.slice(0,a.maxLines).join(`
45
- `));let g=document.documentElement.getAttribute("data-theme")==="dark"?"material-palenight":"default",y={readOnly:!0,lineNumbers:!0,lineWrapping:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],value:l,extraKeys:{Tab:!1},theme:g};this.yasr.results?.getType()==="json"&&(y.mode={name:"javascript",json:!0}),this.cm=(0,gm.default)(this.yasr.resultsEl,y),c.length>a.maxLines&&this.showLess(!1)}limitData(n){let a=n.split(`
46
- `);return a.length>this.config.maxLines&&(n=a.slice(0,this.config.maxLines).join(`
47
- `)),n}showLess(n=!0){if(!this.cm)return;Qe(this.cm.getWrapperElement(),"overflow"),this.overLay&&(this.overLay.remove(),this.overLay=void 0),this.overLay=document.createElement("div"),Qe(this.overLay,"overlay");let a=document.createElement("div");Qe(a,"overlay_content");let l=document.createElement("button");l.title="Show all",Qe(l,"yasr_btn","overlay_btn"),l.textContent="Show all",l.addEventListener("click",()=>this.showMore()),a.append(l);let c=document.createElement("button");c.title="Download result",Qe(c,"yasr_btn","overlay_btn");let p=document.createElement("span");p.innerText="Download result",c.appendChild(p);let g=document.createElement("i");Qe(g,"fas"),Qe(g,"fa-download"),c.appendChild(g),c.addEventListener("click",()=>this.yasr.download()),c.addEventListener("keydown",y=>{(y.code==="Space"||y.code==="Enter")&&this.yasr.download()}),a.appendChild(c),this.overLay.appendChild(a),this.cm.getWrapperElement().appendChild(this.overLay),n&&this.cm.setValue(this.limitData(this.yasr.results?.getOriginalResponseAsString()||""))}showMore(){this.cm&&(hn(this.cm.getWrapperElement(),"overflow"),this.overLay?.remove(),this.overLay=void 0,this.cm.setValue(this.yasr.results?.getOriginalResponseAsString()||""),this.cm.refresh())}};Gs.defaults={maxLines:30};var na=Gs;var ia=class{constructor(n){this.priority=20;this.hideFromSelection=!0;this.yasr=n}canHandleResults(){return!!this.yasr.results&&!!this.yasr.results.getError()}getTryBtn(n){let a=document.createElement("a");return a.href=n,a.rel="noopener noreferrer",a.target="_blank",a.className="yasr_tryQuery",a.textContent="Try query in a new browser window",a}getCorsMessage(){let n=document.createElement("div");n.className="redOutline";let a=document.createElement("p");a.textContent="Unable to get response from endpoint. Possible reasons:",n.appendChild(a);let l=document.createElement("ul"),c=document.createElement("li");c.textContent="Incorrect endpoint URL",l.appendChild(c);let p=document.createElement("li");p.textContent="Endpoint is down",l.appendChild(p);let g=document.createElement("li");g.textContent="Credentials have expired",l.appendChild(g);let y=document.createElement("li"),T=document.createElement("span");T.textContent="Endpoint is not accessible from the YASGUI server and website, and the endpoint is not ",y.appendChild(T);let U=document.createElement("a");return U.textContent="CORS-enabled",U.href="http://enable-cors.org/",U.target="_blank",U.rel="noopener noreferrer",y.appendChild(U),l.appendChild(y),n.appendChild(l),n}getStatusSpecificGuidance(n){let a=document.createElement("div");a.className="statusGuidance";let l=document.createElement("h4"),c=document.createElement("ul");switch(n){case 401:l.textContent="Authentication Required",a.appendChild(l);let p=document.createElement("li");p.textContent="The endpoint requires authentication credentials",c.appendChild(p);let g=document.createElement("li");g.textContent="Check if you need to provide an API key, username/password, or bearer token",c.appendChild(g);let y=document.createElement("li");return y.textContent="Verify your credentials are correct and not expired",c.appendChild(y),a.appendChild(c),a;case 403:l.textContent="Access Forbidden",a.appendChild(l);let T=document.createElement("li");T.textContent="You don't have permission to access this endpoint",c.appendChild(T);let U=document.createElement("li");U.textContent="Your credentials may be valid but lack sufficient privileges",c.appendChild(U);let A=document.createElement("li");A.textContent="Contact the endpoint administrator to request access",c.appendChild(A);let F=document.createElement("li");return F.textContent="A firewall such as OWASP is blocking is blocking SPARQL queries because they resemble SQL injection attempts. Contact the endpoint administrator to whitelist your queries or adjust firewall settings",c.appendChild(F),a.appendChild(c),a;case 404:l.textContent="Endpoint Not Found",a.appendChild(l);let M=document.createElement("li");M.textContent="The endpoint URL may be incorrect or has changed",c.appendChild(M);let X=document.createElement("li");X.textContent="Check for typos in the endpoint address",c.appendChild(X);let S=document.createElement("li");return S.textContent="Verify the endpoint is still active and hasn't been moved",c.appendChild(S),a.appendChild(c),a;case 429:l.textContent="Too Many Requests",a.appendChild(l);let Z=document.createElement("li");Z.textContent="You've exceeded the rate limit for this endpoint",c.appendChild(Z);let _=document.createElement("li");_.textContent="Wait a few moments before trying again",c.appendChild(_);let G=document.createElement("li");return G.textContent="Consider reducing query frequency or contacting the endpoint provider for higher limits",c.appendChild(G),a.appendChild(c),a;case 500:l.textContent="Internal Server Error",a.appendChild(l);let J=document.createElement("li");J.textContent="The SPARQL endpoint encountered an error while processing your query",c.appendChild(J);let q=document.createElement("li");q.textContent="Try simplifying your query or reducing the result limit",c.appendChild(q);let te=document.createElement("li");te.textContent="Check the error message below for specific details",c.appendChild(te);let ae=document.createElement("li");return ae.textContent="If the problem persists, contact the endpoint administrator",c.appendChild(ae),a.appendChild(c),a;case 502:case 503:case 504:l.textContent=n===502?"Bad Gateway":n===503?"Service Unavailable":"Gateway Timeout",a.appendChild(l);let R=document.createElement("li");R.textContent="The endpoint is temporarily unavailable or overloaded",c.appendChild(R);let w=document.createElement("li");w.textContent="Try again in a few moments",c.appendChild(w);let P=document.createElement("li");return P.textContent="The service may be undergoing maintenance",c.appendChild(P),a.appendChild(c),a;default:if(n>=400&&n<500){l.textContent="Client Error",a.appendChild(l);let $=document.createElement("li");$.textContent="There's an issue with the request",c.appendChild($);let fe=document.createElement("li");return fe.textContent="Check the error message below for details",c.appendChild(fe),a.appendChild(c),a}return null}}async draw(){let n=document.createElement("div");n.className="errorResult",this.yasr.resultsEl.appendChild(n);let a=this.yasr.results?.getError();if(!a)return;let l=document.createElement("div");l.className="errorHeader",n.appendChild(l);let c=await this.yasr.renderError(a);if(c){let g=document.createElement("div");g.className="redOutline",g.appendChild(c),n.appendChild(g);return}if(a.status){var p="Error";a.statusText&&a.statusText.length<100&&(p=a.statusText),p+=` (#${a.status})`;let g=document.createElement("span");if(g.className="status",g.textContent=p,l.appendChild(g),this.yasr.config.getPlainQueryLinkToEndpoint){let T=this.yasr.config.getPlainQueryLinkToEndpoint();T&&l.appendChild(this.getTryBtn(T))}let y=this.getStatusSpecificGuidance(a.status);if(y&&n.appendChild(y),a.text){let T=document.createElement("div");Qe(T,"errorMessageContainer"),n.appendChild(T);let U=document.createElement("pre");Qe(U,"errorMessage"),U.textContent=a.text,T.appendChild(U)}}else{if(this.yasr.config.getPlainQueryLinkToEndpoint){let y=this.yasr.config.getPlainQueryLinkToEndpoint();y&&l.appendChild(this.getTryBtn(y))}if(!a.text||a.text.indexOf("Request has been terminated")>=0||a.text.indexOf("Failed to fetch")>=0||a.text.indexOf("NetworkError")>=0||a.text.indexOf("Network request failed")>=0)n.appendChild(this.getCorsMessage());else{let y=document.createElement("pre");y.textContent=a.text,n.appendChild(y)}}}getIcon(){return document.createElement("")}};var ar=class ar extends mm.EventEmitter{constructor(a,l={},c){super();this.plugins={};this.helpDrawn=!1;this.isFullscreen=!1;this.isLoading=!1;this.utils={addScript:Ms,addCSS:ks,sanitize:wu};if(!a)throw new Error("No parent passed as argument. Dont know where to draw YASR");this.rootEl=document.createElement("div"),this.rootEl.className="yasr",a.appendChild(this.rootEl),this.config=Ol({},ar.defaults,l),this.storage=new ri(ar.storageNamespace),this.getConfigFromStorage(),this.headerEl=document.createElement("div"),this.headerEl.className="yasr_header",this.rootEl.appendChild(this.headerEl),this.fallbackInfoEl=document.createElement("div"),this.fallbackInfoEl.className="yasr_fallback_info",this.rootEl.appendChild(this.fallbackInfoEl),this.resultsEl=document.createElement("div"),this.resultsEl.className="yasr_results",this.resultsEl.id=Dl("resultsId"),this.rootEl.appendChild(this.resultsEl),this.createLoadingElement(),this.initializePlugins(),this.drawHeader();let p=c||this.getResponseFromStorage();p&&this.setResponse(p)}getConfigFromStorage(){let a=this.getStorageId(this.config.persistenceLabelConfig);if(a){let l=this.storage.get(a);if(l){this.selectedPlugin=l.selectedPlugin;for(let c in l.pluginsConfig){let p=l.pluginsConfig[c];p&&this.config.plugins[c]&&(this.config.plugins[c].dynamicConfig=p)}}}}async renderError(a){let l;if(this.config.errorRenderers!==void 0){for(let c of this.config.errorRenderers)if(l=await c(a),l!==void 0)break}return l}getStorageId(a,l){let c=l||this.config.persistenceId;if(c)return typeof c=="string"?c+"_"+a:c(this)+"_"+a}somethingDrawn(){return!!this.resultsEl.children.length}emptyFallbackElement(){for(;this.fallbackInfoEl.firstChild;)this.fallbackInfoEl.removeChild(this.fallbackInfoEl.firstChild)}getSelectedPluginName(){return this.selectedPlugin||this.config.defaultPlugin}getSelectedPlugin(){if(this.plugins[this.getSelectedPluginName()])return this.plugins[this.getSelectedPluginName()];console.warn(`Tried using plugin ${this.getSelectedPluginName()}, but seems this plugin isnt registered in yasr.`)}updatePluginSelectors(a){if(this.pluginSelectorsEl)for(let l in this.config.plugins){let c=this.plugins[l];c&&!c.hideFromSelection&&(a&&(a.indexOf(l)>=0?hn(this.pluginSelectorsEl.querySelector(".select_"+l),"disabled"):Qe(this.pluginSelectorsEl.querySelector(".select_"+l),"disabled")),l===this.getSelectedPluginName()?Qe(this.pluginSelectorsEl.querySelector(".select_"+l),"selected"):hn(this.pluginSelectorsEl.querySelector(".select_"+l),"selected"))}}getCompatiblePlugins(){if(!this.results)return Object.keys(Gl(this.config.plugins,l=>typeof l=="object"&&l.enabled||l===!0));let a=[];for(let l in this.plugins)this.plugins[l].canHandleResults()&&a.push({name:l,priority:this.plugins[l].priority});return a.sort((l,c)=>c.priority-l.priority).map(l=>l.name)}draw(){if(this.updateHelpButton(),this.updateResponseInfo(),!this.results)return;let a=this.getCompatiblePlugins();if(this.drawnPlugin&&this.getSelectedPluginName()!==this.drawnPlugin){for(;this.pluginControls.firstChild;)this.pluginControls.firstChild.remove();this.plugins[this.drawnPlugin].destroy?.()}let l;if(this.getSelectedPlugin()&&this.getSelectedPlugin()?.canHandleResults()?(l=this.getSelectedPluginName(),this.emptyFallbackElement()):a[0]&&(this.drawnPlugin&&this.plugins[this.drawnPlugin].destroy?.(),l=a[0],this.fillFallbackBox(l)),l){this.drawnPlugin=l,this.emit("draw",this,this.plugins[l]);let c=this.plugins[l];(c.initialize?c.initialize():Promise.resolve()).then(async()=>{if(l){for(;this.resultsEl.firstChild;)this.resultsEl.firstChild.remove();await this.plugins[l].draw(this.config.plugins[l].dynamicConfig),this.emit("drawn",this,this.plugins[l]),this.updateExportHeaders(),this.updatePluginSelectors(a)}},g=>console.error)}else this.resultsEl.textContent="cannot render result",this.updateExportHeaders(),this.updatePluginSelectors(a)}refresh(){this.draw()}destroy(){this.drawnPlugin&&this.plugins[this.drawnPlugin]?.destroy?.(),this.removeAllListeners(),this.rootEl.remove()}getPrefixes(){return this.config.prefixes?typeof this.config.prefixes=="function"?this.config.prefixes(this):this.config.prefixes:{}}selectPlugin(a){this.selectedPlugin!==a&&(this.config.plugins[a]?this.selectedPlugin=a:(console.warn(`Plugin ${a} does not exist.`),this.selectedPlugin=this.config.defaultPlugin),this.storeConfig(),this.emit("change",this),this.updatePluginSelectors(),this.draw())}drawPluginSelectors(){this.pluginSelectorsEl=document.createElement("ul"),this.pluginSelectorsEl.className="yasr_btnGroup";let a=this.config.pluginOrder;Object.keys(this.config.plugins).sort().forEach(l=>{a.indexOf(l)===-1&&a.push(l)});for(let l of a){if(!this.config.plugins[l]||!this.config.plugins[l].enabled)continue;let c=this.plugins[l];if(!c||c.hideFromSelection)continue;let p=c.label||l,g=document.createElement("button");if(Qe(g,"yasr_btn","select_"+l),g.title=p,g.type="button",g.setAttribute("aria-label",`Shows ${p} view`),c.getIcon){let U=c.getIcon();U&&(Qe(U,"plugin_icon"),g.appendChild(U))}let y=document.createElement("span");y.textContent=p,g.appendChild(y),g.addEventListener("click",()=>this.selectPlugin(l));let T=document.createElement("li");T.appendChild(g),this.pluginSelectorsEl.appendChild(T)}this.pluginSelectorsEl.children.length>=1&&this.headerEl.appendChild(this.pluginSelectorsEl),this.updatePluginSelectors()}fillFallbackBox(a){if(this.emptyFallbackElement(),this.plugins[a||this.drawnPlugin||""]?.hideFromSelection)return;let l=this.getSelectedPlugin(),c=this.plugins[a||this.drawnPlugin||""]?.label||a||this.drawnPlugin,p=l?.label||this.getSelectedPluginName(),g=document.createElement("p");if(g.innerText=`Could not render results with the ${p} plugin, the results currently are rendered with the ${c} plugin. ${this.getSelectedPlugin()?.helpReference?"See ":""}`,l?.helpReference){let y=document.createElement("a");y.innerText=`${p} documentation`,y.href=l.helpReference,y.rel="noopener noreferrer",y.target="_blank",g.append(y),g.innerHTML+=" for more information."}this.fallbackInfoEl.appendChild(g)}drawPluginElement(){let a=document.createElement("div");Qe(a,"space_element"),this.headerEl.appendChild(a),this.pluginControls=document.createElement("div"),this.pluginControls.setAttribute("id","yasr_plugin_control"),Qe(this.pluginControls,"yasr_plugin_control"),this.pluginControls.setAttribute("aria-controls",this.resultsEl.id),this.headerEl.appendChild(this.pluginControls)}drawHeader(){this.drawPluginSelectors(),this.drawResponseInfo(),this.drawPluginElement(),this.drawDownloadIcon(),this.drawFullscreenButton(),this.loadingEl&&this.headerEl.appendChild(this.loadingEl),this.drawDocumentationButton()}drawDownloadIcon(){this.downloadBtn=document.createElement("a"),Qe(this.downloadBtn,"yasr_btn","yasr_downloadIcon","btn_icon"),this.downloadBtn.download="",this.downloadBtn.setAttribute("aria-label","Download Results"),this.downloadBtn.setAttribute("tabindex","0"),this.downloadBtn.setAttribute("role","button");let a=document.createElement("i");Qe(a,"fas","fa-download"),a.setAttribute("aria-hidden","true"),this.downloadBtn.appendChild(a),this.downloadBtn.addEventListener("click",()=>{Xo(this.downloadBtn,"disabled")||this.download()}),this.downloadBtn.addEventListener("keydown",l=>{if(l.code==="Space"||l.code==="Enter"){if(Xo(this.downloadBtn,"disabled"))return;this.download()}}),this.headerEl.appendChild(this.downloadBtn)}drawResponseInfo(){this.dataElement=document.createElement("div"),Qe(this.dataElement,"yasr_response_chip"),this.headerEl.appendChild(this.dataElement),this.updateResponseInfo()}updateResponseInfo(){let a="";if(this.results){hn(this.dataElement,"empty");let l=this.results.getBindings();l&&(a+=`${l.length} result${l.length===1?"":"s"}`);let c=this.results.getResponseTime();if(c){a||(a="Response");let p=c/1e3;a+=` in ${p} second${p===1?"":"s"}`}}else Qe(this.dataElement,"empty");this.dataElement.innerText=a}updateHelpButton(){let a=this.getSelectedPlugin();if(a?.helpReference){let l=`View documentation of ${a.label||this.getSelectedPluginName()}`;this.documentationLink.href=a.helpReference,this.documentationLink.title=l,this.documentationLink.setAttribute("aria-label",l),hn(this.documentationLink,"disabled")}else Qe(this.documentationLink,"disabled"),this.documentationLink.title="This plugin doesn't have a help reference yet. Please contact the maintainer to fix this"}updateExportHeaders(){if(this.downloadBtn&&this.drawnPlugin){this.downloadBtn.title="";let a=this.plugins[this.drawnPlugin];if(a&&a.download){let l=a.download(this.config.getDownloadFileName?.());if(hn(this.downloadBtn,"disabled"),l){l.title&&(this.downloadBtn.title=l.title);return}}this.downloadBtn.title="Download not supported",Qe(this.downloadBtn,"disabled")}}drawFullscreenButton(){this.fullscreenBtn=document.createElement("button"),Qe(this.fullscreenBtn,"yasr_btn","yasr_fullscreenButton","btn_icon"),this.fullscreenBtn.setAttribute("aria-label","Toggle fullscreen"),this.fullscreenBtn.setAttribute("tabindex","0"),this.fullscreenBtn.setAttribute("role","button");let a=document.createElement("i");Qe(a,"fas"),Qe(a,"fa-expand"),Qe(a,"fullscreenIcon"),a.setAttribute("aria-hidden","true"),this.fullscreenBtn.appendChild(a);let l=document.createElement("i");Qe(l,"fas"),Qe(l,"fa-compress"),Qe(l,"fullscreenExitIcon"),l.setAttribute("aria-hidden","true"),this.fullscreenBtn.appendChild(l),this.fullscreenBtn.title="Toggle fullscreen (F10)",this.fullscreenBtn.addEventListener("click",()=>{this.toggleFullscreen()}),this.fullscreenBtn.addEventListener("keydown",c=>{(c.code==="Space"||c.code==="Enter")&&this.toggleFullscreen()}),this.headerEl.appendChild(this.fullscreenBtn)}toggleFullscreen(){this.isFullscreen=!this.isFullscreen,this.isFullscreen?(Qe(this.rootEl,"fullscreen"),this.fullscreenBtn&&(this.fullscreenBtn.title="Exit fullscreen (F10)")):(hn(this.rootEl,"fullscreen"),this.fullscreenBtn&&(this.fullscreenBtn.title="Toggle fullscreen (F10)"))}getIsFullscreen(){return this.isFullscreen}createLoadingElement(){this.loadingEl=document.createElement("div"),this.loadingEl.className="yasr_loading_indicator",this.loadingEl.title="Executing query...",this.loadingEl.innerHTML='<div class="yasr_loading_spinner"></div>',this.loadingEl.style.display="none"}showLoading(){this.isLoading=!0,this.loadingEl&&(this.loadingEl.style.display="flex")}hideLoading(){this.isLoading=!1,this.loadingEl&&(this.loadingEl.style.display="none")}drawDocumentationButton(){this.documentationLink=document.createElement("a"),Qe(this.documentationLink,"yasr_btn","yasr_external_ref_btn");let a=document.createElement("i");Qe(a,"fas","fa-circle-question"),this.documentationLink.appendChild(a),this.documentationLink.href="https://yasgui-doc.matdata.eu/docs/user-guide",this.documentationLink.target="_blank",this.documentationLink.rel="noopener noreferrer",this.headerEl.appendChild(this.documentationLink)}download(){if(!this.drawnPlugin)return;let a=this.plugins[this.drawnPlugin];if(a&&a.download){let l=a.download(this.config.getDownloadFileName?.());if(!l)return;let c=l.getData(),p;if(c.startsWith("data:"))p=c;else{let y=new Blob([c],{type:l.contentType??"text/plain"});p=window.URL.createObjectURL(y)}let g=document.createElement("a");g.href=p,g.download=l.filename,g.click()}}handleLocalStorageQuotaFull(a){console.warn("Localstorage quota exceeded. Clearing all queries"),ar.clearStorage()}getResponseFromStorage(){if(this.config.maxPersistentResponseSize<=0){let l=this.getStorageId(this.config.persistenceLabelResponse);l&&this.storage.remove(l);return}let a=this.getStorageId(this.config.persistenceLabelResponse);if(a)return this.storage.get(a)}getPersistentConfig(){return{selectedPlugin:this.getSelectedPluginName(),pluginsConfig:Mo(this.config.plugins,a=>a.dynamicConfig)}}storePluginConfig(a,l){this.config.plugins[a].dynamicConfig=l,this.storeConfig(),this.emit("change",this)}storeConfig(){let a=this.getStorageId(this.config.persistenceLabelConfig);a&&this.storage.set(a,this.getPersistentConfig(),this.config.persistencyExpire,this.handleLocalStorageQuotaFull)}storeResponse(){let a=this.getStorageId(this.config.persistenceLabelResponse);if(a&&this.config.maxPersistentResponseSize<=0){this.storage.remove(a);return}if(a&&this.results){let l=this.results.getAsStoreObject(this.config.maxPersistentResponseSize);l&&!l.error?this.storage.set(a,l,this.config.persistencyExpire,this.handleLocalStorageQuotaFull):this.storage.remove(a)}}setResponse(a,l){a&&(this.hideLoading(),this.results=new Us(a,l),this.draw(),this.storeResponse())}executeQuery(a,l){return this.config.executeQuery?this.config.executeQuery(a,l):Promise.reject(new Error("No executeQuery handler configured on this Yasr instance"))}initializePlugins(){for(let a in this.config.plugins)this.config.plugins[a]&&(ar.plugins[a]?this.plugins[a]=new ar.plugins[a](this):console.warn("Wanted to initialize plugin "+a+" but could not find a matching registered plugin"))}static registerPlugin(a,l,c=!0){ar.plugins[a]=l,c?ar.defaults.plugins[a]={enabled:!0}:ar.defaults.plugins[a]={enabled:!1}}static clearStorage(){new ri(ar.storageNamespace).removeNamespace()}};ar.defaults=Zl(),ar.plugins={},ar.Dependencies={},ar.storageNamespace="triply";var $r=ar;function CR(r,n,a=!0){$r.plugins[r]=n,a?$r.defaults.plugins[r]={enabled:!0}:$r.defaults.plugins[r]={enabled:!1}}$r.registerPlugin("boolean",ra);$r.registerPlugin("response",na);$r.registerPlugin("error",ia);var AR=$r;return Ib(RR);})();
39
+ # Triples where <${e}> is subject
40
+ ${s.trim()}
41
+ `):this.appendToView(`
42
+
43
+ # Triples where <${e}> is subject: no data
44
+ `)}catch(n){if(this.cm!==t)return;console.error("Subject-of query failed:",n);let s=n instanceof Error?n.message:String(n);this.appendToView(`
45
+
46
+ # Triples where <${e}> is subject failed: ${s}
47
+ `)}finally{this.cm===t&&this.yasr.hideLoading()}}async runObjectOfQuery(e){if(!this.yasr.config.executeQuery)return;let t=this.cm;if(!t)return;let r=yl(e);try{this.yasr.showLoading();let n=await this.yasr.executeQuery(r,{acceptHeader:this.getConstructAcceptHeader()});if(this.cm!==t)return;let s=this.getResponseContent(n);s?this.appendToView(`
48
+
49
+ # Triples where <${e}> is object
50
+ ${s.trim()}
51
+ `):this.appendToView(`
52
+
53
+ # Triples where <${e}> is object: no data
54
+ `)}catch(n){if(this.cm!==t)return;console.error("Object-of query failed:",n);let s=n instanceof Error?n.message:String(n);this.appendToView(`
55
+
56
+ # Triples where <${e}> is object failed: ${s}
57
+ `)}finally{this.cm===t&&this.yasr.hideLoading()}}getConstructAcceptHeader(){let e=this.yasr.results?.getContentType();if(e){let t=e.toLowerCase();if(t.includes("turtle")||t.includes("trig")||t.includes("triple")||t.includes("quad")||t.includes("rdf"))return e.split(";")[0].trim()}return"text/turtle"}getResponseContent(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.content=="string")return t.content;if(typeof t.data=="string")return t.data}return""}appendToView(e){if(!this.cm||!e)return;let t=(this.yasr.results?.getOriginalResponseAsString()||"")+this.appendedContent;this.appendedContent+=gx(e,t),this.showMore()}setValue(e){this.cm&&this.cm.dispatch({changes:{from:0,to:this.cm.state.doc.length,insert:e}})}limitData(e){let t=e.split(`
58
+ `);return t.length>this.config.maxLines&&(e=t.slice(0,this.config.maxLines).join(`
59
+ `)),e}showLess(e=!0){if(!this.cm)return;ge(this.cm.dom,"overflow"),this.overLay&&(this.overLay.remove(),this.overLay=void 0),this.overLay=document.createElement("div"),ge(this.overLay,"overlay");let t=document.createElement("div");ge(t,"overlay_content");let r=document.createElement("button");r.title="Show all",ge(r,"yasr_btn","overlay_btn"),r.textContent="Show all",r.addEventListener("click",()=>this.showMore()),t.append(r);let n=document.createElement("button");n.title="Download result",ge(n,"yasr_btn","overlay_btn");let s=document.createElement("span");s.innerText="Download result",n.appendChild(s);let o=document.createElement("i");ge(o,"fas"),ge(o,"fa-download"),n.appendChild(o),n.addEventListener("click",()=>this.yasr.download()),n.addEventListener("keydown",a=>{(a.code==="Space"||a.code==="Enter")&&this.yasr.download()}),t.appendChild(n),this.overLay.appendChild(t),this.cm.dom.appendChild(this.overLay),e&&this.setValue(this.limitData(this.yasr.results?.getOriginalResponseAsString()||""))}showMore(){this.cm&&(Bi(this.cm.dom,"overflow"),this.overLay?.remove(),this.overLay=void 0,this.setValue((this.yasr.results?.getOriginalResponseAsString()||"")+this.appendedContent))}destroy(){this.destroyEditor()}};Sl.defaults={maxLines:30};var no=Sl;var so=class{constructor(e){this.priority=20;this.hideFromSelection=!0;this.yasr=e}canHandleResults(){return!!this.yasr.results&&!!this.yasr.results.getError()}getTryBtn(e){let t=document.createElement("a");return t.href=e,t.rel="noopener noreferrer",t.target="_blank",t.className="yasr_tryQuery",t.textContent="Try query in a new browser window",t}getCorsMessage(){let e=document.createElement("div");e.className="redOutline";let t=document.createElement("p");t.textContent="Unable to get response from endpoint. Possible reasons:",e.appendChild(t);let r=document.createElement("ul"),n=document.createElement("li");n.textContent="Incorrect endpoint URL",r.appendChild(n);let s=document.createElement("li");s.textContent="Endpoint is down",r.appendChild(s);let o=document.createElement("li");o.textContent="Credentials have expired",r.appendChild(o);let a=document.createElement("li"),l=document.createElement("span");l.textContent="Endpoint is not accessible from the Matgui server and website, and the endpoint is not ",a.appendChild(l);let h=document.createElement("a");return h.textContent="CORS-enabled",h.href="http://enable-cors.org/",h.target="_blank",h.rel="noopener noreferrer",a.appendChild(h),r.appendChild(a),e.appendChild(r),e}getStatusSpecificGuidance(e){let t=document.createElement("div");t.className="statusGuidance";let r=document.createElement("h4"),n=document.createElement("ul");switch(e){case 401:r.textContent="Authentication Required",t.appendChild(r);let s=document.createElement("li");s.textContent="The endpoint requires authentication credentials",n.appendChild(s);let o=document.createElement("li");o.textContent="Check if you need to provide an API key, username/password, or bearer token",n.appendChild(o);let a=document.createElement("li");return a.textContent="Verify your credentials are correct and not expired",n.appendChild(a),t.appendChild(n),t;case 403:r.textContent="Access Forbidden",t.appendChild(r);let l=document.createElement("li");l.textContent="You don't have permission to access this endpoint",n.appendChild(l);let h=document.createElement("li");h.textContent="Your credentials may be valid but lack sufficient privileges",n.appendChild(h);let u=document.createElement("li");u.textContent="Contact the endpoint administrator to request access",n.appendChild(u);let c=document.createElement("li");return c.textContent="A firewall such as OWASP is blocking is blocking SPARQL queries because they resemble SQL injection attempts. Contact the endpoint administrator to whitelist your queries or adjust firewall settings",n.appendChild(c),t.appendChild(n),t;case 404:r.textContent="Endpoint Not Found",t.appendChild(r);let d=document.createElement("li");d.textContent="The endpoint URL may be incorrect or has changed",n.appendChild(d);let g=document.createElement("li");g.textContent="Check for typos in the endpoint address",n.appendChild(g);let m=document.createElement("li");return m.textContent="Verify the endpoint is still active and hasn't been moved",n.appendChild(m),t.appendChild(n),t;case 429:r.textContent="Too Many Requests",t.appendChild(r);let x=document.createElement("li");x.textContent="You've exceeded the rate limit for this endpoint",n.appendChild(x);let O=document.createElement("li");O.textContent="Wait a few moments before trying again",n.appendChild(O);let w=document.createElement("li");return w.textContent="Consider reducing query frequency or contacting the endpoint provider for higher limits",n.appendChild(w),t.appendChild(n),t;case 500:r.textContent="Internal Server Error",t.appendChild(r);let B=document.createElement("li");B.textContent="The SPARQL endpoint encountered an error while processing your query",n.appendChild(B);let F=document.createElement("li");F.textContent="Try simplifying your query or reducing the result limit",n.appendChild(F);let M=document.createElement("li");M.textContent="Check the error message below for specific details",n.appendChild(M);let G=document.createElement("li");return G.textContent="If the problem persists, contact the endpoint administrator",n.appendChild(G),t.appendChild(n),t;case 502:case 503:case 504:r.textContent=e===502?"Bad Gateway":e===503?"Service Unavailable":"Gateway Timeout",t.appendChild(r);let T=document.createElement("li");T.textContent="The endpoint is temporarily unavailable or overloaded",n.appendChild(T);let b=document.createElement("li");b.textContent="Try again in a few moments",n.appendChild(b);let A=document.createElement("li");return A.textContent="The service may be undergoing maintenance",n.appendChild(A),t.appendChild(n),t;default:if(e>=400&&e<500){r.textContent="Client Error",t.appendChild(r);let y=document.createElement("li");y.textContent="There's an issue with the request",n.appendChild(y);let v=document.createElement("li");return v.textContent="Check the error message below for details",n.appendChild(v),t.appendChild(n),t}return null}}async draw(){let e=document.createElement("div");e.className="errorResult",this.yasr.resultsEl.appendChild(e);let t=this.yasr.results?.getError();if(!t)return;let r=document.createElement("div");r.className="errorHeader",e.appendChild(r);let n=await this.yasr.renderError(t);if(n){let o=document.createElement("div");o.className="redOutline",o.appendChild(n),e.appendChild(o);return}if(t.status){var s="Error";t.statusText&&t.statusText.length<100&&(s=t.statusText),s+=` (#${t.status})`;let o=document.createElement("span");if(o.className="status",o.textContent=s,r.appendChild(o),this.yasr.config.getPlainQueryLinkToEndpoint){let l=this.yasr.config.getPlainQueryLinkToEndpoint();l&&r.appendChild(this.getTryBtn(l))}let a=this.getStatusSpecificGuidance(t.status);if(a&&e.appendChild(a),t.text){let l=document.createElement("div");ge(l,"errorMessageContainer"),e.appendChild(l);let h=document.createElement("pre");ge(h,"errorMessage"),h.textContent=t.text,l.appendChild(h)}}else{if(this.yasr.config.getPlainQueryLinkToEndpoint){let a=this.yasr.config.getPlainQueryLinkToEndpoint();a&&r.appendChild(this.getTryBtn(a))}if(!t.text||t.text.indexOf("Request has been terminated")>=0||t.text.indexOf("Failed to fetch")>=0||t.text.indexOf("NetworkError")>=0||t.text.indexOf("Network request failed")>=0)e.appendChild(this.getCorsMessage());else{let a=document.createElement("pre");a.textContent=t.text,e.appendChild(a)}}}getIcon(){return document.createElement("")}};var it=class it extends mx.EventEmitter{constructor(t,r={},n){super();this.plugins={};this.helpDrawn=!1;this.isFullscreen=!1;this.isLoading=!1;this.resultHistory=[];this.historyIndex=-1;this.utils={addScript:pa,addCSS:da,sanitize:Ih};if(!t)throw new Error("No parent passed as argument. Dont know where to draw YASR");this.rootEl=document.createElement("div"),this.rootEl.className="yasr",t.appendChild(this.rootEl),this.config=Nl({},it.defaults,r),this.storage=new wr(it.storageNamespace),this.getConfigFromStorage(),this.headerEl=document.createElement("div"),this.headerEl.className="yasr_header",this.rootEl.appendChild(this.headerEl),this.fallbackInfoEl=document.createElement("div"),this.fallbackInfoEl.className="yasr_fallback_info",this.rootEl.appendChild(this.fallbackInfoEl),this.resultsEl=document.createElement("div"),this.resultsEl.className="yasr_results",this.resultsEl.id=_l("resultsId"),this.rootEl.appendChild(this.resultsEl),this.createLoadingElement(),this.initializePlugins(),this.drawHeader();let s=n||this.getResponseFromStorage();s&&this.setResponse(s)}getConfigFromStorage(){let t=this.getStorageId(this.config.persistenceLabelConfig);if(t){let r=this.storage.get(t);if(r){this.selectedPlugin=r.selectedPlugin;for(let n in r.pluginsConfig){let s=r.pluginsConfig[n];s&&this.config.plugins[n]&&(this.config.plugins[n].dynamicConfig=s)}}}}async renderError(t){let r;if(this.config.errorRenderers!==void 0){for(let n of this.config.errorRenderers)if(r=await n(t),r!==void 0)break}return r}getStorageId(t,r){let n=r||this.config.persistenceId;if(n)return typeof n=="string"?n+"_"+t:n(this)+"_"+t}somethingDrawn(){return!!this.resultsEl.children.length}emptyFallbackElement(){for(;this.fallbackInfoEl.firstChild;)this.fallbackInfoEl.removeChild(this.fallbackInfoEl.firstChild)}getSelectedPluginName(){return this.selectedPlugin||this.config.defaultPlugin}getSelectedPlugin(){if(this.plugins[this.getSelectedPluginName()])return this.plugins[this.getSelectedPluginName()];console.warn(`Tried using plugin ${this.getSelectedPluginName()}, but seems this plugin isnt registered in yasr.`)}updatePluginSelectors(t){if(this.pluginSelectorsEl)for(let r in this.config.plugins){let n=this.plugins[r];n&&!n.hideFromSelection&&(t&&(t.indexOf(r)>=0?Bi(this.pluginSelectorsEl.querySelector(".select_"+r),"disabled"):ge(this.pluginSelectorsEl.querySelector(".select_"+r),"disabled")),r===this.getSelectedPluginName()?ge(this.pluginSelectorsEl.querySelector(".select_"+r),"selected"):Bi(this.pluginSelectorsEl.querySelector(".select_"+r),"selected"))}}getCompatiblePlugins(){if(!this.results)return Object.keys(kl(this.config.plugins,r=>typeof r=="object"&&r.enabled||r===!0));let t=[];for(let r in this.plugins)this.plugins[r].canHandleResults()&&t.push({name:r,priority:this.plugins[r].priority});return t.sort((r,n)=>n.priority-r.priority).map(r=>r.name)}draw(){if(this.updateHelpButton(),this.updateResponseInfo(),!this.results)return;let t=this.getCompatiblePlugins();if(this.drawnPlugin&&this.getSelectedPluginName()!==this.drawnPlugin){for(;this.pluginControls.firstChild;)this.pluginControls.firstChild.remove();this.plugins[this.drawnPlugin].destroy?.()}let r;if(this.getSelectedPlugin()&&this.getSelectedPlugin()?.canHandleResults()?(r=this.getSelectedPluginName(),this.emptyFallbackElement()):t[0]&&(this.drawnPlugin&&this.plugins[this.drawnPlugin].destroy?.(),r=t[0],this.fillFallbackBox(r)),r){this.drawnPlugin=r,this.emit("draw",this,this.plugins[r]);let n=this.plugins[r];(n.initialize?n.initialize():Promise.resolve()).then(async()=>{if(r){for(;this.resultsEl.firstChild;)this.resultsEl.firstChild.remove();await this.plugins[r].draw(this.config.plugins[r].dynamicConfig),this.emit("drawn",this,this.plugins[r]),this.updateExportHeaders(),this.updatePluginSelectors(t)}},o=>console.error)}else this.resultsEl.textContent="cannot render result",this.updateExportHeaders(),this.updatePluginSelectors(t)}refresh(){this.draw()}destroy(){this.drawnPlugin&&this.plugins[this.drawnPlugin]?.destroy?.(),this.removeAllListeners(),this.rootEl.remove()}getPrefixes(){return this.config.prefixes?typeof this.config.prefixes=="function"?this.config.prefixes(this):this.config.prefixes:{}}selectPlugin(t){this.selectedPlugin!==t&&(this.config.plugins[t]?this.selectedPlugin=t:(console.warn(`Plugin ${t} does not exist.`),this.selectedPlugin=this.config.defaultPlugin),this.storeConfig(),this.emit("change",this),this.updatePluginSelectors(),this.draw())}drawPluginSelectors(){this.pluginSelectorsEl=document.createElement("ul"),this.pluginSelectorsEl.className="yasr_btnGroup";let t=this.config.pluginOrder;Object.keys(this.config.plugins).sort().forEach(r=>{t.indexOf(r)===-1&&t.push(r)});for(let r of t){if(!this.config.plugins[r]||!this.config.plugins[r].enabled)continue;let n=this.plugins[r];if(!n||n.hideFromSelection)continue;let s=n.label||r,o=document.createElement("button");if(ge(o,"yasr_btn","select_"+r),o.title=s,o.type="button",o.setAttribute("aria-label",`Shows ${s} view`),n.getIcon){let h=n.getIcon();h&&(ge(h,"plugin_icon"),o.appendChild(h))}let a=document.createElement("span");a.textContent=s,o.appendChild(a),o.addEventListener("click",()=>this.selectPlugin(r));let l=document.createElement("li");l.appendChild(o),this.pluginSelectorsEl.appendChild(l)}this.pluginSelectorsEl.children.length>=1&&this.headerEl.appendChild(this.pluginSelectorsEl),this.updatePluginSelectors()}fillFallbackBox(t){if(this.emptyFallbackElement(),this.plugins[t||this.drawnPlugin||""]?.hideFromSelection)return;let r=this.getSelectedPlugin(),n=this.plugins[t||this.drawnPlugin||""]?.label||t||this.drawnPlugin,s=r?.label||this.getSelectedPluginName(),o=document.createElement("p");if(o.innerText=`Could not render results with the ${s} plugin, the results currently are rendered with the ${n} plugin. ${this.getSelectedPlugin()?.helpReference?"See ":""}`,r?.helpReference){let a=document.createElement("a");a.innerText=`${s} documentation`,a.href=r.helpReference,a.rel="noopener noreferrer",a.target="_blank",o.append(a),o.innerHTML+=" for more information."}this.fallbackInfoEl.appendChild(o)}drawPluginElement(){let t=document.createElement("div");ge(t,"space_element"),this.headerEl.appendChild(t),this.pluginControls=document.createElement("div"),this.pluginControls.setAttribute("id","yasr_plugin_control"),ge(this.pluginControls,"yasr_plugin_control"),this.pluginControls.setAttribute("aria-controls",this.resultsEl.id),this.headerEl.appendChild(this.pluginControls)}drawHeader(){this.drawPluginSelectors(),this.drawResponseInfo(),this.drawPluginElement(),this.drawHistoryButtons(),this.drawDownloadIcon(),this.drawFullscreenButton(),this.loadingEl&&this.headerEl.appendChild(this.loadingEl),this.drawDocumentationButton()}drawHistoryButtons(){if(this.historyBackBtn&&this.historyForwardBtn)return;let t=(r,n,s)=>{let o=document.createElement("button");ge(o,"yasr_btn","yasr_btn_history","btn_icon"),o.setAttribute("aria-label",r),o.title=s,o.disabled=!0;let a=document.createElement("i");return ge(a,"fas",n),a.setAttribute("aria-hidden","true"),o.appendChild(a),o};this.historyBackBtn=t("Previous result","fa-chevron-left","Previous result"),this.historyBackBtn.addEventListener("click",()=>this.navigateHistory(-1)),this.historyForwardBtn=t("Next result","fa-chevron-right","Next result"),this.historyForwardBtn.addEventListener("click",()=>this.navigateHistory(1)),this.headerEl.appendChild(this.historyBackBtn),this.headerEl.appendChild(this.historyForwardBtn)}updateHistoryButtons(){!this.historyBackBtn||!this.historyForwardBtn||(this.historyBackBtn.disabled=this.historyIndex<=0,this.historyForwardBtn.disabled=this.historyIndex>=this.resultHistory.length-1)}navigateHistory(t){let r=this.historyIndex+t;if(r<0||r>=this.resultHistory.length)return;this.historyIndex=r;let n=this.resultHistory[this.historyIndex];this.results=new Ss(n.data,n.duration),this.draw(),this.updateHistoryButtons()}drawDownloadIcon(){this.downloadBtn=document.createElement("a"),ge(this.downloadBtn,"yasr_btn","yasr_downloadIcon","btn_icon"),this.downloadBtn.download="",this.downloadBtn.setAttribute("aria-label","Download Results"),this.downloadBtn.setAttribute("tabindex","0"),this.downloadBtn.setAttribute("role","button");let t=document.createElement("i");ge(t,"fas","fa-download"),t.setAttribute("aria-hidden","true"),this.downloadBtn.appendChild(t),this.downloadBtn.addEventListener("click",()=>{fs(this.downloadBtn,"disabled")||this.download()}),this.downloadBtn.addEventListener("keydown",r=>{if(r.code==="Space"||r.code==="Enter"){if(fs(this.downloadBtn,"disabled"))return;this.download()}}),this.headerEl.appendChild(this.downloadBtn)}drawResponseInfo(){this.dataElement=document.createElement("div"),ge(this.dataElement,"yasr_response_chip"),this.headerEl.appendChild(this.dataElement),this.updateResponseInfo()}updateResponseInfo(){let t="";if(this.results){Bi(this.dataElement,"empty");let r=this.results.getBindings();r&&(t+=`${r.length} result${r.length===1?"":"s"}`);let n=this.results.getResponseTime();if(n){t||(t="Response");let s=n/1e3;t+=` in ${s} second${s===1?"":"s"}`}}else ge(this.dataElement,"empty");this.dataElement.innerText=t}updateHelpButton(){let t=this.getSelectedPlugin();if(t?.helpReference){let r=`View documentation of ${t.label||this.getSelectedPluginName()}`;this.documentationLink.href=t.helpReference,this.documentationLink.title=r,this.documentationLink.setAttribute("aria-label",r),Bi(this.documentationLink,"disabled")}else ge(this.documentationLink,"disabled"),this.documentationLink.title="This plugin doesn't have a help reference yet. Please contact the maintainer to fix this"}updateExportHeaders(){if(this.downloadBtn&&this.drawnPlugin){this.downloadBtn.title="";let t=this.plugins[this.drawnPlugin];if(t&&t.download){let r=t.download(this.config.getDownloadFileName?.());if(Bi(this.downloadBtn,"disabled"),r){r.title&&(this.downloadBtn.title=r.title);return}}this.downloadBtn.title="Download not supported",ge(this.downloadBtn,"disabled")}}drawFullscreenButton(){this.fullscreenBtn=document.createElement("button"),ge(this.fullscreenBtn,"yasr_btn","yasr_fullscreenButton","btn_icon"),this.fullscreenBtn.setAttribute("aria-label","Toggle fullscreen"),this.fullscreenBtn.setAttribute("tabindex","0"),this.fullscreenBtn.setAttribute("role","button");let t=document.createElement("i");ge(t,"fas"),ge(t,"fa-expand"),ge(t,"fullscreenIcon"),t.setAttribute("aria-hidden","true"),this.fullscreenBtn.appendChild(t);let r=document.createElement("i");ge(r,"fas"),ge(r,"fa-compress"),ge(r,"fullscreenExitIcon"),r.setAttribute("aria-hidden","true"),this.fullscreenBtn.appendChild(r),this.fullscreenBtn.title="Toggle fullscreen (F10)",this.fullscreenBtn.addEventListener("click",()=>{this.toggleFullscreen()}),this.fullscreenBtn.addEventListener("keydown",n=>{(n.code==="Space"||n.code==="Enter")&&this.toggleFullscreen()}),this.headerEl.appendChild(this.fullscreenBtn)}toggleFullscreen(){this.isFullscreen=!this.isFullscreen,this.isFullscreen?(ge(this.rootEl,"fullscreen"),this.fullscreenBtn&&(this.fullscreenBtn.title="Exit fullscreen (F10)")):(Bi(this.rootEl,"fullscreen"),this.fullscreenBtn&&(this.fullscreenBtn.title="Toggle fullscreen (F10)"))}getIsFullscreen(){return this.isFullscreen}createLoadingElement(){this.loadingEl=document.createElement("div"),this.loadingEl.className="yasr_loading_indicator",this.loadingEl.title="Executing query...",this.loadingEl.innerHTML='<div class="yasr_loading_spinner"></div>',this.loadingEl.style.display="none"}showLoading(){this.isLoading=!0,this.loadingEl&&(this.loadingEl.style.display="flex")}hideLoading(){this.isLoading=!1,this.loadingEl&&(this.loadingEl.style.display="none")}drawDocumentationButton(){this.documentationLink=document.createElement("a"),ge(this.documentationLink,"yasr_btn","yasr_external_ref_btn");let t=document.createElement("i");ge(t,"fas","fa-circle-question"),this.documentationLink.appendChild(t),this.documentationLink.href="https://matgui-doc.matdata.eu/docs/user-guide",this.documentationLink.target="_blank",this.documentationLink.rel="noopener noreferrer",this.headerEl.appendChild(this.documentationLink)}download(){if(!this.drawnPlugin)return;let t=this.plugins[this.drawnPlugin];if(t&&t.download){let r=t.download(this.config.getDownloadFileName?.());if(!r)return;let n=r.getData(),s;if(n.startsWith("data:"))s=n;else{let a=new Blob([n],{type:r.contentType??"text/plain"});s=window.URL.createObjectURL(a)}let o=document.createElement("a");o.href=s,o.download=r.filename,o.click()}}handleLocalStorageQuotaFull(t){console.warn("Localstorage quota exceeded. Clearing all queries"),it.clearStorage()}getResponseFromStorage(){if(this.config.maxPersistentResponseSize<=0){let r=this.getStorageId(this.config.persistenceLabelResponse);r&&this.storage.remove(r);return}let t=this.getStorageId(this.config.persistenceLabelResponse);if(t)return this.storage.get(t)}getPersistentConfig(){return{selectedPlugin:this.getSelectedPluginName(),pluginsConfig:es(this.config.plugins,t=>t.dynamicConfig)}}storePluginConfig(t,r){this.config.plugins[t].dynamicConfig=r,this.storeConfig(),this.emit("change",this)}storeConfig(){let t=this.getStorageId(this.config.persistenceLabelConfig);t&&this.storage.set(t,this.getPersistentConfig(),this.config.persistencyExpire,this.handleLocalStorageQuotaFull)}storeResponse(){let t=this.getStorageId(this.config.persistenceLabelResponse);if(t&&this.config.maxPersistentResponseSize<=0){this.storage.remove(t);return}if(t&&this.results){let r=this.results.getAsStoreObject(this.config.maxPersistentResponseSize);r&&!r.error?this.storage.set(t,r,this.config.persistencyExpire,this.handleLocalStorageQuotaFull):this.storage.remove(t)}}setResponse(t,r){t&&(this.hideLoading(),this.results=new Ss(t,r),this.resultHistory=this.resultHistory.slice(0,this.historyIndex+1),this.resultHistory.push({data:t,duration:r}),this.resultHistory.length>it.MAX_HISTORY_SIZE&&(this.resultHistory=this.resultHistory.slice(this.resultHistory.length-it.MAX_HISTORY_SIZE)),this.historyIndex=this.resultHistory.length-1,this.draw(),this.updateHistoryButtons(),this.storeResponse())}executeQuery(t,r){return this.config.executeQuery?this.config.executeQuery(t,r):Promise.reject(new Error("No executeQuery handler configured on this Yasr instance"))}initializePlugins(){for(let t in this.config.plugins)this.config.plugins[t]&&(it.plugins[t]?this.plugins[t]=new it.plugins[t](this):console.warn("Wanted to initialize plugin "+t+" but could not find a matching registered plugin"))}static registerPlugin(t,r,n=!0){it.plugins[t]=r,n?it.defaults.plugins[t]={enabled:!0}:it.defaults.plugins[t]={enabled:!1}}static clearStorage(){new wr(it.storageNamespace).removeNamespace()}};it.MAX_HISTORY_SIZE=20,it.defaults=Bl(),it.plugins={},it.Dependencies={},it.storageNamespace="triply";var Ri=it;function Ek(i,e,t=!0){Ri.plugins[i]=e,t?Ri.defaults.plugins[i]={enabled:!0}:Ri.defaults.plugins[i]={enabled:!1}}Ri.registerPlugin("boolean",Ts);Ri.registerPlugin("response",no);Ri.registerPlugin("error",so);var kk=Ri;return Ox(Nk);})();
48
60
  /*! Bundled license information:
49
61
 
50
62
  ieee754/index.js: