diff --git a/apis/realtime.go b/apis/realtime.go index 3a3901f5..b652af6d 100644 --- a/apis/realtime.go +++ b/apis/realtime.go @@ -9,8 +9,8 @@ import ( "net/http" "time" - "github.com/pocketbase/dbx" "github.com/labstack/echo/v5" + "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" diff --git a/apis/user.go b/apis/user.go index ea8f9347..a7bab8d5 100644 --- a/apis/user.go +++ b/apis/user.go @@ -157,7 +157,7 @@ func (api *userApi) oauth2Auth(c echo.Context) error { user, authData, submitErr := form.Submit() if submitErr != nil { - return rest.NewBadRequestError("Failed to authenticated.", submitErr) + return rest.NewBadRequestError("Failed to authenticate.", submitErr) } return api.authResponse(c, user, authData) diff --git a/ui/dist/assets/Elements.fba5cef6.js b/ui/dist/assets/Elements.6ae71f5f.js similarity index 99% rename from ui/dist/assets/Elements.fba5cef6.js rename to ui/dist/assets/Elements.6ae71f5f.js index 620399fa..16f76713 100644 --- a/ui/dist/assets/Elements.fba5cef6.js +++ b/ui/dist/assets/Elements.6ae71f5f.js @@ -1,4 +1,4 @@ -import{S as ln,i as tn,s as sn,O as We,a as en,b as nn,c as fn,e,d as n,f as Xt,g as f,h as i,j as u,m as Dt,k as bn,t as un,l as on,n as zt,o as Ft,p as s,q as Gt,r as pn,u as Ye}from"./index.a658f3b6.js";function mn(v){let b;return{c(){b=e("p"),b.textContent="Lorem ipsum dolor sit amet..."},m(o,p){i(o,b,p)},p:Ye,d(o){o&&s(b)}}}function vn(v){let b;return{c(){b=e("h4"),b.textContent="My title",f(b,"slot","header")},m(o,p){i(o,b,p)},p:Ye,d(o){o&&s(b)}}}function dn(v){let b,o,p;return{c(){b=e("button"),b.textContent="Cancel",o=n(),p=e("button"),p.textContent="Save",f(b,"class","btn btn-secondary"),f(p,"class","btn btn-expanded")},m(m,d){i(m,b,d),i(m,o,d),i(m,p,d)},p:Ye,d(m){m&&s(b),m&&s(o),m&&s(p)}}}function xn(v){let b,o,p,m,d,Jt,Kt,_,_t,Ze,y,Qt,Ut,Vt,L,Lt,re,B,Wt,Yt,Zt,r,rt,c,ct,a,at,h,ht,g,gt,li,ti,Ht,ii,Ct,si,Mt,ei,Tt,ni,yt,fi,Bt,bi,wt,ui,kt,oi,$t,pi,Ot,mi,It,vi,Et,di,xi,_i,ll,Li,Nt,Hi,Pt,Ci,jt,Mi,At,Ti,yi,Bi,tl,wi,ki,$i,il,Oi,sl,Ii,el,Ei,nl,Ni,fl,Pi,bl,ji,Ai,Si,ul,qi,ol,Ri,pl,Xi,ml,Di,vl,zi,dl,Fi,Gi,Ji,xl,Ki,_l,Qi,Ll,Ui,Hl,Vi,Cl,Wi,Ml,Yi,Zi,ri,w,ci,k,ai,$,hi,O,gi,I,ls,E,ts,N,is,P,ss,j,es,A,ns,S,fs,q,bs,us,os,Tl,ps,yl,ms,Bl,vs,wl,ds,kl,xs,_s,Ls,$l,Hs,Ol,Cs,Il,Ms,El,Ts,Nl,ys,Bs,ws,Pl,ks,jl,$s,Al,Os,Sl,Is,ql,Es,Ns,Ps,Rl,js,Xl,As,Dl,Ss,zl,qs,Fl,Rs,Gl,Xs,Ds,zs,Jl,Fs,Kl,Gs,Ql,Js,Ul,Ks,Vl,Qs,Wl,Us,Vs,Ws,R,Ys,X,Zs,D,rs,z,cs,F,as,G,hs,gs,le,St,te,ie,se,J,H,K,Q,ee,ne,fe,Yl,be,ue,oe,Zl,pe,rl,me,C,qt,ce,U,M,V,W,ve,de,xe,cl,_e,al,Le,hl,gl,T,Y,Z,He,Ce,Me,lt,Te,tt,ye,it,Be,st,we,ke,$e,et,Oe,nt,Ie,ft,Ee,bt,Ne,Pe,je,ut,Ae,ot,Se,pt,qe,mt,Re,Xe,De,vt,ze,dt,Fe,Ge,Je,xt,Ke,x,Qe,Rt,Ue,ae;m=new We({props:{multiple:!0,searchable:!0,items:["test1","test2"]}}),y=new We({props:{searchable:!0,items:["test1","test2"]}}),B=new We({props:{disabled:!0,searchable:!0,items:["test1","test2"]}});function ge(l){v[1](l)}let he={popup:!1,$$slots:{footer:[dn],header:[vn],default:[mn]},$$scope:{ctx:v}};return v[0]!==void 0&&(he.active=v[0]),x=new en({props:he}),nn.push(()=>fn(x,"active",ge)),{c(){b=e("div"),o=e("label"),o.textContent="EXAMPLE",p=n(),Xt(m.$$.fragment),d=n(),Jt=e("hr"),Kt=n(),_=e("div"),_t=e("label"),_t.textContent="EXAMPLE",Ze=n(),Xt(y.$$.fragment),Qt=n(),Ut=e("hr"),Vt=n(),L=e("div"),Lt=e("label"),Lt.textContent="EXAMPLE",re=n(),Xt(B.$$.fragment),Wt=n(),Yt=e("hr"),Zt=n(),r=e("div"),r.innerHTML=`
+import{S as ln,i as tn,s as sn,O as We,a as en,b as nn,c as fn,e,d as n,f as Xt,g as f,h as i,j as u,m as Dt,k as bn,t as un,l as on,n as zt,o as Ft,p as s,q as Gt,r as pn,u as Ye}from"./index.66a4e29c.js";function mn(v){let b;return{c(){b=e("p"),b.textContent="Lorem ipsum dolor sit amet..."},m(o,p){i(o,b,p)},p:Ye,d(o){o&&s(b)}}}function vn(v){let b;return{c(){b=e("h4"),b.textContent="My title",f(b,"slot","header")},m(o,p){i(o,b,p)},p:Ye,d(o){o&&s(b)}}}function dn(v){let b,o,p;return{c(){b=e("button"),b.textContent="Cancel",o=n(),p=e("button"),p.textContent="Save",f(b,"class","btn btn-secondary"),f(p,"class","btn btn-expanded")},m(m,d){i(m,b,d),i(m,o,d),i(m,p,d)},p:Ye,d(m){m&&s(b),m&&s(o),m&&s(p)}}}function xn(v){let b,o,p,m,d,Jt,Kt,_,_t,Ze,y,Qt,Ut,Vt,L,Lt,re,B,Wt,Yt,Zt,r,rt,c,ct,a,at,h,ht,g,gt,li,ti,Ht,ii,Ct,si,Mt,ei,Tt,ni,yt,fi,Bt,bi,wt,ui,kt,oi,$t,pi,Ot,mi,It,vi,Et,di,xi,_i,ll,Li,Nt,Hi,Pt,Ci,jt,Mi,At,Ti,yi,Bi,tl,wi,ki,$i,il,Oi,sl,Ii,el,Ei,nl,Ni,fl,Pi,bl,ji,Ai,Si,ul,qi,ol,Ri,pl,Xi,ml,Di,vl,zi,dl,Fi,Gi,Ji,xl,Ki,_l,Qi,Ll,Ui,Hl,Vi,Cl,Wi,Ml,Yi,Zi,ri,w,ci,k,ai,$,hi,O,gi,I,ls,E,ts,N,is,P,ss,j,es,A,ns,S,fs,q,bs,us,os,Tl,ps,yl,ms,Bl,vs,wl,ds,kl,xs,_s,Ls,$l,Hs,Ol,Cs,Il,Ms,El,Ts,Nl,ys,Bs,ws,Pl,ks,jl,$s,Al,Os,Sl,Is,ql,Es,Ns,Ps,Rl,js,Xl,As,Dl,Ss,zl,qs,Fl,Rs,Gl,Xs,Ds,zs,Jl,Fs,Kl,Gs,Ql,Js,Ul,Ks,Vl,Qs,Wl,Us,Vs,Ws,R,Ys,X,Zs,D,rs,z,cs,F,as,G,hs,gs,le,St,te,ie,se,J,H,K,Q,ee,ne,fe,Yl,be,ue,oe,Zl,pe,rl,me,C,qt,ce,U,M,V,W,ve,de,xe,cl,_e,al,Le,hl,gl,T,Y,Z,He,Ce,Me,lt,Te,tt,ye,it,Be,st,we,ke,$e,et,Oe,nt,Ie,ft,Ee,bt,Ne,Pe,je,ut,Ae,ot,Se,pt,qe,mt,Re,Xe,De,vt,ze,dt,Fe,Ge,Je,xt,Ke,x,Qe,Rt,Ue,ae;m=new We({props:{multiple:!0,searchable:!0,items:["test1","test2"]}}),y=new We({props:{searchable:!0,items:["test1","test2"]}}),B=new We({props:{disabled:!0,searchable:!0,items:["test1","test2"]}});function ge(l){v[1](l)}let he={popup:!1,$$slots:{footer:[dn],header:[vn],default:[mn]},$$scope:{ctx:v}};return v[0]!==void 0&&(he.active=v[0]),x=new en({props:he}),nn.push(()=>fn(x,"active",ge)),{c(){b=e("div"),o=e("label"),o.textContent="EXAMPLE",p=n(),Xt(m.$$.fragment),d=n(),Jt=e("hr"),Kt=n(),_=e("div"),_t=e("label"),_t.textContent="EXAMPLE",Ze=n(),Xt(y.$$.fragment),Qt=n(),Ut=e("hr"),Vt=n(),L=e("div"),Lt=e("label"),Lt.textContent="EXAMPLE",re=n(),Xt(B.$$.fragment),Wt=n(),Yt=e("hr"),Zt=n(),r=e("div"),r.innerHTML=`
Hello world!
`,rt=n(),c=e("div"),c.innerHTML=`
Hello world!
diff --git a/ui/dist/assets/FilterAutocompleteInput.3cd8dab2.js b/ui/dist/assets/FilterAutocompleteInput.5c71eaaa.js similarity index 66% rename from ui/dist/assets/FilterAutocompleteInput.3cd8dab2.js rename to ui/dist/assets/FilterAutocompleteInput.5c71eaaa.js index 53721c68..590f4290 100644 --- a/ui/dist/assets/FilterAutocompleteInput.3cd8dab2.js +++ b/ui/dist/assets/FilterAutocompleteInput.5c71eaaa.js @@ -1,12 +1,12 @@ -import{S as Sa,i as va,s as Ca,e as Aa,g as Ma,h as Da,u as xn,p as Oa,M as Ta,N as Ba,P as Pa,Q as Ra,R as La,H as kn,b as Ea}from"./index.a658f3b6.js";class z{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ve.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Ve.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new _t(this),r=new _t(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new _t(this,e)}iterRange(e,t=this.length){return new zo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qo(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new Q(e):Ve.from(Q.split(e,[]))}}class Q extends z{constructor(e,t=Ia(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Na(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Q(hr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Ri(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new Q(l,o.length+r.length));else{let h=l.length>>1;i.push(new Q(l.slice(0,h)),new Q(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Q))return super.replace(e,t,i);let s=Ri(this.text,Ri(i.text,hr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Q(s,r):Ve.from(Q.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{S as Sa,i as va,s as Ca,e as Aa,g as Ma,h as Da,u as xn,p as Oa,M as Ta,N as Ba,P as Ra,Q as Pa,R as La,H as kn,b as Ea}from"./index.66a4e29c.js";class z{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ve.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Ve.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Zt(this),r=new Zt(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Zt(this,e)}iterRange(e,t=this.length){return new zo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qo(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new Q(e):Ve.from(Q.split(e,[]))}}class Q extends z{constructor(e,t=Ia(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Na(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Q(hr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Pi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new Q(l,o.length+r.length));else{let h=l.length>>1;i.push(new Q(l.slice(0,h)),new Q(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Q))return super.replace(e,t,i);let s=Pi(this.text,Pi(i.text,hr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Q(s,r):Ve.from(Q.split(s,[]),r)}sliceString(e,t=this.length,i=` `){let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=h+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new Q(i,s)),i=[],s=-1);return s>-1&&t.push(new Q(i,s)),t}}class Ve extends z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,h=i+o.lines-1;if((t?h:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=h+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let a=s&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!a?i.push(l):l.decompose(e-o,t-o,i,a)}o=h+1}}replace(e,t,i){if(i.lines=r&&t<=l){let h=o.replace(e-r,t-r,i),a=this.lines-o.lines+h.lines;if(h.lines>5-1&&h.lines>a>>5+1){let c=this.children.slice();return c[s]=h,new Ve(c,this.length-(t-e)+i.length)}return super.replace(r,l,h)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ve))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Q(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ve)for(let g of d.children)f(g);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof Q&&h&&(p=c[c.length-1])instanceof Q&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new Q(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:Ve.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ve(l,t)}}z.empty=new Q([""],0);function Ia(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Ri(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(h>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof Q?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof Q?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof Q){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof Q?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class zo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new _t(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),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 qo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol!="undefined"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},_t.prototype[Symbol.iterator]=zo.prototype[Symbol.iterator]=qo.prototype[Symbol.iterator]=function(){return this});class Na{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Dt="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(n=>n?parseInt(n,36):1);for(let n=1;nn)return Dt[e-1]<=n;return!1}function ar(n){return n>=127462&&n<=127487}const cr=8205;function Ae(n,e,t=!0,i=!0){return(t?Ko:Fa)(n,e,i)}function Ko(n,e,t){if(e==n.length)return e;e&&Uo(n.charCodeAt(e))&&jo(n.charCodeAt(e-1))&&e--;let i=re(n,e);for(e+=ve(i);e=0&&ar(re(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Fa(n,e,t){for(;e>0;){let i=Ko(n,e-2,t);if(i=56320&&n<57344}function jo(n){return n>=55296&&n<56320}function re(n,e){let t=n.charCodeAt(e);if(!jo(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uo(i)?(t-55296<<10)+(i-56320)+65536:t}function Ps(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ve(n){return n<65536?1:2}const Kn=/\r\n?|\n/;var me=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(me||(me={}));class We{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=me.Simple&&a>=e&&(i==me.TrackDel&&se||i==me.TrackBefore&&se))return null;if(a>e||a==e&&t<0&&!l)return e==s||t<0?r:r+h;r+=h}s=a}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new We(e)}static create(e){return new We(e)}}class ee extends We{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Un(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return jn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let h=s>>1;for(;i.length0&&Ye(i,t,r.text),r.forward(c),l+=c}let a=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function h(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?z.of(d.split(i||Kn)):d:z.empty,g=p.length;if(f==u&&g==0)return;fo&&he(s,f-o,-1),he(s,u-f,g),Ye(r,s,p),o=u}}return a(e),h(!l),l}static empty(e){return new ee(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function Ye(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],h=n.sections[o++];e(s,a,r,c,f),s=a,r=c}}}function jn(n,e,t,i=!1){let s=[],r=i?[]:null,o=new ii(n),l=new ii(e);for(let h=-1;;)if(o.ins==-1&&l.ins==-1){let a=Math.min(o.len,l.len);he(s,a,-1),o.forward(a),l.forward(a)}else if(l.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(l.len=0&&h=0){let a=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);a+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lenh||o.ins>=0&&o.len>h)&&(l||i.length>a),r.forward2(h),o.forward(h)}}}}class ii{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?z.empty:t[i].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 ct{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new ct(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return m.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return m.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return m.range(e.anchor,e.head)}static create(e,t,i){return new ct(e,t,i)}}class m{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:m.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.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 m(e.ranges.map(t=>ct.fromJSON(t)),e.main)}static single(e,t=e){return new m([m.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0))}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?m.range(h,l):m.range(l,h))}}return new m(e,t)}}function Jo(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Rs=0;class T{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=Rs++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new T(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ls),!!e.static,e.enables)}of(e){return new Li([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Li(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Li(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ls(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Li{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=Rs++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,h=!1,a=!1,c=[];for(let f of this.dependencies)f=="doc"?h=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(h&&u.docChanged||a&&(u.docChanged||u.selection)||Gn(f,c)){let d=i(f);if(l?!fr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d=i(f),p=u.config.address[r];if(p!=null){let g=Fi(u,p);if(this.dependencies.every(y=>y instanceof T?u.facet(y)===f.facet(y):y instanceof ke?u.field(y,!1)==f.field(y,!1):!0)||(l?fr(d,g,s):s(d,g)))return f.values[o]=g,0}return f.values[o]=d,1}}}}function fr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[h.id]),s=t.map(h=>h.type),r=i.filter(h=>!(h&1)),o=n[e.id]>>1;function l(h){let a=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const Ct={lowest:4,low:3,default:2,high:1,highest:0};function zt(n){return e=>new $o(e,n)}const fi={highest:zt(Ct.highest),high:zt(Ct.high),default:zt(Ct.default),low:zt(Ct.low),lowest:zt(Ct.lowest)};class $o{constructor(e,t){this.inner=e,this.prec=t}}class _e{of(e){return new Jn(this,e)}reconfigure(e){return _e.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Jn{constructor(e,t){this.compartment=e,this.inner=t}}class Vi{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Wa(e,t,o))u instanceof ke?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),h=[],a=[];for(let u of s)l[u.id]=a.length<<1,a.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,g=c&&c[u]||[];if(d.every(y=>y.type==0))if(l[p.id]=h.length<<1|1,Ls(g,d))h.push(i.facet(p));else{let y=p.combine(d.map(b=>b.value));h.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=h.length<<1|1,h.push(y.value)):(l[y.id]=a.length<<1,a.push(b=>y.dynamicSlot(b)));l[p.id]=a.length<<1,a.push(y=>Ha(y,p,d))}}let f=a.map(u=>u(l));return new Vi(e,o,f,l,h,r)}}function Wa(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let h=s.get(o);if(h!=null){if(h<=l)return;let a=i[h].indexOf(o);a>-1&&i[h].splice(a,1),o instanceof Jn&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let a of o)r(a,l);else if(o instanceof Jn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(o.compartment)||o.inner;t.set(o.compartment,a),r(a,l)}else if(o instanceof $o)r(o.inner,o.prec);else if(o instanceof ke)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Li)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,l);else{let a=o.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(a,l)}}return r(n,Ct.default),i.reduce((o,l)=>o.concat(l))}function Qt(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Fi(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Xo=T.define(),Yo=T.define({combine:n=>n.some(e=>e),static:!0}),_o=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),Qo=T.define(),Zo=T.define(),el=T.define(),tl=T.define({combine:n=>n.length?n[0]:!1});class wt{constructor(e,t){this.type=e,this.value=t}static define(){return new za}}class za{of(e){return new wt(this,e)}}class qa{constructor(e){this.map=e}of(e){return new H(this,e)}}class H{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new H(this.type,t)}is(e){return this.type==e}static define(e={}){return new qa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}H.reconfigure=H.define();H.appendConfig=H.define();class te{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Jo(i,t.newLength),r.some(l=>l.type==te.time)||(this.annotations=r.concat(te.time.of(Date.now())))}static create(e,t,i,s,r,o){return new te(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=wt.define();te.userEvent=wt.define();te.addToHistory=wt.define();te.remote=wt.define();function Ka(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof te?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof te?n=r[0]:n=nl(e,Ot(r),!1)}return n}function ja(n){let e=n.startState,t=e.facet(el),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=il(n,$n(e,r,n.changes.newLength),!0))}return i==n?n:te.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Ga=[];function Ot(n){return n==null?Ga:Array.isArray(n)?n:[n]}var ce=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(ce||(ce={}));const Ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Xn;try{Xn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $a(n){if(Xn)return Xn.test(n);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Ja.test(t)))return!0}return!1}function Xa(n){return e=>{if(!/\S/.test(e))return ce.Space;if($a(e))return ce.Word;for(let t=0;t-1)return ce.Word;return ce.Other}}class V{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(H.reconfigure)?(t=null,i=o.value):o.is(H.appendConfig)&&(t=null,i=Ot(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Vi.resolve(i,s,this),r=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values),new V(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:m.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Ot(i.effects);for(let l=1;lo.spec.fromJSON(l,h)))}}return V.create({doc:e.doc,selection:m.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Vi.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Kn)),s=e.selection?e.selection instanceof m?e.selection:m.single(e.selection.anchor,e.selection.head):m.single(0);return Jo(s,i.length),t.staticFacet(Yo)||(s=s.asSingle()),new V(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||` -`}get readOnly(){return this.facet(tl)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Xo))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return Xa(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=Ae(t,o,!1);if(r(t.slice(h,o))!=ce.Word)break;o=h}for(;ln.length?n[0]:4});V.lineSeparator=_o;V.readOnly=tl;V.phrases=T.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});V.languageData=Xo;V.changeFilter=Qo;V.transactionFilter=Zo;V.transactionExtender=el;_e.reconfigure=H.define();function Ht(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class pt{eq(e){return this==e}range(e,t=e){return ni.create(e,t,this)}}pt.prototype.startSide=pt.prototype.endSide=0;pt.prototype.point=!1;pt.prototype.mapMode=me.TrackDel;class ni{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new ni(e,t,i)}}function Yn(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Es{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new Es(s,r,i,l):null,pos:o}}}class Y{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new Y(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Yn)),this.isEmpty)return t.length?Y.of(t):this;let l=new sl(this,null,-1).goto(0),h=0,a=[],c=new gt;for(;l.value||h=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return si.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return si.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=dr(o,l,i),a=new qt(o,h,r),c=new qt(l,h,r);i.iterGaps((f,u,d)=>pr(a,f,c,u,d,s)),i.empty&&i.length==0&&pr(a,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=dr(r,o),h=new qt(r,l,0).goto(i),a=new qt(o,l,0).goto(i);for(;;){if(h.to!=a.to||!_n(h.active,a.active)||h.point&&(!a.point||!h.point.eq(a.point)))return!1;if(h.to>s)return!0;h.next(),a.next()}}static spans(e,t,i,s,r=-1){let o=new qt(e,null,r).goto(t),l=t,h=o.openStart;for(;;){let a=Math.min(o.to,i);if(o.point?(s.point(l,a,o.point,o.activeForPoint(o.to),h,o.pointRank),h=o.openEnd(a)+(o.to>a?1:0)):a>l&&(s.span(l,a,o.active,h),h=o.openEnd(a)),o.to>i)break;l=o.to,o.next()}return h}static of(e,t=!1){let i=new gt;for(let s of e instanceof ni?[e]:t?Ya(e):e)i.add(s.from,s.to,s.value);return i.finish()}}Y.empty=new Y([],[],null,-1);function Ya(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Yn);e=i}return n}Y.empty.nextLayer=Y.empty;class gt{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}finishChunk(e){this.chunks.push(new Es(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=[])}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new gt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Y.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Y.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function dr(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new sl(o,t,i,r));return s.length==1?s[0]:new si(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Sn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Sn(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Sn(this.heap,0)}}}function Sn(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class qt{constructor(e,t,i){this.minPoint=i,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=si.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){mi(this.active,e),mi(this.activeTo,e),mi(this.activeRank,e),this.minActive=gr(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&mi(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function pr(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,h=i-e;for(;;){let a=n.to+h-t.to||n.endSide-t.endSide,c=a<0?n.to+h:t.to,f=Math.min(c,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&_n(n.activeForPoint(n.to+h),t.activeForPoint(t.to))||r.comparePoint(l,f,n.point,t.point):f>l&&!_n(n.active,t.active)&&r.compareRange(l,f,n.active,t.active),c>o)break;l=c,a<=0&&n.next(),a>=0&&t.next()}}function _n(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function gr(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=Ae(n,s)}return i===!0?-1:n.length}const Zn="\u037C",mr=typeof Symbol=="undefined"?"__"+Zn:Symbol.for(Zn),es=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),yr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class st{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,h,a){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return h.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(g=>o.map(y=>g.replace(/&/,y))).reduce((g,y)=>g.concat(y)),p,h);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(c.length||u)&&h.push((i&&!f&&!a?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ve))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Q(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ve)for(let g of d.children)f(g);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof Q&&h&&(p=c[c.length-1])instanceof Q&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new Q(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:Ve.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ve(l,t)}}z.empty=new Q([""],0);function Ia(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Pi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(h>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof Q?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof Q?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof Q){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof Q?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class zo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Zt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),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 qo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol!="undefined"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Zt.prototype[Symbol.iterator]=zo.prototype[Symbol.iterator]=qo.prototype[Symbol.iterator]=function(){return this});class Na{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Dt="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(n=>n?parseInt(n,36):1);for(let n=1;nn)return Dt[e-1]<=n;return!1}function ar(n){return n>=127462&&n<=127487}const cr=8205;function Ae(n,e,t=!0,i=!0){return(t?Ko:Fa)(n,e,i)}function Ko(n,e,t){if(e==n.length)return e;e&&Uo(n.charCodeAt(e))&&jo(n.charCodeAt(e-1))&&e--;let i=re(n,e);for(e+=ve(i);e=0&&ar(re(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Fa(n,e,t){for(;e>0;){let i=Ko(n,e-2,t);if(i=56320&&n<57344}function jo(n){return n>=55296&&n<56320}function re(n,e){let t=n.charCodeAt(e);if(!jo(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uo(i)?(t-55296<<10)+(i-56320)+65536:t}function Rs(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ve(n){return n<65536?1:2}const Kn=/\r\n?|\n/;var me=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(me||(me={}));class We{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=me.Simple&&a>=e&&(i==me.TrackDel&&se||i==me.TrackBefore&&se))return null;if(a>e||a==e&&t<0&&!l)return e==s||t<0?r:r+h;r+=h}s=a}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new We(e)}static create(e){return new We(e)}}class ee extends We{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Un(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return jn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let h=s>>1;for(;i.length0&&Ye(i,t,r.text),r.forward(c),l+=c}let a=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function h(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?z.of(d.split(i||Kn)):d:z.empty,g=p.length;if(f==u&&g==0)return;fo&&he(s,f-o,-1),he(s,u-f,g),Ye(r,s,p),o=u}}return a(e),h(!l),l}static empty(e){return new ee(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function Ye(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],h=n.sections[o++];e(s,a,r,c,f),s=a,r=c}}}function jn(n,e,t,i=!1){let s=[],r=i?[]:null,o=new si(n),l=new si(e);for(let h=-1;;)if(o.ins==-1&&l.ins==-1){let a=Math.min(o.len,l.len);he(s,a,-1),o.forward(a),l.forward(a)}else if(l.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(l.len=0&&h=0){let a=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);a+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lenh||o.ins>=0&&o.len>h)&&(l||i.length>a),r.forward2(h),o.forward(h)}}}}class si{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?z.empty:t[i].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 ct{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new ct(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return m.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return m.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return m.range(e.anchor,e.head)}static create(e,t,i){return new ct(e,t,i)}}class m{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:m.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.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 m(e.ranges.map(t=>ct.fromJSON(t)),e.main)}static single(e,t=e){return new m([m.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0))}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?m.range(h,l):m.range(l,h))}}return new m(e,t)}}function Jo(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ps=0;class T{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=Ps++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new T(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ls),!!e.static,e.enables)}of(e){return new Li([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Li(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Li(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ls(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Li{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=Ps++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,h=!1,a=!1,c=[];for(let f of this.dependencies)f=="doc"?h=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(h&&u.docChanged||a&&(u.docChanged||u.selection)||Gn(f,c)){let d=i(f);if(l?!fr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d=i(f),p=u.config.address[r];if(p!=null){let g=Fi(u,p);if(this.dependencies.every(y=>y instanceof T?u.facet(y)===f.facet(y):y instanceof ke?u.field(y,!1)==f.field(y,!1):!0)||(l?fr(d,g,s):s(d,g)))return f.values[o]=g,0}return f.values[o]=d,1}}}}function fr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[h.id]),s=t.map(h=>h.type),r=i.filter(h=>!(h&1)),o=n[e.id]>>1;function l(h){let a=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const Ct={lowest:4,low:3,default:2,high:1,highest:0};function Kt(n){return e=>new $o(e,n)}const Wt={highest:Kt(Ct.highest),high:Kt(Ct.high),default:Kt(Ct.default),low:Kt(Ct.low),lowest:Kt(Ct.lowest)};class $o{constructor(e,t){this.inner=e,this.prec=t}}class _e{of(e){return new Jn(this,e)}reconfigure(e){return _e.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Jn{constructor(e,t){this.compartment=e,this.inner=t}}class Vi{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Wa(e,t,o))u instanceof ke?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),h=[],a=[];for(let u of s)l[u.id]=a.length<<1,a.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,g=c&&c[u]||[];if(d.every(y=>y.type==0))if(l[p.id]=h.length<<1|1,Ls(g,d))h.push(i.facet(p));else{let y=p.combine(d.map(b=>b.value));h.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=h.length<<1|1,h.push(y.value)):(l[y.id]=a.length<<1,a.push(b=>y.dynamicSlot(b)));l[p.id]=a.length<<1,a.push(y=>Ha(y,p,d))}}let f=a.map(u=>u(l));return new Vi(e,o,f,l,h,r)}}function Wa(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let h=s.get(o);if(h!=null){if(h<=l)return;let a=i[h].indexOf(o);a>-1&&i[h].splice(a,1),o instanceof Jn&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let a of o)r(a,l);else if(o instanceof Jn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(o.compartment)||o.inner;t.set(o.compartment,a),r(a,l)}else if(o instanceof $o)r(o.inner,o.prec);else if(o instanceof ke)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Li)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,l);else{let a=o.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(a,l)}}return r(n,Ct.default),i.reduce((o,l)=>o.concat(l))}function ei(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Fi(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Xo=T.define(),Yo=T.define({combine:n=>n.some(e=>e),static:!0}),_o=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),Qo=T.define(),Zo=T.define(),el=T.define(),tl=T.define({combine:n=>n.length?n[0]:!1});class wt{constructor(e,t){this.type=e,this.value=t}static define(){return new za}}class za{of(e){return new wt(this,e)}}class qa{constructor(e){this.map=e}of(e){return new H(this,e)}}class H{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new H(this.type,t)}is(e){return this.type==e}static define(e={}){return new qa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}H.reconfigure=H.define();H.appendConfig=H.define();class te{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Jo(i,t.newLength),r.some(l=>l.type==te.time)||(this.annotations=r.concat(te.time.of(Date.now())))}static create(e,t,i,s,r,o){return new te(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=wt.define();te.userEvent=wt.define();te.addToHistory=wt.define();te.remote=wt.define();function Ka(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof te?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof te?n=r[0]:n=nl(e,Ot(r),!1)}return n}function ja(n){let e=n.startState,t=e.facet(el),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=il(n,$n(e,r,n.changes.newLength),!0))}return i==n?n:te.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Ga=[];function Ot(n){return n==null?Ga:Array.isArray(n)?n:[n]}var ce=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(ce||(ce={}));const Ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Xn;try{Xn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $a(n){if(Xn)return Xn.test(n);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Ja.test(t)))return!0}return!1}function Xa(n){return e=>{if(!/\S/.test(e))return ce.Space;if($a(e))return ce.Word;for(let t=0;t-1)return ce.Word;return ce.Other}}class V{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(H.reconfigure)?(t=null,i=o.value):o.is(H.appendConfig)&&(t=null,i=Ot(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Vi.resolve(i,s,this),r=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values),new V(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:m.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Ot(i.effects);for(let l=1;lo.spec.fromJSON(l,h)))}}return V.create({doc:e.doc,selection:m.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Vi.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Kn)),s=e.selection?e.selection instanceof m?e.selection:m.single(e.selection.anchor,e.selection.head):m.single(0);return Jo(s,i.length),t.staticFacet(Yo)||(s=s.asSingle()),new V(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||` +`}get readOnly(){return this.facet(tl)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Xo))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return Xa(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=Ae(t,o,!1);if(r(t.slice(h,o))!=ce.Word)break;o=h}for(;ln.length?n[0]:4});V.lineSeparator=_o;V.readOnly=tl;V.phrases=T.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});V.languageData=Xo;V.changeFilter=Qo;V.transactionFilter=Zo;V.transactionExtender=el;_e.reconfigure=H.define();function zt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class pt{eq(e){return this==e}range(e,t=e){return ri.create(e,t,this)}}pt.prototype.startSide=pt.prototype.endSide=0;pt.prototype.point=!1;pt.prototype.mapMode=me.TrackDel;class ri{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new ri(e,t,i)}}function Yn(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Es{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new Es(s,r,i,l):null,pos:o}}}class Y{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new Y(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Yn)),this.isEmpty)return t.length?Y.of(t):this;let l=new sl(this,null,-1).goto(0),h=0,a=[],c=new gt;for(;l.value||h=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return oi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return oi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=dr(o,l,i),a=new Ut(o,h,r),c=new Ut(l,h,r);i.iterGaps((f,u,d)=>pr(a,f,c,u,d,s)),i.empty&&i.length==0&&pr(a,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=dr(r,o),h=new Ut(r,l,0).goto(i),a=new Ut(o,l,0).goto(i);for(;;){if(h.to!=a.to||!_n(h.active,a.active)||h.point&&(!a.point||!h.point.eq(a.point)))return!1;if(h.to>s)return!0;h.next(),a.next()}}static spans(e,t,i,s,r=-1){let o=new Ut(e,null,r).goto(t),l=t,h=o.openStart;for(;;){let a=Math.min(o.to,i);if(o.point?(s.point(l,a,o.point,o.activeForPoint(o.to),h,o.pointRank),h=o.openEnd(a)+(o.to>a?1:0)):a>l&&(s.span(l,a,o.active,h),h=o.openEnd(a)),o.to>i)break;l=o.to,o.next()}return h}static of(e,t=!1){let i=new gt;for(let s of e instanceof ri?[e]:t?Ya(e):e)i.add(s.from,s.to,s.value);return i.finish()}}Y.empty=new Y([],[],null,-1);function Ya(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Yn);e=i}return n}Y.empty.nextLayer=Y.empty;class gt{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}finishChunk(e){this.chunks.push(new Es(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=[])}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new gt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Y.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Y.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function dr(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new sl(o,t,i,r));return s.length==1?s[0]:new oi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Sn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Sn(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Sn(this.heap,0)}}}function Sn(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Ut{constructor(e,t,i){this.minPoint=i,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=oi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){mi(this.active,e),mi(this.activeTo,e),mi(this.activeRank,e),this.minActive=gr(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&mi(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function pr(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,h=i-e;for(;;){let a=n.to+h-t.to||n.endSide-t.endSide,c=a<0?n.to+h:t.to,f=Math.min(c,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&_n(n.activeForPoint(n.to+h),t.activeForPoint(t.to))||r.comparePoint(l,f,n.point,t.point):f>l&&!_n(n.active,t.active)&&r.compareRange(l,f,n.active,t.active),c>o)break;l=c,a<=0&&n.next(),a>=0&&t.next()}}function _n(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function gr(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=Ae(n,s)}return i===!0?-1:n.length}const Zn="\u037C",mr=typeof Symbol=="undefined"?"__"+Zn:Symbol.for(Zn),es=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),yr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class st{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,h,a){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return h.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(g=>o.map(y=>g.replace(/&/,y))).reduce((g,y)=>g.concat(y)),p,h);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(c.length||u)&&h.push((i&&!f&&!a?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=yr[mr]||1;return yr[mr]=e+1,Zn+e.toString(36)}static mount(e,t){(e[es]||new _a(e)).mount(Array.isArray(t)?t:[t])}}let bi=null;class _a{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet!="undefined"){if(bi)return e.adoptedStyleSheets=[bi.sheet].concat(e.adoptedStyleSheets),e[es]=bi;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),bi=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[es]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),t)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},br=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qa=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),Za=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),wr=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),ec=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tc=br&&(wr||+br[1]<57)||Za&≀for(var oe=0;oe<10;oe++)rt[48+oe]=rt[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)rt[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)rt[oe]=String.fromCharCode(oe+32),Pt[oe]=String.fromCharCode(oe);for(var vn in rt)Pt.hasOwnProperty(vn)||(Pt[vn]=rt[vn]);function ic(n){var e=tc&&(n.ctrlKey||n.altKey||n.metaKey)||(Qa||ec)&&n.shiftKey&&n.key&&n.key.length==1,t=!e&&n.key||(n.shiftKey?Pt:rt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Hi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Rt(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function nc(){let n=document.activeElement;for(;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ts(n,e){if(!e.anchorNode)return!1;try{return Rt(n,e.anchorNode)}catch{return!1}}function ri(n){return n.nodeType==3?oi(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Wi(n,e,t,i){return t?xr(n,e,t,i,-1)||xr(n,e,t,i,1):!1}function is(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function xr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:zi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=is(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?zi(n):0}else return!1}}function zi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const rl={left:0,right:0,top:0,bottom:0};function on(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function sc(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function rc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=sc(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.parentNode;continue}let g=c.getBoundingClientRect();f={left:g.left,right:g.left+c.clientWidth,top:g.top,bottom:g.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.leftt)return f.domBoundsAround(e,t,a);if(u>=e&&s==-1&&(s=h,r=a),a>t&&f.dom.parentNode==this.dom){o=h,l=c;break}c=u,a=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),t.dirty&1)return;t.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=Is){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function al(n,e,t,i,s,r,o,l,h){let{children:a}=n,c=a.length?a[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,h))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var M={mac:Ar||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:ln,ie_version:fl?ns.documentMode||6:rs?+rs[1]:ss?+ss[1]:0,gecko:vr,gecko_version:vr?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!Cn,chrome_version:Cn?+Cn[1]:0,ios:Ar,android:/Android\b/.test(Ce.userAgent),webkit:Cr,safari:ul,webkit_version:Cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:ns.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const hc=256;class ot extends ${constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return i&&(!(i instanceof ot)||this.length-(t-e)+i.length>hc)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ot(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new le(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return os(this.dom,e,t)}}class ze extends ${constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(ll(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e)}merge(e,t,i,s,r,o){return i&&(!(i instanceof ze&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=h,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new ze(this.mark,t,o)}domAtPos(e){return gl(this.dom,this.children,e)}coordsAt(e,t){return yl(this,e,t)}}function os(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?M.chrome||M.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return M.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?on(h,o<0):h||null}class Qe extends ${constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new(e.customView||Qe)(e,t,i)}split(e){let t=Qe.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof Qe)||!this.widget.compare(i.widget)||e>0&&r<=0||t0?i.length-1:0;s=i[r],!(e>0?r==0:r==i.length-1||s.top0?-1:1);return e==0&&t>0||e==this.length&&t<=0?s:on(s,e==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class dl extends Qe{domAtPos(e){let{topView:t,text:i}=this.widget;return t?ls(e,0,t,i,(s,r)=>s.domAtPos(r),s=>new le(i,Math.min(s,i.nodeValue.length))):new le(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,t){let{topView:i,text:s}=this.widget;return i?pl(e,t,i,s):Math.min(t,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,t){let{topView:i,text:s}=this.widget;return i?ls(e,t,i,s,(r,o,l)=>r.coordsAt(o,l),(r,o)=>os(s,r,o)):os(s,e,t)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}}function ls(n,e,t,i,s,r){if(t instanceof ze){for(let o of t.children){let l=Rt(o.dom,i),h=l?i.nodeValue.length:o.length;if(n0?-1:1);return i&&i.topt.top?{left:t.left,right:t.right,top:i.top,bottom:i.bottom}:t}get overrideDOMText(){return z.empty}}ot.prototype.children=Qe.prototype.children=Lt.prototype.children=Is;function ac(n,e){let t=n.parent,i=t?t.children.indexOf(n):-1;for(;t&&i>=0;)if(e<0?i>0:is&&t0;i--){let s=e[i-1].dom;if(s.parentNode==n)return le.after(s)}return new le(n,0)}function ml(n,e,t){let i,{children:s}=n;t>0&&e instanceof ze&&s.length&&(i=s[s.length-1])instanceof ze&&i.mark.eq(e.mark)?ml(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function yl(n,e,t){for(let r=0,o=0;o0?h>=e:h>e)&&(e0)){let c=0;if(h==r){if(l.getSide()<=0)continue;c=t=-l.getSide()}let f=l.coordsAt(Math.max(0,e-r),t);return c&&f?on(f,t<0):f}r=h}let i=n.dom.lastChild;if(!i)return n.dom.getBoundingClientRect();let s=ri(i);return s[s.length-1]||null}function hs(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}function Ns(n,e){if(n==e)return!0;if(!n||!e)return!1;let t=Object.keys(n),i=Object.keys(e);if(t.length!=i.length)return!1;for(let s of t)if(i.indexOf(s)==-1||n[s]!==e[s])return!1;return!0}function as(n,e,t){let i=null;if(e)for(let s in e)t&&s in t||n.removeAttribute(i=s);if(t)for(let s in t)e&&e[s]==t[s]||n.setAttribute(i=s,t[s]);return!!i}class xt{eq(e){return!1}updateDOM(e){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}ignoreEvent(e){return!0}get customView(){return null}destroy(e){}}var J=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(J||(J={}));class P extends pt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new hn(e)}static widget(e){let t=e.side||0,i=!!e.block;return t+=i?t>0?3e8:-4e8:t>0?1e8:-1e8,new mt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=bl(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new mt(e,i,s,t,e.widget||null,!0)}static line(e){return new di(e)}static set(e,t=!1){return Y.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}P.none=Y.empty;class hn extends P{constructor(e){let{start:t,end:i}=bl(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof hn&&this.tagName==e.tagName&&this.class==e.class&&Ns(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}hn.prototype.point=!1;class di extends P{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof di&&Ns(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}di.prototype.mapMode=me.TrackBefore;di.prototype.point=!0;class mt extends P{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?me.TrackBefore:me.TrackAfter:me.TrackDel}get type(){return this.startSide=5}eq(e){return e instanceof mt&&cc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}mt.prototype.point=!0;function bl(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function cc(n,e){return n==e||!!(n&&e&&n.compare(e))}function cs(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class fe extends ${constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof fe))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),cl(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new fe;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){!this.dom||(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Ns(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ml(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=hs(t,this.attrs||{})),i&&(this.attrs=hs({class:i},this.attrs||{}))}domAtPos(e){return gl(this.dom,this.children,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e){var t;this.dom?this.dirty&4&&(ll(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&&(as(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e);let i=this.dom.lastChild;for(;i&&$.get(i)instanceof ze;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((t=$.get(i))===null||t===void 0?void 0:t.isEditable)==!1&&(!M.ios||!this.children.some(s=>s instanceof ot))){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;for(let t of this.children){if(!(t instanceof ot))return null;let i=ri(t.dom);if(i.length!=1)return null;e+=i[0].width}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length}}coordsAt(e,t){return yl(this,e,t)}become(e){return!1}get type(){return J.Text}static find(e,t){for(let i=0,s=0;i=t){if(r instanceof fe)return r;if(o>t)break}s=o+r.breakAfter}return null}}class ut extends ${constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof ut)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,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,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(0,i)),this.getLine().append(wi(new ot(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof mt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof mt)if(i.block){let{type:h}=i;h==J.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ut(i.widget||new Mr("div"),l,h))}else{let h=Qe.create(i.widget||new Mr("span"),l,i.startSide),a=this.atCursorPos&&!h.isEditable&&r<=s.length&&(e0),c=!h.isEditable&&(en.some(e=>e)});class qi{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new qi(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Dr=H.define({map:(n,e)=>n.map(e)});function Pe(n,e,t){let i=n.facet(Sl);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const an=T.define({combine:n=>n.length?n[0]:!0});let fc=0;const Gt=T.define();class ue{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new ue(fc++,e,i,o=>{let l=[Gt.of(o)];return r&&l.push(li.of(h=>{let a=h.plugin(o);return a?r(a):P.none})),s&&l.push(s(o)),l})}static fromClass(e,t){return ue.define(i=>new e(i),t)}}class An{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Pe(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Pe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Pe(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Al=T.define(),Ml=T.define(),li=T.define(),Dl=T.define(),Ol=T.define(),Jt=T.define();class Ue{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Ue(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!h)return i;new Ue(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),o=h.toA,l=h.toB}}}class Ki{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ee.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let s=[];this.changes.iterChangedRanges((o,l,h,a)=>s.push(new Ue(o,l,h,a))),this.changedRanges=s;let r=e.hasFocus;r!=e.inputState.notifiedFocused&&(e.inputState.notifiedFocused=r,this.flags|=1)}static create(e,t,i){return new Ki(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var Z=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(Z||(Z={}));const us=Z.LTR,uc=Z.RTL;function Tl(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const X=[];function yc(n,e){let t=n.length,i=e==us?1:2,s=e==us?2:1;if(!n||i==1&&!mc.test(n))return Bl(t);for(let o=0,l=i,h=i;o=0;u-=3)if(Re[u+1]==-c){let d=Re[u+2],p=d&2?i:d&4?d&1?s:i:0;p&&(X[o]=X[Re[u]]=p),l=u;break}}else{if(Re.length==189)break;Re[l++]=o,Re[l++]=a,Re[l++]=h}else if((f=X[o])==2||f==1){let u=f==i;h=u?0:1;for(let d=l-3;d>=0;d-=3){let p=Re[d+2];if(p&2)break;if(u)Re[d+2]|=2;else{if(p&4)break;Re[d+2]|=4}}}for(let o=0;ol;){let c=a,f=X[--a]!=2;for(;a>l&&f==(X[a-1]!=2);)a--;r.push(new Tt(a,c,f?2:1))}else r.push(new Tt(l,o,0))}else for(let o=0;o1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=$.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function Or(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class Tr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Br extends ${constructor(e){super(),this.view=e,this.compositionDeco=P.none,this.decorations=[],this.dynamicDecorationMap=[],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 fe],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ue(0,0,0,e.state.doc.length)],0)}get root(){return this.view.root}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:o,toA:l})=>lthis.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.view.inputState.composing<0?this.compositionDeco=P.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=xc(this.view,e.changes)),(M.ie||M.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=Cc(i,s,e.changes);return t=Ue.extendWithRanges(t,r),this.dirty==0&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=M.chrome||M.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?e[s]:null;if(!r)break;let{fromA:o,toA:l,fromB:h,toB:a}=r,{content:c,breakAtStart:f,openStart:u,openEnd:d}=Vs.build(this.view.state.doc,h,a,this.decorations,this.dynamicDecorationMap),{i:p,off:g}=i.findPos(l,1),{i:y,off:b}=i.findPos(o,-1);al(this,y,b,p,g,c,f,u,d)}}updateSelection(e=!1,t=!1){if((e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(t||this.mayControlSelection())||M.ios&&this.view.inputState.rapidCompositionStart)return;let i=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,r=this.domAtPos(s.anchor),o=s.empty?r:this.domAtPos(s.head);if(M.gecko&&s.empty&&wc(r)){let h=document.createTextNode("");this.view.observer.ignore(()=>r.node.insertBefore(h,r.node.childNodes[r.offset]||null)),r=o=new le(h,0),i=!0}let l=this.view.observer.selectionRange;(i||!l.focusNode||!Wi(r.node,r.offset,l.anchorNode,l.anchorOffset)||!Wi(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{M.android&&M.chrome&&this.dom.contains(l.focusNode)&&Ac(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Hi(this.root);if(h)if(s.empty){if(M.gecko){let a=Sc(r.node,r.offset);if(a&&a!=3){let c=El(r.node,r.offset,a==1?1:-1);c&&(r=new le(c,a==1?0:c.nodeValue.length))}}h.collapse(r.node,r.offset),s.bidiLevel!=null&&l.cursorBidiLevel!=null&&(l.cursorBidiLevel=s.bidiLevel)}else if(h.extend)h.collapse(r.node,r.offset),h.extend(o.node,o.offset);else{let a=document.createRange();s.anchor>s.head&&([r,o]=[o,r]),a.setEnd(o.node,o.offset),a.setStart(r.node,r.offset),h.removeAllRanges(),h.addRange(a)}}),this.view.observer.setSelectionRange(r,o)),this.impreciseAnchor=r.precise?null:new le(l.anchorNode,l.anchorOffset),this.impreciseHead=o.precise?null:new le(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let e=this.view.state.selection.main,t=Hi(this.root);if(!t||!e.empty||!e.assoc||!t.modify)return;let i=fe.find(this,e.head);if(!i)return;let s=i.posAtStart;if(e.head==s||e.head==s+i.length)return;let r=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!r||!o||r.bottom>o.top)return;let l=this.domAtPos(e.head+e.assoc);t.collapse(l.node,l.offset),t.modify("move",e.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){let e=this.root.activeElement;return e==this.dom||ts(this.dom,this.view.observer.selectionRange)&&!(e&&this.dom.contains(e))}nearest(e){for(let t=e;t;){let i=$.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=J.WidgetBefore&&r.type!=J.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==J.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==Z.LTR;for(let a=0,c=0;cs)break;if(a>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,g=p?ri(p):[];if(g.length){let y=g[g.length-1],b=h?y.right-d.left:d.right-y.left;b>l&&(l=b,this.minWidth=r,this.minWidthFrom=a,this.minWidthTo=u)}}}a=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Z.RTL:Z.LTR}measureTextSize(){for(let s of this.children)if(s instanceof fe){let r=s.measureTextSize();if(r)return r}let e=document.createElement("div"),t,i;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ri(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,e.remove()}),{lineHeight:t,charWidth:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new hl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(P.replace({widget:new Pr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return P.set(e)}updateDeco(){let e=this.view.state.facet(li).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=0,o=0,l=0,h=0;for(let c of this.view.state.facet(Ol).map(f=>f(this.view)))if(c){let{left:f,right:u,top:d,bottom:p}=c;f!=null&&(r=Math.max(r,f)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(h=Math.max(h,p))}let a={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+h};rc(this.view.scrollDOM,a,t.head0&&t<=0)n=n.childNodes[e-1],e=zi(n);else if(n.nodeType==1&&e=0)n=n.childNodes[e],e=0;else return null}}function Sc(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let a=Ae(s.text,o,!1);if(i(s.text.slice(a,o))!=h)break;o=a}for(;ln?e.left-n:Math.max(0,n-e.right)}function Oc(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Mn(n,e){return n.tope.top+1}function Rr(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function ps(n,e,t){let i,s,r,o,l,h,a,c;for(let d=n.firstChild;d;d=d.nextSibling){let p=ri(d);for(let g=0;gv||o==v&&r>b)&&(i=d,s=y,r=b,o=v),b==0?t>y.bottom&&(!a||a.bottomy.top)&&(h=d,c=y):a&&Mn(a,y)?a=Lr(a,y.bottom):c&&Mn(c,y)&&(c=Rr(c,y.top))}}if(a&&a.bottom>=t?(i=l,s=a):c&&c.top<=t&&(i=h,s=c),!i)return{node:n,offset:0};let f=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Er(i,f,t);if(!r&&i.contentEditable=="true")return ps(i,f,t);let u=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:u}}function Er(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if((M.chrome||M.gecko)&&oi(n,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function Il(n,{x:e,y:t},i,s=-1){var r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,h,{docHeight:a}=n.viewState,c=t-l;if(c<0)return 0;if(c>a)return n.state.doc.length;for(let b=n.defaultLineHeight/2,v=!1;h=n.elementAtHeight(c),h.type!=J.Text;)for(;c=s>0?h.bottom+b:h.top-b,!(c>=0&&c<=a);){if(v)return i?null:0;v=!0,s=-s}t=l+c;let f=h.from;if(fn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:i?null:Ir(n,o,h,e,t);let u=n.dom.ownerDocument,d=n.root.elementFromPoint?n.root:u,p=d.elementFromPoint(e,t);p&&!n.contentDOM.contains(p)&&(p=null),p||(e=Math.max(o.left+1,Math.min(o.right-1,e)),p=d.elementFromPoint(e,t),p&&!n.contentDOM.contains(p)&&(p=null));let g,y=-1;if(p&&((r=n.docView.nearest(p))===null||r===void 0?void 0:r.isEditable)!=!1){if(u.caretPositionFromPoint){let b=u.caretPositionFromPoint(e,t);b&&({offsetNode:g,offset:y}=b)}else if(u.caretRangeFromPoint){let b=u.caretRangeFromPoint(e,t);b&&({startContainer:g,startOffset:y}=b,M.safari&&Tc(g,y,e)&&(g=void 0))}}if(!g||!n.docView.dom.contains(g)){let b=fe.find(n.docView,f);if(!b)return c>h.top+h.height/2?h.to:h.from;({node:g,offset:y}=ps(b.dom,e,t))}return n.docView.posFromDOM(g,y)}function Ir(n,e,t,i,s){let r=Math.round((i-e.left)*n.defaultCharacterWidth);n.lineWrapping&&t.height>n.defaultLineHeight*1.5&&(r+=Math.floor((s-t.top)/n.defaultLineHeight)*n.viewState.heightOracle.lineLength);let o=n.state.sliceDoc(t.from,t.to);return t.from+Qn(o,r,n.state.tabSize)}function Tc(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return oi(n,i-1,i).getBoundingClientRect().left>t}function Bc(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=!i||!n.lineWrapping?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let h=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),c=n.posAtCoords({x:t==(a==Z.LTR)?h.right-1:h.left+1,y:(r.top+r.bottom)/2});if(c!=null)return m.cursor(c,t?-1:1)}let o=fe.find(n.docView,e.head),l=o?t?o.posAtEnd:o.posAtStart:t?s.to:s.from;return m.cursor(l,t?-1:1)}function Nr(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,h=null;;){let a=bc(s,r,o,l,t),c=Pl;if(!a){if(s.number==(t?n.state.doc.lines:1))return l;c=` -`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=m.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Pc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==ce.Space&&(s=o),s==o}}function Rc(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return m.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,g=Il(n,{x:f,y:p},!1,r);if(ph.bottom||(r<0?gs))return m.cursor(g,e.assoc,void 0,o)}}function Dn(n,e,t){let i=n.state.facet(Dl).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.fromt.from?m.cursor(o,1):m.cursor(l,-1),s=!0)});if(!s)return t}}class Lc{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let t in ie){let i=ie[t];e.contentDOM.addEventListener(t,s=>{!Vr(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))}),this.registeredEvents.push(t)}M.chrome&&M.chrome_version>=102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,M.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Vr(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Pe(t.state,o)}}return!1}runScrollHandlers(e,t){for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Pe(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!(t.ctrlKey||t.altKey||t.metaKey)&&!t.synthetic?(this.pendingIOSKey=i,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,Zt(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:M.safari&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!M.ios}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Nl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vl=[16,17,18,20,91,92,224,225];class Ec{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&Ic(e,t),this.dragMove=Nc(e,t),this.dragging=Vc(e,t)&&Fs(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(e){let t=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!t.eq(this.view.state.selection)||t.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:t,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Ic(n,e){let t=n.state.facet(wl);return t.length?t[0](e):M.mac?e.metaKey:e.ctrlKey}function Nc(n,e){let t=n.state.facet(xl);return t.length?t[0](e):M.mac?!e.altKey:!e.ctrlKey}function Vc(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Hi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Vr(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=$.get(t))&&i.ignoreEvent(e))return!1;return!0}const ie=Object.create(null),Fl=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;function Fc(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Hl(n,t.value)},50)}function Hl(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(gs!=null&&t.selection.ranges.every(h=>h.empty)&&gs==r.toString()){let h=-1;i=t.changeByRange(a=>{let c=t.doc.lineAt(a.from);if(c.from==h)return{range:a};h=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:m.cursor(a.from+f.length)}})}else o?i=t.changeByRange(h=>{let a=r.line(s++);return{changes:{from:h.from,to:h.to,insert:a.text},range:m.cursor(h.from+a.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ie.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27?n.inputState.lastEscPress=Date.now():Vl.indexOf(e.keyCode)<0&&(n.inputState.lastEscPress=0)};let Wl=0;ie.touchstart=(n,e)=>{Wl=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ie.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ie.mousedown=(n,e)=>{if(n.observer.flush(),Wl>Date.now()-2e3&&Fs(e)==1)return;let t=null;for(let i of n.state.facet(kl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=zc(n,e)),t){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>ol(n.contentDOM)),n.inputState.startMouseSelection(new Ec(n,e,t,i))}};function Fr(n,e,t,i){if(i==1)return m.cursor(e,t);if(i==2)return Mc(n.state,e,t);{let s=fe.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return ln>=e.top&&n<=e.bottom,Hr=(n,e,t)=>zl(e,t)&&n>=t.left&&n<=t.right;function Hc(n,e,t,i){let s=fe.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Hr(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Hr(t,i,l)?1:o&&zl(i,o)?-1:1}function Wr(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Hc(n,t,e.clientX,e.clientY)}}const Wc=M.ie&&M.ie_version<=11;let zr=null,qr=0,Kr=0;function Fs(n){if(!Wc)return n.detail;let e=zr,t=Kr;return zr=n,Kr=Date.now(),qr=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(qr+1)%3:1}function zc(n,e){let t=Wr(n,e),i=Fs(e),s=n.state.selection,r=t,o=e;return{update(l){l.docChanged&&(t&&(t.pos=l.changes.mapPos(t.pos)),s=s.map(l.changes),o=null)},get(l,h,a){let c;if(o&&l.clientX==o.clientX&&l.clientY==o.clientY?c=r:(c=r=Wr(n,l),o=l),!c||!t)return s;let f=Fr(n,c.pos,c.bias,i);if(t.pos!=c.pos&&!h){let u=Fr(n,t.pos,t.bias,i),d=Math.min(u.from,f.from),p=Math.max(u.to,f.to);f=d{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function Ur(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:t},h=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}ie.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&Ur(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}}else Ur(n,e,e.dataTransfer.getData("Text"),!0)};ie.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=Fl?null:e.clipboardData;t?(Hl(n,t.getData("text/plain")),e.preventDefault()):Fc(n)};function qc(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Kc(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let gs=null;ie.copy=ie.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=Kc(n.state);if(!t&&!s)return;gs=s?t:null;let r=Fl?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):qc(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};function ql(n){setTimeout(()=>{n.hasFocus!=n.inputState.notifiedFocused&&n.update([])},10)}ie.focus=ql;ie.blur=n=>{n.observer.clearSelectionRange(),ql(n)};function Kl(n,e){if(n.docView.compositionDeco.size){n.inputState.rapidCompositionStart=e;try{n.update([])}finally{n.inputState.rapidCompositionStart=!1}}}ie.compositionstart=ie.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0,n.docView.compositionDeco.size&&(n.observer.flush(),Kl(n,!0)))};ie.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionFirstChange=null,setTimeout(()=>{n.inputState.composing<0&&Kl(n,!1)},50)};ie.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};ie.beforeinput=(n,e)=>{var t;let i;if(M.chrome&&M.android&&(i=Nl.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const jr=["pre-wrap","normal","pre-line","break-spaces"];class Uc{constructor(){this.doc=z.empty,this.lineWrapping=!1,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}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 jr.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=i,this.lineLength=s,l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Ei&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return be.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:h,fromB:a,toB:c}=s[o],f=r.lineAt(l,j.ByPosNoHeight,t,0,0),u=f.to>=h?f:r.lineAt(h,j.ByPosNoHeight,t,0,0);for(c+=u.to-h,h=u.to;o>0&&f.from<=s[o-1].toA;)l=s[o-1].fromA,a=s[o-1].fromB,o--,lr*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Se extends Ul{constructor(e,t){super(e,t,J.Text),this.collapsed=0,this.widgetHeight=0}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Se||s instanceof se&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof se?s=new Se(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):be.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class se extends be{constructor(e){super(e,0)}lines(e,t){let i=e.lineAt(t).number,s=e.lineAt(t+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,lineHeight:l}=this.lines(t,s),h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:a,length:c}=t.line(r+h);return new et(a,c,i+l*h,l,J.Text)}lineAt(e,t,i,s,r){if(t==j.ByHeight)return this.blockAt(e,i,s,r);if(t==j.ByPosNoHeight){let{from:f,to:u}=i.lineAt(e);return new et(f,u-f,0,0,J.Text)}let{firstLine:o,lineHeight:l}=this.lines(i,r),{from:h,length:a,number:c}=i.lineAt(e);return new et(h,a,s+l*(c-o),l,J.Text)}forEachLine(e,t,i,s,r,o){let{firstLine:l,lineHeight:h}=this.lines(i,r);for(let a=Math.max(e,r),c=Math.min(r+this.length,t);a<=c;){let f=i.lineAt(a);a==e&&(s+=h*(f.number-l)),o(new et(f.from,f.length,s,h,J.Text)),s+=h,a=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof se?i[i.length-1]=new se(r.length+s):i.push(null,new se(s-1))}if(e>0){let r=i[0];r instanceof se?i[0]=new se(e+r.length):i.unshift(new se(e-1),null)}return be.of(i)}decomposeLeft(e,t){t.push(new se(e-1),null)}decomposeRight(e,t){t.push(null,new se(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),h=-1,a=e.heightChanged;for(s.from>t&&o.push(new se(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let u=s.heights[s.index++];h==-1?h=u:Math.abs(u-h)>=Ei&&(h=-2);let d=new Se(f,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new se(r-l).updateHeight(e,l));let c=be.of(o);return e.heightChanged=a||h<0||Math.abs(c.height-this.height)>=Ei||Math.abs(h-this.lines(e.doc,t).lineHeight)>=Ei,c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Gc extends be{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return a;let c=t==j.ByPosNoHeight?j.ByPosNoHeight:j.ByPos;return h?a.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(a)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)e=h&&this.right.forEachLine(e,t,i,l,h,o);else{let a=this.lineAt(h,j.ByPos,i,s,r);e=e&&a.from<=t&&o(a),t>a.to&&this.right.forEachLine(a.to+1,t,i,l,h,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&Gr(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?be.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,h=null;return s&&s.from<=t+r.length&&s.more?h=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?h=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),h?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Gr(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof se&&(i=n[e+1])instanceof se&&n.splice(e-1,3,new se(t.length+1+i.length))}const Jc=5;class Hs{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Se?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Se(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Jc)&&this.addLineDeco(s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Se(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new se(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Se)return e;let t=new Se(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine(),e.type==J.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=J.WidgetBefore&&(this.covering=e)}addLineDeco(e,t){let i=this.ensureLine();i.length+=t,i.collapsed+=t,i.widgetHeight=Math.max(i.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Se)&&!this.isCovered?this.nodes.push(new Se(0,-1)):(this.writtenToa.clientHeight||a.scrollWidth>a.clientWidth)&&c.overflow!="visible"){let f=a.getBoundingClientRect();i=Math.max(i,f.left),s=Math.min(s,f.right),r=Math.max(r,f.top),o=Math.min(o,f.bottom)}h=c.position=="absolute"||c.position=="fixed"?a.offsetParent:a.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-t.left,right:Math.max(i,s)-t.left,top:r-(t.top+e),bottom:Math.max(r,o)-(t.top+e)}}function _c(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class On{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof t!="function"),this.heightMap=be.empty().applyChanges(this.stateDeco,z.empty,this.heightOracle.setDoc(e.doc),[new Ue(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=P.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new xi(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?Yr:new tf(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:$t(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(li).filter(a=>typeof a!="function");let s=e.changedRanges,r=Ue.extendWithRanges(s,$c(i,this.stateDeco,e?e.changes:ee.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Z.RTL:Z.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=o||this.mustMeasureContent||this.contentDOMHeight!=t.clientHeight;this.contentDOMHeight=t.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=f)&&(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let u=(this.printing?_c:Yc)(t,this.paddingTop),d=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView)return 0;let y=t.clientWidth;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=y,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:A,charWidth:x}=e.docView.measureTextSize();o=s.refresh(r,A,x,y/x,v),o&&(e.docView.minWidth=0,h|=8)}d>0&&p>0?a=Math.max(d,p):d<0&&p<0&&(a=Math.min(d,p)),s.heightChanged=!1;for(let A of this.viewports){let x=A.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(A);this.heightMap=this.heightMap.updateHeight(s,0,o,new jc(A.from,x))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(h&2||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.state.doc,{visibleTop:o,visibleBottom:l}=this,h=new xi(s.lineAt(o-i*1e3,j.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,j.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(ah.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(a,j.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&a=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&ri.from&&l.push({from:i.from,to:r}),o=i.from&&h.from<=i.to&&Xr(l,h.from-10,h.from+10),!h.empty&&h.to>=i.from&&h.to<=i.to&&Xr(l,h.to-10,h.to+10);for(let{from:a,to:c}of l)c-a>1e3&&t.push(ef(e,f=>f.from>=i.from&&f.to<=i.to&&Math.abs(f.from-a)<1e3&&Math.abs(f.to-c)<1e3)||new On(a,c,this.gapSize(i,a,c,s)))}return t}gapSize(e,t,i,s){let r=$r(s,i)-$r(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){On.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=P.set(e.map(t=>t.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];Y.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||$t(this.heightMap.lineAt(e,j.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(e){return $t(this.heightMap.lineAt(this.scaler.fromDOM(e),j.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(e){return $t(this.heightMap.blockAt(this.scaler.fromDOM(e),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class xi{constructor(e,t){this.from=e,this.to=t}}function Zc(n,e,t){let i=[],s=n,r=0;return Y.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function $r(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Xr(n,e,t){for(let i=0;ie){let r=[];s.fromt&&r.push({from:t,to:s.to}),n.splice(i,1,...r),i+=r.length-1}}}function ef(n,e){for(let t of n)if(e(t))return t}const Yr={toDOM(n){return n},fromDOM(n){return n},scale:1};class tf{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:h})=>{let a=t.lineAt(l,j.ByPos,e,0,0).top,c=t.lineAt(h,j.ByPos,e,0,0).bottom;return s+=c-a,{from:l,to:h,top:a,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=t$t(s,e)):n.type)}const Si=T.define({combine:n=>n.join(" ")}),ms=T.define({combine:n=>n.indexOf(!0)>-1}),ys=st.newName(),jl=st.newName(),Gl=st.newName(),Jl={"&light":"."+jl,"&dark":"."+Gl};function bs(n,e,t){return new st(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const nf=bs("."+ys,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",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 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},".cm-cursor, .cm-dropCursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".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"}},Jl),sf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Tn=M.ie&&M.ie_version<=11;class rf{constructor(e,t,i){this.view=e,this.onChange=t,this.onScrollChanged=i,this.active=!1,this.selectionRange=new oc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(s=>{for(let r of s)this.queue.push(r);(M.ie&&M.ie_version<=11||M.ios&&e.composing)&&s.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Tn&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),window.addEventListener("resize",this.onResize=this.onResize.bind(this)),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),s.length>0&&s[s.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(s=>{s.length>0&&s[s.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange(),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:t}=this,i=this.selectionRange;if(t.state.facet(an)?t.root.activeElement!=this.dom:!ts(t.dom,i))return;let s=i.anchorNode&&t.docView.nearest(i.anchorNode);s&&s.ignoreEvent(e)||((M.ie&&M.ie_version<=11||M.android&&M.chrome)&&!t.state.selection.main.empty&&i.focusNode&&Wi(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1))}readSelectionRange(){let{root:e}=this.view,t=M.safari&&e.nodeType==11&&nc()==this.view.contentDOM&&of(this.view)||Hi(e);return!t||this.selectionRange.eq(t)?!1:(this.selectionRange.setRange(t),this.selectionChanged=!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e{let i=this.delayedAndroidKey;this.delayedAndroidKey=null,this.delayedFlush=-1,this.flush()||Zt(this.view.contentDOM,i.key,i.keyCode)}),(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t})}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=window.setTimeout(()=>{this.delayedFlush=-1,this.flush()},20))}forceFlush(){this.delayedFlush>=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}processRecords(){let e=this.queue;for(let r of this.observer.takeRecords())e.push(r);e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);!o||(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return;e&&this.readSelectionRange();let{from:t,to:i,typeOver:s}=this.processRecords(),r=this.selectionChanged&&ts(this.dom,this.selectionRange);if(t<0&&!r)return;this.selectionChanged=!1;let o=this.view.state,l=this.onChange(t,i,s);return this.view.state==o&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.dirty|=4),e.type=="childList"){let i=_r(t,e.previousSibling||e.target.previousSibling,-1),s=_r(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resize)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);window.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize),window.removeEventListener("beforeprint",this.onPrint),this.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}function _r(n,e,t){for(;e;){let i=$.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function of(n){let e=null;function t(h){h.preventDefault(),h.stopImmediatePropagation(),e=h.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),document.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return Wi(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}function lf(n,e,t,i){let s,r,o=n.state.selection.main;if(e>-1){let l=n.docView.domBoundsAround(e,t,0);if(!l||n.state.readOnly)return!1;let{from:h,to:a}=l,c=n.docView.impreciseHead||n.docView.impreciseAnchor?[]:af(n),f=new Rl(c,n.state);f.readRange(l.startDOM,l.endDOM);let u=o.from,d=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||M.android&&f.text.length=o.from&&s.to<=o.to&&(s.from!=o.from||s.to!=o.to)&&o.to-o.from-(s.to-s.from)<=4?s={from:o.from,to:o.to,insert:n.state.doc.slice(o.from,s.from).append(s.insert).append(n.state.doc.slice(s.to,o.to))}:(M.mac||M.android)&&s&&s.from==s.to&&s.from==o.head-1&&s.insert.toString()=="."&&(s={from:o.from,to:o.to,insert:z.of([" "])}),s){let l=n.state;if(M.ios&&n.inputState.flushIOSKey(n)||M.android&&(s.from==o.from&&s.to==o.to&&s.insert.length==1&&s.insert.lines==2&&Zt(n.contentDOM,"Enter",13)||s.from==o.from-1&&s.to==o.to&&s.insert.length==0&&Zt(n.contentDOM,"Backspace",8)||s.from==o.from&&s.to==o.to+1&&s.insert.length==0&&Zt(n.contentDOM,"Delete",46)))return!0;let h=s.insert.toString();if(n.state.facet(vl).some(f=>f(n,s.from,s.to,h)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let a;if(s.from>=o.from&&s.to<=o.to&&s.to-s.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==s.from+s.insert.length)&&n.inputState.composing<0){let f=o.froms.to?l.sliceDoc(s.to,o.to):"";a=l.replaceSelection(n.state.toText(f+s.insert.sliceString(0,void 0,n.state.lineBreak)+u))}else{let f=l.changes(s),u=r&&!l.selection.main.eq(r.main)&&r.main.to<=f.newLength?r.main:void 0;if(l.selection.ranges.length>1&&n.inputState.composing>=0&&s.to<=o.to&&s.to>=o.to-10){let d=n.state.sliceDoc(s.from,s.to),p=Ll(n)||n.state.doc.lineAt(o.head),g=o.to-s.to,y=o.to-o.from;a=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:f,range:u||b.map(f)};let v=b.to-g,A=v-d.length;if(b.to-b.from!=y||n.state.sliceDoc(A,v)!=d||p&&b.to>=p.from&&b.from<=p.to)return{range:b};let x=l.changes({from:A,to:v,insert:s.insert}),S=b.to-o.to;return{changes:x,range:u?m.range(Math.max(0,u.anchor+S),Math.max(0,u.head+S)):b.map(x)}})}else a={changes:f,selection:u&&l.selection.replaceRange(u)}}let c="input.type";return n.composing&&(c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(a,{scrollIntoView:!0,userEvent:c}),!0}else if(r&&!r.main.eq(o)){let l=!1,h="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),h=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:l,userEvent:h}),!0}else return!1}function hf(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(o,l));t-=o+h-r}return o=o?r-t:0,l=r+(l-o),o=r):l=l?r-t:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}function af(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Tr(t,i)),(s!=t||r!=i)&&e.push(new Tr(s,r))),e}function cf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?m.single(t+e,i+e):null}class O{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this.root=e.root||lc(e.parent)||document,this.viewState=new Jr(e.state||V.create(e)),this.plugins=this.state.facet(Gt).map(t=>new An(t));for(let t of this.plugins)t.update(this);this.observer=new rf(this,(t,i,s)=>lf(this,t,i,s),t=>{this.inputState.runScrollHandlers(this,t),this.observer.intersecting&&this.measure()}),this.inputState=new Lc(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Br(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof te?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let l of e){if(l.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=l.state}if(this.destroyed){this.viewState.state=r;return}if(this.observer.clear(),r.facet(V.phrases)!=this.state.facet(V.phrases))return this.setState(r);s=Ki.create(this,r,e);let o=this.viewState.scrollTarget;try{this.updateState=2;for(let l of e){if(o&&(o=o.map(l.changes)),l.scrollIntoView){let{main:h}=l.state.selection;o=new qi(h.empty?h:m.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of l.effects)h.is(Dr)&&(o=h.value)}this.viewState.update(s,o),this.bidiCache=Ui.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Jt)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(l=>l.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Si)!=s.state.facet(Si)&&(this.viewState.mustMeasureContent=!0),(t||i||o||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let l of this.state.facet(fs))l(s)}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Jr(e),this.plugins=e.facet(Gt).map(i=>new An(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Br(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Gt),i=e.state.facet(Gt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new An(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.flush();let t=null;try{for(let i=0;;i++){this.updateState=1;let s=this.viewport,r=this.viewState.measure(this);if(!r&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(i>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let o=[];r&4||([this.measureRequests,o]=[o,this.measureRequests]);let l=o.map(f=>{try{return f.read(this)}catch(u){return Pe(this.state,u),Qr}}),h=Ki.create(this,this.state,[]),a=!1,c=!1;h.flags|=r,t?t.flags|=r:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),a=this.docView.update(h));for(let f=0;f{let s=as(this.contentDOM,this.contentAttrs,t),r=as(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(O.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Jt),st.mount(this.root,this.styleModules.concat(nf).reverse())}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=requestAnimationFrame(()=>this.measure())),e){if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Dn(this,e,Nr(this,e,t,i))}moveByGroup(e,t){return Dn(this,e,Nr(this,e,t,i=>Pc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Bc(this,e,t,i)}moveVertically(e,t,i){return Dn(this,e,Rc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Il(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Tt.find(r,e-s.from,-1,t)];return on(i,o.dir==Z.LTR==t>0)}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(Cl)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ff)return Bl(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=yc(e.text,t);return this.bidiCache.push(new Ui(e.from,e.to,t,i)),i}get hasFocus(){var e;return(document.hasFocus()||M.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ol(this.contentDOM),this.docView.updateSelection()})}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Dr.of(new qi(typeof e=="number"?m.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ue.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=st.newName(),s=[Si.of(i),Jt.of(bs(`.${i}`,e))];return t&&t.dark&&s.push(ms.of(!0)),s}static baseTheme(e){return fi.lowest(Jt.of(bs("."+ys,e,Jl)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&$.get(i)||$.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}O.styleModule=Jt;O.inputHandler=vl;O.perLineTextDirection=Cl;O.exceptionSink=Sl;O.updateListener=fs;O.editable=an;O.mouseSelectionStyle=kl;O.dragMovesSelection=xl;O.clickAddsSelectionRange=wl;O.decorations=li;O.atomicRanges=Dl;O.scrollMargins=Ol;O.darkTheme=ms;O.contentAttributes=Ml;O.editorAttributes=Al;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=H.define();const ff=4096,Qr={};class Ui{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:Z.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&hs(o,t)}return t}const uf=M.mac?"mac":M.windows?"win":M.linux?"linux":"key";function df(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let h=0;hi.concat(s),[]))),t}function gf(n,e,t){return Xl($l(n.state),e,n,t)}let Xe=null;const mf=4e3;function yf(n,e=uf){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let h=i[o];if(h==null)i[o]=l;else if(h!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,h,a)=>{let c=t[o]||(t[o]=Object.create(null)),f=l.split(/ (?!$)/).map(p=>df(p,e));for(let p=1;p{let b=Xe={view:y,prefix:g,scope:o};return setTimeout(()=>{Xe==b&&(Xe=null)},mf),!0}]})}let u=f.join(" ");s(u,!1);let d=c[u]||(c[u]={preventDefault:!1,commands:[]});d.commands.push(h),a&&(d.preventDefault=!0)};for(let o of n){let l=o[e]||o.key;if(!!l)for(let h of o.scope?o.scope.split(" "):["editor"])r(h,l,o.run,o.preventDefault),o.shift&&r(h,"Shift-"+l,o.shift,o.preventDefault)}return t}function Xl(n,e,t,i){let s=ic(e),r=re(s,0),o=ve(r)==s.length&&s!=" ",l="",h=!1;Xe&&Xe.view==t&&Xe.scope==i&&(l=Xe.prefix+" ",(h=Vl.indexOf(e.keyCode)<0)&&(Xe=null));let a=u=>{if(u){for(let d of u.commands)if(d(t))return!0;u.preventDefault&&(h=!0)}return!1},c=n[i],f;if(c){if(a(c[l+vi(s,e,!o)]))return!0;if(o&&(e.shiftKey||e.altKey||e.metaKey||r>127)&&(f=rt[e.keyCode])&&f!=s){if(a(c[l+vi(f,e,!0)]))return!0;if(e.shiftKey&&Pt[e.keyCode]!=f&&a(c[l+vi(Pt[e.keyCode],e,!1)]))return!0}else if(o&&e.shiftKey&&a(c[l+vi(s,e,!0)]))return!0}return h}const Yl=!M.ios,Xt=T.define({combine(n){return Ht(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function bf(n={}){return[Xt.of(n),wf,xf]}class _l{constructor(e,t,i,s,r){this.left=e,this.top=t,this.width=i,this.height=s,this.className=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(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}}const wf=ue.fromClass(class{constructor(n){this.view=n,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=n.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=n.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),n.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet(Xt).cursorBlinkRate+"ms"}update(n){let e=n.startState.facet(Xt)!=n.state.facet(Xt);(e||n.selectionSet||n.geometryChanged||n.viewportChanged)&&this.view.requestMeasure(this.measureReq),n.transactions.some(t=>t.scrollIntoView)&&(this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:n}=this.view,e=n.facet(Xt),t=n.selection.ranges.map(s=>s.empty?[]:kf(this.view,s)).reduce((s,r)=>s.concat(r)),i=[];for(let s of n.selection.ranges){let r=s==n.selection.main;if(s.empty?!r||Yl:e.drawRangeCursor){let o=Sf(this.view,s,r);o&&i.push(o)}}return{rangePieces:t,cursors:i}}drawSel({rangePieces:n,cursors:e}){if(n.length!=this.rangePieces.length||n.some((t,i)=>!t.eq(this.rangePieces[i]))){this.selectionLayer.textContent="";for(let t of n)this.selectionLayer.appendChild(t.draw());this.rangePieces=n}if(e.length!=this.cursors.length||e.some((t,i)=>!t.eq(this.cursors[i]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent="";for(const i of e)this.cursorLayer.appendChild(i.draw())}else e.forEach((i,s)=>i.adjust(t[s]));this.cursors=e}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),Ql={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Yl&&(Ql[".cm-line"].caretColor="transparent !important");const xf=fi.highest(O.theme(Ql));function Zl(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Z.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function to(n,e,t){let i=m.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:J.Text}}function io(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==J.Text))return i}return t}function kf(n,e){if(e.to<=n.viewport.from||e.from>=n.viewport.to)return[];let t=Math.max(e.from,n.viewport.from),i=Math.min(e.to,n.viewport.to),s=n.textDirection==Z.LTR,r=n.contentDOM,o=r.getBoundingClientRect(),l=Zl(n),h=window.getComputedStyle(r.firstChild),a=o.left+parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)),c=o.right-parseInt(h.paddingRight),f=io(n,t),u=io(n,i),d=f.type==J.Text?f:null,p=u.type==J.Text?u:null;if(n.lineWrapping&&(d&&(d=to(n,t,d)),p&&(p=to(n,i,p))),d&&p&&d.from==p.from)return y(b(e.from,e.to,d));{let A=d?b(e.from,null,d):v(f,!1),x=p?b(null,e.to,p):v(u,!0),S=[];return(d||f).to<(p||u).from-1?S.push(g(a,A.bottom,c,x.top)):A.bottomL&&G.from=E)break;I>C&&N(Math.max(q,C),A==null&&q<=L,Math.min(I,E),x==null&&I>=W,K.dir)}if(C=R.to+1,C>=E)break}return U.length==0&&N(L,A==null,W,x==null,n.textDirection),{top:D,bottom:B,horizontal:U}}function v(A,x){let S=o.top+(x?A.top:A.bottom);return{top:S,bottom:S,horizontal:[]}}}function Sf(n,e,t){let i=n.coordsAtPos(e.head,e.assoc||1);if(!i)return null;let s=Zl(n);return new _l(i.left-s.left,i.top-s.top,-1,i.bottom-i.top,t?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}const eh=H.define({map(n,e){return n==null?null:e.mapPos(n)}}),Yt=ke.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(eh)?i.value:t,n)}}),vf=ue.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Yt);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Yt)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(Yt),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Yt)!=n&&this.view.dispatch({effects:eh.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Cf(){return[Yt,vf]}function no(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,o+l.index+l[0].length,l)}function Af(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Mf{constructor(e){let{regexp:t,decoration:i,boundary:s,maxLength:r=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=t,this.getDeco=typeof i=="function"?i:()=>i,this.boundary=s,this.maxLength=r}createDeco(e){let t=new gt;for(let{from:i,to:s}of Af(e,this.maxLength))no(e.state.doc,this.regexp,i,s,(r,o,l)=>t.add(r,o,this.getDeco(l,e,r)));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,h)=>{h>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let h=e.state.doc.lineAt(o),a=h.toh.from;o--)if(this.boundary.test(h.text[o-1-h.from])){c=o;break}for(;lu.push(this.getDeco(y,e,p).range(p,g)));t=t.update({filterFrom:c,filterTo:f,filter:(p,g)=>pf,add:u})}}return t}}const ws=/x/.unicode!=null?"gu":"g",Df=new RegExp(`[\0-\b --\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\uFEFF\uFFF9-\uFFFC]`,ws),Of={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",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Bn=null;function Tf(){var n;if(Bn==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Bn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Bn||!1}const Ii=T.define({combine(n){let e=Ht(n,{render:null,specialChars:Df,addSpecialChars:null});return(e.replaceTabs=!Tf())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ws)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ws)),e}});function Bf(n={}){return[Ii.of(n),Pf()]}let so=null;function Pf(){return so||(so=ue.fromClass(class{constructor(n){this.view=n,this.decorations=P.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Ii)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Mf({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=re(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=ui(o.text,l,i-o.from);return P.replace({widget:new If((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=P.replace({widget:new Ef(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Ii);n.startState.facet(Ii)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Rf="\u2022";function Lf(n){return n>=32?Rf:n==10?"\u2424":String.fromCharCode(9216+n)}class Ef extends xt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Lf(this.code),i=e.state.phrase("Control character")+" "+(Of[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class If extends xt{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}}class Nf extends xt{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function ro(n){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=P.set([P.widget({widget:new Nf(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?P.none:this.placeholder}},{decorations:e=>e.decorations})}const xs=2e3;function Vf(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>xs||t.off>xs||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(m.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=Qn(a.text,o,n.tabSize,!0);if(c>-1){let f=Qn(a.text,l,n.tabSize);r.push(m.range(a.from+c,a.from+f))}}}return r}function Ff(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function oo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>xs?-1:s==i.length?Ff(n,e.clientX):ui(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Hf(n,e){let t=oo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=oo(n,s);if(!l)return i;let h=Vf(n.state,t,l);return h.length?o?m.create(h.concat(i.ranges)):m.create(h):i}}:null}function Wf(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?Hf(t,i):null)}const Pn="-10000px";class zf{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){let t=e.state.facet(this.facet),i=t.filter(r=>r);if(t===this.input){for(let r of this.tooltipViews)r.update&&r.update(e);return!1}let s=[];for(let r=0;r{var e,t,i;return{position:M.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||qf}}}),th=ue.fromClass(class{constructor(n){var e;this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let t=n.state.facet(Rn);this.position=t.position,this.parent=t.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new zf(n,ih,i=>this.createTooltip(i)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),(e=n.dom.ownerDocument.defaultView)===null||e===void 0||e.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Rn);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Pn,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n,e;(n=this.view.dom.ownerDocument.defaultView)===null||n===void 0||n.removeEventListener("resize",this.measureSoon);for(let{dom:t}of this.manager.tooltipViews)t.remove();(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Rn).tooltipSpace(this.view)}}writeMeasure(n){let{editor:e,space:t}=n,i=[];for(let s=0;s=Math.min(e.bottom,t.bottom)||h.rightMath.min(e.right,t.right)+.1){l.style.top=Pn;continue}let c=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,u=a.right-a.left,d=a.bottom-a.top,p=o.offset||Uf,g=this.view.textDirection==Z.LTR,y=a.width>t.right-t.left?g?t.left:t.right-a.width:g?Math.min(h.left-(c?14:0)+p.x,t.right-u):Math.max(t.left,h.left-u+(c?14:0)-p.x),b=!!r.above;!r.strictSide&&(b?h.top-(a.bottom-a.top)-p.yt.bottom)&&b==t.bottom-h.bottom>h.top-t.top&&(b=!b);let v=b?h.top-d-f-p.y:h.bottom+f+p.y,A=y+u;if(o.overlap!==!0)for(let x of i)x.lefty&&x.topv&&(v=b?x.top-d-2-f:x.bottom+f+2);this.position=="absolute"?(l.style.top=v-n.parent.top+"px",l.style.left=y-n.parent.left+"px"):(l.style.top=v+"px",l.style.left=y+"px"),c&&(c.style.left=`${h.left+(g?p.x:-p.x)-(y+14-7)}px`),o.overlap!==!0&&i.push({left:y,top:v,right:A,bottom:v+d}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),o.positioned&&o.positioned()}}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 n of this.manager.tooltipViews)n.dom.style.top=Pn}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Kf=O.baseTheme({".cm-tooltip":{zIndex:100},"&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:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Uf={x:0,y:0},ih=T.define({enables:[th,Kf]});function jf(n,e){let t=n.plugin(th);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const lo=T.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ji(n,e){let t=n.plugin(nh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const nh=ue.fromClass(class{constructor(n){this.input=n.state.facet(Gi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(lo);this.top=new Ci(n,!0,e.topContainer),this.bottom=new Ci(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(lo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ci(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ci(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Gi);if(t!=this.input){let i=t.filter(h=>h),s=[],r=[],o=[],l=[];for(let h of i){let a=this.specs.indexOf(h),c;a<0?(c=h(n.view),l.push(c)):(c=this.panels[a],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let h of l)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>O.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ci{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ho(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ho(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 ho(n){let e=n.nextSibling;return n.remove(),e}const Gi=T.define({enables:nh});class yt extends pt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yt.prototype.elementClass="";yt.prototype.toDOM=void 0;yt.prototype.mapMode=me.TrackBefore;yt.prototype.startSide=yt.prototype.endSide=-1;yt.prototype.point=!0;const Gf=T.define(),Jf=new class extends yt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},$f=Gf.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges)if(i.empty){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Jf.range(s)))}return Y.of(e)});function Xf(){return $f}const Yf=1024;let _f=0;class Ln{constructor(e,t){this.from=e,this.to=t}}class F{constructor(e={}){this.id=_f++,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=we.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}F.closedBy=new F({deserialize:n=>n.split(" ")});F.openedBy=new F({deserialize:n=>n.split(" ")});F.group=new F({deserialize:n=>n.split(" ")});F.contextHash=new F({perNode:!0});F.lookAhead=new F({perNode:!0});F.mounted=new F({perNode:!0});const Qf=Object.create(null);class we{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Qf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new we(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(F.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(F.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}we.none=new we("",Object.create(null),0,8);class zs{constructor(e){this.types=e;for(let t=0;t=s&&(o.type.isAnonymous||t(o)!==!1)){if(o.firstChild())continue;l=!0}for(;l&&i&&!o.type.isAnonymous&&i(o),!o.nextSibling();){if(!o.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Us(we.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new _(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new _(we.none,t,i,s)))}static build(e){return eu(e)}}_.empty=new _(we.none,[],[],0);class qs{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new qs(this.buffer,this.index)}}class kt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return we.none}toString(){let e=[];for(let t=0;t0));h=o[h+3]);return l}slice(e,t,i,s){let r=this.buffer,o=new Uint16Array(t-e);for(let l=e,h=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function rh(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function Et(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=a;e+=t){let c=l[e],f=h[e]+o.from;if(!!sh(s,i,f,f+c.length)){if(c instanceof kt){if(r&ae.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new tt(new Zf(o,c,e,f),null,u)}else if(r&ae.IncludeAnonymous||!c.type.isAnonymous||Ks(c)){let u;if(!(r&ae.IgnoreMounts)&&c.props&&(u=c.prop(F.mounted))&&!u.overlay)return new je(u.tree,f,e,o);let d=new je(c,f,e,o);return r&ae.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&ae.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&ae.IgnoreOverlays)&&(s=this._tree.prop(F.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new je(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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}cursor(e=0){return new Xi(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return Et(this,e,t,!1)}resolveInner(e,t=0){return Et(this,e,t,!0)}enterUnfinishedNodesBefore(e){return rh(this,e)}getChild(e,t=null,i=null){let s=Ji(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Ji(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return $i(this,e)}}function Ji(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function $i(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Zf{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class tt{constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}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]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new tt(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&ae.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new tt(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new tt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new tt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new Xi(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1],l=i.buffer[this.index+2];e.push(i.slice(s,r,o,l)),t.push(0)}return new _(this.type,e,t,this.to-this.from)}resolve(e,t=0){return Et(this,e,t,!1)}resolveInner(e,t=0){return Et(this,e,t,!0)}enterUnfinishedNodesBefore(e){return rh(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=Ji(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Ji(this,e,t,i)}get node(){return this}matchContext(e){return $i(this,e)}}class Xi{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof je)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof je?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&ae.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ae.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ae.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&ae.IncludeAnonymous||l instanceof kt||!l.type.isAnonymous||Ks(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}}for(let s=i;s=0;r--){if(r<0)return $i(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Ks(n){return n.children.some(e=>e instanceof kt||!e.type.isAnonymous||Ks(e))}function eu(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Yf,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new qs(t,t.length):t,h=i.types,a=0,c=0;function f(x,S,D,B,U){let{id:N,start:L,end:W,size:G}=l,C=c;for(;G<0;)if(l.next(),G==-1){let I=r[N];D.push(I),B.push(L-x);return}else if(G==-3){a=N;return}else if(G==-4){c=N;return}else throw new RangeError(`Unrecognized record size: ${G}`);let E=h[N],R,K,q=L-x;if(W-L<=s&&(K=g(l.pos-S,U))){let I=new Uint16Array(K.size-K.skip),ne=l.pos-K.size,de=I.length;for(;l.pos>ne;)de=y(K.start,I,de);R=new kt(I,W-K.start,i),q=K.start-x}else{let I=l.pos-G;l.next();let ne=[],de=[],ht=N>=o?N:-1,St=0,gi=W;for(;l.pos>I;)ht>=0&&l.id==ht&&l.size>=0?(l.end<=gi-s&&(d(ne,de,L,St,l.end,gi,ht,C),St=ne.length,gi=l.end),l.next()):f(L,I,ne,de,ht);if(ht>=0&&St>0&&St-1&&St>0){let lr=u(E);R=Us(E,ne,de,0,ne.length,0,W-L,lr,lr)}else R=p(E,ne,de,W-L,C-W)}D.push(R),B.push(q)}function u(x){return(S,D,B)=>{let U=0,N=S.length-1,L,W;if(N>=0&&(L=S[N])instanceof _){if(!N&&L.type==x&&L.length==B)return L;(W=L.prop(F.lookAhead))&&(U=D[N]+L.length+W)}return p(x,S,D,B,U)}}function d(x,S,D,B,U,N,L,W){let G=[],C=[];for(;x.length>B;)G.push(x.pop()),C.push(S.pop()+D-U);x.push(p(i.types[L],G,C,N-U,W-N)),S.push(U-D)}function p(x,S,D,B,U=0,N){if(a){let L=[F.contextHash,a];N=N?[L].concat(N):[L]}if(U>25){let L=[F.lookAhead,U];N=N?[L].concat(N):[L]}return new _(x,S,D,B,N)}function g(x,S){let D=l.fork(),B=0,U=0,N=0,L=D.end-s,W={size:0,start:0,skip:0};e:for(let G=D.pos-x;D.pos>G;){let C=D.size;if(D.id==S&&C>=0){W.size=B,W.start=U,W.skip=N,N+=4,B+=4,D.next();continue}let E=D.pos-C;if(C<0||E=o?4:0,K=D.start;for(D.next();D.pos>E;){if(D.size<0)if(D.size==-3)R+=4;else break e;else D.id>=o&&(R+=4);D.next()}U=K,B+=C,N+=R}return(S<0||B==x)&&(W.size=B,W.start=U,W.skip=N),W.size>4?W:void 0}function y(x,S,D){let{id:B,start:U,end:N,size:L}=l;if(l.next(),L>=0&&B4){let G=l.pos-(L-4);for(;l.pos>G;)D=y(x,S,D)}S[--D]=W,S[--D]=N-x,S[--D]=U-x,S[--D]=B}else L==-3?a=B:L==-4&&(c=B);return D}let b=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,b,v,-1);let A=(e=n.length)!==null&&e!==void 0?e:b.length?v[0]+b[0].length:0;return new _(h[n.topID],b.reverse(),v.reverse(),A)}const co=new WeakMap;function Ni(n,e){if(!n.isAnonymous||e instanceof kt||e.type!=n)return 1;let t=co.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof _)){t=1;break}t+=Ni(n,i)}co.set(e,t)}return t}function Us(n,e,t,i,s,r,o,l,h){let a=0;for(let p=i;p=c)break;D+=B}if(A==x+1){if(D>c){let B=p[x];d(B.children,B.positions,0,B.children.length,g[x]+v);continue}f.push(p[x])}else{let B=g[A-1]+p[A-1].length-S;f.push(Us(n,p,g,x,A,S,B,null,h))}u.push(S+v-r)}}return d(e,t,i,s,0),(l||h)(f,u,o)}class dt{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new dt(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,h=0,a=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||a){let d=Math.max(u.from,h)-a,p=Math.min(u.to,f)-a;u=d>=p?null:new dt(d,p,u.tree,u.offset+a,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ln(s.from,s.to)):[new Ln(0,0)]:[new Ln(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class tu{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new F({perNode:!0});let iu=0;class Ne{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=iu++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new Ne([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new Yi;return t=>t.modified.indexOf(e)>-1?t:Yi.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let nu=0;class Yi{constructor(){this.instances=[],this.id=nu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&su(t,l.modified));if(i)return i;let s=[],r=new Ne(s,e,t);for(let l of t)l.instances.push(r);let o=lh(t);for(let l of e.set)for(let h of o)s.push(Yi.get(l,h));return r}}function su(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function lh(n){let e=[n];for(let t=0;t0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let h=r.length-1,a=r[h];if(!a)throw new RangeError("Invalid path: "+s);let c=new ou(i,o,h>0?r.slice(0,h):null);e[a]=c.sort(e[a])}}return hh.add(e)}const hh=new F;class ou{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let h of l.set){let a=t[h.id];if(a){o=o?o+" "+a:a;break}}return o},scope:i}}function lu(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function hu(n,e,t,i=0,s=n.length){let r=new au(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class au{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:h}=e;if(l>=i||h<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let a=s,c=o.prop(hh),f=!1;for(;c;){if(!c.context||e.matchContext(c.context)){let d=lu(r,c.tags);d&&(a&&(a+=" "),a+=d,c.mode==1?s+=(s?" ":"")+d:c.mode==0&&(f=!0));break}c=c.next}if(this.startSpan(e.from,a),f)return;let u=e.tree&&e.tree.prop(F.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(y=>!y.scope||y.scope(u.tree.type)),g=e.firstChild();for(let y=0,b=l;;y++){let v=y=A||!e.nextSibling())););if(!v||A>i)break;b=v.to+l,b>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,b),s,p),this.startSpan(b,a))}g&&e.parent()}else if(e.firstChild()){do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),a)}while(e.nextSibling());e.parent()}}}const w=Ne.define,Mi=w(),Je=w(),fo=w(Je),uo=w(Je),$e=w(),Di=w($e),En=w($e),Ie=w(),at=w(Ie),Le=w(),Ee=w(),ks=w(),Kt=w(ks),Oi=w(),k={comment:Mi,lineComment:w(Mi),blockComment:w(Mi),docComment:w(Mi),name:Je,variableName:w(Je),typeName:fo,tagName:w(fo),propertyName:uo,attributeName:w(uo),className:w(Je),labelName:w(Je),namespace:w(Je),macroName:w(Je),literal:$e,string:Di,docString:w(Di),character:w(Di),attributeValue:w(Di),number:En,integer:w(En),float:w(En),bool:w($e),regexp:w($e),escape:w($e),color:w($e),url:w($e),keyword:Le,self:w(Le),null:w(Le),atom:w(Le),unit:w(Le),modifier:w(Le),operatorKeyword:w(Le),controlKeyword:w(Le),definitionKeyword:w(Le),moduleKeyword:w(Le),operator:Ee,derefOperator:w(Ee),arithmeticOperator:w(Ee),logicOperator:w(Ee),bitwiseOperator:w(Ee),compareOperator:w(Ee),updateOperator:w(Ee),definitionOperator:w(Ee),typeOperator:w(Ee),controlOperator:w(Ee),punctuation:ks,separator:w(ks),bracket:Kt,angleBracket:w(Kt),squareBracket:w(Kt),paren:w(Kt),brace:w(Kt),content:Ie,heading:at,heading1:w(at),heading2:w(at),heading3:w(at),heading4:w(at),heading5:w(at),heading6:w(at),contentSeparator:w(Ie),list:w(Ie),quote:w(Ie),emphasis:w(Ie),strong:w(Ie),link:w(Ie),monospace:w(Ie),strikethrough:w(Ie),inserted:w(),deleted:w(),changed:w(),invalid:w(),meta:Oi,documentMeta:w(Oi),annotation:w(Oi),processingInstruction:w(Oi),definition:Ne.defineModifier(),constant:Ne.defineModifier(),function:Ne.defineModifier(),standard:Ne.defineModifier(),local:Ne.defineModifier(),special:Ne.defineModifier()};ah([{tag:k.link,class:"tok-link"},{tag:k.heading,class:"tok-heading"},{tag:k.emphasis,class:"tok-emphasis"},{tag:k.strong,class:"tok-strong"},{tag:k.keyword,class:"tok-keyword"},{tag:k.atom,class:"tok-atom"},{tag:k.bool,class:"tok-bool"},{tag:k.url,class:"tok-url"},{tag:k.labelName,class:"tok-labelName"},{tag:k.inserted,class:"tok-inserted"},{tag:k.deleted,class:"tok-deleted"},{tag:k.literal,class:"tok-literal"},{tag:k.string,class:"tok-string"},{tag:k.number,class:"tok-number"},{tag:[k.regexp,k.escape,k.special(k.string)],class:"tok-string2"},{tag:k.variableName,class:"tok-variableName"},{tag:k.local(k.variableName),class:"tok-variableName tok-local"},{tag:k.definition(k.variableName),class:"tok-variableName tok-definition"},{tag:k.special(k.variableName),class:"tok-variableName2"},{tag:k.definition(k.propertyName),class:"tok-propertyName tok-definition"},{tag:k.typeName,class:"tok-typeName"},{tag:k.namespace,class:"tok-namespace"},{tag:k.className,class:"tok-className"},{tag:k.macroName,class:"tok-macroName"},{tag:k.propertyName,class:"tok-propertyName"},{tag:k.operator,class:"tok-operator"},{tag:k.comment,class:"tok-comment"},{tag:k.meta,class:"tok-meta"},{tag:k.invalid,class:"tok-invalid"},{tag:k.punctuation,class:"tok-punctuation"}]);var In;const hi=new F;function cu(n){return T.define({combine:n?e=>e.concat(n):void 0})}class Be{constructor(e,t,i=[]){this.data=e,V.prototype.hasOwnProperty("tree")||Object.defineProperty(V.prototype,"tree",{get(){return xe(this)}}),this.parser=t,this.extension=[Vt.of(this),V.languageData.of((s,r,o)=>s.facet(po(s,r,o)))].concat(i)}isActiveAt(e,t,i=-1){return po(e,t,i)==this.data}findRegions(e){let t=e.facet(Vt);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(hi)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(F.mounted);if(l){if(l.tree.prop(hi)==this.data){if(l.overlay)for(let h of l.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let h=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>h)return}}for(let h=0;h=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Ut=null;class It{constructor(e,t,i=[],s,r,o,l,h){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new It(e,t,[],_.empty,0,i,[],null)}startParse(){return this.parser.startParse(new fu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=_.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(dt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ut;Ut=this;try{return e()}finally{Ut=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=go(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((a,c,f,u)=>h.push({fromA:a,toA:c,fromB:f,toB:u})),i=dt.applyChanges(i,h),s=_.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let a of this.skipped){let c=e.mapPos(a.from,1),f=e.mapPos(a.to,-1);ce.from&&(this.fragments=go(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends oh{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let h=Ut;if(h){for(let a of s)h.tempSkipped.push(a);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new _(we.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ut}}function go(n,e,t){return dt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Nt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Nt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=It.create(e.facet(Vt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Nt(i)}}Be.state=ke.define({create:Nt.init,update(n,e){for(let t of e.effects)if(t.is(Be.setState))return t.value;return e.startState.facet(Vt)!=e.state.facet(Vt)?Nt.init(e.state):n.apply(e)}});let ch=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(ch=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Nn=typeof navigator!="undefined"&&((In=navigator.scheduling)===null||In===void 0?void 0:In.isInputPending)?()=>navigator.scheduling.isInputPending():null,uu=ue.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Be.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Be.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ch(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,h=r.context.work(()=>Nn&&Nn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Be.setState.of(new Nt(r.context))})),this.chunkBudget>0&&!(h&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Vt=T.define({combine(n){return n.length?n[0]:null},enables:[Be.state,uu]}),fh=T.define(),js=T.define({combine:n=>{if(!n.length)return" ";if(!/^(?: +|\t+)$/.test(n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return n[0]}});function bt(n){let e=n.facet(js);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function _i(n,e){let t="",i=n.tabSize;if(n.facet(js).charCodeAt(0)==9)for(;e>=i;)t+=" ",e-=i;for(let s=0;s=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return ui(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const du=new F;function pu(n,e,t){return dh(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function gu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function mu(n){let e=n.type.prop(du);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(F.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>xu(o,!0,1,void 0,r&&!gu(o)?s.from:void 0)}return n.parent==null?yu:null}function dh(n,e,t){for(;n;n=n.parent){let i=mu(n);if(i)return i(Gs.create(t,e,n))}return null}function yu(){return 0}class Gs extends cn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new Gs(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let e=this.state.doc.lineAt(this.node.from);for(;;){let t=this.node.resolve(e.from);for(;t.parent&&t.parent.from==t.from;)t=t.parent;if(bu(t,this.node))break;e=this.state.doc.lineAt(t.from)}return this.lineIndent(e.from)}continue(){let e=this.node.parent;return e?dh(e,this.pos,this.base):0}}function bu(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function wu(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let h=e.childAfter(l);if(!h||h==i)return null;if(!h.type.isSkipped)return h.froml.prop(hi)==o.data:o?l=>l==o:void 0,this.style=ah(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new st(i):null,this.themeType=t.themeType}static define(e,t){return new fn(e,t||{})}}const Ss=T.define(),ph=T.define({combine(n){return n.length?[n[0]]:null}});function Vn(n){let e=n.facet(Ss);return e.length?e:n.facet(ph)}function ku(n,e){let t=[vu],i;return n instanceof fn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(ph.of(n)):i?t.push(Ss.computeN([O.darkTheme],s=>s.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(Ss.of(n)),t}class Su{constructor(e){this.markCache=Object.create(null),this.tree=xe(e.state),this.decorations=this.buildDeco(e,Vn(e.state))}update(e){let t=xe(e.state),i=Vn(e.state),s=i!=Vn(e.startState);t.length{i.add(o,l,this.markCache[h]||(this.markCache[h]=P.mark({class:h})))},s,r);return i.finish()}}const vu=fi.high(ue.fromClass(Su,{decorations:n=>n.decorations})),Cu=fn.define([{tag:k.meta,color:"#7a757a"},{tag:k.link,textDecoration:"underline"},{tag:k.heading,textDecoration:"underline",fontWeight:"bold"},{tag:k.emphasis,fontStyle:"italic"},{tag:k.strong,fontWeight:"bold"},{tag:k.strikethrough,textDecoration:"line-through"},{tag:k.keyword,color:"#708"},{tag:[k.atom,k.bool,k.url,k.contentSeparator,k.labelName],color:"#219"},{tag:[k.literal,k.inserted],color:"#164"},{tag:[k.string,k.deleted],color:"#a11"},{tag:[k.regexp,k.escape,k.special(k.string)],color:"#e40"},{tag:k.definition(k.variableName),color:"#00f"},{tag:k.local(k.variableName),color:"#30a"},{tag:[k.typeName,k.namespace],color:"#085"},{tag:k.className,color:"#167"},{tag:[k.special(k.variableName),k.macroName],color:"#256"},{tag:k.definition(k.propertyName),color:"#00c"},{tag:k.comment,color:"#940"},{tag:k.invalid,color:"#f00"}]),Au=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),gh=1e4,mh="()[]{}",yh=T.define({combine(n){return Ht(n,{afterCursor:!0,brackets:mh,maxScanDistance:gh,renderMatch:Ou})}}),Mu=P.mark({class:"cm-matchingBracket"}),Du=P.mark({class:"cm-nonmatchingBracket"});function Ou(n){let e=[],t=n.matched?Mu:Du;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Tu=ke.define({create(){return P.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(yh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Fe(e.state,s.head,-1,i)||s.head>0&&Fe(e.state,s.head-1,1,i)||i.afterCursor&&(Fe(e.state,s.head,1,i)||s.headO.decorations.from(n)}),Bu=[Tu,Au];function Pu(n={}){return[yh.of(n),Bu]}function vs(n,e,t){let i=n.prop(e<0?F.openedBy:F.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Fe(n,e,t,i={}){let s=i.maxScanDistance||gh,r=i.brackets||mh,o=xe(n),l=o.resolveInner(e,t);for(let h=l;h;h=h.parent){let a=vs(h.type,t,r);if(a&&h.from=i.to){if(h==0&&s.indexOf(a.type.name)>-1&&a.from0)return null;let a={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let g=t>0?0:d.length-1,y=t>0?d.length:-1;g!=y;g+=t){let b=o.indexOf(d[g]);if(!(b<0||i.resolveInner(p+g,1).type!=s))if(b%2==0==t>0)f++;else{if(f==1)return{start:a,end:{from:p+g,to:p+g+1},matched:b>>1==h>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:a,matched:!1}:null}function mo(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Eu(n){return{token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Iu,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Xs}}function Iu(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}class Js extends Be{constructor(e){let t=cu(e.languageData),i=Eu(e),s,r=new class extends oh{createParse(o,l,h){return new Vu(s,o,l,h)}};super(t,r,[fh.of((o,l)=>this.getIndent(o,l))]),this.topNode=Wu(t),s=this,this.streamParser=i,this.stateAfter=new F({perNode:!0}),this.tokenTable=e.tokenTable?new Sh(i.tokenTable):Hu}static define(e){return new Js(e)}getIndent(e,t){let i=xe(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let r=$s(this,i,0,s.from,t),o,l;if(r?(l=r.state,o=r.pos+1):(l=this.streamParser.startState(e.unit),o=0),t-o>1e4)return null;for(;o=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],h=t+e.positions[o],a=l instanceof _&&h=e.length)return e;!s&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],h;if(ot&&$s(n,s.tree,0-s.offset,t,o),h;if(l&&(h=wh(n,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:n.streamParser.startState(i?bt(i):4),tree:_.empty}}class Vu{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=It.get(),o=s[0].from,{state:l,tree:h}=Nu(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+h.length;for(let a=0;a=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`;this.styleTag.textContent=r}}}var rt={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:"'",229:"q"},Rt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},br=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qa=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),Za=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),wr=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),ec=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tc=br&&(wr||+br[1]<57)||Za&≀for(var oe=0;oe<10;oe++)rt[48+oe]=rt[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)rt[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)rt[oe]=String.fromCharCode(oe+32),Rt[oe]=String.fromCharCode(oe);for(var vn in rt)Rt.hasOwnProperty(vn)||(Rt[vn]=rt[vn]);function ic(n){var e=tc&&(n.ctrlKey||n.altKey||n.metaKey)||(Qa||ec)&&n.shiftKey&&n.key&&n.key.length==1,t=!e&&n.key||(n.shiftKey?Rt:rt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Hi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Pt(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function nc(){let n=document.activeElement;for(;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ts(n,e){if(!e.anchorNode)return!1;try{return Pt(n,e.anchorNode)}catch{return!1}}function li(n){return n.nodeType==3?Lt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Wi(n,e,t,i){return t?xr(n,e,t,i,-1)||xr(n,e,t,i,1):!1}function is(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function xr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:zi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=is(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?zi(n):0}else return!1}}function zi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const rl={left:0,right:0,top:0,bottom:0};function on(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function sc(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function rc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=sc(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.parentNode;continue}let g=c.getBoundingClientRect();f={left:g.left,right:g.left+c.clientWidth,top:g.top,bottom:g.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.leftt)return f.domBoundsAround(e,t,a);if(u>=e&&s==-1&&(s=h,r=a),a>t&&f.dom.parentNode==this.dom){o=h,l=c;break}c=u,a=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),t.dirty&1)return;t.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=Is){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function al(n,e,t,i,s,r,o,l,h){let{children:a}=n,c=a.length?a[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,h))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var M={mac:Ar||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:ln,ie_version:fl?ns.documentMode||6:rs?+rs[1]:ss?+ss[1]:0,gecko:vr,gecko_version:vr?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!Cn,chrome_version:Cn?+Cn[1]:0,ios:Ar,android:/Android\b/.test(Ce.userAgent),webkit:Cr,safari:ul,webkit_version:Cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:ns.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const hc=256;class ot extends ${constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return i&&(!(i instanceof ot)||this.length-(t-e)+i.length>hc)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ot(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new le(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return os(this.dom,e,t)}}class ze extends ${constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(ll(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e)}merge(e,t,i,s,r,o){return i&&(!(i instanceof ze&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=h,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new ze(this.mark,t,o)}domAtPos(e){return gl(this.dom,this.children,e)}coordsAt(e,t){return yl(this,e,t)}}function os(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?M.chrome||M.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return M.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?on(h,o<0):h||null}class Qe extends ${constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new(e.customView||Qe)(e,t,i)}split(e){let t=Qe.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof Qe)||!this.widget.compare(i.widget)||e>0&&r<=0||t0?i.length-1:0;s=i[r],!(e>0?r==0:r==i.length-1||s.top0?-1:1);return e==0&&t>0||e==this.length&&t<=0?s:on(s,e==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class dl extends Qe{domAtPos(e){let{topView:t,text:i}=this.widget;return t?ls(e,0,t,i,(s,r)=>s.domAtPos(r),s=>new le(i,Math.min(s,i.nodeValue.length))):new le(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,t){let{topView:i,text:s}=this.widget;return i?pl(e,t,i,s):Math.min(t,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,t){let{topView:i,text:s}=this.widget;return i?ls(e,t,i,s,(r,o,l)=>r.coordsAt(o,l),(r,o)=>os(s,r,o)):os(s,e,t)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}}function ls(n,e,t,i,s,r){if(t instanceof ze){for(let o of t.children){let l=Pt(o.dom,i),h=l?i.nodeValue.length:o.length;if(n0?-1:1);return i&&i.topt.top?{left:t.left,right:t.right,top:i.top,bottom:i.bottom}:t}get overrideDOMText(){return z.empty}}ot.prototype.children=Qe.prototype.children=Et.prototype.children=Is;function ac(n,e){let t=n.parent,i=t?t.children.indexOf(n):-1;for(;t&&i>=0;)if(e<0?i>0:is&&t0;i--){let s=e[i-1].dom;if(s.parentNode==n)return le.after(s)}return new le(n,0)}function ml(n,e,t){let i,{children:s}=n;t>0&&e instanceof ze&&s.length&&(i=s[s.length-1])instanceof ze&&i.mark.eq(e.mark)?ml(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function yl(n,e,t){for(let r=0,o=0;o0?h>=e:h>e)&&(e0)){let c=0;if(h==r){if(l.getSide()<=0)continue;c=t=-l.getSide()}let f=l.coordsAt(Math.max(0,e-r),t);return c&&f?on(f,t<0):f}r=h}let i=n.dom.lastChild;if(!i)return n.dom.getBoundingClientRect();let s=li(i);return s[s.length-1]||null}function hs(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}function Ns(n,e){if(n==e)return!0;if(!n||!e)return!1;let t=Object.keys(n),i=Object.keys(e);if(t.length!=i.length)return!1;for(let s of t)if(i.indexOf(s)==-1||n[s]!==e[s])return!1;return!0}function as(n,e,t){let i=null;if(e)for(let s in e)t&&s in t||n.removeAttribute(i=s);if(t)for(let s in t)e&&e[s]==t[s]||n.setAttribute(i=s,t[s]);return!!i}class xt{eq(e){return!1}updateDOM(e){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}ignoreEvent(e){return!0}get customView(){return null}destroy(e){}}var J=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(J||(J={}));class R extends pt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new hn(e)}static widget(e){let t=e.side||0,i=!!e.block;return t+=i?t>0?3e8:-4e8:t>0?1e8:-1e8,new mt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=bl(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new mt(e,i,s,t,e.widget||null,!0)}static line(e){return new di(e)}static set(e,t=!1){return Y.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}R.none=Y.empty;class hn extends R{constructor(e){let{start:t,end:i}=bl(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof hn&&this.tagName==e.tagName&&this.class==e.class&&Ns(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}hn.prototype.point=!1;class di extends R{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof di&&Ns(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}di.prototype.mapMode=me.TrackBefore;di.prototype.point=!0;class mt extends R{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?me.TrackBefore:me.TrackAfter:me.TrackDel}get type(){return this.startSide=5}eq(e){return e instanceof mt&&cc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}mt.prototype.point=!0;function bl(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function cc(n,e){return n==e||!!(n&&e&&n.compare(e))}function cs(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class fe extends ${constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof fe))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),cl(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new fe;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){!this.dom||(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Ns(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ml(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=hs(t,this.attrs||{})),i&&(this.attrs=hs({class:i},this.attrs||{}))}domAtPos(e){return gl(this.dom,this.children,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e){var t;this.dom?this.dirty&4&&(ll(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&&(as(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e);let i=this.dom.lastChild;for(;i&&$.get(i)instanceof ze;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((t=$.get(i))===null||t===void 0?void 0:t.isEditable)==!1&&(!M.ios||!this.children.some(s=>s instanceof ot))){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;for(let t of this.children){if(!(t instanceof ot))return null;let i=li(t.dom);if(i.length!=1)return null;e+=i[0].width}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length}}coordsAt(e,t){return yl(this,e,t)}become(e){return!1}get type(){return J.Text}static find(e,t){for(let i=0,s=0;i=t){if(r instanceof fe)return r;if(o>t)break}s=o+r.breakAfter}return null}}class ut extends ${constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof ut)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,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,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(0,i)),this.getLine().append(wi(new ot(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof mt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof mt)if(i.block){let{type:h}=i;h==J.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ut(i.widget||new Mr("div"),l,h))}else{let h=Qe.create(i.widget||new Mr("span"),l,i.startSide),a=this.atCursorPos&&!h.isEditable&&r<=s.length&&(e0),c=!h.isEditable&&(en.some(e=>e)});class qi{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new qi(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Dr=H.define({map:(n,e)=>n.map(e)});function Re(n,e,t){let i=n.facet(Sl);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const an=T.define({combine:n=>n.length?n[0]:!0});let fc=0;const $t=T.define();class ue{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new ue(fc++,e,i,o=>{let l=[$t.of(o)];return r&&l.push(hi.of(h=>{let a=h.plugin(o);return a?r(a):R.none})),s&&l.push(s(o)),l})}static fromClass(e,t){return ue.define(i=>new e(i),t)}}class An{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Re(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Re(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Re(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Al=T.define(),Ml=T.define(),hi=T.define(),Dl=T.define(),Ol=T.define(),Xt=T.define();class Ue{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Ue(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!h)return i;new Ue(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),o=h.toA,l=h.toB}}}class Ki{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ee.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let s=[];this.changes.iterChangedRanges((o,l,h,a)=>s.push(new Ue(o,l,h,a))),this.changedRanges=s;let r=e.hasFocus;r!=e.inputState.notifiedFocused&&(e.inputState.notifiedFocused=r,this.flags|=1)}static create(e,t,i){return new Ki(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var Z=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(Z||(Z={}));const us=Z.LTR,uc=Z.RTL;function Tl(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const X=[];function yc(n,e){let t=n.length,i=e==us?1:2,s=e==us?2:1;if(!n||i==1&&!mc.test(n))return Bl(t);for(let o=0,l=i,h=i;o=0;u-=3)if(Pe[u+1]==-c){let d=Pe[u+2],p=d&2?i:d&4?d&1?s:i:0;p&&(X[o]=X[Pe[u]]=p),l=u;break}}else{if(Pe.length==189)break;Pe[l++]=o,Pe[l++]=a,Pe[l++]=h}else if((f=X[o])==2||f==1){let u=f==i;h=u?0:1;for(let d=l-3;d>=0;d-=3){let p=Pe[d+2];if(p&2)break;if(u)Pe[d+2]|=2;else{if(p&4)break;Pe[d+2]|=4}}}for(let o=0;ol;){let c=a,f=X[--a]!=2;for(;a>l&&f==(X[a-1]!=2);)a--;r.push(new Tt(a,c,f?2:1))}else r.push(new Tt(l,o,0))}else for(let o=0;o1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=$.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function Or(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class Tr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Br extends ${constructor(e){super(),this.view=e,this.compositionDeco=R.none,this.decorations=[],this.dynamicDecorationMap=[],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 fe],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ue(0,0,0,e.state.doc.length)],0)}get root(){return this.view.root}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:o,toA:l})=>lthis.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.view.inputState.composing<0?this.compositionDeco=R.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=xc(this.view,e.changes)),(M.ie||M.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=Cc(i,s,e.changes);return t=Ue.extendWithRanges(t,r),this.dirty==0&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=M.chrome||M.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?e[s]:null;if(!r)break;let{fromA:o,toA:l,fromB:h,toB:a}=r,{content:c,breakAtStart:f,openStart:u,openEnd:d}=Vs.build(this.view.state.doc,h,a,this.decorations,this.dynamicDecorationMap),{i:p,off:g}=i.findPos(l,1),{i:y,off:b}=i.findPos(o,-1);al(this,y,b,p,g,c,f,u,d)}}updateSelection(e=!1,t=!1){if((e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(t||this.mayControlSelection())||M.ios&&this.view.inputState.rapidCompositionStart)return;let i=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,r=this.domAtPos(s.anchor),o=s.empty?r:this.domAtPos(s.head);if(M.gecko&&s.empty&&wc(r)){let h=document.createTextNode("");this.view.observer.ignore(()=>r.node.insertBefore(h,r.node.childNodes[r.offset]||null)),r=o=new le(h,0),i=!0}let l=this.view.observer.selectionRange;(i||!l.focusNode||!Wi(r.node,r.offset,l.anchorNode,l.anchorOffset)||!Wi(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{M.android&&M.chrome&&this.dom.contains(l.focusNode)&&Ac(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Hi(this.root);if(h)if(s.empty){if(M.gecko){let a=Sc(r.node,r.offset);if(a&&a!=3){let c=El(r.node,r.offset,a==1?1:-1);c&&(r=new le(c,a==1?0:c.nodeValue.length))}}h.collapse(r.node,r.offset),s.bidiLevel!=null&&l.cursorBidiLevel!=null&&(l.cursorBidiLevel=s.bidiLevel)}else if(h.extend)h.collapse(r.node,r.offset),h.extend(o.node,o.offset);else{let a=document.createRange();s.anchor>s.head&&([r,o]=[o,r]),a.setEnd(o.node,o.offset),a.setStart(r.node,r.offset),h.removeAllRanges(),h.addRange(a)}}),this.view.observer.setSelectionRange(r,o)),this.impreciseAnchor=r.precise?null:new le(l.anchorNode,l.anchorOffset),this.impreciseHead=o.precise?null:new le(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let e=this.view.state.selection.main,t=Hi(this.root);if(!t||!e.empty||!e.assoc||!t.modify)return;let i=fe.find(this,e.head);if(!i)return;let s=i.posAtStart;if(e.head==s||e.head==s+i.length)return;let r=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!r||!o||r.bottom>o.top)return;let l=this.domAtPos(e.head+e.assoc);t.collapse(l.node,l.offset),t.modify("move",e.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){let e=this.root.activeElement;return e==this.dom||ts(this.dom,this.view.observer.selectionRange)&&!(e&&this.dom.contains(e))}nearest(e){for(let t=e;t;){let i=$.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=J.WidgetBefore&&r.type!=J.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==J.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==Z.LTR;for(let a=0,c=0;cs)break;if(a>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,g=p?li(p):[];if(g.length){let y=g[g.length-1],b=h?y.right-d.left:d.right-y.left;b>l&&(l=b,this.minWidth=r,this.minWidthFrom=a,this.minWidthTo=u)}}}a=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Z.RTL:Z.LTR}measureTextSize(){for(let s of this.children)if(s instanceof fe){let r=s.measureTextSize();if(r)return r}let e=document.createElement("div"),t,i;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=li(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,e.remove()}),{lineHeight:t,charWidth:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new hl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(R.replace({widget:new Rr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return R.set(e)}updateDeco(){let e=this.view.state.facet(hi).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=0,o=0,l=0,h=0;for(let c of this.view.state.facet(Ol).map(f=>f(this.view)))if(c){let{left:f,right:u,top:d,bottom:p}=c;f!=null&&(r=Math.max(r,f)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(h=Math.max(h,p))}let a={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+h};rc(this.view.scrollDOM,a,t.head0&&t<=0)n=n.childNodes[e-1],e=zi(n);else if(n.nodeType==1&&e=0)n=n.childNodes[e],e=0;else return null}}function Sc(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let a=Ae(s.text,o,!1);if(i(s.text.slice(a,o))!=h)break;o=a}for(;ln?e.left-n:Math.max(0,n-e.right)}function Oc(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Mn(n,e){return n.tope.top+1}function Pr(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function ps(n,e,t){let i,s,r,o,l,h,a,c;for(let d=n.firstChild;d;d=d.nextSibling){let p=li(d);for(let g=0;gv||o==v&&r>b)&&(i=d,s=y,r=b,o=v),b==0?t>y.bottom&&(!a||a.bottomy.top)&&(h=d,c=y):a&&Mn(a,y)?a=Lr(a,y.bottom):c&&Mn(c,y)&&(c=Pr(c,y.top))}}if(a&&a.bottom>=t?(i=l,s=a):c&&c.top<=t&&(i=h,s=c),!i)return{node:n,offset:0};let f=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Er(i,f,t);if(!r&&i.contentEditable=="true")return ps(i,f,t);let u=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:u}}function Er(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if((M.chrome||M.gecko)&&Lt(n,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function Il(n,{x:e,y:t},i,s=-1){var r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,h,{docHeight:a}=n.viewState,c=t-l;if(c<0)return 0;if(c>a)return n.state.doc.length;for(let b=n.defaultLineHeight/2,v=!1;h=n.elementAtHeight(c),h.type!=J.Text;)for(;c=s>0?h.bottom+b:h.top-b,!(c>=0&&c<=a);){if(v)return i?null:0;v=!0,s=-s}t=l+c;let f=h.from;if(fn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:i?null:Ir(n,o,h,e,t);let u=n.dom.ownerDocument,d=n.root.elementFromPoint?n.root:u,p=d.elementFromPoint(e,t);p&&!n.contentDOM.contains(p)&&(p=null),p||(e=Math.max(o.left+1,Math.min(o.right-1,e)),p=d.elementFromPoint(e,t),p&&!n.contentDOM.contains(p)&&(p=null));let g,y=-1;if(p&&((r=n.docView.nearest(p))===null||r===void 0?void 0:r.isEditable)!=!1){if(u.caretPositionFromPoint){let b=u.caretPositionFromPoint(e,t);b&&({offsetNode:g,offset:y}=b)}else if(u.caretRangeFromPoint){let b=u.caretRangeFromPoint(e,t);b&&({startContainer:g,startOffset:y}=b,(M.safari&&Tc(g,y,e)||M.chrome&&Bc(g,y,e))&&(g=void 0))}}if(!g||!n.docView.dom.contains(g)){let b=fe.find(n.docView,f);if(!b)return c>h.top+h.height/2?h.to:h.from;({node:g,offset:y}=ps(b.dom,e,t))}return n.docView.posFromDOM(g,y)}function Ir(n,e,t,i,s){let r=Math.round((i-e.left)*n.defaultCharacterWidth);n.lineWrapping&&t.height>n.defaultLineHeight*1.5&&(r+=Math.floor((s-t.top)/n.defaultLineHeight)*n.viewState.heightOracle.lineLength);let o=n.state.sliceDoc(t.from,t.to);return t.from+Qn(o,r,n.state.tabSize)}function Tc(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return Lt(n,i-1,i).getBoundingClientRect().left>t}function Bc(n,e,t){if(e!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Lt(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Rc(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=!i||!n.lineWrapping?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let h=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),c=n.posAtCoords({x:t==(a==Z.LTR)?h.right-1:h.left+1,y:(r.top+r.bottom)/2});if(c!=null)return m.cursor(c,t?-1:1)}let o=fe.find(n.docView,e.head),l=o?t?o.posAtEnd:o.posAtStart:t?s.to:s.from;return m.cursor(l,t?-1:1)}function Nr(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,h=null;;){let a=bc(s,r,o,l,t),c=Rl;if(!a){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=m.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Pc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==ce.Space&&(s=o),s==o}}function Lc(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return m.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,g=Il(n,{x:f,y:p},!1,r);if(ph.bottom||(r<0?gs))return m.cursor(g,e.assoc,void 0,o)}}function Dn(n,e,t){let i=n.state.facet(Dl).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.fromt.from?m.cursor(o,1):m.cursor(l,-1),s=!0)});if(!s)return t}}class Ec{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let t in ie){let i=ie[t];e.contentDOM.addEventListener(t,s=>{!Vr(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))}),this.registeredEvents.push(t)}M.chrome&&M.chrome_version>=102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,M.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Vr(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Re(t.state,o)}}return!1}runScrollHandlers(e,t){for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Re(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!(t.ctrlKey||t.altKey||t.metaKey)&&!t.synthetic?(this.pendingIOSKey=i,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ti(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:M.safari&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!M.ios}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Nl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vl=[16,17,18,20,91,92,224,225];class Ic{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&Nc(e,t),this.dragMove=Vc(e,t),this.dragging=Fc(e,t)&&Fs(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(e){let t=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!t.eq(this.view.state.selection)||t.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:t,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Nc(n,e){let t=n.state.facet(wl);return t.length?t[0](e):M.mac?e.metaKey:e.ctrlKey}function Vc(n,e){let t=n.state.facet(xl);return t.length?t[0](e):M.mac?!e.altKey:!e.ctrlKey}function Fc(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Hi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Vr(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=$.get(t))&&i.ignoreEvent(e))return!1;return!0}const ie=Object.create(null),Fl=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;function Hc(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Hl(n,t.value)},50)}function Hl(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(gs!=null&&t.selection.ranges.every(h=>h.empty)&&gs==r.toString()){let h=-1;i=t.changeByRange(a=>{let c=t.doc.lineAt(a.from);if(c.from==h)return{range:a};h=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:m.cursor(a.from+f.length)}})}else o?i=t.changeByRange(h=>{let a=r.line(s++);return{changes:{from:h.from,to:h.to,insert:a.text},range:m.cursor(h.from+a.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ie.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27?n.inputState.lastEscPress=Date.now():Vl.indexOf(e.keyCode)<0&&(n.inputState.lastEscPress=0)};let Wl=0;ie.touchstart=(n,e)=>{Wl=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ie.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ie.mousedown=(n,e)=>{if(n.observer.flush(),Wl>Date.now()-2e3&&Fs(e)==1)return;let t=null;for(let i of n.state.facet(kl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=qc(n,e)),t){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>ol(n.contentDOM)),n.inputState.startMouseSelection(new Ic(n,e,t,i))}};function Fr(n,e,t,i){if(i==1)return m.cursor(e,t);if(i==2)return Mc(n.state,e,t);{let s=fe.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return ln>=e.top&&n<=e.bottom,Hr=(n,e,t)=>zl(e,t)&&n>=t.left&&n<=t.right;function Wc(n,e,t,i){let s=fe.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Hr(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Hr(t,i,l)?1:o&&zl(i,o)?-1:1}function Wr(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Wc(n,t,e.clientX,e.clientY)}}const zc=M.ie&&M.ie_version<=11;let zr=null,qr=0,Kr=0;function Fs(n){if(!zc)return n.detail;let e=zr,t=Kr;return zr=n,Kr=Date.now(),qr=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(qr+1)%3:1}function qc(n,e){let t=Wr(n,e),i=Fs(e),s=n.state.selection,r=t,o=e;return{update(l){l.docChanged&&(t&&(t.pos=l.changes.mapPos(t.pos)),s=s.map(l.changes),o=null)},get(l,h,a){let c;if(o&&l.clientX==o.clientX&&l.clientY==o.clientY?c=r:(c=r=Wr(n,l),o=l),!c||!t)return s;let f=Fr(n,c.pos,c.bias,i);if(t.pos!=c.pos&&!h){let u=Fr(n,t.pos,t.bias,i),d=Math.min(u.from,f.from),p=Math.max(u.to,f.to);f=d1&&s.ranges.some(u=>u.eq(f))?Kc(s,f):a?s.addRange(f):m.create([f])}}}function Kc(n,e){for(let t=0;;t++)if(n.ranges[t].eq(e))return m.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}ie.dragstart=(n,e)=>{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function Ur(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:t},h=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}ie.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&Ur(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}}else Ur(n,e,e.dataTransfer.getData("Text"),!0)};ie.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=Fl?null:e.clipboardData;t?(Hl(n,t.getData("text/plain")),e.preventDefault()):Hc(n)};function Uc(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function jc(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let gs=null;ie.copy=ie.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=jc(n.state);if(!t&&!s)return;gs=s?t:null;let r=Fl?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):Uc(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};function ql(n){setTimeout(()=>{n.hasFocus!=n.inputState.notifiedFocused&&n.update([])},10)}ie.focus=ql;ie.blur=n=>{n.observer.clearSelectionRange(),ql(n)};function Kl(n,e){if(n.docView.compositionDeco.size){n.inputState.rapidCompositionStart=e;try{n.update([])}finally{n.inputState.rapidCompositionStart=!1}}}ie.compositionstart=ie.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0,n.docView.compositionDeco.size&&(n.observer.flush(),Kl(n,!0)))};ie.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionFirstChange=null,setTimeout(()=>{n.inputState.composing<0&&Kl(n,!1)},50)};ie.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};ie.beforeinput=(n,e)=>{var t;let i;if(M.chrome&&M.android&&(i=Nl.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const jr=["pre-wrap","normal","pre-line","break-spaces"];class Gc{constructor(){this.doc=z.empty,this.lineWrapping=!1,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}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 jr.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=i,this.lineLength=s,l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Ei&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return be.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:h,fromB:a,toB:c}=s[o],f=r.lineAt(l,j.ByPosNoHeight,t,0,0),u=f.to>=h?f:r.lineAt(h,j.ByPosNoHeight,t,0,0);for(c+=u.to-h,h=u.to;o>0&&f.from<=s[o-1].toA;)l=s[o-1].fromA,a=s[o-1].fromB,o--,lr*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Se extends Ul{constructor(e,t){super(e,t,J.Text),this.collapsed=0,this.widgetHeight=0}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Se||s instanceof se&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof se?s=new Se(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):be.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class se extends be{constructor(e){super(e,0)}lines(e,t){let i=e.lineAt(t).number,s=e.lineAt(t+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,lineHeight:l}=this.lines(t,s),h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:a,length:c}=t.line(r+h);return new et(a,c,i+l*h,l,J.Text)}lineAt(e,t,i,s,r){if(t==j.ByHeight)return this.blockAt(e,i,s,r);if(t==j.ByPosNoHeight){let{from:f,to:u}=i.lineAt(e);return new et(f,u-f,0,0,J.Text)}let{firstLine:o,lineHeight:l}=this.lines(i,r),{from:h,length:a,number:c}=i.lineAt(e);return new et(h,a,s+l*(c-o),l,J.Text)}forEachLine(e,t,i,s,r,o){let{firstLine:l,lineHeight:h}=this.lines(i,r);for(let a=Math.max(e,r),c=Math.min(r+this.length,t);a<=c;){let f=i.lineAt(a);a==e&&(s+=h*(f.number-l)),o(new et(f.from,f.length,s,h,J.Text)),s+=h,a=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof se?i[i.length-1]=new se(r.length+s):i.push(null,new se(s-1))}if(e>0){let r=i[0];r instanceof se?i[0]=new se(e+r.length):i.unshift(new se(e-1),null)}return be.of(i)}decomposeLeft(e,t){t.push(new se(e-1),null)}decomposeRight(e,t){t.push(null,new se(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),h=-1,a=e.heightChanged;for(s.from>t&&o.push(new se(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let u=s.heights[s.index++];h==-1?h=u:Math.abs(u-h)>=Ei&&(h=-2);let d=new Se(f,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new se(r-l).updateHeight(e,l));let c=be.of(o);return e.heightChanged=a||h<0||Math.abs(c.height-this.height)>=Ei||Math.abs(h-this.lines(e.doc,t).lineHeight)>=Ei,c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class $c extends be{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return a;let c=t==j.ByPosNoHeight?j.ByPosNoHeight:j.ByPos;return h?a.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(a)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)e=h&&this.right.forEachLine(e,t,i,l,h,o);else{let a=this.lineAt(h,j.ByPos,i,s,r);e=e&&a.from<=t&&o(a),t>a.to&&this.right.forEachLine(a.to+1,t,i,l,h,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&Gr(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?be.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,h=null;return s&&s.from<=t+r.length&&s.more?h=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?h=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),h?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Gr(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof se&&(i=n[e+1])instanceof se&&n.splice(e-1,3,new se(t.length+1+i.length))}const Xc=5;class Hs{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Se?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Se(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Xc)&&this.addLineDeco(s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Se(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new se(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Se)return e;let t=new Se(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine(),e.type==J.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=J.WidgetBefore&&(this.covering=e)}addLineDeco(e,t){let i=this.ensureLine();i.length+=t,i.collapsed+=t,i.widgetHeight=Math.max(i.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Se)&&!this.isCovered?this.nodes.push(new Se(0,-1)):(this.writtenToa.clientHeight||a.scrollWidth>a.clientWidth)&&c.overflow!="visible"){let f=a.getBoundingClientRect();i=Math.max(i,f.left),s=Math.min(s,f.right),r=Math.max(r,f.top),o=Math.min(o,f.bottom)}h=c.position=="absolute"||c.position=="fixed"?a.offsetParent:a.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-t.left,right:Math.max(i,s)-t.left,top:r-(t.top+e),bottom:Math.max(r,o)-(t.top+e)}}function Zc(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class On{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof t!="function"),this.heightMap=be.empty().applyChanges(this.stateDeco,z.empty,this.heightOracle.setDoc(e.doc),[new Ue(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new xi(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?Yr:new sf(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Yt(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(hi).filter(a=>typeof a!="function");let s=e.changedRanges,r=Ue.extendWithRanges(s,Yc(i,this.stateDeco,e?e.changes:ee.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Z.RTL:Z.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=o||this.mustMeasureContent||this.contentDOMHeight!=t.clientHeight;this.contentDOMHeight=t.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=f)&&(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let u=(this.printing?Zc:Qc)(t,this.paddingTop),d=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView)return 0;let y=t.clientWidth;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=y,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:A,charWidth:x}=e.docView.measureTextSize();o=s.refresh(r,A,x,y/x,v),o&&(e.docView.minWidth=0,h|=8)}d>0&&p>0?a=Math.max(d,p):d<0&&p<0&&(a=Math.min(d,p)),s.heightChanged=!1;for(let A of this.viewports){let x=A.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(A);this.heightMap=this.heightMap.updateHeight(s,0,o,new Jc(A.from,x))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(h&2||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.state.doc,{visibleTop:o,visibleBottom:l}=this,h=new xi(s.lineAt(o-i*1e3,j.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,j.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(ah.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(a,j.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&a=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&ri.from&&l.push({from:i.from,to:r}),o=i.from&&h.from<=i.to&&Xr(l,h.from-10,h.from+10),!h.empty&&h.to>=i.from&&h.to<=i.to&&Xr(l,h.to-10,h.to+10);for(let{from:a,to:c}of l)c-a>1e3&&t.push(nf(e,f=>f.from>=i.from&&f.to<=i.to&&Math.abs(f.from-a)<1e3&&Math.abs(f.to-c)<1e3)||new On(a,c,this.gapSize(i,a,c,s)))}return t}gapSize(e,t,i,s){let r=$r(s,i)-$r(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){On.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=R.set(e.map(t=>t.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];Y.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Yt(this.heightMap.lineAt(e,j.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(e){return Yt(this.heightMap.lineAt(this.scaler.fromDOM(e),j.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(e){return Yt(this.heightMap.blockAt(this.scaler.fromDOM(e),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class xi{constructor(e,t){this.from=e,this.to=t}}function tf(n,e,t){let i=[],s=n,r=0;return Y.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function $r(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Xr(n,e,t){for(let i=0;ie){let r=[];s.fromt&&r.push({from:t,to:s.to}),n.splice(i,1,...r),i+=r.length-1}}}function nf(n,e){for(let t of n)if(e(t))return t}const Yr={toDOM(n){return n},fromDOM(n){return n},scale:1};class sf{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:h})=>{let a=t.lineAt(l,j.ByPos,e,0,0).top,c=t.lineAt(h,j.ByPos,e,0,0).bottom;return s+=c-a,{from:l,to:h,top:a,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tYt(s,e)):n.type)}const Si=T.define({combine:n=>n.join(" ")}),ms=T.define({combine:n=>n.indexOf(!0)>-1}),ys=st.newName(),jl=st.newName(),Gl=st.newName(),Jl={"&light":"."+jl,"&dark":"."+Gl};function bs(n,e,t){return new st(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const rf=bs("."+ys,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",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 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .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":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".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"}},Jl),of={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Tn=M.ie&&M.ie_version<=11;class lf{constructor(e,t,i){this.view=e,this.onChange=t,this.onScrollChanged=i,this.active=!1,this.selectionRange=new oc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(s=>{for(let r of s)this.queue.push(r);(M.ie&&M.ie_version<=11||M.ios&&e.composing)&&s.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Tn&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),window.addEventListener("resize",this.onResize=this.onResize.bind(this)),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),s.length>0&&s[s.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(s=>{s.length>0&&s[s.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange(),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:t}=this,i=this.selectionRange;if(t.state.facet(an)?t.root.activeElement!=this.dom:!ts(t.dom,i))return;let s=i.anchorNode&&t.docView.nearest(i.anchorNode);s&&s.ignoreEvent(e)||((M.ie&&M.ie_version<=11||M.android&&M.chrome)&&!t.state.selection.main.empty&&i.focusNode&&Wi(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1))}readSelectionRange(){let{root:e}=this.view,t=M.safari&&e.nodeType==11&&nc()==this.view.contentDOM&&hf(this.view)||Hi(e);return!t||this.selectionRange.eq(t)?!1:(this.selectionRange.setRange(t),this.selectionChanged=!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e{let i=this.delayedAndroidKey;this.delayedAndroidKey=null,this.delayedFlush=-1,this.flush()||ti(this.view.contentDOM,i.key,i.keyCode)}),(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t})}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=window.setTimeout(()=>{this.delayedFlush=-1,this.flush()},20))}forceFlush(){this.delayedFlush>=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}processRecords(){let e=this.queue;for(let r of this.observer.takeRecords())e.push(r);e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);!o||(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return;e&&this.readSelectionRange();let{from:t,to:i,typeOver:s}=this.processRecords(),r=this.selectionChanged&&ts(this.dom,this.selectionRange);if(t<0&&!r)return;this.selectionChanged=!1;let o=this.view.state,l=this.onChange(t,i,s);return this.view.state==o&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.dirty|=4),e.type=="childList"){let i=_r(t,e.previousSibling||e.target.previousSibling,-1),s=_r(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resize)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);window.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize),window.removeEventListener("beforeprint",this.onPrint),this.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}function _r(n,e,t){for(;e;){let i=$.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function hf(n){let e=null;function t(h){h.preventDefault(),h.stopImmediatePropagation(),e=h.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),document.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return Wi(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}function af(n,e,t,i){let s,r,o=n.state.selection.main;if(e>-1){let l=n.docView.domBoundsAround(e,t,0);if(!l||n.state.readOnly)return!1;let{from:h,to:a}=l,c=n.docView.impreciseHead||n.docView.impreciseAnchor?[]:ff(n),f=new Pl(c,n.state);f.readRange(l.startDOM,l.endDOM);let u=o.from,d=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||M.android&&f.text.length=o.from&&s.to<=o.to&&(s.from!=o.from||s.to!=o.to)&&o.to-o.from-(s.to-s.from)<=4?s={from:o.from,to:o.to,insert:n.state.doc.slice(o.from,s.from).append(s.insert).append(n.state.doc.slice(s.to,o.to))}:(M.mac||M.android)&&s&&s.from==s.to&&s.from==o.head-1&&s.insert.toString()=="."&&(s={from:o.from,to:o.to,insert:z.of([" "])}),s){let l=n.state;if(M.ios&&n.inputState.flushIOSKey(n)||M.android&&(s.from==o.from&&s.to==o.to&&s.insert.length==1&&s.insert.lines==2&&ti(n.contentDOM,"Enter",13)||s.from==o.from-1&&s.to==o.to&&s.insert.length==0&&ti(n.contentDOM,"Backspace",8)||s.from==o.from&&s.to==o.to+1&&s.insert.length==0&&ti(n.contentDOM,"Delete",46)))return!0;let h=s.insert.toString();if(n.state.facet(vl).some(f=>f(n,s.from,s.to,h)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let a;if(s.from>=o.from&&s.to<=o.to&&s.to-s.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==s.from+s.insert.length)&&n.inputState.composing<0){let f=o.froms.to?l.sliceDoc(s.to,o.to):"";a=l.replaceSelection(n.state.toText(f+s.insert.sliceString(0,void 0,n.state.lineBreak)+u))}else{let f=l.changes(s),u=r&&!l.selection.main.eq(r.main)&&r.main.to<=f.newLength?r.main:void 0;if(l.selection.ranges.length>1&&n.inputState.composing>=0&&s.to<=o.to&&s.to>=o.to-10){let d=n.state.sliceDoc(s.from,s.to),p=Ll(n)||n.state.doc.lineAt(o.head),g=o.to-s.to,y=o.to-o.from;a=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:f,range:u||b.map(f)};let v=b.to-g,A=v-d.length;if(b.to-b.from!=y||n.state.sliceDoc(A,v)!=d||p&&b.to>=p.from&&b.from<=p.to)return{range:b};let x=l.changes({from:A,to:v,insert:s.insert}),S=b.to-o.to;return{changes:x,range:u?m.range(Math.max(0,u.anchor+S),Math.max(0,u.head+S)):b.map(x)}})}else a={changes:f,selection:u&&l.selection.replaceRange(u)}}let c="input.type";return n.composing&&(c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(a,{scrollIntoView:!0,userEvent:c}),!0}else if(r&&!r.main.eq(o)){let l=!1,h="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),h=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:l,userEvent:h}),!0}else return!1}function cf(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(o,l));t-=o+h-r}return o=o?r-t:0,l=r+(l-o),o=r):l=l?r-t:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}function ff(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Tr(t,i)),(s!=t||r!=i)&&e.push(new Tr(s,r))),e}function uf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?m.single(t+e,i+e):null}class O{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this.root=e.root||lc(e.parent)||document,this.viewState=new Jr(e.state||V.create(e)),this.plugins=this.state.facet($t).map(t=>new An(t));for(let t of this.plugins)t.update(this);this.observer=new lf(this,(t,i,s)=>af(this,t,i,s),t=>{this.inputState.runScrollHandlers(this,t),this.observer.intersecting&&this.measure()}),this.inputState=new Ec(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Br(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof te?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let l of e){if(l.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=l.state}if(this.destroyed){this.viewState.state=r;return}if(this.observer.clear(),r.facet(V.phrases)!=this.state.facet(V.phrases))return this.setState(r);s=Ki.create(this,r,e);let o=this.viewState.scrollTarget;try{this.updateState=2;for(let l of e){if(o&&(o=o.map(l.changes)),l.scrollIntoView){let{main:h}=l.state.selection;o=new qi(h.empty?h:m.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of l.effects)h.is(Dr)&&(o=h.value)}this.viewState.update(s,o),this.bidiCache=Ui.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Xt)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(l=>l.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Si)!=s.state.facet(Si)&&(this.viewState.mustMeasureContent=!0),(t||i||o||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let l of this.state.facet(fs))l(s)}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Jr(e),this.plugins=e.facet($t).map(i=>new An(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Br(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet($t),i=e.state.facet($t);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new An(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.flush();let t=null;try{for(let i=0;;i++){this.updateState=1;let s=this.viewport,r=this.viewState.measure(this);if(!r&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(i>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let o=[];r&4||([this.measureRequests,o]=[o,this.measureRequests]);let l=o.map(f=>{try{return f.read(this)}catch(u){return Re(this.state,u),Qr}}),h=Ki.create(this,this.state,[]),a=!1,c=!1;h.flags|=r,t?t.flags|=r:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),a=this.docView.update(h));for(let f=0;f{let s=as(this.contentDOM,this.contentAttrs,t),r=as(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(O.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Xt),st.mount(this.root,this.styleModules.concat(rf).reverse())}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=requestAnimationFrame(()=>this.measure())),e){if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Dn(this,e,Nr(this,e,t,i))}moveByGroup(e,t){return Dn(this,e,Nr(this,e,t,i=>Pc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Rc(this,e,t,i)}moveVertically(e,t,i){return Dn(this,e,Lc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Il(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Tt.find(r,e-s.from,-1,t)];return on(i,o.dir==Z.LTR==t>0)}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(Cl)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>df)return Bl(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=yc(e.text,t);return this.bidiCache.push(new Ui(e.from,e.to,t,i)),i}get hasFocus(){var e;return(document.hasFocus()||M.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ol(this.contentDOM),this.docView.updateSelection()})}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Dr.of(new qi(typeof e=="number"?m.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ue.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=st.newName(),s=[Si.of(i),Xt.of(bs(`.${i}`,e))];return t&&t.dark&&s.push(ms.of(!0)),s}static baseTheme(e){return Wt.lowest(Xt.of(bs("."+ys,e,Jl)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&$.get(i)||$.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}O.styleModule=Xt;O.inputHandler=vl;O.perLineTextDirection=Cl;O.exceptionSink=Sl;O.updateListener=fs;O.editable=an;O.mouseSelectionStyle=kl;O.dragMovesSelection=xl;O.clickAddsSelectionRange=wl;O.decorations=hi;O.atomicRanges=Dl;O.scrollMargins=Ol;O.darkTheme=ms;O.contentAttributes=Ml;O.editorAttributes=Al;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=H.define();const df=4096,Qr={};class Ui{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:Z.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&hs(o,t)}return t}const pf=M.mac?"mac":M.windows?"win":M.linux?"linux":"key";function gf(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let h=0;hi.concat(s),[]))),t}function yf(n,e,t){return Xl($l(n.state),e,n,t)}let Xe=null;const bf=4e3;function wf(n,e=pf){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let h=i[o];if(h==null)i[o]=l;else if(h!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,h,a)=>{let c=t[o]||(t[o]=Object.create(null)),f=l.split(/ (?!$)/).map(p=>gf(p,e));for(let p=1;p{let b=Xe={view:y,prefix:g,scope:o};return setTimeout(()=>{Xe==b&&(Xe=null)},bf),!0}]})}let u=f.join(" ");s(u,!1);let d=c[u]||(c[u]={preventDefault:!1,commands:[]});d.commands.push(h),a&&(d.preventDefault=!0)};for(let o of n){let l=o[e]||o.key;if(!!l)for(let h of o.scope?o.scope.split(" "):["editor"])r(h,l,o.run,o.preventDefault),o.shift&&r(h,"Shift-"+l,o.shift,o.preventDefault)}return t}function Xl(n,e,t,i){let s=ic(e),r=re(s,0),o=ve(r)==s.length&&s!=" ",l="",h=!1;Xe&&Xe.view==t&&Xe.scope==i&&(l=Xe.prefix+" ",(h=Vl.indexOf(e.keyCode)<0)&&(Xe=null));let a=u=>{if(u){for(let d of u.commands)if(d(t))return!0;u.preventDefault&&(h=!0)}return!1},c=n[i],f;if(c){if(a(c[l+vi(s,e,!o)]))return!0;if(o&&(e.shiftKey||e.altKey||e.metaKey||r>127)&&(f=rt[e.keyCode])&&f!=s){if(a(c[l+vi(f,e,!0)]))return!0;if(e.shiftKey&&Rt[e.keyCode]!=f&&a(c[l+vi(Rt[e.keyCode],e,!1)]))return!0}else if(o&&e.shiftKey&&a(c[l+vi(s,e,!0)]))return!0}return h}const Yl=!M.ios,_t=T.define({combine(n){return zt(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function xf(n={}){return[_t.of(n),kf,Sf]}class _l{constructor(e,t,i,s,r){this.left=e,this.top=t,this.width=i,this.height=s,this.className=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(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}}const kf=ue.fromClass(class{constructor(n){this.view=n,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=n.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=n.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),n.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet(_t).cursorBlinkRate+"ms"}update(n){let e=n.startState.facet(_t)!=n.state.facet(_t);(e||n.selectionSet||n.geometryChanged||n.viewportChanged)&&this.view.requestMeasure(this.measureReq),n.transactions.some(t=>t.scrollIntoView)&&(this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:n}=this.view,e=n.facet(_t),t=n.selection.ranges.map(s=>s.empty?[]:vf(this.view,s)).reduce((s,r)=>s.concat(r)),i=[];for(let s of n.selection.ranges){let r=s==n.selection.main;if(s.empty?!r||Yl:e.drawRangeCursor){let o=Cf(this.view,s,r);o&&i.push(o)}}return{rangePieces:t,cursors:i}}drawSel({rangePieces:n,cursors:e}){if(n.length!=this.rangePieces.length||n.some((t,i)=>!t.eq(this.rangePieces[i]))){this.selectionLayer.textContent="";for(let t of n)this.selectionLayer.appendChild(t.draw());this.rangePieces=n}if(e.length!=this.cursors.length||e.some((t,i)=>!t.eq(this.cursors[i]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent="";for(const i of e)this.cursorLayer.appendChild(i.draw())}else e.forEach((i,s)=>i.adjust(t[s]));this.cursors=e}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),Ql={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Yl&&(Ql[".cm-line"].caretColor="transparent !important");const Sf=Wt.highest(O.theme(Ql));function Zl(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Z.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function to(n,e,t){let i=m.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:J.Text}}function io(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==J.Text))return i}return t}function vf(n,e){if(e.to<=n.viewport.from||e.from>=n.viewport.to)return[];let t=Math.max(e.from,n.viewport.from),i=Math.min(e.to,n.viewport.to),s=n.textDirection==Z.LTR,r=n.contentDOM,o=r.getBoundingClientRect(),l=Zl(n),h=window.getComputedStyle(r.firstChild),a=o.left+parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)),c=o.right-parseInt(h.paddingRight),f=io(n,t),u=io(n,i),d=f.type==J.Text?f:null,p=u.type==J.Text?u:null;if(n.lineWrapping&&(d&&(d=to(n,t,d)),p&&(p=to(n,i,p))),d&&p&&d.from==p.from)return y(b(e.from,e.to,d));{let A=d?b(e.from,null,d):v(f,!1),x=p?b(null,e.to,p):v(u,!0),S=[];return(d||f).to<(p||u).from-1?S.push(g(a,A.bottom,c,x.top)):A.bottomL&&G.from=E)break;I>C&&N(Math.max(q,C),A==null&&q<=L,Math.min(I,E),x==null&&I>=W,K.dir)}if(C=P.to+1,C>=E)break}return U.length==0&&N(L,A==null,W,x==null,n.textDirection),{top:D,bottom:B,horizontal:U}}function v(A,x){let S=o.top+(x?A.top:A.bottom);return{top:S,bottom:S,horizontal:[]}}}function Cf(n,e,t){let i=n.coordsAtPos(e.head,e.assoc||1);if(!i)return null;let s=Zl(n);return new _l(i.left-s.left,i.top-s.top,-1,i.bottom-i.top,t?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}const eh=H.define({map(n,e){return n==null?null:e.mapPos(n)}}),Qt=ke.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(eh)?i.value:t,n)}}),Af=ue.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Qt);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Qt)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(Qt),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Qt)!=n&&this.view.dispatch({effects:eh.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Mf(){return[Qt,Af]}function no(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,o+l.index+l[0].length,l)}function Df(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Of{constructor(e){let{regexp:t,decoration:i,boundary:s,maxLength:r=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=t,this.getDeco=typeof i=="function"?i:()=>i,this.boundary=s,this.maxLength=r}createDeco(e){let t=new gt;for(let{from:i,to:s}of Df(e,this.maxLength))no(e.state.doc,this.regexp,i,s,(r,o,l)=>t.add(r,o,this.getDeco(l,e,r)));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,h)=>{h>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let h=e.state.doc.lineAt(o),a=h.toh.from;o--)if(this.boundary.test(h.text[o-1-h.from])){c=o;break}for(;lu.push(this.getDeco(y,e,p).range(p,g)));t=t.update({filterFrom:c,filterTo:f,filter:(p,g)=>pf,add:u})}}return t}}const ws=/x/.unicode!=null?"gu":"g",Tf=new RegExp(`[\0-\b +-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\uFEFF\uFFF9-\uFFFC]`,ws),Bf={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",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Bn=null;function Rf(){var n;if(Bn==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Bn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Bn||!1}const Ii=T.define({combine(n){let e=zt(n,{render:null,specialChars:Tf,addSpecialChars:null});return(e.replaceTabs=!Rf())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ws)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ws)),e}});function Pf(n={}){return[Ii.of(n),Lf()]}let so=null;function Lf(){return so||(so=ue.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Ii)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Of({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=re(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=ui(o.text,l,i-o.from);return R.replace({widget:new Vf((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new Nf(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Ii);n.startState.facet(Ii)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Ef="\u2022";function If(n){return n>=32?Ef:n==10?"\u2424":String.fromCharCode(9216+n)}class Nf extends xt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=If(this.code),i=e.state.phrase("Control character")+" "+(Bf[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Vf extends xt{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}}class Ff extends xt{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function ro(n){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=R.set([R.widget({widget:new Ff(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:e=>e.decorations})}const xs=2e3;function Hf(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>xs||t.off>xs||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(m.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=Qn(a.text,o,n.tabSize,!0);if(c>-1){let f=Qn(a.text,l,n.tabSize);r.push(m.range(a.from+c,a.from+f))}}}return r}function Wf(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function oo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>xs?-1:s==i.length?Wf(n,e.clientX):ui(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function zf(n,e){let t=oo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=oo(n,s);if(!l)return i;let h=Hf(n.state,t,l);return h.length?o?m.create(h.concat(i.ranges)):m.create(h):i}}:null}function qf(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?zf(t,i):null)}const Rn="-10000px";class Kf{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){let t=e.state.facet(this.facet),i=t.filter(r=>r);if(t===this.input){for(let r of this.tooltipViews)r.update&&r.update(e);return!1}let s=[];for(let r=0;r{var e,t,i;return{position:M.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Uf}}}),th=ue.fromClass(class{constructor(n){var e;this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let t=n.state.facet(Pn);this.position=t.position,this.parent=t.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Kf(n,ih,i=>this.createTooltip(i)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),(e=n.dom.ownerDocument.defaultView)===null||e===void 0||e.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Pn);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Rn,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n,e;(n=this.view.dom.ownerDocument.defaultView)===null||n===void 0||n.removeEventListener("resize",this.measureSoon);for(let{dom:t}of this.manager.tooltipViews)t.remove();(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Pn).tooltipSpace(this.view)}}writeMeasure(n){let{editor:e,space:t}=n,i=[];for(let s=0;s=Math.min(e.bottom,t.bottom)||h.rightMath.min(e.right,t.right)+.1){l.style.top=Rn;continue}let c=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,u=a.right-a.left,d=a.bottom-a.top,p=o.offset||Gf,g=this.view.textDirection==Z.LTR,y=a.width>t.right-t.left?g?t.left:t.right-a.width:g?Math.min(h.left-(c?14:0)+p.x,t.right-u):Math.max(t.left,h.left-u+(c?14:0)-p.x),b=!!r.above;!r.strictSide&&(b?h.top-(a.bottom-a.top)-p.yt.bottom)&&b==t.bottom-h.bottom>h.top-t.top&&(b=!b);let v=b?h.top-d-f-p.y:h.bottom+f+p.y,A=y+u;if(o.overlap!==!0)for(let x of i)x.lefty&&x.topv&&(v=b?x.top-d-2-f:x.bottom+f+2);this.position=="absolute"?(l.style.top=v-n.parent.top+"px",l.style.left=y-n.parent.left+"px"):(l.style.top=v+"px",l.style.left=y+"px"),c&&(c.style.left=`${h.left+(g?p.x:-p.x)-(y+14-7)}px`),o.overlap!==!0&&i.push({left:y,top:v,right:A,bottom:v+d}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),o.positioned&&o.positioned()}}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 n of this.manager.tooltipViews)n.dom.style.top=Rn}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),jf=O.baseTheme({".cm-tooltip":{zIndex:100},"&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:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Gf={x:0,y:0},ih=T.define({enables:[th,jf]});function Jf(n,e){let t=n.plugin(th);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const lo=T.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ji(n,e){let t=n.plugin(nh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const nh=ue.fromClass(class{constructor(n){this.input=n.state.facet(Gi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(lo);this.top=new Ci(n,!0,e.topContainer),this.bottom=new Ci(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(lo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ci(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ci(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Gi);if(t!=this.input){let i=t.filter(h=>h),s=[],r=[],o=[],l=[];for(let h of i){let a=this.specs.indexOf(h),c;a<0?(c=h(n.view),l.push(c)):(c=this.panels[a],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let h of l)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>O.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ci{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ho(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ho(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 ho(n){let e=n.nextSibling;return n.remove(),e}const Gi=T.define({enables:nh});class yt extends pt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yt.prototype.elementClass="";yt.prototype.toDOM=void 0;yt.prototype.mapMode=me.TrackBefore;yt.prototype.startSide=yt.prototype.endSide=-1;yt.prototype.point=!0;const $f=T.define(),Xf=new class extends yt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Yf=$f.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges)if(i.empty){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Xf.range(s)))}return Y.of(e)});function _f(){return Yf}const Qf=1024;let Zf=0;class Ln{constructor(e,t){this.from=e,this.to=t}}class F{constructor(e={}){this.id=Zf++,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=we.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}F.closedBy=new F({deserialize:n=>n.split(" ")});F.openedBy=new F({deserialize:n=>n.split(" ")});F.group=new F({deserialize:n=>n.split(" ")});F.contextHash=new F({perNode:!0});F.lookAhead=new F({perNode:!0});F.mounted=new F({perNode:!0});const eu=Object.create(null);class we{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):eu,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new we(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(F.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(F.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}we.none=new we("",Object.create(null),0,8);class zs{constructor(e){this.types=e;for(let t=0;t=s&&(o.type.isAnonymous||t(o)!==!1)){if(o.firstChild())continue;l=!0}for(;l&&i&&!o.type.isAnonymous&&i(o),!o.nextSibling();){if(!o.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Us(we.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new _(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new _(we.none,t,i,s)))}static build(e){return iu(e)}}_.empty=new _(we.none,[],[],0);class qs{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new qs(this.buffer,this.index)}}class kt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return we.none}toString(){let e=[];for(let t=0;t0));h=o[h+3]);return l}slice(e,t,i,s){let r=this.buffer,o=new Uint16Array(t-e);for(let l=e,h=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function rh(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function It(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=a;e+=t){let c=l[e],f=h[e]+o.from;if(!!sh(s,i,f,f+c.length)){if(c instanceof kt){if(r&ae.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new tt(new tu(o,c,e,f),null,u)}else if(r&ae.IncludeAnonymous||!c.type.isAnonymous||Ks(c)){let u;if(!(r&ae.IgnoreMounts)&&c.props&&(u=c.prop(F.mounted))&&!u.overlay)return new je(u.tree,f,e,o);let d=new je(c,f,e,o);return r&ae.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&ae.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&ae.IgnoreOverlays)&&(s=this._tree.prop(F.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new je(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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}cursor(e=0){return new Xi(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return It(this,e,t,!1)}resolveInner(e,t=0){return It(this,e,t,!0)}enterUnfinishedNodesBefore(e){return rh(this,e)}getChild(e,t=null,i=null){let s=Ji(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Ji(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return $i(this,e)}}function Ji(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function $i(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class tu{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class tt{constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}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]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new tt(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&ae.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new tt(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new tt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new tt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new Xi(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1],l=i.buffer[this.index+2];e.push(i.slice(s,r,o,l)),t.push(0)}return new _(this.type,e,t,this.to-this.from)}resolve(e,t=0){return It(this,e,t,!1)}resolveInner(e,t=0){return It(this,e,t,!0)}enterUnfinishedNodesBefore(e){return rh(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=Ji(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Ji(this,e,t,i)}get node(){return this}matchContext(e){return $i(this,e)}}class Xi{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof je)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof je?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&ae.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ae.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ae.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&ae.IncludeAnonymous||l instanceof kt||!l.type.isAnonymous||Ks(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}}for(let s=i;s=0;r--){if(r<0)return $i(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Ks(n){return n.children.some(e=>e instanceof kt||!e.type.isAnonymous||Ks(e))}function iu(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Qf,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new qs(t,t.length):t,h=i.types,a=0,c=0;function f(x,S,D,B,U){let{id:N,start:L,end:W,size:G}=l,C=c;for(;G<0;)if(l.next(),G==-1){let I=r[N];D.push(I),B.push(L-x);return}else if(G==-3){a=N;return}else if(G==-4){c=N;return}else throw new RangeError(`Unrecognized record size: ${G}`);let E=h[N],P,K,q=L-x;if(W-L<=s&&(K=g(l.pos-S,U))){let I=new Uint16Array(K.size-K.skip),ne=l.pos-K.size,de=I.length;for(;l.pos>ne;)de=y(K.start,I,de);P=new kt(I,W-K.start,i),q=K.start-x}else{let I=l.pos-G;l.next();let ne=[],de=[],ht=N>=o?N:-1,St=0,gi=W;for(;l.pos>I;)ht>=0&&l.id==ht&&l.size>=0?(l.end<=gi-s&&(d(ne,de,L,St,l.end,gi,ht,C),St=ne.length,gi=l.end),l.next()):f(L,I,ne,de,ht);if(ht>=0&&St>0&&St-1&&St>0){let lr=u(E);P=Us(E,ne,de,0,ne.length,0,W-L,lr,lr)}else P=p(E,ne,de,W-L,C-W)}D.push(P),B.push(q)}function u(x){return(S,D,B)=>{let U=0,N=S.length-1,L,W;if(N>=0&&(L=S[N])instanceof _){if(!N&&L.type==x&&L.length==B)return L;(W=L.prop(F.lookAhead))&&(U=D[N]+L.length+W)}return p(x,S,D,B,U)}}function d(x,S,D,B,U,N,L,W){let G=[],C=[];for(;x.length>B;)G.push(x.pop()),C.push(S.pop()+D-U);x.push(p(i.types[L],G,C,N-U,W-N)),S.push(U-D)}function p(x,S,D,B,U=0,N){if(a){let L=[F.contextHash,a];N=N?[L].concat(N):[L]}if(U>25){let L=[F.lookAhead,U];N=N?[L].concat(N):[L]}return new _(x,S,D,B,N)}function g(x,S){let D=l.fork(),B=0,U=0,N=0,L=D.end-s,W={size:0,start:0,skip:0};e:for(let G=D.pos-x;D.pos>G;){let C=D.size;if(D.id==S&&C>=0){W.size=B,W.start=U,W.skip=N,N+=4,B+=4,D.next();continue}let E=D.pos-C;if(C<0||E=o?4:0,K=D.start;for(D.next();D.pos>E;){if(D.size<0)if(D.size==-3)P+=4;else break e;else D.id>=o&&(P+=4);D.next()}U=K,B+=C,N+=P}return(S<0||B==x)&&(W.size=B,W.start=U,W.skip=N),W.size>4?W:void 0}function y(x,S,D){let{id:B,start:U,end:N,size:L}=l;if(l.next(),L>=0&&B4){let G=l.pos-(L-4);for(;l.pos>G;)D=y(x,S,D)}S[--D]=W,S[--D]=N-x,S[--D]=U-x,S[--D]=B}else L==-3?a=B:L==-4&&(c=B);return D}let b=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,b,v,-1);let A=(e=n.length)!==null&&e!==void 0?e:b.length?v[0]+b[0].length:0;return new _(h[n.topID],b.reverse(),v.reverse(),A)}const co=new WeakMap;function Ni(n,e){if(!n.isAnonymous||e instanceof kt||e.type!=n)return 1;let t=co.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof _)){t=1;break}t+=Ni(n,i)}co.set(e,t)}return t}function Us(n,e,t,i,s,r,o,l,h){let a=0;for(let p=i;p=c)break;D+=B}if(A==x+1){if(D>c){let B=p[x];d(B.children,B.positions,0,B.children.length,g[x]+v);continue}f.push(p[x])}else{let B=g[A-1]+p[A-1].length-S;f.push(Us(n,p,g,x,A,S,B,null,h))}u.push(S+v-r)}}return d(e,t,i,s,0),(l||h)(f,u,o)}class dt{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new dt(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,h=0,a=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||a){let d=Math.max(u.from,h)-a,p=Math.min(u.to,f)-a;u=d>=p?null:new dt(d,p,u.tree,u.offset+a,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ln(s.from,s.to)):[new Ln(0,0)]:[new Ln(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class nu{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new F({perNode:!0});let su=0;class Ne{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=su++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new Ne([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new Yi;return t=>t.modified.indexOf(e)>-1?t:Yi.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let ru=0;class Yi{constructor(){this.instances=[],this.id=ru++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&ou(t,l.modified));if(i)return i;let s=[],r=new Ne(s,e,t);for(let l of t)l.instances.push(r);let o=lh(t);for(let l of e.set)for(let h of o)s.push(Yi.get(l,h));return r}}function ou(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function lh(n){let e=[n];for(let t=0;t0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let h=r.length-1,a=r[h];if(!a)throw new RangeError("Invalid path: "+s);let c=new hu(i,o,h>0?r.slice(0,h):null);e[a]=c.sort(e[a])}}return hh.add(e)}const hh=new F;class hu{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let h of l.set){let a=t[h.id];if(a){o=o?o+" "+a:a;break}}return o},scope:i}}function au(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function cu(n,e,t,i=0,s=n.length){let r=new fu(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class fu{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:h}=e;if(l>=i||h<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let a=s,c=o.prop(hh),f=!1;for(;c;){if(!c.context||e.matchContext(c.context)){let d=au(r,c.tags);d&&(a&&(a+=" "),a+=d,c.mode==1?s+=(s?" ":"")+d:c.mode==0&&(f=!0));break}c=c.next}if(this.startSpan(e.from,a),f)return;let u=e.tree&&e.tree.prop(F.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(y=>!y.scope||y.scope(u.tree.type)),g=e.firstChild();for(let y=0,b=l;;y++){let v=y=A||!e.nextSibling())););if(!v||A>i)break;b=v.to+l,b>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,b),s,p),this.startSpan(b,a))}g&&e.parent()}else if(e.firstChild()){do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),a)}while(e.nextSibling());e.parent()}}}const w=Ne.define,Mi=w(),Je=w(),fo=w(Je),uo=w(Je),$e=w(),Di=w($e),En=w($e),Ie=w(),at=w(Ie),Le=w(),Ee=w(),ks=w(),jt=w(ks),Oi=w(),k={comment:Mi,lineComment:w(Mi),blockComment:w(Mi),docComment:w(Mi),name:Je,variableName:w(Je),typeName:fo,tagName:w(fo),propertyName:uo,attributeName:w(uo),className:w(Je),labelName:w(Je),namespace:w(Je),macroName:w(Je),literal:$e,string:Di,docString:w(Di),character:w(Di),attributeValue:w(Di),number:En,integer:w(En),float:w(En),bool:w($e),regexp:w($e),escape:w($e),color:w($e),url:w($e),keyword:Le,self:w(Le),null:w(Le),atom:w(Le),unit:w(Le),modifier:w(Le),operatorKeyword:w(Le),controlKeyword:w(Le),definitionKeyword:w(Le),moduleKeyword:w(Le),operator:Ee,derefOperator:w(Ee),arithmeticOperator:w(Ee),logicOperator:w(Ee),bitwiseOperator:w(Ee),compareOperator:w(Ee),updateOperator:w(Ee),definitionOperator:w(Ee),typeOperator:w(Ee),controlOperator:w(Ee),punctuation:ks,separator:w(ks),bracket:jt,angleBracket:w(jt),squareBracket:w(jt),paren:w(jt),brace:w(jt),content:Ie,heading:at,heading1:w(at),heading2:w(at),heading3:w(at),heading4:w(at),heading5:w(at),heading6:w(at),contentSeparator:w(Ie),list:w(Ie),quote:w(Ie),emphasis:w(Ie),strong:w(Ie),link:w(Ie),monospace:w(Ie),strikethrough:w(Ie),inserted:w(),deleted:w(),changed:w(),invalid:w(),meta:Oi,documentMeta:w(Oi),annotation:w(Oi),processingInstruction:w(Oi),definition:Ne.defineModifier(),constant:Ne.defineModifier(),function:Ne.defineModifier(),standard:Ne.defineModifier(),local:Ne.defineModifier(),special:Ne.defineModifier()};ah([{tag:k.link,class:"tok-link"},{tag:k.heading,class:"tok-heading"},{tag:k.emphasis,class:"tok-emphasis"},{tag:k.strong,class:"tok-strong"},{tag:k.keyword,class:"tok-keyword"},{tag:k.atom,class:"tok-atom"},{tag:k.bool,class:"tok-bool"},{tag:k.url,class:"tok-url"},{tag:k.labelName,class:"tok-labelName"},{tag:k.inserted,class:"tok-inserted"},{tag:k.deleted,class:"tok-deleted"},{tag:k.literal,class:"tok-literal"},{tag:k.string,class:"tok-string"},{tag:k.number,class:"tok-number"},{tag:[k.regexp,k.escape,k.special(k.string)],class:"tok-string2"},{tag:k.variableName,class:"tok-variableName"},{tag:k.local(k.variableName),class:"tok-variableName tok-local"},{tag:k.definition(k.variableName),class:"tok-variableName tok-definition"},{tag:k.special(k.variableName),class:"tok-variableName2"},{tag:k.definition(k.propertyName),class:"tok-propertyName tok-definition"},{tag:k.typeName,class:"tok-typeName"},{tag:k.namespace,class:"tok-namespace"},{tag:k.className,class:"tok-className"},{tag:k.macroName,class:"tok-macroName"},{tag:k.propertyName,class:"tok-propertyName"},{tag:k.operator,class:"tok-operator"},{tag:k.comment,class:"tok-comment"},{tag:k.meta,class:"tok-meta"},{tag:k.invalid,class:"tok-invalid"},{tag:k.punctuation,class:"tok-punctuation"}]);var In;const ai=new F;function uu(n){return T.define({combine:n?e=>e.concat(n):void 0})}class Be{constructor(e,t,i=[]){this.data=e,V.prototype.hasOwnProperty("tree")||Object.defineProperty(V.prototype,"tree",{get(){return xe(this)}}),this.parser=t,this.extension=[Ft.of(this),V.languageData.of((s,r,o)=>s.facet(po(s,r,o)))].concat(i)}isActiveAt(e,t,i=-1){return po(e,t,i)==this.data}findRegions(e){let t=e.facet(Ft);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(ai)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(F.mounted);if(l){if(l.tree.prop(ai)==this.data){if(l.overlay)for(let h of l.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let h=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>h)return}}for(let h=0;h=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Gt=null;class Nt{constructor(e,t,i=[],s,r,o,l,h){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Nt(e,t,[],_.empty,0,i,[],null)}startParse(){return this.parser.startParse(new du(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=_.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(dt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Gt;Gt=this;try{return e()}finally{Gt=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=go(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((a,c,f,u)=>h.push({fromA:a,toA:c,fromB:f,toB:u})),i=dt.applyChanges(i,h),s=_.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let a of this.skipped){let c=e.mapPos(a.from,1),f=e.mapPos(a.to,-1);ce.from&&(this.fragments=go(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends oh{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let h=Gt;if(h){for(let a of s)h.tempSkipped.push(a);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new _(we.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Gt}}function go(n,e,t){return dt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Vt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Vt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Nt.create(e.facet(Ft).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Vt(i)}}Be.state=ke.define({create:Vt.init,update(n,e){for(let t of e.effects)if(t.is(Be.setState))return t.value;return e.startState.facet(Ft)!=e.state.facet(Ft)?Vt.init(e.state):n.apply(e)}});let ch=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(ch=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Nn=typeof navigator!="undefined"&&((In=navigator.scheduling)===null||In===void 0?void 0:In.isInputPending)?()=>navigator.scheduling.isInputPending():null,pu=ue.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Be.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Be.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ch(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,h=r.context.work(()=>Nn&&Nn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Be.setState.of(new Vt(r.context))})),this.chunkBudget>0&&!(h&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Re(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ft=T.define({combine(n){return n.length?n[0]:null},enables:[Be.state,pu]}),fh=T.define(),js=T.define({combine:n=>{if(!n.length)return" ";if(!/^(?: +|\t+)$/.test(n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return n[0]}});function bt(n){let e=n.facet(js);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function _i(n,e){let t="",i=n.tabSize;if(n.facet(js).charCodeAt(0)==9)for(;e>=i;)t+=" ",e-=i;for(let s=0;s=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return ui(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const gu=new F;function mu(n,e,t){return dh(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function yu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function bu(n){let e=n.type.prop(gu);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(F.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>Su(o,!0,1,void 0,r&&!yu(o)?s.from:void 0)}return n.parent==null?wu:null}function dh(n,e,t){for(;n;n=n.parent){let i=bu(n);if(i)return i(Gs.create(t,e,n))}return null}function wu(){return 0}class Gs extends cn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new Gs(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let e=this.state.doc.lineAt(this.node.from);for(;;){let t=this.node.resolve(e.from);for(;t.parent&&t.parent.from==t.from;)t=t.parent;if(xu(t,this.node))break;e=this.state.doc.lineAt(t.from)}return this.lineIndent(e.from)}continue(){let e=this.node.parent;return e?dh(e,this.pos,this.base):0}}function xu(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function ku(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let h=e.childAfter(l);if(!h||h==i)return null;if(!h.type.isSkipped)return h.froml.prop(ai)==o.data:o?l=>l==o:void 0,this.style=ah(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new st(i):null,this.themeType=t.themeType}static define(e,t){return new fn(e,t||{})}}const Ss=T.define(),ph=T.define({combine(n){return n.length?[n[0]]:null}});function Vn(n){let e=n.facet(Ss);return e.length?e:n.facet(ph)}function vu(n,e){let t=[Au],i;return n instanceof fn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(ph.of(n)):i?t.push(Ss.computeN([O.darkTheme],s=>s.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(Ss.of(n)),t}class Cu{constructor(e){this.markCache=Object.create(null),this.tree=xe(e.state),this.decorations=this.buildDeco(e,Vn(e.state))}update(e){let t=xe(e.state),i=Vn(e.state),s=i!=Vn(e.startState);t.length{i.add(o,l,this.markCache[h]||(this.markCache[h]=R.mark({class:h})))},s,r);return i.finish()}}const Au=Wt.high(ue.fromClass(Cu,{decorations:n=>n.decorations})),Mu=fn.define([{tag:k.meta,color:"#7a757a"},{tag:k.link,textDecoration:"underline"},{tag:k.heading,textDecoration:"underline",fontWeight:"bold"},{tag:k.emphasis,fontStyle:"italic"},{tag:k.strong,fontWeight:"bold"},{tag:k.strikethrough,textDecoration:"line-through"},{tag:k.keyword,color:"#708"},{tag:[k.atom,k.bool,k.url,k.contentSeparator,k.labelName],color:"#219"},{tag:[k.literal,k.inserted],color:"#164"},{tag:[k.string,k.deleted],color:"#a11"},{tag:[k.regexp,k.escape,k.special(k.string)],color:"#e40"},{tag:k.definition(k.variableName),color:"#00f"},{tag:k.local(k.variableName),color:"#30a"},{tag:[k.typeName,k.namespace],color:"#085"},{tag:k.className,color:"#167"},{tag:[k.special(k.variableName),k.macroName],color:"#256"},{tag:k.definition(k.propertyName),color:"#00c"},{tag:k.comment,color:"#940"},{tag:k.invalid,color:"#f00"}]),Du=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),gh=1e4,mh="()[]{}",yh=T.define({combine(n){return zt(n,{afterCursor:!0,brackets:mh,maxScanDistance:gh,renderMatch:Bu})}}),Ou=R.mark({class:"cm-matchingBracket"}),Tu=R.mark({class:"cm-nonmatchingBracket"});function Bu(n){let e=[],t=n.matched?Ou:Tu;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Ru=ke.define({create(){return R.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(yh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Fe(e.state,s.head,-1,i)||s.head>0&&Fe(e.state,s.head-1,1,i)||i.afterCursor&&(Fe(e.state,s.head,1,i)||s.headO.decorations.from(n)}),Pu=[Ru,Du];function Lu(n={}){return[yh.of(n),Pu]}function vs(n,e,t){let i=n.prop(e<0?F.openedBy:F.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Fe(n,e,t,i={}){let s=i.maxScanDistance||gh,r=i.brackets||mh,o=xe(n),l=o.resolveInner(e,t);for(let h=l;h;h=h.parent){let a=vs(h.type,t,r);if(a&&h.from=i.to){if(h==0&&s.indexOf(a.type.name)>-1&&a.from0)return null;let a={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let g=t>0?0:d.length-1,y=t>0?d.length:-1;g!=y;g+=t){let b=o.indexOf(d[g]);if(!(b<0||i.resolveInner(p+g,1).type!=s))if(b%2==0==t>0)f++;else{if(f==1)return{start:a,end:{from:p+g,to:p+g+1},matched:b>>1==h>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:a,matched:!1}:null}function mo(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Nu(n){return{token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Vu,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Xs}}function Vu(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}class Js extends Be{constructor(e){let t=uu(e.languageData),i=Nu(e),s,r=new class extends oh{createParse(o,l,h){return new Hu(s,o,l,h)}};super(t,r,[fh.of((o,l)=>this.getIndent(o,l))]),this.topNode=qu(t),s=this,this.streamParser=i,this.stateAfter=new F({perNode:!0}),this.tokenTable=e.tokenTable?new Sh(i.tokenTable):zu}static define(e){return new Js(e)}getIndent(e,t){let i=xe(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let r=$s(this,i,0,s.from,t),o,l;if(r?(l=r.state,o=r.pos+1):(l=this.streamParser.startState(e.unit),o=0),t-o>1e4)return null;for(;o=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],h=t+e.positions[o],a=l instanceof _&&h=e.length)return e;!s&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],h;if(ot&&$s(n,s.tree,0-s.offset,t,o),h;if(l&&(h=wh(n,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:n.streamParser.startState(i?bt(i):4),tree:_.empty}}class Hu{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=Nt.get(),o=s[0].from,{state:l,tree:h}=Fu(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+h.length;for(let a=0;a=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` `&&(t="");else{let i=t.indexOf(` -`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;t+=this.ranges[++this.rangeIndex].from-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new bh(t,e?e.state.tabSize:4,e?bt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xh(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Xs=Object.create(null),ai=[we.none],Fu=new zs(ai),yo=[],kh=Object.create(null);for(let[n,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"]])kh[n]=vh(Xs,e);class Sh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kh)}resolve(e){return e?this.table[e]||(this.table[e]=vh(this.extra,e)):0}}const Hu=new Sh(Xs);function Fn(n,e){yo.indexOf(n)>-1||(yo.push(n),console.warn(e))}function vh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||k[r];o?typeof o=="function"?t?t=o(t):Fn(r,`Modifier ${r} used at start of tag`):t?Fn(r,`Tag ${r} used as modifier`):t=o:Fn(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=we.define({id:ai.length,name:i,props:[ru({[i]:t})]});return ai.push(s),s.id}function Wu(n){let e=we.define({id:ai.length,name:"Document",props:[hi.add(()=>n)]});return ai.push(e),e}const zu=n=>{let e=_s(n.state);return e.line?qu(n):e.block?Uu(n):!1};function Ys(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const qu=Ys(Ju,0),Ku=Ys(Ch,0),Uu=Ys((n,e)=>Ch(n,e,Gu(e)),0);function _s(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const jt=50;function ju(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-jt,i),o=n.sliceDoc(s,s+jt),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*jt?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+jt),f=n.sliceDoc(s-jt,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Gu(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function Ch(n,e,t=e.selection.ranges){let i=t.map(r=>_s(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>ju(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>c.from)){s=c.from;let f=_s(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c.length,p=c.text.slice(u,u+f.length)==f?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:h,indent:a,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+a,insert:h+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:h}of i)if(l>=0){let a=o.from+l,c=a+h.length;o.text[c-o.from]==" "&&c++,r.push({from:a,to:c})}return{changes:r}}return null}const Cs=wt.define(),$u=wt.define(),Xu=T.define(),Ah=T.define({combine(n){return Ht(n,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}});function Yu(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const Mh=ke.define({create(){return He.empty},update(n,e){let t=e.state.facet(Ah),i=e.annotation(Cs);if(i){let h=e.docChanged?m.single(Yu(e.changes)):void 0,a=ye.fromTransaction(e,h),c=i.side,f=c==0?n.undone:n.done;return a?f=Qi(f,f.length,t.minDepth,a):f=Th(f,e.startState.selection),new He(c==0?i.rest:f,c==0?f:i.rest)}let s=e.annotation($u);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(te.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=ye.fromTransaction(e),o=e.annotation(te.time),l=e.annotation(te.userEvent);return r?n=n.addChanges(r,o,l,t.newGroupDelay,t.minDepth):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new He(n.done.map(ye.fromJSON),n.undone.map(ye.fromJSON))}});function _u(n={}){return[Mh,Ah.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Dh:e.inputType=="historyRedo"?As:null;return i?(e.preventDefault(),i(t)):!1}})]}function un(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Mh,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Dh=un(0,!1),As=un(1,!1),Qu=un(0,!0),Zu=un(1,!0);class ye{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new ye(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ye(e.changes&&ee.fromJSON(e.changes),[],e.mapped&&We.fromJSON(e.mapped),e.startSelection&&m.fromJSON(e.startSelection),e.selectionsAfter.map(m.fromJSON))}static fromTransaction(e,t){let i=Oe;for(let s of e.startState.facet(Xu)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new ye(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Oe)}static selection(e){return new ye(void 0,Oe,void 0,void 0,e)}}function Qi(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function ed(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let h=0;h=a&&o<=c&&(i=!0)}}),i}function td(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Oh(n,e){return n.length?e.length?n.concat(e):n:e}const Oe=[],id=200;function Th(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-id));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Qi(n,n.length-1,1e9,t.setSelAfter(i)))}else return[ye.selection([e])]}function nd(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Hn(n,e){if(!n.length)return n;let t=n.length,i=Oe;for(;t;){let s=sd(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[ye.selection(i)]:Oe}function sd(n,e,t){let i=Oh(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Oe,t);if(!n.changes)return ye.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new ye(s,H.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const rd=/^(input\.type|delete)($|\.)/;class He{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new He(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||rd.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):dn(t,e))}function Te(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Ph=n=>Bh(n,!Te(n)),Rh=n=>Bh(n,Te(n));function Lh(n,e){return Ge(n,t=>t.empty?n.moveByGroup(t,e):dn(t,e))}const ld=n=>Lh(n,!Te(n)),hd=n=>Lh(n,Te(n));function ad(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function pn(n,e,t){let i=xe(n).resolveInner(e.head),s=t?F.closedBy:F.openedBy;for(let h=e.head;;){let a=t?i.childAfter(h):i.childBefore(h);if(!a)break;ad(n,a,s)?i=a:h=t?a.to:a.from}let r=i.type.prop(s),o,l;return r&&(o=t?Fe(n,i.from,1):Fe(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,m.cursor(l,t?-1:1)}const cd=n=>Ge(n,e=>pn(n.state,e,!Te(n))),fd=n=>Ge(n,e=>pn(n.state,e,Te(n)));function Eh(n,e){return Ge(n,t=>{if(!t.empty)return dn(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Ih=n=>Eh(n,!1),Nh=n=>Eh(n,!0);function Vh(n){return Math.max(n.defaultLineHeight,Math.min(n.dom.clientHeight,innerHeight)-5)}function Fh(n,e){let{state:t}=n,i=Wt(t.selection,l=>l.empty?n.moveVertically(l,e,Vh(n)):dn(l,e));if(i.eq(t.selection))return!1;let s=n.coordsAtPos(t.selection.main.head),r=n.scrollDOM.getBoundingClientRect(),o;return s&&s.top>r.top&&s.bottomFh(n,!1),Ms=n=>Fh(n,!0);function gn(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=m.cursor(i.from+r))}return s}const wo=n=>Ge(n,e=>gn(n,e,!0)),xo=n=>Ge(n,e=>gn(n,e,!1)),ud=n=>Ge(n,e=>m.cursor(n.lineBlockAt(e.head).from,1)),dd=n=>Ge(n,e=>m.cursor(n.lineBlockAt(e.head).to,-1));function pd(n,e,t){let i=!1,s=Wt(n.selection,r=>{let o=Fe(n,r.head,-1)||Fe(n,r.head,1)||r.head>0&&Fe(n,r.head-1,1)||r.headpd(n,e,!1);function Ke(n,e){let t=Wt(n.state.selection,i=>{let s=e(i);return m.range(i.anchor,s.head,s.goalColumn)});return t.eq(n.state.selection)?!1:(n.dispatch(qe(n.state,t)),!0)}function Hh(n,e){return Ke(n,t=>n.moveByChar(t,e))}const Wh=n=>Hh(n,!Te(n)),zh=n=>Hh(n,Te(n));function qh(n,e){return Ke(n,t=>n.moveByGroup(t,e))}const md=n=>qh(n,!Te(n)),yd=n=>qh(n,Te(n)),bd=n=>Ke(n,e=>pn(n.state,e,!Te(n))),wd=n=>Ke(n,e=>pn(n.state,e,Te(n)));function Kh(n,e){return Ke(n,t=>n.moveVertically(t,e))}const Uh=n=>Kh(n,!1),jh=n=>Kh(n,!0);function Gh(n,e){return Ke(n,t=>n.moveVertically(t,e,Vh(n)))}const ko=n=>Gh(n,!1),So=n=>Gh(n,!0),vo=n=>Ke(n,e=>gn(n,e,!0)),Co=n=>Ke(n,e=>gn(n,e,!1)),xd=n=>Ke(n,e=>m.cursor(n.lineBlockAt(e.head).from)),kd=n=>Ke(n,e=>m.cursor(n.lineBlockAt(e.head).to)),Ao=({state:n,dispatch:e})=>(e(qe(n,{anchor:0})),!0),Mo=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.doc.length})),!0),Do=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.selection.main.anchor,head:0})),!0),Oo=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Sd=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),vd=({state:n,dispatch:e})=>{let t=bn(n).map(({from:i,to:s})=>m.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:m.create(t),userEvent:"select"})),!0},Cd=({state:n,dispatch:e})=>{let t=Wt(n.selection,i=>{var s;let r=xe(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return m.range(r.to,r.from)});return e(qe(n,t)),!0},Ad=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=m.create([t.main]):t.main.empty||(i=m.create([m.cursor(t.main.head)])),i?(e(qe(n,i)),!0):!1};function mn({state:n,dispatch:e},t){if(n.readOnly)return!1;let i="delete.selection",s=n.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let h=t(o);ho&&(i="delete.forward"),o=Math.min(o,h),l=Math.max(l,h)}return o==l?{range:r}:{changes:{from:o,to:l},range:m.cursor(o)}});return s.changes.empty?!1:(e(n.update(s,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?O.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yn(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Jh=(n,e)=>mn(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tJh(n,!1),$h=n=>Jh(n,!0),Xh=(n,e)=>mn(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let h=Ae(r.text,i-r.from,e)+r.from,a=r.text.slice(Math.min(i,h)-r.from,Math.max(i,h)-r.from),c=o(a);if(l!=null&&c!=l)break;(a!=" "||i!=t)&&(l=c),i=h}return yn(n,i,e)}),Yh=n=>Xh(n,!1),Md=n=>Xh(n,!0),_h=n=>mn(n,e=>{let t=n.lineBlockAt(e).to;return yn(n,emn(n,e=>{let t=n.lineBlockAt(e).from;return yn(n,e>t?t:Math.max(0,e-1),!1)}),Od=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:z.of(["",""])},range:m.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Td=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:Ae(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:Ae(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:m.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bn(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Qh(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of bn(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let h of r.ranges)s.push(m.range(Math.min(n.doc.length,h.anchor+l),Math.min(n.doc.length,h.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let h of r.ranges)s.push(m.range(h.anchor-l,h.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:m.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Bd=({state:n,dispatch:e})=>Qh(n,e,!1),Pd=({state:n,dispatch:e})=>Qh(n,e,!0);function Zh(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of bn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Rd=({state:n,dispatch:e})=>Zh(n,e,!1),Ld=({state:n,dispatch:e})=>Zh(n,e,!0),Ed=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(bn(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Id(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=xe(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(F.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const Nd=ea(!1),Vd=ea(!0);function ea(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),h=!n&&r==o&&Id(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let a=new cn(e,{simulateBreak:r,simulateDoubleBreak:!!h}),c=uh(a,r);for(c==null&&(c=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:m.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const Fd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new cn(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=Qs(n,(r,o,l)=>{let h=uh(i,r.from);if(h==null)return;/\S/.test(r.text)||(h=0);let a=/^\s*/.exec(r.text)[0],c=_i(n,h);(a!=c||l.fromn.readOnly?!1:(e(n.update(Qs(n,(t,i)=>{i.push({from:t.from,insert:n.facet(js)})}),{userEvent:"input.indent"})),!0),Wd=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Qs(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=ui(s,n.tabSize),o=0,l=_i(n,Math.max(0,r-bt(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),Kd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:cd,shift:bd},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:fd,shift:wd},{key:"Alt-ArrowUp",run:Bd},{key:"Shift-Alt-ArrowUp",run:Rd},{key:"Alt-ArrowDown",run:Pd},{key:"Shift-Alt-ArrowDown",run:Ld},{key:"Escape",run:Ad},{key:"Mod-Enter",run:Vd},{key:"Alt-l",mac:"Ctrl-l",run:vd},{key:"Mod-i",run:Cd,preventDefault:!0},{key:"Mod-[",run:Wd},{key:"Mod-]",run:Hd},{key:"Mod-Alt-\\",run:Fd},{key:"Shift-Mod-k",run:Ed},{key:"Shift-Mod-\\",run:gd},{key:"Mod-/",run:zu},{key:"Alt-A",run:Ku}].concat(qd);function pe(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class Ft{constructor(e,t,i=0,s=e.length,r){this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?o=>r(To(o)):To,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return re(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Ps(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r),h=this.match(l,o);if(h)return this.value=h,this;if(r==s.length-1)break;o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=s+(i==s?1:0),i==this.curLine.length&&this.nextLine(),ithis.value.to)return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Bt(t,e.sliceString(t,i));return Wn.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t&&this.flat.tothis.flat.text.length-10&&(t=null),t){let i=this.flat.from+t.index,s=i+t[0].length;return this.value={from:i,to:s,match:t},this.matchPos=s+(i==s?1:0),this}else{if(this.flat.to==this.to)return this.done=!0,this;this.flat=Bt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}}typeof Symbol!="undefined"&&(na.prototype[Symbol.iterator]=sa.prototype[Symbol.iterator]=function(){return this});function Ud(n){try{return new RegExp(n,Zs),!0}catch{return!1}}function Os(n){let e=pe("input",{class:"cm-textfield",name:"line"}),t=pe("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:Zi.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},pe("label",n.state.phrase("Go to line"),": ",e)," ",pe("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,l,h,a,c]=s,f=a?+a.slice(1):0,u=h?+h:o.number;if(h&&c){let p=u/100;l&&(p=p*(l=="-"?-1:1)+o.number/r.doc.lines),u=Math.round(r.doc.lines*p)}else h&&l&&(u=u*(l=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u)));n.dispatch({effects:Zi.of(!1),selection:m.cursor(d.from+Math.max(0,Math.min(f,d.length))),scrollIntoView:!0}),n.focus()}return{dom:t}}const Zi=H.define(),Bo=ke.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(Zi)&&(n=t.value);return n},provide:n=>Gi.from(n,e=>e?Os:null)}),jd=n=>{let e=ji(n,Os);if(!e){let t=[Zi.of(!0)];n.state.field(Bo,!1)==null&&t.push(H.appendConfig.of([Bo,Gd])),n.dispatch({effects:t}),e=ji(n,Os)}return e&&e.dom.querySelector("input").focus(),!0},Gd=O.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jd={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ra=T.define({combine(n){return Ht(n,Jd,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function $d(n){let e=[Zd,Qd];return n&&e.push(ra.of(n)),e}const Xd=P.mark({class:"cm-selectionMatch"}),Yd=P.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Po(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=ce.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=ce.Word)}function _d(n,e,t,i){return n(e.sliceDoc(t,t+1))==ce.Word&&n(e.sliceDoc(i-1,i))==ce.Word}const Qd=ue.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ra),{state:t}=n,i=t.selection;if(i.ranges.length>1)return P.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return P.none;let h=t.wordAt(s.head);if(!h)return P.none;o=t.charCategorizer(s.head),r=t.sliceDoc(h.from,h.to)}else{let h=s.to-s.from;if(h200)return P.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Po(o,t,s.from,s.to)&&_d(o,t,s.from,s.to)))return P.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return P.none}let l=[];for(let h of n.visibleRanges){let a=new Ft(t.doc,r,h.from,h.to);for(;!a.next().done;){let{from:c,to:f}=a.value;if((!o||Po(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Yd.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Xd.range(c,f)),l.length>e.maxMatches))return P.none}}return P.set(l)}},{decorations:n=>n.decorations}),Zd=O.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ep=({state:n,dispatch:e})=>{let{selection:t}=n,i=m.create(t.ranges.map(s=>n.wordAt(s.head)||m.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function tp(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new Ft(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Ft(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(h=>h.from==l.value.from))continue;if(r){let h=n.wordAt(l.value.from);if(!h||h.from!=l.value.from||h.to!=l.value.to)continue}return l.value}}const ip=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return ep({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=tp(n,i);return s?(e(n.update({selection:n.selection.addRange(m.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},er=T.define({combine(n){var e;return{top:n.reduce((t,i)=>t!=null?t:i.top,void 0)||!1,caseSensitive:n.reduce((t,i)=>t!=null?t:i.caseSensitive,void 0)||!1,createPanel:((e=n.find(t=>t.createPanel))===null||e===void 0?void 0:e.createPanel)||(t=>new up(t))}}});class oa{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Ud(this.search)),this.unquoted=e.literal?this.search:this.search.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp}create(){return this.regexp?new sp(this):new np(this)}getCursor(e,t=0,i=e.length){return this.regexp?Mt(this,e,t,i):At(this,e,t,i)}}class la{constructor(e){this.spec=e}}function At(n,e,t,i){return new Ft(e,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase())}class np extends la{constructor(e){super(e)}nextMatch(e,t,i){let s=At(this.spec,e,i,e.length).nextOverlapping();return s.done&&(s=At(this.spec,e,0,t).nextOverlapping()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=At(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace}matchAll(e,t){let i=At(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=At(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Mt(n,e,t,i){return new na(e,n.search,n.caseSensitive?void 0:{ignoreCase:!0},t,i)}class sp extends la{nextMatch(e,t,i){let s=Mt(this.spec,e,i,e.length).next();return s.done&&(s=Mt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Mt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Mt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const ci=H.define(),tr=H.define(),it=ke.define({create(n){return new zn(Ts(n).create(),null)},update(n,e){for(let t of e.effects)t.is(ci)?n=new zn(t.value.create(),n.panel):t.is(tr)&&(n=new zn(n.query,t.value?ir:null));return n},provide:n=>Gi.from(n,e=>e.panel)});class zn{constructor(e,t){this.query=e,this.panel=t}}const rp=P.mark({class:"cm-searchMatch"}),op=P.mark({class:"cm-searchMatch cm-searchMatch-selected"}),lp=ue.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(it))}update(n){let e=n.state.field(it);(e!=n.startState.field(it)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return P.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state.doc,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?op:rp)})}return i.finish()}},{decorations:n=>n.decorations});function pi(n){return e=>{let t=e.state.field(it,!1);return t&&t.query.spec.valid?n(e,t):ha(e)}}const en=pi((n,{query:e})=>{let{from:t,to:i}=n.state.selection.main,s=e.nextMatch(n.state.doc,t,i);return!s||s.from==t&&s.to==i?!1:(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:nr(n,s),userEvent:"select.search"}),!0)}),tn=pi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main,r=e.prevMatch(t.doc,i,s);return r?(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:nr(n,r),userEvent:"select.search"}),!0):!1}),hp=pi((n,{query:e})=>{let t=e.matchAll(n.state.doc,1e3);return!t||!t.length?!1:(n.dispatch({selection:m.create(t.map(i=>m.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),ap=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Ft(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(m.range(l.value.from,l.value.to))}return e(n.update({selection:m.create(r,o),userEvent:"select.search.matches"})),!0},Ro=pi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t.doc,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t.doc,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(nr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),cp=pi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state.doc,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:O.announce.of(i),userEvent:"input.replace.all"}),!0});function ir(n){return n.state.facet(er).createPanel(n)}function Ts(n,e){var t;let i=n.selection.main,s=i.empty||i.to>i.from+100?"":n.sliceDoc(i.from,i.to),r=(t=e==null?void 0:e.caseSensitive)!==null&&t!==void 0?t:n.facet(er).caseSensitive;return e&&!s?e:new oa({search:s.replace(/\n/g,"\\n"),caseSensitive:r})}const ha=n=>{let e=n.state.field(it,!1);if(e&&e.panel){let t=ji(n,ir);if(!t)return!1;let i=t.dom.querySelector("[main-field]");if(i&&i!=n.root.activeElement){let s=Ts(n.state,e.query.spec);s.valid&&n.dispatch({effects:ci.of(s)}),i.focus(),i.select()}}else n.dispatch({effects:[tr.of(!0),e?ci.of(Ts(n.state,e.query.spec)):H.appendConfig.of(pp)]});return!0},aa=n=>{let e=n.state.field(it,!1);if(!e||!e.panel)return!1;let t=ji(n,ir);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:tr.of(!1)}),!0},fp=[{key:"Mod-f",run:ha,scope:"editor search-panel"},{key:"F3",run:en,shift:tn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:en,shift:tn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ap},{key:"Alt-g",run:jd},{key:"Mod-d",run:ip,preventDefault:!0}];class up{constructor(e){this.view=e;let t=this.query=e.state.field(it).query.spec;this.commit=this.commit.bind(this),this.searchField=pe("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=pe("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",onchange:this.commit,onkeyup:this.commit}),this.caseField=pe("input",{type:"checkbox",name:"case",checked:t.caseSensitive,onchange:this.commit}),this.reField=pe("input",{type:"checkbox",name:"re",checked:t.regexp,onchange:this.commit});function i(s,r,o){return pe("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=pe("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>en(e),[Me(e,"next")]),i("prev",()=>tn(e),[Me(e,"previous")]),i("select",()=>hp(e),[Me(e,"all")]),pe("label",null,[this.caseField,Me(e,"match case")]),pe("label",null,[this.reField,Me(e,"regexp")]),...e.state.readOnly?[]:[pe("br"),this.replaceField,i("replace",()=>Ro(e),[Me(e,"replace")]),i("replaceAll",()=>cp(e),[Me(e,"replace all")]),pe("button",{name:"close",onclick:()=>aa(e),"aria-label":Me(e,"close"),type:"button"},["\xD7"])]])}commit(){let e=new oa({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ci.of(e)}))}keydown(e){gf(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?tn:en)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ro(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(ci)&&!i.value.eq(this.query)&&this.setQuery(i.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}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(er).top}}function Me(n,e){return n.state.phrase(e)}const Ti=30,Bi=/[\s\.,:;?!]/;function nr(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Ti),o=Math.min(s,t+Ti),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let h=0;hl.length-Ti;h--)if(!Bi.test(l[h-1])&&Bi.test(l[h])){l=l.slice(0,h);break}}return O.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const dp=O.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"}}),pp=[it,fi.lowest(lp),dp];class ca{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=xe(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(fa(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function Lo(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function gp(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:gp(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Eo{constructor(e,t,i){this.completion=e,this.source=t,this.match=i}}function nt(n){return n.selection.main.head}function fa(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}function yp(n,e,t,i){return Object.assign(Object.assign({},n.changeByRange(s=>{if(s==n.selection.main)return{changes:{from:t,to:i,insert:e},range:m.cursor(t+e.length)};let r=i-t;return!s.empty||r&&n.sliceDoc(s.from-r,s.from)!=n.sliceDoc(t,i)?{range:s}:{changes:{from:s.from-r,to:s.from,insert:e},range:m.cursor(s.from-r+e.length)}})),{userEvent:"input.complete"})}function ua(n,e){const t=e.completion.apply||e.completion.label;let i=e.source;typeof t=="string"?n.dispatch(yp(n.state,t,i.from,i.to)):t(n,e.completion,i.from,i.to)}const Io=new WeakMap;function bp(n){if(!Array.isArray(n))return n;let e=Io.get(n);return e||Io.set(n,e=mp(n)),e}class wp{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(D=Ps(S))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0;(!v||B==1&&y||x==0&&B!=0)&&(t[f]==S||i[f]==S&&(u=!0)?o[f++]=v:o.length&&(b=!1)),x=B,v+=ve(S)}return f==h&&o[0]==0&&b?this.result(-100+(u?-200:0),o,e):d==h&&p==0?[-200-e.length,0,g]:l>-1?[-700-e.length,l,l+this.pattern.length]:d==h?[-200+-700-e.length,p,g]:f==h?this.result(-100+(u?-200:0)+-700+(b?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[e-i.length],r=1;for(let o of t){let l=o+(this.astral?ve(re(i,o)):1);r>1&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return s}}const lt=T.define({combine(n){return Ht(n,{activateOnTyping:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[]},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>i=>xp(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function xp(n,e){return n?e?n+" "+e:n:e}function kp(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let{label:o}=t,l=0;for(let h=1;hl&&r.appendChild(document.createTextNode(o.slice(l,a)));let f=r.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(o.slice(a,c))),f.className="cm-completionMatchedText",l=c}return lt.position-i.position).map(t=>t.render)}function No(n,e,t){if(n<=t)return{from:0,to:n};if(e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class Sp{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:l=>this.positionInfo(l),key:this};let i=e.state.field(t),{options:s,selected:r}=i.open,o=e.state.facet(lt);this.optionContent=kp(o),this.optionClass=o.optionClass,this.range=No(s.length,r,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",l=>{for(let h=l.target,a;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(a=/-(\d+)$/.exec(h.id))&&+a[1]{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected=this.range.to)&&(this.range=No(t.options.length,t.selected,this.view.state.facet(lt).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o)}).catch(o=>Pe(this.view.state,o,"completion info")):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&Cp(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect();if(s.top>Math.min(innerHeight,t.bottom)-10||s.bottomnew Sp(e,n)}function Cp(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function Vo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Ap(n,e){let t=[],i=0;for(let o of n)if(o.hasResult())if(o.result.filter===!1){let l=o.result.getMatch;for(let h of o.result.options){let a=[1e9-i++];if(l)for(let c of l(h))a.push(c);t.push(new Eo(h,o,a))}}else{let l=new wp(e.sliceDoc(o.from,o.to)),h;for(let a of o.result.options)(h=l.match(a.label))&&(a.boost!=null&&(h[0]+=a.boost),t.push(new Eo(a,o,h)))}let s=[],r=null;for(let o of t.sort(Tp))!r||r.label!=o.completion.label||r.detail!=o.completion.detail||r.type!=null&&o.completion.type!=null&&r.type!=o.completion.type||r.apply!=o.completion.apply?s.push(o):Vo(o.completion)>Vo(r)&&(s[s.length-1]=o),r=o.completion;return s}class ei{constructor(e,t,i,s,r){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ei(this.options,Fo(t,e),this.tooltip,this.timestamp,e)}static build(e,t,i,s,r){let o=Ap(e,t);if(!o.length)return null;let l=0;if(s&&s.selected){let h=s.options[s.selected].completion;for(let a=0;aa.hasResult()?Math.min(h,a.from):h,1e8),create:vp(De),above:r.aboveCursor},s?s.timestamp:Date.now(),l)}map(e){return new ei(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class nn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new nn(Op,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(lt),r=(i.override||t.languageDataAt("autocomplete",nt(t)).map(bp)).map(l=>(this.active.find(a=>a.source==l)||new ge(l,this.active.some(a=>a.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,h)=>l==this.active[h])&&(r=this.active);let o=e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Mp(r,this.active)?ei.build(r,t,this.id,this.open,i):this.open&&e.docChanged?this.open.map(e.changes):this.open;!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ge(l.source,0):l));for(let l of e.effects)l.is(pa)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new nn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Dp}}function Mp(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;to||t=="delete"&&nt(e.startState)==this.from)return new ge(this.source,t=="input"&&i.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),a;return Bp(this.result.validFor,e.state,r,o)?new ti(this.source,h,this.result,r,o):this.result.update&&(a=this.result.update(this.result,r,o,new ca(e.state,l,h>=0)))?new ti(this.source,h,a,a.from,(s=a.to)!==null&&s!==void 0?s:nt(e.state)):new ge(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ge(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ti(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Bp(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):fa(n,!0).test(s)}const sr=H.define(),sn=H.define(),da=H.define({map(n,e){return n.map(t=>t.map(e))}}),pa=H.define(),De=ke.define({create(){return nn.start()},update(n,e){return n.update(e)},provide:n=>[ih.from(n,e=>e.tooltip),O.contentAttributes.from(n,e=>e.attrs)]}),ga=75;function Pi(n,e="option"){return t=>{let i=t.state.field(De,!1);if(!i||!i.open||Date.now()-i.open.timestamp=l&&(o=e=="page"?l-1:0),t.dispatch({effects:pa.of(o)}),!0}}const Pp=n=>{let e=n.state.field(De,!1);return n.state.readOnly||!e||!e.open||Date.now()-e.open.timestampn.state.field(De,!1)?(n.dispatch({effects:sr.of(!0)}),!0):!1,Lp=n=>{let e=n.state.field(De,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:sn.of(null)}),!0)};class Ep{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Ho=50,Ip=50,Np=1e3,Vp=ue.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(De).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(De);if(!n.selectionSet&&!n.docChanged&&n.startState.field(De)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!Bs(i));for(let i=0;iIp&&Date.now()-s.time>Np){for(let r of s.context.abortListeners)try{r()}catch(o){Pe(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),Ho):-1,this.composing!=0)for(let i of n.transactions)Bs(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(De);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=nt(e),i=new ca(e,t,n.explicitPos==t),s=new Ep(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:sn.of(null)}),Pe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Ho))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(lt);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ge(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:da.of(e)})}},{eventHandlers:{blur(){let n=this.view.state.field(De,!1);n&&n.tooltip&&this.view.state.facet(lt).closeOnBlur&&this.view.dispatch({effects:sn.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sr.of(!1)}),20),this.composing=0}}}),Fp=O.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",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",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"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),rn={brackets:["(","[","{","'",'"'],before:")]}:;>"},ft=H.define({map(n,e){let t=e.mapPos(n,-1,me.TrackAfter);return t==null?void 0:t}}),rr=H.define({map(n,e){return e.mapPos(n)}}),or=new class extends pt{};or.startSide=1;or.endSide=-1;const ma=ke.define({create(){return Y.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=Y.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(ft)?n=n.update({add:[or.range(t.value,t.value+1)]}):t.is(rr)&&(n=n.update({filter:i=>i!=t.value}));return n}});function Hp(){return[zp,ma]}const qn="()[]{}<>";function ya(n){for(let e=0;e{if((Wp?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&ve(re(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Up(n.state,i);return r?(n.dispatch(r),!0):!1}),qp=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ba(n,n.selection.main.head).brackets||rn.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=jp(n.doc,o.head);for(let h of i)if(h==l&&wn(n.doc,o.head)==ya(re(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:m.cursor(o.head-h.length),userEvent:"delete.backward"}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0})),!s},Kp=[{key:"Backspace",run:qp}];function Up(n,e){let t=ba(n,n.selection.main.head),i=t.brackets||rn.brackets;for(let s of i){let r=ya(re(s,0));if(e==s)return r==s?$p(n,s,i.indexOf(s+s+s)>-1):Gp(n,s,r,t.before||rn.before);if(e==r&&wa(n,n.selection.main.from))return Jp(n,s,r)}return null}function wa(n,e){let t=!1;return n.field(ma).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function wn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ve(re(t,0)))}function jp(n,e){let t=n.sliceString(e-2,e);return ve(re(t,0))==t.length?t:t.slice(1)}function Gp(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:ft.of(o.to+e.length),range:m.range(o.anchor+e.length,o.head+e.length)};let l=wn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:ft.of(o.head+e.length),range:m.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Jp(n,e,t){let i=null,s=n.selection.ranges.map(r=>r.empty&&wn(n.doc,r.head)==t?m.cursor(r.head+t.length):i=r);return i?null:n.update({selection:m.create(s,n.selection.mainIndex),scrollIntoView:!0,effects:n.selection.ranges.map(({from:r})=>rr.of(r))})}function $p(n,e,t){let i=null,s=n.changeByRange(r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:e,from:r.to}],effects:ft.of(r.to+e.length),range:m.range(r.anchor+e.length,r.head+e.length)};let o=r.head,l=wn(n.doc,o);if(l==e){if(Wo(n,o))return{changes:{insert:e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)};if(wa(n,o)){let h=t&&n.sliceDoc(o,o+e.length*3)==e+e+e;return{range:m.cursor(o+e.length*(h?3:1)),effects:rr.of(o)}}}else{if(t&&n.sliceDoc(o-2*e.length,o)==e+e&&Wo(n,o-2*e.length))return{changes:{insert:e+e+e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)};if(n.charCategorizer(o)(l)!=ce.Word){let h=n.sliceDoc(o-1,o);if(h!=e&&n.charCategorizer(o)(h)!=ce.Word&&!Xp(n,o,e))return{changes:{insert:e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)}}}return{range:i=r}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Wo(n,e){let t=xe(n).resolveInner(e+1);return t.parent&&t.from==e}function Xp(n,e,t){console.log("check pos",e);let i=xe(n).resolveInner(e,-1);for(let s=0;s<5;s++){if(n.sliceDoc(i.from,i.from+t.length)==t){let o=i.firstChild;for(;o&&o.from==i.from&&o.to-o.from>t.length;){if(n.sliceDoc(o.to-t.length,o.to)==t)return!1;o=o.firstChild}return!0}let r=i.to==e&&i.parent;if(!r)break;i=r}return!1}function Yp(n={}){return[De,lt.of(n),Vp,_p,Fp]}const xa=[{key:"Ctrl-Space",run:Rp},{key:"Escape",run:Lp},{key:"ArrowDown",run:Pi(!0)},{key:"ArrowUp",run:Pi(!1)},{key:"PageDown",run:Pi(!0,"page")},{key:"PageUp",run:Pi(!1,"page")},{key:"Enter",run:Pp}],_p=fi.highest(Ws.computeN([lt],n=>n.facet(lt).defaultKeymap?[xa]:[]));function Qp(n){ka(n,"start");var e={},t=n.languageData||{},i=!1;for(var s in n)if(s!=t&&n.hasOwnProperty(s))for(var r=e[s]=[],o=n[s],l=0;l2&&o.token&&typeof o.token!="string"){t.pending=[];for(var a=2;a-1)return null;var s=t.indent.length-1,r=n[t.state];e:for(;;){for(var o=0;ot(11,s=C));const r=Pa();let{value:o=""}=e,{disabled:l=!1}=e,{placeholder:h=""}=e,{baseCollection:a=new Ra}=e,{singleLine:c=!1}=e,{extraAutocompleteKeys:f=[]}=e,{disableRequestKeys:u=!1}=e,{disableIndirectCollectionsKeys:d=!1}=e,p,g,y=new _e,b=new _e,v=new _e,A=new _e;function x(){p==null||p.focus()}function S(C){let E=C.slice();return kn.pushOrReplaceByKey(E,a,"id"),E}function D(){g==null||g.dispatchEvent(new CustomEvent("change",{detail:{value:o},bubbles:!0}))}function B(C,E="",R=0){let K=i.find(I=>I.name==C||I.id==C);if(!K||R>=4)return[];let q=[E+"id",E+"created",E+"updated"];for(const I of K.schema){const ne=E+I.name;if(I.type==="relation"&&I.options.collectionId){const de=B(I.options.collectionId,ne+".",R+1);de.length?q=q.concat(de):q.push(ne)}else q.push(ne)}return q}function U(C=!0,E=!0){let R=[].concat(f);const K=B(a.name);for(const q of K)R.push(q);if(C&&(R.push("@request.method"),R.push("@request.query."),R.push("@request.data."),R.push("@request.user.id"),R.push("@request.user.email"),R.push("@request.user.verified"),R.push("@request.user.created"),R.push("@request.user.updated")),C||E)for(const q of i){let I="";if(q.name==="profiles"){if(!C)continue;I="@request.user.profile."}else{if(!E)continue;I="@collection."+q.name+"."}const ne=B(q.name,I);for(const de of ne)R.push(de)}return R.sort(function(q,I){return I.length-q.length}),R}function N(C){let E=C.matchBefore(/[\@\w\.]*/);if(E.from==E.to&&!C.explicit)return null;let R=[{label:"null"},{label:"false"},{label:"true"}];d||R.push({label:"@collection.*",apply:"@collection."});const K=["@request.user.profile.id","@request.user.profile.userId","@request.user.profile.created","@request.user.profile.updated"],q=U(!u,!u&&E.text.startsWith("@c"));for(const I of q)K.includes(I)||R.push({label:I.endsWith(".")?I+"*":I,apply:I});return{from:E.from,options:R}}function L(){const C=[],E=U(!u,!d);for(const R of E){let K;R.endsWith(".")?K=kn.escapeRegExp(R)+"\\w+[\\w.]*":K=kn.escapeRegExp(R),C.push({regex:K,token:"keyword"})}return C}function W(){return Js.define(Qp({start:[{regex:/true|false|null/,token:"atom"},{regex:/"(?:[^\\]|\\.)*?(?:"|$)/,token:"string"},{regex:/'(?:[^\\]|\\.)*?(?:'|$)/,token:"string"},{regex:/0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,token:"number"},{regex:/\&\&|\|\||\=|\!\=|\~|\!\~|\>|\<|\>\=|\<\=/,token:"operator"},{regex:/[\{\[\(]/,indent:!0},{regex:/[\}\]\)]/,dedent:!0}].concat(L())}))}La(()=>{const C={key:"Enter",run:E=>{c&&r("submit",o)}};return t(10,p=new O({parent:g,state:V.create({doc:o,extensions:[Xf(),Bf(),_u(),bf(),Cf(),V.allowMultipleSelections.of(!0),ku(Cu,{fallback:!0}),Pu(),Hp(),Wf(),$d(),Ws.of([C,...Kp,...Kd,...fp,...od,...xa]),O.lineWrapping,Yp({override:[N],icons:!1}),A.of(ro(h)),b.of(O.editable.of(!0)),v.of(V.readOnly.of(!1)),y.of(W()),V.transactionFilter.of(E=>c&&E.newDoc.lines>1?[]:E),O.updateListener.of(E=>{!E.docChanged||l||(t(1,o=E.state.doc.toString()),D())})]})})),()=>p==null?void 0:p.destroy()});function G(C){Ea[C?"unshift":"push"](()=>{g=C,t(0,g)})}return n.$$set=C=>{"value"in C&&t(1,o=C.value),"disabled"in C&&t(2,l=C.disabled),"placeholder"in C&&t(3,h=C.placeholder),"baseCollection"in C&&t(4,a=C.baseCollection),"singleLine"in C&&t(5,c=C.singleLine),"extraAutocompleteKeys"in C&&t(6,f=C.extraAutocompleteKeys),"disableRequestKeys"in C&&t(7,u=C.disableRequestKeys),"disableIndirectCollectionsKeys"in C&&t(8,d=C.disableIndirectCollectionsKeys)},n.$$.update=()=>{n.$$.dirty&2048&&(i=S(s)),n.$$.dirty&1040&&p&&(a==null?void 0:a.schema)&&p.dispatch({effects:[y.reconfigure(W())]}),n.$$.dirty&1028&&p&&typeof l!="undefined"&&p.dispatch({effects:[b.reconfigure(O.editable.of(!l)),v.reconfigure(V.readOnly.of(l))]}),n.$$.dirty&1026&&p&&o!=p.state.doc.toString()&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:o}}),n.$$.dirty&1032&&p&&typeof h!="undefined"&&p.dispatch({effects:[A.reconfigure(ro(h))]})},[g,o,l,h,a,c,f,u,d,x,p,s,G]}class hg extends Sa{constructor(e){super(),va(this,e,rg,sg,Ca,{value:1,disabled:2,placeholder:3,baseCollection:4,singleLine:5,extraAutocompleteKeys:6,disableRequestKeys:7,disableIndirectCollectionsKeys:8,focus:9})}get focus(){return this.$$.ctx[9]}}export{hg as default}; +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;t+=this.ranges[++this.rangeIndex].from-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new bh(t,e?e.state.tabSize:4,e?bt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xh(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Xs=Object.create(null),ci=[we.none],Wu=new zs(ci),yo=[],kh=Object.create(null);for(let[n,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"]])kh[n]=vh(Xs,e);class Sh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kh)}resolve(e){return e?this.table[e]||(this.table[e]=vh(this.extra,e)):0}}const zu=new Sh(Xs);function Fn(n,e){yo.indexOf(n)>-1||(yo.push(n),console.warn(e))}function vh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||k[r];o?typeof o=="function"?t?t=o(t):Fn(r,`Modifier ${r} used at start of tag`):t?Fn(r,`Tag ${r} used as modifier`):t=o:Fn(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=we.define({id:ci.length,name:i,props:[lu({[i]:t})]});return ci.push(s),s.id}function qu(n){let e=we.define({id:ci.length,name:"Document",props:[ai.add(()=>n)]});return ci.push(e),e}const Ku=n=>{let e=_s(n.state);return e.line?Uu(n):e.block?Gu(n):!1};function Ys(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Uu=Ys(Xu,0),ju=Ys(Ch,0),Gu=Ys((n,e)=>Ch(n,e,$u(e)),0);function _s(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Jt=50;function Ju(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Jt,i),o=n.sliceDoc(s,s+Jt),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*Jt?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Jt),f=n.sliceDoc(s-Jt,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function $u(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function Ch(n,e,t=e.selection.ranges){let i=t.map(r=>_s(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Ju(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>c.from)){s=c.from;let f=_s(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c.length,p=c.text.slice(u,u+f.length)==f?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:h,indent:a,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+a,insert:h+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:h}of i)if(l>=0){let a=o.from+l,c=a+h.length;o.text[c-o.from]==" "&&c++,r.push({from:a,to:c})}return{changes:r}}return null}const Cs=wt.define(),Yu=wt.define(),_u=T.define(),Ah=T.define({combine(n){return zt(n,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}});function Qu(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const Mh=ke.define({create(){return He.empty},update(n,e){let t=e.state.facet(Ah),i=e.annotation(Cs);if(i){let h=e.docChanged?m.single(Qu(e.changes)):void 0,a=ye.fromTransaction(e,h),c=i.side,f=c==0?n.undone:n.done;return a?f=Qi(f,f.length,t.minDepth,a):f=Th(f,e.startState.selection),new He(c==0?i.rest:f,c==0?f:i.rest)}let s=e.annotation(Yu);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(te.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=ye.fromTransaction(e),o=e.annotation(te.time),l=e.annotation(te.userEvent);return r?n=n.addChanges(r,o,l,t.newGroupDelay,t.minDepth):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new He(n.done.map(ye.fromJSON),n.undone.map(ye.fromJSON))}});function Zu(n={}){return[Mh,Ah.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Dh:e.inputType=="historyRedo"?As:null;return i?(e.preventDefault(),i(t)):!1}})]}function un(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Mh,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Dh=un(0,!1),As=un(1,!1),ed=un(0,!0),td=un(1,!0);class ye{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new ye(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ye(e.changes&&ee.fromJSON(e.changes),[],e.mapped&&We.fromJSON(e.mapped),e.startSelection&&m.fromJSON(e.startSelection),e.selectionsAfter.map(m.fromJSON))}static fromTransaction(e,t){let i=Oe;for(let s of e.startState.facet(_u)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new ye(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Oe)}static selection(e){return new ye(void 0,Oe,void 0,void 0,e)}}function Qi(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function id(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let h=0;h=a&&o<=c&&(i=!0)}}),i}function nd(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Oh(n,e){return n.length?e.length?n.concat(e):n:e}const Oe=[],sd=200;function Th(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-sd));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Qi(n,n.length-1,1e9,t.setSelAfter(i)))}else return[ye.selection([e])]}function rd(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Hn(n,e){if(!n.length)return n;let t=n.length,i=Oe;for(;t;){let s=od(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[ye.selection(i)]:Oe}function od(n,e,t){let i=Oh(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Oe,t);if(!n.changes)return ye.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new ye(s,H.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const ld=/^(input\.type|delete)($|\.)/;class He{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new He(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||ld.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):dn(t,e))}function Te(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Rh=n=>Bh(n,!Te(n)),Ph=n=>Bh(n,Te(n));function Lh(n,e){return Ge(n,t=>t.empty?n.moveByGroup(t,e):dn(t,e))}const ad=n=>Lh(n,!Te(n)),cd=n=>Lh(n,Te(n));function fd(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function pn(n,e,t){let i=xe(n).resolveInner(e.head),s=t?F.closedBy:F.openedBy;for(let h=e.head;;){let a=t?i.childAfter(h):i.childBefore(h);if(!a)break;fd(n,a,s)?i=a:h=t?a.to:a.from}let r=i.type.prop(s),o,l;return r&&(o=t?Fe(n,i.from,1):Fe(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,m.cursor(l,t?-1:1)}const ud=n=>Ge(n,e=>pn(n.state,e,!Te(n))),dd=n=>Ge(n,e=>pn(n.state,e,Te(n)));function Eh(n,e){return Ge(n,t=>{if(!t.empty)return dn(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Ih=n=>Eh(n,!1),Nh=n=>Eh(n,!0);function Vh(n){return Math.max(n.defaultLineHeight,Math.min(n.dom.clientHeight,innerHeight)-5)}function Fh(n,e){let{state:t}=n,i=qt(t.selection,l=>l.empty?n.moveVertically(l,e,Vh(n)):dn(l,e));if(i.eq(t.selection))return!1;let s=n.coordsAtPos(t.selection.main.head),r=n.scrollDOM.getBoundingClientRect(),o;return s&&s.top>r.top&&s.bottomFh(n,!1),Ms=n=>Fh(n,!0);function gn(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=m.cursor(i.from+r))}return s}const wo=n=>Ge(n,e=>gn(n,e,!0)),xo=n=>Ge(n,e=>gn(n,e,!1)),pd=n=>Ge(n,e=>m.cursor(n.lineBlockAt(e.head).from,1)),gd=n=>Ge(n,e=>m.cursor(n.lineBlockAt(e.head).to,-1));function md(n,e,t){let i=!1,s=qt(n.selection,r=>{let o=Fe(n,r.head,-1)||Fe(n,r.head,1)||r.head>0&&Fe(n,r.head-1,1)||r.headmd(n,e,!1);function Ke(n,e){let t=qt(n.state.selection,i=>{let s=e(i);return m.range(i.anchor,s.head,s.goalColumn)});return t.eq(n.state.selection)?!1:(n.dispatch(qe(n.state,t)),!0)}function Hh(n,e){return Ke(n,t=>n.moveByChar(t,e))}const Wh=n=>Hh(n,!Te(n)),zh=n=>Hh(n,Te(n));function qh(n,e){return Ke(n,t=>n.moveByGroup(t,e))}const bd=n=>qh(n,!Te(n)),wd=n=>qh(n,Te(n)),xd=n=>Ke(n,e=>pn(n.state,e,!Te(n))),kd=n=>Ke(n,e=>pn(n.state,e,Te(n)));function Kh(n,e){return Ke(n,t=>n.moveVertically(t,e))}const Uh=n=>Kh(n,!1),jh=n=>Kh(n,!0);function Gh(n,e){return Ke(n,t=>n.moveVertically(t,e,Vh(n)))}const ko=n=>Gh(n,!1),So=n=>Gh(n,!0),vo=n=>Ke(n,e=>gn(n,e,!0)),Co=n=>Ke(n,e=>gn(n,e,!1)),Sd=n=>Ke(n,e=>m.cursor(n.lineBlockAt(e.head).from)),vd=n=>Ke(n,e=>m.cursor(n.lineBlockAt(e.head).to)),Ao=({state:n,dispatch:e})=>(e(qe(n,{anchor:0})),!0),Mo=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.doc.length})),!0),Do=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.selection.main.anchor,head:0})),!0),Oo=({state:n,dispatch:e})=>(e(qe(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Cd=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Ad=({state:n,dispatch:e})=>{let t=bn(n).map(({from:i,to:s})=>m.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:m.create(t),userEvent:"select"})),!0},Md=({state:n,dispatch:e})=>{let t=qt(n.selection,i=>{var s;let r=xe(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return m.range(r.to,r.from)});return e(qe(n,t)),!0},Dd=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=m.create([t.main]):t.main.empty||(i=m.create([m.cursor(t.main.head)])),i?(e(qe(n,i)),!0):!1};function mn({state:n,dispatch:e},t){if(n.readOnly)return!1;let i="delete.selection",s=n.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let h=t(o);ho&&(i="delete.forward"),o=Math.min(o,h),l=Math.max(l,h)}return o==l?{range:r}:{changes:{from:o,to:l},range:m.cursor(o)}});return s.changes.empty?!1:(e(n.update(s,{scrollIntoView:!0,userEvent:i,effects:i=="delete.selection"?O.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yn(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Jh=(n,e)=>mn(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tJh(n,!1),$h=n=>Jh(n,!0),Xh=(n,e)=>mn(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let h=Ae(r.text,i-r.from,e)+r.from,a=r.text.slice(Math.min(i,h)-r.from,Math.max(i,h)-r.from),c=o(a);if(l!=null&&c!=l)break;(a!=" "||i!=t)&&(l=c),i=h}return yn(n,i,e)}),Yh=n=>Xh(n,!1),Od=n=>Xh(n,!0),_h=n=>mn(n,e=>{let t=n.lineBlockAt(e).to;return yn(n,emn(n,e=>{let t=n.lineBlockAt(e).from;return yn(n,e>t?t:Math.max(0,e-1),!1)}),Bd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:z.of(["",""])},range:m.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Rd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:Ae(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:Ae(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:m.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bn(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Qh(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of bn(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let h of r.ranges)s.push(m.range(Math.min(n.doc.length,h.anchor+l),Math.min(n.doc.length,h.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let h of r.ranges)s.push(m.range(h.anchor-l,h.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:m.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Pd=({state:n,dispatch:e})=>Qh(n,e,!1),Ld=({state:n,dispatch:e})=>Qh(n,e,!0);function Zh(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of bn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Ed=({state:n,dispatch:e})=>Zh(n,e,!1),Id=({state:n,dispatch:e})=>Zh(n,e,!0),Nd=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(bn(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Vd(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=xe(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(F.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const Fd=ea(!1),Hd=ea(!0);function ea(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),h=!n&&r==o&&Vd(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let a=new cn(e,{simulateBreak:r,simulateDoubleBreak:!!h}),c=uh(a,r);for(c==null&&(c=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:m.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const Wd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new cn(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=Qs(n,(r,o,l)=>{let h=uh(i,r.from);if(h==null)return;/\S/.test(r.text)||(h=0);let a=/^\s*/.exec(r.text)[0],c=_i(n,h);(a!=c||l.fromn.readOnly?!1:(e(n.update(Qs(n,(t,i)=>{i.push({from:t.from,insert:n.facet(js)})}),{userEvent:"input.indent"})),!0),qd=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Qs(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=ui(s,n.tabSize),o=0,l=_i(n,Math.max(0,r-bt(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),jd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ud,shift:xd},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:dd,shift:kd},{key:"Alt-ArrowUp",run:Pd},{key:"Shift-Alt-ArrowUp",run:Ed},{key:"Alt-ArrowDown",run:Ld},{key:"Shift-Alt-ArrowDown",run:Id},{key:"Escape",run:Dd},{key:"Mod-Enter",run:Hd},{key:"Alt-l",mac:"Ctrl-l",run:Ad},{key:"Mod-i",run:Md,preventDefault:!0},{key:"Mod-[",run:qd},{key:"Mod-]",run:zd},{key:"Mod-Alt-\\",run:Wd},{key:"Shift-Mod-k",run:Nd},{key:"Shift-Mod-\\",run:yd},{key:"Mod-/",run:Ku},{key:"Alt-A",run:ju}].concat(Ud);function pe(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class Ht{constructor(e,t,i=0,s=e.length,r){this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?o=>r(To(o)):To,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return re(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Rs(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r),h=this.match(l,o);if(h)return this.value=h,this;if(r==s.length-1)break;o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=s+(i==s?1:0),i==this.curLine.length&&this.nextLine(),ithis.value.to)return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Bt(t,e.sliceString(t,i));return Wn.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t&&this.flat.tothis.flat.text.length-10&&(t=null),t){let i=this.flat.from+t.index,s=i+t[0].length;return this.value={from:i,to:s,match:t},this.matchPos=s+(i==s?1:0),this}else{if(this.flat.to==this.to)return this.done=!0,this;this.flat=Bt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}}typeof Symbol!="undefined"&&(na.prototype[Symbol.iterator]=sa.prototype[Symbol.iterator]=function(){return this});function Gd(n){try{return new RegExp(n,Zs),!0}catch{return!1}}function Os(n){let e=pe("input",{class:"cm-textfield",name:"line"}),t=pe("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:Zi.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},pe("label",n.state.phrase("Go to line"),": ",e)," ",pe("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,l,h,a,c]=s,f=a?+a.slice(1):0,u=h?+h:o.number;if(h&&c){let p=u/100;l&&(p=p*(l=="-"?-1:1)+o.number/r.doc.lines),u=Math.round(r.doc.lines*p)}else h&&l&&(u=u*(l=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u)));n.dispatch({effects:Zi.of(!1),selection:m.cursor(d.from+Math.max(0,Math.min(f,d.length))),scrollIntoView:!0}),n.focus()}return{dom:t}}const Zi=H.define(),Bo=ke.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(Zi)&&(n=t.value);return n},provide:n=>Gi.from(n,e=>e?Os:null)}),Jd=n=>{let e=ji(n,Os);if(!e){let t=[Zi.of(!0)];n.state.field(Bo,!1)==null&&t.push(H.appendConfig.of([Bo,$d])),n.dispatch({effects:t}),e=ji(n,Os)}return e&&e.dom.querySelector("input").focus(),!0},$d=O.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Xd={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ra=T.define({combine(n){return zt(n,Xd,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Yd(n){let e=[tp,ep];return n&&e.push(ra.of(n)),e}const _d=R.mark({class:"cm-selectionMatch"}),Qd=R.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ro(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=ce.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=ce.Word)}function Zd(n,e,t,i){return n(e.sliceDoc(t,t+1))==ce.Word&&n(e.sliceDoc(i-1,i))==ce.Word}const ep=ue.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ra),{state:t}=n,i=t.selection;if(i.ranges.length>1)return R.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return R.none;let h=t.wordAt(s.head);if(!h)return R.none;o=t.charCategorizer(s.head),r=t.sliceDoc(h.from,h.to)}else{let h=s.to-s.from;if(h200)return R.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Ro(o,t,s.from,s.to)&&Zd(o,t,s.from,s.to)))return R.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return R.none}let l=[];for(let h of n.visibleRanges){let a=new Ht(t.doc,r,h.from,h.to);for(;!a.next().done;){let{from:c,to:f}=a.value;if((!o||Ro(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Qd.range(c,f)):(c>=s.to||f<=s.from)&&l.push(_d.range(c,f)),l.length>e.maxMatches))return R.none}}return R.set(l)}},{decorations:n=>n.decorations}),tp=O.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ip=({state:n,dispatch:e})=>{let{selection:t}=n,i=m.create(t.ranges.map(s=>n.wordAt(s.head)||m.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function np(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new Ht(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Ht(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(h=>h.from==l.value.from))continue;if(r){let h=n.wordAt(l.value.from);if(!h||h.from!=l.value.from||h.to!=l.value.to)continue}return l.value}}const sp=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return ip({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=np(n,i);return s?(e(n.update({selection:n.selection.addRange(m.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},er=T.define({combine(n){var e;return{top:n.reduce((t,i)=>t!=null?t:i.top,void 0)||!1,caseSensitive:n.reduce((t,i)=>t!=null?t:i.caseSensitive,void 0)||!1,createPanel:((e=n.find(t=>t.createPanel))===null||e===void 0?void 0:e.createPanel)||(t=>new pp(t))}}});class oa{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Gd(this.search)),this.unquoted=e.literal?this.search:this.search.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp}create(){return this.regexp?new op(this):new rp(this)}getCursor(e,t=0,i=e.length){return this.regexp?Mt(this,e,t,i):At(this,e,t,i)}}class la{constructor(e){this.spec=e}}function At(n,e,t,i){return new Ht(e,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase())}class rp extends la{constructor(e){super(e)}nextMatch(e,t,i){let s=At(this.spec,e,i,e.length).nextOverlapping();return s.done&&(s=At(this.spec,e,0,t).nextOverlapping()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=At(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace}matchAll(e,t){let i=At(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=At(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Mt(n,e,t,i){return new na(e,n.search,n.caseSensitive?void 0:{ignoreCase:!0},t,i)}class op extends la{nextMatch(e,t,i){let s=Mt(this.spec,e,i,e.length).next();return s.done&&(s=Mt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Mt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Mt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const fi=H.define(),tr=H.define(),it=ke.define({create(n){return new zn(Ts(n).create(),null)},update(n,e){for(let t of e.effects)t.is(fi)?n=new zn(t.value.create(),n.panel):t.is(tr)&&(n=new zn(n.query,t.value?ir:null));return n},provide:n=>Gi.from(n,e=>e.panel)});class zn{constructor(e,t){this.query=e,this.panel=t}}const lp=R.mark({class:"cm-searchMatch"}),hp=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ap=ue.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(it))}update(n){let e=n.state.field(it);(e!=n.startState.field(it)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return R.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state.doc,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?hp:lp)})}return i.finish()}},{decorations:n=>n.decorations});function pi(n){return e=>{let t=e.state.field(it,!1);return t&&t.query.spec.valid?n(e,t):ha(e)}}const en=pi((n,{query:e})=>{let{from:t,to:i}=n.state.selection.main,s=e.nextMatch(n.state.doc,t,i);return!s||s.from==t&&s.to==i?!1:(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:nr(n,s),userEvent:"select.search"}),!0)}),tn=pi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main,r=e.prevMatch(t.doc,i,s);return r?(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:nr(n,r),userEvent:"select.search"}),!0):!1}),cp=pi((n,{query:e})=>{let t=e.matchAll(n.state.doc,1e3);return!t||!t.length?!1:(n.dispatch({selection:m.create(t.map(i=>m.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),fp=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Ht(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(m.range(l.value.from,l.value.to))}return e(n.update({selection:m.create(r,o),userEvent:"select.search.matches"})),!0},Po=pi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t.doc,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t.doc,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(nr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),up=pi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state.doc,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:O.announce.of(i),userEvent:"input.replace.all"}),!0});function ir(n){return n.state.facet(er).createPanel(n)}function Ts(n,e){var t;let i=n.selection.main,s=i.empty||i.to>i.from+100?"":n.sliceDoc(i.from,i.to),r=(t=e==null?void 0:e.caseSensitive)!==null&&t!==void 0?t:n.facet(er).caseSensitive;return e&&!s?e:new oa({search:s.replace(/\n/g,"\\n"),caseSensitive:r})}const ha=n=>{let e=n.state.field(it,!1);if(e&&e.panel){let t=ji(n,ir);if(!t)return!1;let i=t.dom.querySelector("[main-field]");if(i&&i!=n.root.activeElement){let s=Ts(n.state,e.query.spec);s.valid&&n.dispatch({effects:fi.of(s)}),i.focus(),i.select()}}else n.dispatch({effects:[tr.of(!0),e?fi.of(Ts(n.state,e.query.spec)):H.appendConfig.of(mp)]});return!0},aa=n=>{let e=n.state.field(it,!1);if(!e||!e.panel)return!1;let t=ji(n,ir);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:tr.of(!1)}),!0},dp=[{key:"Mod-f",run:ha,scope:"editor search-panel"},{key:"F3",run:en,shift:tn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:en,shift:tn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:fp},{key:"Alt-g",run:Jd},{key:"Mod-d",run:sp,preventDefault:!0}];class pp{constructor(e){this.view=e;let t=this.query=e.state.field(it).query.spec;this.commit=this.commit.bind(this),this.searchField=pe("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=pe("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",onchange:this.commit,onkeyup:this.commit}),this.caseField=pe("input",{type:"checkbox",name:"case",checked:t.caseSensitive,onchange:this.commit}),this.reField=pe("input",{type:"checkbox",name:"re",checked:t.regexp,onchange:this.commit});function i(s,r,o){return pe("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=pe("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>en(e),[Me(e,"next")]),i("prev",()=>tn(e),[Me(e,"previous")]),i("select",()=>cp(e),[Me(e,"all")]),pe("label",null,[this.caseField,Me(e,"match case")]),pe("label",null,[this.reField,Me(e,"regexp")]),...e.state.readOnly?[]:[pe("br"),this.replaceField,i("replace",()=>Po(e),[Me(e,"replace")]),i("replaceAll",()=>up(e),[Me(e,"replace all")]),pe("button",{name:"close",onclick:()=>aa(e),"aria-label":Me(e,"close"),type:"button"},["\xD7"])]])}commit(){let e=new oa({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:fi.of(e)}))}keydown(e){yf(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?tn:en)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Po(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(fi)&&!i.value.eq(this.query)&&this.setQuery(i.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}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(er).top}}function Me(n,e){return n.state.phrase(e)}const Ti=30,Bi=/[\s\.,:;?!]/;function nr(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Ti),o=Math.min(s,t+Ti),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let h=0;hl.length-Ti;h--)if(!Bi.test(l[h-1])&&Bi.test(l[h])){l=l.slice(0,h);break}}return O.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const gp=O.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"}}),mp=[it,Wt.lowest(ap),gp];class ca{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=xe(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(fa(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function Lo(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function yp(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:yp(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Eo{constructor(e,t,i){this.completion=e,this.source=t,this.match=i}}function nt(n){return n.selection.main.head}function fa(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}function wp(n,e,t,i){return Object.assign(Object.assign({},n.changeByRange(s=>{if(s==n.selection.main)return{changes:{from:t,to:i,insert:e},range:m.cursor(t+e.length)};let r=i-t;return!s.empty||r&&n.sliceDoc(s.from-r,s.from)!=n.sliceDoc(t,i)?{range:s}:{changes:{from:s.from-r,to:s.from,insert:e},range:m.cursor(s.from-r+e.length)}})),{userEvent:"input.complete"})}function ua(n,e){const t=e.completion.apply||e.completion.label;let i=e.source;typeof t=="string"?n.dispatch(wp(n.state,t,i.from,i.to)):t(n,e.completion,i.from,i.to)}const Io=new WeakMap;function xp(n){if(!Array.isArray(n))return n;let e=Io.get(n);return e||Io.set(n,e=bp(n)),e}class kp{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(D=Rs(S))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0;(!v||B==1&&y||x==0&&B!=0)&&(t[f]==S||i[f]==S&&(u=!0)?o[f++]=v:o.length&&(b=!1)),x=B,v+=ve(S)}return f==h&&o[0]==0&&b?this.result(-100+(u?-200:0),o,e):d==h&&p==0?[-200-e.length,0,g]:l>-1?[-700-e.length,l,l+this.pattern.length]:d==h?[-200+-700-e.length,p,g]:f==h?this.result(-100+(u?-200:0)+-700+(b?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[e-i.length],r=1;for(let o of t){let l=o+(this.astral?ve(re(i,o)):1);r>1&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return s}}const lt=T.define({combine(n){return zt(n,{activateOnTyping:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[]},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>i=>Sp(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function Sp(n,e){return n?e?n+" "+e:n:e}function vp(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let{label:o}=t,l=0;for(let h=1;hl&&r.appendChild(document.createTextNode(o.slice(l,a)));let f=r.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(o.slice(a,c))),f.className="cm-completionMatchedText",l=c}return lt.position-i.position).map(t=>t.render)}function No(n,e,t){if(n<=t)return{from:0,to:n};if(e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class Cp{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:l=>this.positionInfo(l),key:this};let i=e.state.field(t),{options:s,selected:r}=i.open,o=e.state.facet(lt);this.optionContent=vp(o),this.optionClass=o.optionClass,this.range=No(s.length,r,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",l=>{for(let h=l.target,a;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(a=/-(\d+)$/.exec(h.id))&&+a[1]{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected=this.range.to)&&(this.range=No(t.options.length,t.selected,this.view.state.facet(lt).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o)}).catch(o=>Re(this.view.state,o,"completion info")):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&Mp(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect();if(s.top>Math.min(innerHeight,t.bottom)-10||s.bottomnew Cp(e,n)}function Mp(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function Vo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Dp(n,e){let t=[],i=0;for(let o of n)if(o.hasResult())if(o.result.filter===!1){let l=o.result.getMatch;for(let h of o.result.options){let a=[1e9-i++];if(l)for(let c of l(h))a.push(c);t.push(new Eo(h,o,a))}}else{let l=new kp(e.sliceDoc(o.from,o.to)),h;for(let a of o.result.options)(h=l.match(a.label))&&(a.boost!=null&&(h[0]+=a.boost),t.push(new Eo(a,o,h)))}let s=[],r=null;for(let o of t.sort(Rp))!r||r.label!=o.completion.label||r.detail!=o.completion.detail||r.type!=null&&o.completion.type!=null&&r.type!=o.completion.type||r.apply!=o.completion.apply?s.push(o):Vo(o.completion)>Vo(r)&&(s[s.length-1]=o),r=o.completion;return s}class ii{constructor(e,t,i,s,r){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ii(this.options,Fo(t,e),this.tooltip,this.timestamp,e)}static build(e,t,i,s,r){let o=Dp(e,t);if(!o.length)return null;let l=0;if(s&&s.selected){let h=s.options[s.selected].completion;for(let a=0;aa.hasResult()?Math.min(h,a.from):h,1e8),create:Ap(De),above:r.aboveCursor},s?s.timestamp:Date.now(),l)}map(e){return new ii(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class nn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new nn(Bp,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(lt),r=(i.override||t.languageDataAt("autocomplete",nt(t)).map(xp)).map(l=>(this.active.find(a=>a.source==l)||new ge(l,this.active.some(a=>a.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,h)=>l==this.active[h])&&(r=this.active);let o=e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Op(r,this.active)?ii.build(r,t,this.id,this.open,i):this.open&&e.docChanged?this.open.map(e.changes):this.open;!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ge(l.source,0):l));for(let l of e.effects)l.is(pa)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new nn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Tp}}function Op(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;to||t=="delete"&&nt(e.startState)==this.from)return new ge(this.source,t=="input"&&i.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),a;return Pp(this.result.validFor,e.state,r,o)?new ni(this.source,h,this.result,r,o):this.result.update&&(a=this.result.update(this.result,r,o,new ca(e.state,l,h>=0)))?new ni(this.source,h,a,a.from,(s=a.to)!==null&&s!==void 0?s:nt(e.state)):new ge(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ge(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ni(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Pp(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):fa(n,!0).test(s)}const sr=H.define(),sn=H.define(),da=H.define({map(n,e){return n.map(t=>t.map(e))}}),pa=H.define(),De=ke.define({create(){return nn.start()},update(n,e){return n.update(e)},provide:n=>[ih.from(n,e=>e.tooltip),O.contentAttributes.from(n,e=>e.attrs)]}),ga=75;function Ri(n,e="option"){return t=>{let i=t.state.field(De,!1);if(!i||!i.open||Date.now()-i.open.timestamp=l&&(o=e=="page"?l-1:0),t.dispatch({effects:pa.of(o)}),!0}}const Lp=n=>{let e=n.state.field(De,!1);return n.state.readOnly||!e||!e.open||Date.now()-e.open.timestampn.state.field(De,!1)?(n.dispatch({effects:sr.of(!0)}),!0):!1,Ip=n=>{let e=n.state.field(De,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:sn.of(null)}),!0)};class Np{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Ho=50,Vp=50,Fp=1e3,Hp=ue.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(De).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(De);if(!n.selectionSet&&!n.docChanged&&n.startState.field(De)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!Bs(i));for(let i=0;iVp&&Date.now()-s.time>Fp){for(let r of s.context.abortListeners)try{r()}catch(o){Re(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),Ho):-1,this.composing!=0)for(let i of n.transactions)Bs(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(De);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=nt(e),i=new ca(e,t,n.explicitPos==t),s=new Np(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:sn.of(null)}),Re(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Ho))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(lt);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ge(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:da.of(e)})}},{eventHandlers:{blur(){let n=this.view.state.field(De,!1);n&&n.tooltip&&this.view.state.facet(lt).closeOnBlur&&this.view.dispatch({effects:sn.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sr.of(!1)}),20),this.composing=0}}}),Wp=O.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",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",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"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),rn={brackets:["(","[","{","'",'"'],before:")]}:;>"},ft=H.define({map(n,e){let t=e.mapPos(n,-1,me.TrackAfter);return t==null?void 0:t}}),rr=H.define({map(n,e){return e.mapPos(n)}}),or=new class extends pt{};or.startSide=1;or.endSide=-1;const ma=ke.define({create(){return Y.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=Y.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(ft)?n=n.update({add:[or.range(t.value,t.value+1)]}):t.is(rr)&&(n=n.update({filter:i=>i!=t.value}));return n}});function zp(){return[Kp,ma]}const qn="()[]{}<>";function ya(n){for(let e=0;e{if((qp?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&ve(re(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Gp(n.state,i);return r?(n.dispatch(r),!0):!1}),Up=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ba(n,n.selection.main.head).brackets||rn.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Jp(n.doc,o.head);for(let h of i)if(h==l&&wn(n.doc,o.head)==ya(re(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:m.cursor(o.head-h.length),userEvent:"delete.backward"}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0})),!s},jp=[{key:"Backspace",run:Up}];function Gp(n,e){let t=ba(n,n.selection.main.head),i=t.brackets||rn.brackets;for(let s of i){let r=ya(re(s,0));if(e==s)return r==s?Yp(n,s,i.indexOf(s+s+s)>-1):$p(n,s,r,t.before||rn.before);if(e==r&&wa(n,n.selection.main.from))return Xp(n,s,r)}return null}function wa(n,e){let t=!1;return n.field(ma).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function wn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ve(re(t,0)))}function Jp(n,e){let t=n.sliceString(e-2,e);return ve(re(t,0))==t.length?t:t.slice(1)}function $p(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:ft.of(o.to+e.length),range:m.range(o.anchor+e.length,o.head+e.length)};let l=wn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:ft.of(o.head+e.length),range:m.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Xp(n,e,t){let i=null,s=n.selection.ranges.map(r=>r.empty&&wn(n.doc,r.head)==t?m.cursor(r.head+t.length):i=r);return i?null:n.update({selection:m.create(s,n.selection.mainIndex),scrollIntoView:!0,effects:n.selection.ranges.map(({from:r})=>rr.of(r))})}function Yp(n,e,t){let i=null,s=n.changeByRange(r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:e,from:r.to}],effects:ft.of(r.to+e.length),range:m.range(r.anchor+e.length,r.head+e.length)};let o=r.head,l=wn(n.doc,o);if(l==e){if(Wo(n,o))return{changes:{insert:e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)};if(wa(n,o)){let h=t&&n.sliceDoc(o,o+e.length*3)==e+e+e;return{range:m.cursor(o+e.length*(h?3:1)),effects:rr.of(o)}}}else{if(t&&n.sliceDoc(o-2*e.length,o)==e+e&&Wo(n,o-2*e.length))return{changes:{insert:e+e+e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)};if(n.charCategorizer(o)(l)!=ce.Word){let h=n.sliceDoc(o-1,o);if(h!=e&&n.charCategorizer(o)(h)!=ce.Word&&!_p(n,o,e))return{changes:{insert:e+e,from:o},effects:ft.of(o+e.length),range:m.cursor(o+e.length)}}}return{range:i=r}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Wo(n,e){let t=xe(n).resolveInner(e+1);return t.parent&&t.from==e}function _p(n,e,t){let i=xe(n).resolveInner(e,-1);for(let s=0;s<5;s++){if(n.sliceDoc(i.from,i.from+t.length)==t){let o=i.firstChild;for(;o&&o.from==i.from&&o.to-o.from>t.length;){if(n.sliceDoc(o.to-t.length,o.to)==t)return!1;o=o.firstChild}return!0}let r=i.to==e&&i.parent;if(!r)break;i=r}return!1}function Qp(n={}){return[De,lt.of(n),Hp,Zp,Wp]}const xa=[{key:"Ctrl-Space",run:Ep},{key:"Escape",run:Ip},{key:"ArrowDown",run:Ri(!0)},{key:"ArrowUp",run:Ri(!1)},{key:"PageDown",run:Ri(!0,"page")},{key:"PageUp",run:Ri(!1,"page")},{key:"Enter",run:Lp}],Zp=Wt.highest(Ws.computeN([lt],n=>n.facet(lt).defaultKeymap?[xa]:[]));function eg(n){ka(n,"start");var e={},t=n.languageData||{},i=!1;for(var s in n)if(s!=t&&n.hasOwnProperty(s))for(var r=e[s]=[],o=n[s],l=0;l2&&o.token&&typeof o.token!="string"){t.pending=[];for(var a=2;a-1)return null;var s=t.indent.length-1,r=n[t.state];e:for(;;){for(var o=0;ot(11,s=C));const r=Ra();let{value:o=""}=e,{disabled:l=!1}=e,{placeholder:h=""}=e,{baseCollection:a=new Pa}=e,{singleLine:c=!1}=e,{extraAutocompleteKeys:f=[]}=e,{disableRequestKeys:u=!1}=e,{disableIndirectCollectionsKeys:d=!1}=e,p,g,y=new _e,b=new _e,v=new _e,A=new _e;function x(){p==null||p.focus()}function S(C){let E=C.slice();return kn.pushOrReplaceByKey(E,a,"id"),E}function D(){g==null||g.dispatchEvent(new CustomEvent("change",{detail:{value:o},bubbles:!0}))}function B(C,E="",P=0){let K=i.find(I=>I.name==C||I.id==C);if(!K||P>=4)return[];let q=[E+"id",E+"created",E+"updated"];for(const I of K.schema){const ne=E+I.name;if(I.type==="relation"&&I.options.collectionId){const de=B(I.options.collectionId,ne+".",P+1);de.length?q=q.concat(de):q.push(ne)}else q.push(ne)}return q}function U(C=!0,E=!0){let P=[].concat(f);const K=B(a.name);for(const q of K)P.push(q);if(C&&(P.push("@request.method"),P.push("@request.query."),P.push("@request.data."),P.push("@request.user.id"),P.push("@request.user.email"),P.push("@request.user.verified"),P.push("@request.user.created"),P.push("@request.user.updated")),C||E)for(const q of i){let I="";if(q.name==="profiles"){if(!C)continue;I="@request.user.profile."}else{if(!E)continue;I="@collection."+q.name+"."}const ne=B(q.name,I);for(const de of ne)P.push(de)}return P.sort(function(q,I){return I.length-q.length}),P}function N(C){let E=C.matchBefore(/[\@\w\.]*/);if(E.from==E.to&&!C.explicit)return null;let P=[{label:"null"},{label:"false"},{label:"true"}];d||P.push({label:"@collection.*",apply:"@collection."});const K=["@request.user.profile.id","@request.user.profile.userId","@request.user.profile.created","@request.user.profile.updated"],q=U(!u,!u&&E.text.startsWith("@c"));for(const I of q)K.includes(I)||P.push({label:I.endsWith(".")?I+"*":I,apply:I});return{from:E.from,options:P}}function L(){const C=[],E=U(!u,!d);for(const P of E){let K;P.endsWith(".")?K=kn.escapeRegExp(P)+"\\w+[\\w.]*":K=kn.escapeRegExp(P),C.push({regex:K,token:"keyword"})}return C}function W(){return Js.define(eg({start:[{regex:/true|false|null/,token:"atom"},{regex:/"(?:[^\\]|\\.)*?(?:"|$)/,token:"string"},{regex:/'(?:[^\\]|\\.)*?(?:'|$)/,token:"string"},{regex:/0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,token:"number"},{regex:/\&\&|\|\||\=|\!\=|\~|\!\~|\>|\<|\>\=|\<\=/,token:"operator"},{regex:/[\{\[\(]/,indent:!0},{regex:/[\}\]\)]/,dedent:!0}].concat(L())}))}La(()=>{const C={key:"Enter",run:E=>{c&&r("submit",o)}};return t(10,p=new O({parent:g,state:V.create({doc:o,extensions:[_f(),Pf(),Zu(),xf(),Mf(),V.allowMultipleSelections.of(!0),vu(Mu,{fallback:!0}),Lu(),zp(),qf(),Yd(),Ws.of([C,...jp,...jd,...dp,...hd,...xa]),O.lineWrapping,Qp({override:[N],icons:!1}),A.of(ro(h)),b.of(O.editable.of(!0)),v.of(V.readOnly.of(!1)),y.of(W()),V.transactionFilter.of(E=>c&&E.newDoc.lines>1?[]:E),O.updateListener.of(E=>{!E.docChanged||l||(t(1,o=E.state.doc.toString()),D())})]})})),()=>p==null?void 0:p.destroy()});function G(C){Ea[C?"unshift":"push"](()=>{g=C,t(0,g)})}return n.$$set=C=>{"value"in C&&t(1,o=C.value),"disabled"in C&&t(2,l=C.disabled),"placeholder"in C&&t(3,h=C.placeholder),"baseCollection"in C&&t(4,a=C.baseCollection),"singleLine"in C&&t(5,c=C.singleLine),"extraAutocompleteKeys"in C&&t(6,f=C.extraAutocompleteKeys),"disableRequestKeys"in C&&t(7,u=C.disableRequestKeys),"disableIndirectCollectionsKeys"in C&&t(8,d=C.disableIndirectCollectionsKeys)},n.$$.update=()=>{n.$$.dirty&2048&&(i=S(s)),n.$$.dirty&1040&&p&&(a==null?void 0:a.schema)&&p.dispatch({effects:[y.reconfigure(W())]}),n.$$.dirty&1028&&p&&typeof l!="undefined"&&p.dispatch({effects:[b.reconfigure(O.editable.of(!l)),v.reconfigure(V.readOnly.of(l))]}),n.$$.dirty&1026&&p&&o!=p.state.doc.toString()&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:o}}),n.$$.dirty&1032&&p&&typeof h!="undefined"&&p.dispatch({effects:[A.reconfigure(ro(h))]})},[g,o,l,h,a,c,f,u,d,x,p,s,G]}class cg extends Sa{constructor(e){super(),va(this,e,lg,og,Ca,{value:1,disabled:2,placeholder:3,baseCollection:4,singleLine:5,extraAutocompleteKeys:6,disableRequestKeys:7,disableIndirectCollectionsKeys:8,focus:9})}get focus(){return this.$$.ctx[9]}}export{cg as default}; diff --git a/ui/dist/assets/NotFoundPage.899a1d8c.js b/ui/dist/assets/NotFoundPage.20ca3d22.js similarity index 66% rename from ui/dist/assets/NotFoundPage.899a1d8c.js rename to ui/dist/assets/NotFoundPage.20ca3d22.js index 62b70cf8..d70ae5d2 100644 --- a/ui/dist/assets/NotFoundPage.899a1d8c.js +++ b/ui/dist/assets/NotFoundPage.20ca3d22.js @@ -1 +1 @@ -import{S as t,i as n,s as o,K as a}from"./index.a658f3b6.js";function l(e){return a("/collections"),[]}class c extends t{constructor(s){super(),n(this,s,l,null,o,{})}}export{c as default}; +import{S as t,i as n,s as o,K as a}from"./index.66a4e29c.js";function l(e){return a("/collections"),[]}class c extends t{constructor(s){super(),n(this,s,l,null,o,{})}}export{c as default}; diff --git a/ui/dist/assets/PageAdminConfirmPasswordReset.6f7f63d0.js b/ui/dist/assets/PageAdminConfirmPasswordReset.3443acd2.js similarity index 98% rename from ui/dist/assets/PageAdminConfirmPasswordReset.6f7f63d0.js rename to ui/dist/assets/PageAdminConfirmPasswordReset.3443acd2.js index 98d35b02..59113111 100644 --- a/ui/dist/assets/PageAdminConfirmPasswordReset.6f7f63d0.js +++ b/ui/dist/assets/PageAdminConfirmPasswordReset.3443acd2.js @@ -1,2 +1,2 @@ -import{S as I,i as K,s as L,F as W,f as F,m as H,n as B,o as J,q as N,H as M,D as q,e as c,g as u,h as b,j as _,E as O,p as w,z,d as k,A as D,B as T,C as Q,k as U,v as V,I as X,y as E,J as Y,K as Z,G as S}from"./index.a658f3b6.js";function G(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&O(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=T(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=T(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,C,v,P,A,h,m=f[3]&&G(f);return r=new z({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new z({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password +import{S as I,i as K,s as L,F as W,f as F,m as H,n as B,o as J,q as N,H as M,D as q,e as c,g as u,h as b,j as _,E as O,p as w,z,d as k,A as D,B as T,C as Q,k as U,v as V,I as X,y as E,J as Y,K as Z,G as S}from"./index.66a4e29c.js";function G(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&O(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=T(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=T(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,C,v,P,A,h,m=f[3]&&G(f);return r=new z({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new z({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password `),m&&m.c(),t=k(),F(r.$$.fragment),p=k(),F(d.$$.fragment),n=k(),i=c("button"),g=c("span"),g.textContent="Set new password",R=k(),C=c("div"),v=c("a"),v.textContent="Back to login",u(s,"class","m-b-xs"),u(o,"class","content txt-center m-b-sm"),u(g,"class","txt"),u(i,"type","submit"),u(i,"class","btn btn-lg btn-block"),i.disabled=f[2],D(i,"btn-loading",f[2]),u(e,"class","m-b-base"),u(v,"href","/login"),u(v,"class","link-hint"),u(C,"class","content txt-center")},m(a,$){b(a,e,$),_(e,o),_(o,s),_(s,l),m&&m.m(s,null),_(e,t),H(r,e,null),_(e,p),H(d,e,null),_(e,n),_(e,i),_(i,g),b(a,R,$),b(a,C,$),_(C,v),P=!0,A||(h=[T(e,"submit",Q(f[4])),U(V.call(null,v))],A=!0)},p(a,$){a[3]?m?m.p(a,$):(m=G(a),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const j={};$&769&&(j.$$scope={dirty:$,ctx:a}),r.$set(j);const y={};$&770&&(y.$$scope={dirty:$,ctx:a}),d.$set(y),(!P||$&4)&&(i.disabled=a[2]),$&4&&D(i,"btn-loading",a[2])},i(a){P||(B(r.$$.fragment,a),B(d.$$.fragment,a),P=!0)},o(a){J(r.$$.fragment,a),J(d.$$.fragment,a),P=!1},d(a){a&&w(e),m&&m.d(),N(r),N(d),a&&w(R),a&&w(C),A=!1,X(h)}}}function se(f){let e,o;return e=new W({props:{$$slots:{default:[te]},$$scope:{ctx:f}}}),{c(){F(e.$$.fragment)},m(s,l){H(e,s,l),o=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){o||(B(e.$$.fragment,s),o=!0)},o(s){J(e.$$.fragment,s),o=!1},d(s){N(e,s)}}}function le(f,e,o){let s,{params:l}=e,t="",r="",p=!1;async function d(){if(!p){o(2,p=!0);try{await E.Admins.confirmPasswordReset(l==null?void 0:l.token,t,r),Y("Successfully set a new admin password."),Z("/")}catch(g){E.errorResponseHandler(g)}o(2,p=!1)}}function n(){t=this.value,o(0,t)}function i(){r=this.value,o(1,r)}return f.$$set=g=>{"params"in g&&o(5,l=g.params)},f.$$.update=()=>{f.$$.dirty&32&&o(3,s=M.getJWTPayload(l==null?void 0:l.token).email||"")},[t,r,p,s,d,l,n,i]}class ae extends I{constructor(e){super(),K(this,e,le,se,L,{params:5})}}export{ae as default}; diff --git a/ui/dist/assets/PageAdminRequestPasswordReset.45866e03.js b/ui/dist/assets/PageAdminRequestPasswordReset.85272c89.js similarity index 98% rename from ui/dist/assets/PageAdminRequestPasswordReset.45866e03.js rename to ui/dist/assets/PageAdminRequestPasswordReset.85272c89.js index 624927e7..9954ffcf 100644 --- a/ui/dist/assets/PageAdminRequestPasswordReset.45866e03.js +++ b/ui/dist/assets/PageAdminRequestPasswordReset.85272c89.js @@ -1,2 +1,2 @@ -import{S,i as B,s as M,F as T,f as A,m as E,n as w,o as y,q as H,d as g,e as _,g as p,h as k,j as d,k as j,v as z,w as D,x as G,p as v,y as C,z as N,A as F,B as L,C as I,D as h,E as J,u as P,G as R}from"./index.a658f3b6.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new N({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`

Forgotten admin password

+import{S,i as B,s as M,F as T,f as A,m as E,n as w,o as y,q as H,d as g,e as _,g as p,h as k,j as d,k as j,v as z,w as D,x as G,p as v,y as C,z as N,A as F,B as L,C as I,D as h,E as J,u as P,G as R}from"./index.66a4e29c.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new N({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`

Forgotten admin password

Enter the email associated with your account and we\u2019ll send you a recovery link:

`,n=g(),A(l.$$.fragment),t=g(),o=_("button"),f=_("i"),m=g(),i=_("span"),i.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(f,"class","ri-mail-send-line"),p(i,"class","txt"),p(o,"type","submit"),p(o,"class","btn btn-lg btn-block"),o.disabled=c[1],F(o,"btn-loading",c[1]),p(e,"class","m-b-base")},m(r,$){k(r,e,$),d(e,s),d(e,n),E(l,e,null),d(e,t),d(e,o),d(o,f),d(o,m),d(o,i),a=!0,b||(u=L(e,"submit",I(c[3])),b=!0)},p(r,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:r}),l.$set(q),(!a||$&2)&&(o.disabled=r[1]),$&2&&F(o,"btn-loading",r[1])},i(r){a||(w(l.$$.fragment,r),a=!0)},o(r){y(l.$$.fragment,r),a=!1},d(r){r&&v(e),H(l),b=!1,u()}}}function O(c){let e,s,n,l,t,o,f,m,i;return{c(){e=_("div"),s=_("div"),s.innerHTML='',n=g(),l=_("div"),t=_("p"),o=h("Check "),f=_("strong"),m=h(c[0]),i=h(" for the recovery link."),p(s,"class","icon"),p(f,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){k(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,o),d(t,f),d(f,m),d(t,i)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&v(e)}}}function Q(c){let e,s,n,l,t,o,f,m;return{c(){e=_("label"),s=h("Email"),l=g(),t=_("input"),p(e,"for",n=c[5]),p(t,"type","email"),p(t,"id",o=c[5]),t.required=!0,t.autofocus=!0},m(i,a){k(i,e,a),d(e,s),k(i,l,a),k(i,t,a),R(t,c[0]),t.focus(),f||(m=L(t,"input",c[4]),f=!0)},p(i,a){a&32&&n!==(n=i[5])&&p(e,"for",n),a&32&&o!==(o=i[5])&&p(t,"id",o),a&1&&t.value!==i[0]&&R(t,i[0])},d(i){i&&v(e),i&&v(l),i&&v(t),f=!1,m()}}}function U(c){let e,s,n,l,t,o,f,m;const i=[O,K],a=[];function b(u,r){return u[2]?0:1}return e=b(c),s=a[e]=i[e](c),{c(){s.c(),n=g(),l=_("div"),t=_("a"),t.textContent="Back to login",p(t,"href","/login"),p(t,"class","link-hint"),p(l,"class","content txt-center")},m(u,r){a[e].m(u,r),k(u,n,r),k(u,l,r),d(l,t),o=!0,f||(m=j(z.call(null,t)),f=!0)},p(u,r){let $=e;e=b(u),e===$?a[e].p(u,r):(D(),y(a[$],1,1,()=>{a[$]=null}),G(),s=a[e],s?s.p(u,r):(s=a[e]=i[e](u),s.c()),w(s,1),s.m(n.parentNode,n))},i(u){o||(w(s),o=!0)},o(u){y(s),o=!1},d(u){a[e].d(u),u&&v(n),u&&v(l),f=!1,m()}}}function V(c){let e,s;return e=new T({props:{$$slots:{default:[U]},$$scope:{ctx:c}}}),{c(){A(e.$$.fragment)},m(n,l){E(e,n,l),s=!0},p(n,[l]){const t={};l&71&&(t.$$scope={dirty:l,ctx:n}),e.$set(t)},i(n){s||(w(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){H(e,n)}}}function W(c,e,s){let n="",l=!1,t=!1;async function o(){if(!l){s(1,l=!0);try{await C.Admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.errorResponseHandler(m)}s(1,l=!1)}}function f(){n=this.value,s(0,n)}return[n,l,t,o,f]}class Y extends S{constructor(e){super(),B(this,e,W,V,M,{})}}export{Y as default}; diff --git a/ui/dist/assets/PageUserConfirmEmailChange.a2624070.js b/ui/dist/assets/PageUserConfirmEmailChange.fa09e84a.js similarity index 98% rename from ui/dist/assets/PageUserConfirmEmailChange.a2624070.js rename to ui/dist/assets/PageUserConfirmEmailChange.fa09e84a.js index 88682453..47448a21 100644 --- a/ui/dist/assets/PageUserConfirmEmailChange.a2624070.js +++ b/ui/dist/assets/PageUserConfirmEmailChange.fa09e84a.js @@ -1,4 +1,4 @@ -import{S as z,i as A,s as B,F as D,f as S,m as U,n as $,o as v,q as j,H as G,L as J,h as _,w as M,x as N,p as b,y as P,D as y,e as m,g as d,j as g,E as R,z as W,d as C,A as F,B as E,C as Y,u as h,G as L}from"./index.a658f3b6.js";function I(r){let e,s,t,l,n,o,c,a,i,u,k,q,p=r[3]&&T(r);return o=new W({props:{class:"form-field required",name:"password",$$slots:{default:[O,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),s=m("div"),t=m("h4"),l=y(`Type your password to confirm changing your email address +import{S as z,i as A,s as B,F as D,f as S,m as U,n as $,o as v,q as j,H as G,L as J,h as _,w as M,x as N,p as b,y as P,D as y,e as m,g as d,j as g,E as R,z as W,d as C,A as F,B as E,C as Y,u as h,G as L}from"./index.66a4e29c.js";function I(r){let e,s,t,l,n,o,c,a,i,u,k,q,p=r[3]&&T(r);return o=new W({props:{class:"form-field required",name:"password",$$slots:{default:[O,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),s=m("div"),t=m("h4"),l=y(`Type your password to confirm changing your email address `),p&&p.c(),n=C(),S(o.$$.fragment),c=C(),a=m("button"),i=m("span"),i.textContent="Confirm new email",d(t,"class","m-b-xs"),d(s,"class","content txt-center m-b-sm"),d(i,"class","txt"),d(a,"type","submit"),d(a,"class","btn btn-lg btn-block"),a.disabled=r[1],F(a,"btn-loading",r[1])},m(f,w){_(f,e,w),g(e,s),g(s,t),g(t,l),p&&p.m(t,null),g(e,n),U(o,e,null),g(e,c),g(e,a),g(a,i),u=!0,k||(q=E(e,"submit",Y(r[4])),k=!0)},p(f,w){f[3]?p?p.p(f,w):(p=T(f),p.c(),p.m(t,null)):p&&(p.d(1),p=null);const H={};w&769&&(H.$$scope={dirty:w,ctx:f}),o.$set(H),(!u||w&2)&&(a.disabled=f[1]),w&2&&F(a,"btn-loading",f[1])},i(f){u||($(o.$$.fragment,f),u=!0)},o(f){v(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),j(o),k=!1,q()}}}function K(r){let e,s,t,l,n;return{c(){e=m("div"),e.innerHTML=`

Email address changed

You can now sign in with your new email address.

`,s=C(),t=m("button"),t.textContent="Close",d(e,"class","alert alert-success"),d(t,"type","button"),d(t,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,s,c),_(o,t,c),l||(n=E(t,"click",r[6]),l=!0)},p:h,i:h,o:h,d(o){o&&b(e),o&&b(s),o&&b(t),l=!1,n()}}}function T(r){let e,s,t;return{c(){e=y("to "),s=m("strong"),t=y(r[3]),d(s,"class","txt-nowrap")},m(l,n){_(l,e,n),_(l,s,n),g(s,t)},p(l,n){n&8&&R(t,l[3])},d(l){l&&b(e),l&&b(s)}}}function O(r){let e,s,t,l,n,o,c,a;return{c(){e=m("label"),s=y("Password"),l=C(),n=m("input"),d(e,"for",t=r[8]),d(n,"type","password"),d(n,"id",o=r[8]),n.required=!0,n.autofocus=!0},m(i,u){_(i,e,u),g(e,s),_(i,l,u),_(i,n,u),L(n,r[0]),n.focus(),c||(a=E(n,"input",r[7]),c=!0)},p(i,u){u&256&&t!==(t=i[8])&&d(e,"for",t),u&256&&o!==(o=i[8])&&d(n,"id",o),u&1&&n.value!==i[0]&&L(n,i[0])},d(i){i&&b(e),i&&b(l),i&&b(n),c=!1,a()}}}function Q(r){let e,s,t,l;const n=[K,I],o=[];function c(a,i){return a[2]?0:1}return e=c(r),s=o[e]=n[e](r),{c(){s.c(),t=J()},m(a,i){o[e].m(a,i),_(a,t,i),l=!0},p(a,i){let u=e;e=c(a),e===u?o[e].p(a,i):(M(),v(o[u],1,1,()=>{o[u]=null}),N(),s=o[e],s?s.p(a,i):(s=o[e]=n[e](a),s.c()),$(s,1),s.m(t.parentNode,t))},i(a){l||($(s),l=!0)},o(a){v(s),l=!1},d(a){o[e].d(a),a&&b(t)}}}function V(r){let e,s;return e=new D({props:{nobranding:!0,$$slots:{default:[Q]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(t,l){U(e,t,l),s=!0},p(t,[l]){const n={};l&527&&(n.$$scope={dirty:l,ctx:t}),e.$set(n)},i(t){s||($(e.$$.fragment,t),s=!0)},o(t){v(e.$$.fragment,t),s=!1},d(t){j(e,t)}}}function X(r,e,s){let t,{params:l}=e,n="",o=!1,c=!1;async function a(){if(!o){s(1,o=!0);try{await P.Users.confirmEmailChange(l==null?void 0:l.token,n),s(2,c=!0)}catch(k){P.errorResponseHandler(k)}s(1,o=!1)}}const i=()=>window.close();function u(){n=this.value,s(0,n)}return r.$$set=k=>{"params"in k&&s(5,l=k.params)},r.$$.update=()=>{r.$$.dirty&32&&s(3,t=G.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,t,a,l,i,u]}class x extends z{constructor(e){super(),A(this,e,X,V,B,{params:5})}}export{x as default}; diff --git a/ui/dist/assets/PageUserConfirmPasswordReset.6d56895b.js b/ui/dist/assets/PageUserConfirmPasswordReset.d7dcb527.js similarity index 98% rename from ui/dist/assets/PageUserConfirmPasswordReset.6d56895b.js rename to ui/dist/assets/PageUserConfirmPasswordReset.d7dcb527.js index 6794dfa5..e371221c 100644 --- a/ui/dist/assets/PageUserConfirmPasswordReset.6d56895b.js +++ b/ui/dist/assets/PageUserConfirmPasswordReset.d7dcb527.js @@ -1,4 +1,4 @@ -import{S as D,i as E,s as G,F as J,f as F,m as L,n as P,o as q,q as N,H as M,L as W,h as _,w as Y,x as I,p as m,y as j,D as y,e as b,j as w,E as K,z,d as C,g as c,A,B as R,C as O,u as h,G as H}from"./index.a658f3b6.js";function Q(r){let e,l,t,n,s,o,p,a,i,u,v,g,k,S,d=r[4]&&B(r);return o=new z({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),a=new z({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password +import{S as D,i as E,s as G,F as J,f as F,m as L,n as P,o as q,q as N,H as M,L as W,h as _,w as Y,x as I,p as m,y as j,D as y,e as b,j as w,E as K,z,d as C,g as c,A,B as R,C as O,u as h,G as H}from"./index.66a4e29c.js";function Q(r){let e,l,t,n,s,o,p,a,i,u,v,g,k,S,d=r[4]&&B(r);return o=new z({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),a=new z({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password `),d&&d.c(),s=C(),F(o.$$.fragment),p=C(),F(a.$$.fragment),i=C(),u=b("button"),v=b("span"),v.textContent="Set new password",c(t,"class","m-b-xs"),c(l,"class","content txt-center m-b-sm"),c(v,"class","txt"),c(u,"type","submit"),c(u,"class","btn btn-lg btn-block"),u.disabled=r[2],A(u,"btn-loading",r[2])},m(f,$){_(f,e,$),w(e,l),w(l,t),w(t,n),d&&d.m(t,null),w(e,s),L(o,e,null),w(e,p),L(a,e,null),w(e,i),w(e,u),w(u,v),g=!0,k||(S=R(e,"submit",O(r[5])),k=!0)},p(f,$){f[4]?d?d.p(f,$):(d=B(f),d.c(),d.m(t,null)):d&&(d.d(1),d=null);const T={};$&3073&&(T.$$scope={dirty:$,ctx:f}),o.$set(T);const U={};$&3074&&(U.$$scope={dirty:$,ctx:f}),a.$set(U),(!g||$&4)&&(u.disabled=f[2]),$&4&&A(u,"btn-loading",f[2])},i(f){g||(P(o.$$.fragment,f),P(a.$$.fragment,f),g=!0)},o(f){q(o.$$.fragment,f),q(a.$$.fragment,f),g=!1},d(f){f&&m(e),d&&d.d(),N(o),N(a),k=!1,S()}}}function V(r){let e,l,t,n,s;return{c(){e=b("div"),e.innerHTML=`

Password changed

You can now sign in with your new password.

`,l=C(),t=b("button"),t.textContent="Close",c(e,"class","alert alert-success"),c(t,"type","button"),c(t,"class","btn btn-secondary btn-block")},m(o,p){_(o,e,p),_(o,l,p),_(o,t,p),n||(s=R(t,"click",r[7]),n=!0)},p:h,i:h,o:h,d(o){o&&m(e),o&&m(l),o&&m(t),n=!1,s()}}}function B(r){let e,l,t;return{c(){e=y("for "),l=b("strong"),t=y(r[4])},m(n,s){_(n,e,s),_(n,l,s),w(l,t)},p(n,s){s&16&&K(t,n[4])},d(n){n&&m(e),n&&m(l)}}}function X(r){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password"),n=C(),s=b("input"),c(e,"for",t=r[10]),c(s,"type","password"),c(s,"id",o=r[10]),s.required=!0,s.autofocus=!0},m(i,u){_(i,e,u),w(e,l),_(i,n,u),_(i,s,u),H(s,r[0]),s.focus(),p||(a=R(s,"input",r[8]),p=!0)},p(i,u){u&1024&&t!==(t=i[10])&&c(e,"for",t),u&1024&&o!==(o=i[10])&&c(s,"id",o),u&1&&s.value!==i[0]&&H(s,i[0])},d(i){i&&m(e),i&&m(n),i&&m(s),p=!1,a()}}}function Z(r){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password confirm"),n=C(),s=b("input"),c(e,"for",t=r[10]),c(s,"type","password"),c(s,"id",o=r[10]),s.required=!0},m(i,u){_(i,e,u),w(e,l),_(i,n,u),_(i,s,u),H(s,r[1]),p||(a=R(s,"input",r[9]),p=!0)},p(i,u){u&1024&&t!==(t=i[10])&&c(e,"for",t),u&1024&&o!==(o=i[10])&&c(s,"id",o),u&2&&s.value!==i[1]&&H(s,i[1])},d(i){i&&m(e),i&&m(n),i&&m(s),p=!1,a()}}}function x(r){let e,l,t,n;const s=[V,Q],o=[];function p(a,i){return a[3]?0:1}return e=p(r),l=o[e]=s[e](r),{c(){l.c(),t=W()},m(a,i){o[e].m(a,i),_(a,t,i),n=!0},p(a,i){let u=e;e=p(a),e===u?o[e].p(a,i):(Y(),q(o[u],1,1,()=>{o[u]=null}),I(),l=o[e],l?l.p(a,i):(l=o[e]=s[e](a),l.c()),P(l,1),l.m(t.parentNode,t))},i(a){n||(P(l),n=!0)},o(a){q(l),n=!1},d(a){o[e].d(a),a&&m(t)}}}function ee(r){let e,l;return e=new J({props:{nobranding:!0,$$slots:{default:[x]},$$scope:{ctx:r}}}),{c(){F(e.$$.fragment)},m(t,n){L(e,t,n),l=!0},p(t,[n]){const s={};n&2079&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(P(e.$$.fragment,t),l=!0)},o(t){q(e.$$.fragment,t),l=!1},d(t){N(e,t)}}}function te(r,e,l){let t,{params:n}=e,s="",o="",p=!1,a=!1;async function i(){if(!p){l(2,p=!0);try{await j.Users.confirmPasswordReset(n==null?void 0:n.token,s,o),l(3,a=!0)}catch(k){j.errorResponseHandler(k)}l(2,p=!1)}}const u=()=>window.close();function v(){s=this.value,l(0,s)}function g(){o=this.value,l(1,o)}return r.$$set=k=>{"params"in k&&l(6,n=k.params)},r.$$.update=()=>{r.$$.dirty&64&&l(4,t=M.getJWTPayload(n==null?void 0:n.token).email||"")},[s,o,p,a,t,i,n,u,v,g]}class le extends D{constructor(e){super(),E(this,e,te,ee,G,{params:6})}}export{le as default}; diff --git a/ui/dist/assets/PageUserConfirmVerification.8d023a32.js b/ui/dist/assets/PageUserConfirmVerification.08b3f8a7.js similarity index 97% rename from ui/dist/assets/PageUserConfirmVerification.8d023a32.js rename to ui/dist/assets/PageUserConfirmVerification.08b3f8a7.js index 544e624b..c6ea4945 100644 --- a/ui/dist/assets/PageUserConfirmVerification.8d023a32.js +++ b/ui/dist/assets/PageUserConfirmVerification.08b3f8a7.js @@ -1,3 +1,3 @@ -import{S as k,i as v,s as y,F as w,f as x,m as C,n as g,o as L,q as $,y as H,L as M,h as r,p as a,e as u,d as m,g as f,B as _,u as p}from"./index.a658f3b6.js";function P(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`
+import{S as k,i as v,s as y,F as w,f as x,m as C,n as g,o as L,q as $,y as H,L as M,h as r,p as a,e as u,d as m,g as f,B as _,u as p}from"./index.66a4e29c.js";function P(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`

Invalid or expired verification token.

`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-danger"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,c){r(l,t,c),r(l,s,c),r(l,e,c),n||(i=_(e,"click",o[4]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function S(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`

Successfully verified email address.

`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-success"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,c){r(l,t,c),r(l,s,c),r(l,e,c),n||(i=_(e,"click",o[3]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function T(o){let t;return{c(){t=u("div"),t.innerHTML='
Please wait...
',f(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function q(o){let t;function s(i,l){return i[1]?T:i[0]?S:P}let e=s(o),n=e(o);return{c(){n.c(),t=M()},m(i,l){n.m(i,l),r(i,t,l)},p(i,l){e===(e=s(i))&&n?n.p(i,l):(n.d(1),n=e(i),n&&(n.c(),n.m(t.parentNode,t)))},d(i){n.d(i),i&&a(t)}}}function F(o){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[q]},$$scope:{ctx:o}}}),{c(){x(t.$$.fragment)},m(e,n){C(t,e,n),s=!0},p(e,[n]){const i={};n&67&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){s||(g(t.$$.fragment,e),s=!0)},o(e){L(t.$$.fragment,e),s=!1},d(e){$(t,e)}}}function U(o,t,s){let{params:e}=t,n=!1,i=!1;l();async function l(){s(1,i=!0);try{await H.Users.confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch(d){console.warn(d),s(0,n=!1)}s(1,i=!1)}const c=()=>window.close(),b=()=>window.close();return o.$$set=d=>{"params"in d&&s(2,e=d.params)},[n,i,e,c,b]}class B extends k{constructor(t){super(),v(this,t,U,F,y,{params:2})}}export{B as default}; diff --git a/ui/dist/assets/index.66a4e29c.js b/ui/dist/assets/index.66a4e29c.js new file mode 100644 index 00000000..f87e555b --- /dev/null +++ b/ui/dist/assets/index.66a4e29c.js @@ -0,0 +1,363 @@ +const Nb=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const r of l.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerpolicy&&(l.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?l.credentials="include":s.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}};Nb();function re(){}const zl=n=>n;function ct(n,e){for(const t in e)n[t]=e[t];return n}function Ng(n){return n()}function gf(){return Object.create(null)}function lt(n){n.forEach(Ng)}function Kn(n){return typeof n=="function"}function Pe(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let sr;function Qn(n,e){return sr||(sr=document.createElement("a")),sr.href=e,n===sr.href}function Rb(n){return Object.keys(n).length===0}function Rg(n,...e){if(n==null)return re;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function pn(n,e,t){n.$$.on_destroy.push(Rg(e,t))}function On(n,e,t,i){if(n){const s=jg(n,e,t,i);return n[0](s)}}function jg(n,e,t,i){return n[1]&&i?ct(t.ctx.slice(),n[1](i(e))):t.ctx}function Tn(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],r=Math.max(e.dirty.length,s.length);for(let o=0;o32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),gu=qg?n=>requestAnimationFrame(n):re;const Fs=new Set;function Vg(n){Fs.forEach(e=>{e.c(n)||(Fs.delete(e),e.f())}),Fs.size!==0&&gu(Vg)}function vo(n){let e;return Fs.size===0&&gu(Vg),{promise:new Promise(t=>{Fs.add(e={c:n,f:t})}),abort(){Fs.delete(e)}}}function m(n,e){n.appendChild(e)}function zg(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function jb(n){const e=_("style");return Hb(zg(n),e),e.sheet}function Hb(n,e){m(n.head||n,e)}function w(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode.removeChild(n)}function zn(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function Jt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function Bn(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function Bg(n){return function(e){e.target===this&&n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function fi(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set?n[i]=e[i]:p(n,i,e[i])}function Tt(n){return n===""?null:+n}function qb(n){return Array.from(n.childNodes)}function _e(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function $e(n,e){n.value=e==null?"":e}function bf(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ne(n,e,t){n.classList[t?"add":"remove"](e)}function Ug(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const Jr=new Map;let xr=0;function Vb(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function zb(n,e){const t={stylesheet:jb(e),rules:{}};return Jr.set(n,t),t}function El(n,e,t,i,s,l,r,o=0){const a=16.666/i;let u=`{ +`;for(let b=0;b<=1;b+=a){const v=e+(t-e)*l(b);u+=b*100+`%{${r(v,1-v)}} +`}const f=u+`100% {${r(t,1-t)}} +}`,c=`__svelte_${Vb(f)}_${o}`,d=zg(n),{stylesheet:h,rules:g}=Jr.get(d)||zb(d,n);g[c]||(g[c]=!0,h.insertRule(`@keyframes ${c} ${f}`,h.cssRules.length));const y=n.style.animation||"";return n.style.animation=`${y?`${y}, `:""}${c} ${i}ms linear ${s}ms 1 both`,xr+=1,c}function Pl(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),xr-=s,xr||Bb())}function Bb(){gu(()=>{xr||(Jr.forEach(n=>{const{stylesheet:e}=n;let t=e.cssRules.length;for(;t--;)e.deleteRule(t);n.rules={}}),Jr.clear())})}function Ub(n,e,t,i){if(!e)return re;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return re;const{delay:l=0,duration:r=300,easing:o=zl,start:a=yo()+l,end:u=a+r,tick:f=re,css:c}=t(n,{from:e,to:s},i);let d=!0,h=!1,g;function y(){c&&(g=El(n,0,1,r,l,o,c)),l||(h=!0)}function b(){c&&Pl(n,g),d=!1}return vo(v=>{if(!h&&v>=a&&(h=!0),h&&v>=u&&(f(1,0),b()),!d)return!1;if(h){const S=v-a,C=0+1*o(S/r);f(C,1-C)}return!0}),y(),f(0,1),b}function Wb(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Wg(n,s)}}function Wg(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let Ll;function kl(n){Ll=n}function ko(){if(!Ll)throw new Error("Function called outside component initialization");return Ll}function di(n){ko().$$.on_mount.push(n)}function Yb(n){ko().$$.after_update.push(n)}function Kb(n){ko().$$.on_destroy.push(n)}function vn(){const n=ko();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=Ug(e,t,{cancelable:i});return s.slice().forEach(r=>{r.call(n,l)}),!l.defaultPrevented}return!0}}function ut(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const ml=[],he=[],Nr=[],Da=[],Yg=Promise.resolve();let Aa=!1;function Kg(){Aa||(Aa=!0,Yg.then(Jg))}function Ui(){return Kg(),Yg}function Dt(n){Nr.push(n)}function Re(n){Da.push(n)}const No=new Set;let lr=0;function Jg(){const n=Ll;do{for(;lr{el=null})),el}function us(n,e,t){n.dispatchEvent(Ug(`${e?"intro":"outro"}${t}`))}const Rr=new Set;let oi;function Te(){oi={r:0,c:[],p:oi}}function De(){oi.r||lt(oi.c),oi=oi.p}function E(n,e){n&&n.i&&(Rr.delete(n),n.i(e))}function F(n,e,t,i){if(n&&n.o){if(Rr.has(n))return;Rr.add(n),oi.c.push(()=>{Rr.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const bu={duration:0};function yu(n,e,t){let i=e(n,t),s=!1,l,r,o=0;function a(){l&&Pl(n,l)}function u(){const{delay:c=0,duration:d=300,easing:h=zl,tick:g=re,css:y}=i||bu;y&&(l=El(n,0,1,d,c,h,y,o++)),g(0,1);const b=yo()+c,v=b+d;r&&r.abort(),s=!0,Dt(()=>us(n,!0,"start")),r=vo(S=>{if(s){if(S>=v)return g(1,0),us(n,!0,"end"),a(),s=!1;if(S>=b){const C=h((S-b)/d);g(C,1-C)}}return s})}let f=!1;return{start(){f||(f=!0,Pl(n),Kn(i)?(i=i(),_u().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function xg(n,e,t){let i=e(n,t),s=!0,l;const r=oi;r.r+=1;function o(){const{delay:a=0,duration:u=300,easing:f=zl,tick:c=re,css:d}=i||bu;d&&(l=El(n,1,0,u,a,f,d));const h=yo()+a,g=h+u;Dt(()=>us(n,!1,"start")),vo(y=>{if(s){if(y>=g)return c(0,1),us(n,!1,"end"),--r.r||lt(r.c),!1;if(y>=h){const b=f((y-h)/u);c(1-b,b)}}return s})}return Kn(i)?_u().then(()=>{i=i(),o()}):o(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&Pl(n,l),s=!1)}}}function ft(n,e,t,i){let s=e(n,t),l=i?0:1,r=null,o=null,a=null;function u(){a&&Pl(n,a)}function f(d,h){const g=d.b-l;return h*=Math.abs(g),{a:l,b:d.b,d:g,duration:h,start:d.start,end:d.start+h,group:d.group}}function c(d){const{delay:h=0,duration:g=300,easing:y=zl,tick:b=re,css:v}=s||bu,S={start:yo()+h,b:d};d||(S.group=oi,oi.r+=1),r||o?o=S:(v&&(u(),a=El(n,l,d,g,h,y,v)),d&&b(0,1),r=f(S,g),Dt(()=>us(n,d,"start")),vo(C=>{if(o&&C>o.start&&(r=f(o,g),o=null,us(n,r.b,"start"),v&&(u(),a=El(n,l,r.b,r.duration,0,y,s.css))),r){if(C>=r.end)b(l=r.b,1-l),us(n,r.b,"end"),o||(r.b?u():--r.group.r||lt(r.group.c)),r=null;else if(C>=r.start){const M=C-r.start;l=r.a+r.d*y(M/r.duration),b(l,1-l)}}return!!(r||o)}))}return{run(d){Kn(s)?_u().then(()=>{s=s(),c(d)}):c(d)},end(){u(),r=o=null}}}function an(n,e){n.d(1),e.delete(n.key)}function Lt(n,e){F(n,1,1,()=>{e.delete(n.key)})}function xb(n,e){n.f(),Lt(n,e)}function ot(n,e,t,i,s,l,r,o,a,u,f,c){let d=n.length,h=l.length,g=d;const y={};for(;g--;)y[n[g].key]=g;const b=[],v=new Map,S=new Map;for(g=h;g--;){const T=c(s,l,g),A=t(T);let D=r.get(A);D?i&&D.p(T,e):(D=u(A,T),D.c()),v.set(A,b[g]=D),A in y&&S.set(A,Math.abs(g-y[A]))}const C=new Set,M=new Set;function $(T){E(T,1),T.m(o,f),r.set(T.key,T),f=T.first,h--}for(;d&&h;){const T=b[h-1],A=n[d-1],D=T.key,P=A.key;T===A?(f=T.first,d--,h--):v.has(P)?!r.has(D)||C.has(D)?$(T):M.has(P)?d--:S.get(D)>S.get(P)?(M.add(D),$(T)):(C.add(P),d--):(a(A,r),d--)}for(;d--;){const T=n[d];v.has(T.key)||a(T,r)}for(;h;)$(b[h-1]);return b}function gn(n,e){const t={},i={},s={$$scope:1};let l=n.length;for(;l--;){const r=n[l],o=e[l];if(o){for(const a in r)a in o||(i[a]=1);for(const a in o)s[a]||(t[a]=o[a],s[a]=1);n[l]=o}else for(const a in r)s[a]=1}for(const r in i)r in t||(t[r]=void 0);return t}function pi(n){return typeof n=="object"&&n!==null?n:{}}function Fe(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function B(n){n&&n.c()}function V(n,e,t,i){const{fragment:s,on_mount:l,on_destroy:r,after_update:o}=n.$$;s&&s.m(e,t),i||Dt(()=>{const a=l.map(Ng).filter(Kn);r?r.push(...a):lt(a),n.$$.on_mount=[]}),o.forEach(Dt)}function z(n,e){const t=n.$$;t.fragment!==null&&(lt(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Gb(n,e){n.$$.dirty[0]===-1&&(ml.push(n),Kg(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const g=h.length?h[0]:d;return u.ctx&&s(u.ctx[c],u.ctx[c]=g)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](g),f&&Gb(n,c)),d}):[],u.update(),f=!0,lt(u.before_update),u.fragment=i?i(u.ctx):!1,e.target){if(e.hydrate){const c=qb(e.target);u.fragment&&u.fragment.l(c),c.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&E(n.$$.fragment),V(n,e.target,e.anchor,e.customElement),Jg()}kl(a)}class Ne{$destroy(){z(this,1),this.$destroy=re}$on(e,t){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!Rb(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Zt(n){if(!n)throw Error("Parameter args is required");if(!n.component==!n.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(n.component&&(n.asyncComponent=()=>Promise.resolve(n.component)),typeof n.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(n.conditions){Array.isArray(n.conditions)||(n.conditions=[n.conditions]);for(let t=0;t{i.delete(u),i.size===0&&(t(),t=null)}}return{set:s,update:l,subscribe:r}}function Zg(n,e,t){const i=!Array.isArray(n),s=i?[n]:n,l=e.length<2;return Gg(t,r=>{let o=!1;const a=[];let u=0,f=re;const c=()=>{if(u)return;f();const h=e(i?a[0]:a,r);l?r(h):f=Kn(h)?h:re},d=s.map((h,g)=>Rg(h,y=>{a[g]=y,u&=~(1<{u|=1<{z(f,1)}),De()}l?(e=new l(r()),e.$on("routeEvent",o[7]),B(e.$$.fragment),E(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&F(e.$$.fragment,o),i=!1},d(o){o&&k(t),e&&z(e,o)}}}function Xb(n){let e,t,i;const s=[{params:n[1]},n[2]];var l=n[0];function r(o){let a={};for(let u=0;u{z(f,1)}),De()}l?(e=new l(r()),e.$on("routeEvent",o[6]),B(e.$$.fragment),E(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&F(e.$$.fragment,o),i=!1},d(o){o&&k(t),e&&z(e,o)}}}function Qb(n){let e,t,i,s;const l=[Xb,Zb],r=[];function o(a,u){return a[1]?0:1}return e=o(n),t=r[e]=l[e](n),{c(){t.c(),i=rt()},m(a,u){r[e].m(a,u),w(a,i,u),s=!0},p(a,[u]){let f=e;e=o(a),e===f?r[e].p(a,u):(Te(),F(r[f],1,1,()=>{r[f]=null}),De(),t=r[e],t?t.p(a,u):(t=r[e]=l[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){s||(E(t),s=!0)},o(a){F(t),s=!1},d(a){r[e].d(a),a&&k(i)}}}function yf(){const n=window.location.href.indexOf("#/");let e=n>-1?window.location.href.substr(n+1):"/";const t=e.indexOf("?");let i="";return t>-1&&(i=e.substr(t+1),e=e.substr(0,t)),{location:e,querystring:i}}const wo=Gg(null,function(e){e(yf());const t=()=>{e(yf())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});Zg(wo,n=>n.location);Zg(wo,n=>n.querystring);const vf=$i(void 0);async function So(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await Ui();const e=(n.charAt(0)=="#"?"":"#")+n;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function Mn(n,e){if(e=wf(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with
tags');return kf(n,e),{update(t){t=wf(t),kf(n,t)}}}function kf(n,e){let t=e.href||n.getAttribute("href");if(t&&t.charAt(0)=="/")t="#"+t;else if(!t||t.length<2||t.slice(0,2)!="#/")throw Error('Invalid value for "href" attribute: '+t);n.setAttribute("href",t),n.addEventListener("click",i=>{i.preventDefault(),e.disabled||e1(i.currentTarget.getAttribute("href"))})}function wf(n){return n&&typeof n=="string"?{href:n}:n||{}}function e1(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0,void 0),window.location.hash=n}function t1(n,e,t){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:l=!1}=e;class r{constructor($,T){if(!T||typeof T!="function"&&(typeof T!="object"||T._sveltesparouter!==!0))throw Error("Invalid component object");if(!$||typeof $=="string"&&($.length<1||$.charAt(0)!="/"&&$.charAt(0)!="*")||typeof $=="object"&&!($ instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:A,keys:D}=Xg($);this.path=$,typeof T=="object"&&T._sveltesparouter===!0?(this.component=T.component,this.conditions=T.conditions||[],this.userData=T.userData,this.props=T.props||{}):(this.component=()=>Promise.resolve(T),this.conditions=[],this.props={}),this._pattern=A,this._keys=D}match($){if(s){if(typeof s=="string")if($.startsWith(s))$=$.substr(s.length)||"/";else return null;else if(s instanceof RegExp){const P=$.match(s);if(P&&P[0])$=$.substr(P[0].length)||"/";else return null}}const T=this._pattern.exec($);if(T===null)return null;if(this._keys===!1)return T;const A={};let D=0;for(;D{o.push(new r($,M))}):Object.keys(i).forEach(M=>{o.push(new r(M,i[M]))});let a=null,u=null,f={};const c=vn();async function d(M,$){await Ui(),c(M,$)}let h=null,g=null;l&&(g=M=>{M.state&&M.state.__svelte_spa_router_scrollY?h=M.state:h=null},window.addEventListener("popstate",g),Yb(()=>{h?window.scrollTo(h.__svelte_spa_router_scrollX,h.__svelte_spa_router_scrollY):window.scrollTo(0,0)}));let y=null,b=null;const v=wo.subscribe(async M=>{y=M;let $=0;for(;${vf.set(u)});return}t(0,a=null),b=null,vf.set(void 0)});Kb(()=>{v(),g&&window.removeEventListener("popstate",g)});function S(M){ut.call(this,n,M)}function C(M){ut.call(this,n,M)}return n.$$set=M=>{"routes"in M&&t(3,i=M.routes),"prefix"in M&&t(4,s=M.prefix),"restoreScrollState"in M&&t(5,l=M.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=l?"manual":"auto")},[a,u,f,i,s,l,S,C]}class n1 extends Ne{constructor(e){super(),Ie(this,e,t1,Qb,Pe,{routes:3,prefix:4,restoreScrollState:5})}}const jr=[];let Qg;function e_(n){const e=n.pattern.test(Qg);Sf(n,n.className,e),Sf(n,n.inactiveClassName,!e)}function Sf(n,e,t){(e||"").split(" ").forEach(i=>{!i||(n.node.classList.remove(i),t&&n.node.classList.add(i))})}wo.subscribe(n=>{Qg=n.location+(n.querystring?"?"+n.querystring:""),jr.map(e_)});function ri(n,e){if(e&&(typeof e=="string"||typeof e=="object"&&e instanceof RegExp)?e={path:e}:e=e||{},!e.path&&n.hasAttribute("href")&&(e.path=n.getAttribute("href"),e.path&&e.path.length>1&&e.path.charAt(0)=="#"&&(e.path=e.path.substring(1))),e.className||(e.className="active"),!e.path||typeof e.path=="string"&&(e.path.length<1||e.path.charAt(0)!="/"&&e.path.charAt(0)!="*"))throw Error('Invalid value for "path" argument');const{pattern:t}=typeof e.path=="string"?Xg(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return jr.push(i),e_(i),{destroy(){jr.splice(jr.indexOf(i),1)}}}const i1="modulepreload",Cf={},s1="/_/",bi=function(e,t){return!t||t.length===0?e():Promise.all(t.map(i=>{if(i=`${s1}${i}`,i in Cf)return;Cf[i]=!0;const s=i.endsWith(".css"),l=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${l}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":i1,s||(r.as="script",r.crossOrigin=""),r.href=i,document.head.appendChild(r),s)return new Promise((o,a)=>{r.addEventListener("load",o),r.addEventListener("error",()=>a(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e())};function l1(n){if(n.__esModule)return n;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(t){var i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return n[t]}})}),e}var Ea={exports:{}},t_=function(n,e){return function(){for(var t=new Array(arguments.length),i=0;i=0)return;s[e]=e==="set-cookie"?(s[e]?s[e]:[]).concat([t]):s[e]?s[e]+", "+t:t}}),s},w1=g1,qo=s_,S1=function(n){return new Promise(function(e,t){var i=n.data,s=n.headers,l=n.responseType;ar.isFormData(i)&&delete s["Content-Type"];var r=new XMLHttpRequest;if(n.auth){var o=n.auth.username||"",a=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.Authorization="Basic "+btoa(o+":"+a)}var u=v1(n.baseURL,n.url);function f(){if(r){var d="getAllResponseHeaders"in r?k1(r.getAllResponseHeaders()):null,h={data:l&&l!=="text"&&l!=="json"?r.response:r.responseText,status:r.status,statusText:r.statusText,headers:d,config:n,request:r};_1(e,t,h),r=null}}if(r.open(n.method.toUpperCase(),y1(u,n.params,n.paramsSerializer),!0),r.timeout=n.timeout,"onloadend"in r?r.onloadend=f:r.onreadystatechange=function(){r&&r.readyState===4&&(r.status!==0||r.responseURL&&r.responseURL.indexOf("file:")===0)&&setTimeout(f)},r.onabort=function(){r&&(t(qo("Request aborted",n,"ECONNABORTED",r)),r=null)},r.onerror=function(){t(qo("Network Error",n,null,r)),r=null},r.ontimeout=function(){var d="timeout of "+n.timeout+"ms exceeded";n.timeoutErrorMessage&&(d=n.timeoutErrorMessage),t(qo(d,n,n.transitional&&n.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",r)),r=null},ar.isStandardBrowserEnv()){var c=(n.withCredentials||w1(u))&&n.xsrfCookieName?b1.read(n.xsrfCookieName):void 0;c&&(s[n.xsrfHeaderName]=c)}"setRequestHeader"in r&&ar.forEach(s,function(d,h){i===void 0&&h.toLowerCase()==="content-type"?delete s[h]:r.setRequestHeader(h,d)}),ar.isUndefined(n.withCredentials)||(r.withCredentials=!!n.withCredentials),l&&l!=="json"&&(r.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&r.addEventListener("progress",n.onDownloadProgress),typeof n.onUploadProgress=="function"&&r.upload&&r.upload.addEventListener("progress",n.onUploadProgress),n.cancelToken&&n.cancelToken.promise.then(function(d){r&&(r.abort(),t(d),r=null)}),i||(i=null),r.send(i)})},Qt=Ln,Df=function(n,e){u1.forEach(n,function(t,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(n[e]=t,delete n[i])})},C1=i_,M1={"Content-Type":"application/x-www-form-urlencoded"};function Af(n,e){!Qt.isUndefined(n)&&Qt.isUndefined(n["Content-Type"])&&(n["Content-Type"]=e)}var Ef,qr={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(Ef=S1),Ef),transformRequest:[function(n,e){return Df(e,"Accept"),Df(e,"Content-Type"),Qt.isFormData(n)||Qt.isArrayBuffer(n)||Qt.isBuffer(n)||Qt.isStream(n)||Qt.isFile(n)||Qt.isBlob(n)?n:Qt.isArrayBufferView(n)?n.buffer:Qt.isURLSearchParams(n)?(Af(e,"application/x-www-form-urlencoded;charset=utf-8"),n.toString()):Qt.isObject(n)||e&&e["Content-Type"]==="application/json"?(Af(e,"application/json"),function(t,i,s){if(Qt.isString(t))try{return(i||JSON.parse)(t),Qt.trim(t)}catch(l){if(l.name!=="SyntaxError")throw l}return(s||JSON.stringify)(t)}(n)):n}],transformResponse:[function(n){var e=this.transitional,t=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!t&&this.responseType==="json";if(s||i&&Qt.isString(n)&&n.length)try{return JSON.parse(n)}catch(l){if(s)throw l.name==="SyntaxError"?C1(l,this,"E_JSON_PARSE"):l}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(n){return n>=200&&n<300}};qr.headers={common:{Accept:"application/json, text/plain, */*"}},Qt.forEach(["delete","get","head"],function(n){qr.headers[n]={}}),Qt.forEach(["post","put","patch"],function(n){qr.headers[n]=Qt.merge(M1)});var vu=qr,$1=Ln,O1=vu,l_=function(n){return!(!n||!n.__CANCEL__)},Pf=Ln,Vo=function(n,e,t){var i=this||O1;return $1.forEach(t,function(s){n=s.call(i,n,e)}),n},T1=l_,D1=vu;function zo(n){n.cancelToken&&n.cancelToken.throwIfRequested()}var sn=Ln,r_=function(n,e){e=e||{};var t={},i=["url","method","data"],s=["headers","auth","proxy","params"],l=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],r=["validateStatus"];function o(c,d){return sn.isPlainObject(c)&&sn.isPlainObject(d)?sn.merge(c,d):sn.isPlainObject(d)?sn.merge({},d):sn.isArray(d)?d.slice():d}function a(c){sn.isUndefined(e[c])?sn.isUndefined(n[c])||(t[c]=o(void 0,n[c])):t[c]=o(n[c],e[c])}sn.forEach(i,function(c){sn.isUndefined(e[c])||(t[c]=o(void 0,e[c]))}),sn.forEach(s,a),sn.forEach(l,function(c){sn.isUndefined(e[c])?sn.isUndefined(n[c])||(t[c]=o(void 0,n[c])):t[c]=o(void 0,e[c])}),sn.forEach(r,function(c){c in e?t[c]=o(n[c],e[c]):c in n&&(t[c]=o(void 0,n[c]))});var u=i.concat(s).concat(l).concat(r),f=Object.keys(n).concat(Object.keys(e)).filter(function(c){return u.indexOf(c)===-1});return sn.forEach(f,a),t},o_={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},ku={};["object","boolean","number","function","string","symbol"].forEach(function(n,e){ku[n]=function(t){return typeof t===n||"a"+(e<1?"n ":" ")+n}});var Lf={},A1=o_.version.split(".");function a_(n,e){for(var t=e?e.split("."):A1,i=n.split("."),s=0;s<3;s++){if(t[s]>i[s])return!0;if(t[s]0;){var l=i[s],r=e[l];if(r){var o=n[l],a=o===void 0||r(o,l,n);if(a!==!0)throw new TypeError("option "+l+" must be "+a)}else if(t!==!0)throw Error("Unknown option "+l)}},validators:ku},Ff=Ln,P1=n_,If=a1,Nf=function(n){return zo(n),n.headers=n.headers||{},n.data=Vo.call(n,n.data,n.headers,n.transformRequest),n.headers=Pf.merge(n.headers.common||{},n.headers[n.method]||{},n.headers),Pf.forEach(["delete","get","head","post","put","patch","common"],function(e){delete n.headers[e]}),(n.adapter||D1.adapter)(n).then(function(e){return zo(n),e.data=Vo.call(n,e.data,e.headers,n.transformResponse),e},function(e){return T1(e)||(zo(n),e&&e.response&&(e.response.data=Vo.call(n,e.response.data,e.response.headers,n.transformResponse))),Promise.reject(e)})},ur=r_,u_=E1,$s=u_.validators;function gl(n){this.defaults=n,this.interceptors={request:new If,response:new If}}gl.prototype.request=function(n){typeof n=="string"?(n=arguments[1]||{}).url=arguments[0]:n=n||{},(n=ur(this.defaults,n)).method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var e=n.transitional;e!==void 0&&u_.assertOptions(e,{silentJSONParsing:$s.transitional($s.boolean,"1.0.0"),forcedJSONParsing:$s.transitional($s.boolean,"1.0.0"),clarifyTimeoutError:$s.transitional($s.boolean,"1.0.0")},!1);var t=[],i=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(n)===!1||(i=i&&f.synchronous,t.unshift(f.fulfilled,f.rejected))});var s,l=[];if(this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)}),!i){var r=[Nf,void 0];for(Array.prototype.unshift.apply(r,t),r=r.concat(l),s=Promise.resolve(n);r.length;)s=s.then(r.shift(),r.shift());return s}for(var o=n;t.length;){var a=t.shift(),u=t.shift();try{o=a(o)}catch(f){u(f);break}}try{s=Nf(o)}catch(f){return Promise.reject(f)}for(;l.length;)s=s.then(l.shift(),l.shift());return s},gl.prototype.getUri=function(n){return n=ur(this.defaults,n),P1(n.url,n.params,n.paramsSerializer).replace(/^\?/,"")},Ff.forEach(["delete","get","head","options"],function(n){gl.prototype[n]=function(e,t){return this.request(ur(t||{},{method:n,url:e,data:(t||{}).data}))}}),Ff.forEach(["post","put","patch"],function(n){gl.prototype[n]=function(e,t,i){return this.request(ur(i||{},{method:n,url:e,data:t}))}});var L1=gl;function La(n){this.message=n}La.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},La.prototype.__CANCEL__=!0;var f_=La,F1=f_;function Vr(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;n(function(i){t.reason||(t.reason=new F1(i),e(t.reason))})}Vr.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Vr.source=function(){var n;return{token:new Vr(function(e){n=e}),cancel:n}};var I1=Vr,Rf=Ln,N1=t_,zr=L1,R1=r_;function c_(n){var e=new zr(n),t=N1(zr.prototype.request,e);return Rf.extend(t,zr.prototype,e),Rf.extend(t,e),t}var Jn=c_(vu);Jn.Axios=zr,Jn.create=function(n){return c_(R1(Jn.defaults,n))},Jn.Cancel=f_,Jn.CancelToken=I1,Jn.isCancel=l_,Jn.all=function(n){return Promise.all(n)},Jn.spread=function(n){return function(e){return n.apply(null,e)}},Jn.isAxiosError=function(n){return typeof n=="object"&&n.isAxiosError===!0},Ea.exports=Jn,Ea.exports.default=Jn;var Bo=Ea.exports,jf=typeof Symbol!="undefined"&&Symbol,j1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},e=Symbol("test"),t=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(t)!=="[object Symbol]")return!1;for(e in n[e]=42,n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var i=Object.getOwnPropertySymbols(n);if(i.length!==1||i[0]!==e||!Object.prototype.propertyIsEnumerable.call(n,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(n,e);if(s.value!==42||s.enumerable!==!0)return!1}return!0},H1="Function.prototype.bind called on incompatible ",Uo=Array.prototype.slice,q1=Object.prototype.toString,V1=function(n){var e=this;if(typeof e!="function"||q1.call(e)!=="[object Function]")throw new TypeError(H1+e);for(var t,i=Uo.call(arguments,1),s=function(){if(this instanceof t){var u=e.apply(this,i.concat(Uo.call(arguments)));return Object(u)===u?u:this}return e.apply(n,i.concat(Uo.call(arguments)))},l=Math.max(0,e.length-i.length),r=[],o=0;o1&&typeof e!="boolean")throw new Is('"allowMissing" argument must be a boolean');if(J1(/^%?[^%]*%?$/g,n)===null)throw new Vs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=Z1(n),i=t.length>0?t[0]:"",s=X1("%"+i+"%",e),l=s.name,r=s.value,o=!1,a=s.alias;a&&(i=a[0],K1(t,Y1([0,1],a)));for(var u=1,f=!0;u=t.length){var g=fs(r,c);r=(f=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:r[c]}else f=Gr(r,c),r=r[c];f&&!o&&(Ns[l]=r)}}return r},p_={exports:{}};(function(n){var e=wu,t=Su,i=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(s,i),r=t("%Object.getOwnPropertyDescriptor%",!0),o=t("%Object.defineProperty%",!0),a=t("%Math.max%");if(o)try{o({},"a",{value:1})}catch{o=null}n.exports=function(f){var c=l(e,s,arguments);if(r&&o){var d=r(c,"length");d.configurable&&o(c,"length",{value:1+a(0,f.length-(arguments.length-1))})}return c};var u=function(){return l(e,i,arguments)};o?o(n.exports,"apply",{value:u}):n.exports.apply=u})(p_);var h_=Su,m_=p_.exports,Q1=m_(h_("String.prototype.indexOf")),ey=l1(Object.freeze({__proto__:null,default:{}})),Cu=typeof Map=="function"&&Map.prototype,Ko=Object.getOwnPropertyDescriptor&&Cu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,fr=Cu&&Ko&&typeof Ko.get=="function"?Ko.get:null,ty=Cu&&Map.prototype.forEach,Mu=typeof Set=="function"&&Set.prototype,Jo=Object.getOwnPropertyDescriptor&&Mu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,cr=Mu&&Jo&&typeof Jo.get=="function"?Jo.get:null,ny=Mu&&Set.prototype.forEach,tl=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap.prototype.has:null,nl=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet.prototype.has:null,Vf=typeof WeakRef=="function"&&WeakRef.prototype?WeakRef.prototype.deref:null,iy=Boolean.prototype.valueOf,sy=Object.prototype.toString,ly=Function.prototype.toString,ry=String.prototype.match,$u=String.prototype.slice,Ri=String.prototype.replace,oy=String.prototype.toUpperCase,zf=String.prototype.toLowerCase,g_=RegExp.prototype.test,Bf=Array.prototype.concat,li=Array.prototype.join,ay=Array.prototype.slice,Uf=Math.floor,xo=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Go=Object.getOwnPropertySymbols,Fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,zs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ln=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===zs||"symbol")?Symbol.toStringTag:null,__=Object.prototype.propertyIsEnumerable,Wf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Yf(n,e){if(n===1/0||n===-1/0||n!=n||n&&n>-1e3&&n<1e3||g_.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var i=n<0?-Uf(-n):Uf(n);if(i!==n){var s=String(i),l=$u.call(e,s.length+1);return Ri.call(s,t,"$&_")+"."+Ri.call(Ri.call(l,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ri.call(e,t,"$&_")}var Ia=ey,Kf=Ia.custom,Jf=y_(Kf)?Kf:null;function b_(n,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+n+i}function uy(n){return Ri.call(String(n),/"/g,""")}function Na(n){return!(Li(n)!=="[object Array]"||ln&&typeof n=="object"&&ln in n)}function xf(n){return!(Li(n)!=="[object RegExp]"||ln&&typeof n=="object"&&ln in n)}function y_(n){if(zs)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Fa)return!1;try{return Fa.call(n),!0}catch{}return!1}var fy=Object.prototype.hasOwnProperty||function(n){return n in this};function Pi(n,e){return fy.call(n,e)}function Li(n){return sy.call(n)}function Gf(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,i=n.length;te.maxStringLength){var t=n.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return v_($u.call(n,0,e.maxStringLength),e)+i}return b_(Ri.call(Ri.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,cy),"single",e)}function cy(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+oy.call(e.toString(16))}function il(n){return"Object("+n+")"}function Zo(n){return n+" { ? }"}function Zf(n,e,t,i){return n+" ("+e+") {"+(i?Ra(t,i):li.call(t,", "))+"}"}function Ra(n,e){if(n.length===0)return"";var t=` +`+e.prev+e.base;return t+li.call(n,","+t)+` +`+e.prev}function dr(n,e){var t=Na(n),i=[];if(t){i.length=n.length;for(var s=0;s-1?m_(t):t},dy=function n(e,t,i,s){var l=t||{};if(Pi(l,"quoteStyle")&&l.quoteStyle!=="single"&&l.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Pi(l,"maxStringLength")&&(typeof l.maxStringLength=="number"?l.maxStringLength<0&&l.maxStringLength!==1/0:l.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var r=!Pi(l,"customInspect")||l.customInspect;if(typeof r!="boolean"&&r!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Pi(l,"indent")&&l.indent!==null&&l.indent!==" "&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Pi(l,"numericSeparator")&&typeof l.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=l.numericSeparator;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return v_(e,l);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return o?Yf(e,a):a}if(typeof e=="bigint"){var u=String(e)+"n";return o?Yf(e,u):u}var f=l.depth===void 0?5:l.depth;if(i===void 0&&(i=0),i>=f&&f>0&&typeof e=="object")return Na(e)?"[Array]":"[Object]";var c=function(R,J){var W;if(R.indent===" ")W=" ";else{if(!(typeof R.indent=="number"&&R.indent>0))return null;W=li.call(Array(R.indent+1)," ")}return{base:W,prev:li.call(Array(J+1),W)}}(l,i);if(s===void 0)s=[];else if(Gf(s,e)>=0)return"[Circular]";function d(R,J,W){if(J&&(s=ay.call(s)).push(J),W){var q={depth:l.depth};return Pi(l,"quoteStyle")&&(q.quoteStyle=l.quoteStyle),n(R,q,i+1,s)}return n(R,l,i+1,s)}if(typeof e=="function"&&!xf(e)){var h=function(R){if(R.name)return R.name;var J=ry.call(ly.call(R),/^function\s*([\w$]+)/);return J?J[1]:null}(e),g=dr(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(g.length>0?" { "+li.call(g,", ")+" }":"")}if(y_(e)){var y=zs?Ri.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Fa.call(e);return typeof e!="object"||zs?y:il(y)}if(function(R){return!R||typeof R!="object"?!1:typeof HTMLElement!="undefined"&&R instanceof HTMLElement?!0:typeof R.nodeName=="string"&&typeof R.getAttribute=="function"}(e)){for(var b="<"+zf.call(String(e.nodeName)),v=e.attributes||[],S=0;S"}if(Na(e)){if(e.length===0)return"[]";var C=dr(e,d);return c&&!function(R){for(var J=0;J=0)return!1;return!0}(C)?"["+Ra(C,c)+"]":"[ "+li.call(C,", ")+" ]"}if(function(R){return!(Li(R)!=="[object Error]"||ln&&typeof R=="object"&&ln in R)}(e)){var M=dr(e,d);return"cause"in Error.prototype||!("cause"in e)||__.call(e,"cause")?M.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+li.call(M,", ")+" }":"{ ["+String(e)+"] "+li.call(Bf.call("[cause]: "+d(e.cause),M),", ")+" }"}if(typeof e=="object"&&r){if(Jf&&typeof e[Jf]=="function"&&Ia)return Ia(e,{depth:f-i});if(r!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(function(R){if(!fr||!R||typeof R!="object")return!1;try{fr.call(R);try{cr.call(R)}catch{return!0}return R instanceof Map}catch{}return!1}(e)){var $=[];return ty.call(e,function(R,J){$.push(d(J,e,!0)+" => "+d(R,e))}),Zf("Map",fr.call(e),$,c)}if(function(R){if(!cr||!R||typeof R!="object")return!1;try{cr.call(R);try{fr.call(R)}catch{return!0}return R instanceof Set}catch{}return!1}(e)){var T=[];return ny.call(e,function(R){T.push(d(R,e))}),Zf("Set",cr.call(e),T,c)}if(function(R){if(!tl||!R||typeof R!="object")return!1;try{tl.call(R,tl);try{nl.call(R,nl)}catch{return!0}return R instanceof WeakMap}catch{}return!1}(e))return Zo("WeakMap");if(function(R){if(!nl||!R||typeof R!="object")return!1;try{nl.call(R,nl);try{tl.call(R,tl)}catch{return!0}return R instanceof WeakSet}catch{}return!1}(e))return Zo("WeakSet");if(function(R){if(!Vf||!R||typeof R!="object")return!1;try{return Vf.call(R),!0}catch{}return!1}(e))return Zo("WeakRef");if(function(R){return!(Li(R)!=="[object Number]"||ln&&typeof R=="object"&&ln in R)}(e))return il(d(Number(e)));if(function(R){if(!R||typeof R!="object"||!xo)return!1;try{return xo.call(R),!0}catch{}return!1}(e))return il(d(xo.call(e)));if(function(R){return!(Li(R)!=="[object Boolean]"||ln&&typeof R=="object"&&ln in R)}(e))return il(iy.call(e));if(function(R){return!(Li(R)!=="[object String]"||ln&&typeof R=="object"&&ln in R)}(e))return il(d(String(e)));if(!function(R){return!(Li(R)!=="[object Date]"||ln&&typeof R=="object"&&ln in R)}(e)&&!xf(e)){var A=dr(e,d),D=Wf?Wf(e)===Object.prototype:e instanceof Object||e.constructor===Object,P=e instanceof Object?"":"null prototype",L=!D&&ln&&Object(e)===e&&ln in e?$u.call(Li(e),8,-1):P?"Object":"",N=(D||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"")+(L||P?"["+li.call(Bf.call([],L||[],P||[]),": ")+"] ":"");return A.length===0?N+"{}":c?N+"{"+Ra(A,c)+"}":N+"{ "+li.call(A,", ")+" }"}return String(e)},py=Ou("%TypeError%"),pr=Ou("%WeakMap%",!0),hr=Ou("%Map%",!0),hy=Js("WeakMap.prototype.get",!0),my=Js("WeakMap.prototype.set",!0),gy=Js("WeakMap.prototype.has",!0),_y=Js("Map.prototype.get",!0),by=Js("Map.prototype.set",!0),yy=Js("Map.prototype.has",!0),Xo=function(n,e){for(var t,i=n;(t=i.next)!==null;i=t)if(t.key===e)return i.next=t.next,t.next=n.next,n.next=t,t},vy=String.prototype.replace,ky=/%20/g,Xf="RFC3986",Tu={default:Xf,formatters:{RFC1738:function(n){return vy.call(n,ky,"+")},RFC3986:function(n){return String(n)}},RFC1738:"RFC1738",RFC3986:Xf},wy=Tu,Qo=Object.prototype.hasOwnProperty,Gi=Array.isArray,ii=function(){for(var n=[],e=0;e<256;++e)n.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return n}(),Qf=function(n,e){for(var t=e&&e.plainObjects?Object.create(null):{},i=0;i1;){var c=f.pop(),d=c.obj[c.prop];if(Gi(d)){for(var h=[],g=0;g=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||s===wy.RFC1738&&(a===40||a===41)?r+=l.charAt(o):a<128?r+=ii[a]:a<2048?r+=ii[192|a>>6]+ii[128|63&a]:a<55296||a>=57344?r+=ii[224|a>>12]+ii[128|a>>6&63]+ii[128|63&a]:(o+=1,a=65536+((1023&a)<<10|1023&l.charCodeAt(o)),r+=ii[240|a>>18]+ii[128|a>>12&63]+ii[128|a>>6&63]+ii[128|63&a])}return r},isBuffer:function(n){return!(!n||typeof n!="object")&&!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))},isRegExp:function(n){return Object.prototype.toString.call(n)==="[object RegExp]"},maybeMap:function(n,e){if(Gi(n)){for(var t=[],i=0;i0?S.join(",")||null:void 0}];else if(yi(a))N=a;else{var J=Object.keys(S);N=u?J.sort(u):J}for(var W=s&&yi(S)&&S.length===1?t+"[]":t,q=0;q-1?n.split(","):n},Ay=function(n,e,t,i){if(n){var s=t.allowDots?n.replace(/\.([^.[]+)/g,"[$1]"):n,l=/(\[[^[\]]*])/g,r=t.depth>0&&/(\[[^[\]]*])/.exec(s),o=r?s.slice(0,r.index):s,a=[];if(o){if(!t.plainObjects&&Ha.call(Object.prototype,o)&&!t.allowPrototypes)return;a.push(o)}for(var u=0;t.depth>0&&(r=l.exec(s))!==null&&u=0;--y){var b,v=f[y];if(v==="[]"&&d.parseArrays)b=[].concat(g);else{b=d.plainObjects?Object.create(null):{};var S=v.charAt(0)==="["&&v.charAt(v.length-1)==="]"?v.slice(1,-1):v,C=parseInt(S,10);d.parseArrays||S!==""?!isNaN(C)&&v!==S&&String(C)===S&&C>=0&&d.parseArrays&&C<=d.arrayLimit?(b=[])[C]=g:S!=="__proto__"&&(b[S]=g):b={0:g}}g=b}return g}(a,e,t,i)}},Ey=function(n,e){var t,i=n,s=function(g){if(!g)return Xt;if(g.encoder!==null&&g.encoder!==void 0&&typeof g.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=g.charset||Xt.charset;if(g.charset!==void 0&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var b=wl.default;if(g.format!==void 0){if(!Sy.call(wl.formatters,g.format))throw new TypeError("Unknown format option provided.");b=g.format}var v=wl.formatters[b],S=Xt.filter;return(typeof g.filter=="function"||yi(g.filter))&&(S=g.filter),{addQueryPrefix:typeof g.addQueryPrefix=="boolean"?g.addQueryPrefix:Xt.addQueryPrefix,allowDots:g.allowDots===void 0?Xt.allowDots:!!g.allowDots,charset:y,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:Xt.charsetSentinel,delimiter:g.delimiter===void 0?Xt.delimiter:g.delimiter,encode:typeof g.encode=="boolean"?g.encode:Xt.encode,encoder:typeof g.encoder=="function"?g.encoder:Xt.encoder,encodeValuesOnly:typeof g.encodeValuesOnly=="boolean"?g.encodeValuesOnly:Xt.encodeValuesOnly,filter:S,format:b,formatter:v,serializeDate:typeof g.serializeDate=="function"?g.serializeDate:Xt.serializeDate,skipNulls:typeof g.skipNulls=="boolean"?g.skipNulls:Xt.skipNulls,sort:typeof g.sort=="function"?g.sort:null,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:Xt.strictNullHandling}}(e);typeof s.filter=="function"?i=(0,s.filter)("",i):yi(s.filter)&&(t=s.filter);var l,r=[];if(typeof i!="object"||i===null)return"";l=e&&e.arrayFormat in ec?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var o=ec[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=o==="comma"&&e&&e.commaRoundTrip;t||(t=Object.keys(i)),s.sort&&t.sort(s.sort);for(var u=S_(),f=0;f0?h+d:""},Py={formats:Tu,parse:function(n,e){var t=function(u){if(!u)return Gt;if(u.decoder!==null&&u.decoder!==void 0&&typeof u.decoder!="function")throw new TypeError("Decoder has to be a function.");if(u.charset!==void 0&&u.charset!=="utf-8"&&u.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var f=u.charset===void 0?Gt.charset:u.charset;return{allowDots:u.allowDots===void 0?Gt.allowDots:!!u.allowDots,allowPrototypes:typeof u.allowPrototypes=="boolean"?u.allowPrototypes:Gt.allowPrototypes,allowSparse:typeof u.allowSparse=="boolean"?u.allowSparse:Gt.allowSparse,arrayLimit:typeof u.arrayLimit=="number"?u.arrayLimit:Gt.arrayLimit,charset:f,charsetSentinel:typeof u.charsetSentinel=="boolean"?u.charsetSentinel:Gt.charsetSentinel,comma:typeof u.comma=="boolean"?u.comma:Gt.comma,decoder:typeof u.decoder=="function"?u.decoder:Gt.decoder,delimiter:typeof u.delimiter=="string"||Ls.isRegExp(u.delimiter)?u.delimiter:Gt.delimiter,depth:typeof u.depth=="number"||u.depth===!1?+u.depth:Gt.depth,ignoreQueryPrefix:u.ignoreQueryPrefix===!0,interpretNumericEntities:typeof u.interpretNumericEntities=="boolean"?u.interpretNumericEntities:Gt.interpretNumericEntities,parameterLimit:typeof u.parameterLimit=="number"?u.parameterLimit:Gt.parameterLimit,parseArrays:u.parseArrays!==!1,plainObjects:typeof u.plainObjects=="boolean"?u.plainObjects:Gt.plainObjects,strictNullHandling:typeof u.strictNullHandling=="boolean"?u.strictNullHandling:Gt.strictNullHandling}}(e);if(n===""||n==null)return t.plainObjects?Object.create(null):{};for(var i=typeof n=="string"?function(u,f){var c,d={},h=f.ignoreQueryPrefix?u.replace(/^\?/,""):u,g=f.parameterLimit===1/0?void 0:f.parameterLimit,y=h.split(f.delimiter,g),b=-1,v=f.charset;if(f.charsetSentinel)for(c=0;c-1&&(C=Ty(C)?[C]:C),Ha.call(d,S)?d[S]=Ls.combine(d[S],C):d[S]=C}return d}(n,t):n,s=t.plainObjects?Object.create(null):{},l=Object.keys(i),r=0;r0&&(!i.exp||i.exp-t>Date.now()/1e3))},n}(),qa=function(n,e){return qa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])},qa(n,e)};function mn(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}qa(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Br(n,e,t,i){return new(t||(t=Promise))(function(s,l){function r(u){try{a(i.next(u))}catch(f){l(f)}}function o(u){try{a(i.throw(u))}catch(f){l(f)}}function a(u){var f;u.done?s(u.value):(f=u.value,f instanceof t?f:new t(function(c){c(f)})).then(r,o)}a((i=i.apply(n,e||[])).next())})}function Ur(n,e){var t,i,s,l,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return l={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function o(a){return function(u){return function(f){if(t)throw new TypeError("Generator is already executing.");for(;r;)try{if(t=1,i&&(s=2&f[0]?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[2&f[0],s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!((s=s.length>0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]0?n:1,this.perPage=e>=0?e:0,this.totalItems=t>=0?t:0,this.items=i||[]},T_=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return mn(e,n),e.prototype._getFullList=function(t,i,s){var l=this;i===void 0&&(i=100),s===void 0&&(s={});var r=[],o=function(a){return Br(l,void 0,void 0,function(){return Ur(this,function(u){return[2,this._getList(t,a,i,s).then(function(f){var c=f,d=c.items,h=c.totalItems;return r=r.concat(d),d.length&&h>r.length?o(a+1):r})]})})};return o(1)},e.prototype._getList=function(t,i,s,l){var r=this;return i===void 0&&(i=1),s===void 0&&(s=30),l===void 0&&(l={}),l=Object.assign({page:i,perPage:s},l),this.client.send({method:"get",url:t,params:l}).then(function(o){var a,u,f,c,d,h=[];if(!((a=o==null?void 0:o.data)===null||a===void 0)&&a.items){o.data.items=((u=o==null?void 0:o.data)===null||u===void 0?void 0:u.items)||[];for(var g=0,y=o.data.items;g{const l=[e(s),s];return i&&t(i[0],l[0])===i[0]?i:l},null)[1]}function xy(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Us(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function ki(n,e,t){return Mo(n)&&n>=e&&n<=t}function Gy(n,e){return n-e*Math.floor(n/e)}function Ut(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Fi(n){if(!(pt(n)||n===null||n===""))return parseInt(n,10)}function Zi(n){if(!(pt(n)||n===null||n===""))return parseFloat(n)}function Eu(n){if(!(pt(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Pu(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function Wl(n){return n%4===0&&(n%100!==0||n%400===0)}function Sl(n){return Wl(n)?366:365}function eo(n,e){const t=Gy(e-1,12)+1,i=n+(e-t)/12;return t===2?Wl(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Lu(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function to(n){const e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,i=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||i===3?53:52}function Ba(n){return n>99?n:n>60?1900+n:2e3+n}function G_(n,e,t,i=null){const s=new Date(n),l={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(l.timeZone=i);const r={timeZoneName:e,...l},o=new Intl.DateTimeFormat(t,r).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return o?o.value:null}function $o(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-i:i;return t*60+s}function Z_(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Hn(`Invalid unit value ${n}`);return e}function no(n,e){const t={};for(const i in n)if(Us(n,i)){const s=n[i];if(s==null)continue;t[e(i)]=Z_(s)}return t}function Cl(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${Ut(t,2)}:${Ut(i,2)}`;case"narrow":return`${s}${t}${i>0?`:${i}`:""}`;case"techie":return`${s}${Ut(t,2)}${Ut(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Oo(n){return xy(n,["hour","minute","second","millisecond"])}const X_=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/,Zy=["January","February","March","April","May","June","July","August","September","October","November","December"],Q_=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xy=["J","F","M","A","M","J","J","A","S","O","N","D"];function e0(n){switch(n){case"narrow":return[...Xy];case"short":return[...Q_];case"long":return[...Zy];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const t0=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],n0=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Qy=["M","T","W","T","F","S","S"];function i0(n){switch(n){case"narrow":return[...Qy];case"short":return[...n0];case"long":return[...t0];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const s0=["AM","PM"],ev=["Before Christ","Anno Domini"],tv=["BC","AD"],nv=["B","A"];function l0(n){switch(n){case"narrow":return[...nv];case"short":return[...tv];case"long":return[...ev];default:return null}}function iv(n){return s0[n.hour<12?0:1]}function sv(n,e){return i0(e)[n.weekday-1]}function lv(n,e){return e0(e)[n.month-1]}function rv(n,e){return l0(e)[n.year<0?0:1]}function ov(n,e,t="always",i=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},l=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&l){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${s[n][0]}`;case-1:return c?"yesterday":`last ${s[n][0]}`;case 0:return c?"today":`this ${s[n][0]}`}}const r=Object.is(e,-0)||e<0,o=Math.abs(e),a=o===1,u=s[n],f=i?a?u[1]:u[2]||u[1]:a?s[n][0]:n;return r?`${o} ${f} ago`:`in ${o} ${f}`}function ic(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const av={D:za,DD:A_,DDD:E_,DDDD:P_,t:L_,tt:F_,ttt:I_,tttt:N_,T:R_,TT:j_,TTT:H_,TTTT:q_,f:V_,ff:B_,fff:W_,ffff:K_,F:z_,FF:U_,FFF:Y_,FFFF:J_};class yn{static create(e,t={}){return new yn(e,t)}static parseFormat(e){let t=null,i="",s=!1;const l=[];for(let r=0;r0&&l.push({literal:s,val:i}),t=null,i="",s=!s):s||o===t?i+=o:(i.length>0&&l.push({literal:!1,val:i}),i=o,t=o)}return i.length>0&&l.push({literal:s,val:i}),l}static macroTokenToFormatOpts(e){return av[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTime(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTimeParts(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).formatToParts()}resolvedOptions(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return Ut(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",l=(h,g)=>this.loc.extract(e,h,g),r=h=>e.isOffsetFixed&&e.offset===0&&h.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,h.format):"",o=()=>i?iv(e):l({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(h,g)=>i?lv(e,h):l(g?{month:h}:{month:h,day:"numeric"},"month"),u=(h,g)=>i?sv(e,h):l(g?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),f=h=>{const g=yn.macroTokenToFormatOpts(h);return g?this.formatWithSystemDefault(e,g):h},c=h=>i?rv(e,h):l({era:h},"era"),d=h=>{switch(h){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return r({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return r({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return r({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return s?l({day:"numeric"},"day"):this.num(e.day);case"dd":return s?l({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?l({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?l({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?l({month:"numeric"},"month"):this.num(e.month);case"MM":return s?l({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?l({year:"numeric"},"year"):this.num(e.year);case"yy":return s?l({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?l({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?l({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(h)}};return ic(yn.parseFormat(t),d)}formatDurationFromString(e,t){const i=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=a=>u=>{const f=i(u);return f?this.num(a.get(f),u.length):u},l=yn.parseFormat(t),r=l.reduce((a,{literal:u,val:f})=>u?a:a.concat(f),[]),o=e.shiftTo(...r.map(i).filter(a=>a));return ic(l,s(o))}}class Zn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}class Yl{get type(){throw new Di}get name(){throw new Di}get ianaName(){return this.name}get isUniversal(){throw new Di}offsetName(e,t){throw new Di}formatOffset(e,t){throw new Di}offset(e){throw new Di}equals(e){throw new Di}get isValid(){throw new Di}}let ta=null;class Fu extends Yl{static get instance(){return ta===null&&(ta=new Fu),ta}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return G_(e,t,i)}formatOffset(e,t){return Cl(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let Wr={};function uv(n){return Wr[n]||(Wr[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Wr[n]}const fv={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function cv(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,l,r,o,a,u,f]=i;return[r,s,l,o,a,u,f]}function dv(n,e){const t=n.formatToParts(e),i=[];for(let s=0;s=0?g:1e3+g,(d-h)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let na=null;class dn extends Yl{static get utcInstance(){return na===null&&(na=new dn(0)),na}static instance(e){return e===0?dn.utcInstance:new dn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new dn($o(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Cl(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Cl(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Cl(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class pv extends Yl{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Ii(n,e){if(pt(n)||n===null)return e;if(n instanceof Yl)return n;if(Yy(n)){const t=n.toLowerCase();return t==="local"||t==="system"?e:t==="utc"||t==="gmt"?dn.utcInstance:dn.parseSpecifier(t)||Si.create(n)}else return cs(n)?dn.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new pv(n)}let sc=()=>Date.now(),lc="system",rc=null,oc=null,ac=null,uc;class Kt{static get now(){return sc}static set now(e){sc=e}static set defaultZone(e){lc=e}static get defaultZone(){return Ii(lc,Fu.instance)}static get defaultLocale(){return rc}static set defaultLocale(e){rc=e}static get defaultNumberingSystem(){return oc}static set defaultNumberingSystem(e){oc=e}static get defaultOutputCalendar(){return ac}static set defaultOutputCalendar(e){ac=e}static get throwOnInvalid(){return uc}static set throwOnInvalid(e){uc=e}static resetCaches(){It.resetCache(),Si.resetCache()}}let fc={};function hv(n,e={}){const t=JSON.stringify([n,e]);let i=fc[t];return i||(i=new Intl.ListFormat(n,e),fc[t]=i),i}let Ua={};function Wa(n,e={}){const t=JSON.stringify([n,e]);let i=Ua[t];return i||(i=new Intl.DateTimeFormat(n,e),Ua[t]=i),i}let Ya={};function mv(n,e={}){const t=JSON.stringify([n,e]);let i=Ya[t];return i||(i=new Intl.NumberFormat(n,e),Ya[t]=i),i}let Ka={};function gv(n,e={}){const{base:t,...i}=e,s=JSON.stringify([n,i]);let l=Ka[s];return l||(l=new Intl.RelativeTimeFormat(n,e),Ka[s]=l),l}let bl=null;function _v(){return bl||(bl=new Intl.DateTimeFormat().resolvedOptions().locale,bl)}function bv(n){const e=n.indexOf("-u-");if(e===-1)return[n];{let t;const i=n.substring(0,e);try{t=Wa(n).resolvedOptions()}catch{t=Wa(i).resolvedOptions()}const{numberingSystem:s,calendar:l}=t;return[i,s,l]}}function yv(n,e,t){return(t||e)&&(n+="-u",t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function vv(n){const e=[];for(let t=1;t<=12;t++){const i=Qe.utc(2016,t,1);e.push(n(i))}return e}function kv(n){const e=[];for(let t=1;t<=7;t++){const i=Qe.utc(2016,11,13+t);e.push(n(i))}return e}function gr(n,e,t,i,s){const l=n.listingMode(t);return l==="error"?null:l==="en"?i(e):s(e)}function wv(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class Sv{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:s,floor:l,...r}=i;if(!t||Object.keys(r).length>0){const o={useGrouping:!1,...i};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=mv(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Pu(e,3);return Ut(t,this.padTo)}}}class Cv{constructor(e,t,i){this.opts=i;let s;if(e.zone.isUniversal){const r=-1*(e.offset/60),o=r>=0?`Etc/GMT+${r}`:`Etc/GMT${r}`;e.offset!==0&&Si.create(o).valid?(s=o,this.dt=e):(s="UTC",i.timeZoneName?this.dt=e:this.dt=e.offset===0?e:Qe.fromMillis(e.ts+e.offset*60*1e3))}else e.zone.type==="system"?this.dt=e:(this.dt=e,s=e.zone.name);const l={...this.opts};s&&(l.timeZone=s),this.dtf=Wa(t,l)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class Mv{constructor(e,t,i){this.opts={style:"long",...i},!t&&x_()&&(this.rtf=gv(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):ov(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}class It{static fromOpts(e){return It.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,i,s=!1){const l=e||Kt.defaultLocale,r=l||(s?"en-US":_v()),o=t||Kt.defaultNumberingSystem,a=i||Kt.defaultOutputCalendar;return new It(r,o,a,l)}static resetCache(){bl=null,Ua={},Ya={},Ka={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i}={}){return It.create(e,t,i)}constructor(e,t,i,s){const[l,r,o]=bv(e);this.locale=l,this.numberingSystem=t||r||null,this.outputCalendar=i||o||null,this.intl=yv(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=wv(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:It.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1,i=!0){return gr(this,e,i,e0,()=>{const s=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=vv(r=>this.extract(r,s,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1,i=!0){return gr(this,e,i,i0,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=kv(r=>this.extract(r,s,"weekday"))),this.weekdaysCache[l][e]})}meridiems(e=!0){return gr(this,void 0,e,()=>s0,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Qe.utc(2016,11,13,9),Qe.utc(2016,11,13,19)].map(i=>this.extract(i,t,"dayperiod"))}return this.meridiemCache})}eras(e,t=!0){return gr(this,e,t,l0,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[Qe.utc(-40,1,1),Qe.utc(2017,1,1)].map(s=>this.extract(s,i,"era"))),this.eraCache[e]})}extract(e,t,i){const s=this.dtFormatter(e,t),l=s.formatToParts(),r=l.find(o=>o.type.toLowerCase()===i);return r?r.value:null}numberFormatter(e={}){return new Sv(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Cv(e,this.intl,t)}relFormatter(e={}){return new Mv(this.intl,this.isEnglish(),e)}listFormatter(e={}){return hv(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}function xs(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Gs(...n){return e=>n.reduce(([t,i,s],l)=>{const[r,o,a]=l(e,s);return[{...t,...r},o||i,a]},[{},null,1]).slice(0,2)}function Zs(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const s=t.exec(n);if(s)return i(s)}return[null,null]}function r0(...n){return(e,t)=>{const i={};let s;for(s=0;sh!==void 0&&(g||h&&f)?-h:h;return[{years:d(Zi(t)),months:d(Zi(i)),weeks:d(Zi(s)),days:d(Zi(l)),hours:d(Zi(r)),minutes:d(Zi(o)),seconds:d(Zi(a),a==="-0"),milliseconds:d(Eu(u),c)}]}const jv={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ru(n,e,t,i,s,l,r){const o={year:e.length===2?Ba(Fi(e)):Fi(e),month:Q_.indexOf(t)+1,day:Fi(i),hour:Fi(s),minute:Fi(l)};return r&&(o.second=Fi(r)),n&&(o.weekday=n.length>3?t0.indexOf(n)+1:n0.indexOf(n)+1),o}const Hv=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function qv(n){const[,e,t,i,s,l,r,o,a,u,f,c]=n,d=Ru(e,s,i,t,l,r,o);let h;return a?h=jv[a]:u?h=0:h=$o(f,c),[d,new dn(h)]}function Vv(n){return n.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const zv=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Bv=/^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Uv=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function cc(n){const[,e,t,i,s,l,r,o]=n;return[Ru(e,s,i,t,l,r,o),dn.utcInstance]}function Wv(n){const[,e,t,i,s,l,r,o]=n;return[Ru(e,o,t,i,s,l,r),dn.utcInstance]}const Yv=xs(Ov,Nu),Kv=xs(Tv,Nu),Jv=xs(Dv,Nu),xv=xs(a0),f0=Gs(Fv,Xs,Kl,Jl),Gv=Gs(Av,Xs,Kl,Jl),Zv=Gs(Ev,Xs,Kl,Jl),Xv=Gs(Xs,Kl,Jl);function Qv(n){return Zs(n,[Yv,f0],[Kv,Gv],[Jv,Zv],[xv,Xv])}function ek(n){return Zs(Vv(n),[Hv,qv])}function tk(n){return Zs(n,[zv,cc],[Bv,cc],[Uv,Wv])}function nk(n){return Zs(n,[Nv,Rv])}const ik=Gs(Xs);function sk(n){return Zs(n,[Iv,ik])}const lk=xs(Pv,Lv),rk=xs(u0),ok=Gs(Xs,Kl,Jl);function ak(n){return Zs(n,[lk,f0],[rk,ok])}const uk="Invalid Duration",c0={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fk={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...c0},In=146097/400,Ts=146097/4800,ck={years:{quarters:4,months:12,weeks:In/7,days:In,hours:In*24,minutes:In*24*60,seconds:In*24*60*60,milliseconds:In*24*60*60*1e3},quarters:{months:3,weeks:In/28,days:In/4,hours:In*24/4,minutes:In*24*60/4,seconds:In*24*60*60/4,milliseconds:In*24*60*60*1e3/4},months:{weeks:Ts/7,days:Ts,hours:Ts*24,minutes:Ts*24*60,seconds:Ts*24*60*60,milliseconds:Ts*24*60*60*1e3},...c0},is=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],dk=is.slice(0).reverse();function Xi(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new bt(i)}function pk(n){return n<0?Math.floor(n):Math.ceil(n)}function d0(n,e,t,i,s){const l=n[s][t],r=e[t]/l,o=Math.sign(r)===Math.sign(i[s]),a=!o&&i[s]!==0&&Math.abs(r)<=1?pk(r):Math.trunc(r);i[s]+=a,e[t]-=a*l}function hk(n,e){dk.reduce((t,i)=>pt(e[i])?t:(t&&d0(n,e,t,e,i),i),null)}class bt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;this.values=e.values,this.loc=e.loc||It.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=t?ck:fk,this.isLuxonDuration=!0}static fromMillis(e,t){return bt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Hn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new bt({values:no(e,bt.normalizeUnit),loc:It.fromObject(t),conversionAccuracy:t.conversionAccuracy})}static fromDurationLike(e){if(cs(e))return bt.fromMillis(e);if(bt.isDuration(e))return e;if(typeof e=="object")return bt.fromObject(e);throw new Hn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=nk(e);return i?bt.fromObject(i,t):bt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=sk(e);return i?bt.fromObject(i,t):bt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Hn("need to specify a reason the Duration is invalid");const i=e instanceof Zn?e:new Zn(e,t);if(Kt.throwOnInvalid)throw new By(i);return new bt({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new D_(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?yn.create(this.loc,i).formatDurationFromString(this,e):uk}toHuman(e={}){const t=is.map(i=>{const s=this.values[i];return pt(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Pu(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e};const i=this.shiftTo("hours","minutes","seconds","milliseconds");let s=e.format==="basic"?"hhmm":"hh:mm";(!e.suppressSeconds||i.seconds!==0||i.milliseconds!==0)&&(s+=e.format==="basic"?"ss":":ss",(!e.suppressMilliseconds||i.milliseconds!==0)&&(s+=".SSS"));let l=i.toFormat(s);return e.includePrefix&&(l="T"+l),l}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=bt.fromDurationLike(e),i={};for(const s of is)(Us(t.values,s)||Us(this.values,s))&&(i[s]=t.get(s)+this.get(s));return Xi(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=bt.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=Z_(e(this.values[i],i));return Xi(this,{values:t},!0)}get(e){return this[bt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...no(e,bt.normalizeUnit)};return Xi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t}),l={loc:s};return i&&(l.conversionAccuracy=i),Xi(this,l)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return hk(this.matrix,e),Xi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(r=>bt.normalizeUnit(r));const t={},i={},s=this.toObject();let l;for(const r of is)if(e.indexOf(r)>=0){l=r;let o=0;for(const u in i)o+=this.matrix[u][r]*i[u],i[u]=0;cs(s[r])&&(o+=s[r]);const a=Math.trunc(o);t[r]=a,i[r]=(o*1e3-a*1e3)/1e3;for(const u in s)is.indexOf(u)>is.indexOf(r)&&d0(this.matrix,s,u,t,r)}else cs(s[r])&&(i[r]=s[r]);for(const r in i)i[r]!==0&&(t[l]+=r===l?i[r]:i[r]/this.matrix[l][r]);return Xi(this,{values:t},!0).normalize()}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Xi(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,s){return i===void 0||i===0?s===void 0||s===0:i===s}for(const i of is)if(!t(this.values[i],e.values[i]))return!1;return!0}}const sl="Invalid Interval";function mk(n,e){return!n||!n.isValid?Nt.invalid("missing or invalid start"):!e||!e.isValid?Nt.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?Nt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ol).filter(r=>this.contains(r)).sort(),i=[];let{s}=this,l=0;for(;s+this.e?this.e:r;i.push(Nt.fromDateTimes(s,o)),s=o,l+=1}return i}splitBy(e){const t=bt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,s=1,l;const r=[];for(;ia*s));l=+o>+this.e?this.e:o,r.push(Nt.fromDateTimes(i,l)),i=l,s+=1}return r}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e=i?null:Nt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return Nt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((s,l)=>s.s-l.s).reduce(([s,l],r)=>l?l.overlaps(r)||l.abutsStart(r)?[s,l.union(r)]:[s.concat([l]),r]:[s,r],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const s=[],l=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),r=Array.prototype.concat(...l),o=r.sort((a,u)=>a.time-u.time);for(const a of o)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&s.push(Nt.fromDateTimes(t,a.time)),t=null);return Nt.merge(s)}difference(...e){return Nt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:sl}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:sl}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:sl}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:sl}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:sl}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):bt.invalid(this.invalidReason)}mapEndpoints(e){return Nt.fromDateTimes(e(this.s),e(this.e))}}class _r{static hasDST(e=Kt.defaultZone){const t=Qe.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Si.isValidZone(e)}static normalizeZone(e){return Ii(e,Kt.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||It.create(t,i,l)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||It.create(t,i,l)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||It.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||It.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return It.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return It.create(t,null,"gregory").eras(e)}static features(){return{relative:x_()}}}function dc(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(bt.fromMillis(i).as("days"))}function gk(n,e,t){const i=[["years",(o,a)=>a.year-o.year],["quarters",(o,a)=>a.quarter-o.quarter],["months",(o,a)=>a.month-o.month+(a.year-o.year)*12],["weeks",(o,a)=>{const u=dc(o,a);return(u-u%7)/7}],["days",dc]],s={};let l,r;for(const[o,a]of i)if(t.indexOf(o)>=0){l=o;let u=a(n,e);r=n.plus({[o]:u}),r>e?(n=n.plus({[o]:u-1}),u-=1):n=r,s[o]=u}return[n,s,r,l]}function _k(n,e,t,i){let[s,l,r,o]=gk(n,e,t);const a=e-s,u=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);u.length===0&&(r0?bt.fromMillis(a,i).shiftTo(...u).plus(f):f}const ju={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},pc={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},bk=ju.hanidec.replace(/[\[|\]]/g,"").split("");function yk(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=l&&i<=r&&(e+=i-l)}}return parseInt(e,10)}else return e}function xn({numberingSystem:n},e=""){return new RegExp(`${ju[n||"latn"]}${e}`)}const vk="missing Intl.DateTimeFormat.formatToParts support";function kt(n,e=t=>t){return{regex:n,deser:([t])=>e(yk(t))}}const kk=String.fromCharCode(160),p0=`[ ${kk}]`,h0=new RegExp(p0,"g");function wk(n){return n.replace(/\./g,"\\.?").replace(h0,p0)}function hc(n){return n.replace(/\./g,"").replace(h0," ").toLowerCase()}function Gn(n,e){return n===null?null:{regex:RegExp(n.map(wk).join("|")),deser:([t])=>n.findIndex(i=>hc(t)===hc(i))+e}}function mc(n,e){return{regex:n,deser:([,t,i])=>$o(t,i),groups:e}}function ia(n){return{regex:n,deser:([e])=>e}}function Sk(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ck(n,e){const t=xn(e),i=xn(e,"{2}"),s=xn(e,"{3}"),l=xn(e,"{4}"),r=xn(e,"{6}"),o=xn(e,"{1,2}"),a=xn(e,"{1,3}"),u=xn(e,"{1,6}"),f=xn(e,"{1,9}"),c=xn(e,"{2,4}"),d=xn(e,"{4,6}"),h=b=>({regex:RegExp(Sk(b.val)),deser:([v])=>v,literal:!0}),y=(b=>{if(n.literal)return h(b);switch(b.val){case"G":return Gn(e.eras("short",!1),0);case"GG":return Gn(e.eras("long",!1),0);case"y":return kt(u);case"yy":return kt(c,Ba);case"yyyy":return kt(l);case"yyyyy":return kt(d);case"yyyyyy":return kt(r);case"M":return kt(o);case"MM":return kt(i);case"MMM":return Gn(e.months("short",!0,!1),1);case"MMMM":return Gn(e.months("long",!0,!1),1);case"L":return kt(o);case"LL":return kt(i);case"LLL":return Gn(e.months("short",!1,!1),1);case"LLLL":return Gn(e.months("long",!1,!1),1);case"d":return kt(o);case"dd":return kt(i);case"o":return kt(a);case"ooo":return kt(s);case"HH":return kt(i);case"H":return kt(o);case"hh":return kt(i);case"h":return kt(o);case"mm":return kt(i);case"m":return kt(o);case"q":return kt(o);case"qq":return kt(i);case"s":return kt(o);case"ss":return kt(i);case"S":return kt(a);case"SSS":return kt(s);case"u":return ia(f);case"uu":return ia(o);case"uuu":return kt(t);case"a":return Gn(e.meridiems(),0);case"kkkk":return kt(l);case"kk":return kt(c,Ba);case"W":return kt(o);case"WW":return kt(i);case"E":case"c":return kt(t);case"EEE":return Gn(e.weekdays("short",!1,!1),1);case"EEEE":return Gn(e.weekdays("long",!1,!1),1);case"ccc":return Gn(e.weekdays("short",!0,!1),1);case"cccc":return Gn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return mc(new RegExp(`([+-]${o.source})(?::(${i.source}))?`),2);case"ZZZ":return mc(new RegExp(`([+-]${o.source})(${i.source})?`),2);case"z":return ia(/[a-z_+-/]{1,256}?/i);default:return h(b)}})(n)||{invalidReason:vk};return y.token=n,y}const Mk={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function $k(n,e,t){const{type:i,value:s}=n;if(i==="literal")return{literal:!0,val:s};const l=t[i];let r=Mk[i];if(typeof r=="object"&&(r=r[l]),r)return{literal:!1,val:r}}function Ok(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function Tk(n,e,t){const i=n.match(e);if(i){const s={};let l=1;for(const r in t)if(Us(t,r)){const o=t[r],a=o.groups?o.groups+1:1;!o.literal&&o.token&&(s[o.token.val[0]]=o.deser(i.slice(l,l+a))),l+=a}return[i,s]}else return[i,{}]}function Dk(n){const e=l=>{switch(l){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return pt(n.z)||(t=Si.create(n.z)),pt(n.Z)||(t||(t=new dn(n.Z)),i=n.Z),pt(n.q)||(n.M=(n.q-1)*3+1),pt(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),pt(n.u)||(n.S=Eu(n.u)),[Object.keys(n).reduce((l,r)=>{const o=e(r);return o&&(l[o]=n[r]),l},{}),t,i]}let sa=null;function Ak(){return sa||(sa=Qe.fromMillis(1555555555555)),sa}function Ek(n,e){if(n.literal)return n;const t=yn.macroTokenToFormatOpts(n.val);if(!t)return n;const l=yn.create(e,t).formatDateTimeParts(Ak()).map(r=>$k(r,e,t));return l.includes(void 0)?n:l}function Pk(n,e){return Array.prototype.concat(...n.map(t=>Ek(t,e)))}function m0(n,e,t){const i=Pk(yn.parseFormat(t),n),s=i.map(r=>Ck(r,n)),l=s.find(r=>r.invalidReason);if(l)return{input:e,tokens:i,invalidReason:l.invalidReason};{const[r,o]=Ok(s),a=RegExp(r,"i"),[u,f]=Tk(e,a,o),[c,d,h]=f?Dk(f):[null,null,void 0];if(Us(f,"a")&&Us(f,"H"))throw new _l("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:u,matches:f,result:c,zone:d,specificOffset:h}}}function Lk(n,e,t){const{result:i,zone:s,specificOffset:l,invalidReason:r}=m0(n,e,t);return[i,s,l,r]}const g0=[0,31,59,90,120,151,181,212,243,273,304,334],_0=[0,31,60,91,121,152,182,213,244,274,305,335];function Vn(n,e){return new Zn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function b0(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const s=i.getUTCDay();return s===0?7:s}function y0(n,e,t){return t+(Wl(n)?_0:g0)[e-1]}function v0(n,e){const t=Wl(n)?_0:g0,i=t.findIndex(l=>lto(e)?(o=e+1,r=1):o=e,{weekYear:o,weekNumber:r,weekday:l,...Oo(n)}}function gc(n){const{weekYear:e,weekNumber:t,weekday:i}=n,s=b0(e,1,4),l=Sl(e);let r=t*7+i-s-3,o;r<1?(o=e-1,r+=Sl(o)):r>l?(o=e+1,r-=Sl(e)):o=e;const{month:a,day:u}=v0(o,r);return{year:o,month:a,day:u,...Oo(n)}}function la(n){const{year:e,month:t,day:i}=n,s=y0(e,t,i);return{year:e,ordinal:s,...Oo(n)}}function _c(n){const{year:e,ordinal:t}=n,{month:i,day:s}=v0(e,t);return{year:e,month:i,day:s,...Oo(n)}}function Fk(n){const e=Mo(n.weekYear),t=ki(n.weekNumber,1,to(n.weekYear)),i=ki(n.weekday,1,7);return e?t?i?!1:Vn("weekday",n.weekday):Vn("week",n.week):Vn("weekYear",n.weekYear)}function Ik(n){const e=Mo(n.year),t=ki(n.ordinal,1,Sl(n.year));return e?t?!1:Vn("ordinal",n.ordinal):Vn("year",n.year)}function k0(n){const e=Mo(n.year),t=ki(n.month,1,12),i=ki(n.day,1,eo(n.year,n.month));return e?t?i?!1:Vn("day",n.day):Vn("month",n.month):Vn("year",n.year)}function w0(n){const{hour:e,minute:t,second:i,millisecond:s}=n,l=ki(e,0,23)||e===24&&t===0&&i===0&&s===0,r=ki(t,0,59),o=ki(i,0,59),a=ki(s,0,999);return l?r?o?a?!1:Vn("millisecond",s):Vn("second",i):Vn("minute",t):Vn("hour",e)}const ra="Invalid DateTime",bc=864e13;function br(n){return new Zn("unsupported zone",`the zone "${n.name}" is not supported`)}function oa(n){return n.weekData===null&&(n.weekData=Ja(n.c)),n.weekData}function ll(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new Qe({...t,...e,old:t})}function S0(n,e,t){let i=n-e*60*1e3;const s=t.offset(i);if(e===s)return[i,e];i-=(s-e)*60*1e3;const l=t.offset(i);return s===l?[i,s]:[n-Math.min(s,l)*60*1e3,Math.max(s,l)]}function yc(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Yr(n,e,t){return S0(Lu(n),e,t)}function vc(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,l={...n.c,year:i,month:s,day:Math.min(n.c.day,eo(i,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},r=bt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Lu(l);let[a,u]=S0(o,t,n.zone);return r!==0&&(a+=r,u=n.zone.offset(a)),{ts:a,o:u}}function rl(n,e,t,i,s,l){const{setZone:r,zone:o}=t;if(n&&Object.keys(n).length!==0){const a=e||o,u=Qe.fromObject(n,{...t,zone:a,specificOffset:l});return r?u:u.setZone(o)}else return Qe.invalid(new Zn("unparsable",`the input "${s}" can't be parsed as ${i}`))}function yr(n,e,t=!0){return n.isValid?yn.create(It.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function aa(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=Ut(n.c.year,t?6:4),e?(i+="-",i+=Ut(n.c.month),i+="-",i+=Ut(n.c.day)):(i+=Ut(n.c.month),i+=Ut(n.c.day)),i}function kc(n,e,t,i,s,l){let r=Ut(n.c.hour);return e?(r+=":",r+=Ut(n.c.minute),(n.c.second!==0||!t)&&(r+=":")):r+=Ut(n.c.minute),(n.c.second!==0||!t)&&(r+=Ut(n.c.second),(n.c.millisecond!==0||!i)&&(r+=".",r+=Ut(n.c.millisecond,3))),s&&(n.isOffsetFixed&&n.offset===0&&!l?r+="Z":n.o<0?(r+="-",r+=Ut(Math.trunc(-n.o/60)),r+=":",r+=Ut(Math.trunc(-n.o%60))):(r+="+",r+=Ut(Math.trunc(n.o/60)),r+=":",r+=Ut(Math.trunc(n.o%60)))),l&&(r+="["+n.zone.ianaName+"]"),r}const C0={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Nk={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Rk={ordinal:1,hour:0,minute:0,second:0,millisecond:0},M0=["year","month","day","hour","minute","second","millisecond"],jk=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Hk=["year","ordinal","hour","minute","second","millisecond"];function wc(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new D_(n);return e}function Sc(n,e){const t=Ii(e.zone,Kt.defaultZone),i=It.fromObject(e),s=Kt.now();let l,r;if(pt(n.year))l=s;else{for(const u of M0)pt(n[u])&&(n[u]=C0[u]);const o=k0(n)||w0(n);if(o)return Qe.invalid(o);const a=t.offset(s);[l,r]=Yr(n,a,t)}return new Qe({ts:l,zone:t,loc:i,o:r})}function Cc(n,e,t){const i=pt(t.round)?!0:t.round,s=(r,o)=>(r=Pu(r,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(r,o)),l=r=>t.calendary?e.hasSame(n,r)?0:e.startOf(r).diff(n.startOf(r),r).get(r):e.diff(n,r).get(r);if(t.unit)return s(l(t.unit),t.unit);for(const r of t.units){const o=l(r);if(Math.abs(o)>=1)return s(o,r)}return s(n>e?-0:0,t.units[t.units.length-1])}function Mc(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class Qe{constructor(e){const t=e.zone||Kt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new Zn("invalid input"):null)||(t.isValid?null:br(t));this.ts=pt(e.ts)?Kt.now():e.ts;let s=null,l=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,l]=[e.old.c,e.old.o];else{const o=t.offset(this.ts);s=yc(this.ts,o),i=Number.isNaN(s.year)?new Zn("invalid input"):null,s=i?null:s,l=i?null:o}this._zone=t,this.loc=e.loc||It.create(),this.invalid=i,this.weekData=null,this.c=s,this.o=l,this.isLuxonDateTime=!0}static now(){return new Qe({})}static local(){const[e,t]=Mc(arguments),[i,s,l,r,o,a,u]=t;return Sc({year:i,month:s,day:l,hour:r,minute:o,second:a,millisecond:u},e)}static utc(){const[e,t]=Mc(arguments),[i,s,l,r,o,a,u]=t;return e.zone=dn.utcInstance,Sc({year:i,month:s,day:l,hour:r,minute:o,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const i=Ky(e)?e.valueOf():NaN;if(Number.isNaN(i))return Qe.invalid("invalid input");const s=Ii(t.zone,Kt.defaultZone);return s.isValid?new Qe({ts:i,zone:s,loc:It.fromObject(t)}):Qe.invalid(br(s))}static fromMillis(e,t={}){if(cs(e))return e<-bc||e>bc?Qe.invalid("Timestamp out of range"):new Qe({ts:e,zone:Ii(t.zone,Kt.defaultZone),loc:It.fromObject(t)});throw new Hn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(cs(e))return new Qe({ts:e*1e3,zone:Ii(t.zone,Kt.defaultZone),loc:It.fromObject(t)});throw new Hn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Ii(t.zone,Kt.defaultZone);if(!i.isValid)return Qe.invalid(br(i));const s=Kt.now(),l=pt(t.specificOffset)?i.offset(s):t.specificOffset,r=no(e,wc),o=!pt(r.ordinal),a=!pt(r.year),u=!pt(r.month)||!pt(r.day),f=a||u,c=r.weekYear||r.weekNumber,d=It.fromObject(t);if((f||o)&&c)throw new _l("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&o)throw new _l("Can't mix ordinal dates with month/day");const h=c||r.weekday&&!f;let g,y,b=yc(s,l);h?(g=jk,y=Nk,b=Ja(b)):o?(g=Hk,y=Rk,b=la(b)):(g=M0,y=C0);let v=!1;for(const D of g){const P=r[D];pt(P)?v?r[D]=y[D]:r[D]=b[D]:v=!0}const S=h?Fk(r):o?Ik(r):k0(r),C=S||w0(r);if(C)return Qe.invalid(C);const M=h?gc(r):o?_c(r):r,[$,T]=Yr(M,l,i),A=new Qe({ts:$,zone:i,o:T,loc:d});return r.weekday&&f&&e.weekday!==A.weekday?Qe.invalid("mismatched weekday",`you can't specify both a weekday of ${r.weekday} and a date of ${A.toISO()}`):A}static fromISO(e,t={}){const[i,s]=Qv(e);return rl(i,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,s]=ek(e);return rl(i,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,s]=tk(e);return rl(i,s,t,"HTTP",t)}static fromFormat(e,t,i={}){if(pt(e)||pt(t))throw new Hn("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:l=null}=i,r=It.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0}),[o,a,u,f]=Lk(r,e,t);return f?Qe.invalid(f):rl(o,a,i,`format ${t}`,e,u)}static fromString(e,t,i={}){return Qe.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,s]=ak(e);return rl(i,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Hn("need to specify a reason the DateTime is invalid");const i=e instanceof Zn?e:new Zn(e,t);if(Kt.throwOnInvalid)throw new Vy(i);return new Qe({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?oa(this).weekYear:NaN}get weekNumber(){return this.isValid?oa(this).weekNumber:NaN}get weekday(){return this.isValid?oa(this).weekday:NaN}get ordinal(){return this.isValid?la(this.c).ordinal:NaN}get monthShort(){return this.isValid?_r.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?_r.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?_r.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?_r.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return Wl(this.year)}get daysInMonth(){return eo(this.year,this.month)}get daysInYear(){return this.isValid?Sl(this.year):NaN}get weeksInWeekYear(){return this.isValid?to(this.weekYear):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:s}=yn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(dn.instance(e),t)}toLocal(){return this.setZone(Kt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Ii(e,Kt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||i){const l=e.offset(this.ts),r=this.toObject();[s]=Yr(r,l,e)}return ll(this,{ts:s,zone:e})}else return Qe.invalid(br(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return ll(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=no(e,wc),i=!pt(t.weekYear)||!pt(t.weekNumber)||!pt(t.weekday),s=!pt(t.ordinal),l=!pt(t.year),r=!pt(t.month)||!pt(t.day),o=l||r,a=t.weekYear||t.weekNumber;if((o||s)&&a)throw new _l("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(r&&s)throw new _l("Can't mix ordinal dates with month/day");let u;i?u=gc({...Ja(this.c),...t}):pt(t.ordinal)?(u={...this.toObject(),...t},pt(t.day)&&(u.day=Math.min(eo(u.year,u.month),u.day))):u=_c({...la(this.c),...t});const[f,c]=Yr(u,this.o,this.zone);return ll(this,{ts:f,o:c})}plus(e){if(!this.isValid)return this;const t=bt.fromDurationLike(e);return ll(this,vc(this,t))}minus(e){if(!this.isValid)return this;const t=bt.fromDurationLike(e).negate();return ll(this,vc(this,t))}startOf(e){if(!this.isValid)return this;const t={},i=bt.normalizeUnit(e);switch(i){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0;break}if(i==="weeks"&&(t.weekday=1),i==="quarters"){const s=Math.ceil(this.month/3);t.month=(s-1)*3+1}return this.set(t)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,t={}){return this.isValid?yn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ra}toLocaleString(e=za,t={}){return this.isValid?yn.create(this.loc.clone(t),e).formatDateTime(this):ra}toLocaleParts(e={}){return this.isValid?yn.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:i=!1,includeOffset:s=!0,extendedZone:l=!1}={}){if(!this.isValid)return null;const r=e==="extended";let o=aa(this,r);return o+="T",o+=kc(this,r,t,i,s,l),o}toISODate({format:e="extended"}={}){return this.isValid?aa(this,e==="extended"):null}toISOWeekDate(){return yr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:s=!1,extendedZone:l=!1,format:r="extended"}={}){return this.isValid?(s?"T":"")+kc(this,r==="extended",t,e,i,l):null}toRFC2822(){return yr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return yr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?aa(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:i=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(i&&(s+=" "),t?s+="z":e&&(s+="ZZ")),yr(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ra}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",i={}){if(!this.isValid||!e.isValid)return bt.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...i},l=Jy(t).map(bt.normalizeUnit),r=e.valueOf()>this.valueOf(),o=r?this:e,a=r?e:this,u=_k(o,a,l,s);return r?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(Qe.now(),e,t)}until(e){return this.isValid?Nt.fromDateTimes(this,e):this}hasSame(e,t){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t)<=i&&i<=s.endOf(t)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||Qe.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(Qe.isDateTime))throw new Hn("max requires all arguments be DateTimes");return nc(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:s=null,numberingSystem:l=null}=i,r=It.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0});return m0(r,e,t)}static fromStringExplain(e,t,i={}){return Qe.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return za}static get DATE_MED(){return A_}static get DATE_MED_WITH_WEEKDAY(){return Uy}static get DATE_FULL(){return E_}static get DATE_HUGE(){return P_}static get TIME_SIMPLE(){return L_}static get TIME_WITH_SECONDS(){return F_}static get TIME_WITH_SHORT_OFFSET(){return I_}static get TIME_WITH_LONG_OFFSET(){return N_}static get TIME_24_SIMPLE(){return R_}static get TIME_24_WITH_SECONDS(){return j_}static get TIME_24_WITH_SHORT_OFFSET(){return H_}static get TIME_24_WITH_LONG_OFFSET(){return q_}static get DATETIME_SHORT(){return V_}static get DATETIME_SHORT_WITH_SECONDS(){return z_}static get DATETIME_MED(){return B_}static get DATETIME_MED_WITH_SECONDS(){return U_}static get DATETIME_MED_WITH_WEEKDAY(){return Wy}static get DATETIME_FULL(){return W_}static get DATETIME_FULL_WITH_SECONDS(){return Y_}static get DATETIME_HUGE(){return K_}static get DATETIME_HUGE_WITH_SECONDS(){return J_}}function ol(n){if(Qe.isDateTime(n))return n;if(n&&n.valueOf&&cs(n.valueOf()))return Qe.fromJSDate(n);if(n&&typeof n=="object")return Qe.fromObject(n);throw new Hn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}class U{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static isEmpty(e){return e===""||e===null||e==="00000000-0000-0000-0000-000000000000"||e==="0001-01-01T00:00:00Z"||e==="0001-01-01"||typeof e=="undefined"||Array.isArray(e)&&e.length===0||U.isObject(e)&&Object.keys(e).length===0}static isInput(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return t==="input"||t==="select"||t==="textarea"||e.isContentEditable}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return U.isInput(e)||t==="button"||t==="a"||t==="details"||e.tabIndex>=0}static hasNonEmptyProps(e){for(let t in e)if(!U.isEmpty(e[t]))return!0;return!1}static isObjectArrayWithKeys(e,t){if(!Array.isArray(e)||typeof e[0]!="object")return!1;if(e.length==0)return!0;let i=U.toArray(t);for(let s of i)if(!(s in e[0]))return!1;return!0}static toArray(e,t=!1){return Array.isArray(e)?e:(t||e!==null)&&typeof e!="undefined"?[e]:[]}static inArray(e,t){for(let i=e.length-1;i>=0;i--)if(e[i]==t)return!0;return!1}static removeByValue(e,t){for(let i=e.length-1;i>=0;i--)if(e[i]==t){e.splice(i,1);break}}static pushUnique(e,t){U.inArray(e,t)||e.push(t)}static findByKey(e,t,i){for(let s in e)if(e[s][t]==i)return e[s];return null}static groupByKey(e,t){let i={};for(let s in e)i[e[s][t]]=i[e[s][t]]||[],i[e[s][t]].push(e[s]);return i}static removeByKey(e,t,i){for(let s in e)if(e[s][t]==i){e.splice(s,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let s=e.length-1;s>=0;s--)if(e[s][i]==t[i]){e[s]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){const i={};for(const s of e)i[s[t]]=s;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let s in i)typeof i[s]=="object"&&i[s]!==null?i[s]=U.filterRedactedProps(i[s],t):i[s]===t&&delete i[s];return i}static getNestedVal(e,t,i=null,s="."){let l=e||{},r=t.split(s);for(const o of r){if(!U.isObject(l)&&!Array.isArray(l)||typeof l[o]=="undefined")return i;l=l[o]}return l}static setByPath(e,t,i,s="."){if(!U.isObject(e)&&!Array.isArray(e)){console.warn("setByPath: data not an object or array.");return}let l=e,r=t.split(s),o=r.pop();for(const a of r)(!U.isObject(l)&&!Array.isArray(l)||!U.isObject(l[a])&&!Array.isArray(l[a]))&&(l[a]={}),l=l[a];l[o]=i}static deleteByPath(e,t,i="."){let s=e||{},l=t.split(i),r=l.pop();for(const o of l)(!U.isObject(s)&&!Array.isArray(s)||!U.isObject(s[o])&&!Array.isArray(s[o]))&&(s[o]={}),s=s[o];Array.isArray(s)?s.splice(r,1):U.isObject(s)&&delete s[r],l.length>0&&(Array.isArray(s)&&!s.length||U.isObject(s)&&!Object.keys(s).length)&&(Array.isArray(e)&&e.length>0||U.isObject(e)&&Object.keys(e).length>0)&&U.deleteByPath(e,l.join(i),i)}static randomString(e){e=e||10;let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let s=0;s{console.warn("Failed to copy.",i)})}static openInWindow(e,t,i,s){t=t||1024,i=i||768,s=s||"popup";let l=window.innerWidth,r=window.innerHeight;t=t>l?l:t,i=i>r?r:i;let o=l/2-t/2,a=r/2-i/2;return window.open(e,s,"width="+t+",height="+i+",top="+a+",left="+o+",resizable,menubar=no")}static getQueryString(e){let t=e.indexOf("?");if(t<0)return"";let i=e.indexOf("#");return e.substring(t+1,i>t?i:e.length)}static getQueryParams(e){let t={},i=U.getQueryString(e).split("&");for(let s in i){let l=i[s].split("=");if(l.length===2){let r=decodeURIComponent(l[1]);if(r.startsWith("{")||r.startsWith("["))try{r=JSON.parse(r)}catch{}t[decodeURIComponent(l[0])]=r}}return t}static setQueryParams(e,t,i=!0){let s=U.getQueryString(e),l=i&&s?U.getQueryParams(e):{},r=Object.assign(l,t),o="";for(let a in r)U.isEmpty(r[a])||(o&&(o+="&"),o+=encodeURIComponent(a)+"=",U.isObject(r[a])?o+=encodeURIComponent(JSON.stringify(r[a])):o+=encodeURIComponent(r[a]));return o=o?"?"+o:"",U.isEmpty(s)?e+o:e.replace("?"+s,o)}static replaceClientQueryParams(e){let t=U.setQueryParams(window.location.href,e);window.location.replace(t)}static getJWTPayload(e){const t=(e||"").split(".")[1]||"";if(t==="")return{};try{const i=decodeURIComponent(atob(t));return JSON.parse(i)||{}}catch(i){console.warn("Failed to parse JWT payload data.",i)}return{}}static hasImageExtension(e){return/\.jpg|\.jpeg|\.png|\.svg|\.webp|\.avif$/.test(e)}static checkImageUrl(e){return new Promise((t,i)=>{const s=new Image;s.onload=function(){return t(!0)},s.onerror=function(l){return i(l)},s.src=e})}static generateThumb(e,t=100,i=100){return new Promise(s=>{let l=new FileReader;l.onload=function(r){let o=new Image;o.onload=function(){let a=document.createElement("canvas"),u=a.getContext("2d"),f=o.width,c=o.height;return a.width=t,a.height=i,u.drawImage(o,f>c?(f-c)/2:0,0,f>c?c:f,f>c?c:f,0,0,t,i),s(a.toDataURL(e.type))},o.src=r.target.result},l.readAsDataURL(e)})}static setDocumentTitle(e,t="PocketBase"){let i=[];U.isEmpty(e)||i.push(e.trim()),U.isEmpty(t)||i.push(t.trim()),document.title=i.join(" - ")}static addValueToFormData(e,t,i){if(typeof i!="undefined")if(U.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const s of i)U.addValueToFormData(e,t,s);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):U.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static dummyCollectionRecord(e){var s,l,r,o,a;const t=(e==null?void 0:e.schema)||[],i={"@collectionId":e==null?void 0:e.id,"@collectionName":e==null?void 0:e.name,id:"RECORD_ID",created:"2022-01-01 01:00:00",updated:"2022-01-01 23:59:59"};for(const u of t){let f=null;u.type==="number"?f=123:u.type==="date"?f="2022-01-01 10:00:00":u.type==="bool"?f=!0:u.type==="email"?f="test@example.com":u.type==="url"?f="https://example.com":u.type==="json"?f="JSON (array/object)":u.type==="file"?(f="filename.jpg",((s=u.options)==null?void 0:s.maxSelect)>1&&(f=[f])):u.type==="select"?(f=(r=(l=u.options)==null?void 0:l.values)==null?void 0:r[0],((o=u.options)==null?void 0:o.maxSelect)>1&&(f=[f])):u.type==="relation"||u.type==="user"?(f="RELATION_RECORD_ID",((a=u.options)==null?void 0:a.maxSelect)>1&&(f=[f])):f="test",i[u.name]=f}return i}static getFieldTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"primary":return"ri-key-line";case"text":return"ri-text";case"number":return"ri-hashtag";case"date":return"ri-calendar-line";case"bool":return"ri-toggle-line";case"email":return"ri-mail-line";case"url":return"ri-link";case"select":return"ri-list-check";case"json":return"ri-braces-line";case"file":return"ri-image-line";case"relation":return"ri-mind-map";case"user":return"ri-user-line";default:return"ri-star-s-line"}}static getFieldValueType(e){var t;switch(e=e||{},e.type){case"bool":return"Boolean";case"number":return"Number";case"file":return"File";case"select":case"relation":case"user":return((t=e.options)==null?void 0:t.maxSelect)>1?"Array":"String";default:return"String"}}}const Hu=$i([]);function BP(n,e=4e3){return qu(n,"info",e)}function hn(n,e=3e3){return qu(n,"success",e)}function $0(n,e=4500){return qu(n,"error",e)}function qu(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{O0(i)},t)};Hu.update(s=>(T0(s,i.message),U.pushOrReplaceByKey(s,i,"message"),s))}function O0(n){Hu.update(e=>(T0(e,n),e))}function T0(n,e){let t;typeof e=="string"?t=U.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),U.removeByKey(n,"message",t.message))}const gs=$i({});function Wi(n){gs.set(n||{})}function D0(n){gs.update(e=>(U.deleteByPath(e,n),e))}const Vu=$i({});function xa(n){Vu.set(n||{})}Au.prototype.logout=function(n=!0){this.AuthStore.clear(),n&&So("/login")};Au.prototype.errorResponseHandler=function(n,e=!0,t=""){var l,r;if(!n||!(n instanceof Error))return;const i=((l=n==null?void 0:n.response)==null?void 0:l.status)<<0||400,s=((r=n==null?void 0:n.response)==null?void 0:r.data)||{};if(e&&i!==404){let o=s.message||n.message||t;o&&$0(o)}if(U.isEmpty(s.data)||Wi(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),So("/")};class qk extends $_{save(e,t){super.save(e,t),t instanceof Bs&&xa(t)}clear(){super.clear(),xa(null)}}const Se=new Au("/","en-US",new qk("pb_admin_auth"));Se.AuthStore.model instanceof Bs&&xa(Se.AuthStore.model);let Ga,Qi;const Za="app-tooltip";function $c(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function qi(){return Qi=Qi||document.querySelector("."+Za),Qi||(Qi=document.createElement("div"),Qi.classList.add(Za),document.body.appendChild(Qi)),Qi}function A0(n,e){let t=qi();if(!t.classList.contains("active")||!(e!=null&&e.text)){Xa();return}t.textContent=e.text,t.className=Za+" active",e.class&&t.classList.add(e.class),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,s=t.offsetWidth,l=n.getBoundingClientRect(),r=0,o=0,a=5;e.position=="left"?(r=l.top+l.height/2-i/2,o=l.left-s-a):e.position=="right"?(r=l.top+l.height/2-i/2,o=l.right+a):e.position=="top"?(r=l.top-i-a,o=l.left+l.width/2-s/2):e.position=="top-left"?(r=l.top-i-a,o=l.left):e.position=="top-right"?(r=l.top-i-a,o=l.right-s):e.position=="bottom-left"?(r=l.top+l.height+a,o=l.left):e.position=="bottom-right"?(r=l.top+l.height+a,o=l.right-s):(r=l.top+l.height+a,o=l.left+l.width/2-s/2),o+s>document.documentElement.clientWidth&&(o=document.documentElement.clientWidth-s),o=o>=0?o:0,r+i>document.documentElement.clientHeight&&(r=document.documentElement.clientHeight-i),r=r>=0?r:0,t.style.top=r+"px",t.style.left=o+"px"}function Xa(){clearTimeout(Ga),qi().classList.remove("active"),qi().activeNode=void 0}function Vk(n,e){qi().activeNode=n,clearTimeout(Ga),Ga=setTimeout(()=>{qi().classList.add("active"),A0(n,e)},isNaN(e.delay)?250:e.delay)}function St(n,e){let t=$c(e);function i(){Vk(n,t)}function s(){Xa()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&U.isFocusable(n))&&n.addEventListener("click",s),qi(),{update(l){var r,o;t=$c(l),(o=(r=qi())==null?void 0:r.activeNode)!=null&&o.contains(n)&&A0(n,t)},destroy(){var l,r;(r=(l=qi())==null?void 0:l.activeNode)!=null&&r.contains(n)&&Xa(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function Oc(n,e,t){const i=n.slice();return i[11]=e[t],i}const zk=n=>({}),Tc=n=>({uniqueId:n[3]});function Bk(n){let e=(n[11]||io)+"",t;return{c(){t=H(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||io)+"")&&_e(t,e)},d(i){i&&k(t)}}}function Uk(n){var i,s;let e=(((i=n[11])==null?void 0:i.message)||((s=n[11])==null?void 0:s.code)||io)+"",t;return{c(){t=H(e)},m(l,r){w(l,t,r)},p(l,r){var o,a;r&4&&e!==(e=(((o=l[11])==null?void 0:o.message)||((a=l[11])==null?void 0:a.code)||io)+"")&&_e(t,e)},d(l){l&&k(t)}}}function Dc(n){let e,t;function i(r,o){return typeof r[11]=="object"?Uk:Bk}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=O(),p(e,"class","help-block help-block-error")},m(r,o){w(r,e,o),l.m(e,null),m(e,t)},p(r,o){s===(s=i(r))&&l?l.p(r,o):(l.d(1),l=s(r),l&&(l.c(),l.m(e,t)))},d(r){r&&k(e),l.d()}}}function Wk(n){let e,t,i,s,l;const r=n[7].default,o=On(r,n,n[6],Tc);let a=n[2],u=[];for(let f=0;ft(5,i=g));let{$$slots:s={},$$scope:l}=e;const r="field_"+U.randomString(7);let{name:o=""}=e,{class:a=void 0}=e,u,f=[];function c(){D0(o)}di(()=>(u.addEventListener("change",c),()=>{u.removeEventListener("change",c)}));function d(g){ut.call(this,n,g)}function h(g){he[g?"unshift":"push"](()=>{u=g,t(1,u)})}return n.$$set=g=>{"name"in g&&t(4,o=g.name),"class"in g&&t(0,a=g.class),"$$scope"in g&&t(6,l=g.$$scope)},n.$$.update=()=>{n.$$.dirty&48&&t(2,f=U.toArray(U.getNestedVal(i,o)))},[a,u,f,r,o,i,l,s,d,h]}class He extends Ne{constructor(e){super(),Ie(this,e,Yk,Wk,Pe,{name:4,class:0})}}function To(n){const e=n-1;return e*e*e+1}function so(n,{delay:e=0,duration:t=400,easing:i=zl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function ti(n,{delay:e=0,duration:t=400,easing:i=To,x:s=0,y:l=0,opacity:r=0}={}){const o=getComputedStyle(n),a=+o.opacity,u=o.transform==="none"?"":o.transform,f=a*(1-r);return{delay:e,duration:t,easing:i,css:(c,d)=>` + transform: ${u} translate(${(1-c)*s}px, ${(1-c)*l}px); + opacity: ${a-f*d}`}}function un(n,{delay:e=0,duration:t=400,easing:i=To}={}){const s=getComputedStyle(n),l=+s.opacity,r=parseFloat(s.height),o=parseFloat(s.paddingTop),a=parseFloat(s.paddingBottom),u=parseFloat(s.marginTop),f=parseFloat(s.marginBottom),c=parseFloat(s.borderTopWidth),d=parseFloat(s.borderBottomWidth);return{delay:e,duration:t,easing:i,css:h=>`overflow: hidden;opacity: ${Math.min(h*20,1)*l};height: ${h*r}px;padding-top: ${h*o}px;padding-bottom: ${h*a}px;margin-top: ${h*u}px;margin-bottom: ${h*f}px;border-top-width: ${h*c}px;border-bottom-width: ${h*d}px;`}}function Un(n,{delay:e=0,duration:t=400,easing:i=To,start:s=0,opacity:l=0}={}){const r=getComputedStyle(n),o=+r.opacity,a=r.transform==="none"?"":r.transform,u=1-s,f=o*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>` + transform: ${a} scale(${1-u*d}); + opacity: ${o-f*d} + `}}function Kk(n){let e,t,i,s;return{c(){e=_("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(l,r){w(l,e,r),n[13](e),$e(e,n[7]),i||(s=X(e,"input",n[14]),i=!0)},p(l,r){r&3&&t!==(t=l[0]||l[1])&&p(e,"placeholder",t),r&128&&e.value!==l[7]&&$e(e,l[7])},i:re,o:re,d(l){l&&k(e),n[13](null),i=!1,s()}}}function Jk(n){let e,t,i,s;function l(a){n[12](a)}var r=n[4];function o(a){let u={singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return r&&(e=new r(o(n)),he.push(()=>Fe(e,"value",l)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=rt()},m(a,u){e&&V(e,a,u),w(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],Re(()=>t=!1)),r!==(r=a[4])){if(e){Te();const c=e;F(c.$$.fragment,1,0,()=>{z(c,1)}),De()}r?(e=new r(o(a)),he.push(()=>Fe(e,"value",l)),e.$on("submit",a[10]),B(e.$$.fragment),E(e.$$.fragment,1),V(e,i.parentNode,i)):e=null}else r&&e.$set(f)},i(a){s||(e&&E(e.$$.fragment,a),s=!0)},o(a){e&&F(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&z(e,a)}}}function Ac(n){let e,t,i,s,l,r,o=n[7]!==n[0]&&Ec();return{c(){o&&o.c(),e=O(),t=_("button"),t.innerHTML='Clear',p(t,"type","button"),p(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){o&&o.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(r=X(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?o?u&129&&E(o,1):(o=Ec(),o.c(),E(o,1),o.m(e.parentNode,e)):o&&(Te(),F(o,1,1,()=>{o=null}),De())},i(a){s||(E(o),Dt(()=>{i||(i=ft(t,ti,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){F(o),i||(i=ft(t,ti,{duration:150,x:5},!1)),i.run(0),s=!1},d(a){o&&o.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,r()}}}function Ec(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Search',p(e,"type","submit"),p(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(Dt(()=>{t||(t=ft(e,ti,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=ft(e,ti,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function xk(n){let e,t,i,s,l,r,o,a,u,f,c;const d=[Jk,Kk],h=[];function g(b,v){return b[4]&&!b[5]?0:1}r=g(n),o=h[r]=d[r](n);let y=(n[0].length||n[7].length)&&Ac(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=O(),o.c(),a=O(),y&&y.c(),p(s,"class","ri-search-line"),p(i,"for",n[8]),p(i,"class","m-l-10 txt-xl"),p(t,"class","searchbar"),p(e,"class","searchbar-wrapper")},m(b,v){w(b,e,v),m(e,t),m(t,i),m(i,s),m(t,l),h[r].m(t,null),m(t,a),y&&y.m(t,null),u=!0,f||(c=[X(t,"submit",Jt(n[10])),X(e,"click",Bn(n[11]))],f=!0)},p(b,[v]){let S=r;r=g(b),r===S?h[r].p(b,v):(Te(),F(h[S],1,1,()=>{h[S]=null}),De(),o=h[r],o?o.p(b,v):(o=h[r]=d[r](b),o.c()),E(o,1),o.m(t,a)),b[0].length||b[7].length?y?(y.p(b,v),v&129&&E(y,1)):(y=Ac(b),y.c(),E(y,1),y.m(t,null)):y&&(Te(),F(y,1,1,()=>{y=null}),De())},i(b){u||(E(o),E(y),u=!0)},o(b){F(o),F(y),u=!1},d(b){b&&k(e),h[r].d(),y&&y.d(),f=!1,lt(c)}}}function Gk(n,e,t){const i=vn(),s="search_"+U.randomString(7);let{value:l=""}=e,{placeholder:r='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:o=new Pn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function h($=!0){t(7,d=""),$&&(c==null||c.focus()),i("clear")}function g(){t(0,l=d),i("submit",l)}async function y(){u||f||(t(5,f=!0),t(4,u=(await bi(()=>import("./FilterAutocompleteInput.5c71eaaa.js"),[])).default),t(5,f=!1))}di(()=>{y()});function b($){ut.call(this,n,$)}function v($){d=$,t(7,d),t(0,l)}function S($){he[$?"unshift":"push"](()=>{c=$,t(6,c)})}function C(){d=this.value,t(7,d),t(0,l)}const M=()=>{h(!1),g()};return n.$$set=$=>{"value"in $&&t(0,l=$.value),"placeholder"in $&&t(1,r=$.placeholder),"autocompleteCollection"in $&&t(2,o=$.autocompleteCollection),"extraAutocompleteKeys"in $&&t(3,a=$.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,r,o,a,u,f,c,d,s,h,g,b,v,S,C,M]}class Do extends Ne{constructor(e){super(),Ie(this,e,Gk,xk,Pe,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}function Zk(n){let e,t,i,s,l;const r=n[6].default,o=On(r,n,n[5],null);return{c(){e=_("th"),o&&o.c(),p(e,"tabindex","0"),p(e,"class",t="col-sort "+n[1]),ne(e,"col-sort-disabled",n[3]),ne(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ne(e,"sort-desc",n[0]==="-"+n[2]),ne(e,"sort-asc",n[0]==="+"+n[2])},m(a,u){w(a,e,u),o&&o.m(e,null),i=!0,s||(l=[X(e,"click",n[7]),X(e,"keydown",n[8])],s=!0)},p(a,[u]){o&&o.p&&(!i||u&32)&&Dn(o,r,a,a[5],i?Tn(r,a[5],u,null):An(a[5]),null),(!i||u&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),u&10&&ne(e,"col-sort-disabled",a[3]),u&7&&ne(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),u&7&&ne(e,"sort-desc",a[0]==="-"+a[2]),u&7&&ne(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(E(o,a),i=!0)},o(a){F(o,a),i=!1},d(a){a&&k(e),o&&o.d(a),s=!1,lt(l)}}}function Xk(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{name:r}=e,{sort:o=""}=e,{disable:a=!1}=e;function u(){a||("-"+r===o?t(0,o="+"+r):t(0,o="-"+r))}const f=()=>u(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),u())};return n.$$set=d=>{"class"in d&&t(1,l=d.class),"name"in d&&t(2,r=d.name),"sort"in d&&t(0,o=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,s=d.$$scope)},[o,l,r,a,u,s,i,f,c]}class en extends Ne{constructor(e){super(),Ie(this,e,Xk,Zk,Pe,{class:1,name:2,sort:0,disable:3})}}function Qk(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function e2(n){let e,t=U.formatToUTCDate(n[0])+"",i,s,l,r,o;return{c(){e=_("span"),i=H(t),s=H(" UTC"),p(e,"class","txt")},m(a,u){w(a,e,u),m(e,i),m(e,s),r||(o=Xe(l=St.call(null,e,U.formatToLocalDate(n[0])+" Local")),r=!0)},p(a,u){u&1&&t!==(t=U.formatToUTCDate(a[0])+"")&&_e(i,t),l&&Kn(l.update)&&u&1&&l.update.call(null,U.formatToLocalDate(a[0])+" Local")},d(a){a&&k(e),r=!1,o()}}}function t2(n){let e;function t(l,r){return l[0]?e2:Qk}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,[r]){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function n2(n,e,t){let{date:i=""}=e;return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i]}class Ci extends Ne{constructor(e){super(),Ie(this,e,n2,t2,Pe,{date:0})}}function Pc(n,e,t){const i=n.slice();return i[21]=e[t],i}function i2(n){let e;return{c(){e=_("div"),e.innerHTML=` + method`,p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function s2(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="url",p(t,"class",U.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function l2(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="referer",p(t,"class",U.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function r2(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="status",p(t,"class",U.getFieldTypeIcon("number")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function o2(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function Lc(n){let e;function t(l,r){return l[6]?u2:a2}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,r){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function a2(n){var o;let e,t,i,s,l,r=((o=n[0])==null?void 0:o.length)&&Fc(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=O(),r&&r.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),r&&r.m(t,null),m(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?r?r.p(a,u):(r=Fc(a),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(a){a&&k(e),r&&r.d()}}}function u2(n){let e;return{c(){e=_("tr"),e.innerHTML=` + `},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Fc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function Ic(n){let e;return{c(){e=_("i"),p(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),p(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Nc(n,e){var se,G,Oe;let t,i,s,l=((se=e[21].method)==null?void 0:se.toUpperCase())+"",r,o,a,u,f,c=e[21].url+"",d,h,g,y,b,v,S=(e[21].referer||"N/A")+"",C,M,$,T,A,D=e[21].status+"",P,L,N,R,J,W,q,x,K,Y,te=(((G=e[21].meta)==null?void 0:G.errorMessage)||((Oe=e[21].meta)==null?void 0:Oe.errorData))&&Ic();R=new Ci({props:{date:e[21].created}});function fe(){return e[16](e[21])}function ye(...ee){return e[17](e[21],...ee)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),r=H(l),a=O(),u=_("td"),f=_("span"),d=H(c),g=O(),te&&te.c(),y=O(),b=_("td"),v=_("span"),C=H(S),$=O(),T=_("td"),A=_("span"),P=H(D),L=O(),N=_("td"),B(R.$$.fragment),J=O(),W=_("td"),W.innerHTML='',q=O(),p(s,"class",o="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),p(i,"class","col-type-text col-field-method min-width"),p(f,"class","txt txt-ellipsis"),p(f,"title",h=e[21].url),p(u,"class","col-type-text col-field-url"),p(v,"class","txt txt-ellipsis"),p(v,"title",M=e[21].referer),ne(v,"txt-hint",!e[21].referer),p(b,"class","col-type-text col-field-referer"),p(A,"class","label"),ne(A,"label-danger",e[21].status>=400),p(T,"class","col-type-number col-field-status"),p(N,"class","col-type-date col-field-created"),p(W,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(ee,be){w(ee,t,be),m(t,i),m(i,s),m(s,r),m(t,a),m(t,u),m(u,f),m(f,d),m(u,g),te&&te.m(u,null),m(t,y),m(t,b),m(b,v),m(v,C),m(t,$),m(t,T),m(T,A),m(A,P),m(t,L),m(t,N),V(R,N,null),m(t,J),m(t,W),m(t,q),x=!0,K||(Y=[X(t,"click",fe),X(t,"keydown",ye)],K=!0)},p(ee,be){var ie,ve,je;e=ee,(!x||be&8)&&l!==(l=((ie=e[21].method)==null?void 0:ie.toUpperCase())+"")&&_e(r,l),(!x||be&8&&o!==(o="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&p(s,"class",o),(!x||be&8)&&c!==(c=e[21].url+"")&&_e(d,c),(!x||be&8&&h!==(h=e[21].url))&&p(f,"title",h),((ve=e[21].meta)==null?void 0:ve.errorMessage)||((je=e[21].meta)==null?void 0:je.errorData)?te||(te=Ic(),te.c(),te.m(u,null)):te&&(te.d(1),te=null),(!x||be&8)&&S!==(S=(e[21].referer||"N/A")+"")&&_e(C,S),(!x||be&8&&M!==(M=e[21].referer))&&p(v,"title",M),be&8&&ne(v,"txt-hint",!e[21].referer),(!x||be&8)&&D!==(D=e[21].status+"")&&_e(P,D),be&8&&ne(A,"label-danger",e[21].status>=400);const ue={};be&8&&(ue.date=e[21].created),R.$set(ue)},i(ee){x||(E(R.$$.fragment,ee),x=!0)},o(ee){F(R.$$.fragment,ee),x=!1},d(ee){ee&&k(t),te&&te.d(),z(R),K=!1,lt(Y)}}}function Rc(n){let e,t,i=n[3].length+"",s,l,r;return{c(){e=_("small"),t=H("Showing "),s=H(i),l=H(" of "),r=H(n[4]),p(e,"class","block txt-hint txt-right m-t-sm")},m(o,a){w(o,e,a),m(e,t),m(e,s),m(e,l),m(e,r)},p(o,a){a&8&&i!==(i=o[3].length+"")&&_e(s,i),a&16&&_e(r,o[4])},d(o){o&&k(e)}}}function jc(n){let e,t,i,s,l=n[4]-n[3].length+"",r,o,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=H("Load more ("),r=H(l),o=H(")"),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ne(t,"btn-loading",n[6]),ne(t,"btn-disabled",n[6]),p(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(i,s),m(i,r),m(i,o),a||(u=X(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&_e(r,l),c&64&&ne(t,"btn-loading",f[6]),c&64&&ne(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function f2(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C,M,$,T,A=[],D=new Map,P,L,N,R;function J(ie){n[11](ie)}let W={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[i2]},$$scope:{ctx:n}};n[1]!==void 0&&(W.sort=n[1]),l=new en({props:W}),he.push(()=>Fe(l,"sort",J));function q(ie){n[12](ie)}let x={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[s2]},$$scope:{ctx:n}};n[1]!==void 0&&(x.sort=n[1]),a=new en({props:x}),he.push(()=>Fe(a,"sort",q));function K(ie){n[13](ie)}let Y={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[l2]},$$scope:{ctx:n}};n[1]!==void 0&&(Y.sort=n[1]),c=new en({props:Y}),he.push(()=>Fe(c,"sort",K));function te(ie){n[14](ie)}let fe={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[r2]},$$scope:{ctx:n}};n[1]!==void 0&&(fe.sort=n[1]),g=new en({props:fe}),he.push(()=>Fe(g,"sort",te));function ye(ie){n[15](ie)}let se={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[o2]},$$scope:{ctx:n}};n[1]!==void 0&&(se.sort=n[1]),v=new en({props:se}),he.push(()=>Fe(v,"sort",ye));let G=n[3];const Oe=ie=>ie[21].id;for(let ie=0;ier=!1)),l.$set(je);const Le={};ve&16777216&&(Le.$$scope={dirty:ve,ctx:ie}),!u&&ve&2&&(u=!0,Le.sort=ie[1],Re(()=>u=!1)),a.$set(Le);const qe={};ve&16777216&&(qe.$$scope={dirty:ve,ctx:ie}),!d&&ve&2&&(d=!0,qe.sort=ie[1],Re(()=>d=!1)),c.$set(qe);const oe={};ve&16777216&&(oe.$$scope={dirty:ve,ctx:ie}),!y&&ve&2&&(y=!0,oe.sort=ie[1],Re(()=>y=!1)),g.$set(oe);const le={};ve&16777216&&(le.$$scope={dirty:ve,ctx:ie}),!S&&ve&2&&(S=!0,le.sort=ie[1],Re(()=>S=!1)),v.$set(le),ve&841&&(G=ie[3],Te(),A=ot(A,ve,Oe,1,ie,G,D,T,Lt,Nc,null,Pc),De(),!G.length&&ee?ee.p(ie,ve):G.length?ee&&(ee.d(1),ee=null):(ee=Lc(ie),ee.c(),ee.m(T,null))),ve&64&&ne(t,"table-loading",ie[6]),ie[3].length?be?be.p(ie,ve):(be=Rc(ie),be.c(),be.m(L.parentNode,L)):be&&(be.d(1),be=null),ie[3].length&&ie[7]?ue?ue.p(ie,ve):(ue=jc(ie),ue.c(),ue.m(N.parentNode,N)):ue&&(ue.d(1),ue=null)},i(ie){if(!R){E(l.$$.fragment,ie),E(a.$$.fragment,ie),E(c.$$.fragment,ie),E(g.$$.fragment,ie),E(v.$$.fragment,ie);for(let ve=0;ve{D<=1&&g(),t(6,d=!1),t(3,u=u.concat(P.items)),t(5,f=P.page),t(4,c=P.totalItems),s("load",u)}).catch(P=>{P!==null&&(t(6,d=!1),console.warn(P),g(),Se.errorResponseHandler(P,!1))})}function g(){t(3,u=[]),t(5,f=1),t(4,c=0)}function y(D){a=D,t(1,a)}function b(D){a=D,t(1,a)}function v(D){a=D,t(1,a)}function S(D){a=D,t(1,a)}function C(D){a=D,t(1,a)}const M=D=>s("select",D),$=(D,P)=>{P.code==="Enter"&&(P.preventDefault(),s("select",D))},T=()=>t(0,r=""),A=()=>h(f+1);return n.$$set=D=>{"filter"in D&&t(0,r=D.filter),"presets"in D&&t(10,o=D.presets),"sort"in D&&t(1,a=D.sort)},n.$$.update=()=>{n.$$.dirty&1027&&(typeof a!="undefined"||typeof r!="undefined"||typeof o!="undefined")&&(g(),h(1)),n.$$.dirty&24&&t(7,i=c>u.length)},[r,a,h,u,c,f,d,i,s,l,o,y,b,v,S,C,M,$,T,A]}class d2 extends Ne{constructor(e){super(),Ie(this,e,c2,f2,Pe,{filter:0,presets:10,sort:1,load:2})}get load(){return this.$$.ctx[2]}}/*! + * Chart.js v3.8.0 + * https://www.chartjs.org + * (c) 2022 Chart.js Contributors + * Released under the MIT License + */const E0=function(){return typeof window=="undefined"?function(n){return n()}:window.requestAnimationFrame}();function P0(n,e,t){const i=t||(r=>Array.prototype.slice.call(r));let s=!1,l=[];return function(...r){l=i(r),s||(s=!0,E0.call(window,()=>{s=!1,n.apply(e,l)}))}}function p2(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const h2=n=>n==="start"?"left":n==="end"?"right":"center",Hc=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function mi(){}const m2=function(){let n=0;return function(){return n++}}();function Mt(n){return n===null||typeof n=="undefined"}function Pt(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function dt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Vt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Rn(n,e){return Vt(n)?n:e}function ht(n,e){return typeof n=="undefined"?e:n}const g2=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,L0=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function Rt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function Ct(n,e,t,i){let s,l,r;if(Pt(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;st;)n=n[e.slice(t,i)],t=i+1,i=qc(e,t);return n}function zu(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Wn=n=>typeof n!="undefined",Bi=n=>typeof n=="function",Vc=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function k2(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Ht=Math.PI,Et=2*Ht,w2=Et+Ht,oo=Number.POSITIVE_INFINITY,S2=Ht/180,jt=Ht/2,al=Ht/4,zc=Ht*2/3,qn=Math.log10,ai=Math.sign;function Bc(n){const e=Math.round(n);n=$l(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(qn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function C2(n){const e=[],t=Math.sqrt(n);let i;for(i=1;is-l).pop(),e}function Il(n){return!isNaN(parseFloat(n))&&isFinite(n)}function $l(n,e,t){return Math.abs(n-e)=n}function I0(n,e,t){let i,s,l;for(i=0,s=n.length;ia&&u=Math.min(e,t)-i&&n<=Math.max(e,t)+i}const vr=n=>n===0||n===1,Wc=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*Et/t)),Yc=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*Et/t)+1,Ol={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*jt)+1,easeOutSine:n=>Math.sin(n*jt),easeInOutSine:n=>-.5*(Math.cos(Ht*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>vr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>vr(n)?n:Wc(n,.075,.3),easeOutElastic:n=>vr(n)?n:Yc(n,.075,.3),easeInOutElastic(n){return vr(n)?n:n<.5?.5*Wc(n*2,.1125,.45):.5+.5*Yc(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-Ol.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Ol.easeInBounce(n*2)*.5:Ol.easeOutBounce(n*2-1)*.5+.5};/*! + * @kurkle/color v0.2.1 + * https://github.com/kurkle/color#readme + * (c) 2022 Jukka Kurkela + * Released under the MIT License + */function xl(n){return n+.5|0}const ji=(n,e,t)=>Math.max(Math.min(n,t),e);function yl(n){return ji(xl(n*2.55),0,255)}function Vi(n){return ji(xl(n*255),0,255)}function vi(n){return ji(xl(n/2.55)/100,0,1)}function Kc(n){return ji(xl(n*100),0,100)}const Nn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},eu=[..."0123456789ABCDEF"],T2=n=>eu[n&15],D2=n=>eu[(n&240)>>4]+eu[n&15],kr=n=>(n&240)>>4===(n&15),A2=n=>kr(n.r)&&kr(n.g)&&kr(n.b)&&kr(n.a);function E2(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Nn[n[1]]*17,g:255&Nn[n[2]]*17,b:255&Nn[n[3]]*17,a:e===5?Nn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Nn[n[1]]<<4|Nn[n[2]],g:Nn[n[3]]<<4|Nn[n[4]],b:Nn[n[5]]<<4|Nn[n[6]],a:e===9?Nn[n[7]]<<4|Nn[n[8]]:255})),t}const P2=(n,e)=>n<255?e(n):"";function L2(n){var e=A2(n)?T2:D2;return n?"#"+e(n.r)+e(n.g)+e(n.b)+P2(n.a,e):void 0}const F2=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function R0(n,e,t){const i=e*Math.min(t,1-t),s=(l,r=(l+n/30)%12)=>t-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function I2(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function N2(n,e,t){const i=R0(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function R2(n,e,t,i,s){return n===s?(e-t)/i+(e.5?f/(2-l-r):f/(l+r),a=R2(t,i,s,f,l),a=a*60+.5),[a|0,u||0,o]}function Wu(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Vi)}function Yu(n,e,t){return Wu(R0,n,e,t)}function j2(n,e,t){return Wu(N2,n,e,t)}function H2(n,e,t){return Wu(I2,n,e,t)}function j0(n){return(n%360+360)%360}function q2(n){const e=F2.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?yl(+e[5]):Vi(+e[5]));const s=j0(+e[2]),l=+e[3]/100,r=+e[4]/100;return e[1]==="hwb"?i=j2(s,l,r):e[1]==="hsv"?i=H2(s,l,r):i=Yu(s,l,r),{r:i[0],g:i[1],b:i[2],a:t}}function V2(n,e){var t=Uu(n);t[0]=j0(t[0]+e),t=Yu(t),n.r=t[0],n.g=t[1],n.b=t[2]}function z2(n){if(!n)return;const e=Uu(n),t=e[0],i=Kc(e[1]),s=Kc(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${vi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Jc={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},xc={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function B2(){const n={},e=Object.keys(xc),t=Object.keys(Jc);let i,s,l,r,o;for(i=0;i>16&255,l>>8&255,l&255]}return n}let wr;function U2(n){wr||(wr=B2(),wr.transparent=[0,0,0,0]);const e=wr[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const W2=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Y2(n){const e=W2.exec(n);let t=255,i,s,l;if(!!e){if(e[7]!==i){const r=+e[7];t=e[8]?yl(r):ji(r*255,0,255)}return i=+e[1],s=+e[3],l=+e[5],i=255&(e[2]?yl(i):ji(i,0,255)),s=255&(e[4]?yl(s):ji(s,0,255)),l=255&(e[6]?yl(l):ji(l,0,255)),{r:i,g:s,b:l,a:t}}}function K2(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${vi(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const ua=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Ds=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function J2(n,e,t){const i=Ds(vi(n.r)),s=Ds(vi(n.g)),l=Ds(vi(n.b));return{r:Vi(ua(i+t*(Ds(vi(e.r))-i))),g:Vi(ua(s+t*(Ds(vi(e.g))-s))),b:Vi(ua(l+t*(Ds(vi(e.b))-l))),a:n.a+t*(e.a-n.a)}}function Sr(n,e,t){if(n){let i=Uu(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Yu(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function H0(n,e){return n&&Object.assign(e||{},n)}function Gc(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=Vi(n[3]))):(e=H0(n,{r:0,g:0,b:0,a:1}),e.a=Vi(e.a)),e}function x2(n){return n.charAt(0)==="r"?Y2(n):q2(n)}class ao{constructor(e){if(e instanceof ao)return e;const t=typeof e;let i;t==="object"?i=Gc(e):t==="string"&&(i=E2(e)||U2(e)||x2(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=H0(this._rgb);return e&&(e.a=vi(e.a)),e}set rgb(e){this._rgb=Gc(e)}rgbString(){return this._valid?K2(this._rgb):void 0}hexString(){return this._valid?L2(this._rgb):void 0}hslString(){return this._valid?z2(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let l;const r=t===l?.5:t,o=2*r-1,a=i.a-s.a,u=((o*a===-1?o:(o+a)/(1+o*a))+1)/2;l=1-u,i.r=255&u*i.r+l*s.r+.5,i.g=255&u*i.g+l*s.g+.5,i.b=255&u*i.b+l*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=J2(this._rgb,e._rgb,t)),this}clone(){return new ao(this.rgb)}alpha(e){return this._rgb.a=Vi(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=xl(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Sr(this._rgb,2,e),this}darken(e){return Sr(this._rgb,2,-e),this}saturate(e){return Sr(this._rgb,1,e),this}desaturate(e){return Sr(this._rgb,1,-e),this}rotate(e){return V2(this._rgb,e),this}}function q0(n){return new ao(n)}function V0(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Zc(n){return V0(n)?n:q0(n)}function fa(n){return V0(n)?n:q0(n).saturate(.5).darken(.1).hexString()}const hs=Object.create(null),tu=Object.create(null);function Tl(n,e){if(!e)return n;const t=e.split(".");for(let i=0,s=t.length;it.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,i)=>fa(i.backgroundColor),this.hoverBorderColor=(t,i)=>fa(i.borderColor),this.hoverColor=(t,i)=>fa(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e)}set(e,t){return ca(this,e,t)}get(e){return Tl(this,e)}describe(e,t){return ca(tu,e,t)}override(e,t){return ca(hs,e,t)}route(e,t,i,s){const l=Tl(this,e),r=Tl(this,i),o="_"+t;Object.defineProperties(l,{[o]:{value:l[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[o],u=r[s];return dt(a)?Object.assign({},u,a):ht(a,u)},set(a){this[o]=a}}})}}var mt=new G2({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Z2(n){return!n||Mt(n.size)||Mt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function uo(n,e,t,i,s){let l=e[s];return l||(l=e[s]=n.measureText(s).width,t.push(s)),l>i&&(i=l),i}function X2(n,e,t,i){i=i||{};let s=i.data=i.data||{},l=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(s=i.data={},l=i.garbageCollect=[],i.font=e),n.save(),n.font=e;let r=0;const o=t.length;let a,u,f,c,d;for(a=0;at.length){for(a=0;a0&&n.stroke()}}function jl(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.xe.top-t&&n.y0&&l.strokeColor!=="";let a,u;for(n.save(),n.font=s.string,tw(n,l),a=0;a+n||0;function xu(n,e){const t={},i=dt(e),s=i?Object.keys(e):e,l=dt(n)?i?r=>ht(n[r],n[e[r]]):r=>n[r]:()=>n;for(const r of s)t[r]=rw(l(r));return t}function z0(n){return xu(n,{top:"y",right:"x",bottom:"y",left:"x"})}function js(n){return xu(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Yn(n){const e=z0(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function $n(n,e){n=n||{},e=e||mt.font;let t=ht(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=ht(n.style,e.style);i&&!(""+i).match(sw)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:ht(n.family,e.family),lineHeight:lw(ht(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:ht(n.weight,e.weight),string:""};return s.string=Z2(s),s}function Cr(n,e,t,i){let s=!0,l,r,o;for(l=0,r=n.length;lt&&o===0?0:o+a;return{min:r(i,-Math.abs(l)),max:r(s,l)}}function Yi(n,e){return Object.assign(Object.create(n),e)}function Gu(n,e,t){t=t||(r=>n[r]1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const as=(n,e,t)=>Gu(n,t,i=>n[i][e]Gu(n,t,i=>n[i][e]>=t);function uw(n,e,t){let i=0,s=n.length;for(;ii&&n[s-1]>t;)s--;return i>0||s{const i="_onData"+zu(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const r=s.apply(this,l);return n._chartjs.listeners.forEach(o=>{typeof o[i]=="function"&&o[i](...l)}),r}})})}function Qc(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,s=i.indexOf(e);s!==-1&&i.splice(s,1),!(i.length>0)&&(B0.forEach(l=>{delete n[l]}),delete n._chartjs)}function U0(n){const e=new Set;let t,i;for(t=0,i=n.length;tn[0]){Wn(i)||(i=J0("_fallback",n));const l={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:t,_fallback:i,_getTarget:s,override:r=>Zu([r,...n],e,t,i)};return new Proxy(l,{deleteProperty(r,o){return delete r[o],delete r._keys,delete n[0][o],!0},get(r,o){return Y0(r,o,()=>bw(o,e,n,r))},getOwnPropertyDescriptor(r,o){return Reflect.getOwnPropertyDescriptor(r._scopes[0],o)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(r,o){return td(r).includes(o)},ownKeys(r){return td(r)},set(r,o,a){const u=r._storage||(r._storage=s());return r[o]=u[o]=a,delete r._keys,!0}})}function Ws(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:W0(n,i),setContext:l=>Ws(n,l,t,i),override:l=>Ws(n.override(l),e,t,i)};return new Proxy(s,{deleteProperty(l,r){return delete l[r],delete n[r],!0},get(l,r,o){return Y0(l,r,()=>dw(l,r,o))},getOwnPropertyDescriptor(l,r){return l._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(l,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(l,r,o){return n[r]=o,delete l[r],!0}})}function W0(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:s=e.allKeys}=n;return{allKeys:s,scriptable:t,indexable:i,isScriptable:Bi(t)?t:()=>t,isIndexable:Bi(i)?i:()=>i}}const cw=(n,e)=>n?n+zu(e):e,Xu=(n,e)=>dt(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Y0(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function dw(n,e,t){const{_proxy:i,_context:s,_subProxy:l,_descriptors:r}=n;let o=i[e];return Bi(o)&&r.isScriptable(e)&&(o=pw(e,o,n,t)),Pt(o)&&o.length&&(o=hw(e,o,n,r.isIndexable)),Xu(e,o)&&(o=Ws(o,s,l&&l[e],r)),o}function pw(n,e,t,i){const{_proxy:s,_context:l,_subProxy:r,_stack:o}=t;if(o.has(n))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+n);return o.add(n),e=e(l,r||i),o.delete(n),Xu(n,e)&&(e=Qu(s._scopes,s,n,e)),e}function hw(n,e,t,i){const{_proxy:s,_context:l,_subProxy:r,_descriptors:o}=t;if(Wn(l.index)&&i(n))e=e[l.index%e.length];else if(dt(e[0])){const a=e,u=s._scopes.filter(f=>f!==a);e=[];for(const f of a){const c=Qu(u,s,n,f);e.push(Ws(c,l,r&&r[n],o))}}return e}function K0(n,e,t){return Bi(n)?n(e,t):n}const mw=(n,e)=>n===!0?e:typeof n=="string"?zi(e,n):void 0;function gw(n,e,t,i,s){for(const l of e){const r=mw(t,l);if(r){n.add(r);const o=K0(r._fallback,t,s);if(Wn(o)&&o!==t&&o!==i)return o}else if(r===!1&&Wn(i)&&t!==i)return null}return!1}function Qu(n,e,t,i){const s=e._rootScopes,l=K0(e._fallback,t,i),r=[...n,...s],o=new Set;o.add(i);let a=ed(o,r,t,l||t,i);return a===null||Wn(l)&&l!==t&&(a=ed(o,r,l,a,i),a===null)?!1:Zu(Array.from(o),[""],s,l,()=>_w(e,t,i))}function ed(n,e,t,i,s){for(;t;)t=gw(n,e,t,i,s);return t}function _w(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return Pt(s)&&dt(t)?t:s}function bw(n,e,t,i){let s;for(const l of e)if(s=J0(cw(l,n),t),Wn(s))return Xu(n,s)?Qu(t,i,n,s):s}function J0(n,e){for(const t of e){if(!t)continue;const i=t[n];if(Wn(i))return i}}function td(n){let e=n._keys;return e||(e=n._keys=yw(n._scopes)),e}function yw(n){const e=new Set;for(const t of n)for(const i of Object.keys(t).filter(s=>!s.startsWith("_")))e.add(i);return Array.from(e)}function x0(n,e,t,i){const{iScale:s}=n,{key:l="r"}=this._parsing,r=new Array(i);let o,a,u,f;for(o=0,a=i;oen==="x"?"y":"x";function kw(n,e,t,i){const s=n.skip?e:n,l=e,r=t.skip?e:t,o=Qa(l,s),a=Qa(r,l);let u=o/(o+a),f=a/(o+a);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const c=i*u,d=i*f;return{previous:{x:l.x-c*(r.x-s.x),y:l.y-c*(r.y-s.y)},next:{x:l.x+d*(r.x-s.x),y:l.y+d*(r.y-s.y)}}}function ww(n,e,t){const i=n.length;let s,l,r,o,a,u=Ys(n,0);for(let f=0;f!u.skip)),e.cubicInterpolationMode==="monotone")Cw(n,s);else{let u=i?n[n.length-1]:n[0];for(l=0,r=n.length;lwindow.getComputedStyle(n,null);function Ow(n,e){return Ao(n).getPropertyValue(e)}const Tw=["top","right","bottom","left"];function ds(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const l=Tw[s];i[l]=parseFloat(n[e+"-"+l+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Dw=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function Aw(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:l}=i;let r=!1,o,a;if(Dw(s,l,n.target))o=s,a=l;else{const u=e.getBoundingClientRect();o=i.clientX-u.left,a=i.clientY-u.top,r=!0}return{x:o,y:a,box:r}}function ss(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=Ao(t),l=s.boxSizing==="border-box",r=ds(s,"padding"),o=ds(s,"border","width"),{x:a,y:u,box:f}=Aw(n,t),c=r.left+(f&&o.left),d=r.top+(f&&o.top);let{width:h,height:g}=e;return l&&(h-=r.width+o.width,g-=r.height+o.height),{x:Math.round((a-c)/h*t.width/i),y:Math.round((u-d)/g*t.height/i)}}function Ew(n,e,t){let i,s;if(e===void 0||t===void 0){const l=ef(n);if(!l)e=n.clientWidth,t=n.clientHeight;else{const r=l.getBoundingClientRect(),o=Ao(l),a=ds(o,"border","width"),u=ds(o,"padding");e=r.width-u.width-a.width,t=r.height-u.height-a.height,i=po(o.maxWidth,l,"clientWidth"),s=po(o.maxHeight,l,"clientHeight")}}return{width:e,height:t,maxWidth:i||oo,maxHeight:s||oo}}const da=n=>Math.round(n*10)/10;function Pw(n,e,t,i){const s=Ao(n),l=ds(s,"margin"),r=po(s.maxWidth,n,"clientWidth")||oo,o=po(s.maxHeight,n,"clientHeight")||oo,a=Ew(n,e,t);let{width:u,height:f}=a;if(s.boxSizing==="content-box"){const c=ds(s,"border","width"),d=ds(s,"padding");u-=d.width+c.width,f-=d.height+c.height}return u=Math.max(0,u-l.width),f=Math.max(0,i?Math.floor(u/i):f-l.height),u=da(Math.min(u,r,a.maxWidth)),f=da(Math.min(f,o,a.maxHeight)),u&&!f&&(f=da(u/2)),{width:u,height:f}}function nd(n,e,t){const i=e||1,s=Math.floor(n.height*i),l=Math.floor(n.width*i);n.height=s/i,n.width=l/i;const r=n.canvas;return r.style&&(t||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==l?(n.currentDevicePixelRatio=i,r.height=s,r.width=l,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Lw=function(){let n=!1;try{const e={get passive(){return n=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return n}();function id(n,e){const t=Ow(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function ls(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function Fw(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:i==="middle"?t<.5?n.y:e.y:i==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function Iw(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},l={x:e.cp1x,y:e.cp1y},r=ls(n,s,t),o=ls(s,l,t),a=ls(l,e,t),u=ls(r,o,t),f=ls(o,a,t);return ls(u,f,t)}const sd=new Map;function Nw(n,e){e=e||{};const t=n+JSON.stringify(e);let i=sd.get(t);return i||(i=new Intl.NumberFormat(n,e),sd.set(t,i)),i}function Gl(n,e,t){return Nw(e,t).format(n)}const Rw=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},jw=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function pa(n,e,t){return n?Rw(e,t):jw()}function Hw(n,e){let t,i;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=i)}function qw(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function X0(n){return n==="angle"?{between:Nl,compare:$2,normalize:Cn}:{between:Rl,compare:(e,t)=>e-t,normalize:e=>e}}function ld({start:n,end:e,count:t,loop:i,style:s}){return{start:n%t,end:e%t,loop:i&&(e-n+1)%t===0,style:s}}function Vw(n,e,t){const{property:i,start:s,end:l}=t,{between:r,normalize:o}=X0(i),a=e.length;let{start:u,end:f,loop:c}=n,d,h;if(c){for(u+=a,f+=a,d=0,h=a;da(s,C,v)&&o(s,C)!==0,$=()=>o(l,v)===0||a(l,C,v),T=()=>y||M(),A=()=>!y||$();for(let D=f,P=f;D<=c;++D)S=e[D%r],!S.skip&&(v=u(S[i]),v!==C&&(y=a(v,s,l),b===null&&T()&&(b=o(v,s)===0?D:P),b!==null&&A()&&(g.push(ld({start:b,end:D,loop:d,count:r,style:h})),b=null),P=D,C=v));return b!==null&&g.push(ld({start:b,end:c,loop:d,count:r,style:h})),g}function eb(n,e){const t=[],i=n.segments;for(let s=0;ss&&n[l%e].skip;)l--;return l%=e,{start:s,end:l}}function Bw(n,e,t,i){const s=n.length,l=[];let r=e,o=n[e],a;for(a=e+1;a<=t;++a){const u=n[a%s];u.skip||u.stop?o.skip||(i=!1,l.push({start:e%s,end:(a-1)%s,loop:i}),e=r=u.stop?a:null):(r=a,o.skip&&(e=a)),o=u}return r!==null&&l.push({start:e%s,end:r%s,loop:i}),l}function Uw(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const l=!!n._loop,{start:r,end:o}=zw(t,s,l,i);if(i===!0)return rd(n,[{start:r,end:o,loop:l}],t,e);const a=oo({chart:e,initial:t.initial,numSteps:r,currentStep:Math.min(i-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=E0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let r=l.length-1,o=!1,a;for(;r>=0;--r)a=l[r],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),o=!0):(l[r]=l[l.length-1],l.pop());o&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);!t||(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var gi=new Kw;const ad="transparent",Jw={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Zc(n||ad),s=i.valid&&Zc(e||ad);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class xw{constructor(e,t,i,s){const l=t[i];s=Cr([e.to,s,l,e.from]);const r=Cr([e.from,l,s]);this._active=!0,this._fn=e.fn||Jw[e.type||typeof r],this._easing=Ol[e.easing]||Ol.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,r=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(r,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Cr([e.to,t,s,e.from]),this._from=Cr([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,r=this._loop,o=this._to;let a;if(this._active=l!==o&&(r||t1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,o,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});mt.set("animations",{colors:{type:"color",properties:Zw},numbers:{type:"number",properties:Gw}});mt.describe("animations",{_fallback:"animation"});mt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class tb{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!dt(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!dt(s))return;const l={};for(const r of Xw)l[r]=s[r];(Pt(s.properties)&&s.properties||[i]).forEach(r=>{(r===i||!t.has(r))&&t.set(r,l)})})}_animateOptions(e,t){const i=t.options,s=eS(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&Qw(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),r=Object.keys(t),o=Date.now();let a;for(a=r.length-1;a>=0;--a){const u=r[a];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,o);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new xw(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return gi.add(this._chart,i),!0}}function Qw(n,e){const t=[],i=Object.keys(e);for(let s=0;s0||!t&&l<0)return s.index}return null}function pd(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:l,vScale:r,index:o}=i,a=l.axis,u=r.axis,f=sS(l,r,i),c=e.length;let d;for(let h=0;ht[i].axis===e).shift()}function oS(n,e){return Yi(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function aS(n,e,t){return Yi(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function ul(n,e){const t=n.controller.index,i=n.vScale&&n.vScale.axis;if(!!i){e=e||n._parsed;for(const s of e){const l=s._stacks;if(!l||l[i]===void 0||l[i][t]===void 0)return;delete l[i][t]}}}const ma=n=>n==="reset"||n==="none",hd=(n,e)=>e?n:Object.assign({},n),uS=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:nb(t,!0),values:null};class hi{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=cd(e.vScale,e),this.addElements()}updateIndex(e){this.index!==e&&ul(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(c,d,h,g)=>c==="x"?d:c==="r"?g:h,l=t.xAxisID=ht(i.xAxisID,ha(e,"x")),r=t.yAxisID=ht(i.yAxisID,ha(e,"y")),o=t.rAxisID=ht(i.rAxisID,ha(e,"r")),a=t.indexAxis,u=t.iAxisID=s(a,l,r,o),f=t.vAxisID=s(a,r,l,o);t.xScale=this.getScaleForId(l),t.yScale=this.getScaleForId(r),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(u),t.vScale=this.getScaleForId(f)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Qc(this._data,this),e._stacked&&ul(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(dt(t))this._data=iS(t);else if(i!==t){if(i){Qc(i,this);const s=this._cachedMeta;ul(s),s._parsed=[]}t&&Object.isExtensible(t)&&fw(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const l=t._stacked;t._stacked=cd(t.vScale,t),t.stack!==i.stack&&(s=!0,ul(t),t.stack=i.stack),this._resyncElements(e),(s||l!==t._stacked)&&pd(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:s}=this,{iScale:l,_stacked:r}=i,o=l.axis;let a=e===0&&t===s.length?!0:i._sorted,u=e>0&&i._parsed[e-1],f,c,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{Pt(s[e])?d=this.parseArrayData(i,s,e,t):dt(s[e])?d=this.parseObjectData(i,s,e,t):d=this.parsePrimitiveData(i,s,e,t);const h=()=>c[o]===null||u&&c[o]y||c=0;--d)if(!g()){this.updateRangeFromParsed(u,e,h,a);break}}return u}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,l,r;for(s=0,l=t.length;s=0&&ethis.getContext(i,s),y=u.resolveNamedOptions(d,h,g,c);return y.$shared&&(y.$shared=a,l[r]=Object.freeze(hd(y,a))),y}_resolveAnimations(e,t,i){const s=this.chart,l=this._cachedDataOpts,r=`animation-${t}`,o=l[r];if(o)return o;let a;if(s.options.animation!==!1){const f=this.chart.config,c=f.datasetAnimationScopeKeys(this._type,t),d=f.getOptionScopes(this.getDataset(),c);a=f.createResolver(d,this.getContext(e,i,t))}const u=new tb(s,a&&a.animations);return a&&a._cacheable&&(l[r]=Object.freeze(u)),u}getSharedOptions(e){if(!!e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||ma(e)||this.chart._animationsDisabled}updateElement(e,t,i,s){ma(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!ma(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,s){e.active=s;const l=this.getStyle(t,s);this._resolveAnimations(t,i,s).update(e,{options:!s&&this.getSharedOptions(l)||l})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[o,a,u]of this._syncList)this[o](a,u);this._syncList=[];const s=i.length,l=t.length,r=Math.min(l,s);r&&this.parse(0,r),l>s?this._insertElements(s,l-s,e):l{for(u.length+=t,o=u.length-1;o>=r;o--)u[o]=u[o-t]};for(a(l),o=e;os-l))}return n._cache.$bar}function cS(n){const e=n.iScale,t=fS(e,n.type);let i=e._length,s,l,r,o;const a=()=>{r===32767||r===-32768||(Wn(o)&&(i=Math.min(i,Math.abs(r-o)||i)),o=r)};for(s=0,l=t.length;s0?s[n-1]:null,o=nMath.abs(o)&&(a=o,u=r),e[t.axis]=u,e._custom={barStart:a,barEnd:u,start:s,end:l,min:r,max:o}}function ib(n,e,t,i){return Pt(n)?hS(n,e,t,i):e[t.axis]=t.parse(n,i),e}function md(n,e,t,i){const s=n.iScale,l=n.vScale,r=s.getLabels(),o=s===l,a=[];let u,f,c,d;for(u=t,f=t+i;u=t?1:-1)}function gS(n){let e,t,i,s,l;return n.horizontal?(e=n.base>n.x,t="left",i="right"):(e=n.base=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}getLabelAndValue(e){const t=this._cachedMeta,{xScale:i,yScale:s}=t,l=this.getParsed(e),r=i.getLabelForValue(l.x),o=s.getLabelForValue(l.y),a=l._custom;return{label:t.label,value:"("+r+", "+o+(a?", "+a:"")+")"}}update(e){const t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:r,vScale:o}=this._cachedMeta,a=this.resolveDataElementOptions(t,s),u=this.getSharedOptions(a),f=this.includeOptions(s,u),c=r.axis,d=o.axis;for(let h=t;hNl(C,o,a,!0)?1:Math.max(M,M*t,$,$*t),g=(C,M,$)=>Nl(C,o,a,!0)?-1:Math.min(M,M*t,$,$*t),y=h(0,u,c),b=h(jt,f,d),v=g(Ht,u,c),S=g(Ht+jt,f,d);i=(y-v)/2,s=(b-S)/2,l=-(y+v)/2,r=-(b+S)/2}return{ratioX:i,ratioY:s,offsetX:l,offsetY:r}}class Zl extends hi{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let l=a=>+i[a];if(dt(i[e])){const{key:a="value"}=this._parsing;l=u=>+zi(i[u],a)}let r,o;for(r=e,o=e+t;r0&&!isNaN(e)?Et*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Gl(t._parsed[e],i.options.locale);return{label:s[e]||"",value:l}}getMaxBorderWidth(e){let t=0;const i=this.chart;let s,l,r,o,a;if(!e){for(s=0,l=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Zl.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const r=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let e=n.label;const t=": "+n.formattedValue;return Pt(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class Xl extends hi{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:s=[],_dataset:l}=t,r=this.chart._animationsDisabled;let{start:o,count:a}=kS(t,s,r);this._drawStart=o,this._drawCount=a,wS(t)&&(o=0,a=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!l._decimated,i.points=s;const u=this.resolveDatasetElementOptions(e);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:u},e),this.updateElements(s,o,a,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:r,vScale:o,_stacked:a,_dataset:u}=this._cachedMeta,f=this.resolveDataElementOptions(t,s),c=this.getSharedOptions(f),d=this.includeOptions(s,c),h=r.axis,g=o.axis,{spanGaps:y,segment:b}=this.options,v=Il(y)?y:Number.POSITIVE_INFINITY,S=this.chart._animationsDisabled||l||s==="none";let C=t>0&&this.getParsed(t-1);for(let M=t;M0&&Math.abs(T[h]-C[h])>v,b&&(A.parsed=T,A.raw=u.data[M]),d&&(A.options=c||this.resolveDataElementOptions(M,$.active?"active":s)),S||this.updateElement($,M,A,s),C=T}this.updateSharedOptions(c,s,f)}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,s=e.data||[];if(!s.length)return i;const l=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,l,r)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Xl.id="line";Xl.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Xl.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};function kS(n,e,t){const i=e.length;let s=0,l=i;if(n._sorted){const{iScale:r,_parsed:o}=n,a=r.axis,{min:u,max:f,minDefined:c,maxDefined:d}=r.getUserBounds();c&&(s=on(Math.min(as(o,r.axis,u).lo,t?i:as(e,a,r.getPixelForValue(u)).lo),0,i-1)),d?l=on(Math.max(as(o,r.axis,f).hi+1,t?0:as(e,a,r.getPixelForValue(f)).hi+1),s,i)-s:l=i-s}return{start:s,count:l}}function wS(n){const{xScale:e,yScale:t,_scaleRanges:i}=n,s={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!i)return n._scaleRanges=s,!0;const l=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==t.min||i.ymax!==t.max;return Object.assign(i,s),l}class sf extends hi{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Gl(t._parsed[e].r,i.options.locale);return{label:s[e]||"",value:l}}parseObjectData(e,t,i,s){return x0.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,s)=>{const l=this.getParsed(s).r;!isNaN(l)&&this.chart.getDataVisibility(s)&&(lt.max&&(t.max=l))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,i=e.options,s=Math.min(t.right-t.left,t.bottom-t.top),l=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?l/100*i.cutoutPercentage:1,0),o=(l-r)/e.getVisibleDatasetCount();this.outerRadius=l-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(e,t,i,s){const l=s==="reset",r=this.chart,a=r.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,c=u.yCenter,d=u.getIndexAngle(0)-.5*Ht;let h=d,g;const y=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?Xn(this.resolveDataElementOptions(e,t).angle||i):0}}sf.id="polarArea";sf.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};sf.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const r=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,lineWidth:r.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class sb extends Zl{}sb.id="pie";sb.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class lf extends hi{getLabelAndValue(e){const t=this._cachedMeta.vScale,i=this.getParsed(e);return{label:t.getLabels()[e],value:""+t.getLabelForValue(i[t.axis])}}parseObjectData(e,t,i,s){return x0.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta,i=t.dataset,s=t.data||[],l=t.iScale.getLabels();if(i.points=s,e!=="resize"){const r=this.resolveDatasetElementOptions(e);this.options.showLine||(r.borderWidth=0);const o={_loop:!0,_fullLoop:l.length===s.length,options:r};this.updateElement(i,void 0,o,e)}this.updateElements(s,0,s.length,e)}updateElements(e,t,i,s){const l=this._cachedMeta.rScale,r=s==="reset";for(let o=t;o{a[r](e[t],s)&&(l.push({element:a,datasetIndex:u,index:f}),o=o||a.inRange(e.x,e.y,s))}),i&&!o?[]:l}var OS={evaluateInteractionItems:Ql,modes:{index(n,e,t,i){const s=ss(e,n),l=t.axis||"x",r=t.includeInvisible||!1,o=t.intersect?_a(n,s,l,i,r):ba(n,s,l,!1,i,r),a=[];return o.length?(n.getSortedVisibleDatasetMetas().forEach(u=>{const f=o[0].index,c=u.data[f];c&&!c.skip&&a.push({element:c,datasetIndex:u.index,index:f})}),a):[]},dataset(n,e,t,i){const s=ss(e,n),l=t.axis||"xy",r=t.includeInvisible||!1;let o=t.intersect?_a(n,s,l,i,r):ba(n,s,l,!1,i,r);if(o.length>0){const a=o[0].datasetIndex,u=n.getDatasetMeta(a).data;o=[];for(let f=0;ft.pos===e)}function yd(n,e){return n.filter(t=>rb.indexOf(t.pos)===-1&&t.box.axis===e)}function cl(n,e){return n.sort((t,i)=>{const s=e?i:t,l=e?t:i;return s.weight===l.weight?s.index-l.index:s.weight-l.weight})}function TS(n){const e=[];let t,i,s,l,r,o;for(t=0,i=(n||[]).length;tu.box.fullSize),!0),i=cl(fl(e,"left"),!0),s=cl(fl(e,"right")),l=cl(fl(e,"top"),!0),r=cl(fl(e,"bottom")),o=yd(e,"x"),a=yd(e,"y");return{fullSize:t,leftAndTop:i.concat(l),rightAndBottom:s.concat(a).concat(r).concat(o),chartArea:fl(e,"chartArea"),vertical:i.concat(s).concat(a),horizontal:l.concat(r).concat(o)}}function vd(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function ob(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function PS(n,e,t,i){const{pos:s,box:l}=t,r=n.maxPadding;if(!dt(s)){t.size&&(n[s]-=t.size);const c=i[t.stack]||{size:0,count:1};c.size=Math.max(c.size,t.horizontal?l.height:l.width),t.size=c.size/c.count,n[s]+=t.size}l.getPadding&&ob(r,l.getPadding());const o=Math.max(0,e.outerWidth-vd(r,n,"left","right")),a=Math.max(0,e.outerHeight-vd(r,n,"top","bottom")),u=o!==n.w,f=a!==n.h;return n.w=o,n.h=a,t.horizontal?{same:u,other:f}:{same:f,other:u}}function LS(n){const e=n.maxPadding;function t(i){const s=Math.max(e[i]-n[i],0);return n[i]+=s,s}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function FS(n,e){const t=e.maxPadding;function i(s){const l={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{l[r]=Math.max(e[r],t[r])}),l}return i(n?["left","right"]:["top","bottom"])}function vl(n,e,t,i){const s=[];let l,r,o,a,u,f;for(l=0,r=n.length,u=0;l{typeof y.beforeLayout=="function"&&y.beforeLayout()});const f=a.reduce((y,b)=>b.box.options&&b.box.options.display===!1?y:y+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:l,availableHeight:r,vBoxMaxWidth:l/2/f,hBoxMaxHeight:r/2}),d=Object.assign({},s);ob(d,Yn(i));const h=Object.assign({maxPadding:d,w:l,h:r,x:s.left,y:s.top},s),g=AS(a.concat(u),c);vl(o.fullSize,h,c,g),vl(a,h,c,g),vl(u,h,c,g)&&vl(a,h,c,g),LS(h),kd(o.leftAndTop,h,c,g),h.x+=h.w,h.y+=h.h,kd(o.rightAndBottom,h,c,g),n.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},Ct(o.chartArea,y=>{const b=y.box;Object.assign(b,n.chartArea),b.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class ab{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,s){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,s?Math.floor(t/s):i)}}isAttached(e){return!0}updateConfig(e){}}class IS extends ab{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Kr="$chartjs",NS={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},wd=n=>n===null||n==="";function RS(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Kr]={initial:{height:i,width:s,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",wd(s)){const l=id(n,"width");l!==void 0&&(n.width=l)}if(wd(i))if(n.style.height==="")n.height=n.width/(e||2);else{const l=id(n,"height");l!==void 0&&(n.height=l)}return n}const ub=Lw?{passive:!0}:!1;function jS(n,e,t){n.addEventListener(e,t,ub)}function HS(n,e,t){n.canvas.removeEventListener(e,t,ub)}function qS(n,e){const t=NS[n.type]||n.type,{x:i,y:s}=ss(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ho(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function VS(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let r=!1;for(const o of l)r=r||ho(o.addedNodes,i),r=r&&!ho(o.removedNodes,i);r&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function zS(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let r=!1;for(const o of l)r=r||ho(o.removedNodes,i),r=r&&!ho(o.addedNodes,i);r&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const Hl=new Map;let Sd=0;function fb(){const n=window.devicePixelRatio;n!==Sd&&(Sd=n,Hl.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function BS(n,e){Hl.size||window.addEventListener("resize",fb),Hl.set(n,e)}function US(n){Hl.delete(n),Hl.size||window.removeEventListener("resize",fb)}function WS(n,e,t){const i=n.canvas,s=i&&ef(i);if(!s)return;const l=P0((o,a)=>{const u=s.clientWidth;t(o,a),u{const a=o[0],u=a.contentRect.width,f=a.contentRect.height;u===0&&f===0||l(u,f)});return r.observe(s),BS(n,l),r}function ya(n,e,t){t&&t.disconnect(),e==="resize"&&US(n)}function YS(n,e,t){const i=n.canvas,s=P0(l=>{n.ctx!==null&&t(qS(l,n))},n,l=>{const r=l[0];return[r,r.offsetX,r.offsetY]});return jS(i,e,s),s}class KS extends ab{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(RS(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[Kr])return!1;const i=t[Kr].initial;["height","width"].forEach(l=>{const r=i[l];Mt(r)?t.removeAttribute(l):t.setAttribute(l,r)});const s=i.style||{};return Object.keys(s).forEach(l=>{t.style[l]=s[l]}),t.width=t.width,delete t[Kr],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),r={attach:VS,detach:zS,resize:WS}[t]||YS;s[t]=r(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:ya,detach:ya,resize:ya}[t]||HS)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return Pw(e,t,i,s)}isAttached(e){const t=ef(e);return!!(t&&t.isConnected)}}function JS(n){return!Z0()||typeof OffscreenCanvas!="undefined"&&n instanceof OffscreenCanvas?IS:KS}class Oi{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return Il(this.x)&&Il(this.y)}getProps(e,t){const i=this.$animations;if(!t||!i)return this;const s={};return e.forEach(l=>{s[l]=i[l]&&i[l].active()?i[l]._to:this[l]}),s}}Oi.defaults={};Oi.defaultRoutes=void 0;const cb={values(n){return Pt(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const i=this.chart.options.locale;let s,l=n;if(t.length>1){const u=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(u<1e-4||u>1e15)&&(s="scientific"),l=xS(n,t)}const r=qn(Math.abs(l)),o=Math.max(Math.min(-1*Math.floor(r),20),0),a={notation:s,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(a,this.options.ticks.format),Gl(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(qn(n)));return i===1||i===2||i===5?cb.numeric.call(this,n,e,t):""}};function xS(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var Eo={formatters:cb};mt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,e)=>e.lineWidth,tickColor:(n,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Eo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});mt.route("scale.ticks","color","","color");mt.route("scale.grid","color","","borderColor");mt.route("scale.grid","borderColor","","borderColor");mt.route("scale.title","color","","color");mt.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});mt.describe("scales",{_fallback:"scale"});mt.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function GS(n,e){const t=n.options.ticks,i=t.maxTicksLimit||ZS(n),s=t.major.enabled?QS(e):[],l=s.length,r=s[0],o=s[l-1],a=[];if(l>i)return eC(e,a,s,l/i),a;const u=XS(s,e,i);if(l>0){let f,c;const d=l>1?Math.round((o-r)/(l-1)):null;for(Tr(e,a,u,Mt(d)?0:r-d,r),f=0,c=l-1;fs)return a}return Math.max(s,1)}function QS(n){const e=[];let t,i;for(t=0,i=n.length;tn==="left"?"right":n==="right"?"left":n,Cd=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t;function Md(n,e){const t=[],i=n.length/e,s=n.length;let l=0;for(;lr+o)))return a}function sC(n,e){Ct(n,t=>{const i=t.gc,s=i.length/2;let l;if(s>e){for(l=0;li?i:t,i=s&&t>i?t:i,{min:Rn(t,Rn(i,t)),max:Rn(i,Rn(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Rt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:l,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ow(this,l,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=o=l||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const f=this._getLabelSizes(),c=f.widest.width,d=f.highest.height,h=on(this.chart.width-c,0,this.maxWidth);o=e.offset?this.maxWidth/i:h/(i-1),c+6>o&&(o=h/(i-(e.offset?.5:1)),a=this.maxHeight-dl(e.grid)-t.padding-$d(e.title,this.chart.options.font),u=Math.sqrt(c*c+d*d),r=Bu(Math.min(Math.asin(on((f.highest.height+6)/o,-1,1)),Math.asin(on(a/u,-1,1))-Math.asin(on(d/u,-1,1)))),r=Math.max(s,Math.min(l,r))),this.labelRotation=r}afterCalculateLabelRotation(){Rt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Rt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:l}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){const a=$d(s,t.options.font);if(o?(e.width=this.maxWidth,e.height=dl(l)+a):(e.height=this.maxHeight,e.width=dl(l)+a),i.display&&this.ticks.length){const{first:u,last:f,widest:c,highest:d}=this._getLabelSizes(),h=i.padding*2,g=Xn(this.labelRotation),y=Math.cos(g),b=Math.sin(g);if(o){const v=i.mirror?0:b*c.width+y*d.height;e.height=Math.min(this.maxHeight,e.height+v+h)}else{const v=i.mirror?0:y*c.width+b*d.height;e.width=Math.min(this.maxWidth,e.width+v+h)}this._calculatePadding(u,f,b,y)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,s){const{ticks:{align:l,padding:r},position:o}=this.options,a=this.labelRotation!==0,u=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const f=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,h=0;a?u?(d=s*e.width,h=i*t.height):(d=i*e.height,h=s*t.width):l==="start"?h=t.width:l==="end"?d=e.width:l!=="inner"&&(d=e.width/2,h=t.width/2),this.paddingLeft=Math.max((d-f+r)*this.width/(this.width-f),0),this.paddingRight=Math.max((h-c+r)*this.width/(this.width-c),0)}else{let f=t.height/2,c=e.height/2;l==="start"?(f=0,c=e.height):l==="end"&&(f=t.height,c=0),this.paddingTop=f+r,this.paddingBottom=c+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Rt(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t({width:l[A]||0,height:r[A]||0});return{first:T(0),last:T(t-1),widest:T(M),highest:T($),widths:l,heights:r}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return O2(this._alignToPixels?es(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&eo*s?o/i:a/s:a*s0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:l,position:r}=s,o=l.offset,a=this.isHorizontal(),f=this.ticks.length+(o?1:0),c=dl(l),d=[],h=l.setContext(this.getContext()),g=h.drawBorder?h.borderWidth:0,y=g/2,b=function(q){return es(i,q,g)};let v,S,C,M,$,T,A,D,P,L,N,R;if(r==="top")v=b(this.bottom),T=this.bottom-c,D=v-y,L=b(e.top)+y,R=e.bottom;else if(r==="bottom")v=b(this.top),L=e.top,R=b(e.bottom)-y,T=v+y,D=this.top+c;else if(r==="left")v=b(this.right),$=this.right-c,A=v-y,P=b(e.left)+y,N=e.right;else if(r==="right")v=b(this.left),P=e.left,N=b(e.right)-y,$=v+y,A=this.left+c;else if(t==="x"){if(r==="center")v=b((e.top+e.bottom)/2+.5);else if(dt(r)){const q=Object.keys(r)[0],x=r[q];v=b(this.chart.scales[q].getPixelForValue(x))}L=e.top,R=e.bottom,T=v+y,D=T+c}else if(t==="y"){if(r==="center")v=b((e.left+e.right)/2);else if(dt(r)){const q=Object.keys(r)[0],x=r[q];v=b(this.chart.scales[q].getPixelForValue(x))}$=v-y,A=$-c,P=e.left,N=e.right}const J=ht(s.ticks.maxTicksLimit,f),W=Math.max(1,Math.ceil(f/J));for(S=0;Sl.value===e);return s>=0?t.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let l,r;const o=(a,u,f)=>{!f.width||!f.color||(i.save(),i.lineWidth=f.width,i.strokeStyle=f.color,i.setLineDash(f.borderDash||[]),i.lineDashOffset=f.borderDashOffset,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(u.x,u.y),i.stroke(),i.restore())};if(t.display)for(l=0,r=s.length;l{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:t,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let l,r;for(l=0,r=t.length;l{const i=t.split("."),s=i.pop(),l=[n].concat(i).join("."),r=e[t].split("."),o=r.pop(),a=r.join(".");mt.route(l,s,a,o)})}function cC(n){return"id"in n&&"defaults"in n}class dC{constructor(){this.controllers=new Dr(hi,"datasets",!0),this.elements=new Dr(Oi,"elements"),this.plugins=new Dr(Object,"plugins"),this.scales=new Dr(_s,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(s=>{const l=i||this._getRegistryForType(s);i||l.isForType(s)||l===this.plugins&&s.id?this._exec(e,l,s):Ct(s,r=>{const o=i||this._getRegistryForType(r);this._exec(e,o,r)})})}_exec(e,t,i){const s=zu(e);Rt(i["before"+s],[],i),t[e](i),Rt(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;tl.filter(o=>!r.some(a=>o.plugin.id===a.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function hC(n){const e=[],t=Object.keys(wi.plugins.items);for(let s=0;s{const a=i[o];if(!dt(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const u=lu(o,a),f=yC(u,s),c=t.scales||{};l[u]=l[u]||o,r[o]=Ml(Object.create(null),[{axis:u},a,c[u],c[f]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,u=o.indexAxis||su(a,e),c=(hs[a]||{}).scales||{};Object.keys(c).forEach(d=>{const h=bC(d,u),g=o[h+"AxisID"]||l[h]||h;r[g]=r[g]||Object.create(null),Ml(r[g],[{axis:h},i[g],c[d]])})}),Object.keys(r).forEach(o=>{const a=r[o];Ml(a,[mt.scales[a.type],mt.scale])}),r}function db(n){const e=n.options||(n.options={});e.plugins=ht(e.plugins,{}),e.scales=kC(n,e)}function pb(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function wC(n){return n=n||{},n.data=pb(n.data),db(n),n}const Od=new Map,hb=new Set;function Ar(n,e){let t=Od.get(n);return t||(t=e(),Od.set(n,t),hb.add(t)),t}const pl=(n,e,t)=>{const i=zi(e,t);i!==void 0&&n.add(i)};class SC{constructor(e){this._config=wC(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=pb(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),db(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Ar(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Ar(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Ar(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return Ar(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let s=i.get(e);return(!s||t)&&(s=new Map,i.set(e,s)),s}getOptionScopes(e,t,i){const{options:s,type:l}=this,r=this._cachedScopes(e,i),o=r.get(t);if(o)return o;const a=new Set;t.forEach(f=>{e&&(a.add(e),f.forEach(c=>pl(a,e,c))),f.forEach(c=>pl(a,s,c)),f.forEach(c=>pl(a,hs[l]||{},c)),f.forEach(c=>pl(a,mt,c)),f.forEach(c=>pl(a,tu,c))});const u=Array.from(a);return u.length===0&&u.push(Object.create(null)),hb.has(t)&&r.set(t,u),u}chartOptionScopes(){const{options:e,type:t}=this;return[e,hs[t]||{},mt.datasets[t]||{},{type:t},mt,tu]}resolveNamedOptions(e,t,i,s=[""]){const l={$shared:!0},{resolver:r,subPrefixes:o}=Td(this._resolverCache,e,s);let a=r;if(MC(r,t)){l.$shared=!1,i=Bi(i)?i():i;const u=this.createResolver(e,i,o);a=Ws(r,i,u)}for(const u of t)l[u]=a[u];return l}createResolver(e,t,i=[""],s){const{resolver:l}=Td(this._resolverCache,e,i);return dt(t)?Ws(l,t,void 0,s):l}}function Td(n,e,t){let i=n.get(e);i||(i=new Map,n.set(e,i));const s=t.join();let l=i.get(s);return l||(l={resolver:Zu(e,t),subPrefixes:t.filter(o=>!o.toLowerCase().includes("hover"))},i.set(s,l)),l}const CC=n=>dt(n)&&Object.getOwnPropertyNames(n).reduce((e,t)=>e||Bi(n[t]),!1);function MC(n,e){const{isScriptable:t,isIndexable:i}=W0(n);for(const s of e){const l=t(s),r=i(s),o=(r||l)&&n[s];if(l&&(Bi(o)||CC(o))||r&&Pt(o))return!0}return!1}var $C="3.8.0";const OC=["top","bottom","left","right","chartArea"];function Dd(n,e){return n==="top"||n==="bottom"||OC.indexOf(n)===-1&&e==="x"}function Ad(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function Ed(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),Rt(t&&t.onComplete,[n],e)}function TC(n){const e=n.chart,t=e.options.animation;Rt(t&&t.onProgress,[n],e)}function mb(n){return Z0()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const mo={},gb=n=>{const e=mb(n);return Object.values(mo).filter(t=>t.canvas===e).pop()};function DC(n,e,t){const i=Object.keys(n);for(const s of i){const l=+s;if(l>=e){const r=n[s];delete n[s],(t>0||l>e)&&(n[l+t]=r)}}}function AC(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}class go{constructor(e,t){const i=this.config=new SC(t),s=mb(e),l=gb(s);if(l)throw new Error("Canvas is already in use. Chart with ID '"+l.id+"' must be destroyed before the canvas can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||JS(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,r.aspectRatio),a=o&&o.canvas,u=a&&a.height,f=a&&a.width;if(this.id=m2(),this.ctx=o,this.canvas=a,this.width=f,this.height=u,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new pC,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=p2(c=>this.update(c),r.resizeDelay||0),this._dataChanges=[],mo[this.id]=this,!o||!a){console.error("Failed to create chart: can't acquire context from the given item");return}gi.listen(this,"complete",Ed),gi.listen(this,"progress",TC),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:l}=this;return Mt(e)?t&&l?l:s?i/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():nd(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Xc(this.canvas,this.ctx),this}stop(){return gi.stop(this),this}resize(e,t){gi.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,s=this.canvas,l=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,e,t,l),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,nd(this,o,!0)&&(this.notifyPlugins("resize",{size:r}),Rt(i.onResize,[this,r],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};Ct(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((r,o)=>(r[o]=!1,r),{});let l=[];t&&(l=l.concat(Object.keys(t).map(r=>{const o=t[r],a=lu(r,o),u=a==="r",f=a==="x";return{options:o,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),Ct(l,r=>{const o=r.options,a=o.id,u=lu(a,o),f=ht(o.type,r.dtype);(o.position===void 0||Dd(o.position,u)!==Dd(r.dposition))&&(o.position=r.dposition),s[a]=!0;let c=null;if(a in i&&i[a].type===f)c=i[a];else{const d=wi.getScale(f);c=new d({id:a,type:f,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(o,e)}),Ct(s,(r,o)=>{r||delete i[o]}),Ct(i,r=>{Or.configure(this,r,r.options),Or.addBox(this,r)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((s,l)=>s.index-l.index),i>t){for(let s=t;st.length&&delete this._stacks,e.forEach((i,s)=>{t.filter(l=>l===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const l=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Ad("z","_idx"));const{_active:o,_lastEvent:a}=this;a?this._eventHandler(a,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Ct(this.scales,e=>{Or.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!Vc(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:l}of t){const r=i==="_removeElements"?-l:l;DC(e,s,r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=l=>new Set(e.filter(r=>r[0]===l).map((r,o)=>o+","+r.splice(1).join(","))),s=i(0);for(let l=1;ll.split(",")).map(l=>({method:l[1],start:+l[2],count:+l[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Or.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],Ct(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,l)=>{s._idx=l}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,s=!i.disabled,l=this.chartArea,r={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Ku(t,{left:i.left===!1?0:l.left-i.left,right:i.right===!1?this.width:l.right+i.right,top:i.top===!1?0:l.top-i.top,bottom:i.bottom===!1?this.height:l.bottom+i.bottom}),e.controller.draw(),s&&Ju(t),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return jl(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const l=OS.modes[t];return typeof l=="function"?l(this,e,i,s):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let s=i.filter(l=>l&&l._dataset===t).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Yi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const s=i?"show":"hide",l=this.getDatasetMeta(e),r=l.controller._resolveAnimations(void 0,s);Wn(t)?(l.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(l,{visible:i}),this.update(o=>o.datasetIndex===e?s:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),gi.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,l,r),e[l]=r},s=(l,r,o)=>{l.offsetX=r,l.offsetY=o,this._eventHandler(l)};Ct(this.options.events,l=>i(l,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(a,u)=>{t.addEventListener(this,a,u),e[a]=u},s=(a,u)=>{e[a]&&(t.removeEventListener(this,a,u),delete e[a])},l=(a,u)=>{this.canvas&&this.resize(a,u)};let r;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",l),i("detach",r)};r=()=>{this.attached=!1,s("resize",l),this._stop(),this._resize(0,0),i("attach",o)},t.isAttached(this.canvas)?o():r()}unbindEvents(){Ct(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},Ct(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const s=i?"set":"remove";let l,r,o,a;for(t==="dataset"&&(l=this.getDatasetMeta(e[0].datasetIndex),l.controller["_"+s+"DatasetHoverStyle"]()),o=0,a=e.length;o{const o=this.getDatasetMeta(l);if(!o)throw new Error("No dataset found at index "+l);return{datasetIndex:l,element:o.data[r],index:r}});!lo(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}_updateHoverStyles(e,t,i){const s=this.options.hover,l=(a,u)=>a.filter(f=>!u.some(c=>f.datasetIndex===c.datasetIndex&&f.index===c.index)),r=l(t,e),o=i?e:l(e,t);r.length&&this.updateHoverStyle(r,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=r=>(r.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const l=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(l||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:s=[],options:l}=this,r=t,o=this._getActiveElements(e,s,i,r),a=k2(e),u=AC(e,this._lastEvent,i,a);i&&(this._lastEvent=null,Rt(l.onHover,[e,o,this],this),a&&Rt(l.onClick,[e,o,this],this));const f=!lo(o,s);return(f||t)&&(this._active=o,this._updateHoverStyles(o,s,t)),this._lastEvent=u,f}_getActiveElements(e,t,i,s){if(e.type==="mouseout")return[];if(!i)return t;const l=this.options.hover;return this.getElementsAtEventForMode(e,l.mode,l,s)}}const Pd=()=>Ct(go.instances,n=>n._plugins.invalidate()),Ai=!0;Object.defineProperties(go,{defaults:{enumerable:Ai,value:mt},instances:{enumerable:Ai,value:mo},overrides:{enumerable:Ai,value:hs},registry:{enumerable:Ai,value:wi},version:{enumerable:Ai,value:$C},getChart:{enumerable:Ai,value:gb},register:{enumerable:Ai,value:(...n)=>{wi.add(...n),Pd()}},unregister:{enumerable:Ai,value:(...n)=>{wi.remove(...n),Pd()}}});function _b(n,e,t){const{startAngle:i,pixelMargin:s,x:l,y:r,outerRadius:o,innerRadius:a}=e;let u=s/o;n.beginPath(),n.arc(l,r,o,i-u,t+u),a>s?(u=s/a,n.arc(l,r,a,t+u,i-u,!0)):n.arc(l,r,s,t+jt,i-jt),n.closePath(),n.clip()}function EC(n){return xu(n,["outerStart","outerEnd","innerStart","innerEnd"])}function PC(n,e,t,i){const s=EC(n.options.borderRadius),l=(t-e)/2,r=Math.min(l,i*e/2),o=a=>{const u=(t-Math.min(l,a))*i/2;return on(a,0,Math.min(l,u))};return{outerStart:o(s.outerStart),outerEnd:o(s.outerEnd),innerStart:on(s.innerStart,0,r),innerEnd:on(s.innerEnd,0,r)}}function As(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function ru(n,e,t,i,s){const{x:l,y:r,startAngle:o,pixelMargin:a,innerRadius:u}=e,f=Math.max(e.outerRadius+i+t-a,0),c=u>0?u+i+t+a:0;let d=0;const h=s-o;if(i){const x=u>0?u-i:0,K=f>0?f-i:0,Y=(x+K)/2,te=Y!==0?h*Y/(Y+i):h;d=(h-te)/2}const g=Math.max(.001,h*f-t/Ht)/f,y=(h-g)/2,b=o+y+d,v=s-y-d,{outerStart:S,outerEnd:C,innerStart:M,innerEnd:$}=PC(e,c,f,v-b),T=f-S,A=f-C,D=b+S/T,P=v-C/A,L=c+M,N=c+$,R=b+M/L,J=v-$/N;if(n.beginPath(),n.arc(l,r,f,D,P),C>0){const x=As(A,P,l,r);n.arc(x.x,x.y,C,P,v+jt)}const W=As(N,v,l,r);if(n.lineTo(W.x,W.y),$>0){const x=As(N,J,l,r);n.arc(x.x,x.y,$,v+jt,J+Math.PI)}if(n.arc(l,r,c,v-$/c,b+M/c,!0),M>0){const x=As(L,R,l,r);n.arc(x.x,x.y,M,R+Math.PI,b-jt)}const q=As(T,b,l,r);if(n.lineTo(q.x,q.y),S>0){const x=As(T,D,l,r);n.arc(x.x,x.y,S,b-jt,D)}n.closePath()}function LC(n,e,t,i){const{fullCircles:s,startAngle:l,circumference:r}=e;let o=e.endAngle;if(s){ru(n,e,t,i,l+Et);for(let a=0;a=Et||Nl(l,o,a),y=Rl(r,u+d,f+d);return g&&y}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:l,innerRadius:r,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),{offset:a,spacing:u}=this.options,f=(s+l)/2,c=(r+o+u+a)/2;return{x:t+Math.cos(f)*c,y:i+Math.sin(f)*c}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:i}=this,s=(t.offset||0)/2,l=(t.spacing||0)/2;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=i>Et?Math.floor(i/Et):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let r=0;if(s){r=s/2;const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*r,Math.sin(a)*r),this.circumference>=Ht&&(r=s)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;const o=LC(e,this,r,l);IC(e,this,r,l,o),e.restore()}}of.id="arc";of.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0};of.defaultRoutes={backgroundColor:"backgroundColor"};function bb(n,e,t=e){n.lineCap=ht(t.borderCapStyle,e.borderCapStyle),n.setLineDash(ht(t.borderDash,e.borderDash)),n.lineDashOffset=ht(t.borderDashOffset,e.borderDashOffset),n.lineJoin=ht(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=ht(t.borderWidth,e.borderWidth),n.strokeStyle=ht(t.borderColor,e.borderColor)}function NC(n,e,t){n.lineTo(t.x,t.y)}function RC(n){return n.stepped?Q2:n.tension||n.cubicInterpolationMode==="monotone"?ew:NC}function yb(n,e,t={}){const i=n.length,{start:s=0,end:l=i-1}=t,{start:r,end:o}=e,a=Math.max(s,r),u=Math.min(l,o),f=so&&l>o;return{count:i,start:a,loop:e.loop,ilen:u(r+(u?o-M:M))%l,C=()=>{y!==b&&(n.lineTo(f,b),n.lineTo(f,y),n.lineTo(f,v))};for(a&&(h=s[S(0)],n.moveTo(h.x,h.y)),d=0;d<=o;++d){if(h=s[S(d)],h.skip)continue;const M=h.x,$=h.y,T=M|0;T===g?($b&&(b=$),f=(c*f+M)/++c):(C(),n.lineTo(M,$),g=T,c=0,y=b=$),v=$}C()}function ou(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?HC:jC}function qC(n){return n.stepped?Fw:n.tension||n.cubicInterpolationMode==="monotone"?Iw:ls}function VC(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),bb(n,e.options),n.stroke(s)}function zC(n,e,t,i){const{segments:s,options:l}=e,r=ou(e);for(const o of s)bb(n,l,o.style),n.beginPath(),r(n,e,o,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const BC=typeof Path2D=="function";function UC(n,e,t,i){BC&&!e.options.segment?VC(n,e,t,i):zC(n,e,t,i)}class Ki extends Oi{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;$w(this._points,i,e,s,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Uw(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,s=e[t],l=this.points,r=eb(this,{property:t,start:s,end:s});if(!r.length)return;const o=[],a=qC(i);let u,f;for(u=0,f=r.length;un!=="borderDash"&&n!=="fill"};function Ld(n,e,t,i){const s=n.options,{[t]:l}=n.getProps([t],i);return Math.abs(e-l){o=uf(r,o,s);const a=s[r],u=s[o];i!==null?(l.push({x:a.x,y:i}),l.push({x:u.x,y:i})):t!==null&&(l.push({x:t,y:a.y}),l.push({x:t,y:u.y}))}),l}function uf(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Fd(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function kb(n,e){let t=[],i=!1;return Pt(n)?(i=!0,t=n):t=ZC(n,e),t.length?new Ki({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function XC(n,e,t){let s=n[e].fill;const l=[e];let r;if(!t)return s;for(;s!==!1&&l.indexOf(s)===-1;){if(!Vt(s))return s;if(r=n[s],!r)return!1;if(r.visible)return s;l.push(s),s=r.fill}return!1}function QC(n,e,t){const i=i3(n);if(dt(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Vt(s)&&Math.floor(s)===s?e3(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function e3(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function t3(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:dt(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function n3(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:dt(n)?i=n.value:i=e.getBaseValue(),i}function i3(n){const e=n.options,t=e.fill;let i=ht(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function s3(n){const{scale:e,index:t,line:i}=n,s=[],l=i.segments,r=i.points,o=l3(e,t);o.push(kb({x:null,y:e.bottom},i));for(let a=0;a=0;--r){const o=s[r].$filler;!o||(o.line.updateControlPoints(l,o.axis),i&&wa(n.ctx,o,l))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const l=i[s].$filler;l&&wa(n.ctx,l,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!i||i.fill===!1||t.drawTime!=="beforeDatasetDraw"||wa(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Dl={average(n){if(!n.length)return!1;let e,t,i=0,s=0,l=0;for(e=0,t=n.length;e-1?n.split(` +`):n}function g3(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:r,value:o}=l.getLabelAndValue(s);return{chart:n,label:r,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:o,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function jd(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:r,boxHeight:o}=e,a=$n(e.bodyFont),u=$n(e.titleFont),f=$n(e.footerFont),c=l.length,d=s.length,h=i.length,g=Yn(e.padding);let y=g.height,b=0,v=i.reduce((M,$)=>M+$.before.length+$.lines.length+$.after.length,0);if(v+=n.beforeBody.length+n.afterBody.length,c&&(y+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),v){const M=e.displayColors?Math.max(o,a.lineHeight):a.lineHeight;y+=h*M+(v-h)*a.lineHeight+(v-1)*e.bodySpacing}d&&(y+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const C=function(M){b=Math.max(b,t.measureText(M).width+S)};return t.save(),t.font=u.string,Ct(n.title,C),t.font=a.string,Ct(n.beforeBody.concat(n.afterBody),C),S=e.displayColors?r+2+e.boxPadding:0,Ct(i,M=>{Ct(M.before,C),Ct(M.lines,C),Ct(M.after,C)}),S=0,t.font=f.string,Ct(n.footer,C),t.restore(),b+=g.width,{width:b,height:y}}function _3(n,e){const{y:t,height:i}=e;return tn.height-i/2?"bottom":"center"}function b3(n,e,t,i){const{x:s,width:l}=i,r=t.caretSize+t.caretPadding;if(n==="left"&&s+l+r>e.width||n==="right"&&s-l-r<0)return!0}function y3(n,e,t,i){const{x:s,width:l}=t,{width:r,chartArea:{left:o,right:a}}=n;let u="center";return i==="center"?u=s<=(o+a)/2?"left":"right":s<=l/2?u="left":s>=r-l/2&&(u="right"),b3(u,n,e,t)&&(u="center"),u}function Hd(n,e,t){const i=t.yAlign||e.yAlign||_3(n,t);return{xAlign:t.xAlign||e.xAlign||y3(n,e,t,i),yAlign:i}}function v3(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function k3(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function qd(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:r}=n,{xAlign:o,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:h}=js(r);let g=v3(e,o);const y=k3(e,a,u);return a==="center"?o==="left"?g+=u:o==="right"&&(g-=u):o==="left"?g-=Math.max(f,d)+s:o==="right"&&(g+=Math.max(c,h)+s),{x:on(g,0,i.width-e.width),y:on(y,0,i.height-e.height)}}function Er(n,e,t){const i=Yn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function Vd(n){return si([],_i(n))}function w3(n,e,t){return Yi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function zd(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class uu extends Oi{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new tb(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=w3(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),r=i.afterTitle.apply(this,[e]);let o=[];return o=si(o,_i(s)),o=si(o,_i(l)),o=si(o,_i(r)),o}getBeforeBody(e,t){return Vd(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return Ct(e,l=>{const r={before:[],lines:[],after:[]},o=zd(i,l);si(r.before,_i(o.beforeLabel.call(this,l))),si(r.lines,o.label.call(this,l)),si(r.after,_i(o.afterLabel.call(this,l))),s.push(r)}),s}getAfterBody(e,t){return Vd(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const{callbacks:i}=t,s=i.beforeFooter.apply(this,[e]),l=i.footer.apply(this,[e]),r=i.afterFooter.apply(this,[e]);let o=[];return o=si(o,_i(s)),o=si(o,_i(l)),o=si(o,_i(r)),o}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],r=[];let o=[],a,u;for(a=0,u=t.length;ae.filter(f,c,d,i))),e.itemSort&&(o=o.sort((f,c)=>e.itemSort(f,c,i))),Ct(o,f=>{const c=zd(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),r.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=r,this.dataPoints=o,o}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let l,r=[];if(!s.length)this.opacity!==0&&(l={opacity:0});else{const o=Dl[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const a=this._size=jd(this,i),u=Object.assign({},o,a),f=Hd(this.chart,i,u),c=qd(i,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,l={opacity:1,x:c.x,y:c.y,width:a.width,height:a.height,caretX:o.x,caretY:o.y}}this._tooltipItems=r,this.$context=void 0,l&&this._resolveAnimations().update(this,l),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,s){const l=this.getCaretPosition(e,i,s);t.lineTo(l.x1,l.y1),t.lineTo(l.x2,l.y2),t.lineTo(l.x3,l.y3)}getCaretPosition(e,t,i){const{xAlign:s,yAlign:l}=this,{caretSize:r,cornerRadius:o}=i,{topLeft:a,topRight:u,bottomLeft:f,bottomRight:c}=js(o),{x:d,y:h}=e,{width:g,height:y}=t;let b,v,S,C,M,$;return l==="center"?(M=h+y/2,s==="left"?(b=d,v=b-r,C=M+r,$=M-r):(b=d+g,v=b+r,C=M-r,$=M+r),S=b):(s==="left"?v=d+Math.max(a,f)+r:s==="right"?v=d+g-Math.max(u,c)-r:v=this.caretX,l==="top"?(C=h,M=C-r,b=v-r,S=v+r):(C=h+y,M=C+r,b=v+r,S=v-r),$=C),{x1:b,x2:v,x3:S,y1:C,y2:M,y3:$}}drawTitle(e,t,i){const s=this.title,l=s.length;let r,o,a;if(l){const u=pa(i.rtl,this.x,this.width);for(e.x=Er(this,i.titleAlign,i),t.textAlign=u.textAlign(i.titleAlign),t.textBaseline="middle",r=$n(i.titleFont),o=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string,a=0;aC!==0)?(e.beginPath(),e.fillStyle=l.multiKeyBackground,co(e,{x:b,y,w:u,h:a,radius:S}),e.fill(),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),co(e,{x:v,y:y+1,w:u-2,h:a-2,radius:S}),e.fill()):(e.fillStyle=l.multiKeyBackground,e.fillRect(b,y,u,a),e.strokeRect(b,y,u,a),e.fillStyle=r.backgroundColor,e.fillRect(v,y+1,u-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:l,bodyAlign:r,displayColors:o,boxHeight:a,boxWidth:u,boxPadding:f}=i,c=$n(i.bodyFont);let d=c.lineHeight,h=0;const g=pa(i.rtl,this.x,this.width),y=function(D){t.fillText(D,g.x(e.x+h),e.y+d/2),e.y+=d+l},b=g.textAlign(r);let v,S,C,M,$,T,A;for(t.textAlign=r,t.textBaseline="middle",t.font=c.string,e.x=Er(this,b,i),t.fillStyle=i.bodyColor,Ct(this.beforeBody,y),h=o&&b!=="right"?r==="center"?u/2+f:u+2+f:0,M=0,T=s.length;M0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,l=i&&i.y;if(s||l){const r=Dl[e.position].call(this,this._active,this._eventPosition);if(!r)return;const o=this._size=jd(this,e),a=Object.assign({},r,this._size),u=Hd(t,e,a),f=qd(e,a,u,t);(s._to!==f.x||l._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=o.width,this.height=o.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const s={width:this.width,height:this.height},l={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Yn(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=i,this.drawBackground(l,e,s,t),Hw(e,t.textDirection),l.y+=r.top,this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),qw(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:o,index:a})=>{const u=this.chart.getDatasetMeta(o);if(!u)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:u.data[a],index:a}}),l=!lo(i,s),r=this._positionChanged(s,t);(l||r)&&(this._active=s,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,l=this._active||[],r=this._getActiveElements(e,l,t,i),o=this._positionChanged(r,e),a=t||!lo(r,l)||o;return a&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),a}_getActiveElements(e,t,i,s){const l=this.options;if(e.type==="mouseout")return[];if(!s)return t;const r=this.chart.getElementsAtEventForMode(e,l.mode,l,i);return l.reverse&&r.reverse(),r}_positionChanged(e,t){const{caretX:i,caretY:s,options:l}=this,r=Dl[l.position].call(this,e,t);return r!==!1&&(i!==r.x||s!==r.y)}}uu.positioners=Dl;var S3={id:"tooltip",_element:uu,positioners:Dl,afterInit(n,e,t){t&&(n.tooltip=new uu({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",t)===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:mi,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndexn!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const C3=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function M3(n,e,t,i){const s=n.indexOf(e);if(s===-1)return C3(n,e,t,i);const l=n.lastIndexOf(e);return s!==l?t:s}const $3=(n,e)=>n===null?null:on(Math.round(n),0,e);class fu extends _s{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const i=this.getLabels();for(const{index:s,label:l}of t)i[s]===l&&i.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(Mt(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:M3(i,e,ht(t,e),this._addedLabels),$3(t,i.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(i=0),t||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const e=this.min,t=this.max,i=this.options.offset,s=[];let l=this.getLabels();l=e===0&&t===l.length-1?l:l.slice(e,t+1),this._valueRange=Math.max(l.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=e;r<=t;r++)s.push({value:r});return s}getLabelForValue(e){const t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}fu.id="category";fu.defaults={ticks:{callback:fu.prototype.getLabelForValue}};function O3(n,e){const t=[],{bounds:s,step:l,min:r,max:o,precision:a,count:u,maxTicks:f,maxDigits:c,includeBounds:d}=n,h=l||1,g=f-1,{min:y,max:b}=e,v=!Mt(r),S=!Mt(o),C=!Mt(u),M=(b-y)/(c+1);let $=Bc((b-y)/g/h)*h,T,A,D,P;if($<1e-14&&!v&&!S)return[{value:y},{value:b}];P=Math.ceil(b/$)-Math.floor(y/$),P>g&&($=Bc(P*$/g/h)*h),Mt(a)||(T=Math.pow(10,a),$=Math.ceil($*T)/T),s==="ticks"?(A=Math.floor(y/$)*$,D=Math.ceil(b/$)*$):(A=y,D=b),v&&S&&l&&M2((o-r)/l,$/1e3)?(P=Math.round(Math.min((o-r)/$,f)),$=(o-r)/P,A=r,D=o):C?(A=v?r:A,D=S?o:D,P=u-1,$=(D-A)/P):(P=(D-A)/$,$l(P,Math.round(P),$/1e3)?P=Math.round(P):P=Math.ceil(P));const L=Math.max(Uc($),Uc(A));T=Math.pow(10,Mt(a)?L:a),A=Math.round(A*T)/T,D=Math.round(D*T)/T;let N=0;for(v&&(d&&A!==r?(t.push({value:r}),As=t?s:a,o=a=>l=i?l:a;if(e){const a=ai(s),u=ai(l);a<0&&u<0?o(0):a>0&&u>0&&r(0)}if(s===l){let a=1;(l>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(a=Math.abs(l*.05)),o(l+a),e||r(s-a)}this.min=s,this.max=l}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),t=t||11),t&&(s=Math.min(t,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},l=this._range||this,r=O3(s,l);return e.bounds==="ticks"&&I0(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const s=(i-t)/Math.max(e.length-1,1)/2;t-=s,i+=s}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return Gl(e,this.chart.options.locale,this.options.ticks.format)}}class ff extends _o{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Vt(e)?e:0,this.max=Vt(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=Xn(this.options.ticks.minRotation),s=(e?Math.sin(i):Math.cos(i))||.001,l=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,l.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}ff.id="linear";ff.defaults={ticks:{callback:Eo.formatters.numeric}};function Ud(n){return n/Math.pow(10,Math.floor(qn(n)))===1}function T3(n,e){const t=Math.floor(qn(e.max)),i=Math.ceil(e.max/Math.pow(10,t)),s=[];let l=Rn(n.min,Math.pow(10,Math.floor(qn(e.min)))),r=Math.floor(qn(l)),o=Math.floor(l/Math.pow(10,r)),a=r<0?Math.pow(10,Math.abs(r)):1;do s.push({value:l,major:Ud(l)}),++o,o===10&&(o=1,++r,a=r>=0?1:a),l=Math.round(o*Math.pow(10,r)*a)/a;while(r0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Vt(e)?Math.max(0,e):null,this.max=Vt(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,s=this.max;const l=a=>i=e?i:a,r=a=>s=t?s:a,o=(a,u)=>Math.pow(10,Math.floor(qn(a))+u);i===s&&(i<=0?(l(1),r(10)):(l(o(i,-1)),r(o(s,1)))),i<=0&&l(o(s,-1)),s<=0&&r(o(i,1)),this._zero&&this.min!==this._suggestedMin&&i===o(this.min,0)&&l(o(i,-1)),this.min=i,this.max=s}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=T3(t,this);return e.bounds==="ticks"&&I0(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":Gl(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=qn(e),this._valueRange=qn(this.max)-qn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(qn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}Sb.id="logarithmic";Sb.defaults={ticks:{callback:Eo.formatters.logarithmic,major:{enabled:!0}}};function cu(n){const e=n.ticks;if(e.display&&n.display){const t=Yn(e.backdropPadding);return ht(e.font&&e.font.size,mt.font.size)+t.height}return 0}function D3(n,e,t){return t=Pt(t)?t:[t],{w:X2(n,e.string,t),h:t.length*e.lineHeight}}function Wd(n,e,t,i,s){return n===i||n===s?{start:e-t/2,end:e+t/2}:ns?{start:e-t,end:e}:{start:e,end:e+t}}function A3(n){const e={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},t=Object.assign({},e),i=[],s=[],l=n._pointLabels.length,r=n.options.pointLabels,o=r.centerPointLabels?Ht/l:0;for(let a=0;ae.r&&(o=(i.end-e.r)/l,n.r=Math.max(n.r,e.r+o)),s.starte.b&&(a=(s.end-e.b)/r,n.b=Math.max(n.b,e.b+a))}function P3(n,e,t){const i=[],s=n._pointLabels.length,l=n.options,r=cu(l)/2,o=n.drawingArea,a=l.pointLabels.centerPointLabels?Ht/s:0;for(let u=0;u270||t<90)&&(n-=e),n}function N3(n,e){const{ctx:t,options:{pointLabels:i}}=n;for(let s=e-1;s>=0;s--){const l=i.setContext(n.getPointLabelContext(s)),r=$n(l.font),{x:o,y:a,textAlign:u,left:f,top:c,right:d,bottom:h}=n._pointLabelItems[s],{backdropColor:g}=l;if(!Mt(g)){const y=js(l.borderRadius),b=Yn(l.backdropPadding);t.fillStyle=g;const v=f-b.left,S=c-b.top,C=d-f+b.width,M=h-c+b.height;Object.values(y).some($=>$!==0)?(t.beginPath(),co(t,{x:v,y:S,w:C,h:M,radius:y}),t.fill()):t.fillRect(v,S,C,M)}fo(t,n._pointLabels[s],o,a+r.lineHeight/2,r,{color:l.color,textAlign:u,textBaseline:"middle"})}}function Cb(n,e,t,i){const{ctx:s}=n;if(t)s.arc(n.xCenter,n.yCenter,e,0,Et);else{let l=n.getPointPosition(0,e);s.moveTo(l.x,l.y);for(let r=1;r{const s=Rt(this.options.pointLabels.callback,[t,i],this);return s||s===0?s:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?A3(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,s){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,s))}getIndexAngle(e){const t=Et/(this._pointLabels.length||1),i=this.options.startAngle||0;return Cn(e*t+Xn(i))}getDistanceFromCenterForValue(e){if(Mt(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(Mt(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(f!==0){o=this.getDistanceFromCenterForValue(u.value);const c=s.setContext(this.getContext(f-1));R3(this,c,o,l)}}),i.display){for(e.save(),r=l-1;r>=0;r--){const u=i.setContext(this.getPointLabelContext(r)),{color:f,lineWidth:c}=u;!c||!f||(e.lineWidth=c,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,o=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),a=this.getPointPosition(r,o),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(a.x,a.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let l,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((o,a)=>{if(a===0&&!t.reverse)return;const u=i.setContext(this.getContext(a)),f=$n(u.font);if(l=this.getDistanceFromCenterForValue(this.ticks[a].value),u.showLabelBackdrop){e.font=f.string,r=e.measureText(o.label).width,e.fillStyle=u.backdropColor;const c=Yn(u.backdropPadding);e.fillRect(-r/2-c.left,-l-f.size/2-c.top,r+c.width,f.size+c.height)}fo(e,o.label,0,-l,f,{color:u.color})}),e.restore()}drawTitle(){}}Lo.id="radialLinear";Lo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Eo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};Lo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Lo.descriptors={angleLines:{_fallback:"grid"}};const Fo={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},bn=Object.keys(Fo);function H3(n,e){return n-e}function Yd(n,e){if(Mt(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:l}=n._parseOpts;let r=e;return typeof i=="function"&&(r=i(r)),Vt(r)||(r=typeof i=="string"?t.parse(r,i):t.parse(r)),r===null?null:(s&&(r=s==="week"&&(Il(l)||l===!0)?t.startOf(r,"isoWeek",l):t.startOf(r,s)),+r)}function Kd(n,e,t,i){const s=bn.length;for(let l=bn.indexOf(n);l=bn.indexOf(t);l--){const r=bn[l];if(Fo[r].common&&n._adapter.diff(s,i,r)>=e-1)return r}return bn[t?bn.indexOf(t):0]}function V3(n){for(let e=bn.indexOf(n)+1,t=bn.length;e=e?t[i]:t[s];n[l]=!0}}function z3(n,e,t,i){const s=n._adapter,l=+s.startOf(e[0].value,i),r=e[e.length-1].value;let o,a;for(o=l;o<=r;o=+s.add(o,1,i))a=t[o],a>=0&&(e[a].major=!0);return e}function xd(n,e,t){const i=[],s={},l=e.length;let r,o;for(r=0;r+e.value))}initOffsets(e){let t=0,i=0,s,l;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?t=1-s:t=(this.getDecimalForValue(e[1])-s)/2,l=this.getDecimalForValue(e[e.length-1]),e.length===1?i=l:i=(l-this.getDecimalForValue(e[e.length-2]))/2);const r=e.length<3?.5:.25;t=on(t,0,r),i=on(i,0,r),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,s=this.options,l=s.time,r=l.unit||Kd(l.minUnit,t,i,this._getLabelCapacity(t)),o=ht(l.stepSize,1),a=r==="week"?l.isoWeekday:!1,u=Il(a)||a===!0,f={};let c=t,d,h;if(u&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,u?"day":r),e.diff(i,t,r)>1e5*o)throw new Error(t+" and "+i+" are too far apart with stepSize of "+o+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=c,h=0;dy-b).map(y=>+y)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}_tickFormatFunction(e,t,i,s){const l=this.options,r=l.time.displayFormats,o=this._unit,a=this._majorUnit,u=o&&r[o],f=a&&r[a],c=i[t],d=a&&f&&c&&c.major,h=this._adapter.format(e,s||(d?f:u)),g=l.ticks.callback;return g?Rt(g,[h,t,i],this):h}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,i=s.length;t=n[i].pos&&e<=n[s].pos&&({lo:i,hi:s}=as(n,"pos",e)),{pos:l,time:o}=n[i],{pos:r,time:a}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=as(n,"time",e)),{time:l,pos:o}=n[i],{time:r,pos:a}=n[s]);const u=r-l;return u?o+(a-o)*(e-l)/u:o}class Mb extends er{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=Pr(t,this.min),this._tableRange=Pr(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],l=[];let r,o,a,u,f;for(r=0,o=e.length;r=t&&u<=i&&s.push(u);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(r=0,o=s.length;r{t||(t=ft(e,Un,{duration:150},!0)),t.run(1)}),i=!0)},o(s){t||(t=ft(e,Un,{duration:150},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function U3(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=H(n[1]),t=O(),s=H(i)},m(l,r){w(l,e,r),w(l,t,r),w(l,s,r)},p(l,r){r&2&&_e(e,l[1]),r&2&&i!==(i=l[1]===1?"log":"logs")&&_e(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function W3(n){let e;return{c(){e=H("Loading...")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Y3(n){let e,t,i,s,l,r,o=n[2]&&Gd();function a(c,d){return c[2]?W3:U3}let u=a(n),f=u(n);return{c(){e=_("div"),o&&o.c(),t=O(),i=_("canvas"),s=O(),l=_("div"),f.c(),p(i,"class","chart-canvas svelte-vh4sl8"),bf(i,"height","250px"),bf(i,"width","100%"),p(e,"class","chart-wrapper svelte-vh4sl8"),ne(e,"loading",n[2]),p(l,"class","txt-hint m-t-xs txt-right")},m(c,d){w(c,e,d),o&&o.m(e,null),m(e,t),m(e,i),n[8](i),w(c,s,d),w(c,l,d),f.m(l,null),r=!0},p(c,[d]){c[2]?o?d&4&&E(o,1):(o=Gd(),o.c(),E(o,1),o.m(e,t)):o&&(Te(),F(o,1,1,()=>{o=null}),De()),d&4&&ne(e,"loading",c[2]),u===(u=a(c))&&f?f.p(c,d):(f.d(1),f=u(c),f&&(f.c(),f.m(l,null)))},i(c){r||(E(o),r=!0)},o(c){F(o),r=!1},d(c){c&&k(e),o&&o.d(),n[8](null),c&&k(s),c&&k(l),f.d()}}}function K3(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,r,o=[],a=0,u=!1;async function f(){return t(2,u=!0),Se.Logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(h=>{c();for(let g of h)o.push({x:U.getDateTime(g.date).toLocal().toJSDate(),y:g.total}),t(1,a+=g.total);o.push({x:new Date,y:void 0})}).catch(h=>{h!==null&&(c(),console.warn(h),Se.errorResponseHandler(h,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,o=[])}di(()=>(go.register(Ki,Po,Xl,ff,er,m3,S3),t(6,r=new go(l,{type:"line",data:{datasets:[{label:"Total requests",data:o,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:h=>h.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:h=>h.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>r==null?void 0:r.destroy()));function d(h){he[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"filter"in h&&t(3,i=h.filter),"presets"in h&&t(4,s=h.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i!="undefined"||typeof s!="undefined")&&f(),n.$$.dirty&192&&typeof o!="undefined"&&r&&(t(6,r.data.datasets[0].data=o,r),r.update())},[l,a,u,i,s,f,r,o,d]}class J3 extends Ne{constructor(e){super(),Ie(this,e,K3,Y3,Pe,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var Zd=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},$b={exports:{}};(function(n){var e=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope?self:{};/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,r={},o={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function S(C){return C instanceof a?new a(C.type,S(C.content),C.alias):Array.isArray(C)?C.map(S):C.replace(/&/g,"&").replace(/"+T.content+""};function u(S,C,M,$){S.lastIndex=C;var T=S.exec(M);if(T&&$&&T[1]){var A=T[1].length;T.index+=A,T[0]=T[0].slice(A)}return T}function f(S,C,M,$,T,A){for(var D in M)if(!(!M.hasOwnProperty(D)||!M[D])){var P=M[D];P=Array.isArray(P)?P:[P];for(var L=0;L=A.reach);te+=Y.value.length,Y=Y.next){var fe=Y.value;if(C.length>S.length)return;if(!(fe instanceof a)){var ye=1,se;if(W){if(se=u(K,te,S,J),!se||se.index>=S.length)break;var be=se.index,G=se.index+se[0].length,Oe=te;for(Oe+=Y.value.length;be>=Oe;)Y=Y.next,Oe+=Y.value.length;if(Oe-=Y.value.length,te=Oe,Y.value instanceof a)continue;for(var ee=Y;ee!==C.tail&&(OeA.reach&&(A.reach=je);var Le=Y.prev;ie&&(Le=d(C,Le,ie),te+=ie.length),h(C,Le,ye);var qe=new a(D,R?o.tokenize(ue,R):ue,q,ue);if(Y=d(C,Le,qe),ve&&d(C,Y,ve),ye>1){var oe={cause:D+","+L,reach:je};f(S,C,M,Y.prev,te,oe),A&&oe.reach>A.reach&&(A.reach=oe.reach)}}}}}}function c(){var S={value:null,prev:null,next:null},C={value:null,prev:S,next:null};S.next=C,this.head=S,this.tail=C,this.length=0}function d(S,C,M){var $=C.next,T={value:M,prev:C,next:$};return C.next=T,$.prev=T,S.length++,T}function h(S,C,M){for(var $=C.next,T=0;T/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(i){i.type==="entity"&&(i.attributes.title=i.content.replace(/&/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(s,l){var r={};r["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:t.languages[l]},r.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:r}};o["language-"+l]={pattern:/[\s\S]+/,inside:t.languages[l]};var a={};a[s]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:o},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(i,s){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+i+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:t.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,function(i){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;i.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},i.languages.css.atrule.inside.rest=i.languages.css;var l=i.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,function(){if(typeof t=="undefined"||typeof document=="undefined")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var i="Loading\u2026",s=function(y,b){return"\u2716 Error "+y+" while fetching file: "+b},l="\u2716 Error: File does not exist or is empty",r={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},o="data-src-status",a="loading",u="loaded",f="failed",c="pre[data-src]:not(["+o+'="'+u+'"]):not(['+o+'="'+a+'"])';function d(y,b,v){var S=new XMLHttpRequest;S.open("GET",y,!0),S.onreadystatechange=function(){S.readyState==4&&(S.status<400&&S.responseText?b(S.responseText):S.status>=400?v(s(S.status,S.statusText)):v(l))},S.send(null)}function h(y){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(y||"");if(b){var v=Number(b[1]),S=b[2],C=b[3];return S?C?[v,Number(C)]:[v,void 0]:[v,v]}}t.hooks.add("before-highlightall",function(y){y.selector+=", "+c}),t.hooks.add("before-sanity-check",function(y){var b=y.element;if(b.matches(c)){y.code="",b.setAttribute(o,a);var v=b.appendChild(document.createElement("CODE"));v.textContent=i;var S=b.getAttribute("data-src"),C=y.language;if(C==="none"){var M=(/\.(\w+)$/.exec(S)||[,"none"])[1];C=r[M]||M}t.util.setLanguage(v,C),t.util.setLanguage(b,C);var $=t.plugins.autoloader;$&&$.loadLanguages(C),d(S,function(T){b.setAttribute(o,u);var A=h(b.getAttribute("data-range"));if(A){var D=T.split(/\r\n?|\n/g),P=A[0],L=A[1]==null?D.length:A[1];P<0&&(P+=D.length),P=Math.max(0,Math.min(P-1,D.length)),L<0&&(L+=D.length),L=Math.max(0,Math.min(L,D.length)),T=D.slice(P,L).join(` +`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(P+1))}v.textContent=T,t.highlightElement(v)},function(T){b.setAttribute(o,f),v.textContent=T})}}),t.plugins.fileHighlight={highlight:function(b){for(var v=(b||document).querySelectorAll(c),S=0,C;C=v[S++];)t.highlightElement(C)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})($b);var hl=$b.exports,x3={exports:{}};(function(n){(function(){if(typeof Prism=="undefined")return;var e=Object.assign||function(l,r){for(var o in r)r.hasOwnProperty(o)&&(l[o]=r[o]);return l};function t(l){this.defaults=e({},l)}function i(l){return l.replace(/-(\w)/g,function(r,o){return o.toUpperCase()})}function s(l){for(var r=0,o=0;or&&(u[c]=` +`+u[c],f=d)}o[a]=u.join("")}return o.join(` +`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(l){var r=Prism.plugins.NormalizeWhitespace;if(!(l.settings&&l.settings["whitespace-normalization"]===!1)&&!!Prism.util.isActive(l.element,"whitespace-normalization",!0)){if((!l.element||!l.element.parentNode)&&l.code){l.code=r.normalize(l.code,l.settings);return}var o=l.element.parentNode;if(!(!l.code||!o||o.nodeName.toLowerCase()!=="pre")){for(var a=o.childNodes,u="",f="",c=!1,d=0;d{"content"in o&&t(1,i=o.content),"language"in o&&t(2,s=o.language)},n.$$.update=()=>{n.$$.dirty&2&&typeof hl!="undefined"&&i&&t(0,l=r(i))},[l,i,s]}class tn extends Ne{constructor(e){super(),Ie(this,e,Z3,G3,Pe,{content:1,language:2})}}const X3=n=>({}),Xd=n=>({}),Q3=n=>({}),Qd=n=>({});function ep(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C=n[4]&&!n[2]&&tp(n);const M=n[18].header,$=On(M,n,n[17],Qd);let T=n[4]&&n[2]&&np(n);const A=n[18].default,D=On(A,n,n[17],null),P=n[18].footer,L=On(P,n,n[17],Xd);return{c(){e=_("div"),t=_("div"),s=O(),l=_("div"),r=_("div"),C&&C.c(),o=O(),$&&$.c(),a=O(),T&&T.c(),u=O(),f=_("div"),D&&D.c(),c=O(),d=_("div"),L&&L.c(),p(t,"class","overlay"),p(r,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(l,"class",h="overlay-panel "+n[1]+" "+n[8]),ne(l,"popup",n[2]),p(e,"class","overlay-panel-container"),ne(e,"padded",n[2]),ne(e,"active",n[0])},m(N,R){w(N,e,R),m(e,t),m(e,s),m(e,l),m(l,r),C&&C.m(r,null),m(r,o),$&&$.m(r,null),m(r,a),T&&T.m(r,null),m(l,u),m(l,f),D&&D.m(f,null),n[20](f),m(l,c),m(l,d),L&&L.m(d,null),b=!0,v||(S=[X(t,"click",Jt(n[19])),X(f,"scroll",n[21])],v=!0)},p(N,R){n=N,n[4]&&!n[2]?C?C.p(n,R):(C=tp(n),C.c(),C.m(r,o)):C&&(C.d(1),C=null),$&&$.p&&(!b||R&131072)&&Dn($,M,n,n[17],b?Tn(M,n[17],R,Q3):An(n[17]),Qd),n[4]&&n[2]?T?T.p(n,R):(T=np(n),T.c(),T.m(r,null)):T&&(T.d(1),T=null),D&&D.p&&(!b||R&131072)&&Dn(D,A,n,n[17],b?Tn(A,n[17],R,null):An(n[17]),null),L&&L.p&&(!b||R&131072)&&Dn(L,P,n,n[17],b?Tn(P,n[17],R,X3):An(n[17]),Xd),(!b||R&258&&h!==(h="overlay-panel "+n[1]+" "+n[8]))&&p(l,"class",h),R&262&&ne(l,"popup",n[2]),R&4&&ne(e,"padded",n[2]),R&1&&ne(e,"active",n[0])},i(N){b||(Dt(()=>{i||(i=ft(t,so,{duration:Es,opacity:0},!0)),i.run(1)}),E($,N),E(D,N),E(L,N),Dt(()=>{y&&y.end(1),g=yu(l,ti,n[2]?{duration:Es,y:-10}:{duration:Es,x:50}),g.start()}),b=!0)},o(N){i||(i=ft(t,so,{duration:Es,opacity:0},!1)),i.run(0),F($,N),F(D,N),F(L,N),g&&g.invalidate(),y=xg(l,ti,n[2]?{duration:Es,y:10}:{duration:Es,x:50}),b=!1},d(N){N&&k(e),N&&i&&i.end(),C&&C.d(),$&&$.d(N),T&&T.d(),D&&D.d(N),n[20](null),L&&L.d(N),N&&y&&y.end(),v=!1,lt(S)}}}function tp(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',p(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=X(e,"click",Jt(n[5])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function np(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary btn-close m-l-auto")},m(s,l){w(s,e,l),t||(i=X(e,"click",Jt(n[5])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function e4(n){let e,t,i,s,l=n[0]&&ep(n);return{c(){e=_("div"),l&&l.c(),p(e,"class","overlay-panel-wrapper")},m(r,o){w(r,e,o),l&&l.m(e,null),n[22](e),t=!0,i||(s=[X(window,"resize",n[10]),X(window,"keydown",n[9])],i=!0)},p(r,[o]){r[0]?l?(l.p(r,o),o&1&&E(l,1)):(l=ep(r),l.c(),E(l,1),l.m(e,null)):l&&(Te(),F(l,1,1,()=>{l=null}),De())},i(r){t||(E(l),t=!0)},o(r){F(l),t=!1},d(r){r&&k(e),l&&l.d(),n[22](null),i=!1,lt(s)}}}let ns;function Ob(){return ns=ns||document.querySelector(".overlays"),ns||(ns=document.createElement("div"),ns.classList.add("overlays"),document.body.appendChild(ns)),ns}let Es=150;function ip(){return 1e3+Ob().querySelectorAll(".overlay-panel-container.active").length}function t4(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{active:r=!1}=e,{popup:o=!1}=e,{overlayClose:a=!0}=e,{btnClose:u=!0}=e,{escClose:f=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const h=vn();let g,y,b,v,S="";function C(){typeof c=="function"&&c()===!1||t(0,r=!0)}function M(){typeof d=="function"&&d()===!1||t(0,r=!1)}function $(){return r}async function T(q){q?(b=document.activeElement,g==null||g.focus(),h("show")):(clearTimeout(v),b==null||b.focus(),h("hide")),await Ui(),A()}function A(){!g||(r?t(6,g.style.zIndex=ip(),g):t(6,g.style="",g))}function D(q){r&&f&&q.code=="Escape"&&!U.isInput(q.target)&&g&&g.style.zIndex==ip()&&(q.preventDefault(),M())}function P(q){r&&L(y)}function L(q,x){x&&t(8,S=""),q&&(v||(v=setTimeout(()=>{if(clearTimeout(v),v=null,!q)return;if(q.scrollHeight-q.offsetHeight>0)t(8,S="scrollable");else{t(8,S="");return}q.scrollTop==0?t(8,S+=" scroll-top-reached"):q.scrollTop+q.offsetHeight==q.scrollHeight&&t(8,S+=" scroll-bottom-reached")},100)))}di(()=>(Ob().appendChild(g),()=>{var q;clearTimeout(v),(q=g==null?void 0:g.classList)==null||q.add("hidden")}));const N=()=>a?M():!0;function R(q){he[q?"unshift":"push"](()=>{y=q,t(7,y)})}const J=q=>L(q.target);function W(q){he[q?"unshift":"push"](()=>{g=q,t(6,g)})}return n.$$set=q=>{"class"in q&&t(1,l=q.class),"active"in q&&t(0,r=q.active),"popup"in q&&t(2,o=q.popup),"overlayClose"in q&&t(3,a=q.overlayClose),"btnClose"in q&&t(4,u=q.btnClose),"escClose"in q&&t(12,f=q.escClose),"beforeOpen"in q&&t(13,c=q.beforeOpen),"beforeHide"in q&&t(14,d=q.beforeHide),"$$scope"in q&&t(17,s=q.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&T(r),n.$$.dirty&128&&L(y,!0),n.$$.dirty&64&&g&&A()},[r,l,o,a,u,M,g,y,S,D,P,L,f,c,d,C,$,s,i,N,R,J,W]}class Ti extends Ne{constructor(e){super(),Ie(this,e,t4,e4,Pe,{class:1,active:0,popup:2,overlayClose:3,btnClose:4,escClose:12,beforeOpen:13,beforeHide:14,show:15,hide:5,isActive:16})}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[5]}get isActive(){return this.$$.ctx[16]}}function n4(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function i4(n){let e,t=n[2].referer+"",i,s;return{c(){e=_("a"),i=H(t),p(e,"href",s=n[2].referer),p(e,"target","_blank"),p(e,"rel","noopener noreferrer")},m(l,r){w(l,e,r),m(e,i)},p(l,r){r&4&&t!==(t=l[2].referer+"")&&_e(i,t),r&4&&s!==(s=l[2].referer)&&p(e,"href",s)},d(l){l&&k(e)}}}function s4(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function l4(n){let e,t;return e=new tn({props:{content:JSON.stringify(n[2].meta,null,2)}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.content=JSON.stringify(i[2].meta,null,2)),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function r4(n){var ni;let e,t,i,s,l,r,o=n[2].id+"",a,u,f,c,d,h,g,y=n[2].status+"",b,v,S,C,M,$,T=((ni=n[2].method)==null?void 0:ni.toUpperCase())+"",A,D,P,L,N,R,J=n[2].auth+"",W,q,x,K,Y,te,fe=n[2].url+"",ye,se,G,Oe,ee,be,ue,ie,ve,je,Le,qe=n[2].ip+"",oe,le,ke,Ve,ze,Ge,ge=n[2].userAgent+"",Ae,Z,ae,Be,vt,it,gt,at,yt,zt,$t,Ot,me,Ce,Ke,st;function fn(pe,I){return pe[2].referer?i4:n4}let ce=fn(n),we=ce(n);const Ze=[l4,s4],xt=[];function qt(pe,I){return I&4&&(gt=null),gt==null&&(gt=!U.isEmpty(pe[2].meta)),gt?0:1}return at=qt(n,-1),yt=xt[at]=Ze[at](n),Ke=new Ci({props:{date:n[2].created}}),{c(){e=_("table"),t=_("tbody"),i=_("tr"),s=_("td"),s.textContent="ID",l=O(),r=_("td"),a=H(o),u=O(),f=_("tr"),c=_("td"),c.textContent="Status",d=O(),h=_("td"),g=_("span"),b=H(y),v=O(),S=_("tr"),C=_("td"),C.textContent="Method",M=O(),$=_("td"),A=H(T),D=O(),P=_("tr"),L=_("td"),L.textContent="Auth",N=O(),R=_("td"),W=H(J),q=O(),x=_("tr"),K=_("td"),K.textContent="URL",Y=O(),te=_("td"),ye=H(fe),se=O(),G=_("tr"),Oe=_("td"),Oe.textContent="Referer",ee=O(),be=_("td"),we.c(),ue=O(),ie=_("tr"),ve=_("td"),ve.textContent="IP",je=O(),Le=_("td"),oe=H(qe),le=O(),ke=_("tr"),Ve=_("td"),Ve.textContent="UserAgent",ze=O(),Ge=_("td"),Ae=H(ge),Z=O(),ae=_("tr"),Be=_("td"),Be.textContent="Meta",vt=O(),it=_("td"),yt.c(),zt=O(),$t=_("tr"),Ot=_("td"),Ot.textContent="Created",me=O(),Ce=_("td"),B(Ke.$$.fragment),p(s,"class","min-width txt-hint txt-bold"),p(c,"class","min-width txt-hint txt-bold"),p(g,"class","label"),ne(g,"label-danger",n[2].status>=400),p(C,"class","min-width txt-hint txt-bold"),p(L,"class","min-width txt-hint txt-bold"),p(K,"class","min-width txt-hint txt-bold"),p(Oe,"class","min-width txt-hint txt-bold"),p(ve,"class","min-width txt-hint txt-bold"),p(Ve,"class","min-width txt-hint txt-bold"),p(Be,"class","min-width txt-hint txt-bold"),p(Ot,"class","min-width txt-hint txt-bold"),p(e,"class","table-compact table-border")},m(pe,I){w(pe,e,I),m(e,t),m(t,i),m(i,s),m(i,l),m(i,r),m(r,a),m(t,u),m(t,f),m(f,c),m(f,d),m(f,h),m(h,g),m(g,b),m(t,v),m(t,S),m(S,C),m(S,M),m(S,$),m($,A),m(t,D),m(t,P),m(P,L),m(P,N),m(P,R),m(R,W),m(t,q),m(t,x),m(x,K),m(x,Y),m(x,te),m(te,ye),m(t,se),m(t,G),m(G,Oe),m(G,ee),m(G,be),we.m(be,null),m(t,ue),m(t,ie),m(ie,ve),m(ie,je),m(ie,Le),m(Le,oe),m(t,le),m(t,ke),m(ke,Ve),m(ke,ze),m(ke,Ge),m(Ge,Ae),m(t,Z),m(t,ae),m(ae,Be),m(ae,vt),m(ae,it),xt[at].m(it,null),m(t,zt),m(t,$t),m($t,Ot),m($t,me),m($t,Ce),V(Ke,Ce,null),st=!0},p(pe,I){var de;(!st||I&4)&&o!==(o=pe[2].id+"")&&_e(a,o),(!st||I&4)&&y!==(y=pe[2].status+"")&&_e(b,y),I&4&&ne(g,"label-danger",pe[2].status>=400),(!st||I&4)&&T!==(T=((de=pe[2].method)==null?void 0:de.toUpperCase())+"")&&_e(A,T),(!st||I&4)&&J!==(J=pe[2].auth+"")&&_e(W,J),(!st||I&4)&&fe!==(fe=pe[2].url+"")&&_e(ye,fe),ce===(ce=fn(pe))&&we?we.p(pe,I):(we.d(1),we=ce(pe),we&&(we.c(),we.m(be,null))),(!st||I&4)&&qe!==(qe=pe[2].ip+"")&&_e(oe,qe),(!st||I&4)&&ge!==(ge=pe[2].userAgent+"")&&_e(Ae,ge);let j=at;at=qt(pe,I),at===j?xt[at].p(pe,I):(Te(),F(xt[j],1,1,()=>{xt[j]=null}),De(),yt=xt[at],yt?yt.p(pe,I):(yt=xt[at]=Ze[at](pe),yt.c()),E(yt,1),yt.m(it,null));const Q={};I&4&&(Q.date=pe[2].created),Ke.$set(Q)},i(pe){st||(E(yt),E(Ke.$$.fragment,pe),st=!0)},o(pe){F(yt),F(Ke.$$.fragment,pe),st=!1},d(pe){pe&&k(e),we.d(),xt[at].d(),z(Ke)}}}function o4(n){let e;return{c(){e=_("h4"),e.textContent="Request log"},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function a4(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Close',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[4]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function u4(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[a4],header:[o4],default:[r4]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[5](e),e.$on("hide",n[6]),e.$on("show",n[7]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const r={};l&260&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[5](null),z(e,s)}}}function f4(n,e,t){let i,s=new Va;function l(c){return t(2,s=c),i==null?void 0:i.show()}function r(){return i==null?void 0:i.hide()}const o=()=>r();function a(c){he[c?"unshift":"push"](()=>{i=c,t(1,i)})}function u(c){ut.call(this,n,c)}function f(c){ut.call(this,n,c)}return[r,i,s,l,o,a,u,f]}class c4 extends Ne{constructor(e){super(),Ie(this,e,f4,u4,Pe,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function d4(n){let e,t,i,s,l,r,o,a;return{c(){e=_("input"),i=O(),s=_("label"),l=H("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",r=n[12])},m(u,f){w(u,e,f),e.checked=n[0],w(u,i,f),w(u,s,f),m(s,l),o||(a=X(e,"change",n[6]),o=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&1&&(e.checked=u[0]),f&4096&&r!==(r=u[12])&&p(s,"for",r)},d(u){u&&k(e),u&&k(i),u&&k(s),o=!1,a()}}}function sp(n){let e,t,i;function s(r){n[8](r)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new J3({props:l}),he.push(()=>Fe(e,"filter",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o&16&&(a.presets=r[4]),!t&&o&4&&(t=!0,a.filter=r[2],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function lp(n){let e,t,i;function s(r){n[9](r)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new d2({props:l}),he.push(()=>Fe(e,"filter",s)),e.$on("select",n[10]),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o&16&&(a.presets=r[4]),!t&&o&4&&(t=!0,a.filter=r[2],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function p4(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v=n[3],S,C=n[3],M,$,T,A,D;c=new He({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[d4,({uniqueId:R})=>({12:R}),({uniqueId:R})=>R?4096:0]},$$scope:{ctx:n}}}),h=new Do({props:{value:n[2],placeholder:"Search logs, ex. status > 200",extraAutocompleteKeys:["method","url","ip","referer","status","auth","userAgent"]}}),h.$on("submit",n[7]);let P=sp(n),L=lp(n),N={};return $=new c4({props:N}),n[11]($),{c(){e=_("main"),t=_("div"),i=_("header"),s=_("nav"),s.innerHTML='',l=O(),r=_("button"),r.innerHTML='',o=O(),a=_("div"),u=O(),f=_("div"),B(c.$$.fragment),d=O(),B(h.$$.fragment),g=O(),y=_("div"),b=O(),P.c(),S=O(),L.c(),M=O(),B($.$$.fragment),p(s,"class","breadcrumbs"),p(r,"type","button"),p(r,"class","btn btn-circle btn-secondary"),p(a,"class","flex-fill"),p(f,"class","inline-flex"),p(i,"class","page-header"),p(y,"class","clearfix m-b-xs"),p(t,"class","page-header-wrapper m-b-0"),p(e,"class","page-wrapper")},m(R,J){w(R,e,J),m(e,t),m(t,i),m(i,s),m(i,l),m(i,r),m(i,o),m(i,a),m(i,u),m(i,f),V(c,f,null),m(t,d),V(h,t,null),m(t,g),m(t,y),m(t,b),P.m(t,null),m(e,S),L.m(e,null),w(R,M,J),V($,R,J),T=!0,A||(D=[Xe(St.call(null,r,{text:"Refresh",position:"right"})),X(r,"click",n[5])],A=!0)},p(R,[J]){const W={};J&12289&&(W.$$scope={dirty:J,ctx:R}),c.$set(W);const q={};J&4&&(q.value=R[2]),h.$set(q),J&8&&Pe(v,v=R[3])?(Te(),F(P,1,1,re),De(),P=sp(R),P.c(),E(P,1),P.m(t,null)):P.p(R,J),J&8&&Pe(C,C=R[3])?(Te(),F(L,1,1,re),De(),L=lp(R),L.c(),E(L,1),L.m(e,null)):L.p(R,J);const x={};$.$set(x)},i(R){T||(E(c.$$.fragment,R),E(h.$$.fragment,R),E(P),E(L),E($.$$.fragment,R),T=!0)},o(R){F(c.$$.fragment,R),F(h.$$.fragment,R),F(P),F(L),F($.$$.fragment,R),T=!1},d(R){R&&k(e),z(c),z(h),P.d(R),L.d(R),R&&k(M),n[11](null),z($,R),A=!1,lt(D)}}}const rp="includeAdminLogs";function h4(n,e,t){var y;let i,s,l="",r=((y=window.localStorage)==null?void 0:y.getItem(rp))<<0,o=1;function a(){t(3,o++,o)}U.setDocumentTitle("Request logs");function u(){r=this.checked,t(0,r)}const f=b=>t(2,l=b.detail);function c(b){l=b,t(2,l)}function d(b){l=b,t(2,l)}const h=b=>s==null?void 0:s.show(b==null?void 0:b.detail);function g(b){he[b?"unshift":"push"](()=>{s=b,t(1,s)})}return n.$$.update=()=>{n.$$.dirty&1&&t(4,i=r?"":'auth!="admin"'),n.$$.dirty&1&&typeof r!="undefined"&&window.localStorage&&window.localStorage.setItem(rp,r<<0)},[r,s,l,o,i,a,u,f,c,d,h,g]}class m4 extends Ne{constructor(e){super(),Ie(this,e,h4,p4,Pe,{})}}const Ks=$i([]),ui=$i({}),du=$i(!1);function g4(n){ui.update(e=>U.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Ks.update(e=>(U.pushOrReplaceByKey(e,n,"id"),e))}function _4(n){Ks.update(e=>(U.removeByKey(e,"id",n.id),ui.update(t=>t.id===n.id?e.find(i=>i.name!="profiles")||{}:t),e))}async function b4(n=null){return du.set(!0),ui.set({}),Ks.set([]),Se.Collections.getFullList(200,{sort:"+created"}).then(e=>{Ks.set(e);const t=n&&U.findByKey(e,"id",n);if(t)ui.set(t);else if(e.length){const i=e.find(s=>s.name!="profiles");i&&ui.set(i)}}).catch(e=>{Se.errorResponseHandler(e)}).finally(()=>{du.set(!1)})}const cf=$i({});function Mi(n,e,t){cf.set({text:n,yesCallback:e,noCallback:t})}function Tb(){cf.set({})}function op(n){let e,t,i,s;const l=n[13].default,r=On(l,n,n[12],null);return{c(){e=_("div"),r&&r.c(),p(e,"class",n[1]),ne(e,"active",n[0])},m(o,a){w(o,e,a),r&&r.m(e,null),s=!0},p(o,a){r&&r.p&&(!s||a&4096)&&Dn(r,l,o,o[12],s?Tn(l,o[12],a,null):An(o[12]),null),(!s||a&2)&&p(e,"class",o[1]),a&3&&ne(e,"active",o[0])},i(o){s||(E(r,o),o&&Dt(()=>{i&&i.end(1),t=yu(e,ti,{duration:150,y:-5}),t.start()}),s=!0)},o(o){F(r,o),t&&t.invalidate(),o&&(i=xg(e,ti,{duration:150,y:2})),s=!1},d(o){o&&k(e),r&&r.d(o),o&&i&&i.end()}}}function y4(n){let e,t,i,s,l=n[0]&&op(n);return{c(){e=_("div"),l&&l.c(),p(e,"class","toggler-container")},m(r,o){w(r,e,o),l&&l.m(e,null),n[14](e),t=!0,i||(s=[X(window,"click",n[3]),X(window,"keydown",n[4]),X(window,"focusin",n[5])],i=!0)},p(r,[o]){r[0]?l?(l.p(r,o),o&1&&E(l,1)):(l=op(r),l.c(),E(l,1),l.m(e,null)):l&&(Te(),F(l,1,1,()=>{l=null}),De())},i(r){t||(E(l),t=!0)},o(r){F(l),t=!1},d(r){r&&k(e),l&&l.d(),n[14](null),i=!1,lt(s)}}}function v4(n,e,t){let{$$slots:i={},$$scope:s}=e,{trigger:l=void 0}=e,{active:r=!1}=e,{escClose:o=!0}=e,{closableClass:a="closable"}=e,{class:u=""}=e,f;const c=vn();function d(){t(0,r=!1)}function h(){t(0,r=!0)}function g(){r?d():h()}function y(T){return!f||T.classList.contains(a)||(l==null?void 0:l.contains(T))&&!f.contains(T)||f.contains(T)&&T.closest&&T.closest("."+a)}function b(T){(!r||y(T.target))&&(T.preventDefault(),g())}function v(T){(T.code==="Enter"||T.code==="Space")&&(!r||y(T.target))&&(T.preventDefault(),T.stopPropagation(),g())}function S(T){r&&!(f!=null&&f.contains(T.target))&&!(l!=null&&l.contains(T.target))&&d()}function C(T){r&&o&&T.code=="Escape"&&(T.preventDefault(),d())}function M(T){return S(T)}di(()=>(t(6,l=l||f.parentNode),l.addEventListener("click",b),l.addEventListener("keydown",v),()=>{l.removeEventListener("click",b),l.removeEventListener("keydown",v)}));function $(T){he[T?"unshift":"push"](()=>{f=T,t(2,f)})}return n.$$set=T=>{"trigger"in T&&t(6,l=T.trigger),"active"in T&&t(0,r=T.active),"escClose"in T&&t(7,o=T.escClose),"closableClass"in T&&t(8,a=T.closableClass),"class"in T&&t(1,u=T.class),"$$scope"in T&&t(12,s=T.$$scope)},n.$$.update=()=>{var T,A;n.$$.dirty&65&&(r?((T=l==null?void 0:l.classList)==null||T.add("active"),c("show")):((A=l==null?void 0:l.classList)==null||A.remove("active"),c("hide")))},[r,u,f,S,C,M,l,o,a,d,h,g,s,i,$]}class bs extends Ne{constructor(e){super(),Ie(this,e,v4,y4,Pe,{trigger:6,active:0,escClose:7,closableClass:8,class:1,hide:9,show:10,toggle:11})}get hide(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}get toggle(){return this.$$.ctx[11]}}const k4=n=>({active:n&1}),ap=n=>({active:n[0]});function up(n){let e,t,i;const s=n[12].default,l=On(s,n,n[11],null);return{c(){e=_("div"),l&&l.c(),p(e,"class","accordion-content")},m(r,o){w(r,e,o),l&&l.m(e,null),i=!0},p(r,o){l&&l.p&&(!i||o&2048)&&Dn(l,s,r,r[11],i?Tn(s,r[11],o,null):An(r[11]),null)},i(r){i||(E(l,r),r&&Dt(()=>{t||(t=ft(e,un,{duration:150},!0)),t.run(1)}),i=!0)},o(r){F(l,r),r&&(t||(t=ft(e,un,{duration:150},!1)),t.run(0)),i=!1},d(r){r&&k(e),l&&l.d(r),r&&t&&t.end()}}}function w4(n){let e,t,i,s,l,r,o,a;const u=n[12].header,f=On(u,n,n[11],ap);let c=n[0]&&up(n);return{c(){e=_("div"),t=_("header"),f&&f.c(),i=O(),c&&c.c(),p(t,"class","accordion-header"),ne(t,"interactive",n[2]),p(e,"tabindex",s=n[2]?0:-1),p(e,"class",l="accordion "+n[1]),ne(e,"active",n[0])},m(d,h){w(d,e,h),m(e,t),f&&f.m(t,null),m(e,i),c&&c.m(e,null),n[14](e),r=!0,o||(a=[X(t,"click",Jt(n[13])),X(e,"keydown",Bg(n[5]))],o=!0)},p(d,[h]){f&&f.p&&(!r||h&2049)&&Dn(f,u,d,d[11],r?Tn(u,d[11],h,k4):An(d[11]),ap),h&4&&ne(t,"interactive",d[2]),d[0]?c?(c.p(d,h),h&1&&E(c,1)):(c=up(d),c.c(),E(c,1),c.m(e,null)):c&&(Te(),F(c,1,1,()=>{c=null}),De()),(!r||h&4&&s!==(s=d[2]?0:-1))&&p(e,"tabindex",s),(!r||h&2&&l!==(l="accordion "+d[1]))&&p(e,"class",l),h&3&&ne(e,"active",d[0])},i(d){r||(E(f,d),E(c),r=!0)},o(d){F(f,d),F(c),r=!1},d(d){d&&k(e),f&&f.d(d),c&&c.d(),n[14](null),o=!1,lt(a)}}}function S4(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=vn();let r,o,{class:a=""}=e,{active:u=!1}=e,{interactive:f=!0}=e,{single:c=!1}=e;function d(){y(),t(0,u=!0),l("expand")}function h(){t(0,u=!1),clearTimeout(o),l("collapse")}function g(){l("toggle"),u?h():d()}function y(){if(c&&r.parentElement){const C=r.parentElement.querySelectorAll(".accordion.active .accordion-header.interactive");for(const M of C)M.click()}}function b(C){!f||(C.code==="Enter"||C.code==="Space")&&(C.preventDefault(),g())}di(()=>()=>clearTimeout(o));const v=()=>f&&g();function S(C){he[C?"unshift":"push"](()=>{r=C,t(4,r)})}return n.$$set=C=>{"class"in C&&t(1,a=C.class),"active"in C&&t(0,u=C.active),"interactive"in C&&t(2,f=C.interactive),"single"in C&&t(6,c=C.single),"$$scope"in C&&t(11,s=C.$$scope)},n.$$.update=()=>{n.$$.dirty&1041&&u&&(clearTimeout(o),t(10,o=setTimeout(()=>{r!=null&&r.scrollIntoView&&r.scrollIntoView({behavior:"smooth",block:"nearest"})},250)))},[u,a,f,g,r,b,c,d,h,y,o,s,i,v,S]}class df extends Ne{constructor(e){super(),Ie(this,e,S4,w4,Pe,{class:1,active:0,interactive:2,single:6,expand:7,collapse:8,toggle:3,collapseSiblings:9})}get expand(){return this.$$.ctx[7]}get collapse(){return this.$$.ctx[8]}get toggle(){return this.$$.ctx[3]}get collapseSiblings(){return this.$$.ctx[9]}}const C4=n=>({}),fp=n=>({});function cp(n,e,t){const i=n.slice();return i[46]=e[t],i}function dp(n,e,t){const i=n.slice();return i[49]=e[t],i}const M4=n=>({}),pp=n=>({});function hp(n,e,t){const i=n.slice();return i[49]=e[t],i}function mp(n){let e,t;return{c(){e=_("div"),t=H(n[2]),p(e,"class","txt-placeholder")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&4&&_e(t,i[2])},d(i){i&&k(e)}}}function $4(n){let e,t=n[49]+"",i;return{c(){e=_("span"),i=H(t),p(e,"class","txt")},m(s,l){w(s,e,l),m(e,i)},p(s,l){l[0]&1&&t!==(t=s[49]+"")&&_e(i,t)},i:re,o:re,d(s){s&&k(e)}}}function O4(n){let e,t,i;const s=[{item:n[49]},n[8]];var l=n[7];function r(o){let a={};for(let u=0;u{z(f,1)}),De()}l?(e=new l(r()),B(e.$$.fragment),E(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&F(e.$$.fragment,o),i=!1},d(o){o&&k(t),e&&z(e,o)}}}function gp(n){let e,t,i;function s(){return n[34](n[49])}return{c(){e=_("span"),e.innerHTML='',p(e,"class","clear")},m(l,r){w(l,e,r),t||(i=[Xe(St.call(null,e,"Clear")),X(e,"click",Bn(Jt(s)))],t=!0)},p(l,r){n=l},d(l){l&&k(e),t=!1,lt(i)}}}function _p(n){let e,t,i,s,l,r;const o=[O4,$4],a=[];function u(c,d){return c[7]?0:1}t=u(n),i=a[t]=o[t](n);let f=(n[4]||n[6])&&gp(n);return{c(){e=_("div"),i.c(),s=O(),f&&f.c(),l=O(),p(e,"class","option")},m(c,d){w(c,e,d),a[t].m(e,null),m(e,s),f&&f.m(e,null),m(e,l),r=!0},p(c,d){let h=t;t=u(c),t===h?a[t].p(c,d):(Te(),F(a[h],1,1,()=>{a[h]=null}),De(),i=a[t],i?i.p(c,d):(i=a[t]=o[t](c),i.c()),E(i,1),i.m(e,s)),c[4]||c[6]?f?f.p(c,d):(f=gp(c),f.c(),f.m(e,l)):f&&(f.d(1),f=null)},i(c){r||(E(i),r=!0)},o(c){F(i),r=!1},d(c){c&&k(e),a[t].d(),f&&f.d()}}}function bp(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left",trigger:n[17],$$slots:{default:[A4]},$$scope:{ctx:n}};return e=new bs({props:i}),n[39](e),e.$on("show",n[23]),e.$on("hide",n[40]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const r={};l[0]&131072&&(r.trigger=s[17]),l[0]&806410|l[1]&2048&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[39](null),z(e,s)}}}function yp(n){let e,t,i,s,l,r,o,a,u=n[14].length&&vp(n);return{c(){e=_("div"),t=_("label"),i=_("div"),i.innerHTML='',s=O(),l=_("input"),r=O(),u&&u.c(),p(i,"class","addon p-r-0"),l.autofocus=!0,p(l,"type","text"),p(l,"placeholder",n[3]),p(t,"class","input-group"),p(e,"class","form-field form-field-sm options-search")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(t,s),m(t,l),$e(l,n[14]),m(t,r),u&&u.m(t,null),l.focus(),o||(a=X(l,"input",n[36]),o=!0)},p(f,c){c[0]&8&&p(l,"placeholder",f[3]),c[0]&16384&&l.value!==f[14]&&$e(l,f[14]),f[14].length?u?u.p(f,c):(u=vp(f),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},d(f){f&&k(e),u&&u.d(),o=!1,a()}}}function vp(n){let e,t,i,s;return{c(){e=_("div"),t=_("button"),t.innerHTML='',p(t,"type","button"),p(t,"class","btn btn-sm btn-circle btn-secondary clear"),p(e,"class","addon suffix p-r-5")},m(l,r){w(l,e,r),m(e,t),i||(s=X(t,"click",Bn(Jt(n[20]))),i=!0)},p:re,d(l){l&&k(e),i=!1,s()}}}function kp(n){let e,t=n[1]&&wp(n);return{c(){t&&t.c(),e=rt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1]?t?t.p(i,s):(t=wp(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function wp(n){let e,t;return{c(){e=_("div"),t=H(n[1]),p(e,"class","txt-missing")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&2&&_e(t,i[1])},d(i){i&&k(e)}}}function Sp(n){let e,t=n[46].group+"",i;return{c(){e=_("div"),i=H(t),p(e,"class","dropdown-item separator")},m(s,l){w(s,e,l),m(e,i)},p(s,l){l[0]&524288&&t!==(t=s[46].group+"")&&_e(i,t)},d(s){s&&k(e)}}}function T4(n){let e=n[49]+"",t;return{c(){t=H(e)},m(i,s){w(i,t,s)},p(i,s){s[0]&524288&&e!==(e=i[49]+"")&&_e(t,e)},i:re,o:re,d(i){i&&k(t)}}}function D4(n){let e,t,i;const s=[{item:n[49]},n[10]];var l=n[9];function r(o){let a={};for(let u=0;u{z(f,1)}),De()}l?(e=new l(r()),B(e.$$.fragment),E(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&F(e.$$.fragment,o),i=!1},d(o){o&&k(t),e&&z(e,o)}}}function Cp(n){let e,t,i,s,l,r,o;const a=[D4,T4],u=[];function f(h,g){return h[9]?0:1}t=f(n),i=u[t]=a[t](n);function c(...h){return n[37](n[49],...h)}function d(...h){return n[38](n[49],...h)}return{c(){e=_("div"),i.c(),s=O(),p(e,"tabindex","0"),p(e,"class","dropdown-item option closable"),ne(e,"selected",n[18](n[49]))},m(h,g){w(h,e,g),u[t].m(e,null),m(e,s),l=!0,r||(o=[X(e,"click",c),X(e,"keydown",d)],r=!0)},p(h,g){n=h;let y=t;t=f(n),t===y?u[t].p(n,g):(Te(),F(u[y],1,1,()=>{u[y]=null}),De(),i=u[t],i?i.p(n,g):(i=u[t]=a[t](n),i.c()),E(i,1),i.m(e,s)),g[0]&786432&&ne(e,"selected",n[18](n[49]))},i(h){l||(E(i),l=!0)},o(h){F(i),l=!1},d(h){h&&k(e),u[t].d(),r=!1,lt(o)}}}function Mp(n){let e,t,i,s=n[46].group!=pu&&Sp(n),l=n[46].items,r=[];for(let a=0;aF(r[a],1,1,()=>{r[a]=null});return{c(){s&&s.c(),e=O();for(let a=0;aF(f[y],1,1,()=>{f[y]=null});let d=null;u.length||(d=kp(n));const h=n[33].afterOptions,g=On(h,n,n[42],fp);return{c(){r&&r.c(),e=O(),a&&a.c(),t=O(),i=_("div");for(let y=0;yF(a[d],1,1,()=>{a[d]=null});let f=null;o.length||(f=mp(n));let c=!n[5]&&bp(n);return{c(){e=_("div"),t=_("div");for(let d=0;d{c=null}),De()):c?(c.p(d,h),h[0]&32&&E(c,1)):(c=bp(d),c.c(),E(c,1),c.m(e,null)),(!r||h[0]&4096&&l!==(l="select "+d[12]))&&p(e,"class",l),h[0]&4112&&ne(e,"multiple",d[4]),h[0]&4128&&ne(e,"disabled",d[5])},i(d){if(!r){for(let h=0;hVe(Ae,le)))||[]:ge=Ge.items||[],ge.length&&ke.push({group:Ge.group,items:ge})}return ke}function ye(oe,le){oe.preventDefault(),b&&h?W(le):J(le)}function se(oe,le){(oe.code==="Enter"||oe.code==="Space")&&ye(oe,le)}function G(){te(),setTimeout(()=>{const oe=L==null?void 0:L.querySelector(".dropdown-item.option.selected");oe&&(oe.focus(),oe.scrollIntoView({block:"nearest"}))},0)}function Oe(oe){oe.stopPropagation(),!g&&(D==null||D.toggle())}di(()=>{const oe=document.querySelectorAll(`label[for="${a}"]`);for(const le of oe)le.addEventListener("click",Oe);return()=>{for(const le of oe)le.removeEventListener("click",Oe)}});const ee=oe=>R(oe);function be(oe){he[oe?"unshift":"push"](()=>{N=oe,t(17,N)})}function ue(){P=this.value,t(14,P)}const ie=(oe,le)=>ye(le,oe),ve=(oe,le)=>se(le,oe);function je(oe){he[oe?"unshift":"push"](()=>{D=oe,t(15,D)})}function Le(oe){ut.call(this,n,oe)}function qe(oe){he[oe?"unshift":"push"](()=>{L=oe,t(16,L)})}return n.$$set=oe=>{"id"in oe&&t(24,a=oe.id),"noOptionsText"in oe&&t(1,u=oe.noOptionsText),"selectPlaceholder"in oe&&t(2,f=oe.selectPlaceholder),"searchPlaceholder"in oe&&t(3,c=oe.searchPlaceholder),"items"in oe&&t(25,d=oe.items),"multiple"in oe&&t(4,h=oe.multiple),"disabled"in oe&&t(5,g=oe.disabled),"selected"in oe&&t(0,y=oe.selected),"toggle"in oe&&t(6,b=oe.toggle),"labelComponent"in oe&&t(7,v=oe.labelComponent),"labelComponentProps"in oe&&t(8,S=oe.labelComponentProps),"optionComponent"in oe&&t(9,C=oe.optionComponent),"optionComponentProps"in oe&&t(10,M=oe.optionComponentProps),"searchable"in oe&&t(11,$=oe.searchable),"searchFunc"in oe&&t(26,T=oe.searchFunc),"class"in oe&&t(12,A=oe.class),"$$scope"in oe&&t(42,o=oe.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&t(32,i=U.isObjectArrayWithKeys(d,["group"])?d:[{group:pu,items:d}]),n.$$.dirty[0]&33554432&&d&&(Y(),te()),n.$$.dirty[0]&16384|n.$$.dirty[1]&2&&t(19,s=fe(i,P)),n.$$.dirty[0]&1&&t(18,l=function(oe){let le=U.toArray(y);return U.inArray(le,oe)})},[y,u,f,c,h,g,b,v,S,C,M,$,A,R,P,D,L,N,l,s,te,ye,se,G,a,d,T,J,W,q,x,K,i,r,ee,be,ue,ie,ve,je,Le,qe,o]}class Db extends Ne{constructor(e){super(),Ie(this,e,L4,E4,Pe,{id:24,noOptionsText:1,selectPlaceholder:2,searchPlaceholder:3,items:25,multiple:4,disabled:5,selected:0,toggle:6,labelComponent:7,labelComponentProps:8,optionComponent:9,optionComponentProps:10,searchable:11,searchFunc:26,class:12,deselectItem:13,selectItem:27,toggleItem:28,reset:29,showDropdown:30,hideDropdown:31},null,[-1,-1])}get deselectItem(){return this.$$.ctx[13]}get selectItem(){return this.$$.ctx[27]}get toggleItem(){return this.$$.ctx[28]}get reset(){return this.$$.ctx[29]}get showDropdown(){return this.$$.ctx[30]}get hideDropdown(){return this.$$.ctx[31]}}function $p(n){let e,t;return{c(){e=_("i"),p(e,"class",t="icon "+n[0].icon)},m(i,s){w(i,e,s)},p(i,s){s&1&&t!==(t="icon "+i[0].icon)&&p(e,"class",t)},d(i){i&&k(e)}}}function F4(n){let e,t,i=(n[0].label||n[0].name||n[0].title||n[0].id||n[0].value)+"",s,l=n[0].icon&&$p(n);return{c(){l&&l.c(),e=O(),t=_("span"),s=H(i),p(t,"class","txt")},m(r,o){l&&l.m(r,o),w(r,e,o),w(r,t,o),m(t,s)},p(r,[o]){r[0].icon?l?l.p(r,o):(l=$p(r),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),o&1&&i!==(i=(r[0].label||r[0].name||r[0].title||r[0].id||r[0].value)+"")&&_e(s,i)},i:re,o:re,d(r){l&&l.d(r),r&&k(e),r&&k(t)}}}function I4(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class Op extends Ne{constructor(e){super(),Ie(this,e,I4,F4,Pe,{item:0})}}const N4=n=>({}),Tp=n=>({});function R4(n){let e;const t=n[8].afterOptions,i=On(t,n,n[12],Tp);return{c(){i&&i.c()},m(s,l){i&&i.m(s,l),e=!0},p(s,l){i&&i.p&&(!e||l&4096)&&Dn(i,t,s,s[12],e?Tn(t,s[12],l,N4):An(s[12]),Tp)},i(s){e||(E(i,s),e=!0)},o(s){F(i,s),e=!1},d(s){i&&i.d(s)}}}function j4(n){let e,t,i;const s=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function l(o){n[9](o)}let r={$$slots:{afterOptions:[R4]},$$scope:{ctx:n}};for(let o=0;oFe(e,"selected",l)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){B(e.$$.fragment)},m(o,a){V(e,o,a),i=!0},p(o,[a]){const u=a&62?gn(s,[a&2&&{items:o[1]},a&4&&{multiple:o[2]},a&8&&{labelComponent:o[3]},a&16&&{optionComponent:o[4]},a&32&&pi(o[5])]):{};a&4096&&(u.$$scope={dirty:a,ctx:o}),!t&&a&1&&(t=!0,u.selected=o[0],Re(()=>t=!1)),e.$set(u)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){F(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function H4(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let s=Yt(e,i),{$$slots:l={},$$scope:r}=e,{items:o=[]}=e,{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{labelComponent:f=Op}=e,{optionComponent:c=Op}=e,{selectionKey:d="value"}=e,{keyOfSelected:h=a?[]:void 0}=e;function g(M){M=U.toArray(M,!0);let $=[],T=b();for(let A of T)U.inArray(M,A[d])&&$.push(A);M.length&&!$.length||t(0,u=a?$:$[0])}async function y(M){let $=U.toArray(M,!0).map(T=>T[d]);!o.length||t(6,h=a?$:$[0])}function b(){if(!U.isObjectArrayWithKeys(o,["group","items"]))return o;let M=[];for(const $ of o)M=M.concat($.items);return M}function v(M){u=M,t(0,u)}function S(M){ut.call(this,n,M)}function C(M){ut.call(this,n,M)}return n.$$set=M=>{e=ct(ct({},e),ci(M)),t(5,s=Yt(e,i)),"items"in M&&t(1,o=M.items),"multiple"in M&&t(2,a=M.multiple),"selected"in M&&t(0,u=M.selected),"labelComponent"in M&&t(3,f=M.labelComponent),"optionComponent"in M&&t(4,c=M.optionComponent),"selectionKey"in M&&t(7,d=M.selectionKey),"keyOfSelected"in M&&t(6,h=M.keyOfSelected),"$$scope"in M&&t(12,r=M.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&o&&g(h),n.$$.dirty&1&&y(u)},[u,o,a,f,c,s,h,d,l,v,S,C,r]}class ys extends Ne{constructor(e){super(),Ie(this,e,H4,j4,Pe,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function q4(n){let e,t,i;const s=[{class:"field-type-select "+n[1]},{searchable:!0},{items:n[2]},n[3]];function l(o){n[4](o)}let r={};for(let o=0;oFe(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,a){V(e,o,a),i=!0},p(o,[a]){const u=a&14?gn(s,[a&2&&{class:"field-type-select "+o[1]},s[1],a&4&&{items:o[2]},a&8&&pi(o[3])]):{};!t&&a&1&&(t=!0,u.keyOfSelected=o[0],Re(()=>t=!1)),e.$set(u)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){F(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function V4(n,e,t){const i=["value","class"];let s=Yt(e,i),{value:l="text"}=e,{class:r=""}=e;const o=[{label:"Text",value:"text",icon:U.getFieldTypeIcon("text")},{label:"Number",value:"number",icon:U.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:U.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:U.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:U.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:U.getFieldTypeIcon("date")},{label:"Multiple choices",value:"select",icon:U.getFieldTypeIcon("select")},{label:"JSON",value:"json",icon:U.getFieldTypeIcon("json")},{label:"File",value:"file",icon:U.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:U.getFieldTypeIcon("relation")},{label:"User",value:"user",icon:U.getFieldTypeIcon("user")}];function a(u){l=u,t(0,l)}return n.$$set=u=>{e=ct(ct({},e),ci(u)),t(3,s=Yt(e,i)),"value"in u&&t(0,l=u.value),"class"in u&&t(1,r=u.class)},[l,r,o,s,a]}class z4 extends Ne{constructor(e){super(),Ie(this,e,V4,q4,Pe,{value:0,class:1})}}function B4(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Min length"),s=O(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",r=n[5]),p(l,"step","1"),p(l,"min","0")},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].min),o||(a=X(l,"input",n[2]),o=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&r!==(r=u[5])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function U4(n){let e,t,i,s,l,r,o,a,u;return{c(){e=_("label"),t=H("Max length"),s=O(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",r=n[5]),p(l,"step","1"),p(l,"min",o=n[0].min||0)},m(f,c){w(f,e,c),m(e,t),w(f,s,c),w(f,l,c),$e(l,n[0].max),a||(u=X(l,"input",n[3]),a=!0)},p(f,c){c&32&&i!==(i=f[5])&&p(e,"for",i),c&32&&r!==(r=f[5])&&p(l,"id",r),c&1&&o!==(o=f[0].min||0)&&p(l,"min",o),c&1&&Tt(l.value)!==f[0].max&&$e(l,f[0].max)},d(f){f&&k(e),f&&k(s),f&&k(l),a=!1,u()}}}function W4(n){let e,t,i,s,l,r,o,a,u,f;return{c(){e=_("label"),t=H("Regex pattern"),s=O(),l=_("input"),o=O(),a=_("div"),a.innerHTML="Valid Go regular expression, eg. ^\\w+$.",p(e,"for",i=n[5]),p(l,"type","text"),p(l,"id",r=n[5]),p(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),$e(l,n[0].pattern),w(c,o,d),w(c,a,d),u||(f=X(l,"input",n[4]),u=!0)},p(c,d){d&32&&i!==(i=c[5])&&p(e,"for",i),d&32&&r!==(r=c[5])&&p(l,"id",r),d&1&&l.value!==c[0].pattern&&$e(l,c[0].pattern)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(o),c&&k(a),u=!1,f()}}}function Y4(n){let e,t,i,s,l,r,o,a,u,f;return i=new He({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[B4,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[U4,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),u=new He({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[W4,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),o=O(),a=_("div"),B(u.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(e,"class","grid")},m(c,d){w(c,e,d),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),m(e,o),m(e,a),V(u,a,null),f=!0},p(c,[d]){const h={};d&2&&(h.name="schema."+c[1]+".options.min"),d&97&&(h.$$scope={dirty:d,ctx:c}),i.$set(h);const g={};d&2&&(g.name="schema."+c[1]+".options.max"),d&97&&(g.$$scope={dirty:d,ctx:c}),r.$set(g);const y={};d&2&&(y.name="schema."+c[1]+".options.pattern"),d&97&&(y.$$scope={dirty:d,ctx:c}),u.$set(y)},i(c){f||(E(i.$$.fragment,c),E(r.$$.fragment,c),E(u.$$.fragment,c),f=!0)},o(c){F(i.$$.fragment,c),F(r.$$.fragment,c),F(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(r),z(u)}}}function K4(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Tt(this.value),t(0,s)}function r(){s.max=Tt(this.value),t(0,s)}function o(){s.pattern=this.value,t(0,s)}return n.$$set=a=>{"key"in a&&t(1,i=a.key),"options"in a&&t(0,s=a.options)},[s,i,l,r,o]}class J4 extends Ne{constructor(e){super(),Ie(this,e,K4,Y4,Pe,{key:1,options:0})}}function x4(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Min"),s=O(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",r=n[4])},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].min),o||(a=X(l,"input",n[2]),o=!0)},p(u,f){f&16&&i!==(i=u[4])&&p(e,"for",i),f&16&&r!==(r=u[4])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function G4(n){let e,t,i,s,l,r,o,a,u;return{c(){e=_("label"),t=H("Max"),s=O(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",r=n[4]),p(l,"min",o=n[0].min)},m(f,c){w(f,e,c),m(e,t),w(f,s,c),w(f,l,c),$e(l,n[0].max),a||(u=X(l,"input",n[3]),a=!0)},p(f,c){c&16&&i!==(i=f[4])&&p(e,"for",i),c&16&&r!==(r=f[4])&&p(l,"id",r),c&1&&o!==(o=f[0].min)&&p(l,"min",o),c&1&&Tt(l.value)!==f[0].max&&$e(l,f[0].max)},d(f){f&&k(e),f&&k(s),f&&k(l),a=!1,u()}}}function Z4(n){let e,t,i,s,l,r,o;return i=new He({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[x4,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[G4,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),o=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.min"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.max"),u&49&&(c.$$scope={dirty:u,ctx:a}),r.$set(c)},i(a){o||(E(i.$$.fragment,a),E(r.$$.fragment,a),o=!0)},o(a){F(i.$$.fragment,a),F(r.$$.fragment,a),o=!1},d(a){a&&k(e),z(i),z(r)}}}function X4(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Tt(this.value),t(0,s)}function r(){s.max=Tt(this.value),t(0,s)}return n.$$set=o=>{"key"in o&&t(1,i=o.key),"options"in o&&t(0,s=o.options)},[s,i,l,r]}class Q4 extends Ne{constructor(e){super(),Ie(this,e,X4,Z4,Pe,{key:1,options:0})}}function eM(n,e,t){let{key:i=""}=e,{options:s={}}=e;return n.$$set=l=>{"key"in l&&t(0,i=l.key),"options"in l&&t(1,s=l.options)},[i,s]}class tM extends Ne{constructor(e){super(),Ie(this,e,eM,null,Pe,{key:0,options:1})}}function nM(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],r={};for(let o=0;o{t(0,r=U.splitNonEmpty(u.target.value,o))};return n.$$set=u=>{e=ct(ct({},e),ci(u)),t(3,l=Yt(e,s)),"value"in u&&t(0,r=u.value),"separator"in u&&t(1,o=u.separator)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=(r||[]).join(","))},[r,o,i,l,a]}class vs extends Ne{constructor(e){super(),Ie(this,e,iM,nM,Pe,{value:0,separator:1})}}function sM(n){let e,t,i,s,l,r,o,a,u,f,c,d,h;function g(b){n[2](b)}let y={id:n[4],disabled:!U.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(y.value=n[0].exceptDomains),o=new vs({props:y}),he.push(()=>Fe(o,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=O(),s=_("i"),r=O(),B(o.$$.fragment),u=O(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[4]),p(f,"class","help-block")},m(b,v){w(b,e,v),m(e,t),m(e,i),m(e,s),w(b,r,v),V(o,b,v),w(b,u,v),w(b,f,v),c=!0,d||(h=Xe(St.call(null,s,{text:`Domains that are NOT allowed as value. + This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,v){(!c||v&16&&l!==(l=b[4]))&&p(e,"for",l);const S={};v&16&&(S.id=b[4]),v&1&&(S.disabled=!U.isEmpty(b[0].onlyDomains)),!a&&v&1&&(a=!0,S.value=b[0].exceptDomains,Re(()=>a=!1)),o.$set(S)},i(b){c||(E(o.$$.fragment,b),c=!0)},o(b){F(o.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(r),z(o,b),b&&k(u),b&&k(f),d=!1,h()}}}function lM(n){let e,t,i,s,l,r,o,a,u,f,c,d,h;function g(b){n[3](b)}let y={id:n[4]+".options.onlyDomains",disabled:!U.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(y.value=n[0].onlyDomains),o=new vs({props:y}),he.push(()=>Fe(o,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=O(),s=_("i"),r=O(),B(o.$$.fragment),u=O(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[4]+".options.onlyDomains"),p(f,"class","help-block")},m(b,v){w(b,e,v),m(e,t),m(e,i),m(e,s),w(b,r,v),V(o,b,v),w(b,u,v),w(b,f,v),c=!0,d||(h=Xe(St.call(null,s,{text:`Domains that are ONLY allowed as value. + This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,v){(!c||v&16&&l!==(l=b[4]+".options.onlyDomains"))&&p(e,"for",l);const S={};v&16&&(S.id=b[4]+".options.onlyDomains"),v&1&&(S.disabled=!U.isEmpty(b[0].exceptDomains)),!a&&v&1&&(a=!0,S.value=b[0].onlyDomains,Re(()=>a=!1)),o.$set(S)},i(b){c||(E(o.$$.fragment,b),c=!0)},o(b){F(o.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(r),z(o,b),b&&k(u),b&&k(f),d=!1,h()}}}function rM(n){let e,t,i,s,l,r,o;return i=new He({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[sM,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[lM,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),o=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.onlyDomains"),u&49&&(c.$$scope={dirty:u,ctx:a}),r.$set(c)},i(a){o||(E(i.$$.fragment,a),E(r.$$.fragment,a),o=!0)},o(a){F(i.$$.fragment,a),F(r.$$.fragment,a),o=!1},d(a){a&&k(e),z(i),z(r)}}}function oM(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(o){n.$$.not_equal(s.exceptDomains,o)&&(s.exceptDomains=o,t(0,s))}function r(o){n.$$.not_equal(s.onlyDomains,o)&&(s.onlyDomains=o,t(0,s))}return n.$$set=o=>{"key"in o&&t(1,i=o.key),"options"in o&&t(0,s=o.options)},[s,i,l,r]}class Ab extends Ne{constructor(e){super(),Ie(this,e,oM,rM,Pe,{key:1,options:0})}}function aM(n){let e,t,i,s;function l(a){n[2](a)}function r(a){n[3](a)}let o={};return n[0]!==void 0&&(o.key=n[0]),n[1]!==void 0&&(o.options=n[1]),e=new Ab({props:o}),he.push(()=>Fe(e,"key",l)),he.push(()=>Fe(e,"options",r)),{c(){B(e.$$.fragment)},m(a,u){V(e,a,u),s=!0},p(a,[u]){const f={};!t&&u&1&&(t=!0,f.key=a[0],Re(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],Re(()=>i=!1)),e.$set(f)},i(a){s||(E(e.$$.fragment,a),s=!0)},o(a){F(e.$$.fragment,a),s=!1},d(a){z(e,a)}}}function uM(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(o){i=o,t(0,i)}function r(o){s=o,t(1,s)}return n.$$set=o=>{"key"in o&&t(0,i=o.key),"options"in o&&t(1,s=o.options)},[i,s,l,r]}class fM extends Ne{constructor(e){super(),Ie(this,e,uM,aM,Pe,{key:0,options:1})}}var Sa=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],Hs={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console!="undefined"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},ql={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},_n=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},jn=function(n){return n===!0?1:0};function Dp(n,e){var t;return function(){var i=this,s=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,s)},e)}}var Ca=function(n){return n instanceof Array?n:[n]};function cn(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function wt(n,e,t){var i=window.document.createElement(n);return e=e||"",t=t||"",i.className=e,t!==void 0&&(i.textContent=t),i}function Lr(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function Eb(n,e){if(e(n))return n;if(n.parentNode)return Eb(n.parentNode,e)}function Fr(n,e){var t=wt("div","numInputWrapper"),i=wt("input","numInput "+n),s=wt("span","arrowUp"),l=wt("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var r in e)i.setAttribute(r,e[r]);return t.appendChild(i),t.appendChild(s),t.appendChild(l),t}function wn(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var Ma=function(){},bo=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},cM={D:Ma,F:function(n,e,t){n.setMonth(t.months.longhand.indexOf(e))},G:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},H:function(n,e){n.setHours(parseFloat(e))},J:function(n,e){n.setDate(parseFloat(e))},K:function(n,e,t){n.setHours(n.getHours()%12+12*jn(new RegExp(t.amPM[1],"i").test(e)))},M:function(n,e,t){n.setMonth(t.months.shorthand.indexOf(e))},S:function(n,e){n.setSeconds(parseFloat(e))},U:function(n,e){return new Date(parseFloat(e)*1e3)},W:function(n,e,t){var i=parseInt(e),s=new Date(n.getFullYear(),0,2+(i-1)*7,0,0,0,0);return s.setDate(s.getDate()-s.getDay()+t.firstDayOfWeek),s},Y:function(n,e){n.setFullYear(parseFloat(e))},Z:function(n,e){return new Date(e)},d:function(n,e){n.setDate(parseFloat(e))},h:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},i:function(n,e){n.setMinutes(parseFloat(e))},j:function(n,e){n.setDate(parseFloat(e))},l:Ma,m:function(n,e){n.setMonth(parseFloat(e)-1)},n:function(n,e){n.setMonth(parseFloat(e)-1)},s:function(n,e){n.setSeconds(parseFloat(e))},u:function(n,e){return new Date(parseFloat(e))},w:Ma,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},rs={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},Al={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[Al.w(n,e,t)]},F:function(n,e,t){return bo(Al.n(n,e,t)-1,!1,e)},G:function(n,e,t){return _n(Al.h(n,e,t))},H:function(n){return _n(n.getHours())},J:function(n,e){return e.ordinal!==void 0?n.getDate()+e.ordinal(n.getDate()):n.getDate()},K:function(n,e){return e.amPM[jn(n.getHours()>11)]},M:function(n,e){return bo(n.getMonth(),!0,e)},S:function(n){return _n(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return _n(n.getFullYear(),4)},d:function(n){return _n(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return _n(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return _n(n.getMonth()+1)},n:function(n){return n.getMonth()+1},s:function(n){return n.getSeconds()},u:function(n){return n.getTime()},w:function(n){return n.getDay()},y:function(n){return String(n.getFullYear()).substring(2)}},Pb=function(n){var e=n.config,t=e===void 0?Hs:e,i=n.l10n,s=i===void 0?ql:i,l=n.isMobile,r=l===void 0?!1:l;return function(o,a,u){var f=u||s;return t.formatDate!==void 0&&!r?t.formatDate(o,a,f):a.split("").map(function(c,d,h){return Al[c]&&h[d-1]!=="\\"?Al[c](o,f,t):c!=="\\"?c:""}).join("")}},hu=function(n){var e=n.config,t=e===void 0?Hs:e,i=n.l10n,s=i===void 0?ql:i;return function(l,r,o,a){if(!(l!==0&&!l)){var u=a||s,f,c=l;if(l instanceof Date)f=new Date(l.getTime());else if(typeof l!="string"&&l.toFixed!==void 0)f=new Date(l);else if(typeof l=="string"){var d=r||(t||Hs).dateFormat,h=String(l).trim();if(h==="today")f=new Date,o=!0;else if(t&&t.parseDate)f=t.parseDate(l,d);else if(/Z$/.test(h)||/GMT$/.test(h))f=new Date(l);else{for(var g=void 0,y=[],b=0,v=0,S="";bMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),Q=Oa(t.config);j.setHours(Q.hours,Q.minutes,Q.seconds,j.getMilliseconds()),t.selectedDates=[j],t.latestSelectedDateObj=j}I!==void 0&&I.type!=="blur"&&pe(I);var de=t._input.value;c(),qt(),t._input.value!==de&&t._debouncedChange()}function u(I,j){return I%12+12*jn(j===t.l10n.amPM[1])}function f(I){switch(I%24){case 0:case 12:return 12;default:return I%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var I=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,j=(parseInt(t.minuteElement.value,10)||0)%60,Q=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(I=u(I,t.amPM.textContent));var de=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&Sn(t.latestSelectedDateObj,t.config.minDate,!0)===0,Ee=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&Sn(t.latestSelectedDateObj,t.config.maxDate,!0)===0;if(t.config.maxTime!==void 0&&t.config.minTime!==void 0&&t.config.minTime>t.config.maxTime){var We=$a(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),tt=$a(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),Je=$a(I,j,Q);if(Je>tt&&Je=12)]),t.secondElement!==void 0&&(t.secondElement.value=_n(Q)))}function g(I){var j=wn(I),Q=parseInt(j.value)+(I.delta||0);(Q/1e3>1||I.key==="Enter"&&!/[^\d]/.test(Q.toString()))&&ue(Q)}function y(I,j,Q,de){if(j instanceof Array)return j.forEach(function(Ee){return y(I,Ee,Q,de)});if(I instanceof Array)return I.forEach(function(Ee){return y(Ee,j,Q,de)});I.addEventListener(j,Q,de),t._handlers.push({remove:function(){return I.removeEventListener(j,Q,de)}})}function b(){st("onChange")}function v(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(Q){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+Q+"]"),function(de){return y(de,"click",t[Q])})}),t.isMobile){Ce();return}var I=Dp(oe,50);if(t._debouncedChange=Dp(b,mM),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&y(t.daysContainer,"mouseover",function(Q){t.config.mode==="range"&&qe(wn(Q))}),y(t._input,"keydown",Le),t.calendarContainer!==void 0&&y(t.calendarContainer,"keydown",Le),!t.config.inline&&!t.config.static&&y(window,"resize",I),window.ontouchstart!==void 0?y(window.document,"touchstart",be):y(window.document,"mousedown",be),y(window.document,"focus",be,{capture:!0}),t.config.clickOpens===!0&&(y(t._input,"focus",t.open),y(t._input,"click",t.open)),t.daysContainer!==void 0&&(y(t.monthNav,"click",ni),y(t.monthNav,["keyup","increment"],g),y(t.daysContainer,"click",vt)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var j=function(Q){return wn(Q).select()};y(t.timeContainer,["increment"],a),y(t.timeContainer,"blur",a,{capture:!0}),y(t.timeContainer,"click",C),y([t.hourElement,t.minuteElement],["focus","click"],j),t.secondElement!==void 0&&y(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&y(t.amPM,"click",function(Q){a(Q)})}t.config.allowInput&&y(t._input,"blur",je)}function S(I,j){var Q=I!==void 0?t.parseDate(I):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(I);var Ee=t.config.appendTo!==void 0&&t.config.appendTo.nodeType!==void 0;if((t.config.inline||t.config.static)&&(t.calendarContainer.classList.add(t.config.inline?"inline":"static"),t.config.inline&&(!Ee&&t.element.parentNode?t.element.parentNode.insertBefore(t.calendarContainer,t._input.nextSibling):t.config.appendTo!==void 0&&t.config.appendTo.appendChild(t.calendarContainer)),t.config.static)){var We=wt("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(We,t.element),We.appendChild(t.element),t.altInput&&We.appendChild(t.altInput),We.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function T(I,j,Q,de){var Ee=ie(j,!0),We=wt("span",I,j.getDate().toString());return We.dateObj=j,We.$i=de,We.setAttribute("aria-label",t.formatDate(j,t.config.ariaDateFormat)),I.indexOf("hidden")===-1&&Sn(j,t.now)===0&&(t.todayDateElem=We,We.classList.add("today"),We.setAttribute("aria-current","date")),Ee?(We.tabIndex=-1,ce(j)&&(We.classList.add("selected"),t.selectedDateElem=We,t.config.mode==="range"&&(cn(We,"startRange",t.selectedDates[0]&&Sn(j,t.selectedDates[0],!0)===0),cn(We,"endRange",t.selectedDates[1]&&Sn(j,t.selectedDates[1],!0)===0),I==="nextMonthDay"&&We.classList.add("inRange")))):We.classList.add("flatpickr-disabled"),t.config.mode==="range"&&we(j)&&!ce(j)&&We.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&I!=="prevMonthDay"&&de%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(j)+""),st("onDayCreate",We),We}function A(I){I.focus(),t.config.mode==="range"&&qe(I)}function D(I){for(var j=I>0?0:t.config.showMonths-1,Q=I>0?t.config.showMonths:-1,de=j;de!=Q;de+=I)for(var Ee=t.daysContainer.children[de],We=I>0?0:Ee.children.length-1,tt=I>0?Ee.children.length:-1,Je=We;Je!=tt;Je+=I){var nt=Ee.children[Je];if(nt.className.indexOf("hidden")===-1&&ie(nt.dateObj))return nt}}function P(I,j){for(var Q=I.className.indexOf("Month")===-1?I.dateObj.getMonth():t.currentMonth,de=j>0?t.config.showMonths:-1,Ee=j>0?1:-1,We=Q-t.currentMonth;We!=de;We+=Ee)for(var tt=t.daysContainer.children[We],Je=Q-t.currentMonth===We?I.$i+j:j<0?tt.children.length-1:0,nt=tt.children.length,xe=Je;xe>=0&&xe0?nt:-1);xe+=Ee){var et=tt.children[xe];if(et.className.indexOf("hidden")===-1&&ie(et.dateObj)&&Math.abs(I.$i-xe)>=Math.abs(j))return A(et)}t.changeMonth(Ee),L(D(Ee),0)}function L(I,j){var Q=l(),de=ve(Q||document.body),Ee=I!==void 0?I:de?Q:t.selectedDateElem!==void 0&&ve(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&ve(t.todayDateElem)?t.todayDateElem:D(j>0?1:-1);Ee===void 0?t._input.focus():de?P(Ee,j):A(Ee)}function N(I,j){for(var Q=(new Date(I,j,1).getDay()-t.l10n.firstDayOfWeek+7)%7,de=t.utils.getDaysInMonth((j-1+12)%12,I),Ee=t.utils.getDaysInMonth(j,I),We=window.document.createDocumentFragment(),tt=t.config.showMonths>1,Je=tt?"prevMonthDay hidden":"prevMonthDay",nt=tt?"nextMonthDay hidden":"nextMonthDay",xe=de+1-Q,et=0;xe<=de;xe++,et++)We.appendChild(T("flatpickr-day "+Je,new Date(I,j-1,xe),xe,et));for(xe=1;xe<=Ee;xe++,et++)We.appendChild(T("flatpickr-day",new Date(I,j,xe),xe,et));for(var _t=Ee+1;_t<=42-Q&&(t.config.showMonths===1||et%7!==0);_t++,et++)We.appendChild(T("flatpickr-day "+nt,new Date(I,j+1,_t%Ee),_t,et));var Ft=wt("div","dayContainer");return Ft.appendChild(We),Ft}function R(){if(t.daysContainer!==void 0){Lr(t.daysContainer),t.weekNumbers&&Lr(t.weekNumbers);for(var I=document.createDocumentFragment(),j=0;j1||t.config.monthSelectorType!=="dropdown")){var I=function(de){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&det.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var j=0;j<12;j++)if(!!I(j)){var Q=wt("option","flatpickr-monthDropdown-month");Q.value=new Date(t.currentYear,j).getMonth().toString(),Q.textContent=bo(j,t.config.shorthandCurrentMonth,t.l10n),Q.tabIndex=-1,t.currentMonth===j&&(Q.selected=!0),t.monthsDropdownContainer.appendChild(Q)}}}function W(){var I=wt("div","flatpickr-month"),j=window.document.createDocumentFragment(),Q;t.config.showMonths>1||t.config.monthSelectorType==="static"?Q=wt("span","cur-month"):(t.monthsDropdownContainer=wt("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),y(t.monthsDropdownContainer,"change",function(tt){var Je=wn(tt),nt=parseInt(Je.value,10);t.changeMonth(nt-t.currentMonth),st("onMonthChange")}),J(),Q=t.monthsDropdownContainer);var de=Fr("cur-year",{tabindex:"-1"}),Ee=de.getElementsByTagName("input")[0];Ee.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Ee.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Ee.setAttribute("max",t.config.maxDate.getFullYear().toString()),Ee.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var We=wt("div","flatpickr-current-month");return We.appendChild(Q),We.appendChild(de),j.appendChild(We),I.appendChild(j),{container:I,yearElement:Ee,monthElement:Q}}function q(){Lr(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var I=t.config.showMonths;I--;){var j=W();t.yearElements.push(j.yearElement),t.monthElements.push(j.monthElement),t.monthNav.appendChild(j.container)}t.monthNav.appendChild(t.nextMonthNav)}function x(){return t.monthNav=wt("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=wt("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=wt("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,q(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(I){t.__hidePrevMonthArrow!==I&&(cn(t.prevMonthNav,"flatpickr-disabled",I),t.__hidePrevMonthArrow=I)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(I){t.__hideNextMonthArrow!==I&&(cn(t.nextMonthNav,"flatpickr-disabled",I),t.__hideNextMonthArrow=I)}}),t.currentYearElement=t.yearElements[0],Ze(),t.monthNav}function K(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var I=Oa(t.config);t.timeContainer=wt("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var j=wt("span","flatpickr-time-separator",":"),Q=Fr("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=Q.getElementsByTagName("input")[0];var de=Fr("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=de.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=_n(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?I.hours:f(I.hours)),t.minuteElement.value=_n(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():I.minutes),t.hourElement.setAttribute("step",t.config.hourIncrement.toString()),t.minuteElement.setAttribute("step",t.config.minuteIncrement.toString()),t.hourElement.setAttribute("min",t.config.time_24hr?"0":"1"),t.hourElement.setAttribute("max",t.config.time_24hr?"23":"12"),t.hourElement.setAttribute("maxlength","2"),t.minuteElement.setAttribute("min","0"),t.minuteElement.setAttribute("max","59"),t.minuteElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(Q),t.timeContainer.appendChild(j),t.timeContainer.appendChild(de),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Ee=Fr("flatpickr-second");t.secondElement=Ee.getElementsByTagName("input")[0],t.secondElement.value=_n(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():I.seconds),t.secondElement.setAttribute("step",t.minuteElement.getAttribute("step")),t.secondElement.setAttribute("min","0"),t.secondElement.setAttribute("max","59"),t.secondElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(wt("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Ee)}return t.config.time_24hr||(t.amPM=wt("span","flatpickr-am-pm",t.l10n.amPM[jn((t.latestSelectedDateObj?t.hourElement.value:t.config.defaultHour)>11)]),t.amPM.title=t.l10n.toggleTitle,t.amPM.tabIndex=-1,t.timeContainer.appendChild(t.amPM)),t.timeContainer}function Y(){t.weekdayContainer?Lr(t.weekdayContainer):t.weekdayContainer=wt("div","flatpickr-weekdays");for(var I=t.config.showMonths;I--;){var j=wt("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(j)}return te(),t.weekdayContainer}function te(){if(!!t.weekdayContainer){var I=t.l10n.firstDayOfWeek,j=Ap(t.l10n.weekdays.shorthand);I>0&&I + `+j.join("")+` + + `}}function fe(){t.calendarContainer.classList.add("hasWeeks");var I=wt("div","flatpickr-weekwrapper");I.appendChild(wt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var j=wt("div","flatpickr-weeks");return I.appendChild(j),{weekWrapper:I,weekNumbers:j}}function ye(I,j){j===void 0&&(j=!0);var Q=j?I:I-t.currentMonth;Q<0&&t._hidePrevMonthArrow===!0||Q>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=Q,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,st("onYearChange"),J()),R(),st("onMonthChange"),Ze())}function se(I,j){if(I===void 0&&(I=!0),j===void 0&&(j=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,j===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var Q=Oa(t.config),de=Q.hours,Ee=Q.minutes,We=Q.seconds;h(de,Ee,We)}t.redraw(),I&&st("onChange")}function G(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),st("onClose")}function Oe(){t.config!==void 0&&st("onDestroy");for(var I=t._handlers.length;I--;)t._handlers[I].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var j=t.calendarContainer.parentNode;if(j.lastChild&&j.removeChild(j.lastChild),j.parentNode){for(;j.firstChild;)j.parentNode.insertBefore(j.firstChild,j);j.parentNode.removeChild(j)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(Q){try{delete t[Q]}catch{}})}function ee(I){return t.calendarContainer.contains(I)}function be(I){if(t.isOpen&&!t.config.inline){var j=wn(I),Q=ee(j),de=j===t.input||j===t.altInput||t.element.contains(j)||I.path&&I.path.indexOf&&(~I.path.indexOf(t.input)||~I.path.indexOf(t.altInput)),Ee=!de&&!Q&&!ee(I.relatedTarget),We=!t.config.ignoredFocusElements.some(function(tt){return tt.contains(j)});Ee&&We&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function ue(I){if(!(!I||t.config.minDate&&It.config.maxDate.getFullYear())){var j=I,Q=t.currentYear!==j;t.currentYear=j||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),Q&&(t.redraw(),st("onYearChange"),J())}}function ie(I,j){var Q;j===void 0&&(j=!0);var de=t.parseDate(I,void 0,j);if(t.config.minDate&&de&&Sn(de,t.config.minDate,j!==void 0?j:!t.minDateHasTime)<0||t.config.maxDate&&de&&Sn(de,t.config.maxDate,j!==void 0?j:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(de===void 0)return!1;for(var Ee=!!t.config.enable,We=(Q=t.config.enable)!==null&&Q!==void 0?Q:t.config.disable,tt=0,Je=void 0;tt=Je.from.getTime()&&de.getTime()<=Je.to.getTime())return Ee}return!Ee}function ve(I){return t.daysContainer!==void 0?I.className.indexOf("hidden")===-1&&I.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(I):!1}function je(I){var j=I.target===t._input,Q=t._input.value.trimEnd()!==xt();j&&Q&&!(I.relatedTarget&&ee(I.relatedTarget))&&t.setDate(t._input.value,!0,I.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Le(I){var j=wn(I),Q=t.config.wrap?n.contains(j):j===t._input,de=t.config.allowInput,Ee=t.isOpen&&(!de||!Q),We=t.config.inline&&Q&&!de;if(I.keyCode===13&&Q){if(de)return t.setDate(t._input.value,!0,j===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),j.blur();t.open()}else if(ee(j)||Ee||We){var tt=!!t.timeContainer&&t.timeContainer.contains(j);switch(I.keyCode){case 13:tt?(I.preventDefault(),a(),Be()):vt(I);break;case 27:I.preventDefault(),Be();break;case 8:case 46:Q&&!t.config.allowInput&&(I.preventDefault(),t.clear());break;case 37:case 39:if(!tt&&!Q){I.preventDefault();var Je=l();if(t.daysContainer!==void 0&&(de===!1||Je&&ve(Je))){var nt=I.keyCode===39?1:-1;I.ctrlKey?(I.stopPropagation(),ye(nt),L(D(1),0)):L(void 0,nt)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:I.preventDefault();var xe=I.keyCode===40?1:-1;t.daysContainer&&j.$i!==void 0||j===t.input||j===t.altInput?I.ctrlKey?(I.stopPropagation(),ue(t.currentYear-xe),L(D(1),0)):tt||L(void 0,xe*7):j===t.currentYearElement?ue(t.currentYear-xe):t.config.enableTime&&(!tt&&t.hourElement&&t.hourElement.focus(),a(I),t._debouncedChange());break;case 9:if(tt){var et=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(nn){return nn}),_t=et.indexOf(j);if(_t!==-1){var Ft=et[_t+(I.shiftKey?-1:1)];I.preventDefault(),(Ft||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(j)&&I.shiftKey&&(I.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&j===t.amPM)switch(I.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),qt();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),qt();break}(Q||ee(j))&&st("onKeyDown",I)}function qe(I,j){if(j===void 0&&(j="flatpickr-day"),!(t.selectedDates.length!==1||I&&(!I.classList.contains(j)||I.classList.contains("flatpickr-disabled")))){for(var Q=I?I.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),de=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Ee=Math.min(Q,t.selectedDates[0].getTime()),We=Math.max(Q,t.selectedDates[0].getTime()),tt=!1,Je=0,nt=0,xe=Ee;xeEe&&xeJe)?Je=xe:xe>de&&(!nt||xe ."+j));et.forEach(function(_t){var Ft=_t.dateObj,nn=Ft.getTime(),Fn=Je>0&&nn0&&nn>nt;if(Fn){_t.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Bt){_t.classList.remove(Bt)});return}else if(tt&&!Fn)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Bt){_t.classList.remove(Bt)}),I!==void 0&&(I.classList.add(Q<=t.selectedDates[0].getTime()?"startRange":"endRange"),deQ&&nn===de&&_t.classList.add("endRange"),nn>=Je&&(nt===0||nn<=nt)&&dM(nn,de,Q)&&_t.classList.add("inRange"))})}}function oe(){t.isOpen&&!t.config.static&&!t.config.inline&&ge()}function le(I,j){if(j===void 0&&(j=t._positionElement),t.isMobile===!0){if(I){I.preventDefault();var Q=wn(I);Q&&Q.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),st("onOpen");return}else if(t._input.disabled||t.config.inline)return;var de=t.isOpen;t.isOpen=!0,de||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),st("onOpen"),ge(j)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(I===void 0||!t.timeContainer.contains(I.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function ke(I){return function(j){var Q=t.config["_"+I+"Date"]=t.parseDate(j,t.config.dateFormat),de=t.config["_"+(I==="min"?"max":"min")+"Date"];Q!==void 0&&(t[I==="min"?"minDateHasTime":"maxDateHasTime"]=Q.getHours()>0||Q.getMinutes()>0||Q.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Ee){return ie(Ee)}),!t.selectedDates.length&&I==="min"&&d(Q),qt()),t.daysContainer&&(ae(),Q!==void 0?t.currentYearElement[I]=Q.getFullYear().toString():t.currentYearElement.removeAttribute(I),t.currentYearElement.disabled=!!de&&Q!==void 0&&de.getFullYear()===Q.getFullYear())}}function Ve(){var I=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],j=rn(rn({},JSON.parse(JSON.stringify(n.dataset||{}))),e),Q={};t.config.parseDate=j.parseDate,t.config.formatDate=j.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(et){t.config._enable=zt(et)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(et){t.config._disable=zt(et)}});var de=j.mode==="time";if(!j.dateFormat&&(j.enableTime||de)){var Ee=Wt.defaultConfig.dateFormat||Hs.dateFormat;Q.dateFormat=j.noCalendar||de?"H:i"+(j.enableSeconds?":S":""):Ee+" H:i"+(j.enableSeconds?":S":"")}if(j.altInput&&(j.enableTime||de)&&!j.altFormat){var We=Wt.defaultConfig.altFormat||Hs.altFormat;Q.altFormat=j.noCalendar||de?"h:i"+(j.enableSeconds?":S K":" K"):We+(" h:i"+(j.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:ke("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:ke("max")});var tt=function(et){return function(_t){t.config[et==="min"?"_minTime":"_maxTime"]=t.parseDate(_t,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:tt("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:tt("max")}),j.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,Q,j);for(var Je=0;Je-1?t.config[xe]=Ca(nt[xe]).map(r).concat(t.config[xe]):typeof j[xe]=="undefined"&&(t.config[xe]=nt[xe])}j.altInputClass||(t.config.altInputClass=ze().className+" "+t.config.altInputClass),st("onParseConfig")}function ze(){return t.config.wrap?n.querySelector("[data-input]"):n}function Ge(){typeof t.config.locale!="object"&&typeof Wt.l10ns[t.config.locale]=="undefined"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=rn(rn({},Wt.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?Wt.l10ns[t.config.locale]:void 0),rs.D="("+t.l10n.weekdays.shorthand.join("|")+")",rs.l="("+t.l10n.weekdays.longhand.join("|")+")",rs.M="("+t.l10n.months.shorthand.join("|")+")",rs.F="("+t.l10n.months.longhand.join("|")+")",rs.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var I=rn(rn({},e),JSON.parse(JSON.stringify(n.dataset||{})));I.time_24hr===void 0&&Wt.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=Pb(t),t.parseDate=hu({config:t.config,l10n:t.l10n})}function ge(I){if(typeof t.config.position=="function")return void t.config.position(t,I);if(t.calendarContainer!==void 0){st("onPreCalendarPosition");var j=I||t._positionElement,Q=Array.prototype.reduce.call(t.calendarContainer.children,function(Me,Ye){return Me+Ye.offsetHeight},0),de=t.calendarContainer.offsetWidth,Ee=t.config.position.split(" "),We=Ee[0],tt=Ee.length>1?Ee[1]:null,Je=j.getBoundingClientRect(),nt=window.innerHeight-Je.bottom,xe=We==="above"||We!=="below"&&ntQ,et=window.pageYOffset+Je.top+(xe?-Q-2:j.offsetHeight+2);if(cn(t.calendarContainer,"arrowTop",!xe),cn(t.calendarContainer,"arrowBottom",xe),!t.config.inline){var _t=window.pageXOffset+Je.left,Ft=!1,nn=!1;tt==="center"?(_t-=(de-Je.width)/2,Ft=!0):tt==="right"&&(_t-=de-Je.width,nn=!0),cn(t.calendarContainer,"arrowLeft",!Ft&&!nn),cn(t.calendarContainer,"arrowCenter",Ft),cn(t.calendarContainer,"arrowRight",nn);var Fn=window.document.body.offsetWidth-(window.pageXOffset+Je.right),Bt=_t+de>window.document.body.offsetWidth,ks=Fn+de>window.document.body.offsetWidth;if(cn(t.calendarContainer,"rightMost",Bt),!t.config.static)if(t.calendarContainer.style.top=et+"px",!Bt)t.calendarContainer.style.left=_t+"px",t.calendarContainer.style.right="auto";else if(!ks)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Fn+"px";else{var ws=Ae();if(ws===void 0)return;var Ji=window.document.body.offsetWidth,tr=Math.max(0,Ji/2-de/2),Ss=".flatpickr-calendar.centerMost:before",nr=".flatpickr-calendar.centerMost:after",xi=ws.cssRules.length,ir="{left:"+Je.left+"px;right:auto;}";cn(t.calendarContainer,"rightMost",!1),cn(t.calendarContainer,"centerMost",!0),ws.insertRule(Ss+","+nr+ir,xi),t.calendarContainer.style.left=tr+"px",t.calendarContainer.style.right="auto"}}}}function Ae(){for(var I=null,j=0;jt.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=de,t.config.mode==="single")t.selectedDates=[Ee];else if(t.config.mode==="multiple"){var tt=ce(Ee);tt?t.selectedDates.splice(parseInt(tt),1):t.selectedDates.push(Ee)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Ee,t.selectedDates.push(Ee),Sn(Ee,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(et,_t){return et.getTime()-_t.getTime()}));if(c(),We){var Je=t.currentYear!==Ee.getFullYear();t.currentYear=Ee.getFullYear(),t.currentMonth=Ee.getMonth(),Je&&(st("onYearChange"),J()),st("onMonthChange")}if(Ze(),R(),qt(),!We&&t.config.mode!=="range"&&t.config.showMonths===1?A(de):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var nt=t.config.mode==="single"&&!t.config.enableTime,xe=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(nt||xe)&&Be()}b()}}var it={locale:[Ge,te],showMonths:[q,o,Y],minDate:[S],maxDate:[S],positionElement:[me],clickOpens:[function(){t.config.clickOpens===!0?(y(t._input,"focus",t.open),y(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function gt(I,j){if(I!==null&&typeof I=="object"){Object.assign(t.config,I);for(var Q in I)it[Q]!==void 0&&it[Q].forEach(function(de){return de()})}else t.config[I]=j,it[I]!==void 0?it[I].forEach(function(de){return de()}):Sa.indexOf(I)>-1&&(t.config[I]=Ca(j));t.redraw(),qt(!0)}function at(I,j){var Q=[];if(I instanceof Array)Q=I.map(function(de){return t.parseDate(de,j)});else if(I instanceof Date||typeof I=="number")Q=[t.parseDate(I,j)];else if(typeof I=="string")switch(t.config.mode){case"single":case"time":Q=[t.parseDate(I,j)];break;case"multiple":Q=I.split(t.config.conjunction).map(function(de){return t.parseDate(de,j)});break;case"range":Q=I.split(t.l10n.rangeSeparator).map(function(de){return t.parseDate(de,j)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(I)));t.selectedDates=t.config.allowInvalidPreload?Q:Q.filter(function(de){return de instanceof Date&&ie(de,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(de,Ee){return de.getTime()-Ee.getTime()})}function yt(I,j,Q){if(j===void 0&&(j=!1),Q===void 0&&(Q=t.config.dateFormat),I!==0&&!I||I instanceof Array&&I.length===0)return t.clear(j);at(I,Q),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),S(void 0,j),d(),t.selectedDates.length===0&&t.clear(!1),qt(j),j&&st("onChange")}function zt(I){return I.slice().map(function(j){return typeof j=="string"||typeof j=="number"||j instanceof Date?t.parseDate(j,void 0,!0):j&&typeof j=="object"&&j.from&&j.to?{from:t.parseDate(j.from,void 0),to:t.parseDate(j.to,void 0)}:j}).filter(function(j){return j})}function $t(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var I=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);I&&at(I,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function Ot(){if(t.input=ze(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=wt(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),me()}function me(){t._positionElement=t.config.positionElement||t._input}function Ce(){var I=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=wt("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=I,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=I==="datetime-local"?"Y-m-d\\TH:i:S":I==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch{}y(t.mobileInput,"change",function(j){t.setDate(wn(j).value,!1,t.mobileFormatStr),st("onChange"),st("onClose")})}function Ke(I){if(t.isOpen===!0)return t.close();t.open(I)}function st(I,j){if(t.config!==void 0){var Q=t.config[I];if(Q!==void 0&&Q.length>0)for(var de=0;Q[de]&&de=0&&Sn(I,t.selectedDates[1])<=0}function Ze(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(I,j){var Q=new Date(t.currentYear,t.currentMonth,1);Q.setMonth(t.currentMonth+j),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[j].textContent=bo(Q.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=Q.getMonth().toString(),I.value=Q.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYeart.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function xt(I){var j=I||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(Q){return t.formatDate(Q,j)}).filter(function(Q,de,Ee){return t.config.mode!=="range"||t.config.enableTime||Ee.indexOf(Q)===de}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function qt(I){I===void 0&&(I=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=xt(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=xt(t.config.altFormat)),I!==!1&&st("onValueUpdate")}function ni(I){var j=wn(I),Q=t.prevMonthNav.contains(j),de=t.nextMonthNav.contains(j);Q||de?ye(Q?-1:1):t.yearElements.indexOf(j)>=0?j.select():j.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):j.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function pe(I){I.preventDefault();var j=I.type==="keydown",Q=wn(I),de=Q;t.amPM!==void 0&&Q===t.amPM&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]);var Ee=parseFloat(de.getAttribute("min")),We=parseFloat(de.getAttribute("max")),tt=parseFloat(de.getAttribute("step")),Je=parseInt(de.value,10),nt=I.delta||(j?I.which===38?1:-1:0),xe=Je+tt*nt;if(typeof de.value!="undefined"&&de.value.length===2){var et=de===t.hourElement,_t=de===t.minuteElement;xeWe&&(xe=de===t.hourElement?xe-We-jn(!t.amPM):Ee,_t&&M(void 0,1,t.hourElement)),t.amPM&&et&&(tt===1?xe+Je===23:Math.abs(xe-Je)>tt)&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]),de.value=_n(xe)}}return s(),t}function qs(n,e){for(var t=Array.prototype.slice.call(n).filter(function(r){return r instanceof HTMLElement}),i=[],s=0;s{const M=f||g,$=v(d);return $.onReady.push(()=>{t(8,h=!0)}),t(3,y=Wt(M,Object.assign($,f?{wrap:!0}:{}))),()=>{y.destroy()}});const b=vn();function v(M={}){M=Object.assign({},M);for(const $ of o){const T=(A,D,P)=>{b(yM($),[A,D,P])};$ in M?(Array.isArray(M[$])||(M[$]=[M[$]]),M[$].push(T)):M[$]=[T]}return M.onChange&&!M.onChange.includes(S)&&M.onChange.push(S),M}function S(M,$,T){var D,P;const A=(P=(D=T==null?void 0:T.config)==null?void 0:D.mode)!=null?P:"single";t(2,a=A==="single"?M[0]:M),t(4,u=$)}function C(M){he[M?"unshift":"push"](()=>{g=M,t(0,g)})}return n.$$set=M=>{e=ct(ct({},e),ci(M)),t(1,s=Yt(e,i)),"value"in M&&t(2,a=M.value),"formattedValue"in M&&t(4,u=M.formattedValue),"element"in M&&t(5,f=M.element),"dateFormat"in M&&t(6,c=M.dateFormat),"options"in M&&t(7,d=M.options),"input"in M&&t(0,g=M.input),"flatpickr"in M&&t(3,y=M.flatpickr),"$$scope"in M&&t(9,r=M.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&y&&h&&y.setDate(a,!1,c),n.$$.dirty&392&&y&&h)for(const[M,$]of Object.entries(v(d)))y.set(M,$)},[g,s,a,y,u,f,c,d,h,r,l,C]}class pf extends Ne{constructor(e){super(),Ie(this,e,vM,bM,Pe,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function kM(n){let e,t,i,s,l,r,o;function a(f){n[2](f)}let u={id:n[4],options:U.defaultFlatpickrOptions(),value:n[0].min};return n[0].min!==void 0&&(u.formattedValue=n[0].min),l=new pf({props:u}),he.push(()=>Fe(l,"formattedValue",a)),{c(){e=_("label"),t=H("Min date (UTC)"),s=O(),B(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].min),!r&&c&1&&(r=!0,d.formattedValue=f[0].min,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function wM(n){let e,t,i,s,l,r,o;function a(f){n[3](f)}let u={id:n[4],options:U.defaultFlatpickrOptions(),value:n[0].max};return n[0].max!==void 0&&(u.formattedValue=n[0].max),l=new pf({props:u}),he.push(()=>Fe(l,"formattedValue",a)),{c(){e=_("label"),t=H("Max date (UTC)"),s=O(),B(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].max),!r&&c&1&&(r=!0,d.formattedValue=f[0].max,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function SM(n){let e,t,i,s,l,r,o;return i=new He({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[kM,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[wM,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),o=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.min"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.max"),u&49&&(c.$$scope={dirty:u,ctx:a}),r.$set(c)},i(a){o||(E(i.$$.fragment,a),E(r.$$.fragment,a),o=!0)},o(a){F(i.$$.fragment,a),F(r.$$.fragment,a),o=!1},d(a){a&&k(e),z(i),z(r)}}}function CM(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(o){n.$$.not_equal(s.min,o)&&(s.min=o,t(0,s))}function r(o){n.$$.not_equal(s.max,o)&&(s.max=o,t(0,s))}return n.$$set=o=>{"key"in o&&t(1,i=o.key),"options"in o&&t(0,s=o.options)},[s,i,l,r]}class MM extends Ne{constructor(e){super(),Ie(this,e,CM,SM,Pe,{key:1,options:0})}}function $M(n){let e,t,i,s,l,r,o,a,u;function f(d){n[2](d)}let c={id:n[4],placeholder:"eg. optionA, optionB",required:!0};return n[0].values!==void 0&&(c.value=n[0].values),l=new vs({props:c}),he.push(()=>Fe(l,"value",f)),{c(){e=_("label"),t=H("Choices"),s=O(),B(l.$$.fragment),o=O(),a=_("div"),a.textContent="Use comma as separator.",p(e,"for",i=n[4]),p(a,"class","help-block")},m(d,h){w(d,e,h),m(e,t),w(d,s,h),V(l,d,h),w(d,o,h),w(d,a,h),u=!0},p(d,h){(!u||h&16&&i!==(i=d[4]))&&p(e,"for",i);const g={};h&16&&(g.id=d[4]),!r&&h&1&&(r=!0,g.value=d[0].values,Re(()=>r=!1)),l.$set(g)},i(d){u||(E(l.$$.fragment,d),u=!0)},o(d){F(l.$$.fragment,d),u=!1},d(d){d&&k(e),d&&k(s),z(l,d),d&&k(o),d&&k(a)}}}function OM(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Max select"),s=O(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",r=n[4]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),o||(a=X(l,"input",n[3]),o=!0)},p(u,f){f&16&&i!==(i=u[4])&&p(e,"for",i),f&16&&r!==(r=u[4])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function TM(n){let e,t,i,s,l,r,o;return i=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.values",$$slots:{default:[$M,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[OM,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),o=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.values"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.maxSelect"),u&49&&(c.$$scope={dirty:u,ctx:a}),r.$set(c)},i(a){o||(E(i.$$.fragment,a),E(r.$$.fragment,a),o=!0)},o(a){F(i.$$.fragment,a),F(r.$$.fragment,a),o=!1},d(a){a&&k(e),z(i),z(r)}}}function DM(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(o){n.$$.not_equal(s.values,o)&&(s.values=o,t(0,s))}function r(){s.maxSelect=Tt(this.value),t(0,s)}return n.$$set=o=>{"key"in o&&t(1,i=o.key),"options"in o&&t(0,s=o.options)},n.$$.update=()=>{n.$$.dirty&1&&U.isEmpty(s)&&t(0,s={maxSelect:1,values:[]})},[s,i,l,r]}class AM extends Ne{constructor(e){super(),Ie(this,e,DM,TM,Pe,{key:1,options:0})}}function EM(n,e,t){return["",{}]}class PM extends Ne{constructor(e){super(),Ie(this,e,EM,null,Pe,{key:0,options:1})}get key(){return this.$$.ctx[0]}get options(){return this.$$.ctx[1]}}function LM(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Max file size (bytes)"),s=O(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","number"),p(l,"id",r=n[9]),p(l,"step","1"),p(l,"min","0")},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSize),o||(a=X(l,"input",n[2]),o=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&r!==(r=u[9])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].maxSize&&$e(l,u[0].maxSize)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function FM(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Max files"),s=O(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","number"),p(l,"id",r=n[9]),p(l,"step","1"),p(l,"min",""),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),o||(a=X(l,"input",n[3]),o=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&r!==(r=u[9])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function IM(n){let e,t,i,s,l,r,o;return{c(){e=_("div"),e.innerHTML='Images (jpg, png, svg, gif)',t=O(),i=_("div"),i.innerHTML='Documents (pdf, doc/docx, xls/xlsx)',s=O(),l=_("div"),l.innerHTML='Archives (zip, 7zip, rar)',p(e,"tabindex","0"),p(e,"class","dropdown-item closable"),p(i,"tabindex","0"),p(i,"class","dropdown-item closable"),p(l,"tabindex","0"),p(l,"class","dropdown-item closable")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),w(a,s,u),w(a,l,u),r||(o=[X(e,"click",n[5]),X(i,"click",n[6]),X(l,"click",n[7])],r=!0)},p:re,d(a){a&&k(e),a&&k(t),a&&k(i),a&&k(s),a&&k(l),r=!1,lt(o)}}}function NM(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S;function C($){n[4]($)}let M={id:n[9],placeholder:"eg. image/png, application/pdf..."};return n[0].mimeTypes!==void 0&&(M.value=n[0].mimeTypes),o=new vs({props:M}),he.push(()=>Fe(o,"value",C)),y=new bs({props:{class:"dropdown dropdown-sm dropdown-nowrap",$$slots:{default:[IM]},$$scope:{ctx:n}}}),{c(){e=_("label"),t=_("span"),t.textContent="Mime types",i=O(),s=_("i"),r=O(),B(o.$$.fragment),u=O(),f=_("div"),c=H(`Use comma as separator. + `),d=_("span"),h=_("span"),h.textContent="Choose presets",g=O(),B(y.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[9]),p(h,"class","txt link-primary"),p(d,"class","inline-flex"),p(f,"class","help-block")},m($,T){w($,e,T),m(e,t),m(e,i),m(e,s),w($,r,T),V(o,$,T),w($,u,T),w($,f,T),m(f,c),m(f,d),m(d,h),m(d,g),V(y,d,null),b=!0,v||(S=Xe(St.call(null,s,{text:`Allow uploading files ONLY with the listed mime types. + Leave empty for no restriction.`,position:"top"})),v=!0)},p($,T){(!b||T&512&&l!==(l=$[9]))&&p(e,"for",l);const A={};T&512&&(A.id=$[9]),!a&&T&1&&(a=!0,A.value=$[0].mimeTypes,Re(()=>a=!1)),o.$set(A);const D={};T&1025&&(D.$$scope={dirty:T,ctx:$}),y.$set(D)},i($){b||(E(o.$$.fragment,$),E(y.$$.fragment,$),b=!0)},o($){F(o.$$.fragment,$),F(y.$$.fragment,$),b=!1},d($){$&&k(e),$&&k(r),z(o,$),$&&k(u),$&&k(f),z(y),v=!1,S()}}}function RM(n){let e,t,i,s,l,r,o,a,u,f,c,d,h;function g(b){n[8](b)}let y={id:n[9],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(y.value=n[0].thumbs),o=new vs({props:y}),he.push(()=>Fe(o,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=O(),s=_("i"),r=O(),B(o.$$.fragment),u=O(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[9]),p(f,"class","help-block")},m(b,v){w(b,e,v),m(e,t),m(e,i),m(e,s),w(b,r,v),V(o,b,v),w(b,u,v),w(b,f,v),c=!0,d||(h=Xe(St.call(null,s,{text:"List of thumb sizes for image files. The thumbs will be generated lazily on first access.",position:"top"})),d=!0)},p(b,v){(!c||v&512&&l!==(l=b[9]))&&p(e,"for",l);const S={};v&512&&(S.id=b[9]),!a&&v&1&&(a=!0,S.value=b[0].thumbs,Re(()=>a=!1)),o.$set(S)},i(b){c||(E(o.$$.fragment,b),c=!0)},o(b){F(o.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(r),z(o,b),b&&k(u),b&&k(f),d=!1,h()}}}function jM(n){let e,t,i,s,l,r,o,a,u,f,c,d,h;return i=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[LM,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[FM,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),u=new He({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[NM,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),d=new He({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[RM,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),o=O(),a=_("div"),B(u.$$.fragment),f=O(),c=_("div"),B(d.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(c,"class","col-sm-12"),p(e,"class","grid")},m(g,y){w(g,e,y),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),m(e,o),m(e,a),V(u,a,null),m(e,f),m(e,c),V(d,c,null),h=!0},p(g,[y]){const b={};y&2&&(b.name="schema."+g[1]+".options.maxSize"),y&1537&&(b.$$scope={dirty:y,ctx:g}),i.$set(b);const v={};y&2&&(v.name="schema."+g[1]+".options.maxSelect"),y&1537&&(v.$$scope={dirty:y,ctx:g}),r.$set(v);const S={};y&2&&(S.name="schema."+g[1]+".options.mimeTypes"),y&1537&&(S.$$scope={dirty:y,ctx:g}),u.$set(S);const C={};y&2&&(C.name="schema."+g[1]+".options.thumbs"),y&1537&&(C.$$scope={dirty:y,ctx:g}),d.$set(C)},i(g){h||(E(i.$$.fragment,g),E(r.$$.fragment,g),E(u.$$.fragment,g),E(d.$$.fragment,g),h=!0)},o(g){F(i.$$.fragment,g),F(r.$$.fragment,g),F(u.$$.fragment,g),F(d.$$.fragment,g),h=!1},d(g){g&&k(e),z(i),z(r),z(u),z(d)}}}function HM(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=Tt(this.value),t(0,s)}function r(){s.maxSelect=Tt(this.value),t(0,s)}function o(d){n.$$.not_equal(s.mimeTypes,d)&&(s.mimeTypes=d,t(0,s))}const a=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},u=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},f=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function c(d){n.$$.not_equal(s.thumbs,d)&&(s.thumbs=d,t(0,s))}return n.$$set=d=>{"key"in d&&t(1,i=d.key),"options"in d&&t(0,s=d.options)},n.$$.update=()=>{n.$$.dirty&1&&U.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,r,o,a,u,f,c]}class qM extends Ne{constructor(e){super(),Ie(this,e,HM,jM,Pe,{key:1,options:0})}}function VM(n){let e,t,i,s,l,r,o;function a(f){n[5](f)}let u={searchable:n[3].length>5,selectPlaceholder:n[2]?"Loading...":"Select collection",noOptionsText:"No collections found",selectionKey:"id",items:n[3]};return n[0].collectionId!==void 0&&(u.keyOfSelected=n[0].collectionId),l=new ys({props:u}),he.push(()=>Fe(l,"keyOfSelected",a)),{c(){e=_("label"),t=H("Collection"),s=O(),B(l.$$.fragment),p(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c&512&&i!==(i=f[9]))&&p(e,"for",i);const d={};c&8&&(d.searchable=f[3].length>5),c&4&&(d.selectPlaceholder=f[2]?"Loading...":"Select collection"),c&8&&(d.items=f[3]),!r&&c&1&&(r=!0,d.keyOfSelected=f[0].collectionId,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function zM(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Max select"),s=O(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","number"),p(l,"id",r=n[9]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),o||(a=X(l,"input",n[6]),o=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&r!==(r=u[9])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function BM(n){let e,t,i,s,l,r,o;function a(f){n[7](f)}let u={id:n[9],items:n[4]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new ys({props:u}),he.push(()=>Fe(l,"keyOfSelected",a)),{c(){e=_("label"),t=H("Delete record on relation delete"),s=O(),B(l.$$.fragment),p(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c&512&&i!==(i=f[9]))&&p(e,"for",i);const d={};c&512&&(d.id=f[9]),!r&&c&1&&(r=!0,d.keyOfSelected=f[0].cascadeDelete,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function UM(n){let e,t,i,s,l,r,o,a,u,f;return i=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.collectionId",$$slots:{default:[VM,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[zM,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),u=new He({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[BM,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),o=O(),a=_("div"),B(u.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(a,"class","col-sm-12"),p(e,"class","grid")},m(c,d){w(c,e,d),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),m(e,o),m(e,a),V(u,a,null),f=!0},p(c,[d]){const h={};d&2&&(h.name="schema."+c[1]+".options.collectionId"),d&1549&&(h.$$scope={dirty:d,ctx:c}),i.$set(h);const g={};d&2&&(g.name="schema."+c[1]+".options.maxSelect"),d&1537&&(g.$$scope={dirty:d,ctx:c}),r.$set(g);const y={};d&2&&(y.name="schema."+c[1]+".options.cascadeDelete"),d&1537&&(y.$$scope={dirty:d,ctx:c}),u.$set(y)},i(c){f||(E(i.$$.fragment,c),E(r.$$.fragment,c),E(u.$$.fragment,c),f=!0)},o(c){F(i.$$.fragment,c),F(r.$$.fragment,c),F(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(r),z(u)}}}function WM(n,e,t){let{key:i=""}=e,{options:s={}}=e;const l=[{label:"False",value:!1},{label:"True",value:!0}];let r=!1,o=[];a();function a(){t(2,r=!0),Se.Collections.getFullList(200,{sort:"-created"}).then(d=>{t(3,o=d)}).catch(d=>{Se.errorResponseHandler(d)}).finally(()=>{t(2,r=!1)})}function u(d){n.$$.not_equal(s.collectionId,d)&&(s.collectionId=d,t(0,s))}function f(){s.maxSelect=Tt(this.value),t(0,s)}function c(d){n.$$.not_equal(s.cascadeDelete,d)&&(s.cascadeDelete=d,t(0,s))}return n.$$set=d=>{"key"in d&&t(1,i=d.key),"options"in d&&t(0,s=d.options)},n.$$.update=()=>{n.$$.dirty&1&&U.isEmpty(s)&&t(0,s={maxSelect:1,collectionId:null,cascadeDelete:!1})},[s,i,r,o,l,u,f,c]}class YM extends Ne{constructor(e){super(),Ie(this,e,WM,UM,Pe,{key:1,options:0})}}function KM(n){let e,t,i,s,l,r,o,a;return{c(){e=_("label"),t=H("Max select"),s=O(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",r=n[5]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),o||(a=X(l,"input",n[3]),o=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&r!==(r=u[5])&&p(l,"id",r),f&1&&Tt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),o=!1,a()}}}function JM(n){let e,t,i,s,l,r,o;function a(f){n[4](f)}let u={id:n[5],items:n[2]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new ys({props:u}),he.push(()=>Fe(l,"keyOfSelected",a)),{c(){e=_("label"),t=H("Delete record on user delete"),s=O(),B(l.$$.fragment),p(e,"for",i=n[5])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c&32&&i!==(i=f[5]))&&p(e,"for",i);const d={};c&32&&(d.id=f[5]),!r&&c&1&&(r=!0,d.keyOfSelected=f[0].cascadeDelete,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function xM(n){let e,t,i,s,l,r,o;return i=new He({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[KM,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),r=new He({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[JM,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=O(),l=_("div"),B(r.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(r,l,null),o=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.maxSelect"),u&97&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.cascadeDelete"),u&97&&(c.$$scope={dirty:u,ctx:a}),r.$set(c)},i(a){o||(E(i.$$.fragment,a),E(r.$$.fragment,a),o=!0)},o(a){F(i.$$.fragment,a),F(r.$$.fragment,a),o=!1},d(a){a&&k(e),z(i),z(r)}}}function GM(n,e,t){const i=[{label:"False",value:!1},{label:"True",value:!0}];let{key:s=""}=e,{options:l={}}=e;function r(){l.maxSelect=Tt(this.value),t(0,l)}function o(a){n.$$.not_equal(l.cascadeDelete,a)&&(l.cascadeDelete=a,t(0,l))}return n.$$set=a=>{"key"in a&&t(1,s=a.key),"options"in a&&t(0,l=a.options)},n.$$.update=()=>{n.$$.dirty&1&&U.isEmpty(l)&&t(0,l={maxSelect:1,cascadeDelete:!1})},[l,s,i,r,o]}class ZM extends Ne{constructor(e){super(),Ie(this,e,GM,xM,Pe,{key:1,options:0})}}function XM(n){let e,t,i,s,l,r,o;function a(f){n[15](f)}let u={id:n[37],disabled:n[0].id};return n[0].type!==void 0&&(u.value=n[0].type),l=new z4({props:u}),he.push(()=>Fe(l,"value",a)),{c(){e=_("label"),t=H("Type"),s=O(),B(l.$$.fragment),p(e,"for",i=n[37])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),o=!0},p(f,c){(!o||c[1]&64&&i!==(i=f[37]))&&p(e,"for",i);const d={};c[1]&64&&(d.id=f[37]),c[0]&1&&(d.disabled=f[0].id),!r&&c[0]&1&&(r=!0,d.value=f[0].type,Re(()=>r=!1)),l.$set(d)},i(f){o||(E(l.$$.fragment,f),o=!0)},o(f){F(l.$$.fragment,f),o=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function QM(n){let e,t,i,s,l,r,o,a,u,f,c;return{c(){e=_("label"),t=H("Name"),s=O(),l=_("input"),p(e,"for",i=n[37]),p(l,"type","text"),p(l,"id",r=n[37]),l.required=!0,l.disabled=o=n[0].id&&n[0].system,p(l,"spellcheck","false"),l.autofocus=a=!n[0].id,l.value=u=n[0].name},m(d,h){w(d,e,h),m(e,t),w(d,s,h),w(d,l,h),n[0].id||l.focus(),f||(c=X(l,"input",n[16]),f=!0)},p(d,h){h[1]&64&&i!==(i=d[37])&&p(e,"for",i),h[1]&64&&r!==(r=d[37])&&p(l,"id",r),h[0]&1&&o!==(o=d[0].id&&d[0].system)&&(l.disabled=o),h[0]&1&&a!==(a=!d[0].id)&&(l.autofocus=a),h[0]&1&&u!==(u=d[0].name)&&l.value!==u&&(l.value=u)},d(d){d&&k(e),d&&k(s),d&&k(l),f=!1,c()}}}function e$(n){let e,t,i;function s(r){n[27](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new ZM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function t$(n){let e,t,i;function s(r){n[26](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new YM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function n$(n){let e,t,i;function s(r){n[25](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new qM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function i$(n){let e,t,i;function s(r){n[24](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new PM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function s$(n){let e,t,i;function s(r){n[23](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new AM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function l$(n){let e,t,i;function s(r){n[22](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new MM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function r$(n){let e,t,i;function s(r){n[21](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new fM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function o$(n){let e,t,i;function s(r){n[20](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new Ab({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function a$(n){let e,t,i;function s(r){n[19](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new tM({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function u$(n){let e,t,i;function s(r){n[18](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new Q4({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function f$(n){let e,t,i;function s(r){n[17](r)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new J4({props:l}),he.push(()=>Fe(e,"options",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){const a={};o[0]&2&&(a.key=r[1]),!t&&o[0]&1&&(t=!0,a.options=r[0].options,Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function c$(n){let e,t,i,s,l,r,o,a;return{c(){e=_("input"),i=O(),s=_("label"),l=H("Required"),p(e,"type","checkbox"),p(e,"id",t=n[37]),p(s,"for",r=n[37])},m(u,f){w(u,e,f),e.checked=n[0].required,w(u,i,f),w(u,s,f),m(s,l),o||(a=X(e,"change",n[28]),o=!0)},p(u,f){f[1]&64&&t!==(t=u[37])&&p(e,"id",t),f[0]&1&&(e.checked=u[0].required),f[1]&64&&r!==(r=u[37])&&p(s,"for",r)},d(u){u&&k(e),u&&k(i),u&&k(s),o=!1,a()}}}function Ep(n){let e,t;return e=new He({props:{class:"form-field form-field-toggle m-0",name:"unique",$$slots:{default:[d$,({uniqueId:i})=>({37:i}),({uniqueId:i})=>[0,i?64:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&1|s[1]&192&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function d$(n){let e,t,i,s,l,r,o,a;return{c(){e=_("input"),i=O(),s=_("label"),l=H("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[37]),p(s,"for",r=n[37])},m(u,f){w(u,e,f),e.checked=n[0].unique,w(u,i,f),w(u,s,f),m(s,l),o||(a=X(e,"change",n[29]),o=!0)},p(u,f){f[1]&64&&t!==(t=u[37])&&p(e,"id",t),f[0]&1&&(e.checked=u[0].unique),f[1]&64&&r!==(r=u[37])&&p(s,"for",r)},d(u){u&&k(e),u&&k(i),u&&k(s),o=!1,a()}}}function p$(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C,M,$;s=new He({props:{class:"form-field required "+(n[0].id?"disabled":""),name:"schema."+n[1]+".type",$$slots:{default:[XM,({uniqueId:L})=>({37:L}),({uniqueId:L})=>[0,L?64:0]]},$$scope:{ctx:n}}}),o=new He({props:{class:"form-field required "+(n[0].id&&n[0].system?"disabled":""),name:"schema."+n[1]+".name",$$slots:{default:[QM,({uniqueId:L})=>({37:L}),({uniqueId:L})=>[0,L?64:0]]},$$scope:{ctx:n}}});const T=[f$,u$,a$,o$,r$,l$,s$,i$,n$,t$,e$],A=[];function D(L,N){return L[0].type==="text"?0:L[0].type==="number"?1:L[0].type==="bool"?2:L[0].type==="email"?3:L[0].type==="url"?4:L[0].type==="date"?5:L[0].type==="select"?6:L[0].type==="json"?7:L[0].type==="file"?8:L[0].type==="relation"?9:L[0].type==="user"?10:-1}~(f=D(n))&&(c=A[f]=T[f](n)),g=new He({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[c$,({uniqueId:L})=>({37:L}),({uniqueId:L})=>[0,L?64:0]]},$$scope:{ctx:n}}});let P=n[0].type!=="file"&&Ep(n);return{c(){e=_("form"),t=_("div"),i=_("div"),B(s.$$.fragment),l=O(),r=_("div"),B(o.$$.fragment),a=O(),u=_("div"),c&&c.c(),d=O(),h=_("div"),B(g.$$.fragment),y=O(),b=_("div"),P&&P.c(),v=O(),S=_("input"),p(i,"class","col-sm-6"),p(r,"class","col-sm-6"),p(u,"class","col-sm-12 hidden-empty"),p(h,"class","col-4"),p(b,"class","col-4"),p(t,"class","grid"),p(S,"type","submit"),p(S,"class","hidden"),p(S,"tabindex","-1"),p(e,"class","field-form")},m(L,N){w(L,e,N),m(e,t),m(t,i),V(s,i,null),m(t,l),m(t,r),V(o,r,null),m(t,a),m(t,u),~f&&A[f].m(u,null),m(t,d),m(t,h),V(g,h,null),m(t,y),m(t,b),P&&P.m(b,null),m(e,v),m(e,S),C=!0,M||($=X(e,"submit",Jt(n[30])),M=!0)},p(L,N){const R={};N[0]&1&&(R.class="form-field required "+(L[0].id?"disabled":"")),N[0]&2&&(R.name="schema."+L[1]+".type"),N[0]&1|N[1]&192&&(R.$$scope={dirty:N,ctx:L}),s.$set(R);const J={};N[0]&1&&(J.class="form-field required "+(L[0].id&&L[0].system?"disabled":"")),N[0]&2&&(J.name="schema."+L[1]+".name"),N[0]&1|N[1]&192&&(J.$$scope={dirty:N,ctx:L}),o.$set(J);let W=f;f=D(L),f===W?~f&&A[f].p(L,N):(c&&(Te(),F(A[W],1,1,()=>{A[W]=null}),De()),~f?(c=A[f],c?c.p(L,N):(c=A[f]=T[f](L),c.c()),E(c,1),c.m(u,null)):c=null);const q={};N[0]&1|N[1]&192&&(q.$$scope={dirty:N,ctx:L}),g.$set(q),L[0].type!=="file"?P?(P.p(L,N),N[0]&1&&E(P,1)):(P=Ep(L),P.c(),E(P,1),P.m(b,null)):P&&(Te(),F(P,1,1,()=>{P=null}),De())},i(L){C||(E(s.$$.fragment,L),E(o.$$.fragment,L),E(c),E(g.$$.fragment,L),E(P),C=!0)},o(L){F(s.$$.fragment,L),F(o.$$.fragment,L),F(c),F(g.$$.fragment,L),F(P),C=!1},d(L){L&&k(e),z(s),z(o),~f&&A[f].d(),z(g),P&&P.d(),M=!1,$()}}}function Pp(n){let e,t,i,s,l=n[0].system&&Lp(),r=!n[0].id&&Fp(n),o=n[0].required&&Ip(),a=n[0].unique&&Np();return{c(){e=_("div"),l&&l.c(),t=O(),r&&r.c(),i=O(),o&&o.c(),s=O(),a&&a.c(),p(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),m(e,t),r&&r.m(e,null),m(e,i),o&&o.m(e,null),m(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=Lp(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?r&&(r.d(1),r=null):r?r.p(u,f):(r=Fp(u),r.c(),r.m(e,i)),u[0].required?o||(o=Ip(),o.c(),o.m(e,s)):o&&(o.d(1),o=null),u[0].unique?a||(a=Np(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),r&&r.d(),o&&o.d(),a&&a.d()}}}function Lp(n){let e;return{c(){e=_("span"),e.textContent="System",p(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Fp(n){let e;return{c(){e=_("span"),e.textContent="New",p(e,"class","label"),ne(e,"label-warning",n[7]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&129&&ne(e,"label-warning",t[7]&&!t[0].toDelete)},d(t){t&&k(e)}}}function Ip(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Np(n){let e;return{c(){e=_("span"),e.textContent="Unique",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Rp(n){let e,t,i,s,l,r;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,a){w(o,e,a),s=!0,l||(r=Xe(t=St.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){s||(Dt(()=>{i||(i=ft(e,Un,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(o){i||(i=ft(e,Un,{duration:150,start:.7},!1)),i.run(0),s=!1},d(o){o&&k(e),o&&i&&i.end(),l=!1,r()}}}function jp(n){let e,t,i,s,l,r,o=n[7]&&Hp(n);return{c(){e=_("div"),t=_("button"),t.innerHTML='Remove',i=O(),o&&o.c(),p(t,"type","button"),p(t,"class","btn btn-sm fade p-l-0 p-r-0"),p(e,"class","inline-flex flex-gap-sm flex-nowrap")},m(a,u){w(a,e,u),m(e,t),m(e,i),o&&o.m(e,null),l||(r=X(t,"click",Bn(n[8])),l=!0)},p(a,u){a[7]?o?o.p(a,u):(o=Hp(a),o.c(),o.m(e,null)):o&&(o.d(1),o=null)},i(a){s||Dt(()=>{s=yu(e,ti,{duration:200,x:20,opacity:0}),s.start()})},o:re,d(a){a&&k(e),o&&o.d(),l=!1,r()}}}function Hp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Done',p(e,"type","button"),p(e,"class","btn btn-sm btn-outline btn-expanded-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",Bn(n[3])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function qp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",Bn(n[14])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function h$(n){let e,t,i,s,l,r,o=(n[0].name||"-")+"",a,u,f,c,d,h,g,y,b,v,S=!n[0].toDelete&&Pp(n),C=n[6]&&Rp(),M=n[36]&&!n[0].toDelete&&jp(n),$=n[0].toDelete&&qp(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=O(),r=_("strong"),a=H(o),f=O(),S&&S.c(),c=O(),d=_("div"),h=O(),C&&C.c(),g=O(),M&&M.c(),y=O(),$&&$.c(),b=rt(),p(i,"class",s=_f(U.getFieldTypeIcon(n[0].type))+" svelte-162uq6"),p(t,"class","icon field-type"),p(r,"class","title field-name svelte-162uq6"),p(r,"title",u=n[0].name),ne(r,"txt-strikethrough",n[0].toDelete),p(e,"class","inline-flex"),p(d,"class","flex-fill")},m(T,A){w(T,e,A),m(e,t),m(t,i),m(e,l),m(e,r),m(r,a),w(T,f,A),S&&S.m(T,A),w(T,c,A),w(T,d,A),w(T,h,A),C&&C.m(T,A),w(T,g,A),M&&M.m(T,A),w(T,y,A),$&&$.m(T,A),w(T,b,A),v=!0},p(T,A){(!v||A[0]&1&&s!==(s=_f(U.getFieldTypeIcon(T[0].type))+" svelte-162uq6"))&&p(i,"class",s),(!v||A[0]&1)&&o!==(o=(T[0].name||"-")+"")&&_e(a,o),(!v||A[0]&1&&u!==(u=T[0].name))&&p(r,"title",u),A[0]&1&&ne(r,"txt-strikethrough",T[0].toDelete),T[0].toDelete?S&&(S.d(1),S=null):S?S.p(T,A):(S=Pp(T),S.c(),S.m(c.parentNode,c)),T[6]?C?A[0]&64&&E(C,1):(C=Rp(),C.c(),E(C,1),C.m(g.parentNode,g)):C&&(Te(),F(C,1,1,()=>{C=null}),De()),T[36]&&!T[0].toDelete?M?(M.p(T,A),A[0]&1|A[1]&32&&E(M,1)):(M=jp(T),M.c(),E(M,1),M.m(y.parentNode,y)):M&&(M.d(1),M=null),T[0].toDelete?$?$.p(T,A):($=qp(T),$.c(),$.m(b.parentNode,b)):$&&($.d(1),$=null)},i(T){v||(E(C),E(M),v=!0)},o(T){F(C),v=!1},d(T){T&&k(e),T&&k(f),S&&S.d(T),T&&k(c),T&&k(d),T&&k(h),C&&C.d(T),T&&k(g),M&&M.d(T),T&&k(y),$&&$.d(T),T&&k(b)}}}function m$(n){let e,t,i={single:!0,interactive:n[7],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[h$,({active:s})=>({36:s}),({active:s})=>[0,s?32:0]],default:[p$]},$$scope:{ctx:n}};return e=new df({props:i}),n[31](e),e.$on("expand",n[32]),e.$on("collapse",n[33]),e.$on("toggle",n[34]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const r={};l[0]&128&&(r.interactive=s[7]),l[0]&5&&(r.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&227|l[1]&160&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[31](null),z(e,s)}}}function g$(n,e,t){let i,s,l,r;pn(n,gs,G=>t(13,r=G));const o=vn();let{key:a="0"}=e,{field:u=new kn}=e,{disabled:f=!1}=e,{excludeNames:c=[]}=e,d,h=u.type;function g(){d==null||d.expand()}function y(){d==null||d.collapse()}function b(){u.id?t(0,u.toDelete=!0,u):(y(),o("remove"))}function v(G){G=U.slugify(G);let Oe="";for(;c.includes(G+Oe);)++Oe;return G+Oe}di(()=>{u.id||g()});const S=()=>{t(0,u.toDelete=!1,u)};function C(G){n.$$.not_equal(u.type,G)&&(u.type=G,t(0,u),t(12,h),t(10,c),t(4,d))}const M=G=>{t(0,u.name=v(G.target.value),u),G.target.value=u.name};function $(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function T(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function A(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function D(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function P(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function L(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function N(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function R(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function J(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function W(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function q(G){n.$$.not_equal(u.options,G)&&(u.options=G,t(0,u),t(12,h),t(10,c),t(4,d))}function x(){u.required=this.checked,t(0,u),t(12,h),t(10,c),t(4,d)}function K(){u.unique=this.checked,t(0,u),t(12,h),t(10,c),t(4,d)}const Y=()=>{i&&y()};function te(G){he[G?"unshift":"push"](()=>{d=G,t(4,d)})}function fe(G){ut.call(this,n,G)}function ye(G){ut.call(this,n,G)}function se(G){ut.call(this,n,G)}return n.$$set=G=>{"key"in G&&t(1,a=G.key),"field"in G&&t(0,u=G.field),"disabled"in G&&t(2,f=G.disabled),"excludeNames"in G&&t(10,c=G.excludeNames)},n.$$.update=()=>{if(n.$$.dirty[0]&4097&&h!=u.type&&(t(12,h=u.type),t(0,u.options={},u),t(0,u.unique=!1,u)),n.$$.dirty[0]&1025&&c.length){const G=v(u.name);u.name!==G&&t(0,u.name=G,u)}n.$$.dirty[0]&17&&u.toDelete&&(d&&y(),!u.name&&u.originalName&&t(0,u.name=u.originalName,u)),n.$$.dirty[0]&1&&!u.originalName&&u.name&&t(0,u.originalName=u.name,u),n.$$.dirty[0]&1&&typeof u.toDelete=="undefined"&&t(0,u.toDelete=!1,u),n.$$.dirty[0]&1&&t(5,i=!U.isEmpty(u.name)&&u.type),n.$$.dirty[0]&48&&(i||d&&g()),n.$$.dirty[0]&37&&t(7,s=!f&&!u.system&&!u.toDelete&&i),n.$$.dirty[0]&8194&&t(6,l=!U.isEmpty(U.getNestedVal(r,`schema.${a}`)))},[u,a,f,y,d,i,l,s,b,v,c,g,h,r,S,C,M,$,T,A,D,P,L,N,R,J,W,q,x,K,Y,te,fe,ye,se]}class _$ extends Ne{constructor(e){super(),Ie(this,e,g$,m$,Pe,{key:1,field:0,disabled:2,excludeNames:10,expand:11,collapse:3},null,[-1,-1])}get expand(){return this.$$.ctx[11]}get collapse(){return this.$$.ctx[3]}}function Vp(n,e,t){const i=n.slice();return i[9]=e[t],i[10]=e,i[11]=t,i}function zp(n,e){let t,i,s,l;function r(u){e[5](u,e[9],e[10],e[11])}function o(){return e[6](e[11])}let a={key:e[11],excludeNames:e[1].concat(e[4](e[9]))};return e[9]!==void 0&&(a.field=e[9]),i=new _$({props:a}),he.push(()=>Fe(i,"field",r)),i.$on("remove",o),{key:n,first:null,c(){t=rt(),B(i.$$.fragment),this.first=t},m(u,f){w(u,t,f),V(i,u,f),l=!0},p(u,f){e=u;const c={};f&1&&(c.key=e[11]),f&1&&(c.excludeNames=e[1].concat(e[4](e[9]))),!s&&f&1&&(s=!0,c.field=e[9],Re(()=>s=!1)),i.$set(c)},i(u){l||(E(i.$$.fragment,u),l=!0)},o(u){F(i.$$.fragment,u),l=!1},d(u){u&&k(t),z(i,u)}}}function b$(n){let e,t=[],i=new Map,s,l,r,o,a,u,f,c,d,h,g,y=n[0].schema;const b=v=>v[11];for(let v=0;vh.name===d)}function u(d){let h=[];for(let g of s.schema)g!==d&&(h.push(g.name),g.id&&g.originalName!==""&&g.originalName!==g.name&&h.push(g.originalName));return h}function f(d,h,g,y){g[y]=d,t(0,s)}const c=d=>l(d);return n.$$set=d=>{"collection"in d&&t(0,s=d.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof(s==null?void 0:s.schema)=="undefined"&&(t(0,s=s||{}),t(0,s.schema=[],s))},[s,i,l,r,u,f,c]}class v$ extends Ne{constructor(e){super(),Ie(this,e,y$,b$,Pe,{collection:0})}}function Bp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i[16]=e,i[17]=t,i}function Up(n,e,t){const i=n.slice();return i[19]=e[t],i}function Wp(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C,M,$,T,A,D,P,L,N,R,J,W,q=n[0].schema,x=[];for(let K=0;K@request filter:",v=O(),S=_("div"),S.innerHTML=`@request.method + @request.query.* + @request.data.* + @request.user.*`,C=O(),M=_("hr"),$=O(),T=_("p"),T.innerHTML="You could also add constraints and query other collections using the @collection filter:",A=O(),D=_("div"),D.innerHTML="@collection.ANY_COLLECTION_NAME.*",P=O(),L=_("hr"),N=O(),R=_("p"),R.innerHTML=`Example rule: +
+ @request.user.id!=null && created>"2022-01-01 00:00:00"`,p(s,"class","m-b-0"),p(r,"class","inline-flex flex-gap-5"),p(g,"class","m-t-10 m-b-5"),p(b,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p(M,"class","m-t-10 m-b-5"),p(T,"class","m-b-0"),p(D,"class","inline-flex flex-gap-5"),p(L,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(K,Y){w(K,e,Y),m(e,t),m(t,i),m(i,s),m(i,l),m(i,r),m(r,o),m(r,a),m(r,u),m(r,f),m(r,c),m(r,d);for(let te=0;te{J||(J=ft(e,un,{duration:150},!0)),J.run(1)}),W=!0)},o(K){K&&(J||(J=ft(e,un,{duration:150},!1)),J.run(0)),W=!1},d(K){K&&k(e),zn(x,K),K&&J&&J.end()}}}function k$(n){let e,t=n[19].name+"",i;return{c(){e=_("code"),i=H(t)},m(s,l){w(s,e,l),m(e,i)},p(s,l){l&1&&t!==(t=s[19].name+"")&&_e(i,t)},d(s){s&&k(e)}}}function w$(n){let e,t=n[19].name+"",i,s;return{c(){e=_("code"),i=H(t),s=H(".*")},m(l,r){w(l,e,r),m(e,i),m(e,s)},p(l,r){r&1&&t!==(t=l[19].name+"")&&_e(i,t)},d(l){l&&k(e)}}}function Yp(n){let e;function t(l,r){return l[19].type==="relation"||l[19].type==="user"?w$:k$}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,r){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function S$(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const r=o=>o[14];for(let o=0;o',p(e,"class","txt-center")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function M$(n){let e,t,i;function s(){return n[9](n[14])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,r){w(l,e,r),t||(i=[Xe(St.call(null,e,"Lock and set to Admins only")),X(e,"click",s)],t=!0)},p(l,r){n=l},d(l){l&&k(e),t=!1,lt(i)}}}function $$(n){let e,t,i;function s(){return n[8](n[14])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,r){w(l,e,r),t||(i=[Xe(St.call(null,e,"Unlock and set custom rule")),X(e,"click",s)],t=!0)},p(l,r){n=l},d(l){l&&k(e),t=!1,lt(i)}}}function O$(n){let e;return{c(){e=H("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function T$(n){let e;return{c(){e=H("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function D$(n){let e,t=n[15]+"",i,s,l=Ni(n[0][n[14]])?"Admins only":"Custom rule",r,o,a,u,f=n[14],c,d,h,g,y,b,v;function S(){return n[10](n[14])}const C=()=>n[11](u,f),M=()=>n[11](null,f);function $(N){n[12](N,n[14])}var T=n[4];function A(N){let R={baseCollection:N[0],disabled:Ni(N[0][N[14]])};return N[0][N[14]]!==void 0&&(R.value=N[0][N[14]]),{props:R}}T&&(u=new T(A(n)),C(),he.push(()=>Fe(u,"value",$)));function D(N,R){return R&1&&(g=null),g==null&&(g=!!Ni(N[0][N[14]])),g?T$:O$}let P=D(n,-1),L=P(n);return{c(){e=_("label"),i=H(t),s=H(" - "),r=H(l),a=O(),u&&B(u.$$.fragment),d=O(),h=_("div"),L.c(),p(e,"for",o=n[18]),p(h,"class","help-block")},m(N,R){w(N,e,R),m(e,i),m(e,s),m(e,r),w(N,a,R),u&&V(u,N,R),w(N,d,R),w(N,h,R),L.m(h,null),y=!0,b||(v=X(e,"click",S),b=!0)},p(N,R){n=N,(!y||R&1)&&l!==(l=Ni(n[0][n[14]])?"Admins only":"Custom rule")&&_e(r,l),(!y||R&262144&&o!==(o=n[18]))&&p(e,"for",o),f!==n[14]&&(M(),f=n[14],C());const J={};if(R&1&&(J.baseCollection=n[0]),R&1&&(J.disabled=Ni(n[0][n[14]])),!c&&R&65&&(c=!0,J.value=n[0][n[14]],Re(()=>c=!1)),T!==(T=n[4])){if(u){Te();const W=u;F(W.$$.fragment,1,0,()=>{z(W,1)}),De()}T?(u=new T(A(n)),C(),he.push(()=>Fe(u,"value",$)),B(u.$$.fragment),E(u.$$.fragment,1),V(u,d.parentNode,d)):u=null}else T&&u.$set(J);P!==(P=D(n,R))&&(L.d(1),L=P(n),L&&(L.c(),L.m(h,null)))},i(N){y||(u&&E(u.$$.fragment,N),y=!0)},o(N){u&&F(u.$$.fragment,N),y=!1},d(N){N&&k(e),N&&k(a),M(),u&&z(u,N),N&&k(d),N&&k(h),L.d(),b=!1,v()}}}function Kp(n,e){let t,i,s,l,r,o,a,u;function f(h,g){return g&1&&(l=null),l==null&&(l=!!Ni(h[0][h[14]])),l?$$:M$}let c=f(e,-1),d=c(e);return o=new He({props:{class:"form-field rule-field m-0 "+(Ni(e[0][e[14]])?"disabled":""),name:e[14],$$slots:{default:[D$,({uniqueId:h})=>({18:h}),({uniqueId:h})=>h?262144:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=_("hr"),i=O(),s=_("div"),d.c(),r=O(),B(o.$$.fragment),a=O(),p(t,"class","m-t-sm m-b-sm"),p(s,"class","rule-block svelte-fjxz7k"),this.first=t},m(h,g){w(h,t,g),w(h,i,g),w(h,s,g),d.m(s,null),m(s,r),V(o,s,null),m(s,a),u=!0},p(h,g){e=h,c===(c=f(e,g))&&d?d.p(e,g):(d.d(1),d=c(e),d&&(d.c(),d.m(s,r)));const y={};g&1&&(y.class="form-field rule-field m-0 "+(Ni(e[0][e[14]])?"disabled":"")),g&4456473&&(y.$$scope={dirty:g,ctx:e}),o.$set(y)},i(h){u||(E(o.$$.fragment,h),u=!0)},o(h){F(o.$$.fragment,h),u=!1},d(h){h&&k(t),h&&k(i),h&&k(s),d.d(),z(o)}}}function A$(n){let e,t,i,s,l,r=n[2]?"Hide available fields":"Show available fields",o,a,u,f,c,d,h,g,y,b=n[2]&&Wp(n);const v=[C$,S$],S=[];function C(M,$){return M[5]?0:1}return f=C(n),c=S[f]=v[f](n),{c(){e=_("div"),t=_("div"),i=_("p"),i.innerHTML=`All rules follow the +
PocketBase filter syntax and operators + .`,s=O(),l=_("span"),o=H(r),a=O(),b&&b.c(),u=O(),c.c(),d=rt(),p(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex"),p(e,"class","block m-b-base")},m(M,$){w(M,e,$),m(e,t),m(t,i),m(t,s),m(t,l),m(l,o),m(e,a),b&&b.m(e,null),w(M,u,$),S[f].m(M,$),w(M,d,$),h=!0,g||(y=X(l,"click",n[7]),g=!0)},p(M,[$]){(!h||$&4)&&r!==(r=M[2]?"Hide available fields":"Show available fields")&&_e(o,r),M[2]?b?(b.p(M,$),$&4&&E(b,1)):(b=Wp(M),b.c(),E(b,1),b.m(e,null)):b&&(Te(),F(b,1,1,()=>{b=null}),De());let T=f;f=C(M),f===T?S[f].p(M,$):(Te(),F(S[T],1,1,()=>{S[T]=null}),De(),c=S[f],c?c.p(M,$):(c=S[f]=v[f](M),c.c()),E(c,1),c.m(d.parentNode,d))},i(M){h||(E(b),E(c),h=!0)},o(M){F(b),F(c),h=!1},d(M){M&&k(e),b&&b.d(),M&&k(u),S[f].d(M),M&&k(d),g=!1,y()}}}function Ni(n){return n===null}function E$(n,e,t){let{collection:i=new Pn}=e,s={},l=!1,r={},o,a=!1;const u={listRule:"List Action",viewRule:"View Action",createRule:"Create Action",updateRule:"Update Action",deleteRule:"Delete Action"};async function f(){t(5,a=!0);try{t(4,o=(await bi(()=>import("./FilterAutocompleteInput.5c71eaaa.js"),[])).default)}catch(v){console.warn(v),t(4,o=null)}t(5,a=!1)}di(()=>{f()});const c=()=>t(2,l=!l),d=async v=>{var S;t(0,i[v]=s[v]||"",i),await Ui(),(S=r[v])==null||S.focus()},h=v=>{t(1,s[v]=i[v],s),t(0,i[v]=null,i)},g=v=>{var S;return(S=r[v])==null?void 0:S.focus()};function y(v,S){he[v?"unshift":"push"](()=>{r[S]=v,t(3,r)})}function b(v,S){n.$$.not_equal(i[S],v)&&(i[S]=v,t(0,i))}return n.$$set=v=>{"collection"in v&&t(0,i=v.collection)},[i,s,l,r,o,a,u,c,d,h,g,y,b]}class P$ extends Ne{constructor(e){super(),Ie(this,e,E$,A$,Pe,{collection:0})}}function Jp(n,e,t){const i=n.slice();return i[14]=e[t],i}function xp(n,e,t){const i=n.slice();return i[14]=e[t],i}function Gp(n){let e;return{c(){e=_("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Zp(n){let e,t,i,s,l=n[1].originalName+"",r,o,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=H(`Renamed collection + `),s=_("strong"),r=H(l),o=O(),a=_("i"),u=O(),f=_("strong"),d=H(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,g){w(h,e,g),m(e,t),m(t,i),m(t,s),m(s,r),m(t,o),m(t,a),m(t,u),m(t,f),m(f,d)},p(h,g){g&2&&l!==(l=h[1].originalName+"")&&_e(r,l),g&2&&c!==(c=h[1].name+"")&&_e(d,c)},d(h){h&&k(e)}}}function Xp(n){let e,t,i,s,l=n[14].originalName+"",r,o,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=H(`Renamed field + `),s=_("strong"),r=H(l),o=O(),a=_("i"),u=O(),f=_("strong"),d=H(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,g){w(h,e,g),m(e,t),m(t,i),m(t,s),m(s,r),m(t,o),m(t,a),m(t,u),m(t,f),m(f,d)},p(h,g){g&16&&l!==(l=h[14].originalName+"")&&_e(r,l),g&16&&c!==(c=h[14].name+"")&&_e(d,c)},d(h){h&&k(e)}}}function Qp(n){let e,t,i,s=n[14].name+"",l,r;return{c(){e=_("li"),t=H("Removed field "),i=_("span"),l=H(s),r=O(),p(i,"class","txt-bold"),p(e,"class","txt-danger")},m(o,a){w(o,e,a),m(e,t),m(e,i),m(i,l),m(e,r)},p(o,a){a&8&&s!==(s=o[14].name+"")&&_e(l,s)},d(o){o&&k(e)}}}function L$(n){let e,t,i,s,l,r,o,a,u,f,c,d,h=n[3].length&&Gp(),g=n[5]&&Zp(n),y=n[4],b=[];for(let C=0;C',i=O(),s=_("div"),l=_("p"),l.textContent=`If any of the following changes is part of another collection rule or filter, you'll have to + update it manually!`,r=O(),h&&h.c(),o=O(),a=_("h6"),a.textContent="Changes:",u=O(),f=_("ul"),g&&g.c(),c=O();for(let C=0;CCancel',t=O(),i=_("button"),i.innerHTML='Confirm',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-secondary"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(r,o){w(r,e,o),w(r,t,o),w(r,i,o),e.focus(),s||(l=[X(e,"click",n[8]),X(i,"click",n[9])],s=!0)},p:re,d(r){r&&k(e),r&&k(t),r&&k(i),s=!1,lt(l)}}}function N$(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[I$],header:[F$],default:[L$]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const r={};l&524346&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[10](null),z(e,s)}}}function R$(n,e,t){let i,s,l;const r=vn();let o,a;async function u(v){t(1,a=v),await Ui(),!i&&!s.length&&!l.length?c():o==null||o.show()}function f(){o==null||o.hide()}function c(){f(),r("confirm")}const d=()=>f(),h=()=>c();function g(v){he[v?"unshift":"push"](()=>{o=v,t(2,o)})}function y(v){ut.call(this,n,v)}function b(v){ut.call(this,n,v)}return n.$$.update=()=>{n.$$.dirty&2&&t(5,i=(a==null?void 0:a.originalName)!=(a==null?void 0:a.name)),n.$$.dirty&2&&t(4,s=(a==null?void 0:a.schema.filter(v=>v.id&&!v.toDelete&&v.originalName!=v.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(v=>v.id&&v.toDelete))||[])},[f,a,o,l,s,i,c,u,d,h,g,y,b]}class j$ extends Ne{constructor(e){super(),Ie(this,e,R$,N$,Pe,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function eh(n){let e,t,i,s;function l(o){n[26](o)}let r={};return n[2]!==void 0&&(r.collection=n[2]),t=new P$({props:r}),he.push(()=>Fe(t,"collection",l)),{c(){e=_("div"),B(t.$$.fragment),p(e,"class","tab-item active")},m(o,a){w(o,e,a),V(t,e,null),s=!0},p(o,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=o[2],Re(()=>i=!1)),t.$set(u)},i(o){s||(E(t.$$.fragment,o),s=!0)},o(o){F(t.$$.fragment,o),s=!1},d(o){o&&k(e),z(t)}}}function H$(n){let e,t,i,s,l,r;function o(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new v$({props:a}),he.push(()=>Fe(i,"collection",o));let u=n[9]===Vl&&eh(n);return{c(){e=_("div"),t=_("div"),B(i.$$.fragment),l=O(),u&&u.c(),p(t,"class","tab-item"),ne(t,"active",n[9]===ps),p(e,"class","tabs-content svelte-b10vi")},m(f,c){w(f,e,c),m(e,t),V(i,t,null),m(e,l),u&&u.m(e,null),r=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],Re(()=>s=!1)),i.$set(d),c[0]&512&&ne(t,"active",f[9]===ps),f[9]===Vl?u?(u.p(f,c),c[0]&512&&E(u,1)):(u=eh(f),u.c(),E(u,1),u.m(e,null)):u&&(Te(),F(u,1,1,()=>{u=null}),De())},i(f){r||(E(i.$$.fragment,f),E(u),r=!0)},o(f){F(i.$$.fragment,f),F(u),r=!1},d(f){f&&k(e),z(i),u&&u.d()}}}function th(n){let e,t,i,s,l,r,o;return r=new bs({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[q$]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=O(),i=_("button"),s=_("i"),l=O(),B(r.$$.fragment),p(e,"class","flex-fill"),p(s,"class","ri-more-line"),p(i,"type","button"),p(i,"class","btn btn-sm btn-circle btn-secondary flex-gap-0")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),m(i,s),m(i,l),V(r,i,null),o=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),r.$set(f)},i(a){o||(E(r.$$.fragment,a),o=!0)},o(a){F(r.$$.fragment,a),o=!1},d(a){a&&k(e),a&&k(t),a&&k(i),z(r)}}}function q$(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` + Delete`,p(e,"type","button"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[20]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function nh(n){let e;return{c(){e=_("div"),e.textContent="System collection",p(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function V$(n){let e,t,i,s,l,r,o,a,u,f,c,d,h=n[2].system&&nh();return{c(){e=_("label"),t=H("Name"),s=O(),l=_("input"),u=O(),h&&h.c(),f=rt(),p(e,"for",i=n[38]),p(l,"type","text"),p(l,"id",r=n[38]),l.required=!0,l.disabled=n[11],p(l,"spellcheck","false"),l.autofocus=o=n[2].isNew,p(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(g,y){w(g,e,y),m(e,t),w(g,s,y),w(g,l,y),w(g,u,y),h&&h.m(g,y),w(g,f,y),n[2].isNew&&l.focus(),c||(d=X(l,"input",n[21]),c=!0)},p(g,y){y[1]&128&&i!==(i=g[38])&&p(e,"for",i),y[1]&128&&r!==(r=g[38])&&p(l,"id",r),y[0]&2048&&(l.disabled=g[11]),y[0]&4&&o!==(o=g[2].isNew)&&(l.autofocus=o),y[0]&4&&a!==(a=g[2].name)&&l.value!==a&&(l.value=a),g[2].system?h||(h=nh(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},d(g){g&&k(e),g&&k(s),g&&k(l),g&&k(u),h&&h.d(g),g&&k(f),c=!1,d()}}}function ih(n){let e,t,i,s,l,r;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,a){w(o,e,a),s=!0,l||(r=Xe(t=St.call(null,e,n[12])),l=!0)},p(o,a){t&&Kn(t.update)&&a[0]&4096&&t.update.call(null,o[12])},i(o){s||(o&&Dt(()=>{i||(i=ft(e,Un,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(o){o&&(i||(i=ft(e,Un,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(o){o&&k(e),o&&i&&i.end(),l=!1,r()}}}function sh(n){let e,t,i,s,l;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,o){w(r,e,o),i=!0,s||(l=Xe(St.call(null,e,"Has errors")),s=!0)},i(r){i||(r&&Dt(()=>{t||(t=ft(e,Un,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(r){r&&(t||(t=ft(e,Un,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(r){r&&k(e),r&&t&&t.end(),s=!1,l()}}}function z$(n){var N,R,J,W,q,x;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,r,o,a,u,f,c,d,h,g,y=!U.isEmpty((N=n[4])==null?void 0:N.schema),b,v,S,C,M=!U.isEmpty((R=n[4])==null?void 0:R.listRule)||!U.isEmpty((J=n[4])==null?void 0:J.viewRule)||!U.isEmpty((W=n[4])==null?void 0:W.createRule)||!U.isEmpty((q=n[4])==null?void 0:q.updateRule)||!U.isEmpty((x=n[4])==null?void 0:x.deleteRule),$,T,A,D=!n[2].isNew&&!n[2].system&&th(n);o=new He({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[V$,({uniqueId:K})=>({38:K}),({uniqueId:K})=>[0,K?128:0]]},$$scope:{ctx:n}}});let P=y&&ih(n),L=M&&sh();return{c(){e=_("h4"),i=H(t),s=O(),D&&D.c(),l=O(),r=_("form"),B(o.$$.fragment),a=O(),u=_("input"),f=O(),c=_("div"),d=_("button"),h=_("span"),h.textContent="Fields",g=O(),P&&P.c(),b=O(),v=_("button"),S=_("span"),S.textContent="API Rules",C=O(),L&&L.c(),p(u,"type","submit"),p(u,"class","hidden"),p(u,"tabindex","-1"),p(r,"class","block"),p(h,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),ne(d,"active",n[9]===ps),p(S,"class","txt"),p(v,"type","button"),p(v,"class","tab-item"),ne(v,"active",n[9]===Vl),p(c,"class","tabs-header stretched")},m(K,Y){w(K,e,Y),m(e,i),w(K,s,Y),D&&D.m(K,Y),w(K,l,Y),w(K,r,Y),V(o,r,null),m(r,a),m(r,u),w(K,f,Y),w(K,c,Y),m(c,d),m(d,h),m(d,g),P&&P.m(d,null),m(c,b),m(c,v),m(v,S),m(v,C),L&&L.m(v,null),$=!0,T||(A=[X(r,"submit",Jt(n[22])),X(d,"click",n[23]),X(v,"click",n[24])],T=!0)},p(K,Y){var fe,ye,se,G,Oe,ee;(!$||Y[0]&4)&&t!==(t=K[2].isNew?"New collection":"Edit collection")&&_e(i,t),!K[2].isNew&&!K[2].system?D?(D.p(K,Y),Y[0]&4&&E(D,1)):(D=th(K),D.c(),E(D,1),D.m(l.parentNode,l)):D&&(Te(),F(D,1,1,()=>{D=null}),De());const te={};Y[0]&2048&&(te.class="form-field required m-b-0 "+(K[11]?"disabled":"")),Y[0]&2052|Y[1]&384&&(te.$$scope={dirty:Y,ctx:K}),o.$set(te),Y[0]&16&&(y=!U.isEmpty((fe=K[4])==null?void 0:fe.schema)),y?P?(P.p(K,Y),Y[0]&16&&E(P,1)):(P=ih(K),P.c(),E(P,1),P.m(d,null)):P&&(Te(),F(P,1,1,()=>{P=null}),De()),Y[0]&512&&ne(d,"active",K[9]===ps),Y[0]&16&&(M=!U.isEmpty((ye=K[4])==null?void 0:ye.listRule)||!U.isEmpty((se=K[4])==null?void 0:se.viewRule)||!U.isEmpty((G=K[4])==null?void 0:G.createRule)||!U.isEmpty((Oe=K[4])==null?void 0:Oe.updateRule)||!U.isEmpty((ee=K[4])==null?void 0:ee.deleteRule)),M?L?Y[0]&16&&E(L,1):(L=sh(),L.c(),E(L,1),L.m(v,null)):L&&(Te(),F(L,1,1,()=>{L=null}),De()),Y[0]&512&&ne(v,"active",K[9]===Vl)},i(K){$||(E(D),E(o.$$.fragment,K),E(P),E(L),$=!0)},o(K){F(D),F(o.$$.fragment,K),F(P),F(L),$=!1},d(K){K&&k(e),K&&k(s),D&&D.d(K),K&&k(l),K&&k(r),z(o),K&&k(f),K&&k(c),P&&P.d(),L&&L.d(),T=!1,lt(A)}}}function B$(n){let e,t,i,s,l,r=n[2].isNew?"Create":"Save changes",o,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=O(),s=_("button"),l=_("span"),o=H(r),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ne(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,o),u||(f=[X(e,"click",n[18]),X(s,"click",n[19])],u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&r!==(r=c[2].isNew?"Create":"Save changes")&&_e(o,r),d[0]&1152&&a!==(a=!c[10]||c[7])&&(s.disabled=a),d[0]&128&&ne(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,lt(f)}}}function U$(n){let e,t,i,s,l={class:"overlay-panel-lg colored-header collection-panel",beforeHide:n[27],$$slots:{footer:[B$],header:[z$],default:[H$]},$$scope:{ctx:n}};e=new Ti({props:l}),n[28](e),e.$on("hide",n[29]),e.$on("show",n[30]);let r={};return i=new j$({props:r}),n[31](i),i.$on("confirm",n[32]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(o,a){V(e,o,a),w(o,t,a),V(i,o,a),s=!0},p(o,a){const u={};a[0]&264&&(u.beforeHide=o[27]),a[0]&7828|a[1]&256&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};i.$set(f)},i(o){s||(E(e.$$.fragment,o),E(i.$$.fragment,o),s=!0)},o(o){F(e.$$.fragment,o),F(i.$$.fragment,o),s=!1},d(o){n[28](null),z(e,o),o&&k(t),n[31](null),z(i,o)}}}const ps="fields",Vl="api_rules";function Ta(n){return JSON.stringify(n)}function W$(n,e,t){let i,s,l,r,o,a;pn(n,ui,ee=>t(34,o=ee)),pn(n,gs,ee=>t(4,a=ee));const u=vn();let f,c,d=null,h=new Pn,g=!1,y=!1,b=ps,v=Ta(h);function S(ee){t(9,b=ee)}function C(ee){return $(ee),t(8,y=!0),S(ps),f==null?void 0:f.show()}function M(){return f==null?void 0:f.hide()}async function $(ee){Wi({}),typeof ee!="undefined"?(d=ee,t(2,h=ee==null?void 0:ee.clone())):(d=null,t(2,h=new Pn)),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await Ui(),t(17,v=Ta(h))}function T(){if(h.isNew)return A();c==null||c.show(h)}function A(){if(g)return;t(7,g=!0);const ee=D();let be;h.isNew?be=Se.Collections.create(ee):be=Se.Collections.update(h.id,ee),be.then(ue=>{t(8,y=!1),M(),hn(h.isNew?"Successfully created collection.":"Successfully updated collection."),g4(ue),h.isNew&&Hg(ui,o=ue,o),u("save",ue)}).catch(ue=>{Se.errorResponseHandler(ue)}).finally(()=>{t(7,g=!1)})}function D(){const ee=h.export();ee.schema=ee.schema.slice(0);for(let be=ee.schema.length-1;be>=0;be--)ee.schema[be].toDelete&&ee.schema.splice(be,1);return ee}function P(){!(d!=null&&d.id)||Mi(`Do you really want to delete collection "${d==null?void 0:d.name}" and all its records?`,()=>Se.Collections.delete(d==null?void 0:d.id).then(()=>{M(),hn(`Successfully deleted collection "${d==null?void 0:d.name}".`),u("delete",d),_4(d)}).catch(ee=>{Se.errorResponseHandler(ee)}))}const L=()=>M(),N=()=>T(),R=()=>P(),J=ee=>{t(2,h.name=U.slugify(ee.target.value),h),ee.target.value=h.name},W=()=>{r&&T()},q=()=>S(ps),x=()=>S(Vl);function K(ee){h=ee,t(2,h)}function Y(ee){h=ee,t(2,h)}const te=()=>l&&y?(Mi("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,y=!1),M()}),!1):!0;function fe(ee){he[ee?"unshift":"push"](()=>{f=ee,t(5,f)})}function ye(ee){ut.call(this,n,ee)}function se(ee){ut.call(this,n,ee)}function G(ee){he[ee?"unshift":"push"](()=>{c=ee,t(6,c)})}const Oe=()=>A();return n.$$.update=()=>{n.$$.dirty[0]&16&&t(12,i=typeof U.getNestedVal(a,"schema.message",null)=="string"?U.getNestedVal(a,"schema.message"):"Has errors"),n.$$.dirty[0]&4&&t(11,s=!h.isNew&&h.system),n.$$.dirty[0]&131076&&t(3,l=v!=Ta(h)),n.$$.dirty[0]&12&&t(10,r=h.isNew||l)},[S,M,h,l,a,f,c,g,y,b,r,s,i,T,A,P,C,v,L,N,R,J,W,q,x,K,Y,te,fe,ye,se,G,Oe]}class hf extends Ne{constructor(e){super(),Ie(this,e,W$,U$,Pe,{changeTab:0,show:16,hide:1},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[1]}}function lh(n,e,t){const i=n.slice();return i[13]=e[t],i}function rh(n){let e,t=n[1].length&&oh();return{c(){t&&t.c(),e=rt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1].length?t||(t=oh(),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function oh(n){let e;return{c(){e=_("p"),e.textContent="No collections found.",p(e,"class","txt-hint m-t-10 m-b-10 txt-center")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Y$(n){let e;return{c(){e=_("i"),p(e,"class","ri-folder-2-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function K$(n){let e;return{c(){e=_("i"),p(e,"class","ri-folder-open-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ah(n,e){let t,i,s,l=e[13].name+"",r,o,a,u;function f(g,y){var b;return((b=g[5])==null?void 0:b.id)===g[13].id?K$:Y$}let c=f(e),d=c(e);function h(){return e[10](e[13])}return{key:n,first:null,c(){var g;t=_("div"),d.c(),i=O(),s=_("span"),r=H(l),o=O(),p(s,"class","txt"),p(t,"tabindex","0"),p(t,"class","sidebar-list-item"),ne(t,"active",((g=e[5])==null?void 0:g.id)===e[13].id),this.first=t},m(g,y){w(g,t,y),d.m(t,null),m(t,i),m(t,s),m(s,r),m(t,o),a||(u=X(t,"click",h),a=!0)},p(g,y){var b;e=g,c!==(c=f(e))&&(d.d(1),d=c(e),d&&(d.c(),d.m(t,i))),y&8&&l!==(l=e[13].name+"")&&_e(r,l),y&40&&ne(t,"active",((b=e[5])==null?void 0:b.id)===e[13].id)},d(g){g&&k(t),d.d(),a=!1,u()}}}function J$(n){let e,t,i,s,l,r,o,a,u,f,c,d=[],h=new Map,g,y,b,v,S,C,M,$,T=n[3];const A=L=>L[13].id;for(let L=0;L',r=O(),o=_("input"),a=O(),u=_("hr"),f=O(),c=_("div");for(let L=0;L + New collection`,v=O(),B(S.$$.fragment),p(l,"type","button"),p(l,"class","btn btn-xs btn-secondary btn-circle btn-clear"),ne(l,"hidden",!n[4]),p(s,"class","form-field-addon"),p(o,"type","text"),p(o,"placeholder","Search collections..."),p(i,"class","form-field search"),ne(i,"active",n[4]),p(t,"class","sidebar-header"),p(u,"class","m-t-5 m-b-xs"),p(c,"class","sidebar-content"),p(b,"type","button"),p(b,"class","btn btn-block btn-outline"),p(y,"class","sidebar-footer"),p(e,"class","page-sidebar collection-sidebar")},m(L,N){w(L,e,N),m(e,t),m(t,i),m(i,s),m(s,l),m(i,r),m(i,o),$e(o,n[0]),m(e,a),m(e,u),m(e,f),m(e,c);for(let R=0;Rt(5,r=b)),pn(n,Ks,b=>t(7,o=b));let a,u="";function f(b){Hg(ui,r=b,r)}const c=()=>t(0,u="");function d(){u=this.value,t(0,u)}const h=b=>f(b),g=()=>a==null?void 0:a.show();function y(b){he[b?"unshift":"push"](()=>{a=b,t(2,a)})}return n.$$.update=()=>{n.$$.dirty&1&&t(1,i=u.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=u!==""),n.$$.dirty&131&&t(3,l=o.filter(b=>b.name!="profiles"&&(b.id==u||b.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[u,i,a,l,s,r,f,o,c,d,h,g,y]}class G$ extends Ne{constructor(e){super(),Ie(this,e,x$,J$,Pe,{})}}function Z$(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C,M,$,T,A,D,P,L,N,R,J,W,q,x,K,Y,te,fe,ye,se,G,Oe,ee,be,ue,ie,ve,je,Le,qe,oe,le,ke,Ve;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format + OPERAND + OPERATOR + OPERAND, where:`,t=O(),i=_("ul"),s=_("li"),s.innerHTML=`OPERAND - could be any of the above field literal, string (single or double + quoted), number, null, true, false`,l=O(),r=_("li"),o=_("code"),o.textContent="OPERATOR",a=H(` - is one of: + `),u=_("br"),f=O(),c=_("ul"),d=_("li"),h=_("code"),h.textContent="=",g=O(),y=_("span"),y.textContent="Equal",b=O(),v=_("li"),S=_("code"),S.textContent="!=",C=O(),M=_("span"),M.textContent="NOT equal",$=O(),T=_("li"),A=_("code"),A.textContent=">",D=O(),P=_("span"),P.textContent="Greater than",L=O(),N=_("li"),R=_("code"),R.textContent=">=",J=O(),W=_("span"),W.textContent="Greater than or equal",q=O(),x=_("li"),K=_("code"),K.textContent="<",Y=O(),te=_("span"),te.textContent="Less than or equal",fe=O(),ye=_("li"),se=_("code"),se.textContent="<=",G=O(),Oe=_("span"),Oe.textContent="Less than or equal",ee=O(),be=_("li"),ue=_("code"),ue.textContent="~",ie=O(),ve=_("span"),ve.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard + match)`,je=O(),Le=_("li"),qe=_("code"),qe.textContent="!~",oe=O(),le=_("span"),le.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for + wildcard match)`,ke=O(),Ve=_("p"),Ve.innerHTML=`To group and combine several expressions you could use brackets + (...), && (AND) and || (OR) tokens.`,p(o,"class","txt-danger"),p(h,"class","filter-op svelte-1w7s5nw"),p(y,"class","txt-hint"),p(S,"class","filter-op svelte-1w7s5nw"),p(M,"class","txt-hint"),p(A,"class","filter-op svelte-1w7s5nw"),p(P,"class","txt-hint"),p(R,"class","filter-op svelte-1w7s5nw"),p(W,"class","txt-hint"),p(K,"class","filter-op svelte-1w7s5nw"),p(te,"class","txt-hint"),p(se,"class","filter-op svelte-1w7s5nw"),p(Oe,"class","txt-hint"),p(ue,"class","filter-op svelte-1w7s5nw"),p(ve,"class","txt-hint"),p(qe,"class","filter-op svelte-1w7s5nw"),p(le,"class","txt-hint")},m(ze,Ge){w(ze,e,Ge),w(ze,t,Ge),w(ze,i,Ge),m(i,s),m(i,l),m(i,r),m(r,o),m(r,a),m(r,u),m(r,f),m(r,c),m(c,d),m(d,h),m(d,g),m(d,y),m(c,b),m(c,v),m(v,S),m(v,C),m(v,M),m(c,$),m(c,T),m(T,A),m(T,D),m(T,P),m(c,L),m(c,N),m(N,R),m(N,J),m(N,W),m(c,q),m(c,x),m(x,K),m(x,Y),m(x,te),m(c,fe),m(c,ye),m(ye,se),m(ye,G),m(ye,Oe),m(c,ee),m(c,be),m(be,ue),m(be,ie),m(be,ve),m(c,je),m(c,Le),m(Le,qe),m(Le,oe),m(Le,le),w(ze,ke,Ge),w(ze,Ve,Ge)},p:re,i:re,o:re,d(ze){ze&&k(e),ze&&k(t),ze&&k(i),ze&&k(ke),ze&&k(Ve)}}}class X$ extends Ne{constructor(e){super(),Ie(this,e,null,Z$,Pe,{})}}function uh(n,e,t){const i=n.slice();return i[8]=e[t],i}function fh(n,e,t){const i=n.slice();return i[8]=e[t],i}function ch(n,e,t){const i=n.slice();return i[13]=e[t],i}function dh(n,e,t){const i=n.slice();return i[13]=e[t],i}function ph(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function hh(n,e){let t,i=e[13].lang+"",s,l,r,o;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&_e(s,i),f&24&&ne(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),r=!1,o()}}}function mh(n,e){let t,i,s,l;return i=new tn({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&16&&(a.content=e[13].code),i.$set(a),o&24&&ne(t,"active",e[3]===e[13].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function gh(n,e){let t,i=e[8].code+"",s,l,r,o;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("div"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&36&&ne(t,"active",e[2]===e[8].code)},d(u){u&&k(t),r=!1,o()}}}function _h(n,e){let t,i,s,l;return i=new tn({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r,o&36&&ne(t,"active",e[2]===e[8].code)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function Q$(n){let e,t,i,s,l,r,o,a=n[0].name+"",u,f,c,d,h,g,y,b,v=n[0].name+"",S,C,M,$,T,A,D,P=[],L=new Map,N,R,J=[],W=new Map,q,x,K,Y,te,fe,ye,se,G,Oe,ee,be,ue,ie,ve,je,Le,qe,oe,le,ke,Ve,ze,Ge,ge,Ae,Z,ae,Be,vt,it,gt,at,yt,zt,$t,Ot,me,Ce,Ke,st,fn,ce,we,Ze,xt,qt,ni,pe,I,j,Q,de,Ee,We,tt,Je,nt=[],xe=new Map,et,_t,Ft=[],nn=new Map,Fn,Bt=n[1]&&ph(),ks=n[4];const ws=Me=>Me[13].lang;for(let Me=0;MeMe[13].lang;for(let Me=0;Me'2022-01-01') + `}}),$t=new X$({}),Ze=new tn({props:{content:` + ?expand=rel1,rel2.subrel21.subrel22 + `}});let Ss=n[5];const nr=Me=>Me[8].code;for(let Me=0;MeMe[8].code;for(let Me=0;MeParam + Type + Description`,fe=O(),ye=_("tbody"),se=_("tr"),se.innerHTML=`page + Number + The page (aka. offset) of the paginated list (default to 1).`,G=O(),Oe=_("tr"),Oe.innerHTML=`perPage + Number + Specify the max returned records per page (default to 30).`,ee=O(),be=_("tr"),ue=_("td"),ue.textContent="sort",ie=O(),ve=_("td"),ve.innerHTML='String',je=O(),Le=_("td"),qe=H("Specify the records order attribute(s). "),oe=_("br"),le=H(` + Add `),ke=_("code"),ke.textContent="-",Ve=H(" / "),ze=_("code"),ze.textContent="+",Ge=H(` (default) in front of the attribute for DESC / ASC order. + Ex.: + `),B(ge.$$.fragment),Ae=O(),Z=_("tr"),ae=_("td"),ae.textContent="filter",Be=O(),vt=_("td"),vt.innerHTML='String',it=O(),gt=_("td"),at=H(`Filter the returned records. Ex.: + `),B(yt.$$.fragment),zt=O(),B($t.$$.fragment),Ot=O(),me=_("tr"),Ce=_("td"),Ce.textContent="expand",Ke=O(),st=_("td"),st.innerHTML='String',fn=O(),ce=_("td"),we=H(`Auto expand nested record relations. Ex.: + `),B(Ze.$$.fragment),xt=H(` + Supports up to 6-levels depth nested relations expansion. `),qt=_("br"),ni=H(` + The expanded relations will be appended to each individual record under the + `),pe=_("code"),pe.textContent="@expand",I=H(" property (eg. "),j=_("code"),j.textContent='"@expand": {"rel1": {...}, ...}',Q=H(")."),de=O(),Ee=_("div"),Ee.textContent="Responses",We=O(),tt=_("div"),Je=_("div");for(let Me=0;Met(3,r=c.lang),f=c=>t(2,l=c.code);return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(s==null?void 0:s.listRule)===null),n.$$.dirty&3&&s!=null&&s.id&&(o.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[U.dummyCollectionRecord(s),U.dummyCollectionRecord(s)]},null,2)}),o.push({code:400,body:` + { + "code": 400, + "message": "Something went wrong while processing your request. Invalid filter.", + "data": {} + } + `}),i&&o.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),o.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `})),n.$$.dirty&1&&t(4,a=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + client.Records.getList("${s==null?void 0:s.name}", { page: 2 }) + .then(function (list) { + // success... + }).catch(function (error) { + // error... + }); + + // alternatively you can also fetch all records at once via getFullList: + client.Records.getFullList("${s==null?void 0:s.name}", 200 /* batch size */); + .then(function (records) { + // success... + }).catch(function (error) { + // error... + }); + `}])},[s,i,l,r,a,o,u,f]}class tO extends Ne{constructor(e){super(),Ie(this,e,eO,Q$,Pe,{collection:0})}}function bh(n,e,t){const i=n.slice();return i[8]=e[t],i}function yh(n,e,t){const i=n.slice();return i[8]=e[t],i}function vh(n,e,t){const i=n.slice();return i[13]=e[t],i}function kh(n,e,t){const i=n.slice();return i[13]=e[t],i}function wh(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Sh(n,e){let t,i=e[13].lang+"",s,l,r,o;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&_e(s,i),f&24&&ne(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),r=!1,o()}}}function Ch(n,e){let t,i,s,l;return i=new tn({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&16&&(a.content=e[13].code),i.$set(a),o&24&&ne(t,"active",e[3]===e[13].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function Mh(n,e){let t,i=e[8].code+"",s,l,r,o;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&36&&ne(t,"active",e[2]===e[8].code)},d(u){u&&k(t),r=!1,o()}}}function $h(n,e){let t,i,s,l;return i=new tn({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r,o&36&&ne(t,"active",e[2]===e[8].code)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function nO(n){let e,t,i,s,l,r,o,a=n[0].name+"",u,f,c,d,h,g,y,b,v,S=n[0].name+"",C,M,$,T,A,D,P,L=[],N=new Map,R,J,W=[],q=new Map,x,K,Y,te,fe,ye,se,G,Oe,ee,be,ue,ie,ve,je,Le,qe,oe,le,ke,Ve,ze,Ge,ge,Ae,Z,ae,Be,vt,it,gt,at=[],yt=new Map,zt,$t,Ot=[],me=new Map,Ce,Ke=n[1]&&wh(),st=n[4];const fn=pe=>pe[13].lang;for(let pe=0;pepe[13].lang;for(let pe=0;pepe[8].code;for(let pe=0;pepe[8].code;for(let pe=0;peParam + Type + Description + id + String + ID of the record to view.`,fe=O(),ye=_("div"),ye.textContent="Query parameters",se=O(),G=_("table"),Oe=_("thead"),Oe.innerHTML=`Param + Type + Description`,ee=O(),be=_("tbody"),ue=_("tr"),ie=_("td"),ie.textContent="expand",ve=O(),je=_("td"),je.innerHTML='String',Le=O(),qe=_("td"),oe=H(`Auto expand nested record relations. Ex.: + `),B(le.$$.fragment),ke=H(` + Supports up to 6-levels depth nested relations expansion. `),Ve=_("br"),ze=H(` + The expanded relations will be appended to the record under the + `),Ge=_("code"),Ge.textContent="@expand",ge=H(" property (eg. "),Ae=_("code"),Ae.textContent='"@expand": {"rel1": {...}, ...}',Z=H(")."),ae=O(),Be=_("div"),Be.textContent="Responses",vt=O(),it=_("div"),gt=_("div");for(let pe=0;pet(3,r=c.lang),f=c=>t(2,l=c.code);return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(s==null?void 0:s.viewRule)===null),n.$$.dirty&3&&s!=null&&s.id&&(o.push({code:200,body:JSON.stringify(U.dummyCollectionRecord(s),null,2)}),i&&o.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),o.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `})),n.$$.dirty&1&&t(4,a=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + client.Records.getOne("${s==null?void 0:s.name}", "RECORD_ID") + .then(function (record) { + // success... + }).catch(function (error) { + // error... + }); + `}])},[s,i,l,r,a,o,u,f]}class sO extends Ne{constructor(e){super(),Ie(this,e,iO,nO,Pe,{collection:0})}}function Oh(n,e,t){const i=n.slice();return i[8]=e[t],i}function Th(n,e,t){const i=n.slice();return i[8]=e[t],i}function Dh(n,e,t){const i=n.slice();return i[13]=e[t],i}function Ah(n,e,t){const i=n.slice();return i[16]=e[t],i}function Eh(n,e,t){const i=n.slice();return i[16]=e[t],i}function Ph(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Lh(n,e){let t,i=e[16].lang+"",s,l,r,o;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&_e(s,i),f&20&&ne(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),r=!1,o()}}}function Fh(n,e){let t,i,s,l;return i=new tn({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[16].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&16&&(a.content=e[16].code),i.$set(a),o&20&&ne(t,"active",e[2]===e[16].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function lO(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function rO(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function oO(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=H("User "),i=H(t),s=H(".")},m(r,o){w(r,e,o),w(r,i,o),w(r,s,o)},p(r,o){var a;o&1&&t!==(t=((a=r[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&_e(i,t)},d(r){r&&k(e),r&&k(i),r&&k(s)}}}function aO(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=H("Relation record "),i=H(t),s=H(".")},m(r,o){w(r,e,o),w(r,i,o),w(r,s,o)},p(r,o){var a;o&1&&t!==(t=((a=r[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&_e(i,t)},d(r){r&&k(e),r&&k(i),r&&k(s)}}}function uO(n){let e,t,i,s,l;return{c(){e=H("FormData object."),t=_("br"),i=H(` + Set to `),s=_("code"),s.textContent="null",l=H(" to delete already uploaded file(s).")},m(r,o){w(r,e,o),w(r,t,o),w(r,i,o),w(r,s,o),w(r,l,o)},p:re,d(r){r&&k(e),r&&k(t),r&&k(i),r&&k(s),r&&k(l)}}}function fO(n){let e;return{c(){e=H("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function cO(n){let e;return{c(){e=H("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function dO(n){let e;return{c(){e=H("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function pO(n){let e;return{c(){e=H("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function hO(n){let e;return{c(){e=H("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Ih(n,e){let t,i,s,l,r,o=e[13].name+"",a,u,f,c,d=U.getFieldValueType(e[13])+"",h,g,y,b;function v(A,D){return A[13].required?rO:lO}let S=v(e),C=S(e);function M(A,D){if(A[13].type==="text")return hO;if(A[13].type==="number")return pO;if(A[13].type==="json")return dO;if(A[13].type==="email")return cO;if(A[13].type==="url")return fO;if(A[13].type==="file")return uO;if(A[13].type==="relation")return aO;if(A[13].type==="user")return oO}let $=M(e),T=$&&$(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=O(),r=_("span"),a=H(o),u=O(),f=_("td"),c=_("span"),h=H(d),g=O(),y=_("td"),T&&T.c(),b=O(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(A,D){w(A,t,D),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,r),m(r,a),m(t,u),m(t,f),m(f,c),m(c,h),m(t,g),m(t,y),T&&T.m(y,null),m(t,b)},p(A,D){e=A,S!==(S=v(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),D&1&&o!==(o=e[13].name+"")&&_e(a,o),D&1&&d!==(d=U.getFieldValueType(e[13])+"")&&_e(h,d),$===($=M(e))&&T?T.p(e,D):(T&&T.d(1),T=$&&$(e),T&&(T.c(),T.m(y,null)))},d(A){A&&k(t),C.d(),T&&T.d()}}}function Nh(n,e){let t,i=e[8].code+"",s,l,r,o;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&_e(s,i),f&10&&ne(t,"active",e[1]===e[8].code)},d(u){u&&k(t),r=!1,o()}}}function Rh(n,e){let t,i,s,l;return i=new tn({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[8].code),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&8&&(a.content=e[8].body),i.$set(a),o&10&&ne(t,"active",e[1]===e[8].code)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function mO(n){var Ot;let e,t,i,s,l,r,o,a=n[0].name+"",u,f,c,d,h,g,y,b,v=n[0].name+"",S,C,M,$,T,A,D,P,L,N,R,J=[],W=new Map,q,x,K=[],Y=new Map,te,fe,ye,se,G,Oe,ee,be=[],ue=new Map,ie,ve,je,Le,qe,oe=[],le=new Map,ke,Ve,ze=[],Ge=new Map,ge,Ae=n[5]&&Ph(),Z=n[4];const ae=me=>me[16].lang;for(let me=0;meme[16].lang;for(let me=0;meme[13].name;for(let me=0;meme[8].code;for(let me=0;meme[8].code;for(let me=0;meapplication/json or + multipart/form-data.`,T=O(),A=_("p"),A.innerHTML="File upload is supported only via multipart/form-data.",D=O(),P=_("div"),P.textContent="Client SDKs example",L=O(),N=_("div"),R=_("div");for(let me=0;meParam + Type + Description`,Oe=O(),ee=_("tbody");for(let me=0;met(2,r=c.lang),f=c=>t(1,l=c.code);return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{var c,d;n.$$.dirty&1&&t(5,i=(s==null?void 0:s.createRule)===null),n.$$.dirty&1&&t(3,o=[{code:200,body:JSON.stringify(U.dummyCollectionRecord(s),null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to create record.", + "data": { + "${(d=(c=s==null?void 0:s.schema)==null?void 0:c[0])==null?void 0:d.name}": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:403,body:` + { + "code": 403, + "message": "You are not allowed to perform this request.", + "data": {} + } + `}]),n.$$.dirty&1&&t(4,a=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + const data = { ... }; + + client.Records.create("${s==null?void 0:s.name}", data) + .then(function (record) { + // success... + }).catch(function (error) { + // error... + }); + `}])},[s,l,r,o,a,i,u,f]}class _O extends Ne{constructor(e){super(),Ie(this,e,gO,mO,Pe,{collection:0})}}function jh(n,e,t){const i=n.slice();return i[8]=e[t],i}function Hh(n,e,t){const i=n.slice();return i[8]=e[t],i}function qh(n,e,t){const i=n.slice();return i[13]=e[t],i}function Vh(n,e,t){const i=n.slice();return i[16]=e[t],i}function zh(n,e,t){const i=n.slice();return i[16]=e[t],i}function Bh(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Uh(n,e){let t,i=e[16].lang+"",s,l,r,o;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&_e(s,i),f&20&&ne(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),r=!1,o()}}}function Wh(n,e){let t,i,s,l;return i=new tn({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[16].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&16&&(a.content=e[16].code),i.$set(a),o&20&&ne(t,"active",e[2]===e[16].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function bO(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function yO(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function vO(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=H("User "),i=H(t),s=H(".")},m(r,o){w(r,e,o),w(r,i,o),w(r,s,o)},p(r,o){var a;o&1&&t!==(t=((a=r[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&_e(i,t)},d(r){r&&k(e),r&&k(i),r&&k(s)}}}function kO(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=H("Relation record "),i=H(t),s=H(".")},m(r,o){w(r,e,o),w(r,i,o),w(r,s,o)},p(r,o){var a;o&1&&t!==(t=((a=r[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&_e(i,t)},d(r){r&&k(e),r&&k(i),r&&k(s)}}}function wO(n){let e,t,i,s,l;return{c(){e=H("FormData object."),t=_("br"),i=H(` + Set to `),s=_("code"),s.textContent="null",l=H(" to delete already uploaded file(s).")},m(r,o){w(r,e,o),w(r,t,o),w(r,i,o),w(r,s,o),w(r,l,o)},p:re,d(r){r&&k(e),r&&k(t),r&&k(i),r&&k(s),r&&k(l)}}}function SO(n){let e;return{c(){e=H("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function CO(n){let e;return{c(){e=H("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function MO(n){let e;return{c(){e=H("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function $O(n){let e;return{c(){e=H("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function OO(n){let e;return{c(){e=H("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Yh(n,e){let t,i,s,l,r,o=e[13].name+"",a,u,f,c,d=U.getFieldValueType(e[13])+"",h,g,y,b;function v(A,D){return A[13].required?yO:bO}let S=v(e),C=S(e);function M(A,D){if(A[13].type==="text")return OO;if(A[13].type==="number")return $O;if(A[13].type==="json")return MO;if(A[13].type==="email")return CO;if(A[13].type==="url")return SO;if(A[13].type==="file")return wO;if(A[13].type==="relation")return kO;if(A[13].type==="user")return vO}let $=M(e),T=$&&$(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=O(),r=_("span"),a=H(o),u=O(),f=_("td"),c=_("span"),h=H(d),g=O(),y=_("td"),T&&T.c(),b=O(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(A,D){w(A,t,D),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,r),m(r,a),m(t,u),m(t,f),m(f,c),m(c,h),m(t,g),m(t,y),T&&T.m(y,null),m(t,b)},p(A,D){e=A,S!==(S=v(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),D&1&&o!==(o=e[13].name+"")&&_e(a,o),D&1&&d!==(d=U.getFieldValueType(e[13])+"")&&_e(h,d),$===($=M(e))&&T?T.p(e,D):(T&&T.d(1),T=$&&$(e),T&&(T.c(),T.m(y,null)))},d(A){A&&k(t),C.d(),T&&T.d()}}}function Kh(n,e){let t,i=e[8].code+"",s,l,r,o;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&_e(s,i),f&10&&ne(t,"active",e[1]===e[8].code)},d(u){u&&k(t),r=!1,o()}}}function Jh(n,e){let t,i,s,l;return i=new tn({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[8].code),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&8&&(a.content=e[8].body),i.$set(a),o&10&&ne(t,"active",e[1]===e[8].code)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function TO(n){var fn;let e,t,i,s,l,r,o,a=n[0].name+"",u,f,c,d,h,g,y,b,v,S=n[0].name+"",C,M,$,T,A,D,P,L,N,R,J,W=[],q=new Map,x,K,Y=[],te=new Map,fe,ye,se,G,Oe,ee,be,ue,ie,ve,je,Le=[],qe=new Map,oe,le,ke,Ve,ze,Ge=[],ge=new Map,Ae,Z,ae=[],Be=new Map,vt,it=n[5]&&Bh(),gt=n[4];const at=ce=>ce[16].lang;for(let ce=0;cece[16].lang;for(let ce=0;cece[13].name;for(let ce=0;ce<$t.length;ce+=1){let we=qh(n,$t,ce),Ze=Ot(we);qe.set(Ze,Le[ce]=Yh(Ze,we))}let me=n[3];const Ce=ce=>ce[8].code;for(let ce=0;cece[8].code;for(let ce=0;ceapplication/json or + multipart/form-data.`,A=O(),D=_("p"),D.innerHTML="File upload is supported only via multipart/form-data.",P=O(),L=_("div"),L.textContent="Client SDKs example",N=O(),R=_("div"),J=_("div");for(let ce=0;ceParam + Type + Description + id + String + ID of the record to update.`,Oe=O(),ee=_("div"),ee.textContent="Body Parameters",be=O(),ue=_("table"),ie=_("thead"),ie.innerHTML=`Param + Type + Description`,ve=O(),je=_("tbody");for(let ce=0;cet(2,r=c.lang),f=c=>t(1,l=c.code);return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{var c,d;n.$$.dirty&1&&t(5,i=(s==null?void 0:s.updateRule)===null),n.$$.dirty&1&&t(3,o=[{code:200,body:JSON.stringify(U.dummyCollectionRecord(s),null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to update record.", + "data": { + "${(d=(c=s==null?void 0:s.schema)==null?void 0:c[0])==null?void 0:d.name}": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:403,body:` + { + "code": 403, + "message": "You are not allowed to perform this request.", + "data": {} + } + `},{code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}]),n.$$.dirty&1&&t(4,a=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + const data = { ... }; + + client.Records.update("${s==null?void 0:s.name}", "RECORD_ID", data) + .then(function (record) { + // success... + }).catch(function (error) { + // error... + }); + `}])},[s,l,r,o,a,i,u,f]}class AO extends Ne{constructor(e){super(),Ie(this,e,DO,TO,Pe,{collection:0})}}function xh(n,e,t){const i=n.slice();return i[8]=e[t],i}function Gh(n,e,t){const i=n.slice();return i[8]=e[t],i}function Zh(n,e,t){const i=n.slice();return i[13]=e[t],i}function Xh(n,e,t){const i=n.slice();return i[13]=e[t],i}function Qh(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function em(n,e){let t,i=e[13].lang+"",s,l,r,o;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&_e(s,i),f&24&&ne(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),r=!1,o()}}}function tm(n,e){let t,i,s,l;return i=new tn({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[3]===e[13].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&16&&(a.content=e[13].code),i.$set(a),o&24&&ne(t,"active",e[3]===e[13].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function nm(n,e){let t,i=e[8].code+"",s,l,r,o;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&36&&ne(t,"active",e[2]===e[8].code)},d(u){u&&k(t),r=!1,o()}}}function im(n,e){let t,i,s,l;return i=new tn({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[8].code),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r,o&36&&ne(t,"active",e[2]===e[8].code)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function EO(n){let e,t,i,s,l,r,o,a=n[0].name+"",u,f,c,d,h,g,y,b,v,S=n[0].name+"",C,M,$,T,A,D,P,L=[],N=new Map,R,J,W=[],q=new Map,x,K,Y,te,fe,ye,se,G,Oe,ee=[],be=new Map,ue,ie,ve=[],je=new Map,Le,qe=n[1]&&Qh(),oe=n[4];const le=Z=>Z[13].lang;for(let Z=0;ZZ[13].lang;for(let Z=0;ZZ[8].code;for(let Z=0;ZZ[8].code;for(let Z=0;ZParam + Type + Description + id + String + ID of the record to delete.`,fe=O(),ye=_("div"),ye.textContent="Responses",se=O(),G=_("div"),Oe=_("div");for(let Z=0;Zt(3,r=c.lang),f=c=>t(2,l=c.code);return n.$$set=c=>{"collection"in c&&t(0,s=c.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(s==null?void 0:s.deleteRule)===null),n.$$.dirty&3&&s!=null&&s.id&&(o.push({code:204,body:` + null + `}),o.push({code:400,body:` + { + "code": 400, + "message": "Failed to delete record. Make sure that the record is not part of a required relation reference.", + "data": {} + } + `}),i&&o.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),o.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `})),n.$$.dirty&1&&t(4,a=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + client.Records.delete("${s==null?void 0:s.name}", "RECORD_ID") + .then(function () { + // success... + }).catch(function (error) { + // error... + }); + `}])},[s,i,l,r,a,o,u,f]}class LO extends Ne{constructor(e){super(),Ie(this,e,PO,EO,Pe,{collection:0})}}function sm(n,e,t){const i=n.slice();return i[4]=e[t],i}function lm(n,e,t){const i=n.slice();return i[4]=e[t],i}function rm(n,e){let t,i=e[4].lang+"",s,l,r,o;function a(){return e[3](e[4])}return{key:n,first:null,c(){t=_("button"),s=H(i),l=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[4].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),r||(o=X(t,"click",a),r=!0)},p(u,f){e=u,f&4&&i!==(i=e[4].lang+"")&&_e(s,i),f&6&&ne(t,"active",e[1]===e[4].lang)},d(u){u&&k(t),r=!1,o()}}}function om(n,e){let t,i,s,l;return i=new tn({props:{content:e[4].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=O(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[4].lang),this.first=t},m(r,o){w(r,t,o),V(i,t,null),m(t,s),l=!0},p(r,o){e=r;const a={};o&4&&(a.content=e[4].code),i.$set(a),o&6&&ne(t,"active",e[1]===e[4].lang)},i(r){l||(E(i.$$.fragment,r),l=!0)},o(r){F(i.$$.fragment,r),l=!1},d(r){r&&k(t),z(i)}}}function FO(n){let e,t,i,s,l,r,o,a,u=[],f=new Map,c,d,h=[],g=new Map,y,b,v,S,C,M=n[2];const $=D=>D[4].lang;for(let D=0;DD[4].lang;for(let D=0;DSSE +

/api/realtime

`,t=O(),i=_("div"),i.innerHTML=`

Subscribe to realtime changes via Server-Sent Events (SSE).

+

Events are send for create, update + and delete record operations (see "Event data format" section below).

+
+

You could subscribe to a single record or to an entire collection.

+

When you subscribe to a single record, the collection's + ViewRule will be used to determine whether the subscriber has access to receive + the event message.

+

When you subscribe to an entire collection, the collection's + ListRule will be used to determine whether the subscriber has access to receive + the event message.

`,s=O(),l=_("div"),l.textContent="Client SDKs example",r=O(),o=_("div"),a=_("div");for(let D=0;Dt(1,s=o.lang);return n.$$set=o=>{"collection"in o&&t(0,i=o.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(2,l=[{lang:"JavaScript",code:` + import PocketBase from 'pocketbase'; + + const client = new PocketBase("${Se.baseUrl}"); + + // (Optionally) authenticate + client.Users.authViaEmail("test@example.com", "123456"); + + // Subscribe to changes in any record from the collection + client.Realtime.subscribe("${i==null?void 0:i.name}", function (e) { + console.log(e.record); + }); + + // Subscribe to changes in a single record + client.Realtime.subscribe("${i==null?void 0:i.name}/RECORD_ID", function (e) { + console.log(e.record); + }); + + // Unsubscribe + client.Realtime.unsubscribe() // remove all subscriptions + client.Realtime.unsubscribe("${i==null?void 0:i.name}") // remove the collection subscription + client.Realtime.unsubscribe("${i==null?void 0:i.name}/RECORD_ID") // remove the record subscription + `}])},[i,s,l,r]}class NO extends Ne{constructor(e){super(),Ie(this,e,IO,FO,Pe,{collection:0})}}function am(n,e,t){const i=n.slice();return i[14]=e[t],i}function um(n,e,t){const i=n.slice();return i[14]=e[t],i}function fm(n){let e,t,i,s;var l=n[14].component;function r(o){return{props:{collection:o[3]}}}return l&&(t=new l(r(n))),{c(){e=_("div"),t&&B(t.$$.fragment),i=O(),p(e,"class","tab-item active")},m(o,a){w(o,e,a),t&&V(t,e,null),m(e,i),s=!0},p(o,a){const u={};if(a&8&&(u.collection=o[3]),l!==(l=o[14].component)){if(t){Te();const f=t;F(f.$$.fragment,1,0,()=>{z(f,1)}),De()}l?(t=new l(r(o)),B(t.$$.fragment),E(t.$$.fragment,1),V(t,e,i)):t=null}else l&&t.$set(u)},i(o){s||(t&&E(t.$$.fragment,o),s=!0)},o(o){t&&F(t.$$.fragment,o),s=!1},d(o){o&&k(e),t&&z(t)}}}function cm(n,e){let t,i,s,l=e[4]===e[14].id&&fm(e);return{key:n,first:null,c(){t=rt(),l&&l.c(),i=rt(),this.first=t},m(r,o){w(r,t,o),l&&l.m(r,o),w(r,i,o),s=!0},p(r,o){e=r,e[4]===e[14].id?l?(l.p(e,o),o&16&&E(l,1)):(l=fm(e),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(Te(),F(l,1,1,()=>{l=null}),De())},i(r){s||(E(l),s=!0)},o(r){F(l),s=!1},d(r){r&&k(t),l&&l.d(r),r&&k(i)}}}function RO(n){let e,t=[],i=new Map,s,l=n[5];const r=o=>o[14].id;for(let o=0;od[14].id;for(let d=0;dClose',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[8]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function qO(n){let e,t,i={class:"overlay-panel-xl colored-header collection-panel",$$slots:{footer:[HO],header:[jO],default:[RO]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[11](e),e.$on("hide",n[12]),e.$on("show",n[13]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const r={};l&524312&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[11](null),z(e,s)}}}function VO(n,e,t){const i=[{id:"list",label:"List",component:tO},{id:"view",label:"View",component:sO},{id:"create",label:"Create",component:_O},{id:"update",label:"Update",component:AO},{id:"delete",label:"Delete",component:LO},{id:"realtime",label:"Realtime",component:NO}];let s,l=new Pn,r=i[0].id;function o(v){return t(3,l=v),u(i[0].id),s==null?void 0:s.show()}function a(){return s==null?void 0:s.hide()}function u(v){t(4,r=v)}function f(v,S){(v.code==="Enter"||v.code==="Space")&&(v.preventDefault(),u(S))}const c=()=>a(),d=v=>u(v.id),h=(v,S)=>f(S,v.id);function g(v){he[v?"unshift":"push"](()=>{s=v,t(2,s)})}function y(v){ut.call(this,n,v)}function b(v){ut.call(this,n,v)}return[a,u,s,l,r,i,f,o,c,d,h,g,y,b]}class zO extends Ne{constructor(e){super(),Ie(this,e,VO,qO,Pe,{show:7,hide:0,changeTab:1})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function BO(n){let e,t,i,s=[n[3]],l={};for(let r=0;r{o&&(t(1,o.style.height="",o),t(1,o.style.height=Math.min(o.scrollHeight+2,r)+"px",o))},0)}function f(h){if((h==null?void 0:h.code)==="Enter"&&!(h!=null&&h.shiftKey)){h.preventDefault();const g=o.closest("form");g!=null&&g.requestSubmit&&g.requestSubmit()}}function c(h){he[h?"unshift":"push"](()=>{o=h,t(1,o)})}function d(){l=this.value,t(0,l)}return n.$$set=h=>{e=ct(ct({},e),ci(h)),t(3,s=Yt(e,i)),"value"in h&&t(0,l=h.value),"maxHeight"in h&&t(4,r=h.maxHeight)},n.$$.update=()=>{n.$$.dirty&3&&o&&typeof l!==void 0&&u()},[l,o,f,s,r,c,d]}class WO extends Ne{constructor(e){super(),Ie(this,e,UO,BO,Pe,{value:0,maxHeight:4})}}function YO(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d;function h(y){n[2](y)}let g={id:n[3],required:n[1].required};return n[0]!==void 0&&(g.value=n[0]),f=new WO({props:g}),he.push(()=>Fe(f,"value",h)),{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),B(f.$$.fragment),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3])},m(y,b){w(y,e,b),m(e,t),m(e,s),m(e,l),m(l,o),w(y,u,b),V(f,y,b),d=!0},p(y,b){(!d||b&2&&i!==(i=U.getFieldTypeIcon(y[1].type)))&&p(t,"class",i),(!d||b&2)&&r!==(r=y[1].name+"")&&_e(o,r),(!d||b&8&&a!==(a=y[3]))&&p(e,"for",a);const v={};b&8&&(v.id=y[3]),b&2&&(v.required=y[1].required),!c&&b&1&&(c=!0,v.value=y[0],Re(()=>c=!1)),f.$set(v)},i(y){d||(E(f.$$.fragment,y),d=!0)},o(y){F(f.$$.fragment,y),d=!1},d(y){y&&k(e),y&&k(u),z(f,y)}}}function KO(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[YO,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function JO(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(r){s=r,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class xO extends Ne{constructor(e){super(),Ie(this,e,JO,KO,Pe,{field:1,value:0})}}function GO(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g,y,b;return{c(){var v,S;e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),f=_("input"),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","number"),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"min",h=(v=n[1].options)==null?void 0:v.min),p(f,"max",g=(S=n[1].options)==null?void 0:S.max)},m(v,S){w(v,e,S),m(e,t),m(e,s),m(e,l),m(l,o),w(v,u,S),w(v,f,S),$e(f,n[0]),y||(b=X(f,"input",n[2]),y=!0)},p(v,S){var C,M;S&2&&i!==(i=U.getFieldTypeIcon(v[1].type))&&p(t,"class",i),S&2&&r!==(r=v[1].name+"")&&_e(o,r),S&8&&a!==(a=v[3])&&p(e,"for",a),S&8&&c!==(c=v[3])&&p(f,"id",c),S&2&&d!==(d=v[1].required)&&(f.required=d),S&2&&h!==(h=(C=v[1].options)==null?void 0:C.min)&&p(f,"min",h),S&2&&g!==(g=(M=v[1].options)==null?void 0:M.max)&&p(f,"max",g),S&1&&Tt(f.value)!==v[0]&&$e(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),y=!1,b()}}}function ZO(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[GO,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function XO(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(){s=Tt(this.value),t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class QO extends Ne{constructor(e){super(),Ie(this,e,XO,ZO,Pe,{field:1,value:0})}}function eT(n){let e,t,i,s,l=n[1].name+"",r,o,a,u;return{c(){e=_("input"),i=O(),s=_("label"),r=H(l),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(s,"for",o=n[3])},m(f,c){w(f,e,c),e.checked=n[0],w(f,i,c),w(f,s,c),m(s,r),a||(u=X(e,"change",n[2]),a=!0)},p(f,c){c&8&&t!==(t=f[3])&&p(e,"id",t),c&1&&(e.checked=f[0]),c&2&&l!==(l=f[1].name+"")&&_e(r,l),c&8&&o!==(o=f[3])&&p(s,"for",o)},d(f){f&&k(e),f&&k(i),f&&k(s),a=!1,u()}}}function tT(n){let e,t;return e=new He({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[eT,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field form-field-toggle "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function nT(n,e,t){let{field:i=new kn}=e,{value:s=!1}=e;function l(){s=this.checked,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class iT extends Ne{constructor(e){super(),Ie(this,e,nT,tT,Pe,{field:1,value:0})}}function sT(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),f=_("input"),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","email"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(y,b){w(y,e,b),m(e,t),m(e,s),m(e,l),m(l,o),w(y,u,b),w(y,f,b),$e(f,n[0]),h||(g=X(f,"input",n[2]),h=!0)},p(y,b){b&2&&i!==(i=U.getFieldTypeIcon(y[1].type))&&p(t,"class",i),b&2&&r!==(r=y[1].name+"")&&_e(o,r),b&8&&a!==(a=y[3])&&p(e,"for",a),b&8&&c!==(c=y[3])&&p(f,"id",c),b&2&&d!==(d=y[1].required)&&(f.required=d),b&1&&f.value!==y[0]&&$e(f,y[0])},d(y){y&&k(e),y&&k(u),y&&k(f),h=!1,g()}}}function lT(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[sT,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function rT(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class oT extends Ne{constructor(e){super(),Ie(this,e,rT,lT,Pe,{field:1,value:0})}}function aT(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),f=_("input"),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","url"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(y,b){w(y,e,b),m(e,t),m(e,s),m(e,l),m(l,o),w(y,u,b),w(y,f,b),$e(f,n[0]),h||(g=X(f,"input",n[2]),h=!0)},p(y,b){b&2&&i!==(i=U.getFieldTypeIcon(y[1].type))&&p(t,"class",i),b&2&&r!==(r=y[1].name+"")&&_e(o,r),b&8&&a!==(a=y[3])&&p(e,"for",a),b&8&&c!==(c=y[3])&&p(f,"id",c),b&2&&d!==(d=y[1].required)&&(f.required=d),b&1&&$e(f,y[0])},d(y){y&&k(e),y&&k(u),y&&k(f),h=!1,g()}}}function uT(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[aT,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function fT(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class cT extends Ne{constructor(e){super(),Ie(this,e,fT,uT,Pe,{field:1,value:0})}}function dT(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h;function g(b){n[2](b)}let y={id:n[3],options:U.defaultFlatpickrOptions(),value:n[0]};return n[0]!==void 0&&(y.formattedValue=n[0]),c=new pf({props:y}),he.push(()=>Fe(c,"formattedValue",g)),{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),a=H(" (UTC)"),f=O(),B(c.$$.fragment),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",u=n[3])},m(b,v){w(b,e,v),m(e,t),m(e,s),m(e,l),m(l,o),m(l,a),w(b,f,v),V(c,b,v),h=!0},p(b,v){(!h||v&2&&i!==(i=U.getFieldTypeIcon(b[1].type)))&&p(t,"class",i),(!h||v&2)&&r!==(r=b[1].name+"")&&_e(o,r),(!h||v&8&&u!==(u=b[3]))&&p(e,"for",u);const S={};v&8&&(S.id=b[3]),v&1&&(S.value=b[0]),!d&&v&1&&(d=!0,S.formattedValue=b[0],Re(()=>d=!1)),c.$set(S)},i(b){h||(E(c.$$.fragment,b),h=!0)},o(b){F(c.$$.fragment,b),h=!1},d(b){b&&k(e),b&&k(f),z(c,b)}}}function pT(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[dT,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function hT(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(r){s=r,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},[s,i,l]}class mT extends Ne{constructor(e){super(),Ie(this,e,hT,pT,Pe,{field:1,value:0})}}function pm(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=H("Select up to "),s=H(i),l=H(" items."),p(e,"class","help-block")},m(r,o){w(r,e,o),m(e,t),m(e,s),m(e,l)},p(r,o){o&2&&i!==(i=r[1].options.maxSelect+"")&&_e(s,i)},d(r){r&&k(e)}}}function gT(n){var S,C,M;let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;function y($){n[3]($)}let b={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],items:(S=n[1].options)==null?void 0:S.values,searchable:((C=n[1].options)==null?void 0:C.values)>5};n[0]!==void 0&&(b.selected=n[0]),f=new Db({props:b}),he.push(()=>Fe(f,"selected",y));let v=((M=n[1].options)==null?void 0:M.maxSelect)>1&&pm(n);return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),B(f.$$.fragment),d=O(),v&&v.c(),h=rt(),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m($,T){w($,e,T),m(e,t),m(e,s),m(e,l),m(l,o),w($,u,T),V(f,$,T),w($,d,T),v&&v.m($,T),w($,h,T),g=!0},p($,T){var D,P,L;(!g||T&2&&i!==(i=U.getFieldTypeIcon($[1].type)))&&p(t,"class",i),(!g||T&2)&&r!==(r=$[1].name+"")&&_e(o,r),(!g||T&16&&a!==(a=$[4]))&&p(e,"for",a);const A={};T&16&&(A.id=$[4]),T&6&&(A.toggle=!$[1].required||$[2]),T&4&&(A.multiple=$[2]),T&2&&(A.items=(D=$[1].options)==null?void 0:D.values),T&2&&(A.searchable=((P=$[1].options)==null?void 0:P.values)>5),!c&&T&1&&(c=!0,A.selected=$[0],Re(()=>c=!1)),f.$set(A),((L=$[1].options)==null?void 0:L.maxSelect)>1?v?v.p($,T):(v=pm($),v.c(),v.m(h.parentNode,h)):v&&(v.d(1),v=null)},i($){g||(E(f.$$.fragment,$),g=!0)},o($){F(f.$$.fragment,$),g=!1},d($){$&&k(e),$&&k(u),z(f,$),$&&k(d),v&&v.d($),$&&k(h)}}}function _T(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[gT,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function bT(n,e,t){let i,{field:s=new kn}=e,{value:l=void 0}=e;function r(o){l=o,t(0,l),t(2,i),t(1,s)}return n.$$set=o=>{"field"in o&&t(1,s=o.field),"value"in o&&t(0,l=o.value)},n.$$.update=()=>{var o;n.$$.dirty&2&&t(2,i=((o=s.options)==null?void 0:o.maxSelect)>1),n.$$.dirty&5&&typeof l=="undefined"&&t(0,l=i?[]:null),n.$$.dirty&7&&i&&Array.isArray(l)&&l.length>s.options.maxSelect&&t(0,l=l.slice(l.length-s.options.maxSelect))},[l,s,i,r]}class yT extends Ne{constructor(e){super(),Ie(this,e,bT,_T,Pe,{field:1,value:0})}}function vT(n){let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),f=_("textarea"),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"class","txt-mono txt-sm")},m(y,b){w(y,e,b),m(e,t),m(e,s),m(e,l),m(l,o),w(y,u,b),w(y,f,b),$e(f,n[0]),h||(g=X(f,"input",n[2]),h=!0)},p(y,b){b&2&&i!==(i=U.getFieldTypeIcon(y[1].type))&&p(t,"class",i),b&2&&r!==(r=y[1].name+"")&&_e(o,r),b&8&&a!==(a=y[3])&&p(e,"for",a),b&8&&c!==(c=y[3])&&p(f,"id",c),b&2&&d!==(d=y[1].required)&&(f.required=d),b&1&&$e(f,y[0])},d(y){y&&k(e),y&&k(u),y&&k(f),h=!1,g()}}}function kT(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[vT,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function wT(n,e,t){let{field:i=new kn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=r=>{"field"in r&&t(1,i=r.field),"value"in r&&t(0,s=r.value)},n.$$.update=()=>{n.$$.dirty&1&&typeof s!="undefined"&&typeof s!="string"&&s!==null&&t(0,s=JSON.stringify(s,null,2))},[s,i,l]}class ST extends Ne{constructor(e){super(),Ie(this,e,wT,kT,Pe,{field:1,value:0})}}function CT(n){let e,t;return{c(){e=_("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,s){w(i,e,s)},p(i,s){s&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&k(e)}}}function MT(n){let e,t,i;return{c(){e=_("img"),Qn(e.src,t=n[2])||p(e,"src",t),p(e,"width",n[1]),p(e,"height",n[1]),p(e,"alt",i=n[0].name)},m(s,l){w(s,e,l)},p(s,l){l&4&&!Qn(e.src,t=s[2])&&p(e,"src",t),l&2&&p(e,"width",s[1]),l&2&&p(e,"height",s[1]),l&1&&i!==(i=s[0].name)&&p(e,"alt",i)},d(s){s&&k(e)}}}function $T(n){let e;function t(l,r){return l[2]?MT:CT}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,[r]){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function OT(n,e,t){let i,{file:s}=e,{size:l=50}=e;function r(){t(2,i=""),U.hasImageExtension(s==null?void 0:s.name)&&U.generateThumb(s,l,l).then(o=>{t(2,i=o)}).catch(o=>{console.warn("Unable to generate thumb: ",o)})}return n.$$set=o=>{"file"in o&&t(0,s=o.file),"size"in o&&t(1,l=o.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof s!="undefined"&&r()},t(2,i=""),[s,l,i]}class TT extends Ne{constructor(e){super(),Ie(this,e,OT,$T,Pe,{file:0,size:1})}}function DT(n){let e,t;return{c(){e=_("img"),Qn(e.src,t=n[2])||p(e,"src",t),p(e,"alt","Preview")},m(i,s){w(i,e,s)},p(i,s){s&4&&!Qn(e.src,t=i[2])&&p(e,"src",t)},d(i){i&&k(e)}}}function AT(n){let e,t,i=n[2].substring(n[2].lastIndexOf("/")+1)+"",s,l,r,o,a,u,f;return{c(){e=_("a"),t=H("/../"),s=H(i),l=O(),r=_("div"),o=O(),a=_("button"),a.textContent="Close",p(e,"href",n[2]),p(e,"class","link-hint txt-ellipsis"),p(r,"class","flex-fill"),p(a,"type","button"),p(a,"class","btn btn-secondary")},m(c,d){w(c,e,d),m(e,t),m(e,s),w(c,l,d),w(c,r,d),w(c,o,d),w(c,a,d),u||(f=X(a,"click",n[0]),u=!0)},p(c,d){d&4&&i!==(i=c[2].substring(c[2].lastIndexOf("/")+1)+"")&&_e(s,i),d&4&&p(e,"href",c[2])},d(c){c&&k(e),c&&k(l),c&&k(r),c&&k(o),c&&k(a),u=!1,f()}}}function ET(n){let e,t,i={class:"image-preview",popup:!0,$$slots:{footer:[AT],default:[DT]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[4](e),e.$on("show",n[5]),e.$on("hide",n[6]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const r={};l&132&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[4](null),z(e,s)}}}function PT(n,e,t){let i,s="";function l(f){f!==""&&U.checkImageUrl(f).then(()=>{t(2,s=f),i==null||i.show()}).catch(()=>{console.warn("Invalid image preview url: ",f),r()})}function r(){return i==null?void 0:i.hide()}function o(f){he[f?"unshift":"push"](()=>{i=f,t(1,i)})}function a(f){ut.call(this,n,f)}function u(f){ut.call(this,n,f)}return[r,i,s,l,o,a,u]}class LT extends Ne{constructor(e){super(),Ie(this,e,PT,ET,Pe,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function FT(n){let e;return{c(){e=_("i"),p(e,"class","ri-file-line")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function IT(n){let e,t,i,s;return{c(){e=_("img"),Qn(e.src,t=n[1])||p(e,"src",t),p(e,"alt",n[0])},m(l,r){w(l,e,r),i||(s=X(e,"error",n[2]),i=!0)},p(l,r){r&2&&!Qn(e.src,t=l[1])&&p(e,"src",t),r&1&&p(e,"alt",l[0])},d(l){l&&k(e),i=!1,s()}}}function NT(n){let e;function t(l,r){return l[1]?IT:FT}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,[r]){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function RT(n,e,t){let{record:i}=e,{filename:s}=e,l="";function r(){t(1,l="")}return n.$$set=o=>{"record"in o&&t(3,i=o.record),"filename"in o&&t(0,s=o.filename)},n.$$.update=()=>{n.$$.dirty&9&&U.hasImageExtension(s)&&t(1,l=Se.Records.getFileUrl(i,`${s}?thumb=100x100`))},[s,l,r,i]}class Lb extends Ne{constructor(e){super(),Ie(this,e,RT,NT,Pe,{record:3,filename:0})}}function hm(n,e,t){const i=n.slice();return i[25]=e[t],i[27]=t,i}function mm(n,e,t){const i=n.slice();return i[28]=e[t],i[27]=t,i}function jT(n){let e,t,i;function s(){return n[16](n[27])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-sm btn-circle btn-remove txt-hint")},m(l,r){w(l,e,r),t||(i=[Xe(St.call(null,e,"Remove file")),X(e,"click",s)],t=!0)},p(l,r){n=l},d(l){l&&k(e),t=!1,lt(i)}}}function HT(n){let e,t,i;function s(){return n[15](n[27])}return{c(){e=_("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(l,r){w(l,e,r),t||(i=X(e,"click",s),t=!0)},p(l,r){n=l},d(l){l&&k(e),t=!1,i()}}}function gm(n,e){let t,i,s,l,r,o,a,u=e[28]+"",f,c,d,h,g,y,b,v;s=new Lb({props:{record:e[2],filename:e[28]}});function S(){return e[14](e[28])}function C(T,A){return A&18&&(g=null),g==null&&(g=!!T[1].includes(T[27])),g?HT:jT}let M=C(e,-1),$=M(e);return{key:n,first:null,c(){t=_("div"),i=_("figute"),B(s.$$.fragment),r=O(),o=_("a"),a=H("/.../"),f=H(u),h=O(),$.c(),p(i,"class","thumb"),p(i,"title",l=U.hasImageExtension(e[28])?"Preview":""),ne(i,"fade",e[1].includes(e[27])),ne(i,"link-fade",U.hasImageExtension(e[28])),p(o,"href",c=Se.Records.getFileUrl(e[2],e[28])),p(o,"class","filename"),p(o,"title",d="Download "+e[28]),p(o,"target","_blank"),p(o,"rel","noopener"),p(o,"download",""),ne(o,"txt-strikethrough",e[1].includes(e[27])),p(t,"class","list-item"),this.first=t},m(T,A){w(T,t,A),m(t,i),V(s,i,null),m(t,r),m(t,o),m(o,a),m(o,f),m(t,h),$.m(t,null),y=!0,b||(v=X(i,"click",S),b=!0)},p(T,A){e=T;const D={};A&4&&(D.record=e[2]),A&16&&(D.filename=e[28]),s.$set(D),(!y||A&16&&l!==(l=U.hasImageExtension(e[28])?"Preview":""))&&p(i,"title",l),A&18&&ne(i,"fade",e[1].includes(e[27])),A&16&&ne(i,"link-fade",U.hasImageExtension(e[28])),(!y||A&16)&&u!==(u=e[28]+"")&&_e(f,u),(!y||A&20&&c!==(c=Se.Records.getFileUrl(e[2],e[28])))&&p(o,"href",c),(!y||A&16&&d!==(d="Download "+e[28]))&&p(o,"title",d),A&18&&ne(o,"txt-strikethrough",e[1].includes(e[27])),M===(M=C(e,A))&&$?$.p(e,A):($.d(1),$=M(e),$&&($.c(),$.m(t,null)))},i(T){y||(E(s.$$.fragment,T),y=!0)},o(T){F(s.$$.fragment,T),y=!1},d(T){T&&k(t),z(s),$.d(),b=!1,v()}}}function _m(n){let e,t,i,s,l,r,o,a,u=n[25].name+"",f,c,d,h,g,y,b,v;i=new TT({props:{file:n[25]}});function S(){return n[17](n[27])}return{c(){e=_("div"),t=_("figute"),B(i.$$.fragment),s=O(),l=_("div"),r=_("small"),r.textContent="New",o=O(),a=_("span"),f=H(u),d=O(),h=_("button"),h.innerHTML='',p(t,"class","thumb"),p(r,"class","label label-success m-r-5"),p(a,"class","txt"),p(l,"class","filename"),p(l,"title",c=n[25].name),p(h,"type","button"),p(h,"class","btn btn-secondary btn-sm btn-circle btn-remove"),p(e,"class","list-item")},m(C,M){w(C,e,M),m(e,t),V(i,t,null),m(e,s),m(e,l),m(l,r),m(l,o),m(l,a),m(a,f),m(e,d),m(e,h),y=!0,b||(v=[Xe(g=St.call(null,h,"Remove file")),X(h,"click",S)],b=!0)},p(C,M){n=C;const $={};M&1&&($.file=n[25]),i.$set($),(!y||M&1)&&u!==(u=n[25].name+"")&&_e(f,u),(!y||M&1&&c!==(c=n[25].name))&&p(l,"title",c)},i(C){y||(E(i.$$.fragment,C),y=!0)},o(C){F(i.$$.fragment,C),y=!1},d(C){C&&k(e),z(i),b=!1,lt(v)}}}function bm(n){let e,t,i,s,l,r;return{c(){e=_("div"),t=_("input"),i=O(),s=_("button"),s.innerHTML=` + Upload new file`,p(t,"type","file"),p(t,"class","hidden"),t.multiple=n[5],p(s,"type","button"),p(s,"class","btn btn-secondary btn-sm btn-block"),p(e,"class","list-item btn-list-item")},m(o,a){w(o,e,a),m(e,t),n[18](t),m(e,i),m(e,s),l||(r=[X(t,"change",n[19]),X(s,"click",n[20])],l=!0)},p(o,a){a&32&&(t.multiple=o[5])},d(o){o&&k(e),n[18](null),l=!1,lt(r)}}}function qT(n){let e,t,i,s,l,r=n[3].name+"",o,a,u,f,c=[],d=new Map,h,g,y,b=n[4];const v=T=>T[28];for(let T=0;TF(C[T],1,1,()=>{C[T]=null});let $=!n[9]&&bm(n);return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),f=_("div");for(let T=0;T({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}});let l={};return i=new LT({props:l}),n[22](i),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(r,o){V(e,r,o),w(r,t,o),V(i,r,o),s=!0},p(r,[o]){const a={};o&8&&(a.class="form-field form-field-file "+(r[3].required?"required":"")),o&8&&(a.name=r[3].name),o&1090520063&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};i.$set(u)},i(r){s||(E(e.$$.fragment,r),E(i.$$.fragment,r),s=!0)},o(r){F(e.$$.fragment,r),F(i.$$.fragment,r),s=!1},d(r){z(e,r),r&&k(t),n[22](null),z(i,r)}}}function zT(n,e,t){let i,s,l,{record:r}=e,{value:o=null}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new kn}=e,c,d,h;function g(N){U.removeByValue(u,N),t(1,u)}function y(N){U.pushUnique(u,N),t(1,u)}function b(N){U.isEmpty(a[N])||a.splice(N,1),t(0,a)}function v(){h==null||h.dispatchEvent(new CustomEvent("change",{detail:{value:o,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const S=N=>U.hasImageExtension(N)?d==null?void 0:d.show(Se.Records.getFileUrl(r,N)):!1,C=N=>g(N),M=N=>y(N),$=N=>b(N);function T(N){he[N?"unshift":"push"](()=>{c=N,t(6,c)})}const A=()=>{for(let N of c.files)a.push(N);t(0,a),t(6,c.value=null,c)},D=()=>c==null?void 0:c.click();function P(N){he[N?"unshift":"push"](()=>{h=N,t(8,h)})}function L(N){he[N?"unshift":"push"](()=>{d=N,t(7,d)})}return n.$$set=N=>{"record"in N&&t(2,r=N.record),"value"in N&&t(13,o=N.value),"uploadedFiles"in N&&t(0,a=N.uploadedFiles),"deletedFileIndexes"in N&&t(1,u=N.deletedFileIndexes),"field"in N&&t(3,f=N.field)},n.$$.update=()=>{var N,R;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=U.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=U.toArray(u))),n.$$.dirty&8&&t(5,i=((N=f.options)==null?void 0:N.maxSelect)>1),n.$$.dirty&8224&&(typeof o=="undefined"||o===null)&&t(13,o=i?[]:null),n.$$.dirty&8192&&t(4,s=U.toArray(o)),n.$$.dirty&27&&t(9,l=(s.length||a.length)&&((R=f.options)==null?void 0:R.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&v()},[a,u,r,f,s,i,c,d,h,l,g,y,b,o,S,C,M,$,T,A,D,P,L]}class BT extends Ne{constructor(e){super(),Ie(this,e,zT,VT,Pe,{record:2,value:13,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function ym(n){let e,t;return{c(){e=_("small"),t=H(n[1]),p(e,"class","block txt-hint txt-ellipsis")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s&2&&_e(t,i[1])},d(i){i&&k(e)}}}function UT(n){let e,t,i,s,l,r=n[0].id+"",o,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&ym(n);return{c(){e=_("i"),i=O(),s=_("div"),l=_("div"),o=H(r),a=O(),c&&c.c(),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(s,"class","content svelte-1gjwqyd")},m(d,h){w(d,e,h),w(d,i,h),w(d,s,h),m(s,l),m(l,o),m(s,a),c&&c.m(s,null),u||(f=Xe(t=St.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[h]){t&&Kn(t.update)&&h&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),h&1&&r!==(r=d[0].id+"")&&_e(o,r),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,h):(c=ym(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:re,o:re,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function WT(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function r(o){o=o||{};const a=["name","title","label","key","email","heading","content",...Object.keys(o)];for(const u of a)if(typeof o[u]=="string"&&!U.isEmpty(o[u])&&!s.includes(u))return u+": "+o[u];return""}return n.$$set=o=>{"item"in o&&t(0,l=o.item)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=r(l))},[l,i]}class YT extends Ne{constructor(e){super(),Ie(this,e,WT,UT,Pe,{item:0})}}function vm(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',p(e,"type","button"),p(e,"class","btn btn-block btn-sm"),ne(e,"btn-loading",n[6]),ne(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=X(e,"click",Bn(n[14])),t=!0)},p(s,l){l&64&&ne(e,"btn-loading",s[6]),l&64&&ne(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function KT(n){let e,t=n[7]&&vm(n);return{c(){t&&t.c(),e=rt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=vm(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function JT(n){let e,t,i,s;const l=[{selectPlaceholder:n[8]?"Loading...":n[3]},{items:n[5]},{searchable:n[5].length>5},{selectionKey:"id"},{labelComponent:n[4]},{optionComponent:n[4]},{multiple:n[2]},{class:"records-select block-options"},n[10]];function r(u){n[15](u)}function o(u){n[16](u)}let a={$$slots:{afterOptions:[KT]},$$scope:{ctx:n}};for(let u=0;uFe(e,"keyOfSelected",r)),he.push(()=>Fe(e,"selected",o)),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){B(e.$$.fragment)},m(u,f){V(e,u,f),s=!0},p(u,[f]){const c=f&1340?gn(l,[f&264&&{selectPlaceholder:u[8]?"Loading...":u[3]},f&32&&{items:u[5]},f&32&&{searchable:u[5].length>5},l[3],f&16&&{labelComponent:u[4]},f&16&&{optionComponent:u[4]},f&4&&{multiple:u[2]},l[7],f&1024&&pi(u[10])]):{};f&4194496&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],Re(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],Re(()=>i=!1)),e.$set(c)},i(u){s||(E(e.$$.fragment,u),s=!0)},o(u){F(e.$$.fragment,u),s=!1},d(u){z(e,u)}}}function xT(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent","collectionId"];let r=Yt(e,l);const o="select_"+U.randomString(5);let{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{keyOfSelected:f=a?[]:void 0}=e,{selectPlaceholder:c="- Select -"}=e,{optionComponent:d=YT}=e,{collectionId:h}=e,g=[],y=1,b=0,v=!1,S=!1;C();async function C(){const L=U.toArray(f);if(!(!h||!L.length)){t(13,S=!0);try{const N=[];for(const R of L)N.push(`id="${R}"`);t(0,u=await Se.Records.getFullList(h,200,{sort:"-created",filter:N.join("||"),$cancelKey:o+"loadSelected"})),t(5,g=U.filterDuplicatesByKey(g.concat(u)))}catch(N){Se.errorResponseHandler(N)}t(13,S=!1)}}async function M(L=!1){if(!!h){t(6,v=!0);try{const N=L?1:y+1,R=await Se.Records.getList(h,N,200,{sort:"-created",$cancelKey:o+"loadList"});L&&t(5,g=[]),t(5,g=U.filterDuplicatesByKey(g.concat(R.items))),y=R.page,t(12,b=R.totalItems)}catch(N){Se.errorResponseHandler(N)}t(6,v=!1)}}const $=()=>M();function T(L){f=L,t(1,f)}function A(L){u=L,t(0,u)}function D(L){ut.call(this,n,L)}function P(L){ut.call(this,n,L)}return n.$$set=L=>{e=ct(ct({},e),ci(L)),t(10,r=Yt(e,l)),"multiple"in L&&t(2,a=L.multiple),"selected"in L&&t(0,u=L.selected),"keyOfSelected"in L&&t(1,f=L.keyOfSelected),"selectPlaceholder"in L&&t(3,c=L.selectPlaceholder),"optionComponent"in L&&t(4,d=L.optionComponent),"collectionId"in L&&t(11,h=L.collectionId)},n.$$.update=()=>{n.$$.dirty&2048&&h&&M(),n.$$.dirty&8256&&t(8,i=v||S),n.$$.dirty&4128&&t(7,s=b>g.length)},[u,f,a,c,d,g,v,s,i,M,r,h,b,S,$,T,A,D,P]}class GT extends Ne{constructor(e){super(),Ie(this,e,xT,JT,Pe,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4,collectionId:11})}}function km(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=H("Select up to "),s=H(i),l=H(" items."),p(e,"class","help-block")},m(r,o){w(r,e,o),m(e,t),m(e,s),m(e,l)},p(r,o){o&2&&i!==(i=r[1].options.maxSelect+"")&&_e(s,i)},d(r){r&&k(e)}}}function ZT(n){var S,C;let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;function y(M){n[3](M)}let b={toggle:!0,id:n[4],multiple:n[2],collectionId:(S=n[1].options)==null?void 0:S.collectionId};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new GT({props:b}),he.push(()=>Fe(f,"keyOfSelected",y));let v=((C=n[1].options)==null?void 0:C.maxSelect)>1&&km(n);return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),B(f.$$.fragment),d=O(),v&&v.c(),h=rt(),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m(M,$){w(M,e,$),m(e,t),m(e,s),m(e,l),m(l,o),w(M,u,$),V(f,M,$),w(M,d,$),v&&v.m(M,$),w(M,h,$),g=!0},p(M,$){var A,D;(!g||$&2&&i!==(i=U.getFieldTypeIcon(M[1].type)))&&p(t,"class",i),(!g||$&2)&&r!==(r=M[1].name+"")&&_e(o,r),(!g||$&16&&a!==(a=M[4]))&&p(e,"for",a);const T={};$&16&&(T.id=M[4]),$&4&&(T.multiple=M[2]),$&2&&(T.collectionId=(A=M[1].options)==null?void 0:A.collectionId),!c&&$&1&&(c=!0,T.keyOfSelected=M[0],Re(()=>c=!1)),f.$set(T),((D=M[1].options)==null?void 0:D.maxSelect)>1?v?v.p(M,$):(v=km(M),v.c(),v.m(h.parentNode,h)):v&&(v.d(1),v=null)},i(M){g||(E(f.$$.fragment,M),g=!0)},o(M){F(f.$$.fragment,M),g=!1},d(M){M&&k(e),M&&k(u),z(f,M),M&&k(d),v&&v.d(M),M&&k(h)}}}function XT(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[ZT,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function QT(n,e,t){let i,{field:s=new kn}=e,{value:l=void 0}=e;function r(o){l=o,t(0,l),t(2,i),t(1,s)}return n.$$set=o=>{"field"in o&&t(1,s=o.field),"value"in o&&t(0,l=o.value)},n.$$.update=()=>{var o;n.$$.dirty&2&&t(2,i=((o=s.options)==null?void 0:o.maxSelect)>1),n.$$.dirty&7&&i&&Array.isArray(l)&&l.length>s.options.maxSelect&&t(0,l=l.slice(s.options.maxSelect-1))},[l,s,i,r]}class eD extends Ne{constructor(e){super(),Ie(this,e,QT,XT,Pe,{field:1,value:0})}}function tD(n){let e,t,i,s,l,r=n[0].id+"",o,a,u,f=n[0].email+"",c,d,h;return{c(){e=_("i"),i=O(),s=_("div"),l=_("div"),o=H(r),a=O(),u=_("small"),c=H(f),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(u,"class","block txt-hint txt-ellipsis"),p(s,"class","content")},m(g,y){w(g,e,y),w(g,i,y),w(g,s,y),m(s,l),m(l,o),m(s,a),m(s,u),m(u,c),d||(h=Xe(t=St.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),d=!0)},p(g,[y]){t&&Kn(t.update)&&y&1&&t.update.call(null,{text:JSON.stringify(g[0],null,2),position:"left",class:"code"}),y&1&&r!==(r=g[0].id+"")&&_e(o,r),y&1&&f!==(f=g[0].email+"")&&_e(c,f)},i:re,o:re,d(g){g&&k(e),g&&k(i),g&&k(s),d=!1,h()}}}function nD(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class mu extends Ne{constructor(e){super(),Ie(this,e,nD,tD,Pe,{item:0})}}function wm(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',p(e,"type","button"),p(e,"class","btn btn-block btn-sm"),ne(e,"btn-loading",n[6]),ne(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=X(e,"click",Bn(n[13])),t=!0)},p(s,l){l&64&&ne(e,"btn-loading",s[6]),l&64&&ne(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function iD(n){let e,t=n[7]&&wm(n);return{c(){t&&t.c(),e=rt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=wm(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function sD(n){let e,t,i,s;const l=[{selectPlaceholder:n[8]?"Loading...":n[3]},{items:n[5]},{searchable:n[5].length>5},{selectionKey:"id"},{labelComponent:mu},{optionComponent:n[4]},{multiple:n[2]},{class:"users-select block-options"},n[10]];function r(u){n[14](u)}function o(u){n[15](u)}let a={$$slots:{afterOptions:[iD]},$$scope:{ctx:n}};for(let u=0;uFe(e,"keyOfSelected",r)),he.push(()=>Fe(e,"selected",o)),e.$on("show",n[16]),e.$on("hide",n[17]),{c(){B(e.$$.fragment)},m(u,f){V(e,u,f),s=!0},p(u,[f]){const c=f&1340?gn(l,[f&264&&{selectPlaceholder:u[8]?"Loading...":u[3]},f&32&&{items:u[5]},f&32&&{searchable:u[5].length>5},l[3],f&0&&{labelComponent:mu},f&16&&{optionComponent:u[4]},f&4&&{multiple:u[2]},l[7],f&1024&&pi(u[10])]):{};f&2097344&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],Re(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],Re(()=>i=!1)),e.$set(c)},i(u){s||(E(e.$$.fragment,u),s=!0)},o(u){F(e.$$.fragment,u),s=!1},d(u){z(e,u)}}}function lD(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent"];let r=Yt(e,l);const o="select_"+U.randomString(5);let{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{keyOfSelected:f=a?[]:void 0}=e,{selectPlaceholder:c="- Select -"}=e,{optionComponent:d=mu}=e,h=[],g=1,y=0,b=!1,v=!1;C(),S();async function S(){const P=U.toArray(f);if(!!P.length){t(12,v=!0);try{const L=[];for(const N of P)L.push(`id="${N}"`);t(0,u=await Se.Users.getFullList(100,{sort:"-created",filter:L.join("||"),$cancelKey:o+"loadSelected"})),t(5,h=U.filterDuplicatesByKey(h.concat(u)))}catch(L){Se.errorResponseHandler(L)}t(12,v=!1)}}async function C(P=!1){t(6,b=!0);try{const L=P?1:g+1,N=await Se.Users.getList(L,200,{sort:"-created",$cancelKey:o+"loadList"});P&&t(5,h=[]),t(5,h=U.filterDuplicatesByKey(h.concat(N.items))),g=N.page,t(11,y=N.totalItems)}catch(L){Se.errorResponseHandler(L)}t(6,b=!1)}const M=()=>C();function $(P){f=P,t(1,f)}function T(P){u=P,t(0,u)}function A(P){ut.call(this,n,P)}function D(P){ut.call(this,n,P)}return n.$$set=P=>{e=ct(ct({},e),ci(P)),t(10,r=Yt(e,l)),"multiple"in P&&t(2,a=P.multiple),"selected"in P&&t(0,u=P.selected),"keyOfSelected"in P&&t(1,f=P.keyOfSelected),"selectPlaceholder"in P&&t(3,c=P.selectPlaceholder),"optionComponent"in P&&t(4,d=P.optionComponent)},n.$$.update=()=>{n.$$.dirty&4160&&t(8,i=b||v),n.$$.dirty&2080&&t(7,s=y>h.length)},[u,f,a,c,d,h,b,s,i,C,r,y,v,M,$,T,A,D]}class rD extends Ne{constructor(e){super(),Ie(this,e,lD,sD,Pe,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4})}}function Sm(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=H("Select up to "),s=H(i),l=H(" users."),p(e,"class","help-block")},m(r,o){w(r,e,o),m(e,t),m(e,s),m(e,l)},p(r,o){o&2&&i!==(i=r[1].options.maxSelect+"")&&_e(s,i)},d(r){r&&k(e)}}}function oD(n){var S;let e,t,i,s,l,r=n[1].name+"",o,a,u,f,c,d,h,g;function y(C){n[4](C)}let b={toggle:!0,id:n[5],multiple:n[2],disabled:n[3]};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new rD({props:b}),he.push(()=>Fe(f,"keyOfSelected",y));let v=((S=n[1].options)==null?void 0:S.maxSelect)>1&&Sm(n);return{c(){e=_("label"),t=_("i"),s=O(),l=_("span"),o=H(r),u=O(),B(f.$$.fragment),d=O(),v&&v.c(),h=rt(),p(t,"class",i=U.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[5])},m(C,M){w(C,e,M),m(e,t),m(e,s),m(e,l),m(l,o),w(C,u,M),V(f,C,M),w(C,d,M),v&&v.m(C,M),w(C,h,M),g=!0},p(C,M){var T;(!g||M&2&&i!==(i=U.getFieldTypeIcon(C[1].type)))&&p(t,"class",i),(!g||M&2)&&r!==(r=C[1].name+"")&&_e(o,r),(!g||M&32&&a!==(a=C[5]))&&p(e,"for",a);const $={};M&32&&($.id=C[5]),M&4&&($.multiple=C[2]),M&8&&($.disabled=C[3]),!c&&M&1&&(c=!0,$.keyOfSelected=C[0],Re(()=>c=!1)),f.$set($),((T=C[1].options)==null?void 0:T.maxSelect)>1?v?v.p(C,M):(v=Sm(C),v.c(),v.m(h.parentNode,h)):v&&(v.d(1),v=null)},i(C){g||(E(f.$$.fragment,C),g=!0)},o(C){F(f.$$.fragment,C),g=!1},d(C){C&&k(e),C&&k(u),z(f,C),C&&k(d),v&&v.d(C),C&&k(h)}}}function aD(n){let e,t;return e=new He({props:{class:"form-field "+(n[1].required?"required":"")+" "+(n[3]?"disabled":""),name:n[1].name,$$slots:{default:[oD,({uniqueId:i})=>({5:i}),({uniqueId:i})=>i?32:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&10&&(l.class="form-field "+(i[1].required?"required":"")+" "+(i[3]?"disabled":"")),s&2&&(l.name=i[1].name),s&111&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function uD(n,e,t){let i,s,{field:l=new kn}=e,{value:r=void 0}=e;function o(a){r=a,t(0,r),t(2,s),t(1,l)}return n.$$set=a=>{"field"in a&&t(1,l=a.field),"value"in a&&t(0,r=a.value)},n.$$.update=()=>{var a;n.$$.dirty&2&&t(2,s=((a=l.options)==null?void 0:a.maxSelect)>1),n.$$.dirty&7&&s&&Array.isArray(r)&&r.length>l.options.maxSelect&&t(0,r=r.slice(l.options.maxSelect-1)),n.$$.dirty&3&&t(3,i=!U.isEmpty(r)&&l.system)},[r,l,s,i,o]}class fD extends Ne{constructor(e){super(),Ie(this,e,uD,aD,Pe,{field:1,value:0})}}function Cm(n,e,t){const i=n.slice();return i[40]=e[t],i[41]=e,i[42]=t,i}function Mm(n){let e,t;return e=new He({props:{class:"form-field disabled",name:"id",$$slots:{default:[cD,({uniqueId:i})=>({43:i}),({uniqueId:i})=>[0,i?4096:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&4|s[1]&12288&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function cD(n){let e,t,i,s,l,r,o,a,u,f,c;return{c(){e=_("label"),t=_("i"),i=O(),s=_("span"),s.textContent="id",l=O(),r=_("span"),a=O(),u=_("input"),p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(r,"class","flex-fill"),p(e,"for",o=n[43]),p(u,"type","text"),p(u,"id",f=n[43]),u.value=c=n[2].id,u.disabled=!0},m(d,h){w(d,e,h),m(e,t),m(e,i),m(e,s),m(e,l),m(e,r),w(d,a,h),w(d,u,h)},p(d,h){h[1]&4096&&o!==(o=d[43])&&p(e,"for",o),h[1]&4096&&f!==(f=d[43])&&p(u,"id",f),h[0]&4&&c!==(c=d[2].id)&&u.value!==c&&(u.value=c)},d(d){d&&k(e),d&&k(a),d&&k(u)}}}function $m(n){let e;return{c(){e=_("div"),e.innerHTML=`
No custom fields to be set
+ `,p(e,"class","block txt-center txt-disabled")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function dD(n){let e,t,i;function s(r){n[31](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new fD({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function pD(n){let e,t,i;function s(r){n[30](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new eD({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function hD(n){let e,t,i,s,l;function r(f){n[27](f,n[40])}function o(f){n[28](f,n[40])}function a(f){n[29](f,n[40])}let u={field:n[40],record:n[2]};return n[2][n[40].name]!==void 0&&(u.value=n[2][n[40].name]),n[3][n[40].name]!==void 0&&(u.uploadedFiles=n[3][n[40].name]),n[4][n[40].name]!==void 0&&(u.deletedFileIndexes=n[4][n[40].name]),e=new BT({props:u}),he.push(()=>Fe(e,"value",r)),he.push(()=>Fe(e,"uploadedFiles",o)),he.push(()=>Fe(e,"deletedFileIndexes",a)),{c(){B(e.$$.fragment)},m(f,c){V(e,f,c),l=!0},p(f,c){n=f;const d={};c[0]&1&&(d.field=n[40]),c[0]&4&&(d.record=n[2]),!t&&c[0]&5&&(t=!0,d.value=n[2][n[40].name],Re(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[40].name],Re(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[40].name],Re(()=>s=!1)),e.$set(d)},i(f){l||(E(e.$$.fragment,f),l=!0)},o(f){F(e.$$.fragment,f),l=!1},d(f){z(e,f)}}}function mD(n){let e,t,i;function s(r){n[26](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new ST({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function gD(n){let e,t,i;function s(r){n[25](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new yT({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function _D(n){let e,t,i;function s(r){n[24](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new mT({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function bD(n){let e,t,i;function s(r){n[23](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new cT({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function yD(n){let e,t,i;function s(r){n[22](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new oT({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function vD(n){let e,t,i;function s(r){n[21](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new iT({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function kD(n){let e,t,i;function s(r){n[20](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new QO({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function wD(n){let e,t,i;function s(r){n[19](r,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new xO({props:l}),he.push(()=>Fe(e,"value",s)),{c(){B(e.$$.fragment)},m(r,o){V(e,r,o),i=!0},p(r,o){n=r;const a={};o[0]&1&&(a.field=n[40]),!t&&o[0]&5&&(t=!0,a.value=n[2][n[40].name],Re(()=>t=!1)),e.$set(a)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){F(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function Om(n,e){let t,i,s,l,r;const o=[wD,kD,vD,yD,bD,_D,gD,mD,hD,pD,dD],a=[];function u(f,c){return f[40].type==="text"?0:f[40].type==="number"?1:f[40].type==="bool"?2:f[40].type==="email"?3:f[40].type==="url"?4:f[40].type==="date"?5:f[40].type==="select"?6:f[40].type==="json"?7:f[40].type==="file"?8:f[40].type==="relation"?9:f[40].type==="user"?10:-1}return~(i=u(e))&&(s=a[i]=o[i](e)),{key:n,first:null,c(){t=rt(),s&&s.c(),l=rt(),this.first=t},m(f,c){w(f,t,c),~i&&a[i].m(f,c),w(f,l,c),r=!0},p(f,c){e=f;let d=i;i=u(e),i===d?~i&&a[i].p(e,c):(s&&(Te(),F(a[d],1,1,()=>{a[d]=null}),De()),~i?(s=a[i],s?s.p(e,c):(s=a[i]=o[i](e),s.c()),E(s,1),s.m(l.parentNode,l)):s=null)},i(f){r||(E(s),r=!0)},o(f){F(s),r=!1},d(f){f&&k(t),~i&&a[i].d(f),f&&k(l)}}}function SD(n){var d;let e,t,i=[],s=new Map,l,r,o,a=!n[2].isNew&&Mm(n),u=((d=n[0])==null?void 0:d.schema)||[];const f=h=>h[40].name;for(let h=0;h{a=null}),De()):a?(a.p(h,g),g[0]&4&&E(a,1)):(a=Mm(h),a.c(),E(a,1),a.m(e,t)),g[0]&29&&(u=((y=h[0])==null?void 0:y.schema)||[],Te(),i=ot(i,g,f,1,h,u,s,e,Lt,Om,null,Cm),De(),!u.length&&c?c.p(h,g):u.length?c&&(c.d(1),c=null):(c=$m(),c.c(),c.m(e,null)))},i(h){if(!l){E(a);for(let g=0;g + Delete`,p(e,"tabindex","0"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function MD(n){let e,t=n[2].isNew?"New":"Edit",i,s,l=n[0].name+"",r,o,a,u,f,c=!n[2].isNew&&n[9]&&Tm(n);return{c(){e=_("h4"),i=H(t),s=O(),r=H(l),o=H(" record"),a=O(),c&&c.c(),u=rt()},m(d,h){w(d,e,h),m(e,i),m(e,s),m(e,r),m(e,o),w(d,a,h),c&&c.m(d,h),w(d,u,h),f=!0},p(d,h){(!f||h[0]&4)&&t!==(t=d[2].isNew?"New":"Edit")&&_e(i,t),(!f||h[0]&1)&&l!==(l=d[0].name+"")&&_e(r,l),!d[2].isNew&&d[9]?c?(c.p(d,h),h[0]&516&&E(c,1)):(c=Tm(d),c.c(),E(c,1),c.m(u.parentNode,u)):c&&(Te(),F(c,1,1,()=>{c=null}),De())},i(d){f||(E(c),f=!0)},o(d){F(c),f=!1},d(d){d&&k(e),d&&k(a),c&&c.d(d),d&&k(u)}}}function $D(n){let e,t,i,s,l,r=n[2].isNew?"Create":"Save changes",o,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=O(),s=_("button"),l=_("span"),o=H(r),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[11]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ne(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,o),u||(f=X(e,"click",n[17]),u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&r!==(r=c[2].isNew?"Create":"Save changes")&&_e(o,r),d[0]&1152&&a!==(a=!c[10]||c[7])&&(s.disabled=a),d[0]&128&&ne(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,f()}}}function OD(n){let e,t,i={class:"overlay-panel-lg record-panel",beforeHide:n[32],$$slots:{footer:[$D],header:[MD],default:[SD]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const r={};l[0]&288&&(r.beforeHide=s[32]),l[0]&1693|l[1]&8192&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[33](null),z(e,s)}}}function Dm(n){return JSON.stringify(n)}function TD(n,e,t){let i,s,l,r;const o=vn(),a="record_"+U.randomString(5);let{collection:u}=e,f,c=null,d=new Xr,h=!1,g=!1,y={},b={},v="";function S(ue){return M(ue),t(8,g=!0),f==null?void 0:f.show()}function C(){return f==null?void 0:f.hide()}function M(ue){Wi({}),c=ue||{},t(2,d=ue!=null&&ue.clone?ue.clone():new Xr),t(3,y={}),t(4,b={}),t(15,v=Dm(d))}function $(){if(h||!s)return;t(7,h=!0);const ue=A();let ie;d.isNew?ie=Se.Records.create(u==null?void 0:u.id,ue):ie=Se.Records.update(u==null?void 0:u.id,d.id,ue),ie.then(async ve=>{hn(d.isNew?"Successfully created record.":"Successfully updated record."),t(8,g=!1),C(),o("save",ve)}).catch(ve=>{Se.errorResponseHandler(ve)}).finally(()=>{t(7,h=!1)})}function T(){!(c!=null&&c.id)||Mi("Do you really want to delete the selected record?",()=>Se.Records.delete(c["@collectionId"],c.id).then(()=>{C(),hn("Successfully deleted record."),o("delete",c)}).catch(ue=>{Se.errorResponseHandler(ue)}))}function A(){const ue=(d==null?void 0:d.export())||{},ie=new FormData,ve={};for(const je of(u==null?void 0:u.schema)||[])ve[je.name]=je;for(const je in ue)!ve[je]||(typeof ue[je]=="undefined"&&(ue[je]=null),U.addValueToFormData(ie,je,ue[je]));for(const je in y){const Le=U.toArray(y[je]);for(const qe of Le)ie.append(je,qe)}for(const je in b){const Le=U.toArray(b[je]);for(const qe of Le)ie.append(je+"."+qe,"")}return ie}const D=()=>C(),P=()=>T();function L(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function N(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function R(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function J(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function W(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function q(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function x(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function K(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function Y(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function te(ue,ie){n.$$.not_equal(y[ie.name],ue)&&(y[ie.name]=ue,t(3,y))}function fe(ue,ie){n.$$.not_equal(b[ie.name],ue)&&(b[ie.name]=ue,t(4,b))}function ye(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}function se(ue,ie){n.$$.not_equal(d[ie.name],ue)&&(d[ie.name]=ue,t(2,d))}const G=()=>s&&g?(Mi("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,g=!1),C()}),!1):!0;function Oe(ue){he[ue?"unshift":"push"](()=>{f=ue,t(6,f)})}function ee(ue){ut.call(this,n,ue)}function be(ue){ut.call(this,n,ue)}return n.$$set=ue=>{"collection"in ue&&t(0,u=ue.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(16,i=U.hasNonEmptyProps(y)||U.hasNonEmptyProps(b)),n.$$.dirty[0]&98308&&t(5,s=i||v!=Dm(d)),n.$$.dirty[0]&36&&t(10,l=d.isNew||s),n.$$.dirty[0]&1&&t(9,r=(u==null?void 0:u.name)!=="profiles")},[u,C,d,y,b,s,f,h,g,r,l,a,$,T,S,v,i,D,P,L,N,R,J,W,q,x,K,Y,te,fe,ye,se,G,Oe,ee,be]}class Fb extends Ne{constructor(e){super(),Ie(this,e,TD,OD,Pe,{collection:0,show:14,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[1]}}function DD(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function AD(n){let e,t;return{c(){e=_("span"),t=H(n[1]),p(e,"class","label txt-base txt-mono"),p(e,"title",n[0])},m(i,s){w(i,e,s),m(e,t)},p(i,s){s&2&&_e(t,i[1]),s&1&&p(e,"title",i[0])},d(i){i&&k(e)}}}function ED(n){let e;function t(l,r){return l[0]?AD:DD}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,[r]){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function PD(n,e,t){let{id:i=""}=e,s=i;return n.$$set=l=>{"id"in l&&t(0,i=l.id)},n.$$.update=()=>{n.$$.dirty&1&&typeof i=="string"&&i.length>27&&t(1,s=i.substring(0,5)+"..."+i.substring(i.length-10))},[i,s]}class Io extends Ne{constructor(e){super(),Ie(this,e,PD,ED,Pe,{id:0})}}function Am(n,e,t){const i=n.slice();return i[8]=e[t],i}function Em(n,e,t){const i=n.slice();return i[3]=e[t],i}function Pm(n,e,t){const i=n.slice();return i[3]=e[t],i}function LD(n){let e,t=n[0][n[1].name]+"",i,s;return{c(){e=_("span"),i=H(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=n[0][n[1].name])},m(l,r){w(l,e,r),m(e,i)},p(l,r){r&3&&t!==(t=l[0][l[1].name]+"")&&_e(i,t),r&3&&s!==(s=l[0][l[1].name])&&p(e,"title",s)},i:re,o:re,d(l){l&&k(e)}}}function FD(n){let e,t,i=U.toArray(n[0][n[1].name]),s=[];for(let r=0;rF(s[r],1,1,()=>{s[r]=null});return{c(){e=_("div");for(let r=0;rF(s[r],1,1,()=>{s[r]=null});return{c(){e=_("div");for(let r=0;r{a[d]=null}),De(),s=a[i],s?s.p(f,c):(s=a[i]=o[i](f),s.c()),E(s,1),s.m(e,null)),(!r||c&2&&l!==(l="col-type-"+f[1].type+" col-field-"+f[1].name))&&p(e,"class",l)},i(f){r||(E(s),r=!0)},o(f){F(s),r=!1},d(f){f&&k(e),a[i].d()}}}function BD(n,e,t){let{record:i}=e,{field:s}=e;function l(r){ut.call(this,n,r)}return n.$$set=r=>{"record"in r&&t(0,i=r.record),"field"in r&&t(1,s=r.field)},[i,s,l]}class Ib extends Ne{constructor(e){super(),Ie(this,e,BD,zD,Pe,{record:0,field:1})}}function Nm(n,e,t){const i=n.slice();return i[35]=e[t],i}function Rm(n,e,t){const i=n.slice();return i[38]=e[t],i}function jm(n,e,t){const i=n.slice();return i[38]=e[t],i}function UD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="id",p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function WD(n){let e,t,i,s,l,r=n[38].name+"",o;return{c(){e=_("div"),t=_("i"),s=O(),l=_("span"),o=H(r),p(t,"class",i=U.getFieldTypeIcon(n[38].type)),p(l,"class","txt"),p(e,"class","col-header-content")},m(a,u){w(a,e,u),m(e,t),m(e,s),m(e,l),m(l,o)},p(a,u){u[0]&2048&&i!==(i=U.getFieldTypeIcon(a[38].type))&&p(t,"class",i),u[0]&2048&&r!==(r=a[38].name+"")&&_e(o,r)},d(a){a&&k(e)}}}function Hm(n,e){let t,i,s,l;function r(a){e[22](a)}let o={class:"col-type-"+e[38].type+" col-field-"+e[38].name,name:e[38].name,$$slots:{default:[WD]},$$scope:{ctx:e}};return e[0]!==void 0&&(o.sort=e[0]),i=new en({props:o}),he.push(()=>Fe(i,"sort",r)),{key:n,first:null,c(){t=rt(),B(i.$$.fragment),this.first=t},m(a,u){w(a,t,u),V(i,a,u),l=!0},p(a,u){e=a;const f={};u[0]&2048&&(f.class="col-type-"+e[38].type+" col-field-"+e[38].name),u[0]&2048&&(f.name=e[38].name),u[0]&2048|u[1]&4096&&(f.$$scope={dirty:u,ctx:e}),!s&&u[0]&1&&(s=!0,f.sort=e[0],Re(()=>s=!1)),i.$set(f)},i(a){l||(E(i.$$.fragment,a),l=!0)},o(a){F(i.$$.fragment,a),l=!1},d(a){a&&k(t),z(i,a)}}}function YD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function KD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="updated",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function qm(n){let e;function t(l,r){return l[8]?xD:JD}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,r){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function JD(n){var o;let e,t,i,s,l,r=((o=n[1])==null?void 0:o.length)&&Vm(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No records found.",s=O(),r&&r.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),r&&r.m(t,null),m(e,l)},p(a,u){var f;(f=a[1])!=null&&f.length?r?r.p(a,u):(r=Vm(a),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(a){a&&k(e),r&&r.d()}}}function xD(n){let e;return{c(){e=_("tr"),e.innerHTML=` + `},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Vm(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[28]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function zm(n,e){let t,i,s;return i=new Ib({props:{record:e[35],field:e[38]}}),{key:n,first:null,c(){t=rt(),B(i.$$.fragment),this.first=t},m(l,r){w(l,t,r),V(i,l,r),s=!0},p(l,r){e=l;const o={};r[0]&8&&(o.record=e[35]),r[0]&2048&&(o.field=e[38]),i.$set(o)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){F(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function Bm(n,e){let t,i,s,l,r,o,a,u,f,c,d,h,g,y=[],b=new Map,v,S,C,M,$,T,A,D,P,L,N,R;function J(){return e[25](e[35])}h=new Io({props:{id:e[35].id}});let W=e[11];const q=Y=>Y[38].name;for(let Y=0;Y',P=O(),p(l,"type","checkbox"),p(l,"id",r="checkbox_"+e[35].id),l.checked=o=e[5][e[35].id],p(u,"for",f="checkbox_"+e[35].id),p(s,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-id"),p(S,"class","col-type-date col-field-created"),p($,"class","col-type-date col-field-updated"),p(D,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(Y,te){w(Y,t,te),m(t,i),m(i,s),m(s,l),m(s,a),m(s,u),m(t,c),m(t,d),V(h,d,null),m(t,g);for(let fe=0;feReset',c=O(),d=_("div"),h=O(),g=_("button"),g.innerHTML='Delete selected',p(t,"class","txt"),p(f,"type","button"),p(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),ne(f,"btn-disabled",n[9]),p(d,"class","flex-fill"),p(g,"type","button"),p(g,"class","btn btn-sm btn-secondary btn-danger"),ne(g,"btn-loading",n[9]),ne(g,"btn-disabled",n[9]),p(e,"class","bulkbar")},m(C,M){w(C,e,M),m(e,t),m(t,i),m(t,s),m(s,l),m(t,r),m(t,a),m(e,u),m(e,f),m(e,c),m(e,d),m(e,h),m(e,g),b=!0,v||(S=[X(f,"click",n[30]),X(g,"click",n[31])],v=!0)},p(C,M){(!b||M[0]&64)&&_e(l,C[6]),(!b||M[0]&64)&&o!==(o=C[6]===1?"record":"records")&&_e(a,o),M[0]&512&&ne(f,"btn-disabled",C[9]),M[0]&512&&ne(g,"btn-loading",C[9]),M[0]&512&&ne(g,"btn-disabled",C[9])},i(C){b||(C&&Dt(()=>{y||(y=ft(e,ti,{duration:150,y:5},!0)),y.run(1)}),b=!0)},o(C){C&&(y||(y=ft(e,ti,{duration:150,y:5},!1)),y.run(0)),b=!1},d(C){C&&k(e),C&&y&&y.end(),v=!1,lt(S)}}}function GD(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y=[],b=new Map,v,S,C,M,$,T,A,D,P,L,N=[],R=new Map,J,W,q,x,K,Y,te;function fe(le){n[21](le)}let ye={class:"col-type-text col-field-id",name:"id",$$slots:{default:[UD]},$$scope:{ctx:n}};n[0]!==void 0&&(ye.sort=n[0]),d=new en({props:ye}),he.push(()=>Fe(d,"sort",fe));let se=n[11];const G=le=>le[38].name;for(let le=0;leFe(S,"sort",Oe));function be(le){n[24](le)}let ue={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[KD]},$$scope:{ctx:n}};n[0]!==void 0&&(ue.sort=n[0]),$=new en({props:ue}),he.push(()=>Fe($,"sort",be));let ie=n[3];const ve=le=>le[35].id;for(let le=0;leh=!1)),d.$set(Ve),ke[0]&2049&&(se=le[11],Te(),y=ot(y,ke,G,1,le,se,b,s,Lt,Hm,v,jm),De());const ze={};ke[1]&4096&&(ze.$$scope={dirty:ke,ctx:le}),!C&&ke[0]&1&&(C=!0,ze.sort=le[0],Re(()=>C=!1)),S.$set(ze);const Ge={};ke[1]&4096&&(Ge.$$scope={dirty:ke,ctx:le}),!T&&ke[0]&1&&(T=!0,Ge.sort=le[0],Re(()=>T=!1)),$.$set(Ge),ke[0]&76074&&(ie=le[3],Te(),N=ot(N,ke,ve,1,le,ie,R,L,Lt,Bm,null,Nm),De(),!ie.length&&je?je.p(le,ke):ie.length?je&&(je.d(1),je=null):(je=qm(le),je.c(),je.m(L,null))),ke[0]&256&&ne(t,"table-loading",le[8]),le[3].length?Le?Le.p(le,ke):(Le=Um(le),Le.c(),Le.m(W.parentNode,W)):Le&&(Le.d(1),Le=null),le[3].length&&le[12]?qe?qe.p(le,ke):(qe=Wm(le),qe.c(),qe.m(q.parentNode,q)):qe&&(qe.d(1),qe=null),le[6]?oe?(oe.p(le,ke),ke[0]&64&&E(oe,1)):(oe=Ym(le),oe.c(),E(oe,1),oe.m(x.parentNode,x)):oe&&(Te(),F(oe,1,1,()=>{oe=null}),De())},i(le){if(!K){E(d.$$.fragment,le);for(let ke=0;ke{se<=1&&S(),t(8,y=!1),t(3,c=c.concat(G.items)),t(7,d=G.page),t(4,h=G.totalItems),o("load",c)}).catch(G=>{G!==null&&(t(8,y=!1),console.warn(G),S(),Se.errorResponseHandler(G,!1))})}function S(){t(3,c=[]),t(7,d=1),t(4,h=0),t(5,g={})}function C(){r?M():$()}function M(){t(5,g={})}function $(){for(const se of c)t(5,g[se.id]=se,g);t(5,g)}function T(se){g[se.id]?delete g[se.id]:t(5,g[se.id]=se,g),t(5,g)}function A(){Mi(`Do you really want to delete the selected ${l===1?"record":"records"}?`,D)}async function D(){if(b||!l)return;let se=[];for(const G of Object.keys(g))se.push(Se.Records.delete(a==null?void 0:a.id,G));return t(9,b=!0),Promise.all(se).then(()=>{hn(`Successfully deleted the selected ${l===1?"record":"records"}.`),M()}).catch(G=>{Se.errorResponseHandler(G)}).finally(()=>(t(9,b=!1),v()))}function P(se){ut.call(this,n,se)}const L=()=>C();function N(se){u=se,t(0,u)}function R(se){u=se,t(0,u)}function J(se){u=se,t(0,u)}function W(se){u=se,t(0,u)}const q=se=>T(se),x=se=>o("select",se),K=(se,G)=>{G.code==="Enter"&&(G.preventDefault(),o("select",se))},Y=()=>t(1,f=""),te=()=>v(d+1),fe=()=>M(),ye=()=>A();return n.$$set=se=>{"collection"in se&&t(18,a=se.collection),"sort"in se&&t(0,u=se.sort),"filter"in se&&t(1,f=se.filter)},n.$$.update=()=>{n.$$.dirty[0]&262147&&a&&a.id&&u!==-1&&f!==-1&&(S(),v(1)),n.$$.dirty[0]&24&&t(12,i=h>c.length),n.$$.dirty[0]&262144&&t(11,s=(a==null?void 0:a.schema)||[]),n.$$.dirty[0]&32&&t(6,l=Object.keys(g).length),n.$$.dirty[0]&72&&t(10,r=c.length&&l===c.length)},[u,f,v,c,h,g,l,d,y,b,r,s,i,o,C,M,T,A,a,P,L,N,R,J,W,q,x,K,Y,te,fe,ye]}class XD extends Ne{constructor(e){super(),Ie(this,e,ZD,GD,Pe,{collection:18,sort:0,filter:1,load:2},null,[-1,-1])}get load(){return this.$$.ctx[2]}}function QD(n){let e,t,i,s,l,r,o,a,u=n[2].name+"",f,c,d,h,g,y,b,v,S,C,M,$,T,A,D,P,L;e=new G$({}),C=new Do({props:{value:n[0],autocompleteCollection:n[2]}}),C.$on("submit",n[15]);function N(W){n[17](W)}function R(W){n[18](W)}let J={collection:n[2]};return n[0]!==void 0&&(J.filter=n[0]),n[1]!==void 0&&(J.sort=n[1]),$=new XD({props:J}),n[16]($),he.push(()=>Fe($,"filter",N)),he.push(()=>Fe($,"sort",R)),$.$on("select",n[19]),{c(){B(e.$$.fragment),t=O(),i=_("main"),s=_("header"),l=_("nav"),r=_("div"),r.textContent="Collections",o=O(),a=_("div"),f=H(u),c=O(),d=_("button"),d.innerHTML='',h=O(),g=_("div"),y=_("button"),y.innerHTML=` + API Preview`,b=O(),v=_("button"),v.innerHTML=` + New record`,S=O(),B(C.$$.fragment),M=O(),B($.$$.fragment),p(r,"class","breadcrumb-item"),p(a,"class","breadcrumb-item"),p(l,"class","breadcrumbs"),p(d,"type","button"),p(d,"class","btn btn-secondary btn-circle"),p(y,"type","button"),p(y,"class","btn btn-outline"),p(v,"type","button"),p(v,"class","btn btn-expanded"),p(g,"class","btns-group"),p(s,"class","page-header"),p(i,"class","page-wrapper")},m(W,q){V(e,W,q),w(W,t,q),w(W,i,q),m(i,s),m(s,l),m(l,r),m(l,o),m(l,a),m(a,f),m(s,c),m(s,d),m(s,h),m(s,g),m(g,y),m(g,b),m(g,v),m(i,S),V(C,i,null),m(i,M),V($,i,null),D=!0,P||(L=[Xe(St.call(null,d,{text:"Edit collection",position:"right"})),X(d,"click",n[12]),X(y,"click",n[13]),X(v,"click",n[14])],P=!0)},p(W,q){(!D||q&4)&&u!==(u=W[2].name+"")&&_e(f,u);const x={};q&1&&(x.value=W[0]),q&4&&(x.autocompleteCollection=W[2]),C.$set(x);const K={};q&4&&(K.collection=W[2]),!T&&q&1&&(T=!0,K.filter=W[0],Re(()=>T=!1)),!A&&q&2&&(A=!0,K.sort=W[1],Re(()=>A=!1)),$.$set(K)},i(W){D||(E(e.$$.fragment,W),E(C.$$.fragment,W),E($.$$.fragment,W),D=!0)},o(W){F(e.$$.fragment,W),F(C.$$.fragment,W),F($.$$.fragment,W),D=!1},d(W){z(e,W),W&&k(t),W&&k(i),z(C),n[16](null),z($),P=!1,lt(L)}}}function eA(n){let e,t,i,s,l,r,o,a;return{c(){e=_("div"),t=_("div"),t.innerHTML='',i=O(),s=_("h1"),s.textContent="Create your first collection to add records!",l=O(),r=_("button"),r.innerHTML=` + Create new collection`,p(t,"class","icon"),p(s,"class","m-b-10"),p(r,"type","button"),p(r,"class","btn btn-expanded-lg btn-lg"),p(e,"class","placeholder-section m-b-base")},m(u,f){w(u,e,f),m(e,t),m(e,i),m(e,s),m(e,l),m(e,r),o||(a=X(r,"click",n[11]),o=!0)},p:re,i:re,o:re,d(u){u&&k(e),o=!1,a()}}}function tA(n){let e;return{c(){e=_("div"),e.innerHTML=` +

Loading collections...

`,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function nA(n){let e,t,i,s,l,r,o,a,u;const f=[tA,eA,QD],c=[];function d(b,v){return b[8]?0:b[7].length?2:1}e=d(n),t=c[e]=f[e](n);let h={};s=new hf({props:h}),n[20](s);let g={};r=new zO({props:g}),n[21](r);let y={collection:n[2]};return a=new Fb({props:y}),n[22](a),a.$on("save",n[23]),a.$on("delete",n[24]),{c(){t.c(),i=O(),B(s.$$.fragment),l=O(),B(r.$$.fragment),o=O(),B(a.$$.fragment)},m(b,v){c[e].m(b,v),w(b,i,v),V(s,b,v),w(b,l,v),V(r,b,v),w(b,o,v),V(a,b,v),u=!0},p(b,[v]){let S=e;e=d(b),e===S?c[e].p(b,v):(Te(),F(c[S],1,1,()=>{c[S]=null}),De(),t=c[e],t?t.p(b,v):(t=c[e]=f[e](b),t.c()),E(t,1),t.m(i.parentNode,i));const C={};s.$set(C);const M={};r.$set(M);const $={};v&4&&($.collection=b[2]),a.$set($)},i(b){u||(E(t),E(s.$$.fragment,b),E(r.$$.fragment,b),E(a.$$.fragment,b),u=!0)},o(b){F(t),F(s.$$.fragment,b),F(r.$$.fragment,b),F(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[20](null),z(s,b),b&&k(l),n[21](null),z(r,b),b&&k(o),n[22](null),z(a,b)}}}function iA(n,e,t){var J;let i,s,l,r;pn(n,ui,W=>t(2,s=W)),pn(n,Ks,W=>t(10,l=W)),pn(n,du,W=>t(8,r=W));const o=U.getQueryParams((J=window.location)==null?void 0:J.href);let a,u,f,c,d=o.filter||"",h=o.sort||"-created",g=o.collectionId;U.setDocumentTitle("Collections"),b4(g);const y=()=>a==null?void 0:a.show(),b=()=>a==null?void 0:a.show(s),v=()=>u==null?void 0:u.show(s),S=()=>f==null?void 0:f.show(),C=W=>t(0,d=W.detail);function M(W){he[W?"unshift":"push"](()=>{c=W,t(6,c)})}function $(W){d=W,t(0,d),t(2,s),t(9,g)}function T(W){h=W,t(1,h),t(2,s),t(9,g)}const A=W=>f==null?void 0:f.show(W==null?void 0:W.detail);function D(W){he[W?"unshift":"push"](()=>{a=W,t(3,a)})}function P(W){he[W?"unshift":"push"](()=>{u=W,t(4,u)})}function L(W){he[W?"unshift":"push"](()=>{f=W,t(5,f)})}const N=()=>c==null?void 0:c.load(),R=()=>c==null?void 0:c.load();return n.$$.update=()=>{n.$$.dirty&1024&&t(7,i=l.filter(W=>W.name!="profiles")),n.$$.dirty&516&&(s==null?void 0:s.id)&&g!=s.id&&(t(9,g=s.id),t(1,h="-created"),t(0,d="")),n.$$.dirty&7&&(h||d||(s==null?void 0:s.id))&&U.replaceClientQueryParams({collectionId:s==null?void 0:s.id,filter:d,sort:h})},[d,h,s,a,u,f,c,i,r,g,l,y,b,v,S,C,M,$,T,A,D,P,L,N,R]}class sA extends Ne{constructor(e){super(),Ie(this,e,iA,nA,Pe,{})}}function Km(n){let e,t;return e=new He({props:{class:"form-field disabled",name:"id",$$slots:{default:[lA,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&2|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function lA(n){let e,t,i,s,l,r,o,a,u;return{c(){e=_("label"),t=_("i"),i=O(),s=_("span"),s.textContent="ID",r=O(),o=_("input"),p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"for",l=n[31]),p(o,"type","text"),p(o,"id",a=n[31]),o.value=u=n[1].id,o.disabled=!0},m(f,c){w(f,e,c),m(e,t),m(e,i),m(e,s),w(f,r,c),w(f,o,c)},p(f,c){c[1]&1&&l!==(l=f[31])&&p(e,"for",l),c[1]&1&&a!==(a=f[31])&&p(o,"id",a),c[0]&2&&u!==(u=f[1].id)&&o.value!==u&&(o.value=u)},d(f){f&&k(e),f&&k(r),f&&k(o)}}}function Jm(n){let e,t,i,s;return{c(){e=_("div"),e.innerHTML='',p(e,"class","form-field-addon txt-success")},m(l,r){w(l,e,r),i||(s=Xe(t=St.call(null,e,"Verified")),i=!0)},d(l){l&&k(e),i=!1,s()}}}function rA(n){let e,t,i,s,l,r,o,a,u,f,c,d=n[1].verified&&Jm();return{c(){e=_("label"),t=_("i"),i=O(),s=_("span"),s.textContent="Email",r=O(),d&&d.c(),o=O(),a=_("input"),p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[31]),p(a,"type","email"),p(a,"autocomplete","off"),p(a,"id",u=n[31]),a.required=!0},m(h,g){w(h,e,g),m(e,t),m(e,i),m(e,s),w(h,r,g),d&&d.m(h,g),w(h,o,g),w(h,a,g),$e(a,n[2]),f||(c=X(a,"input",n[19]),f=!0)},p(h,g){g[1]&1&&l!==(l=h[31])&&p(e,"for",l),h[1].verified?d||(d=Jm(),d.c(),d.m(o.parentNode,o)):d&&(d.d(1),d=null),g[1]&1&&u!==(u=h[31])&&p(a,"id",u),g[0]&4&&a.value!==h[2]&&$e(a,h[2])},d(h){h&&k(e),h&&k(r),d&&d.d(h),h&&k(o),h&&k(a),f=!1,c()}}}function xm(n){let e,t;return e=new He({props:{class:"form-field form-field-toggle",$$slots:{default:[oA,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&8|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function oA(n){let e,t,i,s,l,r,o,a;return{c(){e=_("input"),i=O(),s=_("label"),l=H("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[31]),p(s,"for",r=n[31])},m(u,f){w(u,e,f),e.checked=n[3],w(u,i,f),w(u,s,f),m(s,l),o||(a=X(e,"change",n[20]),o=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&p(e,"id",t),f[0]&8&&(e.checked=u[3]),f[1]&1&&r!==(r=u[31])&&p(s,"for",r)},d(u){u&&k(e),u&&k(i),u&&k(s),o=!1,a()}}}function Gm(n){let e,t,i,s,l,r,o,a,u;return s=new He({props:{class:"form-field required",name:"password",$$slots:{default:[aA,({uniqueId:f})=>({31:f}),({uniqueId:f})=>[0,f?1:0]]},$$scope:{ctx:n}}}),o=new He({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[uA,({uniqueId:f})=>({31:f}),({uniqueId:f})=>[0,f?1:0]]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),i=_("div"),B(s.$$.fragment),l=O(),r=_("div"),B(o.$$.fragment),p(i,"class","col-sm-6"),p(r,"class","col-sm-6"),p(t,"class","grid"),p(e,"class","col-12")},m(f,c){w(f,e,c),m(e,t),m(t,i),V(s,i,null),m(t,l),m(t,r),V(o,r,null),u=!0},p(f,c){const d={};c[0]&128|c[1]&3&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const h={};c[0]&256|c[1]&3&&(h.$$scope={dirty:c,ctx:f}),o.$set(h)},i(f){u||(E(s.$$.fragment,f),E(o.$$.fragment,f),Dt(()=>{a||(a=ft(t,un,{duration:150},!0)),a.run(1)}),u=!0)},o(f){F(s.$$.fragment,f),F(o.$$.fragment,f),a||(a=ft(t,un,{duration:150},!1)),a.run(0),u=!1},d(f){f&&k(e),z(s),z(o),f&&a&&a.end()}}}function aA(n){let e,t,i,s,l,r,o,a,u,f;return{c(){e=_("label"),t=_("i"),i=O(),s=_("span"),s.textContent="Password",r=O(),o=_("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[31]),p(o,"type","password"),p(o,"autocomplete","new-password"),p(o,"id",a=n[31]),o.required=!0},m(c,d){w(c,e,d),m(e,t),m(e,i),m(e,s),w(c,r,d),w(c,o,d),$e(o,n[7]),u||(f=X(o,"input",n[21]),u=!0)},p(c,d){d[1]&1&&l!==(l=c[31])&&p(e,"for",l),d[1]&1&&a!==(a=c[31])&&p(o,"id",a),d[0]&128&&o.value!==c[7]&&$e(o,c[7])},d(c){c&&k(e),c&&k(r),c&&k(o),u=!1,f()}}}function uA(n){let e,t,i,s,l,r,o,a,u,f;return{c(){e=_("label"),t=_("i"),i=O(),s=_("span"),s.textContent="Password confirm",r=O(),o=_("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[31]),p(o,"type","password"),p(o,"autocomplete","new-password"),p(o,"id",a=n[31]),o.required=!0},m(c,d){w(c,e,d),m(e,t),m(e,i),m(e,s),w(c,r,d),w(c,o,d),$e(o,n[8]),u||(f=X(o,"input",n[22]),u=!0)},p(c,d){d[1]&1&&l!==(l=c[31])&&p(e,"for",l),d[1]&1&&a!==(a=c[31])&&p(o,"id",a),d[0]&256&&o.value!==c[8]&&$e(o,c[8])},d(c){c&&k(e),c&&k(r),c&&k(o),u=!1,f()}}}function Zm(n){let e,t;return e=new He({props:{class:"form-field form-field-toggle",$$slots:{default:[fA,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&512|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){F(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function fA(n){let e,t,i,s,l,r,o,a;return{c(){e=_("input"),i=O(),s=_("label"),l=H("Send verification email"),p(e,"type","checkbox"),p(e,"id",t=n[31]),p(s,"for",r=n[31])},m(u,f){w(u,e,f),e.checked=n[9],w(u,i,f),w(u,s,f),m(s,l),o||(a=X(e,"change",n[23]),o=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&p(e,"id",t),f[0]&512&&(e.checked=u[9]),f[1]&1&&r!==(r=u[31])&&p(s,"for",r)},d(u){u&&k(e),u&&k(i),u&&k(s),o=!1,a()}}}function cA(n){let e,t,i,s,l,r,o,a,u,f=!n[1].isNew&&Km(n);i=new He({props:{class:"form-field required",name:"email",$$slots:{default:[rA,({uniqueId:g})=>({31:g}),({uniqueId:g})=>[0,g?1:0]]},$$scope:{ctx:n}}});let c=!n[1].isNew&&xm(n),d=(n[1].isNew||n[3])&&Gm(n),h=n[1].isNew&&Zm(n);return{c(){e=_("form"),f&&f.c(),t=O(),B(i.$$.fragment),s=O(),c&&c.c(),l=O(),d&&d.c(),r=O(),h&&h.c(),p(e,"id",n[11]),p(e,"class","grid"),p(e,"autocomplete","off")},m(g,y){w(g,e,y),f&&f.m(e,null),m(e,t),V(i,e,null),m(e,s),c&&c.m(e,null),m(e,l),d&&d.m(e,null),m(e,r),h&&h.m(e,null),o=!0,a||(u=X(e,"submit",Jt(n[12])),a=!0)},p(g,y){g[1].isNew?f&&(Te(),F(f,1,1,()=>{f=null}),De()):f?(f.p(g,y),y[0]&2&&E(f,1)):(f=Km(g),f.c(),E(f,1),f.m(e,t));const b={};y[0]&6|y[1]&3&&(b.$$scope={dirty:y,ctx:g}),i.$set(b),g[1].isNew?c&&(Te(),F(c,1,1,()=>{c=null}),De()):c?(c.p(g,y),y[0]&2&&E(c,1)):(c=xm(g),c.c(),E(c,1),c.m(e,l)),g[1].isNew||g[3]?d?(d.p(g,y),y[0]&10&&E(d,1)):(d=Gm(g),d.c(),E(d,1),d.m(e,r)):d&&(Te(),F(d,1,1,()=>{d=null}),De()),g[1].isNew?h?(h.p(g,y),y[0]&2&&E(h,1)):(h=Zm(g),h.c(),E(h,1),h.m(e,null)):h&&(Te(),F(h,1,1,()=>{h=null}),De())},i(g){o||(E(f),E(i.$$.fragment,g),E(c),E(d),E(h),o=!0)},o(g){F(f),F(i.$$.fragment,g),F(c),F(d),F(h),o=!1},d(g){g&&k(e),f&&f.d(),z(i),c&&c.d(),d&&d.d(),h&&h.d(),a=!1,u()}}}function dA(n){let e,t=n[1].isNew?"New user":"Edit user",i;return{c(){e=_("h4"),i=H(t)},m(s,l){w(s,e,l),m(e,i)},p(s,l){l[0]&2&&t!==(t=s[1].isNew?"New user":"Edit user")&&_e(i,t)},d(s){s&&k(e)}}}function Xm(n){let e,t,i,s,l,r,o,a,u;return r=new bs({props:{class:"dropdown dropdown-upside dropdown-left dropdown-nowrap",$$slots:{default:[pA]},$$scope:{ctx:n}}}),{c(){e=_("button"),t=_("span"),i=O(),s=_("i"),l=O(),B(r.$$.fragment),o=O(),a=_("div"),p(s,"class","ri-more-line"),p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary"),p(a,"class","flex-fill")},m(f,c){w(f,e,c),m(e,t),m(e,i),m(e,s),m(e,l),V(r,e,null),w(f,o,c),w(f,a,c),u=!0},p(f,c){const d={};c[0]&2|c[1]&2&&(d.$$scope={dirty:c,ctx:f}),r.$set(d)},i(f){u||(E(r.$$.fragment,f),u=!0)},o(f){F(r.$$.fragment,f),u=!1},d(f){f&&k(e),z(r),f&&k(o),f&&k(a)}}}function Qm(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` + Send verification email`,p(e,"type","button"),p(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[16]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function pA(n){let e,t,i,s,l=!n[1].verified&&Qm(n);return{c(){l&&l.c(),e=O(),t=_("button"),t.innerHTML=` + Delete`,p(t,"type","button"),p(t,"class","dropdown-item")},m(r,o){l&&l.m(r,o),w(r,e,o),w(r,t,o),i||(s=X(t,"click",n[17]),i=!0)},p(r,o){r[1].verified?l&&(l.d(1),l=null):l?l.p(r,o):(l=Qm(r),l.c(),l.m(e.parentNode,e))},d(r){l&&l.d(r),r&&k(e),r&&k(t),i=!1,s()}}}function hA(n){let e,t,i,s,l,r,o=n[1].isNew?"Create":"Save changes",a,u,f,c,d,h=!n[1].isNew&&Xm(n);return{c(){h&&h.c(),e=O(),t=_("button"),i=_("span"),i.textContent="Cancel",s=O(),l=_("button"),r=_("span"),a=H(o),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-secondary"),t.disabled=n[5],p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[11]),p(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[5],ne(l,"btn-loading",n[5])},m(g,y){h&&h.m(g,y),w(g,e,y),w(g,t,y),m(t,i),w(g,s,y),w(g,l,y),m(l,r),m(r,a),f=!0,c||(d=X(t,"click",n[18]),c=!0)},p(g,y){g[1].isNew?h&&(Te(),F(h,1,1,()=>{h=null}),De()):h?(h.p(g,y),y[0]&2&&E(h,1)):(h=Xm(g),h.c(),E(h,1),h.m(e.parentNode,e)),(!f||y[0]&32)&&(t.disabled=g[5]),(!f||y[0]&2)&&o!==(o=g[1].isNew?"Create":"Save changes")&&_e(a,o),(!f||y[0]&1056&&u!==(u=!g[10]||g[5]))&&(l.disabled=u),y[0]&32&&ne(l,"btn-loading",g[5])},i(g){f||(E(h),f=!0)},o(g){F(h),f=!1},d(g){h&&h.d(g),g&&k(e),g&&k(t),g&&k(s),g&&k(l),c=!1,d()}}}function mA(n){let e,t,i={popup:!0,class:"user-panel",beforeHide:n[24],$$slots:{footer:[hA],header:[dA],default:[cA]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[25](e),e.$on("hide",n[26]),e.$on("show",n[27]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const r={};l[0]&1088&&(r.beforeHide=s[24]),l[0]&1966|l[1]&2&&(r.$$scope={dirty:l,ctx:s}),e.$set(r)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){F(e.$$.fragment,s),t=!1},d(s){n[25](null),z(e,s)}}}function gA(n,e,t){let i;const s=vn(),l="user_"+U.randomString(5);let r,o=new Qr,a=!1,u=!1,f="",c="",d="",h=!1,g=!0;function y(Y){return v(Y),t(6,u=!0),r==null?void 0:r.show()}function b(){return r==null?void 0:r.hide()}function v(Y){Wi({}),t(1,o=Y!=null&&Y.clone?Y.clone():new Qr),S()}function S(){t(3,h=!1),t(9,g=!0),t(2,f=(o==null?void 0:o.email)||""),t(7,c=""),t(8,d="")}function C(){if(a||!i)return;t(5,a=!0);const Y={email:f};(o.isNew||h)&&(Y.password=c,Y.passwordConfirm=d);let te;o.isNew?te=Se.Users.create(Y):te=Se.Users.update(o.id,Y),te.then(async fe=>{g&&$(!1),t(6,u=!1),b(),hn(o.isNew?"Successfully created user.":"Successfully updated user."),s("save",fe)}).catch(fe=>{Se.errorResponseHandler(fe)}).finally(()=>{t(5,a=!1)})}function M(){!(o!=null&&o.id)||Mi("Do you really want to delete the selected user?",()=>Se.Users.delete(o.id).then(()=>{t(6,u=!1),b(),hn("Successfully deleted user."),s("delete",o)}).catch(Y=>{Se.errorResponseHandler(Y)}))}function $(Y=!0){return Se.Users.requestVerification(o.isNew?f:o.email).then(()=>{t(6,u=!1),b(),Y&&hn(`Successfully sent verification email to ${o.email}.`)}).catch(te=>{Se.errorResponseHandler(te)})}const T=()=>$(),A=()=>M(),D=()=>b();function P(){f=this.value,t(2,f)}function L(){h=this.checked,t(3,h)}function N(){c=this.value,t(7,c)}function R(){d=this.value,t(8,d)}function J(){g=this.checked,t(9,g)}const W=()=>i&&u?(Mi("You have unsaved changes. Do you really want to close the panel?",()=>{t(6,u=!1),b()}),!1):!0;function q(Y){he[Y?"unshift":"push"](()=>{r=Y,t(4,r)})}function x(Y){ut.call(this,n,Y)}function K(Y){ut.call(this,n,Y)}return n.$$.update=()=>{n.$$.dirty[0]&14&&t(10,i=o.isNew&&f!=""||h||f!==o.email)},[b,o,f,h,r,a,u,c,d,g,i,l,C,M,$,y,T,A,D,P,L,N,R,J,W,q,x,K]}class _A extends Ne{constructor(e){super(),Ie(this,e,gA,mA,Pe,{show:15,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[0]}}function eg(n,e,t){const i=n.slice();return i[37]=e[t],i}function tg(n,e,t){const i=n.slice();return i[40]=e[t],i}function ng(n,e,t){const i=n.slice();return i[40]=e[t],i}function bA(n){let e,t,i,s,l,r,o,a,u,f,c,d,h,g,y,b,v,S,C,M,$,T,A=[],D=new Map,P,L,N,R,J,W,q,x,K,Y,te=[],fe=new Map,ye,se,G,Oe,ee;c=new Do({props:{value:n[3],placeholder:"Search filter, eg. verified=1",extraAutocompleteKeys:["verified","email"]}}),c.$on("submit",n[17]);function be(Z){n[18](Z)}let ue={class:"col-type-text col-field-id",name:"id",$$slots:{default:[vA]},$$scope:{ctx:n}};n[4]!==void 0&&(ue.sort=n[4]),v=new en({props:ue}),he.push(()=>Fe(v,"sort",be));function ie(Z){n[19](Z)}let ve={class:"col-type-email col-field-email",name:"email",$$slots:{default:[kA]},$$scope:{ctx:n}};n[4]!==void 0&&(ve.sort=n[4]),M=new en({props:ve}),he.push(()=>Fe(M,"sort",ie));let je=n[12];const Le=Z=>Z[40].name;for(let Z=0;ZFe(L,"sort",qe));function le(Z){n[21](Z)}let ke={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[SA]},$$scope:{ctx:n}};n[4]!==void 0&&(ke.sort=n[4]),J=new en({props:ke}),he.push(()=>Fe(J,"sort",le));let Ve=n[1];const ze=Z=>Z[37].id;for(let Z=0;ZUsers',s=O(),l=_("button"),l.innerHTML='',r=O(),o=_("div"),a=O(),u=_("button"),u.innerHTML=` + New user`,f=O(),B(c.$$.fragment),d=O(),h=_("div"),g=_("table"),y=_("thead"),b=_("tr"),B(v.$$.fragment),C=O(),B(M.$$.fragment),T=O();for(let Z=0;ZS=!1)),v.$set(vt);const it={};ae[1]&16384&&(it.$$scope={dirty:ae,ctx:Z}),!$&&ae[0]&16&&($=!0,it.sort=Z[4],Re(()=>$=!1)),M.$set(it),ae[0]&4096&&(je=Z[12],A=ot(A,ae,Le,1,Z,je,D,b,an,ig,P,ng));const gt={};ae[1]&16384&&(gt.$$scope={dirty:ae,ctx:Z}),!N&&ae[0]&16&&(N=!0,gt.sort=Z[4],Re(()=>N=!1)),L.$set(gt);const at={};ae[1]&16384&&(at.$$scope={dirty:ae,ctx:Z}),!W&&ae[0]&16&&(W=!0,at.sort=Z[4],Re(()=>W=!1)),J.$set(at),ae[0]&5450&&(Ve=Z[1],Te(),te=ot(te,ae,ze,1,Z,Ve,fe,Y,Lt,og,null,eg),De(),!Ve.length&&Ge?Ge.p(Z,ae):Ve.length?Ge&&(Ge.d(1),Ge=null):(Ge=sg(Z),Ge.c(),Ge.m(Y,null))),ae[0]&1024&&ne(g,"table-loading",Z[10]),Z[1].length?ge?ge.p(Z,ae):(ge=ag(Z),ge.c(),ge.m(e,se)):ge&&(ge.d(1),ge=null),Z[1].length&&Z[13]?Ae?Ae.p(Z,ae):(Ae=ug(Z),Ae.c(),Ae.m(e,null)):Ae&&(Ae.d(1),Ae=null)},i(Z){if(!G){E(c.$$.fragment,Z),E(v.$$.fragment,Z),E(M.$$.fragment,Z),E(L.$$.fragment,Z),E(J.$$.fragment,Z);for(let ae=0;ae +

Loading users...

`,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function vA(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="id",p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function kA(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="email",p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function ig(n,e){let t,i,s,l,r,o,a,u=e[40].name+"",f,c,d;return{key:n,first:null,c(){t=_("th"),i=_("div"),s=_("i"),r=O(),o=_("span"),a=H("profile."),f=H(u),p(s,"class",l=U.getFieldTypeIcon(e[40].type)),p(o,"class","txt"),p(i,"class","col-header-content"),p(t,"class",c="col-type-"+e[40].type+" col-field-"+e[40].name),p(t,"name",d=e[40].name),this.first=t},m(h,g){w(h,t,g),m(t,i),m(i,s),m(i,r),m(i,o),m(o,a),m(o,f)},p(h,g){e=h,g[0]&4096&&l!==(l=U.getFieldTypeIcon(e[40].type))&&p(s,"class",l),g[0]&4096&&u!==(u=e[40].name+"")&&_e(f,u),g[0]&4096&&c!==(c="col-type-"+e[40].type+" col-field-"+e[40].name)&&p(t,"class",c),g[0]&4096&&d!==(d=e[40].name)&&p(t,"name",d)},d(h){h&&k(t)}}}function wA(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function SA(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=O(),s=_("span"),s.textContent="updated",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,r){w(l,e,r),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function sg(n){let e;function t(l,r){return l[10]?MA:CA}let i=t(n),s=i(n);return{c(){s.c(),e=rt()},m(l,r){s.m(l,r),w(l,e,r)},p(l,r){i===(i=t(l))&&s?s.p(l,r):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function CA(n){var o;let e,t,i,s,l,r=((o=n[3])==null?void 0:o.length)&&lg(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No users found.",s=O(),r&&r.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),r&&r.m(t,null),m(e,l)},p(a,u){var f;(f=a[3])!=null&&f.length?r?r.p(a,u):(r=lg(a),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(a){a&&k(e),r&&r.d()}}}function MA(n){let e;return{c(){e=_("tr"),e.innerHTML=` + `},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function lg(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[24]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function rg(n,e){let t,i,s;return i=new Ib({props:{field:e[40],record:e[37].profile||{}}}),{key:n,first:null,c(){t=rt(),B(i.$$.fragment),this.first=t},m(l,r){w(l,t,r),V(i,l,r),s=!0},p(l,r){e=l;const o={};r[0]&4096&&(o.field=e[40]),r[0]&2&&(o.record=e[37].profile||{}),i.$set(o)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){F(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function og(n,e){let t,i,s,l,r,o,a,u=e[37].email+"",f,c,d,h,g=e[37].verified?"Verified":"Unverified",y,b,v=[],S=new Map,C,M,$,T,A,D,P,L,N,R,J,W,q,x,K;s=new Io({props:{id:e[37].id}});let Y=e[12];const te=se=>se[40].name;for(let se=0;se