whistle.interceptors 0.0.3 → 0.0.4
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/CHANGELOG.md +33 -0
- package/commitlint.config.js +1 -0
- package/dist/server.js +1 -1
- package/dist/uiServer/index.js +3 -1
- package/package.json +15 -3
- package/public/assets/index-BWNZu5u4.css +1 -0
- package/public/assets/index-ZlpNVKm2.js +85 -0
- package/public/index.html +2 -2
- package/src/server.ts +54 -45
- package/src/types/rule.ts +4 -0
- package/src/uiServer/constant.ts +8 -0
- package/src/uiServer/router.ts +51 -23
- package/.console.log +0 -2
- package/public/assets/index-Bn3cFRn4.css +0 -1
- package/public/assets/index-yFos5qg5.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const a1=!1;var Lu=Array.isArray,JO=Array.prototype.indexOf,gv=Array.from,KO=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,i2=Object.getOwnPropertyDescriptors,GO=Object.prototype,XO=Array.prototype,mv=Object.getPrototypeOf,c1=Object.isExtensible;function kc(t){return typeof t=="function"}const _a=()=>{};function QO(t){return t()}function wh(t){for(var e=0;e<t.length;e++)t[e]()}const Pi=2,s2=4,Sd=8,vv=16,bo=32,rc=64,Sh=128,yi=256,Ch=512,Kr=1024,Ns=2048,$o=4096,eo=8192,Cd=16384,YO=32768,Nu=65536,o2=1<<17,ZO=1<<19,l2=1<<20,Dg=1<<21,Ps=Symbol("$state"),a2=Symbol("legacy props"),$O=Symbol("");function c2(t){return t===this.v}function kd(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function e3(t,e){return t!==e}function yv(t){return!kd(t,this.v)}function t3(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function n3(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function r3(t){throw new Error("https://svelte.dev/e/effect_orphan")}function i3(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function s3(t){throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function o3(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function l3(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function a3(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function c3(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let ic=!1,u3=!1;function f3(){ic=!0}const bv=1,xv=2,u2=4,h3=8,d3=16,p3=1,g3=2,f2=4,m3=8,v3=16,h2=1,y3=2,Fr=Symbol(),b3="http://www.w3.org/1999/xhtml";function ju(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Wt=null;function u1(t){Wt=t}function el(t){return d2().get(t)}function x3(t,e){return d2().set(t,e),e}function Ge(t,e=!1,n){var r=Wt={p:Wt,c:null,d:!1,e:null,m:!1,s:t,x:null,l:null};ic&&!e&&(Wt.l={s:null,u:null,r1:[],r2:Rl(!1)}),wv(()=>{r.d=!0})}function Xe(t){const e=Wt;if(e!==null){t!==void 0&&(e.x=t);const o=e.e;if(o!==null){var n=pn,r=wn;e.e=null;try{for(var i=0;i<o.length;i++){var s=o[i];Ho(s.effect),js(s.reaction),cr(s.fn)}}finally{Ho(n),js(r)}}Wt=e.p,e.m=!0}return t||{}}function sc(){return!ic||Wt!==null&&Wt.l===null}function d2(t){return Wt===null&&ju(),Wt.c??(Wt.c=new Map(w3(Wt)||void 0))}function w3(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}function gl(t){if(typeof t!="object"||t===null||Ps in t)return t;const e=mv(t);if(e!==GO&&e!==XO)return t;var n=new Map,r=Lu(t),i=Ks(0),s=wn,o=l=>{var a=wn;js(s);var u=l();return js(a),u};return r&&n.set("length",Ks(t.length)),new Proxy(t,{defineProperty(l,a,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&l3();var f=n.get(a);return f===void 0?(f=o(()=>Ks(u.value)),n.set(a,f)):b(f,o(()=>gl(u.value))),!0},deleteProperty(l,a){var u=n.get(a);if(u===void 0)a in l&&(n.set(a,o(()=>Ks(Fr))),Tp(i));else{if(r&&typeof a=="string"){var f=n.get("length"),h=Number(a);Number.isInteger(h)&&h<f.v&&b(f,h)}b(u,Fr),Tp(i)}return!0},get(l,a,u){var p;if(a===Ps)return t;var f=n.get(a),h=a in l;if(f===void 0&&(!h||(p=$s(l,a))!=null&&p.writable)&&(f=o(()=>Ks(gl(h?l[a]:Fr))),n.set(a,f)),f!==void 0){var d=c(f);return d===Fr?void 0:d}return Reflect.get(l,a,u)},getOwnPropertyDescriptor(l,a){var u=Reflect.getOwnPropertyDescriptor(l,a);if(u&&"value"in u){var f=n.get(a);f&&(u.value=c(f))}else if(u===void 0){var h=n.get(a),d=h==null?void 0:h.v;if(h!==void 0&&d!==Fr)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return u},has(l,a){var d;if(a===Ps)return!0;var u=n.get(a),f=u!==void 0&&u.v!==Fr||Reflect.has(l,a);if(u!==void 0||pn!==null&&(!f||(d=$s(l,a))!=null&&d.writable)){u===void 0&&(u=o(()=>Ks(f?gl(l[a]):Fr)),n.set(a,u));var h=c(u);if(h===Fr)return!1}return f},set(l,a,u,f){var S;var h=n.get(a),d=a in l;if(r&&a==="length")for(var p=u;p<h.v;p+=1){var g=n.get(p+"");g!==void 0?b(g,Fr):p in l&&(g=o(()=>Ks(Fr)),n.set(p+"",g))}h===void 0?(!d||(S=$s(l,a))!=null&&S.writable)&&(h=o(()=>Ks(void 0)),b(h,o(()=>gl(u))),n.set(a,h)):(d=h.v!==Fr,b(h,o(()=>gl(u))));var m=Reflect.getOwnPropertyDescriptor(l,a);if(m!=null&&m.set&&m.set.call(f,u),!d){if(r&&typeof a=="string"){var v=n.get("length"),y=Number(a);Number.isInteger(y)&&y>=v.v&&b(v,y+1)}Tp(i)}return!0},ownKeys(l){c(i);var a=Reflect.ownKeys(l).filter(h=>{var d=n.get(h);return d===void 0||d.v!==Fr});for(var[u,f]of n)f.v!==Fr&&!(u in l)&&a.push(u);return a},setPrototypeOf(){a3()}})}function Tp(t,e=1){b(t,t.v+e)}function f1(t){try{if(t!==null&&typeof t=="object"&&Ps in t)return t[Ps]}catch{}return t}function S3(t,e){return Object.is(f1(t),f1(e))}function za(t){var e=Pi|Ns,n=wn!==null&&(wn.f&Pi)!==0?wn:null;return pn===null||n!==null&&(n.f&yi)!==0?e|=yi:pn.f|=l2,{ctx:Wt,deps:null,effects:null,equals:c2,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:n??pn}}function $r(t){const e=za(t);return T2(e),e}function he(t){const e=za(t);return e.equals=yv,e}function p2(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)ao(e[n])}}function C3(t){for(var e=t.parent;e!==null;){if((e.f&Pi)===0)return e;e=e.parent}return null}function g2(t){var e,n=pn;Ho(C3(t));try{p2(t),e=D2(t)}finally{Ho(n)}return e}function m2(t){var e=g2(t),n=(Ro||(t.f&yi)!==0)&&t.deps!==null?$o:Kr;Di(t,n),t.equals(e)||(t.v=e,t.wv=R2())}const ru=new Map;function Rl(t,e){var n={f:0,v:t,reactions:null,equals:c2,rv:0,wv:0};return n}function Ks(t,e){const n=Rl(t);return T2(n),n}function R(t,e=!1){var r;const n=Rl(t);return e||(n.equals=yv),ic&&Wt!==null&&Wt.l!==null&&((r=Wt.l).s??(r.s=[])).push(n),n}function gi(t,e){return b(t,ri(()=>c(t))),e}function b(t,e,n=!1){wn!==null&&!As&&sc()&&(wn.f&(Pi|vv))!==0&&!(Ur!=null&&Ur.includes(t))&&c3();let r=n?gl(e):e;return iu(t,r)}function iu(t,e){if(!t.equals(e)){var n=t.v;Bu?ru.set(t,e):ru.set(t,n),t.v=e,(t.f&Pi)!==0&&((t.f&Ns)!==0&&g2(t),Di(t,(t.f&yi)===0?Kr:$o)),t.wv=R2(),v2(t,Ns),sc()&&pn!==null&&(pn.f&Kr)!==0&&(pn.f&(bo|rc))===0&&(Ci===null?P3([t]):Ci.push(t))}return e}function h1(t,e=1){var n=c(t),r=e===1?n++:n--;return b(t,n),r}function v2(t,e){var n=t.reactions;if(n!==null)for(var r=sc(),i=n.length,s=0;s<i;s++){var o=n[s],l=o.f;(l&Ns)===0&&(!r&&o===pn||(Di(o,e),(l&(Kr|yi))!==0&&((l&Pi)!==0?v2(o,$o):Md(o))))}}let k3=!1;var to,y2,b2,x2;function A3(){if(to===void 0){to=window,y2=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;b2=$s(e,"firstChild").get,x2=$s(e,"nextSibling").get,c1(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),c1(n)&&(n.__t=void 0)}}function Ad(t=""){return document.createTextNode(t)}function mi(t){return b2.call(t)}function Od(t){return x2.call(t)}function M(t,e){return mi(t)}function $e(t,e){{var n=mi(t);return n instanceof Comment&&n.data===""?Od(n):n}}function N(t,e=1,n=!1){let r=t;for(;e--;)r=Od(r);return r}function O3(t){t.textContent=""}function w2(t){pn===null&&wn===null&&r3(),wn!==null&&(wn.f&yi)!==0&&pn===null&&n3(),Bu&&t3()}function _3(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function oc(t,e,n,r=!0){var i=pn,s={ctx:Wt,deps:null,nodes_start:null,nodes_end:null,f:t|Ns,first:null,fn:e,last:null,next:null,parent:i,prev:null,teardown:null,transitions:null,wv:0};if(n)try{Td(s),s.f|=YO}catch(a){throw ao(s),a}else e!==null&&Md(s);var o=n&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null&&(s.f&(l2|Sh))===0;if(!o&&r&&(i!==null&&_3(s,i),wn!==null&&(wn.f&Pi)!==0)){var l=wn;(l.effects??(l.effects=[])).push(s)}return s}function wv(t){const e=oc(Sd,null,!1);return Di(e,Kr),e.teardown=t,e}function Ig(t){w2();var e=pn!==null&&(pn.f&bo)!==0&&Wt!==null&&!Wt.m;if(e){var n=Wt;(n.e??(n.e=[])).push({fn:t,effect:pn,reaction:wn})}else{var r=cr(t);return r}}function E3(t){return w2(),lc(t)}function T3(t){const e=oc(rc,t,!0);return(n={})=>new Promise(r=>{n.outro?Va(e,()=>{ao(e),r(void 0)}):(ao(e),r(void 0))})}function cr(t){return oc(s2,t,!1)}function K(t,e){var n=Wt,r={effect:null,ran:!1};n.l.r1.push(r),r.effect=lc(()=>{t(),!r.ran&&(r.ran=!0,b(n.l.r2,!0),ri(e))})}function Vt(){var t=Wt;lc(()=>{if(c(t.l.r2)){for(var e of t.l.r1){var n=e.effect;(n.f&Kr)!==0&&Di(n,$o),cc(n)&&Td(n),e.ran=!1}t.l.r2.v=!1}})}function lc(t){return oc(Sd,t,!0)}function xe(t,e=[],n=za){const r=e.map(n);return ac(()=>t(...r.map(c)))}function ac(t,e=0){return oc(Sd|vv|e,t,!0)}function Vo(t,e=!0){return oc(Sd|bo,t,!0,e)}function S2(t){var e=t.teardown;if(e!==null){const n=Bu,r=wn;p1(!0),js(null);try{e.call(null)}finally{p1(n),js(r)}}}function C2(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){var r=n.next;(n.f&rc)!==0?n.parent=null:ao(n,e),n=r}}function M3(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&bo)===0&&ao(e),e=n}}function ao(t,e=!0){var n=!1;(e||(t.f&ZO)!==0)&&t.nodes_start!==null&&(k2(t.nodes_start,t.nodes_end),n=!0),C2(t,e&&!n),Eh(t,0),Di(t,Cd);var r=t.transitions;if(r!==null)for(const s of r)s.stop();S2(t);var i=t.parent;i!==null&&i.first!==null&&A2(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function k2(t,e){for(;t!==null;){var n=t===e?null:Od(t);t.remove(),t=n}}function A2(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Va(t,e){var n=[];Sv(t,n,!0),O2(n,()=>{ao(t),e&&e()})}function O2(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var i of t)i.out(r)}else e()}function Sv(t,e,n){if((t.f&eo)===0){if(t.f^=eo,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var i=r.next,s=(r.f&Nu)!==0||(r.f&bo)!==0;Sv(r,e,s?n:!1),r=i}}}function kh(t){_2(t,!0)}function _2(t,e){if((t.f&eo)!==0){t.f^=eo,(t.f&Kr)===0&&(t.f^=Kr),cc(t)&&(Di(t,Ns),Md(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Nu)!==0||(n.f&bo)!==0;_2(n,i?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}let su=[],Lg=[];function E2(){var t=su;su=[],wh(t)}function R3(){var t=Lg;Lg=[],wh(t)}function _d(t){su.length===0&&queueMicrotask(E2),su.push(t)}function d1(){su.length>0&&E2(),Lg.length>0&&R3()}let $f=!1,Ah=!1,Oh=null,kl=!1,Bu=!1;function p1(t){Bu=t}let Jc=[];let wn=null,As=!1;function js(t){wn=t}let pn=null;function Ho(t){pn=t}let Ur=null;function T2(t){wn!==null&&wn.f&Dg&&(Ur===null?Ur=[t]:Ur.push(t))}let zr=null,hi=0,Ci=null;function P3(t){Ci=t}let M2=1,_h=0,Ro=!1,To=null;function R2(){return++M2}function cc(t){var h;var e=t.f;if((e&Ns)!==0)return!0;if((e&$o)!==0){var n=t.deps,r=(e&yi)!==0;if(n!==null){var i,s,o=(e&Ch)!==0,l=r&&pn!==null&&!Ro,a=n.length;if(o||l){var u=t,f=u.parent;for(i=0;i<a;i++)s=n[i],(o||!((h=s==null?void 0:s.reactions)!=null&&h.includes(u)))&&(s.reactions??(s.reactions=[])).push(u);o&&(u.f^=Ch),l&&f!==null&&(f.f&yi)===0&&(u.f^=yi)}for(i=0;i<a;i++)if(s=n[i],cc(s)&&m2(s),s.wv>t.wv)return!0}(!r||pn!==null&&!Ro)&&Di(t,Kr)}return!1}function D3(t,e){for(var n=e;n!==null;){if((n.f&Sh)!==0)try{n.fn(t);return}catch{n.f^=Sh}n=n.parent}throw $f=!1,t}function g1(t){return(t.f&Cd)===0&&(t.parent===null||(t.parent.f&Sh)===0)}function Ed(t,e,n,r){if($f){if(n===null&&($f=!1),g1(e))throw t;return}if(n!==null&&($f=!0),D3(t,e),g1(e))throw t}function P2(t,e,n=!0){var r=t.reactions;if(r!==null)for(var i=0;i<r.length;i++){var s=r[i];Ur!=null&&Ur.includes(t)||((s.f&Pi)!==0?P2(s,e,!1):e===s&&(n?Di(s,Ns):(s.f&Kr)!==0&&Di(s,$o),Md(s)))}}function D2(t){var p;var e=zr,n=hi,r=Ci,i=wn,s=Ro,o=Ur,l=Wt,a=As,u=t.f;zr=null,hi=0,Ci=null,Ro=(u&yi)!==0&&(As||!kl||wn===null),wn=(u&(bo|rc))===0?t:null,Ur=null,u1(t.ctx),As=!1,_h++,t.f|=Dg;try{var f=(0,t.fn)(),h=t.deps;if(zr!==null){var d;if(Eh(t,hi),h!==null&&hi>0)for(h.length=hi+zr.length,d=0;d<zr.length;d++)h[hi+d]=zr[d];else t.deps=h=zr;if(!Ro)for(d=hi;d<h.length;d++)((p=h[d]).reactions??(p.reactions=[])).push(t)}else h!==null&&hi<h.length&&(Eh(t,hi),h.length=hi);if(sc()&&Ci!==null&&!As&&h!==null&&(t.f&(Pi|$o|Ns))===0)for(d=0;d<Ci.length;d++)P2(Ci[d],t);return i!==null&&i!==t&&(_h++,Ci!==null&&(r===null?r=Ci:r.push(...Ci))),f}finally{zr=e,hi=n,Ci=r,wn=i,Ro=s,Ur=o,u1(l),As=a,t.f^=Dg}}function I3(t,e){let n=e.reactions;if(n!==null){var r=JO.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}n===null&&(e.f&Pi)!==0&&(zr===null||!zr.includes(e))&&(Di(e,$o),(e.f&(yi|Ch))===0&&(e.f^=Ch),p2(e),Eh(e,0))}function Eh(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)I3(t,n[r])}function Td(t){var e=t.f;if((e&Cd)===0){Di(t,Kr);var n=pn,r=Wt,i=kl;pn=t,kl=!0;try{(e&vv)!==0?M3(t):C2(t),S2(t);var s=D2(t);t.teardown=typeof s=="function"?s:null,t.wv=M2;var o=t.deps,l;a1&&u3&&t.f&Ns}catch(a){Ed(a,t,n,r||t.ctx)}finally{kl=i,pn=n}}}function L3(){try{i3()}catch(t){if(Oh!==null)Ed(t,Oh,null);else throw t}}function I2(){var t=kl;try{var e=0;for(kl=!0;Jc.length>0;){e++>1e3&&L3();var n=Jc,r=n.length;Jc=[];for(var i=0;i<r;i++){var s=j3(n[i]);N3(s)}ru.clear()}}finally{Ah=!1,kl=t,Oh=null}}function N3(t){var e=t.length;if(e!==0)for(var n=0;n<e;n++){var r=t[n];if((r.f&(Cd|eo))===0)try{cc(r)&&(Td(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null?A2(r):r.fn=null))}catch(i){Ed(i,r,null,r.ctx)}}}function Md(t){Ah||(Ah=!0,queueMicrotask(I2));for(var e=Oh=t;e.parent!==null;){e=e.parent;var n=e.f;if((n&(rc|bo))!==0){if((n&Kr)===0)return;e.f^=Kr}}Jc.push(e)}function j3(t){for(var e=[],n=t;n!==null;){var r=n.f,i=(r&(bo|rc))!==0,s=i&&(r&Kr)!==0;if(!s&&(r&eo)===0){if((r&s2)!==0)e.push(n);else if(i)n.f^=Kr;else try{cc(n)&&Td(n)}catch(a){Ed(a,n,null,n.ctx)}var o=n.first;if(o!==null){n=o;continue}}var l=n.parent;for(n=n.next;n===null&&l!==null;)n=l.next,l=l.parent}return e}function _n(t){var e;for(d1();Jc.length>0;)Ah=!0,I2(),d1();return e}async function B3(){await Promise.resolve(),_n()}function c(t){var e=t.f,n=(e&Pi)!==0;if(To!==null&&To.add(t),wn!==null&&!As){if(!(Ur!=null&&Ur.includes(t))){var r=wn.deps;t.rv<_h&&(t.rv=_h,zr===null&&r!==null&&r[hi]===t?hi++:zr===null?zr=[t]:(!Ro||!zr.includes(t))&&zr.push(t))}}else if(n&&t.deps===null&&t.effects===null){var i=t,s=i.parent;s!==null&&(s.f&yi)===0&&(i.f^=yi)}return n&&(i=t,cc(i)&&m2(i)),Bu&&ru.has(t)?ru.get(t):t.v}function F3(t){var e=To;To=new Set;var n=To,r;try{if(ri(t),e!==null)for(r of To)e.add(r)}finally{To=e}return n}function m1(t){var e=F3(()=>ri(t));for(var n of e)if((n.f&o2)!==0)for(const r of n.deps||[])(r.f&Pi)===0&&iu(r,r.v);else iu(n,n.v)}function ri(t){var e=As;try{return As=!0,t()}finally{As=e}}const z3=-7169;function Di(t,e){t.f=t.f&z3|e}function P(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Ps in t)Ng(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&Ps in n&&Ng(n)}}}function Ng(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Ng(t[r],e)}catch{}const n=mv(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=i2(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function V3(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const H3=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function q3(t){return H3.includes(t)}const U3={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function W3(t){return t=t.toLowerCase(),U3[t]??t}const J3=["touchstart","touchmove"];function K3(t){return J3.includes(t)}function G3(t,e){if(e){const n=document.body;t.autofocus=!0,_d(()=>{document.activeElement===n&&t.focus()})}}let v1=!1;function X3(){v1||(v1=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n.__on_r)==null||e.call(n)})},{capture:!0}))}function L2(t){var e=wn,n=pn;js(null),Ho(null);try{return t()}finally{js(e),Ho(n)}}function Q3(t,e,n,r=n){t.addEventListener(e,()=>L2(n));const i=t.__on_r;i?t.__on_r=()=>{i(),r(!0)}:t.__on_r=()=>r(!0),X3()}const N2=new Set,jg=new Set;function j2(t,e,n,r={}){function i(s){if(r.capture||Bc.call(e,s),!s.cancelBubble)return L2(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?_d(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function ae(t,e,n,r,i){var s={capture:r,passive:i},o=j2(t,e,n,s);(e===document.body||e===window||e===document)&&wv(()=>{e.removeEventListener(t,o,s)})}function Fu(t){for(var e=0;e<t.length;e++)N2.add(t[e]);for(var n of jg)n(t)}function Bc(t){var S;var e=this,n=e.ownerDocument,r=t.type,i=((S=t.composedPath)==null?void 0:S.call(t))||[],s=i[0]||t.target,o=0,l=t.__root;if(l){var a=i.indexOf(l);if(a!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;a<=u&&(o=a)}if(s=i[o]||t.target,s!==e){KO(t,"currentTarget",{configurable:!0,get(){return s||n}});var f=wn,h=pn;js(null),Ho(null);try{for(var d,p=[];s!==null;){var g=s.assignedSlot||s.parentNode||s.host||null;try{var m=s["__"+r];if(m!=null&&(!s.disabled||t.target===s))if(Lu(m)){var[v,...y]=m;v.apply(s,[t,...y])}else m.call(s,t)}catch(k){d?p.push(k):d=k}if(t.cancelBubble||g===e||g===null)break;s=g}if(d){for(let k of p)queueMicrotask(()=>{throw k});throw d}}finally{t.__root=e,delete t.currentTarget,js(f),Ho(h)}}}function Cv(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function Pl(t,e){var n=pn;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function J(t,e){var n=(e&h2)!==0,r=(e&y3)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=Cv(s?t:"<!>"+t),n||(i=mi(i)));var o=r||y2?document.importNode(i,!0):i.cloneNode(!0);if(n){var l=mi(o),a=o.lastChild;Pl(l,a)}else Pl(o,o);return o}}function tl(t,e,n="svg"){var r=!t.startsWith("<!>"),i=(e&h2)!==0,s=`<${n}>${r?t:"<!>"+t}</${n}>`,o;return()=>{if(!o){var l=Cv(s),a=mi(l);if(i)for(o=document.createDocumentFragment();mi(a);)o.appendChild(mi(a));else o=mi(a)}var u=o.cloneNode(!0);if(i){var f=mi(u),h=u.lastChild;Pl(f,h)}else Pl(u,u);return u}}function ur(t=""){{var e=Ad(t+"");return Pl(e,e),e}}function bn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Ad();return t.append(e,n),Pl(e,n),t}function D(t,e){t!==null&&t.before(e)}function et(t,e){var n=e==null?"":typeof e=="object"?e+"":e;n!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=n,t.nodeValue=n+"")}function Y3(t,e){return Z3(t,e)}const la=new Map;function Z3(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0}){A3();var l=new Set,a=h=>{for(var d=0;d<h.length;d++){var p=h[d];if(!l.has(p)){l.add(p);var g=K3(p);e.addEventListener(p,Bc,{passive:g});var m=la.get(p);m===void 0?(document.addEventListener(p,Bc,{passive:g}),la.set(p,1)):la.set(p,m+1)}}};a(gv(N2)),jg.add(a);var u=void 0,f=T3(()=>{var h=n??e.appendChild(Ad());return Vo(()=>{if(s){Ge({});var d=Wt;d.c=s}i&&(r.$$events=i),u=t(h,r)||{},s&&Xe()}),()=>{var g;for(var d of l){e.removeEventListener(d,Bc);var p=la.get(d);--p===0?(document.removeEventListener(d,Bc),la.delete(d)):la.set(d,p)}jg.delete(a),h!==n&&((g=h.parentNode)==null||g.removeChild(h))}});return $3.set(u,f),u}let $3=new WeakMap;function te(t,e,[n,r]=[0,0]){var i=t,s=null,o=null,l=Fr,a=n>0?Nu:0,u=!1;const f=(d,p=!0)=>{u=!0,h(p,d)},h=(d,p)=>{l!==(l=d)&&(l?(s?kh(s):p&&(s=Vo(()=>p(i))),o&&Va(o,()=>{o=null})):(o?kh(o):p&&(o=Vo(()=>p(i,[n+1,r]))),s&&Va(s,()=>{s=null})))};ac(()=>{u=!1,e(f),u||h(null,null)},a)}function B2(t,e,n){var r=t,i=Fr,s,o=sc()?e3:kd;ac(()=>{o(i,i=e())&&(s&&Va(s),s=Vo(()=>n(r)))})}function Ln(t,e){return e}function e_(t,e,n,r){for(var i=[],s=e.length,o=0;o<s;o++)Sv(e[o].e,i,!0);var l=s>0&&i.length===0&&n!==null;if(l){var a=n.parentNode;O3(a),a.append(n),r.clear(),ko(t,e[0].prev,e[s-1].next)}O2(i,()=>{for(var u=0;u<s;u++){var f=e[u];l||(r.delete(f.k),ko(t,f.prev,f.next)),ao(f.e,!l)}})}function Sn(t,e,n,r,i,s=null){var o=t,l={flags:e,items:new Map,first:null},a=(e&u2)!==0;if(a){var u=t;o=u.appendChild(Ad())}var f=null,h=!1,d=he(()=>{var p=n();return Lu(p)?p:p==null?[]:gv(p)});ac(()=>{var p=c(d),g=p.length;h&&g===0||(h=g===0,t_(p,l,o,i,e,r,n),s!==null&&(g===0?f?kh(f):f=Vo(()=>s(o)):f!==null&&Va(f,()=>{f=null})),c(d))})}function t_(t,e,n,r,i,s,o){var Q,Y,ie,F;var l=(i&h3)!==0,a=(i&(bv|xv))!==0,u=t.length,f=e.items,h=e.first,d=h,p,g=null,m,v=[],y=[],S,k,C,w;if(l)for(w=0;w<u;w+=1)S=t[w],k=s(S,w),C=f.get(k),C!==void 0&&((Q=C.a)==null||Q.measure(),(m??(m=new Set)).add(C));for(w=0;w<u;w+=1){if(S=t[w],k=s(S,w),C=f.get(k),C===void 0){var E=d?d.e.nodes_start:n;g=r_(E,e,g,g===null?e.first:g.next,S,k,w,r,i,o),f.set(k,g),v=[],y=[],d=g.next;continue}if(a&&n_(C,S,w,i),(C.e.f&eo)!==0&&(kh(C.e),l&&((Y=C.a)==null||Y.unfix(),(m??(m=new Set)).delete(C))),C!==d){if(p!==void 0&&p.has(C)){if(v.length<y.length){var A=y[0],O;g=A.prev;var H=v[0],W=v[v.length-1];for(O=0;O<v.length;O+=1)y1(v[O],A,n);for(O=0;O<y.length;O+=1)p.delete(y[O]);ko(e,H.prev,W.next),ko(e,g,H),ko(e,W,A),d=A,g=W,w-=1,v=[],y=[]}else p.delete(C),y1(C,d,n),ko(e,C.prev,C.next),ko(e,C,g===null?e.first:g.next),ko(e,g,C),g=C;continue}for(v=[],y=[];d!==null&&d.k!==k;)(d.e.f&eo)===0&&(p??(p=new Set)).add(d),y.push(d),d=d.next;if(d===null)continue;C=d}v.push(C),g=C,d=C.next}if(d!==null||p!==void 0){for(var G=p===void 0?[]:gv(p);d!==null;)(d.e.f&eo)===0&&G.push(d),d=d.next;var V=G.length;if(V>0){var U=(i&u2)!==0&&u===0?n:null;if(l){for(w=0;w<V;w+=1)(ie=G[w].a)==null||ie.measure();for(w=0;w<V;w+=1)(F=G[w].a)==null||F.fix()}e_(e,G,U,f)}}l&&_d(()=>{var X;if(m!==void 0)for(C of m)(X=C.a)==null||X.apply()}),pn.first=e.first&&e.first.e,pn.last=g&&g.e}function n_(t,e,n,r){(r&bv)!==0&&iu(t.v,e),(r&xv)!==0?iu(t.i,n):t.i=n}function r_(t,e,n,r,i,s,o,l,a,u){var f=(a&bv)!==0,h=(a&d3)===0,d=f?h?R(i):Rl(i):i,p=(a&xv)===0?o:Rl(o),g={i:p,v:d,k:s,a:null,e:null,prev:n,next:r};try{return g.e=Vo(()=>l(t,d,p,u),k3),g.e.prev=n&&n.e,g.e.next=r&&r.e,n===null?e.first=g:(n.next=g,n.e.next=g.e),r!==null&&(r.prev=g,r.e.prev=g.e),g}finally{}}function y1(t,e,n){for(var r=t.next?t.next.e.nodes_start:n,i=e?e.e.nodes_start:n,s=t.e.nodes_start;s!==r;){var o=Od(s);i.before(s),s=o}}function ko(t,e,n){e===null?t.first=n:(e.next=n,e.e.next=n&&n.e),n!==null&&(n.prev=e,n.e.prev=e&&e.e)}function F2(t,e,n=!1,r=!1,i=!1){var s=t,o="";xe(()=>{var l=pn;if(o!==(o=e()??"")&&(l.nodes_start!==null&&(k2(l.nodes_start,l.nodes_end),l.nodes_start=l.nodes_end=null),o!=="")){var a=o+"";n?a=`<svg>${a}</svg>`:r&&(a=`<math>${a}</math>`);var u=Cv(a);if((n||r)&&(u=mi(u)),Pl(mi(u),u.lastChild),n||r)for(;mi(u);)s.before(mi(u));else s.before(u)}})}function Pn(t,e,n,r,i){var l;var s=(l=e.$$slots)==null?void 0:l[n],o=!1;s===!0&&(s=e[n==="default"?"children":n],o=!0),s===void 0?i!==null&&i(t):s(t,o?()=>r:r)}function i_(t){const e={};t.children&&(e.default=!0);for(const n in t.$$slots)e[n]=!0;return e}function s_(t,e,...n){var r=t,i=_a,s;ac(()=>{i!==(i=e())&&(s&&(ao(s),s=null),s=Vo(()=>i(r,...n)))},Nu)}function z2(t,e,n){var r=t,i,s;ac(()=>{i!==(i=e())&&(s&&(Va(s),s=null),i&&(s=Vo(()=>n(r,i))))},Nu)}function Tr(t,e,n){cr(()=>{var r=ri(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};lc(()=>{var o=n();P(o),i&&kd(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function V2(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=V2(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function o_(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=V2(t))&&(r&&(r+=" "),r+=e);return r}function nl(t){return typeof t=="object"?o_(t):t??""}const b1=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function l_(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var i in n)if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var l=o+s;(o===0||b1.includes(r[o-1]))&&(l===r.length||b1.includes(r[l]))?r=(o===0?"":r.substring(0,o))+r.substring(l+1):o=l}}return r===""?null:r}function x1(t,e=!1){var n=e?" !important;":";",r="";for(var i in t){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function Mp(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function a_(t,e){if(e){var n="",r,i;if(Array.isArray(e)?(r=e[0],i=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,l=!1,a=[];r&&a.push(...Object.keys(r).map(Mp)),i&&a.push(...Object.keys(i).map(Mp));var u=0,f=-1;const m=t.length;for(var h=0;h<m;h++){var d=t[h];if(l?d==="/"&&t[h-1]==="*"&&(l=!1):s?s===d&&(s=!1):d==="/"&&t[h+1]==="*"?l=!0:d==='"'||d==="'"?s=d:d==="("?o++:d===")"&&o--,!l&&s===!1&&o===0){if(d===":"&&f===-1)f=h;else if(d===";"||h===m-1){if(f!==-1){var p=Mp(t.substring(u,f).trim());if(!a.includes(p)){d!==";"&&h++;var g=t.substring(u,h).trim();n+=" "+g+";"}}u=h+1,f=-1}}}}return r&&(n+=x1(r)),i&&(n+=x1(i,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function ct(t,e,n,r,i,s){var o=t.__className;if(o!==n||o===void 0){var l=l_(n,r,s);l==null?t.removeAttribute("class"):e?t.className=l:t.setAttribute("class",l),t.__className=n}else if(s&&i!==s)for(var a in s){var u=!!s[a];(i==null||u!==!!i[a])&&t.classList.toggle(a,u)}return s}function Rp(t,e={},n,r){for(var i in n){var s=n[i];e[i]!==s&&(n[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,r))}}function Gi(t,e,n,r){var i=t.__style;if(i!==e){var s=a_(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t.__style=e}else r&&(Array.isArray(r)?(Rp(t,n==null?void 0:n[0],r[0]),Rp(t,n==null?void 0:n[1],r[1],"important")):Rp(t,n,r));return r}const ga=Symbol("class"),Ac=Symbol("style"),H2=Symbol("is custom element"),q2=Symbol("is html");function Dl(t,e){var n=kv(t);n.value===(n.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e??"")}function c_(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Jt(t,e,n,r){var i=kv(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[$O]=n),n==null?t.removeAttribute(e):typeof n!="string"&&U2(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Th(t,e,n,r,i=!1){var s=kv(t),o=s[H2],l=!s[q2],a=e||{},u=t.tagName==="OPTION";for(var f in e)f in n||(n[f]=null);n.class?n.class=nl(n.class):(r||n[ga])&&(n.class=null),n[Ac]&&(n.style??(n.style=null));var h=U2(t);for(const S in n){let k=n[S];if(u&&S==="value"&&k==null){t.value=t.__value="",a[S]=k;continue}if(S==="class"){var d=t.namespaceURI==="http://www.w3.org/1999/xhtml";ct(t,d,k,r,e==null?void 0:e[ga],n[ga]),a[S]=k,a[ga]=n[ga];continue}if(S==="style"){Gi(t,k,e==null?void 0:e[Ac],n[Ac]),a[S]=k,a[Ac]=n[Ac];continue}var p=a[S];if(k!==p){a[S]=k;var g=S[0]+S[1];if(g!=="$$")if(g==="on"){const C={},w="$$"+S;let E=S.slice(2);var m=q3(E);if(V3(E)&&(E=E.slice(0,-7),C.capture=!0),!m&&p){if(k!=null)continue;t.removeEventListener(E,a[w],C),a[w]=null}if(k!=null)if(m)t[`__${E}`]=k,Fu([E]);else{let A=function(O){a[S].call(this,O)};a[w]=j2(E,t,A,C)}else m&&(t[`__${E}`]=void 0)}else if(S==="style")Jt(t,S,k);else if(S==="autofocus")G3(t,!!k);else if(!o&&(S==="__value"||S==="value"&&k!=null))t.value=t.__value=k;else if(S==="selected"&&u)c_(t,k);else{var v=S;l||(v=W3(v));var y=v==="defaultValue"||v==="defaultChecked";if(k==null&&!o&&!y)if(s[S]=null,v==="value"||v==="checked"){let C=t;const w=e===void 0;if(v==="value"){let E=C.defaultValue;C.removeAttribute(v),C.defaultValue=E,C.value=C.__value=w?E:null}else{let E=C.defaultChecked;C.removeAttribute(v),C.defaultChecked=E,C.checked=w?E:!1}}else t.removeAttribute(S);else y||h.includes(v)&&(o||typeof k!="string")?t[v]=k:typeof k!="function"&&Jt(t,v,k)}}}return a}function kv(t){return t.__attributes??(t.__attributes={[H2]:t.nodeName.includes("-"),[q2]:t.namespaceURI===b3})}var w1=new Map;function U2(t){var e=w1.get(t.nodeName);if(e)return e;w1.set(t.nodeName,e=[]);for(var n,r=t,i=Element.prototype;i!==r;){n=i2(r);for(var s in n)n[s].set&&e.push(s);r=mv(r)}return e}function no(t,e,n=e){var r=sc();Q3(t,"input",i=>{var s=i?t.defaultValue:t.value;if(s=Pp(t)?Dp(s):s,n(s),r&&s!==(s=e())){var o=t.selectionStart,l=t.selectionEnd;t.value=s??"",l!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(l,t.value.length))}}),ri(e)==null&&t.value&&n(Pp(t)?Dp(t.value):t.value),lc(()=>{var i=e();Pp(t)&&i===Dp(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function Pp(t){var e=t.type;return e==="number"||e==="range"}function Dp(t){return t===""?null:+t}function at(t,e,n){var r=$s(t,e);r&&r.set&&(t[e]=n,wv(()=>{t[e]=null}))}function Mh(t,e,n){if(t.multiple)return u_(t,e);for(var r of t.options){var i=W2(r);if(S3(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function S1(t,e){let n=!0;cr(()=>{e&&Mh(t,ri(e),n),n=!1;var r=new MutationObserver(()=>{var i=t.__value;Mh(t,i)});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{r.disconnect()}})}function u_(t,e){for(var n of t.options)n.selected=~e.indexOf(W2(n))}function W2(t){return"__value"in t?t.__value:t.value}function C1(t,e){return t===e||(t==null?void 0:t[Ps])===e}function gn(t={},e,n,r){return cr(()=>{var i,s;return lc(()=>{i=s,s=[],ri(()=>{t!==n(...s)&&(e(t,...s),i&&C1(n(...i),t)&&e(null,...i))})}),()=>{_d(()=>{s&&C1(n(...s),t)&&e(null,...s)})}}),t}function f_(t){return function(...e){var n=e[0];n.target===this&&(t==null||t.apply(this,e))}}function Ui(t){return function(...e){var n=e[0];return n.stopPropagation(),t==null?void 0:t.apply(this,e)}}function Co(t){return function(...e){var n=e[0];return n.preventDefault(),t==null?void 0:t.apply(this,e)}}function st(t=!1){const e=Wt,n=e.l.u;if(!n)return;let r=()=>P(e.s);if(t){let i=0,s={};const o=za(()=>{let l=!1;const a=e.s;for(const u in a)a[u]!==s[u]&&(s[u]=a[u],l=!0);return l&&i++,i});r=()=>c(o)}n.b.length&&E3(()=>{k1(e,r),wh(n.b)}),Ig(()=>{const i=ri(()=>n.m.map(QO));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&Ig(()=>{k1(e,r),wh(n.a)})}function k1(t,e){if(t.l.s)for(const n of t.l.s)c(n);e()}function Rd(t){var e=Rl(0);return function(){return arguments.length===1?(b(e,c(e)+1),arguments[0]):(c(e),t())}}function ba(t,e){var s;var n=(s=t.$$events)==null?void 0:s[e.type],r=Lu(n)?n.slice():n==null?[]:[n];for(var i of r)i.call(this,e)}function h_(t,e,n){if(t==null)return e(void 0),_a;const r=ri(()=>t.subscribe(e,n));return r.unsubscribe?()=>r.unsubscribe():r}const aa=[];function d_(t,e=_a){let n=null;const r=new Set;function i(l){if(kd(t,l)&&(t=l,n)){const a=!aa.length;for(const u of r)u[1](),aa.push(u,t);if(a){for(let u=0;u<aa.length;u+=2)aa[u][0](aa[u+1]);aa.length=0}}}function s(l){i(l(t))}function o(l,a=_a){const u=[l,a];return r.add(u),r.size===1&&(n=e(i,s)||_a),l(t),()=>{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:o}}function Ip(t){let e;return h_(t,n=>e=n)(),e}let pf=!1;function p_(t){var e=pf;try{return pf=!1,[t(),pf]}finally{pf=e}}const g_={get(t,e){if(!t.exclude.includes(e))return c(t.version),e in t.special?t.special[e]():t.props[e]},set(t,e,n){return e in t.special||(t.special[e]=x({get[e](){return t.props[e]}},e,f2)),t.special[e](n),h1(t.version),!0},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},deleteProperty(t,e){return t.exclude.includes(e)||(t.exclude.push(e),h1(t.version)),!0},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function Rh(t,e){return new Proxy({props:t,exclude:e,special:{},version:Rl(0)},g_)}const m_={get(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(kc(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r)return r[e]}},set(t,e,n){let r=t.props.length;for(;r--;){let i=t.props[r];kc(i)&&(i=i());const s=$s(i,e);if(s&&s.set)return s.set(n),!0}return!1},getOwnPropertyDescriptor(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(kc(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r){const i=$s(r,e);return i&&!i.configurable&&(i.configurable=!0),i}}},has(t,e){if(e===Ps||e===a2)return!1;for(let n of t.props)if(kc(n)&&(n=n()),n!=null&&e in n)return!0;return!1},ownKeys(t){const e=[];for(let n of t.props){kc(n)&&(n=n());for(const r in n)e.includes(r)||e.push(r)}return e}};function jo(...t){return new Proxy({props:t},m_)}function A1(t){var e;return((e=t.ctx)==null?void 0:e.d)??!1}function x(t,e,n,r){var A;var i=(n&p3)!==0,s=!ic||(n&g3)!==0,o=(n&m3)!==0,l=(n&v3)!==0,a=!1,u;o?[u,a]=p_(()=>t[e]):u=t[e];var f=Ps in t||a2 in t,h=o&&(((A=$s(t,e))==null?void 0:A.set)??(f&&e in t&&(O=>t[e]=O)))||void 0,d=r,p=!0,g=!1,m=()=>(g=!0,p&&(p=!1,l?d=ri(r):d=r),d);u===void 0&&r!==void 0&&(h&&s&&o3(),u=m(),h&&h(u));var v;if(s)v=()=>{var O=t[e];return O===void 0?m():(p=!0,g=!1,O)};else{var y=(i?za:he)(()=>t[e]);y.f|=o2,v=()=>{var O=c(y);return O!==void 0&&(d=void 0),O===void 0?d:O}}if((n&f2)===0)return v;if(h){var S=t.$$legacy;return function(O,H){return arguments.length>0?((!s||!H||S||a)&&h(H?v():O),O):v()}}var k=!1,C=!1,w=R(u),E=za(()=>{var O=v(),H=c(w);return k?(k=!1,C=!0,H):(C=!1,w.v=O)});return o&&c(E),i||(E.equals=yv),function(O,H){if(To!==null&&(k=C,v(),c(w)),arguments.length>0){const W=H?c(E):s&&o?gl(O):O;if(!E.equals(W)){if(k=!0,b(w,W),g&&d!==void 0&&(d=W),A1(E))return O;ri(()=>c(E))}return O}return A1(E)?E.v:c(E)}}function Cr(t){Wt===null&&ju(),ic&&Wt.l!==null?J2(Wt).m.push(t):Ig(()=>{const e=ri(t);if(typeof e=="function")return e})}function Ii(t){Wt===null&&ju(),Cr(()=>()=>ri(t))}function v_(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function y_(){const t=Wt;return t===null&&ju(),(e,n,r)=>{var s;const i=(s=t.s.$$events)==null?void 0:s[e];if(i){const o=Lu(i)?i.slice():[i],l=v_(e,n,r);for(const a of o)a.call(t.x,l);return!l.defaultPrevented}return!0}}function b_(t){Wt===null&&ju(),Wt.l===null&&s3(),J2(Wt).b.push(t)}function J2(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const x_="5";var r2;typeof window<"u"&&((r2=window.__svelte??(window.__svelte={})).v??(r2.v=new Set)).add(x_);f3();function K2(t,e){return function(){return t.apply(e,arguments)}}const{toString:w_}=Object.prototype,{getPrototypeOf:Av}=Object,{iterator:Pd,toStringTag:G2}=Symbol,Dd=(t=>e=>{const n=w_.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ls=t=>(t=t.toLowerCase(),e=>Dd(e)===t),Id=t=>e=>typeof e===t,{isArray:uc}=Array,ou=Id("undefined");function S_(t){return t!==null&&!ou(t)&&t.constructor!==null&&!ou(t.constructor)&&ti(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const X2=ls("ArrayBuffer");function C_(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&X2(t.buffer),e}const k_=Id("string"),ti=Id("function"),Q2=Id("number"),Ld=t=>t!==null&&typeof t=="object",A_=t=>t===!0||t===!1,eh=t=>{if(Dd(t)!=="object")return!1;const e=Av(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(G2 in t)&&!(Pd in t)},O_=ls("Date"),__=ls("File"),E_=ls("Blob"),T_=ls("FileList"),M_=t=>Ld(t)&&ti(t.pipe),R_=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ti(t.append)&&((e=Dd(t))==="formdata"||e==="object"&&ti(t.toString)&&t.toString()==="[object FormData]"))},P_=ls("URLSearchParams"),[D_,I_,L_,N_]=["ReadableStream","Request","Response","Headers"].map(ls),j_=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),uc(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),o=s.length;let l;for(r=0;r<o;r++)l=s[r],e.call(null,t[l],l,t)}}function Y2(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const wl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Z2=t=>!ou(t)&&t!==wl;function Bg(){const{caseless:t}=Z2(this)&&this||{},e={},n=(r,i)=>{const s=t&&Y2(e,i)||i;eh(e[s])&&eh(r)?e[s]=Bg(e[s],r):eh(r)?e[s]=Bg({},r):uc(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&zu(arguments[r],n);return e}const B_=(t,e,n,{allOwnKeys:r}={})=>(zu(e,(i,s)=>{n&&ti(i)?t[s]=K2(i,n):t[s]=i},{allOwnKeys:r}),t),F_=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),z_=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},V_=(t,e,n,r)=>{let i,s,o;const l={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!r||r(o,t,e))&&!l[o]&&(e[o]=t[o],l[o]=!0);t=n!==!1&&Av(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},H_=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},q_=t=>{if(!t)return null;if(uc(t))return t;let e=t.length;if(!Q2(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},U_=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Av(Uint8Array)),W_=(t,e)=>{const r=(t&&t[Pd]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},J_=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},K_=ls("HTMLFormElement"),G_=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),O1=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),X_=ls("RegExp"),$2=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};zu(n,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(r[s]=o||i)}),Object.defineProperties(t,r)},Q_=t=>{$2(t,(e,n)=>{if(ti(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ti(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Y_=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return uc(t)?r(t):r(String(t).split(e)),n},Z_=()=>{},$_=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function e4(t){return!!(t&&ti(t.append)&&t[G2]==="FormData"&&t[Pd])}const t4=t=>{const e=new Array(10),n=(r,i)=>{if(Ld(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=uc(r)?[]:{};return zu(r,(o,l)=>{const a=n(o,i+1);!ou(a)&&(s[l]=a)}),e[i]=void 0,s}}return r};return n(t,0)},n4=ls("AsyncFunction"),r4=t=>t&&(Ld(t)||ti(t))&&ti(t.then)&&ti(t.catch),ew=((t,e)=>t?setImmediate:e?((n,r)=>(wl.addEventListener("message",({source:i,data:s})=>{i===wl&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),wl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ti(wl.postMessage)),i4=typeof queueMicrotask<"u"?queueMicrotask.bind(wl):typeof process<"u"&&process.nextTick||ew,s4=t=>t!=null&&ti(t[Pd]),re={isArray:uc,isArrayBuffer:X2,isBuffer:S_,isFormData:R_,isArrayBufferView:C_,isString:k_,isNumber:Q2,isBoolean:A_,isObject:Ld,isPlainObject:eh,isReadableStream:D_,isRequest:I_,isResponse:L_,isHeaders:N_,isUndefined:ou,isDate:O_,isFile:__,isBlob:E_,isRegExp:X_,isFunction:ti,isStream:M_,isURLSearchParams:P_,isTypedArray:U_,isFileList:T_,forEach:zu,merge:Bg,extend:B_,trim:j_,stripBOM:F_,inherits:z_,toFlatObject:V_,kindOf:Dd,kindOfTest:ls,endsWith:H_,toArray:q_,forEachEntry:W_,matchAll:J_,isHTMLForm:K_,hasOwnProperty:O1,hasOwnProp:O1,reduceDescriptors:$2,freezeMethods:Q_,toObjectSet:Y_,toCamelCase:G_,noop:Z_,toFiniteNumber:$_,findKey:Y2,global:wl,isContextDefined:Z2,isSpecCompliantForm:e4,toJSONObject:t4,isAsyncFn:n4,isThenable:r4,setImmediate:ew,asap:i4,isIterable:s4};function At(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits(At,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const tw=At.prototype,nw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{nw[t]={value:t}});Object.defineProperties(At,nw);Object.defineProperty(tw,"isAxiosError",{value:!0});At.from=(t,e,n,r,i,s)=>{const o=Object.create(tw);return re.toFlatObject(t,o,function(a){return a!==Error.prototype},l=>l!=="isAxiosError"),At.call(o,t.message,e,n,r,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const o4=null;function Fg(t){return re.isPlainObject(t)||re.isArray(t)}function rw(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function _1(t,e,n){return t?t.concat(e).map(function(i,s){return i=rw(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function l4(t){return re.isArray(t)&&!t.some(Fg)}const a4=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function Nd(t,e,n){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!re.isUndefined(v[m])});const r=n.metaTokens,i=n.visitor||f,s=n.dots,o=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(re.isDate(g))return g.toISOString();if(!a&&re.isBlob(g))throw new At("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(g)||re.isTypedArray(g)?a&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function f(g,m,v){let y=g;if(g&&!v&&typeof g=="object"){if(re.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(re.isArray(g)&&l4(g)||(re.isFileList(g)||re.endsWith(m,"[]"))&&(y=re.toArray(g)))return m=rw(m),y.forEach(function(k,C){!(re.isUndefined(k)||k===null)&&e.append(o===!0?_1([m],C,s):o===null?m:m+"[]",u(k))}),!1}return Fg(g)?!0:(e.append(_1(v,m,s),u(g)),!1)}const h=[],d=Object.assign(a4,{defaultVisitor:f,convertValue:u,isVisitable:Fg});function p(g,m){if(!re.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(g),re.forEach(g,function(y,S){(!(re.isUndefined(y)||y===null)&&i.call(e,y,re.isString(S)?S.trim():S,m,d))===!0&&p(y,m?m.concat(S):[S])}),h.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return p(t),e}function E1(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Ov(t,e){this._pairs=[],t&&Nd(t,this,e)}const iw=Ov.prototype;iw.append=function(e,n){this._pairs.push([e,n])};iw.toString=function(e){const n=e?function(r){return e.call(this,r,E1)}:E1;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function c4(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function sw(t,e,n){if(!e)return t;const r=n&&n.encode||c4;re.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(e,n):s=re.isURLSearchParams(e)?e.toString():new Ov(e,n).toString(r),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class T1{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const ow={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},u4=typeof URLSearchParams<"u"?URLSearchParams:Ov,f4=typeof FormData<"u"?FormData:null,h4=typeof Blob<"u"?Blob:null,d4={isBrowser:!0,classes:{URLSearchParams:u4,FormData:f4,Blob:h4},protocols:["http","https","file","blob","url","data"]},_v=typeof window<"u"&&typeof document<"u",zg=typeof navigator=="object"&&navigator||void 0,p4=_v&&(!zg||["ReactNative","NativeScript","NS"].indexOf(zg.product)<0),g4=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",m4=_v&&window.location.href||"http://localhost",v4=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_v,hasStandardBrowserEnv:p4,hasStandardBrowserWebWorkerEnv:g4,navigator:zg,origin:m4},Symbol.toStringTag,{value:"Module"})),_r={...v4,...d4};function y4(t,e){return Nd(t,new _r.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return _r.isNode&&re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function b4(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function x4(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],e[s]=t[s];return e}function lw(t){function e(n,r,i,s){let o=n[s++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),a=s>=n.length;return o=!o&&re.isArray(i)?i.length:o,a?(re.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!l):((!i[o]||!re.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],s)&&re.isArray(i[o])&&(i[o]=x4(i[o])),!l)}if(re.isFormData(t)&&re.isFunction(t.entries)){const n={};return re.forEachEntry(t,(r,i)=>{e(b4(r),i,n,0)}),n}return null}function w4(t,e,n){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Vu={transitional:ow,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(lw(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return y4(e,this.formSerializer).toString();if((l=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Nd(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),w4(e)):e}],transformResponse:[function(e){const n=this.transitional||Vu.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?At.from(l,At.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_r.classes.FormData,Blob:_r.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{Vu.headers[t]={}});const S4=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),C4=t=>{const e={};let n,r,i;return t&&t.split(`
|
|
3
|
-
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&S4[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},M1=Symbol("internals");function Oc(t){return t&&String(t).trim().toLowerCase()}function th(t){return t===!1||t==null?t:re.isArray(t)?t.map(th):String(t)}function k4(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const A4=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Lp(t,e,n,r,i){if(re.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!re.isString(e)){if(re.isString(r))return e.indexOf(r)!==-1;if(re.isRegExp(r))return r.test(e)}}function O4(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function _4(t,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}let ni=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(l,a,u){const f=Oc(a);if(!f)throw new Error("header name must be a non-empty string");const h=re.findKey(i,f);(!h||i[h]===void 0||u===!0||u===void 0&&i[h]!==!1)&&(i[h||a]=th(l))}const o=(l,a)=>re.forEach(l,(u,f)=>s(u,f,a));if(re.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(re.isString(e)&&(e=e.trim())&&!A4(e))o(C4(e),n);else if(re.isObject(e)&&re.isIterable(e)){let l={},a,u;for(const f of e){if(!re.isArray(f))throw TypeError("Object iterator must return a key-value pair");l[u=f[0]]=(a=l[u])?re.isArray(a)?[...a,f[1]]:[a,f[1]]:f[1]}o(l,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=Oc(e),e){const r=re.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return k4(i);if(re.isFunction(n))return n.call(this,i,r);if(re.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Oc(e),e){const r=re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Lp(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(o){if(o=Oc(o),o){const l=re.findKey(r,o);l&&(!n||Lp(r,r[l],l,n))&&(delete r[l],i=!0)}}return re.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||Lp(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return re.forEach(this,(i,s)=>{const o=re.findKey(r,s);if(o){n[o]=th(i),delete n[s];return}const l=e?O4(s):String(s).trim();l!==s&&delete n[s],n[l]=th(i),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return re.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&re.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
4
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[M1]=this[M1]={accessors:{}}).accessors,i=this.prototype;function s(o){const l=Oc(o);r[l]||(_4(i,o),r[l]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}};ni.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);re.reduceDescriptors(ni.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});re.freezeMethods(ni);function Np(t,e){const n=this||Vu,r=e||n,i=ni.from(r.headers);let s=r.data;return re.forEach(t,function(l){s=l.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function aw(t){return!!(t&&t.__CANCEL__)}function fc(t,e,n){At.call(this,t??"canceled",At.ERR_CANCELED,e,n),this.name="CanceledError"}re.inherits(fc,At,{__CANCEL__:!0});function cw(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new At("Request failed with status code "+n.status,[At.ERR_BAD_REQUEST,At.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function E4(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function T4(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),f=r[s];o||(o=u),n[i]=a,r[i]=u;let h=s,d=0;for(;h!==i;)d+=n[h++],h=h%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o<e)return;const p=f&&u-f;return p?Math.round(d*1e3/p):void 0}}function M4(t,e){let n=0,r=1e3/e,i,s;const o=(u,f=Date.now())=>{n=f,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{const f=Date.now(),h=f-n;h>=r?o(u,f):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-h)))},()=>i&&o(i)]}const Ph=(t,e,n=3)=>{let r=0;const i=T4(50,250);return M4(s=>{const o=s.loaded,l=s.lengthComputable?s.total:void 0,a=o-r,u=i(a),f=o<=l;r=o;const h={loaded:o,total:l,progress:l?o/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&f?(l-o)/u:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(h)},n)},R1=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},P1=t=>(...e)=>re.asap(()=>t(...e)),R4=_r.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,_r.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(_r.origin),_r.navigator&&/(msie|trident)/i.test(_r.navigator.userAgent)):()=>!0,P4=_r.hasStandardBrowserEnv?{write(t,e,n,r,i,s){const o=[t+"="+encodeURIComponent(e)];re.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),re.isString(r)&&o.push("path="+r),re.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function D4(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function I4(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function uw(t,e,n){let r=!D4(e);return t&&(r||n==!1)?I4(t,e):e}const D1=t=>t instanceof ni?{...t}:t;function Il(t,e){e=e||{};const n={};function r(u,f,h,d){return re.isPlainObject(u)&&re.isPlainObject(f)?re.merge.call({caseless:d},u,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function i(u,f,h,d){if(re.isUndefined(f)){if(!re.isUndefined(u))return r(void 0,u,h,d)}else return r(u,f,h,d)}function s(u,f){if(!re.isUndefined(f))return r(void 0,f)}function o(u,f){if(re.isUndefined(f)){if(!re.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function l(u,f,h){if(h in e)return r(u,f);if(h in t)return r(void 0,u)}const a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,f,h)=>i(D1(u),D1(f),h,!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(f){const h=a[f]||i,d=h(t[f],e[f],f);re.isUndefined(d)&&h!==l||(n[f]=d)}),n}const fw=t=>{const e=Il({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=ni.from(o),e.url=sw(uw(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(re.isFormData(n)){if(_r.hasStandardBrowserEnv||_r.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...f]=a?a.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...f].join("; "))}}if(_r.hasStandardBrowserEnv&&(r&&re.isFunction(r)&&(r=r(e)),r||r!==!1&&R4(e.url))){const u=i&&s&&P4.read(s);u&&o.set(i,u)}return e},L4=typeof XMLHttpRequest<"u",N4=L4&&function(t){return new Promise(function(n,r){const i=fw(t);let s=i.data;const o=ni.from(i.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=i,f,h,d,p,g;function m(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function y(){if(!v)return;const k=ni.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),w={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:k,config:t,request:v};cw(function(A){n(A),m()},function(A){r(A),m()},w),v=null}"onloadend"in v?v.onloadend=y:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(y)},v.onabort=function(){v&&(r(new At("Request aborted",At.ECONNABORTED,t,v)),v=null)},v.onerror=function(){r(new At("Network Error",At.ERR_NETWORK,t,v)),v=null},v.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const w=i.transitional||ow;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),r(new At(C,w.clarifyTimeoutError?At.ETIMEDOUT:At.ECONNABORTED,t,v)),v=null},s===void 0&&o.setContentType(null),"setRequestHeader"in v&&re.forEach(o.toJSON(),function(C,w){v.setRequestHeader(w,C)}),re.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),l&&l!=="json"&&(v.responseType=i.responseType),u&&([d,g]=Ph(u,!0),v.addEventListener("progress",d)),a&&v.upload&&([h,p]=Ph(a),v.upload.addEventListener("progress",h),v.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(f=k=>{v&&(r(!k||k.type?new fc(null,t,v):k),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));const S=E4(i.url);if(S&&_r.protocols.indexOf(S)===-1){r(new At("Unsupported protocol "+S+":",At.ERR_BAD_REQUEST,t));return}v.send(s||null)})},j4=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,l();const f=u instanceof Error?u:this.reason;r.abort(f instanceof At?f:new fc(f instanceof Error?f.message:f))}};let o=e&&setTimeout(()=>{o=null,s(new At(`timeout ${e} of ms exceeded`,At.ETIMEDOUT))},e);const l=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>re.asap(l),a}},B4=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},F4=async function*(t,e){for await(const n of z4(t))yield*B4(n,e)},z4=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},I1=(t,e,n,r)=>{const i=F4(t,e);let s=0,o,l=a=>{o||(o=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:u,value:f}=await i.next();if(u){l(),a.close();return}let h=f.byteLength;if(n){let d=s+=h;n(d)}a.enqueue(new Uint8Array(f))}catch(u){throw l(u),u}},cancel(a){return l(a),i.return()}},{highWaterMark:2})},jd=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",hw=jd&&typeof ReadableStream=="function",V4=jd&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),dw=(t,...e)=>{try{return!!t(...e)}catch{return!1}},H4=hw&&dw(()=>{let t=!1;const e=new Request(_r.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),L1=64*1024,Vg=hw&&dw(()=>re.isReadableStream(new Response("").body)),Dh={stream:Vg&&(t=>t.body)};jd&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Dh[e]&&(Dh[e]=re.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new At(`Response type '${e}' is not supported`,At.ERR_NOT_SUPPORT,r)})})})(new Response);const q4=async t=>{if(t==null)return 0;if(re.isBlob(t))return t.size;if(re.isSpecCompliantForm(t))return(await new Request(_r.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(re.isArrayBufferView(t)||re.isArrayBuffer(t))return t.byteLength;if(re.isURLSearchParams(t)&&(t=t+""),re.isString(t))return(await V4(t)).byteLength},U4=async(t,e)=>{const n=re.toFiniteNumber(t.getContentLength());return n??q4(e)},W4=jd&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:a,responseType:u,headers:f,withCredentials:h="same-origin",fetchOptions:d}=fw(t);u=u?(u+"").toLowerCase():"text";let p=j4([i,s&&s.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let v;try{if(a&&H4&&n!=="get"&&n!=="head"&&(v=await U4(f,r))!==0){let w=new Request(e,{method:"POST",body:r,duplex:"half"}),E;if(re.isFormData(r)&&(E=w.headers.get("content-type"))&&f.setContentType(E),w.body){const[A,O]=R1(v,Ph(P1(a)));r=I1(w.body,L1,A,O)}}re.isString(h)||(h=h?"include":"omit");const y="credentials"in Request.prototype;g=new Request(e,{...d,signal:p,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:y?h:void 0});let S=await fetch(g);const k=Vg&&(u==="stream"||u==="response");if(Vg&&(l||k&&m)){const w={};["status","statusText","headers"].forEach(H=>{w[H]=S[H]});const E=re.toFiniteNumber(S.headers.get("content-length")),[A,O]=l&&R1(E,Ph(P1(l),!0))||[];S=new Response(I1(S.body,L1,A,()=>{O&&O(),m&&m()}),w)}u=u||"text";let C=await Dh[re.findKey(Dh,u)||"text"](S,t);return!k&&m&&m(),await new Promise((w,E)=>{cw(w,E,{data:C,headers:ni.from(S.headers),status:S.status,statusText:S.statusText,config:t,request:g})})}catch(y){throw m&&m(),y&&y.name==="TypeError"&&/Load failed|fetch/i.test(y.message)?Object.assign(new At("Network Error",At.ERR_NETWORK,t,g),{cause:y.cause||y}):At.from(y,y&&y.code,t,g)}}),Hg={http:o4,xhr:N4,fetch:W4};re.forEach(Hg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const N1=t=>`- ${t}`,J4=t=>re.isFunction(t)||t===null||t===!1,pw={getAdapter:t=>{t=re.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let s=0;s<e;s++){n=t[s];let o;if(r=n,!J4(n)&&(r=Hg[(o=String(n)).toLowerCase()],r===void 0))throw new At(`Unknown adapter '${o}'`);if(r)break;i[o||"#"+s]=r}if(!r){const s=Object.entries(i).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since :
|
|
5
|
-
`+s.map(N1).join(`
|
|
6
|
-
`):" "+N1(s[0]):"as no adapter specified";throw new At("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Hg};function jp(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fc(null,t)}function j1(t){return jp(t),t.headers=ni.from(t.headers),t.data=Np.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),pw.getAdapter(t.adapter||Vu.adapter)(t).then(function(r){return jp(t),r.data=Np.call(t,t.transformResponse,r),r.headers=ni.from(r.headers),r},function(r){return aw(r)||(jp(t),r&&r.response&&(r.response.data=Np.call(t,t.transformResponse,r.response),r.response.headers=ni.from(r.response.headers))),Promise.reject(r)})}const gw="1.9.0",Bd={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Bd[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const B1={};Bd.transitional=function(e,n,r){function i(s,o){return"[Axios v"+gw+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,l)=>{if(e===!1)throw new At(i(o," has been removed"+(n?" in "+n:"")),At.ERR_DEPRECATED);return n&&!B1[o]&&(B1[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,o,l):!0}};Bd.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function K4(t,e,n){if(typeof t!="object")throw new At("options must be an object",At.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const l=t[s],a=l===void 0||o(l,s,t);if(a!==!0)throw new At("option "+s+" must be "+a,At.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new At("Unknown option "+s,At.ERR_BAD_OPTION)}}const nh={assertOptions:K4,validators:Bd},xs=nh.validators;let Al=class{constructor(e){this.defaults=e||{},this.interceptors={request:new T1,response:new T1}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
7
|
-
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Il(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&nh.assertOptions(r,{silentJSONParsing:xs.transitional(xs.boolean),forcedJSONParsing:xs.transitional(xs.boolean),clarifyTimeoutError:xs.transitional(xs.boolean)},!1),i!=null&&(re.isFunction(i)?n.paramsSerializer={serialize:i}:nh.assertOptions(i,{encode:xs.function,serialize:xs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nh.assertOptions(n,{baseUrl:xs.spelling("baseURL"),withXsrfToken:xs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&re.merge(s.common,s[n.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=ni.concat(o,s);const l=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(a=a&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let f,h=0,d;if(!a){const g=[j1.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),d=g.length,f=Promise.resolve(n);h<d;)f=f.then(g[h++],g[h++]);return f}d=l.length;let p=n;for(h=0;h<d;){const g=l[h++],m=l[h++];try{p=g(p)}catch(v){m.call(this,v);break}}try{f=j1.call(this,p)}catch(g){return Promise.reject(g)}for(h=0,d=u.length;h<d;)f=f.then(u[h++],u[h++]);return f}getUri(e){e=Il(this.defaults,e);const n=uw(e.baseURL,e.url,e.allowAbsoluteUrls);return sw(n,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){Al.prototype[e]=function(n,r){return this.request(Il(r||{},{method:e,url:n,data:(r||{}).data}))}});re.forEach(["post","put","patch"],function(e){function n(r){return function(s,o,l){return this.request(Il(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Al.prototype[e]=n(),Al.prototype[e+"Form"]=n(!0)});let G4=class mw{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{r.subscribe(l),s=l}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,l){r.reason||(r.reason=new fc(s,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new mw(function(i){e=i}),cancel:e}}};function X4(t){return function(n){return t.apply(null,n)}}function Q4(t){return re.isObject(t)&&t.isAxiosError===!0}const qg={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qg).forEach(([t,e])=>{qg[e]=t});function vw(t){const e=new Al(t),n=K2(Al.prototype.request,e);return re.extend(n,Al.prototype,e,{allOwnKeys:!0}),re.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return vw(Il(t,i))},n}const Yn=vw(Vu);Yn.Axios=Al;Yn.CanceledError=fc;Yn.CancelToken=G4;Yn.isCancel=aw;Yn.VERSION=gw;Yn.toFormData=Nd;Yn.AxiosError=At;Yn.Cancel=Yn.CanceledError;Yn.all=function(e){return Promise.all(e)};Yn.spread=X4;Yn.isAxiosError=Q4;Yn.mergeConfig=Il;Yn.AxiosHeaders=ni;Yn.formToJSON=t=>lw(re.isHTMLForm(t)?new FormData(t):t);Yn.getAdapter=pw.getAdapter;Yn.HttpStatusCode=qg;Yn.default=Yn;const{Axios:WU,AxiosError:JU,CanceledError:KU,isCancel:GU,CancelToken:XU,VERSION:QU,all:YU,Cancel:ZU,isAxiosError:$U,spread:eW,toFormData:tW,AxiosHeaders:nW,HttpStatusCode:rW,formToJSON:iW,getAdapter:sW,mergeConfig:oW}=Yn,Y4="/whistle.interceptors",Z4=Yn.create({headers:{"Content-Type":"application/json"}}),yw=async(t,e,n)=>(await Z4({url:Y4+t,method:e,data:n})).data,$4=async t=>await yw("/collections/add","post",t),eE=async()=>await yw("/collections/query","get"),tE=(t,e)=>!e.some(n=>n.id===t),nE=()=>{const t={rules:[],selectedRule:null,originalRules:[]},e=d_(t),{subscribe:n,set:r,update:i}=e;return{subscribe:n,addRule:(s,o)=>{i(l=>{const a=l.rules||[];if(o&&!tE(o,a))throw new Error("规则ID已存在,请使用其他ID");const u={id:o||String(a.length+1),name:s.trim(),config:{method:"GET",matchType:"and",conditions:[{key:"",value:"",response:""}]}};return{...l,rules:[...a,u],selectedRule:u}})},deleteRule:s=>{i(o=>{var u;const l=o.rules.filter(f=>f.id!==s),a=((u=o.selectedRule)==null?void 0:u.id)===s?null:o.selectedRule;return{...o,rules:l,selectedRule:a}})},selectRule:s=>{i(o=>({...o,selectedRule:s}))},updateRuleConfig:(s,o)=>{i(l=>{var f;const a=l.rules.map(h=>h.id===s?{...h,config:o}:h),u=((f=l.selectedRule)==null?void 0:f.id)===s?{...l.selectedRule,config:o}:l.selectedRule;return console.log("[info: 68]:",{...l,rules:a,selectedRule:u}),{...l,rules:a,selectedRule:u}})},saveRules:async()=>{const s=Ip(e);console.log("Current rules:",s.rules);try{await $4(s.rules),i(o=>({...o,originalRules:[...o.rules]})),console.log("Rules saved successfully")}catch(o){console.error("Failed to save rules:",o)}},filterRules:s=>{const o=Ip(e);i(l=>({...l,rules:o.rules.filter(a=>a.name.toLowerCase().includes(s.toLowerCase()))}))},getCurrentRules:()=>Ip(e).rules,getRulesList:async()=>{const s=await eE();console.log("[info: 110]:",{rulesList:s}),i(o=>({...o,rules:s.data}))},reset:()=>r(t)}},Vr=nE();var rE=J('<div><div class="name svelte-me8ek3"> </div> <div class="id svelte-me8ek3"> </div> <button class="delete-btn svelte-me8ek3">删除</button></div>'),iE=J('<div class="error-message svelte-me8ek3"> </div>'),sE=J('<div class="dialog-overlay svelte-me8ek3"><div class="dialog svelte-me8ek3"><h2 class="svelte-me8ek3">新增规则</h2> <input type="text" class="dialog-input svelte-me8ek3" placeholder="请输入规则名称"> <input type="text" class="dialog-input svelte-me8ek3" placeholder="请输入规则ID"> <!> <div class="dialog-buttons svelte-me8ek3"><button class="dialog-btn cancel-btn svelte-me8ek3">取消</button> <button class="dialog-btn confirm-btn svelte-me8ek3">确定</button></div></div></div>'),oE=J('<div class="rule-container svelte-me8ek3"><div class="search-bar svelte-me8ek3"><input type="text" class="search-input svelte-me8ek3" placeholder="搜索规则..."></div> <div class="rule-content svelte-me8ek3"><div class="rule-list svelte-me8ek3"></div></div> <div class="button-bar svelte-me8ek3"><button class="action-btn add-btn svelte-me8ek3">添加</button> <button class="action-btn save-btn svelte-me8ek3">保存</button></div></div> <!>',1);function lE(t,e){Ge(e,!1);const n=R();let r=R(!1),i=R(""),s=R(""),o=R(""),l=R(""),a=x(e,"selectedRule",12,null);function u(){b(r,!0),b(i,""),b(s,""),b(o,"")}function f(){b(r,!1),b(o,"")}function h(){if(c(i).trim())try{Vr.addRule(c(i),c(s).trim()||void 0),f()}catch(G){b(o,G.message)}}function d(){Vr.saveRules()}function p(G){Vr.selectRule(G)}function g(G){Vr.deleteRule(G.id)}let m=R([]);Vr.subscribe(G=>{b(m,G.rules),a(G.selectedRule)}),Vr.getRulesList(),K(()=>(c(l),c(m)),()=>{b(n,c(l)?c(m).filter(G=>G.name.toLowerCase().includes(c(l).toLowerCase())):c(m))}),Vt(),st();var v=oE(),y=$e(v),S=M(y),k=M(S),C=N(S,2),w=M(C);Sn(w,5,()=>c(n),Ln,(G,V)=>{var U=rE(),Q=M(U),Y=M(Q),ie=N(Q,2),F=M(ie),X=N(ie,2);xe(()=>{var I;ct(U,1,`rule-item ${((I=a())==null?void 0:I.id)===c(V).id?"selected":""}`,"svelte-me8ek3"),et(Y,c(V).name),et(F,`ID: ${c(V).id??""}`)}),ae("click",X,Ui(()=>g(c(V)))),ae("click",U,()=>p(c(V))),D(G,U)});var E=N(C,2),A=M(E),O=N(A,2),H=N(y,2);{var W=G=>{var V=sE(),U=M(V),Q=N(M(U),2),Y=N(Q,2),ie=N(Y,2);{var F=ce=>{var Te=iE(),le=M(Te);xe(()=>et(le,c(o))),D(ce,Te)};te(ie,ce=>{c(o)&&ce(F)})}var X=N(ie,2),I=M(X),se=N(I,2);no(Q,()=>c(i),ce=>b(i,ce)),no(Y,()=>c(s),ce=>b(s,ce)),ae("click",I,f),ae("click",se,h),ae("click",U,Ui(function(ce){ba.call(this,e,ce)})),ae("click",V,f),D(G,V)};te(H,G=>{c(r)&&G(W)})}no(k,()=>c(l),G=>b(l,G)),ae("click",A,u),ae("click",O,d),D(t,v),Xe()}function rr(t,e=aE(t)){if(!e)return cE;const n=fE(t);return function(...i){console.log(`%c${t}`,`color:${n}`,...i)}}function aE(t){const e=uE("debug");return e!=null&&e.endsWith("*")?t.startsWith(e.slice(0,-1)):t===e}function cE(){}function uE(t){try{if(typeof window<"u"&&typeof window.localStorage<"u")return window.localStorage[t]}catch{}}function fE(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return F1[Math.abs(e)%F1.length]}const F1=["#0000CC","#0099FF","#009400","#8dd200","#CCCC00","#CC9933","#ae04e7","#ff35d7","#FF3333","#FF6600","#FF9933","#FFCC33"];let z1=0;function xa(){return z1++,z1}function Nn(t){return Array.isArray(t)}function Hn(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function bw(t){return t&&typeof t=="object"?t.op==="add":!1}function xw(t){return t&&typeof t=="object"?t.op==="remove":!1}function Ev(t){return t&&typeof t=="object"?t.op==="replace":!1}function Ug(t){return t&&typeof t=="object"?t.op==="copy":!1}function Ha(t){return t&&typeof t=="object"?t.op==="move":!1}function hE(t,e){return JSON.stringify(t)===JSON.stringify(e)}function dE(t,e){return t===e}function ww(t){return t.slice(0,t.length-1)}function pE(t){return t[t.length-1]}function gE(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dE;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Sw(t){return typeof t=="object"&&t!==null}function Tv(t){if(Nn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(Hn(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function Mv(t,e,n){if(t[e]===n)return t;{const r=Tv(t);return r[e]=n,r}}function De(t,e){let n=t,r=0;for(;r<e.length;)Hn(n)?n=n[e[r]]:Nn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Xr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const i=e[0],s=Xr(t?t[i]:void 0,e.slice(1),n,r);if(Hn(t)||Nn(t))return Mv(t,i,s);if(r){const o=mE.test(i)?[]:{};return o[i]=s,o}else throw new Error("Path does not exist")}const mE=/^\d+$/;function Rv(t,e,n){if(e.length===0)return n(t);if(!Sw(t))throw new Error("Path doesn't exist");const r=e[0],i=Rv(t[r],e.slice(1),n);return Mv(t,r,i)}function Fd(t,e){if(e.length===0)return t;if(!Sw(t))throw new Error("Path does not exist");if(e.length===1){const i=e[0];if(i in t){const s=Tv(t);return Nn(s)&&s.splice(parseInt(i),1),Hn(s)&&delete s[i],s}else return t}const n=e[0],r=Fd(t[n],e.slice(1));return Mv(t,n,r)}function Pv(t,e,n){const r=e.slice(0,e.length-1),i=e[e.length-1];return Rv(t,r,s=>{if(!Array.isArray(s))throw new TypeError("Array expected at path "+JSON.stringify(r));const o=Tv(s);return o.splice(parseInt(i),0,n),o})}function Ei(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Ei(t[e[0]],e.slice(1))}function Li(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function tt(t){return t.map(Cw).join("")}function Cw(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function V1(t,e){return t+Cw(e)}function Xi(t,e,n){let r=t;for(let i=0;i<e.length;i++){kE(e[i]);let s=e[i];if(n&&n.before){const a=n.before(r,s);if(a!==void 0){if(a.document!==void 0&&(r=a.document),a.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');a.operation!==void 0&&(s=a.operation)}}const o=r,l=Qi(r,s.path);if(s.op==="add")r=bE(r,l,s.value);else if(s.op==="remove")r=yE(r,l);else if(s.op==="replace")r=vE(r,l,s.value);else if(s.op==="copy")r=xE(r,l,Wg(s.from));else if(s.op==="move")r=wE(r,l,Wg(s.from));else if(s.op==="test")SE(r,l,s.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(s));if(n&&n.after){const a=n.after(r,s,o);a!==void 0&&(r=a)}}return r}function vE(t,e,n){return Xr(t,e,n)}function yE(t,e){return Fd(t,e)}function bE(t,e,n){return Hu(t,e)?Pv(t,e,n):Xr(t,e,n)}function xE(t,e,n){const r=De(t,n);if(Hu(t,e))return Pv(t,e,r);{const i=De(t,n);return Xr(t,e,i)}}function wE(t,e,n){const r=De(t,n),i=Fd(t,n);return Hu(i,e)?Pv(i,e,r):Xr(i,e,r)}function SE(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${tt(e)}")`);if(!Ei(t,e))throw new Error(`Test failed: path not found (path: "${tt(e)}")`);const r=De(t,e);if(!hE(r,n))throw new Error(`Test failed, value differs (path: "${tt(e)}")`)}function Hu(t,e){if(e.length===0)return!1;const n=De(t,ww(e));return Array.isArray(n)}function CE(t,e){if(pE(e)!=="-")return e;const n=ww(e),r=De(t,n);return n.concat(r.length)}function kE(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function Qi(t,e){return CE(t,Li(e))}function Wg(t){return Li(t)}function kw(t,e,n){let r=[];return Xi(t,e,{before:(s,o)=>{let l;const a=Qi(s,o.path);if(o.op==="add")l=_w(s,a);else if(o.op==="remove")l=Ow(s,a);else if(o.op==="replace")l=Aw(s,a);else if(o.op==="copy")l=AE(s,a);else if(o.op==="move")l=OE(s,a,Wg(o.from));else if(o.op==="test")l=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(o));let u;if(n&&n.before){const f=n.before(s,o,l);if(f&&f.revertOperations&&(l=f.revertOperations),f&&f.document&&(u=f.document),f&&f.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=l.concat(r),u!==void 0)return{document:u}}}),r}function Aw(t,e){return[{op:"replace",path:tt(e),value:De(t,e)}]}function Ow(t,e){return[{op:"add",path:tt(e),value:De(t,e)}]}function _w(t,e){return Hu(t,e)||!Ei(t,e)?[{op:"remove",path:tt(e)}]:Aw(t,e)}function AE(t,e){return _w(t,e)}function OE(t,e,n){if(e.length<n.length&&gE(n,e))return[{op:"replace",path:tt(e),value:t}];const r={op:"move",from:tt(e),path:tt(n)};return!Hu(t,e)&&Ei(t,e)?[r,...Ow(t,e)]:[r]}function Ew(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gf={},H1;function _E(){if(H1)return gf;H1=1;var t={b:"\b",f:"\f",n:`
|
|
8
|
-
`,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},e=97;gf.parse=function(g,m,v){var y={},S=0,k=0,C=0,w=v&&v.bigint&&typeof BigInt<"u";return{data:E("",!0),pointers:y};function E(le,de){A();var ne;F(le,"value");var ue=U();switch(ue){case"t":V("rue"),ne=!0;break;case"f":V("alse"),ne=!1;break;case"n":V("ull"),ne=null;break;case'"':ne=O();break;case"[":ne=W(le);break;case"{":ne=G(le);break;default:Q(),"-0123456789".indexOf(ue)>=0?ne=H():se()}return F(le,"valueEnd"),A(),de&&C<g.length&&se(),ne}function A(){e:for(;C<g.length;){switch(g[C]){case" ":k++;break;case" ":k+=4;break;case"\r":k=0;break;case`
|
|
9
|
-
`:k=0,S++;break;default:break e}C++}}function O(){for(var le="",de;de=U(),de!='"';)de=="\\"?(de=U(),de in t?le+=t[de]:de=="u"?le+=Y():ce()):le+=de;return le}function H(){var le="",de=!0;g[C]=="-"&&(le+=U()),le+=g[C]=="0"?U():ie(),g[C]=="."&&(le+=U()+ie(),de=!1),(g[C]=="e"||g[C]=="E")&&(le+=U(),(g[C]=="+"||g[C]=="-")&&(le+=U()),le+=ie(),de=!1);var ne=+le;return w&&de&&(ne>Number.MAX_SAFE_INTEGER||ne<Number.MIN_SAFE_INTEGER)?BigInt(le):ne}function W(le){A();var de=[],ne=0;if(U()=="]")return de;for(Q();;){var ue=le+"/"+ne;de.push(E(ue)),A();var ge=U();if(ge=="]")break;ge!=","&&ce(),A(),ne++}return de}function G(le){A();var de={};if(U()=="}")return de;for(Q();;){var ne=I();U()!='"'&&ce();var ue=O(),ge=le+"/"+p(ue);X(ge,"key",ne),F(ge,"keyEnd"),A(),U()!=":"&&ce(),A(),de[ue]=E(ge),A();var j=U();if(j=="}")break;j!=","&&ce(),A()}return de}function V(le){for(var de=0;de<le.length;de++)U()!==le[de]&&ce()}function U(){Te();var le=g[C];return C++,k++,le}function Q(){C--,k--}function Y(){for(var le=4,de=0;le--;){de<<=4;var ne=U().toLowerCase();ne>="a"&&ne<="f"?de+=ne.charCodeAt()-e+10:ne>="0"&&ne<="9"?de+=+ne:ce()}return String.fromCharCode(de)}function ie(){for(var le="";g[C]>="0"&&g[C]<="9";)le+=U();if(le.length)return le;Te(),se()}function F(le,de){X(le,de,I())}function X(le,de,ne){y[le]=y[le]||{},y[le][de]=ne}function I(){return{line:S,column:k,pos:C}}function se(){throw new SyntaxError("Unexpected token "+g[C]+" in JSON at position "+C)}function ce(){Q(),se()}function Te(){if(C>=g.length)throw new SyntaxError("Unexpected end of JSON input")}},gf.stringify=function(g,m,v){if(!r(g))return;var y=0,S,k,C=typeof v=="object"?v.space:v;switch(typeof C){case"number":var w=C>10?10:C<0?0:Math.floor(C);C=w&&X(w," "),S=w,k=w;break;case"string":C=C.slice(0,10),S=0,k=0;for(var E=0;E<C.length;E++){var A=C[E];switch(A){case" ":k++;break;case" ":k+=4;break;case"\r":k=0;break;case`
|
|
10
|
-
`:k=0,y++;break;default:throw new Error("whitespace characters not allowed in JSON")}S++}break;default:C=void 0}var O="",H={},W=0,G=0,V=0,U=v&&v.es6&&typeof Map=="function";return Q(g,0,""),{json:O,pointers:H};function Q(I,se,ce){switch(F(ce,"value"),typeof I){case"number":case"bigint":case"boolean":Y(""+I);break;case"string":Y(f(I));break;case"object":I===null?Y("null"):typeof I.toJSON=="function"?Y(f(I.toJSON())):Array.isArray(I)?Te():U?I.constructor.BYTES_PER_ELEMENT?Te():I instanceof Map?de():I instanceof Set?de(!0):le():le()}F(ce,"valueEnd");function Te(){if(I.length){Y("[");for(var ne=se+1,ue=0;ue<I.length;ue++){ue&&Y(","),ie(ne);var ge=r(I[ue])?I[ue]:null,j=ce+"/"+ue;Q(ge,ne,j)}ie(se),Y("]")}else Y("[]")}function le(){var ne=Object.keys(I);if(ne.length){Y("{");for(var ue=se+1,ge=0;ge<ne.length;ge++){var j=ne[ge],we=I[j];if(r(we)){ge&&Y(",");var Pe=ce+"/"+p(j);ie(ue),F(Pe,"key"),Y(f(j)),F(Pe,"keyEnd"),Y(":"),C&&Y(" "),Q(we,ue,Pe)}}ie(se),Y("}")}else Y("{}")}function de(ne){if(I.size){Y("{");for(var ue=se+1,ge=!0,j=I.entries(),we=j.next();!we.done;){var Pe=we.value,q=Pe[0],B=ne?!0:Pe[1];if(r(B)){ge||Y(","),ge=!1;var Se=ce+"/"+p(q);ie(ue),F(Se,"key"),Y(f(q)),F(Se,"keyEnd"),Y(":"),C&&Y(" "),Q(B,ue,Se)}we=j.next()}ie(se),Y("}")}else Y("{}")}}function Y(I){G+=I.length,V+=I.length,O+=I}function ie(I){if(C){for(O+=`
|
|
11
|
-
`+X(I,C),W++,G=0;I--;)y?(W+=y,G=k):G+=k,V+=S;V+=1}}function F(I,se){H[I]=H[I]||{},H[I][se]={line:W,column:G,pos:V}}function X(I,se){return Array(I+1).join(se)}};var n=["number","bigint","boolean","string","object"];function r(g){return n.indexOf(typeof g)>=0}var i=/"|\\/g,s=/[\b]/g,o=/\f/g,l=/\n/g,a=/\r/g,u=/\t/g;function f(g){return g=g.replace(i,"\\$&").replace(o,"\\f").replace(s,"\\b").replace(l,"\\n").replace(a,"\\r").replace(u,"\\t"),'"'+g+'"'}var h=/~/g,d=/\//g;function p(g){return g.replace(h,"~0").replace(d,"~1")}return gf}var EE=_E();const Tw=Ew(EE);class ca extends Error{constructor(e,n){super("".concat(e," at position ").concat(n)),this.position=n}}const Mw=32,TE=10,Rw=9,Pw=13,ME=160,RE=8192,PE=8202,DE=8239,IE=8287,LE=12288;function NE(t){return/^[0-9A-Fa-f]$/.test(t)}function dl(t){return t>="0"&&t<="9"}function jE(t){return t>=" "}function mf(t){return`,:[]/{}()
|
|
12
|
-
+`.includes(t)}function q1(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"||t==="$"}function U1(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"||t==="$"||t>="0"&&t<="9"}const W1=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,J1=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function K1(t){return`,[]/{}
|
|
13
|
-
+`.includes(t)}function G1(t){return rh(t)||BE.test(t)}const BE=/^[[{\w-]$/;function FE(t){return t===`
|
|
14
|
-
`||t==="\r"||t===" "||t==="\b"||t==="\f"}function ml(t,e){const n=t.charCodeAt(e);return n===Mw||n===TE||n===Rw||n===Pw}function zE(t,e){const n=t.charCodeAt(e);return n===Mw||n===Rw||n===Pw}function VE(t,e){const n=t.charCodeAt(e);return n===ME||n>=RE&&n<=PE||n===DE||n===IE||n===LE}function rh(t){return Dw(t)||Jg(t)}function Dw(t){return t==='"'||t==="“"||t==="”"}function X1(t){return t==='"'}function Jg(t){return t==="'"||t==="‘"||t==="’"||t==="`"||t==="´"}function Q1(t){return t==="'"}function _c(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const r=t.lastIndexOf(e);return r!==-1?t.substring(0,r)+(n?"":t.substring(r+1)):t}function Hi(t,e){let n=t.length;if(!ml(t,n-1))return t+e;for(;ml(t,n-1);)n--;return t.substring(0,n)+e+t.substring(n)}function HE(t,e,n){return t.substring(0,e)+t.substring(e+n)}function qE(t){return/[,\n][ \t\r]*$/.test(t)}const UE={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},WE={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
15
|
-
`,r:"\r",t:" "};function Ds(t){let e=0,n="";u(),s()||U(),u();const i=f(",");for(i&&o(),G1(t[e])&&qE(n)?(i||(n=Hi(n,",")),v()):i&&(n=_c(n,","));t[e]==="}"||t[e]==="]";)e++,o();if(e>=t.length)return n;V();function s(){o();const F=g()||m()||y()||k()||C()||E(!1)||A();return o(),F}function o(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const X=e;let I=l(F);do I=a(),I&&(I=l(F));while(I);return e>X}function l(F){const X=F?ml:zE;let I="";for(;;)if(X(t,e))I+=t[e],e++;else if(VE(t,e))I+=" ",e++;else break;return I.length>0?(n+=I,!0):!1}function a(){if(t[e]==="/"&&t[e+1]==="*"){for(;e<t.length&&!JE(t,e);)e++;return e+=2,!0}if(t[e]==="/"&&t[e+1]==="/"){for(;e<t.length&&t[e]!==`
|
|
16
|
-
`;)e++;return!0}return!1}function u(){if(t.slice(e,e+3)==="```"){if(e+=3,q1(t[e]))for(;e<t.length&&U1(t[e]);)e++;return o(),!0}return!1}function f(F){return t[e]===F?(n+=t[e],e++,!0):!1}function h(F){return t[e]===F?(e++,!0):!1}function d(){return h("\\")}function p(){return o(),t[e]==="."&&t[e+1]==="."&&t[e+2]==="."?(e+=3,o(),h(","),!0):!1}function g(){if(t[e]==="{"){n+="{",e++,o(),h(",")&&o();let F=!0;for(;e<t.length&&t[e]!=="}";){let X;if(F?(X=!0,F=!1):(X=f(","),X||(n=Hi(n,",")),o()),p(),!(y()||E(!0))){t[e]==="}"||t[e]==="{"||t[e]==="]"||t[e]==="["||t[e]===void 0?n=_c(n,","):Q();break}o();const se=f(":"),ce=e>=t.length;se||(G1(t[e])||ce?n=Hi(n,":"):Y()),s()||(se||ce?n+="null":Y())}return t[e]==="}"?(n+="}",e++):n=Hi(n,"}"),!0}return!1}function m(){if(t[e]==="["){n+="[",e++,o(),h(",")&&o();let F=!0;for(;e<t.length&&t[e]!=="]";)if(F?F=!1:f(",")||(n=Hi(n,",")),p(),!s()){n=_c(n,",");break}return t[e]==="]"?(n+="]",e++):n=Hi(n,"]"),!0}return!1}function v(){let F=!0,X=!0;for(;X;)F?F=!1:f(",")||(n=Hi(n,",")),X=s();X||(n=_c(n,",")),n=`[
|
|
17
|
-
`.concat(n,`
|
|
18
|
-
]`)}function y(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,I=t[e]==="\\";if(I&&(e++,I=!0),rh(t[e])){const se=X1(t[e])?X1:Q1(t[e])?Q1:Jg(t[e])?Jg:Dw,ce=e,Te=n.length;let le='"';for(e++;;){if(e>=t.length){const de=O(e-1);return!F&&mf(t.charAt(de))?(e=ce,n=n.substring(0,Te),y(!0)):(le=Hi(le,'"'),n+=le,!0)}else{if(e===X)return le=Hi(le,'"'),n+=le,!0;if(se(t[e])){const de=e,ne=le.length;if(le+='"',e++,n+=le,o(!1),F||e>=t.length||mf(t[e])||rh(t[e])||dl(t[e]))return S(),!0;const ue=O(de-1),ge=t.charAt(ue);if(ge===",")return e=ce,n=n.substring(0,Te),y(!1,ue);if(mf(ge))return e=ce,n=n.substring(0,Te),y(!0);n=n.substring(0,Te),e=de+1,le="".concat(le.substring(0,ne),"\\").concat(le.substring(ne))}else if(F&&K1(t[e])){if(t[e-1]===":"&&W1.test(t.substring(ce+1,e+2)))for(;e<t.length&&J1.test(t[e]);)le+=t[e],e++;return le=Hi(le,'"'),n+=le,S(),!0}else if(t[e]==="\\"){const de=t.charAt(e+1);if(WE[de]!==void 0)le+=t.slice(e,e+2),e+=2;else if(de==="u"){let ue=2;for(;ue<6&&NE(t[e+ue]);)ue++;ue===6?(le+=t.slice(e,e+6),e+=6):e+ue>=t.length?e=t.length:ie()}else le+=de,e+=2}else{const de=t.charAt(e);de==='"'&&t[e-1]!=="\\"?(le+="\\".concat(de),e++):FE(de)?(le+=UE[de],e++):(jE(de)||G(de),le+=de,e++)}}I&&d()}}return!1}function S(){let F=!1;for(o();t[e]==="+";){F=!0,e++,o(),n=_c(n,'"',!0);const X=n.length;y()?n=HE(n,X,1):n=Hi(n,'"')}return F}function k(){const F=e;if(t[e]==="-"){if(e++,H())return W(F),!0;if(!dl(t[e]))return e=F,!1}for(;dl(t[e]);)e++;if(t[e]==="."){if(e++,H())return W(F),!0;if(!dl(t[e]))return e=F,!1;for(;dl(t[e]);)e++}if(t[e]==="e"||t[e]==="E"){if(e++,(t[e]==="-"||t[e]==="+")&&e++,H())return W(F),!0;if(!dl(t[e]))return e=F,!1;for(;dl(t[e]);)e++}if(!H())return e=F,!1;if(e>F){const X=t.slice(F,e),I=/^0\d/.test(X);return n+=I?'"'.concat(X,'"'):X,!0}return!1}function C(){return w("true","true")||w("false","false")||w("null","null")||w("True","true")||w("False","false")||w("None","null")}function w(F,X){return t.slice(e,e+F.length)===F?(n+=X,e+=F.length,!0):!1}function E(F){const X=e;if(q1(t[e])){for(;e<t.length&&U1(t[e]);)e++;let I=e;for(;ml(t,I);)I++;if(t[I]==="(")return e=I+1,s(),t[e]===")"&&(e++,t[e]===";"&&e++),!0}for(;e<t.length&&!K1(t[e])&&!rh(t[e])&&(!F||t[e]!==":");)e++;if(t[e-1]===":"&&W1.test(t.substring(X,e+2)))for(;e<t.length&&J1.test(t[e]);)e++;if(e>X){for(;ml(t,e-1)&&e>0;)e--;const I=t.slice(X,e);return n+=I==="undefined"?"null":JSON.stringify(I),t[e]==='"'&&e++,!0}}function A(){if(t[e]==="/"){const F=e;for(e++;e<t.length&&(t[e]!=="/"||t[e-1]==="\\");)e++;return e++,n+='"'.concat(t.substring(F,e),'"'),!0}}function O(F){let X=F;for(;X>0&&ml(t,X);)X--;return X}function H(){return e>=t.length||mf(t[e])||ml(t,e)}function W(F){n+="".concat(t.slice(F,e),"0")}function G(F){throw new ca("Invalid character ".concat(JSON.stringify(F)),e)}function V(){throw new ca("Unexpected character ".concat(JSON.stringify(t[e])),e)}function U(){throw new ca("Unexpected end of json string",t.length)}function Q(){throw new ca("Object key expected",e)}function Y(){throw new ca("Colon expected",e)}function ie(){const F=t.slice(e,e+6);throw new ca('Invalid unicode character "'.concat(F,'"'),e)}}function JE(t,e){return t[e]==="*"&&t[e+1]==="/"}function mr(t){return parseInt(t,10)}function Dv(t){return KE.test(t)}const KE=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Kt(t){return typeof t=="object"&&t!==null&&(t.constructor===void 0||t.constructor.name==="Object")}function Vn(t){return typeof t=="object"&&t!==null&&(t.constructor===void 0||t.constructor.name==="Object"||t.constructor.name==="Array")}function GE(t){return t===!0||t===!1}function Kg(t){if(typeof t=="number")return t>9466848e5&&isFinite(t)&&Math.floor(t)===t&&!isNaN(new Date(t).valueOf());if(typeof t=="bigint")return Kg(Number(t));try{const n=t&&t.valueOf();if(n!==t)return Kg(n)}catch{return!1}return!1}function Iw(t){Ec=Ec||window.document.createElement("div"),Ec.style.color="",Ec.style.color=t;const e=Ec.style.color;return e!==""?e.replace(/\s+/g,"").toLowerCase():void 0}let Ec;function XE(t){return typeof t=="string"&&t.length<99&&!!Iw(t)}function Iv(t,e){if(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||typeof t>"u")return typeof t;if(typeof t=="bigint")return"number";if(t===null)return"null";if(Array.isArray(t))return"array";if(Kt(t))return"object";const n=e.stringify(t);return n&&Dv(n)?"number":n==="true"||n==="false"?"boolean":n==="null"?"null":"unknown"}const QE=/^https?:\/\/\S+$/;function zd(t){return typeof t=="string"&&QE.test(t)}function hc(t,e){if(t==="")return"";const n=t.trim();return n==="null"?null:n==="true"?!0:n==="false"?!1:Dv(n)?e.parse(n):t}function YE(t){return typeof t=="string"&&typeof hc(t,JSON)!="string"}var Lw=typeof global=="object"&&global&&global.Object===Object&&global,ZE=typeof self=="object"&&self&&self.Object===Object&&self,as=Lw||ZE||Function("return this")(),Ni=as.Symbol,Nw=Object.prototype,$E=Nw.hasOwnProperty,eT=Nw.toString,Tc=Ni?Ni.toStringTag:void 0;function tT(t){var e=$E.call(t,Tc),n=t[Tc];try{t[Tc]=void 0;var r=!0}catch{}var i=eT.call(t);return r&&(e?t[Tc]=n:delete t[Tc]),i}var nT=Object.prototype,rT=nT.toString;function iT(t){return rT.call(t)}var sT="[object Null]",oT="[object Undefined]",Y1=Ni?Ni.toStringTag:void 0;function dc(t){return t==null?t===void 0?oT:sT:Y1&&Y1 in Object(t)?tT(t):iT(t)}function qo(t){return t!=null&&typeof t=="object"}var lT="[object Symbol]";function Ll(t){return typeof t=="symbol"||qo(t)&&dc(t)==lT}function Kc(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var Dr=Array.isArray,Z1=Ni?Ni.prototype:void 0,$1=Z1?Z1.toString:void 0;function jw(t){if(typeof t=="string")return t;if(Dr(t))return Kc(t,jw)+"";if(Ll(t))return $1?$1.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var aT=/\s/;function cT(t){for(var e=t.length;e--&&aT.test(t.charAt(e)););return e}var uT=/^\s+/;function fT(t){return t&&t.slice(0,cT(t)+1).replace(uT,"")}function co(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ey=NaN,hT=/^[-+]0x[0-9a-f]+$/i,dT=/^0b[01]+$/i,pT=/^0o[0-7]+$/i,gT=parseInt;function Gg(t){if(typeof t=="number")return t;if(Ll(t))return ey;if(co(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=co(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=fT(t);var n=dT.test(t);return n||pT.test(t)?gT(t.slice(2),n?2:8):hT.test(t)?ey:+t}var mT=1/0,vT=17976931348623157e292;function ih(t){if(!t)return t===0?t:0;if(t=Gg(t),t===mT||t===-1/0){var e=t<0?-1:1;return e*vT}return t===t?t:0}function yT(t){var e=ih(t),n=e%1;return e===e?n?e-n:e:0}function qu(t){return t}var bT="[object AsyncFunction]",xT="[object Function]",wT="[object GeneratorFunction]",ST="[object Proxy]";function Bw(t){if(!co(t))return!1;var e=dc(t);return e==xT||e==wT||e==bT||e==ST}var Bp=as["__core-js_shared__"],ty=function(){var t=/[^.]+$/.exec(Bp&&Bp.keys&&Bp.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function CT(t){return!!ty&&ty in t}var kT=Function.prototype,AT=kT.toString;function Xl(t){if(t!=null){try{return AT.call(t)}catch{}try{return t+""}catch{}}return""}var OT=/[\\^$.*+?()[\]{}|]/g,_T=/^\[object .+?Constructor\]$/,ET=Function.prototype,TT=Object.prototype,MT=ET.toString,RT=TT.hasOwnProperty,PT=RegExp("^"+MT.call(RT).replace(OT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function DT(t){if(!co(t)||CT(t))return!1;var e=Bw(t)?PT:_T;return e.test(Xl(t))}function IT(t,e){return t==null?void 0:t[e]}function Ql(t,e){var n=IT(t,e);return DT(n)?n:void 0}var Xg=Ql(as,"WeakMap"),ny=Object.create,LT=function(){function t(){}return function(e){if(!co(e))return{};if(ny)return ny(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function NT(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Kn(){}var jT=800,BT=16,FT=Date.now;function zT(t){var e=0,n=0;return function(){var r=FT(),i=BT-(r-n);if(n=r,i>0){if(++e>=jT)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function VT(t){return function(){return t}}var Ih=function(){try{var t=Ql(Object,"defineProperty");return t({},"",{}),t}catch{}}(),HT=Ih?function(t,e){return Ih(t,"toString",{configurable:!0,enumerable:!1,value:VT(e),writable:!0})}:qu,qT=zT(HT);function UT(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var WT=9007199254740991,JT=/^(?:0|[1-9]\d*)$/;function Lv(t,e){var n=typeof t;return e=e??WT,!!e&&(n=="number"||n!="symbol"&&JT.test(t))&&t>-1&&t%1==0&&t<e}function Nv(t,e,n){e=="__proto__"&&Ih?Ih(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Vd(t,e){return t===e||t!==t&&e!==e}var KT=Object.prototype,GT=KT.hasOwnProperty;function XT(t,e,n){var r=t[e];(!(GT.call(t,e)&&Vd(r,n))||n===void 0&&!(e in t))&&Nv(t,e,n)}var ry=Math.max;function QT(t,e,n){return e=ry(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=ry(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=n(o),NT(t,this,l)}}function YT(t,e){return qT(QT(t,e,qu),t+"")}var ZT=9007199254740991;function jv(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ZT}function Uu(t){return t!=null&&jv(t.length)&&!Bw(t)}function Qg(t,e,n){if(!co(n))return!1;var r=typeof e;return(r=="number"?Uu(n)&&Lv(e,n.length):r=="string"&&e in n)?Vd(n[e],t):!1}var $T=Object.prototype;function Bv(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||$T;return t===n}function Fw(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var eM="[object Arguments]";function iy(t){return qo(t)&&dc(t)==eM}var zw=Object.prototype,tM=zw.hasOwnProperty,nM=zw.propertyIsEnumerable,Hd=iy(function(){return arguments}())?iy:function(t){return qo(t)&&tM.call(t,"callee")&&!nM.call(t,"callee")};function rM(){return!1}var Vw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sy=Vw&&typeof module=="object"&&module&&!module.nodeType&&module,iM=sy&&sy.exports===Vw,oy=iM?as.Buffer:void 0,sM=oy?oy.isBuffer:void 0,lu=sM||rM,oM="[object Arguments]",lM="[object Array]",aM="[object Boolean]",cM="[object Date]",uM="[object Error]",fM="[object Function]",hM="[object Map]",dM="[object Number]",pM="[object Object]",gM="[object RegExp]",mM="[object Set]",vM="[object String]",yM="[object WeakMap]",bM="[object ArrayBuffer]",xM="[object DataView]",wM="[object Float32Array]",SM="[object Float64Array]",CM="[object Int8Array]",kM="[object Int16Array]",AM="[object Int32Array]",OM="[object Uint8Array]",_M="[object Uint8ClampedArray]",EM="[object Uint16Array]",TM="[object Uint32Array]",Rn={};Rn[wM]=Rn[SM]=Rn[CM]=Rn[kM]=Rn[AM]=Rn[OM]=Rn[_M]=Rn[EM]=Rn[TM]=!0;Rn[oM]=Rn[lM]=Rn[bM]=Rn[aM]=Rn[xM]=Rn[cM]=Rn[uM]=Rn[fM]=Rn[hM]=Rn[dM]=Rn[pM]=Rn[gM]=Rn[mM]=Rn[vM]=Rn[yM]=!1;function MM(t){return qo(t)&&jv(t.length)&&!!Rn[dc(t)]}function qd(t){return function(e){return t(e)}}var Hw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Gc=Hw&&typeof module=="object"&&module&&!module.nodeType&&module,RM=Gc&&Gc.exports===Hw,Fp=RM&&Lw.process,qa=function(){try{var t=Gc&&Gc.require&&Gc.require("util").types;return t||Fp&&Fp.binding&&Fp.binding("util")}catch{}}(),ly=qa&&qa.isTypedArray,Fv=ly?qd(ly):MM,PM=Object.prototype,DM=PM.hasOwnProperty;function IM(t,e){var n=Dr(t),r=!n&&Hd(t),i=!n&&!r&&lu(t),s=!n&&!r&&!i&&Fv(t),o=n||r||i||s,l=o?Fw(t.length,String):[],a=l.length;for(var u in t)DM.call(t,u)&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Lv(u,a)))&&l.push(u);return l}function qw(t,e){return function(n){return t(e(n))}}var LM=qw(Object.keys,Object),NM=Object.prototype,jM=NM.hasOwnProperty;function Uw(t){if(!Bv(t))return LM(t);var e=[];for(var n in Object(t))jM.call(t,n)&&n!="constructor"&&e.push(n);return e}function Ud(t){return Uu(t)?IM(t):Uw(t)}var BM=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FM=/^\w*$/;function zv(t,e){if(Dr(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ll(t)?!0:FM.test(t)||!BM.test(t)||e!=null&&t in Object(e)}var au=Ql(Object,"create");function zM(){this.__data__=au?au(null):{},this.size=0}function VM(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var HM="__lodash_hash_undefined__",qM=Object.prototype,UM=qM.hasOwnProperty;function WM(t){var e=this.__data__;if(au){var n=e[t];return n===HM?void 0:n}return UM.call(e,t)?e[t]:void 0}var JM=Object.prototype,KM=JM.hasOwnProperty;function GM(t){var e=this.__data__;return au?e[t]!==void 0:KM.call(e,t)}var XM="__lodash_hash_undefined__";function QM(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=au&&e===void 0?XM:e,this}function Nl(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Nl.prototype.clear=zM;Nl.prototype.delete=VM;Nl.prototype.get=WM;Nl.prototype.has=GM;Nl.prototype.set=QM;function YM(){this.__data__=[],this.size=0}function Wd(t,e){for(var n=t.length;n--;)if(Vd(t[n][0],e))return n;return-1}var ZM=Array.prototype,$M=ZM.splice;function eR(t){var e=this.__data__,n=Wd(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():$M.call(e,n,1),--this.size,!0}function tR(t){var e=this.__data__,n=Wd(e,t);return n<0?void 0:e[n][1]}function nR(t){return Wd(this.__data__,t)>-1}function rR(t,e){var n=this.__data__,r=Wd(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function xo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}xo.prototype.clear=YM;xo.prototype.delete=eR;xo.prototype.get=tR;xo.prototype.has=nR;xo.prototype.set=rR;var cu=Ql(as,"Map");function iR(){this.size=0,this.__data__={hash:new Nl,map:new(cu||xo),string:new Nl}}function sR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Jd(t,e){var n=t.__data__;return sR(e)?n[typeof e=="string"?"string":"hash"]:n.map}function oR(t){var e=Jd(this,t).delete(t);return this.size-=e?1:0,e}function lR(t){return Jd(this,t).get(t)}function aR(t){return Jd(this,t).has(t)}function cR(t,e){var n=Jd(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function wo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}wo.prototype.clear=iR;wo.prototype.delete=oR;wo.prototype.get=lR;wo.prototype.has=aR;wo.prototype.set=cR;var uR="Expected a function";function Vv(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(uR);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(Vv.Cache||wo),n}Vv.Cache=wo;var fR=500;function hR(t){var e=Vv(t,function(r){return n.size===fR&&n.clear(),r}),n=e.cache;return e}var dR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pR=/\\(\\)?/g,gR=hR(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(dR,function(n,r,i,s){e.push(i?s.replace(pR,"$1"):r||n)}),e});function Ww(t){return t==null?"":jw(t)}function Jw(t,e){return Dr(t)?t:zv(t,e)?[t]:gR(Ww(t))}function Kd(t){if(typeof t=="string"||Ll(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Hv(t,e){e=Jw(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Kd(e[n++])];return n&&n==r?t:void 0}function mR(t,e,n){var r=t==null?void 0:Hv(t,e);return r===void 0?n:r}function Kw(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var ay=Ni?Ni.isConcatSpreadable:void 0;function vR(t){return Dr(t)||Hd(t)||!!(ay&&t&&t[ay])}function yR(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=vR),i||(i=[]);++s<o;){var l=t[s];n(l)?Kw(i,l):i[i.length]=l}return i}var bR=qw(Object.getPrototypeOf,Object);function xR(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function wR(){this.__data__=new xo,this.size=0}function SR(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function CR(t){return this.__data__.get(t)}function kR(t){return this.__data__.has(t)}var AR=200;function OR(t,e){var n=this.__data__;if(n instanceof xo){var r=n.__data__;if(!cu||r.length<AR-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new wo(r)}return n.set(t,e),this.size=n.size,this}function Is(t){var e=this.__data__=new xo(t);this.size=e.size}Is.prototype.clear=wR;Is.prototype.delete=SR;Is.prototype.get=CR;Is.prototype.has=kR;Is.prototype.set=OR;var Gw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cy=Gw&&typeof module=="object"&&module&&!module.nodeType&&module,_R=cy&&cy.exports===Gw,uy=_R?as.Buffer:void 0;uy&&uy.allocUnsafe;function ER(t,e){return t.slice()}function TR(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function MR(){return[]}var RR=Object.prototype,PR=RR.propertyIsEnumerable,fy=Object.getOwnPropertySymbols,DR=fy?function(t){return t==null?[]:(t=Object(t),TR(fy(t),function(e){return PR.call(t,e)}))}:MR;function IR(t,e,n){var r=e(t);return Dr(t)?r:Kw(r,n(t))}function Yg(t){return IR(t,Ud,DR)}var Zg=Ql(as,"DataView"),$g=Ql(as,"Promise"),em=Ql(as,"Set"),hy="[object Map]",LR="[object Object]",dy="[object Promise]",py="[object Set]",gy="[object WeakMap]",my="[object DataView]",NR=Xl(Zg),jR=Xl(cu),BR=Xl($g),FR=Xl(em),zR=Xl(Xg),Ai=dc;(Zg&&Ai(new Zg(new ArrayBuffer(1)))!=my||cu&&Ai(new cu)!=hy||$g&&Ai($g.resolve())!=dy||em&&Ai(new em)!=py||Xg&&Ai(new Xg)!=gy)&&(Ai=function(t){var e=dc(t),n=e==LR?t.constructor:void 0,r=n?Xl(n):"";if(r)switch(r){case NR:return my;case jR:return hy;case BR:return dy;case FR:return py;case zR:return gy}return e});var VR=Object.prototype,HR=VR.hasOwnProperty;function qR(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&HR.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Lh=as.Uint8Array;function qv(t){var e=new t.constructor(t.byteLength);return new Lh(e).set(new Lh(t)),e}function UR(t,e){var n=qv(t.buffer);return new t.constructor(n,t.byteOffset,t.byteLength)}var WR=/\w*$/;function JR(t){var e=new t.constructor(t.source,WR.exec(t));return e.lastIndex=t.lastIndex,e}var vy=Ni?Ni.prototype:void 0,yy=vy?vy.valueOf:void 0;function KR(t){return yy?Object(yy.call(t)):{}}function GR(t,e){var n=qv(t.buffer);return new t.constructor(n,t.byteOffset,t.length)}var XR="[object Boolean]",QR="[object Date]",YR="[object Map]",ZR="[object Number]",$R="[object RegExp]",eP="[object Set]",tP="[object String]",nP="[object Symbol]",rP="[object ArrayBuffer]",iP="[object DataView]",sP="[object Float32Array]",oP="[object Float64Array]",lP="[object Int8Array]",aP="[object Int16Array]",cP="[object Int32Array]",uP="[object Uint8Array]",fP="[object Uint8ClampedArray]",hP="[object Uint16Array]",dP="[object Uint32Array]";function pP(t,e,n){var r=t.constructor;switch(e){case rP:return qv(t);case XR:case QR:return new r(+t);case iP:return UR(t);case sP:case oP:case lP:case aP:case cP:case uP:case fP:case hP:case dP:return GR(t);case YR:return new r;case ZR:case tP:return new r(t);case $R:return JR(t);case eP:return new r;case nP:return KR(t)}}function gP(t){return typeof t.constructor=="function"&&!Bv(t)?LT(bR(t)):{}}var mP="[object Map]";function vP(t){return qo(t)&&Ai(t)==mP}var by=qa&&qa.isMap,yP=by?qd(by):vP,bP="[object Set]";function xP(t){return qo(t)&&Ai(t)==bP}var xy=qa&&qa.isSet,wP=xy?qd(xy):xP,Xw="[object Arguments]",SP="[object Array]",CP="[object Boolean]",kP="[object Date]",AP="[object Error]",Qw="[object Function]",OP="[object GeneratorFunction]",_P="[object Map]",EP="[object Number]",Yw="[object Object]",TP="[object RegExp]",MP="[object Set]",RP="[object String]",PP="[object Symbol]",DP="[object WeakMap]",IP="[object ArrayBuffer]",LP="[object DataView]",NP="[object Float32Array]",jP="[object Float64Array]",BP="[object Int8Array]",FP="[object Int16Array]",zP="[object Int32Array]",VP="[object Uint8Array]",HP="[object Uint8ClampedArray]",qP="[object Uint16Array]",UP="[object Uint32Array]",On={};On[Xw]=On[SP]=On[IP]=On[LP]=On[CP]=On[kP]=On[NP]=On[jP]=On[BP]=On[FP]=On[zP]=On[_P]=On[EP]=On[Yw]=On[TP]=On[MP]=On[RP]=On[PP]=On[VP]=On[HP]=On[qP]=On[UP]=!0;On[AP]=On[Qw]=On[DP]=!1;function Xc(t,e,n,r,i,s){var o;if(n&&(o=i?n(t,r,i,s):n(t)),o!==void 0)return o;if(!co(t))return t;var l=Dr(t);if(l)o=qR(t);else{var a=Ai(t),u=a==Qw||a==OP;if(lu(t))return ER(t);if(a==Yw||a==Xw||u&&!i)o=u?{}:gP(t);else{if(!On[a])return i?t:{};o=pP(t,a)}}s||(s=new Is);var f=s.get(t);if(f)return f;s.set(t,o),wP(t)?t.forEach(function(p){o.add(Xc(p,e,n,p,t,s))}):yP(t)&&t.forEach(function(p,g){o.set(g,Xc(p,e,n,g,t,s))});var h=Yg,d=l?void 0:h(t);return UT(d||t,function(p,g){d&&(g=p,p=t[g]),XT(o,g,Xc(p,e,n,g,t,s))}),o}var WP=1,JP=4;function tm(t){return Xc(t,WP|JP)}var KP=1,GP=4;function XP(t,e){return e=typeof e=="function"?e:void 0,Xc(t,KP|GP,e)}var QP="__lodash_hash_undefined__";function YP(t){return this.__data__.set(t,QP),this}function ZP(t){return this.__data__.has(t)}function Nh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new wo;++e<n;)this.add(t[e])}Nh.prototype.add=Nh.prototype.push=YP;Nh.prototype.has=ZP;function $P(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function e8(t,e){return t.has(e)}var t8=1,n8=2;function Zw(t,e,n,r,i,s){var o=n&t8,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var u=s.get(t),f=s.get(e);if(u&&f)return u==e&&f==t;var h=-1,d=!0,p=n&n8?new Nh:void 0;for(s.set(t,e),s.set(e,t);++h<l;){var g=t[h],m=e[h];if(r)var v=o?r(m,g,h,e,t,s):r(g,m,h,t,e,s);if(v!==void 0){if(v)continue;d=!1;break}if(p){if(!$P(e,function(y,S){if(!e8(p,S)&&(g===y||i(g,y,n,r,s)))return p.push(S)})){d=!1;break}}else if(!(g===m||i(g,m,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),d}function r8(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function i8(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var s8=1,o8=2,l8="[object Boolean]",a8="[object Date]",c8="[object Error]",u8="[object Map]",f8="[object Number]",h8="[object RegExp]",d8="[object Set]",p8="[object String]",g8="[object Symbol]",m8="[object ArrayBuffer]",v8="[object DataView]",wy=Ni?Ni.prototype:void 0,zp=wy?wy.valueOf:void 0;function y8(t,e,n,r,i,s,o){switch(n){case v8:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case m8:return!(t.byteLength!=e.byteLength||!s(new Lh(t),new Lh(e)));case l8:case a8:case f8:return Vd(+t,+e);case c8:return t.name==e.name&&t.message==e.message;case h8:case p8:return t==e+"";case u8:var l=r8;case d8:var a=r&s8;if(l||(l=i8),t.size!=e.size&&!a)return!1;var u=o.get(t);if(u)return u==e;r|=o8,o.set(t,e);var f=Zw(l(t),l(e),r,i,s,o);return o.delete(t),f;case g8:if(zp)return zp.call(t)==zp.call(e)}return!1}var b8=1,x8=Object.prototype,w8=x8.hasOwnProperty;function S8(t,e,n,r,i,s){var o=n&b8,l=Yg(t),a=l.length,u=Yg(e),f=u.length;if(a!=f&&!o)return!1;for(var h=a;h--;){var d=l[h];if(!(o?d in e:w8.call(e,d)))return!1}var p=s.get(t),g=s.get(e);if(p&&g)return p==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var v=o;++h<a;){d=l[h];var y=t[d],S=e[d];if(r)var k=o?r(S,y,d,e,t,s):r(y,S,d,t,e,s);if(!(k===void 0?y===S||i(y,S,n,r,s):k)){m=!1;break}v||(v=d=="constructor")}if(m&&!v){var C=t.constructor,w=e.constructor;C!=w&&"constructor"in t&&"constructor"in e&&!(typeof C=="function"&&C instanceof C&&typeof w=="function"&&w instanceof w)&&(m=!1)}return s.delete(t),s.delete(e),m}var C8=1,Sy="[object Arguments]",Cy="[object Array]",vf="[object Object]",k8=Object.prototype,ky=k8.hasOwnProperty;function A8(t,e,n,r,i,s){var o=Dr(t),l=Dr(e),a=o?Cy:Ai(t),u=l?Cy:Ai(e);a=a==Sy?vf:a,u=u==Sy?vf:u;var f=a==vf,h=u==vf,d=a==u;if(d&&lu(t)){if(!lu(e))return!1;o=!0,f=!1}if(d&&!f)return s||(s=new Is),o||Fv(t)?Zw(t,e,n,r,i,s):y8(t,e,a,n,r,i,s);if(!(n&C8)){var p=f&&ky.call(t,"__wrapped__"),g=h&&ky.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,v=g?e.value():e;return s||(s=new Is),i(m,v,n,r,s)}}return d?(s||(s=new Is),S8(t,e,n,r,i,s)):!1}function Gd(t,e,n,r,i){return t===e?!0:t==null||e==null||!qo(t)&&!qo(e)?t!==t&&e!==e:A8(t,e,n,r,Gd,i)}var O8=1,_8=2;function E8(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var o=n[i];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=n[i];var l=o[0],a=t[l],u=o[1];if(o[2]){if(a===void 0&&!(l in t))return!1}else{var f=new Is,h;if(!(h===void 0?Gd(u,a,O8|_8,r,f):h))return!1}}return!0}function $w(t){return t===t&&!co(t)}function T8(t){for(var e=Ud(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,$w(i)]}return e}function eS(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function M8(t){var e=T8(t);return e.length==1&&e[0][2]?eS(e[0][0],e[0][1]):function(n){return n===t||E8(n,t,e)}}function R8(t,e){return t!=null&&e in Object(t)}function P8(t,e,n){e=Jw(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var o=Kd(e[r]);if(!(s=t!=null&&n(t,o)))break;t=t[o]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&jv(i)&&Lv(o,i)&&(Dr(t)||Hd(t)))}function D8(t,e){return t!=null&&P8(t,e,R8)}var I8=1,L8=2;function N8(t,e){return zv(t)&&$w(e)?eS(Kd(t),e):function(n){var r=mR(n,t);return r===void 0&&r===e?D8(n,t):Gd(e,r,I8|L8)}}function j8(t){return function(e){return e==null?void 0:e[t]}}function B8(t){return function(e){return Hv(e,t)}}function F8(t){return zv(t)?j8(Kd(t)):B8(t)}function Wu(t){return typeof t=="function"?t:t==null?qu:typeof t=="object"?Dr(t)?N8(t[0],t[1]):M8(t):F8(t)}function z8(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function tS(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),l=o.length;l--;){var a=o[t?l:++i];if(n(s[a],a,s)===!1)break}return e}}var V8=tS();function nS(t,e){return t&&V8(t,e,Ud)}function rS(t,e){return function(n,r){if(n==null)return n;if(!Uu(n))return t(n,r);for(var i=n.length,s=e?i:-1,o=Object(n);(e?s--:++s<i)&&r(o[s],s,o)!==!1;);return n}}var iS=rS(nS);function H8(t,e,n,r){return iS(t,function(i,s,o){e(r,i,n(i),o)}),r}function sS(t,e){return function(n,r){var i=Dr(n)?z8:H8,s=e?e():{};return i(n,t,Wu(r),s)}}var Vp=function(){return as.Date.now()},q8="Expected a function",U8=Math.max,W8=Math.min;function jh(t,e,n){var r,i,s,o,l,a,u=0,f=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError(q8);e=Gg(e)||0,co(n)&&(f=!!n.leading,h="maxWait"in n,s=h?U8(Gg(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d);function p(E){var A=r,O=i;return r=i=void 0,u=E,o=t.apply(O,A),o}function g(E){return u=E,l=setTimeout(y,e),f?p(E):o}function m(E){var A=E-a,O=E-u,H=e-A;return h?W8(H,s-O):H}function v(E){var A=E-a,O=E-u;return a===void 0||A>=e||A<0||h&&O>=s}function y(){var E=Vp();if(v(E))return S(E);l=setTimeout(y,m(E))}function S(E){return l=void 0,d&&r?p(E):(r=i=void 0,o)}function k(){l!==void 0&&clearTimeout(l),u=0,r=a=i=l=void 0}function C(){return l===void 0?o:S(Vp())}function w(){var E=Vp(),A=v(E);if(r=arguments,i=this,a=E,A){if(l===void 0)return g(a);if(h)return clearTimeout(l),l=setTimeout(y,e),p(a)}return l===void 0&&(l=setTimeout(y,e)),o}return w.cancel=k,w.flush=C,w}function Ot(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function oS(t){return typeof t=="function"?t:qu}function J8(t,e){for(var n=t==null?0:t.length;n--&&e(t[n],n,t)!==!1;);return t}var K8=tS(!0);function G8(t,e){return t&&K8(t,e,Ud)}var X8=rS(G8,!0);function Q8(t,e){var n=Dr(t)?J8:X8;return n(t,oS(e))}function ro(t){return t&&t.length?t[0]:void 0}function lS(t,e){var n=-1,r=Uu(t)?Array(t.length):[];return iS(t,function(i,s,o){r[++n]=e(i,s,o)}),r}function Y8(t,e){var n=Dr(t)?Kc:lS;return n(t,Wu(e))}var Z8=Object.prototype,$8=Z8.hasOwnProperty,e5=sS(function(t,e,n){$8.call(t,n)?t[n].push(e):Nv(t,n,[e])});function Lt(t){var e=t==null?0:t.length;return e?xR(t,0,-1):[]}var t5="[object Map]",n5="[object Set]",r5=Object.prototype,i5=r5.hasOwnProperty;function Yt(t){if(t==null)return!0;if(Uu(t)&&(Dr(t)||typeof t=="string"||typeof t.splice=="function"||lu(t)||Fv(t)||Hd(t)))return!t.length;var e=Ai(t);if(e==t5||e==n5)return!t.size;if(Bv(t))return!Uw(t).length;for(var n in t)if(i5.call(t,n))return!1;return!0}function Pt(t,e){return Gd(t,e)}function s5(t,e){return t<e}function o5(t,e){var n={};return e=Wu(e),nS(t,function(r,i,s){Nv(n,i,e(r,i,s))}),n}function l5(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],o=e(s);if(o!=null&&(l===void 0?o===o&&!Ll(o):n(o,l)))var l=o,a=s}return a}function yf(t,e){return t&&t.length?l5(t,Wu(e),s5):void 0}function a5(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}function c5(t,e){if(t!==e){var n=t!==void 0,r=t===null,i=t===t,s=Ll(t),o=e!==void 0,l=e===null,a=e===e,u=Ll(e);if(!l&&!u&&!s&&t>e||s&&o&&a&&!l&&!u||r&&o&&a||!n&&a||!i)return 1;if(!r&&!s&&!u&&t<e||u&&n&&i&&!r&&!s||l&&n&&i||!o&&i||!a)return-1}return 0}function u5(t,e,n){for(var r=-1,i=t.criteria,s=e.criteria,o=i.length,l=n.length;++r<o;){var a=c5(i[r],s[r]);if(a){if(r>=l)return a;var u=n[r];return a*(u=="desc"?-1:1)}}return t.index-e.index}function f5(t,e,n){e.length?e=Kc(e,function(s){return Dr(s)?function(o){return Hv(o,s.length===1?s[0]:s)}:s}):e=[qu];var r=-1;e=Kc(e,qd(Wu));var i=lS(t,function(s,o,l){var a=Kc(e,function(u){return u(s)});return{criteria:a,index:++r,value:s}});return a5(i,function(s,o){return u5(s,o,n)})}var h5=sS(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),d5=Math.ceil,p5=Math.max;function g5(t,e,n,r){for(var i=-1,s=p5(d5((e-t)/(n||1)),0),o=Array(s);s--;)o[++i]=t,t+=n;return o}function m5(t){return function(e,n,r){return r&&typeof r!="number"&&Qg(e,n,r)&&(n=r=void 0),e=ih(e),n===void 0?(n=e,e=0):n=ih(n),r=r===void 0?e<n?1:-1:ih(r),g5(e,n,r)}}var aS=m5(),v5=YT(function(t,e){if(t==null)return[];var n=e.length;return n>1&&Qg(t,e[0],e[1])?e=[]:n>2&&Qg(e[0],e[1],e[2])&&(e=[e[0]]),f5(t,yR(e),[])}),y5=9007199254740991,Hp=4294967295,b5=Math.min;function Ay(t,e){if(t=yT(t),t<1||t>y5)return[];var n=Hp,r=b5(t,Hp);e=oS(e),t-=Hp;for(var i=Fw(r,e);++n<t;)e(n);return i}var x5=0;function Ua(t){var e=++x5;return Ww(t)+e}const w5=1e4,S5=[];function Oy(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function nm(t,e=!1){const n={};if(!Array.isArray(t))throw new TypeError("Array expected");function r(o,l){(!Array.isArray(o)&&!Kt(o)||e&&l.length>0)&&(n[tt(l)]=!0),Kt(o)&&Object.keys(o).forEach(u=>{r(o[u],l.concat(u))})}const i=Math.min(t.length,w5);for(let o=0;o<i;o++){const l=t[o];r(l,S5)}return Object.keys(n).sort().map(Li)}function cS(t,e,n){if(!(e<=t))for(let r=t;r<e;r++)n(r)}function uS(t,e){return t.length>e?t.slice(0,e):t}function _y(t){return{...t}}function Ey(t){return Object.values(t)}function Ty(t,e,n,r){const i=t.slice(0),s=i.splice(e,n);return i.splice.apply(i,[e+r,0,...s]),i}function C5(t,e,n){if(t.length<e)t.forEach(n);else{const r=e>1?(t.length-1)/(e-1):t.length;for(let i=0;i<e;i++){const s=Math.floor(i*r);n(t[s],s,t)}}}function k5(t,e,n){return t.slice(0,e).concat(n).concat(t.slice(e))}function A5(t,e=Pt){return t.filter((n,r)=>{for(let i=r+1;i<t.length;i++)if(e(n,t[i]))return!1;return!0})}function Ju(t,e){try{return e.parse(t)}catch{return e.parse(Ds(t))}}function fS(t,e){try{return Ju(t,e)}catch{return}}function Xd(t,e){t=t.replace(dS,"");try{return e(t)}catch{}try{return e("{"+t+"}")}catch{}try{return e("["+t+"]")}catch{}throw new Error("Failed to parse partial JSON")}function hS(t){t=t.replace(dS,"");try{return Ds(t)}catch{}try{const e=Ds("["+t+"]");return e.substring(1,e.length-1)}catch{}try{const e=Ds("{"+t+"}");return e.substring(1,e.length-1)}catch{}throw new Error("Failed to repair partial JSON")}const dS=/,\s*$/;function Wa(t,e){const n=Ry.exec(e);if(n){const r=mr(n[2]),i=_5(t,`
|
|
19
|
-
`,0,r),s=t.lastIndexOf(`
|
|
20
|
-
`,r),o=r-s-1;return{position:r,line:i,column:o,message:e.replace(Ry,()=>`line ${i+1} column ${o+1}`)}}else{const r=D5.exec(e),i=r?mr(r[1]):void 0,s=i!==void 0?i-1:void 0,o=I5.exec(e),l=o?mr(o[1]):void 0,a=l!==void 0?l-1:void 0;return{position:s!==void 0&&a!==void 0?O5(t,s,a):void 0,line:s,column:a,message:e.replace(/^JSON.parse: /,"").replace(/ of the JSON data$/,"")}}}function O5(t,e,n){let r=t.indexOf(`
|
|
21
|
-
`),i=1;for(;i<e&&r!==-1;)r=t.indexOf(`
|
|
22
|
-
`,r+1),i++;return r!==-1?r+n+1:void 0}function _5(t,e,n=0,r=t.length){let i=0;for(let s=n;s<r;s++)t.charAt(s)===e&&i++;return i}function E5(t,e){try{const n=Tw.parse(t),r=tt(e),i=n.pointers[r];if(i)return{path:e,line:i.key?i.key.line:i.value?i.value.line:0,column:i.key?i.key.column:i.value?i.value.column:0,from:i.key?i.key.pos:i.value?i.value.pos:0,to:i.keyEnd?i.keyEnd.pos:i.valueEnd?i.valueEnd.pos:0}}catch(n){console.error(n)}return{path:e,line:0,column:0,from:0,to:0}}function T5(t,e,n){if(e==="array"){if(Array.isArray(t))return t;if(Kt(t))return Ey(t);if(typeof t=="string")try{const r=n.parse(t);if(Array.isArray(r))return r;if(Kt(r))return Ey(r)}catch{return[t]}return[t]}if(e==="object"){if(Array.isArray(t))return _y(t);if(Kt(t))return t;if(typeof t=="string")try{const r=n.parse(t);if(Kt(r))return r;if(Array.isArray(r))return _y(r)}catch{return{value:t}}return{value:t}}if(e==="value")return Vn(t)?n.stringify(t):t;throw new Error(`Cannot convert ${Iv(t,n)} to ${e}`)}function qp(t){return Kt(t)?t.json!==void 0?t.text!==void 0?'Content must contain either a property "json" or a property "text" but not both':void 0:t.text===void 0?'Content must contain either a property "json" or a property "text"':typeof t.text!="string"?'Content "text" property must be a string containing a JSON document. Did you mean to use the "json" property instead?':void 0:"Content must be an object"}function uu(t){return Kt(t)&&typeof t.text=="string"}function fu(t){return Kt(t)&&typeof t.json<"u"}function M5(t,e=void 0,n=JSON){return uu(t)?t:{text:n.stringify(t.json,null,e)}}function My(t,e=JSON){return fu(t)?t:{json:e.parse(t.text)}}function rm(t,e,n){return M5(t,e,n).text}function R5(t,e){return P5(t,e)>e}function P5(t,e=1/0){if(uu(t))return t.text.length;const n=t.json;let r=0;function i(s){if(Array.isArray(s)){if(r+=2+(s.length-1),r>e)return;for(let o=0;o<s.length;o++){const l=s[o];if(i(l),r>e)return}}else if(Kt(s)){const o=Object.keys(s);r+=2+o.length+(o.length-1);for(let l=0;l<o.length;l++){const a=o[l],u=s[a];r+=a.length+2,i(u)}}else typeof s=="string"?r+=s.length+2:r+=String(s).length}return i(n),r}const Ry=/(position|char) (\d+)/,D5=/line (\d+)/,I5=/column (\d+)/;function L5(t,e){return t.parse===e.parse&&t.stringify===e.stringify}function N5(t){const n=t.substring(0,999).trim();return!n.includes(`
|
|
23
|
-
`)&&j5.test(n)}const j5=/[,:]\S/;var $n;(function(t){t.text="text",t.tree="tree",t.table="table"})($n||($n={}));var Zt;(function(t){t.after="after",t.inside="inside",t.key="key",t.value="value",t.multi="multi",t.text="text"})(Zt||(Zt={}));var Wi;(function(t){t.after="after",t.key="key",t.value="value",t.inside="inside"})(Wi||(Wi={}));var Yi;(function(t){t.info="info",t.warning="warning",t.error="error"})(Yi||(Yi={}));var Zi;(function(t){t.key="key",t.value="value"})(Zi||(Zi={}));var Ji;(function(t){t.asc="asc",t.desc="desc"})(Ji||(Ji={}));var Bo;(function(t){t.no="no",t.self="self",t.nextInside="nextInside"})(Bo||(Bo={}));function Uv({escapeControlCharacters:t,escapeUnicodeCharacters:e}){return t?e?B5:F5:e?z5:V5}const B5={escapeValue:t=>pS(vS(String(t))),unescapeValue:t=>yS(gS(t))},F5={escapeValue:t=>vS(String(t)),unescapeValue:t=>yS(t)},z5={escapeValue:t=>pS(String(t)),unescapeValue:t=>gS(t)},V5={escapeValue:t=>String(t),unescapeValue:t=>t};function pS(t){return t.replace(/[^\x20-\x7F]/g,e=>{var n;return e==="\b"||e==="\f"||e===`
|
|
24
|
-
`||e==="\r"||e===" "?e:"\\u"+("000"+((n=e.codePointAt(0))==null?void 0:n.toString(16))).slice(-4)})}function gS(t){return t.replace(/\\u[a-fA-F0-9]{4}/g,e=>{try{const n=JSON.parse('"'+e+'"');return mS[n]||n}catch{return e}})}const mS={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},H5={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
|
|
25
|
-
`,"\\r":"\r","\\t":" "};function vS(t){return t.replace(/["\b\f\n\r\t\\]/g,e=>mS[e]||e)}function yS(t){return t.replace(/\\["bfnrt\\]/g,e=>H5[e]||e)}function Qd(t){return typeof t!="string"?String(t):t.endsWith(`
|
|
26
|
-
`)?t+`
|
|
27
|
-
`:t}function q5(t){return t.replace(/\n$/,"")}function bS(t,e){return pc(t,n=>n.nodeName.toUpperCase()===e.toUpperCase())}function Po(t,e,n){return pc(t,r=>W5(r,e,n))}function U5(t){return t.nodeName==="DIV"&&t.contentEditable==="true"}function W5(t,e,n){return typeof t.getAttribute=="function"&&t.getAttribute(e)===n}function pc(t,e){return!!Wv(t,e)}function Wv(t,e){let n=t;for(;n&&!e(n);)n=n.parentNode;return n}function J5(t){if(t.firstChild==null){t.focus();return}const e=document.createRange(),n=window.getSelection();e.setStart(t,1),e.collapse(!0),n==null||n.removeAllRanges(),n==null||n.addRange(e)}function Ku(t){var e;return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??void 0}function Jv(t){const e=Ku(t),n=e==null?void 0:e.document.activeElement;return n?pc(n,r=>r===t):!1}function xS(t,e){return Wv(t,n=>n.nodeName===e)}function Up(t){return Po(t,"data-type","selectable-key")?Zt.key:Po(t,"data-type","selectable-value")?Zt.value:Po(t,"data-type","insert-selection-area-inside")?Zt.inside:Po(t,"data-type","insert-selection-area-after")?Zt.after:Zt.multi}function im(t){return encodeURIComponent(tt(t))}function K5(t){return Li(decodeURIComponent(t))}function wS(t){const e=Wv(t,r=>r!=null&&r.hasAttribute?r.hasAttribute("data-path"):!1),n=(e==null?void 0:e.getAttribute("data-path"))??void 0;return n?K5(n):void 0}function G5({allElements:t,currentElement:e,direction:n,hasPrio:r=()=>!0,margin:i=10}){const s=Y8(t.filter(l),a),o=a(e);function l(y){const S=y.getBoundingClientRect();return S.width>0&&S.height>0}function a(y){const S=y.getBoundingClientRect();return{x:S.left+S.width/2,y:S.top+S.height/2,rect:S,element:y}}const u=(y,S)=>Math.abs(y.y-S.y)<i,f=(y,S)=>y.rect.left+i<S.rect.left,h=(y,S)=>y.rect.right>S.rect.right+i,d=(y,S)=>y.y+i<S.y,p=(y,S)=>y.y>S.y+i;function g(y,S,k=1){const C=y.x-S.x,w=(y.y-S.y)*k;return Math.sqrt(C*C+w*w)}const m=y=>g(y,o),v=y=>g(y,o,10);if(n==="Left"||n==="Right"){const y=n==="Left"?s.filter(C=>f(C,o)):s.filter(C=>h(C,o)),S=y.filter(C=>u(C,o)),k=yf(S,m)||yf(y,v);return k==null?void 0:k.element}if(n==="Up"||n==="Down"){const y=n==="Up"?s.filter(C=>d(C,o)):s.filter(C=>p(C,o)),S=y.filter(C=>r(C.element)),k=yf(S,m)||yf(y,m);return k==null?void 0:k.element}}function Kv(){var t,e,n;return typeof navigator<"u"&&(((t=navigator==null?void 0:navigator.platform)==null?void 0:t.toUpperCase().includes("MAC"))??((n=(e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.platform)==null?void 0:n.toUpperCase().includes("MAC"))??!1)}function uo(t,e="+",n=Kv){const r=[];Gv(t,n)&&r.push("Ctrl"),t.altKey&&r.push("Alt"),t.shiftKey&&r.push("Shift");const i=t.key.length===1?t.key.toUpperCase():t.key;return i in X5||r.push(i),r.join(e)}function Gv(t,e=Kv){return t.ctrlKey||t.metaKey&&e()}const X5={Ctrl:!0,Command:!0,Control:!0,Alt:!0,Option:!0,Shift:!0};var Q5=J('<div class="jse-absolute-popup-content svelte-1r8q3m8"><input type="text" readonly="" tabindex="-1" class="jse-hidden-input svelte-1r8q3m8"> <!></div>'),Y5=J('<div role="none" class="jse-absolute-popup svelte-1r8q3m8"><!></div>');function Z5(t,e){Ge(e,!1);let n=x(e,"popup",8),r=x(e,"closeAbsolutePopup",8),i=R(),s=R();Cr(d);function o(v){n().options&&n().options.closeOnOuterClick&&!pc(v.target,y=>y===c(i))&&r()(n().id)}function l(v){o(v)}function a(v){v.stopPropagation()}function u(v){uo(v)==="Escape"&&(v.preventDefault(),v.stopPropagation(),r()(n().id))}function f(v){o(v)}function h(v,y){function S(){if(y.anchor){const{anchor:W,width:G=0,height:V=0,offsetTop:U=0,offsetLeft:Q=0,position:Y}=y,{left:ie,top:F,bottom:X,right:I}=W.getBoundingClientRect(),se=Y==="top"||F+V>window.innerHeight&&F>V,ce=Y==="left"||ie+G>window.innerWidth&&ie>G;return{left:ce?I-Q:ie+Q,top:se?F-U:X+U,positionAbove:se,positionLeft:ce}}else if(typeof y.left=="number"&&typeof y.top=="number"){const{left:W,top:G,width:V=0,height:U=0}=y,Q=G+U>window.innerHeight&&G>U,Y=W+V>window.innerWidth&&W>V;return{left:W,top:G,positionAbove:Q,positionLeft:Y}}else throw new Error('Invalid config: pass either "left" and "top", or pass "anchor"')}const k=v.getBoundingClientRect(),{left:C,top:w,positionAbove:E,positionLeft:A}=S(),O=E?`bottom: ${k.top-w}px;`:`top: ${w-k.top}px;`,H=A?`right: ${k.left-C}px;`:`left: ${C-k.left}px;`;return O+H}function d(){c(s)&&c(s).focus()}st();var p=Y5();ae("mousedown",to,l,!0),ae("keydown",to,u,!0),ae("wheel",to,f,!0);var g=M(p);{var m=v=>{var y=Q5(),S=M(y);gn(S,C=>b(s,C),()=>c(s));var k=N(S,2);z2(k,()=>n().component,(C,w)=>{w(C,jo(()=>n().props))}),xe(C=>Gi(y,C),[()=>h(c(i),n().options)],he),D(v,y)};te(g,v=>{c(i)&&v(m)})}gn(p,v=>b(i,v),()=>c(i)),ae("mousedown",p,a),ae("keydown",p,u),D(t,p),Xe()}var $5=J("<!> <!>",1);function Xv(t,e){Ge(e,!1);const n=rr("jsoneditor:AbsolutePopup");let r=R([],!0);function i(u,f,h){n("open...",f,h);const d={id:xa(),component:u,props:f||{},options:h||{}};return b(r,[...c(r),d]),d.id}function s(u){const f=c(r).findIndex(h=>h.id===u);if(f!==-1){const h=c(r)[f];h.options.onClose&&h.options.onClose(),b(r,c(r).filter(d=>d.id!==u))}}x3("absolute-popup",{openAbsolutePopup:i,closeAbsolutePopup:s}),K(()=>c(r),()=>{n("popups",c(r))}),Vt(),st(!0);var o=$5(),l=$e(o);Sn(l,1,()=>c(r),Ln,(u,f)=>{Z5(u,{get popup(){return c(f)},closeAbsolutePopup:s})});var a=N(l,2);Pn(a,e,"default",{},null),D(t,o),Xe()}const Yd=t=>Array.isArray(t),eD=t=>t&&typeof t=="object"&&!Yd(t),tD=t=>typeof t=="string";function Xn(t){return(...e)=>{const n=e.map(s=>ar(s)),r=n[0],i=n[1];return n.length===1?s=>t(r(s)):n.length===2?s=>t(r(s),i(s)):s=>t(...n.map(o=>o(s)))}}const vl={pipe:(...t)=>{const e=t.map(n=>ar(n));return n=>e.reduce((r,i)=>i(r),n)},object:t=>{const e=Object.keys(t).map(n=>[n,ar(t[n])]);return n=>{const r={};for(const[i,s]of e)r[i]=s(n);return r}},array:(...t)=>{const e=t.map(n=>ar(n));return n=>e.map(r=>r(n))},get:(...t)=>{if(t.length===0)return e=>e??null;if(t.length===1){const e=t[0];return n=>(n==null?void 0:n[e])??null}return e=>{let n=e;for(const r of t)n=n==null?void 0:n[r];return n??null}},map:t=>{const e=ar(t);return n=>n.map(e)},mapObject:t=>{const e=ar(t);return n=>{const r={};for(const i of Object.keys(n)){const s=e({key:i,value:n[i]});r[s.key]=s.value}return r}},mapKeys:t=>{const e=ar(t);return n=>{const r={};for(const i of Object.keys(n)){const s=e(i);r[s]=n[i]}return r}},mapValues:t=>{const e=ar(t);return n=>{const r={};for(const i of Object.keys(n))r[i]=e(n[i]);return r}},filter:t=>{const e=ar(t);return n=>n.filter(r=>Py(e(r)))},sort:(t=["get"],e)=>{const n=ar(t),r=e==="desc"?-1:1;function i(s,o){const l=n(s),a=n(o);return l>a?r:l<a?-r:0}return s=>s.slice().sort(i)},reverse:()=>t=>t.toReversed(),pick:(...t)=>{const e=t.map(([r,...i])=>[i[i.length-1],vl.get(...i)]),n=(r,i)=>{const s={};for(const[o,l]of i)s[o]=l(r);return s};return r=>Yd(r)?r.map(i=>n(i,e)):n(r,e)},groupBy:t=>{const e=ar(t);return n=>{const r={};for(const i of n){const s=e(i);r[s]?r[s].push(i):r[s]=[i]}return r}},keyBy:t=>{const e=ar(t);return n=>{const r={};for(const i of n){const s=e(i);s in r||(r[s]=i)}return r}},flatten:()=>t=>t.flat(),join:(t="")=>e=>e.join(t),split:Xn((t,e)=>e!==void 0?t.split(e):t.trim().split(/\s+/)),substring:Xn((t,e,n)=>t.slice(Math.max(e,0),n)),uniq:()=>t=>[...new Set(t)],uniqBy:t=>e=>Object.values(vl.keyBy(t)(e)),limit:t=>e=>e.slice(0,Math.max(t,0)),size:()=>t=>t.length,keys:()=>Object.keys,values:()=>Object.values,prod:()=>t=>t.reduce((e,n)=>e*n),sum:()=>t=>t.reduce((e,n)=>e+n),average:()=>t=>vl.sum()(t)/t.length,min:()=>t=>Math.min(...t),max:()=>t=>Math.max(...t),and:Xn((t,e)=>!!(t&&e)),or:Xn((t,e)=>!!(t||e)),not:Xn(t=>!t),exists:t=>{const e=t.slice(1),n=e.pop(),r=vl.get(...e);return i=>{const s=r(i);return!!s&&Object.hasOwnProperty.call(s,n)}},if:(t,e,n)=>{const r=ar(t),i=ar(e),s=ar(n);return o=>Py(r(o))?i(o):s(o)},in:(t,e)=>{const n=ar(t),r=ar(e);return i=>r(i).includes(n(i))},"not in":(t,e)=>{const n=vl.in(t,e);return r=>!n(r)},regex:(t,e,n)=>{const r=new RegExp(e,n),i=ar(t);return s=>r.test(i(s))},eq:Xn((t,e)=>t===e),gt:Xn((t,e)=>t>e),gte:Xn((t,e)=>t>=e),lt:Xn((t,e)=>t<e),lte:Xn((t,e)=>t<=e),ne:Xn((t,e)=>t!==e),add:Xn((t,e)=>t+e),subtract:Xn((t,e)=>t-e),multiply:Xn((t,e)=>t*e),divide:Xn((t,e)=>t/e),pow:Xn((t,e)=>t**e),mod:Xn((t,e)=>t%e),abs:Xn(Math.abs),round:Xn((t,e=0)=>+`${Math.round(+`${t}e${e}`)}e${-e}`),number:Xn(t=>{const e=Number(t);return Number.isNaN(Number(t))?null:e}),string:Xn(String)},Py=t=>t!==null&&t!==0&&t!==!1,bf=[];function ar(t,e){bf.unshift({...vl,...bf[0]});try{const n=Yd(t)?nD(t,bf[0]):eD(t)?SS(`Function notation ["object", {...}] expected but got ${JSON.stringify(t)}`):()=>t;return r=>{try{return n(r)}catch(i){throw i.jsonquery=[{data:r,query:t},...i.jsonquery??[]],i}}}finally{bf.shift()}}function nD(t,e){const[n,...r]=t,i=e[n];return i||SS(`Unknown function '${n}'`),i(...r)}function SS(t){throw new Error(t)}const CS={and:"and",or:"or",eq:"==",gt:">",gte:">=",lt:"<",lte:"<=",ne:"!=",add:"+",subtract:"-",multiply:"*",divide:"/",pow:"^",mod:"%",in:"in","not in":"not in"},rD=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,iD=/^[a-zA-Z_$][a-zA-Z\d_$]*/,sD=/^"(?:[^"\\]|\\.)*"/,oD=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/,lD=/^(0|[1-9][0-9]*)/,aD=/^(true|false|null)/,cD=/^[ \n\t\r]+/;function kS(t,e){const n={...CS},r=Object.keys(n).sort((A,O)=>O.length-A.length),i=()=>{S();const A=s();if(S(),t[w]==="|"){const O=[A];for(;t[w]==="|";)w++,S(),O.push(s());return["pipe",...O]}return A},s=()=>{const A=o();S();for(const O of r){const H=n[O];if(t.substring(w,w+H.length)===H){w+=H.length,S();const W=o();return[O,A,W]}}return A},o=()=>{if(t[w]==="("){w++;const A=i();return k(")"),A}return l()},l=()=>{if(t[w]==="."){const A=[];for(;t[w]===".";)w++,A.push(h()??d()??g()??C("Property expected"));return["get",...A]}return a()},a=()=>{const A=w,O=d();if(S(),!O||t[w]!=="(")return w=A,u();w++,!vl[O]&&C(`Unknown function '${O}'`),S();const H=t[w]!==")"?[i()]:[];for(;w<t.length&&t[w]!==")";)S(),k(","),H.push(i());return k(")"),[O,...H]},u=()=>{if(t[w]==="{"){w++,S();const A={};let O=!0;for(;w<t.length&&t[w]!=="}";){O?O=!1:(k(","),S());const H=h()??d()??g()??C("Key expected");S(),k(":"),A[H]=i()}return k("}"),["object",A]}return f()},f=()=>{if(t[w]==="["){w++,S();const A=[];let O=!0;for(;w<t.length&&t[w]!=="]";)O?O=!1:(k(","),S()),A.push(i());return k("]"),["array",...A]}return h()??p()??m()},h=()=>y(sD,JSON.parse),d=()=>y(iD,A=>A),p=()=>y(oD,JSON.parse),g=()=>y(lD,JSON.parse),m=()=>{const A=y(aD,JSON.parse);if(A!==void 0)return A;C("Value expected")},v=()=>{S(),w<t.length&&C(`Unexpected part '${t.substring(w)}'`)},y=(A,O)=>{const H=t.substring(w).match(A);if(H)return w+=H[0].length,O(H[0])},S=()=>y(cD,A=>A),k=A=>{t[w]!==A&&C(`Character '${A}' expected`),w++},C=(A,O=w)=>{throw new SyntaxError(`${A} (pos: ${O})`)};let w=0;const E=i();return v(),E}const uD=40,fD=" ",hD=(t,e)=>{const n=fD,r=(u,f)=>Yd(u)?i(u,f):JSON.stringify(u),i=(u,f)=>{var h;const[d,...p]=u;if(d==="get"&&p.length>0)return o(p);if(d==="pipe"){const y=p.map(S=>r(S,f+n));return a(y,[""," | ",""],["",`
|
|
28
|
-
${f+n}| `,""])}if(d==="object")return s(p[0],f);if(d==="array"){const y=p.map(S=>r(S,f));return a(y,["[",", ","]"],[`[
|
|
29
|
-
${f+n}`,`,
|
|
30
|
-
${f+n}`,`
|
|
31
|
-
${f}]`])}const g=((h=void 0)==null?void 0:h[d])??CS[d];if(g&&p.length===2){const[y,S]=p,k=r(y,f),C=r(S,f);return`(${k} ${g} ${C})`}const m=p.length===1?f:f+n,v=p.map(y=>r(y,m));return p.length===1&&v[0][0]==="("?`${d}${v[0]}`:a(v,[`${d}(`,", ",")"],p.length===1?[`${d}(`,`,
|
|
32
|
-
${f}`,")"]:[`${d}(
|
|
33
|
-
${m}`,`,
|
|
34
|
-
${m}`,`
|
|
35
|
-
${f})`])},s=(u,f)=>{const h=f+n,d=Object.entries(u).map(([p,g])=>`${l(p)}: ${r(g,h)}`);return a(d,["{ ",", "," }"],[`{
|
|
36
|
-
${h}`,`,
|
|
37
|
-
${h}`,`
|
|
38
|
-
${f}}`])},o=u=>u.map(f=>`.${l(f)}`).join(""),l=u=>rD.test(u)?u:JSON.stringify(u),a=(u,[f,h,d],[p,g,m])=>f.length+u.reduce((v,y)=>v+y.length+h.length,0)-h.length+d.length<=uD?f+u.join(h)+d:p+u.join(g)+m;return r(t,"")};function dD(t,e,n){return ar(tD(e)?kS(e):e)(t)}function Gu(t,e){const n=new Set(e),r=t.replace(/ \(copy( \d+)?\)$/,"");let i=t,s=1;for(;n.has(i);){const o="copy"+(s>1?" "+s:"");i=`${r} (${o})`,s++}return i}function Xu(t,e){const n="...",r=e-n.length;return t.length>e?t.substring(0,r)+n:t}function pD(t){if(t==="")return"";const e=t.toLowerCase();if(e==="null")return null;if(e==="true")return!0;if(e==="false")return!1;if(e==="undefined")return;const n=Number(t),r=parseFloat(t);return!isNaN(n)&&!isNaN(r)?n:t}const gD=`
|
|
39
|
-
<p>
|
|
40
|
-
Enter a <a href="https://jsonquerylang.org" target="_blank"
|
|
41
|
-
rel="noopener noreferrer">JSON Query</a> function to filter, sort, or transform the data.
|
|
42
|
-
You can use functions like <code>get</code>, <code>filter</code>,
|
|
43
|
-
<code>sort</code>, <code>pick</code>, <code>groupBy</code>, <code>uniq</code>, etcetera.
|
|
44
|
-
Example query: <code>filter(.age >= 18)</code>
|
|
45
|
-
</p>
|
|
46
|
-
`,mD={id:"jsonquery",name:"JSONQuery",description:gD,createQuery:vD,executeQuery:yD};function vD(t,e){const{filter:n,sort:r,projection:i}=e,s=[];return n&&n.path&&n.relation&&n.value&&s.push(["filter",[bD(n.relation),xf(n.path),pD(n.value)]]),r&&r.path&&r.direction&&s.push(["sort",xf(r.path),r.direction==="desc"?"desc":"asc"]),i&&i.paths&&(i.paths.length>1?s.push(["pick",...i.paths.map(xf)]):s.push(["map",xf(i.paths[0])])),hD(["pipe",...s])}function xf(t){return["get",...t]}function yD(t,e){return e.trim()!==""?dD(t,e):t}function bD(t){return kS(`1 ${t} 1`)[0]}/*!
|
|
47
|
-
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
|
48
|
-
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
49
|
-
* Copyright 2024 Fonticons, Inc.
|
|
50
|
-
*/const xD={prefix:"far",iconName:"lightbulb",icon:[384,512,[128161],"f0eb","M297.2 248.9C311.6 228.3 320 203.2 320 176c0-70.7-57.3-128-128-128S64 105.3 64 176c0 27.2 8.4 52.3 22.8 72.9c3.7 5.3 8.1 11.3 12.8 17.7c0 0 0 0 0 0c12.9 17.7 28.3 38.9 39.8 59.8c10.4 19 15.7 38.8 18.3 57.5L109 384c-2.2-12-5.9-23.7-11.8-34.5c-9.9-18-22.2-34.9-34.5-51.8c0 0 0 0 0 0s0 0 0 0c-5.2-7.1-10.4-14.2-15.4-21.4C27.6 247.9 16 213.3 16 176C16 78.8 94.8 0 192 0s176 78.8 176 176c0 37.3-11.6 71.9-31.4 100.3c-5 7.2-10.2 14.3-15.4 21.4c0 0 0 0 0 0s0 0 0 0c-12.3 16.8-24.6 33.7-34.5 51.8c-5.9 10.8-9.6 22.5-11.8 34.5l-48.6 0c2.6-18.7 7.9-38.6 18.3-57.5c11.5-20.9 26.9-42.1 39.8-59.8c0 0 0 0 0 0s0 0 0 0s0 0 0 0c4.7-6.4 9-12.4 12.7-17.7zM192 128c-26.5 0-48 21.5-48 48c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-44.2 35.8-80 80-80c8.8 0 16 7.2 16 16s-7.2 16-16 16zm0 384c-44.2 0-80-35.8-80-80l0-16 160 0 0 16c0 44.2-35.8 80-80 80z"]},wD={prefix:"far",iconName:"square-check",icon:[448,512,[9745,9989,61510,"check-square"],"f14a","M64 80c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l320 0c8.8 0 16-7.2 16-16l0-320c0-8.8-7.2-16-16-16L64 80zM0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]},AS=wD,OS={prefix:"far",iconName:"square",icon:[448,512,[9632,9723,9724,61590],"f0c8","M384 80c8.8 0 16 7.2 16 16l0 320c0 8.8-7.2 16-16 16L64 432c-8.8 0-16-7.2-16-16L48 96c0-8.8 7.2-16 16-16l320 0zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"]},SD={prefix:"far",iconName:"clock",icon:[512,512,[128339,"clock-four"],"f017","M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"]};var CD=tl("<g><!></g>");function kD(t,e){Ge(e,!1);let n=870711;function r(){return n+=1,`fa-${n.toString(16)}`}let i=R(""),s=x(e,"data",8);function o(u){if(!u||!u.raw)return"";let f=u.raw;const h={};return f=f.replace(/\s(?:xml:)?id=["']?([^"')\s]+)/g,(d,p)=>{const g=r();return h[p]=g,` id="${g}"`}),f=f.replace(/#(?:([^'")\s]+)|xpointer\(id\((['"]?)([^')]+)\2\)\))/g,(d,p,g,m)=>{const v=p||m;return!v||!h[v]?d:`#${h[v]}`}),f}K(()=>P(s()),()=>{b(i,o(s()))}),Vt();var l=CD(),a=M(l);F2(a,()=>c(i),!0),D(t,l),Xe()}var AD=tl("<svg><!></svg>");function OD(t,e){const n=Rh(e,["children","$$slots","$$events","$$legacy"]),r=Rh(n,["class","width","height","box","spin","inverse","pulse","flip","style","label"]);let i=x(e,"class",8,""),s=x(e,"width",8),o=x(e,"height",8),l=x(e,"box",8,"0 0 0 0"),a=x(e,"spin",8,!1),u=x(e,"inverse",8,!1),f=x(e,"pulse",8,!1),h=x(e,"flip",8,"none"),d=x(e,"style",8,""),p=x(e,"label",8,"");var g=AD();let m;var v=M(g);Pn(v,e,"default",{},null),xe(y=>m=Th(g,m,{version:"1.1",class:`fa-icon ${i()??""}`,width:s(),height:o(),"aria-label":p(),role:p()?"img":"presentation",viewBox:l(),style:d(),...r,[ga]:y},"svelte-1mc5hvj"),[()=>({"fa-spin":a(),"fa-pulse":f(),"fa-inverse":u(),"fa-flip-horizontal":h()==="horizontal","fa-flip-vertical":h()==="vertical"})],he),D(t,g)}var _D=tl("<path></path>"),ED=tl("<polygon></polygon>"),TD=tl("<!><!><!>",1);function Dt(t,e){const n=Rh(e,["children","$$slots","$$events","$$legacy"]),r=Rh(n,["class","data","scale","spin","inverse","pulse","flip","label","style"]);Ge(e,!1);let i=x(e,"class",8,""),s=x(e,"data",8),o=R(),l=x(e,"scale",8,1),a=x(e,"spin",8,!1),u=x(e,"inverse",8,!1),f=x(e,"pulse",8,!1),h=x(e,"flip",8,void 0),d=x(e,"label",8,""),p=x(e,"style",8,""),g=1,m=R(10),v=R(10),y=R(),S=R();function k(W){let G,V;if(W)if("definition"in W){console.error("`import faIconName from '@fortawesome/package-name/faIconName` not supported - Please use `import { faIconName } from '@fortawesome/package-name/faIconName'` instead");return}else if("iconName"in W&&"icon"in W){G=W.iconName;const[U,Q,,,Y]=W.icon,ie=Array.isArray(Y)?Y:[Y];V={width:U,height:Q,paths:ie.map(F=>({d:F}))}}else G=Object.keys(W)[0],V=W[G];else return;return V}function C(){let W=1;return typeof l()<"u"&&(W=Number(l())),isNaN(W)||W<=0?(console.warn('Invalid prop: prop "scale" should be a number over 0.'),g):W*g}function w(){return c(o)?`0 0 ${c(o).width} ${c(o).height}`:`0 0 ${c(m)} ${c(v)}`}function E(){return c(o)?Math.max(c(o).width,c(o).height)/16:1}function A(){return c(o)?c(o).width/E()*C():0}function O(){return c(o)?c(o).height/E()*C():0}function H(){let W="";p()!==null&&(W+=p());let G=C();return G===1?W.length===0?"":W:(W!==""&&!W.endsWith(";")&&(W+="; "),`${W}font-size: ${G}em`)}K(()=>(P(s()),P(p()),P(l())),()=>{b(o,k(s())),p(),l(),b(m,A()),b(v,O()),b(y,H()),b(S,w())}),Vt(),st(),OD(t,jo({get label(){return d()},get width(){return c(m)},get height(){return c(v)},get box(){return c(S)},get style(){return c(y)},get spin(){return a()},get flip(){return h()},get inverse(){return u()},get pulse(){return f()},get class(){return i()}},()=>r,{children:(W,G)=>{var V=bn(),U=$e(V);Pn(U,e,"default",{},Q=>{var Y=TD(),ie=$e(Y);Sn(ie,1,()=>{var se;return((se=c(o))==null?void 0:se.paths)||[]},Ln,(se,ce)=>{var Te=_D();let le;xe(()=>le=Th(Te,le,{...c(ce)})),D(se,Te)});var F=N(ie);Sn(F,1,()=>{var se;return((se=c(o))==null?void 0:se.polygons)||[]},Ln,(se,ce)=>{var Te=ED();let le;xe(()=>le=Th(Te,le,{...c(ce)})),D(se,Te)});var X=N(F);{var I=se=>{kD(se,{get data(){return c(o)},set data(ce){b(o,ce)},$$legacy:!0})};te(X,se=>{var ce;(ce=c(o))!=null&&ce.raw&&se(I)})}D(Q,Y)}),D(W,V)},$$slots:{default:!0}})),Xe()}var MD=J('<div role="checkbox" tabindex="-1"><!></div>');function RD(t,e){Ge(e,!1);let n=x(e,"path",9),r=x(e,"value",9),i=x(e,"readOnly",9),s=x(e,"onPatch",9),o=x(e,"focus",9);function l(d){d.stopPropagation(),!i()&&(s()([{op:"replace",path:tt(n()),value:!r()}]),o()())}st(!0);var a=MD();let u;var f=M(a);const h=he(()=>r()===!0?AS:OS);Dt(f,{get data(){return c(h)}}),xe(d=>{Jt(a,"aria-checked",r()===!0),u=ct(a,1,"jse-boolean-toggle svelte-1ryp01u",null,u,d),Jt(a,"title",i()?`Boolean value ${r()}`:"Click to toggle this boolean value")},[()=>({"jse-readonly":i()})],he),ae("mousedown",a,l),D(t,a),Xe()}const PD="modulepreload",DD=function(t,e){return new URL(t,e).href},Dy={},ID=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const l=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),u=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(f=>{if(f=DD(f,r),f in Dy)return;Dy[f]=!0;const h=f.endsWith(".css"),d=h?'[rel="stylesheet"]':"";if(!!r)for(let m=l.length-1;m>=0;m--){const v=l[m];if(v.href===f&&(!h||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${d}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":PD,h||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),h)return new Promise((m,v)=>{g.addEventListener("load",m),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};var LD=J('<div class="jse-color-picker-popup svelte-s1wu8v"></div>');function ND(t,e){Ge(e,!1);let n=x(e,"color",8),r=x(e,"onChange",8),i=x(e,"showOnTop",8),s=R(),o=()=>{};Cr(async()=>{var f;const a=(f=await ID(async()=>{const{default:h}=await import("./vanilla-picker-B6E6ObS_.js");return{default:h}},[],import.meta.url))==null?void 0:f.default,u=new a({parent:c(s),color:n(),popup:i()?"top":"bottom",onDone(h){const p=h.rgba[3]===1?h.hex.substring(0,7):h.hex;r()(p)}});u.show(),o=()=>{u.destroy()}}),Ii(()=>{o()}),st();var l=LD();gn(l,a=>b(s,a),()=>c(s)),D(t,l),Xe()}var jD=J('<button type="button"></button>');function BD(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),{openAbsolutePopup:i}=el("absolute-popup");let s=x(e,"path",9),o=x(e,"value",9),l=x(e,"readOnly",9),a=x(e,"onPatch",9),u=x(e,"focus",9);function f(m){a()([{op:"replace",path:tt(s()),value:m}]),h()}function h(){u()()}function d(m){var E;if(l())return;const v=300,y=m.target,S=y.getBoundingClientRect().top,C=(((E=Ku(y))==null?void 0:E.innerHeight)??0)-S<v&&S>v,w={color:o(),onChange:f,showOnTop:C};i(ND,w,{anchor:y,closeOnOuterClick:!0,onClose:h,offsetTop:18,offsetLeft:-8,height:v})}K(()=>P(o()),()=>{b(n,Iw(o()))}),K(()=>(P(l()),P(o())),()=>{b(r,l()?`Color ${o()}`:"Click to open a color picker")}),Vt(),st(!0);var p=jD();let g;xe(m=>{g=ct(p,1,"jse-color-picker-button svelte-xeg9n6",null,g,m),Gi(p,`background: ${c(n)??""}`),Jt(p,"title",c(r)),Jt(p,"aria-label",c(r))},[()=>({"jse-readonly":l()})],he),ae("click",p,d),D(t,p),Xe()}const sm=300,om=300,Iy=300,Ly=50,FD=200,zD=400,VD=1200,wf=1e3,hu=100,Wp=100,lm=2e4,HD=50,qD=50,Ea=[{start:0,end:hu}],UD=100*1024*1024,WD=1024*1024,Ny=10*1024*1024,JD=10*1024,Jp="Insert or paste contents, enter [ insert a new array, enter { to insert a new object, or start typing to insert a new value",Qv="Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)",Mc="hover-insert-inside",Kp="hover-insert-after",jy="hover-collection",Gp="valid",By="repairable",KD="invalid",Ys=42*8,Zs=260,Fc=100,Fy={[Ji.asc]:"ascending",[Ji.desc]:"descending"};function GD(t,e){const n={start:t,end:Math.min(am(t),e)},r=Math.max(Bh((t+e)/2),t),i={start:r,end:Math.min(am(r),e)},s=Bh(e),o=s===e?s-hu:s,l={start:Math.max(o,t),end:e},a=[n],u=i.start>=n.end&&i.end<=l.start;return u&&a.push(i),l.start>=(u?i.end:n.end)&&a.push(l),a}function _S(t){const e=v5(t,r=>r.start),n=[e[0]];for(let r=0;r<e.length;r++){const i=n.length-1,s=n[i],o=e[r];o.start<=s.end?n[i]={start:Math.min(s.start,o.start),end:Math.max(s.end,o.end)}:n.push(o)}return n}function XD(t,e){return t.some(n=>e>=n.start&&e<n.end)}function am(t){return Bh(t)+hu}function Bh(t){return Math.floor(t/hu)*hu}function ES(t){return t?t.type==="space"||t.space===!0:!1}function sh(t){return t?t.type==="separator"||t.separator===!0:!1}function QD(t){return t?t.type==="label"&&typeof t.text=="string":!1}function Qc(t){return t?typeof t.onClick=="function":!1}function Xp(t){return t?t.type==="dropdown-button"&&Qc(t.main)&&Array.isArray(t.items):!1}function YD(t){return t?t.type==="row"&&Array.isArray(t.items):!1}function ZD(t){return t?t.type==="column"&&Array.isArray(t.items):!1}function zy(t){return Kt(t)&&Kt(t.parseError)}function $D(t){return Kt(t)&&Array.isArray(t.validationErrors)}function e6(t){return Kt(t)&&Array.isArray(t.path)&&typeof t.message=="string"&&"severity"in t}function t6(t){return Kt(t)&&e6(t)&&typeof t.isChildError=="boolean"}function n6(t){return Kt(t)&&typeof t.action=="function"&&Kt(t.props)}function $i(t){return t!==void 0&&t.type==="object"}function wr(t){return t!==void 0&&t.type==="array"}function Yv(t){return t!==void 0&&t.type==="value"}function jl(t){return $i(t)||wr(t)}function TS(t){return t!==void 0&&Array.isArray(t.searchResults)}function Fh(t){return t?t.type==="tree":!1}function Vy(t){return t?t.type==="text":!1}function Hy(t){return t?t.type==="mode":!1}function r6({json:t,factory:e}){return Array.isArray(t)?e.createArrayDocumentState():Kt(t)?e.createObjectDocumentState():t!==void 0?e.createValueDocumentState():void 0}function cm({json:t,expand:e}){const n=r6({json:t,factory:e0});return e&&n?qi(t,n,[],e):n}function Zv({expanded:t}={expanded:!1}){return{type:"array",expanded:t,visibleSections:Ea,items:[]}}function $v({expanded:t}={expanded:!1}){return{type:"object",expanded:t,properties:{}}}function i6(){return{type:"value"}}const e0={createObjectDocumentState:$v,createArrayDocumentState:Zv,createValueDocumentState:i6};function MS(t,e,n,{createObjectDocumentState:r,createArrayDocumentState:i,createValueDocumentState:s}){function o(l,a,u){if(Array.isArray(l)){const f=wr(a)?a:i();if(u.length===0)return f;const h=mr(u[0]),d=o(l[h],f.items[h],u.slice(1));return Xr(f,["items",u[0]],d)}if(Kt(l)){const f=$i(a)?a:r();if(u.length===0)return f;const h=u[0],d=o(l[h],f.properties[h],u.slice(1));return Xr(f,["properties",h],d)}return Yv(a)?a:s()}return o(t,e,n)}function pi(t,e,n=[]){return du(t,e,n,(r,i)=>{if(!(r===void 0||i===void 0)){if(Array.isArray(r)){if(wr(i))return i;const s=jl(i)?i.expanded:!1;return Zv({expanded:s})}if(Kt(r)){if($i(i))return i;const s=jl(i)?i.expanded:!1;return $v({expanded:s})}if(Yv(i))return i}},()=>!0)}function du(t,e,n,r,i){const s=r(t,e,n);if(Array.isArray(t)&&wr(s)&&i(s)){const o=[];return t0(t,s.visibleSections,a=>{const u=n.concat(String(a)),f=t[a],h=s.items[a],d=du(f,h,u,r,i);d!==void 0&&(o[a]=d)}),!Oy(o,s.items)?{...s,items:o}:s}if(Kt(t)&&$i(s)&&i(s)){const o={};return Object.keys(t).forEach(a=>{const u=n.concat(a),f=t[a],h=s.properties[a],d=du(f,h,u,r,i);d!==void 0&&(o[a]=d)}),!Oy(Object.values(o),Object.values(s.properties))?{...s,properties:o}:s}return s}function t0(t,e,n){e.forEach(({start:r,end:i})=>{cS(r,Math.min(t.length,i),n)})}function s6(t,e){if(XD(t.visibleSections,e))return t;const n=Bh(e),r=am(n),i={start:n,end:r};return{...t,visibleSections:_S(t.visibleSections.concat(i))}}function pu(t,e){let n=t;const r=[];let i=0;for(;i<e.length;){if(Array.isArray(n)){const s=e[i];r.push("items",s),n=n[mr(s)]}else if(Kt(n)){const s=e[i];r.push("properties",s),n=n[s]}else throw new Error(`Cannot convert path: Object or Array expected at index ${i}`);i++}return r}function qi(t,e,n,r){let i=e;for(let s=0;s<n.length;s++){const o=n.slice(0,s);i=Ja(t,i,o,(l,a)=>{const u=jl(a)&&!a.expanded?{...a,expanded:!0}:a;if(wr(u)){const f=mr(n[s]);return s6(u,f)}return u})}return Ja(t,i,n,(s,o)=>o6(s,o,[],r))}function o6(t,e,n,r){return du(t,e,n,(i,s,o)=>Array.isArray(i)&&r(o)?wr(s)?s.expanded?s:{...s,expanded:!0}:Zv({expanded:!0}):Kt(i)&&r(o)?$i(s)?s.expanded?s:{...s,expanded:!0}:$v({expanded:!0}):s,i=>jl(i)&&i.expanded)}function RS(t,e,n,r){return Ja(t,e,n,(i,s)=>r?l6(i,s,n):PS(s))}function PS(t){return wr(t)&&t.expanded?{...t,expanded:!1,visibleSections:Ea}:$i(t)&&t.expanded?{...t,expanded:!1}:t}function l6(t,e,n){return du(t,e,n,(r,i)=>PS(i),()=>!0)}function a6(t,e,n,r){return Ja(t,e,n,(i,s)=>{if(!wr(s))return s;const o=_S(s.visibleSections.concat(r));return{...s,visibleSections:o}})}function DS(t,e,n){const r={json:t,documentState:e},i=n.reduce((s,o)=>({json:Xi(s.json,[o]),documentState:c6(s.json,s.documentState,o)}),r);return{json:i.json,documentState:pi(i.json,i.documentState)}}function c6(t,e,n){if(bw(n))return IS(t,e,n,void 0);if(xw(n))return LS(t,e,n);if(Ev(n)){const r=Qi(t,n.path),i=fo(t,e,r);return i?Zd(t,e,r,{type:"value",enforceString:i}):e}return Ug(n)||Ha(n)?h6(t,e,n):e}function Ol(t,e,n){try{return De(e,pu(t,n))}catch{return}}function u6(t,e,n,r,i){const s=MS(t,e,n,i);return Xr(s,pu(t,n),r)}function n0(t,e,n,r,i){const s=MS(t,e,n,i);return Rv(s,pu(t,n),o=>{const l=De(t,n);return r(l,o)})}function Zd(t,e,n,r){return u6(t,e,n,r,e0)}function Ja(t,e,n,r){return n0(t,e,n,r,e0)}function f6(t,e,n){const r=pu(t,n);return Ei(e,r)?Fd(e,pu(t,n)):e}function IS(t,e,n,r){const i=Qi(t,n.path),s=Lt(i);let o=e;return o=Ja(t,o,s,(l,a)=>{if(!wr(a))return a;const u=mr(Ot(i)),{items:f,visibleSections:h}=a;return{...a,items:u<f.length?k5(f,u,r!==void 0?[r]:Array(1)):f,visibleSections:NS(h,u,1)}}),Zd(t,o,i,r)}function LS(t,e,n){const r=Qi(t,n.path),i=Lt(r),s=De(t,i);return Array.isArray(s)?Ja(t,e,i,(o,l)=>{if(!wr(l))return l;const a=mr(Ot(r)),{items:u,visibleSections:f}=l;return{...l,items:u.slice(0,a).concat(u.slice(a+1)),visibleSections:NS(f,a,-1)}}):f6(t,e,r)}function h6(t,e,n){if(Ha(n)&&n.from===n.path)return e;let r=e;const i=Qi(t,n.from),s=Ol(t,r,i);return Ha(n)&&(r=LS(t,r,{path:n.from})),r=IS(t,r,{path:n.path},s),r}function NS(t,e,n){const r=t.map(i=>({start:i.start>e?i.start+n:i.start,end:i.end>e?i.end+n:i.end}));return d6(r)}function d6(t){const e=t.slice(0);let n=1;for(;n<e.length;)e[n-1].end===e[n].start&&(e[n-1]={start:e[n-1].start,end:e[n].end},e.splice(n)),n++;return e}function fo(t,e,n){const r=De(t,n),i=Ol(t,e,n),s=Yv(i)?i.enforceString:void 0;return typeof s=="boolean"?s:YE(r)}function Qu(t,e,n=!1){const r=t.indexOf(e);return r!==-1?n?t.slice(r):t.slice(r+1):[]}function r0(t,e){const n=[];function r(i,s,o){n.push(o),Nn(i)&&wr(s)&&s.expanded&&t0(i,s.visibleSections,l=>{r(i[l],s.items[l],o.concat(String(l)))}),Hn(i)&&$i(s)&&s.expanded&&Object.keys(i).forEach(l=>{r(i[l],s.properties[l],o.concat(l))})}return r(t,e,[]),n}function jS(t,e,n=!0){const r=[];function i(s,o){r.push({path:o,type:Wi.value});const l=Ol(t,e,o);if(s&&jl(l)&&l.expanded){if(n&&r.push({path:o,type:Wi.inside}),Nn(s)){const a=wr(l)?l.visibleSections:Ea;t0(s,a,u=>{const f=o.concat(String(u));i(s[u],f),n&&r.push({path:f,type:Wi.after})})}Hn(s)&&Object.keys(s).forEach(u=>{const f=o.concat(u);r.push({path:f,type:Wi.key}),i(s[u],f),n&&r.push({path:f,type:Wi.after})})}}return i(t,[]),r}function p6(t,e,n){const r=r0(t,e),i=r.map(tt),s=tt(n),o=i.indexOf(s);if(o!==-1&&o>0)return r[o-1]}function um(t,e,n){const r=r0(t,e),s=r.map(tt).indexOf(tt(n));if(s!==-1&&s<r.length-1)return r[s+1]}function Bl(t,e,n,r=JD){const i=De(t,n),s=R5({json:i},r)?zc:i0;return qi(t,e,n,s)}function Qp(t,e,n){const r=Ol(t,e,n);return(jl(r)?r.expanded:!1)?e:Bl(t,e,n)}function zc(t){return t.length===0?!0:t.length===1&&t[0]==="0"}function qy(t){return t.length===0}function i0(){return!0}function oh(){return!1}function Ti(t){return t&&t.type===Zt.after||!1}function br(t){return t&&t.type===Zt.inside||!1}function nr(t){return t&&t.type===Zt.key||!1}function Qt(t){return t&&t.type===Zt.value||!1}function dn(t){return t&&t.type===Zt.multi||!1}function $d(t){return dn(t)&&Pt(t.focusPath,t.anchorPath)}function gu(t){return dn(t)||Ti(t)||br(t)||nr(t)||Qt(t)}function Yp(t){return t&&t.type===Zt.text||!1}function Uo(t,e){const n=[];return g6(t,e,r=>{n.push(r)}),n}function g6(t,e,n){if(!e)return;const r=Fl(e),i=He(e);if(Pt(r,i))return n(r);{if(t===void 0)return;const s=zS(r,i);if(r.length===s.length||i.length===s.length)return n(s);const o=Rr(r,i),l=ho(t,o),a=rl(t,o),u=io(t,o,l),f=io(t,o,a);if(u===-1||f===-1)return;const h=De(t,s);if(Hn(h)){const d=Object.keys(h);for(let p=u;p<=f;p++){const g=n(s.concat(d[p]));if(g!==void 0)return g}return}if(Nn(h)){for(let d=u;d<=f;d++){const p=n(s.concat(String(d)));if(p!==void 0)return p}return}}throw new Error("Failed to create selection")}function BS(t){return br(t)?t.path:Lt(He(t))}function ho(t,e){if(!dn(e))return e.path;const n=io(t,e,e.anchorPath);return io(t,e,e.focusPath)<n?e.focusPath:e.anchorPath}function rl(t,e){if(!dn(e))return e.path;const n=io(t,e,e.anchorPath);return io(t,e,e.focusPath)>n?e.focusPath:e.anchorPath}function m6(t,e){return po(He(t),e)&&(He(t).length>e.length||br(t))}function Uy(t,e,n,r=!1){if(!n)return;const i=r?He(n):ho(t,n),s=p6(t,e,i);if(r)return br(n)||Ti(n)?s!==void 0?Rr(i,i):void 0:s!==void 0?Rr(Fl(n),s):void 0;if(Ti(n)||br(n))return wt(i);if(nr(n)){if(s===void 0||s.length===0)return;const o=Lt(s),l=De(t,o);return Array.isArray(l)||Yt(s)?wt(s):go(s)}if(Qt(n))return s!==void 0?wt(s):void 0;if(s!==void 0)return wt(s)}function v6(t,e,n,r=!1){if(!n)return;const i=r?He(n):rl(t,n),s=Vn(De(t,i))?RS(t,e,i,!0):e,o=um(t,e,i),l=um(t,s,i);if(r)return br(n)?o!==void 0?Rr(o,o):void 0:Ti(n)?l!==void 0?Rr(l,l):void 0:l!==void 0?Rr(Fl(n),l):void 0;if(Ti(n))return l!==void 0?wt(l):void 0;if(br(n)||Qt(n))return o!==void 0?wt(o):void 0;if(nr(n)){if(o===void 0||o.length===0)return;const a=Lt(o),u=De(t,a);return Array.isArray(u)?wt(o):go(o)}if(dn(n))return l!==void 0?wt(l):o!==void 0?wt(o):void 0}function y6(t,e,n){const r=Lt(n),i=[Ot(n)],s=De(t,r),o=s?um(s,e,i):void 0;return o?wt(r.concat(o)):vo(n)}function FS(t,e,n,r){if(!n)return{caret:void 0,previous:void 0,next:void 0};const i=jS(t,e,r),s=i.findIndex(o=>Pt(o.path,He(n))&&String(o.type)===String(n.type));return{caret:s!==-1?i[s]:void 0,previous:s!==-1&&s>0?i[s-1]:void 0,next:s!==-1&&s<i.length-1?i[s+1]:void 0}}function b6(t,e,n,r=!1,i=!0){if(!n)return;const{caret:s,previous:o}=FS(t,e,n,i);if(r)return dn(n)?void 0:Rr(n.path,n.path);if(s&&o)return o0(o);const l=Lt(He(n)),a=De(t,l);if(Qt(n)&&Array.isArray(a))return Rr(n.path,n.path);if(dn(n)&&!Array.isArray(a))return go(n.focusPath)}function x6(t,e,n,r=!1,i=!0){if(!n)return;const{caret:s,next:o}=FS(t,e,n,i);if(r)return dn(n)?void 0:Rr(n.path,n.path);if(s&&o)return o0(o);if(dn(n))return wt(n.focusPath)}function ua(t,e){const n=r0(t,e);let r=0;for(;r<n.length-1&&n[r+1].length>n[r].length;)r++;const i=n[r];return i===void 0||i.length===0||Array.isArray(De(t,Lt(i)))?wt(i):go(i)}function Ka(t,e){if(e.length===1){const r=ro(e);if(r.op==="replace"){const i=Qi(t,r.path);return wt(i)}}if(!Yt(e)&&e.every(r=>r.op==="move")){const r=ro(e),i=e.slice(1);if((Ug(r)||Ha(r))&&r.from!==r.path&&i.every(s=>(Ug(s)||Ha(s))&&s.from===s.path)){const s=Qi(t,r.path);return go(s)}}const n=e.filter(r=>r.op!=="test"&&r.op!=="remove"&&(r.op!=="move"||r.from!==r.path)&&typeof r.path=="string").map(r=>Qi(t,r.path));if(!Yt(n))return{type:Zt.multi,anchorPath:ro(n),focusPath:Ot(n)}}function zS(t,e){let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;return t.slice(0,n)}function zh(t){return nr(t)||Qt(t)||$d(t)}function Wy(t,e){return zh(e)&&Vn(De(t,He(e)))?He(e):Lt(He(e))}function po(t,e){if(t.length<e.length)return!1;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function Os(t){if(ei(t)){const{type:e,path:n}=t;return{type:e,path:n}}return t}function go(t){return{type:Zt.key,path:t}}function s0(t,e){return{type:Zt.key,path:t,edit:!0,initialValue:e}}function wt(t){return{type:Zt.value,path:t}}function Vh(t,e){return{type:Zt.value,path:t,edit:!0,initialValue:e}}function mo(t){return{type:Zt.inside,path:t}}function vo(t){return{type:Zt.after,path:t}}function Rr(t,e){const n=zS(t,e),r=t.length>n.length&&e.length>n.length;return{type:Zt.multi,anchorPath:r?n.concat(t[n.length]):n,focusPath:r?n.concat(e[n.length]):n}}function VS(t,e,n,r){if(nr(e))return String(Ot(e.path));if(Qt(e)){const i=De(t,e.path);return typeof i=="string"?i:r.stringify(i,null,n)}if(dn(e)){if(Yt(e.focusPath))return r.stringify(t,null,n);const i=BS(e),s=De(t,i);if(Array.isArray(s))if($d(e)){const o=De(t,e.focusPath);return r.stringify(o,null,n)}else return Uo(t,e).map(o=>{const l=De(t,o);return`${r.stringify(l,null,n)},`}).join(`
|
|
51
|
-
`);else return Uo(t,e).map(o=>{const l=Ot(o),a=De(t,o);return`${r.stringify(l)}: ${r.stringify(a,null,n)},`}).join(`
|
|
52
|
-
`)}}function ei(t){return(nr(t)||Qt(t))&&t.edit===!0}function w6(){return wt([])}function gc(t){return nr(t)||Qt(t)||dn(t)}function lh(t){return nr(t)||Qt(t)||$d(t)}function o0(t){switch(t.type){case Wi.key:return go(t.path);case Wi.value:return wt(t.path);case Wi.after:return vo(t.path);case Wi.inside:return mo(t.path)}}function Jy(t,e){switch(t){case Zt.key:return go(e);case Zt.value:return wt(e);case Zt.after:return vo(e);case Zt.inside:return mo(e);case Zt.multi:case Zt.text:return Rr(e,e)}}function Ky(t,e,n){if(!e)return;if(mu(t,e,n))return e;const r=dn(e)?Lt(e.focusPath):e.path;if(po(r,n))return e}function mu(t,e,n){if(t===void 0||!e)return!1;if(nr(e)||br(e)||Ti(e))return Pt(e.path,n);if(Qt(e))return po(n,e.path);if(dn(e)){const r=ho(t,e),i=rl(t,e),s=Lt(e.focusPath);if(!po(n,s)||n.length<=s.length)return!1;const o=io(t,e,r),l=io(t,e,i),a=io(t,e,n);return a!==-1&&a>=o&&a<=l}return!1}function io(t,e,n){const r=Lt(e.focusPath);if(!po(n,r)||n.length<=r.length)return-1;const i=n[r.length],s=De(t,r);if(Hn(s))return Object.keys(s).indexOf(i);if(Nn(s)){const o=mr(i);if(o<s.length)return o}return-1}function He(t){return dn(t)?t.focusPath:t.path}function Fl(t){return dn(t)?t.anchorPath:t.path}function mc(...t){const e=[];for(const n of t)if(typeof n=="string"&&e.push(n),n&&typeof n=="object")for(const r in n)Object.hasOwnProperty.call(n,r)&&n[r]&&e.push(r);return e.join(" ")}function HS(t,e,n){const r=Iv(t,n);return mc("jse-value","jse-"+r,{"jse-url":zd(t),"jse-empty":typeof t=="string"&&t.length===0,"jse-table-cell":e===$n.table})}var S6=J('<div role="textbox" tabindex="0" contenteditable="true" spellcheck="false"></div>');function qS(t,e){Ge(e,!1);const n=rr("jsoneditor:EditableDiv");let r=x(e,"value",9),i=x(e,"initialValue",9),s=x(e,"shortText",9,!1),o=x(e,"label",9),l=x(e,"onChange",9),a=x(e,"onCancel",9),u=x(e,"onFind",9),f=x(e,"onPaste",9,Kn),h=x(e,"onValueClass",9,()=>""),d=R(void 0,!0),p=R(void 0,!0),g=!1;Cr(()=>{n("onMount",{value:r(),initialValue:i()}),v(i()!==void 0?i():r()),c(d)&&J5(c(d))}),Ii(()=>{const A=m();n("onDestroy",{closed:g,value:r(),newValue:A}),!g&&A!==r()&&l()(A,Bo.no)});function m(){return c(d)?q5(c(d).innerText):""}function v(A){c(d)&&gi(d,c(d).innerText=Qd(A))}function y(){const A=m();A===""&&v(""),b(p,h()(A))}function S(){g=!0,a()()}function k(A){A.stopPropagation();const O=uo(A);if(O==="Escape"&&(A.preventDefault(),S()),O==="Enter"||O==="Tab"){A.preventDefault(),g=!0;const H=m();l()(H,Bo.nextInside)}O==="Ctrl+F"&&(A.preventDefault(),u()(!1)),O==="Ctrl+H"&&(A.preventDefault(),u()(!0))}function C(A){if(A.stopPropagation(),!f()||!A.clipboardData)return;const O=A.clipboardData.getData("text/plain");f()(O)}function w(){const A=document.hasFocus(),O=m();n("handleBlur",{hasFocus:A,closed:g,value:r(),newValue:O}),document.hasFocus()&&!g&&(g=!0,O!==r()&&l()(O,Bo.self))}K(()=>(P(h()),P(r())),()=>{b(p,h()(r()))}),Vt(),st(!0);var E=S6();gn(E,A=>b(d,A),()=>c(d)),xe(A=>{Jt(E,"aria-label",o()),ct(E,1,A,"svelte-f9kmxj")},[()=>nl(mc("jse-editable-div",c(p),{"jse-short-text":s()}))],he),ae("input",E,y),ae("keydown",E,k),ae("paste",E,C),ae("blur",E,w),D(t,E),Xe()}function C6(t,e){Ge(e,!1);let n=x(e,"path",9),r=x(e,"value",9),i=x(e,"selection",9),s=x(e,"mode",9),o=x(e,"parser",9),l=x(e,"normalization",9),a=x(e,"enforceString",9),u=x(e,"onPatch",9),f=x(e,"onPasteJson",9),h=x(e,"onSelect",9),d=x(e,"onFind",9),p=x(e,"focus",9),g=x(e,"findNextInside",9);function m(E){return a()?E:hc(E,o())}function v(E,A){u()([{op:"replace",path:tt(n()),value:m(l().unescapeValue(E))}],(O,H,W)=>{if(W&&!Pt(n(),He(W)))return;const G=A===Bo.nextInside?g()(n()):wt(n());return{state:H,selection:G}}),p()()}function y(){h()(wt(n())),p()()}function S(E){try{const A=o().parse(E);Vn(A)&&f()({path:n(),contents:A,onPasteAsJson:()=>{y();const O=[{op:"replace",path:tt(n()),value:A}];u()(O,(H,W)=>({state:Bl(H,W,n())}))}})}catch{}}function k(E){return HS(m(l().unescapeValue(E)),s(),o())}st(!0);const C=he(()=>l().escapeValue(r())),w=he(()=>ei(i())?i().initialValue:void 0);qS(t,{get value(){return c(C)},get initialValue(){return c(w)},label:"Edit value",onChange:v,onCancel:y,onPaste:S,get onFind(){return d()},onValueClass:k}),Xe()}function wa(t,e,n){const r=Lt(e),i=De(t,r);if(Nn(i)){const s=mr(Ot(e));return n.map((o,l)=>({op:"add",path:tt(r.concat(String(s+l))),value:o.value}))}else if(Hn(i)){const s=Ot(e),o=Object.keys(i),l=s!==void 0?Qu(o,s,!0):[];return[...n.map(a=>{const u=Gu(a.key,o);return{op:"add",path:tt(r.concat(u)),value:a.value}}),...l.map(a=>zl(r,a))]}else throw new Error("Cannot create insert operations: parent must be an Object or Array")}function fm(t,e,n){const r=De(t,e);if(Array.isArray(r)){const i=r.length;return n.map((s,o)=>({op:"add",path:tt(e.concat(String(i+o))),value:s.value}))}else return n.map(i=>{const s=Gu(i.key,Object.keys(r));return{op:"add",path:tt(e.concat(s)),value:i.value}})}function Yu(t,e,n,r){const i=e.filter(l=>l!==n),s=Gu(r,i),o=Qu(e,n,!1);return[{op:"move",from:tt(t.concat(n)),path:tt(t.concat(s))},...o.map(l=>zl(t,l))]}function k6(t,e,n){const r=ro(e),i=Lt(r),s=De(t,i);if(Nn(s)){const o=ro(e),l=o?mr(Ot(o)):0;return[...Hh(e),...n.map((a,u)=>({op:"add",path:tt(i.concat(String(u+l))),value:a.value}))]}else if(Hn(s)){const o=Ot(e),l=Lt(o),a=Ot(o),u=Object.keys(s),f=a!==void 0?Qu(u,a,!1):[],h=new Set(e.map(p=>Ot(p))),d=u.filter(p=>!h.has(p));return[...Hh(e),...n.map(p=>{const g=Gu(p.key,d);return{op:"add",path:tt(l.concat(g)),value:p.value}}),...f.map(p=>zl(l,p))]}else throw new Error("Cannot create replace operations: parent must be an Object or Array")}function US(t,e){const n=Ot(e);if(Yt(n))throw new Error("Cannot duplicate root object");const r=Lt(n),i=Ot(n),s=De(t,r);if(Nn(s)){const o=Ot(e),l=o?mr(Ot(o))+1:0;return[...e.map((a,u)=>({op:"copy",from:tt(a),path:tt(r.concat(String(u+l)))}))]}else if(Hn(s)){const o=Object.keys(s),l=i!==void 0?Qu(o,i,!1):[];return[...e.map(a=>{const u=Ot(a),f=Gu(u,o);return{op:"copy",from:tt(a),path:tt(r.concat(f))}}),...l.map(a=>zl(r,a))]}else throw new Error("Cannot create duplicate operations: parent must be an Object or Array")}function WS(t,e){if(Qt(e))return[{op:"move",from:tt(e.path),path:""}];if(dn(e)){const n=Lt(e.focusPath),r=De(t,n);if(Nn(r))return[{op:"replace",path:"",value:Uo(t,e).map(s=>{const o=mr(Ot(s));return r[o]})}];if(Hn(r)){const i={};return Uo(t,e).forEach(s=>{const o=String(Ot(s));i[o]=r[o]}),[{op:"replace",path:"",value:i}]}}else throw new Error("Cannot create extract operations: parent must be an Object or Array");throw new Error("Cannot extract: unsupported type of selection "+JSON.stringify(e))}function JS(t,e,n,r){if(nr(e)){const i=fS(n,r),s=Lt(e.path),o=De(t,s),l=Object.keys(o),a=Ot(e.path);return Yu(s,l,a,typeof i=="string"?i:n)}if(Qt(e)||dn(e)&&Yt(e.focusPath))try{return[{op:"replace",path:tt(He(e)),value:Xd(n,i=>Ju(i,r))}]}catch{return[{op:"replace",path:tt(He(e)),value:n}]}if(dn(e)){const i=Zp(n,r);return k6(t,Uo(t,e),i)}if(Ti(e)){const i=Zp(n,r),s=e.path,o=Lt(s),l=De(t,o);if(Nn(l)){const a=mr(Ot(s)),u=o.concat(String(a+1));return wa(t,u,i)}else if(Hn(l)){const a=String(Ot(s)),u=Object.keys(l);if(Yt(u)||Ot(u)===a)return fm(t,o,i);{const f=u.indexOf(a),h=u[f+1],d=o.concat(h);return wa(t,d,i)}}else throw new Error("Cannot create insert operations: parent must be an Object or Array")}if(br(e)){const i=Zp(n,r),s=e.path,o=De(t,s);if(Nn(o)){const l=s.concat("0");return wa(t,l,i)}else if(Hn(o)){const l=Object.keys(o);if(Yt(l))return fm(t,s,i);{const a=ro(l),u=s.concat(a);return wa(t,u,i)}}else throw new Error("Cannot create insert operations: parent must be an Object or Array")}throw new Error("Cannot insert: unsupported type of selection "+JSON.stringify(e))}function A6(t,e,n){if(!e)return[];const r="beforePath"in n?n.beforePath:void 0,i="append"in n?n.append:void 0,s=Lt(He(e)),o=De(t,s);if(!i&&!(r&&po(r,s)&&r.length>s.length))return[];const l=ho(t,e),a=rl(t,e),u=Ot(l),f=Ot(a),h=r?r[s.length]:void 0;if(Hn(o)){const d=Object.keys(o),p=d.indexOf(u),g=d.indexOf(f),m=i?d.length:h!==void 0?d.indexOf(h):-1;if(p!==-1&&g!==-1&&m!==-1)return m>p?[...d.slice(p,g+1),...d.slice(m,d.length)].map(v=>zl(s,v)):[...d.slice(m,p),...d.slice(g+1,d.length)].map(v=>zl(s,v))}else if(Nn(o)){const d=mr(u),p=mr(f),g=h!==void 0?mr(h):o.length,m=p-d+1;return g<d?Ay(m,v=>({op:"move",from:tt(s.concat(String(d+v))),path:tt(s.concat(String(g+v)))})):Ay(m,()=>({op:"move",from:tt(s.concat(String(d))),path:tt(s.concat(String(g)))}))}else throw new Error("Cannot create move operations: parent must be an Object or Array");return[]}function O6(t,e,n){if(n==="object")return{};if(n==="array")return[];if(n==="structure"&&t!==void 0){const r=e?BS(e):[],i=De(t,r);if(Array.isArray(i)&&!Yt(i)){const s=ro(i);return Vn(s)?XP(s,o=>Array.isArray(o)?[]:Kt(o)?void 0:""):""}}return""}function Hh(t){return t.map(e=>({op:"remove",path:tt(e)})).reverse()}function zl(t,e){return{op:"move",from:tt(t.concat(e)),path:tt(t.concat(e))}}function Zp(t,e){const n=/^\s*{/.test(t),r=/^\s*\[/.test(t),i=fS(t,e),s=i!==void 0?i:Xd(t,o=>Ju(o,e));return n&&Kt(s)||r&&Array.isArray(s)?[{key:"New item",value:s}]:Array.isArray(s)?s.map((o,l)=>({key:"New item "+l,value:o})):Kt(s)?Object.keys(s).map(o=>({key:o,value:s[o]})):[{key:"New item",value:s}]}function KS(t,e){if(nr(e)){const n=Lt(e.path),r=De(t,n),i=Object.keys(r),s=Ot(e.path),l=Yu(n,i,s,""),a=Ka(t,l);return{operations:l,newSelection:a}}if(Qt(e))return{operations:[{op:"replace",path:tt(e.path),value:""}],newSelection:e};if(dn(e)){const n=Uo(t,e),r=Hh(n),i=Ot(n);if(Yt(i)){const l=[{op:"replace",path:"",value:""}],a=wt([]);return{operations:l,newSelection:a}}const s=Lt(i),o=De(t,s);if(Nn(o)){const l=ro(n),a=mr(Ot(l)),u=a===0?mo(s):vo(s.concat(String(a-1)));return{operations:r,newSelection:u}}else if(Hn(o)){const l=Object.keys(o),a=ro(n),u=Ot(a),f=l.indexOf(u),h=l[f-1],d=f===0?mo(s):vo(s.concat(h));return{operations:r,newSelection:d}}else throw new Error("Cannot create remove operations: parent must be an Object or Array")}throw new Error("Cannot remove: unsupported type of selection "+JSON.stringify(e))}function GS(t,e){return A5(kw(t,e,{before:(n,r,i)=>{if(xw(r)){const s=Li(r.path);return{revertOperations:[...i,...$p(n,s)]}}if(Ha(r)){const s=Li(r.from);return{revertOperations:r.from===r.path?[r,...$p(n,s)]:[...i,...$p(n,s)]}}return{document:n}}}))}function $p(t,e){const n=Lt(e),r=Ot(e),i=De(t,n);if(Hn(i)){const s=Object.keys(i);return Qu(s,r,!1).map(l=>zl(n,l))}return[]}function _6(t,e){return t.flatMap(n=>{if(Ev(n)){const r=Li(n.path);if(r.length>0){const i=[n];let s=Lt(r);for(;s.length>0&&!Ei(e,s);)i.unshift({op:"add",path:tt(s),value:{}}),s=Lt(s);return i}}return n})}function E6(t,e){const n=e!=null&&e.activeItem?Yy(e.activeItem):void 0,r=t.findIndex(l=>Pt(n,Yy(l))),i=r!==-1?r:(e==null?void 0:e.activeIndex)!==void 0&&(e==null?void 0:e.activeIndex)<t.length?e==null?void 0:e.activeIndex:t.length>0?0:-1,s=t.map((l,a)=>({resultIndex:a,...l,active:a===i})),o=s[i];return{items:s,activeItem:o,activeIndex:i}}function Gy(t){const e=t.activeIndex<t.items.length-1?t.activeIndex+1:t.items.length>0?0:-1,n=t.items[e],r=t.items.map((i,s)=>({...i,active:s===e}));return{...t,items:r,activeItem:n,activeIndex:e}}function T6(t){const e=t.activeIndex>0?t.activeIndex-1:t.items.length-1,n=t.items[e],r=t.items.map((i,s)=>({...i,active:s===e}));return{...t,items:r,activeItem:n,activeIndex:e}}function XS(t,e,n={}){const r=t.toLowerCase(),i=(n==null?void 0:n.maxResults)??1/0,s=n==null?void 0:n.columns,o=[],l=[];function a(f){o.length>=i||o.push(f)}function u(f,h){if(Nn(h)){const d=l.length;l.push("0");for(let p=0;p<h.length;p++)if(l[d]=String(p),u(f,h[p]),o.length>=i)return;l.pop()}else if(Hn(h)){const d=Object.keys(h),p=l.length;l.push("");for(const g of d)if(l[p]=g,Xy(g,f,l,Zi.key,a),u(f,h[g]),o.length>=i)return;l.pop()}else Xy(String(h),f,l,Zi.value,a)}if(t==="")return[];if(s){if(!Array.isArray(e))throw new Error("json must be an Array when option columns is defined");for(let f=0;f<e.length;f++){l[0]=String(f);const h=e[f];for(let d=0;d<s.length;d++){const p=s[d];if(p.length===1)l[1]=p[0];else for(let m=0;m<p.length;m++)l[m+1]=p[m];for(;l.length>p.length+1;)l.pop();const g=De(h,p);u(r,g)}if(o.length>=i)break}return o}else return u(r,e),o}function Xy(t,e,n,r,i){const s=t.toLowerCase();let o=0,l=-1,a=-1;do a=s.indexOf(e,l),a!==-1&&(l=a+e.length,i({path:n.slice(0),field:r,fieldIndex:o,start:a,end:l}),o++);while(a!==-1)}function hm(t,e,n,r){return t.substring(0,n)+e+t.substring(r)}function Qy(t,e,n){let r=t;return Q8(n,i=>{r=hm(r,e,i.start,i.end)}),r}function M6(t,e,n,r,i){const{field:s,path:o,start:l,end:a}=r;if(s===Zi.key){const u=Lt(o),f=De(t,u),h=Ot(o),d=Object.keys(f),p=hm(h,n,l,a),g=Yu(u,d,h,p);return{newSelection:Ka(t,g),operations:g}}else if(s===Zi.value){const u=De(t,o);if(u===void 0)throw new Error(`Cannot replace: path not found ${tt(o)}`);const f=typeof u=="string"?u:String(u),h=fo(t,e,o),d=hm(f,n,l,a),p=[{op:"replace",path:tt(o),value:h?d:hc(d,i)}];return{newSelection:Ka(t,p),operations:p}}else throw new Error(`Cannot replace: unknown type of search result field ${s}`)}function R6(t,e,n,r,i){const s=XS(n,t,{maxResults:1/0}),o=[];for(let u=0;u<s.length;u++){const f=s[u-1],h=s[u];u===0||h.field!==f.field||!Pt(h.path,f.path)?o.push({path:h.path,field:h.field,items:[h]}):Ot(o).items.push(h)}o.sort((u,f)=>u.field!==f.field?u.field===Zi.key?1:-1:f.path.length-u.path.length);let l=[],a;return o.forEach(u=>{const{field:f,path:h,items:d}=u;if(f===Zi.key){const p=Lt(h),g=De(t,p),m=Ot(h),v=Object.keys(g),y=Qy(m,r,d),S=Yu(p,v,m,y);l=l.concat(S),a=Ka(t,S)}else if(f===Zi.value){const p=De(t,h);if(p===void 0)throw new Error(`Cannot replace: path not found ${tt(h)}`);const g=typeof p=="string"?p:String(p),m=fo(t,e,h),v=Qy(g,r,d),y=[{op:"replace",path:tt(h),value:m?v:hc(v,i)}];l=l.concat(y),a=Ka(t,y)}else throw new Error(`Cannot replace: unknown type of search result field ${f}`)}),{operations:l,newSelection:a}}function P6(t,e){const n=[];let r=0;for(const s of e){const o=t.slice(r,s.start);o!==""&&n.push({resultIndex:void 0,type:"normal",text:o,active:!1});const l=t.slice(s.start,s.end);n.push({resultIndex:s.resultIndex,type:"highlight",text:l,active:s.active}),r=s.end}const i=Ot(e);return i&&i.end<t.length&&n.push({type:"normal",text:t.slice(i.end),resultIndex:void 0,active:!1}),n}function Yy(t){return t.path.concat(t.field,String(t.fieldIndex))}function D6(t){const e=TS(t)?t.searchResults.filter(n=>n.field===Zi.key):void 0;return e&&e.length>0?e:void 0}function I6(t){const e=TS(t)?t.searchResults.filter(n=>n.field===Zi.value):void 0;return e&&e.length>0?e:void 0}const L6={createObjectDocumentState:()=>({type:"object",properties:{}}),createArrayDocumentState:()=>({type:"array",items:[]}),createValueDocumentState:()=>({type:"value"})};function N6(t,e,n,r){return n0(t,e,n,r,L6)}function QS(t,e){return e.reduce((n,r)=>N6(t,n,r.path,(i,s)=>({...s,searchResults:s.searchResults?s.searchResults.concat(r):[r]})),void 0)}function dm(t){const e=(t==null?void 0:t.searchResults)??[],n=$i(t)?Object.values(t.properties).flatMap(dm):wr(t)?t.items.flatMap(dm):[];return e.concat(n)}var j6=J("<span> </span>");function YS(t,e){Ge(e,!1);const n=R();let r=x(e,"text",8),i=x(e,"searchResultItems",8);K(()=>(P(r()),P(i())),()=>{b(n,P6(String(r()),i()))}),Vt(),st();var s=bn(),o=$e(s);Sn(o,1,()=>c(n),Ln,(l,a)=>{var u=bn(),f=$e(u);{var h=p=>{var g=ur();xe(()=>et(g,c(a).text)),D(p,g)},d=p=>{var g=j6();let m;var v=M(g);xe((y,S,k)=>{m=ct(g,1,"jse-highlight svelte-5fb7bl",null,m,y),Jt(g,"data-search-result-index",S),et(v,k)},[()=>({"jse-active":c(a).active}),()=>String(c(a).resultIndex),()=>Qd(c(a).text)],he),D(p,g)};te(f,p=>{c(a).type==="normal"?p(h):p(d,!1)})}D(l,u)}),D(t,s),Xe()}function pm(t){if(t<.9*1e3)return t.toFixed()+" B";const r=t/1e3;if(r<.9*1e3)return r.toFixed(1)+" KB";const i=r/1e3;if(i<.9*1e3)return i.toFixed(1)+" MB";const s=i/1e3;return s<.9*1e3?s.toFixed(1)+" GB":(s/1e3).toFixed(1)+" TB"}var B6=J('<button type="button" class="jse-tag svelte-tqwlgz"><!></button>');function ah(t,e){Ge(e,!0);const n=$r(()=>e.onclick?s=>{s.preventDefault(),s.stopPropagation(),e.onclick()}:void 0);var r=B6();r.__click=function(...s){var o;(o=c(n))==null||o.apply(this,s)};var i=M(r);s_(i,()=>e.children??_a),xe(()=>r.disabled=!e.onclick),D(t,r),Xe()}Fu(["click"]);function F6(t,e,n){typeof e.value=="string"&&c(n)&&Gv(t)&&(t.preventDefault(),t.stopPropagation(),window.open(e.value,"_blank"))}function z6(t,e){e.readOnly||(t.preventDefault(),e.onSelect(Vh(e.path)))}var V6=J('<div role="button" tabindex="-1" data-type="selectable-value"><!> <!></div>');function H6(t,e){Ge(e,!0);let n=Ks(!0);const r=$r(()=>c(n)&&typeof e.value=="string"&&e.value.length>e.truncateTextSize&&(!e.searchResultItems||!e.searchResultItems.some(p=>p.active&&p.end>e.truncateTextSize))),i=$r(()=>c(r)&&typeof e.value=="string"?e.value.substring(0,e.truncateTextSize).trim():e.value),s=$r(()=>zd(e.value));function o(){b(n,!1)}var l=V6();l.__click=[F6,e,s],l.__dblclick=[z6,e];var a=M(l);{var u=p=>{const g=$r(()=>e.normalization.escapeValue(c(i)));YS(p,{get text(){return c(g)},get searchResultItems(){return e.searchResultItems}})},f=p=>{var g=ur();xe(m=>et(g,m),[()=>Qd(e.normalization.escapeValue(c(i)))]),D(p,g)};te(a,p=>{e.searchResultItems?p(u):p(f,!1)})}var h=N(a,2);{var d=p=>{ah(p,{onclick:o,children:(g,m)=>{var v=ur();xe(y=>et(v,`Show more (${y??""})`),[()=>pm(e.value.length)]),D(g,v)},$$slots:{default:!0}})};te(h,p=>{c(r)&&typeof e.value=="string"&&p(d)})}xe(p=>{ct(l,1,p,"svelte-c0g9qz"),Jt(l,"title",c(s)?"Ctrl+Click or Ctrl+Enter to open url in new window":void 0)},[()=>nl(HS(e.value,e.mode,e.parser))]),D(t,l),Xe()}Fu(["click","dblclick"]);var q6=J('<div class="jse-tooltip svelte-14y3y8t"> </div>');function U6(t,e){let n=x(e,"text",8);var r=q6(),i=M(r);xe(()=>et(i,n())),D(t,r)}function so(t,{text:e,openAbsolutePopup:n,closeAbsolutePopup:r}){let i;function s(){i=n(U6,{text:e},{position:"top",width:10*e.length,offsetTop:3,anchor:t,closeOnOuterClick:!0})}function o(){r(i)}return t.addEventListener("mouseenter",s),t.addEventListener("mouseleave",o),{destroy(){t.removeEventListener("mouseenter",s),t.removeEventListener("mouseleave",o)}}}var W6=J('<div class="jse-timestamp svelte-1jla5ec"><!></div>');function J6(t,e){Ge(e,!1);const n=R(void 0,!0),r=el("absolute-popup");let i=x(e,"value",9);K(()=>P(i()),()=>{b(n,`Time: ${new Date(i()).toString()}`)}),Vt(),st(!0);var s=W6(),o=M(s);Dt(o,{data:SD}),Tr(s,(l,a)=>so==null?void 0:so(l,a),()=>({text:c(n),...r})),D(t,s),Xe()}function K6(t){const e=[];return!t.isEditing&&GE(t.value)&&e.push({component:RD,props:t}),!t.isEditing&&XE(t.value)&&e.push({component:BD,props:t}),t.isEditing&&e.push({component:C6,props:t}),t.isEditing||e.push({component:H6,props:t}),!t.isEditing&&Kg(t.value)&&e.push({component:J6,props:t}),e}/*!
|
|
53
|
-
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
|
54
|
-
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
55
|
-
* Copyright 2024 Fonticons, Inc.
|
|
56
|
-
*/const gm={prefix:"fas",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M135.2 17.7C140.6 6.8 151.7 0 163.8 0L284.2 0c12.1 0 23.2 6.8 28.6 17.7L320 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 7.2-14.3zM32 128l384 0 0 320c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-320zm96 64c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16z"]},G6={prefix:"fas",iconName:"down-left-and-up-right-to-center",icon:[512,512,["compress-alt"],"f422","M439 7c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8l-144 0c-13.3 0-24-10.7-24-24l0-144c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39L439 7zM72 272l144 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39L73 505c-9.4 9.4-24.6 9.4-33.9 0L7 473c-9.4-9.4-9.4-24.6 0-33.9l87-87L55 313c-6.9-6.9-8.9-17.2-5.2-26.2s12.5-14.8 22.2-14.8z"]},vu={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]},ZS={prefix:"fas",iconName:"paste",icon:[512,512,["file-clipboard"],"f0ea","M160 0c-23.7 0-44.4 12.9-55.4 32L48 32C21.5 32 0 53.5 0 80L0 400c0 26.5 21.5 48 48 48l144 0 0-272c0-44.2 35.8-80 80-80l48 0 0-16c0-26.5-21.5-48-48-48l-56.6 0C204.4 12.9 183.7 0 160 0zM272 128c-26.5 0-48 21.5-48 48l0 272 0 16c0 26.5 21.5 48 48 48l192 0c26.5 0 48-21.5 48-48l0-220.1c0-12.7-5.1-24.9-14.1-33.9l-67.9-67.9c-9-9-21.2-14.1-33.9-14.1L320 128l-48 0zM160 40a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"]},X6={prefix:"fas",iconName:"circle-notch",icon:[512,512,[],"f1ce","M222.7 32.1c5 16.9-4.6 34.8-21.5 39.8C121.8 95.6 64 169.1 64 256c0 106 86 192 192 192s192-86 192-192c0-86.9-57.8-160.4-137.1-184.1c-16.9-5-26.6-22.9-21.5-39.8s22.9-26.6 39.8-21.5C434.9 42.1 512 140 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 140 77.1 42.1 182.9 10.6c16.9-5 34.8 4.6 39.8 21.5z"]},Q6={prefix:"fas",iconName:"scissors",icon:[512,512,[9984,9986,9988,"cut"],"f0c4","M256 192l-39.5-39.5c4.9-12.6 7.5-26.2 7.5-40.5C224 50.1 173.9 0 112 0S0 50.1 0 112s50.1 112 112 112c14.3 0 27.9-2.7 40.5-7.5L192 256l-39.5 39.5c-12.6-4.9-26.2-7.5-40.5-7.5C50.1 288 0 338.1 0 400s50.1 112 112 112s112-50.1 112-112c0-14.3-2.7-27.9-7.5-40.5L499.2 76.8c7.1-7.1 7.1-18.5 0-25.6c-28.3-28.3-74.1-28.3-102.4 0L256 192zm22.6 150.6L396.8 460.8c28.3 28.3 74.1 28.3 102.4 0c7.1-7.1 7.1-18.5 0-25.6L342.6 278.6l-64 64zM64 112a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm48 240a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"]},Ta=Q6,Y6={prefix:"fas",iconName:"square-caret-down",icon:[448,512,["caret-square-down"],"f150","M384 480c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0zM224 352c-6.7 0-13-2.8-17.6-7.7l-104-112c-6.5-7-8.2-17.2-4.4-25.9s12.5-14.4 22-14.4l208 0c9.5 0 18.2 5.7 22 14.4s2.1 18.9-4.4 25.9l-104 112c-4.5 4.9-10.9 7.7-17.6 7.7z"]},Z6=Y6,$6={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]},e9={prefix:"fas",iconName:"square-check",icon:[448,512,[9745,9989,61510,"check-square"],"f14a","M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]},$S=e9,t9={prefix:"fas",iconName:"pen-to-square",icon:[512,512,["edit"],"f044","M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160L0 416c0 53 43 96 96 96l256 0c53 0 96-43 96-96l0-96c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7-14.3 32-32 32L96 448c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L96 64z"]},n9=t9,r9={prefix:"fas",iconName:"chevron-up",icon:[512,512,[],"f077","M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"]},eC={prefix:"fas",iconName:"angle-right",icon:[320,512,[8250],"f105","M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"]},i9={prefix:"fas",iconName:"square-caret-up",icon:[448,512,["caret-square-up"],"f151","M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32zM224 160c6.7 0 13 2.8 17.6 7.7l104 112c6.5 7 8.2 17.2 4.4 25.9s-12.5 14.4-22 14.4l-208 0c-9.5 0-18.2-5.7-22-14.4s-2.1-18.9 4.4-25.9l104-112c4.5-4.9 10.9-7.7 17.6-7.7z"]},s9=i9,o9={prefix:"fas",iconName:"caret-up",icon:[320,512,[],"f0d8","M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"]},tC={prefix:"fas",iconName:"square",icon:[448,512,[9632,9723,9724,61590],"f0c8","M0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96z"]},ep={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"]},qh={prefix:"fas",iconName:"code",icon:[640,512,[],"f121","M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"]},Ga={prefix:"fas",iconName:"wrench",icon:[512,512,[128295],"f0ad","M352 320c88.4 0 160-71.6 160-160c0-15.3-2.2-30.1-6.2-44.2c-3.1-10.8-16.4-13.2-24.3-5.3l-76.8 76.8c-3 3-7.1 4.7-11.3 4.7L336 192c-8.8 0-16-7.2-16-16l0-57.4c0-4.2 1.7-8.3 4.7-11.3l76.8-76.8c7.9-7.9 5.4-21.2-5.3-24.3C382.1 2.2 367.3 0 352 0C263.6 0 192 71.6 192 160c0 19.1 3.4 37.5 9.5 54.5L19.9 396.1C7.2 408.8 0 426.1 0 444.1C0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9L297.5 310.5c17 6.2 35.4 9.5 54.5 9.5zM80 408a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"]},l9={prefix:"fas",iconName:"eye",icon:[576,512,[128065],"f06e","M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z"]},Ma={prefix:"fas",iconName:"pen",icon:[512,512,[128394],"f304","M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"]},a9={prefix:"fas",iconName:"arrow-rotate-right",icon:[512,512,[8635,"arrow-right-rotate","arrow-rotate-forward","redo"],"f01e","M386.3 160L336 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32l0-128c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0s-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3s163.8-62.5 226.3 0L386.3 160z"]},l0=a9,c9={prefix:"fas",iconName:"arrow-rotate-left",icon:[512,512,[8634,"arrow-left-rotate","arrow-rotate-back","arrow-rotate-backward","undo"],"f0e2","M125.7 160l50.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L48 224c-17.7 0-32-14.3-32-32L16 64c0-17.7 14.3-32 32-32s32 14.3 32 32l0 51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"]},a0=c9,u9={prefix:"fas",iconName:"crop-simple",icon:[512,512,["crop-alt"],"f565","M128 32c0-17.7-14.3-32-32-32S64 14.3 64 32l0 32L32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l32 0 0 256c0 35.3 28.7 64 64 64l224 0 0-64-224 0 0-352zM384 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-32 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-256c0-35.3-28.7-64-64-64L160 64l0 64 224 0 0 352z"]},f9=u9,h9={prefix:"fas",iconName:"gear",icon:[512,512,[9881,"cog"],"f013","M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"]},d9=h9,Wo={prefix:"fas",iconName:"caret-down",icon:[320,512,[],"f0d7","M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"]},p9={prefix:"fas",iconName:"ellipsis-vertical",icon:[128,512,["ellipsis-v"],"f142","M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"]},nC=p9,Sf={prefix:"fas",iconName:"arrow-right-arrow-left",icon:[448,512,[8644,"exchange"],"f0ec","M438.6 150.6c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.7 96 32 96C14.3 96 0 110.3 0 128s14.3 32 32 32l306.7 0-41.4 41.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l96-96zm-333.3 352c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 416 416 416c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0 41.4-41.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96z"]},g9={prefix:"fas",iconName:"arrow-down-short-wide",icon:[576,512,["sort-amount-desc","sort-amount-down-alt"],"f884","M151.6 469.6C145.5 476.2 137 480 128 480s-17.5-3.8-23.6-10.4l-88-96c-11.9-13-11.1-33.3 2-45.2s33.3-11.1 45.2 2L96 365.7 96 64c0-17.7 14.3-32 32-32s32 14.3 32 32l0 301.7 32.4-35.4c11.9-13 32.2-13.9 45.2-2s13.9 32.2 2 45.2l-88 96zM320 32l32 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128l160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-160 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 128l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"]},tp=g9,m9={prefix:"fas",iconName:"angle-down",icon:[448,512,[8964],"f107","M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"]},Zy={prefix:"fas",iconName:"arrow-down",icon:[384,512,[8595],"f063","M169.4 470.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 370.8 224 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 306.7L54.6 265.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"]},v9={prefix:"fas",iconName:"magnifying-glass",icon:[512,512,[128269,"search"],"f002","M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"]},np=v9,y9={prefix:"fas",iconName:"chevron-down",icon:[512,512,[],"f078","M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"]},Fo={prefix:"fas",iconName:"copy",icon:[448,512,[],"f0c5","M208 0L332.1 0c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9L448 336c0 26.5-21.5 48-48 48l-192 0c-26.5 0-48-21.5-48-48l0-288c0-26.5 21.5-48 48-48zM48 128l80 0 0 64-64 0 0 256 192 0 0-32 64 0 0 48c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 176c0-26.5 21.5-48 48-48z"]},Sa={prefix:"fas",iconName:"plus",icon:[448,512,[10133,61543,"add"],"2b","M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"]},rC={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]},b9=rC,rp=rC,x9={prefix:"fas",iconName:"rotate",icon:[512,512,[128260,"sync-alt"],"f2f1","M142.9 142.9c-17.5 17.5-30.1 38-37.8 59.8c-5.9 16.7-24.2 25.4-40.8 19.5s-25.4-24.2-19.5-40.8C55.6 150.7 73.2 122 97.6 97.6c87.2-87.2 228.3-87.5 315.8-1L455 55c6.9-6.9 17.2-8.9 26.2-5.2s14.8 12.5 14.8 22.2l0 128c0 13.3-10.7 24-24 24l-8.4 0c0 0 0 0 0 0L344 224c-9.7 0-18.5-5.8-22.2-14.8s-1.7-19.3 5.2-26.2l41.1-41.1c-62.6-61.5-163.1-61.2-225.3 1zM16 312c0-13.3 10.7-24 24-24l7.6 0 .7 0L168 288c9.7 0 18.5 5.8 22.2 14.8s1.7 19.3-5.2 26.2l-41.1 41.1c62.6 61.5 163.1 61.2 225.3-1c17.5-17.5 30.1-38 37.8-59.8c5.9-16.7 24.2-25.4 40.8-19.5s25.4 24.2 19.5 40.8c-10.8 30.6-28.4 59.3-52.9 83.8c-87.2 87.2-228.3 87.5-315.8 1L57 457c-6.9 6.9-17.2 8.9-26.2 5.2S16 449.7 16 440l0-119.6 0-.7 0-7.6z"]},w9={prefix:"fas",iconName:"up-right-and-down-left-from-center",icon:[512,512,["expand-alt"],"f424","M344 0L488 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87L327 41c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512L24 512c-13.3 0-24-10.7-24-24L0 344c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8z"]},iC={prefix:"fas",iconName:"clone",icon:[512,512,[],"f24d","M288 448L64 448l0-224 64 0 0-64-64 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l224 0c35.3 0 64-28.7 64-64l0-64-64 0 0 64zm-64-96l224 0c35.3 0 64-28.7 64-64l0-224c0-35.3-28.7-64-64-64L224 0c-35.3 0-64 28.7-64 64l0 224c0 35.3 28.7 64 64 64z"]},c0={prefix:"fas",iconName:"check",icon:[448,512,[10003,10004],"f00c","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"]},S9={prefix:"fas",iconName:"triangle-exclamation",icon:[512,512,[9888,"exclamation-triangle","warning"],"f071","M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480L40 480c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24l0 112c0 13.3 10.7 24 24 24s24-10.7 24-24l0-112c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"]},Vl=S9;function ts(t){return t.map((e,n)=>A9.test(e)?"["+e+"]":/[.[\]]/.test(e)||e===""?'["'+C9(e)+'"]':(n>0?".":"")+e).join("")}function C9(t){return t.replace(/"/g,'\\"')}function k9(t){const e=[];let n=0;for(;n<t.length;)t[n]==="."&&n++,t[n]==="["?(n++,t[n]==='"'?(n++,e.push(r(s=>s==='"',!0)),i('"')):e.push(r(s=>s==="]")),i("]")):e.push(r(s=>s==="."||s==="["));function r(s,o=!1){let l="";for(;n<t.length&&!s(t[n]);)o&&t[n]==="\\"&&t[n+1]==='"'?(l+='"',n+=2):(l+=t[n],n++);return l}function i(s){if(t[n]!==s)throw new SyntaxError(`Invalid JSON path: ${s} expected at position ${n}`);n++}return e}function Ao(t){return{value:t,label:Yt(t)?"(item root)":ts(t)}}const A9=/^\d+$/,O9={},_9={showWizard:!0,showOriginal:!0},Uh=Math.min,_l=Math.max,Wh=Math.round,Cf=Math.floor,Ls=t=>({x:t,y:t}),E9={left:"right",right:"left",bottom:"top",top:"bottom"},T9={start:"end",end:"start"};function $y(t,e,n){return _l(t,Uh(e,n))}function ip(t,e){return typeof t=="function"?t(e):t}function Hl(t){return t.split("-")[0]}function sp(t){return t.split("-")[1]}function sC(t){return t==="x"?"y":"x"}function oC(t){return t==="y"?"height":"width"}function El(t){return["top","bottom"].includes(Hl(t))?"y":"x"}function lC(t){return sC(El(t))}function M9(t,e,n){n===void 0&&(n=!1);const r=sp(t),i=lC(t),s=oC(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Jh(o)),[o,Jh(o)]}function R9(t){const e=Jh(t);return[mm(t),e,mm(e)]}function mm(t){return t.replace(/start|end/g,e=>T9[e])}function P9(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function D9(t,e,n,r){const i=sp(t);let s=P9(Hl(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(mm)))),s}function Jh(t){return t.replace(/left|right|bottom|top/g,e=>E9[e])}function I9(t){return{top:0,right:0,bottom:0,left:0,...t}}function L9(t){return typeof t!="number"?I9(t):{top:t,right:t,bottom:t,left:t}}function Kh(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function eb(t,e,n){let{reference:r,floating:i}=t;const s=El(e),o=lC(e),l=oC(o),a=Hl(e),u=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,d=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:f,y:r.y-i.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}switch(sp(e)){case"start":p[o]-=d*(n&&u?-1:1);break;case"end":p[o]+=d*(n&&u?-1:1);break}return p}const N9=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:h}=eb(u,r,a),d=r,p={},g=0;for(let m=0;m<l.length;m++){const{name:v,fn:y}=l[m],{x:S,y:k,data:C,reset:w}=await y({x:f,y:h,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:u,platform:o,elements:{reference:t,floating:e}});f=S??f,h=k??h,p={...p,[v]:{...p[v],...C}},w&&g<=50&&(g++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(u=w.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):w.rects),{x:f,y:h}=eb(u,d,a)),m=-1)}return{x:f,y:h,placement:d,strategy:i,middlewareData:p}};async function aC(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:d=!1,padding:p=0}=ip(e,t),g=L9(p),v=l[d?h==="floating"?"reference":"floating":h],y=Kh(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:f,strategy:a})),S=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},w=Kh(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:S,offsetParent:k,strategy:a}):S);return{top:(y.top-w.top+g.top)/C.y,bottom:(w.bottom-y.bottom+g.bottom)/C.y,left:(y.left-w.left+g.left)/C.x,right:(w.right-y.right+g.right)/C.x}}const j9=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=ip(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Hl(i),S=El(l),k=Hl(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(u.floating)),w=d||(k||!m?[Jh(l)]:R9(l)),E=g!=="none";!d&&E&&w.push(...D9(l,m,g,C));const A=[l,...w],O=await aC(e,v),H=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&H.push(O[y]),h){const Y=M9(i,o,C);H.push(O[Y[0]],O[Y[1]])}if(W=[...W,{placement:i,overflows:H}],!H.every(Y=>Y<=0)){var G,V;const Y=(((G=s.flip)==null?void 0:G.index)||0)+1,ie=A[Y];if(ie){var U;const X=h==="alignment"?S!==El(ie):!1,I=((U=W[0])==null?void 0:U.overflows[0])>0;if(!X||I)return{data:{index:Y,overflows:W},reset:{placement:ie}}}let F=(V=W.filter(X=>X.overflows[0]<=0).sort((X,I)=>X.overflows[1]-I.overflows[1])[0])==null?void 0:V.placement;if(!F)switch(p){case"bestFit":{var Q;const X=(Q=W.filter(I=>{if(E){const se=El(I.placement);return se===S||se==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(se=>se>0).reduce((se,ce)=>se+ce,0)]).sort((I,se)=>I[1]-se[1])[0])==null?void 0:Q[0];X&&(F=X);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};async function B9(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hl(n),l=sp(n),a=El(n)==="y",u=["left","top"].includes(o)?-1:1,f=s&&a?-1:1,h=ip(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),a?{x:p*f,y:d*u}:{x:d*u,y:p*f}}const F9=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await B9(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},z9=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:y,y:S}=v;return{x:y,y:S}}},...a}=ip(t,e),u={x:n,y:r},f=await aC(e,a),h=El(Hl(i)),d=sC(h);let p=u[d],g=u[h];if(s){const v=d==="y"?"top":"left",y=d==="y"?"bottom":"right",S=p+f[v],k=p-f[y];p=$y(S,p,k)}if(o){const v=h==="y"?"top":"left",y=h==="y"?"bottom":"right",S=g+f[v],k=g-f[y];g=$y(S,g,k)}const m=l.fn({...e,[d]:p,[h]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:s,[h]:o}}}}}};function op(){return typeof window<"u"}function vc(t){return cC(t)?(t.nodeName||"").toLowerCase():"#document"}function bi(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vs(t){var e;return(e=(cC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function cC(t){return op()?t instanceof Node||t instanceof bi(t).Node:!1}function ns(t){return op()?t instanceof Element||t instanceof bi(t).Element:!1}function Bs(t){return op()?t instanceof HTMLElement||t instanceof bi(t).HTMLElement:!1}function tb(t){return!op()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof bi(t).ShadowRoot}function Zu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=rs(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function V9(t){return["table","td","th"].includes(vc(t))}function lp(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function u0(t){const e=f0(),n=ns(t)?rs(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function H9(t){let e=Jo(t);for(;Bs(e)&&!Xa(e);){if(u0(e))return e;if(lp(e))return null;e=Jo(e)}return null}function f0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Xa(t){return["html","body","#document"].includes(vc(t))}function rs(t){return bi(t).getComputedStyle(t)}function ap(t){return ns(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Jo(t){if(vc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tb(t)&&t.host||Vs(t);return tb(e)?e.host:e}function uC(t){const e=Jo(t);return Xa(e)?t.ownerDocument?t.ownerDocument.body:t.body:Bs(e)&&Zu(e)?e:uC(e)}function yu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=uC(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=bi(i);if(s){const l=vm(o);return e.concat(o,o.visualViewport||[],Zu(i)?i:[],l&&n?yu(l):[])}return e.concat(i,yu(i,[],n))}function vm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function fC(t){const e=rs(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Bs(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,l=Wh(n)!==s||Wh(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function h0(t){return ns(t)?t:t.contextElement}function Ra(t){const e=h0(t);if(!Bs(e))return Ls(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=fC(e);let o=(s?Wh(n.width):n.width)/r,l=(s?Wh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const q9=Ls(0);function hC(t){const e=bi(t);return!f0()||!e.visualViewport?q9:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function U9(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==bi(t)?!1:e}function ql(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=h0(t);let o=Ls(1);e&&(r?ns(r)&&(o=Ra(r)):o=Ra(t));const l=U9(s,n,r)?hC(s):Ls(0);let a=(i.left+l.x)/o.x,u=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const d=bi(s),p=r&&ns(r)?bi(r):r;let g=d,m=vm(g);for(;m&&r&&p!==g;){const v=Ra(m),y=m.getBoundingClientRect(),S=rs(m),k=y.left+(m.clientLeft+parseFloat(S.paddingLeft))*v.x,C=y.top+(m.clientTop+parseFloat(S.paddingTop))*v.y;a*=v.x,u*=v.y,f*=v.x,h*=v.y,a+=k,u+=C,g=bi(m),m=vm(g)}}return Kh({width:f,height:h,x:a,y:u})}function d0(t,e){const n=ap(t).scrollLeft;return e?e.left+n:ql(Vs(t)).left+n}function dC(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:d0(t,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function W9(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Vs(r),l=e?lp(e.floating):!1;if(r===o||l&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ls(1);const f=Ls(0),h=Bs(r);if((h||!h&&!s)&&((vc(r)!=="body"||Zu(o))&&(a=ap(r)),Bs(r))){const p=ql(r);u=Ra(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const d=o&&!h&&!s?dC(o,a,!0):Ls(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+f.x+d.x,y:n.y*u.y-a.scrollTop*u.y+f.y+d.y}}function J9(t){return Array.from(t.getClientRects())}function K9(t){const e=Vs(t),n=ap(t),r=t.ownerDocument.body,i=_l(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=_l(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+d0(t);const l=-n.scrollTop;return rs(r).direction==="rtl"&&(o+=_l(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}function G9(t,e){const n=bi(t),r=Vs(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const u=f0();(!u||u&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l,y:a}}function X9(t,e){const n=ql(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Bs(t)?Ra(t):Ls(1),o=t.clientWidth*s.x,l=t.clientHeight*s.y,a=i*s.x,u=r*s.y;return{width:o,height:l,x:a,y:u}}function nb(t,e,n){let r;if(e==="viewport")r=G9(t,n);else if(e==="document")r=K9(Vs(t));else if(ns(e))r=X9(e,n);else{const i=hC(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Kh(r)}function pC(t,e){const n=Jo(t);return n===e||!ns(n)||Xa(n)?!1:rs(n).position==="fixed"||pC(n,e)}function Q9(t,e){const n=e.get(t);if(n)return n;let r=yu(t,[],!1).filter(l=>ns(l)&&vc(l)!=="body"),i=null;const s=rs(t).position==="fixed";let o=s?Jo(t):t;for(;ns(o)&&!Xa(o);){const l=rs(o),a=u0(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zu(o)&&!a&&pC(t,o))?r=r.filter(f=>f!==o):i=l,o=Jo(o)}return e.set(t,r),r}function Y9(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?lp(e)?[]:Q9(e,this._c):[].concat(n),r],l=o[0],a=o.reduce((u,f)=>{const h=nb(e,f,i);return u.top=_l(h.top,u.top),u.right=Uh(h.right,u.right),u.bottom=Uh(h.bottom,u.bottom),u.left=_l(h.left,u.left),u},nb(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Z9(t){const{width:e,height:n}=fC(t);return{width:e,height:n}}function $9(t,e,n){const r=Bs(e),i=Vs(e),s=n==="fixed",o=ql(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=Ls(0);function u(){a.x=d0(i)}if(r||!r&&!s)if((vc(e)!=="body"||Zu(i))&&(l=ap(e)),r){const p=ql(e,!0,s,e);a.x=p.x+e.clientLeft,a.y=p.y+e.clientTop}else i&&u();s&&!r&&i&&u();const f=i&&!r&&!s?dC(i,l):Ls(0),h=o.left+l.scrollLeft-a.x-f.x,d=o.top+l.scrollTop-a.y-f.y;return{x:h,y:d,width:o.width,height:o.height}}function eg(t){return rs(t).position==="static"}function rb(t,e){if(!Bs(t)||rs(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Vs(t)===n&&(n=n.ownerDocument.body),n}function gC(t,e){const n=bi(t);if(lp(t))return n;if(!Bs(t)){let i=Jo(t);for(;i&&!Xa(i);){if(ns(i)&&!eg(i))return i;i=Jo(i)}return n}let r=rb(t,e);for(;r&&V9(r)&&eg(r);)r=rb(r,e);return r&&Xa(r)&&eg(r)&&!u0(r)?n:r||H9(t)||n}const eI=async function(t){const e=this.getOffsetParent||gC,n=this.getDimensions,r=await n(t.floating);return{reference:$9(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tI(t){return rs(t).direction==="rtl"}const nI={convertOffsetParentRelativeRectToViewportRelativeRect:W9,getDocumentElement:Vs,getClippingRect:Y9,getOffsetParent:gC,getElementRects:eI,getClientRects:J9,getDimensions:Z9,getScale:Ra,isElement:ns,isRTL:tI};function mC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function rI(t,e){let n=null,r;const i=Vs(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const u=t.getBoundingClientRect(),{left:f,top:h,width:d,height:p}=u;if(l||e(),!d||!p)return;const g=Cf(h),m=Cf(i.clientWidth-(f+d)),v=Cf(i.clientHeight-(h+p)),y=Cf(f),k={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:_l(0,Uh(1,a))||1};let C=!0;function w(E){const A=E[0].intersectionRatio;if(A!==a){if(!C)return o();A?o(!1,A):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A===1&&!mC(u,t.getBoundingClientRect())&&o(),C=!1}try{n=new IntersectionObserver(w,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,k)}n.observe(t)}return o(!0),s}function iI(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=h0(t),f=i||s?[...u?yu(u):[],...yu(e)]:[];f.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&l?rI(u,n):null;let d=-1,p=null;o&&(p=new ResizeObserver(y=>{let[S]=y;S&&S.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),u&&!a&&p.observe(u),p.observe(e));let g,m=a?ql(t):null;a&&v();function v(){const y=ql(t);m&&!mC(m,y)&&n(),m=y,g=requestAnimationFrame(v)}return n(),()=>{var y;f.forEach(S=>{i&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,a&&cancelAnimationFrame(g)}}const sI=F9,oI=z9,lI=j9,aI=(t,e,n)=>{const r=new Map,i={platform:nI,...n},s={...i.platform,_c:r};return N9(t,e,{...i,platform:s})};function cI(t){let e,n;const r={autoUpdate:!0};let i=t;const s=f=>({...r,...t||{},...f||{}}),o=f=>{e&&n&&(i=s(f),aI(e,n,i).then(h=>{Object.assign(n.style,{position:h.strategy,left:`${h.x}px`,top:`${h.y}px`}),i!=null&&i.onComputed&&i.onComputed(h)}))},l=f=>{if("subscribe"in f)return u(f),{};e=f,o()},a=(f,h)=>{let d;n=f,i=s(h),setTimeout(()=>o(h),0),o(h);const p=()=>{d&&(d(),d=void 0)},g=({autoUpdate:m}=i||{})=>{p(),m!==!1&&B3().then(()=>iI(e,n,()=>o(i),m===!0?{}:m))};return d=g(),{update(m){o(m),d=g(m)},destroy(){p()}}},u=f=>{const h=f.subscribe(d=>{e===void 0?(e=d,o()):(Object.assign(e,d),o())});Ii(h)};return[l,a,o]}function uI({loadOptions:t,filterText:e,items:n,multiple:r,value:i,itemId:s,groupBy:o,filterSelectedItems:l,itemFilter:a,convertStringItemsToObjects:u,filterGroupedItems:f,label:h}){if(n&&t)return n;if(!n)return[];n&&n.length>0&&typeof n[0]!="object"&&(n=u(n));let d=n.filter(p=>{let g=a(p[h],e,p);return g&&r&&(i!=null&&i.length)&&(g=!i.some(m=>l?m[s]===p[s]:!1)),g});return o&&(d=f(d)),d}async function fI({dispatch:t,loadOptions:e,convertStringItemsToObjects:n,filterText:r}){let i=await e(r).catch(s=>{console.warn("svelte-select loadOptions error :>> ",s),t("error",{type:"loadOptions",details:s})});if(i&&!i.cancelled)return i?(i&&i.length>0&&typeof i[0]!="object"&&(i=n(i)),t("loaded",{items:i})):i=[],{filteredItems:i,loading:!1,focused:!0,listOpen:!0}}var hI=tl(`<svg width="100%" height="100%" viewBox="0 0 20 20" focusable="false" aria-hidden="true" class="svelte-qbd276"><path fill="currentColor" d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747
|
|
57
|
-
3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0
|
|
58
|
-
1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502
|
|
59
|
-
0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0
|
|
60
|
-
0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"></path></svg>`);function dI(t){var e=hI();D(t,e)}var pI=tl(`<svg width="100%" height="100%" viewBox="-2 -2 50 50" focusable="false" aria-hidden="true" role="presentation" class="svelte-whdbu1"><path fill="currentColor" d="M34.923,37.251L24,26.328L13.077,37.251L9.436,33.61l10.923-10.923L9.436,11.765l3.641-3.641L24,19.047L34.923,8.124
|
|
61
|
-
l3.641,3.641L27.641,22.688L38.564,33.61L34.923,37.251z"></path></svg>`);function tg(t){var e=pI();D(t,e)}var gI=tl('<svg class="loading svelte-1p3nqvd" viewBox="25 25 50 50"><circle class="circle_path svelte-1p3nqvd" cx="50" cy="50" r="20" fill="none" stroke="currentColor" stroke-width="5" stroke-miterlimit="10"></circle></svg>');function mI(t){var e=gI();D(t,e)}var vI=J('<div class="list-item svelte-82qwg8" tabindex="-1" role="none"><div><!></div></div>'),yI=J('<div class="empty svelte-82qwg8">No options</div>'),bI=J('<div role="none"><!> <!> <!></div>'),xI=J('<span id="aria-selection" class="svelte-82qwg8"> </span> <span id="aria-context" class="svelte-82qwg8"> </span>',1),wI=J('<div class="multi-item-clear svelte-82qwg8"><!></div>'),SI=J('<div role="none"><span class="multi-item-text svelte-82qwg8"><!></span> <!></div>'),CI=J("<div><!></div>"),kI=J('<div class="icon loading svelte-82qwg8" aria-hidden="true"><!></div>'),AI=J('<button type="button" class="icon clear-select svelte-82qwg8"><!></button>'),OI=J('<div class="icon chevron svelte-82qwg8" aria-hidden="true"><!></div>'),_I=J('<input type="hidden" class="svelte-82qwg8">'),EI=J('<select class="required svelte-82qwg8" required tabindex="-1" aria-hidden="true"></select>'),TI=J('<div role="none"><!> <span aria-live="polite" aria-atomic="false" aria-relevant="additions text" class="a11y-text svelte-82qwg8"><!></span> <div class="prepend svelte-82qwg8"><!></div> <div class="value-container svelte-82qwg8"><!> <input></div> <div class="indicators svelte-82qwg8"><!> <!> <!></div> <!> <!></div>');function yl(t,e){const n=i_(e);Ge(e,!1);const r=R(),i=R(),s=R(),o=R(),l=R(),a=R(),u=R(),f=R(),h=R(),d=y_();let p=x(e,"justValue",12,null),g=x(e,"filter",8,uI),m=x(e,"getItems",8,fI),v=x(e,"id",8,null),y=x(e,"name",8,null),S=x(e,"container",12,void 0),k=x(e,"input",12,void 0),C=x(e,"multiple",8,!1),w=x(e,"multiFullItemClearable",8,!1),E=x(e,"disabled",8,!1),A=x(e,"focused",12,!1),O=x(e,"value",12,null),H=x(e,"filterText",12,""),W=x(e,"placeholder",8,"Please select"),G=x(e,"placeholderAlwaysShow",8,!1),V=x(e,"items",12,null),U=x(e,"label",8,"label"),Q=x(e,"itemFilter",8,(Z,ve,ut)=>`${Z}`.toLowerCase().includes(ve.toLowerCase())),Y=x(e,"groupBy",8,void 0),ie=x(e,"groupFilter",8,Z=>Z),F=x(e,"groupHeaderSelectable",8,!1),X=x(e,"itemId",8,"value"),I=x(e,"loadOptions",8,void 0),se=x(e,"containerStyles",8,""),ce=x(e,"hasError",8,!1),Te=x(e,"filterSelectedItems",8,!0),le=x(e,"required",8,!1),de=x(e,"closeListOnChange",8,!0),ne=x(e,"clearFilterTextOnBlur",8,!0),ue=x(e,"createGroupHeaderItem",8,(Z,ve)=>({value:Z,[U()]:Z}));const ge=()=>c(u);let j=x(e,"searchable",8,!0),we=x(e,"inputStyles",8,""),Pe=x(e,"clearable",8,!0),q=x(e,"loading",12,!1),B=x(e,"listOpen",12,!1),Se,ke=x(e,"debounce",8,(Z,ve=1)=>{clearTimeout(Se),Se=setTimeout(Z,ve)}),z=x(e,"debounceWait",8,300),L=x(e,"hideEmptyState",8,!1),ze=x(e,"inputAttributes",24,()=>({})),We=x(e,"listAutoWidth",8,!0),je=x(e,"showChevron",8,!1),Qe=x(e,"listOffset",8,5),be=x(e,"hoverItemIndex",12,0),gt=x(e,"floatingConfig",24,()=>({})),Ye=x(e,"class",8,""),Ve=R(),_t=R(),Nt=R(),Ae=R();function Je(){if(typeof O()=="string"){let Z=(V()||[]).find(ve=>ve[X()]===O());O(Z||{[X()]:O(),label:O()})}else C()&&Array.isArray(O())&&O().length>0&&O(O().map(Z=>typeof Z=="string"?{value:Z,label:Z}:Z))}let ht=R();function it(){b(ht,Object.assign({autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:!1,tabindex:0,type:"text","aria-autocomplete":"list"},ze())),v()&&gi(ht,c(ht).id=v()),j()||gi(ht,c(ht).readonly=!0)}function vt(Z){return Z.map((ve,ut)=>({index:ut,value:ve,label:`${ve}`}))}function Ze(Z){const ve=[],ut={};Z.forEach(Tn=>{const Cn=Y()(Tn);ve.includes(Cn)||(ve.push(Cn),ut[Cn]=[],Cn&&ut[Cn].push(Object.assign(ue()(Cn,Tn),{id:Cn,groupHeader:!0,selectable:F()}))),ut[Cn].push(Object.assign({groupItem:!!Cn},Tn))});const un=[];return ie()(ve).forEach(Tn=>{ut[Tn]&&un.push(...ut[Tn])}),un}function rt(){if(C()){JSON.stringify(O())!==JSON.stringify(c(_t))&&ln()&&d("input",O());return}(!c(_t)||JSON.stringify(O()[X()])!==JSON.stringify(c(_t)[X()]))&&d("input",O())}function Le(){O()&&(Array.isArray(O())?O([...O()]):O([O()]))}function oe(){O()&&O(null)}function Et(){const Z=c(u).findIndex(ve=>ve[X()]===O()[X()]);Un(Z,!0)}function bt(Z){d("hoverItem",Z)}function Un(Z=0,ve){be(Z<0?0:Z),!ve&&Y()&&c(u)[be()]&&!c(u)[be()].selectable&&Ke(1)}function fr(){!I()&&H().length===0||(I()?ke()(async function(){q(!0);let Z=await m()({dispatch:d,loadOptions:I(),convertStringItemsToObjects:vt,filterText:H()});Z?(q(Z.loading),B(B()?Z.listOpen:H().length>0),A(B()&&Z.focused),V(Y()?Ze(Z.filteredItems):Z.filteredItems)):(q(!1),A(!0),B(!0))},z()):(B(!0),C()&&b(Ve,void 0)))}function ot(Z){B()&&d("filter",Z)}b_(async()=>{b(_t,O()),b(Nt,H()),b(Ae,C())});function Ht(){return C()?O()?O().map(Z=>Z[X()]):null:O()?O()[X()]:O()}function ln(){let Z=!0;if(O()){const ve=[],ut=[];O().forEach(un=>{ve.includes(un[X()])?Z=!1:(ve.push(un[X()]),ut.push(un))}),Z||O(ut)}return Z}function Gt(Z){let ve=Z?Z[X()]:O()[X()];return V().find(ut=>ut[X()]===ve)}function lt(Z){!Z||Z.length===0||Z.some(ve=>typeof ve!="object")||!O()||(C()?O().some(ve=>!ve||!ve[X()]):!O()[X()])||(Array.isArray(O())?O(O().map(ve=>Gt(ve)||ve)):O(Gt()||O()))}async function yt(Z){const ve=O()[Z];O().length===1?O(void 0):O(O().filter(ut=>ut!==ve)),d("clear",ve)}function Xt(Z){if(A())switch(Z.stopPropagation(),Z.key){case"Escape":Z.preventDefault(),mt();break;case"Enter":if(Z.preventDefault(),B()){if(c(u).length===0)break;const ve=c(u)[be()];if(O()&&!C()&&O()[X()]===ve[X()]){mt();break}else me(c(u)[be()])}break;case"ArrowDown":Z.preventDefault(),B()?Ke(1):(B(!0),b(Ve,void 0));break;case"ArrowUp":Z.preventDefault(),B()?Ke(-1):(B(!0),b(Ve,void 0));break;case"Tab":if(B()&&A()){if(c(u).length===0||O()&&O()[X()]===c(u)[be()][X()])return mt();Z.preventDefault(),me(c(u)[be()]),mt()}break;case"Backspace":if(!C()||H().length>0)return;if(C()&&O()&&O().length>0){if(yt(c(Ve)!==void 0?c(Ve):O().length-1),c(Ve)===0||c(Ve)===void 0)break;b(Ve,O().length>c(Ve)?c(Ve)-1:void 0)}break;case"ArrowLeft":if(!O()||!C()||H().length>0)return;c(Ve)===void 0?b(Ve,O().length-1):O().length>c(Ve)&&c(Ve)!==0&&b(Ve,c(Ve)-1);break;case"ArrowRight":if(!O()||!C()||H().length>0||c(Ve)===void 0)return;c(Ve)===O().length-1?b(Ve,void 0):c(Ve)<O().length-1&&b(Ve,c(Ve)+1);break}}function nn(Z){var ve;A()&&k()===(document==null?void 0:document.activeElement)||(Z&&d("focus",Z),(ve=k())==null||ve.focus(),A(!0))}async function Ft(Z){var ve;fn||(B()||A())&&(d("blur",Z),mt(),A(!1),b(Ve,void 0),(ve=k())==null||ve.blur())}function qt(){if(!E()){if(H().length>0)return B(!0);B(!B())}}function rn(){d("clear",O()),O(void 0),mt(),nn()}Cr(()=>{B()&&A(!0),A()&&k()&&k().focus()});function Gn(Z){if(Z){H("");const ve=Object.assign({},Z);if(ve.groupHeader&&!ve.selectable)return;O(C()?O()?O().concat([ve]):[ve]:O(ve)),setTimeout(()=>{de()&&mt(),b(Ve,void 0),d("change",O()),d("select",Z)})}}function mt(){ne()&&H(""),B(!1)}let dt=x(e,"ariaValues",8,Z=>`Option ${Z}, selected.`),Tt=x(e,"ariaListOpen",8,(Z,ve)=>`You are currently focused on option ${Z}. There are ${ve} results available.`),an=x(e,"ariaFocused",8,()=>"Select is focused, type to refine list, press down to open the menu.");function $t(Z){let ve;return Z&&O().length>0?ve=O().map(ut=>ut[U()]).join(", "):ve=O()[U()],dt()(ve)}function sn(){if(!c(u)||c(u).length===0)return"";let Z=c(u)[be()];if(B()&&Z){let ve=c(u)?c(u).length:0;return Tt()(Z[U()],ve)}else return an()()}let jt=R(null),on;function En(){clearTimeout(on),on=setTimeout(()=>{fn=!1},100)}function Wn(Z){var ve;!B()&&!A()&&S()&&!S().contains(Z.target)&&!((ve=c(jt))!=null&&ve.contains(Z.target))&&Ft()}Ii(()=>{var Z;(Z=c(jt))==null||Z.remove()});let fn=!1;function me(Z){!Z||Z.selectable===!1||Gn(Z)}function xt(Z){fn||be(Z)}function mn(Z){const{item:ve,i:ut}=Z;if((ve==null?void 0:ve.selectable)!==!1){if(O()&&!C()&&O()[X()]===ve[X()])return mt();kr(ve)&&(be(ut),me(ve))}}function Ke(Z){if(c(u).filter(un=>!Object.hasOwn(un,"selectable")||un.selectable===!0).length===0)return be(0);Z>0&&be()===c(u).length-1?be(0):Z<0&&be()===0?be(c(u).length-1):be(be()+Z);const ut=c(u)[be()];if(ut&&ut.selectable===!1){(Z===1||Z===-1)&&Ke(Z);return}}function ir(Z,ve,ut){if(!C())return ve&&ve[ut]===Z[ut]}function Fn(Z){return Z===0}function kr(Z){return Z.groupHeader&&Z.selectable||Z.selectable||!Z.hasOwnProperty("selectable")}const si=fs,oi=fs;function fs(Z){return{update(ve){ve.scroll&&(En(),Z.scrollIntoView({behavior:"auto",block:"nearest"}))}}}function hs(){const{width:Z}=S().getBoundingClientRect();gi(jt,c(jt).style.width=We()?Z+"px":"auto")}let hr=R({strategy:"absolute",placement:"bottom-start",middleware:[sI(Qe()),lI(),oI()],autoUpdate:!1});const[ee,Oe,pt]=cI(c(hr));let Mt=R(!0);function St(Z,ve){if(!Z||!ve)return b(Mt,!0);setTimeout(()=>{b(Mt,!1)},0)}K(()=>(P(V()),P(O())),()=>{V(),O()&&Je()}),K(()=>(P(ze()),P(j())),()=>{(ze()||!j())&&it()}),K(()=>P(C()),()=>{C()&&Le()}),K(()=>(c(Ae),P(C())),()=>{c(Ae)&&!C()&&oe()}),K(()=>(P(C()),P(O())),()=>{C()&&O()&&O().length>1&&ln()}),K(()=>P(O()),()=>{O()&&rt()}),K(()=>(P(O()),P(C()),c(_t)),()=>{!O()&&C()&&c(_t)&&d("input",O())}),K(()=>(P(A()),P(k())),()=>{!A()&&k()&&mt()}),K(()=>(P(H()),c(Nt)),()=>{H()!==c(Nt)&&fr()}),K(()=>(P(g()),P(I()),P(H()),P(V()),P(C()),P(O()),P(X()),P(Y()),P(U()),P(Te()),P(Q())),()=>{b(u,g()({loadOptions:I(),filterText:H(),items:V(),multiple:C(),value:O(),itemId:X(),groupBy:Y(),label:U(),filterSelectedItems:Te(),itemFilter:Q(),convertStringItemsToObjects:vt,filterGroupedItems:Ze}))}),K(()=>(P(C()),P(B()),P(O()),c(u)),()=>{!C()&&B()&&O()&&c(u)&&Et()}),K(()=>(P(B()),P(C())),()=>{B()&&C()&&be(0)}),K(()=>P(H()),()=>{H()&&be(0)}),K(()=>P(be()),()=>{bt(be())}),K(()=>(P(C()),P(O())),()=>{b(r,C()?O()&&O().length>0:O())}),K(()=>(c(r),P(H())),()=>{b(i,c(r)&&H().length>0)}),K(()=>(c(r),P(Pe()),P(E()),P(q())),()=>{b(s,c(r)&&Pe()&&!E()&&!q())}),K(()=>(P(G()),P(C()),P(W()),P(O())),()=>{var Z;b(o,G()&&C()||C()&&((Z=O())==null?void 0:Z.length)===0?W():O()?"":W())}),K(()=>(P(O()),P(C())),()=>{b(l,O()?$t(C()):"")}),K(()=>(c(u),P(be()),P(A()),P(B())),()=>{b(a,sn({filteredItems:c(u),hoverItemIndex:be(),focused:A(),listOpen:B()}))}),K(()=>P(V()),()=>{lt(V())}),K(()=>(P(C()),P(O()),P(X())),()=>{p(Ht(C(),O(),X()))}),K(()=>(P(C()),c(_t),P(O())),()=>{!C()&&c(_t)&&!O()&&d("input",O())}),K(()=>(P(B()),c(u),P(C()),P(O())),()=>{B()&&c(u)&&!C()&&!O()&&Un()}),K(()=>c(u),()=>{ot(c(u))}),K(()=>(P(S()),P(gt()),c(hr)),()=>{S()&>()&&pt(Object.assign(c(hr),gt()))}),K(()=>c(jt),()=>{b(f,!!c(jt))}),K(()=>(c(jt),P(B())),()=>{St(c(jt),B())}),K(()=>(P(B()),P(S()),c(jt)),()=>{B()&&S()&&c(jt)&&hs()}),K(()=>P(be()),()=>{b(h,be())}),K(()=>(P(k()),P(B()),P(A())),()=>{k()&&B()&&!A()&&nn()}),K(()=>(P(S()),P(gt())),()=>{var Z;S()&&((Z=gt())==null?void 0:Z.autoUpdate)===void 0&&gi(hr,c(hr).autoUpdate=!0)}),Vt(),st();var Rt=TI();ae("click",to,Wn),ae("keydown",to,Xt);let cn;var sr=M(Rt);{var jn=Z=>{var ve=bI();let ut;var un=M(ve);{var Tn=ye=>{var Ee=bn(),nt=$e(Ee);Pn(nt,e,"list-prepend",{},null),D(ye,Ee)};te(un,ye=>{n["list-prepend"]&&ye(Tn)})}var Cn=N(un,2);{var ai=ye=>{var Ee=bn(),nt=$e(Ee);Pn(nt,e,"list",{get filteredItems(){return c(u)}},null),D(ye,Ee)},ms=(ye,Ee)=>{{var nt=kn=>{var Ct=bn(),An=$e(Ct);Sn(An,1,()=>c(u),Ln,(_,$,Ce)=>{var Be=vI(),Me=M(Be);let Ue;var Jn=M(Me);Pn(Jn,e,"item",{get item(){return c($)},index:Ce},kt=>{var Nr=ur();xe(()=>{var ci;return et(Nr,(ci=c($))==null?void 0:ci[U()])}),D(kt,Nr)}),Tr(Me,(kt,Nr)=>si==null?void 0:si(kt),()=>({scroll:ir(c($),O(),X()),listDom:c(f)})),Tr(Me,(kt,Nr)=>oi==null?void 0:oi(kt),()=>({scroll:c(h)===Ce,listDom:c(f)})),xe(kt=>Ue=ct(Me,1,"item svelte-82qwg8",null,Ue,kt),[()=>{var kt;return{"list-group-title":c($).groupHeader,active:ir(c($),O(),X()),first:Fn(Ce),hover:be()===Ce,"group-item":c($).groupItem,"not-selectable":((kt=c($))==null?void 0:kt.selectable)===!1}}],he),ae("mouseover",Be,()=>xt(Ce)),ae("focus",Be,()=>xt(Ce)),ae("click",Be,Ui(()=>mn({item:c($),i:Ce}))),ae("keydown",Be,Co(Ui(function(kt){ba.call(this,e,kt)}))),D(_,Be)}),D(kn,Ct)},qe=(kn,Ct)=>{{var An=_=>{var $=bn(),Ce=$e($);Pn(Ce,e,"empty",{},Be=>{var Me=yI();D(Be,Me)}),D(_,$)};te(kn,_=>{L()||_(An)},Ct)}};te(ye,kn=>{c(u).length>0?kn(nt):kn(qe,!1)},Ee)}};te(Cn,ye=>{n.list?ye(ai):ye(ms,!1)})}var T=N(Cn,2);{var fe=ye=>{var Ee=bn(),nt=$e(Ee);Pn(nt,e,"list-append",{},null),D(ye,Ee)};te(T,ye=>{n["list-append"]&&ye(fe)})}Tr(ve,ye=>Oe==null?void 0:Oe(ye)),gn(ve,ye=>b(jt,ye),()=>c(jt)),cr(()=>ae("scroll",ve,En)),cr(()=>ae("pointerup",ve,Co(Ui(function(ye){ba.call(this,e,ye)})))),cr(()=>ae("mousedown",ve,Co(Ui(function(ye){ba.call(this,e,ye)})))),xe(ye=>ut=ct(ve,1,"svelte-select-list svelte-82qwg8",null,ut,ye),[()=>({prefloat:c(Mt)})],he),D(Z,ve)};te(sr,Z=>{B()&&Z(jn)})}var zn=N(sr,2),xi=M(zn);{var Gr=Z=>{var ve=xI(),ut=$e(ve),un=M(ut),Tn=N(ut,2),Cn=M(Tn);xe(()=>{et(un,c(l)),et(Cn,c(a))}),D(Z,ve)};te(xi,Z=>{A()&&Z(Gr)})}var ds=N(zn,2),ps=M(ds);Pn(ps,e,"prepend",{},null);var wi=N(ds,2),li=M(wi);{var zi=Z=>{var ve=bn(),ut=$e(ve);{var un=Cn=>{var ai=bn(),ms=$e(ai);Sn(ms,1,O,Ln,(T,fe,ye)=>{var Ee=SI();let nt;var qe=M(Ee),kn=M(qe);Pn(kn,e,"selection",{get selection(){return c(fe)},index:ye},_=>{var $=ur();xe(()=>et($,c(fe)[U()])),D(_,$)});var Ct=N(qe,2);{var An=_=>{var $=wI(),Ce=M($);Pn(Ce,e,"multi-clear-icon",{},Be=>{tg(Be)}),ae("pointerup",$,Co(Ui(()=>yt(ye)))),D(_,$)};te(Ct,_=>{!E()&&!w()&&tg&&_(An)})}xe(_=>nt=ct(Ee,1,"multi-item svelte-82qwg8",null,nt,_),[()=>({active:c(Ve)===ye,disabled:E()})],he),ae("click",Ee,Co(()=>w()?yt(ye):{})),ae("keydown",Ee,Co(Ui(function(_){ba.call(this,e,_)}))),D(T,Ee)}),D(Cn,ai)},Tn=Cn=>{var ai=CI();let ms;var T=M(ai);Pn(T,e,"selection",{get selection(){return O()}},fe=>{var ye=ur();xe(()=>et(ye,O()[U()])),D(fe,ye)}),xe(fe=>ms=ct(ai,1,"selected-item svelte-82qwg8",null,ms,fe),[()=>({"hide-selected-item":c(i)})],he),D(Cn,ai)};te(ut,Cn=>{C()?Cn(un):Cn(Tn,!1)})}D(Z,ve)};te(li,Z=>{c(r)&&Z(zi)})}var Si=N(li,2);let dr;gn(Si,Z=>k(Z),()=>k());var gs=N(wi,2),Vi=M(gs);{var ea=Z=>{var ve=kI(),ut=M(ve);Pn(ut,e,"loading-icon",{},un=>{mI(un)}),D(Z,ve)};te(Vi,Z=>{q()&&Z(ea)})}var ll=N(Vi,2);{var xc=Z=>{var ve=AI(),ut=M(ve);Pn(ut,e,"clear-icon",{},un=>{tg(un)}),ae("click",ve,rn),D(Z,ve)};te(ll,Z=>{c(s)&&Z(xc)})}var ta=N(ll,2);{var na=Z=>{var ve=OI(),ut=M(ve);Pn(ut,e,"chevron-icon",{get listOpen(){return B()}},un=>{dI(un)}),D(Z,ve)};te(ta,Z=>{je()&&Z(na)})}var en=N(gs,2);Pn(en,e,"input-hidden",{get value(){return O()}},Z=>{var ve=_I();xe(ut=>{Jt(ve,"name",y()),Dl(ve,ut)},[()=>O()?JSON.stringify(O()):null],he),D(Z,ve)});var ra=N(en,2);{var ia=Z=>{var ve=bn(),ut=$e(ve);Pn(ut,e,"required",{get value(){return O()}},un=>{var Tn=EI();D(un,Tn)}),D(Z,ve)};te(ra,Z=>{le()&&(!O()||O().length===0)&&Z(ia)})}return cr(()=>ae("pointerup",Rt,Co(qt))),gn(Rt,Z=>S(Z),()=>S()),Tr(Rt,Z=>ee==null?void 0:ee(Z)),xe(Z=>{cn=ct(Rt,1,`svelte-select ${Ye()??""}`,"svelte-82qwg8",cn,Z),Gi(Rt,se()),dr=Th(Si,dr,{readOnly:!j(),...c(ht),placeholder:c(o),style:we(),disabled:E()},"svelte-82qwg8")},[()=>({multi:C(),disabled:E(),focused:A(),"list-open":B(),"show-chevron":je(),error:ce()})],he),ae("keydown",Si,Xt),ae("blur",Si,Ft),ae("focus",Si,nn),no(Si,H),D(t,Rt),at(e,"getFilteredItems",ge),at(e,"handleClear",rn),Xe({getFilteredItems:ge,handleClear:rn})}var MI=J('<table class="jse-transform-wizard svelte-qbze6z"><tbody><tr class="svelte-qbze6z"><th class="svelte-qbze6z">Filter</th><td class="svelte-qbze6z"><div class="jse-horizontal svelte-qbze6z"><!> <!> <input class="jse-filter-value svelte-qbze6z"></div></td></tr><tr class="svelte-qbze6z"><th class="svelte-qbze6z">Sort</th><td class="svelte-qbze6z"><div class="jse-horizontal svelte-qbze6z"><!> <!></div></td></tr><tr class="svelte-qbze6z"><th class="svelte-qbze6z">Pick</th><td class="svelte-qbze6z"><div class="jse-horizontal svelte-qbze6z"><!></div></td></tr></tbody></table>');function RI(t,e){var ue,ge,j,we,Pe,q;Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=R(void 0,!0),o=R(void 0,!0),l=R(void 0,!0),a=rr("jsoneditor:TransformWizard");let u=x(e,"json",9),f=x(e,"queryOptions",29,()=>({})),h=x(e,"onChange",9);const d=["==","!=","<","<=",">",">="].map(B=>({value:B,label:B})),p=[{value:"asc",label:"ascending"},{value:"desc",label:"descending"}];let g=R((ge=(ue=f())==null?void 0:ue.filter)!=null&&ge.path?Ao(f().filter.path):void 0,!0),m=R(d.find(B=>{var Se;return B.value===((Se=f().filter)==null?void 0:Se.relation)})??d[0],!0),v=R(((we=(j=f())==null?void 0:j.filter)==null?void 0:we.value)||"",!0),y=R((q=(Pe=f())==null?void 0:Pe.sort)!=null&&q.path?Ao(f().sort.path):void 0,!0),S=R(p.find(B=>{var Se;return B.value===((Se=f().sort)==null?void 0:Se.direction)})??p[0],!0);function k(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.filter)==null?void 0:ke.path,B)||(a("changeFilterPath",B),f(Xr(f(),["filter","path"],B,!0)),h()(f()))}function C(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.filter)==null?void 0:ke.relation,B)||(a("changeFilterRelation",B),f(Xr(f(),["filter","relation"],B,!0)),h()(f()))}function w(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.filter)==null?void 0:ke.value,B)||(a("changeFilterValue",B),f(Xr(f(),["filter","value"],B,!0)),h()(f()))}function E(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.sort)==null?void 0:ke.path,B)||(a("changeSortPath",B),f(Xr(f(),["sort","path"],B,!0)),h()(f()))}function A(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.sort)==null?void 0:ke.direction,B)||(a("changeSortDirection",B),f(Xr(f(),["sort","direction"],B,!0)),h()(f()))}function O(B){var Se,ke;Pt((ke=(Se=f())==null?void 0:Se.projection)==null?void 0:ke.paths,B)||(a("changeProjectionPaths",B),f(Xr(f(),["projection","paths"],B,!0)),h()(f()))}K(()=>P(u()),()=>{b(n,Array.isArray(u()))}),K(()=>(c(n),P(u())),()=>{b(r,c(n)?nm(u()):[])}),K(()=>(c(n),P(u())),()=>{b(i,c(n)?nm(u(),!0):[])}),K(()=>(c(r),Ao),()=>{b(s,c(r).map(Ao))}),K(()=>(c(i),Ao),()=>{b(o,c(i)?c(i).map(Ao):[])}),K(()=>(P(f()),c(o),Pt),()=>{var B,Se;b(l,(Se=(B=f())==null?void 0:B.projection)!=null&&Se.paths&&c(o)?f().projection.paths.map(ke=>c(o).find(z=>Pt(z.value,ke))).filter(ke=>!!ke):void 0)}),K(()=>c(g),()=>{var B;k((B=c(g))==null?void 0:B.value)}),K(()=>c(m),()=>{var B;C((B=c(m))==null?void 0:B.value)}),K(()=>c(v),()=>{w(c(v))}),K(()=>c(y),()=>{var B;E((B=c(y))==null?void 0:B.value)}),K(()=>c(S),()=>{var B;A((B=c(S))==null?void 0:B.value)}),K(()=>c(l),()=>{O(c(l)?c(l).map(B=>B.value):void 0)}),Vt(),st(!0);var H=MI(),W=M(H),G=M(W),V=N(M(G)),U=M(V),Q=M(U);yl(Q,{class:"jse-filter-path",showChevron:!0,get items(){return c(s)},get value(){return c(g)},set value(B){b(g,B)},$$legacy:!0});var Y=N(Q,2);yl(Y,{class:"jse-filter-relation",showChevron:!0,clearable:!1,items:d,get value(){return c(m)},set value(B){b(m,B)},$$legacy:!0});var ie=N(Y,2),F=N(G),X=N(M(F)),I=M(X),se=M(I);yl(se,{class:"jse-sort-path",showChevron:!0,get items(){return c(s)},get value(){return c(y)},set value(B){b(y,B)},$$legacy:!0});var ce=N(se,2);yl(ce,{class:"jse-sort-direction",showChevron:!0,clearable:!1,items:p,get value(){return c(S)},set value(B){b(S,B)},$$legacy:!0});var Te=N(F),le=N(M(Te)),de=M(le),ne=M(de);yl(ne,{class:"jse-projection-paths",multiple:!0,showChevron:!0,get items(){return c(o)},get value(){return c(l)},set value(B){b(l,B)},$$legacy:!0}),no(ie,()=>c(v),B=>b(v,B)),D(t,H),Xe()}var PI=J('<button type="button"><!> </button>'),DI=J('<div class="jse-select-query-language svelte-atm4um"><div class="jse-select-query-language-container svelte-atm4um"></div></div>');function II(t,e){Ge(e,!1);let n=x(e,"queryLanguages",8),r=x(e,"queryLanguageId",12),i=x(e,"onChangeQueryLanguage",8);function s(a){r(a),i()(a)}st();var o=DI(),l=M(o);Sn(l,5,n,Ln,(a,u)=>{var f=PI();let h;var d=M(f);{var p=v=>{Dt(v,{data:AS})},g=v=>{Dt(v,{data:OS})};te(d,v=>{c(u).id===r()?v(p):v(g,!1)})}var m=N(d);xe(v=>{h=ct(f,1,"jse-query-language svelte-atm4um",null,h,v),Jt(f,"title",`Select ${c(u).name} as query language`),et(m,` ${c(u).name??""}`)},[()=>({selected:c(u).id===r()})],he),ae("click",f,()=>s(c(u).id)),D(a,f)}),D(t,o),Xe()}var LI=J('<button type="button" class="jse-fullscreen svelte-1y24war" title="Toggle full screen"><!></button>'),NI=J('<div class="jse-header svelte-1y24war"><div class="jse-title svelte-1y24war"> </div> <!> <!> <button type="button" class="jse-close svelte-1y24war"><!></button></div>');function cp(t,e){Ge(e,!1);let n=x(e,"title",9,"Modal"),r=x(e,"fullScreenButton",9,!1),i=x(e,"fullscreen",13,!1),s=x(e,"onClose",9,void 0);st(!0);var o=NI(),l=M(o),a=M(l),u=N(l,2);Pn(u,e,"actions",{},null);var f=N(u,2);{var h=g=>{var m=LI(),v=M(m);const y=he(()=>i()?G6:w9);Dt(v,{get data(){return c(y)}}),ae("click",m,()=>i(!i())),D(g,m)};te(f,g=>{r()&&g(h)})}var d=N(f,2),p=M(d);Dt(p,{data:rp}),xe(()=>et(a,n())),ae("click",d,()=>{var g;return(g=s())==null?void 0:g()}),D(t,o),Xe()}var jI=J('<button slot="actions" type="button" title="Select a query language"><!></button>');function BI(t,e){Ge(e,!1);let n=x(e,"queryLanguages",9),r=x(e,"queryLanguageId",9),i=x(e,"fullscreen",13),s=x(e,"onChangeQueryLanguage",9),o=x(e,"onClose",9),l=R(void 0,!0),a;const{openAbsolutePopup:u,closeAbsolutePopup:f}=el("absolute-popup");function h(){const d={queryLanguages:n(),queryLanguageId:r(),onChangeQueryLanguage:p=>{f(a),s()(p)}};a=u(II,d,{offsetTop:-2,offsetLeft:0,anchor:c(l),closeOnOuterClick:!0})}st(!0),cp(t,{title:"Transform",fullScreenButton:!0,get onClose(){return o()},get fullscreen(){return i()},set fullscreen(d){i(d)},$$slots:{actions:(d,p)=>{var g=jI();let m;var v=M(g);Dt(v,{data:d9}),gn(g,y=>b(l,y),()=>c(l)),xe(y=>m=ct(g,1,"jse-config svelte-1kpylsp",null,m,y),[()=>({hide:n().length<=1})],he),ae("click",g,h),D(d,g)}},$$legacy:!0}),Xe()}const ng=rr("jsoneditor:AutoScrollHandler");function ib(t){ng("createAutoScrollHandler",t);let e,n;function r(u){return u<20?FD:u<50?zD:VD}function i(){if(t){const u=(e||0)*(Ly/1e3);t.scrollTop+=u}}function s(u){(!n||u!==e)&&(o(),ng("startAutoScroll",u),e=u,n=setInterval(i,Ly))}function o(){n&&(ng("stopAutoScroll"),clearInterval(n),n=void 0,e=void 0)}function l(u){if(t){const f=u.clientY,{top:h,bottom:d}=t.getBoundingClientRect();if(f<h){const p=r(h-f);s(-p)}else if(f>d){const p=r(f-d);s(p)}else o()}}function a(){o()}return{onDrag:l,onDragEnd:a}}const FI=(t,e,n,r)=>(t/=r/2,t<1?n/2*t*t+e:(t--,-n/2*(t*(t-2)-1)+e)),vC=()=>{let t,e,n,r,i,s,o,l,a,u,f,h,d,p;function g(){return t.scrollTop}function m(C){const w=C.getBoundingClientRect().top,E=t.getBoundingClientRect?t.getBoundingClientRect().top:0;return w-E+n}function v(C){t.scrollTo?t.scrollTo(t.scrollLeft,C):t.scrollTop=C}function y(C){u||(u=C),f=C-u,h=s(f,n,l,a),v(h),p=!0,f<a?requestAnimationFrame(y):S()}function S(){v(n+l),e&&o&&(e.setAttribute("tabindex","-1"),e.focus()),typeof d=="function"&&d(),u=0,p=!1}function k(C,w={}){switch(a=1e3,i=w.offset||0,d=w.callback,s=w.easing||FI,o=w.a11y||!1,typeof w.container){case"object":t=w.container;break;case"string":t=document.querySelector(w.container);break;default:t=window.document.documentElement}switch(n=g(),typeof C){case"number":e=void 0,o=!1,r=n+C;break;case"object":e=C,r=m(e);break;case"string":e=document.querySelector(C),r=m(e);break}switch(l=r-n+i,typeof w.duration){case"number":a=w.duration;break;case"function":a=w.duration(l);break}p?u=0:requestAnimationFrame(y)}return k};function Ca(t,e){const n=Date.now(),r=t(),i=Date.now();return e(i-n),r}const ma=rr("validation"),zI={createObjectDocumentState:()=>({type:"object",properties:{}}),createArrayDocumentState:()=>({type:"array",items:[]}),createValueDocumentState:()=>({type:"value"})};function sb(t,e,n,r){return n0(t,e,n,r,zI)}function VI(t,e){let n;return e.forEach(r=>{n=sb(t,n,r.path,(i,s)=>({...s,validationError:r}))}),e.forEach(r=>{let i=r.path;for(;i.length>0;)i=Lt(i),n=sb(t,n,i,(s,o)=>o.validationError?o:{...o,validationError:{isChildError:!0,path:i,message:"Contains invalid data",severity:Yi.warning}})}),n}function yC(t,e,n,r){if(ma("validateJSON"),!e)return[];if(n!==r){const i=n.stringify(t),s=i!==void 0?r.parse(i):void 0;return e(s)}else return e(t)}function HI(t,e,n,r){if(ma("validateText"),t.length>UD)return{validationErrors:[{path:[],message:"Validation turned off: the document is too large",severity:Yi.info}]};if(t.length!==0)try{const i=Ca(()=>n.parse(t),l=>ma(`validate: parsed json in ${l} ms`));if(!e)return;const s=n===r?i:Ca(()=>r.parse(t),l=>ma(`validate: parsed json with the validationParser in ${l} ms`)),o=Ca(()=>e(s),l=>ma(`validate: validated json in ${l} ms`));return Yt(o)?void 0:{validationErrors:o}}catch(i){const s=Ca(()=>qI(t,n),l=>ma(`validate: checked whether repairable in ${l} ms`));return{parseError:Wa(t,i.message||i.toString()),isRepairable:s}}}function qI(t,e){if(t.length>WD)return!1;try{return e.parse(Ds(t)),!0}catch{return!1}}const kf=rr("jsoneditor:FocusTracker");function p0({onMount:t,onDestroy:e,getWindow:n,hasFocus:r,onFocus:i,onBlur:s}){let o,l=!1;function a(){const f=r();f&&(clearTimeout(o),l||(kf("focus"),i(),l=f))}function u(){l&&(clearTimeout(o),o=setTimeout(()=>{r()||(kf("blur"),l=!1,s())}))}t(()=>{kf("mount FocusTracker");const f=n();f&&(f.addEventListener("focusin",a,!0),f.addEventListener("focusout",u,!0))}),e(()=>{kf("destroy FocusTracker");const f=n();f&&(f.removeEventListener("focusin",a,!0),f.removeEventListener("focusout",u,!0))})}var UI=J('<button type="button" class="jse-button jse-action jse-primary svelte-czprfx"><!> </button>'),WI=J('<div><div role="button" tabindex="-1"><div class="jse-text-centered"><!> </div></div> <div class="jse-actions svelte-czprfx"></div></div>');function es(t,e){Ge(e,!1);let n=x(e,"type",9,"success"),r=x(e,"icon",9,void 0),i=x(e,"message",9,void 0),s=x(e,"actions",25,()=>[]),o=x(e,"onClick",9,void 0),l=x(e,"onClose",9,void 0);l()&&Ii(l());function a(){o()&&o()()}st(!0);var u=WI(),f=M(u);let h;var d=M(f),p=M(d);{var g=y=>{Dt(y,{get data(){return r()}})};te(p,y=>{r()&&y(g)})}var m=N(p),v=N(f,2);Sn(v,5,s,Ln,(y,S)=>{var k=UI(),C=M(k);{var w=A=>{Dt(A,{get data(){return c(S).icon}})};te(C,A=>{c(S).icon&&A(w)})}var E=N(C);xe(()=>{Jt(k,"title",c(S).title),k.disabled=c(S).disabled,et(E,` ${c(S).text??""}`)}),ae("click",k,()=>{c(S).onClick&&c(S).onClick()}),ae("mousedown",k,()=>{c(S).onMouseDown&&c(S).onMouseDown()}),D(y,k)}),xe(y=>{ct(u,1,`jse-message jse-${n()??""}`,"svelte-czprfx"),h=ct(f,1,"jse-text svelte-czprfx",null,h,y),et(m,` ${i()??""}`)},[()=>({"jse-clickable":!!o()})],he),ae("click",f,a),D(t,u),Xe()}var JI=J('<button type="button" class="jse-validation-errors-collapse svelte-1uindol" title="Collapse validation errors"><!></button>'),KI=J('<tr tabindex="0"><td class="jse-validation-error-icon svelte-1uindol"><!></td><td class="jse-validation-error-path svelte-1uindol"> </td><td class="jse-validation-error-message svelte-1uindol"> </td><td class="jse-validation-error-action svelte-1uindol"><!></td></tr>'),GI=J('<tr class="jse-validation-error svelte-1uindol"><td class="svelte-1uindol"></td><td class="svelte-1uindol"></td><td class="svelte-1uindol"> </td><td class="svelte-1uindol"></td></tr>'),XI=J('<table class="jse-validation-errors-overview-expanded svelte-1uindol"><tbody><!><!></tbody></table>'),QI=J('<table class="jse-validation-errors-overview-collapsed svelte-1uindol"><tbody><tr><td class="jse-validation-error-icon svelte-1uindol"><!></td><td class="jse-validation-error-count svelte-1uindol"> <div class="jse-validation-errors-expand svelte-1uindol"><!></div></td></tr></tbody></table>'),YI=J('<div class="jse-validation-errors-overview svelte-1uindol"><!></div>');function g0(t,e){Ge(e,!1);const n=R(void 0,!0);let r=x(e,"validationErrors",9),i=x(e,"selectError",9),s=R(!0,!0);function o(){b(s,!1)}function l(){b(s,!0)}function a(d){return[Yi.error,Yi.warning,Yi.info].find(g=>d.some(m=>m.severity===g))}K(()=>P(r()),()=>{b(n,r().length)}),Vt(),st(!0);var u=bn(),f=$e(u);{var h=d=>{var p=YI(),g=M(p);{var m=y=>{var S=XI(),k=M(S),C=M(k);Sn(C,1,()=>uS(r(),Wp),Ln,(A,O,H)=>{var W=KI(),G=M(W),V=M(G);Dt(V,{data:Vl});var U=N(G),Q=M(U),Y=N(U),ie=M(Y),F=N(Y),X=M(F);{var I=se=>{var ce=JI(),Te=M(ce);Dt(Te,{data:m9}),ae("click",ce,Ui(o)),D(se,ce)};te(X,se=>{H===0&&r().length>1&&se(I)})}xe(se=>{ct(W,1,`jse-validation-${c(O).severity??""}`,"svelte-1uindol"),et(Q,se),et(ie,c(O).message)},[()=>ts(c(O).path)],he),ae("click",W,()=>{setTimeout(()=>i()(c(O)))}),D(A,W)});var w=N(C);{var E=A=>{var O=GI(),H=N(M(O),2),W=M(H);xe(()=>et(W,`(and ${c(n)-Wp} more errors)`)),D(A,O)};te(w,A=>{c(n)>Wp&&A(E)})}D(y,S)},v=y=>{var S=QI(),k=M(S),C=M(k),w=M(C),E=M(w);Dt(E,{data:Vl});var A=N(w),O=M(A),H=N(O),W=M(H);Dt(W,{data:eC}),xe(G=>{ct(C,1,`jse-validation-${G??""}`,"svelte-1uindol"),et(O,`${c(n)??""} validation errors `)},[()=>a(r())],he),ae("click",C,l),D(y,S)};te(g,y=>{c(s)||c(n)===1?y(m):y(v,!1)})}D(d,p)};te(f,d=>{Yt(r())||d(h)})}D(t,u),Xe()}function Pa(t,e){if(!t)return;function n(r){r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),e())}return t.addEventListener("keydown",n),{destroy(){t.removeEventListener("keydown",n)}}}var ZI=J('<dialog><div class="jse-modal-inner svelte-1s9c2ql"><!></div></dialog>');function $u(t,e){Ge(e,!1);let n=x(e,"className",8,void 0),r=x(e,"fullscreen",8,!1),i=x(e,"onClose",8),s=R();Cr(()=>c(s).showModal()),Ii(()=>c(s).close());function o(){i()()}st();var l=ZI();let a;var u=M(l),f=M(u);Pn(f,e,"default",{},null),gn(l,h=>b(s,h),()=>c(s)),cr(()=>ae("close",l,o)),cr(()=>ae("pointerdown",l,f_(o))),cr(()=>ae("cancel",l,Co(function(h){ba.call(this,e,h)}))),Tr(l,(h,d)=>Pa==null?void 0:Pa(h,d),()=>o),xe((h,d)=>a=ct(l,1,h,"svelte-1s9c2ql",a,d),[()=>nl(mc("jse-modal",n())),()=>({"jse-fullscreen":r()})],he),D(t,l),Xe()}var $I=J('<!> <div class="jse-modal-contents svelte-189qksl"><div>Clipboard permission is disabled by your browser. You can use:</div> <div class="jse-shortcuts svelte-189qksl"><div class="jse-shortcut svelte-189qksl"><div class="jse-key svelte-189qksl"></div> for copy</div> <div class="jse-shortcut svelte-189qksl"><div class="jse-key svelte-189qksl"></div> for cut</div> <div class="jse-shortcut svelte-189qksl"><div class="jse-key svelte-189qksl"></div> for paste</div></div> <div class="jse-actions svelte-189qksl"><button type="button" class="jse-primary svelte-189qksl">Close</button></div></div>',1);function bC(t,e){Ge(e,!1);let n=x(e,"onClose",9);const r=Kv()?"⌘":"Ctrl";st(!0),$u(t,{get onClose(){return n()},className:"jse-copy-paste",children:(i,s)=>{var o=$I(),l=$e(o);cp(l,{title:"Copying and pasting",get onClose(){return n()}});var a=N(l,2),u=N(M(a),2),f=M(u),h=M(f);h.textContent=`${r}+C`;var d=N(f,2),p=M(d);p.textContent=`${r}+X`;var g=N(d,2),m=M(g);m.textContent=`${r}+V`;var v=N(u,2),y=M(v);ae("click",y,function(...S){var k;(k=n())==null||k.apply(this,S)}),D(i,o)},$$slots:{default:!0}}),Xe()}var eL=J('<div class="jse-separator svelte-pf7s2l"></div>'),tL=J('<div class="jse-space svelte-pf7s2l"></div>'),nL=J('<button type="button"><!> <!></button>'),rL=J('<div class="jse-menu svelte-pf7s2l"><!> <!> <!></div>');function up(t,e){Ge(e,!1);let n=x(e,"items",25,()=>[]);function r(a){return console.error("Unknown type of menu item",a),"???"}st(!0);var i=rL(),s=M(i);Pn(s,e,"left",{},null);var o=N(s,2);Sn(o,1,n,Ln,(a,u)=>{var f=bn(),h=$e(f);{var d=g=>{var m=eL();D(g,m)},p=(g,m)=>{{var v=S=>{var k=tL();D(S,k)},y=(S,k)=>{{var C=E=>{var A=nL(),O=M(A);{var H=V=>{Dt(V,{get data(){return c(u).icon}})};te(O,V=>{c(u).icon&&V(H)})}var W=N(O,2);{var G=V=>{var U=ur();xe(()=>et(U,c(u).text)),D(V,U)};te(W,V=>{c(u).text&&V(G)})}xe(()=>{ct(A,1,`jse-button ${c(u).className??""}`,"svelte-pf7s2l"),Jt(A,"title",c(u).title),A.disabled=c(u).disabled||!1}),ae("click",A,function(...V){var U;(U=c(u).onClick)==null||U.apply(this,V)}),D(E,A)},w=E=>{var A=ur();xe(O=>et(A,O),[()=>r(c(u))],he),D(E,A)};te(S,E=>{Qc(c(u))?E(C):E(w,!1)},k)}};te(g,S=>{ES(c(u))?S(v):S(y,!1)},m)}};te(h,g=>{sh(c(u))?g(d):g(p,!1)})}D(a,f)});var l=N(o,2);Pn(l,e,"right",{},null),D(t,i),Xe()}var iL=J('<div slot="left" class="jse-info svelte-3golau">Repair invalid JSON, then click apply</div>'),sL=J('<div class="jse-json-repair-component svelte-3golau"><!> <!> <textarea class="jse-json-text svelte-3golau" autocomplete="off" autocapitalize="off" spellcheck="false"></textarea></div>');function oL(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=R(void 0,!0),o=R(void 0,!0),l=R(void 0,!0);let a=x(e,"text",13,""),u=x(e,"readOnly",9,!1),f=x(e,"onParse",9),h=x(e,"onRepair",9),d=x(e,"onChange",9,void 0),p=x(e,"onApply",9),g=x(e,"onCancel",9);const m=rr("jsoneditor:JSONRepair");let v=R(void 0,!0);function y(Q){try{f()(Q);return}catch(Y){return Wa(Q,Y.message)}}function S(Q){try{return h()(Q),!0}catch{return!1}}function k(){if(c(v)&&c(n)){const Q=c(n).position!==void 0?c(n).position:0;c(v).setSelectionRange(Q,Q),c(v).focus()}}function C(Q){m("handleChange");const Y=Q.target.value;a()!==Y&&(a(Y),d()&&d()(a()))}function w(){p()(a())}function E(){try{a(h()(a())),d()&&d()(a())}catch{}}let A=R(void 0,!0);K(()=>P(a()),()=>{b(n,y(a()))}),K(()=>P(a()),()=>{b(r,S(a()))}),K(()=>c(n),()=>{m("error",c(n))}),K(()=>P(g()),()=>{b(A,[{type:"space"},{type:"button",icon:rp,title:"Cancel repair",className:"jse-cancel",onClick:g()}])}),K(()=>Zy,()=>{b(i,{icon:Zy,text:"Show me",title:"Scroll to the error location",onClick:k})}),K(()=>Ga,()=>{b(s,{icon:Ga,text:"Auto repair",title:"Automatically repair JSON",onClick:E})}),K(()=>(c(r),c(i),c(s)),()=>{b(o,c(r)?[c(i),c(s)]:[c(i)])}),K(()=>P(u()),()=>{b(l,[{icon:c0,text:"Apply",title:"Apply fixed JSON",disabled:u(),onClick:w}])}),Vt(),st(!0);var O=sL(),H=M(O);up(H,{get items(){return c(A)},$$slots:{left:(Q,Y)=>{var ie=iL();D(Q,ie)}}});var W=N(H,2);{var G=Q=>{const Y=he(()=>`Cannot parse JSON: ${c(n).message}`);es(Q,{type:"error",icon:Vl,get message(){return c(Y)},get actions(){return c(o)}})},V=Q=>{es(Q,{type:"success",message:"JSON is valid now and can be parsed.",get actions(){return c(l)}})};te(W,Q=>{c(n)?Q(G):Q(V,!1)})}var U=N(W,2);gn(U,Q=>b(v,Q),()=>c(v)),xe(()=>{U.readOnly=u(),Dl(U,a())}),ae("input",U,C),D(t,O),Xe()}function xC(t,e){Ge(e,!1);let n=x(e,"text",13),r=x(e,"onParse",9),i=x(e,"onRepair",9),s=x(e,"onApply",9),o=x(e,"onClose",9);function l(u){s()(u),o()()}function a(){o()()}st(!0),$u(t,{get onClose(){return o()},className:"jse-repair-modal",children:(u,f)=>{oL(u,{get onParse(){return r()},get onRepair(){return i()},onApply:l,onCancel:a,get text(){return n()},set text(h){n(h)},$$legacy:!0})},$$slots:{default:!0}}),Xe()}var lL=J('<button type="button" class="jse-expand-items svelte-1h6hzoq"> </button>'),aL=J('<div role="none"><div><div class="jse-text svelte-1h6hzoq"> </div> <!></div></div>');function cL(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=R(void 0,!0),o=R(void 0,!0);let l=x(e,"visibleSections",9),a=x(e,"sectionIndex",9),u=x(e,"total",9),f=x(e,"path",9),h=x(e,"selection",9),d=x(e,"onExpandSection",9),p=x(e,"context",9);function g(E){E.stopPropagation()}K(()=>(P(l()),P(a())),()=>{b(n,l()[a()])}),K(()=>c(n),()=>{b(r,c(n).end)}),K(()=>(P(l()),P(a()),P(u())),()=>{b(i,l()[a()+1]?l()[a()+1].start:u())}),K(()=>(P(p()),P(h()),P(f()),c(r)),()=>{b(s,mu(p().getJson(),h(),f().concat(String(c(r)))))}),K(()=>(c(r),c(i)),()=>{b(o,GD(c(r),c(i)))}),Vt(),st(!0);var m=aL();let v,y;var S=M(m),k=M(S),C=M(k),w=N(k,2);Sn(w,1,()=>c(o),Ln,(E,A)=>{var O=lL(),H=M(O);xe(()=>et(H,`show ${c(A).start??""}-${c(A).end??""}`)),ae("click",O,()=>d()(f(),c(A))),D(E,O)}),xe(E=>{v=ct(m,1,"jse-collapsed-items svelte-1h6hzoq",null,v,E),y=Gi(m,"",y,{"--level":f().length+2}),et(C,`Items ${c(r)??""}-${c(i)??""}`)},[()=>({"jse-selected":c(s)})],he),ae("mousemove",m,g),D(t,m),Xe()}var uL=J('<button type="button"><!></button>');function Oo(t,e){Ge(e,!1);let n=x(e,"root",9,!1),r=x(e,"insert",9,!1),i=x(e,"selected",9),s=x(e,"onContextMenu",9);function o(f){let h=f.target;for(;h&&h.nodeName!=="BUTTON";)h=h.parentNode;h&&s()({anchor:h,left:0,top:0,width:Zs,height:Ys,offsetTop:2,offsetLeft:0,showTip:!0})}st(!0);var l=uL();let a;Jt(l,"title",Qv);var u=M(l);Dt(u,{data:Wo}),xe(f=>a=ct(l,1,"jse-context-menu-pointer svelte-137iwnw",null,a,f),[()=>({"jse-root":n(),"jse-insert":r(),"jse-selected":i()})],he),ae("click",l,o),D(t,l),Xe()}var fL=J('<div role="none" data-type="selectable-key"><!></div>'),hL=J("<!> <!>",1);function dL(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0);let i=x(e,"pointer",9),s=x(e,"key",9),o=x(e,"selection",9),l=x(e,"searchResultItems",9),a=x(e,"onUpdateKey",9),u=x(e,"context",9),f=R(void 0,!0);function h(C){!c(r)&&!u().readOnly&&(C.preventDefault(),u().onSelect(s0(c(f))))}function d(C,w){const E=a()(s(),u().normalization.unescapeValue(C)),A=Lt(c(f)).concat(E);u().onSelect(w===Bo.nextInside?wt(A):go(A)),w!==Bo.self&&u().focus()}function p(){u().onSelect(go(c(f))),u().focus()}K(()=>P(i()),()=>{b(f,Li(i()))}),K(()=>(P(o()),c(f)),()=>{b(n,nr(o())&&Pt(o().path,c(f)))}),K(()=>(c(n),P(o())),()=>{b(r,c(n)&&ei(o()))}),Vt(),st(!0);var g=hL(),m=$e(g);{var v=C=>{const w=he(()=>u().normalization.escapeValue(s())),E=he(()=>ei(o())?o().initialValue:void 0);qS(C,{get value(){return c(w)},get initialValue(){return c(E)},label:"Edit key",shortText:!0,onChange:d,onCancel:p,get onFind(){return u().onFind}})},y=C=>{var w=fL();let E;var A=M(w);{var O=W=>{const G=he(()=>u().normalization.escapeValue(s()));YS(W,{get text(){return c(G)},get searchResultItems(){return l()}})},H=W=>{var G=ur();xe(V=>et(G,V),[()=>Qd(u().normalization.escapeValue(s()))],he),D(W,G)};te(A,W=>{l()?W(O):W(H,!1)})}xe(W=>E=ct(w,1,"jse-key svelte-2iqnqn",null,E,W),[()=>({"jse-empty":s()===""})],he),ae("dblclick",w,h),D(C,w)};te(m,C=>{!u().readOnly&&c(r)?C(v):C(y,!1)})}var S=N(m,2);{var k=C=>{Oo(C,{selected:!0,get onContextMenu(){return u().onContextMenu}})};te(S,C=>{!u().readOnly&&c(n)&&!c(r)&&C(k)})}D(t,g),Xe()}var pL=J('<div role="button" tabindex="-1" class="jse-value" data-type="selectable-value"></div>');function wC(t,e){Ge(e,!0);const n=$r(()=>Qt(e.selection)&&ei(e.selection)),r=$r(()=>e.context.onRenderValue({path:e.path,value:e.value,mode:e.context.mode,truncateTextSize:e.context.truncateTextSize,readOnly:e.context.readOnly,enforceString:e.enforceString,isEditing:c(n),parser:e.context.parser,normalization:e.context.normalization,selection:e.selection,searchResultItems:e.searchResultItems,onPatch:e.context.onPatch,onPasteJson:e.context.onPasteJson,onSelect:e.context.onSelect,onFind:e.context.onFind,findNextInside:e.context.findNextInside,focus:e.context.focus}));var i=bn(),s=$e(i);Sn(s,17,()=>c(r),Ln,(o,l)=>{var a=bn(),u=$e(a);{var f=d=>{var p=pL();const g=$r(()=>c(l).action);Tr(p,(m,v)=>{var y;return(y=c(g))==null?void 0:y(m,v)},()=>c(l).props),D(d,p)},h=d=>{var p=bn();const g=$r(()=>c(l).component);var m=$e(p);z2(m,()=>c(g),(v,y)=>{y(v,jo(()=>c(l).props))}),D(d,p)};te(u,d=>{n6(c(l))?d(f):d(h,!1)})}D(o,a)}),D(t,i),Xe()}const gL={selecting:!1,selectionAnchor:void 0,selectionAnchorType:void 0,selectionFocus:void 0,dragging:!1};function rg({json:t,selection:e,deltaY:n,items:r}){if(!e)return{operations:void 0,updatedSelection:void 0,offset:0};const i=n<0?mL({json:t,selection:e,deltaY:n,items:r}):vL({json:t,selection:e,deltaY:n,items:r});if(!i||i.offset===0)return{operations:void 0,updatedSelection:void 0,offset:0};const s=A6(t,e,i),o=Lt(ho(t,e)),l=De(t,o);if(Array.isArray(l)){const a=yL({items:r,json:t,selection:e,offset:i.offset});return{operations:s,updatedSelection:a,offset:i.offset}}else return{operations:s,updatedSelection:void 0,offset:i.offset}}function mL({json:t,items:e,selection:n,deltaY:r}){const i=ho(t,n),s=e.findIndex(h=>Pt(h.path,i)),o=()=>{var h;return(h=e[l-1])==null?void 0:h.height};let l=s,a=0;for(;o()!==void 0&&Math.abs(r)>a+o()/2;)a+=o(),l-=1;const u=e[l].path,f=l-s;return l!==s&&e[l]!==void 0?{beforePath:u,offset:f}:void 0}function vL({json:t,items:e,selection:n,deltaY:r}){var m;const i=rl(t,n),s=e.findIndex(v=>Pt(v.path,i));let o=0,l=s;const a=()=>{var v;return(v=e[l+1])==null?void 0:v.height};for(;a()!==void 0&&Math.abs(r)>o+a()/2;)o+=a(),l+=1;const u=Lt(i),f=De(t,u),d=Array.isArray(f)?l:l+1,p=(m=e[d])==null?void 0:m.path,g=l-s;return p?{beforePath:p,offset:g}:{append:!0,offset:g}}function yL({items:t,json:e,selection:n,offset:r}){var f,h;const i=ho(e,n),s=rl(e,n),o=t.findIndex(d=>Pt(d.path,i)),l=t.findIndex(d=>Pt(d.path,s)),a=(f=t[o+r])==null?void 0:f.path,u=(h=t[l+r])==null?void 0:h.path;return Rr(a,u)}var bL=J('<button type="button"><!></button>');function Da(t,e){Ge(e,!1);const n=R(),r=el("absolute-popup");let i=x(e,"validationError",8),s=x(e,"onExpand",8);K(()=>P(i()),()=>{b(n,t6(i())&&i().isChildError?"Contains invalid data":i().message)}),Vt(),st();var o=bL(),l=M(o);Dt(l,{data:Vl}),cr(()=>ae("click",o,function(...a){var u;(u=s())==null||u.apply(this,a)})),Tr(o,(a,u)=>so==null?void 0:so(a,u),()=>({text:c(n),...r})),xe(()=>ct(o,1,`jse-validation-${i().severity??""}`,"svelte-1a8aobl")),D(t,o),Xe()}var hn=Rd(()=>gL),xL=J('<div class="jse-separator svelte-oawf7x">:</div>'),wL=J('<div class="jse-bracket svelte-oawf7x">[</div> <!> ',1),SL=J('<div class="jse-bracket svelte-oawf7x">[</div> <!> <div class="jse-bracket svelte-oawf7x">]</div>',1),CL=J('<div class="jse-context-menu-pointer-anchor svelte-oawf7x"><!></div>'),kL=J('<div role="none" class="jse-insert-selection-area jse-inside svelte-oawf7x" data-type="insert-selection-area-inside"></div>'),AL=J('<div role="none" class="jse-insert-selection-area jse-after svelte-oawf7x" data-type="insert-selection-area-after"></div>'),OL=J('<div data-type="insert-selection-area-inside"><!></div>'),_L=J('<div slot="identifier" class="jse-identifier svelte-oawf7x"><div class="jse-index svelte-oawf7x"> </div></div>'),EL=J("<!> <!>",1),TL=J('<div role="none" class="jse-insert-selection-area jse-after svelte-oawf7x" data-type="insert-selection-area-after"></div>'),ML=J('<div class="jse-items svelte-oawf7x"><!> <!></div> <div class="jse-footer-outer svelte-oawf7x"><div data-type="selectable-value" class="jse-footer svelte-oawf7x"><span class="jse-bracket svelte-oawf7x">]</span></div> <!></div>',1),RL=J('<div class="jse-header-outer svelte-oawf7x"><div class="jse-header svelte-oawf7x"><button type="button" class="jse-expand svelte-oawf7x" title="Expand or collapse this array (Ctrl+Click to expand/collapse recursively)"><!></button> <!> <!> <div class="jse-meta svelte-oawf7x"><div class="jse-meta-inner svelte-oawf7x" data-type="selectable-value"><!></div></div> <!></div> <!> <!></div> <!>',1),PL=J('<div class="jse-separator svelte-oawf7x">:</div>'),DL=J('<div class="jse-bracket jse-expanded svelte-oawf7x">{</div>'),IL=J('<div class="jse-bracket svelte-oawf7x">{</div> <!> <div class="jse-bracket svelte-oawf7x">}</div>',1),LL=J('<div class="jse-context-menu-pointer-anchor svelte-oawf7x"><!></div>'),NL=J('<div role="none" class="jse-insert-selection-area jse-inside svelte-oawf7x" data-type="insert-selection-area-inside"></div>'),jL=J('<div role="none" class="jse-insert-selection-area jse-after svelte-oawf7x" data-type="insert-selection-area-after"></div>'),BL=J('<div data-type="insert-selection-area-inside"><!></div>'),FL=J('<div slot="identifier"><!></div>'),zL=J('<div role="none" class="jse-insert-selection-area jse-after svelte-oawf7x" data-type="insert-selection-area-after"></div>'),VL=J('<div class="jse-props svelte-oawf7x"><!> <!></div> <div class="jse-footer-outer svelte-oawf7x"><div data-type="selectable-value" class="jse-footer svelte-oawf7x"><div class="jse-bracket svelte-oawf7x">}</div></div> <!></div>',1),HL=J('<div class="jse-header-outer svelte-oawf7x"><div class="jse-header svelte-oawf7x"><button type="button" class="jse-expand svelte-oawf7x" title="Expand or collapse this object (Ctrl+Click to expand/collapse recursively)"><!></button> <!> <!> <div class="jse-meta svelte-oawf7x" data-type="selectable-value"><div class="jse-meta-inner svelte-oawf7x"><!></div></div> <!></div> <!> <!></div> <!>',1),qL=J('<div class="jse-separator svelte-oawf7x">:</div>'),UL=J('<div class="jse-context-menu-pointer-anchor svelte-oawf7x"><!></div>'),WL=J('<div role="none" class="jse-insert-selection-area jse-after svelte-oawf7x" data-type="insert-selection-area-after"></div>'),JL=J('<div class="jse-contents-outer svelte-oawf7x"><div class="jse-contents svelte-oawf7x"><!> <!> <div class="jse-value-outer svelte-oawf7x"><!></div> <!></div> <!> <!></div>'),KL=J('<div data-type="insert-selection-area-after"><!></div>'),GL=J('<div role="treeitem" tabindex="-1"><!> <!></div>');function ym(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0);let i=x(e,"pointer",9),s=x(e,"value",9),o=x(e,"state",9),l=x(e,"validationErrors",9),a=x(e,"searchResults",9),u=x(e,"selection",9),f=x(e,"context",9),h=x(e,"onDragSelectionStart",9);const d=rr("jsoneditor:JSONNode");let p=R(void 0,!0),g,m=R(void 0,!0),v=R(void 0,!0),y=R(void 0,!0),S=R(void 0,!0),k=R(void 0,!0),C=R(void 0,!0),w=R(void 0,!0);function E(z,L){const ze=Object.keys(z);return L&&L.offset!==0?Ty(ze,L.selectionStartIndex,L.selectionItemsCount,L.offset):ze}function A(z,L,ze){const We=L.start,je=Math.min(L.end,z.length),Qe=aS(We,je);return ze&&ze.offset!==0?Ty(Qe,ze.selectionStartIndex,ze.selectionItemsCount,ze.offset).map((be,gt)=>({index:be,gutterIndex:gt})):Qe.map(be=>({index:be,gutterIndex:be}))}function O(z){z.stopPropagation();const L=Gv(z);f().onExpand(c(v),!c(y),L)}function H(){f().onExpand(c(v),!0)}function W(z,L){const ze=Yu(c(v),Object.keys(s()),z,L);return f().onPatch(ze),Ot(Li(ze[0].path))}function G(z){if(z.buttons!==1&&z.buttons!==2||U5(z.target)||z.buttons===1&&bS(z.target,"BUTTON"))return;z.stopPropagation(),z.preventDefault(),f().focus(),document.addEventListener("mousemove",U,!0),document.addEventListener("mouseup",Q);const L=Up(z.target),ze=f().getJson(),We=f().getDocumentState();if(u()&&L!==Zt.after&&L!==Zt.inside&&(u().type===L||u().type===Zt.multi)&&mu(ze,u(),c(v))){z.button===0&&h()(z);return}if(hn(hn().selecting=!0),hn(hn().selectionAnchor=c(v)),hn(hn().selectionAnchorType=L),hn(hn().selectionFocus=c(v)),z.shiftKey){const je=f().getSelection();je&&f().onSelect(Rr(Fl(je),c(v)))}else if(L===Zt.multi)if(c(r)&&z.target.hasAttribute("data-path")){const je=Ot(jS(s(),We));f().onSelect(o0(je))}else f().onSelect(Rr(c(v),c(v)));else ze!==void 0&&f().onSelect(Jy(L,c(v)))}function V(z){if(hn().selecting){z.preventDefault(),z.stopPropagation(),hn().selectionFocus===void 0&&window.getSelection&&window.getSelection().empty();const L=Up(z.target);(!Pt(c(v),hn().selectionFocus)||L!==hn().selectionAnchorType)&&(hn(hn().selectionFocus=c(v)),hn(hn().selectionAnchorType=L),f().onSelect(Rr(hn().selectionAnchor||hn().selectionFocus,hn().selectionFocus)))}}function U(z){f().onDrag(z)}function Q(z){hn().selecting&&(hn(hn().selecting=!1),z.stopPropagation()),f().onDragEnd(),document.removeEventListener("mousemove",U,!0),document.removeEventListener("mouseup",Q)}function Y(){var z,L;return((L=(z=f().findElement([]))==null?void 0:z.getBoundingClientRect())==null?void 0:L.top)||0}function ie(z,L){const We=Y()-z.initialContentTop;return L.clientY-z.initialClientY-We}function F(z){if(f().readOnly||!u())return;const L=Lt(He(u()));if(!Pt(c(v),L)){h()(z);return}const ze=se(u(),c(k)||Ea);if(d("dragSelectionStart",{selection:u(),items:ze}),!ze){d("Cannot drag the current selection (probably spread over multiple sections)");return}const We=f().getJson();if(We===void 0)return;const je=ho(We,u()),Qe=ze.findIndex(gt=>Pt(gt.path,je)),{offset:be}=rg({json:We,selection:f().getSelection(),deltaY:0,items:ze});b(m,{initialTarget:z.target,initialClientY:z.clientY,initialContentTop:Y(),selectionStartIndex:Qe,selectionItemsCount:Uo(We,u()).length,items:ze,offset:be,didMoveItems:!1}),hn(hn().dragging=!0),document.addEventListener("mousemove",X,!0),document.addEventListener("mouseup",I)}function X(z){if(c(m)){const L=f().getJson();if(L===void 0)return;const ze=ie(c(m),z),{offset:We}=rg({json:L,selection:f().getSelection(),deltaY:ze,items:c(m).items});We!==c(m).offset&&(d("drag selection",We,ze),b(m,{...c(m),offset:We,didMoveItems:!0}))}}function I(z){if(c(m)){const L=f().getJson();if(L===void 0)return;const ze=ie(c(m),z),{operations:We,updatedSelection:je}=rg({json:L,selection:f().getSelection(),deltaY:ze,items:c(m).items});if(We)f().onPatch(We,(Qe,be)=>({state:be,selection:je??u()}));else if(z.target===c(m).initialTarget&&!c(m).didMoveItems){const Qe=Up(z.target),be=wS(z.target);be&&f().onSelect(Jy(Qe,be))}b(m,void 0),hn(hn().dragging=!1),document.removeEventListener("mousemove",X,!0),document.removeEventListener("mouseup",I)}}function se(z,L){const ze=[];function We(je){const Qe=c(v).concat(je),be=f().findElement(Qe);be!==void 0&&ze.push({path:Qe,height:be.clientHeight})}if(Array.isArray(s())){const je=f().getJson();if(je===void 0)return;const Qe=ho(je,z),be=rl(je,z),gt=parseInt(Ot(Qe),10),Ye=parseInt(Ot(be),10),Ve=L.find(Ae=>gt>=Ae.start&&Ye<=Ae.end);if(!Ve)return;const{start:_t,end:Nt}=Ve;cS(_t,Math.min(s().length,Nt),Ae=>We(String(Ae)))}else Object.keys(s()).forEach(We);return ze}function ce(z){hn().selecting||hn().dragging||(z.stopPropagation(),Po(z.target,"data-type","selectable-value")?b(p,jy):Po(z.target,"data-type","selectable-key")?b(p,void 0):Po(z.target,"data-type","insert-selection-area-inside")?b(p,Mc):Po(z.target,"data-type","insert-selection-area-after")&&b(p,Kp),clearTimeout(g))}function Te(z){z.stopPropagation(),g=window.setTimeout(()=>b(p,void 0))}function le(z){z.shiftKey||(z.stopPropagation(),z.preventDefault(),f().onSelect(mo(c(v))))}function de(z){z.shiftKey||(z.stopPropagation(),z.preventDefault(),f().onSelect(vo(c(v))))}function ne(z){f().onSelect(mo(c(v))),f().onContextMenu(z)}function ue(z){f().onSelect(vo(c(v))),f().onContextMenu(z)}K(()=>P(i()),()=>{b(v,Li(i()))}),K(()=>P(i()),()=>{b(n,encodeURIComponent(i()))}),K(()=>P(o()),()=>{b(y,jl(o())?o().expanded:!1)}),K(()=>(P(s()),P(o())),()=>{b(S,fo(s(),o(),[]))}),K(()=>P(o()),()=>{b(k,wr(o())?o().visibleSections:void 0)}),K(()=>P(l()),()=>{var z;b(C,(z=l())==null?void 0:z.validationError)}),K(()=>(P(f()),P(u()),c(v)),()=>{b(w,mu(f().getJson(),u(),c(v)))}),K(()=>c(v),()=>{b(r,c(v).length===0)}),Vt(),st(!0);var ge=GL();let j,we;var Pe=M(ge);{var q=z=>{var L=RL(),ze=$e(L),We=M(ze),je=M(We),Qe=M(je);{var be=ot=>{Dt(ot,{data:Wo})},gt=ot=>{Dt(ot,{data:vu})};te(Qe,ot=>{c(y)?ot(be):ot(gt,!1)})}var Ye=N(je,2);Pn(Ye,e,"identifier",{},null);var Ve=N(Ye,2);{var _t=ot=>{var Ht=xL();D(ot,Ht)};te(Ve,ot=>{c(r)||ot(_t)})}var Nt=N(Ve,2),Ae=M(Nt),Je=M(Ae);{var ht=ot=>{var Ht=wL(),ln=N($e(Ht),2);ah(ln,{children:(Gt,lt)=>{var yt=ur();xe(()=>et(yt,`${s().length??""}
|
|
62
|
-
${s().length===1?"item":"items"}`)),D(Gt,yt)},$$slots:{default:!0}}),D(ot,Ht)},it=ot=>{var Ht=SL(),ln=N($e(Ht),2);ah(ln,{onclick:H,children:(Gt,lt)=>{var yt=ur();xe(()=>et(yt,`${s().length??""}
|
|
63
|
-
${s().length===1?"item":"items"}`)),D(Gt,yt)},$$slots:{default:!0}}),D(ot,Ht)};te(Je,ot=>{c(y)?ot(ht):ot(it,!1)})}var vt=N(Nt,2);{var Ze=ot=>{var Ht=CL(),ln=M(Ht);Oo(ln,{get root(){return c(r)},selected:!0,get onContextMenu(){return f().onContextMenu}}),D(ot,Ht)};te(vt,ot=>{!f().readOnly&&c(w)&&u()&&(Qt(u())||dn(u()))&&!ei(u())&&Pt(He(u()),c(v))&&ot(Ze)})}var rt=N(We,2);{var Le=ot=>{Da(ot,{get validationError(){return c(C)},onExpand:H})};te(rt,ot=>{c(C)&&(!c(y)||!c(C).isChildError)&&ot(Le)})}var oe=N(rt,2);{var Et=ot=>{var Ht=kL();ae("click",Ht,le),D(ot,Ht)},bt=ot=>{var Ht=AL();ae("click",Ht,de),D(ot,Ht)};te(oe,ot=>{c(y)?ot(Et):ot(bt,!1)})}var Un=N(ze,2);{var fr=ot=>{var Ht=ML(),ln=$e(Ht),Gt=M(ln);{var lt=qt=>{var rn=OL();let Gn;Jt(rn,"title",Jp);let mt;var dt=M(rn);const Tt=he(()=>c(w)&&br(u()));Oo(dt,{insert:!0,get selected(){return c(Tt)},onContextMenu:ne}),xe(an=>{Gn=ct(rn,1,"jse-insert-area jse-inside svelte-oawf7x",null,Gn,an),mt=Gi(rn,"",mt,{"--level":c(v).length+1})},[()=>({"jse-hovered":c(p)===Mc,"jse-selected":c(w)&&br(u())})],he),D(qt,rn)};te(Gt,qt=>{!f().readOnly&&(c(p)===Mc||c(w)&&br(u()))&&qt(lt)})}var yt=N(Gt,2);Sn(yt,1,()=>c(k)||Ea,Ln,(qt,rn,Gn)=>{var mt=EL(),dt=$e(mt);Sn(dt,1,()=>A(s(),c(rn),c(m)),$t=>$t.index,($t,sn)=>{var jt=bn();const on=he(()=>wr(l())?l().items[c(sn).index]:void 0),En=he(()=>Ky(f().getJson(),u(),c(v).concat(String(c(sn).index))));var Wn=$e(jt);const fn=he(()=>V1(i(),c(sn).index)),me=he(()=>wr(o())?o().items[c(sn).index]:void 0),xt=he(()=>wr(a())?a().items[c(sn).index]:void 0);ym(Wn,{get value(){return s()[c(sn).index]},get pointer(){return c(fn)},get state(){return c(me)},get validationErrors(){return c(on)},get searchResults(){return c(xt)},get selection(){return c(En)},get context(){return f()},onDragSelectionStart:F,$$slots:{identifier:(mn,Ke)=>{var ir=_L(),Fn=M(ir),kr=M(Fn);xe(()=>et(kr,c(sn).gutterIndex)),D(mn,ir)}}}),D($t,jt)});var Tt=N(dt,2);{var an=$t=>{const sn=he(()=>c(k)||Ea);cL($t,{get visibleSections(){return c(sn)},sectionIndex:Gn,get total(){return s().length},get path(){return c(v)},get onExpandSection(){return f().onExpandSection},get selection(){return u()},get context(){return f()}})};te(Tt,$t=>{c(rn).end<s().length&&$t(an)})}D(qt,mt)});var Xt=N(ln,2),nn=N(M(Xt),2);{var Ft=qt=>{var rn=TL();ae("click",rn,de),D(qt,rn)};te(nn,qt=>{c(r)||qt(Ft)})}D(ot,Ht)};te(Un,ot=>{c(y)&&ot(fr)})}ae("click",je,O),D(z,L)},B=(z,L)=>{{var ze=je=>{var Qe=HL(),be=$e(Qe),gt=M(be),Ye=M(gt),Ve=M(Ye);{var _t=lt=>{Dt(lt,{data:Wo})},Nt=lt=>{Dt(lt,{data:vu})};te(Ve,lt=>{c(y)?lt(_t):lt(Nt,!1)})}var Ae=N(Ye,2);Pn(Ae,e,"identifier",{},null);var Je=N(Ae,2);{var ht=lt=>{var yt=PL();D(lt,yt)};te(Je,lt=>{c(r)||lt(ht)})}var it=N(Je,2),vt=M(it),Ze=M(vt);{var rt=lt=>{var yt=DL();D(lt,yt)},Le=lt=>{var yt=IL(),Xt=N($e(yt),2);ah(Xt,{onclick:H,children:(nn,Ft)=>{var qt=ur();xe((rn,Gn)=>et(qt,`${rn??""}
|
|
64
|
-
${Gn??""}`),[()=>Object.keys(s()).length,()=>Object.keys(s()).length===1?"prop":"props"],he),D(nn,qt)},$$slots:{default:!0}}),D(lt,yt)};te(Ze,lt=>{c(y)?lt(rt):lt(Le,!1)})}var oe=N(it,2);{var Et=lt=>{var yt=LL(),Xt=M(yt);Oo(Xt,{get root(){return c(r)},selected:!0,get onContextMenu(){return f().onContextMenu}}),D(lt,yt)};te(oe,lt=>{!f().readOnly&&c(w)&&u()&&(Qt(u())||dn(u()))&&!ei(u())&&Pt(He(u()),c(v))&<(Et)})}var bt=N(gt,2);{var Un=lt=>{Da(lt,{get validationError(){return c(C)},onExpand:H})};te(bt,lt=>{c(C)&&(!c(y)||!c(C).isChildError)&<(Un)})}var fr=N(bt,2);{var ot=lt=>{var yt=NL();ae("click",yt,le),D(lt,yt)},Ht=(lt,yt)=>{{var Xt=nn=>{var Ft=jL();ae("click",Ft,de),D(nn,Ft)};te(lt,nn=>{c(r)||nn(Xt)},yt)}};te(fr,lt=>{c(y)?lt(ot):lt(Ht,!1)})}var ln=N(be,2);{var Gt=lt=>{var yt=VL(),Xt=$e(yt),nn=M(Xt);{var Ft=dt=>{var Tt=BL();let an;Jt(Tt,"title",Jp);let $t;var sn=M(Tt);const jt=he(()=>c(w)&&br(u()));Oo(sn,{insert:!0,get selected(){return c(jt)},onContextMenu:ne}),xe(on=>{an=ct(Tt,1,"jse-insert-area jse-inside svelte-oawf7x",null,an,on),$t=Gi(Tt,"",$t,{"--level":c(v).length+1})},[()=>({"jse-hovered":c(p)===Mc,"jse-selected":c(w)&&br(u())})],he),D(dt,Tt)};te(nn,dt=>{!f().readOnly&&(c(p)===Mc||c(w)&&br(u()))&&dt(Ft)})}var qt=N(nn,2);Sn(qt,1,()=>E(s(),c(m)),Ln,(dt,Tt)=>{var an=bn();const $t=he(()=>V1(i(),c(Tt))),sn=he(()=>$i(a())?a().properties[c(Tt)]:void 0),jt=he(()=>$i(l())?l().properties[c(Tt)]:void 0),on=he(()=>c(v).concat(c(Tt))),En=he(()=>Ky(f().getJson(),u(),c(on)));var Wn=$e(an);const fn=he(()=>$i(o())?o().properties[c(Tt)]:void 0);ym(Wn,{get value(){return s()[c(Tt)]},get pointer(){return c($t)},get state(){return c(fn)},get validationErrors(){return c(jt)},get searchResults(){return c(sn)},get selection(){return c(En)},get context(){return f()},onDragSelectionStart:F,$$slots:{identifier:(me,xt)=>{var mn=FL();let Ke;var ir=M(mn);const Fn=he(()=>D6(c(sn)));dL(ir,{get pointer(){return c($t)},get key(){return c(Tt)},get selection(){return c(En)},get searchResultItems(){return c(Fn)},get context(){return f()},onUpdateKey:W}),xe(kr=>Ke=ct(mn,1,"jse-key-outer svelte-oawf7x",null,Ke,kr),[()=>({"jse-selected-key":nr(c(En))&&Pt(c(En).path,c(on))})],he),D(me,mn)}}}),D(dt,an)});var rn=N(Xt,2),Gn=N(M(rn),2);{var mt=dt=>{var Tt=zL();ae("click",Tt,de),D(dt,Tt)};te(Gn,dt=>{c(r)||dt(mt)})}D(lt,yt)};te(ln,lt=>{c(y)&<(Gt)})}ae("click",Ye,O),D(je,Qe)},We=je=>{var Qe=JL(),be=M(Qe),gt=M(be);Pn(gt,e,"identifier",{},null);var Ye=N(gt,2);{var Ve=oe=>{var Et=qL();D(oe,Et)};te(Ye,oe=>{c(r)||oe(Ve)})}var _t=N(Ye,2),Nt=M(_t);const Ae=he(()=>c(w)?u():void 0),Je=he(()=>I6(a()));wC(Nt,{get path(){return c(v)},get value(){return s()},get enforceString(){return c(S)},get selection(){return c(Ae)},get searchResultItems(){return c(Je)},get context(){return f()}});var ht=N(_t,2);{var it=oe=>{var Et=UL(),bt=M(Et);Oo(bt,{get root(){return c(r)},selected:!0,get onContextMenu(){return f().onContextMenu}}),D(oe,Et)};te(ht,oe=>{!f().readOnly&&c(w)&&u()&&(Qt(u())||dn(u()))&&!ei(u())&&Pt(He(u()),c(v))&&oe(it)})}var vt=N(be,2);{var Ze=oe=>{Da(oe,{get validationError(){return c(C)},onExpand:H})};te(vt,oe=>{c(C)&&oe(Ze)})}var rt=N(vt,2);{var Le=oe=>{var Et=WL();ae("click",Et,de),D(oe,Et)};te(rt,oe=>{c(r)||oe(Le)})}D(je,Qe)};te(z,je=>{Kt(s())?je(ze):je(We,!1)},L)}};te(Pe,z=>{Array.isArray(s())?z(q):z(B,!1)})}var Se=N(Pe,2);{var ke=z=>{var L=KL();let ze;Jt(L,"title",Jp);var We=M(L);const je=he(()=>c(w)&&Ti(u()));Oo(We,{insert:!0,get selected(){return c(je)},onContextMenu:ue}),xe(Qe=>ze=ct(L,1,"jse-insert-area jse-after svelte-oawf7x",null,ze,Qe),[()=>({"jse-hovered":c(p)===Kp,"jse-selected":c(w)&&Ti(u())})],he),D(z,L)};te(Se,z=>{!f().readOnly&&(c(p)===Kp||c(w)&&Ti(u()))&&z(ke)})}xe((z,L)=>{j=ct(ge,1,z,"svelte-oawf7x",j,L),Jt(ge,"data-path",c(n)),Jt(ge,"aria-selected",c(w)),we=Gi(ge,"",we,{"--level":c(v).length})},[()=>nl(mc("jse-json-node",{"jse-expanded":c(y)},f().onClassName(c(v),s()))),()=>({"jse-root":c(r),"jse-selected":c(w)&&dn(u()),"jse-selected-value":c(w)&&Qt(u()),"jse-readonly":f().readOnly,"jse-hovered":c(p)===jy})],he),ae("mousedown",ge,G),ae("mousemove",ge,V),ae("mouseover",ge,ce),ae("mouseout",ge,Te),D(t,ge),Xe()}const XL={prefix:"fas",iconName:"jsoneditor-expand",icon:[512,512,[],"","M 0,448 V 512 h 512 v -64 z M 0,0 V 64 H 512 V 0 Z M 256,96 128,224 h 256 z M 256,416 384,288 H 128 Z"]},QL={prefix:"fas",iconName:"jsoneditor-collapse",icon:[512,512,[],"","m 0,224 v 64 h 512 v -64 z M 256,192 384,64 H 128 Z M 256,320 128,448 h 256 z"]},SC={prefix:"fas",iconName:"jsoneditor-format",icon:[512,512,[],"","M 0,32 v 64 h 416 v -64 z M 160,160 v 64 h 352 v -64 z M 160,288 v 64 h 288 v -64 z M 0,416 v 64 h 320 v -64 z"]},YL={prefix:"fas",iconName:"jsoneditor-compact",icon:[512,512,[],"","M 0,32 v 64 h 512 v -64 z M 0,160 v 64 h 512 v -64 z M 0,288 v 64 h 352 v -64 z"]};function ZL(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0);let s=x(e,"json",9),o=x(e,"selection",9),l=x(e,"readOnly",9),a=x(e,"showSearch",13,!1),u=x(e,"history",9),f=x(e,"onExpandAll",9),h=x(e,"onCollapseAll",9),d=x(e,"onUndo",9),p=x(e,"onRedo",9),g=x(e,"onSort",9),m=x(e,"onTransform",9),v=x(e,"onContextMenu",9),y=x(e,"onCopy",9),S=x(e,"onRenderMenu",9);function k(){a(!a())}let C=R(void 0,!0),w=R(void 0,!0),E=R(void 0,!0),A=R(void 0,!0);K(()=>P(s()),()=>{b(n,s()!==void 0)}),K(()=>(c(n),P(o()),Qt),()=>{b(r,c(n)&&(dn(o())||nr(o())||Qt(o())))}),K(()=>(P(f()),P(s())),()=>{b(C,{type:"button",icon:XL,title:"Expand all",className:"jse-expand-all",onClick:f(),disabled:!Vn(s())})}),K(()=>(P(h()),P(s())),()=>{b(w,{type:"button",icon:QL,title:"Collapse all",className:"jse-collapse-all",onClick:h(),disabled:!Vn(s())})}),K(()=>P(s()),()=>{b(E,{type:"button",icon:np,title:"Search (Ctrl+F)",className:"jse-search",onClick:k,disabled:s()===void 0})}),K(()=>(P(l()),c(C),c(w),P(g()),P(s()),P(m()),c(E),P(v()),P(d()),P(u()),P(p()),P(y()),c(r)),()=>{b(A,l()?[c(C),c(w),{type:"separator"},{type:"button",icon:Fo,title:"Copy (Ctrl+C)",className:"jse-copy",onClick:y(),disabled:!c(r)},{type:"separator"},c(E),{type:"space"}]:[c(C),c(w),{type:"separator"},{type:"button",icon:tp,title:"Sort",className:"jse-sort",onClick:g(),disabled:l()||s()===void 0},{type:"button",icon:ep,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:m(),disabled:l()||s()===void 0},c(E),{type:"button",icon:nC,title:Qv,className:"jse-contextmenu",onClick:v()},{type:"separator"},{type:"button",icon:a0,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:d(),disabled:!u().canUndo},{type:"button",icon:l0,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:p(),disabled:!u().canRedo},{type:"space"}])}),K(()=>(P(S()),c(A)),()=>{b(i,S()(c(A))||c(A))}),Vt(),st(!0),up(t,{get items(){return c(i)}}),Xe()}function $L(t,e){t.stopPropagation(),e.onCreateObject()}function eN(t,e){t.stopPropagation(),e.onCreateArray()}var tN=(t,e)=>e.onClick(),nN=J('<div class="jse-welcome-info svelte-1eamlhk">You can paste clipboard data using <b>Ctrl+V</b>, or use the following options:</div> <button class="svelte-1eamlhk">Create object</button> <button class="svelte-1eamlhk">Create array</button>',1),rN=J('<div class="jse-welcome svelte-1eamlhk" role="none"><div class="jse-space jse-before svelte-1eamlhk"></div> <div class="jse-contents svelte-1eamlhk"><div class="jse-welcome-title">Empty document</div> <!></div> <div class="jse-space jse-after svelte-1eamlhk"></div></div>');function iN(t,e){Ge(e,!0);var n=rN();n.__click=[tN,e];var r=N(M(n),2),i=N(M(r),2);{var s=o=>{var l=nN(),a=N($e(l),2);Jt(a,"title","Create an empty JSON object (press '{')"),a.__click=[$L,e];var u=N(a,2);Jt(u,"title","Create an empty JSON array (press '[')"),u.__click=[eN,e],D(o,l)};te(i,o=>{e.readOnly||o(s)})}D(t,n),Xe()}Fu(["click"]);var ig={exports:{}},ob;function sN(){if(ob)return ig.exports;ob=1;/*
|
|
65
|
-
* @version 1.4.0
|
|
66
|
-
* @date 2015-10-26
|
|
67
|
-
* @stability 3 - Stable
|
|
68
|
-
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
69
|
-
* @license MIT License
|
|
70
|
-
*/var t=function(e,n){var r,i,s=1,o=0,l=0,a=String.alphabet;function u(f,h,d){if(d){for(r=h;d=u(f,r),d<76&&d>65;)++r;return+f.slice(h-1,r)}return d=a&&a.indexOf(f.charAt(h)),d>-1?d+76:(d=f.charCodeAt(h)||0,d<45||d>127?d:d<46?65:d<48?d-1:d<58?d+18:d<65?d-11:d<91?d+11:d<97?d-37:d<123?d+5:d-63)}if((e+="")!=(n+="")){for(;s;)if(i=u(e,o++),s=u(n,l++),i<76&&s<76&&i>66&&s>66&&(i=u(e,o,o),s=u(n,l,o=r),l=r),i!=s)return i<s?-1:1}return 0};try{ig.exports=t}catch{String.naturalCompare=t}return ig.exports}var oN=sN();const lN=Ew(oN);function m0(t,e){const n=typeof t=="string"?t.toLowerCase():t,r=typeof e=="string"?e.toLowerCase():e;return lN(n,r)}function CC(t,e=[],n=[],r=1){const i=De(t,e);if(Nn(i)){if(n===void 0)throw new Error("Cannot sort: no property selected by which to sort the array");return cN(t,e,n,r)}if(Kt(i))return aN(t,e,r);throw new Error("Cannot sort: no array or object")}function aN(t,e=[],n=1){const r=De(t,e),s=Object.keys(r).slice();s.sort((l,a)=>n*m0(l,a));const o={};return s.forEach(l=>o[l]=r[l]),[{op:"replace",path:tt(e),value:o}]}function cN(t,e=[],n=[],r=1){const i=uN(n,r),s=De(t,e);return[{op:"replace",path:tt(e),value:s.slice(0).sort(i)}]}function uN(t,e){return function(r,i){const s=De(r,t),o=De(i,t);return s===void 0?e:o===void 0?-e:typeof s!="string"&&typeof o!="string"?s>o?e:s<o?-e:0:e*m0(s,o)}}var fN=J('<button type="button"> </button>'),hN=J('<button type="button" class="jse-navigation-bar-dropdown-item svelte-2nnd2m">...</button>'),dN=J('<div class="jse-navigation-bar-dropdown svelte-2nnd2m"><!> <!></div>');function pN(t,e){Ge(e,!1);let n=x(e,"items",9),r=x(e,"selectedItem",9),i=x(e,"onSelect",9);const s=100,o=30;st(!0);var l=dN(),a=M(l);Sn(a,1,()=>uS(n(),s),h=>h,(h,d)=>{var p=fN();let g;var m=M(p);xe((v,y,S)=>{g=ct(p,1,"jse-navigation-bar-dropdown-item svelte-2nnd2m",null,g,v),Jt(p,"title",y),et(m,S)},[()=>({"jse-selected":c(d)===r()}),()=>c(d).toString(),()=>Xu(c(d).toString(),o)],he),ae("click",p,Ui(()=>i()(c(d)))),D(h,p)});var u=N(a,2);{var f=h=>{var d=hN();Jt(d,"title","Limited to 100 items"),D(h,d)};te(u,h=>{n().length>s&&h(f)})}D(t,l),Xe()}var gN=J('<button type="button" class="jse-navigation-bar-button svelte-752ro1"> </button>'),mN=J('<div class="jse-navigation-bar-item svelte-752ro1"><button type="button"><!></button> <!></div>');function lb(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),{openAbsolutePopup:i,closeAbsolutePopup:s}=el("absolute-popup");let o=x(e,"path",9),l=x(e,"index",9),a=x(e,"onSelect",9),u=x(e,"getItems",9),f=R(void 0,!0),h=R(!1,!0),d;function p(w){s(d),a()(c(n).concat(w))}function g(){if(c(f)){b(h,!0);const w={items:u()(c(n)),selectedItem:c(r),onSelect:p};d=i(pN,w,{anchor:c(f),closeOnOuterClick:!0,onClose:()=>{b(h,!1)}})}}K(()=>(P(o()),P(l())),()=>{b(n,o().slice(0,l()))}),K(()=>(P(o()),P(l())),()=>{b(r,o()[l()])}),Vt(),st(!0);var m=mN(),v=M(m);let y;var S=M(v);Dt(S,{data:eC});var k=N(v,2);{var C=w=>{var E=gN(),A=M(E);xe(()=>et(A,c(r))),ae("click",E,()=>p(c(r))),D(w,E)};te(k,w=>{c(r)!==void 0&&w(C)})}gn(m,w=>b(f,w),()=>c(f)),xe(w=>y=ct(v,1,"jse-navigation-bar-button jse-navigation-bar-arrow svelte-752ro1",null,y,w),[()=>({"jse-open":c(h)})],he),ae("click",v,g),D(t,m),Xe()}function v0(t){var e;if(navigator.clipboard)return navigator.clipboard.writeText(t);if((e=document.queryCommandSupported)!=null&&e.call(document,"copy")){const n=document.createElement("textarea");n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();try{document.execCommand("copy")}catch(r){console.error(r)}finally{document.body.removeChild(n)}return Promise.resolve()}else return console.error("Copy failed."),Promise.resolve()}var vN=J('<button type="button" class="jse-navigation-bar-validation-error svelte-zc2wx7"><!></button>'),yN=J('<div class="jse-copied-text svelte-zc2wx7">Copied!</div>'),bN=J('<div><input type="text" class="jse-navigation-bar-text svelte-zc2wx7"> <!> <!> <button type="button" title="Copy selected path to the clipboard"><!></button></div>');function xN(t,e){Ge(e,!1);const n=R(),r=el("absolute-popup");let i=x(e,"path",8),s=x(e,"pathParser",8),o=x(e,"onChange",8),l=x(e,"onClose",8),a=x(e,"onError",8),u=x(e,"pathExists",8),f=R(),h=R(),d=R(!1),p,g=R(!1);const m=1e3;Cr(()=>{v()}),Ii(()=>{clearTimeout(p)});function v(){c(f).focus()}function y(ie){try{const F=s().parse(ie);return S(F),{path:F,error:void 0}}catch(F){return{path:void 0,error:F}}}function S(ie){if(!u()(ie))throw new Error("Path does not exist in current document")}function k(ie){b(h,ie.currentTarget.value)}function C(ie){const F=uo(ie);if(F==="Escape"&&(ie.preventDefault(),l()()),F==="Enter"){ie.preventDefault(),b(d,!0);const X=y(c(h));X.path!==void 0?o()(X.path):a()(X.error)}}function w(){v0(c(h)),b(g,!0),p=window.setTimeout(()=>b(g,!1),m),v()}K(()=>(P(s()),P(i())),()=>{b(h,s().stringify(i()))}),K(()=>(c(d),c(h)),()=>{b(n,c(d)?y(c(h)).error:void 0)}),Vt(),st();var E=bN();let A;var O=M(E);gn(O,ie=>b(f,ie),()=>c(f));var H=N(O,2);{var W=ie=>{var F=vN(),X=M(F);Dt(X,{data:Vl}),Tr(F,(I,se)=>so==null?void 0:so(I,se),()=>({text:String(c(n)||""),...r})),D(ie,F)};te(H,ie=>{c(n)&&ie(W)})}var G=N(H,2);{var V=ie=>{var F=yN();D(ie,F)};te(G,ie=>{c(g)&&ie(V)})}var U=N(G,2);let Q;var Y=M(U);Dt(Y,{data:Fo}),xe((ie,F)=>{A=ct(E,1,"jse-navigation-bar-path-editor svelte-zc2wx7",null,A,ie),Dl(O,c(h)),Q=ct(U,1,"jse-navigation-bar-copy svelte-zc2wx7",null,Q,F)},[()=>({error:c(n)}),()=>({copied:c(g)})],he),ae("keydown",O,Ui(C)),ae("input",O,k),ae("click",U,w),D(t,E),Xe()}var wN=J("<!> <!>",1),SN=J('<div class="jse-navigation-bar svelte-xs03gj"><!> <button type="button"><span class="jse-navigation-bar-space svelte-xs03gj"> </span> <!></button></div>');function CN(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=rr("jsoneditor:NavigationBar");let s=x(e,"json",9),o=x(e,"selection",9),l=x(e,"onSelect",9),a=x(e,"onError",9),u=x(e,"pathParser",9),f=R(void 0,!0),h=R(!1,!0);function d(U){setTimeout(()=>{if(c(f)&&c(f).scrollTo){const Q=c(f).scrollWidth-c(f).clientWidth;Q>0&&(i("scrollTo ",Q),c(f).scrollTo({left:Q,behavior:"smooth"}))}})}function p(U){i("get items for path",U);const Q=De(s(),U);if(Array.isArray(Q))return aS(0,Q.length).map(String);if(Kt(Q)){const ie=Object.keys(Q).slice(0);return ie.sort(m0),ie}else return[]}function g(U){return Ei(s(),U)}function m(U){i("select path",JSON.stringify(U)),l()(Rr(U,U))}function v(){b(h,!c(h))}function y(){b(h,!1)}function S(U){y(),m(U)}K(()=>(P(o()),He),()=>{b(n,o()?He(o()):[])}),K(()=>(P(s()),c(n)),()=>{b(r,Vn(De(s(),c(n))))}),K(()=>c(n),()=>{d(c(n))}),Vt(),st(!0);var k=SN(),C=M(k);{var w=U=>{var Q=wN(),Y=$e(Q);Sn(Y,1,()=>c(n),Ln,(X,I,se)=>{lb(X,{getItems:p,get path(){return c(n)},index:se,onSelect:m})});var ie=N(Y,2);{var F=X=>{lb(X,{getItems:p,get path(){return c(n)},get index(){return c(n).length},onSelect:m})};te(ie,X=>{c(r)&&X(F)})}D(U,Q)},E=U=>{xN(U,{get path(){return c(n)},onClose:y,onChange:S,get onError(){return a()},pathExists:g,get pathParser(){return u()}})};te(C,U=>{c(h)?U(E,!1):U(w)})}var A=N(C,2);let O;var H=M(A),W=M(H),G=N(H,2);const V=he(()=>c(h)?b9:n9);Dt(G,{get data(){return c(V)}}),gn(k,U=>b(f,U),()=>c(f)),xe((U,Q)=>{O=ct(A,1,"jse-navigation-bar-edit svelte-xs03gj",null,O,U),Jt(A,"title",c(h)?"Cancel editing the selected path":"Edit the selected path"),et(W,Q)},[()=>({flex:!c(h),editing:c(h)}),()=>!Vn(s())&&!c(h)?"Navigation bar":" "],he),ae("click",A,v),D(t,k),Xe()}var kN=J('<button type="button" class="jse-replace-toggle svelte-1mxl2uo" title="Toggle visibility of replace options (Ctrl+H)"><!></button>'),AN=J('<div class="jse-replace-section svelte-1mxl2uo"><input class="jse-replace-input svelte-1mxl2uo" title="Enter replacement text" type="text" placeholder="Replace"> <button type="button" title="Replace current occurrence (Ctrl+Enter)" class="svelte-1mxl2uo">Replace</button> <button type="button" title="Replace all occurrences" class="svelte-1mxl2uo">All</button></div>'),ON=J('<div class="jse-search-box svelte-1mxl2uo"><form class="jse-search-form svelte-1mxl2uo"><!> <div class="jse-search-contents svelte-1mxl2uo"><div class="jse-search-section svelte-1mxl2uo"><div class="jse-search-icon svelte-1mxl2uo"><!></div> <label class="jse-search-input-label svelte-1mxl2uo" about="jse-search input"><input class="jse-search-input svelte-1mxl2uo" title="Enter text to search" type="text" placeholder="Find"></label> <div> </div> <button type="button" class="jse-search-next svelte-1mxl2uo" title="Go to next search result (Enter)"><!></button> <button type="button" class="jse-search-previous svelte-1mxl2uo" title="Go to previous search result (Shift+Enter)"><!></button> <button type="button" class="jse-search-clear svelte-1mxl2uo" title="Close search box (Esc)"><!></button></div> <!></div></form></div>');function kC(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=rr("jsoneditor:SearchBox");let o=x(e,"json",9),l=x(e,"documentState",9),a=x(e,"parser",9),u=x(e,"showSearch",9),f=x(e,"showReplace",13),h=x(e,"readOnly",9),d=x(e,"columns",9),p=x(e,"onSearch",9),g=x(e,"onFocus",9),m=x(e,"onPatch",9),v=x(e,"onClose",9),y=R("",!0),S="",k=R("",!0),C=R(!1,!0),w=R(void 0,!0);const E=jh(I,om),A=jh(se,om);function O(){f(!f()&&!h())}function H(ue){ue.stopPropagation();const ge=uo(ue);ge==="Enter"&&(ue.preventDefault(),c(y)!==S?E.flush():Y()),ge==="Shift+Enter"&&(ue.preventDefault(),ie()),ge==="Ctrl+Enter"&&(ue.preventDefault(),f()?V():Y()),ge==="Ctrl+H"&&(ue.preventDefault(),O()),ge==="Escape"&&(ue.preventDefault(),Te())}function W(ue){uo(ue)==="Enter"&&(ue.preventDefault(),ue.stopPropagation(),V())}async function G(){_n(),await E.flush()}async function V(){var we;if(h())return;const ue=(we=c(w))==null?void 0:we.activeItem;if(s("handleReplace",{replaceText:c(k),activeItem:ue}),!c(w)||!ue||o()===void 0)return;b(w,{...Gy(c(w)),activeIndex:c(r)});const{operations:ge,newSelection:j}=M6(o(),l(),c(k),ue,a());m()(ge,(Pe,q)=>({state:q,selection:j})),_n(),await A.flush(),await F()}async function U(){if(h())return;s("handleReplaceAll",{text:c(y),replaceText:c(k)});const{operations:ue,newSelection:ge}=R6(o(),l(),c(y),c(k),a());m()(ue,(j,we)=>({state:we,selection:ge})),await F()}function Q(ue){ue.select()}async function Y(){b(w,c(w)?Gy(c(w)):void 0),await F()}async function ie(){b(w,c(w)?T6(c(w)):void 0),await F()}async function F(){var ge;s("handleFocus",c(w));const ue=(ge=c(w))==null?void 0:ge.activeItem;ue&&o()!==void 0&&await g()(ue.path,ue.resultIndex)}async function X(ue){await ce(ue,c(y),o())}async function I(ue){await ce(u(),ue,o()),await F()}async function se(ue){await ce(u(),c(y),ue)}async function ce(ue,ge,j){return ue?(s("applySearch",{showSearch:ue,text:ge}),ge===""?(s("clearing search result"),c(w)!==void 0&&b(w,void 0),Promise.resolve()):(S=ge,b(C,!0),new Promise(we=>{setTimeout(()=>{const Pe=XS(ge,j,{maxResults:wf,columns:d()});b(w,E6(Pe,c(w))),b(C,!1),we()})}))):(c(w)&&b(w,void 0),Promise.resolve())}function Te(){s("handleClose"),E.cancel(),A.cancel(),ce(!1,c(y),o()),v()()}K(()=>c(w),()=>{var ue,ge;b(n,((ge=(ue=c(w))==null?void 0:ue.items)==null?void 0:ge.length)||0)}),K(()=>c(w),()=>{var ue;b(r,((ue=c(w))==null?void 0:ue.activeIndex)||0)}),K(()=>(c(n),wf),()=>{b(i,c(n)>=wf?`${wf-1}+`:String(c(n)))}),K(()=>(P(p()),c(w)),()=>{p()(c(w))}),K(()=>P(u()),()=>{X(u())}),K(()=>c(y),()=>{E(c(y))}),K(()=>P(o()),()=>{A(o())}),Vt(),st(!0);var le=bn(),de=$e(le);{var ne=ue=>{var ge=ON(),j=M(ge),we=M(j);{var Pe=it=>{var vt=kN(),Ze=M(vt);const rt=he(()=>f()?Wo:vu);Dt(Ze,{get data(){return c(rt)}}),ae("click",vt,O),D(it,vt)};te(we,it=>{h()||it(Pe)})}var q=N(we,2),B=M(q),Se=M(B),ke=M(Se);{var z=it=>{Dt(it,{data:X6,spin:!0})},L=it=>{Dt(it,{data:np})};te(ke,it=>{c(C)?it(z):it(L,!1)})}var ze=N(Se,2),We=M(ze);cr(()=>no(We,()=>c(y),it=>b(y,it))),Tr(We,it=>Q==null?void 0:Q(it)),cr(()=>ae("paste",We,G));var je=N(ze,2);let Qe;var be=M(je),gt=N(je,2),Ye=M(gt);Dt(Ye,{data:y9});var Ve=N(gt,2),_t=M(Ve);Dt(_t,{data:r9});var Nt=N(Ve,2),Ae=M(Nt);Dt(Ae,{data:rp});var Je=N(B,2);{var ht=it=>{var vt=AN(),Ze=M(vt),rt=N(Ze,2),Le=N(rt,2);no(Ze,()=>c(k),oe=>b(k,oe)),ae("keydown",Ze,W),ae("click",rt,V),ae("click",Le,U),D(it,vt)};te(Je,it=>{f()&&!h()&&it(ht)})}xe(it=>{Qe=ct(je,1,"jse-search-count svelte-1mxl2uo",null,Qe,it),et(be,`${c(r)!==-1&&c(r)<c(n)?`${c(r)+1}/`:""}${c(i)??""}`)},[()=>({"jse-visible":c(y)!==""})],he),ae("click",gt,Y),ae("click",Ve,ie),ae("click",Nt,Te),ae("keydown",j,H),D(ue,ge)};te(de,ue=>{u()&&ue(ne)})}D(t,le),Xe()}var ab=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function _N(t,e){return!!(t===e||ab(t)&&ab(e))}function EN(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!_N(t[n],e[n]))return!1;return!0}function ef(t,e){e===void 0&&(e=EN);var n=null;function r(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(n&&n.lastThis===this&&e(i,n.lastArgs))return n.lastResult;var o=t.apply(this,i);return n={lastResult:o,lastArgs:i,lastThis:this},o}return r.clear=function(){n=null},r}const bu=Symbol("path");function TN(t,e,n=1/0){const r={};Array.isArray(t)&&C5(t,n,s=>{Kt(s)?AC(s,r,e):r[bu]=!0});const i=[];return bu in r&&i.push([]),OC(r,[],i,e),i}function AC(t,e,n){for(const r in t){const i=t[r],s=e[r]||(e[r]={});Kt(i)&&n?AC(i,s,n):s[bu]===void 0&&(s[bu]=!0)}}function OC(t,e,n,r){for(const i in t){const s=e.concat(i),o=t[i];o&&o[bu]===!0&&n.push(s),Hn(o)&&r&&OC(o,s,n,r)}}function MN(t,e){const n=new Set(e.map(tt)),r=new Set(t.map(tt));for(const i of n)r.has(i)||n.delete(i);for(const i of r)n.has(i)||n.add(i);return[...n].map(Li)}function RN(t,e,n,r,i,s,o=80){const l=Nn(n)?n.length:0,a=PN(r,i),u=t-o,f=e+2*o,h=S=>r[S]||i;let d=0,p=s;for(;p<u&&d<l;)p+=h(d),d++;d>0&&(d--,p-=h(d));let g=d,m=0;for(;m<f&&g<l;)m+=h(g),g++;let v=0;for(let S=g;S<l;S++)v+=h(S);const y=Nn(n)?n.slice(d,g):[];return{startIndex:d,endIndex:g,startHeight:p,endHeight:v,averageItemHeight:a,visibleHeight:m,visibleItems:y}}function cb(t,e,n,r){const{rowIndex:i}=Bi(t,e);let s=0;for(let o=0;o<i;o++)s+=n[o]||r;return s}function PN(t,e){const n=Object.values(t);if(Yt(n))return e;const r=(s,o)=>s+o;return n.reduce(r)/n.length}function DN(t,e){const{rowIndex:n,columnIndex:r}=Bi(He(e),t);if(n>0){const i={rowIndex:n-1,columnIndex:r},s=Yl(i,t);return wt(s)}return e}function IN(t,e,n){const{rowIndex:r,columnIndex:i}=Bi(He(n),e);if(r<t.length-1){const s={rowIndex:r+1,columnIndex:i},o=Yl(s,e);return wt(o)}return n}function LN(t,e){const{rowIndex:n,columnIndex:r}=Bi(He(e),t);if(r>0){const i={rowIndex:n,columnIndex:r-1},s=Yl(i,t);return wt(s)}return e}function NN(t,e){const{rowIndex:n,columnIndex:r}=Bi(He(e),t);if(r<t.length-1){const i={rowIndex:n,columnIndex:r+1},s=Yl(i,t);return wt(s)}return e}function Bi(t,e){const[n,...r]=t,i=parseInt(n,10);return{rowIndex:isNaN(i)?-1:i,columnIndex:e.findIndex(s=>po(r,s))}}function Yl(t,e){const{rowIndex:n,columnIndex:r}=t;return[String(n),...e[r]]}function jN(t,e){const[n,r]=h5(t,o=>Dv(o.path[0])),i=e5(n,BN),s=o5(i,o=>{const l={row:[],columns:{}};return o.forEach(a=>{const u=FN(a,e);u!==-1?(l.columns[u]===void 0&&(l.columns[u]=[]),l.columns[u].push(a)):l.row.push(a)}),l});return{root:r,rows:s}}function sg(t,e){if(!(!e||e.length===0))return e.length===1?e[0]:{path:t,message:"Multiple validation issues: "+e.map(n=>ts(n.path)+" "+n.message).join(", "),severity:Yi.warning}}function BN(t){return parseInt(t.path[0],10)}function FN(t,e){const n=Bi(t.path,e);return n.columnIndex!==-1?n.columnIndex:-1}function zN(t,e,n){return e.some(i=>VN(t,i,n))?void 0:t}function VN(t,e,n){if(!t)return!1;if(e.op==="replace"){const r=Li(e.path),{rowIndex:i,columnIndex:s}=Bi(r,n),o=n.findIndex(l=>Pt(l,t.path));if(i!==-1&&s!==-1&&s!==o)return!1}return!0}function HN(t,e=2){const n=[];function r(i,s){Hn(i)&&s.length<e&&Object.keys(i).forEach(o=>{r(i[o],s.concat(o))}),Nn(i)&&n.push(s)}return r(t,[]),n}const Pr=rr("jsoneditor:actions");async function _C({json:t,selection:e,indentation:n,readOnly:r,parser:i,onPatch:s}){if(r||t===void 0||!e||!gc(e))return;const o=VS(t,e,n,i);if(o===void 0)return;Pr("cut",{selection:e,clipboard:o,indentation:n}),await v0(o);const{operations:l,newSelection:a}=KS(t,e);s(l,(u,f)=>({state:f,selection:a}))}async function EC({json:t,selection:e,indentation:n,parser:r}){const i=VS(t,e,n,r);i!==void 0&&(Pr("copy",{clipboard:i,indentation:n}),await v0(i))}function TC({clipboardText:t,json:e,selection:n,readOnly:r,parser:i,onPatch:s,onChangeText:o,openRepairModal:l}){if(r)return;function a(u){if(e!==void 0){const f=n||wt([]),h=JS(e,f,u,i);Pr("paste",{pastedText:u,operations:h,ensureSelection:f}),s(h,(d,p)=>{let g=p;return h.filter(m=>(bw(m)||Ev(m))&&Vn(m.value)).forEach(m=>{const v=Qi(e,m.path);g=Bl(d,g,v)}),{state:g}})}else Pr("paste text",{pastedText:u}),o(t,(f,h)=>{if(f)return{state:Bl(f,h,[])}})}try{a(t)}catch{l(t,u=>{Pr("repaired pasted text: ",u),a(u)})}}function MC({json:t,text:e,selection:n,keepSelection:r,readOnly:i,onChange:s,onPatch:o}){if(i||!n)return;const l=t!==void 0&&(nr(n)||Qt(n))?Rr(n.path,n.path):n;if(Yt(He(n)))Pr("remove root",{selection:n}),s&&s({text:"",json:void 0},t!==void 0?{text:void 0,json:t}:{text:e||"",json:t},{contentErrors:void 0,patchResult:void 0});else if(t!==void 0){const{operations:a,newSelection:u}=KS(t,l);Pr("remove",{operations:a,selection:n,newSelection:u}),o(a,(f,h)=>({state:h,selection:r?n:u}))}}function qN({json:t,selection:e,columns:n,readOnly:r,onPatch:i}){if(r||t===void 0||!e||!gc(e))return;const{rowIndex:s,columnIndex:o}=Bi(He(e),n);Pr("duplicate row",{rowIndex:s});const l=[String(s)],a=US(t,[l]);i(a,(u,f)=>{const h=s<t.length?s+1:s,d=Yl({rowIndex:h,columnIndex:o},n),p=wt(d);return{state:f,selection:p}})}function UN({json:t,selection:e,columns:n,readOnly:r,onPatch:i}){if(r||t===void 0||!e||!gc(e))return;const{rowIndex:s}=Bi(He(e),n);Pr("insert before row",{rowIndex:s});const o=[String(s)],a=[{key:"",value:Hn(t[0])?{}:""}],u=wa(t,o,a);i(u)}function WN({json:t,selection:e,columns:n,readOnly:r,onPatch:i}){if(r||t===void 0||!e||!gc(e))return;const{rowIndex:s,columnIndex:o}=Bi(He(e),n);Pr("insert after row",{rowIndex:s});const l=s+1,a=[String(l)],f=[{key:"",value:Hn(t[0])?{}:""}],h=l<t.length?wa(t,a,f):fm(t,[],f);i(h,(d,p)=>{const g=Yl({rowIndex:l,columnIndex:o},n),m=wt(g);return{state:p,selection:m}})}function JN({json:t,selection:e,columns:n,readOnly:r,onPatch:i}){if(r||t===void 0||!e||!gc(e))return;const{rowIndex:s,columnIndex:o}=Bi(He(e),n);Pr("remove row",{rowIndex:s});const l=[String(s)],a=Hh([l]);i(a,(u,f)=>{const h=s<u.length?s:s>0?s-1:void 0,d=h!==void 0?wt(Yl({rowIndex:h,columnIndex:o},n)):void 0;return Pr("remove row new selection",{rowIndex:s,newRowIndex:h,newSelection:d}),{state:f,selection:d}})}function Gh({insertType:t,selectInside:e,initialValue:n,json:r,selection:i,readOnly:s,parser:o,onPatch:l,onReplaceJson:a}){if(s)return;const u=O6(r,i,t);if(r!==void 0){const f=o.stringify(u),h=JS(r,i,f,o);Pr("onInsert",{insertType:t,operations:h,newValue:u,data:f});const d=Ot(h.filter(p=>p.op==="add"||p.op==="replace"));l(h,(p,g,m)=>{if(d){const v=Qi(p,d.path);if(Vn(u))return{state:qi(p,g,v,i0),selection:e?mo(v):m};if(u===""){const y=Yt(v)?void 0:De(p,Lt(v));return{state:qi(p,g,v,oh),selection:Kt(y)?s0(v,n):Vh(v,n)}}}}),Pr("after patch")}else{Pr("onInsert",{insertType:t,newValue:u});const f=[];a(u,(h,d)=>({state:Bl(h,d,f),selection:Vn(u)?mo(f):Vh(f)}))}}async function RC({char:t,selectInside:e,json:n,selection:r,readOnly:i,parser:s,onPatch:o,onReplaceJson:l,onSelect:a}){if(!i){if(nr(r)){a({...r,edit:!0,initialValue:t});return}t==="{"?Gh({insertType:"object",selectInside:e,initialValue:void 0,json:n,selection:r,readOnly:i,parser:s,onPatch:o,onReplaceJson:l}):t==="["?Gh({insertType:"array",selectInside:e,initialValue:void 0,json:n,selection:r,readOnly:i,parser:s,onPatch:o,onReplaceJson:l}):Qt(r)&&n!==void 0?Vn(De(n,r.path))||a({...r,edit:!0,initialValue:t}):(Pr("onInsertValueWithCharacter",{char:t}),await KN({char:t,json:n,selection:r,readOnly:i,parser:s,onPatch:o,onReplaceJson:l}))}}async function KN({char:t,json:e,selection:n,readOnly:r,parser:i,onPatch:s,onReplaceJson:o}){r||Gh({insertType:"value",selectInside:!1,initialValue:t,json:e,selection:n,readOnly:r,parser:i,onPatch:s,onReplaceJson:o})}var GN=J('<div class="jse-json-preview svelte-1vjn89h"> </div>');function PC(t,e){Ge(e,!1);const n=R(),r=R();let i=x(e,"text",8),s=x(e,"json",8),o=x(e,"indentation",8),l=x(e,"parser",8);K(()=>(P(s()),P(i())),()=>{b(n,s()!==void 0?{json:s()}:{text:i()||""})}),K(()=>(c(n),P(o()),P(l()),lm),()=>{b(r,Xu(rm(c(n),o(),l()),lm))}),Vt(),st();var a=GN(),u=M(a);xe(()=>et(u,c(r))),D(t,a),Xe()}var XN=J('<button type="button"><!> <!></button>');function og(t,e){Ge(e,!1);let n=x(e,"item",8),r=x(e,"className",8,void 0),i=x(e,"onRequestClose",8);st();var s=XN(),o=M(s);{var l=f=>{Dt(f,{get data(){return n().icon}})};te(o,f=>{n().icon&&f(l)})}var a=N(o,2);{var u=f=>{var h=ur();xe(()=>et(h,n().text)),D(f,h)};te(a,f=>{n().text&&f(u)})}xe(f=>{ct(s,1,f,"svelte-1idfykj"),Jt(s,"title",n().title),s.disabled=n().disabled||!1},[()=>nl(mc("jse-context-menu-button",r(),n().className))],he),ae("click",s,f=>{i()(),n().onClick(f)}),D(t,s),Xe()}var QN=J('<li class="svelte-11rxb2m"><button type="button"><!> </button></li>'),YN=J('<div role="button" tabindex="0" class="jse-dropdown-button svelte-11rxb2m"><!> <button type="button" data-type="jse-open-dropdown"><!></button> <div><ul class="svelte-11rxb2m"></ul></div></div>');function ZN(t,e){Ge(e,!1);const n=R(void 0,!0);let r=x(e,"items",25,()=>[]),i=x(e,"title",9,void 0),s=x(e,"width",9,"120px"),o=R(!1,!0);function l(){const S=c(o);setTimeout(()=>b(o,!S))}function a(){b(o,!1)}function u(S){uo(S)==="Escape"&&(S.preventDefault(),b(o,!1))}Cr(()=>{document.addEventListener("click",a),document.addEventListener("keydown",u)}),Ii(()=>{document.removeEventListener("click",a),document.removeEventListener("keydown",u)}),K(()=>P(r()),()=>{b(n,r().every(S=>S.disabled===!0))}),Vt(),st(!0);var f=YN(),h=M(f);Pn(h,e,"defaultItem",{},null);var d=N(h,2);let p;var g=M(d);Dt(g,{data:Wo});var m=N(d,2);let v;var y=M(m);Sn(y,5,r,Ln,(S,k)=>{var C=QN(),w=M(C),E=M(w);{var A=H=>{Dt(H,{get data(){return c(k).icon}})};te(E,H=>{c(k).icon&&H(A)})}var O=N(E);xe(()=>{Jt(w,"title",c(k).title),w.disabled=c(k).disabled,ct(w,1,nl(c(k).className),"svelte-11rxb2m"),et(O,` ${c(k).text??""}`)}),ae("click",w,H=>c(k).onClick(H)),D(S,C)}),xe((S,k)=>{Jt(f,"title",i()),p=ct(d,1,"jse-open-dropdown svelte-11rxb2m",null,p,S),d.disabled=c(n),v=ct(m,1,"jse-dropdown-items svelte-11rxb2m",null,v,k),Gi(m,`width: ${s()??""};`)},[()=>({"jse-visible":c(o)}),()=>({"jse-visible":c(o)})],he),ae("click",d,l),ae("click",f,a),D(t,f),Xe()}var $N=J('<button type="button" slot="defaultItem"><!> </button>');function lg(t,e){Ge(e,!1);const n=R();let r=x(e,"item",8),i=x(e,"className",8,void 0),s=x(e,"onRequestClose",8);K(()=>(P(r()),P(s())),()=>{b(n,r().items.map(o=>({...o,onClick:l=>{s()(),o.onClick(l)}})))}),Vt(),st(),ZN(t,{get width(){return r().width},get items(){return c(n)},$$slots:{defaultItem:(o,l)=>{var a=$N(),u=M(a);{var f=d=>{Dt(d,{get data(){return r().main.icon}})};te(u,d=>{r().main.icon&&d(f)})}var h=N(u);xe(d=>{ct(a,1,d,"svelte-1idfykj"),Jt(a,"title",r().main.title),a.disabled=r().main.disabled||!1,et(h,` ${r().main.text??""}`)},[()=>nl(mc("jse-context-menu-button",i(),r().main.className))],he),ae("click",a,d=>{s()(),r().main.onClick(d)}),D(o,a)}}}),Xe()}var ej=J('<div class="jse-separator svelte-12z7bz1"></div>'),tj=J('<div class="jse-label svelte-12z7bz1"> </div>'),nj=J('<div class="jse-column svelte-12z7bz1"></div>'),rj=J('<div class="jse-separator svelte-12z7bz1"></div>'),ij=J('<div class="jse-row svelte-12z7bz1"></div>'),sj=J('<div class="jse-separator svelte-12z7bz1"></div>'),oj=J('<div class="jse-row svelte-12z7bz1"><div class="jse-tip svelte-12z7bz1"><div class="jse-tip-icon svelte-12z7bz1"><!></div> <div class="jse-tip-text"> </div></div></div>'),lj=J('<div role="menu" tabindex="-1" class="jse-contextmenu svelte-12z7bz1"><!> <!></div>');function DC(t,e){Ge(e,!1);let n=x(e,"items",9),r=x(e,"onRequestClose",9),i=x(e,"tip",9),s=R(void 0,!0);Cr(()=>{const p=Array.from(c(s).querySelectorAll("button")).find(g=>!g.disabled);p&&p.focus()});const o={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right"};function l(p){const g=uo(p),m=o[g];if(m&&p.target){p.preventDefault();const v=Array.from(c(s).querySelectorAll("button:not([disabled])")),y=G5({allElements:v,currentElement:p.target,direction:m,hasPrio:S=>S.getAttribute("data-type")!=="jse-open-dropdown"});y&&y.focus()}}function a(p){return console.error("Unknown type of context menu item",p),"???"}st(!0);var u=lj(),f=M(u);Sn(f,1,n,Ln,(p,g)=>{var m=bn(),v=$e(m);{var y=k=>{og(k,{get item(){return c(g)},get onRequestClose(){return r()}})},S=(k,C)=>{{var w=A=>{lg(A,{get item(){return c(g)},get onRequestClose(){return r()}})},E=(A,O)=>{{var H=G=>{var V=ij();Sn(V,5,()=>c(g).items,Ln,(U,Q)=>{var Y=bn(),ie=$e(Y);{var F=I=>{og(I,{get item(){return c(Q)},get onRequestClose(){return r()}})},X=(I,se)=>{{var ce=le=>{lg(le,{get item(){return c(Q)},get onRequestClose(){return r()}})},Te=(le,de)=>{{var ne=ge=>{var j=nj();Sn(j,5,()=>c(Q).items,Ln,(we,Pe)=>{var q=bn(),B=$e(q);{var Se=z=>{og(z,{className:"left",get item(){return c(Pe)},get onRequestClose(){return r()}})},ke=(z,L)=>{{var ze=je=>{lg(je,{className:"left",get item(){return c(Pe)},get onRequestClose(){return r()}})},We=(je,Qe)=>{{var be=Ye=>{var Ve=ej();D(Ye,Ve)},gt=(Ye,Ve)=>{{var _t=Ae=>{var Je=tj(),ht=M(Je);xe(()=>et(ht,c(Pe).text)),D(Ae,Je)},Nt=Ae=>{var Je=ur();xe(ht=>et(Je,ht),[()=>a(c(Pe))],he),D(Ae,Je)};te(Ye,Ae=>{QD(c(Pe))?Ae(_t):Ae(Nt,!1)},Ve)}};te(je,Ye=>{sh(c(Pe))?Ye(be):Ye(gt,!1)},Qe)}};te(z,je=>{Xp(c(Pe))?je(ze):je(We,!1)},L)}};te(B,z=>{Qc(c(Pe))?z(Se):z(ke,!1)})}D(we,q)}),D(ge,j)},ue=(ge,j)=>{{var we=q=>{var B=rj();D(q,B)},Pe=q=>{var B=ur();xe(Se=>et(B,Se),[()=>a(c(Q))],he),D(q,B)};te(ge,q=>{sh(c(Q))?q(we):q(Pe,!1)},j)}};te(le,ge=>{ZD(c(Q))?ge(ne):ge(ue,!1)},de)}};te(I,le=>{Xp(c(Q))?le(ce):le(Te,!1)},se)}};te(ie,I=>{Qc(c(Q))?I(F):I(X,!1)})}D(U,Y)}),D(G,V)},W=(G,V)=>{{var U=Y=>{var ie=sj();D(Y,ie)},Q=Y=>{var ie=ur();xe(F=>et(ie,F),[()=>a(c(g))],he),D(Y,ie)};te(G,Y=>{sh(c(g))?Y(U):Y(Q,!1)},V)}};te(A,G=>{YD(c(g))?G(H):G(W,!1)},O)}};te(k,A=>{Xp(c(g))?A(w):A(E,!1)},C)}};te(v,k=>{Qc(c(g))?k(y):k(S,!1)})}D(p,m)});var h=N(f,2);{var d=p=>{var g=oj(),m=M(g),v=M(m),y=M(v);Dt(y,{data:xD});var S=N(v,2),k=M(S);xe(()=>et(k,i())),D(p,g)};te(h,p=>{i()&&p(d)})}gn(u,p=>b(s,p),()=>c(s)),ae("keydown",u,l),D(t,u),Xe()}function aj({json:t,documentState:e,selection:n,readOnly:r,onEditKey:i,onEditValue:s,onToggleEnforceString:o,onCut:l,onCopy:a,onPaste:u,onRemove:f,onDuplicate:h,onExtract:d,onInsertBefore:p,onInsert:g,onConvert:m,onInsertAfter:v,onSort:y,onTransform:S}){const k=t!==void 0,C=!!n,w=n?Yt(He(n)):!1,E=n?De(t,He(n)):void 0,A=Array.isArray(E)?"Edit array":Kt(E)?"Edit object":"Edit value",O=k&&(dn(n)||nr(n)||Qt(n)),H=n&&!w?De(t,Lt(He(n))):void 0,W=!r&&k&&zh(n)&&!w&&!Array.isArray(H),G=!r&&k&&n!==void 0&&zh(n),V=G&&!Vn(E),U=!r&&O,Q=O,Y=!r&&C,ie=!r&&k&&O&&!w,F=!r&&k&&n!==void 0&&(dn(n)||Qt(n))&&!w,X=O,I=X?"Convert to:":"Insert:",se=!r&&(br(n)&&Array.isArray(E)||Ti(n)&&Array.isArray(H)),ce=!r&&(X?lh(n)&&!Kt(E):C),Te=!r&&(X?lh(n)&&!Array.isArray(E):C),le=!r&&(X?lh(n)&&Vn(E):C),de=n!==void 0?fo(t,e,He(n)):!1;function ne(ue){O?ue!=="structure"&&m(ue):g(ue)}return[{type:"row",items:[{type:"button",onClick:()=>i(),icon:Ma,text:"Edit key",title:"Edit the key (Double-click on the key)",disabled:!W},{type:"dropdown-button",main:{type:"button",onClick:()=>s(),icon:Ma,text:A,title:"Edit the value (Double-click on the value)",disabled:!G},width:"11em",items:[{type:"button",icon:Ma,text:A,title:"Edit the value (Double-click on the value)",onClick:()=>s(),disabled:!G},{type:"button",icon:de?$S:tC,text:"Enforce string",title:"Enforce keeping the value as string when it contains a numeric value",onClick:()=>o(),disabled:!V}]}]},{type:"separator"},{type:"row",items:[{type:"dropdown-button",main:{type:"button",onClick:()=>l(!0),icon:Ta,text:"Cut",title:"Cut selected contents, formatted with indentation (Ctrl+X)",disabled:!U},width:"10em",items:[{type:"button",icon:Ta,text:"Cut formatted",title:"Cut selected contents, formatted with indentation (Ctrl+X)",onClick:()=>l(!0),disabled:!U},{type:"button",icon:Ta,text:"Cut compacted",title:"Cut selected contents, without indentation (Ctrl+Shift+X)",onClick:()=>l(!1),disabled:!U}]},{type:"dropdown-button",main:{type:"button",onClick:()=>a(!0),icon:Fo,text:"Copy",title:"Copy selected contents, formatted with indentation (Ctrl+C)",disabled:!Q},width:"12em",items:[{type:"button",icon:Fo,text:"Copy formatted",title:"Copy selected contents, formatted with indentation (Ctrl+C)",onClick:()=>a(!0),disabled:!Q},{type:"button",icon:Fo,text:"Copy compacted",title:"Copy selected contents, without indentation (Ctrl+Shift+C)",onClick:()=>a(!1),disabled:!Q}]},{type:"button",onClick:()=>u(),icon:ZS,text:"Paste",title:"Paste clipboard contents (Ctrl+V)",disabled:!Y}]},{type:"separator"},{type:"row",items:[{type:"column",items:[{type:"button",onClick:()=>h(),icon:iC,text:"Duplicate",title:"Duplicate selected contents (Ctrl+D)",disabled:!ie},{type:"button",onClick:()=>d(),icon:f9,text:"Extract",title:"Extract selected contents",disabled:!F},{type:"button",onClick:()=>y(),icon:tp,text:"Sort",title:"Sort array or object contents",disabled:r||!O},{type:"button",onClick:()=>S(),icon:ep,text:"Transform",title:"Transform array or object contents (filter, sort, project)",disabled:r||!O},{type:"button",onClick:()=>f(),icon:gm,text:"Remove",title:"Remove selected contents (Delete)",disabled:r||!O}]},{type:"column",items:[{type:"label",text:I},{type:"button",onClick:()=>ne("structure"),icon:X?Sf:Sa,text:"Structure",title:I+" structure like the first item in the array",disabled:!se},{type:"button",onClick:()=>ne("object"),icon:X?Sf:Sa,text:"Object",title:I+" object",disabled:!ce},{type:"button",onClick:()=>ne("array"),icon:X?Sf:Sa,text:"Array",title:I+" array",disabled:!Te},{type:"button",onClick:()=>ne("value"),icon:X?Sf:Sa,text:"Value",title:I+" value",disabled:!le}]}]},{type:"separator"},{type:"row",items:[{type:"button",onClick:()=>p(),icon:s9,text:"Insert before",title:"Select area before current entry to insert or paste contents",disabled:r||!O||w},{type:"button",onClick:()=>v(),icon:Z6,text:"Insert after",title:"Select area after current entry to insert or paste contents",disabled:r||!O||w}]}]}var cj=J("<!> <!>",1),uj=J('<div class="jse-search-box-background svelte-vrx1dr"></div>'),fj=J('<div class="jse-search-box-container svelte-vrx1dr"><!></div> <div class="jse-contents svelte-vrx1dr"><!> <!></div> <!> <!> <!>',1),hj=J('<label class="jse-hidden-input-label svelte-vrx1dr"><input type="text" tabindex="-1" class="jse-hidden-input svelte-vrx1dr"></label> <!>',1),dj=J('<div class="jse-contents svelte-vrx1dr"><div class="jse-loading-space svelte-vrx1dr"></div> <div class="jse-loading svelte-vrx1dr">loading...</div></div>'),pj=J('<div role="tree" tabindex="-1"><!> <!> <!></div> <!> <!>',1);function bm(t,e){Ge(e,!1);const n=R(void 0,!0),r=rr("jsoneditor:TreeMode"),i=typeof window>"u";r("isSSR:",i);const s=Ua(),o=Ua(),{openAbsolutePopup:l,closeAbsolutePopup:a}=el("absolute-popup");let u=R(void 0,!0),f=R(void 0,!0),h=R(void 0,!0),d=!1;const p=vC();let g=x(e,"readOnly",9),m=x(e,"externalContent",9),v=x(e,"externalSelection",9),y=x(e,"history",9),S=x(e,"truncateTextSize",9),k=x(e,"mainMenuBar",9),C=x(e,"navigationBar",9),w=x(e,"escapeControlCharacters",9),E=x(e,"escapeUnicodeCharacters",9),A=x(e,"parser",9),O=x(e,"parseMemoizeOne",9),H=x(e,"validator",9),W=x(e,"validationParser",9),G=x(e,"pathParser",9),V=x(e,"indentation",9),U=x(e,"onError",9),Q=x(e,"onChange",9),Y=x(e,"onChangeMode",9),ie=x(e,"onSelect",9),F=x(e,"onUndo",9),X=x(e,"onRedo",9),I=x(e,"onRenderValue",9),se=x(e,"onRenderMenu",9),ce=x(e,"onRenderContextMenu",9),Te=x(e,"onClassName",9),le=x(e,"onFocus",9),de=x(e,"onBlur",9),ne=x(e,"onSortModal",9),ue=x(e,"onTransformModal",9),ge=x(e,"onJSONEditorModal",9),j=!1,we=R(!1,!0),Pe=R(void 0,!0);p0({onMount:Cr,onDestroy:Ii,getWindow:()=>Ku(c(h)),hasFocus:()=>j&&document.hasFocus()||Jv(c(h)),onFocus:()=>{d=!0,le()&&le()()},onBlur:()=>{d=!1,de()&&de()()}});let q=R(void 0,!0),B=R(void 0,!0),Se,ke=!1,z=R(cm({json:c(q)}),!0),L=R(gu(v())?v():void 0,!0);Cr(()=>{if(c(L)){const _=He(c(L));b(z,qi(c(q),c(z),_,oh)),setTimeout(()=>cn(_))}});function ze(_){b(L,_)}function We(_){Pt(_,v())||(r("onSelect",_),ie()(_))}let je=R(void 0,!0),Qe=R(void 0,!0),be,gt=R(void 0,!0),Ye=R(!1,!0),Ve=R(!1,!0);function _t(_){c(u)&&_&&c(u).scrollTop===0&&(gi(u,c(u).style.overflowAnchor="none"),gi(u,c(u).scrollTop+=Fc),setTimeout(()=>{c(u)&&gi(u,c(u).style.overflowAnchor="")}))}function Nt(_){be=_,b(gt,be?QS(c(q),be.items):void 0)}async function Ae(_,$){b(z,qi(c(q),c(z),_,oh));const Ce=Rt($);await Mt(_,{element:Ce})}function Je(){b(Ye,!1),b(Ve,!1),en()}function ht(_){r("select validation error",_),b(L,wt(_.path)),Mt(_.path)}function it(_,$=qy){r("expand"),b(z,qi(c(q),c(z),_,$))}function vt(_,$){b(z,RS(c(q),c(z),_,$)),c(L)&&m6(c(L),_)&&b(L,void 0)}let Ze=R(!1,!0),rt=R([],!0),Le=R(void 0,!0);const oe=ef(yC);function Et(_,$,Ce,Be){Ca(()=>{let Me;try{Me=oe(_,$,Ce,Be)}catch(Ue){Me=[{path:[],message:"Failed to validate: "+Ue.message,severity:Yi.warning}]}Pt(Me,c(rt))||(r("validationErrors changed:",Me),b(rt,Me),b(Le,VI(_,c(rt))))},Me=>r(`validationErrors updated in ${Me} ms`))}function bt(){return r("validate"),Se?{parseError:Se,isRepairable:!1}:(Et(c(q),H(),A(),W()),Yt(c(rt))?void 0:{validationErrors:c(rt)})}function Un(){return c(q)}function fr(){return c(z)}function ot(){return c(L)}function Ht(_){r("applyExternalContent",{updatedContent:_}),fu(_)?ln(_.json):uu(_)&&Gt(_.text)}function ln(_){if(_===void 0)return;const $=!Pt(c(q),_);if(r("update external json",{isChanged:$,currentlyText:c(q)===void 0}),!$)return;const Ce={documentState:c(z),selection:c(L),json:c(q),text:c(B),textIsRepaired:c(Ze)};b(q,_),b(z,pi(_,c(z))),yt(c(q)),b(B,void 0),b(Ze,!1),Se=void 0,Xt(c(q)),nn(Ce)}function Gt(_){if(_===void 0||fu(m()))return;const $=_!==c(B);if(r("update external text",{isChanged:$}),!$)return;const Ce={documentState:c(z),selection:c(L),json:c(q),text:c(B),textIsRepaired:c(Ze)};try{b(q,O()(_)),b(z,pi(c(q),c(z))),yt(c(q)),b(B,_),b(Ze,!1),Se=void 0}catch(Be){try{b(q,O()(Ds(_))),b(z,pi(c(q),c(z))),yt(c(q)),b(B,_),b(Ze,!0),Se=void 0,Xt(c(q))}catch{b(q,void 0),b(z,void 0),b(B,m().text),b(Ze,!1),Se=c(B)!==void 0&&c(B)!==""?Wa(c(B),Be.message||String(Be)):void 0}}Xt(c(q)),nn(Ce)}function lt(_){Pt(c(L),_)||(r("applyExternalSelection",{selection:c(L),externalSelection:_}),gu(_)&&b(L,_))}function yt(_){ke||(ke=!0,b(z,Bl(_,c(z),[])))}function Xt(_){c(L)&&(Ei(_,Fl(c(L)))&&Ei(_,He(c(L)))||(r("clearing selection: path does not exist anymore",c(L)),b(L,ua(_,c(z)))))}function nn(_){if(_.json===void 0&&_.text===void 0)return;const $=c(q)!==void 0&&_.json!==void 0;y().add({type:"tree",undo:{patch:$?[{op:"replace",path:"",value:_.json}]:void 0,json:_.json,text:_.text,documentState:_.documentState,textIsRepaired:_.textIsRepaired,selection:Os(_.selection),sortedColumn:void 0},redo:{patch:$?[{op:"replace",path:"",value:c(q)}]:void 0,json:c(q),text:c(B),documentState:c(z),textIsRepaired:c(Ze),selection:Os(c(L)),sortedColumn:void 0}})}function Ft(){r("createDefaultSelection"),b(L,wt([]))}function qt(_,$){if(r("patch",_,$),c(q)===void 0)throw new Error("Cannot apply patch: no JSON");const Ce=c(q),Be={json:void 0,text:c(B),documentState:c(z),selection:Os(c(L)),textIsRepaired:c(Ze),sortedColumn:void 0},Me=GS(c(q),_),Ue=DS(c(q),c(z),_),Jn=Ka(c(q),_)??c(L),kt=typeof $=="function"?$(Ue.json,Ue.documentState,Jn):void 0;return b(q,(kt==null?void 0:kt.json)!==void 0?kt.json:Ue.json),b(z,(kt==null?void 0:kt.state)!==void 0?kt.state:Ue.documentState),b(L,(kt==null?void 0:kt.selection)!==void 0?kt.selection:Jn),b(B,void 0),b(Ze,!1),b(Qe,void 0),Se=void 0,Xt(c(q)),y().add({type:"tree",undo:{patch:Me,...Be},redo:{patch:_,json:void 0,text:c(B),documentState:c(z),selection:Os(c(L)),sortedColumn:void 0,textIsRepaired:c(Ze)}}),{json:c(q),previousJson:Ce,undo:Me,redo:_}}function rn(){g()||!c(L)||b(L,s0(He(c(L))))}function Gn(){if(g()||!c(L))return;const _=He(c(L)),$=De(c(q),_);Vn($)?pt(_,$):b(L,Vh(_))}function mt(){if(g()||!Qt(c(L)))return;const _=He(c(L)),$=tt(_),Ce=De(c(q),_),Be=!fo(c(q),c(z),_),Me=Be?String(Ce):hc(String(Ce),A());r("handleToggleEnforceString",{enforceString:Be,value:Ce,updatedValue:Me}),jn([{op:"replace",path:$,value:Me}],(Ue,Jn)=>({state:Zd(c(q),Jn,_,{type:"value",enforceString:Be})}))}function dt(){return c(Ze)&&c(q)!==void 0&&zn(c(q)),c(q)!==void 0?{json:c(q)}:{text:c(B)||""}}async function Tt(_=!0){await _C({json:c(q),selection:c(L),indentation:_?V():void 0,readOnly:g(),parser:A(),onPatch:jn})}async function an(_=!0){c(q)!==void 0&&await EC({json:c(q),selection:c(L),indentation:_?V():void 0,parser:A()})}function $t(_){var Ce;_.preventDefault();const $=(Ce=_.clipboardData)==null?void 0:Ce.getData("text/plain");jt($)}async function sn(){try{const _=await navigator.clipboard.readText();jt(_)}catch(_){console.error(_),b(we,!0)}}function jt(_){_!==void 0&&TC({clipboardText:_,json:c(q),selection:c(L),readOnly:g(),parser:A(),onPatch:jn,onChangeText:xi,openRepairModal:on})}function on(_,$){b(Pe,{text:_,onParse:Ce=>Xd(Ce,Be=>Ju(Be,A())),onRepair:hS,onApply:$,onClose:en})}function En(){MC({json:c(q),text:c(B),selection:c(L),keepSelection:!1,readOnly:g(),onChange:Q(),onPatch:jn})}function Wn(){if(g()||c(q)===void 0||!c(L)||!gc||Yt(He(c(L))))return;r("duplicate",{selection:c(L)});const _=US(c(q),Uo(c(q),c(L)));jn(_)}function fn(){if(g()||!c(L)||!dn(c(L))&&!Qt(c(L))||Yt(He(c(L))))return;r("extract",{selection:c(L)});const _=WS(c(q),c(L));jn(_,($,Ce)=>{if(Vn($))return{state:Qp($,Ce,[])}})}function me(_){Gh({insertType:_,selectInside:!0,initialValue:void 0,json:c(q),selection:c(L),readOnly:g(),parser:A(),onPatch:jn,onReplaceJson:zn})}function xt(_){nr(c(L))&&b(L,wt(c(L).path)),c(L)||b(L,ua(c(q),c(z))),me(_)}function mn(_){if(!(g()||!c(L))){if(!lh(c(L))){U()(new Error(`Cannot convert current selection to ${_}`));return}try{const $=Fl(c(L)),Ce=De(c(q),$),Be=T5(Ce,_,A());if(Be===Ce)return;const Me=[{op:"replace",path:tt($),value:Be}];r("handleConvert",{selection:c(L),path:$,type:_,operations:Me}),jn(Me,(Ue,Jn)=>({state:c(L)?Bl(Ue,Jn,He(c(L))):c(z)}))}catch($){U()($)}}}function Ke(){if(!c(L))return;const _=Uy(c(q),c(z),c(L),!1),$=Lt(He(c(L)));_&&!Yt(He(_))&&Pt($,Lt(He(_)))?b(L,vo(He(_))):b(L,mo($)),r("insert before",{selection:c(L),selectionBefore:_,parentPath:$}),_n(),Vi()}function ir(){if(!c(L))return;const _=rl(c(q),c(L));r("insert after",_),b(L,vo(_)),_n(),Vi()}async function Fn(_){await RC({char:_,selectInside:!0,json:c(q),selection:c(L),readOnly:g(),parser:A(),onPatch:jn,onReplaceJson:zn,onSelect:ze})}function kr(){if(g()||!y().canUndo)return;const _=y().undo();if(!Fh(_)){F()(_);return}const $={json:c(q),text:c(B)};b(q,_.undo.patch?Xi(c(q),_.undo.patch):_.undo.json),b(z,_.undo.documentState),b(L,_.undo.selection),b(B,_.undo.text),b(Ze,_.undo.textIsRepaired),Se=void 0,r("undo",{item:_,json:c(q),documentState:c(z),selection:c(L)});const Ce=_.undo.patch&&_.redo.patch?{json:c(q),previousJson:$.json,redo:_.undo.patch,undo:_.redo.patch}:void 0;sr($,Ce),en(),c(L)&&Mt(He(c(L)),{scrollToWhenVisible:!1})}function si(){if(g()||!y().canRedo)return;const _=y().redo();if(!Fh(_)){X()(_);return}const $={json:c(q),text:c(B)};b(q,_.redo.patch?Xi(c(q),_.redo.patch):_.redo.json),b(z,_.redo.documentState),b(L,_.redo.selection),b(B,_.redo.text),b(Ze,_.redo.textIsRepaired),Se=void 0,r("redo",{item:_,json:c(q),documentState:c(z),selection:c(L)});const Ce=_.undo.patch&&_.redo.patch?{json:c(q),previousJson:$.json,redo:_.redo.patch,undo:_.undo.patch}:void 0;sr($,Ce),en(),c(L)&&Mt(He(c(L)),{scrollToWhenVisible:!1})}function oi(_){g()||c(q)===void 0||(j=!0,ne()({id:s,json:c(q),rootPath:_,onSort:async({operations:$})=>{r("onSort",_,$),jn($,(Ce,Be)=>({state:Qp(Ce,Be,_),selection:wt(_)}))},onClose:()=>{j=!1,setTimeout(en)}}))}function fs(){if(!c(L))return;const _=Wy(c(q),c(L));oi(_)}function hs(){oi([])}function hr(_){if(c(q)===void 0)return;const{id:$,onTransform:Ce,onClose:Be}=_,Me=_.rootPath||[];j=!0,ue()({id:$||o,json:c(q),rootPath:Me,onTransform:Ue=>{Ce?Ce({operations:Ue,json:c(q),transformedJson:Xi(c(q),Ue)}):(r("onTransform",Me,Ue),jn(Ue,(Jn,kt)=>({state:Qp(Jn,kt,Me),selection:wt(Me)})))},onClose:()=>{j=!1,setTimeout(en),Be&&Be()}})}function ee(){if(!c(L))return;const _=Wy(c(q),c(L));hr({rootPath:_})}function Oe(){hr({rootPath:[]})}function pt(_,$){r("openJSONEditorModal",{path:_,value:$}),j=!0,ge()({content:{json:$},path:_,onPatch:c(ut).onPatch,onClose:()=>{j=!1,setTimeout(en)}})}async function Mt(_,{scrollToWhenVisible:$=!0,element:Ce}={}){b(z,qi(c(q),c(z),_,oh));const Be=Ce??St(_);if(r("scrollTo",{path:_,elem:Be,refContents:c(u)}),!Be||!c(u))return Promise.resolve();const Me=c(u).getBoundingClientRect(),Ue=Be.getBoundingClientRect();if(!$&&Ue.bottom>Me.top&&Ue.top<Me.bottom)return Promise.resolve();const Jn=-(Me.height/4);return new Promise(kt=>{p(Be,{container:c(u),offset:Jn,duration:sm,callback:()=>kt()})})}function St(_){var $;return _n(),(($=c(u))==null?void 0:$.querySelector(`div[data-path="${im(_)}"]`))??void 0}function Rt(_){var $;return _n(),(($=c(u))==null?void 0:$.querySelector(`span[data-search-result-index="${_}"]`))??void 0}function cn(_){const $=St(_);if(!$||!c(u))return;const Ce=c(u).getBoundingClientRect(),Be=$.getBoundingClientRect(),Me=20,Ue=Vn(De(c(q),_))?Me:Be.height;Be.top<Ce.top+Me?p($,{container:c(u),offset:-20,duration:0}):Be.top+Ue>Ce.bottom-Me&&p($,{container:c(u),offset:-(Ce.height-Ue-Me),duration:0})}function sr(_,$){var Ce,Be;if(!(_.json===void 0&&(_==null?void 0:_.text)===void 0)){if(c(B)!==void 0){const Me={text:c(B),json:void 0};(Ce=Q())==null||Ce(Me,_,{contentErrors:bt(),patchResult:$})}else if(c(q)!==void 0){const Me={text:void 0,json:c(q)};(Be=Q())==null||Be(Me,_,{contentErrors:bt(),patchResult:$})}}}function jn(_,$){r("handlePatch",_,$);const Ce={json:c(q),text:c(B)},Be=qt(_,$);return sr(Ce,Be),Be}function zn(_,$){const Ce={json:c(q),text:c(B)},Be={documentState:c(z),selection:c(L),json:c(q),text:c(B),textIsRepaired:c(Ze)},Me=qi(c(q),pi(_,c(z)),[],zc),Ue=typeof $=="function"?$(_,Me,c(L)):void 0;b(q,(Ue==null?void 0:Ue.json)!==void 0?Ue.json:_),b(z,(Ue==null?void 0:Ue.state)!==void 0?Ue.state:Me),b(L,(Ue==null?void 0:Ue.selection)!==void 0?Ue.selection:c(L)),b(B,void 0),b(Ze,!1),Se=void 0,Xt(c(q)),nn(Be),sr(Ce,void 0)}function xi(_,$){r("handleChangeText");const Ce={json:c(q),text:c(B)},Be={documentState:c(z),selection:c(L),json:c(q),text:c(B),textIsRepaired:c(Ze)};try{b(q,O()(_)),b(z,qi(c(q),pi(c(q),c(z)),[],zc)),b(B,void 0),b(Ze,!1),Se=void 0}catch(Ue){try{b(q,O()(Ds(_))),b(z,qi(c(q),pi(c(q),c(z)),[],zc)),b(B,_),b(Ze,!0),Se=void 0}catch{b(q,void 0),b(z,cm({json:c(q),expand:zc})),b(B,_),b(Ze,!1),Se=c(B)!==""?Wa(c(B),Ue.message||String(Ue)):void 0}}if(typeof $=="function"){const Ue=$(c(q),c(z),c(L));b(q,(Ue==null?void 0:Ue.json)!==void 0?Ue.json:c(q)),b(z,(Ue==null?void 0:Ue.state)!==void 0?Ue.state:c(z)),b(L,(Ue==null?void 0:Ue.selection)!==void 0?Ue.selection:c(L))}Xt(c(q)),nn(Be),sr(Ce,void 0)}function Gr(_,$,Ce=!1){r("handleExpand",{path:_,expanded:$,recursive:Ce}),$?it(_,Ce?i0:qy):vt(_,Ce),en()}function ds(){Gr([],!0,!0)}function ps(){Gr([],!1,!0)}function wi(_){r("openFind",{findAndReplace:_}),b(Ye,!1),b(Ve,!1),_n(),b(Ye,!0),b(Ve,_)}function li(_,$){r("handleExpandSection",_,$),b(z,a6(c(q),c(z),_,$))}function zi(_){r("pasted json as text",_),b(Qe,_)}function Si(_){const $=uo(_),Ce=_.shiftKey;if(r("keydown",{combo:$,key:_.key}),$==="Ctrl+X"&&(_.preventDefault(),Tt(!0)),$==="Ctrl+Shift+X"&&(_.preventDefault(),Tt(!1)),$==="Ctrl+C"&&(_.preventDefault(),an(!0)),$==="Ctrl+Shift+C"&&(_.preventDefault(),an(!1)),$==="Ctrl+D"&&(_.preventDefault(),Wn()),($==="Delete"||$==="Backspace")&&(_.preventDefault(),En()),$==="Insert"&&(_.preventDefault(),me("structure")),$==="Ctrl+A"&&(_.preventDefault(),b(L,w6())),$==="Ctrl+Q"&&Vi(_),$==="ArrowUp"||$==="Shift+ArrowUp"){_.preventDefault();const Me=c(L)?Uy(c(q),c(z),c(L),Ce)||c(L):ua(c(q),c(z));b(L,Me),cn(He(Me))}if($==="ArrowDown"||$==="Shift+ArrowDown"){_.preventDefault();const Me=c(L)?v6(c(q),c(z),c(L),Ce)||c(L):ua(c(q),c(z));b(L,Me),cn(He(Me))}if($==="ArrowLeft"||$==="Shift+ArrowLeft"){_.preventDefault();const Me=c(L)?b6(c(q),c(z),c(L),Ce,!g())||c(L):ua(c(q),c(z));b(L,Me),cn(He(Me))}if($==="ArrowRight"||$==="Shift+ArrowRight"){_.preventDefault();const Me=c(L)&&c(q)!==void 0?x6(c(q),c(z),c(L),Ce,!g())||c(L):ua(c(q),c(z));b(L,Me),cn(He(Me))}if($==="Enter"&&c(L)){if($d(c(L))){const Me=c(L).focusPath,Ue=De(c(q),Lt(Me));Array.isArray(Ue)&&(_.preventDefault(),b(L,wt(Me)))}if(nr(c(L))&&(_.preventDefault(),b(L,{...c(L),edit:!0})),Qt(c(L))){_.preventDefault();const Me=De(c(q),c(L).path);Vn(Me)?Gr(c(L).path,!0):b(L,{...c(L),edit:!0})}}if($.replace(/^Shift\+/,"").length===1&&c(L)){_.preventDefault(),Fn(_.key);return}if($==="Enter"&&(Ti(c(L))||br(c(L)))){_.preventDefault(),Fn("");return}if($==="Ctrl+Enter"&&Qt(c(L))){const Me=De(c(q),c(L).path);zd(Me)&&window.open(String(Me),"_blank")}$==="Escape"&&c(L)&&(_.preventDefault(),b(L,void 0)),$==="Ctrl+F"&&(_.preventDefault(),wi(!1)),$==="Ctrl+H"&&(_.preventDefault(),wi(!0)),$==="Ctrl+Z"&&(_.preventDefault(),kr()),$==="Ctrl+Shift+Z"&&(_.preventDefault(),si())}function dr(_){r("handleMouseDown",_);const $=_.target;!bS($,"BUTTON")&&!$.isContentEditable&&(en(),!c(L)&&c(q)===void 0&&(c(B)===""||c(B)===void 0)&&Ft())}function gs({anchor:_,left:$,top:Ce,width:Be,height:Me,offsetTop:Ue,offsetLeft:Jn,showTip:kt}){const Nr=aj({json:c(q),documentState:c(z),selection:c(L),readOnly:g(),onEditKey:rn,onEditValue:Gn,onToggleEnforceString:mt,onCut:Tt,onCopy:an,onPaste:sn,onRemove:En,onDuplicate:Wn,onExtract:fn,onInsertBefore:Ke,onInsert:xt,onInsertAfter:ir,onConvert:mn,onSort:fs,onTransform:ee}),ci=ce()(Nr)??Nr;if(ci===!1)return;const al={tip:kt?"Tip: you can open this context menu via right-click or with Ctrl+Q":void 0,items:ci,onRequestClose:()=>a(jr)},vs={left:$,top:Ce,offsetTop:Ue,offsetLeft:Jn,width:Be,height:Me,anchor:_,closeOnOuterClick:!0,onClose:()=>{j=!1,en()}};j=!0;const jr=l(DC,al,vs)}function Vi(_){var $,Ce;if(!ei(c(L)))if(_&&(_.stopPropagation(),_.preventDefault()),_&&_.type==="contextmenu"&&_.target!==c(f))gs({left:_.clientX,top:_.clientY,width:Zs,height:Ys,showTip:!1});else{const Be=($=c(u))==null?void 0:$.querySelector(".jse-context-menu-pointer.jse-selected");if(Be)gs({anchor:Be,offsetTop:2,width:Zs,height:Ys,showTip:!1});else{const Me=(Ce=c(u))==null?void 0:Ce.getBoundingClientRect();Me&&gs({top:Me.top+2,left:Me.left+2,width:Zs,height:Ys,showTip:!1})}}}function ea(_){gs({anchor:xS(_.target,"BUTTON"),offsetTop:0,width:Zs,height:Ys,showTip:!0})}async function ll(){if(r("apply pasted json",c(Qe)),!c(Qe))return;const{onPasteAsJson:_}=c(Qe);b(Qe,void 0),_(),setTimeout(en)}function xc(){r("clear pasted json"),b(Qe,void 0),en()}function ta(){Y()($n.text)}function na(_){b(L,_),en(),Mt(He(_))}function en(){r("focus"),c(f)&&(c(f).focus(),c(f).select())}function ra(_){!pc(_.target,Ce=>Ce===c(h))&&ei(c(L))&&(r("click outside the editor, exit edit mode"),b(L,Os(c(L))),d&&c(f)&&(c(f).focus(),c(f).blur()),r("blur (outside editor)"),c(f)&&c(f).blur())}function ia(_){return y6(c(q),c(z),_)}function Z(_){c(n)&&c(n).onDrag(_)}function ve(){c(n)&&c(n).onDragEnd()}let ut=R(void 0,!0);K(()=>c(L),()=>{We(c(L))}),K(()=>(P(w()),P(E())),()=>{b(je,Uv({escapeControlCharacters:w(),escapeUnicodeCharacters:E()}))}),K(()=>c(Ye),()=>{_t(c(Ye))}),K(()=>P(m()),()=>{Ht(m())}),K(()=>P(v()),()=>{lt(v())}),K(()=>(c(q),P(H()),P(A()),P(W())),()=>{Et(c(q),H(),A(),W())}),K(()=>(c(u),ib),()=>{b(n,c(u)?ib(c(u)):void 0)}),K(()=>(P(g()),P(S()),P(A()),c(je),P(I()),P(Te())),()=>{b(ut,{mode:$n.tree,readOnly:g(),truncateTextSize:S(),parser:A(),normalization:c(je),getJson:Un,getDocumentState:fr,getSelection:ot,findElement:St,findNextInside:ia,focus:en,onPatch:jn,onInsert:me,onExpand:Gr,onSelect:ze,onFind:wi,onExpandSection:li,onPasteJson:zi,onRenderValue:I(),onContextMenu:gs,onClassName:Te()||(()=>{}),onDrag:Z,onDragEnd:ve})}),K(()=>c(ut),()=>{r("context changed",c(ut))}),Vt(),st(!0);var un=pj();ae("mousedown",to,ra);var Tn=$e(un);let Cn;var ai=M(Tn);{var ms=_=>{ZL(_,{get json(){return c(q)},get selection(){return c(L)},get readOnly(){return g()},get history(){return y()},onExpandAll:ds,onCollapseAll:ps,onUndo:kr,onRedo:si,onSort:hs,onTransform:Oe,onContextMenu:ea,onCopy:an,get onRenderMenu(){return se()},get showSearch(){return c(Ye)},set showSearch($){b(Ye,$)},$$legacy:!0})};te(ai,_=>{k()&&_(ms)})}var T=N(ai,2);{var fe=_=>{CN(_,{get json(){return c(q)},get selection(){return c(L)},onSelect:na,get onError(){return U()},get pathParser(){return G()}})};te(T,_=>{C()&&_(fe)})}var ye=N(T,2);{var Ee=_=>{var $=hj(),Ce=$e($),Be=M(Ce);Be.readOnly=!0,gn(Be,kt=>b(f,kt),()=>c(f));var Me=N(Ce,2);{var Ue=kt=>{var Nr=bn(),ci=$e(Nr);{var al=jr=>{iN(jr,{get readOnly(){return g()},onCreateObject:()=>{en(),Fn("{")},onCreateArray:()=>{en(),Fn("[")},onClick:()=>{en()}})},vs=jr=>{var cl=cj(),ul=$e(cl);const fl=he(()=>g()?[]:[{icon:qh,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:ta}]);es(ul,{type:"error",message:"The loaded JSON document is invalid and could not be repaired automatically.",get actions(){return c(fl)}});var sa=N(ul,2);PC(sa,{get text(){return c(B)},get json(){return c(q)},get indentation(){return V()},get parser(){return A()}}),D(jr,cl)};te(ci,jr=>{c(B)===""||c(B)===void 0?jr(al):jr(vs,!1)})}D(kt,Nr)},Jn=kt=>{var Nr=fj(),ci=$e(Nr),al=M(ci);kC(al,{get json(){return c(q)},get documentState(){return c(z)},get parser(){return A()},get showSearch(){return c(Ye)},get showReplace(){return c(Ve)},get readOnly(){return g()},columns:void 0,onSearch:Nt,onFocus:Ae,onPatch:jn,onClose:Je});var vs=N(ci,2);Jt(vs,"data-jsoneditor-scrollable-contents",!0);var jr=M(vs);{var cl=Ar=>{var hl=uj();D(Ar,hl)};te(jr,Ar=>{c(Ye)&&Ar(cl)})}var ul=N(jr,2);ym(ul,{get value(){return c(q)},pointer:"",get state(){return c(z)},get validationErrors(){return c(Le)},get searchResults(){return c(gt)},get selection(){return c(L)},get context(){return c(ut)},onDragSelectionStart:Kn}),gn(vs,Ar=>b(u,Ar),()=>c(u));var fl=N(vs,2);{var sa=Ar=>{const hl=he(()=>`You pasted a JSON ${Array.isArray(c(Qe).contents)?"array":"object"} as text`);es(Ar,{type:"info",get message(){return c(hl)},actions:[{icon:Ga,text:"Paste as JSON instead",title:"Replace the value with the pasted JSON",onMouseDown:ll},{text:"Leave as is",title:"Keep the JSON embedded in the value",onClick:xc}]})};te(fl,Ar=>{c(Qe)&&Ar(sa)})}var cf=N(fl,2);{var uf=Ar=>{const hl=he(()=>g()?[]:[{icon:c0,text:"Ok",title:"Accept the repaired document",onClick:dt},{icon:qh,text:"Repair manually instead",title:"Leave the document unchanged and repair it manually instead",onClick:ta}]);es(Ar,{type:"success",message:"The loaded JSON document was invalid but is successfully repaired.",get actions(){return c(hl)},onClose:en})};te(cf,Ar=>{c(Ze)&&Ar(uf)})}var ff=N(cf,2);g0(ff,{get validationErrors(){return c(rt)},selectError:ht}),D(kt,Nr)};te(Me,kt=>{c(q)===void 0?kt(Ue):kt(Jn,!1)})}ae("paste",Be,$t),D(_,$)},nt=_=>{var $=dj();D(_,$)};te(ye,_=>{i?_(nt,!1):_(Ee)})}gn(Tn,_=>b(h,_),()=>c(h));var qe=N(Tn,2);{var kn=_=>{bC(_,{onClose:()=>b(we,!1)})};te(qe,_=>{c(we)&&_(kn)})}var Ct=N(qe,2);{var An=_=>{xC(_,jo(()=>c(Pe),{onClose:()=>{var $;($=c(Pe))==null||$.onClose(),b(Pe,void 0)}}))};te(Ct,_=>{c(Pe)&&_(An)})}return xe(_=>Cn=ct(Tn,1,"jse-tree-mode svelte-vrx1dr",null,Cn,_),[()=>({"no-main-menu":!k()})],he),ae("keydown",Tn,Si),ae("mousedown",Tn,dr),ae("contextmenu",Tn,Vi),D(t,un),at(e,"expand",it),at(e,"collapse",vt),at(e,"validate",bt),at(e,"getJson",Un),at(e,"patch",qt),at(e,"acceptAutoRepair",dt),at(e,"openTransformModal",hr),at(e,"scrollTo",Mt),at(e,"findElement",St),at(e,"findSearchResult",Rt),at(e,"focus",en),Xe({expand:it,collapse:vt,validate:bt,getJson:Un,patch:qt,acceptAutoRepair:dt,openTransformModal:hr,scrollTo:Mt,findElement:St,findSearchResult:Rt,focus:en})}function IC(t){return gj(t)?new Proxy(t,{get(e,n,r){const i=Reflect.get(e,n,r);return IC(i)},set(){return!1},deleteProperty(){return!1}}):t}function gj(t){return typeof t=="object"&&t!==null}const mj=1e3,Af=rr("jsoneditor:History");function LC(t={}){const e=t.maxItems||mj;let n=[],r=0;function i(){return r<n.length}function s(){return r>0}function o(){return{canUndo:i(),canRedo:s(),items:()=>n.slice().reverse(),add:a,undo:f,redo:h,clear:u}}function l(){t.onChange&&t.onChange(o())}function a(d){Af("add",d),n=[d].concat(n.slice(r)).slice(0,e),r=0,l()}function u(){Af("clear"),n=[],r=0,l()}function f(){if(i()){const d=n[r];return r+=1,Af("undo",d),l(),d}}function h(){if(s())return r-=1,Af("redo",n[r]),l(),n[r]}return{get:o}}var Rc=Rd(()=>O9),fa=Rd(()=>_9),vj=J('<div class="query-error svelte-rrrjnb"> </div>'),yj=J("<!> <!>",1),bj=J('<div class="jse-preview jse-error svelte-rrrjnb"> </div>'),xj=J('<!> <div class="jse-modal-contents svelte-rrrjnb"><div class="jse-main-contents svelte-rrrjnb"><div class="jse-query-contents svelte-rrrjnb"><div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb">Language</div></div> <div class="jse-description svelte-rrrjnb"><!></div> <div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb">Path</div></div> <input class="jse-path svelte-rrrjnb" type="text" readonly="" title="Selected path"> <div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb"><button type="button" class="svelte-rrrjnb"><!> Wizard</button></div></div> <!> <div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb">Query</div></div> <textarea class="jse-query svelte-rrrjnb" spellcheck="false"></textarea></div> <div><div><div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb"><button type="button" class="svelte-rrrjnb"><!> Original</button></div></div> <!></div> <div class="jse-preview-data svelte-rrrjnb"><div class="jse-label svelte-rrrjnb"><div class="jse-label-inner svelte-rrrjnb">Preview</div></div> <!></div></div></div> <div class="jse-actions svelte-rrrjnb"><button type="button" class="jse-primary svelte-rrrjnb">Transform</button></div></div>',1),wj=J('<div class="jse-transform-modal-inner svelte-rrrjnb"><!></div>');function Sj(t,e){Ge(e,!1);const n=rr("jsoneditor:TransformModal");let r=x(e,"id",25,()=>"transform-modal-"+xa()),i=x(e,"json",9),s=x(e,"rootPath",25,()=>[]),o=x(e,"indentation",9),l=x(e,"truncateTextSize",9),a=x(e,"escapeControlCharacters",9),u=x(e,"escapeUnicodeCharacters",9),f=x(e,"parser",9),h=x(e,"parseMemoizeOne",9),d=x(e,"validationParser",9),p=x(e,"pathParser",9),g=x(e,"queryLanguages",9),m=x(e,"queryLanguageId",13),v=x(e,"onChangeQueryLanguage",9),y=x(e,"onRenderValue",9),S=x(e,"onRenderMenu",9),k=x(e,"onRenderContextMenu",9),C=x(e,"onClassName",9),w=x(e,"onTransform",9),E=x(e,"onClose",9),A=R(void 0,!0);const O=LC({onChange:ke=>b(H,ke)});let H=R(O.get(),!0),W=R(void 0,!0),G=R(void 0,!0),V=R(!1,!0);const U=`${r()}:${tt(s())}`,Q=Rc()[U]??{};let Y=R(fa().showWizard!==!1,!0),ie=R(fa().showOriginal!==!1,!0),F=R(Q.queryOptions??{},!0),X=R(m()===Q.queryLanguageId&&Q.query?Q.query:"",!0),I=R(Q.isManual??!1,!0),se=R(void 0,!0),ce=R(void 0,!0),Te=R({text:""},!0);c(I)||de(c(F)),Cr(()=>{var ke;(ke=c(A))==null||ke.focus()});function le(ke){return g().find(z=>z.id===ke)??g()[0]}function de(ke){try{b(F,ke),b(X,le(m()).createQuery(c(W),ke)),b(se,void 0),b(I,!1),n("updateQueryByWizard",{queryOptions:c(F),query:c(X),isManual:c(I)})}catch(z){b(se,String(z))}}function ne(ke){b(X,ke.target.value),b(I,!0),n("handleChangeQuery",{query:c(X),isManual:c(I)})}function ue(ke,z){if(ke===void 0){b(Te,{text:""}),b(ce,"Error: No JSON");return}if(z.trim()===""){b(Te,{json:ke});return}try{n("previewTransform",{query:z});const L=le(m()).executeQuery(ke,z,f());b(Te,{json:L}),b(ce,void 0)}catch(L){b(Te,{text:""}),b(ce,String(L))}}const ge=jh(ue,om);function j(){if(c(W)===void 0){b(Te,{text:""}),b(ce,"Error: No JSON");return}try{n("handleTransform",{query:c(X)});const ke=le(m()).executeQuery(c(W),c(X),f());w()([{op:"replace",path:tt(s()),value:ke}]),E()()}catch(ke){console.error(ke),b(Te,{text:""}),b(ce,String(ke))}}function we(){b(Y,!c(Y)),fa(fa().showWizard=c(Y))}function Pe(){b(ie,!c(ie)),fa(fa().showOriginal=c(ie))}function q(ke){ke.focus()}function B(ke){n("handleChangeQueryLanguage",ke),m(ke),v()(ke),de(c(F))}function Se(){c(V)?b(V,!c(V)):E()()}K(()=>(P(i()),P(s())),()=>{b(W,IC(De(i(),s())))}),K(()=>c(W),()=>{b(G,c(W)?{json:c(W)}:{text:""})}),K(()=>(c(W),c(X)),()=>{ge(c(W),c(X))}),K(()=>(Rc(),c(F),c(X),P(m()),c(I)),()=>{Rc(Rc()[U]={queryOptions:c(F),query:c(X),queryLanguageId:m(),isManual:c(I)}),n("store state in memory",U,Rc()[U])}),Vt(),st(!0),$u(t,{get onClose(){return E()},className:"jse-transform-modal",get fullscreen(){return c(V)},children:(ke,z)=>{var L=wj(),ze=M(L);Xv(ze,{children:(We,je)=>{var Qe=xj(),be=$e(Qe);BI(be,{get queryLanguages(){return g()},get queryLanguageId(){return m()},onChangeQueryLanguage:B,get onClose(){return E()},get fullscreen(){return c(V)},set fullscreen(dt){b(V,dt)},$$legacy:!0});var gt=N(be,2),Ye=M(gt),Ve=M(Ye),_t=N(M(Ve),2),Nt=M(_t);F2(Nt,()=>le(m()).description);var Ae=N(_t,4),Je=N(Ae,2),ht=M(Je),it=M(ht),vt=M(it);const Ze=he(()=>c(Y)?Wo:vu);Dt(vt,{get data(){return c(Ze)}});var rt=N(Je,2);{var Le=dt=>{var Tt=bn(),an=$e(Tt);{var $t=jt=>{var on=yj(),En=$e(on);RI(En,{get queryOptions(){return c(F)},get json(){return c(W)},onChange:de});var Wn=N(En,2);{var fn=me=>{var xt=vj(),mn=M(xt);xe(()=>et(mn,c(se))),D(me,xt)};te(Wn,me=>{c(se)&&me(fn)})}D(jt,on)},sn=jt=>{var on=ur("(Only available for arrays, not for objects)");D(jt,on)};te(an,jt=>{Array.isArray(c(W))?jt($t):jt(sn,!1)})}D(dt,Tt)};te(rt,dt=>{c(Y)&&dt(Le)})}var oe=N(rt,4);gn(oe,dt=>b(A,dt),()=>c(A));var Et=N(Ve,2);let bt;var Un=M(Et);let fr;var ot=M(Un),Ht=M(ot),ln=M(Ht),Gt=M(ln);const lt=he(()=>c(ie)?Wo:vu);Dt(Gt,{get data(){return c(lt)}});var yt=N(ot,2);{var Xt=dt=>{bm(dt,{get externalContent(){return c(G)},externalSelection:void 0,get history(){return c(H)},readOnly:!0,get truncateTextSize(){return l()},mainMenuBar:!1,navigationBar:!1,get indentation(){return o()},get escapeControlCharacters(){return a()},get escapeUnicodeCharacters(){return u()},get parser(){return f()},get parseMemoizeOne(){return h()},get onRenderValue(){return y()},get onRenderMenu(){return S()},get onRenderContextMenu(){return k()},onError:console.error,onChange:Kn,onChangeMode:Kn,onSelect:Kn,onUndo:Kn,onRedo:Kn,onFocus:Kn,onBlur:Kn,onSortModal:Kn,onTransformModal:Kn,onJSONEditorModal:Kn,get onClassName(){return C()},validator:void 0,get validationParser(){return d()},get pathParser(){return p()}})};te(yt,dt=>{c(ie)&&dt(Xt)})}var nn=N(Un,2),Ft=N(M(nn),2);{var qt=dt=>{bm(dt,{get externalContent(){return c(Te)},externalSelection:void 0,get history(){return c(H)},readOnly:!0,get truncateTextSize(){return l()},mainMenuBar:!1,navigationBar:!1,get indentation(){return o()},get escapeControlCharacters(){return a()},get escapeUnicodeCharacters(){return u()},get parser(){return f()},get parseMemoizeOne(){return h()},get onRenderValue(){return y()},get onRenderMenu(){return S()},get onRenderContextMenu(){return k()},onError:console.error,onChange:Kn,onChangeMode:Kn,onSelect:Kn,onUndo:Kn,onRedo:Kn,onFocus:Kn,onBlur:Kn,onSortModal:Kn,onTransformModal:Kn,onJSONEditorModal:Kn,get onClassName(){return C()},validator:void 0,get validationParser(){return d()},get pathParser(){return p()}})},rn=dt=>{var Tt=bj(),an=M(Tt);xe(()=>et(an,c(ce))),D(dt,Tt)};te(Ft,dt=>{c(ce)?dt(rn,!1):dt(qt)})}var Gn=N(Ye,2),mt=M(Gn);cr(()=>ae("click",mt,j)),Tr(mt,dt=>q==null?void 0:q(dt)),xe((dt,Tt,an)=>{Dl(Ae,dt),Dl(oe,c(X)),bt=ct(Et,1,"jse-data-contents svelte-rrrjnb",null,bt,Tt),fr=ct(Un,1,"jse-original-data svelte-rrrjnb",null,fr,an),mt.disabled=!!c(ce)},[()=>Yt(s())?"(document root)":ts(s()),()=>({"jse-hide-original-data":!c(ie)}),()=>({"jse-hide":!c(ie)})],he),ae("click",it,we),ae("input",oe,ne),ae("click",ln,Pe),D(We,Qe)},$$slots:{default:!0}}),Tr(L,(We,je)=>Pa==null?void 0:Pa(We,je),()=>Se),D(ke,L)},$$slots:{default:!0}}),Xe()}function ki(){}function Cj(t,e){Ge(e,!1);const n=R(void 0,!0);let r=x(e,"readOnly",9,!1),i=x(e,"onFormat",9),s=x(e,"onCompact",9),o=x(e,"onSort",9),l=x(e,"onTransform",9),a=x(e,"onToggleSearch",9),u=x(e,"onUndo",9),f=x(e,"onRedo",9),h=x(e,"canUndo",9),d=x(e,"canRedo",9),p=x(e,"canFormat",9),g=x(e,"canCompact",9),m=x(e,"canSort",9),v=x(e,"canTransform",9),y=x(e,"onRenderMenu",9);const S={type:"button",icon:np,title:"Search (Ctrl+F)",className:"jse-search",onClick:a()};let k=R(void 0,!0);K(()=>(P(r()),P(i()),P(p()),P(s()),P(g()),P(o()),P(m()),P(l()),P(v()),P(u()),P(h()),P(f()),P(d())),()=>{b(k,r()?[S,{type:"space"}]:[{type:"button",icon:SC,title:"Format JSON: add proper indentation and new lines (Ctrl+I)",className:"jse-format",onClick:i(),disabled:r()||!p()},{type:"button",icon:YL,title:"Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)",className:"jse-compact",onClick:s(),disabled:r()||!g()},{type:"separator"},{type:"button",icon:tp,title:"Sort",className:"jse-sort",onClick:o(),disabled:r()||!m()},{type:"button",icon:ep,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:l(),disabled:r()||!v()},S,{type:"separator"},{type:"button",icon:a0,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:u(),disabled:!h()},{type:"button",icon:l0,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:f(),disabled:!d()},{type:"space"}])}),K(()=>(P(y()),c(k)),()=>{b(n,y()(c(k))||c(k))}),Vt(),st(!0),up(t,{get items(){return c(n)}}),Xe()}let xm=[],NC=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?NC:xm).push(n=n+t[e])})();function kj(t){if(t<768)return!1;for(let e=0,n=xm.length;;){let r=e+n>>1;if(t<xm[r])n=r;else if(t>=NC[r])e=r+1;else return!0;if(e==n)return!1}}function ub(t){return t>=127462&&t<=127487}const fb=8205;function Aj(t,e,n=!0,r=!0){return(n?jC:Oj)(t,e,r)}function jC(t,e,n){if(e==t.length)return e;e&&BC(t.charCodeAt(e))&&FC(t.charCodeAt(e-1))&&e--;let r=ag(t,e);for(e+=hb(r);e<t.length;){let i=ag(t,e);if(r==fb||i==fb||n&&kj(i))e+=hb(i),r=i;else if(ub(i)){let s=0,o=e-2;for(;o>=0&&ub(ag(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Oj(t,e,n){for(;e>0;){let r=jC(t,e-2,n);if(r<e)return r;e--}return 0}function ag(t,e){let n=t.charCodeAt(e);if(!FC(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return BC(r)?(n-55296<<10)+(r-56320)+65536:n}function BC(t){return t>=56320&&t<57344}function FC(t){return t>=55296&&t<56320}function hb(t){return t<65536?1:2}let tn=class zC{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Qa(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),_s.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Qa(this,e,n);let r=[];return this.decompose(e,n,r,0),_s.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Yc(this),s=new Yc(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new Yc(this,e)}iterRange(e,n=this.length){return new VC(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new HC(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]?zC.empty:e.length<=32?new Qn(e):_s.from(Qn.split(e,[]))}};class Qn extends tn{constructor(e,n=_j(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new Ej(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new Qn(db(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=ch(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new Qn(l,o.length+s.length));else{let a=l.length>>1;r.push(new Qn(l.slice(0,a)),new Qn(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof Qn))return super.replace(e,n,r);[e,n]=Qa(this,e,n);let i=ch(this.text,ch(r.text,db(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new Qn(i,s):_s.from(Qn.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
|
71
|
-
`){[e,n]=Qa(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(i+=r),e<a&&n>s&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new Qn(r,i)),r=[],i=-1);return i>-1&&n.push(new Qn(r,i)),n}}class _s extends tn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&n>=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Qa(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.length;if(e>=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines<u>>4&&a.lines>u>>6){let f=this.children.slice();return f[i]=a,new _s(f,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
72
|
-
`){[e,n]=Qa(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(i+=r),e<a&&n>o&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof _s))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new Qn(p,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,f=[];function h(p){let g;if(p.lines>s&&p instanceof _s)for(let m of p.children)h(m);else p.lines>o&&(a>o||!a)?(d(),l.push(p)):p instanceof Qn&&a&&(g=f[f.length-1])instanceof Qn&&p.lines+g.lines<=32?(a+=p.lines,u+=p.length+1,f[f.length-1]=new Qn(g.text.concat(p.text),g.length+1+p.length)):(a+p.lines>i&&d(),a+=p.lines,u+=p.length+1,f.push(p))}function d(){a!=0&&(l.push(f.length==1?f[0]:_s.from(f,u)),u=-1,a=f.length=0)}for(let p of e)h(p);return d(),l.length==1?l[0]:new _s(l,n)}}tn.empty=new Qn([""],0);function _j(t){let e=-1;for(let n of t)e+=n.length+1;return e}function ch(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let l=t[s],a=i+l.length;a>=n&&(a>r&&(l=l.slice(0,r-i)),i<n&&(l=l.slice(n-i)),o?(e[e.length-1]+=l,o=!1):e.push(l)),i=a+1}return e}function db(t,e,n){return ch(t,[""],e,n)}class Yc{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Qn?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof Qn?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
73
|
-
`,this;e--}else if(i instanceof Qn){let a=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof Qn?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class VC{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Yc(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class HC{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(tn.prototype[Symbol.iterator]=function(){return this.iter()},Yc.prototype[Symbol.iterator]=VC.prototype[Symbol.iterator]=HC.prototype[Symbol.iterator]=function(){return this});class Ej{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Qa(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Sr(t,e,n=!0,r=!0){return Aj(t,e,n,r)}function Tj(t){return t>=56320&&t<57344}function Mj(t){return t>=55296&&t<56320}function Qr(t,e){let n=t.charCodeAt(e);if(!Mj(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Tj(r)?(n-55296<<10)+(r-56320)+65536:n}function y0(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Es(t){return t<65536?1:2}const wm=/\r\n?|\n/;var Hr=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Hr||(Hr={}));class oo{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){Sm(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new oo(e)}composeDesc(e){return this.empty?e:e.empty?this:qC(this,e)}mapDesc(e,n=!1){return e.empty?this:Cm(this,e,n)}mapPos(e,n=-1,r=Hr.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],u=i+l;if(a<0){if(u>e)return s+(e-i);s+=l}else{if(r!=Hr.Simple&&u>=e&&(r==Hr.TrackDel&&i<e&&u>e||r==Hr.TrackBefore&&i<e||r==Hr.TrackAfter&&u>e))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],l=i+s;if(o>=0&&i<=n&&l>=e)return i<e&&l>n?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new oo(e)}static create(e){return new oo(e)}}class er extends oo{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Sm(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return Cm(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],l=n[i+1];if(l>=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length<a;)r.push(tn.empty);r.push(o?e.slice(s,s+o):tn.empty)}s+=o}return new er(n,r)}compose(e){return this.empty?e:e.empty?this:qC(this,e,!0)}map(e,n=!1){return e.empty?this:Cm(this,e,n,!0)}iterChanges(e,n=!1){Sm(this,e,n)}get desc(){return oo.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new xu(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,a-l);Or(i,f,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Or(n,f,h),h>0&&Do(r,n,s.text),s.forward(f),l+=f}let u=e[o++];for(;l<u;){if(s.done)break e;let f=Math.min(s.len,u-l);Or(n,f,-1),Or(i,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),l+=f}}return{changes:new er(n,r),filtered:oo.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!i.length)return;o<n&&Or(i,n-o,-1);let h=new er(i,s);l=l?l.compose(h.map(l)):h,i=[],s=[],o=0}function u(f){if(Array.isArray(f))for(let h of f)u(h);else if(f instanceof er){if(f.length!=n)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${n})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:h,to:d=h,insert:p}=f;if(h>d||h<0||d>n)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${n})`);let g=p?typeof p=="string"?tn.of(p.split(r||wm)):p:tn.empty,m=g.length;if(h==d&&m==0)return;h<o&&a(),h>o&&Or(i,h-o,-1),Or(i,d-h,m),Do(s,i,g),o=d}}return u(e),a(!l),l}static empty(e){return new er(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(tn.empty);r[i]=tn.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new er(n,r)}static createSet(e,n){return new er(e,n)}}function Or(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Do(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(tn.empty);t.push(n)}}function Sm(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let l=t.sections[o++],a=t.sections[o++];if(a<0)i+=l,s+=l;else{let u=i,f=s,h=tn.empty;for(;u+=l,f+=a,a&&r&&(h=h.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,f,h),i=u,s=f}}}function Cm(t,e,n,r=!1){let i=[],s=r?[]:null,o=new xu(t),l=new xu(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);Or(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!n))){let u=l.len;for(Or(i,l.ins,-1);u;){let f=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=f&&(Or(i,0,o.ins),s&&Do(s,i,o.text),a=o.i),o.forward(f),u-=f}l.next()}else if(o.ins>=0){let u=0,f=o.len;for(;f;)if(l.ins==-1){let h=Math.min(f,l.len);u+=h,f-=h,l.forward(h)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;Or(i,u,a<o.i?o.ins:0),s&&a<o.i&&Do(s,i,o.text),a=o.i,o.forward(o.len-f)}else{if(o.done&&l.done)return s?er.createSet(i,s):oo.create(i);throw new Error("Mismatched change set lengths")}}}function qC(t,e,n=!1){let r=[],i=n?[]:null,s=new xu(t),o=new xu(e);for(let l=!1;;){if(s.done&&o.done)return i?er.createSet(r,i):oo.create(r);if(s.ins==0)Or(r,s.len,0,l),s.next();else if(o.len==0&&!o.done)Or(r,0,o.ins,l),i&&Do(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),u=r.length;if(s.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;Or(r,a,f,l),i&&f&&Do(i,r,o.text)}else o.ins==-1?(Or(r,s.off?0:s.len,a,l),i&&Do(i,r,s.textBit(a))):(Or(r,s.off?0:s.len,o.off?0:o.ins,l),i&&!o.off&&Do(i,r,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class xu{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,n=this.i-2>>1;return n>=e.length?tn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?tn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Sl{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Sl(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return pe.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return pe.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return pe.range(e.anchor,e.head)}static create(e,n,r){return new Sl(e,n,r)}}class pe{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:pe.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new pe([this.main],0)}addRange(e,n=!0){return pe.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,pe.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 pe(e.ranges.map(n=>Sl.fromJSON(n)),e.main)}static single(e,n=e){return new pe([pe.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return pe.normalized(e.slice(),n);r=s.to}return new pe(e,n)}static cursor(e,n=0,r,i){return Sl.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?Sl.create(n,e,48|s):Sl.create(e,n,(n>e?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?pe.range(a,l):pe.range(l,a))}}return new pe(e,n)}}function UC(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let b0=0;class Ne{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=b0++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Ne(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:x0),!!e.static,e.enables)}of(e){return new uh([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new uh(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new uh(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function x0(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class uh{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=b0++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,f=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?u=!0:(((n=e[h.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,d){if(a&&d.docChanged||u&&(d.docChanged||d.selection)||km(h,f)){let p=r(h);if(l?!pb(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,g=d.config.address[s];if(g!=null){let m=Qh(d,g);if(this.dependencies.every(v=>v instanceof Ne?d.facet(v)===h.facet(v):v instanceof vr?d.field(v,!1)==h.field(v,!1):!0)||(l?pb(p=r(h),m,i):i(p=r(h),m)))return h.values[o]=m,0}else p=r(h);return h.values[o]=p,1}}}}function pb(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function km(t,e){let n=!1;for(let r of e)Zc(t,r)&1&&(n=!0);return n}function Rj(t,e,n){let r=n.map(a=>t[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let f=0;f<r.length;f++){let h=Qh(a,r[f]);if(i[f]==2)for(let d of h)u.push(d);else u.push(h)}return e.combine(u)}return{create(a){for(let u of r)Zc(a,u);return a.values[o]=l(a),1},update(a,u){if(!km(a,s))return 0;let f=l(a);return e.compare(f,a.values[o])?0:(a.values[o]=f,1)},reconfigure(a,u){let f=km(a,r),h=u.config.facets[e.id],d=u.facet(e);if(h&&!f&&x0(n,h))return a.values[o]=d,0;let p=l(a);return e.compare(p,d)?(a.values[o]=d,0):(a.values[o]=p,1)}}}const Of=Ne.define({static:!0});class vr{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new vr(b0++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Of).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(Of),o=i.facet(Of),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Of.of({field:this,create:e})]}get extension(){return this}}const bl={lowest:4,low:3,default:2,high:1,highest:0};function Pc(t){return e=>new WC(e,t)}const Zl={highest:Pc(bl.highest),high:Pc(bl.high),default:Pc(bl.default),low:Pc(bl.low),lowest:Pc(bl.lowest)};class WC{constructor(e,n){this.inner=e,this.prec=n}}class Xs{of(e){return new Am(this,e)}reconfigure(e){return Xs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Am{constructor(e,n){this.compartment=e,this.inner=n}}class Xh{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let d of Pj(e,n,o))d instanceof vr?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],u=[];for(let d of i)l[d.id]=u.length<<1,u.push(p=>d.slot(p));let f=r==null?void 0:r.config.facets;for(let d in s){let p=s[d],g=p[0].facet,m=f&&f[d]||[];if(p.every(v=>v.type==0))if(l[g.id]=a.length<<1|1,x0(m,p))a.push(r.facet(g));else{let v=g.combine(p.map(y=>y.value));a.push(r&&g.compare(v,r.facet(g))?r.facet(g):v)}else{for(let v of p)v.type==0?(l[v.id]=a.length<<1|1,a.push(v.value)):(l[v.id]=u.length<<1,u.push(y=>v.dynamicSlot(y)));l[g.id]=u.length<<1,u.push(v=>Rj(v,g,p))}}let h=u.map(d=>d(l));return new Xh(e,o,h,l,a,s)}}function Pj(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof Am&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof Am){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof WC)s(o.inner,o.prec);else if(o instanceof vr)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof uh)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,bl.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,bl.default),r.reduce((o,l)=>o.concat(l))}function Zc(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Qh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const JC=Ne.define(),Om=Ne.define({combine:t=>t.some(e=>e),static:!0}),KC=Ne.define({combine:t=>t.length?t[0]:void 0,static:!0}),GC=Ne.define(),XC=Ne.define(),QC=Ne.define(),YC=Ne.define({combine:t=>t.length?t[0]:!1});class il{constructor(e,n){this.type=e,this.value=n}static define(){return new Dj}}class Dj{of(e){return new il(this,e)}}class Ij{constructor(e){this.map=e}of(e){return new It(this,e)}}class It{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new It(this.type,n)}is(e){return this.type==e}static define(e={}){return new Ij(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}It.reconfigure=It.define();It.appendConfig=It.define();class Mr{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&UC(r,n.newLength),s.some(l=>l.type==Mr.time)||(this.annotations=s.concat(Mr.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Mr(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Mr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Mr.time=il.define();Mr.userEvent=il.define();Mr.addToHistory=il.define();Mr.remote=il.define();function Lj(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function ZC(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=er.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:It.mapEffects(t.effects,i).concat(It.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function _m(t,e,n){let r=e.selection,i=Ia(e.annotations);return e.userEvent&&(i=i.concat(Mr.userEvent.of(e.userEvent))),{changes:e.changes instanceof er?e.changes:er.of(e.changes||[],n,t.facet(KC)),selection:r&&(r instanceof pe?r:pe.single(r.anchor,r.head)),effects:Ia(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function $C(t,e,n){let r=_m(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=ZC(r,_m(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=Mr.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return jj(n?Nj(i):i)}function Nj(t){let e=t.startState,n=!0;for(let i of e.facet(GC)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:Lj(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=er.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Mr.create(e,i,t.selection&&t.selection.map(s),It.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(XC);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Mr?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mr?t=s[0]:t=$C(e,Ia(s),!1)}return t}function jj(t){let e=t.startState,n=e.facet(QC),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=ZC(r,_m(e,s,t.changes.newLength),!0))}return r==t?t:Mr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Bj=[];function Ia(t){return t==null?Bj:Array.isArray(t)?t:[t]}var Bn=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Bn||(Bn={}));const Fj=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Em;try{Em=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function zj(t){if(Em)return Em.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Fj.test(n)))return!0}return!1}function Vj(t){return e=>{if(!/\S/.test(e))return Bn.Space;if(zj(e))return Bn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Bn.Word;return Bn.Other}}class zt{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Zc(this,l<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Zc(this,r),Qh(this,r)}update(...e){return $C(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let l of e.effects)l.is(Xs.reconfigure)?(n&&(i=new Map,n.compartments.forEach((a,u)=>i.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(It.reconfigure)?(n=null,r=l.value):l.is(It.appendConfig)&&(n=null,r=Ia(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=Xh.resolve(r,i,this),s=new zt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(Om)?e.newSelection:e.newSelection.asSingle();new zt(n,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:pe.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ia(r.effects);for(let l=1;l<n.ranges.length;l++){let a=e(n.ranges[l]),u=this.changes(a.changes),f=u.map(i);for(let d=0;d<l;d++)s[d]=s[d].map(f);let h=i.mapDesc(u,!0);s.push(a.range.map(h)),i=i.compose(f),o=It.mapEffects(o,f).concat(It.mapEffects(Ia(a.effects),h))}return{changes:i,selection:pe.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof er?e:er.of(e,this.doc.length,this.facet(zt.lineSeparator))}toText(e){return tn.of(e.split(this.facet(zt.lineSeparator)||wm))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(Zc(this,n),Qh(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof vr&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],l=e[s];i.push(o.init(a=>o.spec.fromJSON(l,a)))}}return zt.create({doc:e.doc,selection:pe.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Xh.resolve(e.extensions||[],new Map),r=e.doc instanceof tn?e.doc:tn.of((e.doc||"").split(n.staticFacet(zt.lineSeparator)||wm)),i=e.selection?e.selection instanceof pe?e.selection:pe.single(e.selection.anchor,e.selection.head):pe.single(0);return UC(i,r.length),n.staticFacet(Om)||(i=i.asSingle()),new zt(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(zt.tabSize)}get lineBreak(){return this.facet(zt.lineSeparator)||`
|
|
74
|
-
`}get readOnly(){return this.facet(YC)}phrase(e,...n){for(let r of this.facet(zt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(JC))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return Vj(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=Sr(n,o,!1);if(s(n.slice(a,o))!=Bn.Word)break;o=a}for(;l<i;){let a=Sr(n,l);if(s(n.slice(l,a))!=Bn.Word)break;l=a}return o==l?null:pe.range(o+r,l+r)}}zt.allowMultipleSelections=Om;zt.tabSize=Ne.define({combine:t=>t.length?t[0]:4});zt.lineSeparator=KC;zt.readOnly=YC;zt.phrases=Ne.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});zt.languageData=JC;zt.changeFilter=GC;zt.transactionFilter=XC;zt.transactionExtender=QC;Xs.reconfigure=It.define();function cs(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Ul{eq(e){return this==e}range(e,n=e){return Tm.create(e,n,this)}}Ul.prototype.startSide=Ul.prototype.endSide=0;Ul.prototype.point=!1;Ul.prototype.mapMode=Hr.TrackDel;let Tm=class ek{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new ek(e,n,r)}};function Mm(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class w0{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let r=[],i=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let u=this.value[a],f=this.from[a]+e,h=this.to[a]+e,d,p;if(f==h){let g=n.mapPos(f,u.startSide,u.mapMode);if(g==null||(d=p=g,u.startSide!=u.endSide&&(p=n.mapPos(f,u.endSide),p<d)))continue}else if(d=n.mapPos(f,u.startSide),p=n.mapPos(h,u.endSide),d>p||d==p&&u.startSide>0&&u.endSide<=0)continue;(p-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(l=Math.max(l,p-d)),r.push(u),i.push(d-o),s.push(p-o))}return{mapped:r.length?new w0(i,s,r,l):null,pos:o}}}class Ut{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new Ut(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Mm)),this.isEmpty)return n.length?Ut.of(n):this;let l=new tk(this,null,-1).goto(0),a=0,u=[],f=new is;for(;l.value||a<n.length;)if(a<n.length&&(l.from-n[a].from||l.startSide-n[a].value.startSide)>=0){let h=n[a++];f.addInner(h.from,h.to,h.value)||u.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==n.length||this.chunkEnd(l.chunkIndex)<n[a].from)&&(!o||i>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||i>l.to||s<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value)||u.push(Tm.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!u.length?Ut.empty:this.nextLayer.update({add:u,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],u=e.touchesRange(l,l+a.length);if(u===!1)i=Math.max(i,a.maxPoint),n.push(a),r.push(e.mapPos(l));else if(u===!0){let{mapped:f,pos:h}=a.map(l,e);f&&(i=Math.max(i,f.maxPoint),n.push(f),r.push(h))}}let s=this.nextLayer.map(e);return n.length==0?s:new Ut(r,n,s||Ut.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return wu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return wu.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=gb(o,l,r),u=new Dc(o,a,s),f=new Dc(l,a,s);r.iterGaps((h,d,p)=>mb(u,h,f,d,p,i)),r.empty&&r.length==0&&mb(u,0,f,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),o=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=gb(s,o),a=new Dc(s,l,0).goto(r),u=new Dc(o,l,0).goto(r);for(;;){if(a.to!=u.to||!Rm(a.active,u.active)||a.point&&(!u.point||!a.point.eq(u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Dc(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),h=o.pointFrom<n?f.length+1:o.point.startSide<0?f.length:Math.min(f.length,a);i.point(l,u,o.point,f,h,o.pointRank),a=Math.min(o.openEnd(u),f.length)}else u>l&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new is;for(let i of e instanceof Tm?[e]:n?Hj(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return Ut.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=Ut.empty;i=i.nextLayer)n=new Ut(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Ut.empty=new Ut([],[],null,-1);function Hj(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Mm(e,r)>0)return t.slice().sort(Mm);e=r}return t}Ut.empty.nextLayer=Ut.empty;class is{finishChunk(e){this.chunks.push(new w0(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new is)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Ut.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Ut.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function gb(t,e,n){let r=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=r.get(s.chunk[o]);l!=null&&(n?n.mapPos(l):l)==s.chunkPos[o]&&!(n!=null&&n.touchesRange(l,l+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class tk{constructor(e,n,r,i=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class wu{constructor(e){this.heap=e}static from(e,n=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new tk(o,n,r,s));return i.length==1?i[0]:new wu(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)cg(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)cg(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),cg(this.heap,0)}}}function cg(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Dc{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=wu.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){_f(this.active,e),_f(this.activeTo,e),_f(this.activeRank,e),this.minActive=vb(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;Ef(this.active,n,r),Ef(this.activeTo,n,i),Ef(this.activeRank,n,s),e&&Ef(e,n,this.cursor.from),this.minActive=vb(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&_f(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<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 i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];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)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function mb(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e;for(;;){let u=t.to+a-n.to,f=u||t.endSide-n.endSide,h=f<0?t.to+a:n.to,d=Math.min(h,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Rm(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,d,t.point,n.point):d>l&&!Rm(t.active,n.active)&&s.compareRange(l,d,t.active,n.active),h>o)break;(u||t.openEnd!=n.openEnd)&&s.boundChange&&s.boundChange(h),l=h,f<=0&&t.next(),f>=0&&n.next()}}function Rm(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function _f(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Ef(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function vb(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function yc(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Sr(t,i));return r}function Pm(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=Sr(t,i)}return r===!0?-1:t.length}const Dm="ͼ",yb=typeof Symbol>"u"?"__"+Dm:Symbol.for(Dm),Im=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ko{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let f=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let p in l){let g=l[p];if(/&/.test(p))s(p.split(/,\s*/).map(m=>o.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),g,a);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),g,f,d)}else g!=null&&f.push(p.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+g+";")}(f.length||d)&&a.push((r&&!h&&!u?o.map(r):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
75
|
-
`)}static newName(){let e=bb[yb]||1;return bb[yb]=e+1,Dm+e.toString(36)}static mount(e,n,r){let i=e[Im],s=r&&r.nonce;i?s&&i.setNonce(s):i=new qj(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let xb=new Map;class qj{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=xb.get(r);if(s)return e[Im]=s;this.sheet=new i.CSSStyleSheet,xb.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Im]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u<l.rules.length;u++)r.insertRule(l.rules[u],i++)}else{for(;s<a;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
|
76
|
-
`;this.styleTag.textContent=o;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Go={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:"'"},Su={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Uj=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xr=0;xr<10;xr++)Go[48+xr]=Go[96+xr]=String(xr);for(var xr=1;xr<=24;xr++)Go[xr+111]="F"+xr;for(var xr=65;xr<=90;xr++)Go[xr]=String.fromCharCode(xr+32),Su[xr]=String.fromCharCode(xr);for(var ug in Go)Su.hasOwnProperty(ug)||(Su[ug]=Go[ug]);function Jj(t){var e=Uj&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Wj&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Su:Go)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Cu(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Lm(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function fh(t,e){if(!e.anchorNode)return!1;try{return Lm(t,e.anchorNode)}catch{return!1}}function ku(t){return t.nodeType==3?Jl(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function $c(t,e,n,r){return n?wb(t,e,n,r,-1)||wb(t,e,n,r,1):!1}function Wl(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Yh(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function wb(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Fs(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Wl(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?Fs(t):0}else return!1}}function Fs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fp(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Kj(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function nk(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Gj(t,e,n,r,i,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let f=t,h=!1;f&&!h;)if(f.nodeType==1){let d,p=f==a.body,g=1,m=1;if(p)d=Kj(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(h=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:g,scaleY:m}=nk(f,S)),d={left:S.left,right:S.left+f.clientWidth*g,top:S.top,bottom:S.top+f.clientHeight*m}}let v=0,y=0;if(i=="nearest")e.top<d.top?(y=e.top-(d.top+o),n>0&&e.bottom>d.bottom+y&&(y=e.bottom-d.bottom+o)):e.bottom>d.bottom&&(y=e.bottom-d.bottom+o,n<0&&e.top-y<d.top&&(y=e.top-(d.top+o)));else{let S=e.bottom-e.top,k=d.bottom-d.top;y=(i=="center"&&S<=k?e.top+S/2-k/2:i=="start"||i=="center"&&n<0?e.top-o:e.bottom-k+o)-d.top}if(r=="nearest"?e.left<d.left?(v=e.left-(d.left+s),n>0&&e.right>d.right+v&&(v=e.right-d.right+s)):e.right>d.right&&(v=e.right-d.right+s,n<0&&e.left<d.left+v&&(v=e.left-(d.left+s))):v=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==l?e.left-s:e.right-(d.right-d.left)+s)-d.left,v||y)if(p)u.scrollBy(v,y);else{let S=0,k=0;if(y){let C=f.scrollTop;f.scrollTop+=y/m,k=(f.scrollTop-C)*m}if(v){let C=f.scrollLeft;f.scrollLeft+=v/g,S=(f.scrollLeft-C)*g}e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k},S&&Math.abs(S-v)<1&&(r="nearest"),k&&Math.abs(k-y)<1&&(i="nearest")}if(p)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)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Xj(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class Qj{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Fs(n):0),r,Math.min(e.focusOffset,r?Fs(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let ha=null;function rk(t){if(t.setActive)return t.setActive();if(ha)return t.focus(ha);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(ha==null?{get preventScroll(){return ha={preventScroll:!0},!0}}:void 0),!ha){ha=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Sb;function Jl(t,e,n=e){let r=Sb||(Sb=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function La(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Yj(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function ik(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Zj(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Fs(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=Fs(n))}else{if(n==t)return!0;r=Wl(n),n=n.parentNode}}function sk(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function ok(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Fs(n)}else if(n.parentNode&&!Yh(n))r=Wl(n),n=n.parentNode;else return null}}function lk(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Yh(n))r=Wl(n)+1,n=n.parentNode;else return null}}class Er{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Er(e.parentNode,Wl(e),n)}static after(e,n){return new Er(e.parentNode,Wl(e)+1,n)}}const S0=[];class xn{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let l=xn.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,n),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&s!=o.dom&&(n.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=Cb(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&n&&n.node==r&&(n.written=!0);s;)s=Cb(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let i=Fs(e)==0?0:n==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!xn.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,n,r=0){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,f=r;a<this.children.length;a++){let h=this.children[a],d=u+h.length;if(u<e&&d>n)return h.domBoundsAround(e,n,u);if(d>=e&&i==-1&&(i=a,s=u),u>n&&h.dom.parentNode==this.dom){o=a,l=f;break}f=d,u=d+h.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=S0){this.markDirty();for(let i=e;i<n;i++){let s=this.children[i];s.parent==this&&r.indexOf(s)<0&&s.destroy()}r.length<250?this.children.splice(e,n-e,...r):this.children=[].concat(this.children.slice(0,e),r,this.children.slice(n));for(let i=0;i<r.length;i++)r[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new ak(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,n,r,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}xn.prototype.breakAfter=0;function Cb(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ak{constructor(e,n,r){this.children=e,this.pos=n,this.i=r,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function ck(t,e,n,r,i,s,o,l,a){let{children:u}=t,f=u.length?u[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==r&&f&&!o&&!d&&s.length<2&&f.merge(n,i,s.length?h:null,n==0,l,a))){if(r<u.length){let p=u[r];p&&(i<p.length||p.breakAfter&&(h!=null&&h.breakAfter))?(e==r&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,a)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,a),s.push(p))):p!=null&&p.breakAfter&&(h?h.breakAfter=1:o=1),r++}for(f&&(f.breakAfter=o,n>0&&(!o&&s.length&&f.merge(n,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(n<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(n,f.length,null,!1,l,0),e++));e<r&&s.length;)if(u[r-1].become(s[s.length-1]))r--,s.pop(),a=s.length?0:l;else if(u[e].become(s[0]))e++,s.shift(),l=s.length?0:a;else break;!s.length&&e&&r<u.length&&!u[e-1].breakAfter&&u[r].merge(0,0,u[e-1],!1,l,a)&&e--,(e<r||s.length)&&t.replaceChildren(e,r,s)}}function uk(t,e,n,r,i,s){let o=t.childCursor(),{i:l,off:a}=o.findPos(n,1),{i:u,off:f}=o.findPos(e,-1),h=e-n;for(let d of r)h+=d.length;t.length+=h,ck(t,u,f,l,a,r,0,i,s)}let Yr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Nm=typeof document<"u"?document:{documentElement:{style:{}}};const jm=/Edge\/(\d+)/.exec(Yr.userAgent),fk=/MSIE \d/.test(Yr.userAgent),Bm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Yr.userAgent),hp=!!(fk||Bm||jm),kb=!hp&&/gecko\/(\d+)/i.test(Yr.userAgent),fg=!hp&&/Chrome\/(\d+)/.exec(Yr.userAgent),$j="webkitFontSmoothing"in Nm.documentElement.style,hk=!hp&&/Apple Computer/.test(Yr.vendor),Ab=hk&&(/Mobile\/\w+/.test(Yr.userAgent)||Yr.maxTouchPoints>2);var Fe={mac:Ab||/Mac/.test(Yr.platform),windows:/Win/.test(Yr.platform),linux:/Linux|X11/.test(Yr.platform),ie:hp,ie_version:fk?Nm.documentMode||6:Bm?+Bm[1]:jm?+jm[1]:0,gecko:kb,gecko_version:kb?+(/Firefox\/(\d+)/.exec(Yr.userAgent)||[0,0])[1]:0,chrome:!!fg,chrome_version:fg?+fg[1]:0,ios:Ab,android:/Android\b/.test(Yr.userAgent),safari:hk,webkit_version:$j?+(/\bAppleWebKit\/(\d+)/.exec(Yr.userAgent)||[0,0])[1]:0,tabSize:Nm.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const eB=256;class ss extends xn{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof ss)||this.length-(n-e)+r.length>eB||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new ss(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Er(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return tB(this.dom,e,n)}}class yo extends xn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let i of n)i.setParent(this)}setAttrs(e){if(ik(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,i,s,o){return r&&(!(r instanceof yo&&r.mark.eq(this.mark))||e&&s<=0||n<this.length&&o<=0)?!1:(uk(this,e,n,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let n=[],r=0,i=-1,s=0;for(let l of this.children){let a=r+l.length;a>e&&n.push(r<e?l.split(e-r):l),i<0&&r>=e&&(i=s),r=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new yo(this.mark,n,o)}domAtPos(e){return dk(this,e)}coordsAt(e,n){return gk(this,e,n)}}function tB(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let l=Jl(t,i,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:n>=0)?0:l.length-1];return Fe.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,u=>u.width)||a),o?fp(a,o<0):a||null}class Io extends xn{static create(e,n,r){return new Io(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=Io.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,i,s,o){return r&&(!(r instanceof Io)||!this.widget.compare(r.widget)||e>0&&s<=0||n<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}become(e){return e instanceof Io&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return tn.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,r=n&&n.state.doc,i=this.posAtStart;return r?r.slice(i,i+this.length):tn.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Er.before(this.dom):Er.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top<s.bottom);l+=o?-1:1);return fp(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Ya extends xn{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Ya&&e.side==this.side}split(){return new Ya(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Er.before(this.dom):Er.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return tn.empty}get isHidden(){return!0}}ss.prototype.children=Io.prototype.children=Ya.prototype.children=S0;function dk(t,e){let n=t.dom,{children:r}=t,i=0;for(let s=0;i<r.length;i++){let o=r[i],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(e>s&&e<l&&o.dom.parentNode==n)return o.domAtPos(e-s);if(e<=s)break;s=l}}for(let s=i;s>0;s--){let o=r[s-1];if(o.dom.parentNode==n)return o.domAtPos(o.length)}for(let s=i;s<r.length;s++){let o=r[s];if(o.dom.parentNode==n)return o.domAtPos(0)}return new Er(n,0)}function pk(t,e,n){let r,{children:i}=t;n>0&&e instanceof yo&&i.length&&(r=i[i.length-1])instanceof yo&&r.mark.eq(e.mark)?pk(r,e.children[0],n-1):(i.push(e),e.setParent(t)),t.length+=e.length}function gk(t,e,n){let r=null,i=-1,s=null,o=-1;function l(u,f){for(let h=0,d=0;h<u.children.length&&d<=f;h++){let p=u.children[h],g=d+p.length;g>=f&&(p.children.length?l(p,f-d):(!s||s.isHidden&&(n>0||rB(s,p)))&&(g>f||d==g&&p.getSide()>0)?(s=p,o=f-d):(d<f||d==g&&p.getSide()<0&&!p.isHidden)&&(r=p,i=f-d)),d=g}}l(t,e);let a=(n<0?r:s)||r||s;return a?a.coordsAt(Math.max(0,a==r?i:o),n):nB(t)}function nB(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=ku(e);return n[n.length-1]||null}function rB(t,e){let n=t.coordsAt(0,1),r=e.coordsAt(0,1);return n&&r&&r.top<n.bottom}function Fm(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const Ob=Object.create(null);function Zh(t,e,n){if(t==e)return!0;t||(t=Ob),e||(e=Ob);let r=Object.keys(t),i=Object.keys(e);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function zm(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function iB(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class sl{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Wr=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Wr||(Wr={}));class ft extends Ul{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new tf(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Xo(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=mk(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Xo(e,r,i,n,e.widget||null,!0)}static line(e){return new nf(e)}static set(e,n=!1){return Ut.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ft.none=Ut.empty;class tf extends ft{constructor(e){let{start:n,end:r}=mk(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof tf&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&Zh(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}tf.prototype.point=!1;class nf extends ft{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof nf&&this.spec.class==e.spec.class&&Zh(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}nf.prototype.mapMode=Hr.TrackBefore;nf.prototype.point=!0;class Xo extends ft{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Hr.TrackBefore:Hr.TrackAfter:Hr.TrackDel}get type(){return this.startSide!=this.endSide?Wr.WidgetRange:this.startSide<=0?Wr.WidgetBefore:Wr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Xo&&sB(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Xo.prototype.point=!0;function mk(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function sB(t,e){return t==e||!!(t&&e&&t.compare(e))}function hh(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Zn extends xn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,i,s,o){if(r){if(!(r instanceof Zn))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),uk(this,e,n,r?r.children.slice():[],s,o),!0}split(e){let n=new Zn;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:i}=this.childPos(e);i&&(n.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)n.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Zh(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){pk(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=Fm(n,this.attrs||{})),r&&(this.attrs=Fm({class:r},this.attrs||{}))}domAtPos(e){return dk(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(ik(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(zm(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let i=this.dom.lastChild;for(;i&&xn.get(i)instanceof yo;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=xn.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(s=>s instanceof ss))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof ss)||/[^ -~]/.test(r.text))return null;let i=ku(r.dom);if(i.length!=1)return null;e+=i[0].width,n=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=gk(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof Zn&&this.children.length==0&&e.children.length==0&&Zh(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let r=0,i=0;r<e.children.length;r++){let s=e.children[r],o=i+s.length;if(o>=n){if(s instanceof Zn)return s;if(o>n)break}i=o+s.breakAfter}return null}}class lo extends xn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,i,s,o){return r&&(!(r instanceof lo)||!this.widget.compare(r.widget)||e>0&&s<=0||n<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Er.before(this.dom):Er.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let r=new lo(this.widget,n,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return S0}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):tn.empty}domBoundsAround(){return null}become(e){return e instanceof lo&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);return r||(this.widget instanceof Vm?null:fp(this.dom.getBoundingClientRect(),this.length?e==0:n<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:r}=this.deco;return n==r?!1:e<0?n<0:r>0}}class Vm extends sl{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}}class eu{constructor(e,n,r,i){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof lo&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Zn),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Tf(new Ya(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof lo)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Tf(new ss(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,n,r,i){this.buildText(n-e,r,i),this.pos=n,this.openStart<0&&(this.openStart=i)}point(e,n,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Xo){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Xo)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new lo(r.widget||Za.block,l,r));else{let a=Io.create(r.widget||Za.inline,l,l?0:r.startSide),u=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e<n||r.startSide>0),f=!a.isEditable&&(e<n||s>i.length||r.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!u&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),u&&(h.append(Tf(new Ya(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Tf(a,i),s),this.atCursorPos=f,this.pendingBuffer=f?e<n||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=s)}static build(e,n,r,i,s){let o=new eu(e,n,r,s);return o.openEnd=Ut.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Tf(t,e){for(let n of e)t=new yo(n,[t],t.length);return t}class Za extends sl{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}}Za.inline=new Za("span");Za.block=new Za("div");var In=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(In||(In={}));const Kl=In.LTR,C0=In.RTL;function vk(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const oB=vk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),lB=vk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Hm=Object.create(null),ws=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Hm[e]=n,Hm[n]=-e}function yk(t){return t<=247?oB[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?lB[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const aB=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Lo{get dir(){return this.level%2?C0:Kl}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=n&&l.to>=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.from<n:l.to>n:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function bk(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!bk(r.inner,i.inner))return!1}return!0}const yn=[];function cB(t,e,n,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:n,a=s?256:i;for(let u=o,f=a,h=a;u<l;u++){let d=yk(t.charCodeAt(u));d==512?d=f:d==8&&h==4&&(d=16),yn[u]=d==4?2:d,d&7&&(h=d),f=d}for(let u=o,f=a,h=a;u<l;u++){let d=yn[u];if(d==128)u<l-1&&f==yn[u+1]&&f&24?d=yn[u]=f:yn[u]=256;else if(d==64){let p=u+1;for(;p<l&&yn[p]==64;)p++;let g=u&&f==8||p<n&&yn[p]==8?h==1?1:8:256;for(let m=u;m<p;m++)yn[m]=g;u=p-1}else d==8&&h==1&&(yn[u]=1);f=d,d&7&&(h=d)}}}function uB(t,e,n,r,i){let s=i==1?2:1;for(let o=0,l=0,a=0;o<=r.length;o++){let u=o?r[o-1].to:e,f=o<r.length?r[o].from:n;for(let h=u,d,p,g;h<f;h++)if(p=Hm[d=t.charCodeAt(h)])if(p<0){for(let m=l-3;m>=0;m-=3)if(ws[m+1]==-p){let v=ws[m+2],y=v&2?i:v&4?v&1?s:i:0;y&&(yn[h]=yn[ws[m]]=y),l=m;break}}else{if(ws.length==189)break;ws[l++]=h,ws[l++]=d,ws[l++]=a}else if((g=yn[h])==2||g==1){let m=g==i;a=m?0:1;for(let v=l-3;v>=0;v-=3){let y=ws[v+2];if(y&2)break;if(m)ws[v+2]|=2;else{if(y&4)break;ws[v+2]|=4}}}}}function fB(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=i<n.length?n[i].from:e;for(let a=o;a<l;){let u=yn[a];if(u==256){let f=a+1;for(;;)if(f==l){if(i==n.length)break;f=n[i++].to,l=i<n.length?n[i].from:e}else if(yn[f]==256)f++;else break;let h=s==1,d=(f<e?yn[f]:r)==1,p=h==d?h?1:2:r;for(let g=f,m=i,v=m?n[m-1].to:t;g>a;)g==v&&(g=n[--m].from,v=m?n[m-1].to:t),yn[--g]=p;a=f}else s=u,a++}}}function qm(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;a<n;){let f=!0,h=!1;if(u==s.length||a<s[u].from){let m=yn[a];m!=l&&(f=!1,h=m==16)}let d=!f&&l==1?[]:null,p=f?r:r+1,g=a;e:for(;;)if(u<s.length&&g==s[u].from){if(h)break e;let m=s[u];if(!f)for(let v=m.to,y=u+1;;){if(v==n)break e;if(y<s.length&&s[y].from==v)v=s[y++].to;else{if(yn[v]==l)break e;break}}if(u++,d)d.push(m);else{m.from>a&&o.push(new Lo(a,m.from,p));let v=m.direction==Kl!=!(p%2);Um(t,v?r+1:r,i,m.inner,m.from,m.to,o),a=m.to}g=m.to}else{if(g==n||(f?yn[g]!=l:yn[g]==l))break;g++}d?qm(t,a,g,r+1,i,d,o):a<g&&o.push(new Lo(a,g,p)),a=g}else for(let a=n,u=s.length;a>e;){let f=!0,h=!1;if(!u||a>s[u-1].to){let m=yn[a-1];m!=l&&(f=!1,h=m==16)}let d=!f&&l==1?[]:null,p=f?r:r+1,g=a;e:for(;;)if(u&&g==s[u-1].to){if(h)break e;let m=s[--u];if(!f)for(let v=m.from,y=u;;){if(v==e)break e;if(y&&s[y-1].to==v)v=s[--y].from;else{if(yn[v-1]==l)break e;break}}if(d)d.push(m);else{m.to<a&&o.push(new Lo(m.to,a,p));let v=m.direction==Kl!=!(p%2);Um(t,v?r+1:r,i,m.inner,m.from,m.to,o),a=m.from}g=m.from}else{if(g==e||(f?yn[g-1]!=l:yn[g-1]==l))break;g--}d?qm(t,g,a,r+1,i,d,o):g<a&&o.push(new Lo(g,a,p)),a=g}}function Um(t,e,n,r,i,s,o){let l=e%2?2:1;cB(t,i,s,r,l),uB(t,i,s,r,l),fB(i,s,r,l),qm(t,i,s,e,n,r,o)}function hB(t,e,n){if(!t)return[new Lo(0,0,e==C0?1:0)];if(e==Kl&&!n.length&&!aB.test(t))return xk(t.length);if(n.length)for(;t.length>yn.length;)yn[yn.length]=256;let r=[],i=e==Kl?0:1;return Um(t,i,i,n,0,t.length,r),r}function xk(t){return[new Lo(0,t,0)]}let wk="";function dB(t,e,n,r,i){var s;let o=r.head-t.from,l=Lo.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let d=l+=i?1:-1;if(d<0||d>=e.length)return null;a=e[l=d],o=a.side(!i,n),u=a.side(i,n)}let f=Sr(t.text,o,a.forward(i,n));(f<a.from||f>a.to)&&(f=u),wk=t.text.slice(Math.min(o,f),Math.max(o,f));let h=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return h&&f==u&&h.level+(i?0:1)<a.level?pe.cursor(h.side(!i,n)+t.from,h.forward(i,n)?1:-1,h.level):pe.cursor(f+t.from,a.forward(i,n)?-1:1,a.level)}function pB(t,e,n){for(let r=e;r<n;r++){let i=yk(t.charCodeAt(r));if(i==1)return Kl;if(i==2||i==4)return C0}return Kl}const Sk=Ne.define(),Ck=Ne.define(),kk=Ne.define(),Ak=Ne.define(),Wm=Ne.define(),Ok=Ne.define(),_k=Ne.define(),k0=Ne.define(),A0=Ne.define(),Ek=Ne.define({combine:t=>t.some(e=>e)}),Tk=Ne.define({combine:t=>t.some(e=>e)}),Mk=Ne.define();class Na{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Na(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 Na(pe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Mf=It.define({map:(t,e)=>t.map(e)}),Rk=It.define();function qr(t,e,n){let r=t.facet(Ak);r.length?r[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const Qs=Ne.define({combine:t=>t.length?t[0]:!0});let gB=0;const Vc=Ne.define();class qn{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.extension=s(this)}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new qn(gB++,e,r,i,l=>{let a=[Vc.of(l)];return o&&a.push(Au.of(u=>{let f=u.plugin(l);return f?o(f):ft.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return qn.define(r=>new e(r),n)}}class hg{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(qr(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){qr(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){qr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Pk=Ne.define(),O0=Ne.define(),Au=Ne.define(),Dk=Ne.define(),_0=Ne.define(),Ik=Ne.define();function _b(t,e){let n=t.state.facet(Ik);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return Ut.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,f=o-e.from,h=i;for(let d=l.length-1;d>=0;d--,a--){let p=l[d].spec.bidiIsolate,g;if(p==null&&(p=pB(e.text,u,f)),a>0&&h.length&&(g=h[h.length-1]).to==u&&g.direction==p)g.to=f,h=g.inner;else{let m={from:u,to:f,direction:p,inner:[]};h.push(m),h=m.inner}}}}),i}const Lk=Ne.define();function E0(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Lk)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Hc=Ne.define();class Mi{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Mi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0,l=0;;i++){let a=i==e.length?null:e[i],u=o-l,f=a?a.fromB:1e9;for(;s<n.length&&n[s]<f;){let h=n[s],d=n[s+1],p=Math.max(l,h),g=Math.min(f,d);if(p<=g&&new Mi(p+u,g+u,p,g).addToSet(r),d>f)break;s+=2}if(!a)return r;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}}class $h{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=er.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new Mi(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new $h(e,n,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}}class Eb extends xn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ft.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.setDOM(e.contentDOM),this.children=[new Zn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:f})=>f<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 i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!SB(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?vB(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:f}=this.hasComposition;r=new Mi(u,f,e.changes.mapPos(u,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Fe.ie||Fe.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=xB(o,l,e.changes);return r=Mi.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Fe.chrome||Fe.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof lo&&o.widget instanceof Vm&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,n,r){let i=r?r.range.addToSet(e.slice()):e,s=this.childCursor(n);for(let o=i.length-1;;o--){let l=o>=0?i[o]:null;if(!l)break;let{fromA:a,toA:u,fromB:f,toB:h}=l,d,p,g,m;if(r&&r.range.fromB<h&&r.range.toB>f){let C=eu.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),w=eu.build(this.view.state.doc,r.range.toB,h,this.decorations,this.dynamicDecorationMap);p=C.breakAtStart,g=C.openStart,m=w.openEnd;let E=this.compositionView(r);w.breakAtStart?E.breakAfter=1:w.content.length&&E.merge(E.length,E.length,w.content[0],!1,w.openStart,0)&&(E.breakAfter=w.content[0].breakAfter,w.content.shift()),C.content.length&&E.merge(0,0,C.content[C.content.length-1],!0,0,C.openEnd)&&C.content.pop(),d=C.content.concat(E).concat(w.content)}else({content:d,breakAtStart:p,openStart:g,openEnd:m}=eu.build(this.view.state.doc,f,h,this.decorations,this.dynamicDecorationMap));let{i:v,off:y}=s.findPos(u,1),{i:S,off:k}=s.findPos(a,-1);ck(this,S,k,v,y,d,p,g,m)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Rk)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new ss(e.text.nodeValue);n.flags|=8;for(let{deco:i}of e.marks)n=new yo(i,[n],n.length);let r=new Zn;return r.append(n,0),r}fixCompositionDOM(e){let n=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=xn.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];n(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],n(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&!(this.view.state.facet(Qs)||this.dom.tabIndex>-1)&&fh(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||n||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),u=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Fe.gecko&&l.empty&&!this.hasComposition&&mB(a)){let h=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(h,a.node.childNodes[a.offset]||null)),a=u=new Er(h,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!$c(a.node,a.offset,f.anchorNode,f.anchorOffset)||!$c(u.node,u.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(f.focusNode)&&wB(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Cu(this.view.root);if(h)if(l.empty){if(Fe.gecko){let d=yB(a.node,a.offset);if(d&&d!=3){let p=(d==1?ok:lk)(a.node,a.offset);p&&(a=new Er(p.node,p.offset))}}h.collapse(a.node,a.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(a.node,a.offset);try{h.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();l.anchor>l.head&&([a,u]=[u,a]),d.setEnd(u.node,u.offset),d.setStart(a.node,a.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,u)),this.impreciseAnchor=a.precise?null:new Er(f.anchorNode,f.anchorOffset),this.impreciseHead=u.precise?null:new Er(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&$c(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Cu(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=Zn.find(this,n.head);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&r.collapse(i,s)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let i=e.offset;!r&&i<n.childNodes.length;i++){let s=xn.get(n.childNodes[i]);s instanceof Zn&&(r=s.domAtPos(0))}for(let i=e.offset-1;!r&&i>=0;i--){let s=xn.get(n.childNodes[i]);s instanceof Zn&&(r=s.domAtPos(s.length))}return r?new Er(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=xn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let i=this.children[n];if(r<i.length||i instanceof Zn)break;n++,r=0}return this.children[n].domAtPos(r)}coordsAt(e,n){let r=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let l=this.children[o],a=s-l.breakAfter,u=a-l.length;if(a<e)break;if(u<=e&&(u<e||l.covers(-1))&&(a>e||l.covers(1))&&(!r||l instanceof Zn&&!(r instanceof Zn&&n>=0)))r=l,i=u;else if(r&&u==e&&a==e&&l instanceof lo&&Math.abs(n)<2){if(l.deco.startSide<0)break;o&&(r=null)}s=u}return r?r.coordsAt(e-i,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),i=this.children[n];if(!(i instanceof Zn))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(r,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}r=a}if(!(i instanceof ss))return null;let s=Sr(i.text,r);if(s==r)return null;let o=Jl(i.dom,r,s).getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(l==o.length-1||a.top<a.bottom&&a.left<a.right)return a}return null}measureVisibleLineHeights(e){let n=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==In.LTR;for(let u=0,f=0;f<this.children.length;f++){let h=this.children[f],d=u+h.length;if(d>i)break;if(u>=r){let p=h.dom.getBoundingClientRect();if(n.push(p.height),o){let g=h.dom.lastChild,m=g?ku(g):[];if(m.length){let v=m[m.length-1],y=a?v.right-p.left:p.right-v.left;y>l&&(l=y,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=d)}}}u=d+h.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?In.RTL:In.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Zn){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),n,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ku(e.firstChild)[0];n=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new ak(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ft.replace({widget:new Vm(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return ft.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Au).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Dk).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(Ut.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(Mk))try{if(u(this.view,e.range,e))return!0}catch(f){qr(this.view.state,f,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=E0(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Gj(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==In.LTR)}}function mB(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Nk(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=ok(n.focusNode,n.focusOffset),i=lk(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=xn.get(i.node);if(!l||l instanceof ss&&l.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let a=xn.get(r.node);!a||a instanceof ss&&a.text!=r.node.nodeValue||(s=i)}}if(t.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 vB(t,e,n){let r=Nk(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc,u=new Mi(a.mapPos(s),a.mapPos(o),s,o),f=[];for(let h=i.parentNode;;h=h.parentNode){let d=xn.get(h);if(d instanceof yo)f.push({node:h,deco:d.mark});else{if(d instanceof Zn||h.nodeName=="DIV"&&h.parentNode==t.contentDOM)return{range:u,text:i,marks:f,line:h};if(h!=t.contentDOM)f.push({node:h,deco:new tf({inclusive:!0,attributes:iB(h),tagName:h.tagName.toLowerCase()})});else return null}}}function yB(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let bB=class{constructor(){this.changes=[]}compareRange(e,n){hh(e,n,this.changes)}comparePoint(e,n){hh(e,n,this.changes)}boundChange(e){hh(e,e,this.changes)}};function xB(t,e,n){let r=new bB;return Ut.compare(t,e,n,r),r.changes}function wB(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function SB(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}function CB(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return pe.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=Sr(i.text,s,!1):l=Sr(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=Sr(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;l<i.length;){let u=Sr(i.text,l);if(r(i.text.slice(l,u))!=a)break;l=u}return pe.range(o+i.from,l+i.from)}function kB(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function AB(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dg(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function Tb(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Mb(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Jm(t,e,n){let r,i,s,o,l=!1,a,u,f,h;for(let g=t.firstChild;g;g=g.nextSibling){let m=ku(g);for(let v=0;v<m.length;v++){let y=m[v];i&&dg(i,y)&&(y=Tb(Mb(y,i.bottom),i.top));let S=kB(e,y),k=AB(n,y);if(S==0&&k==0)return g.nodeType==3?Rb(g,e,n):Jm(g,e,n);if(!r||o>k||o==k&&s>S){r=g,i=y,s=S,o=k;let C=k?n<y.top?-1:1:S?e<y.left?-1:1:0;l=!C||(C>0?v<m.length-1:v>0)}S==0?n>y.bottom&&(!f||f.bottom<y.bottom)?(a=g,f=y):n<y.top&&(!h||h.top>y.top)&&(u=g,h=y):f&&dg(f,y)?f=Mb(f,y.bottom):h&&dg(h,y)&&(h=Tb(h,y.top))}}if(f&&f.bottom>=n?(r=a,i=f):h&&h.top<=n&&(r=u,i=h),!r)return{node:t,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return Rb(r,d,n);if(l&&r.contentEditable!="false")return Jm(r,d,n);let p=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:p}}function Rb(t,e,n){let r=t.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;l<r;l++){let a=Jl(t,l,l+1).getClientRects();for(let u=0;u<a.length;u++){let f=a[u];if(f.top==f.bottom)continue;o||(o=e-f.left);let h=(f.top>n?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&h<s){let d=e>=(f.left+f.right)/2,p=d;if((Fe.chrome||Fe.gecko)&&Jl(t,l).getBoundingClientRect().left==f.right&&(p=!d),h<=0)return{node:t,offset:l+(p?1:0)};i=l+(p?1:0),s=h}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function jk(t,e,n,r=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),l=o.top+t.viewState.paddingTop,a,{docHeight:u}=t.viewState,{x:f,y:h}=e,d=h-l;if(d<0)return 0;if(d>u)return t.state.doc.length;for(let C=t.viewState.heightOracle.textHeight/2,w=!1;a=t.elementAtHeight(d),a.type!=Wr.Text;)for(;d=r>0?a.bottom+C:a.top-C,!(d>=0&&d<=u);){if(w)return n?null:0;w=!0,r=-r}h=l+d;let p=a.from;if(p<t.viewport.from)return t.viewport.from==0?0:n?null:Pb(t,o,a,f,h);if(p>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:Pb(t,o,a,f,h);let g=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:g,v=m.elementFromPoint(f,h);v&&!t.contentDOM.contains(v)&&(v=null),v||(f=Math.max(o.left+1,Math.min(o.right-1,f)),v=m.elementFromPoint(f,h),v&&!t.contentDOM.contains(v)&&(v=null));let y,S=-1;if(v&&((i=t.docView.nearest(v))===null||i===void 0?void 0:i.isEditable)!=!1){if(g.caretPositionFromPoint){let C=g.caretPositionFromPoint(f,h);C&&({offsetNode:y,offset:S}=C)}else if(g.caretRangeFromPoint){let C=g.caretRangeFromPoint(f,h);C&&({startContainer:y,startOffset:S}=C,(!t.contentDOM.contains(y)||Fe.safari&&OB(y,S,f)||Fe.chrome&&_B(y,S,f))&&(y=void 0))}y&&(S=Math.min(Fs(y),S))}if(!y||!t.docView.dom.contains(y)){let C=Zn.find(t.docView,p);if(!C)return d>a.top+a.height/2?a.to:a.from;({node:y,offset:S}=Jm(C.dom,f,h))}let k=t.docView.nearest(y);if(!k)return null;if(k.isWidget&&((s=k.dom)===null||s===void 0?void 0:s.nodeType)==1){let C=k.dom.getBoundingClientRect();return e.y<C.top||e.y<=C.bottom&&e.x<=(C.left+C.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(y,S)+k.posAtStart}function Pb(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+Pm(o,s,t.state.tabSize)}function OB(t,e,n){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let i=t.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Jl(t,r-1,r).getBoundingClientRect().left>n}function _B(t,e,n){if(e!=0)return!1;for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=t.nodeType==1?t.getBoundingClientRect():Jl(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Km(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==Wr.Text&&(i.type!=s.type||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function EB(t,e,n,r){let i=Km(t,e.head,e.assoc||-1),s=!r||i.type!=Wr.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==In.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return pe.cursor(a,n?-1:1)}return pe.cursor(n?i.to:i.from,n?-1:1)}function Db(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=dB(i,s,o,l,n),f=wk;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;f=`
|
|
77
|
-
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(f))return l}else{if(!r)return u;a=r(f)}l=u}}function TB(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Bn.Space&&(i=o),i==o}}function MB(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return pe.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||-1),f=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-p.from))),l=(s<0?p.top:p.bottom)+f}let h=a.left+o,d=r??t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let g=l+(d+p)*s,m=jk(t,{x:h,y:g},!1,s);if(g<a.top||g>a.bottom||(s<0?m<i:m>i)){let v=t.docView.coordsForChar(m),y=!v||g<v.top?-1:1;return pe.cursor(m,y,void 0,o)}}}function dh(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=r||n||(e-s<o-e?-1:1);e=a<0?s:o,r=a}});if(!r)return e}}function pg(t,e,n){let r=dh(t.state.facet(_0).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:pe.cursor(r,r<n.from?1:-1)}const qc="";class RB{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(zt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=qc}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==n)break;let l=xn.get(i),a=xn.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Yh(i))||Yh(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let n=xn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(PB(e,r.node,r.offset)?n:0))}}function PB(t,e,n){for(;;){if(!e||n<Fs(e))return!1;if(e==t)return!0;n=Wl(e)+1,e=e.parentNode}}class Ib{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class DB{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=s||o?[]:NB(e),a=new RB(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=jB(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Lm(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Lm(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&a!=u&&(f.from>0||f.to<e.state.doc.length)){let h=Math.min(a,u),d=Math.max(a,u),p=f.from-h,g=f.to-d;(p==0||p==1||h==0)&&(g==0||g==-1||d==e.state.doc.length)&&(a=0,u=e.state.doc.length)}this.newSel=pe.single(u,a)}}}function Bk(t,e){let n,{newSel:r}=e,i=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=i.from,u=null;(s===8||Fe.android&&e.text.length<l-o)&&(a=i.to,u="end");let f=LB(t.state.doc.sliceString(o,l,qc),e.text,a-o,u);f&&(Fe.chrome&&s==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==qc+qc&&f.toB--,n={from:o+f.from,to:o+f.toA,insert:tn.of(e.text.slice(f.from,f.toB).split(qc))})}else r&&(!t.hasFocus&&t.state.facet(Qs)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,i.to)}:(Fe.mac||Fe.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=pe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:tn.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:Fe.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
|
|
78
|
-
`&&t.lineWrapping&&(r&&(r=pe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:tn.of([" "])}),n)return T0(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function T0(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Fe.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&La(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&La(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&La(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=IB(t,e,n));return t.state.facet(Ok).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function IB(t,e,n){let r,i=t.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",a=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+a))}else{let l=i.changes(e),a=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),f,h=n&&Nk(t,n.main.head);if(h){let g=e.insert.length-(e.to-e.from);f={from:h.from,to:h.to-g}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;r=i.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:l,range:a||g.map(l)};let m=g.to-d,v=m-u.length;if(g.to-g.from!=p||t.state.sliceDoc(v,m)!=u||g.to>=f.from&&g.from<=f.to)return{range:g};let y=i.changes({from:v,to:m,insert:e.insert}),S=g.to-s.to;return{changes:y,range:a?pe.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):g.map(y)}})}else r={changes:l,selection:a&&i.selection.replaceRange(a)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function LB(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o<s&&t.length<e.length){let a=n<=s&&n>=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=n<=s&&n>=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function NB(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new Ib(n,r)),(i!=n||s!=r)&&e.push(new Ib(i,s))),e}function jB(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?pe.single(n+e,r+e):null}class BB{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&e7(e.contentDOM.ownerDocument)}handleEvent(e){!JB(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,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=FB(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&zk.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=Fk.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||zB.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,La(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Fe.safari&&!Fe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.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 Lb(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){qr(n.state,i)}}}function FB(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&n(s).handlers.push(Lb(r.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&n(s).observers.push(Lb(r.value,o))}}for(let r in os)n(r).handlers.push(os[r]);for(let r in ji)n(r).observers.push(ji[r]);return e}const Fk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],zB="dthko",zk=[16,17,18,20,91,92,224,225],Rf=6;function Pf(t){return Math.max(0,t)*.7+8}function VB(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class HB{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Xj(e.contentDOM),this.atoms=e.state.facet(_0).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(zt.allowMultipleSelections)&&qB(e,n),this.dragging=WB(e,n)&&qk(n)==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&&VB(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=E0(this.view);e.clientX-a.left<=i+Rf?n=-Pf(i-e.clientX):e.clientX+a.right>=o-Rf&&(n=Pf(e.clientX-o)),e.clientY-a.top<=s+Rf?r=-Pf(s-e.clientY):e.clientY+a.bottom>=l-Rf&&(r=Pf(e.clientY-l)),this.setScrollSpeed(n,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,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=dh(this.atoms,i.from,0);o!=i.from&&(s=pe.cursor(o,-1))}else{let o=dh(this.atoms,i.from,-1),l=dh(this.atoms,i.to,1);(o!=i.from||l!=i.to)&&(s=pe.range(i.from==i.anchor?o:l,i.from==i.head?o:l))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?pe.create(n,e.mainIndex):e}select(e){let{view:n}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function qB(t,e){let n=t.state.facet(Sk);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function UB(t,e){let n=t.state.facet(Ck);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function WB(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Cu(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function JB(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=xn.get(n))&&r.ignoreEvent(e))return!1;return!0}const os=Object.create(null),ji=Object.create(null),Vk=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function KB(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Hk(t,n.value)},50)}function dp(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function Hk(t,e){e=dp(t.state,k0,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Gm!=null&&n.selection.ranges.every(a=>a.empty)&&Gm==s.toString()){let a=-1;r=n.changeByRange(u=>{let f=n.doc.lineAt(u.from);if(f.from==a)return{range:u};a=f.from;let h=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:h},range:pe.cursor(u.from+h.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:pe.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ji.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};os.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ji.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ji.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};os.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(kk))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=QB(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new HB(t,e,n,r)),r&&t.observer.ignore(()=>{rk(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function Nb(t,e,n,r){if(r==1)return pe.cursor(e,n);if(r==2)return CB(t.state,e,n);{let i=Zn.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return l<t.state.doc.length&&l==s.to&&l++,pe.range(o,l)}}let jb=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function GB(t,e,n,r){let i=Zn.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&jb(n,r,o))return-1;let l=i.coordsAt(s,1);return l&&jb(n,r,l)?1:o&&o.bottom>=r?-1:1}function Bb(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:GB(t,n,e.clientX,e.clientY)}}const XB=Fe.ie&&Fe.ie_version<=11;let Fb=null,zb=0,Vb=0;function qk(t){if(!XB)return t.detail;let e=Fb,n=Vb;return Fb=t,Vb=Date.now(),zb=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(zb+1)%3:1}function QB(t,e){let n=Bb(t,e),r=qk(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=Bb(t,s),u,f=Nb(t,a.pos,a.bias,r);if(n.pos!=a.pos&&!o){let h=Nb(t,n.pos,n.bias,r),d=Math.min(h.from,f.from),p=Math.max(h.to,f.to);f=d<f.from?pe.range(d,p):pe.range(p,d)}return o?i.replaceRange(i.main.extend(f.from,f.to)):l&&r==1&&i.ranges.length>1&&(u=YB(i,a.pos))?u:l?i.addRange(f):pe.create([f])}}}function YB(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return pe.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}os.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=pe.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",dp(t.state,A0,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};os.dragend=t=>(t.inputState.draggedContent=null,!1);function Hb(t,e,n,r){if(n=dp(t.state,k0,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&UB(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}os.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Hb(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Hb(t,e,r,!0),!0}return!1};os.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Vk?null:e.clipboardData;return n?(Hk(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(KB(t),!1)};function ZB(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function $B(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:dp(t,A0,e.join(t.lineBreak)),ranges:n,linewise:r}}let Gm=null;os.copy=os.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=$B(t.state);if(!n&&!i)return!1;Gm=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Vk?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(ZB(t,n),!1)};const Uk=il.define();function Wk(t,e){let n=[];for(let r of t.facet(_k)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:Uk.of(!0)}):null}function Jk(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=Wk(t.state,e);n?t.dispatch(n):t.update([])}},10)}ji.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Jk(t)};ji.blur=t=>{t.observer.clearSelectionRange(),Jk(t)};ji.compositionstart=ji.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ji.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ji.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};os.beforeinput=(t,e)=>{var n,r;if(e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return T0(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let i;if(Fe.chrome&&Fe.android&&(i=Fk.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.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&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ji.compositionend(t,e),20),!1};const qb=new Set;function e7(t){qb.has(t)||(qb.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Ub=["pre-wrap","normal","pre-line","break-spaces"];let $a=!1;function Wb(){$a=!1}class t7{constructor(e){this.lineWrapping=e,this.doc=tn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ub.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let l=Ub.indexOf(e)>-1,a=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u<o.length;u++){let f=o[u];f<0?u++:this.heightSamples[Math.floor(f*10)]=!0}}return a}}class n7{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Ts{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Wr.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 Xo?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ts(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Dn=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Dn||(Dn={}));const ph=.001;class Jr{constructor(e,n,r=2){this.length=e,this.height=n,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)>ph&&($a=!0),this.height=e)}replace(e,n,r){return Jr.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:f,toB:h}=i[l],d=s.lineAt(a,Dn.ByPosNoHeight,r.setDoc(n),0,0),p=d.to>=u?d:s.lineAt(u,Dn.ByPosNoHeight,r,0,0);for(h+=p.to-u,u=p.to;l>0&&d.from<=i[l-1].toA;)a=i[l-1].fromA,f=i[l-1].fromB,l--,a<d.from&&(d=s.lineAt(a,Dn.ByPosNoHeight,r,0,0));f+=d.from-a,a=d.from;let g=M0.build(r.setDoc(o),e,f,h);s=ed(s,s.replace(a,u,g))}return s.updateHeight(r,0)}static empty(){return new di(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i<s){let l=e[n++];l&&(i+=l.size)}else{let l=e[--r];l&&(s+=l.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new r7(Jr.of(e.slice(0,n)),o,Jr.of(e.slice(r)))}}function ed(t,e){return t==e?t:(t.constructor!=e.constructor&&($a=!0),e)}Jr.prototype.size=1;class Kk extends Jr{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,i){return new Ts(i,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,i,s){return this.blockAt(0,r,i,s)}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class di extends Kk{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new Ts(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof di||i instanceof yr&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof yr?i=new di(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Jr.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&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:""})`}}class yr extends Jr{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),f=n.doc.lineAt(u),h=l+f.length*a,d=Math.max(r,e-h/2);return new Ts(f.from,f.length,d,h,0)}else{let u=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:f,length:h}=n.doc.line(s+u);return new Ts(f,h,r+l*u,l,0)}}lineAt(e,n,r,i,s){if(n==Dn.ByHeight)return this.blockAt(e,r,i,s);if(n==Dn.ByPosNoHeight){let{from:p,to:g}=r.doc.lineAt(e);return new Ts(p,g-p,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),u=r.doc.lineAt(e),f=l+u.length*a,h=u.number-o,d=i+l*h+a*(u.from-s-h);return new Ts(u.from,u.length,Math.max(i,Math.min(d,i+this.height-f)),f,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(r,s);for(let f=e,h=i;f<=n;){let d=r.doc.lineAt(f);if(f==e){let g=d.number-l;h+=a*g+u*(e-s-g)}let p=a+u*d.length;o(new Ts(d.from,d.length,h,p,0)),h+=p,f=d.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof yr?r[r.length-1]=new yr(s.length+i):r.push(null,new yr(i-1))}if(e>0){let s=r[0];s instanceof yr?r[0]=new yr(e+s.length):r.unshift(new yr(e-1),null)}return Jr.of(r)}decomposeLeft(e,n){n.push(new yr(e-1),null)}decomposeRight(e,n){n.push(null,new yr(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new yr(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let h=i.heights[i.index++];a==-1?a=h:Math.abs(h-a)>=ph&&(a=-2);let d=new di(f,h);d.outdated=!1,o.push(d),l+=f+1}l<=s&&o.push(null,new yr(s-l).updateHeight(e,l));let u=Jr.of(o);return(a<0||Math.abs(u.height-this.height)>=ph||Math.abs(a-this.heightMetrics(e,n).perLine)>=ph)&&($a=!0),ed(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class r7 extends Jr{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,l=s+this.left.length+this.break,a=n==Dn.ByHeight?e<o:e<l,u=a?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,l);if(this.break||(a?u.to<l:u.from>l))return u;let f=n==Dn.ByPosNoHeight?Dn.ByPosNoHeight:Dn.ByPos;return a?u.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,n,r,i,s,o),n>=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,Dn.ByPos,r,i,s);e<u.from&&this.left.forEachLine(e,u.from-1,r,i,s,o),u.to>=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&Jb(s,o-1),n<this.length){let l=s.length;this.decomposeRight(n,s),Jb(s,l)}return Jr.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Jr.of(this.break?[e,null,n]:[e,n]):(this.left=ed(this.left,e),this.right=ed(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Jb(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof yr&&(r=t[e+1])instanceof yr&&t.splice(e-1,3,new yr(n.length+1+r.length))}const i7=5;class M0{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof di?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new di(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new Kk(o,i,r)):(o||s||i>=i7)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,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 di(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new yr(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof di)return e;let n=new di(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof di)&&!this.isCovered?this.nodes.push(new di(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof di&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new M0(r,e);return Ut.spans(n,r,i,s,0),s.finish(r)}}function s7(t,e,n){let r=new o7;return Ut.compare(t,e,n,r,0),r.changes}class o7{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&hh(e,n,this.changes,5)}}function l7(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(i.innerHeight,n.bottom);for(let u=t.parentNode;u&&u!=r.body;)if(u.nodeType==1){let f=u,h=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&h.overflow!="visible"){let d=f.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),a=Math.min(u==t.parentNode?i.innerHeight:a,d.bottom)}u=h.position=="absolute"||h.position=="fixed"?f.offsetParent:f.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function a7(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function c7(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class gg{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return ft.replace({widget:new u7(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class u7 extends sl{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Kb{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Gb,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=In.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(O0).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new t7(n),this.stateDeco=e.facet(Au).filter(r=>typeof r!="function"),this.heightMap=Jr.empty().applyChanges(this.stateDeco,tn.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ft.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Df(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Gb:new R0(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(Uc(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Au).filter(f=>typeof f!="function");let i=e.changedRanges,s=Mi.extendWithRanges(i,s7(r,this.stateDeco,e?e.changes:er.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Wb(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||$a)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<a.from||n.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Tk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?In.RTL:In.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,f=0;if(l.width&&l.height){let{scaleX:C,scaleY:w}=nk(n,l);(C>.005&&Math.abs(this.scaleX-C)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=C,this.scaleY=w,u|=16,o=a=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=sk(e.scrollDOM);let g=(this.printing?c7:l7)(n,this.paddingTop),m=g.top-this.pixelViewport.top,v=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!a7(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let C=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(C)&&(o=!0),o||i.lineWrapping&&Math.abs(S-this.contentDOMWidth)>i.charWidth){let{lineHeight:w,charWidth:E,textHeight:A}=e.docView.measureTextSize();o=w>0&&i.refresh(s,w,E,A,S/E,C),o&&(e.docView.minWidth=0,u|=16)}m>0&&v>0?f=Math.max(m,v):m<0&&v<0&&(f=Math.min(m,v)),Wb();for(let w of this.viewports){let E=w.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?Jr.empty().applyChanges(this.stateDeco,tn.empty,this.heightOracle,[new Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new n7(w.from,E))}$a&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Df(i.lineAt(o-r*1e3,Dn.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Dn.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(u<a.from||u>a.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(u,Dn.ByPos,s,0,0),d;n.y=="center"?d=(h.top+h.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&u<a.from?d=h.top:d=h.bottom-f,a=new Df(i.lineAt(d-1e3/2,Dn.ByHeight,s,0,0).from,i.lineAt(d+f+1e3/2,Dn.ByHeight,s,0,0).to)}}return a}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new Df(this.heightMap.lineAt(r,Dn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Dn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Dn.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Dn.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new gg(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=In.LTR&&!r)return[];let l=[],a=(f,h,d,p)=>{if(h-f<s)return;let g=this.state.selection.main,m=[g.from];g.empty||m.push(g.to);for(let y of m)if(y>f&&y<h){a(f,y-10,d,p),a(y+10,h,d,p);return}let v=h7(e,y=>y.from>=d.from&&y.to<=d.to&&Math.abs(y.from-f)<s&&Math.abs(y.to-h)<s&&!m.some(S=>y.from<S&&y.to>S));if(!v){if(h<d.to&&n&&r&&n.visibleRanges.some(k=>k.from<=h&&k.to>=h)){let k=n.moveToLineBoundary(pe.cursor(h),!1,!0).head;k>f&&(h=k)}let y=this.gapSize(d,f,h,p),S=r||y<2e6?y:2e6;v=new gg(f,h,y,S)}l.push(v)},u=f=>{if(f.length<o||f.type!=Wr.Text)return;let h=f7(f.from,f.to,this.stateDeco);if(h.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(r){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,y;if(d!=null){let S=Lf(h,d),k=((this.visibleBottom-this.visibleTop)/2+m)/f.height;v=S-k,y=S+k}else v=(this.visibleTop-f.top-m)/f.height,y=(this.visibleBottom-f.top+m)/f.height;p=If(h,v),g=If(h,y)}else{let m=h.total*this.heightOracle.charWidth,v=i*this.heightOracle.charWidth,y=0;if(m>2e6)for(let E of e)E.from>=f.from&&E.from<f.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=E.size-E.displaySize);let S=this.pixelViewport.left+y,k=this.pixelViewport.right+y,C,w;if(d!=null){let E=Lf(h,d),A=((k-S)/2+v)/m;C=E-A,w=E+A}else C=(S-v)/m,w=(k+v)/m;p=If(h,C),g=If(h,w)}p>f.from&&a(f.from,p,f,h),g<f.to&&a(g,f.to,f,h)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(u):u(f);return l}gapSize(e,n,r,i){let s=Lf(i,r)-Lf(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){gg.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ft.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Ut.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],l=r[s];(o.from!=l.from||o.to!=l.to)&&(i|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Uc(this.heightMap.lineAt(e,Dn.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(n=>n.top<=e&&n.bottom>=e)||Uc(this.heightMap.lineAt(this.scaler.fromDOM(e),Dn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Uc(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Df{constructor(e,n){this.from=e,this.to=n}}function f7(t,e,n){let r=[],i=t,s=0;return Ut.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function If({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function Lf(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function h7(t,e){for(let n of t)if(e(n))return n}const Gb={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class R0{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,Dn.ByPos,e,0,0).top,f=n.lineAt(a,Dn.ByPos,e,0,0).bottom;return i+=f-u,{from:l,to:a,top:u,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof R0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Uc(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ts(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Uc(i,e)):t._content)}const Nf=Ne.define({combine:t=>t.join(" ")}),Xm=Ne.define({combine:t=>t.indexOf(!0)>-1}),Qm=Ko.newName(),Gk=Ko.newName(),Xk=Ko.newName(),Qk={"&light":"."+Gk,"&dark":"."+Xk};function Ym(t,e,n){return new Ko(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const d7=Ym("."+Qm,{"&":{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":{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-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"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"}},Qk),p7={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},mg=Fe.ie&&Fe.ie_version<=11;class g7{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Qj,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(n=>{for(let r of n)this.queue.push(r);(Fe.ie&&Fe.ie_version<=11||Fe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new v7(e),e.state.facet(Qs)&&(e.contentDOM.editContext=this.editContext.editContext)),mg&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.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((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Qs)?r.root.activeElement!=this.dom:!fh(this.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&i.focusNode&&$c(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Cu(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&m7(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=fh(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Zj(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)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,p7),mg&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),mg&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&La(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<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 n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&fh(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new DB(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Bk(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=Xb(n,e.previousSibling||e.target.previousSibling,-1),i=Xb(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),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(Qs)!=e.state.facet(Qs)&&(e.view.contentDOM.editContext=e.state.facet(Qs)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Xb(t,e,n){for(;e;){let r=xn.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function Qb(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return $c(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function m7(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Qb(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Qb(t,n):null}class v7{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=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 i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u={from:l,to:a,insert:tn.of(r.text.split(`
|
|
79
|
-
`))};if(u.from==this.from&&s<this.from?u.from=s:u.to==this.to&&s>this.to&&(u.to=s),u.from==u.to&&!u.insert.length){let f=pe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));f.main.eq(i)||e.dispatch({selection:f,userEvent:"select"});return}if((Fe.mac||Fe.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:l,to:a,insert:tn.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let f=this.to-this.from+(u.to-u.from+u.insert.length);T0(e,u,pe.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a<u){let f=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;i.push(ft.mark({attributes:{style:f}}).range(a,u))}}}e.dispatch({effects:Rk.of(ft.set(i))})},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)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Cu(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,u)=>{if(r)return;let f=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=f,this.to+=f;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=f}n+=f}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ie{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 n;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&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Yj(e.parent)||document,this.viewState=new Kb(e.state||zt.create(e)),e.scrollTo&&e.scrollTo.is(Mf)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Vc).map(i=>new hg(i));for(let i of this.plugins)i.update(this);this.observer=new g7(this),this.inputState=new BB(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Eb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Mr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(d=>d.annotation(Uk))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Wk(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,f=null;if(u?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(zt.phrases)!=this.state.facet(zt.phrases))return this.setState(s);i=$h.create(this,s,e),i.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new Na(p.empty?p:pe.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Mf)&&(h=p.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=td.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Hc)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Nf)!=i.state.facet(Nf)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(Wm))try{d(i)}catch(p){qr(this.state,p,"update listener")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Bk(this,f)&&u.force&&La(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Kb(e),this.plugins=e.facet(Vc).map(r=>new hg(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Eb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Vc),r=e.state.facet(Vc);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new hg(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){qr(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 n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(sk(r))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let f=u.map(p=>{try{return p.read(this)}catch(g){return qr(this.state,g),Yb}}),h=$h.create(this,this.state,[]),d=!1;h.flags|=a,n?n.flags|=a:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h),d&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(f[p]!=Yb)try{let g=u[p];g.write&&g.write(f[p],this)}catch(g){qr(this.state,g)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(g>1||g<-1){i=i+g,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Wm))l(n)}get themeClasses(){return Qm+" "+(this.state.facet(Xm)?Xk:Gk)+" "+this.state.facet(Nf)}updateAttrs(){let e=Zb(this,Pk,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Qs)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Zb(this,O0,n);let r=this.observer.ignore(()=>{let i=zm(this.contentDOM,this.contentAttrs,n),s=zm(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(Ie.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Hc);let e=this.state.facet(Ie.cspNonce);Ko.mount(this.root,this.styleModules.concat(d7).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.spec!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return pg(this,e,Db(this,e,n,r))}moveByGroup(e,n){return pg(this,e,Db(this,e,n,r=>TB(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return pe.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return EB(this,e,n,r)}moveVertically(e,n,r){return pg(this,e,MB(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),jk(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Lo.find(s,e-i.from,-1,n)];return fp(r,o.dir==In.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ek)||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>y7)return xk(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||bk(s.isolates,r=_b(this,e))))return s.order;r||(r=_b(this,e));let i=hB(e.text,n,r);return this.bidiCache.push(new td(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{rk(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,n={}){return Mf.of(new Na(typeof e=="number"?pe.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Mf.of(new Na(pe.cursor(r.from),"start","start",r.top-e,n,!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 qn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return qn.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Ko.newName(),i=[Nf.of(r),Hc.of(Ym(`.${r}`,e))];return n&&n.dark&&i.push(Xm.of(!0)),i}static baseTheme(e){return Zl.lowest(Hc.of(Ym("."+Qm,e,Qk)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&xn.get(r)||xn.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}Ie.styleModule=Hc;Ie.inputHandler=Ok;Ie.clipboardInputFilter=k0;Ie.clipboardOutputFilter=A0;Ie.scrollHandler=Mk;Ie.focusChangeEffect=_k;Ie.perLineTextDirection=Ek;Ie.exceptionSink=Ak;Ie.updateListener=Wm;Ie.editable=Qs;Ie.mouseSelectionStyle=kk;Ie.dragMovesSelection=Ck;Ie.clickAddsSelectionRange=Sk;Ie.decorations=Au;Ie.outerDecorations=Dk;Ie.atomicRanges=_0;Ie.bidiIsolatedRanges=Ik;Ie.scrollMargins=Lk;Ie.darkTheme=Xm;Ie.cspNonce=Ne.define({combine:t=>t.length?t[0]:""});Ie.contentAttributes=O0;Ie.editorAttributes=Pk;Ie.lineWrapping=Ie.contentAttributes.of({class:"cm-lineWrapping"});Ie.announce=It.define();const y7=4096,Yb={};class td{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:In.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new td(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Zb(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&Fm(o,n)}return n}const b7=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function x7(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;a<n.length-1;++a){const u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))i=!0;else if(/^(c|ctrl|control)$/i.test(u))s=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+u)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),l&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function jf(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const w7=Zl.default(Ie.domEventHandlers({keydown(t,e){return Zk(Yk(e.state),t,e,"editor")}})),nd=Ne.define({enables:w7}),$b=new WeakMap;function Yk(t){let e=t.facet(nd),n=$b.get(e);return n||$b.set(e,n=k7(e.reduce((r,i)=>r.concat(i),[]))),n}function S7(t,e,n){return Zk(Yk(t.state),e,t,n)}let Mo=null;const C7=4e3;function k7(t,e=b7){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,f)=>{var h,d;let p=n[o]||(n[o]=Object.create(null)),g=l.split(/ (?!$)/).map(y=>x7(y,e));for(let y=1;y<g.length;y++){let S=g.slice(0,y).join(" ");i(S,!0),p[S]||(p[S]={preventDefault:!0,stopPropagation:!1,run:[k=>{let C=Mo={view:k,prefix:S,scope:o};return setTimeout(()=>{Mo==C&&(Mo=null)},C7),!0}]})}let m=g.join(" ");i(m,!1);let v=p[m]||(p[m]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});a&&v.run.push(a),u&&(v.preventDefault=!0),f&&(v.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let f=n[u]||(n[u]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let d in f)f[d].run.push(p=>h(p,Zm))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let Zm=null;function Zk(t,e,n,r){Zm=e;let i=Jj(e),s=Qr(i,0),o=Es(s)==i.length&&i!=" ",l="",a=!1,u=!1,f=!1;Mo&&Mo.view==n&&Mo.scope==r&&(l=Mo.prefix+" ",zk.indexOf(e.keyCode)<0&&(u=!0,Mo=null));let h=new Set,d=v=>{if(v){for(let y of v.run)if(!h.has(y)&&(h.add(y),y(n)))return v.stopPropagation&&(f=!0),!0;v.preventDefault&&(v.stopPropagation&&(f=!0),u=!0)}return!1},p=t[r],g,m;return p&&(d(p[l+jf(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&(g=Go[e.keyCode])&&g!=i?(d(p[l+jf(g,e,!0)])||e.shiftKey&&(m=Su[e.keyCode])!=i&&m!=g&&d(p[l+jf(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(p[l+jf(i,e,!0)])&&(a=!0),!a&&d(p._any)&&(a=!0)),u&&(a=!0),a&&f&&e.stopPropagation(),Zm=null,a}class rf{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=$k(e);return[new rf(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return A7(e,n,r)}}function $k(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==In.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function ex(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,l=t.posAtCoords({x:s.left+1,y:o}),a=t.posAtCoords({x:s.right-1,y:o});return l==null||a==null?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}function A7(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==In.LTR,o=t.contentDOM,l=o.getBoundingClientRect(),a=$k(t),u=o.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),h=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),d=l.right-(f?parseInt(f.paddingRight):0),p=Km(t,r,1),g=Km(t,i,-1),m=p.type==Wr.Text?p:null,v=g.type==Wr.Text?g:null;if(m&&(t.lineWrapping||p.widgetLineBreaks)&&(m=ex(t,r,1,m)),v&&(t.lineWrapping||g.widgetLineBreaks)&&(v=ex(t,i,-1,v)),m&&v&&m.from==v.from&&m.to==v.to)return S(k(n.from,n.to,m));{let w=m?k(n.from,null,m):C(p,!1),E=v?k(null,n.to,v):C(g,!0),A=[];return(m||p).to<(v||g).from-(m&&v?1:0)||p.widgetLineBreaks>1&&w.bottom+t.defaultLineHeight/2<E.top?A.push(y(h,w.bottom,d,E.top)):w.bottom<E.top&&t.elementAtHeight((w.bottom+E.top)/2).type==Wr.Text&&(w.bottom=E.top=(w.bottom+E.top)/2),S(w).concat(A).concat(S(E))}function y(w,E,A,O){return new rf(e,w-a.left,E-a.top,A-w,O-E)}function S({top:w,bottom:E,horizontal:A}){let O=[];for(let H=0;H<A.length;H+=2)O.push(y(A[H],w,A[H+1],E));return O}function k(w,E,A){let O=1e9,H=-1e9,W=[];function G(Q,Y,ie,F,X){let I=t.coordsAtPos(Q,Q==A.to?-2:2),se=t.coordsAtPos(ie,ie==A.from?2:-2);!I||!se||(O=Math.min(I.top,se.top,O),H=Math.max(I.bottom,se.bottom,H),X==In.LTR?W.push(s&&Y?h:I.left,s&&F?d:se.right):W.push(!s&&F?h:se.left,!s&&Y?d:I.right))}let V=w??A.from,U=E??A.to;for(let Q of t.visibleRanges)if(Q.to>V&&Q.from<U)for(let Y=Math.max(Q.from,V),ie=Math.min(Q.to,U);;){let F=t.state.doc.lineAt(Y);for(let X of t.bidiSpans(F)){let I=X.from+F.from,se=X.to+F.from;if(I>=ie)break;se>Y&&G(Math.max(I,Y),w==null&&I<=V,Math.min(se,ie),E==null&&se>=U,X.dir)}if(Y=F.to+1,Y>=ie)break}return W.length==0&&G(V,w==null,U,E==null,t.textDirection),{top:O,bottom:H,horizontal:W}}function C(w,E){let A=l.top+(E?w.top:w.bottom);return{top:A,bottom:A,horizontal:[]}}}function O7(t,e){return t.constructor==e.constructor&&t.eq(e)}class _7{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(gh)!=e.state.facet(gh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(gh);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!O7(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const gh=Ne.define();function eA(t){return[qn.define(e=>new _7(e,t)),gh.of(t)]}const Ou=Ne.define({combine(t){return cs(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function E7(t={}){return[Ou.of(t),T7,M7,R7,Tk.of(!0)]}function tA(t){return t.startState.facet(Ou)!=t.state.facet(Ou)}const T7=eA({above:!0,markers(t){let{state:e}=t,n=e.facet(Ou),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:pe.cursor(i.head,i.head>i.anchor?-1:1);for(let a of rf.forRange(t,o,l))r.push(a)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=tA(t);return n&&tx(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){tx(e.state,t)},class:"cm-cursorLayer"});function tx(t,e){e.style.animationDuration=t.facet(Ou).cursorBlinkRate+"ms"}const M7=eA({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:rf.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||tA(t)},class:"cm-selectionLayer"}),R7=Zl.highest(Ie.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),nA=It.define({map(t,e){return t==null?null:e.mapPos(t)}}),Wc=vr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(nA)?r.value:n,t)}}),P7=qn.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Wc);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Wc)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Wc),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Wc)!=t&&this.view.dispatch({effects:nA.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function D7(){return[Wc,P7]}function nx(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function I7(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class L7{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,a,u,f)=>i(f,u,u+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,u,f)=>{let h=r(l,a,u);h&&f(u,u+l[0].length,h)};else if(r)this.addMatch=(l,a,u,f)=>f(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new is,r=n.add.bind(n);for(let{from:i,to:s}of I7(e,this.maxLength))nx(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),i=Math.max(a,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),l=Math.min(s.to,i);if(l>o){let a=e.state.doc.lineAt(o),u=a.to<l?e.state.doc.lineAt(l):a,f=Math.max(s.from,a.from),h=Math.min(s.to,u.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){f=o;break}for(;l<u.to;l++)if(this.boundary.test(u.text[l-u.from])){h=l;break}}let d=[],p,g=(m,v,y)=>d.push(y.range(m,v));if(a==u)for(this.regexp.lastIndex=f-a.from;(p=this.regexp.exec(a.text))&&p.index<h-a.from;)this.addMatch(p,e,p.index+a.from,g);else nx(e.state.doc,this.regexp,f,h,(m,v)=>this.addMatch(v,e,m,g));n=n.update({filterFrom:f,filterTo:h,filter:(m,v)=>m<f||v>h,add:d})}}return n}}const $m=/x/.unicode!=null?"gu":"g",N7=new RegExp(`[\0-\b
|
|
80
|
-
--\u2028\u2029\uFEFF-]`,$m),j7={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let vg=null;function B7(){var t;if(vg==null&&typeof document<"u"&&document.body){let e=document.body.style;vg=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return vg||!1}const mh=Ne.define({combine(t){let e=cs(t,{render:null,specialChars:N7,addSpecialChars:null});return(e.replaceTabs=!B7())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,$m)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,$m)),e}});function F7(t={}){return[mh.of(t),z7()]}let rx=null;function z7(){return rx||(rx=qn.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(mh)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new L7({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=Qr(e[0],0);if(s==9){let o=i.lineAt(r),l=n.state.tabSize,a=yc(o.text,l,r-o.from);return ft.replace({widget:new U7((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ft.replace({widget:new q7(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(mh);t.startState.facet(mh)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const V7="•";function H7(t){return t>=32?V7:t==10?"":String.fromCharCode(9216+t)}class q7 extends sl{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=H7(this.code),r=e.state.phrase("Control character")+" "+(j7[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class U7 extends sl{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function W7(){return K7}const J7=ft.line({class:"cm-activeLine"}),K7=qn.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(J7.range(i.from)),e=i.from)}return ft.set(n)}},{decorations:t=>t.decorations}),ev=2e3;function G7(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>ev||n.off>ev||e.col<0||n.col<0){let o=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let a=r;a<=i;a++){let u=t.doc.line(a);u.length<=l&&s.push(pe.range(u.from+o,u.to+l))}}else{let o=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let a=r;a<=i;a++){let u=t.doc.line(a),f=Pm(u.text,o,t.tabSize,!0);if(f<0)s.push(pe.cursor(u.to));else{let h=Pm(u.text,l,t.tabSize);s.push(pe.range(u.from+f,u.from+h))}}}return s}function X7(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function ix(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>ev?-1:i==r.length?X7(t,e.clientX):yc(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Q7(t,e){let n=ix(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let l=ix(t,i);if(!l)return r;let a=G7(t.state,n,l);return a.length?o?pe.create(a.concat(r.ranges)):pe.create(a):r}}:null}function Y7(t){let e=n=>n.altKey&&n.button==0;return Ie.mouseSelectionStyle.of((n,r)=>e(r)?Q7(n,r):null)}const Z7={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},$7={style:"cursor: crosshair"};function eF(t={}){let[e,n]=Z7[t.key||"Alt"],r=qn.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,Ie.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?$7:null})]}const Ic="-10000px";class rA{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;a<s.length;a++){let u=s[a],f=-1;if(u){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==u.create&&(f=h)}if(f<0)o[a]=this.createTooltipView(u,a?o[a-1]:null),l&&(l[a]=!!u.above);else{let h=o[a]=this.tooltipViews[f];l&&(l[a]=n[f]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(r=a.destroy)===null||r===void 0||r.call(a));return n&&(l.forEach((a,u)=>n[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function tF(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const yg=Ne.define({combine:t=>{var e,n,r;return{position:Fe.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||tF}}}),sx=new WeakMap,P0=qn.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(yg);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new rA(t,pp,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(yg);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=Ic,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Fe.gecko)n=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==Ic&&s.style.left=="0px"){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=E0(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(yg).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:f}=u,h=t.pos[l],d=t.size[l];if(!h||a.clip!==!1&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){f.style.top=Ic;continue}let p=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,m=d.right-d.left,v=(e=sx.get(u))!==null&&e!==void 0?e:d.bottom-d.top,y=u.offset||rF,S=this.view.textDirection==In.LTR,k=d.width>r.right-r.left?S?r.left:r.right-d.width:S?Math.max(r.left,Math.min(h.left-(p?14:0)+y.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+(p?14:0)-y.x),r.right-m),C=this.above[l];!a.strictSide&&(C?h.top-v-g-y.y<r.top:h.bottom+v+g+y.y>r.bottom)&&C==r.bottom-h.bottom>h.top-r.top&&(C=this.above[l]=!C);let w=(C?h.top-r.top:r.bottom-h.bottom)-g;if(w<v&&u.resize!==!1){if(w<this.view.defaultLineHeight){f.style.top=Ic;continue}sx.set(u,v),f.style.height=(v=w)/s+"px"}else f.style.height&&(f.style.height="");let E=C?h.top-v-g-y.y:h.bottom+g+y.y,A=k+m;if(u.overlap!==!0)for(let O of o)O.left<A&&O.right>k&&O.top<E+v&&O.bottom>E&&(E=C?O.top-v-2-g:O.bottom+g+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/s+"px",ox(f,(k-t.parent.left)/i)):(f.style.top=E/s+"px",ox(f,k/i)),p){let O=h.left+(S?y.x:-y.x)-(k+14-7);p.style.left=O/i+"px"}u.overlap!==!0&&o.push({left:k,top:E,right:A,bottom:E+v}),f.classList.toggle("cm-tooltip-above",C),f.classList.toggle("cm-tooltip-below",!C),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Ic}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ox(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const nF=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"}}}),rF={x:0,y:0},pp=Ne.define({enables:[P0,nF]}),rd=Ne.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class gp{static create(e){return new gp(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new rA(e,rd,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const iF=pp.compute([rd],t=>{let e=t.facet(rd);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:gp.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class sF{constructor(e,n,r,i,s){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.nearest(n.target);if(!r)return;let i,s=1;if(r instanceof Io)i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let l=e.coordsAtPos(i);if(!l||n.y<l.top||n.y>l.bottom||n.x<l.left-e.defaultCharacterWidth||n.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(f=>f.from<=i&&f.to>=i),u=a&&a.dir==In.RTL?-1:1;s=n.x<l.left?-u:u}let o=this.source(e,i,s);if(o!=null&&o.then){let l=this.pending={pos:i};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>qr(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(P0),n=e?e.manager.tooltips.findIndex(r=>r.create==gp.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!oF(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lF(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Bf=4;function oF(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=n-Bf&&e.clientX<=r+Bf&&e.clientY>=i-Bf&&e.clientY<=s+Bf}function lF(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,l)<i)return!1;let a=t.posAtCoords({x:r,y:i},!1);return a>=e&&a<=n}function aF(t,e={}){let n=It.define(),r=vr.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,Hr.TrackDel);if(a!=null){let u=Object.assign(Object.create(null),l);u.pos=a,u.end!=null&&(u.end=s.changes.mapPos(u.end)),o.push(u)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(cF)&&(i=[]);return i},provide:i=>rd.from(i)});return{active:r,extension:[r,qn.define(i=>new sF(i,t,r,n,e.hoverTime||300)),iF]}}function iA(t,e){let n=t.plugin(P0);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const cF=It.define(),lx=Ne.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function _u(t,e){let n=t.plugin(sA),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const sA=qn.fromClass(class{constructor(t){this.input=t.state.facet(Eu),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(lx);this.top=new Ff(t,!0,e.topContainer),this.bottom=new Ff(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(lx);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ff(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ff(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Eu);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),f;u<0?(f=a(t.view),l.push(f)):(f=this.panels[u],f.update&&f.update(t)),i.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ie.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ff{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=ax(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=ax(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ax(t){let e=t.nextSibling;return t.remove(),e}const Eu=Ne.define({enables:sA});class zs extends Ul{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}zs.prototype.elementClass="";zs.prototype.toDOM=void 0;zs.prototype.mapMode=Hr.TrackBefore;zs.prototype.startSide=zs.prototype.endSide=-1;zs.prototype.point=!0;const vh=Ne.define(),uF=Ne.define(),fF={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ut.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},tu=Ne.define();function oA(t){return[lA(),tu.of(Object.assign(Object.assign({},fF),t))]}const cx=Ne.define({combine:t=>t.some(e=>e)});function lA(t){return[hF]}const hF=qn.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(tu).map(e=>new fx(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(cx),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(cx)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Ut.iter(this.view.state.facet(vh),this.view.viewport.from),r=[],i=this.gutters.map(s=>new dF(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Wr.Text&&o){tv(n,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==Wr.Text){tv(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(tu),n=t.state.facet(tu),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ut.eq(t.startState.facet(vh),t.state.facet(vh),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new fx(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Ie.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==In.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function ux(t){return Array.isArray(t)?t:[t]}function tv(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class dF{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ut.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let l=new aA(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];tv(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(uF)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class fx{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=ux(n.markers(e)),n.initialSpacer&&(this.spacer=new aA(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=ux(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!Ut.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class aA{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),pF(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<n.length?n[s++]:null,u=!1;if(a){let f=a.elementClass;f&&(r+=" "+f);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(a)){l=h,u=!0;break}}else l=this.markers.length;for(;o<l;){let f=this.markers[o++];if(f.toDOM){f.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!a)break;a.toDOM&&(u?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),u&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function pF(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const gF=Ne.define(),mF=Ne.define(),ka=Ne.define({combine(t){return cs(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(l,a,u)=>s(l,a,u)||o(l,a,u):o}return r}})}});class bg extends zs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function xg(t,e){return t.state.facet(ka).formatNumber(e,t.state)}const vF=tu.compute([ka],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(gF)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new bg(xg(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(mF)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(ka)!=e.state.facet(ka),initialSpacer(e){return new bg(xg(e,hx(e.state.doc.lines)))},updateSpacer(e,n){let r=xg(n.view,hx(n.view.state.doc.lines));return r==e.number?e:new bg(r)},domEventHandlers:t.facet(ka).domEventHandlers}));function yF(t={}){return[ka.of(t),lA(),vF]}function hx(t){let e=9;for(;e<t;)e=e*10+9;return e}const bF=new class extends zs{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},xF=vh.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(bF.range(i)))}return Ut.of(e)});function wF(){return xF}const cA=1024;let SF=0;class wg{constructor(e,n){this.from=e,this.to=n}}class Bt{constructor(e={}){this.id=SF++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ii.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Bt.closedBy=new Bt({deserialize:t=>t.split(" ")});Bt.openedBy=new Bt({deserialize:t=>t.split(" ")});Bt.group=new Bt({deserialize:t=>t.split(" ")});Bt.isolate=new Bt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Bt.contextHash=new Bt({perNode:!0});Bt.lookAhead=new Bt({perNode:!0});Bt.mounted=new Bt({perNode:!0});class id{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Bt.mounted.id]}}const CF=Object.create(null);class ii{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):CF,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new ii(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Bt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Bt.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}ii.none=new ii("",Object.create(null),0,8);class D0{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}n.push(i?new ii(r.name,i,r.id,r.flags):r)}return new D0(n)}}const zf=new WeakMap,dx=new WeakMap;var pr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(pr||(pr={}));class tr{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=id.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new rv(this.topNode,e)}cursorAt(e,n=0,r=0){let i=zf.get(this)||this.topNode,s=new rv(i);return s.moveTo(e,n),zf.set(this,s._tree),s}get topNode(){return new Ri(this,0,0,null)}resolve(e,n=0){let r=Tu(zf.get(this)||this.topNode,e,n,!1);return zf.set(this,r),r}resolveInner(e,n=0){let r=Tu(dx.get(this)||this.topNode,e,n,!0);return dx.set(this,r),r}resolveStack(e,n=0){return OF(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&pr.IncludeAnonymous)>0;for(let a=this.cursor(o|pr.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:N0(ii.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new tr(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new tr(ii.none,n,r,i)))}static build(e){return _F(e)}}tr.empty=new tr(ii.none,[],[],0);class I0{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new I0(this.buffer,this.index)}}class Qo{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ii.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.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,n,r,i,s){let{buffer:o}=this,l=-1;for(let a=e;a!=n&&!(uA(s,i,o[a+1],o[a+2])&&(l=a,r>0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l<n;){s[a++]=i[l++],s[a++]=i[l++]-r;let u=s[a++]=i[l++]-r;s[a++]=i[l++]-e,o=Math.max(o,u)}return new Qo(s,o,this.set)}}function uA(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Tu(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Ri&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:pr.IgnoreOverlays;if(r)for(let o=t,l=o.parent;l;o=l,l=o.parent)o instanceof Ri&&o.index<0&&((i=l.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=l);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class fA{cursor(e=0){return new rv(this,e)}getChild(e,n=null,r=null){let i=px(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return px(this,e,n,r)}resolve(e,n=0){return Tu(this,e,n,!1)}resolveInner(e,n=0){return Tu(this,e,n,!0)}matchContext(e){return nv(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Ri extends fA{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,u=n>0?l.length:-1;e!=u;e+=n){let f=l[e],h=a[e]+o.from;if(uA(i,r,h,h+f.length)){if(f instanceof Qo){if(s&pr.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,n,r-h,i);if(d>-1)return new No(new kF(o,f,e,h),null,d)}else if(s&pr.IncludeAnonymous||!f.type.isAnonymous||L0(f)){let d;if(!(s&pr.IgnoreMounts)&&(d=id.get(f))&&!d.overlay)return new Ri(d.tree,h,e,o);let p=new Ri(f,h,e,o);return s&pr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?f.children.length-1:0,n,r,i)}}}if(s&pr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&pr.IgnoreOverlays)&&(i=id.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((n>0?o<=s:o<s)&&(n<0?l>=s:l>s))return new Ri(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function px(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function nv(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class kF{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class No extends fA{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new No(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&pr.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new No(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new No(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new No(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new tr(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hA(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof Ri&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new AF(i,n)}class AF{constructor(e,n){this.heads=e,this.node=n}get next(){return hA(this.heads)}}function OF(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Ri?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=id.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Ri(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Tu(l,e,n,!1))}}return i?hA(i):r}class rv{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ri)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ri?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&pr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&pr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&pr.IncludeAnonymous||l instanceof Qo||!l.type.isAnonymous||L0(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new No(this.buffer,n,this.stack[i]);return this.bufferNode=new No(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return nv(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return nv(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function L0(t){return t.children.some(e=>e instanceof Qo||!e.type.isAnonymous||L0(e))}function _F(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=cA,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new I0(n,n.length):n,a=r.types,u=0,f=0;function h(w,E,A,O,H,W){let{id:G,start:V,end:U,size:Q}=l,Y=f,ie=u;for(;Q<0;)if(l.next(),Q==-1){let ce=s[G];A.push(ce),O.push(V-w);return}else if(Q==-3){u=G;return}else if(Q==-4){f=G;return}else throw new RangeError(`Unrecognized record size: ${Q}`);let F=a[G],X,I,se=V-w;if(U-V<=i&&(I=v(l.pos-E,H))){let ce=new Uint16Array(I.size-I.skip),Te=l.pos-I.size,le=ce.length;for(;l.pos>Te;)le=y(I.start,ce,le);X=new Qo(ce,U-I.start,r),se=I.start-w}else{let ce=l.pos-Q;l.next();let Te=[],le=[],de=G>=o?G:-1,ne=0,ue=U;for(;l.pos>ce;)de>=0&&l.id==de&&l.size>=0?(l.end<=ue-i&&(g(Te,le,V,ne,l.end,ue,de,Y,ie),ne=Te.length,ue=l.end),l.next()):W>2500?d(V,ce,Te,le):h(V,ce,Te,le,de,W+1);if(de>=0&&ne>0&&ne<Te.length&&g(Te,le,V,ne,V,ue,de,Y,ie),Te.reverse(),le.reverse(),de>-1&&ne>0){let ge=p(F,ie);X=N0(F,Te,le,0,Te.length,0,U-V,ge,ge)}else X=m(F,Te,le,U-V,Y-U,ie)}A.push(X),O.push(se)}function d(w,E,A,O){let H=[],W=0,G=-1;for(;l.pos>E;){let{id:V,start:U,end:Q,size:Y}=l;if(Y>4)l.next();else{if(G>-1&&U<G)break;G<0&&(G=Q-i),H.push(V,U,Q),W++,l.next()}}if(W){let V=new Uint16Array(W*4),U=H[H.length-2];for(let Q=H.length-3,Y=0;Q>=0;Q-=3)V[Y++]=H[Q],V[Y++]=H[Q+1]-U,V[Y++]=H[Q+2]-U,V[Y++]=Y;A.push(new Qo(V,H[2]-U,r)),O.push(U-w)}}function p(w,E){return(A,O,H)=>{let W=0,G=A.length-1,V,U;if(G>=0&&(V=A[G])instanceof tr){if(!G&&V.type==w&&V.length==H)return V;(U=V.prop(Bt.lookAhead))&&(W=O[G]+V.length+U)}return m(w,A,O,H,W,E)}}function g(w,E,A,O,H,W,G,V,U){let Q=[],Y=[];for(;w.length>O;)Q.push(w.pop()),Y.push(E.pop()+A-H);w.push(m(r.types[G],Q,Y,W-H,V-W,U)),E.push(H-A)}function m(w,E,A,O,H,W,G){if(W){let V=[Bt.contextHash,W];G=G?[V].concat(G):[V]}if(H>25){let V=[Bt.lookAhead,H];G=G?[V].concat(G):[V]}return new tr(w,E,A,O,G)}function v(w,E){let A=l.fork(),O=0,H=0,W=0,G=A.end-i,V={size:0,start:0,skip:0};e:for(let U=A.pos-w;A.pos>U;){let Q=A.size;if(A.id==E&&Q>=0){V.size=O,V.start=H,V.skip=W,W+=4,O+=4,A.next();continue}let Y=A.pos-Q;if(Q<0||Y<U||A.start<G)break;let ie=A.id>=o?4:0,F=A.start;for(A.next();A.pos>Y;){if(A.size<0)if(A.size==-3)ie+=4;else break e;else A.id>=o&&(ie+=4);A.next()}H=F,O+=Q,W+=ie}return(E<0||O==w)&&(V.size=O,V.start=H,V.skip=W),V.size>4?V:void 0}function y(w,E,A){let{id:O,start:H,end:W,size:G}=l;if(l.next(),G>=0&&O<o){let V=A;if(G>4){let U=l.pos-(G-4);for(;l.pos>U;)A=y(w,E,A)}E[--A]=V,E[--A]=W-w,E[--A]=H-w,E[--A]=O}else G==-3?u=O:G==-4&&(f=O);return A}let S=[],k=[];for(;l.pos>0;)h(t.start||0,t.bufferStart||0,S,k,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:S.length?k[0]+S[0].length:0;return new tr(a[t.topID],S.reverse(),k.reverse(),C)}const gx=new WeakMap;function yh(t,e){if(!t.isAnonymous||e instanceof Qo||e.type!=t)return 1;let n=gx.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof tr)){n=1;break}n+=yh(t,r)}gx.set(e,n)}return n}function N0(t,e,n,r,i,s,o,l,a){let u=0;for(let g=r;g<i;g++)u+=yh(t,e[g]);let f=Math.ceil(u*1.5/8),h=[],d=[];function p(g,m,v,y,S){for(let k=v;k<y;){let C=k,w=m[k],E=yh(t,g[k]);for(k++;k<y;k++){let A=yh(t,g[k]);if(E+A>=f)break;E+=A}if(k==C+1){if(E>f){let A=g[C];p(A.children,A.positions,0,A.children.length,m[C]+S);continue}h.push(g[C])}else{let A=m[k-1]+g[k-1].length-w;h.push(N0(t,g,m,C,k,w,A,null,a))}d.push(w+S-s)}}return p(e,n,r,i,0),(l||a)(h,d,o)}class Tl{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Tl(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let f=l<n.length?n[l]:null,h=f?f.fromA:1e9;if(h-a>=r)for(;o&&o.from<h;){let d=o;if(a>=d.from||h<=d.to||u){let p=Math.max(d.from,a)-u,g=Math.min(d.to,h)-u;d=p>=g?null:new Tl(p,g,d.tree,d.offset+u,l>0,!!f)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!f)break;a=f.toA,u=f.toA-f.toB}return i}}class dA{startParse(e,n,r){return typeof e=="string"&&(e=new EF(e)),r=r?r.length?r.map(i=>new wg(i.from,i.to)):[new wg(0,0)]:[new wg(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class EF{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Bt({perNode:!0});let TF=0;class Oi{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=TF++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Oi&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Oi(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new sd(e);return r=>r.modified.indexOf(n)>-1?r:sd.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let MF=0;class sd{constructor(e){this.name=e,this.instances=[],this.id=MF++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&RF(n,l.modified));if(r)return r;let i=[],s=new Oi(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=PF(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(sd.get(l,a));return s}}function RF(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function PF(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function pA(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let h=0;;){if(l=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);l=i.slice(h)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let f=new od(r,o,a>0?s.slice(0,a):null);e[u]=f.sort(e[u])}}return gA.add(e)}const gA=new Bt;class od{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}od.empty=new od([],2,null);function mA(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function DF(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function IF(t,e,n,r=0,i=t.length){let s=new LF(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class LF{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let u=i,f=NF(e)||od.empty,h=DF(s,f.tags);if(h&&(u&&(u+=" "),u+=h,f.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,l),u),f.opaque)return;let d=e.tree&&e.tree.prop(Bt.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+l,1),g=this.highlighters.filter(v=>!v.scope||v.scope(d.tree.type)),m=e.firstChild();for(let v=0,y=l;;v++){let S=v<d.overlay.length?d.overlay[v]:null,k=S?S.from+l:a,C=Math.max(n,y),w=Math.min(r,k);if(C<w&&m)for(;e.from<w&&(this.highlightRange(e,C,w,i,s),this.startSpan(Math.min(w,e.to),u),!(e.to>=k||!e.nextSibling())););if(!S||k>r)break;y=S.to+l,y>n&&(this.highlightRange(p.cursor(),Math.max(n,S.from+l),Math.min(r,y),"",g),this.startSpan(Math.min(r,y),u))}m&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function NF(t){let e=t.type.prop(gA);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Re=Oi.define,Vf=Re(),_o=Re(),mx=Re(_o),vx=Re(_o),Eo=Re(),Hf=Re(Eo),Sg=Re(Eo),ks=Re(),pl=Re(ks),Ss=Re(),Cs=Re(),iv=Re(),Lc=Re(iv),qf=Re(),_e={comment:Vf,lineComment:Re(Vf),blockComment:Re(Vf),docComment:Re(Vf),name:_o,variableName:Re(_o),typeName:mx,tagName:Re(mx),propertyName:vx,attributeName:Re(vx),className:Re(_o),labelName:Re(_o),namespace:Re(_o),macroName:Re(_o),literal:Eo,string:Hf,docString:Re(Hf),character:Re(Hf),attributeValue:Re(Hf),number:Sg,integer:Re(Sg),float:Re(Sg),bool:Re(Eo),regexp:Re(Eo),escape:Re(Eo),color:Re(Eo),url:Re(Eo),keyword:Ss,self:Re(Ss),null:Re(Ss),atom:Re(Ss),unit:Re(Ss),modifier:Re(Ss),operatorKeyword:Re(Ss),controlKeyword:Re(Ss),definitionKeyword:Re(Ss),moduleKeyword:Re(Ss),operator:Cs,derefOperator:Re(Cs),arithmeticOperator:Re(Cs),logicOperator:Re(Cs),bitwiseOperator:Re(Cs),compareOperator:Re(Cs),updateOperator:Re(Cs),definitionOperator:Re(Cs),typeOperator:Re(Cs),controlOperator:Re(Cs),punctuation:iv,separator:Re(iv),bracket:Lc,angleBracket:Re(Lc),squareBracket:Re(Lc),paren:Re(Lc),brace:Re(Lc),content:ks,heading:pl,heading1:Re(pl),heading2:Re(pl),heading3:Re(pl),heading4:Re(pl),heading5:Re(pl),heading6:Re(pl),contentSeparator:Re(ks),list:Re(ks),quote:Re(ks),emphasis:Re(ks),strong:Re(ks),link:Re(ks),monospace:Re(ks),strikethrough:Re(ks),inserted:Re(),deleted:Re(),changed:Re(),invalid:Re(),meta:qf,documentMeta:Re(qf),annotation:Re(qf),processingInstruction:Re(qf),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 t in _e){let e=_e[t];e instanceof Oi&&(e.name=t)}mA([{tag:_e.link,class:"tok-link"},{tag:_e.heading,class:"tok-heading"},{tag:_e.emphasis,class:"tok-emphasis"},{tag:_e.strong,class:"tok-strong"},{tag:_e.keyword,class:"tok-keyword"},{tag:_e.atom,class:"tok-atom"},{tag:_e.bool,class:"tok-bool"},{tag:_e.url,class:"tok-url"},{tag:_e.labelName,class:"tok-labelName"},{tag:_e.inserted,class:"tok-inserted"},{tag:_e.deleted,class:"tok-deleted"},{tag:_e.literal,class:"tok-literal"},{tag:_e.string,class:"tok-string"},{tag:_e.number,class:"tok-number"},{tag:[_e.regexp,_e.escape,_e.special(_e.string)],class:"tok-string2"},{tag:_e.variableName,class:"tok-variableName"},{tag:_e.local(_e.variableName),class:"tok-variableName tok-local"},{tag:_e.definition(_e.variableName),class:"tok-variableName tok-definition"},{tag:_e.special(_e.variableName),class:"tok-variableName2"},{tag:_e.definition(_e.propertyName),class:"tok-propertyName tok-definition"},{tag:_e.typeName,class:"tok-typeName"},{tag:_e.namespace,class:"tok-namespace"},{tag:_e.className,class:"tok-className"},{tag:_e.macroName,class:"tok-macroName"},{tag:_e.propertyName,class:"tok-propertyName"},{tag:_e.operator,class:"tok-operator"},{tag:_e.comment,class:"tok-comment"},{tag:_e.meta,class:"tok-meta"},{tag:_e.invalid,class:"tok-invalid"},{tag:_e.punctuation,class:"tok-punctuation"}]);var Cg;const Aa=new Bt;function jF(t){return Ne.define({combine:t?e=>e.concat(t):void 0})}const BF=new Bt;class Ki{constructor(e,n,r=[],i=""){this.data=e,this.name=i,zt.prototype.hasOwnProperty("tree")||Object.defineProperty(zt.prototype,"tree",{get(){return Ir(this)}}),this.parser=n,this.extension=[Yo.of(this),zt.languageData.of((s,o,l)=>{let a=yx(s,o,l),u=a.type.prop(Aa);if(!u)return[];let f=s.facet(u),h=a.type.prop(BF);if(h){let d=a.resolve(o-a.from,l);for(let p of h)if(p.test(d,s)){let g=s.facet(p.facet);return p.type=="replace"?g:g.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return yx(e,n,r).type.prop(Aa)==this.data}findRegions(e){let n=e.facet(Yo);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Aa)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Bt.mounted);if(l){if(l.tree.prop(Aa)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let u=s.children[a];u instanceof tr&&i(u,s.positions[a]+o)}};return i(Ir(e),0),r}get allowsNesting(){return!0}}Ki.setState=It.define();function yx(t,e,n){let r=t.facet(Yo),i=Ir(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,pr.ExcludeBuffers))s.type.isTop&&(i=s);return i}class ld extends Ki{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=jF(e.languageData);return new ld(n,e.parser.configure({props:[Aa.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new ld(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ir(t){let e=t.field(Ki.state,!1);return e?e.tree:tr.empty}class FF{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Nc=null;class ad{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new ad(e,n,[],tr.empty,0,r,[],null)}startParse(){return this.parser.startParse(new FF(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=tr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Tl.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Tl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Nc;Nc=this;try{return e()}finally{Nc=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=bx(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,f,h,d)=>a.push({fromA:u,toA:f,fromB:h,toB:d})),r=Tl.applyChanges(r,a),i=tr.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let f=e.mapPos(u.from,1),h=e.mapPos(u.to,-1);f<h&&l.push({from:f,to:h})}}}return new ad(this.parser,n,r,i,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=bx(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends dA{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Nc;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new tr(ii.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Nc}}function bx(t,e,n){return Tl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class ec{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new ec(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ad.create(e.facet(Yo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new ec(r)}}Ki.state=vr.define({create:ec.init,update(t,e){for(let n of e.effects)if(n.is(Ki.setState))return n.value;return e.startState.facet(Yo)!=e.state.facet(Yo)?ec.init(e.state):t.apply(e)}});let vA=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(vA=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const kg=typeof navigator<"u"&&(!((Cg=navigator.scheduling)===null||Cg===void 0)&&Cg.isInputPending)?()=>navigator.scheduling.isInputPending():null,zF=qn.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ki.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ki.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=vA(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Ki.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!kg?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>kg&&kg()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ki.setState.of(new ec(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>qr(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Yo=Ne.define({combine(t){return t.length?t[0]:null},enables:t=>[Ki.state,zF,Ie.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class VF{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const HF=Ne.define(),mp=Ne.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Zo(t){let e=t.facet(mp);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Mu(t,e){let n="",r=t.tabSize,i=t.facet(mp)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function j0(t,e){t instanceof zt&&(t=new vp(t));for(let r of t.state.facet(HF)){let i=r(t,e);if(i!==void 0)return i}let n=Ir(t.state);return n.length>=e?qF(t,n,e):null}class vp{constructor(e,n={}){this.state=e,this.options=n,this.unit=Zo(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return yc(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const yA=new Bt;function qF(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return bA(r,t,n)}function bA(t,e,n){for(let r=t;r;r=r.next){let i=WF(r.node);if(i)return i(B0.create(e,n,r))}return 0}function UF(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function WF(t){let e=t.type.prop(yA);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Bt.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>XF(o,!0,1,void 0,s&&!UF(o)?i.from:void 0)}return t.parent==null?JF:null}function JF(){return 0}class B0 extends vp{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new B0(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(KF(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return bA(this.context.next,this.base,this.pos)}}function KF(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function GF(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function XF(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==t.pos+o,a=GF(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function xx({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const QF=200;function YF(){return zt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+QF)return t;let s=n.sliceString(i.from,r);if(!e.some(u=>u.test(s)))return t;let{state:o}=t,l=-1,a=[];for(let{head:u}of o.selection.ranges){let f=o.doc.lineAt(u);if(f.from==l)continue;l=f.from;let h=j0(o,f.from);if(h==null)continue;let d=/^\s*/.exec(f.text)[0],p=Mu(o,h);d!=p&&a.push({from:f.from,to:f.from+d.length,insert:p})}return a.length?[t,{changes:a,sequential:!0}]:t})}const ZF=Ne.define(),xA=new Bt;function $F(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function ez(t,e,n){let r=Ir(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=n||l.from>n)continue;if(s&&l.from<e)break;let a=l.type.prop(xA);if(a&&(l.to<r.length-50||r.length==t.doc.length||!tz(l))){let u=a(l,t);u&&u.from<=n&&u.from>=e&&u.to>n&&(s=u)}}return s}function tz(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function cd(t,e,n){for(let r of t.facet(ZF)){let i=r(t,e,n);if(i)return i}return ez(t,e,n)}function wA(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const yp=It.define({map:wA}),sf=It.define({map:wA});function SA(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Gl=vr.define({create(){return ft.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(yp)&&!nz(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(AA),i=r?ft.replace({widget:new cz(r(e.state,n.value))}):wx;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(sf)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,s)=>{i<r&&s>r&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,s)=>s<=r||i>=r}))}return t},provide:t=>Ie.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(wx.range(r,i))}return ft.set(e,!0)}});function ud(t,e,n){var r;let i=null;return(r=t.field(Gl,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function nz(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function CA(t,e){return t.field(Gl,!1)?e:e.concat(It.appendConfig.of(OA()))}const rz=t=>{for(let e of SA(t)){let n=cd(t.state,e.from,e.to);if(n)return t.dispatch({effects:CA(t.state,[yp.of(n),kA(t,n)])}),!0}return!1},iz=t=>{if(!t.state.field(Gl,!1))return!1;let e=[];for(let n of SA(t)){let r=ud(t.state,n.from,n.to);r&&e.push(sf.of(r),kA(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function kA(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return Ie.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const sz=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=cd(e,i.from,i.to);s&&n.push(yp.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:CA(t.state,n)}),!!n.length},oz=t=>{let e=t.state.field(Gl,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(sf.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},lz=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:rz},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:iz},{key:"Ctrl-Alt-[",run:sz},{key:"Ctrl-Alt-]",run:oz}],az={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},AA=Ne.define({combine(t){return cs(t,az)}});function OA(t){return[Gl,hz]}function _A(t,e){let{state:n}=t,r=n.facet(AA),i=o=>{let l=t.lineBlockAt(t.posAtDOM(o.target)),a=ud(t.state,l.from,l.to);a&&t.dispatch({effects:sf.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const wx=ft.replace({widget:new class extends sl{toDOM(t){return _A(t,null)}}});class cz extends sl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return _A(e,this.value)}}const uz={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Ag extends zs{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function fz(t={}){let e=Object.assign(Object.assign({},uz),t),n=new Ag(e,!0),r=new Ag(e,!1),i=qn.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Yo)!=o.state.facet(Yo)||o.startState.field(Gl,!1)!=o.state.field(Gl,!1)||Ir(o.startState)!=Ir(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new is;for(let a of o.viewportLineBlocks){let u=ud(o.state,a.from,a.to)?r:cd(o.state,a.from,a.to)?n:null;u&&l.add(a.from,a.from,u)}return l.finish()}}),{domEventHandlers:s}=e;return[i,oA({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||Ut.empty},initialSpacer(){return new Ag(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let u=ud(o.state,l.from,l.to);if(u)return o.dispatch({effects:sf.of(u)}),!0;let f=cd(o.state,l.from,l.to);return f?(o.dispatch({effects:yp.of(f)}),!0):!1}})}),OA()]}const hz=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"}});class of{constructor(e,n){this.specs=e;let r;function i(l){let a=Ko.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Ki?l=>l.prop(Aa)==o.data:o?l=>l==o:void 0,this.style=mA(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Ko(r):null,this.themeType=n.themeType}static define(e,n){return new of(e,n||{})}}const sv=Ne.define(),EA=Ne.define({combine(t){return t.length?[t[0]]:null}});function Og(t){let e=t.facet(sv);return e.length?e:t.facet(EA)}function TA(t,e){let n=[pz],r;return t instanceof of&&(t.module&&n.push(Ie.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(EA.of(t)):r?n.push(sv.computeN([Ie.darkTheme],i=>i.facet(Ie.darkTheme)==(r=="dark")?[t]:[])):n.push(sv.of(t)),n}class dz{constructor(e){this.markCache=Object.create(null),this.tree=Ir(e.state),this.decorations=this.buildDeco(e,Og(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ir(e.state),r=Og(e.state),i=r!=Og(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return ft.none;let r=new is;for(let{from:i,to:s}of e.visibleRanges)IF(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=ft.mark({class:a})))},i,s);return r.finish()}}const pz=Zl.high(qn.fromClass(dz,{decorations:t=>t.decorations})),gz=of.define([{tag:_e.meta,color:"#404740"},{tag:_e.link,textDecoration:"underline"},{tag:_e.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_e.emphasis,fontStyle:"italic"},{tag:_e.strong,fontWeight:"bold"},{tag:_e.strikethrough,textDecoration:"line-through"},{tag:_e.keyword,color:"#708"},{tag:[_e.atom,_e.bool,_e.url,_e.contentSeparator,_e.labelName],color:"#219"},{tag:[_e.literal,_e.inserted],color:"#164"},{tag:[_e.string,_e.deleted],color:"#a11"},{tag:[_e.regexp,_e.escape,_e.special(_e.string)],color:"#e40"},{tag:_e.definition(_e.variableName),color:"#00f"},{tag:_e.local(_e.variableName),color:"#30a"},{tag:[_e.typeName,_e.namespace],color:"#085"},{tag:_e.className,color:"#167"},{tag:[_e.special(_e.variableName),_e.macroName],color:"#256"},{tag:_e.definition(_e.propertyName),color:"#00c"},{tag:_e.comment,color:"#940"},{tag:_e.invalid,color:"#f00"}]),mz=Ie.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),MA=1e4,RA="()[]{}",PA=Ne.define({combine(t){return cs(t,{afterCursor:!0,brackets:RA,maxScanDistance:MA,renderMatch:bz})}}),vz=ft.mark({class:"cm-matchingBracket"}),yz=ft.mark({class:"cm-nonmatchingBracket"});function bz(t){let e=[],n=t.matched?vz:yz;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const xz=vr.define({create(){return ft.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(PA);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=Ms(e.state,i.head,-1,r)||i.head>0&&Ms(e.state,i.head-1,1,r)||r.afterCursor&&(Ms(e.state,i.head,1,r)||i.head<e.state.doc.length&&Ms(e.state,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,e.state)))}return ft.set(n,!0)},provide:t=>Ie.decorations.from(t)}),wz=[xz,mz];function Sz(t={}){return[PA.of(t),wz]}const Cz=new Bt;function ov(t,e,n){let r=t.prop(e<0?Bt.openedBy:Bt.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function lv(t){let e=t.type.prop(Cz);return e?e(t.node):t}function Ms(t,e,n,r={}){let i=r.maxScanDistance||MA,s=r.brackets||RA,o=Ir(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=ov(a.type,n,s);if(u&&a.from<a.to){let f=lv(a);if(f&&(n>0?e>=f.from&&e<f.to:e>f.from&&e<=f.to))return kz(t,e,n,a,f,u,s)}}return Az(t,e,n,o,l.type,i,s)}function kz(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},u=0,f=l==null?void 0:l.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(u==0&&s.indexOf(f.type.name)>-1&&f.from<f.to){let h=lv(f);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(ov(f.type,n,o))u++;else if(ov(f.type,-n,o)){if(u==0){let h=lv(f);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}u--}}while(n<0?f.prevSibling():f.nextSibling());return{start:a,matched:!1}}function Az(t,e,n,r,i,s,o){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),h=0;for(let d=0;!f.next().done&&d<=s;){let p=f.value;n<0&&(d+=p.length);let g=e+d*n;for(let m=n>0?0:p.length-1,v=n>0?p.length:-1;m!=v;m+=n){let y=o.indexOf(p[m]);if(!(y<0||r.resolveInner(g+m,1).type!=i))if(y%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:g+m,to:g+m+1},matched:y>>1==a>>1};h--}}n>0&&(d+=p.length)}return f.done?{start:u,matched:!1}:null}const Oz=Object.create(null),Sx=[ii.none],Cx=[],kx=Object.create(null),_z=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])_z[t]=Ez(Oz,e);function _g(t,e){Cx.indexOf(t)>-1||(Cx.push(t),console.warn(e))}function Ez(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let f=t[u]||_e[u];f?typeof f=="function"?a.length?a=a.map(f):_g(u,`Modifier ${u} used at start of tag`):a.length?_g(u,`Tag ${u} used as modifier`):a=Array.isArray(f)?f:[f]:_g(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=kx[i];if(s)return s.id;let o=kx[i]=ii.define({id:Sx.length,name:r,props:[pA({[r]:n})]});return Sx.push(o),o.id}In.RTL,In.LTR;const Tz=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=z0(t.state,n.from);return r.line?Mz(t):r.block?Pz(t):!1};function F0(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Mz=F0(Lz,0),Rz=F0(DA,0),Pz=F0((t,e)=>DA(t,e,Iz(e)),0);function z0(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const jc=50;function Dz(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-jc,r),o=t.sliceDoc(i,i+jc),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let f,h;i-r<=2*jc?f=h=t.sliceDoc(r,i):(f=t.sliceDoc(r,r+jc),h=t.sliceDoc(i-jc,i));let d=/^\s*/.exec(f)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return f.slice(d,d+e.length)==e&&h.slice(g,g+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(f.charAt(d+e.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function Iz(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function DA(t,e,n=e.selection.ranges){let r=n.map(s=>z0(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>Dz(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;o<i.length;o++)if(l=i[o]){let a=r[o],{open:u,close:f}=l;s.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:f.pos-f.margin,to:f.pos+a.close.length})}return{changes:s}}return null}function Lz(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of n){let l=r.length,a=1e9,u=z0(e,s).line;if(u){for(let f=s;f<=o;){let h=e.doc.lineAt(f);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,g=h.text.slice(d,d+u.length)==u?d:-1;d<h.text.length&&d<a&&(a=d),r.push({line:h,comment:g,token:u,indent:d,empty:p,single:!1})}f=h.to+1}if(a<1e9)for(let f=l;f<r.length;f++)r[f].indent<r[f].line.text.length&&(r[f].indent=a);r.length==l+1&&(r[l].single=!0)}}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:f,single:h}of r)(h||!f)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,f=u+a.length;o.text[f-o.from]==" "&&f++,s.push({from:u,to:f})}return{changes:s}}return null}function bc(t,e){return pe.create(t.ranges.map(e),t.mainIndex)}function Hs(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function us({state:t,dispatch:e},n){let r=bc(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Hs(t,r)),!0)}function bp(t,e){return pe.cursor(e?t.to:t.from)}function IA(t,e){return us(t,n=>n.empty?t.moveByChar(n,e):bp(n,e))}function Lr(t){return t.textDirectionAt(t.state.selection.main.head)==In.LTR}const LA=t=>IA(t,!Lr(t)),NA=t=>IA(t,Lr(t));function jA(t,e){return us(t,n=>n.empty?t.moveByGroup(n,e):bp(n,e))}const Nz=t=>jA(t,!Lr(t)),jz=t=>jA(t,Lr(t));function Bz(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function xp(t,e,n){let r=Ir(t).resolveInner(e.head),i=n?Bt.closedBy:Bt.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;Bz(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?Ms(t,r.from,1):Ms(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,pe.cursor(l,n?-1:1)}const Fz=t=>us(t,e=>xp(t.state,e,!Lr(t))),zz=t=>us(t,e=>xp(t.state,e,Lr(t)));function BA(t,e){return us(t,n=>{if(!n.empty)return bp(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const FA=t=>BA(t,!1),zA=t=>BA(t,!0);function VA(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(Ie.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function HA(t,e){let n=VA(t),{state:r}=t,i=bc(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):bp(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottom<u&&(s=Ie.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-a}))}return t.dispatch(Hs(r,i),{effects:s}),!0}const Ax=t=>HA(t,!1),av=t=>HA(t,!0);function ol(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=pe.cursor(r.from+s))}return i}const Vz=t=>us(t,e=>ol(t,e,!0)),Hz=t=>us(t,e=>ol(t,e,!1)),qz=t=>us(t,e=>ol(t,e,!Lr(t))),Uz=t=>us(t,e=>ol(t,e,Lr(t))),Wz=t=>us(t,e=>pe.cursor(t.lineBlockAt(e.head).from,1)),Jz=t=>us(t,e=>pe.cursor(t.lineBlockAt(e.head).to,-1));function Kz(t,e,n){let r=!1,i=bc(t.selection,s=>{let o=Ms(t,s.head,-1)||Ms(t,s.head,1)||s.head>0&&Ms(t,s.head-1,1)||s.head<t.doc.length&&Ms(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return pe.cursor(l)});return r?(e(Hs(t,i)),!0):!1}const Gz=({state:t,dispatch:e})=>Kz(t,e);function Fi(t,e){let n=bc(t.state.selection,r=>{let i=e(r);return pe.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Hs(t.state,n)),!0)}function qA(t,e){return Fi(t,n=>t.moveByChar(n,e))}const UA=t=>qA(t,!Lr(t)),WA=t=>qA(t,Lr(t));function JA(t,e){return Fi(t,n=>t.moveByGroup(n,e))}const Xz=t=>JA(t,!Lr(t)),Qz=t=>JA(t,Lr(t)),Yz=t=>Fi(t,e=>xp(t.state,e,!Lr(t))),Zz=t=>Fi(t,e=>xp(t.state,e,Lr(t)));function KA(t,e){return Fi(t,n=>t.moveVertically(n,e))}const GA=t=>KA(t,!1),XA=t=>KA(t,!0);function QA(t,e){return Fi(t,n=>t.moveVertically(n,e,VA(t).height))}const Ox=t=>QA(t,!1),_x=t=>QA(t,!0),$z=t=>Fi(t,e=>ol(t,e,!0)),eV=t=>Fi(t,e=>ol(t,e,!1)),tV=t=>Fi(t,e=>ol(t,e,!Lr(t))),nV=t=>Fi(t,e=>ol(t,e,Lr(t))),rV=t=>Fi(t,e=>pe.cursor(t.lineBlockAt(e.head).from)),iV=t=>Fi(t,e=>pe.cursor(t.lineBlockAt(e.head).to)),Ex=({state:t,dispatch:e})=>(e(Hs(t,{anchor:0})),!0),Tx=({state:t,dispatch:e})=>(e(Hs(t,{anchor:t.doc.length})),!0),Mx=({state:t,dispatch:e})=>(e(Hs(t,{anchor:t.selection.main.anchor,head:0})),!0),Rx=({state:t,dispatch:e})=>(e(Hs(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),sV=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),oV=({state:t,dispatch:e})=>{let n=wp(t).map(({from:r,to:i})=>pe.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:pe.create(n),userEvent:"select"})),!0},lV=({state:t,dispatch:e})=>{let n=bc(t.selection,r=>{let i=Ir(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return pe.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(Hs(t,n)),!0)},aV=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=pe.create([n.main]):n.main.empty||(r=pe.create([pe.cursor(n.main.head)])),r?(e(Hs(t,r)),!0):!1};function lf(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(n="delete.backward",a=Uf(t,a,!1)):a>o&&(n="delete.forward",a=Uf(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Uf(t,o,!1),l=Uf(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:pe.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Ie.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Uf(t,e,n){if(t instanceof Ie)for(let r of t.state.facet(Ie.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const YA=(t,e,n)=>lf(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),l,a;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(l[l.length-1]==" ")return i-1;let u=yc(l,s.tabSize),f=u%Zo(s)||Zo(s);for(let h=0;h<f&&l[l.length-1-h]==" ";h++)i--;a=i}else a=Sr(o.text,i-o.from,e,e)+o.from,a==i&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,i-o.from))&&(a=Sr(o.text,a-o.from,!1,!1)+o.from);return a}),cv=t=>YA(t,!1,!0),ZA=t=>YA(t,!0,!1),$A=(t,e)=>lf(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=Sr(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(u);if(l!=null&&f!=l)break;(u!=" "||r!=n.head)&&(l=f),r=a}return r}),eO=t=>$A(t,!1),cV=t=>$A(t,!0),uV=t=>lf(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),fV=t=>lf(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),hV=t=>lf(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),dV=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:tn.of(["",""])},range:pe.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},pV=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:Sr(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:Sr(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:pe.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function wp(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function tO(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of wp(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(pe.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(pe.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:pe.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const gV=({state:t,dispatch:e})=>tO(t,e,!1),mV=({state:t,dispatch:e})=>tO(t,e,!0);function nO(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of wp(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vV=({state:t,dispatch:e})=>nO(t,e,!1),yV=({state:t,dispatch:e})=>nO(t,e,!0),bV=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(wp(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=bc(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function xV(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ir(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Bt.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const Px=rO(!1),wV=rO(!0);function rO(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&xV(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new vp(e,{simulateBreak:s,simulateDoubleBreak:!!a}),f=j0(u,s);for(f==null&&(f=yc(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",Mu(e,f)];return a&&h.push(Mu(e,u.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:tn.of(h)},range:pe.cursor(s+1+h[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function V0(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:pe.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const SV=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new vp(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=V0(t,(s,o,l)=>{let a=j0(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],f=Mu(t,a);(u!=f||l.from<s.from+u.length)&&(n[s.from]=a,o.push({from:s.from,to:s.from+u.length,insert:f}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},iO=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(V0(t,(n,r)=>{r.push({from:n.from,insert:t.facet(mp)})}),{userEvent:"input.indent"})),!0),sO=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(V0(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=yc(i,t.tabSize),o=0,l=Mu(t,Math.max(0,s-Zo(t)));for(;o<i.length&&o<l.length&&i.charCodeAt(o)==l.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),CV=t=>(t.setTabFocusMode(),!0),kV=[{key:"Ctrl-b",run:LA,shift:UA,preventDefault:!0},{key:"Ctrl-f",run:NA,shift:WA},{key:"Ctrl-p",run:FA,shift:GA},{key:"Ctrl-n",run:zA,shift:XA},{key:"Ctrl-a",run:Wz,shift:rV},{key:"Ctrl-e",run:Jz,shift:iV},{key:"Ctrl-d",run:ZA},{key:"Ctrl-h",run:cv},{key:"Ctrl-k",run:uV},{key:"Ctrl-Alt-h",run:eO},{key:"Ctrl-o",run:dV},{key:"Ctrl-t",run:pV},{key:"Ctrl-v",run:av}],AV=[{key:"ArrowLeft",run:LA,shift:UA,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Nz,shift:Xz,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:qz,shift:tV,preventDefault:!0},{key:"ArrowRight",run:NA,shift:WA,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:jz,shift:Qz,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Uz,shift:nV,preventDefault:!0},{key:"ArrowUp",run:FA,shift:GA,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ex,shift:Mx},{mac:"Ctrl-ArrowUp",run:Ax,shift:Ox},{key:"ArrowDown",run:zA,shift:XA,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Tx,shift:Rx},{mac:"Ctrl-ArrowDown",run:av,shift:_x},{key:"PageUp",run:Ax,shift:Ox},{key:"PageDown",run:av,shift:_x},{key:"Home",run:Hz,shift:eV,preventDefault:!0},{key:"Mod-Home",run:Ex,shift:Mx},{key:"End",run:Vz,shift:$z,preventDefault:!0},{key:"Mod-End",run:Tx,shift:Rx},{key:"Enter",run:Px,shift:Px},{key:"Mod-a",run:sV},{key:"Backspace",run:cv,shift:cv},{key:"Delete",run:ZA},{key:"Mod-Backspace",mac:"Alt-Backspace",run:eO},{key:"Mod-Delete",mac:"Alt-Delete",run:cV},{mac:"Mod-Backspace",run:fV},{mac:"Mod-Delete",run:hV}].concat(kV.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),OV=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Fz,shift:Yz},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:zz,shift:Zz},{key:"Alt-ArrowUp",run:gV},{key:"Shift-Alt-ArrowUp",run:vV},{key:"Alt-ArrowDown",run:mV},{key:"Shift-Alt-ArrowDown",run:yV},{key:"Escape",run:aV},{key:"Mod-Enter",run:wV},{key:"Alt-l",mac:"Ctrl-l",run:oV},{key:"Mod-i",run:lV,preventDefault:!0},{key:"Mod-[",run:sO},{key:"Mod-]",run:iO},{key:"Mod-Alt-\\",run:SV},{key:"Shift-Mod-k",run:bV},{key:"Shift-Mod-\\",run:Gz},{key:"Mod-/",run:Tz},{key:"Alt-A",run:Rz},{key:"Ctrl-m",mac:"Shift-Alt-m",run:CV}].concat(AV),_V={key:"Tab",run:iO,shift:sO};function vn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)oO(t,arguments[e]);return t}function oO(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)oO(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}class Dx{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class xl{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Rs).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((f,h)=>f.from-h.from||f.to-h.to),o=new is,l=[],a=0;for(let f=0;;){let h=f==s.length?null:s[f];if(!h&&!l.length)break;let d,p;for(l.length?(d=a,p=l.reduce((m,v)=>Math.min(m,v.to),h&&h.from>d?h.from:1e8)):(d=h.from,p=h.to,l.push(h),f++);f<s.length;){let m=s[f];if(m.from==d&&(m.to>m.from||m.to==d))l.push(m),f++,p=Math.min(m.to,p);else{p=Math.min(m.from,p);break}}let g=dO(l);if(l.some(m=>m.from==m.to||m.from==m.to-1&&r.doc.lineAt(m.from).to==m.from))o.add(d,d,ft.widget({widget:new jV(g),diagnostics:l.slice()}));else{let m=l.reduce((v,y)=>y.markClass?v+" "+y.markClass:v,"");o.add(d,p,ft.mark({class:"cm-lintRange cm-lintRange-"+g+m,diagnostics:l.slice(),inclusiveEnd:l.some(v=>v.to>p)}))}a=p;for(let m=0;m<l.length;m++)l[m].to<=a&&l.splice(m--,1)}let u=o.finish();return new xl(u,n,tc(u))}}function tc(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Dx(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Dx(r.from,s,r.diagnostic)}}),r}function lO(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Rs).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(Sp))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function aO(t,e){return t.field(vi,!1)?e:e.concat(It.appendConfig.of(mO))}function EV(t,e){return{effects:aO(t,[Sp.of(e)])}}const Sp=It.define(),H0=It.define(),cO=It.define(),vi=vr.define({create(){return new xl(ft.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=tc(n,t.selected.diagnostic,s)||tc(n,null,s)}!n.size&&i&&e.state.facet(Rs).autoPanel&&(i=null),t=new xl(n,i,r)}for(let n of e.effects)if(n.is(Sp)){let r=e.state.facet(Rs).autoPanel?n.value.length?Ru.open:null:t.panel;t=xl.init(n.value,r,e.state)}else n.is(H0)?t=new xl(t.diagnostics,n.value?Ru.open:null,t.selected):n.is(cO)&&(t=new xl(t.diagnostics,t.panel,n.value));return t},provide:t=>[Eu.from(t,e=>e.panel),Ie.decorations.from(t,e=>e.diagnostics)]}),TV=ft.mark({class:"cm-lintRange cm-lintRange-active"});function MV(t,e,n){let{diagnostics:r}=t.state.field(vi),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:f})=>{if(e>=a&&e<=u&&(a==u||(e>a||n>0)&&(e<u||n<0)))return i=f.diagnostics,s=a,o=u,!1});let l=t.state.facet(Rs).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:uO(t,i)}}}:null}function uO(t,e){return vn("ul",{class:"cm-tooltip-lint"},e.map(n=>hO(t,n,!1)))}const RV=t=>{let e=t.state.field(vi,!1);(!e||!e.panel)&&t.dispatch({effects:aO(t.state,[H0.of(!0)])});let n=_u(t,Ru.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Ix=t=>{let e=t.state.field(vi,!1);return!e||!e.panel?!1:(t.dispatch({effects:H0.of(!1)}),!0)},PV=t=>{let e=t.state.field(vi,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},DV=[{key:"Mod-Shift-m",run:RV,preventDefault:!0},{key:"F8",run:PV}],IV=qn.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(Rs);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(Rs);n.length&&LV(n.map(r=>Promise.resolve(r(this.view))),r=>{this.view.state.doc==e.doc&&this.view.dispatch(EV(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{qr(this.view.state,r)})}}update(t){let e=t.state.facet(Rs);(t.docChanged||e!=t.startState.facet(Rs)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function LV(t,e,n){let r=[],i=-1;for(let s of t)s.then(o=>{r.push(o),clearTimeout(i),r.length==t.length?e(r):i=setTimeout(()=>e(r),200)},n)}const Rs=Ne.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},cs(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function NV(t,e={}){return[Rs.of({source:t,config:e}),IV,mO]}function fO(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function hO(t,e,n){var r;let i=n?fO(e.actions):[];return vn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},vn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=tc(t.state.field(vi).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:u}=s,f=i[o]?u.indexOf(i[o]):-1,h=f<0?u:[u.slice(0,f),vn("u",u.slice(f,f+1)),u.slice(f+1)];return vn("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${u}${f<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&vn("div",{class:"cm-diagnosticSource"},e.source))}class jV extends sl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return vn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Lx{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=hO(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ru{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Ix(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=fO(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=tc(this.view.state.field(vi).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=vn("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=vn("div",{class:"cm-panel-lint"},this.list,vn("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Ix(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(vi).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(vi),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:u})=>{for(let f of u.diagnostics){if(o.has(f))continue;o.add(f);let h=-1,d;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==f){h=p;break}h<0?(d=new Lx(this.view,f),this.items.splice(r,0,d),i=!0):(d=this.items[h],h>r&&(this.items.splice(r,h-r),i=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),s=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Lx(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let u=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/u:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(vi),r=tc(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:cO.of(r)})}static open(e){return new Ru(e)}}function bh(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Wf(t){return bh(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const BV=Ie.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Wf("#d11")},".cm-lintRange-warning":{backgroundImage:Wf("orange")},".cm-lintRange-info":{backgroundImage:Wf("#999")},".cm-lintRange-hint":{backgroundImage:Wf("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function FV(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function dO(t){let e="hint",n=1;for(let r of t){let i=FV(r.severity);i>n&&(n=i,e=r.severity)}return e}class pO extends zs{constructor(e){super(),this.diagnostics=e,this.severity=dO(e)}toDOM(e){let n=document.createElement("div");n.className="cm-lint-marker cm-lint-marker-"+this.severity;let r=this.diagnostics,i=e.state.facet(Cp).tooltipFilter;return i&&(r=i(r,e.state)),r.length&&(n.onmouseover=()=>VV(e,n,r)),n}}function zV(t,e){let n=r=>{let i=e.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let s=r.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",n),t.state.field(gO)&&t.dispatch({effects:q0.of(null)})}};window.addEventListener("mousemove",n)}function VV(t,e,n){function r(){let o=t.elementAtHeight(e.getBoundingClientRect().top+5-t.documentTop);t.coordsAtPos(o.from)&&t.dispatch({effects:q0.of({pos:o.from,above:!1,clip:!1,create(){return{dom:uO(t,n),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,zV(t,e)}let{hoverTime:i}=t.state.facet(Cp),s=setTimeout(r,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(r,i)}}function HV(t,e){let n=Object.create(null);for(let i of e){let s=t.lineAt(i.from);(n[s.from]||(n[s.from]=[])).push(i)}let r=[];for(let i in n)r.push(new pO(n[i]).range(+i));return Ut.of(r,!0)}const qV=oA({class:"cm-gutter-lint",markers:t=>t.state.field(uv),widgetMarker:(t,e,n)=>{let r=[];return t.state.field(uv).between(n.from,n.to,(i,s,o)=>{i>n.from&&i<n.to&&r.push(...o.diagnostics)}),r.length?new pO(r):null}}),uv=vr.define({create(){return Ut.empty},update(t,e){t=t.map(e.changes);let n=e.state.facet(Cp).markerFilter;for(let r of e.effects)if(r.is(Sp)){let i=r.value;n&&(i=n(i||[],e.state)),t=HV(e.state.doc,i.slice(0))}return t}}),q0=It.define(),gO=vr.define({create(){return null},update(t,e){return t&&e.docChanged&&(t=lO(e,t)?null:Object.assign(Object.assign({},t),{pos:e.changes.mapPos(t.pos)})),e.effects.reduce((n,r)=>r.is(q0)?r.value:n,t)},provide:t=>pp.from(t)}),UV=Ie.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:bh('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:bh('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:bh('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),mO=[vi,Ie.decorations.compute([vi],t=>{let{selected:e,panel:n}=t.field(vi);return!e||!n||e.from==e.to?ft.none:ft.set([TV.range(e.from,e.to)])}),aF(MV,{hideOn:lO}),BV],Cp=Ne.define({combine(t){return cs(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function WV(t={}){return[Cp.of(t),uv,qV,UV,gO]}var Nx={};class fd{constructor(e,n,r,i,s,o,l,a,u,f=0,h){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=f,this.parent=h}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new fd(e,[],n,r,r,0,[],0,i?new jx(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let l=s.dynamicPrecedence(i);if(l&&(this.score+=l),r==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(r-1)*3-(e&262144?6:0),u=a?this.stack[a-2]:this.p.ranges[0].from,f=this.reducePos-u;f>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=f));let h=a?this.stack[a-1]:0,d=this.bufferBase+this.buffer.length-h;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,u,p,d+4,!0)}if(e&262144)this.state=this.stack[a];else{let p=this.stack[a-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(n==r)return;if(o.buffer[l-2]>=n){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new fd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new JV(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<n.length;s+=2)(o=n[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(n[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<n.length;s+=2){let o=n[s+1];i.some((l,a)=>a&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let s=n[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}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 n=new jx(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class jx{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class JV{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class hd{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new hd(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new hd(this.stack,this.pos,this.index)}}function Jf(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let s=0;for(;;){let o=t.charCodeAt(r++),l=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class xh{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Bx=new xh;class KV{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Bx,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;n<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=r;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>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,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=Bx,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,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class ja{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;GV(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}ja.prototype.contextual=ja.prototype.fallback=ja.prototype.extend=!1;ja.prototype.fallback=ja.prototype.extend=!1;function GV(t,e,n,r,i,s){let o=0,l=1<<r,{dialect:a}=n.p.parser;e:for(;(l&t[o])!=0;){let u=t[o+1];for(let p=o+3;p<u;p+=2)if((t[p+1]&l)>0){let g=t[p];if(a.allows(g)&&(e.token.value==-1||e.token.value==g||XV(g,e.token.value,i,s))){e.acceptToken(g);break}}let f=e.next,h=0,d=t[o+2];if(e.next<0&&d>h&&t[u+d*3-3]==65535){o=t[u+d*3-1];continue e}for(;h<d;){let p=h+d>>1,g=u+p+(p<<1),m=t[g],v=t[g+1]||65536;if(f<m)d=p;else if(f>=v)h=p+1;else{o=t[g+2],e.advance();continue e}}break}}function Fx(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function XV(t,e,n,r){let i=Fx(n,r,e);return i<0||Fx(n,r,t)<i}const ui=typeof process<"u"&&Nx&&/\bparse\b/.test(Nx.LOG);let Eg=null;function zx(t,e,n){let r=t.cursor(pr.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class QV{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?zx(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?zx(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 n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[n]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof tr){if(o==e){if(o<this.safeFrom)return null;let l=o+s.length;if(l<=this.safeTo){let a=s.prop(Bt.lookAhead);if(!a||l+a<this.fragment.to)return s}}this.index[n]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class YV{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new xh)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;u<s.length;u++){if((1<<u&o)==0)continue;let f=s[u],h=this.tokens[u];if(!(r&&!f.fallback)&&((f.contextual||h.start!=e.pos||h.mask!=o||h.context!=l)&&(this.updateCachedToken(h,f,e),h.mask=o,h.context=l),h.lookAhead>h.end+25&&(a=Math.max(h.lookAhead,a)),h.value!=0)){let d=n;if(h.extended>-1&&(n=this.addActions(e,h.extended,h.end,n)),n=this.addActions(e,h.value,h.end,n),!f.extend&&(r=h,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new xh,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new xh,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let l=s.specializers[o](this.stream.read(e.start,e.end),r);if(l>=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:s}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let u=o.stateSlot(s,a?2:1);;u+=3){if(l[u]==65535)if(l[u+1]==1)u=Gs(l,u+2);else{i==0&&l[u+1]==2&&(i=this.putAction(Gs(l,u+2),n,r,i));break}l[u]==n&&(i=this.putAction(Gs(l,u+1),n,r,i))}return i}}class ZV{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new KV(n,i),this.tokens=new YV(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[fd.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new QV(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>n)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&eH(i);if(o)return ui&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ui&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return ui&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let l=r[o];for(let a=o+1;a<r.length;a++){let u=r[a];if(l.sameState(u)||l.buffer.length>500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<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,n,r){let i=e.pos,{parser:s}=this,o=ui?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,f=u?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!u||(h.prop(Bt.contextHash)||0)==f))return e.useNode(h,d),ui&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof tr)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof tr&&h.positions[0]==0)h=p;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ui&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;u<a.length;){let f=a[u++],h=a[u++],d=a[u++],p=u==a.length||!r,g=p?e:e.split(),m=this.tokens.mainToken;if(g.apply(f,h,m?m.start:g.pos,d),ui&&console.log(o+this.stackID(g)+` (via ${(f&65536)==0?"shift":`reduce of ${s.getName(f&65535)}`} for ${s.getName(h)} @ ${i}${g==e?"":", split"})`),p)return!0;g.pos>i?n.push(g):r.push(g)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return Vx(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let l=e[o],a=n[o<<1],u=n[(o<<1)+1],f=ui?this.stackID(l)+" -> ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ui&&console.log(f+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let h=l.split(),d=f;for(let p=0;h.forceReduce()&&p<10&&(ui&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,r));p++)ui&&(d=this.stackID(h)+" -> ");for(let p of l.recoverByInsert(a))ui&&console.log(f+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),ui&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Vx(l,r)):(!i||i.score<l.score)&&(i=l)}return i}stackToTree(e){return e.close(),tr.build({buffer:hd.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 n=(Eg||(Eg=new WeakMap)).get(e);return n||Eg.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function Vx(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class $V{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class dd extends dA{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;l<e.repeatNodeCount;l++)n.push("");let r=Object.keys(e.topRules).map(l=>e.topRules[l][1]),i=[];for(let l=0;l<n.length;l++)i.push([]);function s(l,a,u){i[l].push([a,a.deserialize(String(u))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=Bt[a]);for(let u=1;u<l.length;){let f=l[u++];if(f>=0)s(f,a,l[u++]);else{let h=l[u+-f];for(let d=-f;d>0;d--)s(l[u++],a,h);u++}}}this.nodeSet=new D0(n.map((l,a)=>ii.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=cA;let o=Jf(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(Hx),this.states=Jf(e.states,Uint32Array),this.data=Jf(e.stateData),this.goto=Jf(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new ja(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new ZV(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s<u;s++)if(i[s]==e)return a;if(l)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Gs(r,s+2)];else{if(r[s+1]==2)return Gs(r,s+2);break}if(o==n||o==0)return Gs(r,s+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Gs(this.data,s+2);else break;i=n(Gs(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Gs(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(dd.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=Hx(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<n.length;s++)if(!r[s])for(let o=this.dialects[n[s]],l;(l=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[l]=1;return new $V(e,r,i)}static deserialize(e){return new dd(e)}}function Gs(t,e){return t[e]|t[e+1]<<16}function eH(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function Hx(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const tH=pA({String:_e.string,Number:_e.number,"True False":_e.bool,PropertyName:_e.propertyName,Null:_e.null,", :":_e.separator,"[ ]":_e.squareBracket,"{ }":_e.brace}),nH=dd.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:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[tH],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}),rH=ld.define({name:"json",parser:nH.configure({props:[yA.add({Object:xx({except:/^\s*\}/}),Array:xx({except:/^\s*\]/})}),xA.add({"Object Array":$F})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function iH(){return new VF(rH)}const qx=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class nc{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(qx(l)):qx,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Qr(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=y0(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Es(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==r&&s<n.length&&n.charCodeAt(s)==l&&o++}}}match(e,n,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:n,to:r}:this.matches.push(1,n)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(nc.prototype[Symbol.iterator]=function(){return this});const vO={from:-1,to:-1,match:/.*/.exec("")},U0="gm"+(/x/.unicode==null?"":"u");class yO{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=vO,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new bO(e,n,r,i,s);this.re=new RegExp(n,U0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=pd(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=pd(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Tg=new WeakMap;class Ba{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=Tg.get(e);if(!i||i.from>=r||i.to<=n){let l=new Ba(n,e.sliceString(n,r));return Tg.set(e,l),l}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),Tg.set(e,new Ba(o,s)),new Ba(n,s.slice(n-o,r-o))}}class bO{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=vO,this.matchPos=pd(e,i),this.re=new RegExp(n,U0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Ba.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=pd(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ba.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(yO.prototype[Symbol.iterator]=bO.prototype[Symbol.iterator]=function(){return this});function sH(t){try{return new RegExp(t,U0),!0}catch{return!1}}function pd(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function fv(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=vn("input",{class:"cm-textfield",name:"line",value:e}),r=vn("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:nu.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},vn("label",t.state.phrase("Go to line"),": ",n)," ",vn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),vn("button",{name:"close",onclick:()=>{t.dispatch({effects:nu.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,l=o.doc.lineAt(o.selection.main.head),[,a,u,f,h]=s,d=f?+f.slice(1):0,p=u?+u:l.number;if(u&&h){let v=p/100;a&&(v=v*(a=="-"?-1:1)+l.number/o.doc.lines),p=Math.round(o.doc.lines*v)}else u&&a&&(p=p*(a=="-"?-1:1)+l.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),m=pe.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[nu.of(!1),Ie.scrollIntoView(m.from,{y:"center"})],selection:m}),t.focus()}return{dom:r}}const nu=It.define(),Ux=vr.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(nu)&&(t=n.value);return t},provide:t=>Eu.from(t,e=>e?fv:null)}),oH=t=>{let e=_u(t,fv);if(!e){let n=[nu.of(!0)];t.state.field(Ux,!1)==null&&n.push(It.appendConfig.of([Ux,lH])),t.dispatch({effects:n}),e=_u(t,fv)}return e&&e.dom.querySelector("input").select(),!0},lH=Ie.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),aH={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},cH=Ne.define({combine(t){return cs(t,aH,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function uH(t){return[gH,pH]}const fH=ft.mark({class:"cm-selectionMatch"}),hH=ft.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wx(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Bn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Bn.Word)}function dH(t,e,n,r){return t(e.sliceDoc(n,n+1))==Bn.Word&&t(e.sliceDoc(r-1,r))==Bn.Word}const pH=qn.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(cH),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ft.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return ft.none;let a=n.wordAt(i.head);if(!a)return ft.none;o=n.charCategorizer(i.head),s=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return ft.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Wx(o,n,i.from,i.to)&&dH(o,n,i.from,i.to)))return ft.none}else if(s=n.sliceDoc(i.from,i.to),!s)return ft.none}let l=[];for(let a of t.visibleRanges){let u=new nc(n.doc,s,a.from,a.to);for(;!u.next().done;){let{from:f,to:h}=u.value;if((!o||Wx(o,n,f,h))&&(i.empty&&f<=i.from&&h>=i.to?l.push(hH.range(f,h)):(f>=i.to||h<=i.from)&&l.push(fH.range(f,h)),l.length>e.maxMatches))return ft.none}}return ft.set(l)}},{decorations:t=>t.decorations}),gH=Ie.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),mH=({state:t,dispatch:e})=>{let{selection:n}=t,r=pe.create(n.ranges.map(i=>t.wordAt(i.head)||pe.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function vH(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,l=new nc(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new nc(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const yH=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return mH({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=vH(t,r);return i?(e(t.update({selection:t.selection.addRange(pe.range(i.from,i.to),!1),effects:Ie.scrollIntoView(i.to)})),!0):!1},$l=Ne.define({combine(t){return cs(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new RH(e),scrollToMatch:e=>Ie.scrollIntoView(e)})}});function bH(t){return t?[$l.of(t),dv]:dv}class xO{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||sH(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
81
|
-
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new CH(this):new wH(this)}getCursor(e,n=0,r){let i=e.doc?e:zt.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?ya(this,i,n,r):va(this,i,n,r)}}class wO{constructor(e){this.spec=e}}function va(t,e,n,r){return new nc(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?xH(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function xH(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(gd(i,n-s))!=Bn.Word||e(md(i,n-s))!=Bn.Word)&&(e(md(i,r-s))!=Bn.Word||e(gd(i,r-s))!=Bn.Word))}class wH extends wO{constructor(e){super(e)}nextMatch(e,n,r){let i=va(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=va(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=va(this.spec,e,s,i),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=va(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=va(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ya(t,e,n,r){return new yO(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?SH(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function gd(t,e){return t.slice(Sr(t,e,!1),e)}function md(t,e){return t.slice(e,Sr(t,e))}function SH(t){return(e,n,r)=>!r[0].length||(t(gd(r.input,r.index))!=Bn.Word||t(md(r.input,r.index))!=Bn.Word)&&(t(md(r.input,r.index+r[0].length))!=Bn.Word||t(gd(r.input,r.index+r[0].length))!=Bn.Word)}class CH extends wO{nextMatch(e,n,r){let i=ya(this.spec,e,r,e.doc.length).next();return i.done&&(i=ya(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=ya(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return n})}matchAll(e,n){let r=ya(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=ya(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Pu=It.define(),W0=It.define(),zo=vr.define({create(t){return new Mg(hv(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Pu)?t=new Mg(n.value.create(),t.panel):n.is(W0)&&(t=new Mg(t.query,n.value?J0:null));return t},provide:t=>Eu.from(t,e=>e.panel)});class Mg{constructor(e,n){this.query=e,this.panel=n}}const kH=ft.mark({class:"cm-searchMatch"}),AH=ft.mark({class:"cm-searchMatch cm-searchMatch-selected"}),OH=qn.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(zo))}update(t){let e=t.state.field(zo);(e!=t.startState.field(zo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ft.none;let{view:n}=this,r=new is;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:l,to:a}=s[i];for(;i<o-1&&a>s[i+1].from-2*250;)a=s[++i].to;t.highlight(n.state,l,a,(u,f)=>{let h=n.state.selection.ranges.some(d=>d.from==u&&d.to==f);r.add(u,f,h?AH:kH)})}return r.finish()}},{decorations:t=>t.decorations});function af(t){return e=>{let n=e.state.field(zo,!1);return n&&n.query.spec.valid?t(e,n):K0(e)}}const vd=af((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=pe.single(r.from,r.to),s=t.state.facet($l);return t.dispatch({selection:i,effects:[X0(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),CO(t),!0}),yd=af((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=pe.single(i.from,i.to),o=t.state.facet($l);return t.dispatch({selection:s,effects:[X0(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),CO(t),!0}),_H=af((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:pe.create(n.map(r=>pe.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),EH=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let l=new nc(t.doc,t.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(pe.range(l.value.from,l.value.to))}return e(t.update({selection:pe.create(s,o),userEvent:"select.search.matches"})),!0},Jx=af((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,l=[],a,u,f=[];if(o.from==r&&o.to==i&&(u=n.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(n,o.from,o.to),f.push(Ie.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),o){let h=l.length==0||l[0].from>=s.to?0:s.to-s.from-u.length;a=pe.single(o.from-h,o.to-h),f.push(X0(t,o)),f.push(n.facet($l).scrollToMatch(a.main,t))}return t.dispatch({changes:l,selection:a,effects:f,userEvent:"input.replace"}),!0}),TH=af((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ie.announce.of(r),userEvent:"input.replace.all"}),!0});function J0(t){return t.state.facet($l).createPanel(t)}function hv(t,e){var n,r,i,s,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let u=t.facet($l);return new xO({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function SO(t){let e=_u(t,J0);return e&&e.dom.querySelector("[main-field]")}function CO(t){let e=SO(t);e&&e==t.root.activeElement&&e.select()}const K0=t=>{let e=t.state.field(zo,!1);if(e&&e.panel){let n=SO(t);if(n&&n!=t.root.activeElement){let r=hv(t.state,e.query.spec);r.valid&&t.dispatch({effects:Pu.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[W0.of(!0),e?Pu.of(hv(t.state,e.query.spec)):It.appendConfig.of(dv)]});return!0},G0=t=>{let e=t.state.field(zo,!1);if(!e||!e.panel)return!1;let n=_u(t,J0);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:W0.of(!1)}),!0},MH=[{key:"Mod-f",run:K0,scope:"editor search-panel"},{key:"F3",run:vd,shift:yd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:vd,shift:yd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:G0,scope:"editor search-panel"},{key:"Mod-Shift-l",run:EH},{key:"Mod-Alt-g",run:oH},{key:"Mod-d",run:yH,preventDefault:!0}];class RH{constructor(e){this.view=e;let n=this.query=e.state.field(zo).query.spec;this.commit=this.commit.bind(this),this.searchField=vn("input",{value:n.search,placeholder:fi(e,"Find"),"aria-label":fi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=vn("input",{value:n.replace,placeholder:fi(e,"Replace"),"aria-label":fi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=vn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=vn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=vn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return vn("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=vn("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>vd(e),[fi(e,"next")]),r("prev",()=>yd(e),[fi(e,"previous")]),r("select",()=>_H(e),[fi(e,"all")]),vn("label",null,[this.caseField,fi(e,"match case")]),vn("label",null,[this.reField,fi(e,"regexp")]),vn("label",null,[this.wordField,fi(e,"by word")]),...e.state.readOnly?[]:[vn("br"),this.replaceField,r("replace",()=>Jx(e),[fi(e,"replace")]),r("replaceAll",()=>TH(e),[fi(e,"replace all")])],vn("button",{name:"close",onclick:()=>G0(e),"aria-label":fi(e,"close"),type:"button"},["×"])])}commit(){let e=new xO({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Pu.of(e)}))}keydown(e){S7(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?yd:vd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Jx(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Pu)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet($l).top}}function fi(t,e){return t.state.phrase(e)}const Kf=30,Gf=/[\s\.,:;?!]/;function X0(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-Kf),o=Math.min(i,n+Kf),l=t.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;a<Kf;a++)if(!Gf.test(l[a+1])&&Gf.test(l[a])){l=l.slice(a);break}}if(o!=i){for(let a=l.length-1;a>l.length-Kf;a--)if(!Gf.test(l[a-1])&&Gf.test(l[a])){l=l.slice(0,a);break}}return Ie.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const PH=Ie.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),dv=[zo,Zl.low(OH),PH];class kO{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Ir(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(AO(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Kx(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function DH(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=Kx(e)+Kx(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function IH(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:DH(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class Gx{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Ml(t){return t.selection.main.from}function AO(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const OO=il.define();function LH(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return Object.assign(Object.assign({},t.changeByRange(l=>{if(l!=i&&n!=r&&t.sliceDoc(l.from+s,l.from+o)!=t.sliceDoc(n,r))return{range:l};let a=t.toText(e);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:a},range:pe.cursor(l.from+s+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const Xx=new WeakMap;function NH(t){if(!Array.isArray(t))return t;let e=Xx.get(t);return e||Xx.set(t,e=IH(t)),e}const bd=It.define(),Du=It.define();class jH{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=Qr(e,n),i=Es(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(Qr(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let S=Qr(e,0),k=Es(S),C=k==e.length?0:-100;if(S!=n[0])if(S==r[0])C+=-200;else return null;return this.ret(C,[0,k])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,u=0;if(l<0){for(let S=0,k=Math.min(e.length,200);S<k&&u<a;){let C=Qr(e,S);(C==n[u]||C==r[u])&&(i[u++]=S),S+=Es(C)}if(u<a)return null}let f=0,h=0,d=!1,p=0,g=-1,m=-1,v=/[a-z]/.test(e),y=!0;for(let S=0,k=Math.min(e.length,200),C=0;S<k&&h<a;){let w=Qr(e,S);l<0&&(f<a&&w==n[f]&&(s[f++]=S),p<a&&(w==n[p]||w==r[p]?(p==0&&(g=S),m=S+1,p++):p=0));let E,A=w<255?w>=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(E=y0(w))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!S||A==1&&v||C==0&&A!=0)&&(n[h]==w||r[h]==w&&(d=!0)?o[h++]=S:o.length&&(y=!1)),C=A,S+=Es(w)}return h==a&&o[0]==0&&y?this.result(-100+(d?-200:0),o,e):p==a&&g==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):p==a?this.ret(-900-e.length,[g,m]):h==a?this.result(-100+(d?-200:0)+-700+(y?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let l=o+(this.astral?Es(Qr(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}class BH{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const gr=Ne.define({combine(t){return cs(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:FH,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>Qx(e(r),n(r)),optionClass:(e,n)=>r=>Qx(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Qx(t,e){return t?e?t+" "+e:t:e}function FH(t,e,n,r,i,s){let o=t.textDirection==In.RTL,l=o,a=!1,u="top",f,h,d=e.left-i.left,p=i.right-e.right,g=r.right-r.left,m=r.bottom-r.top;if(l&&d<Math.min(g,p)?l=!1:!l&&p<Math.min(g,d)&&(l=!0),g<=(l?d:p))f=Math.max(i.top,Math.min(n.top,i.bottom-m))-e.top,h=Math.min(400,l?d:p);else{a=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let S=i.bottom-e.bottom;S>=m||S>e.top?f=n.bottom-e.top:(u="bottom",f=e.bottom-n.top)}let v=(e.bottom-e.top)/s.offsetHeight,y=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${f/v}px; max-width: ${h/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function zH(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;u<s.length;){let f=s[u++],h=s[u++];f>a&&o.appendChild(document.createTextNode(l.slice(a,f)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(l.slice(f,h))),d.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Rg(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class VH{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,l=e.state.facet(gr);this.optionContent=zH(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Rg(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:u}=e.state.field(n).open;for(let f=a.target,h;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(h=/-(\d+)$/.exec(f.id))&&+h[1]<u.length){this.applyCompletion(e,u[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(gr).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Du.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=Rg(s.length,o,e.state.facet(gr).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=Rg(n.options.length,n.selected,this.view.state.facet(gr).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>qr(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&qH(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(gr).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:l,match:a}=e[o],{section:u}=l;if(u){let d=typeof u=="string"?u:u.name;if(d!=s&&(o>r.from||r.from==0))if(s=d,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const f=i.appendChild(document.createElement("li"));f.id=n+"-"+o,f.setAttribute("role","option");let h=this.optionClass(l);h&&(f.className=h);for(let d of this.optionContent){let p=d(l,this.view.state,this.view,a);p&&f.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function HH(t,e){return n=>new VH(n,t,e)}function qH(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function Yx(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function UH(t,e){let n=[],r=null,i=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(d=>d.name==h)||r.push(typeof f=="string"?{name:h}:f)}},s=e.facet(gr);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)i(new Gx(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),d,p=s.filterStrict?new BH(h):new jH(h);for(let g of u.result.options)if(d=p.match(g.label)){let m=g.displayLabel?f?f(g,d.matched):[]:d.matched;i(new Gx(g,u.source,m,d.score+(g.boost||0)))}}}if(r){let u=Object.create(null),f=0,h=(d,p)=>{var g,m;return((g=d.rank)!==null&&g!==void 0?g:1e9)-((m=p.rank)!==null&&m!==void 0?m:1e9)||(d.name<p.name?-1:1)};for(let d of r.sort(h))f-=1e5,u[d.name]=f;for(let d of n){let{section:p}=d.completion;p&&(d.score+=u[typeof p=="string"?p:p.name])}}let o=[],l=null,a=s.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||a(f.completion,h.completion))){let f=u.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?o.push(u):Yx(u.completion)>Yx(l)&&(o[o.length-1]=u),l=u.completion}return o}class Oa{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Oa(this.options,Zx(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(u=>u.isPending))return i.setDisabled();let l=UH(e,n);if(!l.length)return i&&e.some(u=>u.isPending)?i.setDisabled():null;let a=n.facet(gr).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let u=i.options[i.selected].completion;for(let f=0;f<l.length;f++)if(l[f].completion==u){a=f;break}}return new Oa(l,Zx(r,a),{pos:e.reduce((u,f)=>f.hasResult()?Math.min(u,f.from):u,1e8),create:QH,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Oa(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Oa(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class xd{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new xd(GH,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(gr),s=(r.override||n.languageDataAt("autocomplete",Ml(n)).map(NH)).map(a=>(this.active.find(f=>f.source==a)||new _i(a,this.active.some(f=>f.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,u)=>a==this.active[u])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(Q0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!WH(s,this.active)||l?o=Oa.build(s,n,this.id,o,r,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new _i(a.source,0):a));for(let a of e.effects)a.is(EO)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new xd(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?JH:KH}}function WH(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const JH={"aria-autocomplete":"list"},KH={};function Zx(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const GH=[];function _O(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(OO);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class _i{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=_O(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new _i(i.source,0)),r&4&&i.state==0&&(i=new _i(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(bd))i=new _i(i.source,1,s.value);else if(s.is(Du))i=new _i(i.source,0);else if(s.is(Q0))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ml(e.state))}}class Fa extends _i{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ml(e.state);if(l>o||!i||n&2&&(Ml(e.startState)==this.from||l<this.limit))return new _i(this.source,n&4?1:0);let a=e.changes.mapPos(this.limit);return XH(i.validFor,e.state,s,o)?new Fa(this.source,this.explicit,a,i,s,o):i.update&&(i=i.update(i,s,o,new kO(e.state,l,!1)))?new Fa(this.source,this.explicit,a,i,i.from,(r=i.to)!==null&&r!==void 0?r:Ml(e.state)):new _i(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Fa(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new _i(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function XH(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):AO(t,!0).test(i)}const Q0=It.define({map(t,e){return t.map(n=>n.map(e))}}),EO=It.define(),Zr=vr.define({create(){return xd.start()},update(t,e){return t.update(e)},provide:t=>[pp.from(t,e=>e.tooltip),Ie.contentAttributes.from(t,e=>e.attrs)]});function Y0(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Zr).active.find(i=>i.source==e.source);return r instanceof Fa?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},LH(t.state,n,r.from,r.to)),{annotations:OO.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const QH=HH(Zr,Y0);function Xf(t,e="option"){return n=>{let r=n.state.field(Zr,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(gr).interactionDelay)return!1;let i=1,s;e=="page"&&(s=iA(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,l=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),n.dispatch({effects:EO.of(l)}),!0}}const YH=t=>{let e=t.state.field(Zr,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(gr).interactionDelay?!1:Y0(t,e.open.options[e.open.selected])},$x=t=>t.state.field(Zr,!1)?(t.dispatch({effects:bd.of(!0)}),!0):!1,ZH=t=>{let e=t.state.field(Zr,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Du.of(null)}),!0)};class $H{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const eq=50,tq=1e3,nq=qn.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Zr).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Zr),n=t.state.facet(gr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Zr)==e)return;let r=t.transactions.some(s=>{let o=_O(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>eq&&Date.now()-o.time>tq){for(let l of o.context.abortListeners)try{l()}catch(a){qr(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(bd)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Zr);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ml(e),r=new kO(e,n,t.explicit,this.view),i=new $H(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Du.of(null)}),qr(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(gr),r=this.view.state.field(Zr);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let l=Ml(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),u=new Fa(s.active.source,s.active.explicit,a,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:l);for(let f of s.updates)u=u.update(f,n);if(u.hasResult()){e.push(u);continue}}let o=r.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new _i(s.active.source,0);for(let a of s.updates)l=l.update(a,n);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Q0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Zr,!1);if(e&&e.tooltip&&this.view.state.facet(gr).closeOnBlur){let n=e.open&&iA(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Du.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:bd.of(!1)}),20),this.composing=0}}}),rq=typeof navigator=="object"&&/Win/.test(navigator.platform),iq=Zl.highest(Ie.domEventHandlers({keydown(t,e){let n=e.state.field(Zr,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(rq&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&Y0(e,r),!1}})),sq=Ie.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Iu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Cl=It.define({map(t,e){let n=e.mapPos(t,-1,Hr.TrackAfter);return n??void 0}}),Z0=new class extends Ul{};Z0.startSide=1;Z0.endSide=-1;const TO=vr.define({create(){return Ut.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Cl)&&(t=t.update({add:[Z0.range(n.value,n.value+1)]}));return t}});function oq(){return[aq,TO]}const Pg="()[]{}<>«»»«[]{}";function MO(t){for(let e=0;e<Pg.length;e+=2)if(Pg.charCodeAt(e)==t)return Pg.charAt(e+1);return y0(t<128?t:t+1)}function RO(t,e){return t.languageDataAt("closeBrackets",e)[0]||Iu}const lq=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),aq=Ie.inputHandler.of((t,e,n,r)=>{if((lq?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Es(Qr(r,0))==1||e!=i.from||n!=i.to)return!1;let s=fq(t.state,r);return s?(t.dispatch(s),!0):!1}),cq=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=RO(t,t.selection.main.head).brackets||Iu.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let l=hq(t.doc,o.head);for(let a of r)if(a==l&&kp(t.doc,o.head)==MO(Qr(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:pe.cursor(o.head-a.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},uq=[{key:"Backspace",run:cq}];function fq(t,e){let n=RO(t,t.selection.main.head),r=n.brackets||Iu.brackets;for(let i of r){let s=MO(Qr(i,0));if(e==i)return s==i?gq(t,i,r.indexOf(i+i+i)>-1,n):dq(t,i,s,n.before||Iu.before);if(e==s&&PO(t,t.selection.main.from))return pq(t,i,s)}return null}function PO(t,e){let n=!1;return t.field(TO).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function kp(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Es(Qr(n,0)))}function hq(t,e){let n=t.sliceString(e-2,e);return Es(Qr(n,0))==n.length?n:n.slice(1)}function dq(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Cl.of(o.to+e.length),range:pe.range(o.anchor+e.length,o.head+e.length)};let l=kp(t.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:o.head},effects:Cl.of(o.head+e.length),range:pe.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function pq(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&kp(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:pe.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function gq(t,e,n,r){let i=r.stringPrefixes||Iu.stringPrefixes,s=null,o=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Cl.of(l.to+e.length),range:pe.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=kp(t.doc,a),f;if(u==e){if(e2(t,a))return{changes:{insert:e+e,from:a},effects:Cl.of(a+e.length),range:pe.cursor(a+e.length)};if(PO(t,a)){let d=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+d.length,insert:d},range:pe.cursor(a+d.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(f=t2(t,a-2*e.length,i))>-1&&e2(t,f))return{changes:{insert:e+e+e+e,from:a},effects:Cl.of(a+e.length),range:pe.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=Bn.Word&&t2(t,a,i)>-1&&!mq(t,a,e,i))return{changes:{insert:e+e,from:a},effects:Cl.of(a+e.length),range:pe.cursor(a+e.length)}}return{range:s=l}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function e2(t,e){let n=Ir(t).resolveInner(e+1);return n.parent&&n.from==e}function mq(t,e,n,r){let i=Ir(t).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=i.firstChild;for(;f&&f.from==i.from&&f.to-f.from>n.length+a;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let u=i.to==e&&i.parent;if(!u)break;i=u}return!1}function t2(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Bn.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Bn.Word)return s}return-1}function vq(t={}){return[iq,Zr,gr.of(t),nq,yq,sq]}const DO=[{key:"Ctrl-Space",run:$x},{mac:"Alt-`",run:$x},{key:"Escape",run:ZH},{key:"ArrowDown",run:Xf(!0)},{key:"ArrowUp",run:Xf(!1)},{key:"PageDown",run:Xf(!0,"page")},{key:"PageUp",run:Xf(!1,"page")},{key:"Enter",run:YH}],yq=Zl.highest(nd.computeN([gr],t=>t.facet(gr).defaultKeymap?[DO]:[]));var bq=J('<div class="jse-status-bar-info svelte-1ulj7zd"> </div>'),xq=J('<div class="jse-status-bar-info svelte-1ulj7zd"> </div>'),wq=J('<div class="jse-status-bar-info svelte-1ulj7zd"> </div>'),Sq=J('<div class="jse-status-bar svelte-1ulj7zd"><!> <!> <!></div>');function Cq(t,e){Ge(e,!1);let n=x(e,"editorState",8),r=R(),i=R(),s=R(),o=R(),l=R();K(()=>P(n()),()=>{var m,v,y;b(r,(y=(v=(m=n())==null?void 0:m.selection)==null?void 0:v.main)==null?void 0:y.head)}),K(()=>(c(r),P(n())),()=>{var m,v;b(i,c(r)!==void 0?(v=(m=n())==null?void 0:m.doc)==null?void 0:v.lineAt(c(r)):void 0)}),K(()=>c(i),()=>{b(s,c(i)!==void 0?c(i).number:void 0)}),K(()=>(c(i),c(r)),()=>{b(o,c(i)!==void 0&&c(r)!==void 0?c(r)-c(i).from+1:void 0)}),K(()=>P(n()),()=>{var m,v,y;b(l,(y=(v=(m=n())==null?void 0:m.selection)==null?void 0:v.ranges)==null?void 0:y.reduce((S,k)=>S+k.to-k.from,0))}),Vt(),st();var a=Sq(),u=M(a);{var f=m=>{var v=bq(),y=M(v);xe(()=>et(y,`Line: ${c(s)??""}`)),D(m,v)};te(u,m=>{c(s)!==void 0&&m(f)})}var h=N(u,2);{var d=m=>{var v=xq(),y=M(v);xe(()=>et(y,`Column: ${c(o)??""}`)),D(m,v)};te(h,m=>{c(o)!==void 0&&m(d)})}var p=N(h,2);{var g=m=>{var v=wq(),y=M(v);xe(()=>et(y,`Selection: ${c(l)??""} characters`)),D(m,v)};te(p,m=>{c(l)!==void 0&&c(l)>0&&m(g)})}D(t,a),Xe()}const $0=of.define([{tag:_e.propertyName,color:"var(--internal-key-color)"},{tag:_e.number,color:"var(--internal-value-color-number)"},{tag:_e.bool,color:"var(--internal-value-color-boolean)"},{tag:_e.string,color:"var(--internal-value-color-string)"},{tag:_e.keyword,color:"var(--internal-value-color-null)"}]),kq=TA($0),Aq=$0.style;$0.style=t=>Aq(t||[]);function Oq(t,e=t.state){const n=new Set;for(const{from:r,to:i}of t.visibleRanges){let s=r;for(;s<=i;){const o=e.doc.lineAt(s);n.has(o)||n.add(o),s=o.to+1}}return n}function pv(t){const e=t.selection.main.head;return t.doc.lineAt(e)}function n2(t,e){let n=0;e:for(let r=0;r<t.length;r++)switch(t[r]){case" ":case" ":{n+=1;continue e}case" ":{n+=e-n%e;continue e}case"\r":continue e;default:break e}return n}const wd=Ne.define({combine(t){return cs(t,{highlightActiveBlock:!0,hideFirstIndent:!1,markerType:"fullScope",thickness:1})}});class _q{constructor(e,n,r,i){this.lines=e,this.state=n,this.map=new Map,this.unitWidth=r,this.markerType=i;for(const s of this.lines)this.add(s);this.state.facet(wd).highlightActiveBlock&&this.findAndSetActiveLines()}has(e){return this.map.has(typeof e=="number"?e:e.number)}get(e){const n=this.map.get(typeof e=="number"?e:e.number);if(!n)throw new Error("Line not found in indentation map");return n}set(e,n,r){const i=!e.text.trim().length,s={line:e,col:n,level:r,empty:i};return this.map.set(s.line.number,s),s}add(e){if(this.has(e))return this.get(e);if(!e.length||!e.text.trim().length){if(e.number===1)return this.set(e,0,0);if(e.number===this.state.doc.lines){const o=this.closestNonEmpty(e,-1);return this.set(e,0,o.level)}const i=this.closestNonEmpty(e,-1),s=this.closestNonEmpty(e,1);return i.level>=s.level&&this.markerType!=="codeOnly"?this.set(e,0,i.level):i.empty&&i.level===0&&s.level!==0?this.set(e,0,0):s.level>i.level?this.set(e,0,i.level+1):this.set(e,0,s.level)}const n=n2(e.text,this.state.tabSize),r=Math.floor(n/this.unitWidth);return this.set(e,n,r)}closestNonEmpty(e,n){let r=e.number+n;for(;n===-1?r>=1:r<=this.state.doc.lines;){if(this.has(r)){const o=this.get(r);if(!o.empty)return o}const s=this.state.doc.line(r);if(s.text.trim().length){const o=n2(s.text,this.state.tabSize),l=Math.floor(o/this.unitWidth);return this.set(s,o,l)}r+=n}const i=this.state.doc.line(n===-1?1:this.state.doc.lines);return this.set(i,0,0)}findAndSetActiveLines(){const e=pv(this.state);if(!this.has(e))return;let n=this.get(e);if(this.has(n.line.number+1)){const s=this.get(n.line.number+1);s.level>n.level&&(n=s)}if(this.has(n.line.number-1)){const s=this.get(n.line.number-1);s.level>n.level&&(n=s)}if(n.level===0)return;n.active=n.level;let r,i;for(r=n.line.number;r>1;r--){if(!this.has(r-1))continue;const s=this.get(r-1);if(s.level<n.level)break;s.active=n.level}for(i=n.line.number;i<this.state.doc.lines;i++){if(!this.has(i+1))continue;const s=this.get(i+1);if(s.level<n.level)break;s.active=n.level}}}function Eq(t){const e={light:"#F0F1F2",dark:"#2B3245",activeLight:"#E4E5E6",activeDark:"#3C445C"};let n=e;return t&&(n=Object.assign(Object.assign({},e),t)),Ie.baseTheme({"&light":{"--indent-marker-bg-color":n.light,"--indent-marker-active-bg-color":n.activeLight},"&dark":{"--indent-marker-bg-color":n.dark,"--indent-marker-active-bg-color":n.activeDark},".cm-line":{position:"relative"},".cm-indent-markers::before":{content:'""',position:"absolute",top:0,left:"2px",right:0,bottom:0,background:"var(--indent-markers)",pointerEvents:"none",zIndex:"-1"}})}function Qf(t,e,n,r,i){return`${`repeating-linear-gradient(to right, var(${t}) 0 ${e}px, transparent ${e}px ${n}ch)`} ${r*n}.5ch/calc(${n*i}ch - 1px) no-repeat`}function Tq(t,e,n,r,i){const{level:s,active:o}=t;if(i=i??r,n&&s===0)return[];const l=n?1:0,a=[];if(o!==void 0){const u=o-l-1;u>0&&a.push(Qf("--indent-marker-bg-color",r,e,l,u)),a.push(Qf("--indent-marker-active-bg-color",i,e,o-1,1)),o!==s&&a.push(Qf("--indent-marker-bg-color",r,e,o,s-o))}else a.push(Qf("--indent-marker-bg-color",r,e,l,s-l));return a.join(",")}class Mq{constructor(e){this.view=e,this.unitWidth=Zo(e.state),this.currentLineNumber=pv(e.state).number,this.generate(e.state)}update(e){const n=Zo(e.state),r=n!==this.unitWidth;r&&(this.unitWidth=n);const i=pv(e.state).number,s=i!==this.currentLineNumber;this.currentLineNumber=i;const o=e.state.facet(wd).highlightActiveBlock&&s;(e.docChanged||e.viewportChanged||r||o)&&this.generate(e.state)}generate(e){const n=new is,r=Oq(this.view,e),{hideFirstIndent:i,markerType:s,thickness:o,activeThickness:l}=e.facet(wd),a=new _q(r,e,this.unitWidth,s);for(const u of r){const f=a.get(u.number);if(!(f!=null&&f.level))continue;const h=Tq(f,this.unitWidth,i,o,l);n.add(u.from,u.from,ft.line({class:"cm-indent-markers",attributes:{style:`--indent-markers: ${h}`}}))}this.decorations=n.finish()}}function Rq(t={}){return[wd.of(t),Eq(t.colors),qn.fromClass(Mq,{decorations:e=>e.decorations})]}class Pq{constructor(e){this.view=e,this.indentUnit=Zo(e.state),this.initialPaddingLeft=null,this.isChrome=window==null?void 0:window.navigator.userAgent.includes("Chrome"),this.generate(e.state)}update(e){const n=Zo(e.state);(n!==this.indentUnit||e.docChanged||e.viewportChanged)&&(this.indentUnit=n,this.generate(e.state))}generate(e){const n=new is;this.initialPaddingLeft?this.addStyleToBuilder(n,e,this.initialPaddingLeft):this.view.requestMeasure({read:r=>{const i=r.contentDOM.querySelector(".cm-line");i&&(this.initialPaddingLeft=window.getComputedStyle(i).getPropertyValue("padding-left"),this.addStyleToBuilder(n,r.state,this.initialPaddingLeft)),this.decorations=n.finish()}}),this.decorations=n.finish()}addStyleToBuilder(e,n,r){const i=this.getVisibleLines(n);for(const s of i){const{numColumns:o,containsTab:l}=this.numColumns(s.text,n.tabSize),a=`calc(${o+this.indentUnit}ch + ${r})`,u=this.isChrome?`calc(-${o+this.indentUnit}ch - ${l?1:0}px)`:`-${o+this.indentUnit}ch`;e.add(s.from,s.from,ft.line({attributes:{style:`padding-left: ${a}; text-indent: ${u};`}}))}}getVisibleLines(e){const n=new Set;let r=null;for(const{from:i,to:s}of this.view.visibleRanges){let o=i;for(;o<=s;){const l=e.doc.lineAt(o);r!==l&&(n.add(l),r=l),o=l.to+1}}return n}numColumns(e,n){let r=0,i=!1;e:for(let s=0;s<e.length;s++)switch(e[s]){case" ":{r+=1;continue e}case" ":{r+=n-r%n,i=!0;continue e}case"\r":continue e;default:break e}return{numColumns:r,containsTab:i}}}const Dq=[qn.fromClass(Pq,{decorations:t=>t.decorations})];var Iq=J('<!> <div class="jse-contents jse-preview svelte-xt61xw"> </div>',1),Lq=J("<!> <!> <!> <!>",1),Nq=J("<div></div> <!> <!>",1),jq=J('<div class="jse-contents svelte-xt61xw"><div class="jse-loading-space svelte-xt61xw"></div> <div class="jse-loading svelte-xt61xw">loading...</div></div>'),Bq=J("<div><!> <!></div>");function Fq(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0);let i=x(e,"readOnly",9),s=x(e,"mainMenuBar",9),o=x(e,"statusBar",9),l=x(e,"askToFormat",9),a=x(e,"externalContent",9),u=x(e,"externalSelection",9),f=x(e,"history",9),h=x(e,"indentation",9),d=x(e,"tabSize",9),p=x(e,"escapeUnicodeCharacters",9),g=x(e,"parser",9),m=x(e,"validator",9),v=x(e,"validationParser",9),y=x(e,"onChange",9),S=x(e,"onChangeMode",9),k=x(e,"onSelect",9),C=x(e,"onUndo",9),w=x(e,"onRedo",9),E=x(e,"onError",9),A=x(e,"onFocus",9),O=x(e,"onBlur",9),H=x(e,"onRenderMenu",9),W=x(e,"onSortModal",9),G=x(e,"onTransformModal",9);const V=rr("jsoneditor:TextMode"),U={key:"Mod-i",run:je,shift:Qe,preventDefault:!0},Q=typeof window>"u";V("isSSR:",Q);let Y=R(void 0,!0),ie=R(void 0,!0),F,X=R(void 0,!0),I=R(!1,!0),se=R(l(),!0),ce=R([],!0);const Te=new Xs,le=new Xs,de=new Xs,ne=new Xs,ue=new Xs;let ge=a(),j=R(rm(ge,h(),g()),!0),we=il.define(),Pe=null;function q(){if(!Pe||Pe.length===0)return!1;const ee=Pe[0].startState,Oe=Pe[Pe.length-1].state,pt=Pe.map(Rt=>Rt.changes).reduce((Rt,cn)=>Rt.compose(cn)),St={type:"text",undo:{changes:pt.invert(ee.doc).toJSON(),selection:on(ee.selection)},redo:{changes:pt.toJSON(),selection:on(Oe.selection)}};return V("add history item",St),f().add(St),Pe=null,!0}let B=R(p(),!0);Cr(async()=>{if(!Q)try{F=Et({target:c(Y),initialText:En(c(j),c(I))?"":c(n).escapeValue(c(j)),readOnly:i(),indentation:h()})}catch(ee){console.error(ee)}}),Ii(()=>{$t(),F&&(V("Destroy CodeMirror editor"),F.destroy())});const Se=Ua(),ke=Ua();function z(){F&&(V("focus"),F.focus())}let L=!1;p0({onMount:Cr,onDestroy:Ii,getWindow:()=>Ku(c(ie)),hasFocus:()=>L&&document.hasFocus()||Jv(c(ie)),onFocus:A(),onBlur:()=>{$t(),O()()}});function ze(ee){return We(ee,!1)}function We(ee,Oe){V("handlePatch",ee,Oe);const pt=g().parse(c(j)),Mt=Xi(pt,ee),St=kw(pt,ee),Rt={text:g().stringify(Mt,null,h())};return Gt(Rt,Oe,!1),{json:Mt,previousJson:pt,undo:St,redo:ee}}function je(){if(V("format"),i())return!1;try{const ee=g().parse(c(j)),Oe={text:g().stringify(ee,null,h())};return Gt(Oe,!0,!1),b(se,l()),!0}catch(ee){E()(ee)}return!1}function Qe(){if(V("compact"),i())return!1;try{const ee=g().parse(c(j)),Oe={text:g().stringify(ee)};return Gt(Oe,!0,!1),b(se,!1),!0}catch(ee){E()(ee)}return!1}function be(){if(V("repair"),!i())try{const ee={text:Ds(c(j))};Gt(ee,!0,!1),b(Wn,Gp),b(fn,void 0)}catch(ee){E()(ee)}}function gt(){if(!i())try{const ee=g().parse(c(j));L=!0,W()({id:Se,json:ee,rootPath:[],onSort:async({operations:Oe})=>{V("onSort",Oe),We(Oe,!0)},onClose:()=>{L=!1,z()}})}catch(ee){E()(ee)}}function Ye({id:ee,rootPath:Oe,onTransform:pt,onClose:Mt}){try{const St=g().parse(c(j));L=!0,G()({id:ee||ke,json:St,rootPath:Oe||[],onTransform:Rt=>{pt?pt({operations:Rt,json:St,transformedJson:Xi(St,Rt)}):(V("onTransform",Rt),We(Rt,!0))},onClose:()=>{L=!1,z(),Mt&&Mt()}})}catch(St){E()(St)}}function Ve(){i()||Ye({rootPath:[]})}function _t(){F&&(c(Y)&&c(Y).querySelector(".cm-search")?G0(F):K0(F))}function Nt(){if(i())return!1;$t();const ee=f().undo();return V("undo",ee),Vy(ee)?(F.dispatch({annotations:we.of("undo"),changes:er.fromJSON(ee.undo.changes),selection:pe.fromJSON(ee.undo.selection),scrollIntoView:!0}),!0):(C()(ee),!1)}function Ae(){if(i())return!1;$t();const ee=f().redo();return V("redo",ee),Vy(ee)?(F.dispatch({annotations:we.of("redo"),changes:er.fromJSON(ee.redo.changes),selection:pe.fromJSON(ee.redo.selection),scrollIntoView:!0}),!0):(w()(ee),!1)}function Je(){b(I,!0),Gt(a(),!0,!0)}function ht(){S()($n.tree)}function it(){Ft()}function vt(ee){V("select validation error",ee);const{from:Oe,to:pt}=ot(ee);Oe===void 0||pt===void 0||(rt(Oe,pt),z())}function Ze(ee){V("select parse error",ee);const Oe=Ht(ee,!1),pt=Oe.from!=null?Oe.from:0,Mt=Oe.to!=null?Oe.to:0;rt(pt,Mt),z()}function rt(ee,Oe){V("setSelection",{anchor:ee,head:Oe}),F&&F.dispatch(F.state.update({selection:{anchor:ee,head:Oe},scrollIntoView:!0}))}function Le(ee,Oe){if(Oe.state.selection.ranges.length===1){const pt=Oe.state.selection.ranges[0],Mt=c(j).slice(pt.from,pt.to);if(Mt==="{"||Mt==="["){const St=Tw.parse(c(j)),Rt=Object.keys(St.pointers).find(sr=>{var zn;return((zn=St.pointers[sr].value)==null?void 0:zn.pos)===pt.from}),cn=St.pointers[Rt];if(Rt&&cn&&cn.value&&cn.valueEnd){V("pointer found, selecting inner contents of path:",Rt,cn);const sr=cn.value.pos+1,jn=cn.valueEnd.pos-1;rt(sr,jn)}}}}function oe(){return NV(me,{delay:Iy})}function Et({target:ee,initialText:Oe,readOnly:pt,indentation:Mt}){V("Create CodeMirror editor",{readOnly:pt,indentation:Mt});const St=fr(u(),Oe)?yt(u()):void 0,Rt=zt.create({doc:Oe,selection:St,extensions:[nd.of([_V,U]),Te.of(oe()),WV(),yF(),wF(),F7(),fz(),E7(),D7(),zt.allowMultipleSelections.of(!0),YF(),TA(gz,{fallback:!0}),Sz(),oq(),vq(),Y7(),eF(),W7(),uH(),nd.of([...uq,...OV,...MH,{key:"Mod-z",run:Nt,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ae,preventDefault:!0},{key:"Ctrl-Shift-z",run:Ae,preventDefault:!0},...lz,...DO,...DV]),kq,Rq({hideFirstIndent:!0}),Ie.domEventHandlers({dblclick:Le}),Ie.updateListener.of(cn=>{b(X,cn.state),cn.docChanged&&(cn.transactions.some(jn=>!!jn.annotation(we))||(Pe=[...Pe??[],cn]),an()),cn.selectionSet&&jt()}),iH(),bH({top:!0}),Ie.lineWrapping,le.of(zt.readOnly.of(pt)),ne.of(zt.tabSize.of(d())),de.of(Tt(Mt)),ue.of(Ie.theme({},{dark:Un()}))]});return F=new Ie({state:Rt,parent:ee}),St&&F.dispatch(F.state.update({selection:St.main,scrollIntoView:!0})),F}function bt(){return F?c(n).unescapeValue(F.state.doc.toString()):""}function Un(){return c(Y)?getComputedStyle(c(Y)).getPropertyValue("--jse-theme").includes("dark"):!1}function fr(ee,Oe){return Yp(ee)?ee.ranges.every(pt=>pt.anchor<Oe.length&&pt.head<Oe.length):!1}function ot(ee){const{path:Oe,message:pt,severity:Mt}=ee,{line:St,column:Rt,from:cn,to:sr}=E5(c(n).escapeValue(c(j)),Oe);return{path:Oe,line:St,column:Rt,from:cn,to:sr,message:pt,severity:Mt,actions:[]}}function Ht(ee,Oe){const{line:pt,column:Mt,position:St,message:Rt}=ee;return{path:[],line:pt,column:Mt,from:St,to:St,severity:Yi.error,message:Rt,actions:Oe&&!i()?[{name:"Auto repair",apply:()=>be()}]:void 0}}function ln(ee){return{from:ee.from||0,to:ee.to||0,message:ee.message||"",actions:ee.actions,severity:ee.severity}}function Gt(ee,Oe,pt){const Mt=rm(ee,h(),g()),St=!Pt(ee,ge),Rt=ge;V("setCodeMirrorContent",{isChanged:St,emitChange:Oe,forceUpdate:pt}),!(!F||!St&&!pt)&&(ge=ee,b(j,Mt),En(c(j),c(I))||F.dispatch({changes:{from:0,to:F.state.doc.length,insert:c(n).escapeValue(c(j))}}),q(),St&&Oe&&sn(ge,Rt))}function lt(ee){if(!Yp(ee))return;const Oe=yt(ee);F&&Oe&&(!c(X)||!c(X).selection.eq(Oe))&&(V("applyExternalSelection",Oe),F.dispatch({selection:Oe}))}function yt(ee){return Yp(ee)?pe.fromJSON(ee):void 0}async function Xt(){V("refresh"),await dt()}function nn(){V("forceUpdateText",{escapeUnicodeCharacters:p()}),F&&F.dispatch({changes:{from:0,to:F.state.doc.length,insert:c(n).escapeValue(c(j))}})}function Ft(){if(!F)return;const ee=bt(),Oe=ee!==c(j);if(V("onChangeCodeMirrorValue",{isChanged:Oe}),!Oe)return;const pt=ge;b(j,ee),ge={text:c(j)},q(),sn(ge,pt),_n(),jt()}function qt(ee){V("updateLinter",ee),F&&F.dispatch({effects:Te.reconfigure(oe())})}function rn(ee){F&&(V("updateIndentation",ee),F.dispatch({effects:de.reconfigure(Tt(ee))}))}function Gn(ee){F&&(V("updateTabSize",ee),F.dispatch({effects:ne.reconfigure(zt.tabSize.of(ee))}))}function mt(ee){F&&(V("updateReadOnly",ee),F.dispatch({effects:[le.reconfigure(zt.readOnly.of(ee))]}))}async function dt(){if(_n(),F){const ee=Un();return V("updateTheme",{dark:ee}),F.dispatch({effects:[ue.reconfigure(Ie.theme({},{dark:ee}))]}),new Promise(Oe=>setTimeout(Oe))}return Promise.resolve()}function Tt(ee){const Oe=mp.of(typeof ee=="number"?" ".repeat(ee):ee);return ee===" "?[Oe]:[Oe,Dq]}const an=jh(Ft,Iy);function $t(){an.flush()}function sn(ee,Oe){y()&&y()(ee,Oe,{contentErrors:xt(),patchResult:void 0})}function jt(){k()(on(c(X).selection))}function on(ee){return{type:Zt.text,...ee.toJSON()}}function En(ee,Oe){return(ee?ee.length>Ny:!1)&&!Oe}let Wn=R(Gp,!0),fn=R(void 0,!0);function me(){if(En(c(j),c(I)))return[];const ee=xt();if(zy(ee)){const{parseError:Oe,isRepairable:pt}=ee;return[ln(Ht(Oe,pt))]}return $D(ee)?ee.validationErrors.map(ot).map(ln):[]}function xt(){V("validate:start"),$t();const ee=mn(c(n).escapeValue(c(j)),m(),g(),v());return zy(ee)?(b(Wn,ee.isRepairable?By:KD),b(fn,ee.parseError),b(ce,[])):(b(Wn,Gp),b(fn,void 0),b(ce,(ee==null?void 0:ee.validationErrors)||[])),V("validate:end"),ee}const mn=ef(HI);function Ke(){c(fn)&&Ze(c(fn))}const ir={icon:l9,text:"Show me",title:"Move to the parse error location",onClick:Ke};K(()=>P(p()),()=>{b(n,Uv({escapeControlCharacters:!1,escapeUnicodeCharacters:p()}))}),K(()=>P(a()),()=>{Gt(a(),!1,!1)}),K(()=>P(u()),()=>{lt(u())}),K(()=>P(m()),()=>{qt(m())}),K(()=>P(h()),()=>{rn(h())}),K(()=>P(d()),()=>{Gn(d())}),K(()=>P(i()),()=>{mt(i())}),K(()=>(c(B),P(p())),()=>{c(B)!==p()&&(b(B,p()),nn())}),K(()=>(c(Wn),P(i()),Ga),()=>{b(r,c(Wn)===By&&!i()?[{icon:Ga,text:"Auto repair",title:"Automatically repair JSON",onClick:be},ir]:[ir])}),Vt(),st(!0);var Fn=Bq();let kr;var si=M(Fn);{var oi=ee=>{const Oe=he(()=>c(j).length===0),pt=he(()=>!c(Oe)),Mt=he(()=>!c(Oe)),St=he(()=>!c(Oe)),Rt=he(()=>!c(Oe));Cj(ee,{get readOnly(){return i()},onFormat:je,onCompact:Qe,onSort:gt,onTransform:Ve,onToggleSearch:_t,onUndo:Nt,onRedo:Ae,get canFormat(){return c(pt)},get canCompact(){return c(Mt)},get canSort(){return c(St)},get canTransform(){return c(Rt)},get canUndo(){return f().canUndo},get canRedo(){return f().canRedo},get onRenderMenu(){return H()}})};te(si,ee=>{s()&&ee(oi)})}var fs=N(si,2);{var hs=ee=>{var Oe=Nq();const pt=he(()=>En(c(j),c(I)));var Mt=$e(Oe);let St;gn(Mt,zn=>b(Y,zn),()=>c(Y));var Rt=N(Mt,2);{var cn=zn=>{var xi=Iq(),Gr=$e(xi);const ds=he(()=>`The JSON document is larger than ${pm(Ny)}, and may crash your browser when loading it in text mode. Actual size: ${pm(c(j).length)}.`);es(Gr,{icon:Vl,type:"error",get message(){return c(ds)},actions:[{text:"Open anyway",title:"Open the document in text mode. This may freeze or crash your browser.",onClick:Je},{text:"Open in tree mode",title:"Open the document in tree mode. Tree mode can handle large documents.",onClick:ht},{text:"Cancel",title:"Cancel opening this large document.",onClick:it}],onClose:z});var ps=N(Gr,2),wi=M(ps);xe(li=>et(wi,li),[()=>Xu(c(j)||"",lm)],he),D(zn,xi)};te(Rt,zn=>{c(pt)&&zn(cn)})}var sr=N(Rt,2);{var jn=zn=>{var xi=Lq(),Gr=$e(xi);{var ds=dr=>{Cq(dr,{get editorState(){return c(X)}})};te(Gr,dr=>{o()&&dr(ds)})}var ps=N(Gr,2);{var wi=dr=>{es(dr,{type:"error",icon:Vl,get message(){return c(fn).message},get actions(){return c(r)},onClick:Ke,onClose:z})};te(ps,dr=>{c(fn)&&dr(wi)})}var li=N(ps,2);{var zi=dr=>{es(dr,{type:"success",message:"Do you want to format the JSON?",actions:[{icon:SC,text:"Format",title:"Format JSON: add proper indentation and new lines (Ctrl+I)",onClick:je},{icon:rp,text:"No thanks",title:"Close this message",onClick:()=>b(se,!1)}],onClose:z})};te(li,dr=>{!c(fn)&&c(se)&&N5(c(j))&&dr(zi)})}var Si=N(li,2);g0(Si,{get validationErrors(){return c(ce)},selectError:vt}),D(zn,xi)};te(sr,zn=>{c(pt)||zn(jn)})}xe(zn=>St=ct(Mt,1,"jse-contents svelte-xt61xw",null,St,zn),[()=>({"jse-hidden":c(pt)})],he),D(ee,Oe)},hr=ee=>{var Oe=jq();D(ee,Oe)};te(fs,ee=>{Q?ee(hr,!1):ee(hs)})}return gn(Fn,ee=>b(ie,ee),()=>c(ie)),xe(ee=>kr=ct(Fn,1,"jse-text-mode svelte-xt61xw",null,kr,ee),[()=>({"no-main-menu":!s()})],he),D(t,Fn),at(e,"focus",z),at(e,"patch",ze),at(e,"handlePatch",We),at(e,"openTransformModal",Ye),at(e,"refresh",Xt),at(e,"flush",$t),at(e,"validate",xt),Xe({focus:z,patch:ze,handlePatch:We,openTransformModal:Ye,refresh:Xt,flush:$t,validate:xt})}function zq(t,e){Ge(e,!1);let n=x(e,"containsValidArray",9),r=x(e,"readOnly",9),i=x(e,"showSearch",13,!1),s=x(e,"history",9),o=x(e,"onSort",9),l=x(e,"onTransform",9),a=x(e,"onContextMenu",9),u=x(e,"onUndo",9),f=x(e,"onRedo",9),h=x(e,"onRenderMenu",9);function d(){i(!i())}let p=R(void 0,!0),g=R(void 0,!0);K(()=>(P(r()),P(o()),P(n()),P(l()),P(a()),P(u()),P(s()),P(f())),()=>{b(p,r()?[{type:"space"}]:[{type:"button",icon:tp,title:"Sort",className:"jse-sort",onClick:o(),disabled:r()||!n()},{type:"button",icon:ep,title:"Transform contents (filter, sort, project)",className:"jse-transform",onClick:l(),disabled:r()||!n()},{type:"button",icon:np,title:"Search (Ctrl+F)",className:"jse-search",onClick:d,disabled:!n()},{type:"button",icon:nC,title:Qv,className:"jse-contextmenu",onClick:a()},{type:"separator"},{type:"button",icon:a0,title:"Undo (Ctrl+Z)",className:"jse-undo",onClick:u(),disabled:!s().canUndo},{type:"button",icon:l0,title:"Redo (Ctrl+Shift+Z)",className:"jse-redo",onClick:f(),disabled:!s().canRedo},{type:"space"}])}),K(()=>(P(h()),c(p)),()=>{b(g,h()(c(p))||c(p))}),Vt(),st(!0),up(t,{get items(){return c(g)}}),Xe()}var Vq=J('<button type="button"> </button>');function Hq(t,e){Ge(e,!1);let n=x(e,"path",9),r=x(e,"value",9),i=x(e,"parser",9),s=x(e,"isSelected",9),o=x(e,"containsSearchResult",9),l=x(e,"containsActiveSearchResult",9),a=x(e,"onEdit",9);st(!0);var u=Vq();let f;var h=M(u);xe((d,p)=>{f=ct(u,1,"jse-inline-value svelte-h57m0p",null,f,d),et(h,p)},[()=>({"jse-selected":s(),"jse-highlight":o(),"jse-active":l()}),()=>Xu(i().stringify(r())??"",HD)],he),ae("dblclick",u,()=>a()(n())),D(t,u),Xe()}var qq=J('<span class="jse-column-sort-icon svelte-2i3vdx"><!></span>'),Uq=J('<button type="button"><span class="jse-column-name"> </span> <!></button>');function Wq(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0);let s=x(e,"path",9),o=x(e,"sortedColumn",9),l=x(e,"readOnly",9),a=x(e,"onSort",9);function u(){l()||a()({path:s(),sortDirection:c(r)===Ji.asc?Ji.desc:Ji.asc})}K(()=>(P(s()),ts),()=>{b(n,Yt(s())?"values":ts(s()))}),K(()=>(P(o()),P(s())),()=>{var v;b(r,o()&&Pt(s(),(v=o())==null?void 0:v.path)?o().sortDirection:void 0)}),K(()=>(c(r),Fy),()=>{b(i,c(r)?Fy[c(r)]:void 0)}),Vt(),st(!0);var f=Uq();let h;var d=M(f),p=M(d),g=N(d,2);{var m=v=>{var y=qq(),S=M(y);const k=he(()=>c(r)===Ji.asc?Wo:o9);Dt(S,{get data(){return c(k)}}),xe(()=>Jt(y,"title",`Currently sorted in ${c(i)} order`)),D(v,y)};te(g,v=>{c(r)!==void 0&&v(m)})}xe((v,y)=>{h=ct(f,1,"jse-column-header svelte-2i3vdx",null,h,v),Jt(f,"title",l()?c(n):c(n)+" (Click to sort the data by this column)"),et(p,y)},[()=>({"jse-readonly":l()}),()=>Xu(c(n),qD)],he),ae("click",f,u),D(t,f),Xe()}let Yf,Zf;function da(t,e){return Yf||(Zf=new WeakMap,Yf=new ResizeObserver(n=>{for(const r of n){const i=Zf.get(r.target);i&&i(r.target)}})),Zf.set(t,e),Yf.observe(t),{destroy:()=>{Zf.delete(t),Yf.unobserve(t)}}}var Jq=(t,e)=>e.onClick(),Kq=J(`An empty document cannot be opened in table mode. You can go to tree mode instead, or paste
|
|
82
|
-
a JSON Array using <b>Ctrl+V</b>.`,1),Gq=(t,e,n)=>e.openJSONEditorModal(c(n)),Xq=(t,e,n)=>e.extractPath(c(n)),Qq=J('<button type="button" class="jse-nested-array-action svelte-17xl1jx">Extract</button>'),Yq=J('<div class="jse-nested-property svelte-17xl1jx"><div class="jse-nested-property-path svelte-17xl1jx"> <span class="jse-nested-property-count svelte-17xl1jx"> </span></div> <button type="button" class="jse-nested-array-action svelte-17xl1jx"> </button> <!></div>'),Zq=(t,e)=>e.onChangeMode($n.tree),$q=J('<div class="jse-table-mode-welcome svelte-17xl1jx" role="none"><div class="jse-space jse-before svelte-17xl1jx"></div> <div class="jse-nested-arrays svelte-17xl1jx"><div class="jse-nested-arrays-title"> </div> <div class="jse-nested-arrays-info svelte-17xl1jx"><!></div> <!> <button type="button" class="jse-nested-array-action svelte-17xl1jx">Switch to tree mode</button></div> <div class="jse-space jse-after svelte-17xl1jx"></div></div>');function eU(t,e){Ge(e,!0);const n=$r(()=>e.json?HN(e.json).slice(0,99).filter(y=>y.length>0):[]),r=$r(()=>!Yt(c(n))),i=$r(()=>e.json===void 0&&(e.text===""||e.text===void 0)),s=$r(()=>c(r)?"Object with nested arrays":c(i)?"An empty document":Hn(e.json)?"An object":Nn(e.json)?"An empty array":`A ${Iv(e.json,e.parser)}`);function o(y){return De(e.json,y).length}var l=$q();l.__click=[Jq,e];var a=N(M(l),2),u=M(a),f=M(u),h=N(u,2),d=M(h);{var p=y=>{var S=ur(`An object cannot be opened in table mode. You can open a nested array instead, or open the
|
|
83
|
-
document in tree mode.`);D(y,S)},g=(y,S)=>{{var k=w=>{var E=Kq();D(w,E)},C=w=>{var E=ur();xe(()=>et(E,`${c(s)??""} cannot be opened in table mode. You can open the document in tree mode instead.`)),D(w,E)};te(y,w=>{c(i)&&!e.readOnly?w(k):w(C,!1)},S)}};te(d,y=>{c(r)?y(p):y(g,!1)})}var m=N(h,2);Sn(m,17,()=>c(n),Ln,(y,S)=>{var k=Yq();const C=$r(()=>o(c(S)));var w=M(k),E=M(w),A=N(E),O=M(A),H=N(w,2);H.__click=[Gq,e,S];var W=M(H),G=N(H,2);{var V=U=>{var Q=Qq();Q.__click=[Xq,e,S],D(U,Q)};te(G,U=>{e.readOnly||U(V)})}xe(U=>{et(E,`"${U??""}" `),et(O,`(${c(C)??""} ${c(C)!==1?"items":"item"})`),et(W,e.readOnly?"View":"Edit")},[()=>ts(c(S))]),D(y,k)});var v=N(m,2);v.__click=[Zq,e],xe(()=>et(f,c(s))),D(t,l),Xe()}Fu(["click"]);var tU=J('<button type="button"><!></button>');function nU(t,e){Ge(e,!1);let n=x(e,"count",9),r=x(e,"maxSampleCount",9),i=x(e,"readOnly",9),s=x(e,"onRefresh",9);st(!0);var o=tU();let l;var a=M(o);Dt(a,{data:x9}),xe(u=>{l=ct(o,1,"jse-column-header svelte-fzj761",null,l,u),Jt(o,"title",`The Columns are created by sampling ${r()} items out of ${n()}. If you're missing a column, click here to sample all of the items instead of a subset. This is slower.`)},[()=>({"jse-readonly":i()})],he),ae("click",o,()=>s()()),D(t,o),Xe()}function rU({json:t,documentState:e,selection:n,readOnly:r,onEditValue:i,onEditRow:s,onToggleEnforceString:o,onCut:l,onCopy:a,onPaste:u,onRemove:f,onDuplicateRow:h,onInsertBeforeRow:d,onInsertAfterRow:p,onRemoveRow:g}){const m=t!==void 0,v=!!n,y=t!==void 0&&n?De(t,He(n)):void 0,S=m&&(dn(n)||nr(n)||Qt(n)),k=!r&&m&&n!==void 0&&zh(n),C=k&&!Vn(y),w=!r&&S,E=n!==void 0?fo(t,e,He(n)):!1;return[{type:"separator"},{type:"row",items:[{type:"column",items:[{type:"label",text:"Table cell:"},{type:"dropdown-button",main:{type:"button",onClick:()=>i(),icon:Ma,text:"Edit",title:"Edit the value (Double-click on the value)",disabled:!k},width:"11em",items:[{type:"button",icon:Ma,text:"Edit",title:"Edit the value (Double-click on the value)",onClick:()=>i(),disabled:!k},{type:"button",icon:E?$S:tC,text:"Enforce string",title:"Enforce keeping the value as string when it contains a numeric value",onClick:()=>o(),disabled:!C}]},{type:"dropdown-button",main:{type:"button",onClick:()=>l(!0),icon:Ta,text:"Cut",title:"Cut selected contents, formatted with indentation (Ctrl+X)",disabled:!w},width:"10em",items:[{type:"button",icon:Ta,text:"Cut formatted",title:"Cut selected contents, formatted with indentation (Ctrl+X)",onClick:()=>l(!0),disabled:r||!S},{type:"button",icon:Ta,text:"Cut compacted",title:"Cut selected contents, without indentation (Ctrl+Shift+X)",onClick:()=>l(!1),disabled:r||!S}]},{type:"dropdown-button",main:{type:"button",onClick:()=>a(!0),icon:Fo,text:"Copy",title:"Copy selected contents, formatted with indentation (Ctrl+C)",disabled:!S},width:"12em",items:[{type:"button",icon:Fo,text:"Copy formatted",title:"Copy selected contents, formatted with indentation (Ctrl+C)",onClick:()=>a(!1),disabled:!S},{type:"button",icon:Fo,text:"Copy compacted",title:"Copy selected contents, without indentation (Ctrl+Shift+C)",onClick:()=>a(!1),disabled:!S}]},{type:"button",onClick:()=>u(),icon:ZS,text:"Paste",title:"Paste clipboard contents (Ctrl+V)",disabled:r||!v},{type:"button",onClick:()=>f(),icon:gm,text:"Remove",title:"Remove selected contents (Delete)",disabled:r||!S}]},{type:"column",items:[{type:"label",text:"Table row:"},{type:"button",onClick:()=>s(),icon:Ma,text:"Edit row",title:"Edit the current row",disabled:r||!v||!m},{type:"button",onClick:()=>h(),icon:iC,text:"Duplicate row",title:"Duplicate the current row (Ctrl+D)",disabled:r||!v||!m},{type:"button",onClick:()=>d(),icon:Sa,text:"Insert before",title:"Insert a row before the current row",disabled:r||!v||!m},{type:"button",onClick:()=>p(),icon:Sa,text:"Insert after",title:"Insert a row after the current row",disabled:r||!v||!m},{type:"button",onClick:()=>g(),icon:gm,text:"Remove row",title:"Remove current row",disabled:r||!v||!m}]}]}]}var iU=J('<div class="jse-table-root-error svelte-u14cgx"><!></div>'),sU=J('<th class="jse-table-cell jse-table-cell-header svelte-u14cgx"><!></th>'),oU=J('<th class="jse-table-cell jse-table-cell-header svelte-u14cgx"><!></th>'),lU=J('<th class="jse-table-cell jse-table-cell-gutter svelte-u14cgx"> <!></th>'),aU=J('<div class="jse-context-menu-anchor svelte-u14cgx"><!></div>'),cU=J('<td class="jse-table-cell svelte-u14cgx"><div><!><!></div> <!></td>'),uU=J('<td class="jse-table-cell svelte-u14cgx"></td>'),fU=J('<tr class="jse-table-row svelte-u14cgx"><!><!><!></tr>'),hU=J('<div class="jse-search-box-container svelte-u14cgx"><!></div> <div class="jse-contents svelte-u14cgx"><table class="jse-table-main svelte-u14cgx"><tbody><tr class="jse-table-row jse-table-row-header svelte-u14cgx"><th class="jse-table-cell jse-table-cell-header svelte-u14cgx"><!></th><!><!></tr><tr><td class="svelte-u14cgx"></td></tr><!><tr class="jse-table-invisible-end-section svelte-u14cgx"><td class="svelte-u14cgx"></td></tr></tbody></table></div> <!> <!> <!>',1),dU=J("<!> <!>",1),pU=J('<label class="jse-hidden-input-label svelte-u14cgx"><input type="text" tabindex="-1" class="jse-hidden-input svelte-u14cgx"></label> <!>',1),gU=J('<div class="jse-contents jse-contents-loading svelte-u14cgx"><div class="jse-loading-space svelte-u14cgx"></div> <div class="jse-loading svelte-u14cgx">loading...</div></div>'),mU=J('<div role="table"><!> <!></div> <!> <!>',1);function vU(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=rr("jsoneditor:TableMode"),{openAbsolutePopup:o,closeAbsolutePopup:l}=el("absolute-popup"),a=vC(),u=Ua(),f=Ua(),h=typeof window>"u";s("isSSR:",h);let d=x(e,"readOnly",9),p=x(e,"externalContent",9),g=x(e,"externalSelection",9),m=x(e,"history",9),v=x(e,"truncateTextSize",9),y=x(e,"mainMenuBar",9),S=x(e,"escapeControlCharacters",9),k=x(e,"escapeUnicodeCharacters",9),C=x(e,"flattenColumns",9),w=x(e,"parser",9),E=x(e,"parseMemoizeOne",9),A=x(e,"validator",9),O=x(e,"validationParser",9),H=x(e,"indentation",9),W=x(e,"onChange",9),G=x(e,"onChangeMode",9),V=x(e,"onSelect",9),U=x(e,"onUndo",9),Q=x(e,"onRedo",9),Y=x(e,"onRenderValue",9),ie=x(e,"onRenderMenu",9),F=x(e,"onRenderContextMenu",9),X=x(e,"onFocus",9),I=x(e,"onBlur",9),se=x(e,"onSortModal",9),ce=x(e,"onTransformModal",9),Te=x(e,"onJSONEditorModal",9),le=R(void 0,!0),de=R(void 0,!0),ne=R(void 0,!0),ue=R(void 0,!0),ge=R(void 0,!0);p0({onMount:Cr,onDestroy:Ii,getWindow:()=>Ku(c(de)),hasFocus:()=>Ye&&document.hasFocus()||Jv(c(de)),onFocus:()=>{Ve=!0,X()&&X()()},onBlur:()=>{Ve=!1,I()&&I()()}});let j=R(void 0,!0),we=R(void 0,!0),Pe=R(void 0,!0),q=R(void 0,!0),B,Se=R(void 0,!0),ke=R(!1,!0),z=R(!1,!0);function L(T){if(!c(ne))return;const fe=T?Fc:-100;c(ne).scrollTo({top:gi(ne,c(ne).scrollTop+=fe),left:c(ne).scrollLeft})}function ze(T){B=T,b(Se,B?QS(c(j),B.items):void 0)}async function We(T){b(oe,void 0),await on(T)}function je(){b(ke,!1),b(z,!1),mt()}let Qe=R(1e4,!0),be=R([],!0),gt=R(void 0,!0),Ye=!1,Ve=!1,_t=R(!1,!0),Nt=R({},!0),Ae=R(600,!0),Je=R(0,!0),ht=18;function it(T){c(ne)&&c(ne).scrollTo({top:c(ne).scrollTop,left:c(ne).scrollLeft})}function vt(T){b(oe,T)}function Ze(T){Pt(T,g())||(s("onSelect",T),V()(T))}function rt(T){!c(oe)||T===void 0||Ei(T,Fl(c(oe)))&&Ei(T,He(c(oe)))||(s("clearing selection: path does not exist anymore",c(oe)),b(oe,void 0))}let Le=R(c(j)!==void 0?cm({json:c(j)}):void 0,!0),oe=R(gu(g())?g():void 0,!0),Et=R(void 0,!0),bt=R(!1,!0);Cr(()=>{c(oe)&&fn(He(c(oe)))});function Un(T){if(d())return;s("onSortByHeader",T);const fe=[],ye=T.sortDirection===Ji.desc?-1:1,Ee=CC(c(j),fe,T.path,ye);Ft(Ee,(nt,qe)=>({state:qe,sortedColumn:T}))}let fr=R(void 0,!0);function ot(T){const fe={json:c(j)},ye=uu(T)?T.text!==c(we):!Pt(fe.json,T.json);if(s("update external content",{isChanged:ye}),!ye)return;const Ee={json:c(j),documentState:c(Le),selection:c(oe),sortedColumn:c(Et),text:c(we),textIsRepaired:c(bt)};if(uu(T))try{b(j,E()(T.text)),b(Le,pi(c(j),c(Le))),b(we,T.text),b(bt,!1),b(Pe,void 0)}catch(nt){try{b(j,E()(Ds(T.text))),b(Le,pi(c(j),c(Le))),b(we,T.text),b(bt,!0),b(Pe,void 0)}catch{b(j,void 0),b(Le,void 0),b(we,T.text),b(bt,!1),b(Pe,c(we)!==""?Wa(c(we),nt.message||String(nt)):void 0)}}else b(j,T.json),b(Le,pi(c(j),c(Le))),b(we,void 0),b(bt,!1),b(Pe,void 0);rt(c(j)),b(Et,void 0),ln(Ee)}function Ht(T){Pt(c(oe),T)||(s("applyExternalSelection",{selection:c(oe),externalSelection:T}),gu(T)&&b(oe,T))}function ln(T){if(T.json===void 0&&T.text===void 0)return;const fe=c(j)!==void 0&&T.json!==void 0;m().add({type:"tree",undo:{patch:fe?[{op:"replace",path:"",value:T.json}]:void 0,json:T.json,text:T.text,documentState:T.documentState,textIsRepaired:T.textIsRepaired,selection:Os(T.selection),sortedColumn:T.sortedColumn},redo:{patch:fe?[{op:"replace",path:"",value:c(j)}]:void 0,json:c(j),text:c(we),documentState:c(Le),textIsRepaired:c(bt),selection:Os(c(oe)),sortedColumn:c(Et)}})}let Gt=R([],!0);const lt=ef(yC);function yt(T,fe,ye,Ee){Ca(()=>{let nt;try{nt=lt(T,fe,ye,Ee)}catch(qe){nt=[{path:[],message:"Failed to validate: "+qe.message,severity:Yi.warning}]}Pt(nt,c(Gt))||(s("validationErrors changed:",nt),b(Gt,nt))},nt=>s(`validationErrors updated in ${nt} ms`))}function Xt(){return s("validate"),c(Pe)?{parseError:c(Pe),isRepairable:!1}:(yt(c(j),A(),w(),O()),Yt(c(Gt))?void 0:{validationErrors:c(Gt)})}function nn(T,fe){if(s("patch",T,fe),c(j)===void 0)throw new Error("Cannot apply patch: no JSON");const ye=c(j),Ee={json:void 0,text:c(we),documentState:c(Le),selection:Os(c(oe)),sortedColumn:c(Et),textIsRepaired:c(bt)},nt=GS(c(j),T),qe=DS(c(j),c(Le),T),kn=zN(c(Et),T,c(be)),Ct=typeof fe=="function"?fe(qe.json,qe.documentState,c(oe)):void 0;return b(j,(Ct==null?void 0:Ct.json)!==void 0?Ct.json:qe.json),b(Le,(Ct==null?void 0:Ct.state)!==void 0?Ct.state:qe.documentState),b(oe,(Ct==null?void 0:Ct.selection)!==void 0?Ct.selection:c(oe)),b(Et,(Ct==null?void 0:Ct.sortedColumn)!==void 0?Ct.sortedColumn:kn),b(we,void 0),b(bt,!1),b(q,void 0),b(Pe,void 0),m().add({type:"tree",undo:{patch:nt,...Ee},redo:{patch:T,json:void 0,text:void 0,documentState:c(Le),selection:Os(c(oe)),sortedColumn:c(Et),textIsRepaired:c(bt)}}),{json:c(j),previousJson:ye,undo:nt,redo:T}}function Ft(T,fe){s("handlePatch",T,fe);const ye={json:c(j),text:c(we)},Ee=nn(T,fe);return qt(ye,Ee),Ee}function qt(T,fe){if(!(T.json===void 0&&(T==null?void 0:T.text)===void 0)&&W()){if(c(we)!==void 0){const ye={text:c(we),json:void 0};W()(ye,T,{contentErrors:Xt(),patchResult:fe})}else if(c(j)!==void 0){const ye={text:void 0,json:c(j)};W()(ye,T,{contentErrors:Xt(),patchResult:fe})}}}function rn(T){s("pasted json as text",T),b(q,T)}function Gn(T){const fe=parseInt(T[0],10),ye=[String(fe+1),...T.slice(1)];return Ei(c(j),ye)?wt(ye):wt(T)}function mt(){s("focus"),c(ue)&&(c(ue).focus(),c(ue).select())}function dt(T){!pc(T.target,ye=>ye===c(de))&&ei(c(oe))&&(s("click outside the editor, exit edit mode"),b(oe,Os(c(oe))),Ve&&c(ue)&&(c(ue).focus(),c(ue).blur()),s("blur (outside editor)"),c(ue)&&c(ue).blur())}function Tt(T){b(Je,T.target.scrollTop)}function an(T){if(T.buttons!==1&&T.buttons!==2)return;const fe=T.target;fe.isContentEditable||mt();const ye=wS(fe);if(ye){if(ei(c(oe))&&mu(c(j),c(oe),ye))return;b(oe,wt(ye)),T.preventDefault()}}function $t(){if(Nn(c(j))&&!Yt(c(j))&&!Yt(c(be))){const T=["0",...c(be)[0]];return wt(T)}else return}function sn(){c(oe)||b(oe,$t())}function jt(){if(c(bt)&&c(j)!==void 0){const T={json:c(j),text:c(we)},fe={json:c(j),documentState:c(Le),selection:c(oe),sortedColumn:c(Et),text:c(we),textIsRepaired:c(bt)};b(we,void 0),b(bt,!1),rt(c(j)),ln(fe),qt(T,void 0)}return{json:c(j),text:c(we)}}function on(T,{scrollToWhenVisible:fe=!0}={}){const ye=c(ke)?Fc:0,Ee=cb(T,c(be),Nt,ht),nt=Ee-c(Je)+ye+ht,qe=me(T);if(s("scrollTo",{path:T,top:Ee,scrollTop:c(Je),elem:qe}),!c(ne))return Promise.resolve();const kn=c(ne).getBoundingClientRect();if(qe&&!fe){const An=qe.getBoundingClientRect();if(An.bottom>kn.top&&An.top<kn.bottom)return Promise.resolve()}const Ct=-Math.max(ye+2*ht,kn.height/4);return qe?new Promise(An=>{a(qe,{container:c(ne),offset:Ct,duration:sm,callback:()=>{Wn(T),An()}})}):new Promise(An=>{a(nt,{container:c(ne),offset:Ct,duration:sm,callback:()=>{_n(),Wn(T),An()}})})}function En(T){if(!c(ne))return;const{rowIndex:fe}=Bi(T,c(be)),ye=cb(T,c(be),Nt,ht),Ee=ye+(Nt[fe]||ht),nt=ht,qe=c(ne).getBoundingClientRect(),kn=c(Je),Ct=c(Je)+qe.height-nt;if(Ee>Ct){const An=Ee-Ct;gi(ne,c(ne).scrollTop+=An)}if(ye<kn){const An=kn-ye;gi(ne,c(ne).scrollTop-=An)}}function Wn(T){const fe=me(T);if(!fe||!c(ne))return;const ye=c(ne).getBoundingClientRect(),Ee=fe.getBoundingClientRect();if(Ee.right>ye.right){const nt=Ee.right-ye.right;gi(ne,c(ne).scrollLeft+=nt)}if(Ee.left<ye.left){const nt=ye.left-Ee.left;gi(ne,c(ne).scrollLeft-=nt)}}function fn(T){En(T),Wn(T)}function me(T){var Ee;const fe=c(be).find(nt=>po(T.slice(1),nt)),ye=fe?T.slice(0,1).concat(fe):T;return((Ee=c(ne))==null?void 0:Ee.querySelector(`td[data-path="${im(ye)}"]`))??void 0}function xt({anchor:T,left:fe,top:ye,width:Ee,height:nt,offsetTop:qe,offsetLeft:kn,showTip:Ct}){const An=rU({json:c(j),documentState:c(Le),selection:c(oe),readOnly:d(),onEditValue:ir,onEditRow:Fn,onToggleEnforceString:kr,onCut:hr,onCopy:ee,onPaste:oi,onRemove:Oe,onDuplicateRow:Mt,onInsertBeforeRow:St,onInsertAfterRow:Rt,onRemoveRow:cn}),_=F()(An)??An;if(_===!1)return;const $={tip:Ct?"Tip: you can open this context menu via right-click or with Ctrl+Q":void 0,items:_,onRequestClose(){l(Be),mt()}},Ce={left:fe,top:ye,offsetTop:qe,offsetLeft:kn,width:Ee,height:nt,anchor:T,closeOnOuterClick:!0,onClose:()=>{Ye=!1,mt()}};Ye=!0;const Be=o(DC,$,Ce)}function mn(T){var fe,ye;if(!ei(c(oe)))if(T&&(T.stopPropagation(),T.preventDefault()),T&&T.type==="contextmenu"&&T.target!==c(ue))xt({left:T.clientX,top:T.clientY,width:Zs,height:Ys,showTip:!1});else{const Ee=(fe=c(ne))==null?void 0:fe.querySelector(".jse-table-cell.jse-selected-value");if(Ee)xt({anchor:Ee,offsetTop:2,width:Zs,height:Ys,showTip:!1});else{const nt=(ye=c(ne))==null?void 0:ye.getBoundingClientRect();nt&&xt({top:nt.top+2,left:nt.left+2,width:Zs,height:Ys,showTip:!1})}}}function Ke(T){xt({anchor:xS(T.target,"BUTTON"),offsetTop:0,width:Zs,height:Ys,showTip:!0})}function ir(){if(d()||!c(oe))return;const T=He(c(oe)),fe=De(c(j),T);Vn(fe)?zi(T):b(oe,wt(T))}function Fn(){if(d()||!c(oe))return;const fe=He(c(oe)).slice(0,1);zi(fe)}function kr(){if(d()||!Qt(c(oe)))return;const T=c(oe).path,fe=tt(T),ye=De(c(j),T),Ee=!fo(c(j),c(Le),T),nt=Ee?String(ye):hc(String(ye),w());s("handleToggleEnforceString",{enforceString:Ee,value:ye,updatedValue:nt}),Ft([{op:"replace",path:fe,value:nt}],(qe,kn)=>({state:Zd(c(j),kn,T,{type:"value",enforceString:Ee})}))}async function si(){if(s("apply pasted json",c(q)),!c(q))return;const{onPasteAsJson:T}=c(q);T(),setTimeout(mt)}async function oi(){try{const T=await navigator.clipboard.readText();xi(T)}catch(T){console.error(T),b(_t,!0)}}function fs(){s("clear pasted json"),b(q,void 0),mt()}function hs(){G()($n.text)}async function hr(T){await _C({json:c(j),selection:c(oe),indentation:T?H():void 0,readOnly:d(),parser:w(),onPatch:Ft})}async function ee(T=!0){c(j)!==void 0&&await EC({json:c(j),selection:c(oe),indentation:T?H():void 0,parser:w()})}function Oe(){MC({json:c(j),text:c(we),selection:c(oe),keepSelection:!0,readOnly:d(),onChange:W(),onPatch:Ft})}function pt(T){if(d())return;s("extract",{path:T});const fe=WS(c(j),wt(T));Ft(fe)}function Mt(){qN({json:c(j),selection:c(oe),columns:c(be),readOnly:d(),onPatch:Ft})}function St(){UN({json:c(j),selection:c(oe),columns:c(be),readOnly:d(),onPatch:Ft})}function Rt(){WN({json:c(j),selection:c(oe),columns:c(be),readOnly:d(),onPatch:Ft})}function cn(){JN({json:c(j),selection:c(oe),columns:c(be),readOnly:d(),onPatch:Ft})}async function sr(T){await RC({char:T,selectInside:!1,json:c(j),selection:c(oe),readOnly:d(),parser:w(),onPatch:Ft,onReplaceJson:Gr,onSelect:vt})}function jn(T){const fe=uo(T);if(s("keydown",{combo:fe,key:T.key}),fe==="Ctrl+X"&&(T.preventDefault(),hr(!0)),fe==="Ctrl+Shift+X"&&(T.preventDefault(),hr(!1)),fe==="Ctrl+C"&&(T.preventDefault(),ee(!0)),fe==="Ctrl+Shift+C"&&(T.preventDefault(),ee(!1)),fe==="Ctrl+D"&&(T.preventDefault(),Mt()),(fe==="Delete"||fe==="Backspace")&&(T.preventDefault(),Oe()),fe==="Insert"&&T.preventDefault(),fe==="Ctrl+A"&&T.preventDefault(),fe==="Ctrl+Q"&&mn(T),fe==="ArrowLeft"&&(T.preventDefault(),sn(),c(oe))){const Ee=LN(c(be),c(oe));b(oe,Ee),fn(He(Ee))}if(fe==="ArrowRight"&&(T.preventDefault(),sn(),c(oe))){const Ee=NN(c(be),c(oe));b(oe,Ee),fn(He(Ee))}if(fe==="ArrowUp"&&(T.preventDefault(),sn(),c(oe))){const Ee=DN(c(be),c(oe));b(oe,Ee),fn(He(Ee))}if(fe==="ArrowDown"&&(T.preventDefault(),sn(),c(oe))){const Ee=IN(c(j),c(be),c(oe));b(oe,Ee),fn(He(Ee))}if(fe==="Enter"&&c(oe)&&Qt(c(oe))){T.preventDefault();const Ee=c(oe).path,nt=De(c(j),Ee);Vn(nt)?zi(Ee):d()||b(oe,{...c(oe),edit:!0})}if(fe.replace(/^Shift\+/,"").length===1&&c(oe)){T.preventDefault(),sr(T.key);return}if(fe==="Ctrl+Enter"&&Qt(c(oe))){T.preventDefault();const Ee=De(c(j),c(oe).path);zd(Ee)&&window.open(String(Ee),"_blank")}fe==="Escape"&&c(oe)&&(T.preventDefault(),b(oe,void 0)),fe==="Ctrl+F"&&(T.preventDefault(),Vi(!1)),fe==="Ctrl+H"&&(T.preventDefault(),Vi(!0)),fe==="Ctrl+Z"&&(T.preventDefault(),ea()),fe==="Ctrl+Shift+Z"&&(T.preventDefault(),ll())}function zn(T){var ye;T.preventDefault();const fe=(ye=T.clipboardData)==null?void 0:ye.getData("text/plain");xi(fe)}function xi(T){T!==void 0&&TC({clipboardText:T,json:c(j),selection:c(oe),readOnly:d(),parser:w(),onPatch:Ft,onChangeText:ds,openRepairModal:Si})}function Gr(T,fe){const ye={json:c(j),text:c(we)},Ee={json:c(j),documentState:c(Le),selection:c(oe),sortedColumn:c(Et),text:c(we),textIsRepaired:c(bt)},nt=pi(T,c(Le)),qe=typeof fe=="function"?fe(T,nt,c(oe)):void 0;b(j,(qe==null?void 0:qe.json)!==void 0?qe.json:T),b(Le,(qe==null?void 0:qe.state)!==void 0?qe.state:nt),b(oe,(qe==null?void 0:qe.selection)!==void 0?qe.selection:c(oe)),b(Et,void 0),b(we,void 0),b(bt,!1),b(Pe,void 0),rt(c(j)),ln(Ee),qt(ye,void 0)}function ds(T,fe){s("handleChangeText");const ye={json:c(j),text:c(we)},Ee={json:c(j),documentState:c(Le),selection:c(oe),sortedColumn:c(Et),text:c(we),textIsRepaired:c(bt)};try{b(j,E()(T)),b(Le,pi(c(j),c(Le))),b(we,void 0),b(bt,!1),b(Pe,void 0)}catch(qe){try{b(j,E()(Ds(T))),b(Le,pi(c(j),c(Le))),b(we,T),b(bt,!0),b(Pe,void 0)}catch{b(j,void 0),b(Le,void 0),b(we,T),b(bt,!1),b(Pe,c(we)!==""?Wa(c(we),qe.message||String(qe)):void 0)}}if(typeof fe=="function"){const qe=fe(c(j),c(Le),c(oe));b(j,(qe==null?void 0:qe.json)!==void 0?qe.json:c(j)),b(Le,(qe==null?void 0:qe.state)!==void 0?qe.state:c(Le)),b(oe,(qe==null?void 0:qe.selection)!==void 0?qe.selection:c(oe))}rt(c(j)),ln(Ee),qt(ye,void 0)}function ps(T){s("select validation error",T),b(oe,wt(T.path)),on(T.path)}function wi(T){d()||c(j)===void 0||(Ye=!0,se()({id:u,json:c(j),rootPath:T,onSort:({operations:fe,itemPath:ye,direction:Ee})=>{s("onSort",fe,T,ye,Ee),Ft(fe,(nt,qe)=>({state:qe,sortedColumn:{path:ye,sortDirection:Ee===-1?Ji.desc:Ji.asc}}))},onClose:()=>{Ye=!1,setTimeout(mt)}}))}function li(T){if(c(j)===void 0)return;const{id:fe,onTransform:ye,onClose:Ee}=T,nt=T.rootPath||[];Ye=!0,ce()({id:fe||f,json:c(j),rootPath:nt||[],onTransform:qe=>{ye?ye({operations:qe,json:c(j),transformedJson:Xi(c(j),qe)}):(s("onTransform",nt,qe),Ft(qe))},onClose:()=>{Ye=!1,setTimeout(mt),Ee&&Ee()}})}function zi(T){s("openJSONEditorModal",{path:T}),Ye=!0,Te()({content:{json:De(c(j),T)},path:T,onPatch:Ft,onClose:()=>{Ye=!1,setTimeout(mt)}})}function Si(T,fe){b(ge,{text:T,onParse:ye=>Xd(ye,Ee=>Ju(Ee,w())),onRepair:hS,onApply:fe,onClose:mt})}function dr(){wi([])}function gs(){li({rootPath:[]})}function Vi(T){s("openFind",{findAndReplace:T}),b(ke,!1),b(z,!1),_n(),b(ke,!0),b(z,T)}function ea(){if(d()||!m().canUndo)return;const T=m().undo();if(!Fh(T)){U()(T);return}const fe={json:c(j),text:c(we)};b(j,T.undo.patch?Xi(c(j),T.undo.patch):T.undo.json),b(Le,T.undo.documentState),b(oe,T.undo.selection),b(Et,T.undo.sortedColumn),b(we,T.undo.text),b(bt,T.undo.textIsRepaired),b(Pe,void 0),s("undo",{item:T,json:c(j)});const ye=T.undo.patch&&T.redo.patch?{json:c(j),previousJson:fe.json,redo:T.undo.patch,undo:T.redo.patch}:void 0;qt(fe,ye),mt(),c(oe)&&on(He(c(oe)),{scrollToWhenVisible:!1})}function ll(){if(d()||!m().canRedo)return;const T=m().redo();if(!Fh(T)){Q()(T);return}const fe={json:c(j),text:c(we)};b(j,T.redo.patch?Xi(c(j),T.redo.patch):T.redo.json),b(Le,T.redo.documentState),b(oe,T.redo.selection),b(Et,T.redo.sortedColumn),b(we,T.redo.text),b(bt,T.redo.textIsRepaired),b(Pe,void 0),s("redo",{item:T,json:c(j)});const ye=T.undo.patch&&T.redo.patch?{json:c(j),previousJson:fe.json,redo:T.redo.patch,undo:T.undo.patch}:void 0;qt(fe,ye),mt(),c(oe)&&on(He(c(oe)),{scrollToWhenVisible:!1})}function xc(T){b(Ae,T.getBoundingClientRect().height)}function ta(T,fe){Nt[fe]=T.getBoundingClientRect().height}K(()=>(P(S()),P(k())),()=>{b(le,Uv({escapeControlCharacters:S(),escapeUnicodeCharacters:k()}))}),K(()=>c(ke),()=>{L(c(ke))}),K(()=>P(p()),()=>{ot(p())}),K(()=>P(g()),()=>{Ht(g())}),K(()=>(c(be),c(j),P(C()),c(Qe)),()=>{b(be,Nn(c(j))?MN(TN(c(j),C(),c(Qe)),c(be)):[])}),K(()=>(c(j),c(be)),()=>{b(gt,!!(c(j)&&!Yt(c(be))))}),K(()=>(c(j),c(Qe)),()=>{b(n,Array.isArray(c(j))&&c(j).length>c(Qe))}),K(()=>(c(Je),c(Ae),c(j),c(ke),Fc),()=>{b(r,RN(c(Je),c(Ae),c(j),Nt,ht,c(ke)?Fc:0))}),K(()=>c(j),()=>{it(c(j))}),K(()=>c(oe),()=>{Ze(c(oe))}),K(()=>(P(d()),P(v()),P(w()),c(le),c(j),c(Le),P(Y())),()=>{b(fr,{mode:$n.table,readOnly:d(),truncateTextSize:v(),parser:w(),normalization:c(le),getJson:()=>c(j),getDocumentState:()=>c(Le),findElement:me,findNextInside:Gn,focus:mt,onPatch:(T,fe)=>Ft(_6(T,c(j)),fe),onSelect:vt,onFind:Vi,onPasteJson:rn,onRenderValue:Y()})}),K(()=>(c(j),P(A()),P(w()),P(O())),()=>{yt(c(j),A(),w(),O())}),K(()=>(c(Gt),c(be)),()=>{b(i,jN(c(Gt),c(be)))}),Vt(),st(!0);var na=mU();ae("mousedown",to,dt);var en=$e(na);let ra;var ia=M(en);{var Z=T=>{zq(T,{get containsValidArray(){return c(gt)},get readOnly(){return d()},get history(){return m()},onSort:dr,onTransform:gs,onUndo:ea,onRedo:ll,onContextMenu:Ke,get onRenderMenu(){return ie()},get showSearch(){return c(ke)},set showSearch(fe){b(ke,fe)},$$legacy:!0})};te(ia,T=>{y()&&T(Z)})}var ve=N(ia,2);{var ut=T=>{var fe=pU(),ye=$e(fe),Ee=M(ye);Ee.readOnly=!0,gn(Ee,Ct=>b(ue,Ct),()=>c(ue));var nt=N(ye,2);{var qe=Ct=>{var An=hU(),_=$e(An),$=M(_);kC($,{get json(){return c(j)},get documentState(){return c(Le)},get parser(){return w()},get showSearch(){return c(ke)},get showReplace(){return c(z)},get readOnly(){return d()},get columns(){return c(be)},onSearch:ze,onFocus:We,onPatch:Ft,onClose:je});var Ce=N(_,2),Be=M(Ce),Me=M(Be),Ue=M(Me),Jn=M(Ue),kt=M(Jn);{var Nr=Mn=>{var or=bn();const qs=he(()=>{var Ws;return sg([],(Ws=c(i))==null?void 0:Ws.root)});var So=$e(or);{var Us=Ws=>{var wc=iU(),Ap=M(wc);Da(Ap,{get validationError(){return c(qs)},onExpand:ki}),D(Ws,wc)};te(So,Ws=>{c(qs)&&Ws(Us)})}D(Mn,or)};te(kt,Mn=>{var or;Yt((or=c(i))==null?void 0:or.root)||Mn(Nr)})}var ci=N(Jn);Sn(ci,1,()=>c(be),Ln,(Mn,or)=>{var qs=sU(),So=M(qs);Wq(So,{get path(){return c(or)},get sortedColumn(){return c(Et)},get readOnly(){return d()},onSort:Un}),D(Mn,qs)});var al=N(ci);{var vs=Mn=>{var or=oU(),qs=M(or);const So=he(()=>Array.isArray(c(j))?c(j).length:0);nU(qs,{get count(){return c(So)},get maxSampleCount(){return c(Qe)},get readOnly(){return d()},onRefresh:()=>b(Qe,1/0)}),D(Mn,or)};te(al,Mn=>{c(n)&&Mn(vs)})}var jr=N(Ue);let cl;var ul=M(jr);let fl;var sa=N(jr);Sn(sa,1,()=>c(r).visibleItems,Ln,(Mn,or,qs)=>{var So=fU();const Us=he(()=>c(r).startIndex+qs),Ws=he(()=>c(i).rows[c(Us)]),wc=he(()=>{var ys;return sg([String(c(Us))],(ys=c(Ws))==null?void 0:ys.row)}),Ap=he(()=>Ol(c(j),c(Se),[String(c(Us))]));var t1=M(So);B2(t1,()=>c(Us),ys=>{var Js=lU(),hf=M(Js),r1=N(hf);{var Sc=Br=>{Da(Br,{get validationError(){return c(wc)},onExpand:ki})};te(r1,Br=>{c(wc)&&Br(Sc)})}Tr(Js,(Br,oa)=>da==null?void 0:da(Br,oa),()=>Br=>ta(Br,c(Us))),xe(()=>et(hf,`${c(Us)??""} `)),D(ys,Js)});var n1=N(t1);Sn(n1,1,()=>c(be),Ln,(ys,Js,hf,r1)=>{var Sc=cU();const Br=he(()=>[String(c(Us))].concat(c(Js))),oa=he(()=>De(c(or),c(Js))),df=he(()=>Qt(c(oe))&&po(c(oe).path,c(Br))),FO=he(()=>{var lr;return(lr=c(Ws))==null?void 0:lr.columns[hf]}),i1=he(()=>sg(c(Br),c(FO)));var Op=M(Sc);let s1;var o1=M(Op);{var zO=lr=>{const bs=he(()=>dm(Ol(c(or),c(Ap),c(Js)))),Cc=he(()=>c(bs)?c(bs).some(Ep=>Ep.active):!1),_p=he(()=>!Yt(c(bs)));Hq(lr,{get path(){return c(Br)},get value(){return c(oa)},get parser(){return w()},get isSelected(){return c(df)},get containsSearchResult(){return c(_p)},get containsActiveSearchResult(){return c(Cc)},onEdit:zi})},VO=lr=>{const bs=he(()=>{var l1;return(l1=Ol(c(j),c(Se),c(Br)))==null?void 0:l1.searchResults}),Cc=he(()=>c(oa)!==void 0?c(oa):""),_p=he(()=>fo(c(j),c(Le),c(Br))),Ep=he(()=>c(df)?c(oe):void 0);wC(lr,{get path(){return c(Br)},get value(){return c(Cc)},get enforceString(){return c(_p)},get selection(){return c(Ep)},get searchResultItems(){return c(bs)},get context(){return c(fr)}})};te(o1,lr=>{Vn(c(oa))?lr(zO):lr(VO,!1)})}var HO=N(o1);{var qO=lr=>{var bs=aU(),Cc=M(bs);Oo(Cc,{selected:!0,onContextMenu:xt}),D(lr,bs)};te(HO,lr=>{!d()&&c(df)&&!ei(c(oe))&&lr(qO)})}var UO=N(Op,2);{var WO=lr=>{Da(lr,{get validationError(){return c(i1)},onExpand:ki})};te(UO,lr=>{c(i1)&&lr(WO)})}xe((lr,bs)=>{Jt(Sc,"data-path",lr),s1=ct(Op,1,"jse-value-outer svelte-u14cgx",null,s1,bs)},[()=>im(c(Br)),()=>({"jse-selected-value":c(df)})],he),D(ys,Sc)});var jO=N(n1);{var BO=ys=>{var Js=uU();D(ys,Js)};te(jO,ys=>{c(n)&&ys(BO)})}D(Mn,So)});var cf=N(sa),uf=M(cf);let ff;gn(Ce,Mn=>b(ne,Mn),()=>c(ne)),Tr(Ce,(Mn,or)=>da==null?void 0:da(Mn,or),()=>xc),cr(()=>ae("scroll",Ce,Tt));var Ar=N(Ce,2);{var hl=Mn=>{const or=he(()=>`You pasted a JSON ${Array.isArray(c(q).contents)?"array":"object"} as text`);es(Mn,{type:"info",get message(){return c(or)},actions:[{icon:Ga,text:"Paste as JSON instead",title:"Paste the text as JSON instead of a single value",onMouseDown:si},{text:"Leave as is",title:"Keep the pasted content as a single value",onClick:fs}]})};te(Ar,Mn=>{c(q)&&Mn(hl)})}var e1=N(Ar,2);{var LO=Mn=>{const or=he(()=>d()?[]:[{icon:c0,text:"Ok",title:"Accept the repaired document",onClick:jt},{icon:qh,text:"Repair manually instead",title:"Leave the document unchanged and repair it manually instead",onClick:hs}]);es(Mn,{type:"success",message:"The loaded JSON document was invalid but is successfully repaired.",get actions(){return c(or)},onClose:mt})};te(e1,Mn=>{c(bt)&&Mn(LO)})}var NO=N(e1,2);g0(NO,{get validationErrors(){return c(Gt)},selectError:ps}),xe(Mn=>{cl=ct(jr,1,"jse-table-invisible-start-section svelte-u14cgx",null,cl,Mn),Jt(ul,"colspan",c(be).length),fl=Gi(ul,"",fl,{height:c(r).startHeight+"px"}),Jt(uf,"colspan",c(be).length),ff=Gi(uf,"",ff,{height:c(r).endHeight+"px"})},[()=>({"jse-search-box-background":c(ke)})],he),D(Ct,An)},kn=(Ct,An)=>{{var _=Ce=>{var Be=dU(),Me=$e(Be);const Ue=he(()=>d()?[]:[{icon:qh,text:"Repair manually",title:'Open the document in "code" mode and repair it manually',onClick:hs}]);es(Me,{type:"error",message:"The loaded JSON document is invalid and could not be repaired automatically.",get actions(){return c(Ue)}});var Jn=N(Me,2);PC(Jn,{get text(){return c(we)},get json(){return c(j)},get indentation(){return H()},get parser(){return w()}}),D(Ce,Be)},$=Ce=>{eU(Ce,{get text(){return c(we)},get json(){return c(j)},get readOnly(){return d()},get parser(){return w()},openJSONEditorModal:zi,extractPath:pt,get onChangeMode(){return G()},onClick:()=>{mt()}})};te(Ct,Ce=>{c(Pe)&&c(we)!==void 0&&c(we)!==""?Ce(_):Ce($,!1)},An)}};te(nt,Ct=>{c(gt)?Ct(qe):Ct(kn,!1)})}ae("paste",Ee,zn),D(T,fe)},un=T=>{var fe=gU();D(T,fe)};te(ve,T=>{h?T(un,!1):T(ut)})}gn(en,T=>b(de,T),()=>c(de));var Tn=N(en,2);{var Cn=T=>{bC(T,{onClose:()=>b(_t,!1)})};te(Tn,T=>{c(_t)&&T(Cn)})}var ai=N(Tn,2);{var ms=T=>{xC(T,jo(()=>c(ge),{onClose:()=>{var fe;(fe=c(ge))==null||fe.onClose(),b(ge,void 0)}}))};te(ai,T=>{c(ge)&&T(ms)})}return xe(T=>ra=ct(en,1,"jse-table-mode svelte-u14cgx",null,ra,T),[()=>({"no-main-menu":!y()})],he),ae("mousedown",en,an),ae("keydown",en,jn),ae("contextmenu",en,mn),D(t,na),at(e,"validate",Xt),at(e,"patch",nn),at(e,"focus",mt),at(e,"acceptAutoRepair",jt),at(e,"scrollTo",on),at(e,"findElement",me),at(e,"openTransformModal",li),Xe({validate:Xt,patch:nn,focus:mt,acceptAutoRepair:jt,scrollTo:on,findElement:me,openTransformModal:li})}function IO(t,e){Ge(e,!1);let n=x(e,"content",8),r=x(e,"selection",12),i=x(e,"readOnly",8),s=x(e,"indentation",8),o=x(e,"tabSize",8),l=x(e,"truncateTextSize",8),a=x(e,"externalMode",8),u=x(e,"mainMenuBar",8),f=x(e,"navigationBar",8),h=x(e,"statusBar",8),d=x(e,"askToFormat",8),p=x(e,"escapeControlCharacters",8),g=x(e,"escapeUnicodeCharacters",8),m=x(e,"flattenColumns",8),v=x(e,"parser",8),y=x(e,"parseMemoizeOne",8),S=x(e,"validator",8),k=x(e,"validationParser",8),C=x(e,"pathParser",8),w=x(e,"insideModal",8),E=x(e,"onChange",8),A=x(e,"onChangeMode",8),O=x(e,"onSelect",8),H=x(e,"onRenderValue",8),W=x(e,"onClassName",8),G=x(e,"onRenderMenu",8),V=x(e,"onRenderContextMenu",8),U=x(e,"onError",8),Q=x(e,"onFocus",8),Y=x(e,"onBlur",8),ie=x(e,"onSortModal",8),F=x(e,"onTransformModal",8),X=x(e,"onJSONEditorModal",8),I=R(),se=R(),ce=R();const Te=rr("jsoneditor:JSONEditorRoot"),le=LC({onChange:Ae=>b(de,Ae)});let de=R(le.get()),ne=R(a());function ue(Ae){if(Ae===c(ne))return;const Je={type:"mode",undo:{mode:c(ne),selection:void 0},redo:{mode:Ae,selection:void 0}};c(ne)==="text"&&c(ce)&&c(ce).flush(),Te("add history item",Je),c(de).add(Je),b(ne,Ae)}function ge(Ae){if(Hy(Ae)){b(ne,Ae.undo.mode);const Je=c(de).items(),ht=Je.findIndex(vt=>vt===Ae),it=ht!==-1?Je[ht-1]:void 0;Te("handleUndo",{index:ht,item:Ae,items:Je,prevItem:it}),it&&r(it.redo.selection),A()(c(ne))}}function j(Ae){if(Hy(Ae)){b(ne,Ae.redo.mode);const Je=c(de).items(),ht=Je.findIndex(vt=>vt===Ae),it=ht!==-1?Je[ht+1]:void 0;Te("handleRedo",{index:ht,item:Ae,items:Je,nextItem:it}),it&&r(it.undo.selection),A()(c(ne))}}let we=R();const Pe={type:"separator"};let q=R(),B=R();function Se(Ae){if(c(I))return c(I).patch(Ae);if(c(se))return c(se).patch(Ae);if(c(ce))return c(ce).patch(Ae);throw new Error(`Method patch is not available in mode "${c(ne)}"`)}function ke(Ae,Je){if(c(I))return c(I).expand(Ae,Je);throw new Error(`Method expand is not available in mode "${c(ne)}"`)}function z(Ae,Je){if(c(I))return c(I).collapse(Ae,Je);throw new Error(`Method collapse is not available in mode "${c(ne)}"`)}function L(Ae){if(c(ce))c(ce).openTransformModal(Ae);else if(c(I))c(I).openTransformModal(Ae);else if(c(se))c(se).openTransformModal(Ae);else throw new Error(`Method transform is not available in mode "${c(ne)}"`)}function ze(){if(c(ce))return c(ce).validate();if(c(I))return c(I).validate();if(c(se))return c(se).validate();throw new Error(`Method validate is not available in mode "${c(ne)}"`)}function We(){return c(I)?c(I).acceptAutoRepair():n()}function je(Ae){if(c(I))return c(I).scrollTo(Ae);if(c(se))return c(se).scrollTo(Ae);throw new Error(`Method scrollTo is not available in mode "${c(ne)}"`)}function Qe(Ae){if(c(I))return c(I).findElement(Ae);if(c(se))return c(se).findElement(Ae);throw new Error(`Method findElement is not available in mode "${c(ne)}"`)}function be(){c(ce)?c(ce).focus():c(I)?c(I).focus():c(se)&&c(se).focus()}async function gt(){c(ce)&&await c(ce).refresh()}K(()=>P(a()),()=>{ue(a())}),K(()=>(c(ne),P(A())),()=>{b(we,[{type:"button",text:"text",title:`Switch to text mode (current mode: ${c(ne)})`,className:"jse-group-button jse-first"+(c(ne)===$n.text?" jse-selected":""),onClick:()=>A()($n.text)},{type:"button",text:"tree",title:`Switch to tree mode (current mode: ${c(ne)})`,className:"jse-group-button "+(c(ne)===$n.tree?" jse-selected":""),onClick:()=>A()($n.tree)},{type:"button",text:"table",title:`Switch to table mode (current mode: ${c(ne)})`,className:"jse-group-button jse-last"+(c(ne)===$n.table?" jse-selected":""),onClick:()=>A()($n.table)}])}),K(()=>(c(we),P(G()),c(ne),P(w()),P(i())),()=>{b(q,Ae=>{const Je=ES(Ae[0])?c(we).concat(Ae):c(we).concat(Pe,Ae),ht=tm(Je);return G()(Je,{mode:c(ne),modal:w(),readOnly:i()})||ht})}),K(()=>(P(V()),c(ne),P(w()),P(i()),P(r())),()=>{b(B,Ae=>{const Je=tm(Ae);return V()(Ae,{mode:c(ne),modal:w(),readOnly:i(),selection:r()})??(i()?!1:Je)})}),Vt(),st();var Ye=bn(),Ve=$e(Ye);{var _t=Ae=>{gn(Fq(Ae,{get externalContent(){return n()},get externalSelection(){return r()},get history(){return c(de)},get readOnly(){return i()},get indentation(){return s()},get tabSize(){return o()},get mainMenuBar(){return u()},get statusBar(){return h()},get askToFormat(){return d()},get escapeUnicodeCharacters(){return g()},get parser(){return v()},get validator(){return S()},get validationParser(){return k()},get onChange(){return E()},get onChangeMode(){return A()},get onSelect(){return O()},onUndo:ge,onRedo:j,get onError(){return U()},get onFocus(){return Q()},get onBlur(){return Y()},get onRenderMenu(){return c(q)},get onSortModal(){return ie()},get onTransformModal(){return F()},$$legacy:!0}),Je=>b(ce,Je),()=>c(ce))},Nt=(Ae,Je)=>{{var ht=vt=>{gn(vU(vt,{get externalContent(){return n()},get externalSelection(){return r()},get history(){return c(de)},get readOnly(){return i()},get truncateTextSize(){return l()},get mainMenuBar(){return u()},get escapeControlCharacters(){return p()},get escapeUnicodeCharacters(){return g()},get flattenColumns(){return m()},get parser(){return v()},get parseMemoizeOne(){return y()},get validator(){return S()},get validationParser(){return k()},get indentation(){return s()},get onChange(){return E()},get onChangeMode(){return A()},get onSelect(){return O()},onUndo:ge,onRedo:j,get onRenderValue(){return H()},get onFocus(){return Q()},get onBlur(){return Y()},get onRenderMenu(){return c(q)},get onRenderContextMenu(){return c(B)},get onSortModal(){return ie()},get onTransformModal(){return F()},get onJSONEditorModal(){return X()},$$legacy:!0}),Ze=>b(se,Ze),()=>c(se))},it=vt=>{gn(bm(vt,{get externalContent(){return n()},get externalSelection(){return r()},get history(){return c(de)},get readOnly(){return i()},get indentation(){return s()},get truncateTextSize(){return l()},get mainMenuBar(){return u()},get navigationBar(){return f()},get escapeControlCharacters(){return p()},get escapeUnicodeCharacters(){return g()},get parser(){return v()},get parseMemoizeOne(){return y()},get validator(){return S()},get validationParser(){return k()},get pathParser(){return C()},get onError(){return U()},get onChange(){return E()},get onChangeMode(){return A()},get onSelect(){return O()},onUndo:ge,onRedo:j,get onRenderValue(){return H()},get onClassName(){return W()},get onFocus(){return Q()},get onBlur(){return Y()},get onRenderMenu(){return c(q)},get onRenderContextMenu(){return c(B)},get onSortModal(){return ie()},get onTransformModal(){return F()},get onJSONEditorModal(){return X()},$$legacy:!0}),Ze=>b(I,Ze),()=>c(I))};te(Ae,vt=>{c(ne)===$n.table?vt(ht):vt(it,!1)},Je)}};te(Ve,Ae=>{c(ne)===$n.text||String(c(ne))==="code"?Ae(_t):Ae(Nt,!1)})}return D(t,Ye),at(e,"patch",Se),at(e,"expand",ke),at(e,"collapse",z),at(e,"transform",L),at(e,"validate",ze),at(e,"acceptAutoRepair",We),at(e,"scrollTo",je),at(e,"findElement",Qe),at(e,"focus",be),at(e,"refresh",gt),Xe({patch:Se,expand:ke,collapse:z,transform:L,validate:ze,acceptAutoRepair:We,scrollTo:je,findElement:Qe,focus:be,refresh:gt})}var yU=J('<div class="jse-error svelte-v0el4e"> </div>'),bU=J('<button type="button" class="jse-secondary svelte-v0el4e"><!> Back</button>'),xU=J('<button type="button" class="jse-primary svelte-v0el4e">Apply</button>'),wU=J('<button type="button" class="jse-primary svelte-v0el4e">Close</button>'),SU=J('<!> <div class="jse-modal-contents svelte-v0el4e"><div class="jse-label svelte-v0el4e"><div class="jse-label-inner svelte-v0el4e">Path</div></div> <input class="jse-path svelte-v0el4e" type="text" readonly="" title="Selected path"> <div class="jse-label svelte-v0el4e"><div class="jse-label-inner svelte-v0el4e">Contents</div></div> <div class="jse-modal-inline-editor svelte-v0el4e"><!></div> <div class="jse-actions svelte-v0el4e"><!> <!> <!></div></div>',1),CU=J('<div class="jse-modal-wrapper svelte-v0el4e"><!></div>');function kU(t,e){Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=R(void 0,!0),o=rr("jsoneditor:JSONEditorModal");let l=x(e,"content",9),a=x(e,"path",9),u=x(e,"onPatch",9),f=x(e,"readOnly",9),h=x(e,"indentation",9),d=x(e,"tabSize",9),p=x(e,"truncateTextSize",9),g=x(e,"mainMenuBar",9),m=x(e,"navigationBar",9),v=x(e,"statusBar",9),y=x(e,"askToFormat",9),S=x(e,"escapeControlCharacters",9),k=x(e,"escapeUnicodeCharacters",9),C=x(e,"flattenColumns",9),w=x(e,"parser",9),E=x(e,"validator",9),A=x(e,"validationParser",9),O=x(e,"pathParser",9),H=x(e,"onRenderValue",9),W=x(e,"onClassName",9),G=x(e,"onRenderMenu",9),V=x(e,"onRenderContextMenu",9),U=x(e,"onSortModal",9),Q=x(e,"onTransformModal",9),Y=x(e,"onClose",9),ie=R(void 0,!0),F=R(void 0,!0);const X={mode:ce(l()),content:l(),selection:void 0,relativePath:a()};let I=R([X],!0),se=R(void 0,!0);Cr(()=>{var B;(B=c(ie))==null||B.focus()});function ce(B){return fu(B)&&Nn(B.json)?$n.table:$n.tree}function Te(){var Se;const B=(Se=Ot(c(I)))==null?void 0:Se.selection;gu(B)&&c(ie).scrollTo(He(B))}function le(){if(o("handleApply"),!f())try{b(se,void 0);const B=c(n).relativePath,Se=c(n).content,ke=[{op:"replace",path:tt(B),value:My(Se,w()).json}];if(c(I).length>1){const z=c(I)[c(I).length-2].content,L=My(z,w()).json,ze={json:Xi(L,ke)},je={...c(I)[c(I).length-2]||X,content:ze};b(I,[...c(I).slice(0,c(I).length-2),je]),_n(),Te()}else u()(ke),Y()()}catch(B){b(se,String(B))}}function de(){var B;o("handleClose"),c(F)?b(F,!1):c(I).length>1?(b(I,Lt(c(I))),_n(),(B=c(ie))==null||B.focus(),Te(),b(se,void 0)):Y()()}function ne(B){o("handleChange",B),j(Se=>({...Se,content:B}))}function ue(B){o("handleChangeSelection",B),j(Se=>({...Se,selection:B}))}function ge(B){o("handleChangeMode",B),j(Se=>({...Se,mode:B}))}function j(B){const Se=Ot(c(I)),ke=B(Se);b(I,[...Lt(c(I)),ke])}function we(B){b(se,B.toString()),console.error(B)}function Pe({content:B,path:Se}){var z;o("handleJSONEditorModal",{content:B,path:Se});const ke={mode:ce(B),content:B,selection:void 0,relativePath:Se};b(I,[...c(I),ke]),_n(),(z=c(ie))==null||z.focus()}function q(B){B.focus()}K(()=>c(I),()=>{b(n,Ot(c(I))||X)}),K(()=>c(I),()=>{b(r,c(I).flatMap(B=>B.relativePath))}),K(()=>(c(r),ts),()=>{b(i,Yt(c(r))?"(document root)":ts(c(r)))}),K(()=>P(w()),()=>{b(s,ef(w().parse))}),Vt(),st(!0),$u(t,{onClose:de,className:"jse-jsoneditor-modal",get fullscreen(){return c(F)},children:(B,Se)=>{var ke=CU(),z=M(ke);Xv(z,{children:(L,ze)=>{var We=SU(),je=$e(We);const Qe=he(()=>c(I).length>1?` (${c(I).length})`:"");cp(je,{get title(){return`Edit nested content ${c(Qe)??""}`},fullScreenButton:!0,onClose:de,get fullscreen(){return c(F)},set fullscreen(rt){b(F,rt)},$$legacy:!0});var be=N(je,2),gt=N(M(be),2),Ye=N(gt,4),Ve=M(Ye);gn(IO(Ve,{get externalMode(){return c(n).mode},get content(){return c(n).content},get selection(){return c(n).selection},get readOnly(){return f()},get indentation(){return h()},get tabSize(){return d()},get truncateTextSize(){return p()},get statusBar(){return v()},get askToFormat(){return y()},get mainMenuBar(){return g()},get navigationBar(){return m()},get escapeControlCharacters(){return S()},get escapeUnicodeCharacters(){return k()},get flattenColumns(){return C()},get parser(){return w()},get parseMemoizeOne(){return c(s)},get validator(){return E()},get validationParser(){return A()},get pathParser(){return O()},insideModal:!0,onError:we,onChange:ne,onChangeMode:ge,onSelect:ue,get onRenderValue(){return H()},get onClassName(){return W()},onFocus:ki,onBlur:ki,get onRenderMenu(){return G()},get onRenderContextMenu(){return V()},get onSortModal(){return U()},get onTransformModal(){return Q()},onJSONEditorModal:Pe,$$legacy:!0}),rt=>b(ie,rt),()=>c(ie));var _t=N(Ye,2),Nt=M(_t);{var Ae=rt=>{var Le=yU(),oe=M(Le);xe(()=>et(oe,c(se))),D(rt,Le)};te(Nt,rt=>{c(se)&&rt(Ae)})}var Je=N(Nt,2);{var ht=rt=>{var Le=bU(),oe=M(Le);Dt(oe,{data:$6}),ae("click",Le,de),D(rt,Le)};te(Je,rt=>{c(I).length>1&&rt(ht)})}var it=N(Je,2);{var vt=rt=>{var Le=xU();cr(()=>ae("click",Le,le)),Tr(Le,oe=>q==null?void 0:q(oe)),D(rt,Le)},Ze=rt=>{var Le=wU();ae("click",Le,de),D(rt,Le)};te(it,rt=>{f()?rt(Ze,!1):rt(vt)})}xe(()=>Dl(gt,c(i))),D(L,We)},$$slots:{default:!0}}),D(B,ke)},$$slots:{default:!0}}),Xe()}const AU={};var pa=Rd(()=>AU),OU=J('<tr><th class="svelte-1v9c92j">Property</th><td class="svelte-1v9c92j"><!></td></tr>'),_U=J('<div class="jse-error svelte-1v9c92j"> </div>'),EU=J('<!> <div class="jse-modal-contents svelte-1v9c92j"><table class="svelte-1v9c92j"><colgroup><col width="25%"><col width="75%"></colgroup><tbody><tr><th class="svelte-1v9c92j">Path</th><td class="svelte-1v9c92j"><input class="jse-path svelte-1v9c92j" type="text" readonly="" title="Selected path"></td></tr><!><tr><th class="svelte-1v9c92j">Direction</th><td class="svelte-1v9c92j"><!></td></tr></tbody></table> <div class="jse-space svelte-1v9c92j"><!></div> <div class="jse-actions svelte-1v9c92j"><button type="button" class="jse-primary svelte-1v9c92j">Sort</button></div></div>',1);function TU(t,e){var w,E;Ge(e,!1);const n=R(void 0,!0),r=R(void 0,!0),i=R(void 0,!0),s=R(void 0,!0),o=rr("jsoneditor:SortModal");let l=x(e,"id",9),a=x(e,"json",9),u=x(e,"rootPath",9),f=x(e,"onSort",9),h=x(e,"onClose",9);const d={value:1,label:"ascending"},g=[d,{value:-1,label:"descending"}],m=`${l()}:${tt(u())}`;let v=R((w=pa()[m])==null?void 0:w.selectedProperty,!0),y=R(((E=pa()[m])==null?void 0:E.selectedDirection)||d,!0),S=R(void 0,!0);function k(){var A,O,H,W;try{b(S,void 0);const G=((A=c(v))==null?void 0:A.value)||((H=(O=c(s))==null?void 0:O[0])==null?void 0:H.value)||[],V=(W=c(y))==null?void 0:W.value,U=CC(a(),u(),G,V);f()!==void 0&&u()!==void 0&&f()({operations:U,rootPath:u(),itemPath:G,direction:V}),h()()}catch(G){b(S,String(G))}}function C(A){A.focus()}K(()=>(P(a()),P(u())),()=>{b(n,De(a(),u()))}),K(()=>c(n),()=>{b(r,Array.isArray(c(n)))}),K(()=>(c(r),c(n)),()=>{b(i,c(r)?nm(c(n)):void 0)}),K(()=>(c(i),Ao),()=>{b(s,c(i)?c(i).map(Ao):void 0)}),K(()=>(pa(),c(v),c(y)),()=>{pa(pa()[m]={selectedProperty:c(v),selectedDirection:c(y)}),o("store state in memory",m,pa()[m])}),Vt(),st(!0),$u(t,{get onClose(){return h()},className:"jse-sort-modal",children:(A,O)=>{var H=EU(),W=$e(H);const G=he(()=>c(r)?"Sort array items":"Sort object keys");cp(W,{get title(){return c(G)},get onClose(){return h()}});var V=N(W,2),U=M(V),Q=N(M(U)),Y=M(Q),ie=N(M(Y)),F=M(ie),X=N(Y);{var I=j=>{var we=OU(),Pe=N(M(we)),q=M(Pe);yl(q,{showChevron:!0,get items(){return c(s)},get value(){return c(v)},set value(B){b(v,B)},$$legacy:!0}),D(j,we)};te(X,j=>{var we;c(r)&&(c(s)&&((we=c(s))==null?void 0:we.length)>1||c(v)===void 0)&&j(I)})}var se=N(X),ce=N(M(se)),Te=M(ce);yl(Te,{showChevron:!0,clearable:!1,items:g,get value(){return c(y)},set value(j){b(y,j)},$$legacy:!0});var le=N(U,2),de=M(le);{var ne=j=>{var we=_U(),Pe=M(we);xe(()=>et(Pe,c(S))),D(j,we)};te(de,j=>{c(S)&&j(ne)})}var ue=N(le,2),ge=M(ue);cr(()=>ae("click",ge,k)),Tr(ge,j=>C==null?void 0:C(j)),xe(j=>{var we;Dl(F,j),ge.disabled=c(r)&&c(s)&&((we=c(s))==null?void 0:we.length)>1?!c(v):!1},[()=>u()&&!Yt(u())?ts(u()):"(document root)"],he),D(A,H)},$$slots:{default:!0}}),Xe()}var MU=J('<div role="none"><!></div> <!> <!> <!>',1);function RU(t,e){Ge(e,!1);const n=R(void 0,!0),r=rr("jsoneditor:JSONEditor"),i={text:""},s=void 0,o=!1,l=2,a=4,u=1e3,f=$n.tree,h=!0,d=!0,p=!0,g=!0,m=!1,v=!1,y=!0,S=JSON,k=void 0,C=JSON,w={parse:k9,stringify:ts},E=[mD],A=E[0].id,O=ki,H=void 0,W=void 0,G=K6,V=ki,U=ki,Q=ki,Y=ki,ie=me=>{console.error(me),alert(me.toString())},F=ki,X=ki;let I=x(e,"content",13,i),se=x(e,"selection",13,s),ce=x(e,"readOnly",13,o),Te=x(e,"indentation",13,l),le=x(e,"tabSize",13,a),de=x(e,"truncateTextSize",13,u),ne=x(e,"mode",13,f),ue=x(e,"mainMenuBar",13,h),ge=x(e,"navigationBar",13,d),j=x(e,"statusBar",13,p),we=x(e,"askToFormat",13,g),Pe=x(e,"escapeControlCharacters",13,m),q=x(e,"escapeUnicodeCharacters",13,v),B=x(e,"flattenColumns",13,y),Se=x(e,"parser",13,S),ke=x(e,"validator",13,k),z=x(e,"validationParser",13,C),L=x(e,"pathParser",13,w),ze=x(e,"queryLanguages",13,E),We=x(e,"queryLanguageId",13,A),je=x(e,"onChangeQueryLanguage",13,O),Qe=x(e,"onChange",13,H),be=x(e,"onSelect",13,W),gt=x(e,"onRenderValue",13,G),Ye=x(e,"onClassName",13,V),Ve=x(e,"onRenderMenu",13,U),_t=x(e,"onRenderContextMenu",13,Q),Nt=x(e,"onChangeMode",13,Y),Ae=x(e,"onError",13,ie),Je=x(e,"onFocus",13,F),ht=x(e,"onBlur",13,X),it=R(xa(),!0),vt=R(!1,!0),Ze=R(void 0,!0),rt=R(void 0,!0),Le=R(void 0,!0),oe=R(void 0,!0),Et=R(Se(),!0);function bt(){return I()}function Un(me){r("set");const xt=qp(me);if(xt)throw new Error(xt);b(it,xa()),I(me),_n()}function fr(me){r("update");const xt=qp(me);if(xt)throw new Error(xt);I(me),_n()}function ot(me){const xt=c(Ze).patch(me);return _n(),xt}function Ht(me){se(me),_n()}function ln(me,xt){c(Ze).expand(me,xt),_n()}function Gt(me,xt=!1){c(Ze).collapse(me,xt),_n()}function lt(me={}){c(Ze).transform(me),_n()}function yt(){return c(Ze).validate()}function Xt(){const me=c(Ze).acceptAutoRepair();return _n(),me}async function nn(me){await c(Ze).scrollTo(me)}function Ft(me){return c(Ze).findElement(me)}function qt(){c(Ze).focus(),_n()}async function rn(){await c(Ze).refresh()}function Gn(me){const xt=Object.keys(me);for(const Ke of xt)switch(Ke){case"content":I(me[Ke]??i);break;case"selection":se(me[Ke]??s);break;case"readOnly":ce(me[Ke]??o);break;case"indentation":Te(me[Ke]??l);break;case"tabSize":le(me[Ke]??a);break;case"truncateTextSize":de(me[Ke]??u);break;case"mode":ne(me[Ke]??f);break;case"mainMenuBar":ue(me[Ke]??h);break;case"navigationBar":ge(me[Ke]??d);break;case"statusBar":j(me[Ke]??p);break;case"askToFormat":we(me[Ke]??g);break;case"escapeControlCharacters":Pe(me[Ke]??m);break;case"escapeUnicodeCharacters":q(me[Ke]??v);break;case"flattenColumns":B(me[Ke]??y);break;case"parser":Se(me[Ke]??S);break;case"validator":ke(me[Ke]??k);break;case"validationParser":z(me[Ke]??C);break;case"pathParser":L(me[Ke]??w);break;case"queryLanguages":ze(me[Ke]??E);break;case"queryLanguageId":We(me[Ke]??A);break;case"onChangeQueryLanguage":je(me[Ke]??O);break;case"onChange":Qe(me[Ke]??H);break;case"onRenderValue":gt(me[Ke]??G);break;case"onClassName":Ye(me[Ke]??V);break;case"onRenderMenu":Ve(me[Ke]??U);break;case"onRenderContextMenu":_t(me[Ke]??Q);break;case"onChangeMode":Nt(me[Ke]??Y);break;case"onSelect":be(me[Ke]??W);break;case"onError":Ae(me[Ke]??ie);break;case"onFocus":Je(me[Ke]??F);break;case"onBlur":ht(me[Ke]??X);break;default:mn(Ke)}ze().some(Ke=>Ke.id===We())||We(ze()[0].id);function mn(Ke){r(`Unknown property "${Ke}"`)}_n()}async function mt(){throw new Error("class method destroy() is deprecated. It is replaced with a method destroy() in the vanilla library.")}function dt(me,xt,mn){I(me),Qe()&&Qe()(me,xt,mn)}function Tt(me){se(me),be()&&be()(tm(me))}function an(){b(vt,!0),Je()&&Je()()}function $t(){b(vt,!1),ht()&&ht()()}async function sn(me){ne()!==me&&(ne(me),_n(),qt(),Nt()(me))}function jt(me){r("handleChangeQueryLanguage",me),We(me),je()(me)}function on({id:me,json:xt,rootPath:mn,onTransform:Ke,onClose:ir}){ce()||b(oe,{id:me,json:xt,rootPath:mn,indentation:Te(),truncateTextSize:de(),escapeControlCharacters:Pe(),escapeUnicodeCharacters:q(),parser:Se(),parseMemoizeOne:c(n),validationParser:z(),pathParser:L(),queryLanguages:ze(),queryLanguageId:We(),onChangeQueryLanguage:jt,onRenderValue:gt(),onRenderMenu:Fn=>Ve()(Fn,{mode:ne(),modal:!0,readOnly:ce()}),onRenderContextMenu:Fn=>_t()(Fn,{mode:ne(),modal:!0,readOnly:ce(),selection:se()}),onClassName:Ye(),onTransform:Ke,onClose:ir})}function En(me){ce()||b(Le,me)}function Wn({content:me,path:xt,onPatch:mn,onClose:Ke}){r("onJSONEditorModal",{content:me,path:xt}),b(rt,{content:me,path:xt,onPatch:mn,readOnly:ce(),indentation:Te(),tabSize:le(),truncateTextSize:de(),mainMenuBar:ue(),navigationBar:ge(),statusBar:j(),askToFormat:we(),escapeControlCharacters:Pe(),escapeUnicodeCharacters:q(),flattenColumns:B(),parser:Se(),validator:void 0,validationParser:z(),pathParser:L(),onRenderValue:gt(),onClassName:Ye(),onRenderMenu:Ve(),onRenderContextMenu:_t(),onSortModal:En,onTransformModal:on,onClose:Ke})}function fn(me){me.stopPropagation()}return K(()=>(P(Se()),c(Et),P(I()),xa),()=>{if(!L5(Se(),c(Et))){if(r("parser changed, recreate editor"),fu(I())){const me=c(Et).stringify(I().json);I({json:me!==void 0?Se().parse(me):void 0})}b(Et,Se()),b(it,xa())}}),K(()=>P(I()),()=>{const me=qp(I());me&&console.error("Error: "+me)}),K(()=>P(se()),()=>{se()===null&&console.warn("selection is invalid: it is null but should be undefined")}),K(()=>P(Se()),()=>{b(n,ef(Se().parse))}),K(()=>P(ne()),()=>{r("mode changed to",ne())}),Vt(),st(!0),Xv(t,{children:(me,xt)=>{var mn=MU(),Ke=$e(mn);let ir;var Fn=M(Ke);B2(Fn,()=>c(it),ee=>{gn(IO(ee,{get externalMode(){return ne()},get content(){return I()},get selection(){return se()},get readOnly(){return ce()},get indentation(){return Te()},get tabSize(){return le()},get truncateTextSize(){return de()},get statusBar(){return j()},get askToFormat(){return we()},get mainMenuBar(){return ue()},get navigationBar(){return ge()},get escapeControlCharacters(){return Pe()},get escapeUnicodeCharacters(){return q()},get flattenColumns(){return B()},get parser(){return Se()},get parseMemoizeOne(){return c(n)},get validator(){return ke()},get validationParser(){return z()},get pathParser(){return L()},insideModal:!1,get onError(){return Ae()},onChange:dt,onChangeMode:sn,onSelect:Tt,get onRenderValue(){return gt()},get onClassName(){return Ye()},onFocus:an,onBlur:$t,get onRenderMenu(){return Ve()},get onRenderContextMenu(){return _t()},onSortModal:En,onTransformModal:on,onJSONEditorModal:Wn,$$legacy:!0}),Oe=>b(Ze,Oe),()=>c(Ze))});var kr=N(Ke,2);{var si=ee=>{TU(ee,jo(()=>c(Le),{onClose:()=>{var Oe;(Oe=c(Le))==null||Oe.onClose(),b(Le,void 0)}}))};te(kr,ee=>{c(Le)&&ee(si)})}var oi=N(kr,2);{var fs=ee=>{Sj(ee,jo(()=>c(oe),{onClose:()=>{var Oe;(Oe=c(oe))==null||Oe.onClose(),b(oe,void 0)}}))};te(oi,ee=>{c(oe)&&ee(fs)})}var hs=N(oi,2);{var hr=ee=>{kU(ee,jo(()=>c(rt),{onClose:()=>{var Oe;(Oe=c(rt))==null||Oe.onClose(),b(rt,void 0)}}))};te(hs,ee=>{c(rt)&&ee(hr)})}xe(ee=>ir=ct(Ke,1,"jse-main svelte-57bmz4",null,ir,ee),[()=>({"jse-focus":c(vt)})],he),ae("keydown",Ke,fn),D(me,mn)},$$slots:{default:!0}}),at(e,"get",bt),at(e,"set",Un),at(e,"update",fr),at(e,"patch",ot),at(e,"select",Ht),at(e,"expand",ln),at(e,"collapse",Gt),at(e,"transform",lt),at(e,"validate",yt),at(e,"acceptAutoRepair",Xt),at(e,"scrollTo",nn),at(e,"findElement",Ft),at(e,"focus",qt),at(e,"refresh",rn),at(e,"updateProps",Gn),at(e,"destroy",mt),Xe({get:bt,set:Un,update:fr,patch:ot,select:Ht,expand:ln,collapse:Gt,transform:lt,validate:yt,acceptAutoRepair:Xt,scrollTo:nn,findElement:Ft,focus:qt,refresh:rn,updateProps:Gn,destroy:mt})}var PU=J('<div class="modal-overlay svelte-mfv2jw"><div class="modal response-editor-modal svelte-mfv2jw"><h2 class="svelte-mfv2jw">编辑返回值</h2> <div class="editor-container response-editor svelte-mfv2jw"><!></div> <div class="modal-actions svelte-mfv2jw"><button class="cancel-btn svelte-mfv2jw">取消</button> <button class="confirm-btn svelte-mfv2jw">保存</button></div></div></div>');function DU(t,e){let n=x(e,"showModal",12,!1),r=x(e,"content",28,()=>({json:{}}));function i(){n(!1)}function s(){n(!1)}var o=bn(),l=$e(o);{var a=u=>{var f=PU(),h=M(f),d=N(M(h),2),p=M(d);RU(p,{get content(){return r()},set content(y){r(y)},$$legacy:!0});var g=N(d,2),m=M(g),v=N(m,2);ae("click",m,i),ae("click",v,s),D(u,f)};te(l,u=>{n()&&u(a)})}D(t,o)}var IU=J('<div class="condition-row svelte-97xoh1" role="group" aria-labelledby="conditions-label"><input type="text" class="form-input condition-input svelte-97xoh1" placeholder="Key"> <input type="text" class="form-input condition-input svelte-97xoh1" placeholder="Value"> <button class="edit-response-btn svelte-97xoh1">编辑返回值</button> <button class="remove-btn svelte-97xoh1">删除</button></div>'),LU=J('<div class="detail-layout svelte-97xoh1"><div class="detail-section basic-info svelte-97xoh1"><div class="section-content svelte-97xoh1"><button class="add-btn svelte-97xoh1">添加条件</button> <div class="form-group svelte-97xoh1"><label for="requestMethod" class="svelte-97xoh1">请求方式</label> <select id="requestMethod" class="form-input select-input svelte-97xoh1"><option>GET</option><option>POST</option></select></div> <div class="form-group svelte-97xoh1"><label for="matchType" class="svelte-97xoh1">匹配模式</label> <select id="matchType" class="form-input select-input svelte-97xoh1"><option>与(&)</option><option>或(|)</option></select></div> <div class="conditions-container svelte-97xoh1"><fieldset><legend>匹配条件</legend> <!></fieldset></div></div></div> <!></div>'),NU=J('<div class="no-selection svelte-97xoh1">选择一个规则查看详情</div>'),jU=J('<div class="rule-detail svelte-97xoh1"><!></div>');function BU(t,e){Ge(e,!1);let n=x(e,"selectedRule",8,null),r=R(!1),i=R(-1),s=R({json:{}});function o(m){var v;b(i,m);try{b(s,{json:(v=n())!=null&&v.config.conditions[m].response?JSON.parse(n().config.conditions[m].response):{}})}catch{b(s,{json:{}})}b(r,!0)}function l(){if(!n())return;const m={...n().config};m.conditions=[...m.conditions,{key:"",value:"",response:""}],Vr.updateRuleConfig(n().id,m)}function a(m){if(!n())return;const v={...n().config};v.conditions=v.conditions.filter((y,S)=>S!==m),Vr.updateRuleConfig(n().id,v)}function u(m){if(!n())return;const v={...n().config,method:m.toUpperCase()};v.conditions=[{key:"",value:"",response:""}],Vr.updateRuleConfig(n().id,v)}function f(m){if(!n())return;const v={...n().config,matchType:m};v.conditions=[{key:"",value:"",response:""}],Vr.updateRuleConfig(n().id,v)}K(()=>(c(r),c(i),P(n()),c(s),Vr),()=>{if(c(r)===!1&&c(i)>=0&&n()){const m={...n().config};m.conditions[c(i)].response=JSON.stringify(c(s).json),console.log("[info: 27]:",{config:m}),Vr.updateRuleConfig(n().id,m),b(i,-1)}}),Vt(),st();var h=jU(),d=M(h);{var p=m=>{var v=LU(),y=M(v),S=M(y),k=M(S),C=N(k,2),w=N(M(C),2);const E=he(()=>n().config.method.toLowerCase());S1(w,()=>c(E));var A,O=M(w);O.value=O.__value="get";var H=N(O);H.value=H.__value="post";var W=N(C,2),G=N(M(W),2);S1(G,()=>n().config.matchType);var V,U=M(G);U.value=U.__value="and";var Q=N(U);Q.value=Q.__value="or";var Y=N(W,2),ie=M(Y),F=N(M(ie),2);Sn(F,1,()=>n().config.conditions,Ln,(I,se,ce)=>{var Te=IU(),le=M(Te),de=N(le,2),ne=N(de,2),ue=N(ne,2);xe(()=>ue.disabled=n().config.conditions.length===1),no(le,()=>c(se).key,ge=>(c(se).key=ge,m1(()=>n().config.conditions))),ae("input",le,()=>{if(n()){const ge={...n().config};Vr.updateRuleConfig(n().id,ge)}}),no(de,()=>c(se).value,ge=>(c(se).value=ge,m1(()=>n().config.conditions))),ae("input",de,()=>{if(n()){const ge={...n().config};Vr.updateRuleConfig(n().id,ge)}}),ae("click",ne,()=>o(ce)),ae("click",ue,()=>a(ce)),D(I,Te)});var X=N(y,2);DU(X,{get showModal(){return c(r)},set showModal(I){b(r,I)},get content(){return c(s)},set content(I){b(s,I)},$$legacy:!0}),xe(()=>{A!==(A=c(E))&&(w.value=(w.__value=c(E))??"",Mh(w,c(E))),V!==(V=n().config.matchType)&&(G.value=(G.__value=n().config.matchType)??"",Mh(G,n().config.matchType))}),ae("click",k,l),ae("change",w,I=>u(I.currentTarget.value)),ae("change",G,I=>f(I.currentTarget.value)),D(m,v)},g=m=>{var v=NU();D(m,v)};te(d,m=>{var v;(v=n())!=null&&v.id?m(p):m(g,!1)})}D(t,h),Xe()}var FU=J('<div class="rules-container svelte-ihsy18"><div class="rules-content svelte-ihsy18"><div class="rules-list svelte-ihsy18"><!></div> <div class="rules-detail svelte-ihsy18"><!></div></div></div>');function zU(t,e){Ge(e,!1);let n=R(null);Vr.subscribe(u=>{b(n,u.selectedRule)}),st();var r=FU(),i=M(r),s=M(i),o=M(s);lE(o,{get selectedRule(){return c(n)},set selectedRule(u){b(n,u)},$$legacy:!0});var l=N(s,2),a=M(l);BU(a,{get selectedRule(){return c(n)},set selectedRule(u){b(n,u)},$$legacy:!0}),D(t,r),Xe()}var VU=J('<main class="svelte-17bb7wa"><!></main>');function HU(t){var e=VU(),n=M(e);zU(n,{}),D(t,e)}Y3(HU,{target:document.getElementById("app")});
|