diff --git a/ui/dist/assets/FilterAutocompleteInput.18e2a4f4.js b/ui/dist/assets/FilterAutocompleteInput.18e2a4f4.js new file mode 100644 index 00000000..7be7f1d6 --- /dev/null +++ b/ui/dist/assets/FilterAutocompleteInput.18e2a4f4.js @@ -0,0 +1,12 @@ +import{S as Sa,i as va,s as Ca,e as Aa,f as Ma,g as Da,y as Sn,o as Oa,G as Ta,H as Ba,I as Ra,J as La,K as Pa,C as vn,L as Ea}from"./index.d16cb8a0.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 qo(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 Ko(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(ar(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,ar(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 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 qo{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 Ko{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<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Zt.prototype[Symbol.iterator]=qo.prototype[Symbol.iterator]=Ko.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 cr(n){return n>=127462&&n<=127487}const fr=8205;function Ae(n,e,t=!0,i=!0){return(t?Uo:Fa)(n,e,i)}function Uo(n,e,t){if(e==n.length)return e;e&&jo(n.charCodeAt(e))&&Go(n.charCodeAt(e-1))&&e--;let i=re(n,e);for(e+=ve(i);e=0&&cr(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=Uo(n,e-2,t);if(i=56320&&n<57344}function Go(n){return n>=55296&&n<56320}function re(n,e){let t=n.charCodeAt(e);if(!Go(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return jo(i)?(t-55296<<10)+(i-56320)+65536:t}function Ls(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 jn=/\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 Gn(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&&_e(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||jn)):d:z.empty,g=p.length;if(f==u&&g==0)return;fo&&he(s,f-o,-1),he(s,u-f,g),_e(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 _e(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 $o(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:Es),!!e.static,e.enables)}of(e){return new Ei([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ei(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ei(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Es(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Ei{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)||$n(f,c)){let d=i(f);if(l?!ur(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=Wi(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?ur(d,g,s):s(d,g)))return f.values[o]=g,0}return f.values[o]=d,1}}}}function ur(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(dr).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,dr.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 Xo(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 Xo{constructor(e,t){this.inner=e,this.prec=t}}class Qe{of(e){return new Xn(this,e)}reconfigure(e){return Qe.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Xn{constructor(e,t){this.compartment=e,this.inner=t}}class Hi{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,Es(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 Hi(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 Xn&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let a of o)r(a,l);else if(o instanceof Xn){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 Xo)r(o.inner,o.prec);else if(o instanceof ke)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Ei)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 Wi(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Yo=T.define(),_o=T.define({combine:n=>n.some(e=>e),static:!0}),Qo=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),Zo=T.define(),el=T.define(),tl=T.define(),il=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&&$o(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=sl(e,Ot(r),!1)}return n}function ja(n){let e=n.startState,t=e.facet(tl),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=nl(n,Yn(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 _n;try{_n=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $a(n){if(_n)return _n.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=Hi.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=Hi.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||jn)),s=e.selection?e.selection instanceof m?e.selection:m.single(e.selection.anchor,e.selection.head):m.single(0);return $o(s,i.length),t.staticFacet(_o)||(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(il)}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(Yo))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=Qo;V.readOnly=il;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=Yo;V.changeFilter=Zo;V.transactionFilter=el;V.transactionExtender=tl;Qe.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 Qn(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Is{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 Is(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(Qn)),this.isEmpty)return t.length?Y.of(t):this;let l=new rl(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=pr(o,l,i),a=new Ut(o,h,r),c=new Ut(l,h,r);i.iterGaps((f,u,d)=>gr(a,f,c,u,d,s)),i.empty&&i.length==0&&gr(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=pr(r,o),h=new Ut(r,l,0).goto(i),a=new Ut(o,l,0).goto(i);for(;;){if(h.to!=a.to||!Zn(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(Qn);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 Is(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 pr(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 rl(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--)Cn(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--)Cn(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(),Cn(this.heap,0)}}}function Cn(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){yi(this.active,e),yi(this.activeTo,e),yi(this.activeRank,e),this.minActive=mr(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&&yi(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 gr(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))&&Zn(n.activeForPoint(n.to+h),t.activeForPoint(t.to))||r.comparePoint(l,f,n.point,t.point):f>l&&!Zn(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 Zn(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 mr(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 ts="\u037C",yr=typeof Symbol>"u"?"__"+ts:Symbol.for(ts),is=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class rt{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=br[yr]||1;return br[yr]=e+1,ts+e.toString(36)}static mount(e,t){(e[is]||new _a(e)).mount(Array.isArray(t)?t:[t])}}let wi=null;class _a{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(wi)return e.adoptedStyleSheets=[wi.sheet].concat(e.adoptedStyleSheets),e[is]=wi;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),wi=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[is]=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:'"'},wr=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qa=typeof navigator<"u"&&/Apple Computer/.test(navigator.vendor),Za=typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),xr=typeof navigator<"u"&&/Mac/.test(navigator.platform),ec=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tc=wr&&(xr||+wr[1]<57)||Za&&xr;for(var oe=0;oe<10;oe++)ot[48+oe]=ot[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)ot[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)ot[oe]=String.fromCharCode(oe+32),Rt[oe]=String.fromCharCode(oe);for(var An in ot)Rt.hasOwnProperty(An)||(Rt[An]=ot[An]);function ic(n){var e=tc&&(n.ctrlKey||n.altKey||n.metaKey)||(Qa||ec)&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Rt:ot)[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 zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Lt(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 Ii(n,e){if(!e.anchorNode)return!1;try{return Lt(n,e.anchorNode)}catch{return!1}}function li(n){return n.nodeType==3?Pt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function qi(n,e,t,i){return t?kr(n,e,t,i,-1)||kr(n,e,t,i,1):!1}function Ki(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function kr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:hi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Ki(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?hi(n):0}else return!1}}function hi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const ol={left:0,right:0,top:0,bottom:0};function hn(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=Ns){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 cl(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 A={mac:Mr||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:an,ie_version:ul?ns.documentMode||6:rs?+rs[1]:ss?+ss[1]:0,gecko:Cr,gecko_version:Cr?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!Mn,chrome_version:Mn?+Mn[1]:0,ios:Mr,android:/Android\b/.test(Ce.userAgent),webkit:Ar,safari:dl,webkit_version:Ar?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:ns.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const ac=256;class lt 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 lt)||this.length-(t-e)+i.length>ac)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new lt(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(hl(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 ml(this.dom,this.children,e)}coordsAt(e,t){return bl(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?A.chrome||A.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return A.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?hn(h,o<0):h||null}class Ze 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||Ze)(e,t,i)}split(e){let t=Ze.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 Ze)||!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:hn(s,e==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class pl extends Ze{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?gl(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=Lt(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}}lt.prototype.children=Ze.prototype.children=Et.prototype.children=Ns;function cc(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 yl(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)?yl(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function bl(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?hn(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 Vs(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 cn(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}=wl(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 pi(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 cn extends R{constructor(e){let{start:t,end:i}=wl(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 cn&&this.tagName==e.tagName&&this.class==e.class&&Vs(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)}}cn.prototype.point=!1;class pi extends R{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof pi&&Vs(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)}}pi.prototype.mapMode=me.TrackBefore;pi.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&&fc(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 wl(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 fc(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),fl(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){Vs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){yl(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 ml(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&&(hl(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&&(!A.ios||!this.children.some(s=>s instanceof lt))){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 lt))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 bl(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(xi(new lt(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 Dr("div"),l,h))}else{let h=Ze.create(i.widget||new Dr("span"),l,i.startSide),a=this.atCursorPos&&!h.isEditable&&r<=s.length&&(e0),c=!h.isEditable&&(en.some(e=>e)});class Ui{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 Ui(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Or=H.define({map:(n,e)=>n.map(e)});function Re(n,e,t){let i=n.facet(vl);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 fn=T.define({combine:n=>n.length?n[0]:!0});let uc=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(uc++,e,i,o=>{let l=[$t.of(o)];return r&&l.push(ai.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 Dn{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 Ml=T.define(),Dl=T.define(),ai=T.define(),Ol=T.define(),Tl=T.define(),Xt=T.define();class je{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new je(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 je(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),o=h.toA,l=h.toB}}}class ji{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 je(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 ji(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,dc=Z.RTL;function Bl(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 bc(n,e){let t=n.length,i=e==us?1:2,s=e==us?2:1;if(!n||i==1&&!yc.test(n))return Rl(t);for(let o=0,l=i,h=i;o=0;u-=3)if(Le[u+1]==-c){let d=Le[u+2],p=d&2?i:d&4?d&1?s:i:0;p&&(X[o]=X[Le[u]]=p),l=u;break}}else{if(Le.length==189)break;Le[l++]=o,Le[l++]=a,Le[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=Le[d+2];if(p&2)break;if(u)Le[d+2]|=2;else{if(p&4)break;Le[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 Tr(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class Br{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Rr 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 je(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=kc(this.view,e.changes)),(A.ie||A.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=Ac(i,s,e.changes);return t=je.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=A.chrome||A.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}=Fs.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);cl(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())||A.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(A.gecko&&s.empty&&xc(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||!qi(r.node,r.offset,l.anchorNode,l.anchorOffset)||!qi(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{A.android&&A.chrome&&this.dom.contains(l.focusNode)&&Mc(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=zi(this.root);if(h)if(s.empty){if(A.gecko){let a=vc(r.node,r.offset);if(a&&a!=3){let c=Il(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=zi(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||Ii(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 al(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 Lr(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(ai).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(Tl).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=hi(n);else if(n.nodeType==1&&e=0)n=n.childNodes[e],e=0;else return null}}function vc(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 Tc(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function On(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&&On(a,y)?a=Er(a,y.bottom):c&&On(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 Ir(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 Ir(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((A.chrome||A.gecko)&&Pt(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 Nl(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:Nr(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,(A.safari&&Bc(g,y,e)||A.chrome&&Rc(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 Nr(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+es(o,r,n.state.tabSize)}function Bc(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 Pt(n,i-1,i).getBoundingClientRect().left>t}function Rc(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():Pt(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Lc(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 Vr(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=wc(s,r,o,l,t),c=Ll;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 Ec(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=Nl(n,{x:f,y:p},!1,r);if(ph.bottom||(r<0?gs))return m.cursor(g,e.assoc,void 0,o)}}function Tn(n,e,t){let i=n.state.facet(Ol).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 Ic{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=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=>{!Fr(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))},gs[t]),this.registeredEvents.push(t)}A.chrome&&A.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,A.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=>{!Fr(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){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;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:A.safari&&!A.ios&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!A.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 Vl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Fl=[16,17,18,20,91,92,224,225];class Nc{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)&&Vc(e,t),this.dragMove=Fc(e,t),this.dragging=Hc(e,t)&&Hs(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 Vc(n,e){let t=n.state.facet(xl);return t.length?t[0](e):A.mac?e.metaKey:e.ctrlKey}function Fc(n,e){let t=n.state.facet(kl);return t.length?t[0](e):A.mac?!e.altKey:!e.ctrlKey}function Hc(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=zi(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 Fr(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),gs=Object.create(null),Hl=A.ie&&A.ie_version<15||A.ios&&A.webkit_version<604;function Wc(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(),Wl(n,t.value)},50)}function Wl(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(ms!=null&&t.selection.ranges.every(h=>h.empty)&&ms==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():Fl.indexOf(e.keyCode)<0&&(n.inputState.lastEscPress=0)};ie.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ie.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};gs.touchstart=gs.touchmove={passive:!0};ie.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3&&Hs(e)==1)return;let t=null;for(let i of n.state.facet(Sl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=Kc(n,e)),t){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>ll(n.contentDOM)),n.inputState.startMouseSelection(new Nc(n,e,t,i))}};function Hr(n,e,t,i){if(i==1)return m.cursor(e,t);if(i==2)return Dc(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,Wr=(n,e,t)=>zl(e,t)&&n>=t.left&&n<=t.right;function zc(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&&Wr(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Wr(t,i,l)?1:o&&zl(i,o)?-1:1}function zr(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:zc(n,t,e.clientX,e.clientY)}}const qc=A.ie&&A.ie_version<=11;let qr=null,Kr=0,Ur=0;function Hs(n){if(!qc)return n.detail;let e=qr,t=Ur;return qr=n,Ur=Date.now(),Kr=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Kr+1)%3:1}function Kc(n,e){let t=zr(n,e),i=Hs(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=zr(n,l),o=l),!c||!t)return s;let f=Hr(n,c.pos,c.bias,i);if(t.pos!=c.pos&&!h){let u=Hr(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))?Uc(s,f):a?s.addRange(f):m.create([f])}}}function Uc(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 jr(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&&jr(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 jr(n,e,e.dataTransfer.getData("Text"),!0)};ie.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=Hl?null:e.clipboardData;t?(Wl(n,t.getData("text/plain")),e.preventDefault()):Wc(n)};function jc(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 Gc(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 ms=null;ie.copy=ie.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=Gc(n.state);if(!t&&!s)return;ms=s?t:null;let r=Hl?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):jc(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=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),ql(n)};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(A.chrome&&A.android&&(i=Vl.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 Gr=["pre-wrap","normal","pre-line","break-spaces"];class Jc{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 Gr.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)>Ni&&(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 tt(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 tt(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 tt(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 tt(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)>=Ni&&(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)>=Ni||Math.abs(h-this.lines(e.doc,t).lineHeight)>=Ni,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 Xc 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&&Jr(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 Jr(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 Yc=5;class Ws{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=Yc)&&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 ef(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Bn{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 je(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 ki(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?_r:new rf(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(ai).filter(a=>typeof a!="function");let s=e.changedRanges,r=je.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?ef:Zc)(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:M,charWidth:x}=e.docView.measureTextSize();o=s.refresh(r,M,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 M of this.viewports){let x=M.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(M);this.heightMap=this.heightMap.updateHeight(s,0,o,new $c(M.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 ki(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&&Yr(l,h.from-10,h.from+10),!h.empty&&h.to>=i.from&&h.to<=i.to&&Yr(l,h.to-10,h.to+10);for(let{from:a,to:c}of l)c-a>1e3&&t.push(sf(e,f=>f.from>=i.from&&f.to<=i.to&&Math.abs(f.from-a)<1e3&&Math.abs(f.to-c)<1e3)||new Bn(a,c,this.gapSize(i,a,c,s)))}return t}gapSize(e,t,i,s){let r=Xr(s,i)-Xr(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){Bn.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 ki{constructor(e,t){this.from=e,this.to=t}}function nf(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 Xr(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 Yr(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 sf(n,e){for(let t of n)if(e(t))return t}const _r={toDOM(n){return n},fromDOM(n){return n},scale:1};class rf{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 vi=T.define({combine:n=>n.join(" ")}),ys=T.define({combine:n=>n.indexOf(!0)>-1}),bs=rt.newName(),jl=rt.newName(),Gl=rt.newName(),Jl={"&light":"."+jl,"&dark":"."+Gl};function ws(n,e,t){return new rt(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 of=ws("."+bs,{"&.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":{flexShrink:0,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),lf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Rn=A.ie&&A.ie_version<=11;class hf{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);(A.ie&&A.ie_version<=11||A.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()}),Rn&&(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(fn)?t.root.activeElement!=this.dom:!Ii(t.dom,i))return;let s=i.anchorNode&&t.docView.nearest(i.anchorNode);s&&s.ignoreEvent(e)||((A.ie&&A.ie_version<=11||A.android&&A.chrome)&&!t.state.selection.main.empty&&i.focusNode&&qi(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1))}readSelectionRange(){let{view:e}=this,t=A.safari&&e.root.nodeType==11&&nc()==this.dom&&af(this.view)||zi(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=Ii(this.dom,t);return i&&!this.selectionChanged&&this.selectionRange.focusNode&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;this.delayedAndroidKey=null,this.delayedFlush=-1,this.flush()||ti(this.dom,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&&Ii(this.dom,this.selectionRange);if(t<0&&!r)return;this.view.inputState.lastFocusTime=0,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=Qr(t,e.previousSibling||e.target.previousSibling,-1),s=Qr(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 Qr(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 af(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 qi(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}function cf(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?[]:uf(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||A.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))}:(A.mac||A.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(A.ios&&n.inputState.flushIOSKey(n)||A.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(Cl).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=El(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,M=v-d.length;if(b.to-b.from!=y||n.state.sliceDoc(M,v)!=d||p&&b.to>=p.from&&b.from<=p.to)return{range:b};let x=l.changes({from:M,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 ff(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 uf(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 Br(t,i)),(s!=t||r!=i)&&e.push(new Br(s,r))),e}function df(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 $r(e.state||V.create(e)),this.plugins=this.state.facet($t).map(t=>new Dn(t));for(let t of this.plugins)t.update(this);this.observer=new hf(this,(t,i,s)=>cf(this,t,i,s),t=>{this.inputState.runScrollHandlers(this,t),this.observer.intersecting&&this.measure()}),this.inputState=new Ic(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Rr(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=ji.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 Ui(h.empty?h:m.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of l.effects)h.is(Or)&&(o=h.value)}this.viewState.update(s,o),this.bidiCache=Gi.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(vi)!=s.state.facet(vi)&&(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 $r(e),this.plugins=e.facet($t).map(i=>new Dn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Rr(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 Dn(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.forceFlush();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),Zr}}),h=ji.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),rt.mount(this.root,this.styleModules.concat(of).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 Tn(this,e,Vr(this,e,t,i))}moveByGroup(e,t){return Tn(this,e,Vr(this,e,t,i=>Pc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Lc(this,e,t,i)}moveVertically(e,t,i){return Tn(this,e,Ec(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(),Nl(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 hn(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(Al)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>pf)return Rl(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=bc(e.text,t);return this.bidiCache.push(new Gi(e.from,e.to,t,i)),i}get hasFocus(){var e;return(document.hasFocus()||A.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ll(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 Or.of(new Ui(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=rt.newName(),s=[vi.of(i),Xt.of(ws(`.${i}`,e))];return t&&t.dark&&s.push(ys.of(!0)),s}static baseTheme(e){return Wt.lowest(Xt.of(ws("."+bs,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=Cl;O.perLineTextDirection=Al;O.exceptionSink=vl;O.updateListener=fs;O.editable=fn;O.mouseSelectionStyle=Sl;O.dragMovesSelection=kl;O.clickAddsSelectionRange=xl;O.decorations=ai;O.atomicRanges=Ol;O.scrollMargins=Tl;O.darkTheme=ys;O.contentAttributes=Dl;O.editorAttributes=Ml;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=H.define();const pf=4096,Zr={};class Gi{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 gf=A.mac?"mac":A.windows?"win":A.linux?"linux":"key";function mf(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 bf(n,e,t){return Xl($l(n.state),e,n,t)}let Ye=null;const wf=4e3;function xf(n,e=gf){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=>mf(p,e));for(let p=1;p{let b=Ye={view:y,prefix:g,scope:o};return setTimeout(()=>{Ye==b&&(Ye=null)},wf),!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;Ye&&Ye.view==t&&Ye.scope==i&&(l=Ye.prefix+" ",(h=Fl.indexOf(e.keyCode)<0)&&(Ye=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+Ci(s,e,!o)]))return!0;if(o&&(e.shiftKey||e.altKey||e.metaKey||r>127)&&(f=ot[e.keyCode])&&f!=s){if(a(c[l+Ci(f,e,!0)]))return!0;if(e.shiftKey&&Rt[e.keyCode]!=f&&a(c[l+Ci(Rt[e.keyCode],e,!1)]))return!0}else if(o&&e.shiftKey&&a(c[l+Ci(s,e,!0)]))return!0}return h}const Yl=!A.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 kf(n={}){return[_t.of(n),Sf,vf]}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 Sf=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?[]:Cf(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=Af(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 vf=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 io(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 no(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 Cf(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=no(n,t),u=no(n,i),d=f.type==J.Text?f:null,p=u.type==J.Text?u:null;if(n.lineWrapping&&(d&&(d=io(n,t,d)),p&&(p=io(n,i,p))),d&&p&&d.from==p.from)return y(b(e.from,e.to,d));{let M=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,M.bottom,c,x.top)):M.bottomP&&G.from=E)break;I>C&&N(Math.max(q,C),M==null&&q<=P,Math.min(I,E),x==null&&I>=W,K.dir)}if(C=L.to+1,C>=E)break}return U.length==0&&N(P,M==null,W,x==null,n.textDirection),{top:D,bottom:B,horizontal:U}}function v(M,x){let S=o.top+(x?M.top:M.bottom);return{top:S,bottom:S,horizontal:[]}}}function Af(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)}}),Mf=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 Df(){return[Qt,Mf]}function so(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,l)}function Of(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 Tf{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,h,a,c)=>s(c,a,a+l[0].length,l,h);else if(i){let l=typeof i=="function"?i:()=>i;this.addMatch=(h,a,c,f)=>f(c,c+h[0].length,l(h,a,c))}else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new gt,i=t.add.bind(t);for(let{from:s,to:r}of Of(e,this.maxLength))so(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));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(b.range(g,y));if(h==a)for(this.regexp.lastIndex=c-h.from;(d=this.regexp.exec(h.text))&&d.indexthis.addMatch(y,e,g,p));t=t.update({filterFrom:c,filterTo:f,filter:(g,y)=>gf,add:u})}}return t}}const xs=/x/.unicode!=null?"gu":"g",Bf=new RegExp(`[\0-\b +-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,xs),Rf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ln=null;function Lf(){var n;if(Ln==null&&typeof document<"u"&&document.body){let e=document.body.style;Ln=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Ln||!1}const Vi=T.define({combine(n){let e=zt(n,{render:null,specialChars:Bf,addSpecialChars:null});return(e.replaceTabs=!Lf())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,xs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,xs)),e}});function Pf(n={}){return[Vi.of(n),Ef()]}let ro=null;function Ef(){return ro||(ro=ue.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Vi)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Tf({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=di(o.text,l,i-o.from);return R.replace({widget:new Ff((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new Vf(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Vi);n.startState.facet(Vi)!=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 If="\u2022";function Nf(n){return n>=32?If:n==10?"\u2424":String.fromCharCode(9216+n)}class Vf extends xt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Nf(this.code),i=e.state.phrase("Control character")+" "+(Rf[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 Ff 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 Hf 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 oo(n){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=R.set([R.widget({widget:new Hf(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:e=>e.decorations})}const ks=2e3;function Wf(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ks||t.off>ks||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=es(a.text,o,n.tabSize,!0);if(c>-1){let f=es(a.text,l,n.tabSize);r.push(m.range(a.from+c,a.from+f))}}}return r}function zf(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function lo(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>ks?-1:s==i.length?zf(n,e.clientX):di(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function qf(n,e){let t=lo(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=lo(n,s);if(!l)return i;let h=Wf(n.state,t,l);return h.length?o?m.create(h.concat(i.ranges)):m.create(h):i}}:null}function Kf(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?qf(t,i):null)}const Pn="-10000px";class Uf{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:A.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)||jf}}}),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(En);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 Uf(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(En);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(En).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||Jf,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,M=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:M,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()}}}),Gf=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"}}}),Jf={x:0,y:0},ih=T.define({enables:[th,Gf]});function $f(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 ho=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($i),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(ho);this.top=new Ai(n,!0,e.topContainer),this.bottom=new Ai(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(ho);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ai(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ai(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet($i);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 Ai{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=ao(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ao(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 ao(n){let e=n.nextSibling;return n.remove(),e}const $i=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 Xf=T.define(),Yf=new class extends yt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},_f=Xf.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(Yf.range(s)))}return Y.of(e)});function Qf(){return _f}const Zf=1024;let eu=0;class In{constructor(e,t){this.from=e,this.to=t}}class F{constructor(e={}){this.id=eu++,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 tu=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):tu,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 qs{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:js(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 nu(e)}}_.empty=new _(we.none,[],[],0);class Ks{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 Ks(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 it(new iu(o,c,e,f),null,u)}else if(r&ae.IncludeAnonymous||!c.type.isAnonymous||Us(c)){let u;if(!(r&ae.IgnoreMounts)&&c.props&&(u=c.prop(F.mounted))&&!u.overlay)return new Ge(u.tree,f,e,o);let d=new Ge(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 Ge(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 _i(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=Xi(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Xi(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return Yi(this,e)}}function Xi(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 Yi(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 iu{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class it{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 it(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 it(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 it(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 it(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new _i(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=Xi(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Xi(this,e,t,i)}get node(){return this}matchContext(e){return Yi(this,e)}}class _i{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ge)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 Ge?(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||Us(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 Yi(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 Us(n){return n.children.some(e=>e instanceof kt||!e.type.isAnonymous||Us(e))}function nu(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Zf,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Ks(t,t.length):t,h=i.types,a=0,c=0;function f(x,S,D,B,U){let{id:N,start:P,end:W,size:G}=l,C=c;for(;G<0;)if(l.next(),G==-1){let I=r[N];D.push(I),B.push(P-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],L,K,q=P-x;if(W-P<=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);L=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,mi=W;for(;l.pos>I;)ht>=0&&l.id==ht&&l.size>=0?(l.end<=mi-s&&(d(ne,de,P,St,l.end,mi,ht,C),St=ne.length,mi=l.end),l.next()):f(P,I,ne,de,ht);if(ht>=0&&St>0&&St-1&&St>0){let hr=u(E);L=js(E,ne,de,0,ne.length,0,W-P,hr,hr)}else L=p(E,ne,de,W-P,C-W)}D.push(L),B.push(q)}function u(x){return(S,D,B)=>{let U=0,N=S.length-1,P,W;if(N>=0&&(P=S[N])instanceof _){if(!N&&P.type==x&&P.length==B)return P;(W=P.prop(F.lookAhead))&&(U=D[N]+P.length+W)}return p(x,S,D,B,U)}}function d(x,S,D,B,U,N,P,W){let G=[],C=[];for(;x.length>B;)G.push(x.pop()),C.push(S.pop()+D-U);x.push(p(i.types[P],G,C,N-U,W-N)),S.push(U-D)}function p(x,S,D,B,U=0,N){if(a){let P=[F.contextHash,a];N=N?[P].concat(N):[P]}if(U>25){let P=[F.lookAhead,U];N=N?[P].concat(N):[P]}return new _(x,S,D,B,N)}function g(x,S){let D=l.fork(),B=0,U=0,N=0,P=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)L+=4;else break e;else D.id>=o&&(L+=4);D.next()}U=K,B+=C,N+=L}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:P}=l;if(l.next(),P>=0&&B4){let G=l.pos-(P-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 P==-3?a=B:P==-4&&(c=B);return D}let b=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,b,v,-1);let M=(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(),M)}const fo=new WeakMap;function Fi(n,e){if(!n.isAnonymous||e instanceof kt||e.type!=n)return 1;let t=fo.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof _)){t=1;break}t+=Fi(n,i)}fo.set(e,t)}return t}function js(n,e,t,i,s,r,o,l,h){let a=0;for(let p=i;p=c)break;D+=B}if(M==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[M-1]+p[M-1].length-S;f.push(js(n,p,g,x,M,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 In(s.from,s.to)):[new In(0,0)]:[new In(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 su{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 ru=0;class Ne{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=ru++}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 Qi;return t=>t.modified.indexOf(e)>-1?t:Qi.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let ou=0;class Qi{constructor(){this.instances=[],this.id=ou++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&lu(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(Qi.get(l,h));return r}}function lu(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 au(i,o,h>0?r.slice(0,h):null);e[a]=c.sort(e[a])}}return hh.add(e)}const hh=new F;class au{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 cu(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function fu(n,e,t,i=0,s=n.length){let r=new uu(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class uu{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=cu(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=M||!e.nextSibling())););if(!v||M>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,Di=w(),$e=w(),uo=w($e),po=w($e),Xe=w(),Oi=w(Xe),Nn=w(Xe),Ie=w(),at=w(Ie),Pe=w(),Ee=w(),Ss=w(),jt=w(Ss),Ti=w(),k={comment:Di,lineComment:w(Di),blockComment:w(Di),docComment:w(Di),name:$e,variableName:w($e),typeName:uo,tagName:w(uo),propertyName:po,attributeName:w(po),className:w($e),labelName:w($e),namespace:w($e),macroName:w($e),literal:Xe,string:Oi,docString:w(Oi),character:w(Oi),attributeValue:w(Oi),number:Nn,integer:w(Nn),float:w(Nn),bool:w(Xe),regexp:w(Xe),escape:w(Xe),color:w(Xe),url:w(Xe),keyword:Pe,self:w(Pe),null:w(Pe),atom:w(Pe),unit:w(Pe),modifier:w(Pe),operatorKeyword:w(Pe),controlKeyword:w(Pe),definitionKeyword:w(Pe),moduleKeyword:w(Pe),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:Ss,separator:w(Ss),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:Ti,documentMeta:w(Ti),annotation:w(Ti),processingInstruction:w(Ti),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 Vn;const ci=new F;function du(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(go(s,r,o)))].concat(i)}isActiveAt(e,t,i=-1){return go(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(ci)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(F.mounted);if(l){if(l.tree.prop(ci)==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 pu(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=mo(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=mo(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 mo(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<"u"&&(ch=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Fn=typeof navigator<"u"&&((Vn=navigator.scheduling)===null||Vn===void 0?void 0:Vn.isInputPending)?()=>navigator.scheduling.isInputPending():null,gu=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(()=>Fn&&Fn()||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,gu]}),fh=T.define(),Gs=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(Gs);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Zi(n,e){let t="",i=n.tabSize;if(n.facet(Gs).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 di(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 mu=new F;function yu(n,e,t){return dh(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function bu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function wu(n){let e=n.type.prop(mu);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=>vu(o,!0,1,void 0,r&&!bu(o)?s.from:void 0)}return n.parent==null?xu:null}function dh(n,e,t){for(;n;n=n.parent){let i=wu(n);if(i)return i(Js.create(t,e,n))}return null}function xu(){return 0}class Js extends un{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 Js(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(ku(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 ku(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function Su(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(ci)==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 rt(i):null,this.themeType=t.themeType}static define(e,t){return new dn(e,t||{})}}const vs=T.define(),ph=T.define({combine(n){return n.length?[n[0]]:null}});function Hn(n){let e=n.facet(vs);return e.length?e:n.facet(ph)}function Cu(n,e){let t=[Mu],i;return n instanceof dn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(ph.of(n)):i?t.push(vs.computeN([O.darkTheme],s=>s.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(vs.of(n)),t}class Au{constructor(e){this.markCache=Object.create(null),this.tree=xe(e.state),this.decorations=this.buildDeco(e,Hn(e.state))}update(e){let t=xe(e.state),i=Hn(e.state),s=i!=Hn(e.startState);t.length{i.add(o,l,this.markCache[h]||(this.markCache[h]=R.mark({class:h})))},s,r);return i.finish()}}const Mu=Wt.high(ue.fromClass(Au,{decorations:n=>n.decorations})),Du=dn.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"}]),Ou=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:Ru})}}),Tu=R.mark({class:"cm-matchingBracket"}),Bu=R.mark({class:"cm-nonmatchingBracket"});function Ru(n){let e=[],t=n.matched?Tu:Bu;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 Lu=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=[Lu,Ou];function Eu(n={}){return[yh.of(n),Pu]}function Cs(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=Cs(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 yo(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 Vu(n){return{token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Fu,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Ys}}function Fu(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 $s extends Be{constructor(e){let t=du(e.languageData),i=Vu(e),s,r=new class extends oh{createParse(o,l,h){return new Wu(s,o,l,h)}};super(t,r,[fh.of((o,l)=>this.getIndent(o,l))]),this.topNode=Ku(t),s=this,this.streamParser=i,this.stateAfter=new F({perNode:!0}),this.tokenTable=e.tokenTable?new Sh(i.tokenTable):qu}static define(e){return new $s(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=Xs(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&&Xs(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 Wu{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}=Hu(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 Ys=Object.create(null),fi=[we.none],zu=new qs(fi),bo=[],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(Ys,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 qu=new Sh(Ys);function Wn(n,e){bo.indexOf(n)>-1||(bo.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):Wn(r,`Modifier ${r} used at start of tag`):t?Wn(r,`Tag ${r} used as modifier`):t=o:Wn(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=we.define({id:fi.length,name:i,props:[hu({[i]:t})]});return fi.push(s),s.id}function Ku(n){let e=we.define({id:fi.length,name:"Document",props:[ci.add(()=>n)]});return fi.push(e),e}const Uu=n=>{let e=Qs(n.state);return e.line?ju(n):e.block?Ju(n):!1};function _s(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 ju=_s(Yu,0),Gu=_s(Ch,0),Ju=_s((n,e)=>Ch(n,e,Xu(e)),0);function Qs(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Jt=50;function $u(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 Xu(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=>Qs(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>$u(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=Qs(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 As=wt.define(),_u=wt.define(),Qu=T.define(),Ah=T.define({combine(n){return zt(n,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}});function Zu(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(As);if(i){let h=e.docChanged?m.single(Zu(e.changes)):void 0,a=ye.fromTransaction(e,h),c=i.side,f=c==0?n.undone:n.done;return a?f=en(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 ed(n={}){return[Mh,Ah.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Dh:e.inputType=="historyRedo"?Ms:null;return i?(e.preventDefault(),i(t)):!1}})]}function pn(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=pn(0,!1),Ms=pn(1,!1),td=pn(0,!0),id=pn(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(Qu)){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 en(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 nd(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 sd(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=[],rd=200;function Th(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-rd));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),en(n,n.length-1,1e9,t.setSelAfter(i)))}else return[ye.selection([e])]}function od(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 zn(n,e){if(!n.length)return n;let t=n.length,i=Oe;for(;t;){let s=ld(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 ld(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 hd=/^(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||hd.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):gn(t,e))}function Te(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Rh=n=>Bh(n,!Te(n)),Lh=n=>Bh(n,Te(n));function Ph(n,e){return Je(n,t=>t.empty?n.moveByGroup(t,e):gn(t,e))}const cd=n=>Ph(n,!Te(n)),fd=n=>Ph(n,Te(n));function ud(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 mn(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;ud(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 dd=n=>Je(n,e=>mn(n.state,e,!Te(n))),pd=n=>Je(n,e=>mn(n.state,e,Te(n)));function Eh(n,e){return Je(n,t=>{if(!t.empty)return gn(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)):gn(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),Ds=n=>Fh(n,!0);function yn(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 xo=n=>Je(n,e=>yn(n,e,!0)),ko=n=>Je(n,e=>yn(n,e,!1)),gd=n=>Je(n,e=>m.cursor(n.lineBlockAt(e.head).from,1)),md=n=>Je(n,e=>m.cursor(n.lineBlockAt(e.head).to,-1));function yd(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.headyd(n,e,!1);function Ue(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(Ke(n.state,t)),!0)}function Hh(n,e){return Ue(n,t=>n.moveByChar(t,e))}const Wh=n=>Hh(n,!Te(n)),zh=n=>Hh(n,Te(n));function qh(n,e){return Ue(n,t=>n.moveByGroup(t,e))}const wd=n=>qh(n,!Te(n)),xd=n=>qh(n,Te(n)),kd=n=>Ue(n,e=>mn(n.state,e,!Te(n))),Sd=n=>Ue(n,e=>mn(n.state,e,Te(n)));function Kh(n,e){return Ue(n,t=>n.moveVertically(t,e))}const Uh=n=>Kh(n,!1),jh=n=>Kh(n,!0);function Gh(n,e){return Ue(n,t=>n.moveVertically(t,e,Vh(n)))}const So=n=>Gh(n,!1),vo=n=>Gh(n,!0),Co=n=>Ue(n,e=>yn(n,e,!0)),Ao=n=>Ue(n,e=>yn(n,e,!1)),vd=n=>Ue(n,e=>m.cursor(n.lineBlockAt(e.head).from)),Cd=n=>Ue(n,e=>m.cursor(n.lineBlockAt(e.head).to)),Mo=({state:n,dispatch:e})=>(e(Ke(n,{anchor:0})),!0),Do=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.doc.length})),!0),Oo=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.selection.main.anchor,head:0})),!0),To=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Ad=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Md=({state:n,dispatch:e})=>{let t=xn(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},Dd=({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(Ke(n,t)),!0},Od=({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(Ke(n,i)),!0):!1};function bn({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 wn(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)=>bn(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)=>bn(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 wn(n,i,e)}),Yh=n=>Xh(n,!1),Td=n=>Xh(n,!0),_h=n=>bn(n,e=>{let t=n.lineBlockAt(e).to;return wn(n,ebn(n,e=>{let t=n.lineBlockAt(e).from;return wn(n,e>t?t:Math.max(0,e-1),!1)}),Rd=({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},Ld=({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 xn(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 xn(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),Ed=({state:n,dispatch:e})=>Qh(n,e,!0);function Zh(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of xn(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 Id=({state:n,dispatch:e})=>Zh(n,e,!1),Nd=({state:n,dispatch:e})=>Zh(n,e,!0),Vd=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(xn(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 Fd(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 Hd=ea(!1),Wd=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&&Fd(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let a=new un(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 zd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new un(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=Zs(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=Zi(n,h);(a!=c||l.fromn.readOnly?!1:(e(n.update(Zs(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Gs)})}),{userEvent:"input.indent"})),!0),Kd=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Zs(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=di(s,n.tabSize),o=0,l=Zi(n,Math.max(0,r-bt(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),Gd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:dd,shift:kd},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pd,shift:Sd},{key:"Alt-ArrowUp",run:Pd},{key:"Shift-Alt-ArrowUp",run:Id},{key:"Alt-ArrowDown",run:Ed},{key:"Shift-Alt-ArrowDown",run:Nd},{key:"Escape",run:Od},{key:"Mod-Enter",run:Wd},{key:"Alt-l",mac:"Ctrl-l",run:Md},{key:"Mod-i",run:Dd,preventDefault:!0},{key:"Mod-[",run:Kd},{key:"Mod-]",run:qd},{key:"Mod-Alt-\\",run:zd},{key:"Shift-Mod-k",run:Vd},{key:"Shift-Mod-\\",run:bd},{key:"Mod-/",run:Uu},{key:"Alt-A",run:Gu}].concat(jd);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(Bo(o)):Bo,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=Ls(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 qn.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<"u"&&(na.prototype[Symbol.iterator]=sa.prototype[Symbol.iterator]=function(){return this});function Jd(n){try{return new RegExp(n,er),!0}catch{return!1}}function Ts(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:tn.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:tn.of(!1),selection:m.cursor(d.from+Math.max(0,Math.min(f,d.length))),scrollIntoView:!0}),n.focus()}return{dom:t}}const tn=H.define(),Ro=ke.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(tn)&&(n=t.value);return n},provide:n=>$i.from(n,e=>e?Ts:null)}),$d=n=>{let e=Ji(n,Ts);if(!e){let t=[tn.of(!0)];n.state.field(Ro,!1)==null&&t.push(H.appendConfig.of([Ro,Xd])),n.dispatch({effects:t}),e=Ji(n,Ts)}return e&&e.dom.querySelector("input").focus(),!0},Xd=O.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Yd={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ra=T.define({combine(n){return zt(n,Yd,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function _d(n){let e=[ip,tp];return n&&e.push(ra.of(n)),e}const Qd=R.mark({class:"cm-selectionMatch"}),Zd=R.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Lo(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 ep(n,e,t,i){return n(e.sliceDoc(t,t+1))==ce.Word&&n(e.sliceDoc(i-1,i))==ce.Word}const tp=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),!(Lo(o,t,s.from,s.to)&&ep(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||Lo(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Zd.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Qd.range(c,f)),l.length>e.maxMatches))return R.none}}return R.set(l)}},{decorations:n=>n.decorations}),ip=O.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),np=({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 sp(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 rp=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return np({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=sp(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},tr=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 gp(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||Jd(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 lp(this):new op(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 op 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 lp 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 ui=H.define(),ir=H.define(),nt=ke.define({create(n){return new Kn(Bs(n).create(),null)},update(n,e){for(let t of e.effects)t.is(ui)?n=new Kn(t.value.create(),n.panel):t.is(ir)&&(n=new Kn(n.query,t.value?nr:null));return n},provide:n=>$i.from(n,e=>e.panel)});class Kn{constructor(e,t){this.query=e,this.panel=t}}const hp=R.mark({class:"cm-searchMatch"}),ap=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cp=ue.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(nt))}update(n){let e=n.state.field(nt);(e!=n.startState.field(nt)||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?ap:hp)})}return i.finish()}},{decorations:n=>n.decorations});function gi(n){return e=>{let t=e.state.field(nt,!1);return t&&t.query.spec.valid?n(e,t):ha(e)}}const nn=gi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state.doc,t,t);return i?(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:sr(n,i),userEvent:"select.search"}),!0):!1}),sn=gi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t.doc,i,i);return s?(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:sr(n,s),userEvent:"select.search"}),!0):!1}),fp=gi((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)}),up=({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=gi((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(sr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),dp=gi((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 nr(n){return n.state.facet(tr).createPanel(n)}function Bs(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(tr).caseSensitive;return e&&!s?e:new oa({search:s.replace(/\n/g,"\\n"),caseSensitive:r})}const ha=n=>{let e=n.state.field(nt,!1);if(e&&e.panel){let t=Ji(n,nr);if(!t)return!1;let i=t.dom.querySelector("[main-field]");if(i&&i!=n.root.activeElement){let s=Bs(n.state,e.query.spec);s.valid&&n.dispatch({effects:ui.of(s)}),i.focus(),i.select()}}else n.dispatch({effects:[ir.of(!0),e?ui.of(Bs(n.state,e.query.spec)):H.appendConfig.of(yp)]});return!0},aa=n=>{let e=n.state.field(nt,!1);if(!e||!e.panel)return!1;let t=Ji(n,nr);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:ir.of(!1)}),!0},pp=[{key:"Mod-f",run:ha,scope:"editor search-panel"},{key:"F3",run:nn,shift:sn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:nn,shift:sn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:up},{key:"Alt-g",run:$d},{key:"Mod-d",run:rp,preventDefault:!0}];class gp{constructor(e){this.view=e;let t=this.query=e.state.field(nt).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",()=>nn(e),[Me(e,"next")]),i("prev",()=>sn(e),[Me(e,"previous")]),i("select",()=>fp(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",()=>dp(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:ui.of(e)}))}keydown(e){bf(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?sn:nn)(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(ui)&&!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(tr).top}}function Me(n,e){return n.state.phrase(e)}const Bi=30,Ri=/[\s\.,:;?!]/;function sr(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-Bi),o=Math.min(s,t+Bi),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let h=0;hl.length-Bi;h--)if(!Ri.test(l[h-1])&&Ri.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 mp=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"}}),yp=[nt,Wt.lowest(cp),mp];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 Eo(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 bp(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+$/]:bp(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Io{constructor(e,t,i){this.completion=e,this.source=t,this.match=i}}function st(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 xp(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(xp(n.state,t,i.from,i.to)):t(n,e.completion,i.from,i.to)}const No=new WeakMap;function kp(n){if(!Array.isArray(n))return n;let e=No.get(n);return e||No.set(n,e=wp(n)),e}class Sp{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=Ls(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 qe=T.define({combine(n){return zt(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],compareCompletions:(e,t)=>e.label.localeCompare(t.label)},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>i=>vp(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function vp(n,e){return n?e?n+" "+e:n:e}function Cp(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 Vo(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),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 Ap{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(qe);this.optionContent=Cp(o),this.optionClass=o.optionClass,this.range=Vo(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=Vo(t.options.length,t.selected,this.view.state.facet(qe).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&&Dp(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 Ap(e,n)}function Dp(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function Fo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Op(n,e){let t=[],i=0;for(let l of n)if(l.hasResult())if(l.result.filter===!1){let h=l.result.getMatch;for(let a of l.result.options){let c=[1e9-i++];if(h)for(let f of h(a))c.push(f);t.push(new Io(a,l,c))}}else{let h=new Sp(e.sliceDoc(l.from,l.to)),a;for(let c of l.result.options)(a=h.match(c.label))&&(c.boost!=null&&(a[0]+=c.boost),t.push(new Io(c,l,a)))}let s=[],r=null,o=e.facet(qe).compareCompletions;for(let l of t.sort((h,a)=>a.match[0]-h.match[0]||o(h.completion,a.completion)))!r||r.label!=l.completion.label||r.detail!=l.completion.detail||r.type!=null&&l.completion.type!=null&&r.type!=l.completion.type||r.apply!=l.completion.apply?s.push(l):Fo(l.completion)>Fo(r)&&(s[s.length-1]=l),r=l.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,Ho(t,e),this.tooltip,this.timestamp,e)}static build(e,t,i,s,r){let o=Op(e,t);if(!o.length)return null;let l=t.facet(qe).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let h=s.options[s.selected].completion;for(let a=0;aa.hasResult()?Math.min(h,a.from):h,1e8),create:Mp(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 rn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new rn(Rp,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(qe),r=(i.override||t.languageDataAt("autocomplete",st(t)).map(kp)).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))||!Tp(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 rn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Bp}}function Tp(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Rp=[];function Rs(n){return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class ge{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=Rs(e),s=this;i?s=s.handleUserEvent(e,i,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new ge(s.source,0));for(let r of e.effects)if(r.is(rr))s=new ge(s.source,1,r.value?st(e.state):-1);else if(r.is(on))s=new ge(s.source,0);else if(r.is(da))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new ge(this.source,1)}handleChange(e){return e.changes.touchesRange(st(e.startState))?new ge(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ge(this.source,this.state,e.mapPos(this.explicitPos))}}class ni extends ge{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var s;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=st(e.state);if((this.explicitPos<0?l<=r:lo||t=="delete"&&st(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 Lp(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:st(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 Lp(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 rr=H.define(),on=H.define(),da=H.define({map(n,e){return n.map(t=>t.map(e))}}),pa=H.define(),De=ke.define({create(){return rn.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 Li(n,e="option"){return t=>{let i=t.state.field(De,!1);if(!i||!i.open||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:pa.of(l)}),!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:rr.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:on.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 Wo=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)&&!Rs(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(),Wo):-1,this.composing!=0)for(let i of n.transactions)Rs(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=st(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:on.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(),Wo))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(qe);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(qe).closeOnBlur&&this.view.dispatch({effects:on.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:rr.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"}}}),ln={brackets:["(","[","{","'",'"'],before:")]}:;>"},ft=H.define({map(n,e){let t=e.mapPos(n,-1,me.TrackAfter);return t==null?void 0:t}}),or=H.define({map(n,e){return e.mapPos(n)}}),lr=new class extends pt{};lr.startSide=1;lr.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:[lr.range(t.value,t.value+1)]}):t.is(or)&&(n=n.update({filter:i=>i!=t.value}));return n}});function zp(){return[Kp,ma]}const Un="()[]{}<>";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||ln.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&&kn(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||ln.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||ln.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 kn(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=kn(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&&kn(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})=>or.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=kn(n.doc,o);if(l==e){if(zo(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:or.of(o)}}}else{if(t&&n.sliceDoc(o-2*e.length,o)==e+e&&zo(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 zo(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,qe.of(n),Hp,Zp,Wp]}const xa=[{key:"Ctrl-Space",run:Ep},{key:"Escape",run:Ip},{key:"ArrowDown",run:Li(!0)},{key:"ArrowUp",run:Li(!1)},{key:"PageDown",run:Li(!0,"page")},{key:"PageUp",run:Li(!1,"page")},{key:"Enter",run:Pp}],Zp=Wt.highest(zs.computeN([qe],n=>n.facet(qe).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 La}=e,{singleLine:c=!1}=e,{extraAutocompleteKeys:f=[]}=e,{disableRequestKeys:u=!1}=e,{disableIndirectCollectionsKeys:d=!1}=e,p,g,y=new Qe,b=new Qe,v=new Qe,M=new Qe;function x(){p==null||p.focus()}function S(C){let E=C.slice();return vn.pushOrReplaceByKey(E,a,"id"),E}function D(){g==null||g.dispatchEvent(new CustomEvent("change",{detail:{value:o},bubbles:!0}))}function B(C,E="",L=0){let K=i.find(I=>I.name==C||I.id==C);if(!K||L>=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+".",L+1);de.length?q=q.concat(de):q.push(ne)}else q.push(ne)}return q}function U(C=!0,E=!0){let L=[].concat(f);const K=B(a.name);for(const q of K)L.push(q);if(C&&(L.push("@request.method"),L.push("@request.query."),L.push("@request.data."),L.push("@request.user.id"),L.push("@request.user.email"),L.push("@request.user.verified"),L.push("@request.user.created"),L.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)L.push(de)}return L.sort(function(q,I){return I.length-q.length}),L}function N(C){let E=C.matchBefore(/[\@\w\.]*/);if(E.from==E.to&&!C.explicit)return null;let L=[{label:"false"},{label:"true"}];d||L.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)||L.push({label:I.endsWith(".")?I+"*":I,apply:I});return{from:E.from,options:L}}function P(){const C=[],E=U(!u,!d);for(const L of E){let K;L.endsWith(".")?K=vn.escapeRegExp(L)+"\\w+[\\w.]*":K=vn.escapeRegExp(L),C.push({regex:K,token:"keyword"})}return C}function W(){return $s.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(P())}))}Pa(()=>{const C={key:"Enter",run:E=>{c&&r("submit",o)}};return t(10,p=new O({parent:g,state:V.create({doc:o,extensions:[Qf(),Pf(),ed(),kf(),Df(),V.allowMultipleSelections.of(!0),Cu(Du,{fallback:!0}),Eu(),zp(),Kf(),_d(),zs.of([C,...jp,...Gd,...pp,...ad,...xa]),O.lineWrapping,Qp({override:[N],icons:!1}),M.of(oo(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<"u"&&(p.dispatch({effects:[b.reconfigure(O.editable.of(!l)),v.reconfigure(V.readOnly.of(l))]}),D()),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<"u"&&p.dispatch({effects:[M.reconfigure(oo(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/FilterAutocompleteInput.22ad58b4.js b/ui/dist/assets/FilterAutocompleteInput.22ad58b4.js deleted file mode 100644 index abc6c238..00000000 --- a/ui/dist/assets/FilterAutocompleteInput.22ad58b4.js +++ /dev/null @@ -1,12 +0,0 @@ -import{S as Sa,i as va,s as Ca,e as Aa,f as Ma,g as Da,y as xn,o as Oa,G as Ta,H as Ba,I as Ra,J as Pa,K as La,C as kn,L as Ea}from"./index.38300823.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 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<"u"&&(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>"u"?"__"+Zn:Symbol.for(Zn),es=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),yr=typeof globalThis<"u"?globalThis:typeof window<"u"?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<"u"){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<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qa=typeof navigator<"u"&&/Apple Computer/.test(navigator.vendor),Za=typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),wr=typeof navigator<"u"&&/Mac/.test(navigator.platform),ec=typeof navigator<"u"&&/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<"u"&&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<"u"&&(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<"u"&&((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),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<"u"&&(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:"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<"u"&&(p.dispatch({effects:[b.reconfigure(O.editable.of(!l)),v.reconfigure(V.readOnly.of(l))]}),D()),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<"u"&&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/PageAdminConfirmPasswordReset.0023ef63.js b/ui/dist/assets/PageAdminConfirmPasswordReset.323b4a2b.js similarity index 98% rename from ui/dist/assets/PageAdminConfirmPasswordReset.0023ef63.js rename to ui/dist/assets/PageAdminConfirmPasswordReset.323b4a2b.js index 10e0f9b8..ba32dd9b 100644 --- a/ui/dist/assets/PageAdminConfirmPasswordReset.0023ef63.js +++ b/ui/dist/assets/PageAdminConfirmPasswordReset.323b4a2b.js @@ -1,2 +1,2 @@ -import{S as E,i as G,s as I,F as K,c as F,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as k,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.38300823.js";function y(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&&Z(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=h(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=h(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,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({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 E,i as G,s as I,F as K,c as F,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as k,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.d16cb8a0.js";function y(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&&Z(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=h(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=h(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,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({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],L(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),B(r,e,null),_(e,p),B(d,e,null),_(e,n),_(e,i),_(i,g),b(a,R,$),b(a,C,$),_(C,v),P=!0,A||(j=[h(e,"submit",O(f[4])),Q(U.call(null,v))],A=!0)},p(a,$){a[3]?m?m.p(a,$):(m=y(a),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const z={};$&769&&(z.$$scope={dirty:$,ctx:a}),r.$set(z);const D={};$&770&&(D.$$scope={dirty:$,ctx:a}),d.$set(D),(!P||$&4)&&(i.disabled=a[2]),$&4&&L(i,"btn-loading",a[2])},i(a){P||(H(r.$$.fragment,a),H(d.$$.fragment,a),P=!0)},o(a){N(r.$$.fragment,a),N(d.$$.fragment,a),P=!1},d(a){a&&w(e),m&&m.d(),T(r),T(d),a&&w(R),a&&w(C),A=!1,V(j)}}}function se(f){let e,o;return e=new K({props:{$$slots:{default:[te]},$$scope:{ctx:f}}}),{c(){F(e.$$.fragment)},m(s,l){B(e,s,l),o=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){o||(H(e.$$.fragment,s),o=!0)},o(s){N(e.$$.fragment,s),o=!1},d(s){T(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 W.Admins.confirmPasswordReset(l==null?void 0:l.token,t,r),X("Successfully set a new admin password."),Y("/")}catch(g){W.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 E{constructor(e){super(),G(this,e,le,se,I,{params:5})}}export{ae as default}; diff --git a/ui/dist/assets/PageAdminRequestPasswordReset.bb44d6f7.js b/ui/dist/assets/PageAdminRequestPasswordReset.d2e89221.js similarity index 98% rename from ui/dist/assets/PageAdminRequestPasswordReset.bb44d6f7.js rename to ui/dist/assets/PageAdminRequestPasswordReset.d2e89221.js index 1724dab7..f3474ce5 100644 --- a/ui/dist/assets/PageAdminRequestPasswordReset.bb44d6f7.js +++ b/ui/dist/assets/PageAdminRequestPasswordReset.d2e89221.js @@ -1,2 +1,2 @@ -import{S as E,i as M,s as T,F as j,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as z,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as A,v as I,w as h,x as J,y as P,z as R}from"./index.38300823.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({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 as E,i as M,s as T,F as j,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as z,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as A,v as I,w as h,x as J,y as P,z as R}from"./index.d16cb8a0.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({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(),H(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),L(l,e,null),d(e,t),d(e,o),d(o,f),d(o,m),d(o,i),a=!0,b||(u=A(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),S(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=A(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=z(B.call(null,t)),f=!0)},p(u,r){let $=e;e=b(u),e===$?a[e].p(u,r):(N(),y(a[$],1,1,()=>{a[$]=null}),D(),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 j({props:{$$slots:{default:[U]},$$scope:{ctx:c}}}),{c(){H(e.$$.fragment)},m(n,l){L(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){S(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 E{constructor(e){super(),M(this,e,W,V,T,{})}}export{Y as default}; diff --git a/ui/dist/assets/PageUserConfirmEmailChange.c2566a53.js b/ui/dist/assets/PageUserConfirmEmailChange.a77f7118.js similarity index 98% rename from ui/dist/assets/PageUserConfirmEmailChange.c2566a53.js rename to ui/dist/assets/PageUserConfirmEmailChange.a77f7118.js index 2e8dfc3a..a2b7a4f0 100644 --- a/ui/dist/assets/PageUserConfirmEmailChange.c2566a53.js +++ b/ui/dist/assets/PageUserConfirmEmailChange.a77f7118.js @@ -1,4 +1,4 @@ -import{S as J,i as M,s as N,F as R,c as S,m as U,t as $,a as v,d as z,C as W,E as Y,g as _,k as j,n as A,o as b,p as F,q as B,e as m,w as y,b as C,f as d,r as H,h as k,u as E,v as D,y as h,x as G,z as T}from"./index.38300823.js";function I(r){let e,s,t,l,n,o,c,a,i,u,g,q,p=r[3]&&L(r);return o=new B({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 J,i as M,s as N,F as R,c as S,m as U,t as $,a as v,d as z,C as W,E as Y,g as _,k as j,n as A,o as b,p as F,q as B,e as m,w as y,b as C,f as d,r as H,h as k,u as E,v as D,y as h,x as G,z as T}from"./index.d16cb8a0.js";function I(r){let e,s,t,l,n,o,c,a,i,u,g,q,p=r[3]&&L(r);return o=new B({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],H(a,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,s),k(s,t),k(t,l),p&&p.m(t,null),k(e,n),U(o,e,null),k(e,c),k(e,a),k(a,i),u=!0,g||(q=E(e,"submit",D(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=L(f),p.c(),p.m(t,null)):p&&(p.d(1),p=null);const P={};w&769&&(P.$$scope={dirty:w,ctx:f}),o.$set(P),(!u||w&2)&&(a.disabled=f[1]),w&2&&H(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(),z(o),g=!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 L(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),k(s,t)},p(l,n){n&8&&G(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),k(e,s),_(i,l,u),_(i,n,u),T(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]&&T(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=Y()},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):(j(),v(o[u],1,1,()=>{o[u]=null}),A(),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 R({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){z(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 F.Users.confirmEmailChange(l==null?void 0:l.token,n),s(2,c=!0)}catch(g){F.errorResponseHandler(g)}s(1,o=!1)}}const i=()=>window.close();function u(){n=this.value,s(0,n)}return r.$$set=g=>{"params"in g&&s(5,l=g.params)},r.$$.update=()=>{r.$$.dirty&32&&s(3,t=W.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,t,a,l,i,u]}class x extends J{constructor(e){super(),M(this,e,X,V,N,{params:5})}}export{x as default}; diff --git a/ui/dist/assets/PageUserConfirmPasswordReset.9fab9e12.js b/ui/dist/assets/PageUserConfirmPasswordReset.c5680e29.js similarity index 98% rename from ui/dist/assets/PageUserConfirmPasswordReset.9fab9e12.js rename to ui/dist/assets/PageUserConfirmPasswordReset.c5680e29.js index 620f9153..36d2e851 100644 --- a/ui/dist/assets/PageUserConfirmPasswordReset.9fab9e12.js +++ b/ui/dist/assets/PageUserConfirmPasswordReset.c5680e29.js @@ -1,4 +1,4 @@ -import{S as W,i as Y,s as j,F as A,c as H,m as N,t as P,a as q,d as S,C as B,E as D,g as _,k as G,n as I,o as m,p as z,q as E,e as b,w as y,b as C,f as c,r as J,h as w,u as h,v as K,y as F,x as O,z as R}from"./index.38300823.js";function Q(i){let e,l,t,n,s,o,p,a,r,u,v,g,k,L,d=i[4]&&M(i);return o=new E({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),a=new E({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password +import{S as W,i as Y,s as j,F as A,c as H,m as N,t as P,a as q,d as S,C as B,E as D,g as _,k as G,n as I,o as m,p as z,q as E,e as b,w as y,b as C,f as c,r as J,h as w,u as h,v as K,y as F,x as O,z as R}from"./index.d16cb8a0.js";function Q(i){let e,l,t,n,s,o,p,a,r,u,v,g,k,L,d=i[4]&&M(i);return o=new E({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),a=new E({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password `),d&&d.c(),s=C(),H(o.$$.fragment),p=C(),H(a.$$.fragment),r=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=i[2],J(u,"btn-loading",i[2])},m(f,$){_(f,e,$),w(e,l),w(l,t),w(t,n),d&&d.m(t,null),w(e,s),N(o,e,null),w(e,p),N(a,e,null),w(e,r),w(e,u),w(u,v),g=!0,k||(L=h(e,"submit",K(i[5])),k=!0)},p(f,$){f[4]?d?d.p(f,$):(d=M(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&&J(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(),S(o),S(a),k=!1,L()}}}function V(i){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=h(t,"click",i[7]),n=!0)},p:F,i:F,o:F,d(o){o&&m(e),o&&m(l),o&&m(t),n=!1,s()}}}function M(i){let e,l,t;return{c(){e=y("for "),l=b("strong"),t=y(i[4])},m(n,s){_(n,e,s),_(n,l,s),w(l,t)},p(n,s){s&16&&O(t,n[4])},d(n){n&&m(e),n&&m(l)}}}function X(i){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=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0,s.autofocus=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[0]),s.focus(),p||(a=h(s,"input",i[8]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&1&&s.value!==r[0]&&R(s,r[0])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function Z(i){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=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[1]),p||(a=h(s,"input",i[9]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&2&&s.value!==r[1]&&R(s,r[1])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function x(i){let e,l,t,n;const s=[V,Q],o=[];function p(a,r){return a[3]?0:1}return e=p(i),l=o[e]=s[e](i),{c(){l.c(),t=D()},m(a,r){o[e].m(a,r),_(a,t,r),n=!0},p(a,r){let u=e;e=p(a),e===u?o[e].p(a,r):(G(),q(o[u],1,1,()=>{o[u]=null}),I(),l=o[e],l?l.p(a,r):(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(i){let e,l;return e=new A({props:{nobranding:!0,$$slots:{default:[x]},$$scope:{ctx:i}}}),{c(){H(e.$$.fragment)},m(t,n){N(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){S(e,t)}}}function te(i,e,l){let t,{params:n}=e,s="",o="",p=!1,a=!1;async function r(){if(!p){l(2,p=!0);try{await z.Users.confirmPasswordReset(n==null?void 0:n.token,s,o),l(3,a=!0)}catch(k){z.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 i.$$set=k=>{"params"in k&&l(6,n=k.params)},i.$$.update=()=>{i.$$.dirty&64&&l(4,t=B.getJWTPayload(n==null?void 0:n.token).email||"")},[s,o,p,a,t,r,n,u,v,g]}class le extends W{constructor(e){super(),Y(this,e,te,ee,j,{params:6})}}export{le as default}; diff --git a/ui/dist/assets/PageUserConfirmVerification.5e5c9ab6.js b/ui/dist/assets/PageUserConfirmVerification.1dda27e7.js similarity index 97% rename from ui/dist/assets/PageUserConfirmVerification.5e5c9ab6.js rename to ui/dist/assets/PageUserConfirmVerification.1dda27e7.js index 20d89b60..6998f37d 100644 --- a/ui/dist/assets/PageUserConfirmVerification.5e5c9ab6.js +++ b/ui/dist/assets/PageUserConfirmVerification.1dda27e7.js @@ -1,3 +1,3 @@ -import{S as k,i as v,s as y,F as w,c as x,m as C,t as g,a as $,d as L,p as H,E as M,g as r,o as a,e as u,b as m,f,u as _,y as p}from"./index.38300823.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,c as x,m as C,t as g,a as $,d as L,p as H,E as M,g as r,o as a,e as u,b as m,f,u as _,y as p}from"./index.d16cb8a0.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 F(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 U(o){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[F]},$$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){$(t.$$.fragment,e),s=!1},d(e){L(t,e)}}}function V(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 E extends k{constructor(t){super(),v(this,t,V,U,y,{params:2})}}export{E as default}; diff --git a/ui/dist/assets/index.38300823.js b/ui/dist/assets/index.d16cb8a0.js similarity index 50% rename from ui/dist/assets/index.38300823.js rename to ui/dist/assets/index.d16cb8a0.js index a59da70d..fe0b97da 100644 --- a/ui/dist/assets/index.38300823.js +++ b/ui/dist/assets/index.d16cb8a0.js @@ -1,94 +1,94 @@ -const __=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 o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).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)}};__();function oe(){}const bl=n=>n;function _t(n,e){for(const t in e)n[t]=e[t];return n}function jp(n){return n()}function Ya(){return Object.create(null)}function st(n){n.forEach(jp)}function Zn(n){return typeof n=="function"}function Pe(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Ll;function ti(n,e){return Ll||(Ll=document.createElement("a")),Ll.href=e,n===Ll.href}function b_(n){return Object.keys(n).length===0}function qp(n,...e){if(n==null)return oe;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function qt(n,e,t){n.$$.on_destroy.push(qp(e,t))}function On(n,e,t,i){if(n){const s=Vp(n,e,t,i);return n[0](s)}}function Vp(n,e,t,i){return n[1]&&i?_t(t.ctx.slice(),n[1](i(e))):t.ctx}function En(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=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),sa=zp?n=>requestAnimationFrame(n):oe;const _s=new Set;function Bp(n){_s.forEach(e=>{e.c(n)||(_s.delete(e),e.f())}),_s.size!==0&&sa(Bp)}function Lo(n){let e;return _s.size===0&&sa(Bp),{promise:new Promise(t=>{_s.add(e={c:n,f:t})}),abort(){_s.delete(e)}}}function p(n,e){n.appendChild(e)}function Up(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function v_(n){const e=_("style");return y_(Up(n),e),e.sheet}function y_(n,e){p(n.head||n,e)}function w(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode.removeChild(n)}function Bn(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function Qt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function ni(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function Wp(n){return function(e){e.target===this&&n.call(this,e)}}function h(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]:h(n,i,e[i])}function It(n){return n===""?null:+n}function k_(n){return Array.from(n.childNodes)}function me(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function $e(n,e){n.value=e==null?"":e}function Za(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ee(n,e,t){n.classList[t?"add":"remove"](e)}function Yp(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const ao=new Map;let uo=0;function w_(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function S_(n,e){const t={stylesheet:v_(e),rules:{}};return ao.set(n,t),t}function rl(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{ +const b_=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 o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).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)}};b_();function oe(){}const bl=n=>n;function bt(n,e){for(const t in e)n[t]=e[t];return n}function qp(n){return n()}function Ya(){return Object.create(null)}function st(n){n.forEach(qp)}function Zn(n){return typeof n=="function"}function Pe(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Ll;function ti(n,e){return Ll||(Ll=document.createElement("a")),Ll.href=e,n===Ll.href}function v_(n){return Object.keys(n).length===0}function Vp(n,...e){if(n==null)return oe;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Vt(n,e,t){n.$$.on_destroy.push(Vp(e,t))}function On(n,e,t,i){if(n){const s=zp(n,e,t,i);return n[0](s)}}function zp(n,e,t,i){return n[1]&&i?bt(t.ctx.slice(),n[1](i(e))):t.ctx}function En(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=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),sa=Bp?n=>requestAnimationFrame(n):oe;const _s=new Set;function Up(n){_s.forEach(e=>{e.c(n)||(_s.delete(e),e.f())}),_s.size!==0&&sa(Up)}function Lo(n){let e;return _s.size===0&&sa(Up),{promise:new Promise(t=>{_s.add(e={c:n,f:t})}),abort(){_s.delete(e)}}}function m(n,e){n.appendChild(e)}function Wp(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function y_(n){const e=_("style");return k_(Wp(n),e),e.sheet}function k_(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 Bn(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function Qt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function ni(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function Yp(n){return function(e){e.target===this&&n.call(this,e)}}function h(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]:h(n,i,e[i])}function Nt(n){return n===""?null:+n}function w_(n){return Array.from(n.childNodes)}function me(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function $e(n,e){n.value=e==null?"":e}function Za(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ee(n,e,t){n.classList[t?"add":"remove"](e)}function Kp(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const ao=new Map;let uo=0;function S_(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function $_(n,e){const t={stylesheet:y_(e),rules:{}};return ao.set(n,t),t}function rl(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{ `;for(let b=0;b<=1;b+=a){const y=e+(t-e)*l(b);u+=b*100+`%{${o(y,1-y)}} `}const f=u+`100% {${o(t,1-t)}} -}`,c=`__svelte_${w_(f)}_${r}`,d=Up(n),{stylesheet:m,rules:g}=ao.get(d)||S_(d,n);g[c]||(g[c]=!0,m.insertRule(`@keyframes ${c} ${f}`,m.cssRules.length));const v=n.style.animation||"";return n.style.animation=`${v?`${v}, `:""}${c} ${i}ms linear ${s}ms 1 both`,uo+=1,c}function al(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(", "),uo-=s,uo||$_())}function $_(){sa(()=>{uo||(ao.forEach(n=>{const{stylesheet:e}=n;let t=e.cssRules.length;for(;t--;)e.deleteRule(t);n.rules={}}),ao.clear())})}function C_(n,e,t,i){if(!e)return oe;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return oe;const{delay:l=0,duration:o=300,easing:r=bl,start:a=Po()+l,end:u=a+o,tick:f=oe,css:c}=t(n,{from:e,to:s},i);let d=!0,m=!1,g;function v(){c&&(g=rl(n,0,1,o,l,r,c)),l||(m=!0)}function b(){c&&al(n,g),d=!1}return Lo(y=>{if(!m&&y>=a&&(m=!0),m&&y>=u&&(f(1,0),b()),!d)return!1;if(m){const C=y-a,$=0+1*r(C/o);f($,1-$)}return!0}),v(),f(0,1),b}function M_(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,Kp(n,s)}}function Kp(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 ul;function Gs(n){ul=n}function Fo(){if(!ul)throw new Error("Function called outside component initialization");return ul}function Jn(n){Fo().$$.on_mount.push(n)}function T_(n){Fo().$$.after_update.push(n)}function D_(n){Fo().$$.on_destroy.push(n)}function hn(){const n=Fo();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=Yp(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function pt(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Ws=[],he=[],no=[],Cr=[],Zp=Promise.resolve();let Mr=!1;function Jp(){Mr||(Mr=!0,Zp.then(Gp))}function di(){return Jp(),Zp}function Lt(n){no.push(n)}function He(n){Cr.push(n)}const Jo=new Set;let Fl=0;function Gp(){const n=ul;do{for(;Fl{Ls=null})),Ls}function ts(n,e,t){n.dispatchEvent(Yp(`${e?"intro":"outro"}${t}`))}const io=new Set;let ri;function De(){ri={r:0,c:[],p:ri}}function Oe(){ri.r||st(ri.c),ri=ri.p}function A(n,e){n&&n.i&&(io.delete(n),n.i(e))}function P(n,e,t,i){if(n&&n.o){if(io.has(n))return;io.add(n),ri.c.push(()=>{io.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const oa={duration:0};function Xp(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&al(n,l)}function u(){const{delay:c=0,duration:d=300,easing:m=bl,tick:g=oe,css:v}=i||oa;v&&(l=rl(n,0,1,d,c,m,v,r++)),g(0,1);const b=Po()+c,y=b+d;o&&o.abort(),s=!0,Lt(()=>ts(n,!0,"start")),o=Lo(C=>{if(s){if(C>=y)return g(1,0),ts(n,!0,"end"),a(),s=!1;if(C>=b){const $=m((C-b)/d);g($,1-$)}}return s})}let f=!1;return{start(){f||(f=!0,al(n),Zn(i)?(i=i(),la().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function Qp(n,e,t){let i=e(n,t),s=!0,l;const o=ri;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=bl,tick:c=oe,css:d}=i||oa;d&&(l=rl(n,1,0,u,a,f,d));const m=Po()+a,g=m+u;Lt(()=>ts(n,!1,"start")),Lo(v=>{if(s){if(v>=g)return c(0,1),ts(n,!1,"end"),--o.r||st(o.c),!1;if(v>=m){const b=f((v-m)/u);c(1-b,b)}}return s})}return Zn(i)?la().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&al(n,l),s=!1)}}}function at(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&al(n,a)}function f(d,m){const g=d.b-l;return m*=Math.abs(g),{a:l,b:d.b,d:g,duration:m,start:d.start,end:d.start+m,group:d.group}}function c(d){const{delay:m=0,duration:g=300,easing:v=bl,tick:b=oe,css:y}=s||oa,C={start:Po()+m,b:d};d||(C.group=ri,ri.r+=1),o||r?r=C:(y&&(u(),a=rl(n,l,d,g,m,v,y)),d&&b(0,1),o=f(C,g),Lt(()=>ts(n,d,"start")),Lo($=>{if(r&&$>r.start&&(o=f(r,g),r=null,ts(n,o.b,"start"),y&&(u(),a=rl(n,l,o.b,o.duration,0,v,s.css))),o){if($>=o.end)b(l=o.b,1-l),ts(n,o.b,"end"),r||(o.b?u():--o.group.r||st(o.group.c)),o=null;else if($>=o.start){const S=$-o.start;l=o.a+o.d*v(S/o.duration),b(l,1-l)}}return!!(o||r)}))}return{run(d){Zn(s)?la().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function cn(n,e){n.d(1),e.delete(n.key)}function Bt(n,e){P(n,1,1,()=>{e.delete(n.key)})}function E_(n,e){n.f(),Bt(n,e)}function dt(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,m=l.length,g=d;const v={};for(;g--;)v[n[g].key]=g;const b=[],y=new Map,C=new Map;for(g=m;g--;){const D=c(s,l,g),E=t(D);let O=o.get(E);O?i&&O.p(D,e):(O=u(E,D),O.c()),y.set(E,b[g]=O),E in v&&C.set(E,Math.abs(g-v[E]))}const $=new Set,S=new Set;function M(D){A(D,1),D.m(r,f),o.set(D.key,D),f=D.first,m--}for(;d&&m;){const D=b[m-1],E=n[d-1],O=D.key,F=E.key;D===E?(f=D.first,d--,m--):y.has(F)?!o.has(O)||$.has(O)?M(D):S.has(F)?d--:C.get(O)>C.get(F)?(S.add(O),M(D)):($.add(F),d--):(a(E,o),d--)}for(;d--;){const D=n[d];y.has(D.key)||a(D,o)}for(;m;)M(b[m-1]);return b}function bn(n,e){const t={},i={},s={$$scope:1};let l=n.length;for(;l--;){const o=n[l],r=e[l];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)s[a]||(t[a]=r[a],s[a]=1);n[l]=r}else for(const a in o)s[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function hi(n){return typeof n=="object"&&n!==null?n:{}}function Re(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:o,after_update:r}=n.$$;s&&s.m(e,t),i||Lt(()=>{const a=l.map(jp).filter(Zn);o?o.push(...a):st(a),n.$$.on_mount=[]}),r.forEach(Lt)}function z(n,e){const t=n.$$;t.fragment!==null&&(st(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function A_(n,e){n.$$.dirty[0]===-1&&(Ws.push(n),Jp(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const g=m.length?m[0]:d;return u.ctx&&s(u.ctx[c],u.ctx[c]=g)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](g),f&&A_(n,c)),d}):[],u.update(),f=!0,st(u.before_update),u.fragment=i?i(u.ctx):!1,e.target){if(e.hydrate){const c=k_(e.target);u.fragment&&u.fragment.l(c),c.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&A(n.$$.fragment),V(n,e.target,e.anchor,e.customElement),Gp()}Gs(a)}class Fe{$destroy(){z(this,1),this.$destroy=oe}$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&&!b_(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function an(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:o}}function em(n,e,t){const i=!Array.isArray(n),s=i?[n]:n,l=e.length<2;return xp(t,o=>{let r=!1;const a=[];let u=0,f=oe;const c=()=>{if(u)return;f();const m=e(i?a[0]:a,o);l?o(m):f=Zn(m)?m:oe},d=s.map((m,g)=>qp(m,v=>{a[g]=v,u&=~(1<{u|=1<{z(f,1)}),Oe()}l?(e=new l(o()),e.$on("routeEvent",r[7]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function L_(n){let e,t,i;const s=[{params:n[1]},n[2]];var l=n[0];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),e.$on("routeEvent",r[6]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function F_(n){let e,t,i,s;const l=[L_,P_],o=[];function r(a,u){return a[1]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=lt()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(De(),P(o[f],1,1,()=>{o[f]=null}),Oe(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),A(t,1),t.m(i.parentNode,i))},i(a){s||(A(t),s=!0)},o(a){P(t),s=!1},d(a){o[e].d(a),a&&k(i)}}}function Ja(){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 Io=xp(null,function(e){e(Ja());const t=()=>{e(Ja())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});em(Io,n=>n.location);em(Io,n=>n.querystring);const Ga=si(void 0);async function Ts(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await di();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 Tn(n,e){if(e=Qa(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with
tags');return Xa(n,e),{update(t){t=Qa(t),Xa(n,t)}}}function Xa(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||I_(i.currentTarget.getAttribute("href"))})}function Qa(n){return n&&typeof n=="string"?{href:n}:n||{}}function I_(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 N_(n,e,t){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:l=!1}=e;class o{constructor(M,D){if(!D||typeof D!="function"&&(typeof D!="object"||D._sveltesparouter!==!0))throw Error("Invalid component object");if(!M||typeof M=="string"&&(M.length<1||M.charAt(0)!="/"&&M.charAt(0)!="*")||typeof M=="object"&&!(M instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:E,keys:O}=tm(M);this.path=M,typeof D=="object"&&D._sveltesparouter===!0?(this.component=D.component,this.conditions=D.conditions||[],this.userData=D.userData,this.props=D.props||{}):(this.component=()=>Promise.resolve(D),this.conditions=[],this.props={}),this._pattern=E,this._keys=O}match(M){if(s){if(typeof s=="string")if(M.startsWith(s))M=M.substr(s.length)||"/";else return null;else if(s instanceof RegExp){const F=M.match(s);if(F&&F[0])M=M.substr(F[0].length)||"/";else return null}}const D=this._pattern.exec(M);if(D===null)return null;if(this._keys===!1)return D;const E={};let O=0;for(;O{r.push(new o(M,S))}):Object.keys(i).forEach(S=>{r.push(new o(S,i[S]))});let a=null,u=null,f={};const c=hn();async function d(S,M){await di(),c(S,M)}let m=null,g=null;l&&(g=S=>{S.state&&S.state.__svelte_spa_router_scrollY?m=S.state:m=null},window.addEventListener("popstate",g),T_(()=>{m?window.scrollTo(m.__svelte_spa_router_scrollX,m.__svelte_spa_router_scrollY):window.scrollTo(0,0)}));let v=null,b=null;const y=Io.subscribe(async S=>{v=S;let M=0;for(;M{Ga.set(u)});return}t(0,a=null),b=null,Ga.set(void 0)});D_(()=>{y(),g&&window.removeEventListener("popstate",g)});function C(S){pt.call(this,n,S)}function $(S){pt.call(this,n,S)}return n.$$set=S=>{"routes"in S&&t(3,i=S.routes),"prefix"in S&&t(4,s=S.prefix),"restoreScrollState"in S&&t(5,l=S.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=l?"manual":"auto")},[a,u,f,i,s,l,C,$]}class R_ extends Fe{constructor(e){super(),Le(this,e,N_,F_,Pe,{routes:3,prefix:4,restoreScrollState:5})}}const so=[];let nm;function im(n){const e=n.pattern.test(nm);xa(n,n.className,e),xa(n,n.inactiveClassName,!e)}function xa(n,e,t){(e||"").split(" ").forEach(i=>{!i||(n.node.classList.remove(i),t&&n.node.classList.add(i))})}Io.subscribe(n=>{nm=n.location+(n.querystring?"?"+n.querystring:""),so.map(im)});function oi(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"?tm(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return so.push(i),im(i),{destroy(){so.splice(so.indexOf(i),1)}}}const H_="modulepreload",j_=function(n){return"/_/"+n},eu={},Qi=function(e,t,i){return!t||t.length===0?e():Promise.all(t.map(s=>{if(s=j_(s),s in eu)return;eu[s]=!0;const l=s.endsWith(".css"),o=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${o}`))return;const r=document.createElement("link");if(r.rel=l?"stylesheet":H_,l||(r.as="script",r.crossOrigin=""),r.href=s,document.head.appendChild(r),l)return new Promise((a,u)=>{r.addEventListener("load",a),r.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e())};var Tr=function(n,e){return Tr=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])},Tr(n,e)};function dn(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}Tr(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Dr=function(){return Dr=Object.assign||function(n){for(var e,t=1,i=arguments.length;t0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){o=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]0&&(!i.exp||i.exp-t>Date.now()/1e3))},n}(),vl=function(){function n(e){e===void 0&&(e={}),this.load(e||{})}return n.prototype.load=function(e){this.id=e.id!==void 0?e.id:"",this.created=e.created!==void 0?e.created:"",this.updated=e.updated!==void 0?e.updated:""},Object.defineProperty(n.prototype,"isNew",{get:function(){return!this.id||this.id==="00000000-0000-0000-0000-000000000000"},enumerable:!1,configurable:!0}),n.prototype.clone=function(){return new this.constructor(JSON.parse(JSON.stringify(this)))},n.prototype.export=function(){return Object.assign({},this)},n}(),fo=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return dn(e,n),e.prototype.load=function(t){n.prototype.load.call(this,t);for(var i=0,s=Object.entries(t);i0?n:1,this.perPage=e>=0?e:0,this.totalItems=t>=0?t:0,this.items=i||[]},rm=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return dn(e,n),e.prototype._getFullList=function(t,i,s){var l=this;i===void 0&&(i=100),s===void 0&&(s={});var o=[],r=function(a){return Xs(l,void 0,void 0,function(){return Qs(this,function(u){return[2,this._getList(t,a,i,s).then(function(f){var c=f,d=c.items,m=c.totalItems;return o=o.concat(d),d.length&&m>o.length?r(a+1):o})]})})};return r(1)},e.prototype._getList=function(t,i,s,l){var o=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(t,{method:"GET",params:l}).then(function(r){var a=[];if(r!=null&&r.items){r.items=r.items||[];for(var u=0,f=r.items;u=400)throw new Go({url:$.url,status:$.status,data:S});return[2,S]}})})}).catch(function($){throw $ instanceof Go?$:new Go($)})},n.prototype.buildUrl=function(e){var t=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return e&&(t+=e.startsWith("/")?e.substring(1):e),t},n.prototype.serializeQueryParams=function(e){var t=[];for(var i in e)if(e[i]!==null){var s=e[i],l=encodeURIComponent(i);if(Array.isArray(s))for(var o=0,r=s;o"u"}function ns(n){return typeof n=="number"}function Ro(n){return typeof n=="number"&&n%1===0}function x_(n){return typeof n=="string"}function e0(n){return Object.prototype.toString.call(n)==="[object Date]"}function Dm(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function t0(n){return Array.isArray(n)?n:[n]}function tu(n,e,t){if(n.length!==0)return n.reduce((i,s)=>{const l=[e(s),s];return i&&t(i[0],l[0])===i[0]?i:l},null)[1]}function n0(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Ss(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function vi(n,e,t){return Ro(n)&&n>=e&&n<=t}function i0(n,e){return n-e*Math.floor(n/e)}function xt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Di(n){if(!(vt(n)||n===null||n===""))return parseInt(n,10)}function Bi(n){if(!(vt(n)||n===null||n===""))return parseFloat(n)}function ua(n){if(!(vt(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function fa(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function yl(n){return n%4===0&&(n%100!==0||n%400===0)}function xs(n){return yl(n)?366:365}function ho(n,e){const t=i0(e-1,12)+1,i=n+(e-t)/12;return t===2?yl(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function ca(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 po(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 Ar(n){return n>99?n:n>60?1900+n:2e3+n}function Om(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 o={timeZoneName:e,...l},r=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Ho(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 Em(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new qn(`Invalid unit value ${n}`);return e}function mo(n,e){const t={};for(const i in n)if(Ss(n,i)){const s=n[i];if(s==null)continue;t[e(i)]=Em(s)}return t}function el(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}${xt(t,2)}:${xt(i,2)}`;case"narrow":return`${s}${t}${i>0?`:${i}`:""}`;case"techie":return`${s}${xt(t,2)}${xt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function jo(n){return n0(n,["hour","minute","second","millisecond"])}const Am=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/,s0=["January","February","March","April","May","June","July","August","September","October","November","December"],Pm=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l0=["J","F","M","A","M","J","J","A","S","O","N","D"];function Lm(n){switch(n){case"narrow":return[...l0];case"short":return[...Pm];case"long":return[...s0];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 Fm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Im=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],o0=["M","T","W","T","F","S","S"];function Nm(n){switch(n){case"narrow":return[...o0];case"short":return[...Im];case"long":return[...Fm];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Rm=["AM","PM"],r0=["Before Christ","Anno Domini"],a0=["BC","AD"],u0=["B","A"];function Hm(n){switch(n){case"narrow":return[...u0];case"short":return[...a0];case"long":return[...r0];default:return null}}function f0(n){return Rm[n.hour<12?0:1]}function c0(n,e){return Nm(e)[n.weekday-1]}function d0(n,e){return Lm(e)[n.month-1]}function h0(n,e){return Hm(e)[n.year<0?0:1]}function p0(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 o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,u=s[n],f=i?a?u[1]:u[2]||u[1]:a?s[n][0]:n;return o?`${r} ${f} ago`:`in ${r} ${f}`}function nu(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const m0={D:Er,DD:um,DDD:fm,DDDD:cm,t:dm,tt:hm,ttt:pm,tttt:mm,T:gm,TT:_m,TTT:bm,TTTT:vm,f:ym,ff:wm,fff:$m,ffff:Mm,F:km,FF:Sm,FFF:Cm,FFFF:Tm};class kn{static create(e,t={}){return new kn(e,t)}static parseFormat(e){let t=null,i="",s=!1;const l=[];for(let o=0;o0&&l.push({literal:s,val:i}),t=null,i="",s=!s):s||r===t?i+=r:(i.length>0&&l.push({literal:!1,val:i}),i=r,t=r)}return i.length>0&&l.push({literal:s,val:i}),l}static macroTokenToFormatOpts(e){return m0[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 xt(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=(m,g)=>this.loc.extract(e,m,g),o=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",r=()=>i?f0(e):l({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(m,g)=>i?d0(e,m):l(g?{month:m}:{month:m,day:"numeric"},"month"),u=(m,g)=>i?c0(e,m):l(g?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),f=m=>{const g=kn.macroTokenToFormatOpts(m);return g?this.formatWithSystemDefault(e,g):m},c=m=>i?h0(e,m):l({era:m},"era"),d=m=>{switch(m){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 o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({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 r();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(m)}};return nu(kn.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=kn.parseFormat(t),o=l.reduce((a,{literal:u,val:f})=>u?a:a.concat(f),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return nu(l,s(r))}}class xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}class kl{get type(){throw new Mi}get name(){throw new Mi}get ianaName(){return this.name}get isUniversal(){throw new Mi}offsetName(e,t){throw new Mi}formatOffset(e,t){throw new Mi}offset(e){throw new Mi}equals(e){throw new Mi}get isValid(){throw new Mi}}let Xo=null;class da extends kl{static get instance(){return Xo===null&&(Xo=new da),Xo}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return Om(e,t,i)}formatOffset(e,t){return el(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let lo={};function g0(n){return lo[n]||(lo[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"})),lo[n]}const _0={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function b0(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,l,o,r,a,u,f]=i;return[o,s,l,r,a,u,f]}function v0(n,e){const t=n.formatToParts(e),i=[];for(let s=0;s=0?g:1e3+g,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Qo=null;class gn extends kl{static get utcInstance(){return Qo===null&&(Qo=new gn(0)),Qo}static instance(e){return e===0?gn.utcInstance:new gn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new gn(Ho(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${el(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${el(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return el(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 y0 extends kl{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 Oi(n,e){if(vt(n)||n===null)return e;if(n instanceof kl)return n;if(x_(n)){const t=n.toLowerCase();return t==="local"||t==="system"?e:t==="utc"||t==="gmt"?gn.utcInstance:gn.parseSpecifier(t)||ki.create(n)}else return ns(n)?gn.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new y0(n)}let iu=()=>Date.now(),su="system",lu=null,ou=null,ru=null,au;class sn{static get now(){return iu}static set now(e){iu=e}static set defaultZone(e){su=e}static get defaultZone(){return Oi(su,da.instance)}static get defaultLocale(){return lu}static set defaultLocale(e){lu=e}static get defaultNumberingSystem(){return ou}static set defaultNumberingSystem(e){ou=e}static get defaultOutputCalendar(){return ru}static set defaultOutputCalendar(e){ru=e}static get throwOnInvalid(){return au}static set throwOnInvalid(e){au=e}static resetCaches(){Wt.resetCache(),ki.resetCache()}}let uu={};function k0(n,e={}){const t=JSON.stringify([n,e]);let i=uu[t];return i||(i=new Intl.ListFormat(n,e),uu[t]=i),i}let Pr={};function Lr(n,e={}){const t=JSON.stringify([n,e]);let i=Pr[t];return i||(i=new Intl.DateTimeFormat(n,e),Pr[t]=i),i}let Fr={};function w0(n,e={}){const t=JSON.stringify([n,e]);let i=Fr[t];return i||(i=new Intl.NumberFormat(n,e),Fr[t]=i),i}let Ir={};function S0(n,e={}){const{base:t,...i}=e,s=JSON.stringify([n,i]);let l=Ir[s];return l||(l=new Intl.RelativeTimeFormat(n,e),Ir[s]=l),l}let Ks=null;function $0(){return Ks||(Ks=new Intl.DateTimeFormat().resolvedOptions().locale,Ks)}function C0(n){const e=n.indexOf("-u-");if(e===-1)return[n];{let t;const i=n.substring(0,e);try{t=Lr(n).resolvedOptions()}catch{t=Lr(i).resolvedOptions()}const{numberingSystem:s,calendar:l}=t;return[i,s,l]}}function M0(n,e,t){return(t||e)&&(n+="-u",t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function T0(n){const e=[];for(let t=1;t<=12;t++){const i=tt.utc(2016,t,1);e.push(n(i))}return e}function D0(n){const e=[];for(let t=1;t<=7;t++){const i=tt.utc(2016,11,13+t);e.push(n(i))}return e}function Nl(n,e,t,i,s){const l=n.listingMode(t);return l==="error"?null:l==="en"?i(e):s(e)}function O0(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 E0{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:s,floor:l,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=w0(e,r)}}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):fa(e,3);return xt(t,this.padTo)}}}class A0{constructor(e,t,i){this.opts=i;let s;if(e.zone.isUniversal){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ki.create(r).valid?(s=r,this.dt=e):(s="UTC",i.timeZoneName?this.dt=e:this.dt=e.offset===0?e:tt.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=Lr(t,l)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class P0{constructor(e,t,i){this.opts={style:"long",...i},!t&&Dm()&&(this.rtf=S0(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):p0(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}class Wt{static fromOpts(e){return Wt.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,i,s=!1){const l=e||sn.defaultLocale,o=l||(s?"en-US":$0()),r=t||sn.defaultNumberingSystem,a=i||sn.defaultOutputCalendar;return new Wt(o,r,a,l)}static resetCache(){Ks=null,Pr={},Fr={},Ir={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i}={}){return Wt.create(e,t,i)}constructor(e,t,i,s){const[l,o,r]=C0(e);this.locale=l,this.numberingSystem=t||o||null,this.outputCalendar=i||r||null,this.intl=M0(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=O0(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:Wt.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 Nl(this,e,i,Lm,()=>{const s=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=T0(o=>this.extract(o,s,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1,i=!0){return Nl(this,e,i,Nm,()=>{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]=D0(o=>this.extract(o,s,"weekday"))),this.weekdaysCache[l][e]})}meridiems(e=!0){return Nl(this,void 0,e,()=>Rm,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[tt.utc(2016,11,13,9),tt.utc(2016,11,13,19)].map(i=>this.extract(i,t,"dayperiod"))}return this.meridiemCache})}eras(e,t=!0){return Nl(this,e,t,Hm,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[tt.utc(-40,1,1),tt.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(),o=l.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new E0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new A0(e,this.intl,t)}relFormatter(e={}){return new P0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return k0(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 Ds(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Os(...n){return e=>n.reduce(([t,i,s],l)=>{const[o,r,a]=l(e,s);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Es(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 jm(...n){return(e,t)=>{const i={};let s;for(s=0;sm!==void 0&&(g||m&&f)?-m:m;return[{years:d(Bi(t)),months:d(Bi(i)),weeks:d(Bi(s)),days:d(Bi(l)),hours:d(Bi(o)),minutes:d(Bi(r)),seconds:d(Bi(a),a==="-0"),milliseconds:d(ua(u),c)}]}const W0={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 ma(n,e,t,i,s,l,o){const r={year:e.length===2?Ar(Di(e)):Di(e),month:Pm.indexOf(t)+1,day:Di(i),hour:Di(s),minute:Di(l)};return o&&(r.second=Di(o)),n&&(r.weekday=n.length>3?Fm.indexOf(n)+1:Im.indexOf(n)+1),r}const Y0=/^(?:(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 K0(n){const[,e,t,i,s,l,o,r,a,u,f,c]=n,d=ma(e,s,i,t,l,o,r);let m;return a?m=W0[a]:u?m=0:m=Ho(f,c),[d,new gn(m)]}function Z0(n){return n.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const J0=/^(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$/,G0=/^(Monday|Tuesday|Wednesday|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$/,X0=/^(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 fu(n){const[,e,t,i,s,l,o,r]=n;return[ma(e,s,i,t,l,o,r),gn.utcInstance]}function Q0(n){const[,e,t,i,s,l,o,r]=n;return[ma(e,r,t,i,s,l,o),gn.utcInstance]}const x0=Ds(F0,pa),eb=Ds(I0,pa),tb=Ds(N0,pa),nb=Ds(Vm),Bm=Os(V0,As,wl,Sl),ib=Os(R0,As,wl,Sl),sb=Os(H0,As,wl,Sl),lb=Os(As,wl,Sl);function ob(n){return Es(n,[x0,Bm],[eb,ib],[tb,sb],[nb,lb])}function rb(n){return Es(Z0(n),[Y0,K0])}function ab(n){return Es(n,[J0,fu],[G0,fu],[X0,Q0])}function ub(n){return Es(n,[B0,U0])}const fb=Os(As);function cb(n){return Es(n,[z0,fb])}const db=Ds(j0,q0),hb=Ds(zm),pb=Os(As,wl,Sl);function mb(n){return Es(n,[db,Bm],[hb,pb])}const gb="Invalid Duration",Um={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}},_b={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},...Um},Nn=146097/400,hs=146097/4800,bb={years:{quarters:4,months:12,weeks:Nn/7,days:Nn,hours:Nn*24,minutes:Nn*24*60,seconds:Nn*24*60*60,milliseconds:Nn*24*60*60*1e3},quarters:{months:3,weeks:Nn/28,days:Nn/4,hours:Nn*24/4,minutes:Nn*24*60/4,seconds:Nn*24*60*60/4,milliseconds:Nn*24*60*60*1e3/4},months:{weeks:hs/7,days:hs,hours:hs*24,minutes:hs*24*60,seconds:hs*24*60*60,milliseconds:hs*24*60*60*1e3},...Um},Ji=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],vb=Ji.slice(0).reverse();function Ui(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 wt(i)}function yb(n){return n<0?Math.floor(n):Math.ceil(n)}function Wm(n,e,t,i,s){const l=n[s][t],o=e[t]/l,r=Math.sign(o)===Math.sign(i[s]),a=!r&&i[s]!==0&&Math.abs(o)<=1?yb(o):Math.trunc(o);i[s]+=a,e[t]-=a*l}function kb(n,e){vb.reduce((t,i)=>vt(e[i])?t:(t&&Wm(n,e,t,e,i),i),null)}class wt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;this.values=e.values,this.loc=e.loc||Wt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=t?bb:_b,this.isLuxonDuration=!0}static fromMillis(e,t){return wt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new qn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new wt({values:mo(e,wt.normalizeUnit),loc:Wt.fromObject(t),conversionAccuracy:t.conversionAccuracy})}static fromDurationLike(e){if(ns(e))return wt.fromMillis(e);if(wt.isDuration(e))return e;if(typeof e=="object")return wt.fromObject(e);throw new qn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=ub(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=cb(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new qn("need to specify a reason the Duration is invalid");const i=e instanceof xn?e:new xn(e,t);if(sn.throwOnInvalid)throw new G_(i);return new wt({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 am(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?kn.create(this.loc,i).formatDurationFromString(this,e):gb}toHuman(e={}){const t=Ji.map(i=>{const s=this.values[i];return vt(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+=fa(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=wt.fromDurationLike(e),i={};for(const s of Ji)(Ss(t.values,s)||Ss(this.values,s))&&(i[s]=t.get(s)+this.get(s));return Ui(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=wt.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]=Em(e(this.values[i],i));return Ui(this,{values:t},!0)}get(e){return this[wt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...mo(e,wt.normalizeUnit)};return Ui(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),Ui(this,l)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return kb(this.matrix,e),Ui(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>wt.normalizeUnit(o));const t={},i={},s=this.toObject();let l;for(const o of Ji)if(e.indexOf(o)>=0){l=o;let r=0;for(const u in i)r+=this.matrix[u][o]*i[u],i[u]=0;ns(s[o])&&(r+=s[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3;for(const u in s)Ji.indexOf(u)>Ji.indexOf(o)&&Wm(this.matrix,s,u,t,o)}else ns(s[o])&&(i[o]=s[o]);for(const o in i)i[o]!==0&&(t[l]+=o===l?i[o]:i[o]/this.matrix[l][o]);return Ui(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 Ui(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 Ji)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Fs="Invalid Interval";function wb(n,e){return!n||!n.isValid?Kt.invalid("missing or invalid start"):!e||!e.isValid?Kt.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?Kt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Rs).filter(o=>this.contains(o)).sort(),i=[];let{s}=this,l=0;for(;s+this.e?this.e:o;i.push(Kt.fromDateTimes(s,r)),s=r,l+=1}return i}splitBy(e){const t=wt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,s=1,l;const o=[];for(;ia*s));l=+r>+this.e?this.e:r,o.push(Kt.fromDateTimes(i,l)),i=l,s+=1}return o}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:Kt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return Kt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((s,l)=>s.s-l.s).reduce(([s,l],o)=>l?l.overlaps(o)||l.abutsStart(o)?[s,l.union(o)]:[s.concat([l]),o]:[s,o],[[],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"}]),o=Array.prototype.concat(...l),r=o.sort((a,u)=>a.time-u.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&s.push(Kt.fromDateTimes(t,a.time)),t=null);return Kt.merge(s)}difference(...e){return Kt.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()})`:Fs}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Fs}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Fs}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Fs}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Fs}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):wt.invalid(this.invalidReason)}mapEndpoints(e){return Kt.fromDateTimes(e(this.s),e(this.e))}}class Rl{static hasDST(e=sn.defaultZone){const t=tt.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ki.isValidZone(e)}static normalizeZone(e){return Oi(e,sn.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Wt.create(t,i,l)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Wt.create(t,i,l)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Wt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Wt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Wt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Wt.create(t,null,"gregory").eras(e)}static features(){return{relative:Dm()}}}function cu(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(wt.fromMillis(i).as("days"))}function Sb(n,e,t){const i=[["years",(r,a)=>a.year-r.year],["quarters",(r,a)=>a.quarter-r.quarter],["months",(r,a)=>a.month-r.month+(a.year-r.year)*12],["weeks",(r,a)=>{const u=cu(r,a);return(u-u%7)/7}],["days",cu]],s={};let l,o;for(const[r,a]of i)if(t.indexOf(r)>=0){l=r;let u=a(n,e);o=n.plus({[r]:u}),o>e?(n=n.plus({[r]:u-1}),u-=1):n=o,s[r]=u}return[n,s,o,l]}function $b(n,e,t,i){let[s,l,o,r]=Sb(n,e,t);const a=e-s,u=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);u.length===0&&(o0?wt.fromMillis(a,i).shiftTo(...u).plus(f):f}const ga={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"},du={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]},Cb=ga.hanidec.replace(/[\[|\]]/g,"").split("");function Mb(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=l&&i<=o&&(e+=i-l)}}return parseInt(e,10)}else return e}function Xn({numberingSystem:n},e=""){return new RegExp(`${ga[n||"latn"]}${e}`)}const Tb="missing Intl.DateTimeFormat.formatToParts support";function Dt(n,e=t=>t){return{regex:n,deser:([t])=>e(Mb(t))}}const Db=String.fromCharCode(160),Ym=`[ ${Db}]`,Km=new RegExp(Ym,"g");function Ob(n){return n.replace(/\./g,"\\.?").replace(Km,Ym)}function hu(n){return n.replace(/\./g,"").replace(Km," ").toLowerCase()}function Qn(n,e){return n===null?null:{regex:RegExp(n.map(Ob).join("|")),deser:([t])=>n.findIndex(i=>hu(t)===hu(i))+e}}function pu(n,e){return{regex:n,deser:([,t,i])=>Ho(t,i),groups:e}}function xo(n){return{regex:n,deser:([e])=>e}}function Eb(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ab(n,e){const t=Xn(e),i=Xn(e,"{2}"),s=Xn(e,"{3}"),l=Xn(e,"{4}"),o=Xn(e,"{6}"),r=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}"),m=b=>({regex:RegExp(Eb(b.val)),deser:([y])=>y,literal:!0}),v=(b=>{if(n.literal)return m(b);switch(b.val){case"G":return Qn(e.eras("short",!1),0);case"GG":return Qn(e.eras("long",!1),0);case"y":return Dt(u);case"yy":return Dt(c,Ar);case"yyyy":return Dt(l);case"yyyyy":return Dt(d);case"yyyyyy":return Dt(o);case"M":return Dt(r);case"MM":return Dt(i);case"MMM":return Qn(e.months("short",!0,!1),1);case"MMMM":return Qn(e.months("long",!0,!1),1);case"L":return Dt(r);case"LL":return Dt(i);case"LLL":return Qn(e.months("short",!1,!1),1);case"LLLL":return Qn(e.months("long",!1,!1),1);case"d":return Dt(r);case"dd":return Dt(i);case"o":return Dt(a);case"ooo":return Dt(s);case"HH":return Dt(i);case"H":return Dt(r);case"hh":return Dt(i);case"h":return Dt(r);case"mm":return Dt(i);case"m":return Dt(r);case"q":return Dt(r);case"qq":return Dt(i);case"s":return Dt(r);case"ss":return Dt(i);case"S":return Dt(a);case"SSS":return Dt(s);case"u":return xo(f);case"uu":return xo(r);case"uuu":return Dt(t);case"a":return Qn(e.meridiems(),0);case"kkkk":return Dt(l);case"kk":return Dt(c,Ar);case"W":return Dt(r);case"WW":return Dt(i);case"E":case"c":return Dt(t);case"EEE":return Qn(e.weekdays("short",!1,!1),1);case"EEEE":return Qn(e.weekdays("long",!1,!1),1);case"ccc":return Qn(e.weekdays("short",!0,!1),1);case"cccc":return Qn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return pu(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return pu(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return xo(/[a-z_+-/]{1,256}?/i);default:return m(b)}})(n)||{invalidReason:Tb};return v.token=n,v}const Pb={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 Lb(n,e,t){const{type:i,value:s}=n;if(i==="literal")return{literal:!0,val:s};const l=t[i];let o=Pb[i];if(typeof o=="object"&&(o=o[l]),o)return{literal:!1,val:o}}function Fb(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function Ib(n,e,t){const i=n.match(e);if(i){const s={};let l=1;for(const o in t)if(Ss(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(s[r.token.val[0]]=r.deser(i.slice(l,l+a))),l+=a}return[i,s]}else return[i,{}]}function Nb(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 vt(n.z)||(t=ki.create(n.z)),vt(n.Z)||(t||(t=new gn(n.Z)),i=n.Z),vt(n.q)||(n.M=(n.q-1)*3+1),vt(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),vt(n.u)||(n.S=ua(n.u)),[Object.keys(n).reduce((l,o)=>{const r=e(o);return r&&(l[r]=n[o]),l},{}),t,i]}let er=null;function Rb(){return er||(er=tt.fromMillis(1555555555555)),er}function Hb(n,e){if(n.literal)return n;const t=kn.macroTokenToFormatOpts(n.val);if(!t)return n;const l=kn.create(e,t).formatDateTimeParts(Rb()).map(o=>Lb(o,e,t));return l.includes(void 0)?n:l}function jb(n,e){return Array.prototype.concat(...n.map(t=>Hb(t,e)))}function Zm(n,e,t){const i=jb(kn.parseFormat(t),n),s=i.map(o=>Ab(o,n)),l=s.find(o=>o.invalidReason);if(l)return{input:e,tokens:i,invalidReason:l.invalidReason};{const[o,r]=Fb(s),a=RegExp(o,"i"),[u,f]=Ib(e,a,r),[c,d,m]=f?Nb(f):[null,null,void 0];if(Ss(f,"a")&&Ss(f,"H"))throw new Ys("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:m}}}function qb(n,e,t){const{result:i,zone:s,specificOffset:l,invalidReason:o}=Zm(n,e,t);return[i,s,l,o]}const Jm=[0,31,59,90,120,151,181,212,243,273,304,334],Gm=[0,31,60,91,121,152,182,213,244,274,305,335];function zn(n,e){return new xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Xm(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 Qm(n,e,t){return t+(yl(n)?Gm:Jm)[e-1]}function xm(n,e){const t=yl(n)?Gm:Jm,i=t.findIndex(l=>lpo(e)?(r=e+1,o=1):r=e,{weekYear:r,weekNumber:o,weekday:l,...jo(n)}}function mu(n){const{weekYear:e,weekNumber:t,weekday:i}=n,s=Xm(e,1,4),l=xs(e);let o=t*7+i-s-3,r;o<1?(r=e-1,o+=xs(r)):o>l?(r=e+1,o-=xs(e)):r=e;const{month:a,day:u}=xm(r,o);return{year:r,month:a,day:u,...jo(n)}}function tr(n){const{year:e,month:t,day:i}=n,s=Qm(e,t,i);return{year:e,ordinal:s,...jo(n)}}function gu(n){const{year:e,ordinal:t}=n,{month:i,day:s}=xm(e,t);return{year:e,month:i,day:s,...jo(n)}}function Vb(n){const e=Ro(n.weekYear),t=vi(n.weekNumber,1,po(n.weekYear)),i=vi(n.weekday,1,7);return e?t?i?!1:zn("weekday",n.weekday):zn("week",n.week):zn("weekYear",n.weekYear)}function zb(n){const e=Ro(n.year),t=vi(n.ordinal,1,xs(n.year));return e?t?!1:zn("ordinal",n.ordinal):zn("year",n.year)}function eg(n){const e=Ro(n.year),t=vi(n.month,1,12),i=vi(n.day,1,ho(n.year,n.month));return e?t?i?!1:zn("day",n.day):zn("month",n.month):zn("year",n.year)}function tg(n){const{hour:e,minute:t,second:i,millisecond:s}=n,l=vi(e,0,23)||e===24&&t===0&&i===0&&s===0,o=vi(t,0,59),r=vi(i,0,59),a=vi(s,0,999);return l?o?r?a?!1:zn("millisecond",s):zn("second",i):zn("minute",t):zn("hour",e)}const nr="Invalid DateTime",_u=864e13;function Hl(n){return new xn("unsupported zone",`the zone "${n.name}" is not supported`)}function ir(n){return n.weekData===null&&(n.weekData=Nr(n.c)),n.weekData}function Is(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new tt({...t,...e,old:t})}function ng(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 bu(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 oo(n,e,t){return ng(ca(n),e,t)}function vu(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,ho(i,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=wt.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"),r=ca(l);let[a,u]=ng(r,t,n.zone);return o!==0&&(a+=o,u=n.zone.offset(a)),{ts:a,o:u}}function Ns(n,e,t,i,s,l){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0){const a=e||r,u=tt.fromObject(n,{...t,zone:a,specificOffset:l});return o?u:u.setZone(r)}else return tt.invalid(new xn("unparsable",`the input "${s}" can't be parsed as ${i}`))}function jl(n,e,t=!0){return n.isValid?kn.create(Wt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function sr(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=xt(n.c.year,t?6:4),e?(i+="-",i+=xt(n.c.month),i+="-",i+=xt(n.c.day)):(i+=xt(n.c.month),i+=xt(n.c.day)),i}function yu(n,e,t,i,s,l){let o=xt(n.c.hour);return e?(o+=":",o+=xt(n.c.minute),(n.c.second!==0||!t)&&(o+=":")):o+=xt(n.c.minute),(n.c.second!==0||!t)&&(o+=xt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=xt(n.c.millisecond,3))),s&&(n.isOffsetFixed&&n.offset===0&&!l?o+="Z":n.o<0?(o+="-",o+=xt(Math.trunc(-n.o/60)),o+=":",o+=xt(Math.trunc(-n.o%60))):(o+="+",o+=xt(Math.trunc(n.o/60)),o+=":",o+=xt(Math.trunc(n.o%60)))),l&&(o+="["+n.zone.ianaName+"]"),o}const ig={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Bb={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ub={ordinal:1,hour:0,minute:0,second:0,millisecond:0},sg=["year","month","day","hour","minute","second","millisecond"],Wb=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Yb=["year","ordinal","hour","minute","second","millisecond"];function ku(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 am(n);return e}function wu(n,e){const t=Oi(e.zone,sn.defaultZone),i=Wt.fromObject(e),s=sn.now();let l,o;if(vt(n.year))l=s;else{for(const u of sg)vt(n[u])&&(n[u]=ig[u]);const r=eg(n)||tg(n);if(r)return tt.invalid(r);const a=t.offset(s);[l,o]=oo(n,a,t)}return new tt({ts:l,zone:t,loc:i,o})}function Su(n,e,t){const i=vt(t.round)?!0:t.round,s=(o,r)=>(o=fa(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),l=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return s(l(t.unit),t.unit);for(const o of t.units){const r=l(o);if(Math.abs(r)>=1)return s(r,o)}return s(n>e?-0:0,t.units[t.units.length-1])}function $u(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 tt{constructor(e){const t=e.zone||sn.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new xn("invalid input"):null)||(t.isValid?null:Hl(t));this.ts=vt(e.ts)?sn.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 r=t.offset(this.ts);s=bu(this.ts,r),i=Number.isNaN(s.year)?new xn("invalid input"):null,s=i?null:s,l=i?null:r}this._zone=t,this.loc=e.loc||Wt.create(),this.invalid=i,this.weekData=null,this.c=s,this.o=l,this.isLuxonDateTime=!0}static now(){return new tt({})}static local(){const[e,t]=$u(arguments),[i,s,l,o,r,a,u]=t;return wu({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static utc(){const[e,t]=$u(arguments),[i,s,l,o,r,a,u]=t;return e.zone=gn.utcInstance,wu({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const i=e0(e)?e.valueOf():NaN;if(Number.isNaN(i))return tt.invalid("invalid input");const s=Oi(t.zone,sn.defaultZone);return s.isValid?new tt({ts:i,zone:s,loc:Wt.fromObject(t)}):tt.invalid(Hl(s))}static fromMillis(e,t={}){if(ns(e))return e<-_u||e>_u?tt.invalid("Timestamp out of range"):new tt({ts:e,zone:Oi(t.zone,sn.defaultZone),loc:Wt.fromObject(t)});throw new qn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ns(e))return new tt({ts:e*1e3,zone:Oi(t.zone,sn.defaultZone),loc:Wt.fromObject(t)});throw new qn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Oi(t.zone,sn.defaultZone);if(!i.isValid)return tt.invalid(Hl(i));const s=sn.now(),l=vt(t.specificOffset)?i.offset(s):t.specificOffset,o=mo(e,ku),r=!vt(o.ordinal),a=!vt(o.year),u=!vt(o.month)||!vt(o.day),f=a||u,c=o.weekYear||o.weekNumber,d=Wt.fromObject(t);if((f||r)&&c)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&r)throw new Ys("Can't mix ordinal dates with month/day");const m=c||o.weekday&&!f;let g,v,b=bu(s,l);m?(g=Wb,v=Bb,b=Nr(b)):r?(g=Yb,v=Ub,b=tr(b)):(g=sg,v=ig);let y=!1;for(const O of g){const F=o[O];vt(F)?y?o[O]=v[O]:o[O]=b[O]:y=!0}const C=m?Vb(o):r?zb(o):eg(o),$=C||tg(o);if($)return tt.invalid($);const S=m?mu(o):r?gu(o):o,[M,D]=oo(S,l,i),E=new tt({ts:M,zone:i,o:D,loc:d});return o.weekday&&f&&e.weekday!==E.weekday?tt.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${E.toISO()}`):E}static fromISO(e,t={}){const[i,s]=ob(e);return Ns(i,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,s]=rb(e);return Ns(i,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,s]=ab(e);return Ns(i,s,t,"HTTP",t)}static fromFormat(e,t,i={}){if(vt(e)||vt(t))throw new qn("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:l=null}=i,o=Wt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0}),[r,a,u,f]=qb(o,e,t);return f?tt.invalid(f):Ns(r,a,i,`format ${t}`,e,u)}static fromString(e,t,i={}){return tt.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,s]=mb(e);return Ns(i,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new qn("need to specify a reason the DateTime is invalid");const i=e instanceof xn?e:new xn(e,t);if(sn.throwOnInvalid)throw new Z_(i);return new tt({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?ir(this).weekYear:NaN}get weekNumber(){return this.isValid?ir(this).weekNumber:NaN}get weekday(){return this.isValid?ir(this).weekday:NaN}get ordinal(){return this.isValid?tr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Rl.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Rl.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Rl.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Rl.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 yl(this.year)}get daysInMonth(){return ho(this.year,this.month)}get daysInYear(){return this.isValid?xs(this.year):NaN}get weeksInWeekYear(){return this.isValid?po(this.weekYear):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:s}=kn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(gn.instance(e),t)}toLocal(){return this.setZone(sn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Oi(e,sn.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||i){const l=e.offset(this.ts),o=this.toObject();[s]=oo(o,l,e)}return Is(this,{ts:s,zone:e})}else return tt.invalid(Hl(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Is(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=mo(e,ku),i=!vt(t.weekYear)||!vt(t.weekNumber)||!vt(t.weekday),s=!vt(t.ordinal),l=!vt(t.year),o=!vt(t.month)||!vt(t.day),r=l||o,a=t.weekYear||t.weekNumber;if((r||s)&&a)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&s)throw new Ys("Can't mix ordinal dates with month/day");let u;i?u=mu({...Nr(this.c),...t}):vt(t.ordinal)?(u={...this.toObject(),...t},vt(t.day)&&(u.day=Math.min(ho(u.year,u.month),u.day))):u=gu({...tr(this.c),...t});const[f,c]=oo(u,this.o,this.zone);return Is(this,{ts:f,o:c})}plus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e);return Is(this,vu(this,t))}minus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e).negate();return Is(this,vu(this,t))}startOf(e){if(!this.isValid)return this;const t={},i=wt.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?kn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):nr}toLocaleString(e=Er,t={}){return this.isValid?kn.create(this.loc.clone(t),e).formatDateTime(this):nr}toLocaleParts(e={}){return this.isValid?kn.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 o=e==="extended";let r=sr(this,o);return r+="T",r+=yu(this,o,t,i,s,l),r}toISODate({format:e="extended"}={}){return this.isValid?sr(this,e==="extended"):null}toISOWeekDate(){return jl(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:s=!1,extendedZone:l=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+yu(this,o==="extended",t,e,i,l):null}toRFC2822(){return jl(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jl(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?sr(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")),jl(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():nr}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 wt.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...i},l=t0(t).map(wt.normalizeUnit),o=e.valueOf()>this.valueOf(),r=o?this:e,a=o?e:this,u=$b(r,a,l,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(tt.now(),e,t)}until(e){return this.isValid?Kt.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||tt.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(tt.isDateTime))throw new qn("max requires all arguments be DateTimes");return tu(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:s=null,numberingSystem:l=null}=i,o=Wt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0});return Zm(o,e,t)}static fromStringExplain(e,t,i={}){return tt.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Er}static get DATE_MED(){return um}static get DATE_MED_WITH_WEEKDAY(){return X_}static get DATE_FULL(){return fm}static get DATE_HUGE(){return cm}static get TIME_SIMPLE(){return dm}static get TIME_WITH_SECONDS(){return hm}static get TIME_WITH_SHORT_OFFSET(){return pm}static get TIME_WITH_LONG_OFFSET(){return mm}static get TIME_24_SIMPLE(){return gm}static get TIME_24_WITH_SECONDS(){return _m}static get TIME_24_WITH_SHORT_OFFSET(){return bm}static get TIME_24_WITH_LONG_OFFSET(){return vm}static get DATETIME_SHORT(){return ym}static get DATETIME_SHORT_WITH_SECONDS(){return km}static get DATETIME_MED(){return wm}static get DATETIME_MED_WITH_SECONDS(){return Sm}static get DATETIME_MED_WITH_WEEKDAY(){return Q_}static get DATETIME_FULL(){return $m}static get DATETIME_FULL_WITH_SECONDS(){return Cm}static get DATETIME_HUGE(){return Mm}static get DATETIME_HUGE_WITH_SECONDS(){return Tm}}function Rs(n){if(tt.isDateTime(n))return n;if(n&&n.valueOf&&ns(n.valueOf()))return tt.fromJSDate(n);if(n&&typeof n=="object")return tt.fromObject(n);throw new qn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}class Y{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>"u"||Array.isArray(e)&&e.length===0||Y.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 Y.isInput(e)||t==="button"||t==="a"||t==="details"||e.tabIndex>=0}static hasNonEmptyProps(e){for(let t in e)if(!Y.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=Y.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||!Y.isEmpty(e))&&typeof e<"u"?[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){Y.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]=Y.filterRedactedProps(i[s],t):i[s]===t&&delete i[s];return i}static getNestedVal(e,t,i=null,s="."){let l=e||{},o=t.split(s);for(const r of o){if(!Y.isObject(l)&&!Array.isArray(l)||typeof l[r]>"u")return i;l=l[r]}return l}static setByPath(e,t,i,s="."){if(!Y.isObject(e)&&!Array.isArray(e)){console.warn("setByPath: data not an object or array.");return}let l=e,o=t.split(s),r=o.pop();for(const a of o)(!Y.isObject(l)&&!Array.isArray(l)||!Y.isObject(l[a])&&!Array.isArray(l[a]))&&(l[a]={}),l=l[a];l[r]=i}static deleteByPath(e,t,i="."){let s=e||{},l=t.split(i),o=l.pop();for(const r of l)(!Y.isObject(s)&&!Array.isArray(s)||!Y.isObject(s[r])&&!Array.isArray(s[r]))&&(s[r]={}),s=s[r];Array.isArray(s)?s.splice(o,1):Y.isObject(s)&&delete s[o],l.length>0&&(Array.isArray(s)&&!s.length||Y.isObject(s)&&!Object.keys(s).length)&&(Array.isArray(e)&&e.length>0||Y.isObject(e)&&Object.keys(e).length>0)&&Y.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,o=window.innerHeight;t=t>l?l:t,i=i>o?o:i;let r=l/2-t/2,a=o/2-i/2;return window.open(e,s,"width="+t+",height="+i+",top="+a+",left="+r+",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=Y.getQueryString(e).split("&");for(let s in i){let l=i[s].split("=");if(l.length===2){let o=decodeURIComponent(l[1]);if(o.startsWith("{")||o.startsWith("["))try{o=JSON.parse(o)}catch{}t[decodeURIComponent(l[0])]=o}}return t}static setQueryParams(e,t,i=!0){let s=Y.getQueryString(e),l=i&&s?Y.getQueryParams(e):{},o=Object.assign(l,t),r="";for(let a in o)Y.isEmpty(o[a])||(r&&(r+="&"),r+=encodeURIComponent(a)+"=",Y.isObject(o[a])?r+=encodeURIComponent(JSON.stringify(o[a])):r+=encodeURIComponent(o[a]));return r=r?"?"+r:"",Y.isEmpty(s)?e+r:e.replace("?"+s,r)}static replaceClientQueryParams(e){let t=Y.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|\.gif|\.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(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),u=a.getContext("2d"),f=r.width,c=r.height;return a.width=t,a.height=i,u.drawImage(r,f>c?(f-c)/2:0,0,f>c?c:f,f>c?c:f,0,0,t,i),s(a.toDataURL(e.type))},r.src=o.target.result},l.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(Y.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const s of i)Y.addValueToFormData(e,t,s);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):Y.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,o,r,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=(o=(l=u.options)==null?void 0:l.values)==null?void 0:o[0],((r=u.options)==null?void 0:r.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 _a=si([]);function _n(n,e=3e3){return og(n,"success",e)}function lg(n,e=4500){return og(n,"error",e)}function og(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{rg(i)},t)};_a.update(s=>(ag(s,i.message),Y.pushOrReplaceByKey(s,i,"message"),s))}function rg(n){_a.update(e=>(ag(e,n),e))}function ag(n,e){let t;typeof e=="string"?t=Y.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),Y.removeByKey(n,"message",t.message))}const rs=si({});function Ri(n){rs.set(n||{})}function ug(n){rs.update(e=>(Y.deleteByPath(e,n),e))}const ba=si({});function Rr(n){ba.set(n||{})}aa.prototype.logout=function(n=!0){this.AuthStore.clear(),n&&Ts("/login")};aa.prototype.errorResponseHandler=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,s=(n==null?void 0:n.data)||{};if(e&&i!==404){let l=s.message||n.message||t;l&&lg(l)}if(Y.isEmpty(s.data)||Ri(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),Ts("/")};class Kb extends lm{save(e,t){super.save(e,t),t instanceof ws&&Rr(t)}clear(){super.clear(),Rr(null)}}const Se=new aa("/","en-US",new Kb("pb_admin_auth"));Se.AuthStore.model instanceof ws&&Rr(Se.AuthStore.model);function Cu(n){let e,t,i;return{c(){e=_("div"),e.innerHTML=``,t=T(),i=_("div"),h(e,"class","block txt-center m-b-lg"),h(i,"class","clearfix")},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},d(s){s&&k(e),s&&k(t),s&&k(i)}}}function Zb(n){let e,t,i,s,l,o,r,a,u=!n[0]&&Cu();const f=n[2].default,c=On(f,n,n[1],null);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),u&&u.c(),l=T(),c&&c.c(),o=T(),r=_("div"),h(t,"class","flex-fill"),h(s,"class","wrapper wrapper-sm m-b-xl svelte-1wbawr2"),h(r,"class","flex-fill"),h(e,"class","page-wrapper full-page-panel svelte-1wbawr2")},m(d,m){w(d,e,m),p(e,t),p(e,i),p(e,s),u&&u.m(s,null),p(s,l),c&&c.m(s,null),p(e,o),p(e,r),a=!0},p(d,[m]){d[0]?u&&(u.d(1),u=null):u||(u=Cu(),u.c(),u.m(s,l)),c&&c.p&&(!a||m&2)&&An(c,f,d,d[1],a?En(f,d[1],m,null):Pn(d[1]),null)},i(d){a||(A(c,d),a=!0)},o(d){P(c,d),a=!1},d(d){d&&k(e),u&&u.d(),c&&c.d(d)}}}function Jb(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(1,s=o.$$scope)},[l,s,i]}class fg extends Fe{constructor(e){super(),Le(this,e,Jb,Zb,Pe,{nobranding:0})}}function Mu(n,e,t){const i=n.slice();return i[11]=e[t],i}const Gb=n=>({}),Tu=n=>({uniqueId:n[3]});function Xb(n){let e=(n[11]||go)+"",t;return{c(){t=R(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||go)+"")&&me(t,e)},d(i){i&&k(t)}}}function Qb(n){var i,s;let e=(((i=n[11])==null?void 0:i.message)||((s=n[11])==null?void 0:s.code)||go)+"",t;return{c(){t=R(e)},m(l,o){w(l,t,o)},p(l,o){var r,a;o&4&&e!==(e=(((r=l[11])==null?void 0:r.message)||((a=l[11])==null?void 0:a.code)||go)+"")&&me(t,e)},d(l){l&&k(t)}}}function Du(n){let e,t;function i(o,r){return typeof o[11]=="object"?Qb:Xb}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=T(),h(e,"class","help-block help-block-error")},m(o,r){w(o,e,r),l.m(e,null),p(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&k(e),l.d()}}}function xb(n){let e,t,i,s,l;const o=n[7].default,r=On(o,n,n[6],Tu);let a=n[2],u=[];for(let f=0;ft(5,i=g));let{$$slots:s={},$$scope:l}=e;const o="field_"+Y.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){ug(r)}Jn(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(g){pt.call(this,n,g)}function m(g){he[g?"unshift":"push"](()=>{u=g,t(1,u)})}return n.$$set=g=>{"name"in g&&t(4,r=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=Y.toArray(Y.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,m]}class Ie extends Fe{constructor(e){super(),Le(this,e,e1,xb,Pe,{name:4,class:0})}}function t1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Email"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","email"),h(l,"autocomplete","off"),h(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0]),l.focus(),r||(a=X(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&1&&l.value!==u[0]&&$e(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function n1(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=R("Password"),s=T(),l=_("input"),r=T(),a=_("div"),a.textContent="Minimum 10 characters.",h(e,"for",i=n[9]),h(l,"type","password"),h(l,"autocomplete","new-password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0,h(a,"class","help-block")},m(c,d){w(c,e,d),p(e,t),w(c,s,d),w(c,l,d),$e(l,n[1]),w(c,r,d),w(c,a,d),u||(f=X(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&h(e,"for",i),d&512&&o!==(o=c[9])&&h(l,"id",o),d&2&&l.value!==c[1]&&$e(l,c[1])},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function i1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Password confirm"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[2]),r||(a=X(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&4&&l.value!==u[2]&&$e(l,u[2])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function s1(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;return s=new Ie({props:{class:"form-field required",name:"email",$$slots:{default:[t1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"password",$$slots:{default:[n1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),a=new Ie({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[i1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),{c(){e=_("form"),t=_("div"),t.innerHTML="

Create your first admin account in order to continue

",i=T(),B(s.$$.fragment),l=T(),B(o.$$.fragment),r=T(),B(a.$$.fragment),u=T(),f=_("button"),f.innerHTML=`Create and login - `,h(t,"class","content txt-center m-b-base"),h(f,"type","submit"),h(f,"class","btn btn-lg btn-block btn-next"),ee(f,"btn-disabled",n[3]),ee(f,"btn-loading",n[3]),h(e,"class","block"),h(e,"autocomplete","off")},m(g,v){w(g,e,v),p(e,t),p(e,i),V(s,e,null),p(e,l),V(o,e,null),p(e,r),V(a,e,null),p(e,u),p(e,f),c=!0,d||(m=X(e,"submit",Qt(n[4])),d=!0)},p(g,[v]){const b={};v&1537&&(b.$$scope={dirty:v,ctx:g}),s.$set(b);const y={};v&1538&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const C={};v&1540&&(C.$$scope={dirty:v,ctx:g}),a.$set(C),v&8&&ee(f,"btn-disabled",g[3]),v&8&&ee(f,"btn-loading",g[3])},i(g){c||(A(s.$$.fragment,g),A(o.$$.fragment,g),A(a.$$.fragment,g),c=!0)},o(g){P(s.$$.fragment,g),P(o.$$.fragment,g),P(a.$$.fragment,g),c=!1},d(g){g&&k(e),z(s),z(o),z(a),d=!1,m()}}}function l1(n,e,t){const i=hn();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await Se.Admins.create({email:s,password:l,passwordConfirm:o}),await Se.Admins.authViaEmail(s,l),i("submit")}catch(d){Se.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class o1 extends Fe{constructor(e){super(),Le(this,e,l1,s1,Pe,{})}}function Ou(n){let e,t;return e=new fg({props:{$$slots:{default:[r1]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function r1(n){let e,t;return e=new o1({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p:oe,i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function a1(n){let e,t,i=n[0]&&Ou(n);return{c(){i&&i.c(),e=lt()},m(s,l){i&&i.m(s,l),w(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&A(i,1)):(i=Ou(s),i.c(),A(i,1),i.m(e.parentNode,e)):i&&(De(),P(i,1,1,()=>{i=null}),Oe())},i(s){t||(A(i),t=!0)},o(s){P(i),t=!1},d(s){i&&i.d(s),s&&k(e)}}}function u1(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){Se.logout(!1),t(0,i=!0);return}Se.AuthStore.isValid?Ts("/collections"):Se.logout()}return[i,async()=>{t(0,i=!1),await di(),window.location.search=""}]}class f1 extends Fe{constructor(e){super(),Le(this,e,u1,a1,Pe,{})}}const nn=si(""),_o=si("");function qo(n){const e=n-1;return e*e*e+1}function bo(n,{delay:e=0,duration:t=400,easing:i=bl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function Un(n,{delay:e=0,duration:t=400,easing:i=qo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);return{delay:e,duration:t,easing:i,css:(c,d)=>` +}`,c=`__svelte_${S_(f)}_${r}`,d=Wp(n),{stylesheet:p,rules:g}=ao.get(d)||$_(d,n);g[c]||(g[c]=!0,p.insertRule(`@keyframes ${c} ${f}`,p.cssRules.length));const v=n.style.animation||"";return n.style.animation=`${v?`${v}, `:""}${c} ${i}ms linear ${s}ms 1 both`,uo+=1,c}function al(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(", "),uo-=s,uo||C_())}function C_(){sa(()=>{uo||(ao.forEach(n=>{const{stylesheet:e}=n;let t=e.cssRules.length;for(;t--;)e.deleteRule(t);n.rules={}}),ao.clear())})}function M_(n,e,t,i){if(!e)return oe;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return oe;const{delay:l=0,duration:o=300,easing:r=bl,start:a=Po()+l,end:u=a+o,tick:f=oe,css:c}=t(n,{from:e,to:s},i);let d=!0,p=!1,g;function v(){c&&(g=rl(n,0,1,o,l,r,c)),l||(p=!0)}function b(){c&&al(n,g),d=!1}return Lo(y=>{if(!p&&y>=a&&(p=!0),p&&y>=u&&(f(1,0),b()),!d)return!1;if(p){const $=y-a,C=0+1*r($/o);f(C,1-C)}return!0}),v(),f(0,1),b}function T_(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,Zp(n,s)}}function Zp(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 ul;function Gs(n){ul=n}function Fo(){if(!ul)throw new Error("Function called outside component initialization");return ul}function Jn(n){Fo().$$.on_mount.push(n)}function D_(n){Fo().$$.after_update.push(n)}function O_(n){Fo().$$.on_destroy.push(n)}function hn(){const n=Fo();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=Kp(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function pt(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Ws=[],he=[],no=[],Cr=[],Jp=Promise.resolve();let Mr=!1;function Gp(){Mr||(Mr=!0,Jp.then(Xp))}function di(){return Gp(),Jp}function Lt(n){no.push(n)}function He(n){Cr.push(n)}const Jo=new Set;let Fl=0;function Xp(){const n=ul;do{for(;Fl{Ls=null})),Ls}function ts(n,e,t){n.dispatchEvent(Kp(`${e?"intro":"outro"}${t}`))}const io=new Set;let ri;function De(){ri={r:0,c:[],p:ri}}function Oe(){ri.r||st(ri.c),ri=ri.p}function A(n,e){n&&n.i&&(io.delete(n),n.i(e))}function P(n,e,t,i){if(n&&n.o){if(io.has(n))return;io.add(n),ri.c.push(()=>{io.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const oa={duration:0};function Qp(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&al(n,l)}function u(){const{delay:c=0,duration:d=300,easing:p=bl,tick:g=oe,css:v}=i||oa;v&&(l=rl(n,0,1,d,c,p,v,r++)),g(0,1);const b=Po()+c,y=b+d;o&&o.abort(),s=!0,Lt(()=>ts(n,!0,"start")),o=Lo($=>{if(s){if($>=y)return g(1,0),ts(n,!0,"end"),a(),s=!1;if($>=b){const C=p(($-b)/d);g(C,1-C)}}return s})}let f=!1;return{start(){f||(f=!0,al(n),Zn(i)?(i=i(),la().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function xp(n,e,t){let i=e(n,t),s=!0,l;const o=ri;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=bl,tick:c=oe,css:d}=i||oa;d&&(l=rl(n,1,0,u,a,f,d));const p=Po()+a,g=p+u;Lt(()=>ts(n,!1,"start")),Lo(v=>{if(s){if(v>=g)return c(0,1),ts(n,!1,"end"),--o.r||st(o.c),!1;if(v>=p){const b=f((v-p)/u);c(1-b,b)}}return s})}return Zn(i)?la().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&al(n,l),s=!1)}}}function at(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&al(n,a)}function f(d,p){const g=d.b-l;return p*=Math.abs(g),{a:l,b:d.b,d:g,duration:p,start:d.start,end:d.start+p,group:d.group}}function c(d){const{delay:p=0,duration:g=300,easing:v=bl,tick:b=oe,css:y}=s||oa,$={start:Po()+p,b:d};d||($.group=ri,ri.r+=1),o||r?r=$:(y&&(u(),a=rl(n,l,d,g,p,v,y)),d&&b(0,1),o=f($,g),Lt(()=>ts(n,d,"start")),Lo(C=>{if(r&&C>r.start&&(o=f(r,g),r=null,ts(n,o.b,"start"),y&&(u(),a=rl(n,l,o.b,o.duration,0,v,s.css))),o){if(C>=o.end)b(l=o.b,1-l),ts(n,o.b,"end"),r||(o.b?u():--o.group.r||st(o.group.c)),o=null;else if(C>=o.start){const S=C-o.start;l=o.a+o.d*v(S/o.duration),b(l,1-l)}}return!!(o||r)}))}return{run(d){Zn(s)?la().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function cn(n,e){n.d(1),e.delete(n.key)}function Bt(n,e){P(n,1,1,()=>{e.delete(n.key)})}function A_(n,e){n.f(),Bt(n,e)}function dt(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,p=l.length,g=d;const v={};for(;g--;)v[n[g].key]=g;const b=[],y=new Map,$=new Map;for(g=p;g--;){const D=c(s,l,g),E=t(D);let O=o.get(E);O?i&&O.p(D,e):(O=u(E,D),O.c()),y.set(E,b[g]=O),E in v&&$.set(E,Math.abs(g-v[E]))}const C=new Set,S=new Set;function M(D){A(D,1),D.m(r,f),o.set(D.key,D),f=D.first,p--}for(;d&&p;){const D=b[p-1],E=n[d-1],O=D.key,F=E.key;D===E?(f=D.first,d--,p--):y.has(F)?!o.has(O)||C.has(O)?M(D):S.has(F)?d--:$.get(O)>$.get(F)?(S.add(O),M(D)):(C.add(F),d--):(a(E,o),d--)}for(;d--;){const D=n[d];y.has(D.key)||a(D,o)}for(;p;)M(b[p-1]);return b}function bn(n,e){const t={},i={},s={$$scope:1};let l=n.length;for(;l--;){const o=n[l],r=e[l];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)s[a]||(t[a]=r[a],s[a]=1);n[l]=r}else for(const a in o)s[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function hi(n){return typeof n=="object"&&n!==null?n:{}}function Re(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:o,after_update:r}=n.$$;s&&s.m(e,t),i||Lt(()=>{const a=l.map(qp).filter(Zn);o?o.push(...a):st(a),n.$$.on_mount=[]}),r.forEach(Lt)}function z(n,e){const t=n.$$;t.fragment!==null&&(st(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function P_(n,e){n.$$.dirty[0]===-1&&(Ws.push(n),Gp(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const g=p.length?p[0]:d;return u.ctx&&s(u.ctx[c],u.ctx[c]=g)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](g),f&&P_(n,c)),d}):[],u.update(),f=!0,st(u.before_update),u.fragment=i?i(u.ctx):!1,e.target){if(e.hydrate){const c=w_(e.target);u.fragment&&u.fragment.l(c),c.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&A(n.$$.fragment),V(n,e.target,e.anchor,e.customElement),Xp()}Gs(a)}class Fe{$destroy(){z(this,1),this.$destroy=oe}$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&&!v_(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function an(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:o}}function tm(n,e,t){const i=!Array.isArray(n),s=i?[n]:n,l=e.length<2;return em(t,o=>{let r=!1;const a=[];let u=0,f=oe;const c=()=>{if(u)return;f();const p=e(i?a[0]:a,o);l?o(p):f=Zn(p)?p:oe},d=s.map((p,g)=>Vp(p,v=>{a[g]=v,u&=~(1<{u|=1<{z(f,1)}),Oe()}l?(e=new l(o()),e.$on("routeEvent",r[7]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function F_(n){let e,t,i;const s=[{params:n[1]},n[2]];var l=n[0];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),e.$on("routeEvent",r[6]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function I_(n){let e,t,i,s;const l=[F_,L_],o=[];function r(a,u){return a[1]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=lt()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(De(),P(o[f],1,1,()=>{o[f]=null}),Oe(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),A(t,1),t.m(i.parentNode,i))},i(a){s||(A(t),s=!0)},o(a){P(t),s=!1},d(a){o[e].d(a),a&&k(i)}}}function Ja(){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 Io=em(null,function(e){e(Ja());const t=()=>{e(Ja())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});tm(Io,n=>n.location);tm(Io,n=>n.querystring);const Ga=si(void 0);async function Ts(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await di();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 Tn(n,e){if(e=Qa(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with
tags');return Xa(n,e),{update(t){t=Qa(t),Xa(n,t)}}}function Xa(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||N_(i.currentTarget.getAttribute("href"))})}function Qa(n){return n&&typeof n=="string"?{href:n}:n||{}}function N_(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 R_(n,e,t){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:l=!1}=e;class o{constructor(M,D){if(!D||typeof D!="function"&&(typeof D!="object"||D._sveltesparouter!==!0))throw Error("Invalid component object");if(!M||typeof M=="string"&&(M.length<1||M.charAt(0)!="/"&&M.charAt(0)!="*")||typeof M=="object"&&!(M instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:E,keys:O}=nm(M);this.path=M,typeof D=="object"&&D._sveltesparouter===!0?(this.component=D.component,this.conditions=D.conditions||[],this.userData=D.userData,this.props=D.props||{}):(this.component=()=>Promise.resolve(D),this.conditions=[],this.props={}),this._pattern=E,this._keys=O}match(M){if(s){if(typeof s=="string")if(M.startsWith(s))M=M.substr(s.length)||"/";else return null;else if(s instanceof RegExp){const F=M.match(s);if(F&&F[0])M=M.substr(F[0].length)||"/";else return null}}const D=this._pattern.exec(M);if(D===null)return null;if(this._keys===!1)return D;const E={};let O=0;for(;O{r.push(new o(M,S))}):Object.keys(i).forEach(S=>{r.push(new o(S,i[S]))});let a=null,u=null,f={};const c=hn();async function d(S,M){await di(),c(S,M)}let p=null,g=null;l&&(g=S=>{S.state&&S.state.__svelte_spa_router_scrollY?p=S.state:p=null},window.addEventListener("popstate",g),D_(()=>{p?window.scrollTo(p.__svelte_spa_router_scrollX,p.__svelte_spa_router_scrollY):window.scrollTo(0,0)}));let v=null,b=null;const y=Io.subscribe(async S=>{v=S;let M=0;for(;M{Ga.set(u)});return}t(0,a=null),b=null,Ga.set(void 0)});O_(()=>{y(),g&&window.removeEventListener("popstate",g)});function $(S){pt.call(this,n,S)}function C(S){pt.call(this,n,S)}return n.$$set=S=>{"routes"in S&&t(3,i=S.routes),"prefix"in S&&t(4,s=S.prefix),"restoreScrollState"in S&&t(5,l=S.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=l?"manual":"auto")},[a,u,f,i,s,l,$,C]}class H_ extends Fe{constructor(e){super(),Le(this,e,R_,I_,Pe,{routes:3,prefix:4,restoreScrollState:5})}}const so=[];let im;function sm(n){const e=n.pattern.test(im);xa(n,n.className,e),xa(n,n.inactiveClassName,!e)}function xa(n,e,t){(e||"").split(" ").forEach(i=>{!i||(n.node.classList.remove(i),t&&n.node.classList.add(i))})}Io.subscribe(n=>{im=n.location+(n.querystring?"?"+n.querystring:""),so.map(sm)});function oi(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"?nm(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return so.push(i),sm(i),{destroy(){so.splice(so.indexOf(i),1)}}}const j_="modulepreload",q_=function(n){return"/_/"+n},eu={},Qi=function(e,t,i){return!t||t.length===0?e():Promise.all(t.map(s=>{if(s=q_(s),s in eu)return;eu[s]=!0;const l=s.endsWith(".css"),o=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${o}`))return;const r=document.createElement("link");if(r.rel=l?"stylesheet":j_,l||(r.as="script",r.crossOrigin=""),r.href=s,document.head.appendChild(r),l)return new Promise((a,u)=>{r.addEventListener("load",a),r.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e())};var Tr=function(n,e){return Tr=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])},Tr(n,e)};function dn(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}Tr(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Dr=function(){return Dr=Object.assign||function(n){for(var e,t=1,i=arguments.length;t0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){o=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]0&&(!i.exp||i.exp-t>Date.now()/1e3))},n}(),vl=function(){function n(e){e===void 0&&(e={}),this.load(e||{})}return n.prototype.load=function(e){this.id=e.id!==void 0?e.id:"",this.created=e.created!==void 0?e.created:"",this.updated=e.updated!==void 0?e.updated:""},Object.defineProperty(n.prototype,"isNew",{get:function(){return!this.id||this.id==="00000000-0000-0000-0000-000000000000"},enumerable:!1,configurable:!0}),n.prototype.clone=function(){return new this.constructor(JSON.parse(JSON.stringify(this)))},n.prototype.export=function(){return Object.assign({},this)},n}(),fo=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return dn(e,n),e.prototype.load=function(t){n.prototype.load.call(this,t);for(var i=0,s=Object.entries(t);i0?n:1,this.perPage=e>=0?e:0,this.totalItems=t>=0?t:0,this.items=i||[]},am=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return dn(e,n),e.prototype._getFullList=function(t,i,s){var l=this;i===void 0&&(i=100),s===void 0&&(s={});var o=[],r=function(a){return Xs(l,void 0,void 0,function(){return Qs(this,function(u){return[2,this._getList(t,a,i,s).then(function(f){var c=f,d=c.items,p=c.totalItems;return o=o.concat(d),d.length&&p>o.length?r(a+1):o})]})})};return r(1)},e.prototype._getList=function(t,i,s,l){var o=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(t,{method:"GET",params:l}).then(function(r){var a=[];if(r!=null&&r.items){r.items=r.items||[];for(var u=0,f=r.items;u=400)throw new Go({url:C.url,status:C.status,data:S});return[2,S]}})})}).catch(function(C){throw C instanceof Go?C:new Go(C)})},n.prototype.buildUrl=function(e){var t=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return e&&(t+=e.startsWith("/")?e.substring(1):e),t},n.prototype.serializeQueryParams=function(e){var t=[];for(var i in e)if(e[i]!==null){var s=e[i],l=encodeURIComponent(i);if(Array.isArray(s))for(var o=0,r=s;o"u"}function ns(n){return typeof n=="number"}function Ro(n){return typeof n=="number"&&n%1===0}function e0(n){return typeof n=="string"}function t0(n){return Object.prototype.toString.call(n)==="[object Date]"}function Om(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function n0(n){return Array.isArray(n)?n:[n]}function tu(n,e,t){if(n.length!==0)return n.reduce((i,s)=>{const l=[e(s),s];return i&&t(i[0],l[0])===i[0]?i:l},null)[1]}function i0(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Ss(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function vi(n,e,t){return Ro(n)&&n>=e&&n<=t}function s0(n,e){return n-e*Math.floor(n/e)}function xt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Di(n){if(!(vt(n)||n===null||n===""))return parseInt(n,10)}function Bi(n){if(!(vt(n)||n===null||n===""))return parseFloat(n)}function ua(n){if(!(vt(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function fa(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function yl(n){return n%4===0&&(n%100!==0||n%400===0)}function xs(n){return yl(n)?366:365}function ho(n,e){const t=s0(e-1,12)+1,i=n+(e-t)/12;return t===2?yl(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function ca(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 po(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 Ar(n){return n>99?n:n>60?1900+n:2e3+n}function Em(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 o={timeZoneName:e,...l},r=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Ho(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 Am(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new qn(`Invalid unit value ${n}`);return e}function mo(n,e){const t={};for(const i in n)if(Ss(n,i)){const s=n[i];if(s==null)continue;t[e(i)]=Am(s)}return t}function el(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}${xt(t,2)}:${xt(i,2)}`;case"narrow":return`${s}${t}${i>0?`:${i}`:""}`;case"techie":return`${s}${xt(t,2)}${xt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function jo(n){return i0(n,["hour","minute","second","millisecond"])}const Pm=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/,l0=["January","February","March","April","May","June","July","August","September","October","November","December"],Lm=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o0=["J","F","M","A","M","J","J","A","S","O","N","D"];function Fm(n){switch(n){case"narrow":return[...o0];case"short":return[...Lm];case"long":return[...l0];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 Im=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Nm=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],r0=["M","T","W","T","F","S","S"];function Rm(n){switch(n){case"narrow":return[...r0];case"short":return[...Nm];case"long":return[...Im];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Hm=["AM","PM"],a0=["Before Christ","Anno Domini"],u0=["BC","AD"],f0=["B","A"];function jm(n){switch(n){case"narrow":return[...f0];case"short":return[...u0];case"long":return[...a0];default:return null}}function c0(n){return Hm[n.hour<12?0:1]}function d0(n,e){return Rm(e)[n.weekday-1]}function h0(n,e){return Fm(e)[n.month-1]}function p0(n,e){return jm(e)[n.year<0?0:1]}function m0(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 o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,u=s[n],f=i?a?u[1]:u[2]||u[1]:a?s[n][0]:n;return o?`${r} ${f} ago`:`in ${r} ${f}`}function nu(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const g0={D:Er,DD:fm,DDD:cm,DDDD:dm,t:hm,tt:pm,ttt:mm,tttt:gm,T:_m,TT:bm,TTT:vm,TTTT:ym,f:km,ff:Sm,fff:Cm,ffff:Tm,F:wm,FF:$m,FFF:Mm,FFFF:Dm};class kn{static create(e,t={}){return new kn(e,t)}static parseFormat(e){let t=null,i="",s=!1;const l=[];for(let o=0;o0&&l.push({literal:s,val:i}),t=null,i="",s=!s):s||r===t?i+=r:(i.length>0&&l.push({literal:!1,val:i}),i=r,t=r)}return i.length>0&&l.push({literal:s,val:i}),l}static macroTokenToFormatOpts(e){return g0[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 xt(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=(p,g)=>this.loc.extract(e,p,g),o=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",r=()=>i?c0(e):l({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(p,g)=>i?h0(e,p):l(g?{month:p}:{month:p,day:"numeric"},"month"),u=(p,g)=>i?d0(e,p):l(g?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),f=p=>{const g=kn.macroTokenToFormatOpts(p);return g?this.formatWithSystemDefault(e,g):p},c=p=>i?p0(e,p):l({era:p},"era"),d=p=>{switch(p){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 o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({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 r();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(p)}};return nu(kn.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=kn.parseFormat(t),o=l.reduce((a,{literal:u,val:f})=>u?a:a.concat(f),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return nu(l,s(r))}}class xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}class kl{get type(){throw new Mi}get name(){throw new Mi}get ianaName(){return this.name}get isUniversal(){throw new Mi}offsetName(e,t){throw new Mi}formatOffset(e,t){throw new Mi}offset(e){throw new Mi}equals(e){throw new Mi}get isValid(){throw new Mi}}let Xo=null;class da extends kl{static get instance(){return Xo===null&&(Xo=new da),Xo}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return Em(e,t,i)}formatOffset(e,t){return el(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let lo={};function _0(n){return lo[n]||(lo[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"})),lo[n]}const b0={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function v0(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,l,o,r,a,u,f]=i;return[o,s,l,r,a,u,f]}function y0(n,e){const t=n.formatToParts(e),i=[];for(let s=0;s=0?g:1e3+g,(d-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Qo=null;class gn extends kl{static get utcInstance(){return Qo===null&&(Qo=new gn(0)),Qo}static instance(e){return e===0?gn.utcInstance:new gn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new gn(Ho(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${el(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${el(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return el(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 k0 extends kl{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 Oi(n,e){if(vt(n)||n===null)return e;if(n instanceof kl)return n;if(e0(n)){const t=n.toLowerCase();return t==="local"||t==="system"?e:t==="utc"||t==="gmt"?gn.utcInstance:gn.parseSpecifier(t)||ki.create(n)}else return ns(n)?gn.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new k0(n)}let iu=()=>Date.now(),su="system",lu=null,ou=null,ru=null,au;class sn{static get now(){return iu}static set now(e){iu=e}static set defaultZone(e){su=e}static get defaultZone(){return Oi(su,da.instance)}static get defaultLocale(){return lu}static set defaultLocale(e){lu=e}static get defaultNumberingSystem(){return ou}static set defaultNumberingSystem(e){ou=e}static get defaultOutputCalendar(){return ru}static set defaultOutputCalendar(e){ru=e}static get throwOnInvalid(){return au}static set throwOnInvalid(e){au=e}static resetCaches(){Wt.resetCache(),ki.resetCache()}}let uu={};function w0(n,e={}){const t=JSON.stringify([n,e]);let i=uu[t];return i||(i=new Intl.ListFormat(n,e),uu[t]=i),i}let Pr={};function Lr(n,e={}){const t=JSON.stringify([n,e]);let i=Pr[t];return i||(i=new Intl.DateTimeFormat(n,e),Pr[t]=i),i}let Fr={};function S0(n,e={}){const t=JSON.stringify([n,e]);let i=Fr[t];return i||(i=new Intl.NumberFormat(n,e),Fr[t]=i),i}let Ir={};function $0(n,e={}){const{base:t,...i}=e,s=JSON.stringify([n,i]);let l=Ir[s];return l||(l=new Intl.RelativeTimeFormat(n,e),Ir[s]=l),l}let Ks=null;function C0(){return Ks||(Ks=new Intl.DateTimeFormat().resolvedOptions().locale,Ks)}function M0(n){const e=n.indexOf("-u-");if(e===-1)return[n];{let t;const i=n.substring(0,e);try{t=Lr(n).resolvedOptions()}catch{t=Lr(i).resolvedOptions()}const{numberingSystem:s,calendar:l}=t;return[i,s,l]}}function T0(n,e,t){return(t||e)&&(n+="-u",t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function D0(n){const e=[];for(let t=1;t<=12;t++){const i=tt.utc(2016,t,1);e.push(n(i))}return e}function O0(n){const e=[];for(let t=1;t<=7;t++){const i=tt.utc(2016,11,13+t);e.push(n(i))}return e}function Nl(n,e,t,i,s){const l=n.listingMode(t);return l==="error"?null:l==="en"?i(e):s(e)}function E0(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 A0{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:s,floor:l,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=S0(e,r)}}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):fa(e,3);return xt(t,this.padTo)}}}class P0{constructor(e,t,i){this.opts=i;let s;if(e.zone.isUniversal){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ki.create(r).valid?(s=r,this.dt=e):(s="UTC",i.timeZoneName?this.dt=e:this.dt=e.offset===0?e:tt.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=Lr(t,l)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class L0{constructor(e,t,i){this.opts={style:"long",...i},!t&&Om()&&(this.rtf=$0(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):m0(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}class Wt{static fromOpts(e){return Wt.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,i,s=!1){const l=e||sn.defaultLocale,o=l||(s?"en-US":C0()),r=t||sn.defaultNumberingSystem,a=i||sn.defaultOutputCalendar;return new Wt(o,r,a,l)}static resetCache(){Ks=null,Pr={},Fr={},Ir={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i}={}){return Wt.create(e,t,i)}constructor(e,t,i,s){const[l,o,r]=M0(e);this.locale=l,this.numberingSystem=t||o||null,this.outputCalendar=i||r||null,this.intl=T0(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=E0(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:Wt.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 Nl(this,e,i,Fm,()=>{const s=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=D0(o=>this.extract(o,s,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1,i=!0){return Nl(this,e,i,Rm,()=>{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]=O0(o=>this.extract(o,s,"weekday"))),this.weekdaysCache[l][e]})}meridiems(e=!0){return Nl(this,void 0,e,()=>Hm,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[tt.utc(2016,11,13,9),tt.utc(2016,11,13,19)].map(i=>this.extract(i,t,"dayperiod"))}return this.meridiemCache})}eras(e,t=!0){return Nl(this,e,t,jm,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[tt.utc(-40,1,1),tt.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(),o=l.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new A0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new P0(e,this.intl,t)}relFormatter(e={}){return new L0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return w0(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 Ds(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Os(...n){return e=>n.reduce(([t,i,s],l)=>{const[o,r,a]=l(e,s);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Es(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 qm(...n){return(e,t)=>{const i={};let s;for(s=0;sp!==void 0&&(g||p&&f)?-p:p;return[{years:d(Bi(t)),months:d(Bi(i)),weeks:d(Bi(s)),days:d(Bi(l)),hours:d(Bi(o)),minutes:d(Bi(r)),seconds:d(Bi(a),a==="-0"),milliseconds:d(ua(u),c)}]}const Y0={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 ma(n,e,t,i,s,l,o){const r={year:e.length===2?Ar(Di(e)):Di(e),month:Lm.indexOf(t)+1,day:Di(i),hour:Di(s),minute:Di(l)};return o&&(r.second=Di(o)),n&&(r.weekday=n.length>3?Im.indexOf(n)+1:Nm.indexOf(n)+1),r}const K0=/^(?:(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 Z0(n){const[,e,t,i,s,l,o,r,a,u,f,c]=n,d=ma(e,s,i,t,l,o,r);let p;return a?p=Y0[a]:u?p=0:p=Ho(f,c),[d,new gn(p)]}function J0(n){return n.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const G0=/^(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$/,X0=/^(Monday|Tuesday|Wednesday|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$/,Q0=/^(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 fu(n){const[,e,t,i,s,l,o,r]=n;return[ma(e,s,i,t,l,o,r),gn.utcInstance]}function x0(n){const[,e,t,i,s,l,o,r]=n;return[ma(e,r,t,i,s,l,o),gn.utcInstance]}const eb=Ds(I0,pa),tb=Ds(N0,pa),nb=Ds(R0,pa),ib=Ds(zm),Um=Os(z0,As,wl,Sl),sb=Os(H0,As,wl,Sl),lb=Os(j0,As,wl,Sl),ob=Os(As,wl,Sl);function rb(n){return Es(n,[eb,Um],[tb,sb],[nb,lb],[ib,ob])}function ab(n){return Es(J0(n),[K0,Z0])}function ub(n){return Es(n,[G0,fu],[X0,fu],[Q0,x0])}function fb(n){return Es(n,[U0,W0])}const cb=Os(As);function db(n){return Es(n,[B0,cb])}const hb=Ds(q0,V0),pb=Ds(Bm),mb=Os(As,wl,Sl);function gb(n){return Es(n,[hb,Um],[pb,mb])}const _b="Invalid Duration",Wm={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}},bb={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},...Wm},Nn=146097/400,hs=146097/4800,vb={years:{quarters:4,months:12,weeks:Nn/7,days:Nn,hours:Nn*24,minutes:Nn*24*60,seconds:Nn*24*60*60,milliseconds:Nn*24*60*60*1e3},quarters:{months:3,weeks:Nn/28,days:Nn/4,hours:Nn*24/4,minutes:Nn*24*60/4,seconds:Nn*24*60*60/4,milliseconds:Nn*24*60*60*1e3/4},months:{weeks:hs/7,days:hs,hours:hs*24,minutes:hs*24*60,seconds:hs*24*60*60,milliseconds:hs*24*60*60*1e3},...Wm},Ji=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],yb=Ji.slice(0).reverse();function Ui(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 wt(i)}function kb(n){return n<0?Math.floor(n):Math.ceil(n)}function Ym(n,e,t,i,s){const l=n[s][t],o=e[t]/l,r=Math.sign(o)===Math.sign(i[s]),a=!r&&i[s]!==0&&Math.abs(o)<=1?kb(o):Math.trunc(o);i[s]+=a,e[t]-=a*l}function wb(n,e){yb.reduce((t,i)=>vt(e[i])?t:(t&&Ym(n,e,t,e,i),i),null)}class wt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;this.values=e.values,this.loc=e.loc||Wt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=t?vb:bb,this.isLuxonDuration=!0}static fromMillis(e,t){return wt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new qn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new wt({values:mo(e,wt.normalizeUnit),loc:Wt.fromObject(t),conversionAccuracy:t.conversionAccuracy})}static fromDurationLike(e){if(ns(e))return wt.fromMillis(e);if(wt.isDuration(e))return e;if(typeof e=="object")return wt.fromObject(e);throw new qn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=fb(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=db(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new qn("need to specify a reason the Duration is invalid");const i=e instanceof xn?e:new xn(e,t);if(sn.throwOnInvalid)throw new X_(i);return new wt({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 um(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?kn.create(this.loc,i).formatDurationFromString(this,e):_b}toHuman(e={}){const t=Ji.map(i=>{const s=this.values[i];return vt(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+=fa(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=wt.fromDurationLike(e),i={};for(const s of Ji)(Ss(t.values,s)||Ss(this.values,s))&&(i[s]=t.get(s)+this.get(s));return Ui(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=wt.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]=Am(e(this.values[i],i));return Ui(this,{values:t},!0)}get(e){return this[wt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...mo(e,wt.normalizeUnit)};return Ui(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),Ui(this,l)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return wb(this.matrix,e),Ui(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>wt.normalizeUnit(o));const t={},i={},s=this.toObject();let l;for(const o of Ji)if(e.indexOf(o)>=0){l=o;let r=0;for(const u in i)r+=this.matrix[u][o]*i[u],i[u]=0;ns(s[o])&&(r+=s[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3;for(const u in s)Ji.indexOf(u)>Ji.indexOf(o)&&Ym(this.matrix,s,u,t,o)}else ns(s[o])&&(i[o]=s[o]);for(const o in i)i[o]!==0&&(t[l]+=o===l?i[o]:i[o]/this.matrix[l][o]);return Ui(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 Ui(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 Ji)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Fs="Invalid Interval";function Sb(n,e){return!n||!n.isValid?Kt.invalid("missing or invalid start"):!e||!e.isValid?Kt.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?Kt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Rs).filter(o=>this.contains(o)).sort(),i=[];let{s}=this,l=0;for(;s+this.e?this.e:o;i.push(Kt.fromDateTimes(s,r)),s=r,l+=1}return i}splitBy(e){const t=wt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,s=1,l;const o=[];for(;ia*s));l=+r>+this.e?this.e:r,o.push(Kt.fromDateTimes(i,l)),i=l,s+=1}return o}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:Kt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return Kt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((s,l)=>s.s-l.s).reduce(([s,l],o)=>l?l.overlaps(o)||l.abutsStart(o)?[s,l.union(o)]:[s.concat([l]),o]:[s,o],[[],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"}]),o=Array.prototype.concat(...l),r=o.sort((a,u)=>a.time-u.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&s.push(Kt.fromDateTimes(t,a.time)),t=null);return Kt.merge(s)}difference(...e){return Kt.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()})`:Fs}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Fs}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Fs}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Fs}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Fs}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):wt.invalid(this.invalidReason)}mapEndpoints(e){return Kt.fromDateTimes(e(this.s),e(this.e))}}class Rl{static hasDST(e=sn.defaultZone){const t=tt.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ki.isValidZone(e)}static normalizeZone(e){return Oi(e,sn.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Wt.create(t,i,l)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Wt.create(t,i,l)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Wt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Wt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Wt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Wt.create(t,null,"gregory").eras(e)}static features(){return{relative:Om()}}}function cu(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(wt.fromMillis(i).as("days"))}function $b(n,e,t){const i=[["years",(r,a)=>a.year-r.year],["quarters",(r,a)=>a.quarter-r.quarter],["months",(r,a)=>a.month-r.month+(a.year-r.year)*12],["weeks",(r,a)=>{const u=cu(r,a);return(u-u%7)/7}],["days",cu]],s={};let l,o;for(const[r,a]of i)if(t.indexOf(r)>=0){l=r;let u=a(n,e);o=n.plus({[r]:u}),o>e?(n=n.plus({[r]:u-1}),u-=1):n=o,s[r]=u}return[n,s,o,l]}function Cb(n,e,t,i){let[s,l,o,r]=$b(n,e,t);const a=e-s,u=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);u.length===0&&(o0?wt.fromMillis(a,i).shiftTo(...u).plus(f):f}const ga={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"},du={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]},Mb=ga.hanidec.replace(/[\[|\]]/g,"").split("");function Tb(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=l&&i<=o&&(e+=i-l)}}return parseInt(e,10)}else return e}function Xn({numberingSystem:n},e=""){return new RegExp(`${ga[n||"latn"]}${e}`)}const Db="missing Intl.DateTimeFormat.formatToParts support";function Dt(n,e=t=>t){return{regex:n,deser:([t])=>e(Tb(t))}}const Ob=String.fromCharCode(160),Km=`[ ${Ob}]`,Zm=new RegExp(Km,"g");function Eb(n){return n.replace(/\./g,"\\.?").replace(Zm,Km)}function hu(n){return n.replace(/\./g,"").replace(Zm," ").toLowerCase()}function Qn(n,e){return n===null?null:{regex:RegExp(n.map(Eb).join("|")),deser:([t])=>n.findIndex(i=>hu(t)===hu(i))+e}}function pu(n,e){return{regex:n,deser:([,t,i])=>Ho(t,i),groups:e}}function xo(n){return{regex:n,deser:([e])=>e}}function Ab(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Pb(n,e){const t=Xn(e),i=Xn(e,"{2}"),s=Xn(e,"{3}"),l=Xn(e,"{4}"),o=Xn(e,"{6}"),r=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}"),p=b=>({regex:RegExp(Ab(b.val)),deser:([y])=>y,literal:!0}),v=(b=>{if(n.literal)return p(b);switch(b.val){case"G":return Qn(e.eras("short",!1),0);case"GG":return Qn(e.eras("long",!1),0);case"y":return Dt(u);case"yy":return Dt(c,Ar);case"yyyy":return Dt(l);case"yyyyy":return Dt(d);case"yyyyyy":return Dt(o);case"M":return Dt(r);case"MM":return Dt(i);case"MMM":return Qn(e.months("short",!0,!1),1);case"MMMM":return Qn(e.months("long",!0,!1),1);case"L":return Dt(r);case"LL":return Dt(i);case"LLL":return Qn(e.months("short",!1,!1),1);case"LLLL":return Qn(e.months("long",!1,!1),1);case"d":return Dt(r);case"dd":return Dt(i);case"o":return Dt(a);case"ooo":return Dt(s);case"HH":return Dt(i);case"H":return Dt(r);case"hh":return Dt(i);case"h":return Dt(r);case"mm":return Dt(i);case"m":return Dt(r);case"q":return Dt(r);case"qq":return Dt(i);case"s":return Dt(r);case"ss":return Dt(i);case"S":return Dt(a);case"SSS":return Dt(s);case"u":return xo(f);case"uu":return xo(r);case"uuu":return Dt(t);case"a":return Qn(e.meridiems(),0);case"kkkk":return Dt(l);case"kk":return Dt(c,Ar);case"W":return Dt(r);case"WW":return Dt(i);case"E":case"c":return Dt(t);case"EEE":return Qn(e.weekdays("short",!1,!1),1);case"EEEE":return Qn(e.weekdays("long",!1,!1),1);case"ccc":return Qn(e.weekdays("short",!0,!1),1);case"cccc":return Qn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return pu(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return pu(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return xo(/[a-z_+-/]{1,256}?/i);default:return p(b)}})(n)||{invalidReason:Db};return v.token=n,v}const Lb={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 Fb(n,e,t){const{type:i,value:s}=n;if(i==="literal")return{literal:!0,val:s};const l=t[i];let o=Lb[i];if(typeof o=="object"&&(o=o[l]),o)return{literal:!1,val:o}}function Ib(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function Nb(n,e,t){const i=n.match(e);if(i){const s={};let l=1;for(const o in t)if(Ss(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(s[r.token.val[0]]=r.deser(i.slice(l,l+a))),l+=a}return[i,s]}else return[i,{}]}function Rb(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 vt(n.z)||(t=ki.create(n.z)),vt(n.Z)||(t||(t=new gn(n.Z)),i=n.Z),vt(n.q)||(n.M=(n.q-1)*3+1),vt(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),vt(n.u)||(n.S=ua(n.u)),[Object.keys(n).reduce((l,o)=>{const r=e(o);return r&&(l[r]=n[o]),l},{}),t,i]}let er=null;function Hb(){return er||(er=tt.fromMillis(1555555555555)),er}function jb(n,e){if(n.literal)return n;const t=kn.macroTokenToFormatOpts(n.val);if(!t)return n;const l=kn.create(e,t).formatDateTimeParts(Hb()).map(o=>Fb(o,e,t));return l.includes(void 0)?n:l}function qb(n,e){return Array.prototype.concat(...n.map(t=>jb(t,e)))}function Jm(n,e,t){const i=qb(kn.parseFormat(t),n),s=i.map(o=>Pb(o,n)),l=s.find(o=>o.invalidReason);if(l)return{input:e,tokens:i,invalidReason:l.invalidReason};{const[o,r]=Ib(s),a=RegExp(o,"i"),[u,f]=Nb(e,a,r),[c,d,p]=f?Rb(f):[null,null,void 0];if(Ss(f,"a")&&Ss(f,"H"))throw new Ys("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:p}}}function Vb(n,e,t){const{result:i,zone:s,specificOffset:l,invalidReason:o}=Jm(n,e,t);return[i,s,l,o]}const Gm=[0,31,59,90,120,151,181,212,243,273,304,334],Xm=[0,31,60,91,121,152,182,213,244,274,305,335];function zn(n,e){return new xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Qm(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 xm(n,e,t){return t+(yl(n)?Xm:Gm)[e-1]}function eg(n,e){const t=yl(n)?Xm:Gm,i=t.findIndex(l=>lpo(e)?(r=e+1,o=1):r=e,{weekYear:r,weekNumber:o,weekday:l,...jo(n)}}function mu(n){const{weekYear:e,weekNumber:t,weekday:i}=n,s=Qm(e,1,4),l=xs(e);let o=t*7+i-s-3,r;o<1?(r=e-1,o+=xs(r)):o>l?(r=e+1,o-=xs(e)):r=e;const{month:a,day:u}=eg(r,o);return{year:r,month:a,day:u,...jo(n)}}function tr(n){const{year:e,month:t,day:i}=n,s=xm(e,t,i);return{year:e,ordinal:s,...jo(n)}}function gu(n){const{year:e,ordinal:t}=n,{month:i,day:s}=eg(e,t);return{year:e,month:i,day:s,...jo(n)}}function zb(n){const e=Ro(n.weekYear),t=vi(n.weekNumber,1,po(n.weekYear)),i=vi(n.weekday,1,7);return e?t?i?!1:zn("weekday",n.weekday):zn("week",n.week):zn("weekYear",n.weekYear)}function Bb(n){const e=Ro(n.year),t=vi(n.ordinal,1,xs(n.year));return e?t?!1:zn("ordinal",n.ordinal):zn("year",n.year)}function tg(n){const e=Ro(n.year),t=vi(n.month,1,12),i=vi(n.day,1,ho(n.year,n.month));return e?t?i?!1:zn("day",n.day):zn("month",n.month):zn("year",n.year)}function ng(n){const{hour:e,minute:t,second:i,millisecond:s}=n,l=vi(e,0,23)||e===24&&t===0&&i===0&&s===0,o=vi(t,0,59),r=vi(i,0,59),a=vi(s,0,999);return l?o?r?a?!1:zn("millisecond",s):zn("second",i):zn("minute",t):zn("hour",e)}const nr="Invalid DateTime",_u=864e13;function Hl(n){return new xn("unsupported zone",`the zone "${n.name}" is not supported`)}function ir(n){return n.weekData===null&&(n.weekData=Nr(n.c)),n.weekData}function Is(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new tt({...t,...e,old:t})}function ig(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 bu(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 oo(n,e,t){return ig(ca(n),e,t)}function vu(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,ho(i,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=wt.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"),r=ca(l);let[a,u]=ig(r,t,n.zone);return o!==0&&(a+=o,u=n.zone.offset(a)),{ts:a,o:u}}function Ns(n,e,t,i,s,l){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0){const a=e||r,u=tt.fromObject(n,{...t,zone:a,specificOffset:l});return o?u:u.setZone(r)}else return tt.invalid(new xn("unparsable",`the input "${s}" can't be parsed as ${i}`))}function jl(n,e,t=!0){return n.isValid?kn.create(Wt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function sr(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=xt(n.c.year,t?6:4),e?(i+="-",i+=xt(n.c.month),i+="-",i+=xt(n.c.day)):(i+=xt(n.c.month),i+=xt(n.c.day)),i}function yu(n,e,t,i,s,l){let o=xt(n.c.hour);return e?(o+=":",o+=xt(n.c.minute),(n.c.second!==0||!t)&&(o+=":")):o+=xt(n.c.minute),(n.c.second!==0||!t)&&(o+=xt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=xt(n.c.millisecond,3))),s&&(n.isOffsetFixed&&n.offset===0&&!l?o+="Z":n.o<0?(o+="-",o+=xt(Math.trunc(-n.o/60)),o+=":",o+=xt(Math.trunc(-n.o%60))):(o+="+",o+=xt(Math.trunc(n.o/60)),o+=":",o+=xt(Math.trunc(n.o%60)))),l&&(o+="["+n.zone.ianaName+"]"),o}const sg={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ub={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Wb={ordinal:1,hour:0,minute:0,second:0,millisecond:0},lg=["year","month","day","hour","minute","second","millisecond"],Yb=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Kb=["year","ordinal","hour","minute","second","millisecond"];function ku(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 um(n);return e}function wu(n,e){const t=Oi(e.zone,sn.defaultZone),i=Wt.fromObject(e),s=sn.now();let l,o;if(vt(n.year))l=s;else{for(const u of lg)vt(n[u])&&(n[u]=sg[u]);const r=tg(n)||ng(n);if(r)return tt.invalid(r);const a=t.offset(s);[l,o]=oo(n,a,t)}return new tt({ts:l,zone:t,loc:i,o})}function Su(n,e,t){const i=vt(t.round)?!0:t.round,s=(o,r)=>(o=fa(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),l=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return s(l(t.unit),t.unit);for(const o of t.units){const r=l(o);if(Math.abs(r)>=1)return s(r,o)}return s(n>e?-0:0,t.units[t.units.length-1])}function $u(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 tt{constructor(e){const t=e.zone||sn.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new xn("invalid input"):null)||(t.isValid?null:Hl(t));this.ts=vt(e.ts)?sn.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 r=t.offset(this.ts);s=bu(this.ts,r),i=Number.isNaN(s.year)?new xn("invalid input"):null,s=i?null:s,l=i?null:r}this._zone=t,this.loc=e.loc||Wt.create(),this.invalid=i,this.weekData=null,this.c=s,this.o=l,this.isLuxonDateTime=!0}static now(){return new tt({})}static local(){const[e,t]=$u(arguments),[i,s,l,o,r,a,u]=t;return wu({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static utc(){const[e,t]=$u(arguments),[i,s,l,o,r,a,u]=t;return e.zone=gn.utcInstance,wu({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const i=t0(e)?e.valueOf():NaN;if(Number.isNaN(i))return tt.invalid("invalid input");const s=Oi(t.zone,sn.defaultZone);return s.isValid?new tt({ts:i,zone:s,loc:Wt.fromObject(t)}):tt.invalid(Hl(s))}static fromMillis(e,t={}){if(ns(e))return e<-_u||e>_u?tt.invalid("Timestamp out of range"):new tt({ts:e,zone:Oi(t.zone,sn.defaultZone),loc:Wt.fromObject(t)});throw new qn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ns(e))return new tt({ts:e*1e3,zone:Oi(t.zone,sn.defaultZone),loc:Wt.fromObject(t)});throw new qn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Oi(t.zone,sn.defaultZone);if(!i.isValid)return tt.invalid(Hl(i));const s=sn.now(),l=vt(t.specificOffset)?i.offset(s):t.specificOffset,o=mo(e,ku),r=!vt(o.ordinal),a=!vt(o.year),u=!vt(o.month)||!vt(o.day),f=a||u,c=o.weekYear||o.weekNumber,d=Wt.fromObject(t);if((f||r)&&c)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&r)throw new Ys("Can't mix ordinal dates with month/day");const p=c||o.weekday&&!f;let g,v,b=bu(s,l);p?(g=Yb,v=Ub,b=Nr(b)):r?(g=Kb,v=Wb,b=tr(b)):(g=lg,v=sg);let y=!1;for(const O of g){const F=o[O];vt(F)?y?o[O]=v[O]:o[O]=b[O]:y=!0}const $=p?zb(o):r?Bb(o):tg(o),C=$||ng(o);if(C)return tt.invalid(C);const S=p?mu(o):r?gu(o):o,[M,D]=oo(S,l,i),E=new tt({ts:M,zone:i,o:D,loc:d});return o.weekday&&f&&e.weekday!==E.weekday?tt.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${E.toISO()}`):E}static fromISO(e,t={}){const[i,s]=rb(e);return Ns(i,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,s]=ab(e);return Ns(i,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,s]=ub(e);return Ns(i,s,t,"HTTP",t)}static fromFormat(e,t,i={}){if(vt(e)||vt(t))throw new qn("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:l=null}=i,o=Wt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0}),[r,a,u,f]=Vb(o,e,t);return f?tt.invalid(f):Ns(r,a,i,`format ${t}`,e,u)}static fromString(e,t,i={}){return tt.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,s]=gb(e);return Ns(i,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new qn("need to specify a reason the DateTime is invalid");const i=e instanceof xn?e:new xn(e,t);if(sn.throwOnInvalid)throw new J_(i);return new tt({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?ir(this).weekYear:NaN}get weekNumber(){return this.isValid?ir(this).weekNumber:NaN}get weekday(){return this.isValid?ir(this).weekday:NaN}get ordinal(){return this.isValid?tr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Rl.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Rl.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Rl.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Rl.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 yl(this.year)}get daysInMonth(){return ho(this.year,this.month)}get daysInYear(){return this.isValid?xs(this.year):NaN}get weeksInWeekYear(){return this.isValid?po(this.weekYear):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:s}=kn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(gn.instance(e),t)}toLocal(){return this.setZone(sn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Oi(e,sn.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||i){const l=e.offset(this.ts),o=this.toObject();[s]=oo(o,l,e)}return Is(this,{ts:s,zone:e})}else return tt.invalid(Hl(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Is(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=mo(e,ku),i=!vt(t.weekYear)||!vt(t.weekNumber)||!vt(t.weekday),s=!vt(t.ordinal),l=!vt(t.year),o=!vt(t.month)||!vt(t.day),r=l||o,a=t.weekYear||t.weekNumber;if((r||s)&&a)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&s)throw new Ys("Can't mix ordinal dates with month/day");let u;i?u=mu({...Nr(this.c),...t}):vt(t.ordinal)?(u={...this.toObject(),...t},vt(t.day)&&(u.day=Math.min(ho(u.year,u.month),u.day))):u=gu({...tr(this.c),...t});const[f,c]=oo(u,this.o,this.zone);return Is(this,{ts:f,o:c})}plus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e);return Is(this,vu(this,t))}minus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e).negate();return Is(this,vu(this,t))}startOf(e){if(!this.isValid)return this;const t={},i=wt.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?kn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):nr}toLocaleString(e=Er,t={}){return this.isValid?kn.create(this.loc.clone(t),e).formatDateTime(this):nr}toLocaleParts(e={}){return this.isValid?kn.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 o=e==="extended";let r=sr(this,o);return r+="T",r+=yu(this,o,t,i,s,l),r}toISODate({format:e="extended"}={}){return this.isValid?sr(this,e==="extended"):null}toISOWeekDate(){return jl(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:s=!1,extendedZone:l=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+yu(this,o==="extended",t,e,i,l):null}toRFC2822(){return jl(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jl(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?sr(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")),jl(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():nr}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 wt.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...i},l=n0(t).map(wt.normalizeUnit),o=e.valueOf()>this.valueOf(),r=o?this:e,a=o?e:this,u=Cb(r,a,l,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(tt.now(),e,t)}until(e){return this.isValid?Kt.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||tt.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(tt.isDateTime))throw new qn("max requires all arguments be DateTimes");return tu(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:s=null,numberingSystem:l=null}=i,o=Wt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0});return Jm(o,e,t)}static fromStringExplain(e,t,i={}){return tt.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Er}static get DATE_MED(){return fm}static get DATE_MED_WITH_WEEKDAY(){return Q_}static get DATE_FULL(){return cm}static get DATE_HUGE(){return dm}static get TIME_SIMPLE(){return hm}static get TIME_WITH_SECONDS(){return pm}static get TIME_WITH_SHORT_OFFSET(){return mm}static get TIME_WITH_LONG_OFFSET(){return gm}static get TIME_24_SIMPLE(){return _m}static get TIME_24_WITH_SECONDS(){return bm}static get TIME_24_WITH_SHORT_OFFSET(){return vm}static get TIME_24_WITH_LONG_OFFSET(){return ym}static get DATETIME_SHORT(){return km}static get DATETIME_SHORT_WITH_SECONDS(){return wm}static get DATETIME_MED(){return Sm}static get DATETIME_MED_WITH_SECONDS(){return $m}static get DATETIME_MED_WITH_WEEKDAY(){return x_}static get DATETIME_FULL(){return Cm}static get DATETIME_FULL_WITH_SECONDS(){return Mm}static get DATETIME_HUGE(){return Tm}static get DATETIME_HUGE_WITH_SECONDS(){return Dm}}function Rs(n){if(tt.isDateTime(n))return n;if(n&&n.valueOf&&ns(n.valueOf()))return tt.fromJSDate(n);if(n&&typeof n=="object")return tt.fromObject(n);throw new qn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}class Y{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>"u"||Array.isArray(e)&&e.length===0||Y.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 Y.isInput(e)||t==="button"||t==="a"||t==="details"||e.tabIndex>=0}static hasNonEmptyProps(e){for(let t in e)if(!Y.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=Y.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||!Y.isEmpty(e))&&typeof e<"u"?[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){Y.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]=Y.filterRedactedProps(i[s],t):i[s]===t&&delete i[s];return i}static getNestedVal(e,t,i=null,s="."){let l=e||{},o=t.split(s);for(const r of o){if(!Y.isObject(l)&&!Array.isArray(l)||typeof l[r]>"u")return i;l=l[r]}return l}static setByPath(e,t,i,s="."){if(!Y.isObject(e)&&!Array.isArray(e)){console.warn("setByPath: data not an object or array.");return}let l=e,o=t.split(s),r=o.pop();for(const a of o)(!Y.isObject(l)&&!Array.isArray(l)||!Y.isObject(l[a])&&!Array.isArray(l[a]))&&(l[a]={}),l=l[a];l[r]=i}static deleteByPath(e,t,i="."){let s=e||{},l=t.split(i),o=l.pop();for(const r of l)(!Y.isObject(s)&&!Array.isArray(s)||!Y.isObject(s[r])&&!Array.isArray(s[r]))&&(s[r]={}),s=s[r];Array.isArray(s)?s.splice(o,1):Y.isObject(s)&&delete s[o],l.length>0&&(Array.isArray(s)&&!s.length||Y.isObject(s)&&!Object.keys(s).length)&&(Array.isArray(e)&&e.length>0||Y.isObject(e)&&Object.keys(e).length>0)&&Y.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,o=window.innerHeight;t=t>l?l:t,i=i>o?o:i;let r=l/2-t/2,a=o/2-i/2;return window.open(e,s,"width="+t+",height="+i+",top="+a+",left="+r+",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=Y.getQueryString(e).split("&");for(let s in i){let l=i[s].split("=");if(l.length===2){let o=decodeURIComponent(l[1]);if(o.startsWith("{")||o.startsWith("["))try{o=JSON.parse(o)}catch{}t[decodeURIComponent(l[0])]=o}}return t}static setQueryParams(e,t,i=!0){let s=Y.getQueryString(e),l=i&&s?Y.getQueryParams(e):{},o=Object.assign(l,t),r="";for(let a in o)Y.isEmpty(o[a])||(r&&(r+="&"),r+=encodeURIComponent(a)+"=",Y.isObject(o[a])?r+=encodeURIComponent(JSON.stringify(o[a])):r+=encodeURIComponent(o[a]));return r=r?"?"+r:"",Y.isEmpty(s)?e+r:e.replace("?"+s,r)}static replaceClientQueryParams(e){let t=Y.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|\.gif|\.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(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),u=a.getContext("2d"),f=r.width,c=r.height;return a.width=t,a.height=i,u.drawImage(r,f>c?(f-c)/2:0,0,f>c?c:f,f>c?c:f,0,0,t,i),s(a.toDataURL(e.type))},r.src=o.target.result},l.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(Y.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const s of i)Y.addValueToFormData(e,t,s);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):Y.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,o,r,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=(o=(l=u.options)==null?void 0:l.values)==null?void 0:o[0],((r=u.options)==null?void 0:r.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 _a=si([]);function _n(n,e=3e3){return rg(n,"success",e)}function og(n,e=4500){return rg(n,"error",e)}function rg(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{ag(i)},t)};_a.update(s=>(ug(s,i.message),Y.pushOrReplaceByKey(s,i,"message"),s))}function ag(n){_a.update(e=>(ug(e,n),e))}function ug(n,e){let t;typeof e=="string"?t=Y.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),Y.removeByKey(n,"message",t.message))}const rs=si({});function Ri(n){rs.set(n||{})}function fg(n){rs.update(e=>(Y.deleteByPath(e,n),e))}const ba=si({});function Rr(n){ba.set(n||{})}aa.prototype.logout=function(n=!0){this.AuthStore.clear(),n&&Ts("/login")};aa.prototype.errorResponseHandler=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,s=(n==null?void 0:n.data)||{};if(e&&i!==404){let l=s.message||n.message||t;l&&og(l)}if(Y.isEmpty(s.data)||Ri(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),Ts("/")};class Zb extends om{save(e,t){super.save(e,t),t instanceof ws&&Rr(t)}clear(){super.clear(),Rr(null)}}const Se=new aa("/","en-US",new Zb("pb_admin_auth"));Se.AuthStore.model instanceof ws&&Rr(Se.AuthStore.model);function Cu(n){let e,t,i;return{c(){e=_("div"),e.innerHTML=``,t=T(),i=_("div"),h(e,"class","block txt-center m-b-lg"),h(i,"class","clearfix")},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},d(s){s&&k(e),s&&k(t),s&&k(i)}}}function Jb(n){let e,t,i,s,l,o,r,a,u=!n[0]&&Cu();const f=n[2].default,c=On(f,n,n[1],null);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),u&&u.c(),l=T(),c&&c.c(),o=T(),r=_("div"),h(t,"class","flex-fill"),h(s,"class","wrapper wrapper-sm m-b-xl svelte-1wbawr2"),h(r,"class","flex-fill"),h(e,"class","page-wrapper full-page-panel svelte-1wbawr2")},m(d,p){w(d,e,p),m(e,t),m(e,i),m(e,s),u&&u.m(s,null),m(s,l),c&&c.m(s,null),m(e,o),m(e,r),a=!0},p(d,[p]){d[0]?u&&(u.d(1),u=null):u||(u=Cu(),u.c(),u.m(s,l)),c&&c.p&&(!a||p&2)&&An(c,f,d,d[1],a?En(f,d[1],p,null):Pn(d[1]),null)},i(d){a||(A(c,d),a=!0)},o(d){P(c,d),a=!1},d(d){d&&k(e),u&&u.d(),c&&c.d(d)}}}function Gb(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(1,s=o.$$scope)},[l,s,i]}class cg extends Fe{constructor(e){super(),Le(this,e,Gb,Jb,Pe,{nobranding:0})}}function Mu(n,e,t){const i=n.slice();return i[11]=e[t],i}const Xb=n=>({}),Tu=n=>({uniqueId:n[3]});function Qb(n){let e=(n[11]||go)+"",t;return{c(){t=R(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||go)+"")&&me(t,e)},d(i){i&&k(t)}}}function xb(n){var i,s;let e=(((i=n[11])==null?void 0:i.message)||((s=n[11])==null?void 0:s.code)||go)+"",t;return{c(){t=R(e)},m(l,o){w(l,t,o)},p(l,o){var r,a;o&4&&e!==(e=(((r=l[11])==null?void 0:r.message)||((a=l[11])==null?void 0:a.code)||go)+"")&&me(t,e)},d(l){l&&k(t)}}}function Du(n){let e,t;function i(o,r){return typeof o[11]=="object"?xb:Qb}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=T(),h(e,"class","help-block help-block-error")},m(o,r){w(o,e,r),l.m(e,null),m(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&k(e),l.d()}}}function e1(n){let e,t,i,s,l;const o=n[7].default,r=On(o,n,n[6],Tu);let a=n[2],u=[];for(let f=0;ft(5,i=g));let{$$slots:s={},$$scope:l}=e;const o="field_"+Y.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){fg(r)}Jn(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(g){pt.call(this,n,g)}function p(g){he[g?"unshift":"push"](()=>{u=g,t(1,u)})}return n.$$set=g=>{"name"in g&&t(4,r=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=Y.toArray(Y.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,p]}class Ie extends Fe{constructor(e){super(),Le(this,e,t1,e1,Pe,{name:4,class:0})}}function n1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Email"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","email"),h(l,"autocomplete","off"),h(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[0]),l.focus(),r||(a=X(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&1&&l.value!==u[0]&&$e(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function i1(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=R("Password"),s=T(),l=_("input"),r=T(),a=_("div"),a.textContent="Minimum 10 characters.",h(e,"for",i=n[9]),h(l,"type","password"),h(l,"autocomplete","new-password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0,h(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[1]),w(c,r,d),w(c,a,d),u||(f=X(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&h(e,"for",i),d&512&&o!==(o=c[9])&&h(l,"id",o),d&2&&l.value!==c[1]&&$e(l,c[1])},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function s1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Password confirm"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),$e(l,n[2]),r||(a=X(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&4&&l.value!==u[2]&&$e(l,u[2])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function l1(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;return s=new Ie({props:{class:"form-field required",name:"email",$$slots:{default:[n1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"password",$$slots:{default:[i1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),a=new Ie({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[s1,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),{c(){e=_("form"),t=_("div"),t.innerHTML="

Create your first admin account in order to continue

",i=T(),B(s.$$.fragment),l=T(),B(o.$$.fragment),r=T(),B(a.$$.fragment),u=T(),f=_("button"),f.innerHTML=`Create and login + `,h(t,"class","content txt-center m-b-base"),h(f,"type","submit"),h(f,"class","btn btn-lg btn-block btn-next"),ee(f,"btn-disabled",n[3]),ee(f,"btn-loading",n[3]),h(e,"class","block"),h(e,"autocomplete","off")},m(g,v){w(g,e,v),m(e,t),m(e,i),V(s,e,null),m(e,l),V(o,e,null),m(e,r),V(a,e,null),m(e,u),m(e,f),c=!0,d||(p=X(e,"submit",Qt(n[4])),d=!0)},p(g,[v]){const b={};v&1537&&(b.$$scope={dirty:v,ctx:g}),s.$set(b);const y={};v&1538&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&1540&&($.$$scope={dirty:v,ctx:g}),a.$set($),v&8&&ee(f,"btn-disabled",g[3]),v&8&&ee(f,"btn-loading",g[3])},i(g){c||(A(s.$$.fragment,g),A(o.$$.fragment,g),A(a.$$.fragment,g),c=!0)},o(g){P(s.$$.fragment,g),P(o.$$.fragment,g),P(a.$$.fragment,g),c=!1},d(g){g&&k(e),z(s),z(o),z(a),d=!1,p()}}}function o1(n,e,t){const i=hn();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await Se.Admins.create({email:s,password:l,passwordConfirm:o}),await Se.Admins.authViaEmail(s,l),i("submit")}catch(d){Se.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class r1 extends Fe{constructor(e){super(),Le(this,e,o1,l1,Pe,{})}}function Ou(n){let e,t;return e=new cg({props:{$$slots:{default:[a1]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function a1(n){let e,t;return e=new r1({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p:oe,i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function u1(n){let e,t,i=n[0]&&Ou(n);return{c(){i&&i.c(),e=lt()},m(s,l){i&&i.m(s,l),w(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&A(i,1)):(i=Ou(s),i.c(),A(i,1),i.m(e.parentNode,e)):i&&(De(),P(i,1,1,()=>{i=null}),Oe())},i(s){t||(A(i),t=!0)},o(s){P(i),t=!1},d(s){i&&i.d(s),s&&k(e)}}}function f1(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){Se.logout(!1),t(0,i=!0);return}Se.AuthStore.isValid?Ts("/collections"):Se.logout()}return[i,async()=>{t(0,i=!1),await di(),window.location.search=""}]}class c1 extends Fe{constructor(e){super(),Le(this,e,f1,u1,Pe,{})}}const nn=si(""),_o=si("");function qo(n){const e=n-1;return e*e*e+1}function bo(n,{delay:e=0,duration:t=400,easing:i=bl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function Un(n,{delay:e=0,duration:t=400,easing:i=qo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);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 on(n,{delay:e=0,duration:t=400,easing:i=qo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=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:m=>`overflow: hidden;opacity: ${Math.min(m*20,1)*l};height: ${m*o}px;padding-top: ${m*r}px;padding-bottom: ${m*a}px;margin-top: ${m*u}px;margin-bottom: ${m*f}px;border-top-width: ${m*c}px;border-bottom-width: ${m*d}px;`}}function Wn(n,{delay:e=0,duration:t=400,easing:i=qo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>` + opacity: ${a-f*d}`}}function on(n,{delay:e=0,duration:t=400,easing:i=qo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=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:p=>`overflow: hidden;opacity: ${Math.min(p*20,1)*l};height: ${p*o}px;padding-top: ${p*r}px;padding-bottom: ${p*a}px;margin-top: ${p*u}px;margin-bottom: ${p*f}px;border-top-width: ${p*c}px;border-bottom-width: ${p*d}px;`}}function Wn(n,{delay:e=0,duration:t=400,easing:i=qo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>` transform: ${a} scale(${1-u*d}); opacity: ${r-f*d} - `}}function c1(n){let e,t,i,s;return{c(){e=_("input"),h(e,"type","text"),h(e,"id",n[8]),h(e,"placeholder",t=n[0]||n[1])},m(l,o){w(l,e,o),n[13](e),$e(e,n[7]),i||(s=X(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&h(e,"placeholder",t),o&128&&e.value!==l[7]&&$e(e,l[7])},i:oe,o:oe,d(l){l&&k(e),n[13](null),i=!1,s()}}}function d1(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(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 o&&(e=new o(r(n)),he.push(()=>Re(e,"value",l)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=lt()},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],He(()=>t=!1)),o!==(o=a[4])){if(e){De();const c=e;P(c.$$.fragment,1,0,()=>{z(c,1)}),Oe()}o?(e=new o(r(a)),he.push(()=>Re(e,"value",l)),e.$on("submit",a[10]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&A(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&z(e,a)}}}function Eu(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Au();return{c(){r&&r.c(),e=T(),t=_("button"),t.innerHTML='Clear',h(t,"type","button"),h(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(o=X(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&A(r,1):(r=Au(),r.c(),A(r,1),r.m(e.parentNode,e)):r&&(De(),P(r,1,1,()=>{r=null}),Oe())},i(a){s||(A(r),Lt(()=>{i||(i=at(t,Un,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){P(r),i||(i=at(t,Un,{duration:150,x:5},!1)),i.run(0),s=!1},d(a){r&&r.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,o()}}}function Au(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Search',h(e,"type","submit"),h(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Un,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Un,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function h1(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[d1,c1],m=[];function g(b,y){return b[4]&&!b[5]?0:1}o=g(n),r=m[o]=d[o](n);let v=(n[0].length||n[7].length)&&Eu(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=T(),r.c(),a=T(),v&&v.c(),h(s,"class","ri-search-line"),h(i,"for",n[8]),h(i,"class","m-l-10 txt-xl"),h(t,"class","searchbar"),h(e,"class","searchbar-wrapper")},m(b,y){w(b,e,y),p(e,t),p(t,i),p(i,s),p(t,l),m[o].m(t,null),p(t,a),v&&v.m(t,null),u=!0,f||(c=[X(t,"submit",Qt(n[10])),X(e,"click",ni(n[11]))],f=!0)},p(b,[y]){let C=o;o=g(b),o===C?m[o].p(b,y):(De(),P(m[C],1,1,()=>{m[C]=null}),Oe(),r=m[o],r?r.p(b,y):(r=m[o]=d[o](b),r.c()),A(r,1),r.m(t,a)),b[0].length||b[7].length?v?(v.p(b,y),y&129&&A(v,1)):(v=Eu(b),v.c(),A(v,1),v.m(t,null)):v&&(De(),P(v,1,1,()=>{v=null}),Oe())},i(b){u||(A(r),A(v),u=!0)},o(b){P(r),P(v),u=!1},d(b){b&&k(e),m[o].d(),v&&v.d(),f=!1,st(c)}}}function p1(n,e,t){const i=hn(),s="search_"+Y.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new Fn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function m(M=!0){t(7,d=""),M&&(c==null||c.focus()),i("clear")}function g(){t(0,l=d),i("submit",l)}async function v(){u||f||(t(5,f=!0),t(4,u=(await Qi(()=>import("./FilterAutocompleteInput.22ad58b4.js"),[])).default),t(5,f=!1))}Jn(()=>{v()});function b(M){pt.call(this,n,M)}function y(M){d=M,t(7,d),t(0,l)}function C(M){he[M?"unshift":"push"](()=>{c=M,t(6,c)})}function $(){d=this.value,t(7,d),t(0,l)}const S=()=>{m(!1),g()};return n.$$set=M=>{"value"in M&&t(0,l=M.value),"placeholder"in M&&t(1,o=M.placeholder),"autocompleteCollection"in M&&t(2,r=M.autocompleteCollection),"extraAutocompleteKeys"in M&&t(3,a=M.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,m,g,b,y,C,$,S]}class Vo extends Fe{constructor(e){super(),Le(this,e,p1,h1,Pe,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let Hr,Wi;const jr="app-tooltip";function Pu(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Li(){return Wi=Wi||document.querySelector("."+jr),Wi||(Wi=document.createElement("div"),Wi.classList.add(jr),document.body.appendChild(Wi)),Wi}function cg(n,e){let t=Li();if(!t.classList.contains("active")||!(e!=null&&e.text)){qr();return}t.textContent=e.text,t.className=jr+" 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(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.position=="bottom-left"?(o=l.top+l.height+a,r=l.left):e.position=="bottom-right"?(o=l.top+l.height+a,r=l.right-s):(o=l.top+l.height+a,r=l.left+l.width/2-s/2),r+s>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-s),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function qr(){clearTimeout(Hr),Li().classList.remove("active"),Li().activeNode=void 0}function m1(n,e){Li().activeNode=n,clearTimeout(Hr),Hr=setTimeout(()=>{Li().classList.add("active"),cg(n,e)},isNaN(e.delay)?250:e.delay)}function Et(n,e){let t=Pu(e);function i(){m1(n,t)}function s(){qr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&Y.isFocusable(n))&&n.addEventListener("click",s),Li(),{update(l){var o,r;t=Pu(l),(r=(o=Li())==null?void 0:o.activeNode)!=null&&r.contains(n)&&cg(n,t)},destroy(){var l,o;(o=(l=Li())==null?void 0:l.activeNode)!=null&&o.contains(n)&&qr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function g1(n){let e,t,i,s;return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","btn btn-secondary btn-circle svelte-b7gb6q"),ee(e,"refreshing",n[1])},m(l,o){w(l,e,o),i||(s=[et(t=Et.call(null,e,n[0])),X(e,"click",n[2])],i=!0)},p(l,[o]){t&&Zn(t.update)&&o&1&&t.update.call(null,l[0]),o&2&&ee(e,"refreshing",l[1])},i:oe,o:oe,d(l){l&&k(e),i=!1,st(s)}}}function _1(n,e,t){const i=hn();let{tooltip:s={text:"Refresh",position:"right"}}=e,l=null;function o(){i("refresh");const r=s;t(0,s=null),clearTimeout(l),t(1,l=setTimeout(()=>{t(1,l=null),t(0,s=r)},200))}return Jn(()=>()=>clearTimeout(l)),n.$$set=r=>{"tooltip"in r&&t(0,s=r.tooltip)},[s,l,o]}class zo extends Fe{constructor(e){super(),Le(this,e,_1,g1,Pe,{tooltip:0})}}function b1(n){let e,t,i,s,l;const o=n[6].default,r=On(o,n,n[5],null);return{c(){e=_("th"),r&&r.c(),h(e,"tabindex","0"),h(e,"class",t="col-sort "+n[1]),ee(e,"col-sort-disabled",n[3]),ee(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ee(e,"sort-desc",n[0]==="-"+n[2]),ee(e,"sort-asc",n[0]==="+"+n[2])},m(a,u){w(a,e,u),r&&r.m(e,null),i=!0,s||(l=[X(e,"click",n[7]),X(e,"keydown",n[8])],s=!0)},p(a,[u]){r&&r.p&&(!i||u&32)&&An(r,o,a,a[5],i?En(o,a[5],u,null):Pn(a[5]),null),(!i||u&2&&t!==(t="col-sort "+a[1]))&&h(e,"class",t),u&10&&ee(e,"col-sort-disabled",a[3]),u&7&&ee(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),u&7&&ee(e,"sort-desc",a[0]==="-"+a[2]),u&7&&ee(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(A(r,a),i=!0)},o(a){P(r,a),i=!1},d(a){a&&k(e),r&&r.d(a),s=!1,st(l)}}}function v1(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function u(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}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,o=d.name),"sort"in d&&t(0,r=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,s=d.$$scope)},[r,l,o,a,u,s,i,f,c]}class rn extends Fe{constructor(e){super(),Le(this,e,v1,b1,Pe,{class:1,name:2,sort:0,disable:3})}}function y1(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function k1(n){let e,t=Y.formatToUTCDate(n[0])+"",i,s,l,o,r;return{c(){e=_("span"),i=R(t),s=R(" UTC"),h(e,"class","txt")},m(a,u){w(a,e,u),p(e,i),p(e,s),o||(r=et(l=Et.call(null,e,Y.formatToLocalDate(n[0])+" Local")),o=!0)},p(a,u){u&1&&t!==(t=Y.formatToUTCDate(a[0])+"")&&me(i,t),l&&Zn(l.update)&&u&1&&l.update.call(null,Y.formatToLocalDate(a[0])+" Local")},d(a){a&&k(e),o=!1,r()}}}function w1(n){let e;function t(l,o){return l[0]?k1:y1}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:oe,o:oe,d(l){s.d(l),l&&k(e)}}}function S1(n,e,t){let{date:i=""}=e;return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i]}class wi extends Fe{constructor(e){super(),Le(this,e,S1,w1,Pe,{date:0})}}function Lu(n,e,t){const i=n.slice();return i[21]=e[t],i}function $1(n){let e;return{c(){e=_("div"),e.innerHTML=` - method`,h(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function C1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="url",h(t,"class",Y.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function M1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="referer",h(t,"class",Y.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function T1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="status",h(t,"class",Y.getFieldTypeIcon("number")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function D1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function Fu(n){let e;function t(l,o){return l[6]?E1:O1}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function O1(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Iu(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),p(e,t),p(t,i),p(t,s),o&&o.m(t,null),p(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Iu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function E1(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Iu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',h(e,"type","button"),h(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:oe,d(s){s&&k(e),t=!1,i()}}}function Nu(n){let e;return{c(){e=_("i"),h(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),h(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Ru(n,e){var le,ue,Me;let t,i,s,l=((le=e[21].method)==null?void 0:le.toUpperCase())+"",o,r,a,u,f,c=e[21].url+"",d,m,g,v,b,y,C=(e[21].referer||"N/A")+"",$,S,M,D,E,O=e[21].status+"",F,L,H,j,Q,ie,U,K,W,J,se=(((ue=e[21].meta)==null?void 0:ue.errorMessage)||((Me=e[21].meta)==null?void 0:Me.errorData))&&Nu();j=new wi({props:{date:e[21].created}});function fe(){return e[16](e[21])}function ke(...Z){return e[17](e[21],...Z)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),o=R(l),a=T(),u=_("td"),f=_("span"),d=R(c),g=T(),se&&se.c(),v=T(),b=_("td"),y=_("span"),$=R(C),M=T(),D=_("td"),E=_("span"),F=R(O),L=T(),H=_("td"),B(j.$$.fragment),Q=T(),ie=_("td"),ie.innerHTML='',U=T(),h(s,"class",r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),h(i,"class","col-type-text col-field-method min-width"),h(f,"class","txt txt-ellipsis"),h(f,"title",m=e[21].url),h(u,"class","col-type-text col-field-url"),h(y,"class","txt txt-ellipsis"),h(y,"title",S=e[21].referer),ee(y,"txt-hint",!e[21].referer),h(b,"class","col-type-text col-field-referer"),h(E,"class","label"),ee(E,"label-danger",e[21].status>=400),h(D,"class","col-type-number col-field-status"),h(H,"class","col-type-date col-field-created"),h(ie,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(Z,be){w(Z,t,be),p(t,i),p(i,s),p(s,o),p(t,a),p(t,u),p(u,f),p(f,d),p(u,g),se&&se.m(u,null),p(t,v),p(t,b),p(b,y),p(y,$),p(t,M),p(t,D),p(D,E),p(E,F),p(t,L),p(t,H),V(j,H,null),p(t,Q),p(t,ie),p(t,U),K=!0,W||(J=[X(t,"click",fe),X(t,"keydown",ke)],W=!0)},p(Z,be){var G,_e,je;e=Z,(!K||be&8)&&l!==(l=((G=e[21].method)==null?void 0:G.toUpperCase())+"")&&me(o,l),(!K||be&8&&r!==(r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&h(s,"class",r),(!K||be&8)&&c!==(c=e[21].url+"")&&me(d,c),(!K||be&8&&m!==(m=e[21].url))&&h(f,"title",m),((_e=e[21].meta)==null?void 0:_e.errorMessage)||((je=e[21].meta)==null?void 0:je.errorData)?se||(se=Nu(),se.c(),se.m(u,null)):se&&(se.d(1),se=null),(!K||be&8)&&C!==(C=(e[21].referer||"N/A")+"")&&me($,C),(!K||be&8&&S!==(S=e[21].referer))&&h(y,"title",S),be&8&&ee(y,"txt-hint",!e[21].referer),(!K||be&8)&&O!==(O=e[21].status+"")&&me(F,O),be&8&&ee(E,"label-danger",e[21].status>=400);const x={};be&8&&(x.date=e[21].created),j.$set(x)},i(Z){K||(A(j.$$.fragment,Z),K=!0)},o(Z){P(j.$$.fragment,Z),K=!1},d(Z){Z&&k(t),se&&se.d(),z(j),W=!1,st(J)}}}function Hu(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=R("Showing "),s=R(i),l=R(" of "),o=R(n[4]),h(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),p(e,t),p(e,s),p(e,l),p(e,o)},p(r,a){a&8&&i!==(i=r[3].length+"")&&me(s,i),a&16&&me(o,r[4])},d(r){r&&k(e)}}}function ju(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=R("Load more ("),o=R(l),r=R(")"),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-lg btn-secondary btn-expanded"),ee(t,"btn-loading",n[6]),ee(t,"btn-disabled",n[6]),h(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),p(e,t),p(t,i),p(i,s),p(i,o),p(i,r),a||(u=X(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&me(o,l),c&64&&ee(t,"btn-loading",f[6]),c&64&&ee(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function A1(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$,S,M,D,E=[],O=new Map,F,L,H,j;function Q(G){n[11](G)}let ie={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[$1]},$$scope:{ctx:n}};n[1]!==void 0&&(ie.sort=n[1]),l=new rn({props:ie}),he.push(()=>Re(l,"sort",Q));function U(G){n[12](G)}let K={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[C1]},$$scope:{ctx:n}};n[1]!==void 0&&(K.sort=n[1]),a=new rn({props:K}),he.push(()=>Re(a,"sort",U));function W(G){n[13](G)}let J={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[M1]},$$scope:{ctx:n}};n[1]!==void 0&&(J.sort=n[1]),c=new rn({props:J}),he.push(()=>Re(c,"sort",W));function se(G){n[14](G)}let fe={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[T1]},$$scope:{ctx:n}};n[1]!==void 0&&(fe.sort=n[1]),g=new rn({props:fe}),he.push(()=>Re(g,"sort",se));function ke(G){n[15](G)}let le={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[D1]},$$scope:{ctx:n}};n[1]!==void 0&&(le.sort=n[1]),y=new rn({props:le}),he.push(()=>Re(y,"sort",ke));let ue=n[3];const Me=G=>G[21].id;for(let G=0;Go=!1)),l.$set(je);const Ne={};_e&16777216&&(Ne.$$scope={dirty:_e,ctx:G}),!u&&_e&2&&(u=!0,Ne.sort=G[1],He(()=>u=!1)),a.$set(Ne);const qe={};_e&16777216&&(qe.$$scope={dirty:_e,ctx:G}),!d&&_e&2&&(d=!0,qe.sort=G[1],He(()=>d=!1)),c.$set(qe);const ae={};_e&16777216&&(ae.$$scope={dirty:_e,ctx:G}),!v&&_e&2&&(v=!0,ae.sort=G[1],He(()=>v=!1)),g.$set(ae);const re={};_e&16777216&&(re.$$scope={dirty:_e,ctx:G}),!C&&_e&2&&(C=!0,re.sort=G[1],He(()=>C=!1)),y.$set(re),_e&841&&(ue=G[3],De(),E=dt(E,_e,Me,1,G,ue,O,D,Bt,Ru,null,Lu),Oe(),!ue.length&&Z?Z.p(G,_e):ue.length?Z&&(Z.d(1),Z=null):(Z=Fu(G),Z.c(),Z.m(D,null))),_e&64&&ee(t,"table-loading",G[6]),G[3].length?be?be.p(G,_e):(be=Hu(G),be.c(),be.m(L.parentNode,L)):be&&(be.d(1),be=null),G[3].length&&G[7]?x?x.p(G,_e):(x=ju(G),x.c(),x.m(H.parentNode,H)):x&&(x.d(1),x=null)},i(G){if(!j){A(l.$$.fragment,G),A(a.$$.fragment,G),A(c.$$.fragment,G),A(g.$$.fragment,G),A(y.$$.fragment,G);for(let _e=0;_e{O<=1&&g(),t(6,d=!1),t(3,u=u.concat(F.items)),t(5,f=F.page),t(4,c=F.totalItems),s("load",u)}).catch(F=>{F!=null&&F.isAbort||(t(6,d=!1),console.warn(F),g(),Se.errorResponseHandler(F,!1))})}function g(){t(3,u=[]),t(5,f=1),t(4,c=0)}function v(O){a=O,t(1,a)}function b(O){a=O,t(1,a)}function y(O){a=O,t(1,a)}function C(O){a=O,t(1,a)}function $(O){a=O,t(1,a)}const S=O=>s("select",O),M=(O,F)=>{F.code==="Enter"&&(F.preventDefault(),s("select",O))},D=()=>t(0,o=""),E=()=>m(f+1);return n.$$set=O=>{"filter"in O&&t(0,o=O.filter),"presets"in O&&t(10,r=O.presets),"sort"in O&&t(1,a=O.sort)},n.$$.update=()=>{n.$$.dirty&1027&&(typeof a<"u"||typeof o<"u"||typeof r<"u")&&(g(),m(1)),n.$$.dirty&24&&t(7,i=c>u.length)},[o,a,m,u,c,f,d,i,s,l,r,v,b,y,C,$,S,M,D,E]}class L1 extends Fe{constructor(e){super(),Le(this,e,P1,A1,Pe,{filter:0,presets:10,sort:1,load:2})}get load(){return this.$$.ctx[2]}}/*! - * Chart.js v3.8.0 + `}}function d1(n){let e,t,i,s;return{c(){e=_("input"),h(e,"type","text"),h(e,"id",n[8]),h(e,"placeholder",t=n[0]||n[1])},m(l,o){w(l,e,o),n[13](e),$e(e,n[7]),i||(s=X(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&h(e,"placeholder",t),o&128&&e.value!==l[7]&&$e(e,l[7])},i:oe,o:oe,d(l){l&&k(e),n[13](null),i=!1,s()}}}function h1(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(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 o&&(e=new o(r(n)),he.push(()=>Re(e,"value",l)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=lt()},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],He(()=>t=!1)),o!==(o=a[4])){if(e){De();const c=e;P(c.$$.fragment,1,0,()=>{z(c,1)}),Oe()}o?(e=new o(r(a)),he.push(()=>Re(e,"value",l)),e.$on("submit",a[10]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&A(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&z(e,a)}}}function Eu(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Au();return{c(){r&&r.c(),e=T(),t=_("button"),t.innerHTML='Clear',h(t,"type","button"),h(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(o=X(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&A(r,1):(r=Au(),r.c(),A(r,1),r.m(e.parentNode,e)):r&&(De(),P(r,1,1,()=>{r=null}),Oe())},i(a){s||(A(r),Lt(()=>{i||(i=at(t,Un,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){P(r),i||(i=at(t,Un,{duration:150,x:5},!1)),i.run(0),s=!1},d(a){r&&r.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,o()}}}function Au(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Search',h(e,"type","submit"),h(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Un,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Un,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function p1(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[h1,d1],p=[];function g(b,y){return b[4]&&!b[5]?0:1}o=g(n),r=p[o]=d[o](n);let v=(n[0].length||n[7].length)&&Eu(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=T(),r.c(),a=T(),v&&v.c(),h(s,"class","ri-search-line"),h(i,"for",n[8]),h(i,"class","m-l-10 txt-xl"),h(t,"class","searchbar"),h(e,"class","searchbar-wrapper")},m(b,y){w(b,e,y),m(e,t),m(t,i),m(i,s),m(t,l),p[o].m(t,null),m(t,a),v&&v.m(t,null),u=!0,f||(c=[X(t,"submit",Qt(n[10])),X(e,"click",ni(n[11]))],f=!0)},p(b,[y]){let $=o;o=g(b),o===$?p[o].p(b,y):(De(),P(p[$],1,1,()=>{p[$]=null}),Oe(),r=p[o],r?r.p(b,y):(r=p[o]=d[o](b),r.c()),A(r,1),r.m(t,a)),b[0].length||b[7].length?v?(v.p(b,y),y&129&&A(v,1)):(v=Eu(b),v.c(),A(v,1),v.m(t,null)):v&&(De(),P(v,1,1,()=>{v=null}),Oe())},i(b){u||(A(r),A(v),u=!0)},o(b){P(r),P(v),u=!1},d(b){b&&k(e),p[o].d(),v&&v.d(),f=!1,st(c)}}}function m1(n,e,t){const i=hn(),s="search_"+Y.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new Fn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function p(M=!0){t(7,d=""),M&&(c==null||c.focus()),i("clear")}function g(){t(0,l=d),i("submit",l)}async function v(){u||f||(t(5,f=!0),t(4,u=(await Qi(()=>import("./FilterAutocompleteInput.18e2a4f4.js"),[])).default),t(5,f=!1))}Jn(()=>{v()});function b(M){pt.call(this,n,M)}function y(M){d=M,t(7,d),t(0,l)}function $(M){he[M?"unshift":"push"](()=>{c=M,t(6,c)})}function C(){d=this.value,t(7,d),t(0,l)}const S=()=>{p(!1),g()};return n.$$set=M=>{"value"in M&&t(0,l=M.value),"placeholder"in M&&t(1,o=M.placeholder),"autocompleteCollection"in M&&t(2,r=M.autocompleteCollection),"extraAutocompleteKeys"in M&&t(3,a=M.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,p,g,b,y,$,C,S]}class Vo extends Fe{constructor(e){super(),Le(this,e,m1,p1,Pe,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let Hr,Wi;const jr="app-tooltip";function Pu(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Li(){return Wi=Wi||document.querySelector("."+jr),Wi||(Wi=document.createElement("div"),Wi.classList.add(jr),document.body.appendChild(Wi)),Wi}function dg(n,e){let t=Li();if(!t.classList.contains("active")||!(e!=null&&e.text)){qr();return}t.textContent=e.text,t.className=jr+" 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(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.position=="bottom-left"?(o=l.top+l.height+a,r=l.left):e.position=="bottom-right"?(o=l.top+l.height+a,r=l.right-s):(o=l.top+l.height+a,r=l.left+l.width/2-s/2),r+s>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-s),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function qr(){clearTimeout(Hr),Li().classList.remove("active"),Li().activeNode=void 0}function g1(n,e){Li().activeNode=n,clearTimeout(Hr),Hr=setTimeout(()=>{Li().classList.add("active"),dg(n,e)},isNaN(e.delay)?250:e.delay)}function Et(n,e){let t=Pu(e);function i(){g1(n,t)}function s(){qr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&Y.isFocusable(n))&&n.addEventListener("click",s),Li(),{update(l){var o,r;t=Pu(l),(r=(o=Li())==null?void 0:o.activeNode)!=null&&r.contains(n)&&dg(n,t)},destroy(){var l,o;(o=(l=Li())==null?void 0:l.activeNode)!=null&&o.contains(n)&&qr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function _1(n){let e,t,i,s;return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","btn btn-secondary btn-circle svelte-b7gb6q"),ee(e,"refreshing",n[1])},m(l,o){w(l,e,o),i||(s=[et(t=Et.call(null,e,n[0])),X(e,"click",n[2])],i=!0)},p(l,[o]){t&&Zn(t.update)&&o&1&&t.update.call(null,l[0]),o&2&&ee(e,"refreshing",l[1])},i:oe,o:oe,d(l){l&&k(e),i=!1,st(s)}}}function b1(n,e,t){const i=hn();let{tooltip:s={text:"Refresh",position:"right"}}=e,l=null;function o(){i("refresh");const r=s;t(0,s=null),clearTimeout(l),t(1,l=setTimeout(()=>{t(1,l=null),t(0,s=r)},200))}return Jn(()=>()=>clearTimeout(l)),n.$$set=r=>{"tooltip"in r&&t(0,s=r.tooltip)},[s,l,o]}class zo extends Fe{constructor(e){super(),Le(this,e,b1,_1,Pe,{tooltip:0})}}function v1(n){let e,t,i,s,l;const o=n[6].default,r=On(o,n,n[5],null);return{c(){e=_("th"),r&&r.c(),h(e,"tabindex","0"),h(e,"class",t="col-sort "+n[1]),ee(e,"col-sort-disabled",n[3]),ee(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ee(e,"sort-desc",n[0]==="-"+n[2]),ee(e,"sort-asc",n[0]==="+"+n[2])},m(a,u){w(a,e,u),r&&r.m(e,null),i=!0,s||(l=[X(e,"click",n[7]),X(e,"keydown",n[8])],s=!0)},p(a,[u]){r&&r.p&&(!i||u&32)&&An(r,o,a,a[5],i?En(o,a[5],u,null):Pn(a[5]),null),(!i||u&2&&t!==(t="col-sort "+a[1]))&&h(e,"class",t),u&10&&ee(e,"col-sort-disabled",a[3]),u&7&&ee(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),u&7&&ee(e,"sort-desc",a[0]==="-"+a[2]),u&7&&ee(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(A(r,a),i=!0)},o(a){P(r,a),i=!1},d(a){a&&k(e),r&&r.d(a),s=!1,st(l)}}}function y1(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function u(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}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,o=d.name),"sort"in d&&t(0,r=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,s=d.$$scope)},[r,l,o,a,u,s,i,f,c]}class rn extends Fe{constructor(e){super(),Le(this,e,y1,v1,Pe,{class:1,name:2,sort:0,disable:3})}}function k1(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function w1(n){let e,t=Y.formatToUTCDate(n[0])+"",i,s,l,o,r;return{c(){e=_("span"),i=R(t),s=R(" UTC"),h(e,"class","txt")},m(a,u){w(a,e,u),m(e,i),m(e,s),o||(r=et(l=Et.call(null,e,Y.formatToLocalDate(n[0])+" Local")),o=!0)},p(a,u){u&1&&t!==(t=Y.formatToUTCDate(a[0])+"")&&me(i,t),l&&Zn(l.update)&&u&1&&l.update.call(null,Y.formatToLocalDate(a[0])+" Local")},d(a){a&&k(e),o=!1,r()}}}function S1(n){let e;function t(l,o){return l[0]?w1:k1}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:oe,o:oe,d(l){s.d(l),l&&k(e)}}}function $1(n,e,t){let{date:i=""}=e;return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i]}class wi extends Fe{constructor(e){super(),Le(this,e,$1,S1,Pe,{date:0})}}function Lu(n,e,t){const i=n.slice();return i[21]=e[t],i}function C1(n){let e;return{c(){e=_("div"),e.innerHTML=` + method`,h(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function M1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="url",h(t,"class",Y.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:oe,d(l){l&&k(e)}}}function T1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="referer",h(t,"class",Y.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:oe,d(l){l&&k(e)}}}function D1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="status",h(t,"class",Y.getFieldTypeIcon("number")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:oe,d(l){l&&k(e)}}}function O1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:oe,d(l){l&&k(e)}}}function Fu(n){let e;function t(l,o){return l[6]?A1:E1}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function E1(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Iu(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Iu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function A1(n){let e;return{c(){e=_("tr"),e.innerHTML=` + `},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Iu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',h(e,"type","button"),h(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:oe,d(s){s&&k(e),t=!1,i()}}}function Nu(n){let e;return{c(){e=_("i"),h(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),h(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Ru(n,e){var le,ue,Me;let t,i,s,l=((le=e[21].method)==null?void 0:le.toUpperCase())+"",o,r,a,u,f,c=e[21].url+"",d,p,g,v,b,y,$=(e[21].referer||"N/A")+"",C,S,M,D,E,O=e[21].status+"",F,L,H,j,Q,ie,U,K,W,J,se=(((ue=e[21].meta)==null?void 0:ue.errorMessage)||((Me=e[21].meta)==null?void 0:Me.errorData))&&Nu();j=new wi({props:{date:e[21].created}});function fe(){return e[16](e[21])}function ke(...Z){return e[17](e[21],...Z)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),o=R(l),a=T(),u=_("td"),f=_("span"),d=R(c),g=T(),se&&se.c(),v=T(),b=_("td"),y=_("span"),C=R($),M=T(),D=_("td"),E=_("span"),F=R(O),L=T(),H=_("td"),B(j.$$.fragment),Q=T(),ie=_("td"),ie.innerHTML='',U=T(),h(s,"class",r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),h(i,"class","col-type-text col-field-method min-width"),h(f,"class","txt txt-ellipsis"),h(f,"title",p=e[21].url),h(u,"class","col-type-text col-field-url"),h(y,"class","txt txt-ellipsis"),h(y,"title",S=e[21].referer),ee(y,"txt-hint",!e[21].referer),h(b,"class","col-type-text col-field-referer"),h(E,"class","label"),ee(E,"label-danger",e[21].status>=400),h(D,"class","col-type-number col-field-status"),h(H,"class","col-type-date col-field-created"),h(ie,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(Z,be){w(Z,t,be),m(t,i),m(i,s),m(s,o),m(t,a),m(t,u),m(u,f),m(f,d),m(u,g),se&&se.m(u,null),m(t,v),m(t,b),m(b,y),m(y,C),m(t,M),m(t,D),m(D,E),m(E,F),m(t,L),m(t,H),V(j,H,null),m(t,Q),m(t,ie),m(t,U),K=!0,W||(J=[X(t,"click",fe),X(t,"keydown",ke)],W=!0)},p(Z,be){var G,_e,je;e=Z,(!K||be&8)&&l!==(l=((G=e[21].method)==null?void 0:G.toUpperCase())+"")&&me(o,l),(!K||be&8&&r!==(r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&h(s,"class",r),(!K||be&8)&&c!==(c=e[21].url+"")&&me(d,c),(!K||be&8&&p!==(p=e[21].url))&&h(f,"title",p),((_e=e[21].meta)==null?void 0:_e.errorMessage)||((je=e[21].meta)==null?void 0:je.errorData)?se||(se=Nu(),se.c(),se.m(u,null)):se&&(se.d(1),se=null),(!K||be&8)&&$!==($=(e[21].referer||"N/A")+"")&&me(C,$),(!K||be&8&&S!==(S=e[21].referer))&&h(y,"title",S),be&8&&ee(y,"txt-hint",!e[21].referer),(!K||be&8)&&O!==(O=e[21].status+"")&&me(F,O),be&8&&ee(E,"label-danger",e[21].status>=400);const x={};be&8&&(x.date=e[21].created),j.$set(x)},i(Z){K||(A(j.$$.fragment,Z),K=!0)},o(Z){P(j.$$.fragment,Z),K=!1},d(Z){Z&&k(t),se&&se.d(),z(j),W=!1,st(J)}}}function Hu(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=R("Showing "),s=R(i),l=R(" of "),o=R(n[4]),h(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),m(e,t),m(e,s),m(e,l),m(e,o)},p(r,a){a&8&&i!==(i=r[3].length+"")&&me(s,i),a&16&&me(o,r[4])},d(r){r&&k(e)}}}function ju(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=R("Load more ("),o=R(l),r=R(")"),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-lg btn-secondary btn-expanded"),ee(t,"btn-loading",n[6]),ee(t,"btn-disabled",n[6]),h(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,o),m(i,r),a||(u=X(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&me(o,l),c&64&&ee(t,"btn-loading",f[6]),c&64&&ee(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function P1(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C,S,M,D,E=[],O=new Map,F,L,H,j;function Q(G){n[11](G)}let ie={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[C1]},$$scope:{ctx:n}};n[1]!==void 0&&(ie.sort=n[1]),l=new rn({props:ie}),he.push(()=>Re(l,"sort",Q));function U(G){n[12](G)}let K={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[M1]},$$scope:{ctx:n}};n[1]!==void 0&&(K.sort=n[1]),a=new rn({props:K}),he.push(()=>Re(a,"sort",U));function W(G){n[13](G)}let J={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[T1]},$$scope:{ctx:n}};n[1]!==void 0&&(J.sort=n[1]),c=new rn({props:J}),he.push(()=>Re(c,"sort",W));function se(G){n[14](G)}let fe={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[D1]},$$scope:{ctx:n}};n[1]!==void 0&&(fe.sort=n[1]),g=new rn({props:fe}),he.push(()=>Re(g,"sort",se));function ke(G){n[15](G)}let le={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[O1]},$$scope:{ctx:n}};n[1]!==void 0&&(le.sort=n[1]),y=new rn({props:le}),he.push(()=>Re(y,"sort",ke));let ue=n[3];const Me=G=>G[21].id;for(let G=0;Go=!1)),l.$set(je);const Ne={};_e&16777216&&(Ne.$$scope={dirty:_e,ctx:G}),!u&&_e&2&&(u=!0,Ne.sort=G[1],He(()=>u=!1)),a.$set(Ne);const qe={};_e&16777216&&(qe.$$scope={dirty:_e,ctx:G}),!d&&_e&2&&(d=!0,qe.sort=G[1],He(()=>d=!1)),c.$set(qe);const ae={};_e&16777216&&(ae.$$scope={dirty:_e,ctx:G}),!v&&_e&2&&(v=!0,ae.sort=G[1],He(()=>v=!1)),g.$set(ae);const re={};_e&16777216&&(re.$$scope={dirty:_e,ctx:G}),!$&&_e&2&&($=!0,re.sort=G[1],He(()=>$=!1)),y.$set(re),_e&841&&(ue=G[3],De(),E=dt(E,_e,Me,1,G,ue,O,D,Bt,Ru,null,Lu),Oe(),!ue.length&&Z?Z.p(G,_e):ue.length?Z&&(Z.d(1),Z=null):(Z=Fu(G),Z.c(),Z.m(D,null))),_e&64&&ee(t,"table-loading",G[6]),G[3].length?be?be.p(G,_e):(be=Hu(G),be.c(),be.m(L.parentNode,L)):be&&(be.d(1),be=null),G[3].length&&G[7]?x?x.p(G,_e):(x=ju(G),x.c(),x.m(H.parentNode,H)):x&&(x.d(1),x=null)},i(G){if(!j){A(l.$$.fragment,G),A(a.$$.fragment,G),A(c.$$.fragment,G),A(g.$$.fragment,G),A(y.$$.fragment,G);for(let _e=0;_e{O<=1&&g(),t(6,d=!1),t(3,u=u.concat(F.items)),t(5,f=F.page),t(4,c=F.totalItems),s("load",u)}).catch(F=>{F!=null&&F.isAbort||(t(6,d=!1),console.warn(F),g(),Se.errorResponseHandler(F,!1))})}function g(){t(3,u=[]),t(5,f=1),t(4,c=0)}function v(O){a=O,t(1,a)}function b(O){a=O,t(1,a)}function y(O){a=O,t(1,a)}function $(O){a=O,t(1,a)}function C(O){a=O,t(1,a)}const S=O=>s("select",O),M=(O,F)=>{F.code==="Enter"&&(F.preventDefault(),s("select",O))},D=()=>t(0,o=""),E=()=>p(f+1);return n.$$set=O=>{"filter"in O&&t(0,o=O.filter),"presets"in O&&t(10,r=O.presets),"sort"in O&&t(1,a=O.sort)},n.$$.update=()=>{n.$$.dirty&1027&&(typeof a<"u"||typeof o<"u"||typeof r<"u")&&(g(),p(1)),n.$$.dirty&24&&t(7,i=c>u.length)},[o,a,p,u,c,f,d,i,s,l,r,v,b,y,$,C,S,M,D,E]}class F1 extends Fe{constructor(e){super(),Le(this,e,L1,P1,Pe,{filter:0,presets:10,sort:1,load:2})}get load(){return this.$$.ctx[2]}}/*! + * Chart.js v3.8.2 * https://www.chartjs.org * (c) 2022 Chart.js Contributors * Released under the MIT License - */const dg=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function hg(n,e,t){const i=t||(o=>Array.prototype.slice.call(o));let s=!1,l=[];return function(...o){l=i(o),s||(s=!0,dg.call(window,()=>{s=!1,n.apply(e,l)}))}}function F1(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const I1=n=>n==="start"?"left":n==="end"?"right":"center",qu=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function mi(){}const N1=function(){let n=0;return function(){return n++}}();function Pt(n){return n===null||typeof n>"u"}function zt(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 bt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Xt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Hn(n,e){return Xt(n)?n:e}function yt(n,e){return typeof n>"u"?e:n}const R1=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,pg=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function Zt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function At(n,e,t,i){let s,l,o;if(zt(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=Vu(e,t);return n}function va(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Yn=n=>typeof n<"u",Ni=n=>typeof n=="function",zu=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function z1(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Gt=Math.PI,Vt=2*Gt,B1=Vt+Gt,ko=Number.POSITIVE_INFINITY,U1=Gt/180,Jt=Gt/2,Hs=Gt/4,Bu=Gt*2/3,Vn=Math.log10,ai=Math.sign;function Uu(n){const e=Math.round(n);n=nl(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Vn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function W1(n){const e=[],t=Math.sqrt(n);let i;for(i=1;is-l).pop(),e}function cl(n){return!isNaN(parseFloat(n))&&isFinite(n)}function nl(n,e,t){return Math.abs(n-e)=n}function gg(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 ql=n=>n===0||n===1,Yu=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*Vt/t)),Ku=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*Vt/t)+1,il={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(Gt*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=>ql(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=>ql(n)?n:Yu(n,.075,.3),easeOutElastic:n=>ql(n)?n:Ku(n,.075,.3),easeInOutElastic(n){return ql(n)?n:n<.5?.5*Yu(n*2,.1125,.45):.5+.5*Ku(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-il.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?il.easeInBounce(n*2)*.5:il.easeOutBounce(n*2-1)*.5+.5};/*! + */const hg=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function pg(n,e,t){const i=t||(o=>Array.prototype.slice.call(o));let s=!1,l=[];return function(...o){l=i(o),s||(s=!0,hg.call(window,()=>{s=!1,n.apply(e,l)}))}}function I1(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const N1=n=>n==="start"?"left":n==="end"?"right":"center",qu=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function mi(){}const R1=function(){let n=0;return function(){return n++}}();function Pt(n){return n===null||typeof n>"u"}function zt(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 _t(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Xt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Hn(n,e){return Xt(n)?n:e}function yt(n,e){return typeof n>"u"?e:n}const H1=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,mg=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function Zt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function At(n,e,t,i){let s,l,o;if(zt(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=Vu(e,t);return n}function va(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Yn=n=>typeof n<"u",Ni=n=>typeof n=="function",zu=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function B1(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Gt=Math.PI,It=2*Gt,U1=It+Gt,ko=Number.POSITIVE_INFINITY,W1=Gt/180,Jt=Gt/2,Hs=Gt/4,Bu=Gt*2/3,Vn=Math.log10,ai=Math.sign;function Uu(n){const e=Math.round(n);n=nl(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Vn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function Y1(n){const e=[],t=Math.sqrt(n);let i;for(i=1;is-l).pop(),e}function cl(n){return!isNaN(parseFloat(n))&&isFinite(n)}function nl(n,e,t){return Math.abs(n-e)=n}function _g(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 ql=n=>n===0||n===1,Yu=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*It/t)),Ku=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*It/t)+1,il={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(Gt*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=>ql(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=>ql(n)?n:Yu(n,.075,.3),easeOutElastic:n=>ql(n)?n:Ku(n,.075,.3),easeInOutElastic(n){return ql(n)?n:n<.5?.5*Yu(n*2,.1125,.45):.5+.5*Ku(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-il.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?il.easeInBounce(n*2)*.5:il.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 $l(n){return n+.5|0}const Ai=(n,e,t)=>Math.max(Math.min(n,t),e);function Zs(n){return Ai($l(n*2.55),0,255)}function Fi(n){return Ai($l(n*255),0,255)}function bi(n){return Ai($l(n/2.55)/100,0,1)}function Zu(n){return Ai($l(n*100),0,100)}const Rn={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},zr=[..."0123456789ABCDEF"],J1=n=>zr[n&15],G1=n=>zr[(n&240)>>4]+zr[n&15],Vl=n=>(n&240)>>4===(n&15),X1=n=>Vl(n.r)&&Vl(n.g)&&Vl(n.b)&&Vl(n.a);function Q1(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Rn[n[1]]*17,g:255&Rn[n[2]]*17,b:255&Rn[n[3]]*17,a:e===5?Rn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Rn[n[1]]<<4|Rn[n[2]],g:Rn[n[3]]<<4|Rn[n[4]],b:Rn[n[5]]<<4|Rn[n[6]],a:e===9?Rn[n[7]]<<4|Rn[n[8]]:255})),t}const x1=(n,e)=>n<255?e(n):"";function ev(n){var e=X1(n)?J1:G1;return n?"#"+e(n.r)+e(n.g)+e(n.b)+x1(n.a,e):void 0}const tv=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function bg(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function nv(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 iv(n,e,t){const i=bg(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 sv(n,e,t,i,s){return n===s?(e-t)/i+(e.5?f/(2-l-o):f/(l+o),a=sv(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function wa(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Fi)}function Sa(n,e,t){return wa(bg,n,e,t)}function lv(n,e,t){return wa(iv,n,e,t)}function ov(n,e,t){return wa(nv,n,e,t)}function vg(n){return(n%360+360)%360}function rv(n){const e=tv.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Zs(+e[5]):Fi(+e[5]));const s=vg(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=lv(s,l,o):e[1]==="hsv"?i=ov(s,l,o):i=Sa(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function av(n,e){var t=ka(n);t[0]=vg(t[0]+e),t=Sa(t),n.r=t[0],n.g=t[1],n.b=t[2]}function uv(n){if(!n)return;const e=ka(n),t=e[0],i=Zu(e[1]),s=Zu(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${bi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Ju={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"},Gu={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 fv(){const n={},e=Object.keys(Gu),t=Object.keys(Ju);let i,s,l,o,r;for(i=0;i>16&255,l>>8&255,l&255]}return n}let zl;function cv(n){zl||(zl=fv(),zl.transparent=[0,0,0,0]);const e=zl[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const dv=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function hv(n){const e=dv.exec(n);let t=255,i,s,l;if(!!e){if(e[7]!==i){const o=+e[7];t=e[8]?Zs(o):Ai(o*255,0,255)}return i=+e[1],s=+e[3],l=+e[5],i=255&(e[2]?Zs(i):Ai(i,0,255)),s=255&(e[4]?Zs(s):Ai(s,0,255)),l=255&(e[6]?Zs(l):Ai(l,0,255)),{r:i,g:s,b:l,a:t}}}function pv(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${bi(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const lr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ps=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function mv(n,e,t){const i=ps(bi(n.r)),s=ps(bi(n.g)),l=ps(bi(n.b));return{r:Fi(lr(i+t*(ps(bi(e.r))-i))),g:Fi(lr(s+t*(ps(bi(e.g))-s))),b:Fi(lr(l+t*(ps(bi(e.b))-l))),a:n.a+t*(e.a-n.a)}}function Bl(n,e,t){if(n){let i=ka(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Sa(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function yg(n,e){return n&&Object.assign(e||{},n)}function Xu(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=Fi(n[3]))):(e=yg(n,{r:0,g:0,b:0,a:1}),e.a=Fi(e.a)),e}function gv(n){return n.charAt(0)==="r"?hv(n):rv(n)}class wo{constructor(e){if(e instanceof wo)return e;const t=typeof e;let i;t==="object"?i=Xu(e):t==="string"&&(i=Q1(e)||cv(e)||gv(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=yg(this._rgb);return e&&(e.a=bi(e.a)),e}set rgb(e){this._rgb=Xu(e)}rgbString(){return this._valid?pv(this._rgb):void 0}hexString(){return this._valid?ev(this._rgb):void 0}hslString(){return this._valid?uv(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let l;const o=t===l?.5:t,r=2*o-1,a=i.a-s.a,u=((r*a===-1?r:(r+a)/(1+r*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=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=mv(this._rgb,e._rgb,t)),this}clone(){return new wo(this.rgb)}alpha(e){return this._rgb.a=Fi(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=$l(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 Bl(this._rgb,2,e),this}darken(e){return Bl(this._rgb,2,-e),this}saturate(e){return Bl(this._rgb,1,e),this}desaturate(e){return Bl(this._rgb,1,-e),this}rotate(e){return av(this._rgb,e),this}}function kg(n){return new wo(n)}function wg(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Qu(n){return wg(n)?n:kg(n)}function or(n){return wg(n)?n:kg(n).saturate(.5).darken(.1).hexString()}const ls=Object.create(null),Br=Object.create(null);function sl(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)=>or(i.backgroundColor),this.hoverBorderColor=(t,i)=>or(i.borderColor),this.hoverColor=(t,i)=>or(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 rr(this,e,t)}get(e){return sl(this,e)}describe(e,t){return rr(Br,e,t)}override(e,t){return rr(ls,e,t)}route(e,t,i,s){const l=sl(this,e),o=sl(this,i),r="_"+t;Object.defineProperties(l,{[r]:{value:l[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[r],u=o[s];return bt(a)?Object.assign({},u,a):yt(a,u)},set(a){this[r]=a}}})}}var kt=new _v({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function bv(n){return!n||Pt(n.size)||Pt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function So(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 vv(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 o=0;const r=t.length;let a,u,f,c,d;for(a=0;at.length){for(a=0;a0&&n.stroke()}}function pl(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,wv(n,l),a=0;a+n||0;function Ma(n,e){const t={},i=bt(e),s=i?Object.keys(e):e,l=bt(n)?i?o=>yt(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of s)t[o]=Tv(l(o));return t}function Sg(n){return Ma(n,{top:"y",right:"x",bottom:"y",left:"x"})}function vs(n){return Ma(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Kn(n){const e=Sg(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Dn(n,e){n=n||{},e=e||kt.font;let t=yt(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=yt(n.style,e.style);i&&!(""+i).match(Cv)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:yt(n.family,e.family),lineHeight:Mv(yt(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:yt(n.weight,e.weight),string:""};return s.string=bv(s),s}function Ul(n,e,t,i){let s=!0,l,o,r;for(l=0,o=n.length;lt&&r===0?0:r+a;return{min:o(i,-Math.abs(l)),max:o(s,l)}}function Hi(n,e){return Object.assign(Object.create(n),e)}function Ta(n,e,t){t=t||(o=>n[o]1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const es=(n,e,t)=>Ta(n,t,i=>n[i][e]Ta(n,t,i=>n[i][e]>=t);function Ev(n,e,t){let i=0,s=n.length;for(;ii&&n[s-1]>t;)s--;return i>0||s{const i="_onData"+va(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const o=s.apply(this,l);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...l)}),o}})})}function ef(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)&&($g.forEach(l=>{delete n[l]}),delete n._chartjs)}function Cg(n){const e=new Set;let t,i;for(t=0,i=n.length;tn[0]){Yn(i)||(i=Og("_fallback",n));const l={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:t,_fallback:i,_getTarget:s,override:o=>Da([o,...n],e,t,i)};return new Proxy(l,{deleteProperty(o,r){return delete o[r],delete o._keys,delete n[0][r],!0},get(o,r){return Tg(o,r,()=>jv(r,e,n,o))},getOwnPropertyDescriptor(o,r){return Reflect.getOwnPropertyDescriptor(o._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,r){return nf(o).includes(r)},ownKeys(o){return nf(o)},set(o,r,a){const u=o._storage||(o._storage=s());return o[r]=u[r]=a,delete o._keys,!0}})}function $s(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:Mg(n,i),setContext:l=>$s(n,l,t,i),override:l=>$s(n.override(l),e,t,i)};return new Proxy(s,{deleteProperty(l,o){return delete l[o],delete n[o],!0},get(l,o,r){return Tg(l,o,()=>Lv(l,o,r))},getOwnPropertyDescriptor(l,o){return l._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(l,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(l,o,r){return n[o]=r,delete l[o],!0}})}function Mg(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:Ni(t)?t:()=>t,isIndexable:Ni(i)?i:()=>i}}const Pv=(n,e)=>n?n+va(e):e,Oa=(n,e)=>bt(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Tg(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function Lv(n,e,t){const{_proxy:i,_context:s,_subProxy:l,_descriptors:o}=n;let r=i[e];return Ni(r)&&o.isScriptable(e)&&(r=Fv(e,r,n,t)),zt(r)&&r.length&&(r=Iv(e,r,n,o.isIndexable)),Oa(e,r)&&(r=$s(r,s,l&&l[e],o)),r}function Fv(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_stack:r}=t;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);return r.add(n),e=e(l,o||i),r.delete(n),Oa(n,e)&&(e=Ea(s._scopes,s,n,e)),e}function Iv(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_descriptors:r}=t;if(Yn(l.index)&&i(n))e=e[l.index%e.length];else if(bt(e[0])){const a=e,u=s._scopes.filter(f=>f!==a);e=[];for(const f of a){const c=Ea(u,s,n,f);e.push($s(c,l,o&&o[n],r))}}return e}function Dg(n,e,t){return Ni(n)?n(e,t):n}const Nv=(n,e)=>n===!0?e:typeof n=="string"?Ii(e,n):void 0;function Rv(n,e,t,i,s){for(const l of e){const o=Nv(t,l);if(o){n.add(o);const r=Dg(o._fallback,t,s);if(Yn(r)&&r!==t&&r!==i)return r}else if(o===!1&&Yn(i)&&t!==i)return null}return!1}function Ea(n,e,t,i){const s=e._rootScopes,l=Dg(e._fallback,t,i),o=[...n,...s],r=new Set;r.add(i);let a=tf(r,o,t,l||t,i);return a===null||Yn(l)&&l!==t&&(a=tf(r,o,l,a,i),a===null)?!1:Da(Array.from(r),[""],s,l,()=>Hv(e,t,i))}function tf(n,e,t,i,s){for(;t;)t=Rv(n,e,t,i,s);return t}function Hv(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return zt(s)&&bt(t)?t:s}function jv(n,e,t,i){let s;for(const l of e)if(s=Og(Pv(l,n),t),Yn(s))return Oa(n,s)?Ea(t,i,n,s):s}function Og(n,e){for(const t of e){if(!t)continue;const i=t[n];if(Yn(i))return i}}function nf(n){let e=n._keys;return e||(e=n._keys=qv(n._scopes)),e}function qv(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 Eg(n,e,t,i){const{iScale:s}=n,{key:l="r"}=this._parsing,o=new Array(i);let r,a,u,f;for(r=0,a=i;ren==="x"?"y":"x";function zv(n,e,t,i){const s=n.skip?e:n,l=e,o=t.skip?e:t,r=Vr(l,s),a=Vr(o,l);let u=r/(r+a),f=a/(r+a);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const c=i*u,d=i*f;return{previous:{x:l.x-c*(o.x-s.x),y:l.y-c*(o.y-s.y)},next:{x:l.x+d*(o.x-s.x),y:l.y+d*(o.y-s.y)}}}function Bv(n,e,t){const i=n.length;let s,l,o,r,a,u=Cs(n,0);for(let f=0;f!u.skip)),e.cubicInterpolationMode==="monotone")Wv(n,s);else{let u=i?n[n.length-1]:n[0];for(l=0,o=n.length;lwindow.getComputedStyle(n,null);function Zv(n,e){return Bo(n).getPropertyValue(e)}const Jv=["top","right","bottom","left"];function is(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const l=Jv[s];i[l]=parseFloat(n[e+"-"+l+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Gv=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function Xv(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:l}=i;let o=!1,r,a;if(Gv(s,l,n.target))r=s,a=l;else{const u=e.getBoundingClientRect();r=i.clientX-u.left,a=i.clientY-u.top,o=!0}return{x:r,y:a,box:o}}function Gi(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=Bo(t),l=s.boxSizing==="border-box",o=is(s,"padding"),r=is(s,"border","width"),{x:a,y:u,box:f}=Xv(n,t),c=o.left+(f&&r.left),d=o.top+(f&&r.top);let{width:m,height:g}=e;return l&&(m-=o.width+r.width,g-=o.height+r.height),{x:Math.round((a-c)/m*t.width/i),y:Math.round((u-d)/g*t.height/i)}}function Qv(n,e,t){let i,s;if(e===void 0||t===void 0){const l=Aa(n);if(!l)e=n.clientWidth,t=n.clientHeight;else{const o=l.getBoundingClientRect(),r=Bo(l),a=is(r,"border","width"),u=is(r,"padding");e=o.width-u.width-a.width,t=o.height-u.height-a.height,i=Mo(r.maxWidth,l,"clientWidth"),s=Mo(r.maxHeight,l,"clientHeight")}}return{width:e,height:t,maxWidth:i||ko,maxHeight:s||ko}}const ar=n=>Math.round(n*10)/10;function xv(n,e,t,i){const s=Bo(n),l=is(s,"margin"),o=Mo(s.maxWidth,n,"clientWidth")||ko,r=Mo(s.maxHeight,n,"clientHeight")||ko,a=Qv(n,e,t);let{width:u,height:f}=a;if(s.boxSizing==="content-box"){const c=is(s,"border","width"),d=is(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=ar(Math.min(u,o,a.maxWidth)),f=ar(Math.min(f,r,a.maxHeight)),u&&!f&&(f=ar(u/2)),{width:u,height:f}}function sf(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 o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==l?(n.currentDevicePixelRatio=i,o.height=s,o.width=l,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const ey=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 lf(n,e){const t=Zv(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Xi(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function ty(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 ny(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},l={x:e.cp1x,y:e.cp1y},o=Xi(n,s,t),r=Xi(s,l,t),a=Xi(l,e,t),u=Xi(o,r,t),f=Xi(r,a,t);return Xi(u,f,t)}const of=new Map;function iy(n,e){e=e||{};const t=n+JSON.stringify(e);let i=of.get(t);return i||(i=new Intl.NumberFormat(n,e),of.set(t,i)),i}function Cl(n,e,t){return iy(e,t).format(n)}const sy=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}}},ly=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function ur(n,e,t){return n?sy(e,t):ly()}function oy(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 ry(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function Lg(n){return n==="angle"?{between:dl,compare:K1,normalize:Mn}:{between:hl,compare:(e,t)=>e-t,normalize:e=>e}}function rf({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 ay(n,e,t){const{property:i,start:s,end:l}=t,{between:o,normalize:r}=Lg(i),a=e.length;let{start:u,end:f,loop:c}=n,d,m;if(c){for(u+=a,f+=a,d=0,m=a;da(s,$,y)&&r(s,$)!==0,M=()=>r(l,y)===0||a(l,$,y),D=()=>v||S(),E=()=>!v||M();for(let O=f,F=f;O<=c;++O)C=e[O%o],!C.skip&&(y=u(C[i]),y!==$&&(v=a(y,s,l),b===null&&D()&&(b=r(y,s)===0?O:F),b!==null&&E()&&(g.push(rf({start:b,end:O,loop:d,count:o,style:m})),b=null),F=O,$=y));return b!==null&&g.push(rf({start:b,end:c,loop:d,count:o,style:m})),g}function Ig(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 fy(n,e,t,i){const s=n.length,l=[];let o=e,r=n[e],a;for(a=e+1;a<=t;++a){const u=n[a%s];u.skip||u.stop?r.skip||(i=!1,l.push({start:e%s,end:(a-1)%s,loop:i}),e=o=u.stop?a:null):(o=a,r.skip&&(e=a)),r=u}return o!==null&&l.push({start:e%s,end:o%s,loop:i}),l}function cy(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const l=!!n._loop,{start:o,end:r}=uy(t,s,l,i);if(i===!0)return af(n,[{start:o,end:r,loop:l}],t,e);const a=rMath.max(Math.min(n,t),e);function Zs(n){return Ai($l(n*2.55),0,255)}function Fi(n){return Ai($l(n*255),0,255)}function bi(n){return Ai($l(n/2.55)/100,0,1)}function Zu(n){return Ai($l(n*100),0,100)}const Rn={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},zr=[..."0123456789ABCDEF"],G1=n=>zr[n&15],X1=n=>zr[(n&240)>>4]+zr[n&15],Vl=n=>(n&240)>>4===(n&15),Q1=n=>Vl(n.r)&&Vl(n.g)&&Vl(n.b)&&Vl(n.a);function x1(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Rn[n[1]]*17,g:255&Rn[n[2]]*17,b:255&Rn[n[3]]*17,a:e===5?Rn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Rn[n[1]]<<4|Rn[n[2]],g:Rn[n[3]]<<4|Rn[n[4]],b:Rn[n[5]]<<4|Rn[n[6]],a:e===9?Rn[n[7]]<<4|Rn[n[8]]:255})),t}const ev=(n,e)=>n<255?e(n):"";function tv(n){var e=Q1(n)?G1:X1;return n?"#"+e(n.r)+e(n.g)+e(n.b)+ev(n.a,e):void 0}const nv=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function vg(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function iv(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 sv(n,e,t){const i=vg(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 lv(n,e,t,i,s){return n===s?(e-t)/i+(e.5?f/(2-l-o):f/(l+o),a=lv(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function wa(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Fi)}function Sa(n,e,t){return wa(vg,n,e,t)}function ov(n,e,t){return wa(sv,n,e,t)}function rv(n,e,t){return wa(iv,n,e,t)}function yg(n){return(n%360+360)%360}function av(n){const e=nv.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Zs(+e[5]):Fi(+e[5]));const s=yg(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=ov(s,l,o):e[1]==="hsv"?i=rv(s,l,o):i=Sa(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function uv(n,e){var t=ka(n);t[0]=yg(t[0]+e),t=Sa(t),n.r=t[0],n.g=t[1],n.b=t[2]}function fv(n){if(!n)return;const e=ka(n),t=e[0],i=Zu(e[1]),s=Zu(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${bi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Ju={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"},Gu={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 cv(){const n={},e=Object.keys(Gu),t=Object.keys(Ju);let i,s,l,o,r;for(i=0;i>16&255,l>>8&255,l&255]}return n}let zl;function dv(n){zl||(zl=cv(),zl.transparent=[0,0,0,0]);const e=zl[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const hv=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function pv(n){const e=hv.exec(n);let t=255,i,s,l;if(!!e){if(e[7]!==i){const o=+e[7];t=e[8]?Zs(o):Ai(o*255,0,255)}return i=+e[1],s=+e[3],l=+e[5],i=255&(e[2]?Zs(i):Ai(i,0,255)),s=255&(e[4]?Zs(s):Ai(s,0,255)),l=255&(e[6]?Zs(l):Ai(l,0,255)),{r:i,g:s,b:l,a:t}}}function mv(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${bi(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const lr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ps=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function gv(n,e,t){const i=ps(bi(n.r)),s=ps(bi(n.g)),l=ps(bi(n.b));return{r:Fi(lr(i+t*(ps(bi(e.r))-i))),g:Fi(lr(s+t*(ps(bi(e.g))-s))),b:Fi(lr(l+t*(ps(bi(e.b))-l))),a:n.a+t*(e.a-n.a)}}function Bl(n,e,t){if(n){let i=ka(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Sa(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function kg(n,e){return n&&Object.assign(e||{},n)}function Xu(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=Fi(n[3]))):(e=kg(n,{r:0,g:0,b:0,a:1}),e.a=Fi(e.a)),e}function _v(n){return n.charAt(0)==="r"?pv(n):av(n)}class wo{constructor(e){if(e instanceof wo)return e;const t=typeof e;let i;t==="object"?i=Xu(e):t==="string"&&(i=x1(e)||dv(e)||_v(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=kg(this._rgb);return e&&(e.a=bi(e.a)),e}set rgb(e){this._rgb=Xu(e)}rgbString(){return this._valid?mv(this._rgb):void 0}hexString(){return this._valid?tv(this._rgb):void 0}hslString(){return this._valid?fv(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let l;const o=t===l?.5:t,r=2*o-1,a=i.a-s.a,u=((r*a===-1?r:(r+a)/(1+r*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=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=gv(this._rgb,e._rgb,t)),this}clone(){return new wo(this.rgb)}alpha(e){return this._rgb.a=Fi(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=$l(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 Bl(this._rgb,2,e),this}darken(e){return Bl(this._rgb,2,-e),this}saturate(e){return Bl(this._rgb,1,e),this}desaturate(e){return Bl(this._rgb,1,-e),this}rotate(e){return uv(this._rgb,e),this}}function wg(n){return new wo(n)}function Sg(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Qu(n){return Sg(n)?n:wg(n)}function or(n){return Sg(n)?n:wg(n).saturate(.5).darken(.1).hexString()}const ls=Object.create(null),Br=Object.create(null);function sl(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)=>or(i.backgroundColor),this.hoverBorderColor=(t,i)=>or(i.borderColor),this.hoverColor=(t,i)=>or(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 rr(this,e,t)}get(e){return sl(this,e)}describe(e,t){return rr(Br,e,t)}override(e,t){return rr(ls,e,t)}route(e,t,i,s){const l=sl(this,e),o=sl(this,i),r="_"+t;Object.defineProperties(l,{[r]:{value:l[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[r],u=o[s];return _t(a)?Object.assign({},u,a):yt(a,u)},set(a){this[r]=a}}})}}var kt=new bv({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function vv(n){return!n||Pt(n.size)||Pt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function So(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 yv(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 o=0;const r=t.length;let a,u,f,c,d;for(a=0;at.length){for(a=0;a0&&n.stroke()}}function pl(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,$v(n,l),a=0;a+n||0;function Ma(n,e){const t={},i=_t(e),s=i?Object.keys(e):e,l=_t(n)?i?o=>yt(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of s)t[o]=Ov(l(o));return t}function $g(n){return Ma(n,{top:"y",right:"x",bottom:"y",left:"x"})}function vs(n){return Ma(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Kn(n){const e=$g(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Dn(n,e){n=n||{},e=e||kt.font;let t=yt(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=yt(n.style,e.style);i&&!(""+i).match(Tv)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:yt(n.family,e.family),lineHeight:Dv(yt(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:yt(n.weight,e.weight),string:""};return s.string=vv(s),s}function Ul(n,e,t,i){let s=!0,l,o,r;for(l=0,o=n.length;lt&&r===0?0:r+a;return{min:o(i,-Math.abs(l)),max:o(s,l)}}function Hi(n,e){return Object.assign(Object.create(n),e)}function Ta(n,e,t){t=t||(o=>n[o]1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const es=(n,e,t)=>Ta(n,t,i=>n[i][e]Ta(n,t,i=>n[i][e]>=t);function Pv(n,e,t){let i=0,s=n.length;for(;ii&&n[s-1]>t;)s--;return i>0||s{const i="_onData"+va(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const o=s.apply(this,l);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...l)}),o}})})}function ef(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)&&(Cg.forEach(l=>{delete n[l]}),delete n._chartjs)}function Mg(n){const e=new Set;let t,i;for(t=0,i=n.length;tn[0]){Yn(i)||(i=Eg("_fallback",n));const l={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:t,_fallback:i,_getTarget:s,override:o=>Da([o,...n],e,t,i)};return new Proxy(l,{deleteProperty(o,r){return delete o[r],delete o._keys,delete n[0][r],!0},get(o,r){return Dg(o,r,()=>Vv(r,e,n,o))},getOwnPropertyDescriptor(o,r){return Reflect.getOwnPropertyDescriptor(o._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,r){return nf(o).includes(r)},ownKeys(o){return nf(o)},set(o,r,a){const u=o._storage||(o._storage=s());return o[r]=u[r]=a,delete o._keys,!0}})}function $s(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:Tg(n,i),setContext:l=>$s(n,l,t,i),override:l=>$s(n.override(l),e,t,i)};return new Proxy(s,{deleteProperty(l,o){return delete l[o],delete n[o],!0},get(l,o,r){return Dg(l,o,()=>Iv(l,o,r))},getOwnPropertyDescriptor(l,o){return l._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(l,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(l,o,r){return n[o]=r,delete l[o],!0}})}function Tg(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:Ni(t)?t:()=>t,isIndexable:Ni(i)?i:()=>i}}const Fv=(n,e)=>n?n+va(e):e,Oa=(n,e)=>_t(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Dg(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function Iv(n,e,t){const{_proxy:i,_context:s,_subProxy:l,_descriptors:o}=n;let r=i[e];return Ni(r)&&o.isScriptable(e)&&(r=Nv(e,r,n,t)),zt(r)&&r.length&&(r=Rv(e,r,n,o.isIndexable)),Oa(e,r)&&(r=$s(r,s,l&&l[e],o)),r}function Nv(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_stack:r}=t;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);return r.add(n),e=e(l,o||i),r.delete(n),Oa(n,e)&&(e=Ea(s._scopes,s,n,e)),e}function Rv(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_descriptors:r}=t;if(Yn(l.index)&&i(n))e=e[l.index%e.length];else if(_t(e[0])){const a=e,u=s._scopes.filter(f=>f!==a);e=[];for(const f of a){const c=Ea(u,s,n,f);e.push($s(c,l,o&&o[n],r))}}return e}function Og(n,e,t){return Ni(n)?n(e,t):n}const Hv=(n,e)=>n===!0?e:typeof n=="string"?Ii(e,n):void 0;function jv(n,e,t,i,s){for(const l of e){const o=Hv(t,l);if(o){n.add(o);const r=Og(o._fallback,t,s);if(Yn(r)&&r!==t&&r!==i)return r}else if(o===!1&&Yn(i)&&t!==i)return null}return!1}function Ea(n,e,t,i){const s=e._rootScopes,l=Og(e._fallback,t,i),o=[...n,...s],r=new Set;r.add(i);let a=tf(r,o,t,l||t,i);return a===null||Yn(l)&&l!==t&&(a=tf(r,o,l,a,i),a===null)?!1:Da(Array.from(r),[""],s,l,()=>qv(e,t,i))}function tf(n,e,t,i,s){for(;t;)t=jv(n,e,t,i,s);return t}function qv(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return zt(s)&&_t(t)?t:s}function Vv(n,e,t,i){let s;for(const l of e)if(s=Eg(Fv(l,n),t),Yn(s))return Oa(n,s)?Ea(t,i,n,s):s}function Eg(n,e){for(const t of e){if(!t)continue;const i=t[n];if(Yn(i))return i}}function nf(n){let e=n._keys;return e||(e=n._keys=zv(n._scopes)),e}function zv(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 Ag(n,e,t,i){const{iScale:s}=n,{key:l="r"}=this._parsing,o=new Array(i);let r,a,u,f;for(r=0,a=i;ren==="x"?"y":"x";function Uv(n,e,t,i){const s=n.skip?e:n,l=e,o=t.skip?e:t,r=Vr(l,s),a=Vr(o,l);let u=r/(r+a),f=a/(r+a);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const c=i*u,d=i*f;return{previous:{x:l.x-c*(o.x-s.x),y:l.y-c*(o.y-s.y)},next:{x:l.x+d*(o.x-s.x),y:l.y+d*(o.y-s.y)}}}function Wv(n,e,t){const i=n.length;let s,l,o,r,a,u=Cs(n,0);for(let f=0;f!u.skip)),e.cubicInterpolationMode==="monotone")Kv(n,s);else{let u=i?n[n.length-1]:n[0];for(l=0,o=n.length;lwindow.getComputedStyle(n,null);function Gv(n,e){return Bo(n).getPropertyValue(e)}const Xv=["top","right","bottom","left"];function is(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const l=Xv[s];i[l]=parseFloat(n[e+"-"+l+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Qv=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function xv(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:l}=i;let o=!1,r,a;if(Qv(s,l,n.target))r=s,a=l;else{const u=e.getBoundingClientRect();r=i.clientX-u.left,a=i.clientY-u.top,o=!0}return{x:r,y:a,box:o}}function Gi(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=Bo(t),l=s.boxSizing==="border-box",o=is(s,"padding"),r=is(s,"border","width"),{x:a,y:u,box:f}=xv(n,t),c=o.left+(f&&r.left),d=o.top+(f&&r.top);let{width:p,height:g}=e;return l&&(p-=o.width+r.width,g-=o.height+r.height),{x:Math.round((a-c)/p*t.width/i),y:Math.round((u-d)/g*t.height/i)}}function ey(n,e,t){let i,s;if(e===void 0||t===void 0){const l=Aa(n);if(!l)e=n.clientWidth,t=n.clientHeight;else{const o=l.getBoundingClientRect(),r=Bo(l),a=is(r,"border","width"),u=is(r,"padding");e=o.width-u.width-a.width,t=o.height-u.height-a.height,i=Mo(r.maxWidth,l,"clientWidth"),s=Mo(r.maxHeight,l,"clientHeight")}}return{width:e,height:t,maxWidth:i||ko,maxHeight:s||ko}}const ar=n=>Math.round(n*10)/10;function ty(n,e,t,i){const s=Bo(n),l=is(s,"margin"),o=Mo(s.maxWidth,n,"clientWidth")||ko,r=Mo(s.maxHeight,n,"clientHeight")||ko,a=ey(n,e,t);let{width:u,height:f}=a;if(s.boxSizing==="content-box"){const c=is(s,"border","width"),d=is(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=ar(Math.min(u,o,a.maxWidth)),f=ar(Math.min(f,r,a.maxHeight)),u&&!f&&(f=ar(u/2)),{width:u,height:f}}function sf(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 o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==l?(n.currentDevicePixelRatio=i,o.height=s,o.width=l,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const ny=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 lf(n,e){const t=Gv(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Xi(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function iy(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 sy(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},l={x:e.cp1x,y:e.cp1y},o=Xi(n,s,t),r=Xi(s,l,t),a=Xi(l,e,t),u=Xi(o,r,t),f=Xi(r,a,t);return Xi(u,f,t)}const of=new Map;function ly(n,e){e=e||{};const t=n+JSON.stringify(e);let i=of.get(t);return i||(i=new Intl.NumberFormat(n,e),of.set(t,i)),i}function Cl(n,e,t){return ly(e,t).format(n)}const oy=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}}},ry=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function ur(n,e,t){return n?oy(e,t):ry()}function ay(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 uy(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function Fg(n){return n==="angle"?{between:dl,compare:Z1,normalize:Mn}:{between:hl,compare:(e,t)=>e-t,normalize:e=>e}}function rf({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 fy(n,e,t){const{property:i,start:s,end:l}=t,{between:o,normalize:r}=Fg(i),a=e.length;let{start:u,end:f,loop:c}=n,d,p;if(c){for(u+=a,f+=a,d=0,p=a;da(s,C,y)&&r(s,C)!==0,M=()=>r(l,y)===0||a(l,C,y),D=()=>v||S(),E=()=>!v||M();for(let O=f,F=f;O<=c;++O)$=e[O%o],!$.skip&&(y=u($[i]),y!==C&&(v=a(y,s,l),b===null&&D()&&(b=r(y,s)===0?O:F),b!==null&&E()&&(g.push(rf({start:b,end:O,loop:d,count:o,style:p})),b=null),F=O,C=y));return b!==null&&g.push(rf({start:b,end:c,loop:d,count:o,style:p})),g}function Ng(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 dy(n,e,t,i){const s=n.length,l=[];let o=e,r=n[e],a;for(a=e+1;a<=t;++a){const u=n[a%s];u.skip||u.stop?r.skip||(i=!1,l.push({start:e%s,end:(a-1)%s,loop:i}),e=o=u.stop?a:null):(o=a,r.skip&&(e=a)),r=u}return o!==null&&l.push({start:e%s,end:o%s,loop:i}),l}function hy(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const l=!!n._loop,{start:o,end:r}=cy(t,s,l,i);if(i===!0)return af(n,[{start:o,end:r,loop:l}],t,e);const a=rr({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=dg.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 o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(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 py;const ff="transparent",my={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Qu(n||ff),s=i.valid&&Qu(e||ff);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class gy{constructor(e,t,i,s){const l=t[i];s=Ul([e.to,s,l,e.from]);const o=Ul([e.from,l,s]);this._active=!0,this._fn=e.fn||my[e.type||typeof o],this._easing=il[e.easing]||il.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=o,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,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ul([e.to,t,s,e.from]),this._from=Ul([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,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,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"});kt.set("animations",{colors:{type:"color",properties:by},numbers:{type:"number",properties:_y}});kt.describe("animations",{_fallback:"animation"});kt.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 Ng{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!bt(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!bt(s))return;const l={};for(const o of vy)l[o]=s[o];(zt(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=ky(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&yy(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[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,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new gy(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 yy(n,e){const t=[],i=Object.keys(e);for(let s=0;s0||!t&&l<0)return s.index}return null}function mf(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:l,vScale:o,index:r}=i,a=l.axis,u=o.axis,f=Cy(l,o,i),c=e.length;let d;for(let m=0;mt[i].axis===e).shift()}function Dy(n,e){return Hi(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Oy(n,e,t){return Hi(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function js(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 cr=n=>n==="reset"||n==="none",gf=(n,e)=>e?n:Object.assign({},n),Ey=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:Rg(t,!0),values:null};class pi{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=hf(e.vScale,e),this.addElements()}updateIndex(e){this.index!==e&&js(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(c,d,m,g)=>c==="x"?d:c==="r"?g:m,l=t.xAxisID=yt(i.xAxisID,fr(e,"x")),o=t.yAxisID=yt(i.yAxisID,fr(e,"y")),r=t.rAxisID=yt(i.rAxisID,fr(e,"r")),a=t.indexAxis,u=t.iAxisID=s(a,l,o,r),f=t.vAxisID=s(a,o,l,r);t.xScale=this.getScaleForId(l),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(r),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&&ef(this._data,this),e._stacked&&js(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(bt(t))this._data=$y(t);else if(i!==t){if(i){ef(i,this);const s=this._cachedMeta;js(s),s._parsed=[]}t&&Object.isExtensible(t)&&Av(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=hf(t.vScale,t),t.stack!==i.stack&&(s=!0,js(t),t.stack=i.stack),this._resyncElements(e),(s||l!==t._stacked)&&mf(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:o}=i,r=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{zt(s[e])?d=this.parseArrayData(i,s,e,t):bt(s[e])?d=this.parseObjectData(i,s,e,t):d=this.parsePrimitiveData(i,s,e,t);const m=()=>c[r]===null||u&&c[r]v||c=0;--d)if(!g()){this.updateRangeFromParsed(u,e,m,a);break}}return u}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,l,o;for(s=0,l=t.length;s=0&&ethis.getContext(i,s),v=u.resolveNamedOptions(d,m,g,c);return v.$shared&&(v.$shared=a,l[o]=Object.freeze(gf(v,a))),v}_resolveAnimations(e,t,i){const s=this.chart,l=this._cachedDataOpts,o=`animation-${t}`,r=l[o];if(r)return r;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 Ng(s,a&&a.animations);return a&&a._cacheable&&(l[o]=Object.freeze(u)),u}getSharedOptions(e){if(!!e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||cr(e)||this.chart._animationsDisabled}updateElement(e,t,i,s){cr(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!cr(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[r,a,u]of this._syncList)this[r](a,u);this._syncList=[];const s=i.length,l=t.length,o=Math.min(l,s);o&&this.parse(0,o),l>s?this._insertElements(s,l-s,e):l{for(u.length+=t,r=u.length-1;r>=o;r--)u[r]=u[r-t]};for(a(l),r=e;rs-l))}return n._cache.$bar}function Py(n){const e=n.iScale,t=Ay(e,n.type);let i=e._length,s,l,o,r;const a=()=>{o===32767||o===-32768||(Yn(r)&&(i=Math.min(i,Math.abs(o-r)||i)),r=o)};for(s=0,l=t.length;s0?s[n-1]:null,r=nMath.abs(r)&&(a=r,u=o),e[t.axis]=u,e._custom={barStart:a,barEnd:u,start:s,end:l,min:o,max:r}}function Hg(n,e,t,i){return zt(n)?Iy(n,e,t,i):e[t.axis]=t.parse(n,i),e}function _f(n,e,t,i){const s=n.iScale,l=n.vScale,o=s.getLabels(),r=s===l,a=[];let u,f,c,d;for(u=t,f=t+i;u=t?1:-1)}function Ry(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),o=i.getLabelForValue(l.x),r=s.getLabelForValue(l.y),a=l._custom;return{label:t.label,value:"("+o+", "+r+(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:o,vScale:r}=this._cachedMeta,a=this.resolveDataElementOptions(t,s),u=this.getSharedOptions(a),f=this.includeOptions(s,u),c=o.axis,d=r.axis;for(let m=t;mdl($,r,a,!0)?1:Math.max(S,S*t,M,M*t),g=($,S,M)=>dl($,r,a,!0)?-1:Math.min(S,S*t,M,M*t),v=m(0,u,c),b=m(Jt,f,d),y=g(Gt,u,c),C=g(Gt+Jt,f,d);i=(v-y)/2,s=(b-C)/2,l=-(v+y)/2,o=-(b+C)/2}return{ratioX:i,ratioY:s,offsetX:l,offsetY:o}}class Ml extends pi{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(bt(i[e])){const{key:a="value"}=this._parsing;l=u=>+Ii(i[u],a)}let o,r;for(o=e,r=e+t;o0&&!isNaN(e)?Vt*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Cl(t._parsed[e],i.options.locale);return{label:s[e]||"",value:l}}getMaxBorderWidth(e){let t=0;const i=this.chart;let s,l,o,r,a;if(!e){for(s=0,l=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Ml.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 o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.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 zt(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class Tl extends pi{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:s=[],_dataset:l}=t,o=this.chart._animationsDisabled;let{start:r,count:a}=zy(t,s,o);this._drawStart=r,this._drawCount=a,By(t)&&(r=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:!o,options:u},e),this.updateElements(s,r,a,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r,_stacked:a,_dataset:u}=this._cachedMeta,f=this.resolveDataElementOptions(t,s),c=this.getSharedOptions(f),d=this.includeOptions(s,c),m=o.axis,g=r.axis,{spanGaps:v,segment:b}=this.options,y=cl(v)?v:Number.POSITIVE_INFINITY,C=this.chart._animationsDisabled||l||s==="none";let $=t>0&&this.getParsed(t-1);for(let S=t;S0&&Math.abs(D[m]-$[m])>y,b&&(E.parsed=D,E.raw=u.data[S]),d&&(E.options=c||this.resolveDataElementOptions(S,M.active?"active":s)),C||this.updateElement(M,S,E,s),$=D}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)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,l,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Tl.id="line";Tl.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Tl.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};function zy(n,e,t){const i=e.length;let s=0,l=i;if(n._sorted){const{iScale:o,_parsed:r}=n,a=o.axis,{min:u,max:f,minDefined:c,maxDefined:d}=o.getUserBounds();c&&(s=fn(Math.min(es(r,o.axis,u).lo,t?i:es(e,a,o.getPixelForValue(u)).lo),0,i-1)),d?l=fn(Math.max(es(r,o.axis,f).hi+1,t?0:es(e,a,o.getPixelForValue(f)).hi+1),s,i)-s:l=i-s}return{start:s,count:l}}function By(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 Fa extends pi{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=Cl(t._parsed[e].r,i.options.locale);return{label:s[e]||"",value:l}}parseObjectData(e,t,i,s){return Eg.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),o=Math.max(i.cutoutPercentage?l/100*i.cutoutPercentage:1,0),r=(l-o)/e.getVisibleDatasetCount();this.outerRadius=l-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(e,t,i,s){const l=s==="reset",o=this.chart,a=o.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,c=u.yCenter,d=u.getIndexAngle(0)-.5*Gt;let m=d,g;const v=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)?ei(this.resolveDataElementOptions(e,t).angle||i):0}}Fa.id="polarArea";Fa.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Fa.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 o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.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 jg extends Ml{}jg.id="pie";jg.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ia extends pi{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 Eg.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 o=this.resolveDatasetElementOptions(e);this.options.showLine||(o.borderWidth=0);const r={_loop:!0,_fullLoop:l.length===s.length,options:o};this.updateElement(i,void 0,r,e)}this.updateElements(s,0,s.length,e)}updateElements(e,t,i,s){const l=this._cachedMeta.rScale,o=s==="reset";for(let r=t;r{a[o](e[t],s)&&(l.push({element:a,datasetIndex:u,index:f}),r=r||a.inRange(e.x,e.y,s))}),i&&!r?[]:l}var Zy={evaluateInteractionItems:Dl,modes:{index(n,e,t,i){const s=Gi(e,n),l=t.axis||"x",o=t.includeInvisible||!1,r=t.intersect?hr(n,s,l,i,o):pr(n,s,l,!1,i,o),a=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(u=>{const f=r[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=Gi(e,n),l=t.axis||"xy",o=t.includeInvisible||!1;let r=t.intersect?hr(n,s,l,i,o):pr(n,s,l,!1,i,o);if(r.length>0){const a=r[0].datasetIndex,u=n.getDatasetMeta(a).data;r=[];for(let f=0;ft.pos===e)}function kf(n,e){return n.filter(t=>Vg.indexOf(t.pos)===-1&&t.box.axis===e)}function Vs(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 Jy(n){const e=[];let t,i,s,l,o,r;for(t=0,i=(n||[]).length;tu.box.fullSize),!0),i=Vs(qs(e,"left"),!0),s=Vs(qs(e,"right")),l=Vs(qs(e,"top"),!0),o=Vs(qs(e,"bottom")),r=kf(e,"x"),a=kf(e,"y");return{fullSize:t,leftAndTop:i.concat(l),rightAndBottom:s.concat(a).concat(o).concat(r),chartArea:qs(e,"chartArea"),vertical:i.concat(s).concat(a),horizontal:l.concat(o).concat(r)}}function wf(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function zg(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 xy(n,e,t,i){const{pos:s,box:l}=t,o=n.maxPadding;if(!bt(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&&zg(o,l.getPadding());const r=Math.max(0,e.outerWidth-wf(o,n,"left","right")),a=Math.max(0,e.outerHeight-wf(o,n,"top","bottom")),u=r!==n.w,f=a!==n.h;return n.w=r,n.h=a,t.horizontal?{same:u,other:f}:{same:f,other:u}}function ek(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 tk(n,e){const t=e.maxPadding;function i(s){const l={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{l[o]=Math.max(e[o],t[o])}),l}return i(n?["left","right"]:["top","bottom"])}function Js(n,e,t,i){const s=[];let l,o,r,a,u,f;for(l=0,o=n.length,u=0;l{typeof v.beforeLayout=="function"&&v.beforeLayout()});const f=a.reduce((v,b)=>b.box.options&&b.box.options.display===!1?v:v+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:l,availableHeight:o,vBoxMaxWidth:l/2/f,hBoxMaxHeight:o/2}),d=Object.assign({},s);zg(d,Kn(i));const m=Object.assign({maxPadding:d,w:l,h:o,x:s.left,y:s.top},s),g=Xy(a.concat(u),c);Js(r.fullSize,m,c,g),Js(a,m,c,g),Js(u,m,c,g)&&Js(a,m,c,g),ek(m),Sf(r.leftAndTop,m,c,g),m.x+=m.w,m.y+=m.h,Sf(r.rightAndBottom,m,c,g),n.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},At(r.chartArea,v=>{const b=v.box;Object.assign(b,n.chartArea),b.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class Bg{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 nk extends Bg{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ro="$chartjs",ik={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},$f=n=>n===null||n==="";function sk(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[ro]={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",$f(s)){const l=lf(n,"width");l!==void 0&&(n.width=l)}if($f(i))if(n.style.height==="")n.height=n.width/(e||2);else{const l=lf(n,"height");l!==void 0&&(n.height=l)}return n}const Ug=ey?{passive:!0}:!1;function lk(n,e,t){n.addEventListener(e,t,Ug)}function ok(n,e,t){n.canvas.removeEventListener(e,t,Ug)}function rk(n,e){const t=ik[n.type]||n.type,{x:i,y:s}=Gi(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function To(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function ak(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.addedNodes,i),o=o&&!To(r.removedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function uk(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.removedNodes,i),o=o&&!To(r.addedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const ml=new Map;let Cf=0;function Wg(){const n=window.devicePixelRatio;n!==Cf&&(Cf=n,ml.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function fk(n,e){ml.size||window.addEventListener("resize",Wg),ml.set(n,e)}function ck(n){ml.delete(n),ml.size||window.removeEventListener("resize",Wg)}function dk(n,e,t){const i=n.canvas,s=i&&Aa(i);if(!s)return;const l=hg((r,a)=>{const u=s.clientWidth;t(r,a),u{const a=r[0],u=a.contentRect.width,f=a.contentRect.height;u===0&&f===0||l(u,f)});return o.observe(s),fk(n,l),o}function mr(n,e,t){t&&t.disconnect(),e==="resize"&&ck(n)}function hk(n,e,t){const i=n.canvas,s=hg(l=>{n.ctx!==null&&t(rk(l,n))},n,l=>{const o=l[0];return[o,o.offsetX,o.offsetY]});return lk(i,e,s),s}class pk extends Bg{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(sk(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[ro])return!1;const i=t[ro].initial;["height","width"].forEach(l=>{const o=i[l];Pt(o)?t.removeAttribute(l):t.setAttribute(l,o)});const s=i.style||{};return Object.keys(s).forEach(l=>{t.style[l]=s[l]}),t.width=t.width,delete t[ro],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),o={attach:ak,detach:uk,resize:dk}[t]||hk;s[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:mr,detach:mr,resize:mr}[t]||ok)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return xv(e,t,i,s)}isAttached(e){const t=Aa(e);return!!(t&&t.isConnected)}}function mk(n){return!Pg()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?nk:pk}class $i{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 cl(this.x)&&cl(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}}$i.defaults={};$i.defaultRoutes=void 0;const Yg={values(n){return zt(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=gk(n,t)}const o=Vn(Math.abs(l)),r=Math.max(Math.min(-1*Math.floor(o),20),0),a={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(a,this.options.ticks.format),Cl(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(Vn(n)));return i===1||i===2||i===5?Yg.numeric.call(this,n,e,t):""}};function gk(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 Uo={formatters:Yg};kt.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:Uo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});kt.route("scale.ticks","color","","color");kt.route("scale.grid","color","","borderColor");kt.route("scale.grid","borderColor","","borderColor");kt.route("scale.title","color","","color");kt.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});kt.describe("scales",{_fallback:"scale"});kt.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function _k(n,e){const t=n.options.ticks,i=t.maxTicksLimit||bk(n),s=t.major.enabled?yk(e):[],l=s.length,o=s[0],r=s[l-1],a=[];if(l>i)return kk(e,a,s,l/i),a;const u=vk(s,e,i);if(l>0){let f,c;const d=l>1?Math.round((r-o)/(l-1)):null;for(Zl(e,a,u,Pt(d)?0:o-d,o),f=0,c=l-1;fs)return a}return Math.max(s,1)}function yk(n){const e=[];let t,i;for(t=0,i=n.length;tn==="left"?"right":n==="right"?"left":n,Mf=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t;function Tf(n,e){const t=[],i=n.length/e,s=n.length;let l=0;for(;lo+r)))return a}function Ck(n,e){At(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:Hn(t,Hn(i,t)),max:Hn(i,Hn(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(){Zt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:l,ticks:o}=this.options,r=o.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=Dv(this,l,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=l||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const f=this._getLabelSizes(),c=f.widest.width,d=f.highest.height,m=fn(this.chart.width-c,0,this.maxWidth);r=e.offset?this.maxWidth/i:m/(i-1),c+6>r&&(r=m/(i-(e.offset?.5:1)),a=this.maxHeight-zs(e.grid)-t.padding-Df(e.title,this.chart.options.font),u=Math.sqrt(c*c+d*d),o=ya(Math.min(Math.asin(fn((f.highest.height+6)/r,-1,1)),Math.asin(fn(a/u,-1,1))-Math.asin(fn(d/u,-1,1)))),o=Math.max(s,Math.min(l,o))),this.labelRotation=o}afterCalculateLabelRotation(){Zt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Zt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:l}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const a=Df(s,t.options.font);if(r?(e.width=this.maxWidth,e.height=zs(l)+a):(e.height=this.maxHeight,e.width=zs(l)+a),i.display&&this.ticks.length){const{first:u,last:f,widest:c,highest:d}=this._getLabelSizes(),m=i.padding*2,g=ei(this.labelRotation),v=Math.cos(g),b=Math.sin(g);if(r){const y=i.mirror?0:b*c.width+v*d.height;e.height=Math.min(this.maxHeight,e.height+y+m)}else{const y=i.mirror?0:v*c.width+b*d.height;e.width=Math.min(this.maxWidth,e.width+y+m)}this._calculatePadding(u,f,b,v)}}this._handleMargins(),r?(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:o},position:r}=this.options,a=this.labelRotation!==0,u=r!=="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,m=0;a?u?(d=s*e.width,m=i*t.height):(d=i*e.height,m=s*t.width):l==="start"?m=t.width:l==="end"?d=e.width:l!=="inner"&&(d=e.width/2,m=t.width/2),this.paddingLeft=Math.max((d-f+o)*this.width/(this.width-f),0),this.paddingRight=Math.max((m-c+o)*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+o,this.paddingBottom=c+o}}_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(){Zt(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[E]||0,height:o[E]||0});return{first:D(0),last:D(t-1),widest:D(S),highest:D(M),widths:l,heights:o}}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 Z1(this._alignToPixels?Yi(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&&er*s?r/i:a/s:a*s0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:l,position:o}=s,r=l.offset,a=this.isHorizontal(),f=this.ticks.length+(r?1:0),c=zs(l),d=[],m=l.setContext(this.getContext()),g=m.drawBorder?m.borderWidth:0,v=g/2,b=function(U){return Yi(i,U,g)};let y,C,$,S,M,D,E,O,F,L,H,j;if(o==="top")y=b(this.bottom),D=this.bottom-c,O=y-v,L=b(e.top)+v,j=e.bottom;else if(o==="bottom")y=b(this.top),L=e.top,j=b(e.bottom)-v,D=y+v,O=this.top+c;else if(o==="left")y=b(this.right),M=this.right-c,E=y-v,F=b(e.left)+v,H=e.right;else if(o==="right")y=b(this.left),F=e.left,H=b(e.right)-v,M=y+v,E=this.left+c;else if(t==="x"){if(o==="center")y=b((e.top+e.bottom)/2+.5);else if(bt(o)){const U=Object.keys(o)[0],K=o[U];y=b(this.chart.scales[U].getPixelForValue(K))}L=e.top,j=e.bottom,D=y+v,O=D+c}else if(t==="y"){if(o==="center")y=b((e.left+e.right)/2);else if(bt(o)){const U=Object.keys(o)[0],K=o[U];y=b(this.chart.scales[U].getPixelForValue(K))}M=y-v,E=M-c,F=e.left,H=e.right}const Q=yt(s.ticks.maxTicksLimit,f),ie=Math.max(1,Math.ceil(f/Q));for(C=0;Cl.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,o;const r=(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,o=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,o;for(l=0,o=t.length;l{const i=t.split("."),s=i.pop(),l=[n].concat(i).join("."),o=e[t].split("."),r=o.pop(),a=o.join(".");kt.route(l,s,a,r)})}function Pk(n){return"id"in n&&"defaults"in n}class Lk{constructor(){this.controllers=new Jl(pi,"datasets",!0),this.elements=new Jl($i,"elements"),this.plugins=new Jl(Object,"plugins"),this.scales=new Jl(as,"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):At(s,o=>{const r=i||this._getRegistryForType(o);this._exec(e,r,o)})})}_exec(e,t,i){const s=va(e);Zt(i["before"+s],[],i),t[e](i),Zt(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;tl.filter(r=>!o.some(a=>r.plugin.id===a.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function Ik(n){const e=[],t=Object.keys(yi.plugins.items);for(let s=0;s{const a=i[r];if(!bt(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const u=Kr(r,a),f=qk(u,s),c=t.scales||{};l[u]=l[u]||r,o[r]=tl(Object.create(null),[{axis:u},a,c[u],c[f]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,u=r.indexAxis||Yr(a,e),c=(ls[a]||{}).scales||{};Object.keys(c).forEach(d=>{const m=jk(d,u),g=r[m+"AxisID"]||l[m]||m;o[g]=o[g]||Object.create(null),tl(o[g],[{axis:m},i[g],c[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];tl(a,[kt.scales[a.type],kt.scale])}),o}function Kg(n){const e=n.options||(n.options={});e.plugins=yt(e.plugins,{}),e.scales=zk(n,e)}function Zg(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Bk(n){return n=n||{},n.data=Zg(n.data),Kg(n),n}const Of=new Map,Jg=new Set;function Gl(n,e){let t=Of.get(n);return t||(t=e(),Of.set(n,t),Jg.add(t)),t}const Bs=(n,e,t)=>{const i=Ii(e,t);i!==void 0&&n.add(i)};class Uk{constructor(e){this._config=Bk(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=Zg(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(),Kg(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Gl(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Gl(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Gl(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return Gl(`${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,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const a=new Set;t.forEach(f=>{e&&(a.add(e),f.forEach(c=>Bs(a,e,c))),f.forEach(c=>Bs(a,s,c)),f.forEach(c=>Bs(a,ls[l]||{},c)),f.forEach(c=>Bs(a,kt,c)),f.forEach(c=>Bs(a,Br,c))});const u=Array.from(a);return u.length===0&&u.push(Object.create(null)),Jg.has(t)&&o.set(t,u),u}chartOptionScopes(){const{options:e,type:t}=this;return[e,ls[t]||{},kt.datasets[t]||{},{type:t},kt,Br]}resolveNamedOptions(e,t,i,s=[""]){const l={$shared:!0},{resolver:o,subPrefixes:r}=Ef(this._resolverCache,e,s);let a=o;if(Yk(o,t)){l.$shared=!1,i=Ni(i)?i():i;const u=this.createResolver(e,i,r);a=$s(o,i,u)}for(const u of t)l[u]=a[u];return l}createResolver(e,t,i=[""],s){const{resolver:l}=Ef(this._resolverCache,e,i);return bt(t)?$s(l,t,void 0,s):l}}function Ef(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:Da(e,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,l)),l}const Wk=n=>bt(n)&&Object.getOwnPropertyNames(n).reduce((e,t)=>e||Ni(n[t]),!1);function Yk(n,e){const{isScriptable:t,isIndexable:i}=Mg(n);for(const s of e){const l=t(s),o=i(s),r=(o||l)&&n[s];if(l&&(Ni(r)||Wk(r))||o&&zt(r))return!0}return!1}var Kk="3.8.0";const Zk=["top","bottom","left","right","chartArea"];function Af(n,e){return n==="top"||n==="bottom"||Zk.indexOf(n)===-1&&e==="x"}function Pf(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function Lf(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),Zt(t&&t.onComplete,[n],e)}function Jk(n){const e=n.chart,t=e.options.animation;Zt(t&&t.onProgress,[n],e)}function Gg(n){return Pg()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Do={},Xg=n=>{const e=Gg(n);return Object.values(Do).filter(t=>t.canvas===e).pop()};function Gk(n,e,t){const i=Object.keys(n);for(const s of i){const l=+s;if(l>=e){const o=n[s];delete n[s],(t>0||l>e)&&(n[l+t]=o)}}}function Xk(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}class Oo{constructor(e,t){const i=this.config=new Uk(t),s=Gg(e),l=Xg(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 o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||mk(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,o.aspectRatio),a=r&&r.canvas,u=a&&a.height,f=a&&a.width;if(this.id=N1(),this.ctx=r,this.canvas=a,this.width=f,this.height=u,this._options=o,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 Fk,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=F1(c=>this.update(c),o.resizeDelay||0),this._dataChanges=[],Do[this.id]=this,!r||!a){console.error("Failed to create chart: can't acquire context from the given item");return}gi.listen(this,"complete",Lf),gi.listen(this,"progress",Jk),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:l}=this;return Pt(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():sf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return xu(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,o=this.platform.getMaximumSize(s,e,t,l),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,sf(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),Zt(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};At(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((o,r)=>(o[r]=!1,o),{});let l=[];t&&(l=l.concat(Object.keys(t).map(o=>{const r=t[o],a=Kr(o,r),u=a==="r",f=a==="x";return{options:r,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),At(l,o=>{const r=o.options,a=r.id,u=Kr(a,r),f=yt(r.type,o.dtype);(r.position===void 0||Af(r.position,u)!==Af(o.dposition))&&(r.position=o.dposition),s[a]=!0;let c=null;if(a in i&&i[a].type===f)c=i[a];else{const d=yi.getScale(f);c=new d({id:a,type:f,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(r,e)}),At(s,(o,r)=>{o||delete i[r]}),At(i,o=>{Kl.configure(this,o,o.options),Kl.addBox(this,o)})}_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 o=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Pf("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){At(this.scales,e=>{Kl.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!zu(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 o=i==="_removeElements"?-l:l;Gk(e,s,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=l=>new Set(e.filter(o=>o[0]===l).map((o,r)=>r+","+o.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;Kl.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],At(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,o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&$a(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&&Ca(t),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return pl(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const l=Zy.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=Hi(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),o=l.controller._resolveAnimations(void 0,s);Yn(t)?(l.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(l,{visible:i}),this.update(r=>r.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,o),e[l]=o},s=(l,o,r)=>{l.offsetX=o,l.offsetY=r,this._eventHandler(l)};At(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 o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",l),i("detach",o)};o=()=>{this.attached=!1,s("resize",l),this._stop(),this._resize(0,0),i("attach",r)},t.isAttached(this.canvas)?r():o()}unbindEvents(){At(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},At(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,o,r,a;for(t==="dataset"&&(l=this.getDatasetMeta(e[0].datasetIndex),l.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=e.length;r{const r=this.getDatasetMeta(l);if(!r)throw new Error("No dataset found at index "+l);return{datasetIndex:l,element:r.data[o],index:o}});!vo(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)),o=l(t,e),r=i?e:l(e,t);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=o=>(o.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,o=t,r=this._getActiveElements(e,s,i,o),a=z1(e),u=Xk(e,this._lastEvent,i,a);i&&(this._lastEvent=null,Zt(l.onHover,[e,r,this],this),a&&Zt(l.onClick,[e,r,this],this));const f=!vo(r,s);return(f||t)&&(this._active=r,this._updateHoverStyles(r,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 Ff=()=>At(Oo.instances,n=>n._plugins.invalidate()),Ti=!0;Object.defineProperties(Oo,{defaults:{enumerable:Ti,value:kt},instances:{enumerable:Ti,value:Do},overrides:{enumerable:Ti,value:ls},registry:{enumerable:Ti,value:yi},version:{enumerable:Ti,value:Kk},getChart:{enumerable:Ti,value:Xg},register:{enumerable:Ti,value:(...n)=>{yi.add(...n),Ff()}},unregister:{enumerable:Ti,value:(...n)=>{yi.remove(...n),Ff()}}});function Qg(n,e,t){const{startAngle:i,pixelMargin:s,x:l,y:o,outerRadius:r,innerRadius:a}=e;let u=s/r;n.beginPath(),n.arc(l,o,r,i-u,t+u),a>s?(u=s/a,n.arc(l,o,a,t+u,i-u,!0)):n.arc(l,o,s,t+Jt,i-Jt),n.closePath(),n.clip()}function Qk(n){return Ma(n,["outerStart","outerEnd","innerStart","innerEnd"])}function xk(n,e,t,i){const s=Qk(n.options.borderRadius),l=(t-e)/2,o=Math.min(l,i*e/2),r=a=>{const u=(t-Math.min(l,a))*i/2;return fn(a,0,Math.min(l,u))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:fn(s.innerStart,0,o),innerEnd:fn(s.innerEnd,0,o)}}function ms(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function Zr(n,e,t,i,s){const{x:l,y:o,startAngle:r,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 m=s-r;if(i){const K=u>0?u-i:0,W=f>0?f-i:0,J=(K+W)/2,se=J!==0?m*J/(J+i):m;d=(m-se)/2}const g=Math.max(.001,m*f-t/Gt)/f,v=(m-g)/2,b=r+v+d,y=s-v-d,{outerStart:C,outerEnd:$,innerStart:S,innerEnd:M}=xk(e,c,f,y-b),D=f-C,E=f-$,O=b+C/D,F=y-$/E,L=c+S,H=c+M,j=b+S/L,Q=y-M/H;if(n.beginPath(),n.arc(l,o,f,O,F),$>0){const K=ms(E,F,l,o);n.arc(K.x,K.y,$,F,y+Jt)}const ie=ms(H,y,l,o);if(n.lineTo(ie.x,ie.y),M>0){const K=ms(H,Q,l,o);n.arc(K.x,K.y,M,y+Jt,Q+Math.PI)}if(n.arc(l,o,c,y-M/c,b+S/c,!0),S>0){const K=ms(L,j,l,o);n.arc(K.x,K.y,S,j+Math.PI,b-Jt)}const U=ms(D,b,l,o);if(n.lineTo(U.x,U.y),C>0){const K=ms(D,O,l,o);n.arc(K.x,K.y,C,b-Jt,O)}n.closePath()}function e2(n,e,t,i){const{fullCircles:s,startAngle:l,circumference:o}=e;let r=e.endAngle;if(s){Zr(n,e,t,i,l+Vt);for(let a=0;a=Vt||dl(l,r,a),v=hl(o,u+d,f+d);return g&&v}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:l,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),{offset:a,spacing:u}=this.options,f=(s+l)/2,c=(o+r+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>Vt?Math.floor(i/Vt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=0;if(s){o=s/2;const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*o,Math.sin(a)*o),this.circumference>=Gt&&(o=s)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;const r=e2(e,this,o,l);n2(e,this,o,l,r),e.restore()}}Ra.id="arc";Ra.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0};Ra.defaultRoutes={backgroundColor:"backgroundColor"};function xg(n,e,t=e){n.lineCap=yt(t.borderCapStyle,e.borderCapStyle),n.setLineDash(yt(t.borderDash,e.borderDash)),n.lineDashOffset=yt(t.borderDashOffset,e.borderDashOffset),n.lineJoin=yt(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=yt(t.borderWidth,e.borderWidth),n.strokeStyle=yt(t.borderColor,e.borderColor)}function i2(n,e,t){n.lineTo(t.x,t.y)}function s2(n){return n.stepped?yv:n.tension||n.cubicInterpolationMode==="monotone"?kv:i2}function e_(n,e,t={}){const i=n.length,{start:s=0,end:l=i-1}=t,{start:o,end:r}=e,a=Math.max(s,o),u=Math.min(l,r),f=sr&&l>r;return{count:i,start:a,loop:e.loop,ilen:u(o+(u?r-S:S))%l,$=()=>{v!==b&&(n.lineTo(f,b),n.lineTo(f,v),n.lineTo(f,y))};for(a&&(m=s[C(0)],n.moveTo(m.x,m.y)),d=0;d<=r;++d){if(m=s[C(d)],m.skip)continue;const S=m.x,M=m.y,D=S|0;D===g?(Mb&&(b=M),f=(c*f+S)/++c):($(),n.lineTo(S,M),g=D,c=0,v=b=M),y=M}$()}function Jr(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?o2:l2}function r2(n){return n.stepped?ty:n.tension||n.cubicInterpolationMode==="monotone"?ny:Xi}function a2(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),xg(n,e.options),n.stroke(s)}function u2(n,e,t,i){const{segments:s,options:l}=e,o=Jr(e);for(const r of s)xg(n,l,r.style),n.beginPath(),o(n,e,r,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const f2=typeof Path2D=="function";function c2(n,e,t,i){f2&&!e.options.segment?a2(n,e,t,i):u2(n,e,t,i)}class ji extends $i{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;Kv(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=cy(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,o=Ig(this,{property:t,start:s,end:s});if(!o.length)return;const r=[],a=r2(i);let u,f;for(u=0,f=o.length;un!=="borderDash"&&n!=="fill"};function If(n,e,t,i){const s=n.options,{[t]:l}=n.getProps([t],i);return Math.abs(e-l){r=ja(o,r,s);const a=s[o],u=s[r];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 ja(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Nf(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function n_(n,e){let t=[],i=!1;return zt(n)?(i=!0,t=n):t=b2(n,e),t.length?new ji({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function v2(n,e,t){let s=n[e].fill;const l=[e];let o;if(!t)return s;for(;s!==!1&&l.indexOf(s)===-1;){if(!Xt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;l.push(s),s=o.fill}return!1}function y2(n,e,t){const i=$2(n);if(bt(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Xt(s)&&Math.floor(s)===s?k2(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function k2(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function w2(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:bt(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function S2(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:bt(n)?i=n.value:i=e.getBaseValue(),i}function $2(n){const e=n.options,t=e.fill;let i=yt(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function C2(n){const{scale:e,index:t,line:i}=n,s=[],l=i.segments,o=i.points,r=M2(e,t);r.push(n_({x:null,y:e.bottom},i));for(let a=0;a=0;--o){const r=s[o].$filler;!r||(r.line.updateControlPoints(l,r.axis),i&&br(n.ctx,r,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&&br(n.ctx,l,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!i||i.fill===!1||t.drawTime!=="beforeDatasetDraw"||br(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ll={average(n){if(!n.length)return!1;let e,t,i=0,s=0,l=0;for(e=0,t=n.length;er({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=hg.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 o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(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 gy;const ff="transparent",_y={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Qu(n||ff),s=i.valid&&Qu(e||ff);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class by{constructor(e,t,i,s){const l=t[i];s=Ul([e.to,s,l,e.from]);const o=Ul([e.from,l,s]);this._active=!0,this._fn=e.fn||_y[e.type||typeof o],this._easing=il[e.easing]||il.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=o,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,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ul([e.to,t,s,e.from]),this._from=Ul([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,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,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"});kt.set("animations",{colors:{type:"color",properties:yy},numbers:{type:"number",properties:vy}});kt.describe("animations",{_fallback:"animation"});kt.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 Rg{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!_t(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!_t(s))return;const l={};for(const o of ky)l[o]=s[o];(zt(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=Sy(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&wy(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[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,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new by(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 wy(n,e){const t=[],i=Object.keys(e);for(let s=0;s0||!t&&l<0)return s.index}return null}function mf(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:l,vScale:o,index:r}=i,a=l.axis,u=o.axis,f=Ty(l,o,i),c=e.length;let d;for(let p=0;pt[i].axis===e).shift()}function Ey(n,e){return Hi(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Ay(n,e,t){return Hi(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function js(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 cr=n=>n==="reset"||n==="none",gf=(n,e)=>e?n:Object.assign({},n),Py=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:Hg(t,!0),values:null};class pi{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=hf(e.vScale,e),this.addElements()}updateIndex(e){this.index!==e&&js(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(c,d,p,g)=>c==="x"?d:c==="r"?g:p,l=t.xAxisID=yt(i.xAxisID,fr(e,"x")),o=t.yAxisID=yt(i.yAxisID,fr(e,"y")),r=t.rAxisID=yt(i.rAxisID,fr(e,"r")),a=t.indexAxis,u=t.iAxisID=s(a,l,o,r),f=t.vAxisID=s(a,o,l,r);t.xScale=this.getScaleForId(l),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(r),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&&ef(this._data,this),e._stacked&&js(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(_t(t))this._data=My(t);else if(i!==t){if(i){ef(i,this);const s=this._cachedMeta;js(s),s._parsed=[]}t&&Object.isExtensible(t)&&Lv(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=hf(t.vScale,t),t.stack!==i.stack&&(s=!0,js(t),t.stack=i.stack),this._resyncElements(e),(s||l!==t._stacked)&&mf(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:o}=i,r=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{zt(s[e])?d=this.parseArrayData(i,s,e,t):_t(s[e])?d=this.parseObjectData(i,s,e,t):d=this.parsePrimitiveData(i,s,e,t);const p=()=>c[r]===null||u&&c[r]v||c=0;--d)if(!g()){this.updateRangeFromParsed(u,e,p,a);break}}return u}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,l,o;for(s=0,l=t.length;s=0&&ethis.getContext(i,s),v=u.resolveNamedOptions(d,p,g,c);return v.$shared&&(v.$shared=a,l[o]=Object.freeze(gf(v,a))),v}_resolveAnimations(e,t,i){const s=this.chart,l=this._cachedDataOpts,o=`animation-${t}`,r=l[o];if(r)return r;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 Rg(s,a&&a.animations);return a&&a._cacheable&&(l[o]=Object.freeze(u)),u}getSharedOptions(e){if(!!e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||cr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),s=this._sharedOptions,l=this.getSharedOptions(i),o=this.includeOptions(t,l)||l!==s;return this.updateSharedOptions(l,t,i),{sharedOptions:l,includeOptions:o}}updateElement(e,t,i,s){cr(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!cr(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[r,a,u]of this._syncList)this[r](a,u);this._syncList=[];const s=i.length,l=t.length,o=Math.min(l,s);o&&this.parse(0,o),l>s?this._insertElements(s,l-s,e):l{for(u.length+=t,r=u.length-1;r>=o;r--)u[r]=u[r-t]};for(a(l),r=e;rs-l))}return n._cache.$bar}function Fy(n){const e=n.iScale,t=Ly(e,n.type);let i=e._length,s,l,o,r;const a=()=>{o===32767||o===-32768||(Yn(r)&&(i=Math.min(i,Math.abs(o-r)||i)),r=o)};for(s=0,l=t.length;s0?s[n-1]:null,r=nMath.abs(r)&&(a=r,u=o),e[t.axis]=u,e._custom={barStart:a,barEnd:u,start:s,end:l,min:o,max:r}}function jg(n,e,t,i){return zt(n)?Ry(n,e,t,i):e[t.axis]=t.parse(n,i),e}function _f(n,e,t,i){const s=n.iScale,l=n.vScale,o=s.getLabels(),r=s===l,a=[];let u,f,c,d;for(u=t,f=t+i;u=t?1:-1)}function jy(n){let e,t,i,s,l;return n.horizontal?(e=n.base>n.x,t="left",i="right"):(e=n.basea.controller.options.grouped),l=i.options.stacked,o=[],r=a=>{const u=a.controller.getParsed(t),f=u&&u[a.vScale.axis];if(Pt(f)||isNaN(f))return!0};for(const a of s)if(!(t!==void 0&&r(a))&&((l===!1||o.indexOf(a.stack)===-1||l===void 0&&a.stack===void 0)&&o.push(a.stack),a.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,i){const s=this._getStacks(e,i),l=t!==void 0?s.indexOf(t):-1;return l===-1?s.length-1:l}_getRuler(){const e=this.options,t=this._cachedMeta,i=t.iScale,s=[];let l,o;for(l=0,o=t.data.length;l=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),o=i.getLabelForValue(l.x),r=s.getLabelForValue(l.y),a=l._custom;return{label:t.label,value:"("+o+", "+r+(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:o,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:u}=this._getSharedOptions(t,s),f=o.axis,c=r.axis;for(let d=t;ddl(C,r,a,!0)?1:Math.max(S,S*t,M,M*t),g=(C,S,M)=>dl(C,r,a,!0)?-1:Math.min(S,S*t,M,M*t),v=p(0,u,c),b=p(Jt,f,d),y=g(Gt,u,c),$=g(Gt+Jt,f,d);i=(v-y)/2,s=(b-$)/2,l=-(v+y)/2,o=-(b+$)/2}return{ratioX:i,ratioY:s,offsetX:l,offsetY:o}}class Ml extends pi{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(_t(i[e])){const{key:a="value"}=this._parsing;l=u=>+Ii(i[u],a)}let o,r;for(o=e,r=e+t;o0&&!isNaN(e)?It*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Cl(t._parsed[e],i.options.locale);return{label:s[e]||"",value:l}}getMaxBorderWidth(e){let t=0;const i=this.chart;let s,l,o,r,a;if(!e){for(s=0,l=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Ml.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 o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.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 zt(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class Tl extends pi{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:s=[],_dataset:l}=t,o=this.chart._animationsDisabled;let{start:r,count:a}=Uy(t,s,o);this._drawStart=r,this._drawCount=a,Wy(t)&&(r=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:!o,options:u},e),this.updateElements(s,r,a,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r,_stacked:a,_dataset:u}=this._cachedMeta,{sharedOptions:f,includeOptions:c}=this._getSharedOptions(t,s),d=o.axis,p=r.axis,{spanGaps:g,segment:v}=this.options,b=cl(g)?g:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||l||s==="none";let $=t>0&&this.getParsed(t-1);for(let C=t;C0&&Math.abs(M[d]-$[d])>b,v&&(D.parsed=M,D.raw=u.data[C]),c&&(D.options=f||this.resolveDataElementOptions(C,S.active?"active":s)),y||this.updateElement(S,C,D,s),$=M}}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)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,l,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Tl.id="line";Tl.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Tl.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};function Uy(n,e,t){const i=e.length;let s=0,l=i;if(n._sorted){const{iScale:o,_parsed:r}=n,a=o.axis,{min:u,max:f,minDefined:c,maxDefined:d}=o.getUserBounds();c&&(s=fn(Math.min(es(r,o.axis,u).lo,t?i:es(e,a,o.getPixelForValue(u)).lo),0,i-1)),d?l=fn(Math.max(es(r,o.axis,f).hi+1,t?0:es(e,a,o.getPixelForValue(f)).hi+1),s,i)-s:l=i-s}return{start:s,count:l}}function Wy(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 Fa extends pi{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=Cl(t._parsed[e].r,i.options.locale);return{label:s[e]||"",value:l}}parseObjectData(e,t,i,s){return Ag.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),o=Math.max(i.cutoutPercentage?l/100*i.cutoutPercentage:1,0),r=(l-o)/e.getVisibleDatasetCount();this.outerRadius=l-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(e,t,i,s){const l=s==="reset",o=this.chart,a=o.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,c=u.yCenter,d=u.getIndexAngle(0)-.5*Gt;let p=d,g;const v=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)?ei(this.resolveDataElementOptions(e,t).angle||i):0}}Fa.id="polarArea";Fa.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Fa.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 o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.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 qg extends Ml{}qg.id="pie";qg.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ia extends pi{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 Ag.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 o=this.resolveDatasetElementOptions(e);this.options.showLine||(o.borderWidth=0);const r={_loop:!0,_fullLoop:l.length===s.length,options:o};this.updateElement(i,void 0,r,e)}this.updateElements(s,0,s.length,e)}updateElements(e,t,i,s){const l=this._cachedMeta.rScale,o=s==="reset";for(let r=t;r{a[o](e[t],s)&&(l.push({element:a,datasetIndex:u,index:f}),r=r||a.inRange(e.x,e.y,s))}),i&&!r?[]:l}var Gy={evaluateInteractionItems:Dl,modes:{index(n,e,t,i){const s=Gi(e,n),l=t.axis||"x",o=t.includeInvisible||!1,r=t.intersect?hr(n,s,l,i,o):pr(n,s,l,!1,i,o),a=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(u=>{const f=r[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=Gi(e,n),l=t.axis||"xy",o=t.includeInvisible||!1;let r=t.intersect?hr(n,s,l,i,o):pr(n,s,l,!1,i,o);if(r.length>0){const a=r[0].datasetIndex,u=n.getDatasetMeta(a).data;r=[];for(let f=0;ft.pos===e)}function kf(n,e){return n.filter(t=>zg.indexOf(t.pos)===-1&&t.box.axis===e)}function Vs(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 Xy(n){const e=[];let t,i,s,l,o,r;for(t=0,i=(n||[]).length;tu.box.fullSize),!0),i=Vs(qs(e,"left"),!0),s=Vs(qs(e,"right")),l=Vs(qs(e,"top"),!0),o=Vs(qs(e,"bottom")),r=kf(e,"x"),a=kf(e,"y");return{fullSize:t,leftAndTop:i.concat(l),rightAndBottom:s.concat(a).concat(o).concat(r),chartArea:qs(e,"chartArea"),vertical:i.concat(s).concat(a),horizontal:l.concat(o).concat(r)}}function wf(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function Bg(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 tk(n,e,t,i){const{pos:s,box:l}=t,o=n.maxPadding;if(!_t(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&&Bg(o,l.getPadding());const r=Math.max(0,e.outerWidth-wf(o,n,"left","right")),a=Math.max(0,e.outerHeight-wf(o,n,"top","bottom")),u=r!==n.w,f=a!==n.h;return n.w=r,n.h=a,t.horizontal?{same:u,other:f}:{same:f,other:u}}function nk(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 ik(n,e){const t=e.maxPadding;function i(s){const l={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{l[o]=Math.max(e[o],t[o])}),l}return i(n?["left","right"]:["top","bottom"])}function Js(n,e,t,i){const s=[];let l,o,r,a,u,f;for(l=0,o=n.length,u=0;l{typeof v.beforeLayout=="function"&&v.beforeLayout()});const f=a.reduce((v,b)=>b.box.options&&b.box.options.display===!1?v:v+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:l,availableHeight:o,vBoxMaxWidth:l/2/f,hBoxMaxHeight:o/2}),d=Object.assign({},s);Bg(d,Kn(i));const p=Object.assign({maxPadding:d,w:l,h:o,x:s.left,y:s.top},s),g=xy(a.concat(u),c);Js(r.fullSize,p,c,g),Js(a,p,c,g),Js(u,p,c,g)&&Js(a,p,c,g),nk(p),Sf(r.leftAndTop,p,c,g),p.x+=p.w,p.y+=p.h,Sf(r.rightAndBottom,p,c,g),n.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},At(r.chartArea,v=>{const b=v.box;Object.assign(b,n.chartArea),b.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Ug{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 sk extends Ug{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ro="$chartjs",lk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},$f=n=>n===null||n==="";function ok(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[ro]={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",$f(s)){const l=lf(n,"width");l!==void 0&&(n.width=l)}if($f(i))if(n.style.height==="")n.height=n.width/(e||2);else{const l=lf(n,"height");l!==void 0&&(n.height=l)}return n}const Wg=ny?{passive:!0}:!1;function rk(n,e,t){n.addEventListener(e,t,Wg)}function ak(n,e,t){n.canvas.removeEventListener(e,t,Wg)}function uk(n,e){const t=lk[n.type]||n.type,{x:i,y:s}=Gi(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function To(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function fk(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.addedNodes,i),o=o&&!To(r.removedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function ck(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.removedNodes,i),o=o&&!To(r.addedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const ml=new Map;let Cf=0;function Yg(){const n=window.devicePixelRatio;n!==Cf&&(Cf=n,ml.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function dk(n,e){ml.size||window.addEventListener("resize",Yg),ml.set(n,e)}function hk(n){ml.delete(n),ml.size||window.removeEventListener("resize",Yg)}function pk(n,e,t){const i=n.canvas,s=i&&Aa(i);if(!s)return;const l=pg((r,a)=>{const u=s.clientWidth;t(r,a),u{const a=r[0],u=a.contentRect.width,f=a.contentRect.height;u===0&&f===0||l(u,f)});return o.observe(s),dk(n,l),o}function mr(n,e,t){t&&t.disconnect(),e==="resize"&&hk(n)}function mk(n,e,t){const i=n.canvas,s=pg(l=>{n.ctx!==null&&t(uk(l,n))},n,l=>{const o=l[0];return[o,o.offsetX,o.offsetY]});return rk(i,e,s),s}class gk extends Ug{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(ok(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[ro])return!1;const i=t[ro].initial;["height","width"].forEach(l=>{const o=i[l];Pt(o)?t.removeAttribute(l):t.setAttribute(l,o)});const s=i.style||{};return Object.keys(s).forEach(l=>{t.style[l]=s[l]}),t.width=t.width,delete t[ro],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),o={attach:fk,detach:ck,resize:pk}[t]||mk;s[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:mr,detach:mr,resize:mr}[t]||ak)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return ty(e,t,i,s)}isAttached(e){const t=Aa(e);return!!(t&&t.isConnected)}}function _k(n){return!Lg()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?sk:gk}class $i{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 cl(this.x)&&cl(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}}$i.defaults={};$i.defaultRoutes=void 0;const Kg={values(n){return zt(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=bk(n,t)}const o=Vn(Math.abs(l)),r=Math.max(Math.min(-1*Math.floor(o),20),0),a={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(a,this.options.ticks.format),Cl(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(Vn(n)));return i===1||i===2||i===5?Kg.numeric.call(this,n,e,t):""}};function bk(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 Uo={formatters:Kg};kt.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:Uo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});kt.route("scale.ticks","color","","color");kt.route("scale.grid","color","","borderColor");kt.route("scale.grid","borderColor","","borderColor");kt.route("scale.title","color","","color");kt.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});kt.describe("scales",{_fallback:"scale"});kt.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function vk(n,e){const t=n.options.ticks,i=t.maxTicksLimit||yk(n),s=t.major.enabled?wk(e):[],l=s.length,o=s[0],r=s[l-1],a=[];if(l>i)return Sk(e,a,s,l/i),a;const u=kk(s,e,i);if(l>0){let f,c;const d=l>1?Math.round((r-o)/(l-1)):null;for(Zl(e,a,u,Pt(d)?0:o-d,o),f=0,c=l-1;fs)return a}return Math.max(s,1)}function wk(n){const e=[];let t,i;for(t=0,i=n.length;tn==="left"?"right":n==="right"?"left":n,Mf=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t;function Tf(n,e){const t=[],i=n.length/e,s=n.length;let l=0;for(;lo+r)))return a}function Tk(n,e){At(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:Hn(t,Hn(i,t)),max:Hn(i,Hn(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(){Zt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:l,ticks:o}=this.options,r=o.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=Ev(this,l,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=l||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const f=this._getLabelSizes(),c=f.widest.width,d=f.highest.height,p=fn(this.chart.width-c,0,this.maxWidth);r=e.offset?this.maxWidth/i:p/(i-1),c+6>r&&(r=p/(i-(e.offset?.5:1)),a=this.maxHeight-zs(e.grid)-t.padding-Df(e.title,this.chart.options.font),u=Math.sqrt(c*c+d*d),o=ya(Math.min(Math.asin(fn((f.highest.height+6)/r,-1,1)),Math.asin(fn(a/u,-1,1))-Math.asin(fn(d/u,-1,1)))),o=Math.max(s,Math.min(l,o))),this.labelRotation=o}afterCalculateLabelRotation(){Zt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Zt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:l}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const a=Df(s,t.options.font);if(r?(e.width=this.maxWidth,e.height=zs(l)+a):(e.height=this.maxHeight,e.width=zs(l)+a),i.display&&this.ticks.length){const{first:u,last:f,widest:c,highest:d}=this._getLabelSizes(),p=i.padding*2,g=ei(this.labelRotation),v=Math.cos(g),b=Math.sin(g);if(r){const y=i.mirror?0:b*c.width+v*d.height;e.height=Math.min(this.maxHeight,e.height+y+p)}else{const y=i.mirror?0:v*c.width+b*d.height;e.width=Math.min(this.maxWidth,e.width+y+p)}this._calculatePadding(u,f,b,v)}}this._handleMargins(),r?(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:o},position:r}=this.options,a=this.labelRotation!==0,u=r!=="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,p=0;a?u?(d=s*e.width,p=i*t.height):(d=i*e.height,p=s*t.width):l==="start"?p=t.width:l==="end"?d=e.width:l!=="inner"&&(d=e.width/2,p=t.width/2),this.paddingLeft=Math.max((d-f+o)*this.width/(this.width-f),0),this.paddingRight=Math.max((p-c+o)*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+o,this.paddingBottom=c+o}}_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(){Zt(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[E]||0,height:o[E]||0});return{first:D(0),last:D(t-1),widest:D(S),highest:D(M),widths:l,heights:o}}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 J1(this._alignToPixels?Yi(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&&er*s?r/i:a/s:a*s0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:l,position:o}=s,r=l.offset,a=this.isHorizontal(),f=this.ticks.length+(r?1:0),c=zs(l),d=[],p=l.setContext(this.getContext()),g=p.drawBorder?p.borderWidth:0,v=g/2,b=function(U){return Yi(i,U,g)};let y,$,C,S,M,D,E,O,F,L,H,j;if(o==="top")y=b(this.bottom),D=this.bottom-c,O=y-v,L=b(e.top)+v,j=e.bottom;else if(o==="bottom")y=b(this.top),L=e.top,j=b(e.bottom)-v,D=y+v,O=this.top+c;else if(o==="left")y=b(this.right),M=this.right-c,E=y-v,F=b(e.left)+v,H=e.right;else if(o==="right")y=b(this.left),F=e.left,H=b(e.right)-v,M=y+v,E=this.left+c;else if(t==="x"){if(o==="center")y=b((e.top+e.bottom)/2+.5);else if(_t(o)){const U=Object.keys(o)[0],K=o[U];y=b(this.chart.scales[U].getPixelForValue(K))}L=e.top,j=e.bottom,D=y+v,O=D+c}else if(t==="y"){if(o==="center")y=b((e.left+e.right)/2);else if(_t(o)){const U=Object.keys(o)[0],K=o[U];y=b(this.chart.scales[U].getPixelForValue(K))}M=y-v,E=M-c,F=e.left,H=e.right}const Q=yt(s.ticks.maxTicksLimit,f),ie=Math.max(1,Math.ceil(f/Q));for($=0;$l.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,o;const r=(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,o=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,o;for(l=0,o=t.length;l{const i=t.split("."),s=i.pop(),l=[n].concat(i).join("."),o=e[t].split("."),r=o.pop(),a=o.join(".");kt.route(l,s,a,r)})}function Fk(n){return"id"in n&&"defaults"in n}class Ik{constructor(){this.controllers=new Jl(pi,"datasets",!0),this.elements=new Jl($i,"elements"),this.plugins=new Jl(Object,"plugins"),this.scales=new Jl(as,"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):At(s,o=>{const r=i||this._getRegistryForType(o);this._exec(e,r,o)})})}_exec(e,t,i){const s=va(e);Zt(i["before"+s],[],i),t[e](i),Zt(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;tl.filter(r=>!o.some(a=>r.plugin.id===a.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function Rk(n){const e={},t=[],i=Object.keys(yi.plugins.items);for(let l=0;l{const a=i[r];if(!_t(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const u=Kr(r,a),f=zk(u,s),c=t.scales||{};l[u]=l[u]||r,o[r]=tl(Object.create(null),[{axis:u},a,c[u],c[f]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,u=r.indexAxis||Yr(a,e),c=(ls[a]||{}).scales||{};Object.keys(c).forEach(d=>{const p=Vk(d,u),g=r[p+"AxisID"]||l[p]||p;o[g]=o[g]||Object.create(null),tl(o[g],[{axis:p},i[g],c[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];tl(a,[kt.scales[a.type],kt.scale])}),o}function Zg(n){const e=n.options||(n.options={});e.plugins=yt(e.plugins,{}),e.scales=Uk(n,e)}function Jg(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Wk(n){return n=n||{},n.data=Jg(n.data),Zg(n),n}const Of=new Map,Gg=new Set;function Gl(n,e){let t=Of.get(n);return t||(t=e(),Of.set(n,t),Gg.add(t)),t}const Bs=(n,e,t)=>{const i=Ii(e,t);i!==void 0&&n.add(i)};class Yk{constructor(e){this._config=Wk(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=Jg(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(),Zg(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Gl(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Gl(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Gl(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return Gl(`${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,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const a=new Set;t.forEach(f=>{e&&(a.add(e),f.forEach(c=>Bs(a,e,c))),f.forEach(c=>Bs(a,s,c)),f.forEach(c=>Bs(a,ls[l]||{},c)),f.forEach(c=>Bs(a,kt,c)),f.forEach(c=>Bs(a,Br,c))});const u=Array.from(a);return u.length===0&&u.push(Object.create(null)),Gg.has(t)&&o.set(t,u),u}chartOptionScopes(){const{options:e,type:t}=this;return[e,ls[t]||{},kt.datasets[t]||{},{type:t},kt,Br]}resolveNamedOptions(e,t,i,s=[""]){const l={$shared:!0},{resolver:o,subPrefixes:r}=Ef(this._resolverCache,e,s);let a=o;if(Zk(o,t)){l.$shared=!1,i=Ni(i)?i():i;const u=this.createResolver(e,i,r);a=$s(o,i,u)}for(const u of t)l[u]=a[u];return l}createResolver(e,t,i=[""],s){const{resolver:l}=Ef(this._resolverCache,e,i);return _t(t)?$s(l,t,void 0,s):l}}function Ef(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:Da(e,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,l)),l}const Kk=n=>_t(n)&&Object.getOwnPropertyNames(n).reduce((e,t)=>e||Ni(n[t]),!1);function Zk(n,e){const{isScriptable:t,isIndexable:i}=Tg(n);for(const s of e){const l=t(s),o=i(s),r=(o||l)&&n[s];if(l&&(Ni(r)||Kk(r))||o&&zt(r))return!0}return!1}var Jk="3.8.2";const Gk=["top","bottom","left","right","chartArea"];function Af(n,e){return n==="top"||n==="bottom"||Gk.indexOf(n)===-1&&e==="x"}function Pf(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function Lf(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),Zt(t&&t.onComplete,[n],e)}function Xk(n){const e=n.chart,t=e.options.animation;Zt(t&&t.onProgress,[n],e)}function Xg(n){return Lg()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Do={},Qg=n=>{const e=Xg(n);return Object.values(Do).filter(t=>t.canvas===e).pop()};function Qk(n,e,t){const i=Object.keys(n);for(const s of i){const l=+s;if(l>=e){const o=n[s];delete n[s],(t>0||l>e)&&(n[l+t]=o)}}}function xk(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}class Oo{constructor(e,t){const i=this.config=new Yk(t),s=Xg(e),l=Qg(s);if(l)throw new Error("Canvas is already in use. Chart with ID '"+l.id+"' must be destroyed before the canvas with ID '"+l.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_k(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,o.aspectRatio),a=r&&r.canvas,u=a&&a.height,f=a&&a.width;if(this.id=R1(),this.ctx=r,this.canvas=a,this.width=f,this.height=u,this._options=o,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 Nk,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=I1(c=>this.update(c),o.resizeDelay||0),this._dataChanges=[],Do[this.id]=this,!r||!a){console.error("Failed to create chart: can't acquire context from the given item");return}gi.listen(this,"complete",Lf),gi.listen(this,"progress",Xk),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:l}=this;return Pt(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():sf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return xu(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,o=this.platform.getMaximumSize(s,e,t,l),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,sf(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),Zt(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};At(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((o,r)=>(o[r]=!1,o),{});let l=[];t&&(l=l.concat(Object.keys(t).map(o=>{const r=t[o],a=Kr(o,r),u=a==="r",f=a==="x";return{options:r,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),At(l,o=>{const r=o.options,a=r.id,u=Kr(a,r),f=yt(r.type,o.dtype);(r.position===void 0||Af(r.position,u)!==Af(o.dposition))&&(r.position=o.dposition),s[a]=!0;let c=null;if(a in i&&i[a].type===f)c=i[a];else{const d=yi.getScale(f);c=new d({id:a,type:f,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(r,e)}),At(s,(o,r)=>{o||delete i[r]}),At(i,o=>{Kl.configure(this,o,o.options),Kl.addBox(this,o)})}_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 o=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Pf("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){At(this.scales,e=>{Kl.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!zu(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 o=i==="_removeElements"?-l:l;Qk(e,s,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=l=>new Set(e.filter(o=>o[0]===l).map((o,r)=>r+","+o.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;Kl.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],At(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,o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&$a(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&&Ca(t),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return pl(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const l=Gy.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=Hi(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),o=l.controller._resolveAnimations(void 0,s);Yn(t)?(l.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(l,{visible:i}),this.update(r=>r.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,o),e[l]=o},s=(l,o,r)=>{l.offsetX=o,l.offsetY=r,this._eventHandler(l)};At(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 o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",l),i("detach",o)};o=()=>{this.attached=!1,s("resize",l),this._stop(),this._resize(0,0),i("attach",r)},t.isAttached(this.canvas)?r():o()}unbindEvents(){At(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},At(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,o,r,a;for(t==="dataset"&&(l=this.getDatasetMeta(e[0].datasetIndex),l.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=e.length;r{const r=this.getDatasetMeta(l);if(!r)throw new Error("No dataset found at index "+l);return{datasetIndex:l,element:r.data[o],index:o}});!vo(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)),o=l(t,e),r=i?e:l(e,t);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=o=>(o.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,o=t,r=this._getActiveElements(e,s,i,o),a=B1(e),u=xk(e,this._lastEvent,i,a);i&&(this._lastEvent=null,Zt(l.onHover,[e,r,this],this),a&&Zt(l.onClick,[e,r,this],this));const f=!vo(r,s);return(f||t)&&(this._active=r,this._updateHoverStyles(r,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 Ff=()=>At(Oo.instances,n=>n._plugins.invalidate()),Ti=!0;Object.defineProperties(Oo,{defaults:{enumerable:Ti,value:kt},instances:{enumerable:Ti,value:Do},overrides:{enumerable:Ti,value:ls},registry:{enumerable:Ti,value:yi},version:{enumerable:Ti,value:Jk},getChart:{enumerable:Ti,value:Qg},register:{enumerable:Ti,value:(...n)=>{yi.add(...n),Ff()}},unregister:{enumerable:Ti,value:(...n)=>{yi.remove(...n),Ff()}}});function xg(n,e,t){const{startAngle:i,pixelMargin:s,x:l,y:o,outerRadius:r,innerRadius:a}=e;let u=s/r;n.beginPath(),n.arc(l,o,r,i-u,t+u),a>s?(u=s/a,n.arc(l,o,a,t+u,i-u,!0)):n.arc(l,o,s,t+Jt,i-Jt),n.closePath(),n.clip()}function e2(n){return Ma(n,["outerStart","outerEnd","innerStart","innerEnd"])}function t2(n,e,t,i){const s=e2(n.options.borderRadius),l=(t-e)/2,o=Math.min(l,i*e/2),r=a=>{const u=(t-Math.min(l,a))*i/2;return fn(a,0,Math.min(l,u))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:fn(s.innerStart,0,o),innerEnd:fn(s.innerEnd,0,o)}}function ms(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function Zr(n,e,t,i,s){const{x:l,y:o,startAngle:r,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 p=s-r;if(i){const K=u>0?u-i:0,W=f>0?f-i:0,J=(K+W)/2,se=J!==0?p*J/(J+i):p;d=(p-se)/2}const g=Math.max(.001,p*f-t/Gt)/f,v=(p-g)/2,b=r+v+d,y=s-v-d,{outerStart:$,outerEnd:C,innerStart:S,innerEnd:M}=t2(e,c,f,y-b),D=f-$,E=f-C,O=b+$/D,F=y-C/E,L=c+S,H=c+M,j=b+S/L,Q=y-M/H;if(n.beginPath(),n.arc(l,o,f,O,F),C>0){const K=ms(E,F,l,o);n.arc(K.x,K.y,C,F,y+Jt)}const ie=ms(H,y,l,o);if(n.lineTo(ie.x,ie.y),M>0){const K=ms(H,Q,l,o);n.arc(K.x,K.y,M,y+Jt,Q+Math.PI)}if(n.arc(l,o,c,y-M/c,b+S/c,!0),S>0){const K=ms(L,j,l,o);n.arc(K.x,K.y,S,j+Math.PI,b-Jt)}const U=ms(D,b,l,o);if(n.lineTo(U.x,U.y),$>0){const K=ms(D,O,l,o);n.arc(K.x,K.y,$,b-Jt,O)}n.closePath()}function n2(n,e,t,i){const{fullCircles:s,startAngle:l,circumference:o}=e;let r=e.endAngle;if(s){Zr(n,e,t,i,l+It);for(let a=0;a=It||dl(l,r,a),v=hl(o,u+d,f+d);return g&&v}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:l,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),{offset:a,spacing:u}=this.options,f=(s+l)/2,c=(o+r+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>It?Math.floor(i/It):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=0;if(s){o=s/2;const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*o,Math.sin(a)*o),this.circumference>=Gt&&(o=s)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;const r=n2(e,this,o,l);s2(e,this,o,l,r),e.restore()}}Ra.id="arc";Ra.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0};Ra.defaultRoutes={backgroundColor:"backgroundColor"};function e_(n,e,t=e){n.lineCap=yt(t.borderCapStyle,e.borderCapStyle),n.setLineDash(yt(t.borderDash,e.borderDash)),n.lineDashOffset=yt(t.borderDashOffset,e.borderDashOffset),n.lineJoin=yt(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=yt(t.borderWidth,e.borderWidth),n.strokeStyle=yt(t.borderColor,e.borderColor)}function l2(n,e,t){n.lineTo(t.x,t.y)}function o2(n){return n.stepped?wv:n.tension||n.cubicInterpolationMode==="monotone"?Sv:l2}function t_(n,e,t={}){const i=n.length,{start:s=0,end:l=i-1}=t,{start:o,end:r}=e,a=Math.max(s,o),u=Math.min(l,r),f=sr&&l>r;return{count:i,start:a,loop:e.loop,ilen:u(o+(u?r-S:S))%l,C=()=>{v!==b&&(n.lineTo(f,b),n.lineTo(f,v),n.lineTo(f,y))};for(a&&(p=s[$(0)],n.moveTo(p.x,p.y)),d=0;d<=r;++d){if(p=s[$(d)],p.skip)continue;const S=p.x,M=p.y,D=S|0;D===g?(Mb&&(b=M),f=(c*f+S)/++c):(C(),n.lineTo(S,M),g=D,c=0,v=b=M),y=M}C()}function Jr(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?a2:r2}function u2(n){return n.stepped?iy:n.tension||n.cubicInterpolationMode==="monotone"?sy:Xi}function f2(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),e_(n,e.options),n.stroke(s)}function c2(n,e,t,i){const{segments:s,options:l}=e,o=Jr(e);for(const r of s)e_(n,l,r.style),n.beginPath(),o(n,e,r,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const d2=typeof Path2D=="function";function h2(n,e,t,i){d2&&!e.options.segment?f2(n,e,t,i):c2(n,e,t,i)}class ji extends $i{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;Jv(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=hy(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,o=Ng(this,{property:t,start:s,end:s});if(!o.length)return;const r=[],a=u2(i);let u,f;for(u=0,f=o.length;un!=="borderDash"&&n!=="fill"};function If(n,e,t,i){const s=n.options,{[t]:l}=n.getProps([t],i);return Math.abs(e-l){r=ja(o,r,s);const a=s[o],u=s[r];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 ja(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Nf(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function i_(n,e){let t=[],i=!1;return zt(n)?(i=!0,t=n):t=y2(n,e),t.length?new ji({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function Rf(n){return n&&n.fill!==!1}function k2(n,e,t){let s=n[e].fill;const l=[e];let o;if(!t)return s;for(;s!==!1&&l.indexOf(s)===-1;){if(!Xt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;l.push(s),s=o.fill}return!1}function w2(n,e,t){const i=M2(n);if(_t(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Xt(s)&&Math.floor(s)===s?S2(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function S2(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function $2(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:_t(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function C2(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:_t(n)?i=n.value:i=e.getBaseValue(),i}function M2(n){const e=n.options,t=e.fill;let i=yt(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function T2(n){const{scale:e,index:t,line:i}=n,s=[],l=i.segments,o=i.points,r=D2(e,t);r.push(i_({x:null,y:e.bottom},i));for(let a=0;a=0;--o){const r=s[o].$filler;!r||(r.line.updateControlPoints(l,r.axis),i&&r.fill&&br(n.ctx,r,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;Rf(l)&&br(n.ctx,l,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!Rf(i)||t.drawTime!=="beforeDatasetDraw"||br(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ll={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 R2(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function qf(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=Dn(e.bodyFont),u=Dn(e.titleFont),f=Dn(e.footerFont),c=l.length,d=s.length,m=i.length,g=Kn(e.padding);let v=g.height,b=0,y=i.reduce((S,M)=>S+M.before.length+M.lines.length+M.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(v+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const S=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;v+=m*S+(y-m)*a.lineHeight+(y-1)*e.bodySpacing}d&&(v+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let C=0;const $=function(S){b=Math.max(b,t.measureText(S).width+C)};return t.save(),t.font=u.string,At(n.title,$),t.font=a.string,At(n.beforeBody.concat(n.afterBody),$),C=e.displayColors?o+2+e.boxPadding:0,At(i,S=>{At(S.before,$),At(S.lines,$),At(S.after,$)}),C=0,t.font=f.string,At(n.footer,$),t.restore(),b+=g.width,{width:b,height:v}}function H2(n,e){const{y:t,height:i}=e;return tn.height-i/2?"bottom":"center"}function j2(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function q2(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),j2(u,n,e,t)&&(u="center"),u}function Vf(n,e,t){const i=t.yAlign||e.yAlign||H2(n,t);return{xAlign:t.xAlign||e.xAlign||q2(n,e,t,i),yAlign:i}}function V2(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function z2(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function zf(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:m}=vs(o);let g=V2(e,r);const v=z2(e,a,u);return a==="center"?r==="left"?g+=u:r==="right"&&(g-=u):r==="left"?g-=Math.max(f,d)+s:r==="right"&&(g+=Math.max(c,m)+s),{x:fn(g,0,i.width-e.width),y:fn(v,0,i.height-e.height)}}function Xl(n,e,t){const i=Kn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function Bf(n){return li([],_i(n))}function B2(n,e,t){return Hi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Uf(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class Xr extends $i{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 Ng(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=B2(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]),o=i.afterTitle.apply(this,[e]);let r=[];return r=li(r,_i(s)),r=li(r,_i(l)),r=li(r,_i(o)),r}getBeforeBody(e,t){return Bf(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return At(e,l=>{const o={before:[],lines:[],after:[]},r=Uf(i,l);li(o.before,_i(r.beforeLabel.call(this,l))),li(o.lines,r.label.call(this,l)),li(o.after,_i(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return Bf(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]),o=i.afterFooter.apply(this,[e]);let r=[];return r=li(r,_i(s)),r=li(r,_i(l)),r=li(r,_i(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;ae.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),At(r,f=>{const c=Uf(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let l,o=[];if(!s.length)this.opacity!==0&&(l={opacity:0});else{const r=ll[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const a=this._size=qf(this,i),u=Object.assign({},r,a),f=Vf(this.chart,i,u),c=zf(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:r.x,caretY:r.y}}this._tooltipItems=o,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:o,cornerRadius:r}=i,{topLeft:a,topRight:u,bottomLeft:f,bottomRight:c}=vs(r),{x:d,y:m}=e,{width:g,height:v}=t;let b,y,C,$,S,M;return l==="center"?(S=m+v/2,s==="left"?(b=d,y=b-o,$=S+o,M=S-o):(b=d+g,y=b+o,$=S-o,M=S+o),C=b):(s==="left"?y=d+Math.max(a,f)+o:s==="right"?y=d+g-Math.max(u,c)-o:y=this.caretX,l==="top"?($=m,S=$-o,b=y-o,C=y+o):($=m+v,S=$+o,b=y+o,C=y-o),M=$),{x1:b,x2:y,x3:C,y1:$,y2:S,y3:M}}drawTitle(e,t,i){const s=this.title,l=s.length;let o,r,a;if(l){const u=ur(i.rtl,this.x,this.width);for(e.x=Xl(this,i.titleAlign,i),t.textAlign=u.textAlign(i.titleAlign),t.textBaseline="middle",o=Dn(i.titleFont),r=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,a=0;a$!==0)?(e.beginPath(),e.fillStyle=l.multiKeyBackground,Co(e,{x:b,y:v,w:u,h:a,radius:C}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Co(e,{x:y,y:v+1,w:u-2,h:a-2,radius:C}),e.fill()):(e.fillStyle=l.multiKeyBackground,e.fillRect(b,v,u,a),e.strokeRect(b,v,u,a),e.fillStyle=o.backgroundColor,e.fillRect(y,v+1,u-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:l,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:u,boxPadding:f}=i,c=Dn(i.bodyFont);let d=c.lineHeight,m=0;const g=ur(i.rtl,this.x,this.width),v=function(O){t.fillText(O,g.x(e.x+m),e.y+d/2),e.y+=d+l},b=g.textAlign(o);let y,C,$,S,M,D,E;for(t.textAlign=o,t.textBaseline="middle",t.font=c.string,e.x=Xl(this,b,i),t.fillStyle=i.bodyColor,At(this.beforeBody,v),m=r&&b!=="right"?o==="center"?u/2+f:u+2+f:0,S=0,D=s.length;S0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,l=i&&i.y;if(s||l){const o=ll[e.position].call(this,this._active,this._eventPosition);if(!o)return;const r=this._size=qf(this,e),a=Object.assign({},o,this._size),u=Vf(t,e,a),f=zf(e,a,u,t);(s._to!==f.x||l._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=r.width,this.height=r.height,this.caretX=o.x,this.caretY=o.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 o=Kn(t.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&r&&(e.save(),e.globalAlpha=i,this.drawBackground(l,e,s,t),oy(e,t.textDirection),l.y+=o.top,this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),ry(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:r,index:a})=>{const u=this.chart.getDatasetMeta(r);if(!u)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:u.data[a],index:a}}),l=!vo(i,s),o=this._positionChanged(s,t);(l||o)&&(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||[],o=this._getActiveElements(e,l,t,i),r=this._positionChanged(o,e),a=t||!vo(o,l)||r;return a&&(this._active=o,(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 o=this.chart.getElementsAtEventForMode(e,l.mode,l,i);return l.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:s,options:l}=this,o=ll[l.position].call(this,e,t);return o!==!1&&(i!==o.x||s!==o.y)}}Xr.positioners=ll;var U2={id:"tooltip",_element:Xr,positioners:ll,afterInit(n,e,t){t&&(n.tooltip=new Xr({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 W2=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function Y2(n,e,t,i){const s=n.indexOf(e);if(s===-1)return W2(n,e,t,i);const l=n.lastIndexOf(e);return s!==l?t:s}const K2=(n,e)=>n===null?null:fn(Math.round(n),0,e);class Qr extends as{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(Pt(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:Y2(i,e,yt(t,e),this._addedLabels),K2(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 o=e;o<=t;o++)s.push({value:o});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}}Qr.id="category";Qr.defaults={ticks:{callback:Qr.prototype.getLabelForValue}};function Z2(n,e){const t=[],{bounds:s,step:l,min:o,max:r,precision:a,count:u,maxTicks:f,maxDigits:c,includeBounds:d}=n,m=l||1,g=f-1,{min:v,max:b}=e,y=!Pt(o),C=!Pt(r),$=!Pt(u),S=(b-v)/(c+1);let M=Uu((b-v)/g/m)*m,D,E,O,F;if(M<1e-14&&!y&&!C)return[{value:v},{value:b}];F=Math.ceil(b/M)-Math.floor(v/M),F>g&&(M=Uu(F*M/g/m)*m),Pt(a)||(D=Math.pow(10,a),M=Math.ceil(M*D)/D),s==="ticks"?(E=Math.floor(v/M)*M,O=Math.ceil(b/M)*M):(E=v,O=b),y&&C&&l&&Y1((r-o)/l,M/1e3)?(F=Math.round(Math.min((r-o)/M,f)),M=(r-o)/F,E=o,O=r):$?(E=y?o:E,O=C?r:O,F=u-1,M=(O-E)/F):(F=(O-E)/M,nl(F,Math.round(F),M/1e3)?F=Math.round(F):F=Math.ceil(F));const L=Math.max(Wu(M),Wu(E));D=Math.pow(10,Pt(a)?L:a),E=Math.round(E*D)/D,O=Math.round(O*D)/D;let H=0;for(y&&(d&&E!==o?(t.push({value:o}),Es=t?s:a,r=a=>l=i?l:a;if(e){const a=ai(s),u=ai(l);a<0&&u<0?r(0):a>0&&u>0&&o(0)}if(s===l){let a=1;(l>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(a=Math.abs(l*.05)),r(l+a),e||o(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,o=Z2(s,l);return e.bounds==="ticks"&&gg(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}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 Cl(e,this.chart.options.locale,this.options.ticks.format)}}class qa extends Eo{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Xt(e)?e:0,this.max=Xt(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=ei(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}}qa.id="linear";qa.defaults={ticks:{callback:Uo.formatters.numeric}};function Yf(n){return n/Math.pow(10,Math.floor(Vn(n)))===1}function J2(n,e){const t=Math.floor(Vn(e.max)),i=Math.ceil(e.max/Math.pow(10,t)),s=[];let l=Hn(n.min,Math.pow(10,Math.floor(Vn(e.min)))),o=Math.floor(Vn(l)),r=Math.floor(l/Math.pow(10,o)),a=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:l,major:Yf(l)}),++r,r===10&&(r=1,++o,a=o>=0?1:a),l=Math.round(r*Math.pow(10,o)*a)/a;while(o0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Xt(e)?Math.max(0,e):null,this.max=Xt(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,o=a=>s=t?s:a,r=(a,u)=>Math.pow(10,Math.floor(Vn(a))+u);i===s&&(i<=0?(l(1),o(10)):(l(r(i,-1)),o(r(s,1)))),i<=0&&l(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&l(r(i,-1)),this.min=i,this.max=s}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=J2(t,this);return e.bounds==="ticks"&&gg(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":Cl(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Vn(e),this._valueRange=Vn(this.max)-Vn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Vn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}s_.id="logarithmic";s_.defaults={ticks:{callback:Uo.formatters.logarithmic,major:{enabled:!0}}};function xr(n){const e=n.ticks;if(e.display&&n.display){const t=Kn(e.backdropPadding);return yt(e.font&&e.font.size,kt.font.size)+t.height}return 0}function G2(n,e,t){return t=zt(t)?t:[t],{w:vv(n,e.string,t),h:t.length*e.lineHeight}}function Kf(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 X2(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,o=n.options.pointLabels,r=o.centerPointLabels?Gt/l:0;for(let a=0;ae.r&&(r=(i.end-e.r)/l,n.r=Math.max(n.r,e.r+r)),s.starte.b&&(a=(s.end-e.b)/o,n.b=Math.max(n.b,e.b+a))}function x2(n,e,t){const i=[],s=n._pointLabels.length,l=n.options,o=xr(l)/2,r=n.drawingArea,a=l.pointLabels.centerPointLabels?Gt/s:0;for(let u=0;u270||t<90)&&(n-=e),n}function iw(n,e){const{ctx:t,options:{pointLabels:i}}=n;for(let s=e-1;s>=0;s--){const l=i.setContext(n.getPointLabelContext(s)),o=Dn(l.font),{x:r,y:a,textAlign:u,left:f,top:c,right:d,bottom:m}=n._pointLabelItems[s],{backdropColor:g}=l;if(!Pt(g)){const v=vs(l.borderRadius),b=Kn(l.backdropPadding);t.fillStyle=g;const y=f-b.left,C=c-b.top,$=d-f+b.width,S=m-c+b.height;Object.values(v).some(M=>M!==0)?(t.beginPath(),Co(t,{x:y,y:C,w:$,h:S,radius:v}),t.fill()):t.fillRect(y,C,$,S)}$o(t,n._pointLabels[s],r,a+o.lineHeight/2,o,{color:l.color,textAlign:u,textBaseline:"middle"})}}function l_(n,e,t,i){const{ctx:s}=n;if(t)s.arc(n.xCenter,n.yCenter,e,0,Vt);else{let l=n.getPointPosition(0,e);s.moveTo(l.x,l.y);for(let o=1;o{const s=Zt(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?X2(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=Vt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Mn(e*t+ei(i))}getDistanceFromCenterForValue(e){if(Pt(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(Pt(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){r=this.getDistanceFromCenterForValue(u.value);const c=s.setContext(this.getContext(f-1));sw(this,c,r,l)}}),i.display){for(e.save(),o=l-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:c}=u;!c||!f||(e.lineWidth=c,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,r=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),a=this.getPointPosition(o,r),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,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((r,a)=>{if(a===0&&!t.reverse)return;const u=i.setContext(this.getContext(a)),f=Dn(u.font);if(l=this.getDistanceFromCenterForValue(this.ticks[a].value),u.showLabelBackdrop){e.font=f.string,o=e.measureText(r.label).width,e.fillStyle=u.backdropColor;const c=Kn(u.backdropPadding);e.fillRect(-o/2-c.left,-l-f.size/2-c.top,o+c.width,f.size+c.height)}$o(e,r.label,0,-l,f,{color:u.color})}),e.restore()}drawTitle(){}}Yo.id="radialLinear";Yo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Uo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};Yo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Yo.descriptors={angleLines:{_fallback:"grid"}};const Ko={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}},yn=Object.keys(Ko);function ow(n,e){return n-e}function Zf(n,e){if(Pt(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:l}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),Xt(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(s&&(o=s==="week"&&(cl(l)||l===!0)?t.startOf(o,"isoWeek",l):t.startOf(o,s)),+o)}function Jf(n,e,t,i){const s=yn.length;for(let l=yn.indexOf(n);l=yn.indexOf(t);l--){const o=yn[l];if(Ko[o].common&&n._adapter.diff(s,i,o)>=e-1)return o}return yn[t?yn.indexOf(t):0]}function aw(n){for(let e=yn.indexOf(n)+1,t=yn.length;e=e?t[i]:t[s];n[l]=!0}}function uw(n,e,t,i){const s=n._adapter,l=+s.startOf(e[0].value,i),o=e[e.length-1].value;let r,a;for(r=l;r<=o;r=+s.add(r,1,i))a=t[r],a>=0&&(e[a].major=!0);return e}function Xf(n,e,t){const i=[],s={},l=e.length;let o,r;for(o=0;o+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 o=e.length<3?.5:.25;t=fn(t,0,o),i=fn(i,0,o),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,o=l.unit||Jf(l.minUnit,t,i,this._getLabelCapacity(t)),r=yt(l.stepSize,1),a=o==="week"?l.isoWeekday:!1,u=cl(a)||a===!0,f={};let c=t,d,m;if(u&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,u?"day":o),e.diff(i,t,o)>1e5*r)throw new Error(t+" and "+i+" are too far apart with stepSize of "+r+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=c,m=0;dv-b).map(v=>+v)}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,o=l.time.displayFormats,r=this._unit,a=this._majorUnit,u=r&&o[r],f=a&&o[a],c=i[t],d=a&&f&&c&&c.major,m=this._adapter.format(e,s||(d?f:u)),g=l.ticks.callback;return g?Zt(g,[m,t,i],this):m}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t0?r: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}=es(n,"pos",e)),{pos:l,time:r}=n[i],{pos:o,time:a}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=es(n,"time",e)),{time:l,pos:r}=n[i],{time:o,pos:a}=n[s]);const u=o-l;return u?r+(a-r)*(e-l)/u:r}class o_ extends Ol{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=Ql(t,this.min),this._tableRange=Ql(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],l=[];let o,r,a,u,f;for(o=0,r=e.length;o=t&&u<=i&&s.push(u);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,r=s.length;oS+M.before.length+M.lines.length+M.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(v+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const S=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;v+=p*S+(y-p)*a.lineHeight+(y-1)*e.bodySpacing}d&&(v+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let $=0;const C=function(S){b=Math.max(b,t.measureText(S).width+$)};return t.save(),t.font=u.string,At(n.title,C),t.font=a.string,At(n.beforeBody.concat(n.afterBody),C),$=e.displayColors?o+2+e.boxPadding:0,At(i,S=>{At(S.before,C),At(S.lines,C),At(S.after,C)}),$=0,t.font=f.string,At(n.footer,C),t.restore(),b+=g.width,{width:b,height:v}}function q2(n,e){const{y:t,height:i}=e;return tn.height-i/2?"bottom":"center"}function V2(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function z2(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),V2(u,n,e,t)&&(u="center"),u}function zf(n,e,t){const i=t.yAlign||e.yAlign||q2(n,t);return{xAlign:t.xAlign||e.xAlign||z2(n,e,t,i),yAlign:i}}function B2(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function U2(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function Bf(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:p}=vs(o);let g=B2(e,r);const v=U2(e,a,u);return a==="center"?r==="left"?g+=u:r==="right"&&(g-=u):r==="left"?g-=Math.max(f,d)+s:r==="right"&&(g+=Math.max(c,p)+s),{x:fn(g,0,i.width-e.width),y:fn(v,0,i.height-e.height)}}function Xl(n,e,t){const i=Kn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function Uf(n){return li([],_i(n))}function W2(n,e,t){return Hi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Wf(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class Xr extends $i{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 Rg(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=W2(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]),o=i.afterTitle.apply(this,[e]);let r=[];return r=li(r,_i(s)),r=li(r,_i(l)),r=li(r,_i(o)),r}getBeforeBody(e,t){return Uf(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return At(e,l=>{const o={before:[],lines:[],after:[]},r=Wf(i,l);li(o.before,_i(r.beforeLabel.call(this,l))),li(o.lines,r.label.call(this,l)),li(o.after,_i(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return Uf(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]),o=i.afterFooter.apply(this,[e]);let r=[];return r=li(r,_i(s)),r=li(r,_i(l)),r=li(r,_i(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;ae.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),At(r,f=>{const c=Wf(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let l,o=[];if(!s.length)this.opacity!==0&&(l={opacity:0});else{const r=ll[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const a=this._size=Vf(this,i),u=Object.assign({},r,a),f=zf(this.chart,i,u),c=Bf(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:r.x,caretY:r.y}}this._tooltipItems=o,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:o,cornerRadius:r}=i,{topLeft:a,topRight:u,bottomLeft:f,bottomRight:c}=vs(r),{x:d,y:p}=e,{width:g,height:v}=t;let b,y,$,C,S,M;return l==="center"?(S=p+v/2,s==="left"?(b=d,y=b-o,C=S+o,M=S-o):(b=d+g,y=b+o,C=S-o,M=S+o),$=b):(s==="left"?y=d+Math.max(a,f)+o:s==="right"?y=d+g-Math.max(u,c)-o:y=this.caretX,l==="top"?(C=p,S=C-o,b=y-o,$=y+o):(C=p+v,S=C+o,b=y+o,$=y-o),M=C),{x1:b,x2:y,x3:$,y1:C,y2:S,y3:M}}drawTitle(e,t,i){const s=this.title,l=s.length;let o,r,a;if(l){const u=ur(i.rtl,this.x,this.width);for(e.x=Xl(this,i.titleAlign,i),t.textAlign=u.textAlign(i.titleAlign),t.textBaseline="middle",o=Dn(i.titleFont),r=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,a=0;aC!==0)?(e.beginPath(),e.fillStyle=l.multiKeyBackground,Co(e,{x:b,y:v,w:u,h:a,radius:$}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Co(e,{x:y,y:v+1,w:u-2,h:a-2,radius:$}),e.fill()):(e.fillStyle=l.multiKeyBackground,e.fillRect(b,v,u,a),e.strokeRect(b,v,u,a),e.fillStyle=o.backgroundColor,e.fillRect(y,v+1,u-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:l,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:u,boxPadding:f}=i,c=Dn(i.bodyFont);let d=c.lineHeight,p=0;const g=ur(i.rtl,this.x,this.width),v=function(O){t.fillText(O,g.x(e.x+p),e.y+d/2),e.y+=d+l},b=g.textAlign(o);let y,$,C,S,M,D,E;for(t.textAlign=o,t.textBaseline="middle",t.font=c.string,e.x=Xl(this,b,i),t.fillStyle=i.bodyColor,At(this.beforeBody,v),p=r&&b!=="right"?o==="center"?u/2+f:u+2+f:0,S=0,D=s.length;S0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,l=i&&i.y;if(s||l){const o=ll[e.position].call(this,this._active,this._eventPosition);if(!o)return;const r=this._size=Vf(this,e),a=Object.assign({},o,this._size),u=zf(t,e,a),f=Bf(e,a,u,t);(s._to!==f.x||l._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=r.width,this.height=r.height,this.caretX=o.x,this.caretY=o.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 o=Kn(t.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&r&&(e.save(),e.globalAlpha=i,this.drawBackground(l,e,s,t),ay(e,t.textDirection),l.y+=o.top,this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),uy(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:r,index:a})=>{const u=this.chart.getDatasetMeta(r);if(!u)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:u.data[a],index:a}}),l=!vo(i,s),o=this._positionChanged(s,t);(l||o)&&(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||[],o=this._getActiveElements(e,l,t,i),r=this._positionChanged(o,e),a=t||!vo(o,l)||r;return a&&(this._active=o,(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 o=this.chart.getElementsAtEventForMode(e,l.mode,l,i);return l.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:s,options:l}=this,o=ll[l.position].call(this,e,t);return o!==!1&&(i!==o.x||s!==o.y)}}Xr.positioners=ll;var Y2={id:"tooltip",_element:Xr,positioners:ll,afterInit(n,e,t){t&&(n.tooltip=new Xr({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 K2=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function Z2(n,e,t,i){const s=n.indexOf(e);if(s===-1)return K2(n,e,t,i);const l=n.lastIndexOf(e);return s!==l?t:s}const J2=(n,e)=>n===null?null:fn(Math.round(n),0,e);class Qr extends as{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(Pt(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:Z2(i,e,yt(t,e),this._addedLabels),J2(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 o=e;o<=t;o++)s.push({value:o});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}}Qr.id="category";Qr.defaults={ticks:{callback:Qr.prototype.getLabelForValue}};function G2(n,e){const t=[],{bounds:s,step:l,min:o,max:r,precision:a,count:u,maxTicks:f,maxDigits:c,includeBounds:d}=n,p=l||1,g=f-1,{min:v,max:b}=e,y=!Pt(o),$=!Pt(r),C=!Pt(u),S=(b-v)/(c+1);let M=Uu((b-v)/g/p)*p,D,E,O,F;if(M<1e-14&&!y&&!$)return[{value:v},{value:b}];F=Math.ceil(b/M)-Math.floor(v/M),F>g&&(M=Uu(F*M/g/p)*p),Pt(a)||(D=Math.pow(10,a),M=Math.ceil(M*D)/D),s==="ticks"?(E=Math.floor(v/M)*M,O=Math.ceil(b/M)*M):(E=v,O=b),y&&$&&l&&K1((r-o)/l,M/1e3)?(F=Math.round(Math.min((r-o)/M,f)),M=(r-o)/F,E=o,O=r):C?(E=y?o:E,O=$?r:O,F=u-1,M=(O-E)/F):(F=(O-E)/M,nl(F,Math.round(F),M/1e3)?F=Math.round(F):F=Math.ceil(F));const L=Math.max(Wu(M),Wu(E));D=Math.pow(10,Pt(a)?L:a),E=Math.round(E*D)/D,O=Math.round(O*D)/D;let H=0;for(y&&(d&&E!==o?(t.push({value:o}),Es=t?s:a,r=a=>l=i?l:a;if(e){const a=ai(s),u=ai(l);a<0&&u<0?r(0):a>0&&u>0&&o(0)}if(s===l){let a=1;(l>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(a=Math.abs(l*.05)),r(l+a),e||o(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,o=G2(s,l);return e.bounds==="ticks"&&_g(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}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 Cl(e,this.chart.options.locale,this.options.ticks.format)}}class qa extends Eo{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Xt(e)?e:0,this.max=Xt(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=ei(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}}qa.id="linear";qa.defaults={ticks:{callback:Uo.formatters.numeric}};function Kf(n){return n/Math.pow(10,Math.floor(Vn(n)))===1}function X2(n,e){const t=Math.floor(Vn(e.max)),i=Math.ceil(e.max/Math.pow(10,t)),s=[];let l=Hn(n.min,Math.pow(10,Math.floor(Vn(e.min)))),o=Math.floor(Vn(l)),r=Math.floor(l/Math.pow(10,o)),a=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:l,major:Kf(l)}),++r,r===10&&(r=1,++o,a=o>=0?1:a),l=Math.round(r*Math.pow(10,o)*a)/a;while(o0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Xt(e)?Math.max(0,e):null,this.max=Xt(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,o=a=>s=t?s:a,r=(a,u)=>Math.pow(10,Math.floor(Vn(a))+u);i===s&&(i<=0?(l(1),o(10)):(l(r(i,-1)),o(r(s,1)))),i<=0&&l(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&l(r(i,-1)),this.min=i,this.max=s}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=X2(t,this);return e.bounds==="ticks"&&_g(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":Cl(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Vn(e),this._valueRange=Vn(this.max)-Vn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Vn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}l_.id="logarithmic";l_.defaults={ticks:{callback:Uo.formatters.logarithmic,major:{enabled:!0}}};function xr(n){const e=n.ticks;if(e.display&&n.display){const t=Kn(e.backdropPadding);return yt(e.font&&e.font.size,kt.font.size)+t.height}return 0}function Q2(n,e,t){return t=zt(t)?t:[t],{w:yv(n,e.string,t),h:t.length*e.lineHeight}}function Zf(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 x2(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,o=n.options.pointLabels,r=o.centerPointLabels?Gt/l:0;for(let a=0;ae.r&&(r=(i.end-e.r)/l,n.r=Math.max(n.r,e.r+r)),s.starte.b&&(a=(s.end-e.b)/o,n.b=Math.max(n.b,e.b+a))}function tw(n,e,t){const i=[],s=n._pointLabels.length,l=n.options,o=xr(l)/2,r=n.drawingArea,a=l.pointLabels.centerPointLabels?Gt/s:0;for(let u=0;u270||t<90)&&(n-=e),n}function lw(n,e){const{ctx:t,options:{pointLabels:i}}=n;for(let s=e-1;s>=0;s--){const l=i.setContext(n.getPointLabelContext(s)),o=Dn(l.font),{x:r,y:a,textAlign:u,left:f,top:c,right:d,bottom:p}=n._pointLabelItems[s],{backdropColor:g}=l;if(!Pt(g)){const v=vs(l.borderRadius),b=Kn(l.backdropPadding);t.fillStyle=g;const y=f-b.left,$=c-b.top,C=d-f+b.width,S=p-c+b.height;Object.values(v).some(M=>M!==0)?(t.beginPath(),Co(t,{x:y,y:$,w:C,h:S,radius:v}),t.fill()):t.fillRect(y,$,C,S)}$o(t,n._pointLabels[s],r,a+o.lineHeight/2,o,{color:l.color,textAlign:u,textBaseline:"middle"})}}function o_(n,e,t,i){const{ctx:s}=n;if(t)s.arc(n.xCenter,n.yCenter,e,0,It);else{let l=n.getPointPosition(0,e);s.moveTo(l.x,l.y);for(let o=1;o{const s=Zt(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?x2(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=It/(this._pointLabels.length||1),i=this.options.startAngle||0;return Mn(e*t+ei(i))}getDistanceFromCenterForValue(e){if(Pt(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(Pt(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){r=this.getDistanceFromCenterForValue(u.value);const c=s.setContext(this.getContext(f-1));ow(this,c,r,l)}}),i.display){for(e.save(),o=l-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:c}=u;!c||!f||(e.lineWidth=c,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,r=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),a=this.getPointPosition(o,r),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,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((r,a)=>{if(a===0&&!t.reverse)return;const u=i.setContext(this.getContext(a)),f=Dn(u.font);if(l=this.getDistanceFromCenterForValue(this.ticks[a].value),u.showLabelBackdrop){e.font=f.string,o=e.measureText(r.label).width,e.fillStyle=u.backdropColor;const c=Kn(u.backdropPadding);e.fillRect(-o/2-c.left,-l-f.size/2-c.top,o+c.width,f.size+c.height)}$o(e,r.label,0,-l,f,{color:u.color})}),e.restore()}drawTitle(){}}Yo.id="radialLinear";Yo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Uo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};Yo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Yo.descriptors={angleLines:{_fallback:"grid"}};const Ko={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}},yn=Object.keys(Ko);function aw(n,e){return n-e}function Jf(n,e){if(Pt(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:l}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),Xt(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(s&&(o=s==="week"&&(cl(l)||l===!0)?t.startOf(o,"isoWeek",l):t.startOf(o,s)),+o)}function Gf(n,e,t,i){const s=yn.length;for(let l=yn.indexOf(n);l=yn.indexOf(t);l--){const o=yn[l];if(Ko[o].common&&n._adapter.diff(s,i,o)>=e-1)return o}return yn[t?yn.indexOf(t):0]}function fw(n){for(let e=yn.indexOf(n)+1,t=yn.length;e=e?t[i]:t[s];n[l]=!0}}function cw(n,e,t,i){const s=n._adapter,l=+s.startOf(e[0].value,i),o=e[e.length-1].value;let r,a;for(r=l;r<=o;r=+s.add(r,1,i))a=t[r],a>=0&&(e[a].major=!0);return e}function Qf(n,e,t){const i=[],s={},l=e.length;let o,r;for(o=0;o+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 o=e.length<3?.5:.25;t=fn(t,0,o),i=fn(i,0,o),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,o=l.unit||Gf(l.minUnit,t,i,this._getLabelCapacity(t)),r=yt(l.stepSize,1),a=o==="week"?l.isoWeekday:!1,u=cl(a)||a===!0,f={};let c=t,d,p;if(u&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,u?"day":o),e.diff(i,t,o)>1e5*r)throw new Error(t+" and "+i+" are too far apart with stepSize of "+r+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=c,p=0;dv-b).map(v=>+v)}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,o=l.time.displayFormats,r=this._unit,a=this._majorUnit,u=r&&o[r],f=a&&o[a],c=i[t],d=a&&f&&c&&c.major,p=this._adapter.format(e,s||(d?f:u)),g=l.ticks.callback;return g?Zt(g,[p,t,i],this):p}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t0?r: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}=es(n,"pos",e)),{pos:l,time:r}=n[i],{pos:o,time:a}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=es(n,"time",e)),{time:l,pos:r}=n[i],{time:o,pos:a}=n[s]);const u=o-l;return u?r+(a-r)*(e-l)/u:r}class r_ extends Ol{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=Ql(t,this.min),this._tableRange=Ql(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],l=[];let o,r,a,u,f;for(o=0,r=e.length;o=t&&u<=i&&s.push(u);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,r=s.length;o"u")return null;const i=typeof n;return i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=tt.fromFormat(n,e,t):n=tt.fromISO(n,t):n instanceof Date?n=tt.fromJSDate(n,t):i==="object"&&!(n instanceof tt)&&(n=tt.fromObject(n)),n.isValid?n.valueOf():null},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e,this.options):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function Qf(n){let e,t,i;return{c(){e=_("div"),h(e,"class","chart-loader loader svelte-vh4sl8")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Wn,{duration:150},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Wn,{duration:150},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function cw(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=R(n[1]),t=T(),s=R(i)},m(l,o){w(l,e,o),w(l,t,o),w(l,s,o)},p(l,o){o&2&&me(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&me(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function dw(n){let e;return{c(){e=R("Loading...")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function hw(n){let e,t,i,s,l,o,r=n[2]&&Qf();function a(c,d){return c[2]?dw:cw}let u=a(n),f=u(n);return{c(){e=_("div"),r&&r.c(),t=T(),i=_("canvas"),s=T(),l=_("div"),f.c(),h(i,"class","chart-canvas svelte-vh4sl8"),Za(i,"height","250px"),Za(i,"width","100%"),h(e,"class","chart-wrapper svelte-vh4sl8"),ee(e,"loading",n[2]),h(l,"class","txt-hint m-t-xs txt-right")},m(c,d){w(c,e,d),r&&r.m(e,null),p(e,t),p(e,i),n[8](i),w(c,s,d),w(c,l,d),f.m(l,null),o=!0},p(c,[d]){c[2]?r?d&4&&A(r,1):(r=Qf(),r.c(),A(r,1),r.m(e,t)):r&&(De(),P(r,1,1,()=>{r=null}),Oe()),d&4&&ee(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){o||(A(r),o=!0)},o(c){P(r),o=!1},d(c){c&&k(e),r&&r.d(),n[8](null),c&&k(s),c&&k(l),f.d()}}}function pw(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),Se.Logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(m=>{c();for(let g of m)r.push({x:Y.getDateTime(g.date).toLocal().toJSDate(),y:g.total}),t(1,a+=g.total);r.push({x:new Date,y:void 0})}).catch(m=>{m!=null&&m.isAbort||(c(),console.warn(m),Se.errorResponseHandler(m,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}Jn(()=>(Oo.register(ji,Wo,Tl,qa,Ol,N2,U2),t(6,o=new Oo(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,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:m=>m.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:m=>m.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(m){he[m?"unshift":"push"](()=>{l=m,t(0,l)})}return n.$$set=m=>{"filter"in m&&t(3,i=m.filter),"presets"in m&&t(4,s=m.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class mw extends Fe{constructor(e){super(),Le(this,e,pw,hw,Pe,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r_={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const dw={datetime:tt.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:tt.TIME_WITH_SECONDS,minute:tt.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Vg._date.override({_id:"luxon",_create:function(n){return tt.fromMillis(n,this.options)},formats:function(){return dw},parse:function(n,e){const t=this.options;if(n===null||typeof n>"u")return null;const i=typeof n;return i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=tt.fromFormat(n,e,t):n=tt.fromISO(n,t):n instanceof Date?n=tt.fromJSDate(n,t):i==="object"&&!(n instanceof tt)&&(n=tt.fromObject(n)),n.isValid?n.valueOf():null},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e,this.options):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function xf(n){let e,t,i;return{c(){e=_("div"),h(e,"class","chart-loader loader svelte-vh4sl8")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Wn,{duration:150},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Wn,{duration:150},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function hw(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=R(n[1]),t=T(),s=R(i)},m(l,o){w(l,e,o),w(l,t,o),w(l,s,o)},p(l,o){o&2&&me(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&me(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function pw(n){let e;return{c(){e=R("Loading...")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function mw(n){let e,t,i,s,l,o,r=n[2]&&xf();function a(c,d){return c[2]?pw:hw}let u=a(n),f=u(n);return{c(){e=_("div"),r&&r.c(),t=T(),i=_("canvas"),s=T(),l=_("div"),f.c(),h(i,"class","chart-canvas svelte-vh4sl8"),Za(i,"height","250px"),Za(i,"width","100%"),h(e,"class","chart-wrapper svelte-vh4sl8"),ee(e,"loading",n[2]),h(l,"class","txt-hint m-t-xs txt-right")},m(c,d){w(c,e,d),r&&r.m(e,null),m(e,t),m(e,i),n[8](i),w(c,s,d),w(c,l,d),f.m(l,null),o=!0},p(c,[d]){c[2]?r?d&4&&A(r,1):(r=xf(),r.c(),A(r,1),r.m(e,t)):r&&(De(),P(r,1,1,()=>{r=null}),Oe()),d&4&&ee(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){o||(A(r),o=!0)},o(c){P(r),o=!1},d(c){c&&k(e),r&&r.d(),n[8](null),c&&k(s),c&&k(l),f.d()}}}function gw(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),Se.Logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(p=>{c();for(let g of p)r.push({x:Y.getDateTime(g.date).toLocal().toJSDate(),y:g.total}),t(1,a+=g.total);r.push({x:new Date,y:void 0})}).catch(p=>{p!=null&&p.isAbort||(c(),console.warn(p),Se.errorResponseHandler(p,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}Jn(()=>(Oo.register(ji,Wo,Tl,qa,Ol,H2,Y2),t(6,o=new Oo(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,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:p=>p.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:p=>p.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(p){he[p?"unshift":"push"](()=>{l=p,t(0,l)})}return n.$$set=p=>{"filter"in p&&t(3,i=p.filter),"presets"in p&&t(4,s=p.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class _w extends Fe{constructor(e){super(),Le(this,e,gw,mw,Pe,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a_={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&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,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function C($){return $ instanceof a?new a($.type,C($.content),$.alias):Array.isArray($)?$.map(C):$.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(M){var C=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(M.stack)||[])[1];if(C){var $=document.getElementsByTagName("script");for(var S in $)if($[S].src==C)return $[S]}return null}},isActive:function(C,$,S){for(var M="no-"+$;C;){var D=C.classList;if(D.contains($))return!0;if(D.contains(M))return!1;C=C.parentElement}return!!S}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(C,$){var S=r.util.clone(r.languages[C]);for(var M in $)S[M]=$[M];return S},insertBefore:function(C,$,S,M){M=M||r.languages;var D=M[C],E={};for(var O in D)if(D.hasOwnProperty(O)){if(O==$)for(var F in S)S.hasOwnProperty(F)&&(E[F]=S[F]);S.hasOwnProperty(O)||(E[O]=D[O])}var L=M[C];return M[C]=E,r.languages.DFS(r.languages,function(H,j){j===L&&H!=C&&(this[H]=E)}),E},DFS:function C($,S,M,D){D=D||{};var E=r.util.objId;for(var O in $)if($.hasOwnProperty(O)){S.call($,O,$[O],M||O);var F=$[O],L=r.util.type(F);L==="Object"&&!D[E(F)]?(D[E(F)]=!0,C(F,S,null,D)):L==="Array"&&!D[E(F)]&&(D[E(F)]=!0,C(F,S,O,D))}}},plugins:{},highlightAll:function(C,$){r.highlightAllUnder(document,C,$)},highlightAllUnder:function(C,$,S){var M={callback:S,container:C,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",M),M.elements=Array.prototype.slice.apply(M.container.querySelectorAll(M.selector)),r.hooks.run("before-all-elements-highlight",M);for(var D=0,E;E=M.elements[D++];)r.highlightElement(E,$===!0,M.callback)},highlightElement:function(C,$,S){var M=r.util.getLanguage(C),D=r.languages[M];r.util.setLanguage(C,M);var E=C.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(E,M);var O=C.textContent,F={element:C,language:M,grammar:D,code:O};function L(j){F.highlightedCode=j,r.hooks.run("before-insert",F),F.element.innerHTML=F.highlightedCode,r.hooks.run("after-highlight",F),r.hooks.run("complete",F),S&&S.call(F.element)}if(r.hooks.run("before-sanity-check",F),E=F.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!F.code){r.hooks.run("complete",F),S&&S.call(F.element);return}if(r.hooks.run("before-highlight",F),!F.grammar){L(r.util.encode(F.code));return}if($&&i.Worker){var H=new Worker(r.filename);H.onmessage=function(j){L(j.data)},H.postMessage(JSON.stringify({language:F.language,code:F.code,immediateClose:!0}))}else L(r.highlight(F.code,F.grammar,F.language))},highlight:function(C,$,S){var M={code:C,grammar:$,language:S};if(r.hooks.run("before-tokenize",M),!M.grammar)throw new Error('The language "'+M.language+'" has no grammar.');return M.tokens=r.tokenize(M.code,M.grammar),r.hooks.run("after-tokenize",M),a.stringify(r.util.encode(M.tokens),M.language)},tokenize:function(C,$){var S=$.rest;if(S){for(var M in S)$[M]=S[M];delete $.rest}var D=new c;return d(D,D.head,C),f(C,D,$,D.head,0),g(D)},hooks:{all:{},add:function(C,$){var S=r.hooks.all;S[C]=S[C]||[],S[C].push($)},run:function(C,$){var S=r.hooks.all[C];if(!(!S||!S.length))for(var M=0,D;D=S[M++];)D($)}},Token:a};i.Prism=r;function a(C,$,S,M){this.type=C,this.content=$,this.alias=S,this.length=(M||"").length|0}a.stringify=function C($,S){if(typeof $=="string")return $;if(Array.isArray($)){var M="";return $.forEach(function(L){M+=C(L,S)}),M}var D={type:$.type,content:C($.content,S),tag:"span",classes:["token",$.type],attributes:{},language:S},E=$.alias;E&&(Array.isArray(E)?Array.prototype.push.apply(D.classes,E):D.classes.push(E)),r.hooks.run("wrap",D);var O="";for(var F in D.attributes)O+=" "+F+'="'+(D.attributes[F]||"").replace(/"/g,""")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+O+">"+D.content+""};function u(C,$,S,M){C.lastIndex=$;var D=C.exec(S);if(D&&M&&D[1]){var E=D[1].length;D.index+=E,D[0]=D[0].slice(E)}return D}function f(C,$,S,M,D,E){for(var O in S)if(!(!S.hasOwnProperty(O)||!S[O])){var F=S[O];F=Array.isArray(F)?F:[F];for(var L=0;L=E.reach);se+=J.value.length,J=J.next){var fe=J.value;if($.length>C.length)return;if(!(fe instanceof a)){var ke=1,le;if(ie){if(le=u(W,se,C,Q),!le||le.index>=C.length)break;var be=le.index,ue=le.index+le[0].length,Me=se;for(Me+=J.value.length;be>=Me;)J=J.next,Me+=J.value.length;if(Me-=J.value.length,se=Me,J.value instanceof a)continue;for(var Z=J;Z!==$.tail&&(MeE.reach&&(E.reach=je);var Ne=J.prev;G&&(Ne=d($,Ne,G),se+=G.length),m($,Ne,ke);var qe=new a(O,j?r.tokenize(x,j):x,U,x);if(J=d($,Ne,qe),_e&&d($,J,_e),ke>1){var ae={cause:O+","+L,reach:je};f(C,$,S,J.prev,se,ae),E&&ae.reach>E.reach&&(E.reach=ae.reach)}}}}}}function c(){var C={value:null,prev:null,next:null},$={value:null,prev:C,next:null};C.next=$,this.head=C,this.tail=$,this.length=0}function d(C,$,S){var M=$.next,D={value:S,prev:$,next:M};return $.next=D,M.prev=D,C.length++,D}function m(C,$,S){for(var M=$.next,D=0;D/,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 o={};o["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:t.languages[l]},o.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:o}};r["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:r},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>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var i="Loading\u2026",s=function(v,b){return"\u2716 Error "+v+" while fetching file: "+b},l="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",u="loaded",f="failed",c="pre[data-src]:not(["+r+'="'+u+'"]):not(['+r+'="'+a+'"])';function d(v,b,y){var C=new XMLHttpRequest;C.open("GET",v,!0),C.onreadystatechange=function(){C.readyState==4&&(C.status<400&&C.responseText?b(C.responseText):C.status>=400?y(s(C.status,C.statusText)):y(l))},C.send(null)}function m(v){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(v||"");if(b){var y=Number(b[1]),C=b[2],$=b[3];return C?$?[y,Number($)]:[y,void 0]:[y,y]}}t.hooks.add("before-highlightall",function(v){v.selector+=", "+c}),t.hooks.add("before-sanity-check",function(v){var b=v.element;if(b.matches(c)){v.code="",b.setAttribute(r,a);var y=b.appendChild(document.createElement("CODE"));y.textContent=i;var C=b.getAttribute("data-src"),$=v.language;if($==="none"){var S=(/\.(\w+)$/.exec(C)||[,"none"])[1];$=o[S]||S}t.util.setLanguage(y,$),t.util.setLanguage(b,$);var M=t.plugins.autoloader;M&&M.loadLanguages($),d(C,function(D){b.setAttribute(r,u);var E=m(b.getAttribute("data-range"));if(E){var O=D.split(/\r\n?|\n/g),F=E[0],L=E[1]==null?O.length:E[1];F<0&&(F+=O.length),F=Math.max(0,Math.min(F-1,O.length)),L<0&&(L+=O.length),L=Math.max(0,Math.min(L,O.length)),D=O.slice(F,L).join(` -`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(F+1))}y.textContent=D,t.highlightElement(y)},function(D){b.setAttribute(r,f),y.textContent=D})}}),t.plugins.fileHighlight={highlight:function(b){for(var y=(b||document).querySelectorAll(c),C=0,$;$=y[C++];)t.highlightElement($)}};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)}}()})(r_);const Us=r_.exports;var gw={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(l,o){for(var r in o)o.hasOwnProperty(r)&&(l[r]=o[r]);return l};function t(l){this.defaults=e({},l)}function i(l){return l.replace(/-(\w)/g,function(o,r){return r.toUpperCase()})}function s(l){for(var o=0,r=0;r"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(M){var $=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(M.stack)||[])[1];if($){var C=document.getElementsByTagName("script");for(var S in C)if(C[S].src==$)return C[S]}return null}},isActive:function($,C,S){for(var M="no-"+C;$;){var D=$.classList;if(D.contains(C))return!0;if(D.contains(M))return!1;$=$.parentElement}return!!S}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function($,C){var S=r.util.clone(r.languages[$]);for(var M in C)S[M]=C[M];return S},insertBefore:function($,C,S,M){M=M||r.languages;var D=M[$],E={};for(var O in D)if(D.hasOwnProperty(O)){if(O==C)for(var F in S)S.hasOwnProperty(F)&&(E[F]=S[F]);S.hasOwnProperty(O)||(E[O]=D[O])}var L=M[$];return M[$]=E,r.languages.DFS(r.languages,function(H,j){j===L&&H!=$&&(this[H]=E)}),E},DFS:function $(C,S,M,D){D=D||{};var E=r.util.objId;for(var O in C)if(C.hasOwnProperty(O)){S.call(C,O,C[O],M||O);var F=C[O],L=r.util.type(F);L==="Object"&&!D[E(F)]?(D[E(F)]=!0,$(F,S,null,D)):L==="Array"&&!D[E(F)]&&(D[E(F)]=!0,$(F,S,O,D))}}},plugins:{},highlightAll:function($,C){r.highlightAllUnder(document,$,C)},highlightAllUnder:function($,C,S){var M={callback:S,container:$,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",M),M.elements=Array.prototype.slice.apply(M.container.querySelectorAll(M.selector)),r.hooks.run("before-all-elements-highlight",M);for(var D=0,E;E=M.elements[D++];)r.highlightElement(E,C===!0,M.callback)},highlightElement:function($,C,S){var M=r.util.getLanguage($),D=r.languages[M];r.util.setLanguage($,M);var E=$.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(E,M);var O=$.textContent,F={element:$,language:M,grammar:D,code:O};function L(j){F.highlightedCode=j,r.hooks.run("before-insert",F),F.element.innerHTML=F.highlightedCode,r.hooks.run("after-highlight",F),r.hooks.run("complete",F),S&&S.call(F.element)}if(r.hooks.run("before-sanity-check",F),E=F.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!F.code){r.hooks.run("complete",F),S&&S.call(F.element);return}if(r.hooks.run("before-highlight",F),!F.grammar){L(r.util.encode(F.code));return}if(C&&i.Worker){var H=new Worker(r.filename);H.onmessage=function(j){L(j.data)},H.postMessage(JSON.stringify({language:F.language,code:F.code,immediateClose:!0}))}else L(r.highlight(F.code,F.grammar,F.language))},highlight:function($,C,S){var M={code:$,grammar:C,language:S};if(r.hooks.run("before-tokenize",M),!M.grammar)throw new Error('The language "'+M.language+'" has no grammar.');return M.tokens=r.tokenize(M.code,M.grammar),r.hooks.run("after-tokenize",M),a.stringify(r.util.encode(M.tokens),M.language)},tokenize:function($,C){var S=C.rest;if(S){for(var M in S)C[M]=S[M];delete C.rest}var D=new c;return d(D,D.head,$),f($,D,C,D.head,0),g(D)},hooks:{all:{},add:function($,C){var S=r.hooks.all;S[$]=S[$]||[],S[$].push(C)},run:function($,C){var S=r.hooks.all[$];if(!(!S||!S.length))for(var M=0,D;D=S[M++];)D(C)}},Token:a};i.Prism=r;function a($,C,S,M){this.type=$,this.content=C,this.alias=S,this.length=(M||"").length|0}a.stringify=function $(C,S){if(typeof C=="string")return C;if(Array.isArray(C)){var M="";return C.forEach(function(L){M+=$(L,S)}),M}var D={type:C.type,content:$(C.content,S),tag:"span",classes:["token",C.type],attributes:{},language:S},E=C.alias;E&&(Array.isArray(E)?Array.prototype.push.apply(D.classes,E):D.classes.push(E)),r.hooks.run("wrap",D);var O="";for(var F in D.attributes)O+=" "+F+'="'+(D.attributes[F]||"").replace(/"/g,""")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+O+">"+D.content+""};function u($,C,S,M){$.lastIndex=C;var D=$.exec(S);if(D&&M&&D[1]){var E=D[1].length;D.index+=E,D[0]=D[0].slice(E)}return D}function f($,C,S,M,D,E){for(var O in S)if(!(!S.hasOwnProperty(O)||!S[O])){var F=S[O];F=Array.isArray(F)?F:[F];for(var L=0;L=E.reach);se+=J.value.length,J=J.next){var fe=J.value;if(C.length>$.length)return;if(!(fe instanceof a)){var ke=1,le;if(ie){if(le=u(W,se,$,Q),!le||le.index>=$.length)break;var be=le.index,ue=le.index+le[0].length,Me=se;for(Me+=J.value.length;be>=Me;)J=J.next,Me+=J.value.length;if(Me-=J.value.length,se=Me,J.value instanceof a)continue;for(var Z=J;Z!==C.tail&&(MeE.reach&&(E.reach=je);var Ne=J.prev;G&&(Ne=d(C,Ne,G),se+=G.length),p(C,Ne,ke);var qe=new a(O,j?r.tokenize(x,j):x,U,x);if(J=d(C,Ne,qe),_e&&d(C,J,_e),ke>1){var ae={cause:O+","+L,reach:je};f($,C,S,J.prev,se,ae),E&&ae.reach>E.reach&&(E.reach=ae.reach)}}}}}}function c(){var $={value:null,prev:null,next:null},C={value:null,prev:$,next:null};$.next=C,this.head=$,this.tail=C,this.length=0}function d($,C,S){var M=C.next,D={value:S,prev:C,next:M};return C.next=D,M.prev=D,$.length++,D}function p($,C,S){for(var M=C.next,D=0;D/,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 o={};o["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:t.languages[l]},o.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:o}};r["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:r},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>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var i="Loading\u2026",s=function(v,b){return"\u2716 Error "+v+" while fetching file: "+b},l="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",u="loaded",f="failed",c="pre[data-src]:not(["+r+'="'+u+'"]):not(['+r+'="'+a+'"])';function d(v,b,y){var $=new XMLHttpRequest;$.open("GET",v,!0),$.onreadystatechange=function(){$.readyState==4&&($.status<400&&$.responseText?b($.responseText):$.status>=400?y(s($.status,$.statusText)):y(l))},$.send(null)}function p(v){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(v||"");if(b){var y=Number(b[1]),$=b[2],C=b[3];return $?C?[y,Number(C)]:[y,void 0]:[y,y]}}t.hooks.add("before-highlightall",function(v){v.selector+=", "+c}),t.hooks.add("before-sanity-check",function(v){var b=v.element;if(b.matches(c)){v.code="",b.setAttribute(r,a);var y=b.appendChild(document.createElement("CODE"));y.textContent=i;var $=b.getAttribute("data-src"),C=v.language;if(C==="none"){var S=(/\.(\w+)$/.exec($)||[,"none"])[1];C=o[S]||S}t.util.setLanguage(y,C),t.util.setLanguage(b,C);var M=t.plugins.autoloader;M&&M.loadLanguages(C),d($,function(D){b.setAttribute(r,u);var E=p(b.getAttribute("data-range"));if(E){var O=D.split(/\r\n?|\n/g),F=E[0],L=E[1]==null?O.length:E[1];F<0&&(F+=O.length),F=Math.max(0,Math.min(F-1,O.length)),L<0&&(L+=O.length),L=Math.max(0,Math.min(L,O.length)),D=O.slice(F,L).join(` +`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(F+1))}y.textContent=D,t.highlightElement(y)},function(D){b.setAttribute(r,f),y.textContent=D})}}),t.plugins.fileHighlight={highlight:function(b){for(var y=(b||document).querySelectorAll(c),$=0,C;C=y[$++];)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)}}()})(a_);const Us=a_.exports;var bw={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(l,o){for(var r in o)o.hasOwnProperty(r)&&(l[r]=o[r]);return l};function t(l){this.defaults=e({},l)}function i(l){return l.replace(/-(\w)/g,function(o,r){return r.toUpperCase()})}function s(l){for(var o=0,r=0;ro&&(u[c]=` `+u[c],f=d)}r[a]=u.join("")}return r.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 o=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=o.normalize(l.code,l.settings);return}var r=l.element.parentNode;if(!(!l.code||!r||r.nodeName.toLowerCase()!=="pre")){for(var a=r.childNodes,u="",f="",c=!1,d=0;d{"content"in r&&t(1,i=r.content),"language"in r&&t(2,s=r.language)},n.$$.update=()=>{n.$$.dirty&2&&typeof Us<"u"&&i&&t(0,l=o(i))},[l,i,s]}class ln extends Fe{constructor(e){super(),Le(this,e,bw,_w,Pe,{content:1,language:2})}}const vw=n=>({}),ec=n=>({}),yw=n=>({}),tc=n=>({});function nc(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$=n[4]&&!n[2]&&ic(n);const S=n[18].header,M=On(S,n,n[17],tc);let D=n[4]&&n[2]&&sc(n);const E=n[18].default,O=On(E,n,n[17],null),F=n[18].footer,L=On(F,n,n[17],ec);return{c(){e=_("div"),t=_("div"),s=T(),l=_("div"),o=_("div"),$&&$.c(),r=T(),M&&M.c(),a=T(),D&&D.c(),u=T(),f=_("div"),O&&O.c(),c=T(),d=_("div"),L&&L.c(),h(t,"class","overlay"),h(o,"class","overlay-panel-section panel-header"),h(f,"class","overlay-panel-section panel-content"),h(d,"class","overlay-panel-section panel-footer"),h(l,"class",m="overlay-panel "+n[1]+" "+n[8]),ee(l,"popup",n[2]),h(e,"class","overlay-panel-container"),ee(e,"padded",n[2]),ee(e,"active",n[0])},m(H,j){w(H,e,j),p(e,t),p(e,s),p(e,l),p(l,o),$&&$.m(o,null),p(o,r),M&&M.m(o,null),p(o,a),D&&D.m(o,null),p(l,u),p(l,f),O&&O.m(f,null),n[20](f),p(l,c),p(l,d),L&&L.m(d,null),b=!0,y||(C=[X(t,"click",Qt(n[19])),X(f,"scroll",n[21])],y=!0)},p(H,j){n=H,n[4]&&!n[2]?$?$.p(n,j):($=ic(n),$.c(),$.m(o,r)):$&&($.d(1),$=null),M&&M.p&&(!b||j&131072)&&An(M,S,n,n[17],b?En(S,n[17],j,yw):Pn(n[17]),tc),n[4]&&n[2]?D?D.p(n,j):(D=sc(n),D.c(),D.m(o,null)):D&&(D.d(1),D=null),O&&O.p&&(!b||j&131072)&&An(O,E,n,n[17],b?En(E,n[17],j,null):Pn(n[17]),null),L&&L.p&&(!b||j&131072)&&An(L,F,n,n[17],b?En(F,n[17],j,vw):Pn(n[17]),ec),(!b||j&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&h(l,"class",m),j&262&&ee(l,"popup",n[2]),j&4&&ee(e,"padded",n[2]),j&1&&ee(e,"active",n[0])},i(H){b||(Lt(()=>{i||(i=at(t,bo,{duration:gs,opacity:0},!0)),i.run(1)}),A(M,H),A(O,H),A(L,H),Lt(()=>{v&&v.end(1),g=Xp(l,Un,n[2]?{duration:gs,y:-10}:{duration:gs,x:50}),g.start()}),b=!0)},o(H){i||(i=at(t,bo,{duration:gs,opacity:0},!1)),i.run(0),P(M,H),P(O,H),P(L,H),g&&g.invalidate(),v=Qp(l,Un,n[2]?{duration:gs,y:10}:{duration:gs,x:50}),b=!1},d(H){H&&k(e),H&&i&&i.end(),$&&$.d(),M&&M.d(H),D&&D.d(),O&&O.d(H),n[20](null),L&&L.d(H),H&&v&&v.end(),y=!1,st(C)}}}function ic(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',h(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=X(e,"click",Qt(n[5])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function sc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(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",Qt(n[5])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function kw(n){let e,t,i,s,l=n[0]&&nc(n);return{c(){e=_("div"),l&&l.c(),h(e,"class","overlay-panel-wrapper")},m(o,r){w(o,e,r),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(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=nc(o),l.c(),A(l,1),l.m(e,null)):l&&(De(),P(l,1,1,()=>{l=null}),Oe())},i(o){t||(A(l),t=!0)},o(o){P(l),t=!1},d(o){o&&k(e),l&&l.d(),n[22](null),i=!1,st(s)}}}let Zi;function a_(){return Zi=Zi||document.querySelector(".overlays"),Zi||(Zi=document.createElement("div"),Zi.classList.add("overlays"),document.body.appendChild(Zi)),Zi}let gs=150;function lc(){return 1e3+a_().querySelectorAll(".overlay-panel-container.active").length}function ww(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{active:o=!1}=e,{popup:r=!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 m=hn();let g,v,b,y,C="";function $(){typeof c=="function"&&c()===!1||t(0,o=!0)}function S(){typeof d=="function"&&d()===!1||t(0,o=!1)}function M(){return o}async function D(U){U?(b=document.activeElement,g==null||g.focus(),m("show")):(clearTimeout(y),b==null||b.focus(),m("hide")),await di(),E()}function E(){!g||(o?t(6,g.style.zIndex=lc(),g):t(6,g.style="",g))}function O(U){o&&f&&U.code=="Escape"&&!Y.isInput(U.target)&&g&&g.style.zIndex==lc()&&(U.preventDefault(),S())}function F(U){o&&L(v)}function L(U,K){K&&t(8,C=""),U&&(y||(y=setTimeout(()=>{if(clearTimeout(y),y=null,!U)return;if(U.scrollHeight-U.offsetHeight>0)t(8,C="scrollable");else{t(8,C="");return}U.scrollTop==0?t(8,C+=" scroll-top-reached"):U.scrollTop+U.offsetHeight==U.scrollHeight&&t(8,C+=" scroll-bottom-reached")},100)))}Jn(()=>(a_().appendChild(g),()=>{var U;clearTimeout(y),(U=g==null?void 0:g.classList)==null||U.add("hidden")}));const H=()=>a?S():!0;function j(U){he[U?"unshift":"push"](()=>{v=U,t(7,v)})}const Q=U=>L(U.target);function ie(U){he[U?"unshift":"push"](()=>{g=U,t(6,g)})}return n.$$set=U=>{"class"in U&&t(1,l=U.class),"active"in U&&t(0,o=U.active),"popup"in U&&t(2,r=U.popup),"overlayClose"in U&&t(3,a=U.overlayClose),"btnClose"in U&&t(4,u=U.btnClose),"escClose"in U&&t(12,f=U.escClose),"beforeOpen"in U&&t(13,c=U.beforeOpen),"beforeHide"in U&&t(14,d=U.beforeHide),"$$scope"in U&&t(17,s=U.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&D(o),n.$$.dirty&128&&L(v,!0),n.$$.dirty&64&&g&&E()},[o,l,r,a,u,S,g,v,C,O,F,L,f,c,d,$,M,s,i,H,j,Q,ie]}class Ci extends Fe{constructor(e){super(),Le(this,e,ww,kw,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 Sw(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function $w(n){let e,t=n[2].referer+"",i,s;return{c(){e=_("a"),i=R(t),h(e,"href",s=n[2].referer),h(e,"target","_blank"),h(e,"rel","noopener noreferrer")},m(l,o){w(l,e,o),p(e,i)},p(l,o){o&4&&t!==(t=l[2].referer+"")&&me(i,t),o&4&&s!==(s=l[2].referer)&&h(e,"href",s)},d(l){l&&k(e)}}}function Cw(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function Mw(n){let e,t;return e=new ln({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function Tw(n){var Ut;let e,t,i,s,l,o,r=n[2].id+"",a,u,f,c,d,m,g,v=n[2].status+"",b,y,C,$,S,M,D=((Ut=n[2].method)==null?void 0:Ut.toUpperCase())+"",E,O,F,L,H,j,Q=n[2].auth+"",ie,U,K,W,J,se,fe=n[2].url+"",ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe=n[2].ip+"",ae,re,ve,Je,nt,ut,ot=n[2].userAgent+"",Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Nt,Ft,Ct,Yt,Ge;function Mt(it,N){return it[2].referer?$w:Sw}let ct=Mt(n),Rt=ct(n);const Ht=[Mw,Cw],Tt=[];function ht(it,N){return N&4&&(ye=null),ye==null&&(ye=!Y.isEmpty(it[2].meta)),ye?0:1}return Ke=ht(n,-1),ft=Tt[Ke]=Ht[Ke](n),Yt=new wi({props:{date:n[2].created}}),{c(){e=_("table"),t=_("tbody"),i=_("tr"),s=_("td"),s.textContent="ID",l=T(),o=_("td"),a=R(r),u=T(),f=_("tr"),c=_("td"),c.textContent="Status",d=T(),m=_("td"),g=_("span"),b=R(v),y=T(),C=_("tr"),$=_("td"),$.textContent="Method",S=T(),M=_("td"),E=R(D),O=T(),F=_("tr"),L=_("td"),L.textContent="Auth",H=T(),j=_("td"),ie=R(Q),U=T(),K=_("tr"),W=_("td"),W.textContent="URL",J=T(),se=_("td"),ke=R(fe),le=T(),ue=_("tr"),Me=_("td"),Me.textContent="Referer",Z=T(),be=_("td"),Rt.c(),x=T(),G=_("tr"),_e=_("td"),_e.textContent="IP",je=T(),Ne=_("td"),ae=R(qe),re=T(),ve=_("tr"),Je=_("td"),Je.textContent="UserAgent",nt=T(),ut=_("td"),Xe=R(ot),ge=T(),pe=_("tr"),Ve=_("td"),Ve.textContent="Meta",mt=T(),te=_("td"),ft.c(),St=T(),$t=_("tr"),Nt=_("td"),Nt.textContent="Created",Ft=T(),Ct=_("td"),B(Yt.$$.fragment),h(s,"class","min-width txt-hint txt-bold"),h(c,"class","min-width txt-hint txt-bold"),h(g,"class","label"),ee(g,"label-danger",n[2].status>=400),h($,"class","min-width txt-hint txt-bold"),h(L,"class","min-width txt-hint txt-bold"),h(W,"class","min-width txt-hint txt-bold"),h(Me,"class","min-width txt-hint txt-bold"),h(_e,"class","min-width txt-hint txt-bold"),h(Je,"class","min-width txt-hint txt-bold"),h(Ve,"class","min-width txt-hint txt-bold"),h(Nt,"class","min-width txt-hint txt-bold"),h(e,"class","table-compact table-border")},m(it,N){w(it,e,N),p(e,t),p(t,i),p(i,s),p(i,l),p(i,o),p(o,a),p(t,u),p(t,f),p(f,c),p(f,d),p(f,m),p(m,g),p(g,b),p(t,y),p(t,C),p(C,$),p(C,S),p(C,M),p(M,E),p(t,O),p(t,F),p(F,L),p(F,H),p(F,j),p(j,ie),p(t,U),p(t,K),p(K,W),p(K,J),p(K,se),p(se,ke),p(t,le),p(t,ue),p(ue,Me),p(ue,Z),p(ue,be),Rt.m(be,null),p(t,x),p(t,G),p(G,_e),p(G,je),p(G,Ne),p(Ne,ae),p(t,re),p(t,ve),p(ve,Je),p(ve,nt),p(ve,ut),p(ut,Xe),p(t,ge),p(t,pe),p(pe,Ve),p(pe,mt),p(pe,te),Tt[Ke].m(te,null),p(t,St),p(t,$t),p($t,Nt),p($t,Ft),p($t,Ct),V(Yt,Ct,null),Ge=!0},p(it,N){var ne;(!Ge||N&4)&&r!==(r=it[2].id+"")&&me(a,r),(!Ge||N&4)&&v!==(v=it[2].status+"")&&me(b,v),N&4&&ee(g,"label-danger",it[2].status>=400),(!Ge||N&4)&&D!==(D=((ne=it[2].method)==null?void 0:ne.toUpperCase())+"")&&me(E,D),(!Ge||N&4)&&Q!==(Q=it[2].auth+"")&&me(ie,Q),(!Ge||N&4)&&fe!==(fe=it[2].url+"")&&me(ke,fe),ct===(ct=Mt(it))&&Rt?Rt.p(it,N):(Rt.d(1),Rt=ct(it),Rt&&(Rt.c(),Rt.m(be,null))),(!Ge||N&4)&&qe!==(qe=it[2].ip+"")&&me(ae,qe),(!Ge||N&4)&&ot!==(ot=it[2].userAgent+"")&&me(Xe,ot);let I=Ke;Ke=ht(it,N),Ke===I?Tt[Ke].p(it,N):(De(),P(Tt[I],1,1,()=>{Tt[I]=null}),Oe(),ft=Tt[Ke],ft?ft.p(it,N):(ft=Tt[Ke]=Ht[Ke](it),ft.c()),A(ft,1),ft.m(te,null));const q={};N&4&&(q.date=it[2].created),Yt.$set(q)},i(it){Ge||(A(ft),A(Yt.$$.fragment,it),Ge=!0)},o(it){P(ft),P(Yt.$$.fragment,it),Ge=!1},d(it){it&&k(e),Rt.d(),Tt[Ke].d(),z(Yt)}}}function Dw(n){let e;return{c(){e=_("h4"),e.textContent="Request log"},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Ow(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Close',h(e,"type","button"),h(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[4]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Ew(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[Ow],header:[Dw],default:[Tw]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&260&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[5](null),z(e,s)}}}function Aw(n,e,t){let i,s=new Or;function l(c){return t(2,s=c),i==null?void 0:i.show()}function o(){return i==null?void 0:i.hide()}const r=()=>o();function a(c){he[c?"unshift":"push"](()=>{i=c,t(1,i)})}function u(c){pt.call(this,n,c)}function f(c){pt.call(this,n,c)}return[o,i,s,l,r,a,u,f]}class Pw extends Fe{constructor(e){super(),Le(this,e,Aw,Ew,Pe,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function Lw(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Include requests by admins"),h(e,"type","checkbox"),h(e,"id",t=n[14]),h(s,"for",o=n[14])},m(u,f){w(u,e,f),e.checked=n[0],w(u,i,f),w(u,s,f),p(s,l),r||(a=X(e,"change",n[8]),r=!0)},p(u,f){f&16384&&t!==(t=u[14])&&h(e,"id",t),f&1&&(e.checked=u[0]),f&16384&&o!==(o=u[14])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function oc(n){let e,t,i;function s(o){n[10](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new mw({props:l}),he.push(()=>Re(e,"filter",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function rc(n){let e,t,i;function s(o){n[11](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new L1({props:l}),he.push(()=>Re(e,"filter",s)),e.$on("select",n[12]),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function Fw(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$=n[3],S,M=n[3],D,E,O;a=new zo({}),a.$on("refresh",n[7]),m=new Ie({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[Lw,({uniqueId:j})=>({14:j}),({uniqueId:j})=>j?16384:0]},$$scope:{ctx:n}}}),v=new Vo({props:{value:n[2],placeholder:"Search logs, ex. status > 200",extraAutocompleteKeys:["method","url","ip","referer","status","auth","userAgent"]}}),v.$on("submit",n[9]);let F=oc(n),L=rc(n),H={};return E=new Pw({props:H}),n[13](E),{c(){e=_("main"),t=_("div"),i=_("header"),s=_("nav"),l=_("div"),o=R(n[5]),r=T(),B(a.$$.fragment),u=T(),f=_("div"),c=T(),d=_("div"),B(m.$$.fragment),g=T(),B(v.$$.fragment),b=T(),y=_("div"),C=T(),F.c(),S=T(),L.c(),D=T(),B(E.$$.fragment),h(l,"class","breadcrumb-item"),h(s,"class","breadcrumbs"),h(f,"class","flex-fill"),h(d,"class","inline-flex"),h(i,"class","page-header"),h(y,"class","clearfix m-b-xs"),h(t,"class","page-header-wrapper m-b-0"),h(e,"class","page-wrapper")},m(j,Q){w(j,e,Q),p(e,t),p(t,i),p(i,s),p(s,l),p(l,o),p(i,r),V(a,i,null),p(i,u),p(i,f),p(i,c),p(i,d),V(m,d,null),p(t,g),V(v,t,null),p(t,b),p(t,y),p(t,C),F.m(t,null),p(e,S),L.m(e,null),w(j,D,Q),V(E,j,Q),O=!0},p(j,[Q]){(!O||Q&32)&&me(o,j[5]);const ie={};Q&49153&&(ie.$$scope={dirty:Q,ctx:j}),m.$set(ie);const U={};Q&4&&(U.value=j[2]),v.$set(U),Q&8&&Pe($,$=j[3])?(De(),P(F,1,1,oe),Oe(),F=oc(j),F.c(),A(F,1),F.m(t,null)):F.p(j,Q),Q&8&&Pe(M,M=j[3])?(De(),P(L,1,1,oe),Oe(),L=rc(j),L.c(),A(L,1),L.m(e,null)):L.p(j,Q);const K={};E.$set(K)},i(j){O||(A(a.$$.fragment,j),A(m.$$.fragment,j),A(v.$$.fragment,j),A(F),A(L),A(E.$$.fragment,j),O=!0)},o(j){P(a.$$.fragment,j),P(m.$$.fragment,j),P(v.$$.fragment,j),P(F),P(L),P(E.$$.fragment,j),O=!1},d(j){j&&k(e),z(a),z(m),z(v),F.d(j),L.d(j),j&&k(D),n[13](null),z(E,j)}}}const ac="includeAdminLogs";function Iw(n,e,t){var y;let i,s;qt(n,nn,C=>t(5,s=C)),wn(nn,s="Request logs",s);let l,o="",r=((y=window.localStorage)==null?void 0:y.getItem(ac))<<0,a=1;function u(){t(3,a++,a)}const f=()=>u();function c(){r=this.checked,t(0,r)}const d=C=>t(2,o=C.detail);function m(C){o=C,t(2,o)}function g(C){o=C,t(2,o)}const v=C=>l==null?void 0:l.show(C==null?void 0:C.detail);function b(C){he[C?"unshift":"push"](()=>{l=C,t(1,l)})}return n.$$.update=()=>{n.$$.dirty&1&&t(4,i=r?"":'auth!="admin"'),n.$$.dirty&1&&typeof r<"u"&&window.localStorage&&window.localStorage.setItem(ac,r<<0)},[r,l,o,a,i,s,u,f,c,d,m,g,v,b]}class Nw extends Fe{constructor(e){super(),Le(this,e,Iw,Fw,Pe,{})}}const Ms=si([]),ui=si({}),ea=si(!1);function Rw(n){ui.update(e=>Y.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Ms.update(e=>(Y.pushOrReplaceByKey(e,n,"id"),e))}function Hw(n){Ms.update(e=>(Y.removeByKey(e,"id",n.id),ui.update(t=>t.id===n.id?e.find(i=>i.name!="profiles")||{}:t),e))}async function jw(n=null){return ea.set(!0),ui.set({}),Ms.set([]),Se.Collections.getFullList(200,{sort:"+created"}).then(e=>{Ms.set(e);const t=n&&Y.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(()=>{ea.set(!1)})}const Va=si({});function Si(n,e,t){Va.set({text:n,yesCallback:e,noCallback:t})}function u_(){Va.set({})}function uc(n){let e,t,i,s;const l=n[13].default,o=On(l,n,n[12],null);return{c(){e=_("div"),o&&o.c(),h(e,"class",n[1]),ee(e,"active",n[0])},m(r,a){w(r,e,a),o&&o.m(e,null),s=!0},p(r,a){o&&o.p&&(!s||a&4096)&&An(o,l,r,r[12],s?En(l,r[12],a,null):Pn(r[12]),null),(!s||a&2)&&h(e,"class",r[1]),a&3&&ee(e,"active",r[0])},i(r){s||(A(o,r),r&&Lt(()=>{i&&i.end(1),t=Xp(e,Un,{duration:150,y:-5}),t.start()}),s=!0)},o(r){P(o,r),t&&t.invalidate(),r&&(i=Qp(e,Un,{duration:150,y:2})),s=!1},d(r){r&&k(e),o&&o.d(r),r&&i&&i.end()}}}function qw(n){let e,t,i,s,l=n[0]&&uc(n);return{c(){e=_("div"),l&&l.c(),h(e,"class","toggler-container")},m(o,r){w(o,e,r),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(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=uc(o),l.c(),A(l,1),l.m(e,null)):l&&(De(),P(l,1,1,()=>{l=null}),Oe())},i(o){t||(A(l),t=!0)},o(o){P(l),t=!1},d(o){o&&k(e),l&&l.d(),n[14](null),i=!1,st(s)}}}function Vw(n,e,t){let{$$slots:i={},$$scope:s}=e,{trigger:l=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{closableClass:a="closable"}=e,{class:u=""}=e,f;const c=hn();function d(){t(0,o=!1)}function m(){t(0,o=!0)}function g(){o?d():m()}function v(D){return!f||D.classList.contains(a)||(l==null?void 0:l.contains(D))&&!f.contains(D)||f.contains(D)&&D.closest&&D.closest("."+a)}function b(D){(!o||v(D.target))&&(D.preventDefault(),g())}function y(D){(D.code==="Enter"||D.code==="Space")&&(!o||v(D.target))&&(D.preventDefault(),D.stopPropagation(),g())}function C(D){o&&!(f!=null&&f.contains(D.target))&&!(l!=null&&l.contains(D.target))&&d()}function $(D){o&&r&&D.code=="Escape"&&(D.preventDefault(),d())}function S(D){return C(D)}Jn(()=>(t(6,l=l||f.parentNode),l.addEventListener("click",b),l.addEventListener("keydown",y),()=>{l.removeEventListener("click",b),l.removeEventListener("keydown",y)}));function M(D){he[D?"unshift":"push"](()=>{f=D,t(2,f)})}return n.$$set=D=>{"trigger"in D&&t(6,l=D.trigger),"active"in D&&t(0,o=D.active),"escClose"in D&&t(7,r=D.escClose),"closableClass"in D&&t(8,a=D.closableClass),"class"in D&&t(1,u=D.class),"$$scope"in D&&t(12,s=D.$$scope)},n.$$.update=()=>{var D,E;n.$$.dirty&65&&(o?((D=l==null?void 0:l.classList)==null||D.add("active"),c("show")):((E=l==null?void 0:l.classList)==null||E.remove("active"),c("hide")))},[o,u,f,C,$,S,l,r,a,d,m,g,s,i,M]}class qi extends Fe{constructor(e){super(),Le(this,e,Vw,qw,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 zw=n=>({active:n&1}),fc=n=>({active:n[0]});function cc(n){let e,t,i;const s=n[12].default,l=On(s,n,n[11],null);return{c(){e=_("div"),l&&l.c(),h(e,"class","accordion-content")},m(o,r){w(o,e,r),l&&l.m(e,null),i=!0},p(o,r){l&&l.p&&(!i||r&2048)&&An(l,s,o,o[11],i?En(s,o[11],r,null):Pn(o[11]),null)},i(o){i||(A(l,o),o&&Lt(()=>{t||(t=at(e,on,{duration:150},!0)),t.run(1)}),i=!0)},o(o){P(l,o),o&&(t||(t=at(e,on,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&k(e),l&&l.d(o),o&&t&&t.end()}}}function Bw(n){let e,t,i,s,l,o,r,a;const u=n[12].header,f=On(u,n,n[11],fc);let c=n[0]&&cc(n);return{c(){e=_("div"),t=_("header"),f&&f.c(),i=T(),c&&c.c(),h(t,"class","accordion-header"),ee(t,"interactive",n[2]),h(e,"tabindex",s=n[2]?0:-1),h(e,"class",l="accordion "+n[1]),ee(e,"active",n[0])},m(d,m){w(d,e,m),p(e,t),f&&f.m(t,null),p(e,i),c&&c.m(e,null),n[14](e),o=!0,r||(a=[X(t,"click",Qt(n[13])),X(e,"keydown",Wp(n[5]))],r=!0)},p(d,[m]){f&&f.p&&(!o||m&2049)&&An(f,u,d,d[11],o?En(u,d[11],m,zw):Pn(d[11]),fc),m&4&&ee(t,"interactive",d[2]),d[0]?c?(c.p(d,m),m&1&&A(c,1)):(c=cc(d),c.c(),A(c,1),c.m(e,null)):c&&(De(),P(c,1,1,()=>{c=null}),Oe()),(!o||m&4&&s!==(s=d[2]?0:-1))&&h(e,"tabindex",s),(!o||m&2&&l!==(l="accordion "+d[1]))&&h(e,"class",l),m&3&&ee(e,"active",d[0])},i(d){o||(A(f,d),A(c),o=!0)},o(d){P(f,d),P(c),o=!1},d(d){d&&k(e),f&&f.d(d),c&&c.d(),n[14](null),r=!1,st(a)}}}function Uw(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=hn();let o,r,{class:a=""}=e,{active:u=!1}=e,{interactive:f=!0}=e,{single:c=!1}=e;function d(){v(),t(0,u=!0),l("expand")}function m(){t(0,u=!1),clearTimeout(r),l("collapse")}function g(){l("toggle"),u?m():d()}function v(){if(c&&o.parentElement){const $=o.parentElement.querySelectorAll(".accordion.active .accordion-header.interactive");for(const S of $)S.click()}}function b($){!f||($.code==="Enter"||$.code==="Space")&&($.preventDefault(),g())}Jn(()=>()=>clearTimeout(r));const y=()=>f&&g();function C($){he[$?"unshift":"push"](()=>{o=$,t(4,o)})}return n.$$set=$=>{"class"in $&&t(1,a=$.class),"active"in $&&t(0,u=$.active),"interactive"in $&&t(2,f=$.interactive),"single"in $&&t(6,c=$.single),"$$scope"in $&&t(11,s=$.$$scope)},n.$$.update=()=>{n.$$.dirty&1041&&u&&(clearTimeout(r),t(10,r=setTimeout(()=>{o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},250)))},[u,a,f,g,o,b,c,d,m,v,r,s,i,y,C]}class za extends Fe{constructor(e){super(),Le(this,e,Uw,Bw,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 Ww=n=>({}),dc=n=>({});function hc(n,e,t){const i=n.slice();return i[46]=e[t],i}function pc(n,e,t){const i=n.slice();return i[49]=e[t],i}const Yw=n=>({}),mc=n=>({});function gc(n,e,t){const i=n.slice();return i[49]=e[t],i}function _c(n){let e,t;return{c(){e=_("div"),t=R(n[2]),h(e,"class","txt-placeholder")},m(i,s){w(i,e,s),p(e,t)},p(i,s){s[0]&4&&me(t,i[2])},d(i){i&&k(e)}}}function Kw(n){let e,t=n[49]+"",i;return{c(){e=_("span"),i=R(t),h(e,"class","txt")},m(s,l){w(s,e,l),p(e,i)},p(s,l){l[0]&1&&t!==(t=s[49]+"")&&me(i,t)},i:oe,o:oe,d(s){s&&k(e)}}}function Zw(n){let e,t,i;const s=[{item:n[49]},n[8]];var l=n[7];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function bc(n){let e,t,i;function s(){return n[34](n[49])}return{c(){e=_("span"),e.innerHTML='',h(e,"class","clear")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Clear")),X(e,"click",ni(Qt(s)))],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function vc(n){let e,t,i,s,l,o;const r=[Zw,Kw],a=[];function u(c,d){return c[7]?0:1}t=u(n),i=a[t]=r[t](n);let f=(n[4]||n[6])&&bc(n);return{c(){e=_("div"),i.c(),s=T(),f&&f.c(),l=T(),h(e,"class","option")},m(c,d){w(c,e,d),a[t].m(e,null),p(e,s),f&&f.m(e,null),p(e,l),o=!0},p(c,d){let m=t;t=u(c),t===m?a[t].p(c,d):(De(),P(a[m],1,1,()=>{a[m]=null}),Oe(),i=a[t],i?i.p(c,d):(i=a[t]=r[t](c),i.c()),A(i,1),i.m(e,s)),c[4]||c[6]?f?f.p(c,d):(f=bc(c),f.c(),f.m(e,l)):f&&(f.d(1),f=null)},i(c){o||(A(i),o=!0)},o(c){P(i),o=!1},d(c){c&&k(e),a[t].d(),f&&f.d()}}}function yc(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left",trigger:n[17],$$slots:{default:[Xw]},$$scope:{ctx:n}};return e=new qi({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 o={};l[0]&131072&&(o.trigger=s[17]),l[0]&806410|l[1]&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[39](null),z(e,s)}}}function kc(n){let e,t,i,s,l,o,r,a,u=n[14].length&&wc(n);return{c(){e=_("div"),t=_("label"),i=_("div"),i.innerHTML='',s=T(),l=_("input"),o=T(),u&&u.c(),h(i,"class","addon p-r-0"),l.autofocus=!0,h(l,"type","text"),h(l,"placeholder",n[3]),h(t,"class","input-group"),h(e,"class","form-field form-field-sm options-search")},m(f,c){w(f,e,c),p(e,t),p(t,i),p(t,s),p(t,l),$e(l,n[14]),p(t,o),u&&u.m(t,null),l.focus(),r||(a=X(l,"input",n[36]),r=!0)},p(f,c){c[0]&8&&h(l,"placeholder",f[3]),c[0]&16384&&l.value!==f[14]&&$e(l,f[14]),f[14].length?u?u.p(f,c):(u=wc(f),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},d(f){f&&k(e),u&&u.d(),r=!1,a()}}}function wc(n){let e,t,i,s;return{c(){e=_("div"),t=_("button"),t.innerHTML='',h(t,"type","button"),h(t,"class","btn btn-sm btn-circle btn-secondary clear"),h(e,"class","addon suffix p-r-5")},m(l,o){w(l,e,o),p(e,t),i||(s=X(t,"click",ni(Qt(n[20]))),i=!0)},p:oe,d(l){l&&k(e),i=!1,s()}}}function Sc(n){let e,t=n[1]&&$c(n);return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1]?t?t.p(i,s):(t=$c(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function $c(n){let e,t;return{c(){e=_("div"),t=R(n[1]),h(e,"class","txt-missing")},m(i,s){w(i,e,s),p(e,t)},p(i,s){s[0]&2&&me(t,i[1])},d(i){i&&k(e)}}}function Cc(n){let e,t=n[46].group+"",i;return{c(){e=_("div"),i=R(t),h(e,"class","dropdown-item separator")},m(s,l){w(s,e,l),p(e,i)},p(s,l){l[0]&524288&&t!==(t=s[46].group+"")&&me(i,t)},d(s){s&&k(e)}}}function Jw(n){let e=n[49]+"",t;return{c(){t=R(e)},m(i,s){w(i,t,s)},p(i,s){s[0]&524288&&e!==(e=i[49]+"")&&me(t,e)},i:oe,o:oe,d(i){i&&k(t)}}}function Gw(n){let e,t,i;const s=[{item:n[49]},n[10]];var l=n[9];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function Mc(n){let e,t,i,s,l,o,r;const a=[Gw,Jw],u=[];function f(m,g){return m[9]?0:1}t=f(n),i=u[t]=a[t](n);function c(...m){return n[37](n[49],...m)}function d(...m){return n[38](n[49],...m)}return{c(){e=_("div"),i.c(),s=T(),h(e,"tabindex","0"),h(e,"class","dropdown-item option closable"),ee(e,"selected",n[18](n[49]))},m(m,g){w(m,e,g),u[t].m(e,null),p(e,s),l=!0,o||(r=[X(e,"click",c),X(e,"keydown",d)],o=!0)},p(m,g){n=m;let v=t;t=f(n),t===v?u[t].p(n,g):(De(),P(u[v],1,1,()=>{u[v]=null}),Oe(),i=u[t],i?i.p(n,g):(i=u[t]=a[t](n),i.c()),A(i,1),i.m(e,s)),g[0]&786432&&ee(e,"selected",n[18](n[49]))},i(m){l||(A(i),l=!0)},o(m){P(i),l=!1},d(m){m&&k(e),u[t].d(),o=!1,st(r)}}}function Tc(n){let e,t,i,s=n[46].group!=ta&&Cc(n),l=n[46].items,o=[];for(let a=0;aP(o[a],1,1,()=>{o[a]=null});return{c(){s&&s.c(),e=T();for(let a=0;aP(f[v],1,1,()=>{f[v]=null});let d=null;u.length||(d=Sc(n));const m=n[33].afterOptions,g=On(m,n,n[42],dc);return{c(){o&&o.c(),e=T(),a&&a.c(),t=T(),i=_("div");for(let v=0;vP(a[d],1,1,()=>{a[d]=null});let f=null;r.length||(f=_c(n));let c=!n[5]&&yc(n);return{c(){e=_("div"),t=_("div");for(let d=0;d{c=null}),Oe()):c?(c.p(d,m),m[0]&32&&A(c,1)):(c=yc(d),c.c(),A(c,1),c.m(e,null)),(!o||m[0]&4096&&l!==(l="select "+d[12]))&&h(e,"class",l),m[0]&4112&&ee(e,"multiple",d[4]),m[0]&4128&&ee(e,"disabled",d[5])},i(d){if(!o){for(let m=0;mJe(Xe,re)))||[]:ot=ut.items||[],ot.length&&ve.push({group:ut.group,items:ot})}return ve}function ke(ae,re){ae.preventDefault(),b&&m?ie(re):Q(re)}function le(ae,re){(ae.code==="Enter"||ae.code==="Space")&&ke(ae,re)}function ue(){se(),setTimeout(()=>{const ae=L==null?void 0:L.querySelector(".dropdown-item.option.selected");ae&&(ae.focus(),ae.scrollIntoView({block:"nearest"}))},0)}function Me(ae){ae.stopPropagation(),!g&&(O==null||O.toggle())}Jn(()=>{const ae=document.querySelectorAll(`label[for="${a}"]`);for(const re of ae)re.addEventListener("click",Me);return()=>{for(const re of ae)re.removeEventListener("click",Me)}});const Z=ae=>j(ae);function be(ae){he[ae?"unshift":"push"](()=>{H=ae,t(17,H)})}function x(){F=this.value,t(14,F)}const G=(ae,re)=>ke(re,ae),_e=(ae,re)=>le(re,ae);function je(ae){he[ae?"unshift":"push"](()=>{O=ae,t(15,O)})}function Ne(ae){pt.call(this,n,ae)}function qe(ae){he[ae?"unshift":"push"](()=>{L=ae,t(16,L)})}return n.$$set=ae=>{"id"in ae&&t(24,a=ae.id),"noOptionsText"in ae&&t(1,u=ae.noOptionsText),"selectPlaceholder"in ae&&t(2,f=ae.selectPlaceholder),"searchPlaceholder"in ae&&t(3,c=ae.searchPlaceholder),"items"in ae&&t(25,d=ae.items),"multiple"in ae&&t(4,m=ae.multiple),"disabled"in ae&&t(5,g=ae.disabled),"selected"in ae&&t(0,v=ae.selected),"toggle"in ae&&t(6,b=ae.toggle),"labelComponent"in ae&&t(7,y=ae.labelComponent),"labelComponentProps"in ae&&t(8,C=ae.labelComponentProps),"optionComponent"in ae&&t(9,$=ae.optionComponent),"optionComponentProps"in ae&&t(10,S=ae.optionComponentProps),"searchable"in ae&&t(11,M=ae.searchable),"searchFunc"in ae&&t(26,D=ae.searchFunc),"class"in ae&&t(12,E=ae.class),"$$scope"in ae&&t(42,r=ae.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&t(32,i=Y.isObjectArrayWithKeys(d,["group"])?d:[{group:ta,items:d}]),n.$$.dirty[0]&33554432&&d&&(J(),se()),n.$$.dirty[0]&16384|n.$$.dirty[1]&2&&t(19,s=fe(i,F)),n.$$.dirty[0]&1&&t(18,l=function(ae){let re=Y.toArray(v);return Y.inArray(re,ae)})},[v,u,f,c,m,g,b,y,C,$,S,M,E,j,F,O,L,H,l,s,se,ke,le,ue,a,d,D,Q,ie,U,K,W,i,o,Z,be,x,G,_e,je,Ne,qe,r]}class f_ extends Fe{constructor(e){super(),Le(this,e,eS,Qw,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 Dc(n){let e,t;return{c(){e=_("i"),h(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)&&h(e,"class",t)},d(i){i&&k(e)}}}function tS(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&&Dc(n);return{c(){l&&l.c(),e=T(),t=_("span"),s=R(i),h(t,"class","txt")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),p(t,s)},p(o,[r]){o[0].icon?l?l.p(o,r):(l=Dc(o),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),r&1&&i!==(i=(o[0].label||o[0].name||o[0].title||o[0].id||o[0].value)+"")&&me(s,i)},i:oe,o:oe,d(o){l&&l.d(o),o&&k(e),o&&k(t)}}}function nS(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class Oc extends Fe{constructor(e){super(),Le(this,e,nS,tS,Pe,{item:0})}}const iS=n=>({}),Ec=n=>({});function sS(n){let e;const t=n[8].afterOptions,i=On(t,n,n[12],Ec);return{c(){i&&i.c()},m(s,l){i&&i.m(s,l),e=!0},p(s,l){i&&i.p&&(!e||l&4096)&&An(i,t,s,s[12],e?En(t,s[12],l,iS):Pn(s[12]),Ec)},i(s){e||(A(i,s),e=!0)},o(s){P(i,s),e=!1},d(s){i&&i.d(s)}}}function lS(n){let e,t,i;const s=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function l(r){n[9](r)}let o={$$slots:{afterOptions:[sS]},$$scope:{ctx:n}};for(let r=0;rRe(e,"selected",l)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){B(e.$$.fragment)},m(r,a){V(e,r,a),i=!0},p(r,[a]){const u=a&62?bn(s,[a&2&&{items:r[1]},a&4&&{multiple:r[2]},a&8&&{labelComponent:r[3]},a&16&&{optionComponent:r[4]},a&32&&hi(r[5])]):{};a&4096&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.selected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function oS(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let s=tn(e,i),{$$slots:l={},$$scope:o}=e,{items:r=[]}=e,{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{labelComponent:f=Oc}=e,{optionComponent:c=Oc}=e,{selectionKey:d="value"}=e,{keyOfSelected:m=a?[]:void 0}=e;function g(S){S=Y.toArray(S,!0);let M=[],D=b();for(let E of D)Y.inArray(S,E[d])&&M.push(E);S.length&&!M.length||t(0,u=a?M:M[0])}async function v(S){let M=Y.toArray(S,!0).map(D=>D[d]);!r.length||t(6,m=a?M:M[0])}function b(){if(!Y.isObjectArrayWithKeys(r,["group","items"]))return r;let S=[];for(const M of r)S=S.concat(M.items);return S}function y(S){u=S,t(0,u)}function C(S){pt.call(this,n,S)}function $(S){pt.call(this,n,S)}return n.$$set=S=>{e=_t(_t({},e),ci(S)),t(5,s=tn(e,i)),"items"in S&&t(1,r=S.items),"multiple"in S&&t(2,a=S.multiple),"selected"in S&&t(0,u=S.selected),"labelComponent"in S&&t(3,f=S.labelComponent),"optionComponent"in S&&t(4,c=S.optionComponent),"selectionKey"in S&&t(7,d=S.selectionKey),"keyOfSelected"in S&&t(6,m=S.keyOfSelected),"$$scope"in S&&t(12,o=S.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&r&&g(m),n.$$.dirty&1&&v(u)},[u,r,a,f,c,s,m,d,l,y,C,$,o]}class us extends Fe{constructor(e){super(),Le(this,e,oS,lS,Pe,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function rS(n){let e,t,i;const s=[{class:"field-type-select "+n[1]},{searchable:!0},{items:n[2]},n[3]];function l(r){n[4](r)}let o={};for(let r=0;rRe(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(r,a){V(e,r,a),i=!0},p(r,[a]){const u=a&14?bn(s,[a&2&&{class:"field-type-select "+r[1]},s[1],a&4&&{items:r[2]},a&8&&hi(r[3])]):{};!t&&a&1&&(t=!0,u.keyOfSelected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function aS(n,e,t){const i=["value","class"];let s=tn(e,i),{value:l="text"}=e,{class:o=""}=e;const r=[{label:"Text",value:"text",icon:Y.getFieldTypeIcon("text")},{label:"Number",value:"number",icon:Y.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:Y.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:Y.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:Y.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:Y.getFieldTypeIcon("date")},{label:"Multiple choices",value:"select",icon:Y.getFieldTypeIcon("select")},{label:"JSON",value:"json",icon:Y.getFieldTypeIcon("json")},{label:"File",value:"file",icon:Y.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:Y.getFieldTypeIcon("relation")},{label:"User",value:"user",icon:Y.getFieldTypeIcon("user")}];function a(u){l=u,t(0,l)}return n.$$set=u=>{e=_t(_t({},e),ci(u)),t(3,s=tn(e,i)),"value"in u&&t(0,l=u.value),"class"in u&&t(1,o=u.class)},[l,o,r,s,a]}class uS extends Fe{constructor(e){super(),Le(this,e,aS,rS,Pe,{value:0,class:1})}}function fS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Min length"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(l,"min","0")},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].min),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&h(e,"for",i),f&32&&o!==(o=u[5])&&h(l,"id",o),f&1&&It(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function cS(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=R("Max length"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(l,"min",r=n[0].min||0)},m(f,c){w(f,e,c),p(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])&&h(e,"for",i),c&32&&o!==(o=f[5])&&h(l,"id",o),c&1&&r!==(r=f[0].min||0)&&h(l,"min",r),c&1&&It(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 dS(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=R("Regex pattern"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML="Valid Go regular expression, eg. ^\\w+$.",h(e,"for",i=n[5]),h(l,"type","text"),h(l,"id",o=n[5]),h(a,"class","help-block")},m(c,d){w(c,e,d),p(e,t),w(c,s,d),w(c,l,d),$e(l,n[0].pattern),w(c,r,d),w(c,a,d),u||(f=X(l,"input",n[4]),u=!0)},p(c,d){d&32&&i!==(i=c[5])&&h(e,"for",i),d&32&&o!==(o=c[5])&&h(l,"id",o),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(r),c&&k(a),u=!1,f()}}}function hS(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[fS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[cS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[dS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(a,"class","col-sm-12"),h(e,"class","grid")},m(c,d){w(c,e,d),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),p(e,r),p(e,a),V(u,a,null),f=!0},p(c,[d]){const m={};d&2&&(m.name="schema."+c[1]+".options.min"),d&97&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const g={};d&2&&(g.name="schema."+c[1]+".options.max"),d&97&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);const v={};d&2&&(v.name="schema."+c[1]+".options.pattern"),d&97&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){P(i.$$.fragment,c),P(o.$$.fragment,c),P(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(o),z(u)}}}function pS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=It(this.value),t(0,s)}function o(){s.max=It(this.value),t(0,s)}function r(){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,o,r]}class mS extends Fe{constructor(e){super(),Le(this,e,pS,hS,Pe,{key:1,options:0})}}function gS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Min"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=n[4])},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].min),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&16&&i!==(i=u[4])&&h(e,"for",i),f&16&&o!==(o=u[4])&&h(l,"id",o),f&1&&It(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function _S(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=R("Max"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=n[4]),h(l,"min",r=n[0].min)},m(f,c){w(f,e,c),p(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])&&h(e,"for",i),c&16&&o!==(o=f[4])&&h(l,"id",o),c&1&&r!==(r=f[0].min)&&h(l,"min",r),c&1&&It(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 bS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[gS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[_S,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function vS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=It(this.value),t(0,s)}function o(){s.max=It(this.value),t(0,s)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class yS extends Fe{constructor(e){super(),Le(this,e,vS,bS,Pe,{key:1,options:0})}}function kS(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 wS extends Fe{constructor(e){super(),Le(this,e,kS,null,Pe,{key:0,options:1})}}function SS(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],o={};for(let r=0;r{t(0,o=Y.splitNonEmpty(u.target.value,r))};return n.$$set=u=>{e=_t(_t({},e),ci(u)),t(3,l=tn(e,s)),"value"in u&&t(0,o=u.value),"separator"in u&&t(1,r=u.separator)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=(o||[]).join(","))},[o,r,i,l,a]}class fs extends Fe{constructor(e){super(),Le(this,e,$S,SS,Pe,{value:0,separator:1})}}function CS(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;function g(b){n[2](b)}let v={id:n[4],disabled:!Y.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[4]),h(f,"class","help-block")},m(b,y){w(b,e,y),p(e,t),p(e,i),p(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(m=et(Et.call(null,s,{text:`List of domains that are NOT allowed. - This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]))&&h(e,"for",l);const C={};y&16&&(C.id=b[4]),y&1&&(C.disabled=!Y.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,C.value=b[0].exceptDomains,He(()=>a=!1)),r.$set(C)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,m()}}}function MS(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;function g(b){n[3](b)}let v={id:n[4]+".options.onlyDomains",disabled:!Y.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[4]+".options.onlyDomains"),h(f,"class","help-block")},m(b,y){w(b,e,y),p(e,t),p(e,i),p(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(m=et(Et.call(null,s,{text:`List of domains that are ONLY allowed. - This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]+".options.onlyDomains"))&&h(e,"for",l);const C={};y&16&&(C.id=b[4]+".options.onlyDomains"),y&1&&(C.disabled=!Y.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,C.value=b[0].onlyDomains,He(()=>a=!1)),r.$set(C)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,m()}}}function TS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[CS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[MS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function DS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class c_ extends Fe{constructor(e){super(),Le(this,e,DS,TS,Pe,{key:1,options:0})}}function OS(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new c_({props:r}),he.push(()=>Re(e,"key",l)),he.push(()=>Re(e,"options",o)),{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],He(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],He(()=>i=!1)),e.$set(f)},i(a){s||(A(e.$$.fragment,a),s=!0)},o(a){P(e.$$.fragment,a),s=!1},d(a){z(e,a)}}}function ES(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class AS extends Fe{constructor(e){super(),Le(this,e,ES,OS,Pe,{key:0,options:1})}}var vr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ys={_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<"u"&&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},gl={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},vn=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},jn=function(n){return n===!0?1:0};function Ac(n,e){var t;return function(){var i=this,s=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,s)},e)}}var yr=function(n){return n instanceof Array?n:[n]};function pn(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function Ot(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 xl(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function d_(n,e){if(e(n))return n;if(n.parentNode)return d_(n.parentNode,e)}function eo(n,e){var t=Ot("div","numInputWrapper"),i=Ot("input","numInput "+n),s=Ot("span","arrowUp"),l=Ot("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var o in e)i.setAttribute(o,e[o]);return t.appendChild(i),t.appendChild(s),t.appendChild(l),t}function $n(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var kr=function(){},Ao=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},PS={D:kr,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:kr,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:kr,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},xi={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})"},ol={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[ol.w(n,e,t)]},F:function(n,e,t){return Ao(ol.n(n,e,t)-1,!1,e)},G:function(n,e,t){return vn(ol.h(n,e,t))},H:function(n){return vn(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 Ao(n.getMonth(),!0,e)},S:function(n){return vn(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return vn(n.getFullYear(),4)},d:function(n){return vn(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return vn(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return vn(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)}},h_=function(n){var e=n.config,t=e===void 0?ys:e,i=n.l10n,s=i===void 0?gl:i,l=n.isMobile,o=l===void 0?!1:l;return function(r,a,u){var f=u||s;return t.formatDate!==void 0&&!o?t.formatDate(r,a,f):a.split("").map(function(c,d,m){return ol[c]&&m[d-1]!=="\\"?ol[c](r,f,t):c!=="\\"?c:""}).join("")}},na=function(n){var e=n.config,t=e===void 0?ys:e,i=n.l10n,s=i===void 0?gl:i;return function(l,o,r,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=o||(t||ys).dateFormat,m=String(l).trim();if(m==="today")f=new Date,r=!0;else if(t&&t.parseDate)f=t.parseDate(l,d);else if(/Z$/.test(m)||/GMT$/.test(m))f=new Date(l);else{for(var g=void 0,v=[],b=0,y=0,C="";bMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),q=Sr(t.config);I.setHours(q.hours,q.minutes,q.seconds,I.getMilliseconds()),t.selectedDates=[I],t.latestSelectedDateObj=I}N!==void 0&&N.type!=="blur"&&it(N);var ne=t._input.value;c(),ht(),t._input.value!==ne&&t._debouncedChange()}function u(N,I){return N%12+12*jn(I===t.l10n.amPM[1])}function f(N){switch(N%24){case 0:case 12:return 12;default:return N%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var N=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,I=(parseInt(t.minuteElement.value,10)||0)%60,q=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(N=u(N,t.amPM.textContent));var ne=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&Cn(t.latestSelectedDateObj,t.config.minDate,!0)===0,Te=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&Cn(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 Ae=wr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),Qe=wr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),Ue=wr(N,I,q);if(Ue>Qe&&Ue=12)]),t.secondElement!==void 0&&(t.secondElement.value=vn(q)))}function g(N){var I=$n(N),q=parseInt(I.value)+(N.delta||0);(q/1e3>1||N.key==="Enter"&&!/[^\d]/.test(q.toString()))&&x(q)}function v(N,I,q,ne){if(I instanceof Array)return I.forEach(function(Te){return v(N,Te,q,ne)});if(N instanceof Array)return N.forEach(function(Te){return v(Te,I,q,ne)});N.addEventListener(I,q,ne),t._handlers.push({remove:function(){return N.removeEventListener(I,q,ne)}})}function b(){Ge("onChange")}function y(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(q){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+q+"]"),function(ne){return v(ne,"click",t[q])})}),t.isMobile){Ct();return}var N=Ac(ae,50);if(t._debouncedChange=Ac(b,NS),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&v(t.daysContainer,"mouseover",function(q){t.config.mode==="range"&&qe($n(q))}),v(t._input,"keydown",Ne),t.calendarContainer!==void 0&&v(t.calendarContainer,"keydown",Ne),!t.config.inline&&!t.config.static&&v(window,"resize",N),window.ontouchstart!==void 0?v(window.document,"touchstart",be):v(window.document,"mousedown",be),v(window.document,"focus",be,{capture:!0}),t.config.clickOpens===!0&&(v(t._input,"focus",t.open),v(t._input,"click",t.open)),t.daysContainer!==void 0&&(v(t.monthNav,"click",Ut),v(t.monthNav,["keyup","increment"],g),v(t.daysContainer,"click",mt)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var I=function(q){return $n(q).select()};v(t.timeContainer,["increment"],a),v(t.timeContainer,"blur",a,{capture:!0}),v(t.timeContainer,"click",$),v([t.hourElement,t.minuteElement],["focus","click"],I),t.secondElement!==void 0&&v(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&v(t.amPM,"click",function(q){a(q)})}t.config.allowInput&&v(t._input,"blur",je)}function C(N,I){var q=N!==void 0?t.parseDate(N):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(N);var Te=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&&(!Te&&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 Ae=Ot("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(Ae,t.element),Ae.appendChild(t.element),t.altInput&&Ae.appendChild(t.altInput),Ae.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function D(N,I,q,ne){var Te=G(I,!0),Ae=Ot("span",N,I.getDate().toString());return Ae.dateObj=I,Ae.$i=ne,Ae.setAttribute("aria-label",t.formatDate(I,t.config.ariaDateFormat)),N.indexOf("hidden")===-1&&Cn(I,t.now)===0&&(t.todayDateElem=Ae,Ae.classList.add("today"),Ae.setAttribute("aria-current","date")),Te?(Ae.tabIndex=-1,ct(I)&&(Ae.classList.add("selected"),t.selectedDateElem=Ae,t.config.mode==="range"&&(pn(Ae,"startRange",t.selectedDates[0]&&Cn(I,t.selectedDates[0],!0)===0),pn(Ae,"endRange",t.selectedDates[1]&&Cn(I,t.selectedDates[1],!0)===0),N==="nextMonthDay"&&Ae.classList.add("inRange")))):Ae.classList.add("flatpickr-disabled"),t.config.mode==="range"&&Rt(I)&&!ct(I)&&Ae.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&N!=="prevMonthDay"&&ne%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(I)+""),Ge("onDayCreate",Ae),Ae}function E(N){N.focus(),t.config.mode==="range"&&qe(N)}function O(N){for(var I=N>0?0:t.config.showMonths-1,q=N>0?t.config.showMonths:-1,ne=I;ne!=q;ne+=N)for(var Te=t.daysContainer.children[ne],Ae=N>0?0:Te.children.length-1,Qe=N>0?Te.children.length:-1,Ue=Ae;Ue!=Qe;Ue+=N){var xe=Te.children[Ue];if(xe.className.indexOf("hidden")===-1&&G(xe.dateObj))return xe}}function F(N,I){for(var q=N.className.indexOf("Month")===-1?N.dateObj.getMonth():t.currentMonth,ne=I>0?t.config.showMonths:-1,Te=I>0?1:-1,Ae=q-t.currentMonth;Ae!=ne;Ae+=Te)for(var Qe=t.daysContainer.children[Ae],Ue=q-t.currentMonth===Ae?N.$i+I:I<0?Qe.children.length-1:0,xe=Qe.children.length,ze=Ue;ze>=0&&ze0?xe:-1);ze+=Te){var Ye=Qe.children[ze];if(Ye.className.indexOf("hidden")===-1&&G(Ye.dateObj)&&Math.abs(N.$i-ze)>=Math.abs(I))return E(Ye)}t.changeMonth(Te),L(O(Te),0)}function L(N,I){var q=l(),ne=_e(q||document.body),Te=N!==void 0?N:ne?q:t.selectedDateElem!==void 0&&_e(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&_e(t.todayDateElem)?t.todayDateElem:O(I>0?1:-1);Te===void 0?t._input.focus():ne?F(Te,I):E(Te)}function H(N,I){for(var q=(new Date(N,I,1).getDay()-t.l10n.firstDayOfWeek+7)%7,ne=t.utils.getDaysInMonth((I-1+12)%12,N),Te=t.utils.getDaysInMonth(I,N),Ae=window.document.createDocumentFragment(),Qe=t.config.showMonths>1,Ue=Qe?"prevMonthDay hidden":"prevMonthDay",xe=Qe?"nextMonthDay hidden":"nextMonthDay",ze=ne+1-q,Ye=0;ze<=ne;ze++,Ye++)Ae.appendChild(D("flatpickr-day "+Ue,new Date(N,I-1,ze),ze,Ye));for(ze=1;ze<=Te;ze++,Ye++)Ae.appendChild(D("flatpickr-day",new Date(N,I,ze),ze,Ye));for(var gt=Te+1;gt<=42-q&&(t.config.showMonths===1||Ye%7!==0);gt++,Ye++)Ae.appendChild(D("flatpickr-day "+xe,new Date(N,I+1,gt%Te),gt,Ye));var de=Ot("div","dayContainer");return de.appendChild(Ae),de}function j(){if(t.daysContainer!==void 0){xl(t.daysContainer),t.weekNumbers&&xl(t.weekNumbers);for(var N=document.createDocumentFragment(),I=0;I1||t.config.monthSelectorType!=="dropdown")){var N=function(ne){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&net.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var I=0;I<12;I++)if(!!N(I)){var q=Ot("option","flatpickr-monthDropdown-month");q.value=new Date(t.currentYear,I).getMonth().toString(),q.textContent=Ao(I,t.config.shorthandCurrentMonth,t.l10n),q.tabIndex=-1,t.currentMonth===I&&(q.selected=!0),t.monthsDropdownContainer.appendChild(q)}}}function ie(){var N=Ot("div","flatpickr-month"),I=window.document.createDocumentFragment(),q;t.config.showMonths>1||t.config.monthSelectorType==="static"?q=Ot("span","cur-month"):(t.monthsDropdownContainer=Ot("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),v(t.monthsDropdownContainer,"change",function(Qe){var Ue=$n(Qe),xe=parseInt(Ue.value,10);t.changeMonth(xe-t.currentMonth),Ge("onMonthChange")}),Q(),q=t.monthsDropdownContainer);var ne=eo("cur-year",{tabindex:"-1"}),Te=ne.getElementsByTagName("input")[0];Te.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Te.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Te.setAttribute("max",t.config.maxDate.getFullYear().toString()),Te.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var Ae=Ot("div","flatpickr-current-month");return Ae.appendChild(q),Ae.appendChild(ne),I.appendChild(Ae),N.appendChild(I),{container:N,yearElement:Te,monthElement:q}}function U(){xl(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var N=t.config.showMonths;N--;){var I=ie();t.yearElements.push(I.yearElement),t.monthElements.push(I.monthElement),t.monthNav.appendChild(I.container)}t.monthNav.appendChild(t.nextMonthNav)}function K(){return t.monthNav=Ot("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=Ot("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=Ot("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,U(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(N){t.__hidePrevMonthArrow!==N&&(pn(t.prevMonthNav,"flatpickr-disabled",N),t.__hidePrevMonthArrow=N)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(N){t.__hideNextMonthArrow!==N&&(pn(t.nextMonthNav,"flatpickr-disabled",N),t.__hideNextMonthArrow=N)}}),t.currentYearElement=t.yearElements[0],Ht(),t.monthNav}function W(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var N=Sr(t.config);t.timeContainer=Ot("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var I=Ot("span","flatpickr-time-separator",":"),q=eo("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=q.getElementsByTagName("input")[0];var ne=eo("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=ne.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?N.hours:f(N.hours)),t.minuteElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():N.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(I),t.timeContainer.appendChild(ne),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Te=eo("flatpickr-second");t.secondElement=Te.getElementsByTagName("input")[0],t.secondElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():N.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(Ot("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Te)}return t.config.time_24hr||(t.amPM=Ot("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 J(){t.weekdayContainer?xl(t.weekdayContainer):t.weekdayContainer=Ot("div","flatpickr-weekdays");for(var N=t.config.showMonths;N--;){var I=Ot("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(I)}return se(),t.weekdayContainer}function se(){if(!!t.weekdayContainer){var N=t.l10n.firstDayOfWeek,I=Pc(t.l10n.weekdays.shorthand);N>0&&N{"content"in r&&t(1,i=r.content),"language"in r&&t(2,s=r.language)},n.$$.update=()=>{n.$$.dirty&2&&typeof Us<"u"&&i&&t(0,l=o(i))},[l,i,s]}class ln extends Fe{constructor(e){super(),Le(this,e,yw,vw,Pe,{content:1,language:2})}}const kw=n=>({}),tc=n=>({}),ww=n=>({}),nc=n=>({});function ic(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C=n[4]&&!n[2]&&sc(n);const S=n[18].header,M=On(S,n,n[17],nc);let D=n[4]&&n[2]&&lc(n);const E=n[18].default,O=On(E,n,n[17],null),F=n[18].footer,L=On(F,n,n[17],tc);return{c(){e=_("div"),t=_("div"),s=T(),l=_("div"),o=_("div"),C&&C.c(),r=T(),M&&M.c(),a=T(),D&&D.c(),u=T(),f=_("div"),O&&O.c(),c=T(),d=_("div"),L&&L.c(),h(t,"class","overlay"),h(o,"class","overlay-panel-section panel-header"),h(f,"class","overlay-panel-section panel-content"),h(d,"class","overlay-panel-section panel-footer"),h(l,"class",p="overlay-panel "+n[1]+" "+n[8]),ee(l,"popup",n[2]),h(e,"class","overlay-panel-container"),ee(e,"padded",n[2]),ee(e,"active",n[0])},m(H,j){w(H,e,j),m(e,t),m(e,s),m(e,l),m(l,o),C&&C.m(o,null),m(o,r),M&&M.m(o,null),m(o,a),D&&D.m(o,null),m(l,u),m(l,f),O&&O.m(f,null),n[20](f),m(l,c),m(l,d),L&&L.m(d,null),b=!0,y||($=[X(t,"click",Qt(n[19])),X(f,"scroll",n[21])],y=!0)},p(H,j){n=H,n[4]&&!n[2]?C?C.p(n,j):(C=sc(n),C.c(),C.m(o,r)):C&&(C.d(1),C=null),M&&M.p&&(!b||j&131072)&&An(M,S,n,n[17],b?En(S,n[17],j,ww):Pn(n[17]),nc),n[4]&&n[2]?D?D.p(n,j):(D=lc(n),D.c(),D.m(o,null)):D&&(D.d(1),D=null),O&&O.p&&(!b||j&131072)&&An(O,E,n,n[17],b?En(E,n[17],j,null):Pn(n[17]),null),L&&L.p&&(!b||j&131072)&&An(L,F,n,n[17],b?En(F,n[17],j,kw):Pn(n[17]),tc),(!b||j&258&&p!==(p="overlay-panel "+n[1]+" "+n[8]))&&h(l,"class",p),j&262&&ee(l,"popup",n[2]),j&4&&ee(e,"padded",n[2]),j&1&&ee(e,"active",n[0])},i(H){b||(Lt(()=>{i||(i=at(t,bo,{duration:gs,opacity:0},!0)),i.run(1)}),A(M,H),A(O,H),A(L,H),Lt(()=>{v&&v.end(1),g=Qp(l,Un,n[2]?{duration:gs,y:-10}:{duration:gs,x:50}),g.start()}),b=!0)},o(H){i||(i=at(t,bo,{duration:gs,opacity:0},!1)),i.run(0),P(M,H),P(O,H),P(L,H),g&&g.invalidate(),v=xp(l,Un,n[2]?{duration:gs,y:10}:{duration:gs,x:50}),b=!1},d(H){H&&k(e),H&&i&&i.end(),C&&C.d(),M&&M.d(H),D&&D.d(),O&&O.d(H),n[20](null),L&&L.d(H),H&&v&&v.end(),y=!1,st($)}}}function sc(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',h(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=X(e,"click",Qt(n[5])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function lc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(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",Qt(n[5])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Sw(n){let e,t,i,s,l=n[0]&&ic(n);return{c(){e=_("div"),l&&l.c(),h(e,"class","overlay-panel-wrapper")},m(o,r){w(o,e,r),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(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=ic(o),l.c(),A(l,1),l.m(e,null)):l&&(De(),P(l,1,1,()=>{l=null}),Oe())},i(o){t||(A(l),t=!0)},o(o){P(l),t=!1},d(o){o&&k(e),l&&l.d(),n[22](null),i=!1,st(s)}}}let Zi;function u_(){return Zi=Zi||document.querySelector(".overlays"),Zi||(Zi=document.createElement("div"),Zi.classList.add("overlays"),document.body.appendChild(Zi)),Zi}let gs=150;function oc(){return 1e3+u_().querySelectorAll(".overlay-panel-container.active").length}function $w(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{active:o=!1}=e,{popup:r=!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 p=hn();let g,v,b,y,$="";function C(){typeof c=="function"&&c()===!1||t(0,o=!0)}function S(){typeof d=="function"&&d()===!1||t(0,o=!1)}function M(){return o}async function D(U){U?(b=document.activeElement,g==null||g.focus(),p("show")):(clearTimeout(y),b==null||b.focus(),p("hide")),await di(),E()}function E(){!g||(o?t(6,g.style.zIndex=oc(),g):t(6,g.style="",g))}function O(U){o&&f&&U.code=="Escape"&&!Y.isInput(U.target)&&g&&g.style.zIndex==oc()&&(U.preventDefault(),S())}function F(U){o&&L(v)}function L(U,K){K&&t(8,$=""),U&&(y||(y=setTimeout(()=>{if(clearTimeout(y),y=null,!U)return;if(U.scrollHeight-U.offsetHeight>0)t(8,$="scrollable");else{t(8,$="");return}U.scrollTop==0?t(8,$+=" scroll-top-reached"):U.scrollTop+U.offsetHeight==U.scrollHeight&&t(8,$+=" scroll-bottom-reached")},100)))}Jn(()=>(u_().appendChild(g),()=>{var U;clearTimeout(y),(U=g==null?void 0:g.classList)==null||U.add("hidden")}));const H=()=>a?S():!0;function j(U){he[U?"unshift":"push"](()=>{v=U,t(7,v)})}const Q=U=>L(U.target);function ie(U){he[U?"unshift":"push"](()=>{g=U,t(6,g)})}return n.$$set=U=>{"class"in U&&t(1,l=U.class),"active"in U&&t(0,o=U.active),"popup"in U&&t(2,r=U.popup),"overlayClose"in U&&t(3,a=U.overlayClose),"btnClose"in U&&t(4,u=U.btnClose),"escClose"in U&&t(12,f=U.escClose),"beforeOpen"in U&&t(13,c=U.beforeOpen),"beforeHide"in U&&t(14,d=U.beforeHide),"$$scope"in U&&t(17,s=U.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&D(o),n.$$.dirty&128&&L(v,!0),n.$$.dirty&64&&g&&E()},[o,l,r,a,u,S,g,v,$,O,F,L,f,c,d,C,M,s,i,H,j,Q,ie]}class Ci extends Fe{constructor(e){super(),Le(this,e,$w,Sw,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 Cw(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Mw(n){let e,t=n[2].referer+"",i,s;return{c(){e=_("a"),i=R(t),h(e,"href",s=n[2].referer),h(e,"target","_blank"),h(e,"rel","noopener noreferrer")},m(l,o){w(l,e,o),m(e,i)},p(l,o){o&4&&t!==(t=l[2].referer+"")&&me(i,t),o&4&&s!==(s=l[2].referer)&&h(e,"href",s)},d(l){l&&k(e)}}}function Tw(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function Dw(n){let e,t;return e=new ln({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function Ow(n){var Ut;let e,t,i,s,l,o,r=n[2].id+"",a,u,f,c,d,p,g,v=n[2].status+"",b,y,$,C,S,M,D=((Ut=n[2].method)==null?void 0:Ut.toUpperCase())+"",E,O,F,L,H,j,Q=n[2].auth+"",ie,U,K,W,J,se,fe=n[2].url+"",ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe=n[2].ip+"",ae,re,ve,Je,nt,ut,ot=n[2].userAgent+"",Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Rt,Ft,Ct,Yt,Ge;function Mt(it,N){return it[2].referer?Mw:Cw}let ct=Mt(n),Ht=ct(n);const jt=[Dw,Tw],Tt=[];function ht(it,N){return N&4&&(ye=null),ye==null&&(ye=!Y.isEmpty(it[2].meta)),ye?0:1}return Ke=ht(n,-1),ft=Tt[Ke]=jt[Ke](n),Yt=new wi({props:{date:n[2].created}}),{c(){e=_("table"),t=_("tbody"),i=_("tr"),s=_("td"),s.textContent="ID",l=T(),o=_("td"),a=R(r),u=T(),f=_("tr"),c=_("td"),c.textContent="Status",d=T(),p=_("td"),g=_("span"),b=R(v),y=T(),$=_("tr"),C=_("td"),C.textContent="Method",S=T(),M=_("td"),E=R(D),O=T(),F=_("tr"),L=_("td"),L.textContent="Auth",H=T(),j=_("td"),ie=R(Q),U=T(),K=_("tr"),W=_("td"),W.textContent="URL",J=T(),se=_("td"),ke=R(fe),le=T(),ue=_("tr"),Me=_("td"),Me.textContent="Referer",Z=T(),be=_("td"),Ht.c(),x=T(),G=_("tr"),_e=_("td"),_e.textContent="IP",je=T(),Ne=_("td"),ae=R(qe),re=T(),ve=_("tr"),Je=_("td"),Je.textContent="UserAgent",nt=T(),ut=_("td"),Xe=R(ot),ge=T(),pe=_("tr"),Ve=_("td"),Ve.textContent="Meta",mt=T(),te=_("td"),ft.c(),St=T(),$t=_("tr"),Rt=_("td"),Rt.textContent="Created",Ft=T(),Ct=_("td"),B(Yt.$$.fragment),h(s,"class","min-width txt-hint txt-bold"),h(c,"class","min-width txt-hint txt-bold"),h(g,"class","label"),ee(g,"label-danger",n[2].status>=400),h(C,"class","min-width txt-hint txt-bold"),h(L,"class","min-width txt-hint txt-bold"),h(W,"class","min-width txt-hint txt-bold"),h(Me,"class","min-width txt-hint txt-bold"),h(_e,"class","min-width txt-hint txt-bold"),h(Je,"class","min-width txt-hint txt-bold"),h(Ve,"class","min-width txt-hint txt-bold"),h(Rt,"class","min-width txt-hint txt-bold"),h(e,"class","table-compact table-border")},m(it,N){w(it,e,N),m(e,t),m(t,i),m(i,s),m(i,l),m(i,o),m(o,a),m(t,u),m(t,f),m(f,c),m(f,d),m(f,p),m(p,g),m(g,b),m(t,y),m(t,$),m($,C),m($,S),m($,M),m(M,E),m(t,O),m(t,F),m(F,L),m(F,H),m(F,j),m(j,ie),m(t,U),m(t,K),m(K,W),m(K,J),m(K,se),m(se,ke),m(t,le),m(t,ue),m(ue,Me),m(ue,Z),m(ue,be),Ht.m(be,null),m(t,x),m(t,G),m(G,_e),m(G,je),m(G,Ne),m(Ne,ae),m(t,re),m(t,ve),m(ve,Je),m(ve,nt),m(ve,ut),m(ut,Xe),m(t,ge),m(t,pe),m(pe,Ve),m(pe,mt),m(pe,te),Tt[Ke].m(te,null),m(t,St),m(t,$t),m($t,Rt),m($t,Ft),m($t,Ct),V(Yt,Ct,null),Ge=!0},p(it,N){var ne;(!Ge||N&4)&&r!==(r=it[2].id+"")&&me(a,r),(!Ge||N&4)&&v!==(v=it[2].status+"")&&me(b,v),N&4&&ee(g,"label-danger",it[2].status>=400),(!Ge||N&4)&&D!==(D=((ne=it[2].method)==null?void 0:ne.toUpperCase())+"")&&me(E,D),(!Ge||N&4)&&Q!==(Q=it[2].auth+"")&&me(ie,Q),(!Ge||N&4)&&fe!==(fe=it[2].url+"")&&me(ke,fe),ct===(ct=Mt(it))&&Ht?Ht.p(it,N):(Ht.d(1),Ht=ct(it),Ht&&(Ht.c(),Ht.m(be,null))),(!Ge||N&4)&&qe!==(qe=it[2].ip+"")&&me(ae,qe),(!Ge||N&4)&&ot!==(ot=it[2].userAgent+"")&&me(Xe,ot);let I=Ke;Ke=ht(it,N),Ke===I?Tt[Ke].p(it,N):(De(),P(Tt[I],1,1,()=>{Tt[I]=null}),Oe(),ft=Tt[Ke],ft?ft.p(it,N):(ft=Tt[Ke]=jt[Ke](it),ft.c()),A(ft,1),ft.m(te,null));const q={};N&4&&(q.date=it[2].created),Yt.$set(q)},i(it){Ge||(A(ft),A(Yt.$$.fragment,it),Ge=!0)},o(it){P(ft),P(Yt.$$.fragment,it),Ge=!1},d(it){it&&k(e),Ht.d(),Tt[Ke].d(),z(Yt)}}}function Ew(n){let e;return{c(){e=_("h4"),e.textContent="Request log"},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Aw(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Close',h(e,"type","button"),h(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[4]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Pw(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[Aw],header:[Ew],default:[Ow]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&260&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[5](null),z(e,s)}}}function Lw(n,e,t){let i,s=new Or;function l(c){return t(2,s=c),i==null?void 0:i.show()}function o(){return i==null?void 0:i.hide()}const r=()=>o();function a(c){he[c?"unshift":"push"](()=>{i=c,t(1,i)})}function u(c){pt.call(this,n,c)}function f(c){pt.call(this,n,c)}return[o,i,s,l,r,a,u,f]}class Fw extends Fe{constructor(e){super(),Le(this,e,Lw,Pw,Pe,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function Iw(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Include requests by admins"),h(e,"type","checkbox"),h(e,"id",t=n[14]),h(s,"for",o=n[14])},m(u,f){w(u,e,f),e.checked=n[0],w(u,i,f),w(u,s,f),m(s,l),r||(a=X(e,"change",n[8]),r=!0)},p(u,f){f&16384&&t!==(t=u[14])&&h(e,"id",t),f&1&&(e.checked=u[0]),f&16384&&o!==(o=u[14])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function rc(n){let e,t,i;function s(o){n[10](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new _w({props:l}),he.push(()=>Re(e,"filter",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function ac(n){let e,t,i;function s(o){n[11](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new F1({props:l}),he.push(()=>Re(e,"filter",s)),e.$on("select",n[12]),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function Nw(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C=n[3],S,M=n[3],D,E,O;a=new zo({}),a.$on("refresh",n[7]),p=new Ie({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[Iw,({uniqueId:j})=>({14:j}),({uniqueId:j})=>j?16384:0]},$$scope:{ctx:n}}}),v=new Vo({props:{value:n[2],placeholder:"Search logs, ex. status > 200",extraAutocompleteKeys:["method","url","ip","referer","status","auth","userAgent"]}}),v.$on("submit",n[9]);let F=rc(n),L=ac(n),H={};return E=new Fw({props:H}),n[13](E),{c(){e=_("main"),t=_("div"),i=_("header"),s=_("nav"),l=_("div"),o=R(n[5]),r=T(),B(a.$$.fragment),u=T(),f=_("div"),c=T(),d=_("div"),B(p.$$.fragment),g=T(),B(v.$$.fragment),b=T(),y=_("div"),$=T(),F.c(),S=T(),L.c(),D=T(),B(E.$$.fragment),h(l,"class","breadcrumb-item"),h(s,"class","breadcrumbs"),h(f,"class","flex-fill"),h(d,"class","inline-flex"),h(i,"class","page-header"),h(y,"class","clearfix m-b-xs"),h(t,"class","page-header-wrapper m-b-0"),h(e,"class","page-wrapper")},m(j,Q){w(j,e,Q),m(e,t),m(t,i),m(i,s),m(s,l),m(l,o),m(i,r),V(a,i,null),m(i,u),m(i,f),m(i,c),m(i,d),V(p,d,null),m(t,g),V(v,t,null),m(t,b),m(t,y),m(t,$),F.m(t,null),m(e,S),L.m(e,null),w(j,D,Q),V(E,j,Q),O=!0},p(j,[Q]){(!O||Q&32)&&me(o,j[5]);const ie={};Q&49153&&(ie.$$scope={dirty:Q,ctx:j}),p.$set(ie);const U={};Q&4&&(U.value=j[2]),v.$set(U),Q&8&&Pe(C,C=j[3])?(De(),P(F,1,1,oe),Oe(),F=rc(j),F.c(),A(F,1),F.m(t,null)):F.p(j,Q),Q&8&&Pe(M,M=j[3])?(De(),P(L,1,1,oe),Oe(),L=ac(j),L.c(),A(L,1),L.m(e,null)):L.p(j,Q);const K={};E.$set(K)},i(j){O||(A(a.$$.fragment,j),A(p.$$.fragment,j),A(v.$$.fragment,j),A(F),A(L),A(E.$$.fragment,j),O=!0)},o(j){P(a.$$.fragment,j),P(p.$$.fragment,j),P(v.$$.fragment,j),P(F),P(L),P(E.$$.fragment,j),O=!1},d(j){j&&k(e),z(a),z(p),z(v),F.d(j),L.d(j),j&&k(D),n[13](null),z(E,j)}}}const uc="includeAdminLogs";function Rw(n,e,t){var y;let i,s;Vt(n,nn,$=>t(5,s=$)),wn(nn,s="Request logs",s);let l,o="",r=((y=window.localStorage)==null?void 0:y.getItem(uc))<<0,a=1;function u(){t(3,a++,a)}const f=()=>u();function c(){r=this.checked,t(0,r)}const d=$=>t(2,o=$.detail);function p($){o=$,t(2,o)}function g($){o=$,t(2,o)}const v=$=>l==null?void 0:l.show($==null?void 0:$.detail);function b($){he[$?"unshift":"push"](()=>{l=$,t(1,l)})}return n.$$.update=()=>{n.$$.dirty&1&&t(4,i=r?"":'auth!="admin"'),n.$$.dirty&1&&typeof r<"u"&&window.localStorage&&window.localStorage.setItem(uc,r<<0)},[r,l,o,a,i,s,u,f,c,d,p,g,v,b]}class Hw extends Fe{constructor(e){super(),Le(this,e,Rw,Nw,Pe,{})}}const Ms=si([]),ui=si({}),ea=si(!1);function jw(n){ui.update(e=>Y.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Ms.update(e=>(Y.pushOrReplaceByKey(e,n,"id"),e))}function qw(n){Ms.update(e=>(Y.removeByKey(e,"id",n.id),ui.update(t=>t.id===n.id?e.find(i=>i.name!="profiles")||{}:t),e))}async function Vw(n=null){return ea.set(!0),ui.set({}),Ms.set([]),Se.Collections.getFullList(200,{sort:"+created"}).then(e=>{Ms.set(e);const t=n&&Y.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(()=>{ea.set(!1)})}const Va=si({});function Si(n,e,t){Va.set({text:n,yesCallback:e,noCallback:t})}function f_(){Va.set({})}function fc(n){let e,t,i,s;const l=n[13].default,o=On(l,n,n[12],null);return{c(){e=_("div"),o&&o.c(),h(e,"class",n[1]),ee(e,"active",n[0])},m(r,a){w(r,e,a),o&&o.m(e,null),s=!0},p(r,a){o&&o.p&&(!s||a&4096)&&An(o,l,r,r[12],s?En(l,r[12],a,null):Pn(r[12]),null),(!s||a&2)&&h(e,"class",r[1]),a&3&&ee(e,"active",r[0])},i(r){s||(A(o,r),r&&Lt(()=>{i&&i.end(1),t=Qp(e,Un,{duration:150,y:-5}),t.start()}),s=!0)},o(r){P(o,r),t&&t.invalidate(),r&&(i=xp(e,Un,{duration:150,y:2})),s=!1},d(r){r&&k(e),o&&o.d(r),r&&i&&i.end()}}}function zw(n){let e,t,i,s,l=n[0]&&fc(n);return{c(){e=_("div"),l&&l.c(),h(e,"class","toggler-container")},m(o,r){w(o,e,r),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(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=fc(o),l.c(),A(l,1),l.m(e,null)):l&&(De(),P(l,1,1,()=>{l=null}),Oe())},i(o){t||(A(l),t=!0)},o(o){P(l),t=!1},d(o){o&&k(e),l&&l.d(),n[14](null),i=!1,st(s)}}}function Bw(n,e,t){let{$$slots:i={},$$scope:s}=e,{trigger:l=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{closableClass:a="closable"}=e,{class:u=""}=e,f;const c=hn();function d(){t(0,o=!1)}function p(){t(0,o=!0)}function g(){o?d():p()}function v(D){return!f||D.classList.contains(a)||(l==null?void 0:l.contains(D))&&!f.contains(D)||f.contains(D)&&D.closest&&D.closest("."+a)}function b(D){(!o||v(D.target))&&(D.preventDefault(),g())}function y(D){(D.code==="Enter"||D.code==="Space")&&(!o||v(D.target))&&(D.preventDefault(),D.stopPropagation(),g())}function $(D){o&&!(f!=null&&f.contains(D.target))&&!(l!=null&&l.contains(D.target))&&d()}function C(D){o&&r&&D.code=="Escape"&&(D.preventDefault(),d())}function S(D){return $(D)}Jn(()=>(t(6,l=l||f.parentNode),l.addEventListener("click",b),l.addEventListener("keydown",y),()=>{l.removeEventListener("click",b),l.removeEventListener("keydown",y)}));function M(D){he[D?"unshift":"push"](()=>{f=D,t(2,f)})}return n.$$set=D=>{"trigger"in D&&t(6,l=D.trigger),"active"in D&&t(0,o=D.active),"escClose"in D&&t(7,r=D.escClose),"closableClass"in D&&t(8,a=D.closableClass),"class"in D&&t(1,u=D.class),"$$scope"in D&&t(12,s=D.$$scope)},n.$$.update=()=>{var D,E;n.$$.dirty&65&&(o?((D=l==null?void 0:l.classList)==null||D.add("active"),c("show")):((E=l==null?void 0:l.classList)==null||E.remove("active"),c("hide")))},[o,u,f,$,C,S,l,r,a,d,p,g,s,i,M]}class qi extends Fe{constructor(e){super(),Le(this,e,Bw,zw,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 Uw=n=>({active:n&1}),cc=n=>({active:n[0]});function dc(n){let e,t,i;const s=n[12].default,l=On(s,n,n[11],null);return{c(){e=_("div"),l&&l.c(),h(e,"class","accordion-content")},m(o,r){w(o,e,r),l&&l.m(e,null),i=!0},p(o,r){l&&l.p&&(!i||r&2048)&&An(l,s,o,o[11],i?En(s,o[11],r,null):Pn(o[11]),null)},i(o){i||(A(l,o),o&&Lt(()=>{t||(t=at(e,on,{duration:150},!0)),t.run(1)}),i=!0)},o(o){P(l,o),o&&(t||(t=at(e,on,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&k(e),l&&l.d(o),o&&t&&t.end()}}}function Ww(n){let e,t,i,s,l,o,r,a;const u=n[12].header,f=On(u,n,n[11],cc);let c=n[0]&&dc(n);return{c(){e=_("div"),t=_("header"),f&&f.c(),i=T(),c&&c.c(),h(t,"class","accordion-header"),ee(t,"interactive",n[2]),h(e,"tabindex",s=n[2]?0:-1),h(e,"class",l="accordion "+n[1]),ee(e,"active",n[0])},m(d,p){w(d,e,p),m(e,t),f&&f.m(t,null),m(e,i),c&&c.m(e,null),n[14](e),o=!0,r||(a=[X(t,"click",Qt(n[13])),X(e,"keydown",Yp(n[5]))],r=!0)},p(d,[p]){f&&f.p&&(!o||p&2049)&&An(f,u,d,d[11],o?En(u,d[11],p,Uw):Pn(d[11]),cc),p&4&&ee(t,"interactive",d[2]),d[0]?c?(c.p(d,p),p&1&&A(c,1)):(c=dc(d),c.c(),A(c,1),c.m(e,null)):c&&(De(),P(c,1,1,()=>{c=null}),Oe()),(!o||p&4&&s!==(s=d[2]?0:-1))&&h(e,"tabindex",s),(!o||p&2&&l!==(l="accordion "+d[1]))&&h(e,"class",l),p&3&&ee(e,"active",d[0])},i(d){o||(A(f,d),A(c),o=!0)},o(d){P(f,d),P(c),o=!1},d(d){d&&k(e),f&&f.d(d),c&&c.d(),n[14](null),r=!1,st(a)}}}function Yw(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=hn();let o,r,{class:a=""}=e,{active:u=!1}=e,{interactive:f=!0}=e,{single:c=!1}=e;function d(){v(),t(0,u=!0),l("expand")}function p(){t(0,u=!1),clearTimeout(r),l("collapse")}function g(){l("toggle"),u?p():d()}function v(){if(c&&o.parentElement){const C=o.parentElement.querySelectorAll(".accordion.active .accordion-header.interactive");for(const S of C)S.click()}}function b(C){!f||(C.code==="Enter"||C.code==="Space")&&(C.preventDefault(),g())}Jn(()=>()=>clearTimeout(r));const y=()=>f&&g();function $(C){he[C?"unshift":"push"](()=>{o=C,t(4,o)})}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(r),t(10,r=setTimeout(()=>{o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},250)))},[u,a,f,g,o,b,c,d,p,v,r,s,i,y,$]}class za extends Fe{constructor(e){super(),Le(this,e,Yw,Ww,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 Kw=n=>({}),hc=n=>({});function pc(n,e,t){const i=n.slice();return i[46]=e[t],i}function mc(n,e,t){const i=n.slice();return i[49]=e[t],i}const Zw=n=>({}),gc=n=>({});function _c(n,e,t){const i=n.slice();return i[49]=e[t],i}function bc(n){let e,t;return{c(){e=_("div"),t=R(n[2]),h(e,"class","txt-placeholder")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&4&&me(t,i[2])},d(i){i&&k(e)}}}function Jw(n){let e,t=n[49]+"",i;return{c(){e=_("span"),i=R(t),h(e,"class","txt")},m(s,l){w(s,e,l),m(e,i)},p(s,l){l[0]&1&&t!==(t=s[49]+"")&&me(i,t)},i:oe,o:oe,d(s){s&&k(e)}}}function Gw(n){let e,t,i;const s=[{item:n[49]},n[8]];var l=n[7];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function vc(n){let e,t,i;function s(){return n[34](n[49])}return{c(){e=_("span"),e.innerHTML='',h(e,"class","clear")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Clear")),X(e,"click",ni(Qt(s)))],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function yc(n){let e,t,i,s,l,o;const r=[Gw,Jw],a=[];function u(c,d){return c[7]?0:1}t=u(n),i=a[t]=r[t](n);let f=(n[4]||n[6])&&vc(n);return{c(){e=_("div"),i.c(),s=T(),f&&f.c(),l=T(),h(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),o=!0},p(c,d){let p=t;t=u(c),t===p?a[t].p(c,d):(De(),P(a[p],1,1,()=>{a[p]=null}),Oe(),i=a[t],i?i.p(c,d):(i=a[t]=r[t](c),i.c()),A(i,1),i.m(e,s)),c[4]||c[6]?f?f.p(c,d):(f=vc(c),f.c(),f.m(e,l)):f&&(f.d(1),f=null)},i(c){o||(A(i),o=!0)},o(c){P(i),o=!1},d(c){c&&k(e),a[t].d(),f&&f.d()}}}function kc(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left",trigger:n[17],$$slots:{default:[xw]},$$scope:{ctx:n}};return e=new qi({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 o={};l[0]&131072&&(o.trigger=s[17]),l[0]&806410|l[1]&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[39](null),z(e,s)}}}function wc(n){let e,t,i,s,l,o,r,a,u=n[14].length&&Sc(n);return{c(){e=_("div"),t=_("label"),i=_("div"),i.innerHTML='',s=T(),l=_("input"),o=T(),u&&u.c(),h(i,"class","addon p-r-0"),l.autofocus=!0,h(l,"type","text"),h(l,"placeholder",n[3]),h(t,"class","input-group"),h(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,o),u&&u.m(t,null),l.focus(),r||(a=X(l,"input",n[36]),r=!0)},p(f,c){c[0]&8&&h(l,"placeholder",f[3]),c[0]&16384&&l.value!==f[14]&&$e(l,f[14]),f[14].length?u?u.p(f,c):(u=Sc(f),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},d(f){f&&k(e),u&&u.d(),r=!1,a()}}}function Sc(n){let e,t,i,s;return{c(){e=_("div"),t=_("button"),t.innerHTML='',h(t,"type","button"),h(t,"class","btn btn-sm btn-circle btn-secondary clear"),h(e,"class","addon suffix p-r-5")},m(l,o){w(l,e,o),m(e,t),i||(s=X(t,"click",ni(Qt(n[20]))),i=!0)},p:oe,d(l){l&&k(e),i=!1,s()}}}function $c(n){let e,t=n[1]&&Cc(n);return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1]?t?t.p(i,s):(t=Cc(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function Cc(n){let e,t;return{c(){e=_("div"),t=R(n[1]),h(e,"class","txt-missing")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&2&&me(t,i[1])},d(i){i&&k(e)}}}function Mc(n){let e,t=n[46].group+"",i;return{c(){e=_("div"),i=R(t),h(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+"")&&me(i,t)},d(s){s&&k(e)}}}function Xw(n){let e=n[49]+"",t;return{c(){t=R(e)},m(i,s){w(i,t,s)},p(i,s){s[0]&524288&&e!==(e=i[49]+"")&&me(t,e)},i:oe,o:oe,d(i){i&&k(t)}}}function Qw(n){let e,t,i;const s=[{item:n[49]},n[10]];var l=n[9];function o(r){let a={};for(let u=0;u{z(f,1)}),Oe()}l?(e=new l(o()),B(e.$$.fragment),A(e.$$.fragment,1),V(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&P(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&z(e,r)}}}function Tc(n){let e,t,i,s,l,o,r;const a=[Qw,Xw],u=[];function f(p,g){return p[9]?0:1}t=f(n),i=u[t]=a[t](n);function c(...p){return n[37](n[49],...p)}function d(...p){return n[38](n[49],...p)}return{c(){e=_("div"),i.c(),s=T(),h(e,"tabindex","0"),h(e,"class","dropdown-item option closable"),ee(e,"selected",n[18](n[49]))},m(p,g){w(p,e,g),u[t].m(e,null),m(e,s),l=!0,o||(r=[X(e,"click",c),X(e,"keydown",d)],o=!0)},p(p,g){n=p;let v=t;t=f(n),t===v?u[t].p(n,g):(De(),P(u[v],1,1,()=>{u[v]=null}),Oe(),i=u[t],i?i.p(n,g):(i=u[t]=a[t](n),i.c()),A(i,1),i.m(e,s)),g[0]&786432&&ee(e,"selected",n[18](n[49]))},i(p){l||(A(i),l=!0)},o(p){P(i),l=!1},d(p){p&&k(e),u[t].d(),o=!1,st(r)}}}function Dc(n){let e,t,i,s=n[46].group!=ta&&Mc(n),l=n[46].items,o=[];for(let a=0;aP(o[a],1,1,()=>{o[a]=null});return{c(){s&&s.c(),e=T();for(let a=0;aP(f[v],1,1,()=>{f[v]=null});let d=null;u.length||(d=$c(n));const p=n[33].afterOptions,g=On(p,n,n[42],hc);return{c(){o&&o.c(),e=T(),a&&a.c(),t=T(),i=_("div");for(let v=0;vP(a[d],1,1,()=>{a[d]=null});let f=null;r.length||(f=bc(n));let c=!n[5]&&kc(n);return{c(){e=_("div"),t=_("div");for(let d=0;d{c=null}),Oe()):c?(c.p(d,p),p[0]&32&&A(c,1)):(c=kc(d),c.c(),A(c,1),c.m(e,null)),(!o||p[0]&4096&&l!==(l="select "+d[12]))&&h(e,"class",l),p[0]&4112&&ee(e,"multiple",d[4]),p[0]&4128&&ee(e,"disabled",d[5])},i(d){if(!o){for(let p=0;pJe(Xe,re)))||[]:ot=ut.items||[],ot.length&&ve.push({group:ut.group,items:ot})}return ve}function ke(ae,re){ae.preventDefault(),b&&p?ie(re):Q(re)}function le(ae,re){(ae.code==="Enter"||ae.code==="Space")&&ke(ae,re)}function ue(){se(),setTimeout(()=>{const ae=L==null?void 0:L.querySelector(".dropdown-item.option.selected");ae&&(ae.focus(),ae.scrollIntoView({block:"nearest"}))},0)}function Me(ae){ae.stopPropagation(),!g&&(O==null||O.toggle())}Jn(()=>{const ae=document.querySelectorAll(`label[for="${a}"]`);for(const re of ae)re.addEventListener("click",Me);return()=>{for(const re of ae)re.removeEventListener("click",Me)}});const Z=ae=>j(ae);function be(ae){he[ae?"unshift":"push"](()=>{H=ae,t(17,H)})}function x(){F=this.value,t(14,F)}const G=(ae,re)=>ke(re,ae),_e=(ae,re)=>le(re,ae);function je(ae){he[ae?"unshift":"push"](()=>{O=ae,t(15,O)})}function Ne(ae){pt.call(this,n,ae)}function qe(ae){he[ae?"unshift":"push"](()=>{L=ae,t(16,L)})}return n.$$set=ae=>{"id"in ae&&t(24,a=ae.id),"noOptionsText"in ae&&t(1,u=ae.noOptionsText),"selectPlaceholder"in ae&&t(2,f=ae.selectPlaceholder),"searchPlaceholder"in ae&&t(3,c=ae.searchPlaceholder),"items"in ae&&t(25,d=ae.items),"multiple"in ae&&t(4,p=ae.multiple),"disabled"in ae&&t(5,g=ae.disabled),"selected"in ae&&t(0,v=ae.selected),"toggle"in ae&&t(6,b=ae.toggle),"labelComponent"in ae&&t(7,y=ae.labelComponent),"labelComponentProps"in ae&&t(8,$=ae.labelComponentProps),"optionComponent"in ae&&t(9,C=ae.optionComponent),"optionComponentProps"in ae&&t(10,S=ae.optionComponentProps),"searchable"in ae&&t(11,M=ae.searchable),"searchFunc"in ae&&t(26,D=ae.searchFunc),"class"in ae&&t(12,E=ae.class),"$$scope"in ae&&t(42,r=ae.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&t(32,i=Y.isObjectArrayWithKeys(d,["group"])?d:[{group:ta,items:d}]),n.$$.dirty[0]&33554432&&d&&(J(),se()),n.$$.dirty[0]&16384|n.$$.dirty[1]&2&&t(19,s=fe(i,F)),n.$$.dirty[0]&1&&t(18,l=function(ae){let re=Y.toArray(v);return Y.inArray(re,ae)})},[v,u,f,c,p,g,b,y,$,C,S,M,E,j,F,O,L,H,l,s,se,ke,le,ue,a,d,D,Q,ie,U,K,W,i,o,Z,be,x,G,_e,je,Ne,qe,r]}class c_ extends Fe{constructor(e){super(),Le(this,e,nS,eS,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 Oc(n){let e,t;return{c(){e=_("i"),h(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)&&h(e,"class",t)},d(i){i&&k(e)}}}function iS(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&&Oc(n);return{c(){l&&l.c(),e=T(),t=_("span"),s=R(i),h(t,"class","txt")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),m(t,s)},p(o,[r]){o[0].icon?l?l.p(o,r):(l=Oc(o),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),r&1&&i!==(i=(o[0].label||o[0].name||o[0].title||o[0].id||o[0].value)+"")&&me(s,i)},i:oe,o:oe,d(o){l&&l.d(o),o&&k(e),o&&k(t)}}}function sS(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class Ec extends Fe{constructor(e){super(),Le(this,e,sS,iS,Pe,{item:0})}}const lS=n=>({}),Ac=n=>({});function oS(n){let e;const t=n[8].afterOptions,i=On(t,n,n[12],Ac);return{c(){i&&i.c()},m(s,l){i&&i.m(s,l),e=!0},p(s,l){i&&i.p&&(!e||l&4096)&&An(i,t,s,s[12],e?En(t,s[12],l,lS):Pn(s[12]),Ac)},i(s){e||(A(i,s),e=!0)},o(s){P(i,s),e=!1},d(s){i&&i.d(s)}}}function rS(n){let e,t,i;const s=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function l(r){n[9](r)}let o={$$slots:{afterOptions:[oS]},$$scope:{ctx:n}};for(let r=0;rRe(e,"selected",l)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){B(e.$$.fragment)},m(r,a){V(e,r,a),i=!0},p(r,[a]){const u=a&62?bn(s,[a&2&&{items:r[1]},a&4&&{multiple:r[2]},a&8&&{labelComponent:r[3]},a&16&&{optionComponent:r[4]},a&32&&hi(r[5])]):{};a&4096&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.selected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function aS(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let s=tn(e,i),{$$slots:l={},$$scope:o}=e,{items:r=[]}=e,{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{labelComponent:f=Ec}=e,{optionComponent:c=Ec}=e,{selectionKey:d="value"}=e,{keyOfSelected:p=a?[]:void 0}=e;function g(S){S=Y.toArray(S,!0);let M=[],D=b();for(let E of D)Y.inArray(S,E[d])&&M.push(E);S.length&&!M.length||t(0,u=a?M:M[0])}async function v(S){let M=Y.toArray(S,!0).map(D=>D[d]);!r.length||t(6,p=a?M:M[0])}function b(){if(!Y.isObjectArrayWithKeys(r,["group","items"]))return r;let S=[];for(const M of r)S=S.concat(M.items);return S}function y(S){u=S,t(0,u)}function $(S){pt.call(this,n,S)}function C(S){pt.call(this,n,S)}return n.$$set=S=>{e=bt(bt({},e),ci(S)),t(5,s=tn(e,i)),"items"in S&&t(1,r=S.items),"multiple"in S&&t(2,a=S.multiple),"selected"in S&&t(0,u=S.selected),"labelComponent"in S&&t(3,f=S.labelComponent),"optionComponent"in S&&t(4,c=S.optionComponent),"selectionKey"in S&&t(7,d=S.selectionKey),"keyOfSelected"in S&&t(6,p=S.keyOfSelected),"$$scope"in S&&t(12,o=S.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&r&&g(p),n.$$.dirty&1&&v(u)},[u,r,a,f,c,s,p,d,l,y,$,C,o]}class us extends Fe{constructor(e){super(),Le(this,e,aS,rS,Pe,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function uS(n){let e,t,i;const s=[{class:"field-type-select "+n[1]},{searchable:!0},{items:n[2]},n[3]];function l(r){n[4](r)}let o={};for(let r=0;rRe(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(r,a){V(e,r,a),i=!0},p(r,[a]){const u=a&14?bn(s,[a&2&&{class:"field-type-select "+r[1]},s[1],a&4&&{items:r[2]},a&8&&hi(r[3])]):{};!t&&a&1&&(t=!0,u.keyOfSelected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){P(e.$$.fragment,r),i=!1},d(r){z(e,r)}}}function fS(n,e,t){const i=["value","class"];let s=tn(e,i),{value:l="text"}=e,{class:o=""}=e;const r=[{label:"Text",value:"text",icon:Y.getFieldTypeIcon("text")},{label:"Number",value:"number",icon:Y.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:Y.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:Y.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:Y.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:Y.getFieldTypeIcon("date")},{label:"Multiple choices",value:"select",icon:Y.getFieldTypeIcon("select")},{label:"JSON",value:"json",icon:Y.getFieldTypeIcon("json")},{label:"File",value:"file",icon:Y.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:Y.getFieldTypeIcon("relation")},{label:"User",value:"user",icon:Y.getFieldTypeIcon("user")}];function a(u){l=u,t(0,l)}return n.$$set=u=>{e=bt(bt({},e),ci(u)),t(3,s=tn(e,i)),"value"in u&&t(0,l=u.value),"class"in u&&t(1,o=u.class)},[l,o,r,s,a]}class cS extends Fe{constructor(e){super(),Le(this,e,fS,uS,Pe,{value:0,class:1})}}function dS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Min length"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&h(e,"for",i),f&32&&o!==(o=u[5])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function hS(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=R("Max length"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(l,"min",r=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])&&h(e,"for",i),c&32&&o!==(o=f[5])&&h(l,"id",o),c&1&&r!==(r=f[0].min||0)&&h(l,"min",r),c&1&&Nt(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 pS(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=R("Regex pattern"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML="Valid Go regular expression, eg. ^\\w+$.",h(e,"for",i=n[5]),h(l,"type","text"),h(l,"id",o=n[5]),h(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,r,d),w(c,a,d),u||(f=X(l,"input",n[4]),u=!0)},p(c,d){d&32&&i!==(i=c[5])&&h(e,"for",i),d&32&&o!==(o=c[5])&&h(l,"id",o),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(r),c&&k(a),u=!1,f()}}}function mS(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[dS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[hS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[pS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(a,"class","col-sm-12"),h(e,"class","grid")},m(c,d){w(c,e,d),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),f=!0},p(c,[d]){const p={};d&2&&(p.name="schema."+c[1]+".options.min"),d&97&&(p.$$scope={dirty:d,ctx:c}),i.$set(p);const g={};d&2&&(g.name="schema."+c[1]+".options.max"),d&97&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);const v={};d&2&&(v.name="schema."+c[1]+".options.pattern"),d&97&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){P(i.$$.fragment,c),P(o.$$.fragment,c),P(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(o),z(u)}}}function gS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Nt(this.value),t(0,s)}function o(){s.max=Nt(this.value),t(0,s)}function r(){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,o,r]}class _S extends Fe{constructor(e){super(),Le(this,e,gS,mS,Pe,{key:1,options:0})}}function bS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Min"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=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),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&16&&i!==(i=u[4])&&h(e,"for",i),f&16&&o!==(o=u[4])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].min&&$e(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function vS(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=R("Max"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=n[4]),h(l,"min",r=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])&&h(e,"for",i),c&16&&o!==(o=f[4])&&h(l,"id",o),c&1&&r!==(r=f[0].min)&&h(l,"min",r),c&1&&Nt(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 yS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[bS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[vS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function kS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Nt(this.value),t(0,s)}function o(){s.max=Nt(this.value),t(0,s)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class wS extends Fe{constructor(e){super(),Le(this,e,kS,yS,Pe,{key:1,options:0})}}function SS(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 $S extends Fe{constructor(e){super(),Le(this,e,SS,null,Pe,{key:0,options:1})}}function CS(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],o={};for(let r=0;r{t(0,o=Y.splitNonEmpty(u.target.value,r))};return n.$$set=u=>{e=bt(bt({},e),ci(u)),t(3,l=tn(e,s)),"value"in u&&t(0,o=u.value),"separator"in u&&t(1,r=u.separator)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=(o||[]).join(","))},[o,r,i,l,a]}class fs extends Fe{constructor(e){super(),Le(this,e,MS,CS,Pe,{value:0,separator:1})}}function TS(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[2](b)}let v={id:n[4],disabled:!Y.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[4]),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=et(Et.call(null,s,{text:`List of domains that are NOT allowed. + This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]))&&h(e,"for",l);const $={};y&16&&($.id=b[4]),y&1&&($.disabled=!Y.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,$.value=b[0].exceptDomains,He(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function DS(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[3](b)}let v={id:n[4]+".options.onlyDomains",disabled:!Y.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[4]+".options.onlyDomains"),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=et(Et.call(null,s,{text:`List of domains that are ONLY allowed. + This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]+".options.onlyDomains"))&&h(e,"for",l);const $={};y&16&&($.id=b[4]+".options.onlyDomains"),y&1&&($.disabled=!Y.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,$.value=b[0].onlyDomains,He(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function OS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[TS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[DS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function ES(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class d_ extends Fe{constructor(e){super(),Le(this,e,ES,OS,Pe,{key:1,options:0})}}function AS(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new d_({props:r}),he.push(()=>Re(e,"key",l)),he.push(()=>Re(e,"options",o)),{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],He(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],He(()=>i=!1)),e.$set(f)},i(a){s||(A(e.$$.fragment,a),s=!0)},o(a){P(e.$$.fragment,a),s=!1},d(a){z(e,a)}}}function PS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class LS extends Fe{constructor(e){super(),Le(this,e,PS,AS,Pe,{key:0,options:1})}}var vr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ys={_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<"u"&&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},gl={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},vn=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},jn=function(n){return n===!0?1:0};function Pc(n,e){var t;return function(){var i=this,s=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,s)},e)}}var yr=function(n){return n instanceof Array?n:[n]};function pn(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function Ot(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 xl(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function h_(n,e){if(e(n))return n;if(n.parentNode)return h_(n.parentNode,e)}function eo(n,e){var t=Ot("div","numInputWrapper"),i=Ot("input","numInput "+n),s=Ot("span","arrowUp"),l=Ot("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var o in e)i.setAttribute(o,e[o]);return t.appendChild(i),t.appendChild(s),t.appendChild(l),t}function $n(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var kr=function(){},Ao=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},FS={D:kr,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:kr,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:kr,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},xi={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})"},ol={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[ol.w(n,e,t)]},F:function(n,e,t){return Ao(ol.n(n,e,t)-1,!1,e)},G:function(n,e,t){return vn(ol.h(n,e,t))},H:function(n){return vn(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 Ao(n.getMonth(),!0,e)},S:function(n){return vn(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return vn(n.getFullYear(),4)},d:function(n){return vn(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return vn(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return vn(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)}},p_=function(n){var e=n.config,t=e===void 0?ys:e,i=n.l10n,s=i===void 0?gl:i,l=n.isMobile,o=l===void 0?!1:l;return function(r,a,u){var f=u||s;return t.formatDate!==void 0&&!o?t.formatDate(r,a,f):a.split("").map(function(c,d,p){return ol[c]&&p[d-1]!=="\\"?ol[c](r,f,t):c!=="\\"?c:""}).join("")}},na=function(n){var e=n.config,t=e===void 0?ys:e,i=n.l10n,s=i===void 0?gl:i;return function(l,o,r,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=o||(t||ys).dateFormat,p=String(l).trim();if(p==="today")f=new Date,r=!0;else if(t&&t.parseDate)f=t.parseDate(l,d);else if(/Z$/.test(p)||/GMT$/.test(p))f=new Date(l);else{for(var g=void 0,v=[],b=0,y=0,$="";bMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),q=Sr(t.config);I.setHours(q.hours,q.minutes,q.seconds,I.getMilliseconds()),t.selectedDates=[I],t.latestSelectedDateObj=I}N!==void 0&&N.type!=="blur"&&it(N);var ne=t._input.value;c(),ht(),t._input.value!==ne&&t._debouncedChange()}function u(N,I){return N%12+12*jn(I===t.l10n.amPM[1])}function f(N){switch(N%24){case 0:case 12:return 12;default:return N%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var N=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,I=(parseInt(t.minuteElement.value,10)||0)%60,q=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(N=u(N,t.amPM.textContent));var ne=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&Cn(t.latestSelectedDateObj,t.config.minDate,!0)===0,Te=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&Cn(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 Ae=wr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),Qe=wr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),Ue=wr(N,I,q);if(Ue>Qe&&Ue=12)]),t.secondElement!==void 0&&(t.secondElement.value=vn(q)))}function g(N){var I=$n(N),q=parseInt(I.value)+(N.delta||0);(q/1e3>1||N.key==="Enter"&&!/[^\d]/.test(q.toString()))&&x(q)}function v(N,I,q,ne){if(I instanceof Array)return I.forEach(function(Te){return v(N,Te,q,ne)});if(N instanceof Array)return N.forEach(function(Te){return v(Te,I,q,ne)});N.addEventListener(I,q,ne),t._handlers.push({remove:function(){return N.removeEventListener(I,q,ne)}})}function b(){Ge("onChange")}function y(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(q){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+q+"]"),function(ne){return v(ne,"click",t[q])})}),t.isMobile){Ct();return}var N=Pc(ae,50);if(t._debouncedChange=Pc(b,HS),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&v(t.daysContainer,"mouseover",function(q){t.config.mode==="range"&&qe($n(q))}),v(t._input,"keydown",Ne),t.calendarContainer!==void 0&&v(t.calendarContainer,"keydown",Ne),!t.config.inline&&!t.config.static&&v(window,"resize",N),window.ontouchstart!==void 0?v(window.document,"touchstart",be):v(window.document,"mousedown",be),v(window.document,"focus",be,{capture:!0}),t.config.clickOpens===!0&&(v(t._input,"focus",t.open),v(t._input,"click",t.open)),t.daysContainer!==void 0&&(v(t.monthNav,"click",Ut),v(t.monthNav,["keyup","increment"],g),v(t.daysContainer,"click",mt)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var I=function(q){return $n(q).select()};v(t.timeContainer,["increment"],a),v(t.timeContainer,"blur",a,{capture:!0}),v(t.timeContainer,"click",C),v([t.hourElement,t.minuteElement],["focus","click"],I),t.secondElement!==void 0&&v(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&v(t.amPM,"click",function(q){a(q)})}t.config.allowInput&&v(t._input,"blur",je)}function $(N,I){var q=N!==void 0?t.parseDate(N):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(N);var Te=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&&(!Te&&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 Ae=Ot("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(Ae,t.element),Ae.appendChild(t.element),t.altInput&&Ae.appendChild(t.altInput),Ae.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function D(N,I,q,ne){var Te=G(I,!0),Ae=Ot("span",N,I.getDate().toString());return Ae.dateObj=I,Ae.$i=ne,Ae.setAttribute("aria-label",t.formatDate(I,t.config.ariaDateFormat)),N.indexOf("hidden")===-1&&Cn(I,t.now)===0&&(t.todayDateElem=Ae,Ae.classList.add("today"),Ae.setAttribute("aria-current","date")),Te?(Ae.tabIndex=-1,ct(I)&&(Ae.classList.add("selected"),t.selectedDateElem=Ae,t.config.mode==="range"&&(pn(Ae,"startRange",t.selectedDates[0]&&Cn(I,t.selectedDates[0],!0)===0),pn(Ae,"endRange",t.selectedDates[1]&&Cn(I,t.selectedDates[1],!0)===0),N==="nextMonthDay"&&Ae.classList.add("inRange")))):Ae.classList.add("flatpickr-disabled"),t.config.mode==="range"&&Ht(I)&&!ct(I)&&Ae.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&N!=="prevMonthDay"&&ne%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(I)+""),Ge("onDayCreate",Ae),Ae}function E(N){N.focus(),t.config.mode==="range"&&qe(N)}function O(N){for(var I=N>0?0:t.config.showMonths-1,q=N>0?t.config.showMonths:-1,ne=I;ne!=q;ne+=N)for(var Te=t.daysContainer.children[ne],Ae=N>0?0:Te.children.length-1,Qe=N>0?Te.children.length:-1,Ue=Ae;Ue!=Qe;Ue+=N){var xe=Te.children[Ue];if(xe.className.indexOf("hidden")===-1&&G(xe.dateObj))return xe}}function F(N,I){for(var q=N.className.indexOf("Month")===-1?N.dateObj.getMonth():t.currentMonth,ne=I>0?t.config.showMonths:-1,Te=I>0?1:-1,Ae=q-t.currentMonth;Ae!=ne;Ae+=Te)for(var Qe=t.daysContainer.children[Ae],Ue=q-t.currentMonth===Ae?N.$i+I:I<0?Qe.children.length-1:0,xe=Qe.children.length,ze=Ue;ze>=0&&ze0?xe:-1);ze+=Te){var Ye=Qe.children[ze];if(Ye.className.indexOf("hidden")===-1&&G(Ye.dateObj)&&Math.abs(N.$i-ze)>=Math.abs(I))return E(Ye)}t.changeMonth(Te),L(O(Te),0)}function L(N,I){var q=l(),ne=_e(q||document.body),Te=N!==void 0?N:ne?q:t.selectedDateElem!==void 0&&_e(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&_e(t.todayDateElem)?t.todayDateElem:O(I>0?1:-1);Te===void 0?t._input.focus():ne?F(Te,I):E(Te)}function H(N,I){for(var q=(new Date(N,I,1).getDay()-t.l10n.firstDayOfWeek+7)%7,ne=t.utils.getDaysInMonth((I-1+12)%12,N),Te=t.utils.getDaysInMonth(I,N),Ae=window.document.createDocumentFragment(),Qe=t.config.showMonths>1,Ue=Qe?"prevMonthDay hidden":"prevMonthDay",xe=Qe?"nextMonthDay hidden":"nextMonthDay",ze=ne+1-q,Ye=0;ze<=ne;ze++,Ye++)Ae.appendChild(D("flatpickr-day "+Ue,new Date(N,I-1,ze),ze,Ye));for(ze=1;ze<=Te;ze++,Ye++)Ae.appendChild(D("flatpickr-day",new Date(N,I,ze),ze,Ye));for(var gt=Te+1;gt<=42-q&&(t.config.showMonths===1||Ye%7!==0);gt++,Ye++)Ae.appendChild(D("flatpickr-day "+xe,new Date(N,I+1,gt%Te),gt,Ye));var de=Ot("div","dayContainer");return de.appendChild(Ae),de}function j(){if(t.daysContainer!==void 0){xl(t.daysContainer),t.weekNumbers&&xl(t.weekNumbers);for(var N=document.createDocumentFragment(),I=0;I1||t.config.monthSelectorType!=="dropdown")){var N=function(ne){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&net.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var I=0;I<12;I++)if(!!N(I)){var q=Ot("option","flatpickr-monthDropdown-month");q.value=new Date(t.currentYear,I).getMonth().toString(),q.textContent=Ao(I,t.config.shorthandCurrentMonth,t.l10n),q.tabIndex=-1,t.currentMonth===I&&(q.selected=!0),t.monthsDropdownContainer.appendChild(q)}}}function ie(){var N=Ot("div","flatpickr-month"),I=window.document.createDocumentFragment(),q;t.config.showMonths>1||t.config.monthSelectorType==="static"?q=Ot("span","cur-month"):(t.monthsDropdownContainer=Ot("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),v(t.monthsDropdownContainer,"change",function(Qe){var Ue=$n(Qe),xe=parseInt(Ue.value,10);t.changeMonth(xe-t.currentMonth),Ge("onMonthChange")}),Q(),q=t.monthsDropdownContainer);var ne=eo("cur-year",{tabindex:"-1"}),Te=ne.getElementsByTagName("input")[0];Te.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Te.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Te.setAttribute("max",t.config.maxDate.getFullYear().toString()),Te.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var Ae=Ot("div","flatpickr-current-month");return Ae.appendChild(q),Ae.appendChild(ne),I.appendChild(Ae),N.appendChild(I),{container:N,yearElement:Te,monthElement:q}}function U(){xl(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var N=t.config.showMonths;N--;){var I=ie();t.yearElements.push(I.yearElement),t.monthElements.push(I.monthElement),t.monthNav.appendChild(I.container)}t.monthNav.appendChild(t.nextMonthNav)}function K(){return t.monthNav=Ot("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=Ot("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=Ot("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,U(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(N){t.__hidePrevMonthArrow!==N&&(pn(t.prevMonthNav,"flatpickr-disabled",N),t.__hidePrevMonthArrow=N)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(N){t.__hideNextMonthArrow!==N&&(pn(t.nextMonthNav,"flatpickr-disabled",N),t.__hideNextMonthArrow=N)}}),t.currentYearElement=t.yearElements[0],jt(),t.monthNav}function W(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var N=Sr(t.config);t.timeContainer=Ot("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var I=Ot("span","flatpickr-time-separator",":"),q=eo("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=q.getElementsByTagName("input")[0];var ne=eo("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=ne.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?N.hours:f(N.hours)),t.minuteElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():N.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(I),t.timeContainer.appendChild(ne),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Te=eo("flatpickr-second");t.secondElement=Te.getElementsByTagName("input")[0],t.secondElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():N.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(Ot("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Te)}return t.config.time_24hr||(t.amPM=Ot("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 J(){t.weekdayContainer?xl(t.weekdayContainer):t.weekdayContainer=Ot("div","flatpickr-weekdays");for(var N=t.config.showMonths;N--;){var I=Ot("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(I)}return se(),t.weekdayContainer}function se(){if(!!t.weekdayContainer){var N=t.l10n.firstDayOfWeek,I=Lc(t.l10n.weekdays.shorthand);N>0&&N `+I.join("")+` - `}}function fe(){t.calendarContainer.classList.add("hasWeeks");var N=Ot("div","flatpickr-weekwrapper");N.appendChild(Ot("span","flatpickr-weekday",t.l10n.weekAbbreviation));var I=Ot("div","flatpickr-weeks");return N.appendChild(I),{weekWrapper:N,weekNumbers:I}}function ke(N,I){I===void 0&&(I=!0);var q=I?N:N-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,Ge("onYearChange"),Q()),j(),Ge("onMonthChange"),Ht())}function le(N,I){if(N===void 0&&(N=!0),I===void 0&&(I=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,I===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var q=Sr(t.config),ne=q.hours,Te=q.minutes,Ae=q.seconds;m(ne,Te,Ae)}t.redraw(),N&&Ge("onChange")}function ue(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Ge("onClose")}function Me(){t.config!==void 0&&Ge("onDestroy");for(var N=t._handlers.length;N--;)t._handlers[N].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 I=t.calendarContainer.parentNode;if(I.lastChild&&I.removeChild(I.lastChild),I.parentNode){for(;I.firstChild;)I.parentNode.insertBefore(I.firstChild,I);I.parentNode.removeChild(I)}}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 Z(N){return t.calendarContainer.contains(N)}function be(N){if(t.isOpen&&!t.config.inline){var I=$n(N),q=Z(I),ne=I===t.input||I===t.altInput||t.element.contains(I)||N.path&&N.path.indexOf&&(~N.path.indexOf(t.input)||~N.path.indexOf(t.altInput)),Te=!ne&&!q&&!Z(N.relatedTarget),Ae=!t.config.ignoredFocusElements.some(function(Qe){return Qe.contains(I)});Te&&Ae&&(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 x(N){if(!(!N||t.config.minDate&&Nt.config.maxDate.getFullYear())){var I=N,q=t.currentYear!==I;t.currentYear=I||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(),Ge("onYearChange"),Q())}}function G(N,I){var q;I===void 0&&(I=!0);var ne=t.parseDate(N,void 0,I);if(t.config.minDate&&ne&&Cn(ne,t.config.minDate,I!==void 0?I:!t.minDateHasTime)<0||t.config.maxDate&&ne&&Cn(ne,t.config.maxDate,I!==void 0?I:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(ne===void 0)return!1;for(var Te=!!t.config.enable,Ae=(q=t.config.enable)!==null&&q!==void 0?q:t.config.disable,Qe=0,Ue=void 0;Qe=Ue.from.getTime()&&ne.getTime()<=Ue.to.getTime())return Te}return!Te}function _e(N){return t.daysContainer!==void 0?N.className.indexOf("hidden")===-1&&N.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(N):!1}function je(N){var I=N.target===t._input,q=t._input.value.trimEnd()!==Tt();I&&q&&!(N.relatedTarget&&Z(N.relatedTarget))&&t.setDate(t._input.value,!0,N.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Ne(N){var I=$n(N),q=t.config.wrap?n.contains(I):I===t._input,ne=t.config.allowInput,Te=t.isOpen&&(!ne||!q),Ae=t.config.inline&&q&&!ne;if(N.keyCode===13&&q){if(ne)return t.setDate(t._input.value,!0,I===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),I.blur();t.open()}else if(Z(I)||Te||Ae){var Qe=!!t.timeContainer&&t.timeContainer.contains(I);switch(N.keyCode){case 13:Qe?(N.preventDefault(),a(),Ve()):mt(N);break;case 27:N.preventDefault(),Ve();break;case 8:case 46:q&&!t.config.allowInput&&(N.preventDefault(),t.clear());break;case 37:case 39:if(!Qe&&!q){N.preventDefault();var Ue=l();if(t.daysContainer!==void 0&&(ne===!1||Ue&&_e(Ue))){var xe=N.keyCode===39?1:-1;N.ctrlKey?(N.stopPropagation(),ke(xe),L(O(1),0)):L(void 0,xe)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:N.preventDefault();var ze=N.keyCode===40?1:-1;t.daysContainer&&I.$i!==void 0||I===t.input||I===t.altInput?N.ctrlKey?(N.stopPropagation(),x(t.currentYear-ze),L(O(1),0)):Qe||L(void 0,ze*7):I===t.currentYearElement?x(t.currentYear-ze):t.config.enableTime&&(!Qe&&t.hourElement&&t.hourElement.focus(),a(N),t._debouncedChange());break;case 9:if(Qe){var Ye=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(we){return we}),gt=Ye.indexOf(I);if(gt!==-1){var de=Ye[gt+(N.shiftKey?-1:1)];N.preventDefault(),(de||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(I)&&N.shiftKey&&(N.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&I===t.amPM)switch(N.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),ht();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),ht();break}(q||Z(I))&&Ge("onKeyDown",N)}function qe(N,I){if(I===void 0&&(I="flatpickr-day"),!(t.selectedDates.length!==1||N&&(!N.classList.contains(I)||N.classList.contains("flatpickr-disabled")))){for(var q=N?N.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),ne=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Te=Math.min(q,t.selectedDates[0].getTime()),Ae=Math.max(q,t.selectedDates[0].getTime()),Qe=!1,Ue=0,xe=0,ze=Te;zeTe&&zeUe)?Ue=ze:ze>ne&&(!xe||ze ."+I));Ye.forEach(function(gt){var de=gt.dateObj,we=de.getTime(),Ze=Ue>0&&we0&&we>xe;if(Ze){gt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(In){gt.classList.remove(In)});return}else if(Qe&&!Ze)return;["startRange","inRange","endRange","notAllowed"].forEach(function(In){gt.classList.remove(In)}),N!==void 0&&(N.classList.add(q<=t.selectedDates[0].getTime()?"startRange":"endRange"),neq&&we===ne&>.classList.add("endRange"),we>=Ue&&(xe===0||we<=xe)&&LS(we,ne,q)&>.classList.add("inRange"))})}}function ae(){t.isOpen&&!t.config.static&&!t.config.inline&&ot()}function re(N,I){if(I===void 0&&(I=t._positionElement),t.isMobile===!0){if(N){N.preventDefault();var q=$n(N);q&&q.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),Ge("onOpen");return}else if(t._input.disabled||t.config.inline)return;var ne=t.isOpen;t.isOpen=!0,ne||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),Ge("onOpen"),ot(I)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(N===void 0||!t.timeContainer.contains(N.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function ve(N){return function(I){var q=t.config["_"+N+"Date"]=t.parseDate(I,t.config.dateFormat),ne=t.config["_"+(N==="min"?"max":"min")+"Date"];q!==void 0&&(t[N==="min"?"minDateHasTime":"maxDateHasTime"]=q.getHours()>0||q.getMinutes()>0||q.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Te){return G(Te)}),!t.selectedDates.length&&N==="min"&&d(q),ht()),t.daysContainer&&(pe(),q!==void 0?t.currentYearElement[N]=q.getFullYear().toString():t.currentYearElement.removeAttribute(N),t.currentYearElement.disabled=!!ne&&q!==void 0&&ne.getFullYear()===q.getFullYear())}}function Je(){var N=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],I=un(un({},JSON.parse(JSON.stringify(n.dataset||{}))),e),q={};t.config.parseDate=I.parseDate,t.config.formatDate=I.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(Ye){t.config._enable=St(Ye)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(Ye){t.config._disable=St(Ye)}});var ne=I.mode==="time";if(!I.dateFormat&&(I.enableTime||ne)){var Te=en.defaultConfig.dateFormat||ys.dateFormat;q.dateFormat=I.noCalendar||ne?"H:i"+(I.enableSeconds?":S":""):Te+" H:i"+(I.enableSeconds?":S":"")}if(I.altInput&&(I.enableTime||ne)&&!I.altFormat){var Ae=en.defaultConfig.altFormat||ys.altFormat;q.altFormat=I.noCalendar||ne?"h:i"+(I.enableSeconds?":S K":" K"):Ae+(" h:i"+(I.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:ve("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:ve("max")});var Qe=function(Ye){return function(gt){t.config[Ye==="min"?"_minTime":"_maxTime"]=t.parseDate(gt,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:Qe("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:Qe("max")}),I.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,q,I);for(var Ue=0;Ue-1?t.config[ze]=yr(xe[ze]).map(o).concat(t.config[ze]):typeof I[ze]>"u"&&(t.config[ze]=xe[ze])}I.altInputClass||(t.config.altInputClass=nt().className+" "+t.config.altInputClass),Ge("onParseConfig")}function nt(){return t.config.wrap?n.querySelector("[data-input]"):n}function ut(){typeof t.config.locale!="object"&&typeof en.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=un(un({},en.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?en.l10ns[t.config.locale]:void 0),xi.D="("+t.l10n.weekdays.shorthand.join("|")+")",xi.l="("+t.l10n.weekdays.longhand.join("|")+")",xi.M="("+t.l10n.months.shorthand.join("|")+")",xi.F="("+t.l10n.months.longhand.join("|")+")",xi.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var N=un(un({},e),JSON.parse(JSON.stringify(n.dataset||{})));N.time_24hr===void 0&&en.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=h_(t),t.parseDate=na({config:t.config,l10n:t.l10n})}function ot(N){if(typeof t.config.position=="function")return void t.config.position(t,N);if(t.calendarContainer!==void 0){Ge("onPreCalendarPosition");var I=N||t._positionElement,q=Array.prototype.reduce.call(t.calendarContainer.children,function(zi,Pl){return zi+Pl.offsetHeight},0),ne=t.calendarContainer.offsetWidth,Te=t.config.position.split(" "),Ae=Te[0],Qe=Te.length>1?Te[1]:null,Ue=I.getBoundingClientRect(),xe=window.innerHeight-Ue.bottom,ze=Ae==="above"||Ae!=="below"&&xeq,Ye=window.pageYOffset+Ue.top+(ze?-q-2:I.offsetHeight+2);if(pn(t.calendarContainer,"arrowTop",!ze),pn(t.calendarContainer,"arrowBottom",ze),!t.config.inline){var gt=window.pageXOffset+Ue.left,de=!1,we=!1;Qe==="center"?(gt-=(ne-Ue.width)/2,de=!0):Qe==="right"&&(gt-=ne-Ue.width,we=!0),pn(t.calendarContainer,"arrowLeft",!de&&!we),pn(t.calendarContainer,"arrowCenter",de),pn(t.calendarContainer,"arrowRight",we);var Ze=window.document.body.offsetWidth-(window.pageXOffset+Ue.right),In=gt+ne>window.document.body.offsetWidth,Gn=Ze+ne>window.document.body.offsetWidth;if(pn(t.calendarContainer,"rightMost",In),!t.config.static)if(t.calendarContainer.style.top=Ye+"px",!In)t.calendarContainer.style.left=gt+"px",t.calendarContainer.style.right="auto";else if(!Gn)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Ze+"px";else{var ce=Xe();if(ce===void 0)return;var Ee=window.document.body.offsetWidth,rt=Math.max(0,Ee/2-ne/2),Vi=".flatpickr-calendar.centerMost:before",El=".flatpickr-calendar.centerMost:after",cs=ce.cssRules.length,Al="{left:"+Ue.left+"px;right:auto;}";pn(t.calendarContainer,"rightMost",!1),pn(t.calendarContainer,"centerMost",!0),ce.insertRule(Vi+","+El+Al,cs),t.calendarContainer.style.left=rt+"px",t.calendarContainer.style.right="auto"}}}}function Xe(){for(var N=null,I=0;It.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=ne,t.config.mode==="single")t.selectedDates=[Te];else if(t.config.mode==="multiple"){var Qe=ct(Te);Qe?t.selectedDates.splice(parseInt(Qe),1):t.selectedDates.push(Te)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Te,t.selectedDates.push(Te),Cn(Te,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(Ye,gt){return Ye.getTime()-gt.getTime()}));if(c(),Ae){var Ue=t.currentYear!==Te.getFullYear();t.currentYear=Te.getFullYear(),t.currentMonth=Te.getMonth(),Ue&&(Ge("onYearChange"),Q()),Ge("onMonthChange")}if(Ht(),j(),ht(),!Ae&&t.config.mode!=="range"&&t.config.showMonths===1?E(ne):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 xe=t.config.mode==="single"&&!t.config.enableTime,ze=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(xe||ze)&&Ve()}b()}}var te={locale:[ut,se],showMonths:[U,r,J],minDate:[C],maxDate:[C],positionElement:[Ft],clickOpens:[function(){t.config.clickOpens===!0?(v(t._input,"focus",t.open),v(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function ye(N,I){if(N!==null&&typeof N=="object"){Object.assign(t.config,N);for(var q in N)te[q]!==void 0&&te[q].forEach(function(ne){return ne()})}else t.config[N]=I,te[N]!==void 0?te[N].forEach(function(ne){return ne()}):vr.indexOf(N)>-1&&(t.config[N]=yr(I));t.redraw(),ht(!0)}function Ke(N,I){var q=[];if(N instanceof Array)q=N.map(function(ne){return t.parseDate(ne,I)});else if(N instanceof Date||typeof N=="number")q=[t.parseDate(N,I)];else if(typeof N=="string")switch(t.config.mode){case"single":case"time":q=[t.parseDate(N,I)];break;case"multiple":q=N.split(t.config.conjunction).map(function(ne){return t.parseDate(ne,I)});break;case"range":q=N.split(t.l10n.rangeSeparator).map(function(ne){return t.parseDate(ne,I)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(N)));t.selectedDates=t.config.allowInvalidPreload?q:q.filter(function(ne){return ne instanceof Date&&G(ne,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(ne,Te){return ne.getTime()-Te.getTime()})}function ft(N,I,q){if(I===void 0&&(I=!1),q===void 0&&(q=t.config.dateFormat),N!==0&&!N||N instanceof Array&&N.length===0)return t.clear(I);Ke(N,q),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),C(void 0,I),d(),t.selectedDates.length===0&&t.clear(!1),ht(I),I&&Ge("onChange")}function St(N){return N.slice().map(function(I){return typeof I=="string"||typeof I=="number"||I instanceof Date?t.parseDate(I,void 0,!0):I&&typeof I=="object"&&I.from&&I.to?{from:t.parseDate(I.from,void 0),to:t.parseDate(I.to,void 0)}:I}).filter(function(I){return I})}function $t(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var N=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);N&&Ke(N,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 Nt(){if(t.input=nt(),!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=Ot(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"),Ft()}function Ft(){t._positionElement=t.config.positionElement||t._input}function Ct(){var N=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=Ot("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=N,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=N==="datetime-local"?"Y-m-d\\TH:i:S":N==="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{}v(t.mobileInput,"change",function(I){t.setDate($n(I).value,!1,t.mobileFormatStr),Ge("onChange"),Ge("onClose")})}function Yt(N){if(t.isOpen===!0)return t.close();t.open(N)}function Ge(N,I){if(t.config!==void 0){var q=t.config[N];if(q!==void 0&&q.length>0)for(var ne=0;q[ne]&&ne=0&&Cn(N,t.selectedDates[1])<=0}function Ht(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(N,I){var q=new Date(t.currentYear,t.currentMonth,1);q.setMonth(t.currentMonth+I),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[I].textContent=Ao(q.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=q.getMonth().toString(),N.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 Tt(N){var I=N||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(q){return t.formatDate(q,I)}).filter(function(q,ne,Te){return t.config.mode!=="range"||t.config.enableTime||Te.indexOf(q)===ne}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function ht(N){N===void 0&&(N=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=Tt(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=Tt(t.config.altFormat)),N!==!1&&Ge("onValueUpdate")}function Ut(N){var I=$n(N),q=t.prevMonthNav.contains(I),ne=t.nextMonthNav.contains(I);q||ne?ke(q?-1:1):t.yearElements.indexOf(I)>=0?I.select():I.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):I.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function it(N){N.preventDefault();var I=N.type==="keydown",q=$n(N),ne=q;t.amPM!==void 0&&q===t.amPM&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]);var Te=parseFloat(ne.getAttribute("min")),Ae=parseFloat(ne.getAttribute("max")),Qe=parseFloat(ne.getAttribute("step")),Ue=parseInt(ne.value,10),xe=N.delta||(I?N.which===38?1:-1:0),ze=Ue+Qe*xe;if(typeof ne.value<"u"&&ne.value.length===2){var Ye=ne===t.hourElement,gt=ne===t.minuteElement;zeAe&&(ze=ne===t.hourElement?ze-Ae-jn(!t.amPM):Te,gt&&S(void 0,1,t.hourElement)),t.amPM&&Ye&&(Qe===1?ze+Ue===23:Math.abs(ze-Ue)>Qe)&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]),ne.value=vn(ze)}}return s(),t}function ks(n,e){for(var t=Array.prototype.slice.call(n).filter(function(o){return o instanceof HTMLElement}),i=[],s=0;s{const S=f||g,M=y(d);return M.onReady.push(()=>{t(8,m=!0)}),t(3,v=en(S,Object.assign(M,f?{wrap:!0}:{}))),()=>{v.destroy()}});const b=hn();function y(S={}){S=Object.assign({},S);for(const M of r){const D=(E,O,F)=>{b(qS(M),[E,O,F])};M in S?(Array.isArray(S[M])||(S[M]=[S[M]]),S[M].push(D)):S[M]=[D]}return S.onChange&&!S.onChange.includes(C)&&S.onChange.push(C),S}function C(S,M,D){var O,F;const E=(F=(O=D==null?void 0:D.config)==null?void 0:O.mode)!=null?F:"single";t(2,a=E==="single"?S[0]:S),t(4,u=M)}function $(S){he[S?"unshift":"push"](()=>{g=S,t(0,g)})}return n.$$set=S=>{e=_t(_t({},e),ci(S)),t(1,s=tn(e,i)),"value"in S&&t(2,a=S.value),"formattedValue"in S&&t(4,u=S.formattedValue),"element"in S&&t(5,f=S.element),"dateFormat"in S&&t(6,c=S.dateFormat),"options"in S&&t(7,d=S.options),"input"in S&&t(0,g=S.input),"flatpickr"in S&&t(3,v=S.flatpickr),"$$scope"in S&&t(9,o=S.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&v&&m&&v.setDate(a,!1,c),n.$$.dirty&392&&v&&m)for(const[S,M]of Object.entries(y(d)))v.set(S,M)},[g,s,a,v,u,f,c,d,m,o,l,$]}class Ba extends Fe{constructor(e){super(),Le(this,e,VS,jS,Pe,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function zS(n){let e,t,i,s,l,o,r;function a(f){n[2](f)}let u={id:n[4],options:Y.defaultFlatpickrOptions(),value:n[0].min};return n[0].min!==void 0&&(u.formattedValue=n[0].min),l=new Ba({props:u}),he.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=R("Min date (UTC)"),s=T(),B(l.$$.fragment),h(e,"for",i=n[4])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&h(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].min),!o&&c&1&&(o=!0,d.formattedValue=f[0].min,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function BS(n){let e,t,i,s,l,o,r;function a(f){n[3](f)}let u={id:n[4],options:Y.defaultFlatpickrOptions(),value:n[0].max};return n[0].max!==void 0&&(u.formattedValue=n[0].max),l=new Ba({props:u}),he.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=R("Max date (UTC)"),s=T(),B(l.$$.fragment),h(e,"for",i=n[4])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&h(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].max),!o&&c&1&&(o=!0,d.formattedValue=f[0].max,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function US(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[zS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[BS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function WS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.min,r)&&(s.min=r,t(0,s))}function o(r){n.$$.not_equal(s.max,r)&&(s.max=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class YS extends Fe{constructor(e){super(),Le(this,e,WS,US,Pe,{key:1,options:0})}}function KS(n){let e,t,i,s,l,o,r,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 fs({props:c}),he.push(()=>Re(l,"value",f)),{c(){e=_("label"),t=R("Choices"),s=T(),B(l.$$.fragment),r=T(),a=_("div"),a.textContent="Use comma as separator.",h(e,"for",i=n[4]),h(a,"class","help-block")},m(d,m){w(d,e,m),p(e,t),w(d,s,m),V(l,d,m),w(d,r,m),w(d,a,m),u=!0},p(d,m){(!u||m&16&&i!==(i=d[4]))&&h(e,"for",i);const g={};m&16&&(g.id=d[4]),!o&&m&1&&(o=!0,g.value=d[0].values,He(()=>o=!1)),l.$set(g)},i(d){u||(A(l.$$.fragment,d),u=!0)},o(d){P(l.$$.fragment,d),u=!1},d(d){d&&k(e),d&&k(s),z(l,d),d&&k(r),d&&k(a)}}}function ZS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=n[4]),h(l,"step","1"),h(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&16&&i!==(i=u[4])&&h(e,"for",i),f&16&&o!==(o=u[4])&&h(l,"id",o),f&1&&It(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function JS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.values",$$slots:{default:[KS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[ZS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-9"),h(l,"class","col-sm-3"),h(e,"class","grid")},m(a,u){w(a,e,u),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function GS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.values,r)&&(s.values=r,t(0,s))}function o(){s.maxSelect=It(this.value),t(0,s)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},n.$$.update=()=>{n.$$.dirty&1&&Y.isEmpty(s)&&t(0,s={maxSelect:1,values:[]})},[s,i,l,o]}class XS extends Fe{constructor(e){super(),Le(this,e,GS,JS,Pe,{key:1,options:0})}}function QS(n,e,t){return["",{}]}class xS extends Fe{constructor(e){super(),Le(this,e,QS,null,Pe,{key:0,options:1})}get key(){return this.$$.ctx[0]}get options(){return this.$$.ctx[1]}}function e3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max file size (bytes)"),s=T(),l=_("input"),h(e,"for",i=n[10]),h(l,"type","number"),h(l,"id",o=n[10]),h(l,"step","1"),h(l,"min","0")},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSize),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&h(e,"for",i),f&1024&&o!==(o=u[10])&&h(l,"id",o),f&1&&It(l.value)!==u[0].maxSize&&$e(l,u[0].maxSize)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function t3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max files"),s=T(),l=_("input"),h(e,"for",i=n[10]),h(l,"type","number"),h(l,"id",o=n[10]),h(l,"step","1"),h(l,"min",""),l.required=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&h(e,"for",i),f&1024&&o!==(o=u[10])&&h(l,"id",o),f&1&&It(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function n3(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("div"),e.innerHTML='Documents (pdf, doc/docx, xls/xlsx)',t=T(),i=_("div"),i.innerHTML='Images (jpg, png, svg, gif)',s=T(),l=_("div"),l.innerHTML='Videos (mp4, avi, mov, 3gp)',o=T(),r=_("div"),r.innerHTML='Archives (zip, 7zip, rar)',h(e,"tabindex","0"),h(e,"class","dropdown-item closable"),h(i,"tabindex","0"),h(i,"class","dropdown-item closable"),h(l,"tabindex","0"),h(l,"class","dropdown-item closable"),h(r,"tabindex","0"),h(r,"class","dropdown-item closable")},m(f,c){w(f,e,c),w(f,t,c),w(f,i,c),w(f,s,c),w(f,l,c),w(f,o,c),w(f,r,c),a||(u=[X(e,"click",n[5]),X(i,"click",n[6]),X(l,"click",n[7]),X(r,"click",n[8])],a=!0)},p:oe,d(f){f&&k(e),f&&k(t),f&&k(i),f&&k(s),f&&k(l),f&&k(o),f&&k(r),a=!1,st(u)}}}function i3(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C;function $(M){n[4](M)}let S={id:n[10],placeholder:"eg. image/png, application/pdf..."};return n[0].mimeTypes!==void 0&&(S.value=n[0].mimeTypes),r=new fs({props:S}),he.push(()=>Re(r,"value",$)),v=new qi({props:{class:"dropdown dropdown-sm dropdown-nowrap",$$slots:{default:[n3]},$$scope:{ctx:n}}}),{c(){e=_("label"),t=_("span"),t.textContent="Mime types",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),c=R(`Use comma as separator. - `),d=_("span"),m=_("span"),m.textContent="Choose presets",g=T(),B(v.$$.fragment),h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(m,"class","txt link-primary"),h(d,"class","inline-flex"),h(f,"class","help-block")},m(M,D){w(M,e,D),p(e,t),p(e,i),p(e,s),w(M,o,D),V(r,M,D),w(M,u,D),w(M,f,D),p(f,c),p(f,d),p(d,m),p(d,g),V(v,d,null),b=!0,y||(C=et(Et.call(null,s,{text:`Allow files ONLY with the listed mime types. - Leave empty for no restriction.`,position:"top"})),y=!0)},p(M,D){(!b||D&1024&&l!==(l=M[10]))&&h(e,"for",l);const E={};D&1024&&(E.id=M[10]),!a&&D&1&&(a=!0,E.value=M[0].mimeTypes,He(()=>a=!1)),r.$set(E);const O={};D&2049&&(O.$$scope={dirty:D,ctx:M}),v.$set(O)},i(M){b||(A(r.$$.fragment,M),A(v.$$.fragment,M),b=!0)},o(M){P(r.$$.fragment,M),P(v.$$.fragment,M),b=!1},d(M){M&&k(e),M&&k(o),z(r,M),M&&k(u),M&&k(f),z(v),y=!1,C()}}}function s3(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;function g(b){n[9](b)}let v={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(v.value=n[0].thumbs),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(f,"class","help-block")},m(b,y){w(b,e,y),p(e,t),p(e,i),p(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(m=et(Et.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,y){(!c||y&1024&&l!==(l=b[10]))&&h(e,"for",l);const C={};y&1024&&(C.id=b[10]),!a&&y&1&&(a=!0,C.value=b[0].thumbs,He(()=>a=!1)),r.$set(C)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,m()}}}function l3(n){let e,t,i,s,l,o,r,a,u,f,c,d,m;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[e3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[t3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[i3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),d=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[s3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),f=T(),c=_("div"),B(d.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(a,"class","col-sm-12"),h(c,"class","col-sm-12"),h(e,"class","grid")},m(g,v){w(g,e,v),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),p(e,r),p(e,a),V(u,a,null),p(e,f),p(e,c),V(d,c,null),m=!0},p(g,[v]){const b={};v&2&&(b.name="schema."+g[1]+".options.maxSize"),v&3073&&(b.$$scope={dirty:v,ctx:g}),i.$set(b);const y={};v&2&&(y.name="schema."+g[1]+".options.maxSelect"),v&3073&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const C={};v&2&&(C.name="schema."+g[1]+".options.mimeTypes"),v&3073&&(C.$$scope={dirty:v,ctx:g}),u.$set(C);const $={};v&2&&($.name="schema."+g[1]+".options.thumbs"),v&3073&&($.$$scope={dirty:v,ctx:g}),d.$set($)},i(g){m||(A(i.$$.fragment,g),A(o.$$.fragment,g),A(u.$$.fragment,g),A(d.$$.fragment,g),m=!0)},o(g){P(i.$$.fragment,g),P(o.$$.fragment,g),P(u.$$.fragment,g),P(d.$$.fragment,g),m=!1},d(g){g&&k(e),z(i),z(o),z(u),z(d)}}}function o3(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=It(this.value),t(0,s)}function o(){s.maxSelect=It(this.value),t(0,s)}function r(m){n.$$.not_equal(s.mimeTypes,m)&&(s.mimeTypes=m,t(0,s))}const a=()=>{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)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(m){n.$$.not_equal(s.thumbs,m)&&(s.thumbs=m,t(0,s))}return n.$$set=m=>{"key"in m&&t(1,i=m.key),"options"in m&&t(0,s=m.options)},n.$$.update=()=>{n.$$.dirty&1&&Y.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class r3 extends Fe{constructor(e){super(),Le(this,e,o3,l3,Pe,{key:1,options:0})}}function a3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Collection"),s=T(),B(l.$$.fragment),h(e,"for",i=n[9])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&h(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]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionId,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function u3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","number"),h(l,"id",o=n[9]),h(l,"step","1"),h(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),r||(a=X(l,"input",n[6]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&1&&It(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function f3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Delete record on relation delete"),s=T(),B(l.$$.fragment),h(e,"for",i=n[9])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&h(e,"for",i);const d={};c&512&&(d.id=f[9]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function c3(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.collectionId",$$slots:{default:[a3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[u3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[f3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),h(t,"class","col-sm-9"),h(l,"class","col-sm-3"),h(a,"class","col-sm-12"),h(e,"class","grid")},m(c,d){w(c,e,d),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),p(e,r),p(e,a),V(u,a,null),f=!0},p(c,[d]){const m={};d&2&&(m.name="schema."+c[1]+".options.collectionId"),d&1549&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const g={};d&2&&(g.name="schema."+c[1]+".options.maxSelect"),d&1537&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);const v={};d&2&&(v.name="schema."+c[1]+".options.cascadeDelete"),d&1537&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){P(i.$$.fragment,c),P(o.$$.fragment,c),P(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(o),z(u)}}}function d3(n,e,t){let{key:i=""}=e,{options:s={}}=e;const l=[{label:"False",value:!1},{label:"True",value:!0}];let o=!1,r=[];a();function a(){t(2,o=!0),Se.Collections.getFullList(200,{sort:"-created"}).then(d=>{t(3,r=d)}).catch(d=>{Se.errorResponseHandler(d)}).finally(()=>{t(2,o=!1)})}function u(d){n.$$.not_equal(s.collectionId,d)&&(s.collectionId=d,t(0,s))}function f(){s.maxSelect=It(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&&Y.isEmpty(s)&&t(0,s={maxSelect:1,collectionId:null,cascadeDelete:!1})},[s,i,o,r,l,u,f,c]}class h3 extends Fe{constructor(e){super(),Le(this,e,d3,c3,Pe,{key:1,options:0})}}function p3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),p(e,t),w(u,s,f),w(u,l,f),$e(l,n[0].maxSelect),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&h(e,"for",i),f&32&&o!==(o=u[5])&&h(l,"id",o),f&1&&It(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function m3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Delete record on user delete"),s=T(),B(l.$$.fragment),h(e,"for",i=n[5])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&32&&i!==(i=f[5]))&&h(e,"for",i);const d={};c&32&&(d.id=f[5]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function g3(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[p3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[m3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),p(e,t),V(i,t,null),p(e,s),p(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function _3(n,e,t){const i=[{label:"False",value:!1},{label:"True",value:!0}];let{key:s=""}=e,{options:l={}}=e;function o(){l.maxSelect=It(this.value),t(0,l)}function r(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&&Y.isEmpty(l)&&t(0,l={maxSelect:1,cascadeDelete:!1})},[l,s,i,o,r]}class b3 extends Fe{constructor(e){super(),Le(this,e,_3,g3,Pe,{key:1,options:0})}}function v3(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[38],disabled:n[0].id};return n[0].type!==void 0&&(u.value=n[0].type),l=new uS({props:u}),he.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=R("Type"),s=T(),B(l.$$.fragment),h(e,"for",i=n[38])},m(f,c){w(f,e,c),p(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c[1]&128&&i!==(i=f[38]))&&h(e,"for",i);const d={};c[1]&128&&(d.id=f[38]),c[0]&1&&(d.disabled=f[0].id),!o&&c[0]&1&&(o=!0,d.value=f[0].type,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function Lc(n){let e,t,i;return{c(){e=_("span"),e.textContent="Duplicated or invalid name",h(e,"class","txt invalid-name-note svelte-1tpxlm5")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Un,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Un,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function y3(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g=!n[5]&&Lc();return{c(){e=_("label"),t=_("span"),t.textContent="Name",i=T(),g&&g.c(),l=T(),o=_("input"),h(t,"class","txt"),h(e,"for",s=n[38]),h(o,"type","text"),h(o,"id",r=n[38]),o.required=!0,o.disabled=a=n[0].id&&n[0].system,h(o,"spellcheck","false"),o.autofocus=u=!n[0].id,o.value=f=n[0].name},m(v,b){w(v,e,b),p(e,t),p(e,i),g&&g.m(e,null),w(v,l,b),w(v,o,b),c=!0,n[0].id||o.focus(),d||(m=X(o,"input",n[17]),d=!0)},p(v,b){v[5]?g&&(De(),P(g,1,1,()=>{g=null}),Oe()):g?b[0]&32&&A(g,1):(g=Lc(),g.c(),A(g,1),g.m(e,null)),(!c||b[1]&128&&s!==(s=v[38]))&&h(e,"for",s),(!c||b[1]&128&&r!==(r=v[38]))&&h(o,"id",r),(!c||b[0]&1&&a!==(a=v[0].id&&v[0].system))&&(o.disabled=a),(!c||b[0]&1&&u!==(u=!v[0].id))&&(o.autofocus=u),(!c||b[0]&1&&f!==(f=v[0].name)&&o.value!==f)&&(o.value=f)},i(v){c||(A(g),c=!0)},o(v){P(g),c=!1},d(v){v&&k(e),g&&g.d(),v&&k(l),v&&k(o),d=!1,m()}}}function k3(n){let e,t,i;function s(o){n[28](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new b3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function w3(n){let e,t,i;function s(o){n[27](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new h3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function S3(n){let e,t,i;function s(o){n[26](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new r3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function $3(n){let e,t,i;function s(o){n[25](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new xS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function C3(n){let e,t,i;function s(o){n[24](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new XS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function M3(n){let e,t,i;function s(o){n[23](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new YS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function T3(n){let e,t,i;function s(o){n[22](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new AS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function D3(n){let e,t,i;function s(o){n[21](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new c_({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function O3(n){let e,t,i;function s(o){n[20](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new wS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function E3(n){let e,t,i;function s(o){n[19](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new yS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function A3(n){let e,t,i;function s(o){n[18](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new mS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function P3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Required"),h(e,"type","checkbox"),h(e,"id",t=n[38]),h(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].required,w(u,i,f),w(u,s,f),p(s,l),r||(a=X(e,"change",n[29]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&h(e,"id",t),f[0]&1&&(e.checked=u[0].required),f[1]&128&&o!==(o=u[38])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Fc(n){let e,t;return e=new Ie({props:{class:"form-field form-field-toggle m-0",name:"unique",$$slots:{default:[L3,({uniqueId:i})=>({38:i}),({uniqueId:i})=>[0,i?128: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]&384&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function L3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Unique"),h(e,"type","checkbox"),h(e,"id",t=n[38]),h(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].unique,w(u,i,f),w(u,s,f),p(s,l),r||(a=X(e,"change",n[30]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&h(e,"id",t),f[0]&1&&(e.checked=u[0].unique),f[1]&128&&o!==(o=u[38])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Ic(n){let e,t,i,s,l,o,r,a,u,f;a=new qi({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[F3]},$$scope:{ctx:n}}});let c=n[8]&&Nc(n);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),l=_("button"),o=_("i"),r=T(),B(a.$$.fragment),u=T(),c&&c.c(),h(t,"class","flex-fill"),h(o,"class","ri-more-line"),h(l,"type","button"),h(l,"class","btn btn-circle btn-sm btn-secondary"),h(s,"class","inline-flex flex-gap-sm flex-nowrap"),h(e,"class","col-sm-4 txt-right")},m(d,m){w(d,e,m),p(e,t),p(e,i),p(e,s),p(s,l),p(l,o),p(l,r),V(a,l,null),p(s,u),c&&c.m(s,null),f=!0},p(d,m){const g={};m[1]&256&&(g.$$scope={dirty:m,ctx:d}),a.$set(g),d[8]?c?c.p(d,m):(c=Nc(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i(d){f||(A(a.$$.fragment,d),f=!0)},o(d){P(a.$$.fragment,d),f=!1},d(d){d&&k(e),z(a),c&&c.d()}}}function F3(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Remove',h(e,"type","button"),h(e,"class","dropdown-item txt-right")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[9]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Nc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Done',h(e,"type","button"),h(e,"class","btn btn-sm btn-outline btn-expanded-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[3])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function I3(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$,S,M,D;s=new Ie({props:{class:"form-field required "+(n[0].id?"disabled":""),name:"schema."+n[1]+".type",$$slots:{default:[v3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}}),r=new Ie({props:{class:` + `}}function fe(){t.calendarContainer.classList.add("hasWeeks");var N=Ot("div","flatpickr-weekwrapper");N.appendChild(Ot("span","flatpickr-weekday",t.l10n.weekAbbreviation));var I=Ot("div","flatpickr-weeks");return N.appendChild(I),{weekWrapper:N,weekNumbers:I}}function ke(N,I){I===void 0&&(I=!0);var q=I?N:N-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,Ge("onYearChange"),Q()),j(),Ge("onMonthChange"),jt())}function le(N,I){if(N===void 0&&(N=!0),I===void 0&&(I=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,I===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var q=Sr(t.config),ne=q.hours,Te=q.minutes,Ae=q.seconds;p(ne,Te,Ae)}t.redraw(),N&&Ge("onChange")}function ue(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Ge("onClose")}function Me(){t.config!==void 0&&Ge("onDestroy");for(var N=t._handlers.length;N--;)t._handlers[N].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 I=t.calendarContainer.parentNode;if(I.lastChild&&I.removeChild(I.lastChild),I.parentNode){for(;I.firstChild;)I.parentNode.insertBefore(I.firstChild,I);I.parentNode.removeChild(I)}}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 Z(N){return t.calendarContainer.contains(N)}function be(N){if(t.isOpen&&!t.config.inline){var I=$n(N),q=Z(I),ne=I===t.input||I===t.altInput||t.element.contains(I)||N.path&&N.path.indexOf&&(~N.path.indexOf(t.input)||~N.path.indexOf(t.altInput)),Te=!ne&&!q&&!Z(N.relatedTarget),Ae=!t.config.ignoredFocusElements.some(function(Qe){return Qe.contains(I)});Te&&Ae&&(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 x(N){if(!(!N||t.config.minDate&&Nt.config.maxDate.getFullYear())){var I=N,q=t.currentYear!==I;t.currentYear=I||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(),Ge("onYearChange"),Q())}}function G(N,I){var q;I===void 0&&(I=!0);var ne=t.parseDate(N,void 0,I);if(t.config.minDate&&ne&&Cn(ne,t.config.minDate,I!==void 0?I:!t.minDateHasTime)<0||t.config.maxDate&&ne&&Cn(ne,t.config.maxDate,I!==void 0?I:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(ne===void 0)return!1;for(var Te=!!t.config.enable,Ae=(q=t.config.enable)!==null&&q!==void 0?q:t.config.disable,Qe=0,Ue=void 0;Qe=Ue.from.getTime()&&ne.getTime()<=Ue.to.getTime())return Te}return!Te}function _e(N){return t.daysContainer!==void 0?N.className.indexOf("hidden")===-1&&N.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(N):!1}function je(N){var I=N.target===t._input,q=t._input.value.trimEnd()!==Tt();I&&q&&!(N.relatedTarget&&Z(N.relatedTarget))&&t.setDate(t._input.value,!0,N.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Ne(N){var I=$n(N),q=t.config.wrap?n.contains(I):I===t._input,ne=t.config.allowInput,Te=t.isOpen&&(!ne||!q),Ae=t.config.inline&&q&&!ne;if(N.keyCode===13&&q){if(ne)return t.setDate(t._input.value,!0,I===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),I.blur();t.open()}else if(Z(I)||Te||Ae){var Qe=!!t.timeContainer&&t.timeContainer.contains(I);switch(N.keyCode){case 13:Qe?(N.preventDefault(),a(),Ve()):mt(N);break;case 27:N.preventDefault(),Ve();break;case 8:case 46:q&&!t.config.allowInput&&(N.preventDefault(),t.clear());break;case 37:case 39:if(!Qe&&!q){N.preventDefault();var Ue=l();if(t.daysContainer!==void 0&&(ne===!1||Ue&&_e(Ue))){var xe=N.keyCode===39?1:-1;N.ctrlKey?(N.stopPropagation(),ke(xe),L(O(1),0)):L(void 0,xe)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:N.preventDefault();var ze=N.keyCode===40?1:-1;t.daysContainer&&I.$i!==void 0||I===t.input||I===t.altInput?N.ctrlKey?(N.stopPropagation(),x(t.currentYear-ze),L(O(1),0)):Qe||L(void 0,ze*7):I===t.currentYearElement?x(t.currentYear-ze):t.config.enableTime&&(!Qe&&t.hourElement&&t.hourElement.focus(),a(N),t._debouncedChange());break;case 9:if(Qe){var Ye=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(we){return we}),gt=Ye.indexOf(I);if(gt!==-1){var de=Ye[gt+(N.shiftKey?-1:1)];N.preventDefault(),(de||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(I)&&N.shiftKey&&(N.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&I===t.amPM)switch(N.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),ht();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),ht();break}(q||Z(I))&&Ge("onKeyDown",N)}function qe(N,I){if(I===void 0&&(I="flatpickr-day"),!(t.selectedDates.length!==1||N&&(!N.classList.contains(I)||N.classList.contains("flatpickr-disabled")))){for(var q=N?N.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),ne=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Te=Math.min(q,t.selectedDates[0].getTime()),Ae=Math.max(q,t.selectedDates[0].getTime()),Qe=!1,Ue=0,xe=0,ze=Te;zeTe&&zeUe)?Ue=ze:ze>ne&&(!xe||ze ."+I));Ye.forEach(function(gt){var de=gt.dateObj,we=de.getTime(),Ze=Ue>0&&we0&&we>xe;if(Ze){gt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(In){gt.classList.remove(In)});return}else if(Qe&&!Ze)return;["startRange","inRange","endRange","notAllowed"].forEach(function(In){gt.classList.remove(In)}),N!==void 0&&(N.classList.add(q<=t.selectedDates[0].getTime()?"startRange":"endRange"),neq&&we===ne&>.classList.add("endRange"),we>=Ue&&(xe===0||we<=xe)&&IS(we,ne,q)&>.classList.add("inRange"))})}}function ae(){t.isOpen&&!t.config.static&&!t.config.inline&&ot()}function re(N,I){if(I===void 0&&(I=t._positionElement),t.isMobile===!0){if(N){N.preventDefault();var q=$n(N);q&&q.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),Ge("onOpen");return}else if(t._input.disabled||t.config.inline)return;var ne=t.isOpen;t.isOpen=!0,ne||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),Ge("onOpen"),ot(I)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(N===void 0||!t.timeContainer.contains(N.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function ve(N){return function(I){var q=t.config["_"+N+"Date"]=t.parseDate(I,t.config.dateFormat),ne=t.config["_"+(N==="min"?"max":"min")+"Date"];q!==void 0&&(t[N==="min"?"minDateHasTime":"maxDateHasTime"]=q.getHours()>0||q.getMinutes()>0||q.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Te){return G(Te)}),!t.selectedDates.length&&N==="min"&&d(q),ht()),t.daysContainer&&(pe(),q!==void 0?t.currentYearElement[N]=q.getFullYear().toString():t.currentYearElement.removeAttribute(N),t.currentYearElement.disabled=!!ne&&q!==void 0&&ne.getFullYear()===q.getFullYear())}}function Je(){var N=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],I=un(un({},JSON.parse(JSON.stringify(n.dataset||{}))),e),q={};t.config.parseDate=I.parseDate,t.config.formatDate=I.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(Ye){t.config._enable=St(Ye)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(Ye){t.config._disable=St(Ye)}});var ne=I.mode==="time";if(!I.dateFormat&&(I.enableTime||ne)){var Te=en.defaultConfig.dateFormat||ys.dateFormat;q.dateFormat=I.noCalendar||ne?"H:i"+(I.enableSeconds?":S":""):Te+" H:i"+(I.enableSeconds?":S":"")}if(I.altInput&&(I.enableTime||ne)&&!I.altFormat){var Ae=en.defaultConfig.altFormat||ys.altFormat;q.altFormat=I.noCalendar||ne?"h:i"+(I.enableSeconds?":S K":" K"):Ae+(" h:i"+(I.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:ve("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:ve("max")});var Qe=function(Ye){return function(gt){t.config[Ye==="min"?"_minTime":"_maxTime"]=t.parseDate(gt,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:Qe("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:Qe("max")}),I.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,q,I);for(var Ue=0;Ue-1?t.config[ze]=yr(xe[ze]).map(o).concat(t.config[ze]):typeof I[ze]>"u"&&(t.config[ze]=xe[ze])}I.altInputClass||(t.config.altInputClass=nt().className+" "+t.config.altInputClass),Ge("onParseConfig")}function nt(){return t.config.wrap?n.querySelector("[data-input]"):n}function ut(){typeof t.config.locale!="object"&&typeof en.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=un(un({},en.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?en.l10ns[t.config.locale]:void 0),xi.D="("+t.l10n.weekdays.shorthand.join("|")+")",xi.l="("+t.l10n.weekdays.longhand.join("|")+")",xi.M="("+t.l10n.months.shorthand.join("|")+")",xi.F="("+t.l10n.months.longhand.join("|")+")",xi.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var N=un(un({},e),JSON.parse(JSON.stringify(n.dataset||{})));N.time_24hr===void 0&&en.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=p_(t),t.parseDate=na({config:t.config,l10n:t.l10n})}function ot(N){if(typeof t.config.position=="function")return void t.config.position(t,N);if(t.calendarContainer!==void 0){Ge("onPreCalendarPosition");var I=N||t._positionElement,q=Array.prototype.reduce.call(t.calendarContainer.children,function(zi,Pl){return zi+Pl.offsetHeight},0),ne=t.calendarContainer.offsetWidth,Te=t.config.position.split(" "),Ae=Te[0],Qe=Te.length>1?Te[1]:null,Ue=I.getBoundingClientRect(),xe=window.innerHeight-Ue.bottom,ze=Ae==="above"||Ae!=="below"&&xeq,Ye=window.pageYOffset+Ue.top+(ze?-q-2:I.offsetHeight+2);if(pn(t.calendarContainer,"arrowTop",!ze),pn(t.calendarContainer,"arrowBottom",ze),!t.config.inline){var gt=window.pageXOffset+Ue.left,de=!1,we=!1;Qe==="center"?(gt-=(ne-Ue.width)/2,de=!0):Qe==="right"&&(gt-=ne-Ue.width,we=!0),pn(t.calendarContainer,"arrowLeft",!de&&!we),pn(t.calendarContainer,"arrowCenter",de),pn(t.calendarContainer,"arrowRight",we);var Ze=window.document.body.offsetWidth-(window.pageXOffset+Ue.right),In=gt+ne>window.document.body.offsetWidth,Gn=Ze+ne>window.document.body.offsetWidth;if(pn(t.calendarContainer,"rightMost",In),!t.config.static)if(t.calendarContainer.style.top=Ye+"px",!In)t.calendarContainer.style.left=gt+"px",t.calendarContainer.style.right="auto";else if(!Gn)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Ze+"px";else{var ce=Xe();if(ce===void 0)return;var Ee=window.document.body.offsetWidth,rt=Math.max(0,Ee/2-ne/2),Vi=".flatpickr-calendar.centerMost:before",El=".flatpickr-calendar.centerMost:after",cs=ce.cssRules.length,Al="{left:"+Ue.left+"px;right:auto;}";pn(t.calendarContainer,"rightMost",!1),pn(t.calendarContainer,"centerMost",!0),ce.insertRule(Vi+","+El+Al,cs),t.calendarContainer.style.left=rt+"px",t.calendarContainer.style.right="auto"}}}}function Xe(){for(var N=null,I=0;It.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=ne,t.config.mode==="single")t.selectedDates=[Te];else if(t.config.mode==="multiple"){var Qe=ct(Te);Qe?t.selectedDates.splice(parseInt(Qe),1):t.selectedDates.push(Te)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Te,t.selectedDates.push(Te),Cn(Te,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(Ye,gt){return Ye.getTime()-gt.getTime()}));if(c(),Ae){var Ue=t.currentYear!==Te.getFullYear();t.currentYear=Te.getFullYear(),t.currentMonth=Te.getMonth(),Ue&&(Ge("onYearChange"),Q()),Ge("onMonthChange")}if(jt(),j(),ht(),!Ae&&t.config.mode!=="range"&&t.config.showMonths===1?E(ne):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 xe=t.config.mode==="single"&&!t.config.enableTime,ze=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(xe||ze)&&Ve()}b()}}var te={locale:[ut,se],showMonths:[U,r,J],minDate:[$],maxDate:[$],positionElement:[Ft],clickOpens:[function(){t.config.clickOpens===!0?(v(t._input,"focus",t.open),v(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function ye(N,I){if(N!==null&&typeof N=="object"){Object.assign(t.config,N);for(var q in N)te[q]!==void 0&&te[q].forEach(function(ne){return ne()})}else t.config[N]=I,te[N]!==void 0?te[N].forEach(function(ne){return ne()}):vr.indexOf(N)>-1&&(t.config[N]=yr(I));t.redraw(),ht(!0)}function Ke(N,I){var q=[];if(N instanceof Array)q=N.map(function(ne){return t.parseDate(ne,I)});else if(N instanceof Date||typeof N=="number")q=[t.parseDate(N,I)];else if(typeof N=="string")switch(t.config.mode){case"single":case"time":q=[t.parseDate(N,I)];break;case"multiple":q=N.split(t.config.conjunction).map(function(ne){return t.parseDate(ne,I)});break;case"range":q=N.split(t.l10n.rangeSeparator).map(function(ne){return t.parseDate(ne,I)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(N)));t.selectedDates=t.config.allowInvalidPreload?q:q.filter(function(ne){return ne instanceof Date&&G(ne,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(ne,Te){return ne.getTime()-Te.getTime()})}function ft(N,I,q){if(I===void 0&&(I=!1),q===void 0&&(q=t.config.dateFormat),N!==0&&!N||N instanceof Array&&N.length===0)return t.clear(I);Ke(N,q),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),$(void 0,I),d(),t.selectedDates.length===0&&t.clear(!1),ht(I),I&&Ge("onChange")}function St(N){return N.slice().map(function(I){return typeof I=="string"||typeof I=="number"||I instanceof Date?t.parseDate(I,void 0,!0):I&&typeof I=="object"&&I.from&&I.to?{from:t.parseDate(I.from,void 0),to:t.parseDate(I.to,void 0)}:I}).filter(function(I){return I})}function $t(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var N=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);N&&Ke(N,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 Rt(){if(t.input=nt(),!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=Ot(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"),Ft()}function Ft(){t._positionElement=t.config.positionElement||t._input}function Ct(){var N=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=Ot("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=N,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=N==="datetime-local"?"Y-m-d\\TH:i:S":N==="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{}v(t.mobileInput,"change",function(I){t.setDate($n(I).value,!1,t.mobileFormatStr),Ge("onChange"),Ge("onClose")})}function Yt(N){if(t.isOpen===!0)return t.close();t.open(N)}function Ge(N,I){if(t.config!==void 0){var q=t.config[N];if(q!==void 0&&q.length>0)for(var ne=0;q[ne]&&ne=0&&Cn(N,t.selectedDates[1])<=0}function jt(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(N,I){var q=new Date(t.currentYear,t.currentMonth,1);q.setMonth(t.currentMonth+I),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[I].textContent=Ao(q.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=q.getMonth().toString(),N.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 Tt(N){var I=N||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(q){return t.formatDate(q,I)}).filter(function(q,ne,Te){return t.config.mode!=="range"||t.config.enableTime||Te.indexOf(q)===ne}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function ht(N){N===void 0&&(N=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=Tt(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=Tt(t.config.altFormat)),N!==!1&&Ge("onValueUpdate")}function Ut(N){var I=$n(N),q=t.prevMonthNav.contains(I),ne=t.nextMonthNav.contains(I);q||ne?ke(q?-1:1):t.yearElements.indexOf(I)>=0?I.select():I.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):I.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function it(N){N.preventDefault();var I=N.type==="keydown",q=$n(N),ne=q;t.amPM!==void 0&&q===t.amPM&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]);var Te=parseFloat(ne.getAttribute("min")),Ae=parseFloat(ne.getAttribute("max")),Qe=parseFloat(ne.getAttribute("step")),Ue=parseInt(ne.value,10),xe=N.delta||(I?N.which===38?1:-1:0),ze=Ue+Qe*xe;if(typeof ne.value<"u"&&ne.value.length===2){var Ye=ne===t.hourElement,gt=ne===t.minuteElement;zeAe&&(ze=ne===t.hourElement?ze-Ae-jn(!t.amPM):Te,gt&&S(void 0,1,t.hourElement)),t.amPM&&Ye&&(Qe===1?ze+Ue===23:Math.abs(ze-Ue)>Qe)&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]),ne.value=vn(ze)}}return s(),t}function ks(n,e){for(var t=Array.prototype.slice.call(n).filter(function(o){return o instanceof HTMLElement}),i=[],s=0;s{const S=f||g,M=y(d);return M.onReady.push(()=>{t(8,p=!0)}),t(3,v=en(S,Object.assign(M,f?{wrap:!0}:{}))),()=>{v.destroy()}});const b=hn();function y(S={}){S=Object.assign({},S);for(const M of r){const D=(E,O,F)=>{b(zS(M),[E,O,F])};M in S?(Array.isArray(S[M])||(S[M]=[S[M]]),S[M].push(D)):S[M]=[D]}return S.onChange&&!S.onChange.includes($)&&S.onChange.push($),S}function $(S,M,D){var O,F;const E=(F=(O=D==null?void 0:D.config)==null?void 0:O.mode)!=null?F:"single";t(2,a=E==="single"?S[0]:S),t(4,u=M)}function C(S){he[S?"unshift":"push"](()=>{g=S,t(0,g)})}return n.$$set=S=>{e=bt(bt({},e),ci(S)),t(1,s=tn(e,i)),"value"in S&&t(2,a=S.value),"formattedValue"in S&&t(4,u=S.formattedValue),"element"in S&&t(5,f=S.element),"dateFormat"in S&&t(6,c=S.dateFormat),"options"in S&&t(7,d=S.options),"input"in S&&t(0,g=S.input),"flatpickr"in S&&t(3,v=S.flatpickr),"$$scope"in S&&t(9,o=S.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&v&&p&&v.setDate(a,!1,c),n.$$.dirty&392&&v&&p)for(const[S,M]of Object.entries(y(d)))v.set(S,M)},[g,s,a,v,u,f,c,d,p,o,l,C]}class Ba extends Fe{constructor(e){super(),Le(this,e,BS,VS,Pe,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function US(n){let e,t,i,s,l,o,r;function a(f){n[2](f)}let u={id:n[4],options:Y.defaultFlatpickrOptions(),value:n[0].min};return n[0].min!==void 0&&(u.formattedValue=n[0].min),l=new Ba({props:u}),he.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=R("Min date (UTC)"),s=T(),B(l.$$.fragment),h(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&h(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].min),!o&&c&1&&(o=!0,d.formattedValue=f[0].min,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function WS(n){let e,t,i,s,l,o,r;function a(f){n[3](f)}let u={id:n[4],options:Y.defaultFlatpickrOptions(),value:n[0].max};return n[0].max!==void 0&&(u.formattedValue=n[0].max),l=new Ba({props:u}),he.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=R("Max date (UTC)"),s=T(),B(l.$$.fragment),h(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&h(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].max),!o&&c&1&&(o=!0,d.formattedValue=f[0].max,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function YS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[US,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[WS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function KS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.min,r)&&(s.min=r,t(0,s))}function o(r){n.$$.not_equal(s.max,r)&&(s.max=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class ZS extends Fe{constructor(e){super(),Le(this,e,KS,YS,Pe,{key:1,options:0})}}function JS(n){let e,t,i,s,l,o,r,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 fs({props:c}),he.push(()=>Re(l,"value",f)),{c(){e=_("label"),t=R("Choices"),s=T(),B(l.$$.fragment),r=T(),a=_("div"),a.textContent="Use comma as separator.",h(e,"for",i=n[4]),h(a,"class","help-block")},m(d,p){w(d,e,p),m(e,t),w(d,s,p),V(l,d,p),w(d,r,p),w(d,a,p),u=!0},p(d,p){(!u||p&16&&i!==(i=d[4]))&&h(e,"for",i);const g={};p&16&&(g.id=d[4]),!o&&p&1&&(o=!0,g.value=d[0].values,He(()=>o=!1)),l.$set(g)},i(d){u||(A(l.$$.fragment,d),u=!0)},o(d){P(l.$$.fragment,d),u=!1},d(d){d&&k(e),d&&k(s),z(l,d),d&&k(r),d&&k(a)}}}function GS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[4]),h(l,"type","number"),h(l,"id",o=n[4]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&16&&i!==(i=u[4])&&h(e,"for",i),f&16&&o!==(o=u[4])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function XS(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.values",$$slots:{default:[JS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[GS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-9"),h(l,"class","col-sm-3"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function QS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.values,r)&&(s.values=r,t(0,s))}function o(){s.maxSelect=Nt(this.value),t(0,s)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},n.$$.update=()=>{n.$$.dirty&1&&Y.isEmpty(s)&&t(0,s={maxSelect:1,values:[]})},[s,i,l,o]}class xS extends Fe{constructor(e){super(),Le(this,e,QS,XS,Pe,{key:1,options:0})}}function e3(n,e,t){return["",{}]}class t3 extends Fe{constructor(e){super(),Le(this,e,e3,null,Pe,{key:0,options:1})}get key(){return this.$$.ctx[0]}get options(){return this.$$.ctx[1]}}function n3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max file size (bytes)"),s=T(),l=_("input"),h(e,"for",i=n[10]),h(l,"type","number"),h(l,"id",o=n[10]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[2]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&h(e,"for",i),f&1024&&o!==(o=u[10])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].maxSize&&$e(l,u[0].maxSize)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function i3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max files"),s=T(),l=_("input"),h(e,"for",i=n[10]),h(l,"type","number"),h(l,"id",o=n[10]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&h(e,"for",i),f&1024&&o!==(o=u[10])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function s3(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("div"),e.innerHTML='Documents (pdf, doc/docx, xls/xlsx)',t=T(),i=_("div"),i.innerHTML='Images (jpg, png, svg, gif)',s=T(),l=_("div"),l.innerHTML='Videos (mp4, avi, mov, 3gp)',o=T(),r=_("div"),r.innerHTML='Archives (zip, 7zip, rar)',h(e,"tabindex","0"),h(e,"class","dropdown-item closable"),h(i,"tabindex","0"),h(i,"class","dropdown-item closable"),h(l,"tabindex","0"),h(l,"class","dropdown-item closable"),h(r,"tabindex","0"),h(r,"class","dropdown-item closable")},m(f,c){w(f,e,c),w(f,t,c),w(f,i,c),w(f,s,c),w(f,l,c),w(f,o,c),w(f,r,c),a||(u=[X(e,"click",n[5]),X(i,"click",n[6]),X(l,"click",n[7]),X(r,"click",n[8])],a=!0)},p:oe,d(f){f&&k(e),f&&k(t),f&&k(i),f&&k(s),f&&k(l),f&&k(o),f&&k(r),a=!1,st(u)}}}function l3(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$;function C(M){n[4](M)}let S={id:n[10],placeholder:"eg. image/png, application/pdf..."};return n[0].mimeTypes!==void 0&&(S.value=n[0].mimeTypes),r=new fs({props:S}),he.push(()=>Re(r,"value",C)),v=new qi({props:{class:"dropdown dropdown-sm dropdown-nowrap",$$slots:{default:[s3]},$$scope:{ctx:n}}}),{c(){e=_("label"),t=_("span"),t.textContent="Mime types",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),c=R(`Use comma as separator. + `),d=_("span"),p=_("span"),p.textContent="Choose presets",g=T(),B(v.$$.fragment),h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(p,"class","txt link-primary"),h(d,"class","inline-flex"),h(f,"class","help-block")},m(M,D){w(M,e,D),m(e,t),m(e,i),m(e,s),w(M,o,D),V(r,M,D),w(M,u,D),w(M,f,D),m(f,c),m(f,d),m(d,p),m(d,g),V(v,d,null),b=!0,y||($=et(Et.call(null,s,{text:`Allow files ONLY with the listed mime types. + Leave empty for no restriction.`,position:"top"})),y=!0)},p(M,D){(!b||D&1024&&l!==(l=M[10]))&&h(e,"for",l);const E={};D&1024&&(E.id=M[10]),!a&&D&1&&(a=!0,E.value=M[0].mimeTypes,He(()=>a=!1)),r.$set(E);const O={};D&2049&&(O.$$scope={dirty:D,ctx:M}),v.$set(O)},i(M){b||(A(r.$$.fragment,M),A(v.$$.fragment,M),b=!0)},o(M){P(r.$$.fragment,M),P(v.$$.fragment,M),b=!1},d(M){M&&k(e),M&&k(o),z(r,M),M&&k(u),M&&k(f),z(v),y=!1,$()}}}function o3(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[9](b)}let v={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(v.value=n[0].thumbs),r=new fs({props:v}),he.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=et(Et.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,y){(!c||y&1024&&l!==(l=b[10]))&&h(e,"for",l);const $={};y&1024&&($.id=b[10]),!a&&y&1&&(a=!0,$.value=b[0].thumbs,He(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function r3(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[n3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[i3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[l3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),d=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[o3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),f=T(),c=_("div"),B(d.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(a,"class","col-sm-12"),h(c,"class","col-sm-12"),h(e,"class","grid")},m(g,v){w(g,e,v),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),m(e,f),m(e,c),V(d,c,null),p=!0},p(g,[v]){const b={};v&2&&(b.name="schema."+g[1]+".options.maxSize"),v&3073&&(b.$$scope={dirty:v,ctx:g}),i.$set(b);const y={};v&2&&(y.name="schema."+g[1]+".options.maxSelect"),v&3073&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&2&&($.name="schema."+g[1]+".options.mimeTypes"),v&3073&&($.$$scope={dirty:v,ctx:g}),u.$set($);const C={};v&2&&(C.name="schema."+g[1]+".options.thumbs"),v&3073&&(C.$$scope={dirty:v,ctx:g}),d.$set(C)},i(g){p||(A(i.$$.fragment,g),A(o.$$.fragment,g),A(u.$$.fragment,g),A(d.$$.fragment,g),p=!0)},o(g){P(i.$$.fragment,g),P(o.$$.fragment,g),P(u.$$.fragment,g),P(d.$$.fragment,g),p=!1},d(g){g&&k(e),z(i),z(o),z(u),z(d)}}}function a3(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=Nt(this.value),t(0,s)}function o(){s.maxSelect=Nt(this.value),t(0,s)}function r(p){n.$$.not_equal(s.mimeTypes,p)&&(s.mimeTypes=p,t(0,s))}const a=()=>{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)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(p){n.$$.not_equal(s.thumbs,p)&&(s.thumbs=p,t(0,s))}return n.$$set=p=>{"key"in p&&t(1,i=p.key),"options"in p&&t(0,s=p.options)},n.$$.update=()=>{n.$$.dirty&1&&Y.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class u3 extends Fe{constructor(e){super(),Le(this,e,a3,r3,Pe,{key:1,options:0})}}function f3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Collection"),s=T(),B(l.$$.fragment),h(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&h(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]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionId,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function c3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","number"),h(l,"id",o=n[9]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[6]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function d3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Delete record on relation delete"),s=T(),B(l.$$.fragment),h(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&h(e,"for",i);const d={};c&512&&(d.id=f[9]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function h3(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.collectionId",$$slots:{default:[f3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[c3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),u=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[d3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),h(t,"class","col-sm-9"),h(l,"class","col-sm-3"),h(a,"class","col-sm-12"),h(e,"class","grid")},m(c,d){w(c,e,d),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),f=!0},p(c,[d]){const p={};d&2&&(p.name="schema."+c[1]+".options.collectionId"),d&1549&&(p.$$scope={dirty:d,ctx:c}),i.$set(p);const g={};d&2&&(g.name="schema."+c[1]+".options.maxSelect"),d&1537&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);const v={};d&2&&(v.name="schema."+c[1]+".options.cascadeDelete"),d&1537&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){P(i.$$.fragment,c),P(o.$$.fragment,c),P(u.$$.fragment,c),f=!1},d(c){c&&k(e),z(i),z(o),z(u)}}}function p3(n,e,t){let{key:i=""}=e,{options:s={}}=e;const l=[{label:"False",value:!1},{label:"True",value:!0}];let o=!1,r=[];a();function a(){t(2,o=!0),Se.Collections.getFullList(200,{sort:"-created"}).then(d=>{t(3,r=d)}).catch(d=>{Se.errorResponseHandler(d)}).finally(()=>{t(2,o=!1)})}function u(d){n.$$.not_equal(s.collectionId,d)&&(s.collectionId=d,t(0,s))}function f(){s.maxSelect=Nt(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&&Y.isEmpty(s)&&t(0,s={maxSelect:1,collectionId:null,cascadeDelete:!1})},[s,i,o,r,l,u,f,c]}class m3 extends Fe{constructor(e){super(),Le(this,e,p3,h3,Pe,{key:1,options:0})}}function g3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=R("Max select"),s=T(),l=_("input"),h(e,"for",i=n[5]),h(l,"type","number"),h(l,"id",o=n[5]),h(l,"step","1"),h(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),r||(a=X(l,"input",n[3]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&h(e,"for",i),f&32&&o!==(o=u[5])&&h(l,"id",o),f&1&&Nt(l.value)!==u[0].maxSelect&&$e(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function _3(n){let e,t,i,s,l,o,r;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 us({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=R("Delete record on user delete"),s=T(),B(l.$$.fragment),h(e,"for",i=n[5])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&32&&i!==(i=f[5]))&&h(e,"for",i);const d={};c&32&&(d.id=f[5]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function b3(n){let e,t,i,s,l,o,r;return i=new Ie({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[g3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),o=new Ie({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[_3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!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}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function v3(n,e,t){const i=[{label:"False",value:!1},{label:"True",value:!0}];let{key:s=""}=e,{options:l={}}=e;function o(){l.maxSelect=Nt(this.value),t(0,l)}function r(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&&Y.isEmpty(l)&&t(0,l={maxSelect:1,cascadeDelete:!1})},[l,s,i,o,r]}class y3 extends Fe{constructor(e){super(),Le(this,e,v3,b3,Pe,{key:1,options:0})}}function k3(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[38],disabled:n[0].id};return n[0].type!==void 0&&(u.value=n[0].type),l=new cS({props:u}),he.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=R("Type"),s=T(),B(l.$$.fragment),h(e,"for",i=n[38])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c[1]&128&&i!==(i=f[38]))&&h(e,"for",i);const d={};c[1]&128&&(d.id=f[38]),c[0]&1&&(d.disabled=f[0].id),!o&&c[0]&1&&(o=!0,d.value=f[0].type,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function Fc(n){let e,t,i;return{c(){e=_("span"),e.textContent="Duplicated or invalid name",h(e,"class","txt invalid-name-note svelte-1tpxlm5")},m(s,l){w(s,e,l),i=!0},i(s){i||(Lt(()=>{t||(t=at(e,Un,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=at(e,Un,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function w3(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g=!n[5]&&Fc();return{c(){e=_("label"),t=_("span"),t.textContent="Name",i=T(),g&&g.c(),l=T(),o=_("input"),h(t,"class","txt"),h(e,"for",s=n[38]),h(o,"type","text"),h(o,"id",r=n[38]),o.required=!0,o.disabled=a=n[0].id&&n[0].system,h(o,"spellcheck","false"),o.autofocus=u=!n[0].id,o.value=f=n[0].name},m(v,b){w(v,e,b),m(e,t),m(e,i),g&&g.m(e,null),w(v,l,b),w(v,o,b),c=!0,n[0].id||o.focus(),d||(p=X(o,"input",n[17]),d=!0)},p(v,b){v[5]?g&&(De(),P(g,1,1,()=>{g=null}),Oe()):g?b[0]&32&&A(g,1):(g=Fc(),g.c(),A(g,1),g.m(e,null)),(!c||b[1]&128&&s!==(s=v[38]))&&h(e,"for",s),(!c||b[1]&128&&r!==(r=v[38]))&&h(o,"id",r),(!c||b[0]&1&&a!==(a=v[0].id&&v[0].system))&&(o.disabled=a),(!c||b[0]&1&&u!==(u=!v[0].id))&&(o.autofocus=u),(!c||b[0]&1&&f!==(f=v[0].name)&&o.value!==f)&&(o.value=f)},i(v){c||(A(g),c=!0)},o(v){P(g),c=!1},d(v){v&&k(e),g&&g.d(),v&&k(l),v&&k(o),d=!1,p()}}}function S3(n){let e,t,i;function s(o){n[28](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new y3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function $3(n){let e,t,i;function s(o){n[27](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new m3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function C3(n){let e,t,i;function s(o){n[26](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new u3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function M3(n){let e,t,i;function s(o){n[25](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new t3({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function T3(n){let e,t,i;function s(o){n[24](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new xS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function D3(n){let e,t,i;function s(o){n[23](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new ZS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function O3(n){let e,t,i;function s(o){n[22](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new LS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function E3(n){let e,t,i;function s(o){n[21](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new d_({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function A3(n){let e,t,i;function s(o){n[20](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new $S({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function P3(n){let e,t,i;function s(o){n[19](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new wS({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function L3(n){let e,t,i;function s(o){n[18](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new _S({props:l}),he.push(()=>Re(e,"options",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function F3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Required"),h(e,"type","checkbox"),h(e,"id",t=n[38]),h(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].required,w(u,i,f),w(u,s,f),m(s,l),r||(a=X(e,"change",n[29]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&h(e,"id",t),f[0]&1&&(e.checked=u[0].required),f[1]&128&&o!==(o=u[38])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Ic(n){let e,t;return e=new Ie({props:{class:"form-field form-field-toggle m-0",name:"unique",$$slots:{default:[I3,({uniqueId:i})=>({38:i}),({uniqueId:i})=>[0,i?128: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]&384&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function I3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Unique"),h(e,"type","checkbox"),h(e,"id",t=n[38]),h(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].unique,w(u,i,f),w(u,s,f),m(s,l),r||(a=X(e,"change",n[30]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&h(e,"id",t),f[0]&1&&(e.checked=u[0].unique),f[1]&128&&o!==(o=u[38])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Nc(n){let e,t,i,s,l,o,r,a,u,f;a=new qi({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[N3]},$$scope:{ctx:n}}});let c=n[8]&&Rc(n);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),l=_("button"),o=_("i"),r=T(),B(a.$$.fragment),u=T(),c&&c.c(),h(t,"class","flex-fill"),h(o,"class","ri-more-line"),h(l,"type","button"),h(l,"class","btn btn-circle btn-sm btn-secondary"),h(s,"class","inline-flex flex-gap-sm flex-nowrap"),h(e,"class","col-sm-4 txt-right")},m(d,p){w(d,e,p),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),V(a,l,null),m(s,u),c&&c.m(s,null),f=!0},p(d,p){const g={};p[1]&256&&(g.$$scope={dirty:p,ctx:d}),a.$set(g),d[8]?c?c.p(d,p):(c=Rc(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i(d){f||(A(a.$$.fragment,d),f=!0)},o(d){P(a.$$.fragment,d),f=!1},d(d){d&&k(e),z(a),c&&c.d()}}}function N3(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Remove',h(e,"type","button"),h(e,"class","dropdown-item txt-right")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[9]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Rc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Done',h(e,"type","button"),h(e,"class","btn btn-sm btn-outline btn-expanded-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[3])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function R3(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C,S,M,D;s=new Ie({props:{class:"form-field required "+(n[0].id?"disabled":""),name:"schema."+n[1]+".type",$$slots:{default:[k3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}}),r=new Ie({props:{class:` form-field required `+(n[5]?"":"invalid")+` `+(n[0].id&&n[0].system?"disabled":"")+` - `,name:"schema."+n[1]+".name",$$slots:{default:[y3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}});const E=[A3,E3,O3,D3,T3,M3,C3,$3,S3,w3,k3],O=[];function F(j,Q){return j[0].type==="text"?0:j[0].type==="number"?1:j[0].type==="bool"?2:j[0].type==="email"?3:j[0].type==="url"?4:j[0].type==="date"?5:j[0].type==="select"?6:j[0].type==="json"?7:j[0].type==="file"?8:j[0].type==="relation"?9:j[0].type==="user"?10:-1}~(f=F(n))&&(c=O[f]=E[f](n)),g=new Ie({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[P3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}});let L=n[0].type!=="file"&&Fc(n),H=!n[0].toDelete&&Ic(n);return{c(){e=_("form"),t=_("div"),i=_("div"),B(s.$$.fragment),l=T(),o=_("div"),B(r.$$.fragment),a=T(),u=_("div"),c&&c.c(),d=T(),m=_("div"),B(g.$$.fragment),v=T(),b=_("div"),L&&L.c(),y=T(),H&&H.c(),C=T(),$=_("input"),h(i,"class","col-sm-6"),h(o,"class","col-sm-6"),h(u,"class","col-sm-12 hidden-empty"),h(m,"class","col-sm-4 flex"),h(b,"class","col-sm-4 flex"),h(t,"class","grid"),h($,"type","submit"),h($,"class","hidden"),h($,"tabindex","-1"),h(e,"class","field-form")},m(j,Q){w(j,e,Q),p(e,t),p(t,i),V(s,i,null),p(t,l),p(t,o),V(r,o,null),p(t,a),p(t,u),~f&&O[f].m(u,null),p(t,d),p(t,m),V(g,m,null),p(t,v),p(t,b),L&&L.m(b,null),p(t,y),H&&H.m(t,null),p(e,C),p(e,$),S=!0,M||(D=X(e,"submit",Qt(n[31])),M=!0)},p(j,Q){const ie={};Q[0]&1&&(ie.class="form-field required "+(j[0].id?"disabled":"")),Q[0]&2&&(ie.name="schema."+j[1]+".type"),Q[0]&1|Q[1]&384&&(ie.$$scope={dirty:Q,ctx:j}),s.$set(ie);const U={};Q[0]&33&&(U.class=` + `,name:"schema."+n[1]+".name",$$slots:{default:[w3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}});const E=[L3,P3,A3,E3,O3,D3,T3,M3,C3,$3,S3],O=[];function F(j,Q){return j[0].type==="text"?0:j[0].type==="number"?1:j[0].type==="bool"?2:j[0].type==="email"?3:j[0].type==="url"?4:j[0].type==="date"?5:j[0].type==="select"?6:j[0].type==="json"?7:j[0].type==="file"?8:j[0].type==="relation"?9:j[0].type==="user"?10:-1}~(f=F(n))&&(c=O[f]=E[f](n)),g=new Ie({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[F3,({uniqueId:j})=>({38:j}),({uniqueId:j})=>[0,j?128:0]]},$$scope:{ctx:n}}});let L=n[0].type!=="file"&&Ic(n),H=!n[0].toDelete&&Nc(n);return{c(){e=_("form"),t=_("div"),i=_("div"),B(s.$$.fragment),l=T(),o=_("div"),B(r.$$.fragment),a=T(),u=_("div"),c&&c.c(),d=T(),p=_("div"),B(g.$$.fragment),v=T(),b=_("div"),L&&L.c(),y=T(),H&&H.c(),$=T(),C=_("input"),h(i,"class","col-sm-6"),h(o,"class","col-sm-6"),h(u,"class","col-sm-12 hidden-empty"),h(p,"class","col-sm-4 flex"),h(b,"class","col-sm-4 flex"),h(t,"class","grid"),h(C,"type","submit"),h(C,"class","hidden"),h(C,"tabindex","-1"),h(e,"class","field-form")},m(j,Q){w(j,e,Q),m(e,t),m(t,i),V(s,i,null),m(t,l),m(t,o),V(r,o,null),m(t,a),m(t,u),~f&&O[f].m(u,null),m(t,d),m(t,p),V(g,p,null),m(t,v),m(t,b),L&&L.m(b,null),m(t,y),H&&H.m(t,null),m(e,$),m(e,C),S=!0,M||(D=X(e,"submit",Qt(n[31])),M=!0)},p(j,Q){const ie={};Q[0]&1&&(ie.class="form-field required "+(j[0].id?"disabled":"")),Q[0]&2&&(ie.name="schema."+j[1]+".type"),Q[0]&1|Q[1]&384&&(ie.$$scope={dirty:Q,ctx:j}),s.$set(ie);const U={};Q[0]&33&&(U.class=` form-field required `+(j[5]?"":"invalid")+` `+(j[0].id&&j[0].system?"disabled":"")+` - `),Q[0]&2&&(U.name="schema."+j[1]+".name"),Q[0]&33|Q[1]&384&&(U.$$scope={dirty:Q,ctx:j}),r.$set(U);let K=f;f=F(j),f===K?~f&&O[f].p(j,Q):(c&&(De(),P(O[K],1,1,()=>{O[K]=null}),Oe()),~f?(c=O[f],c?c.p(j,Q):(c=O[f]=E[f](j),c.c()),A(c,1),c.m(u,null)):c=null);const W={};Q[0]&1|Q[1]&384&&(W.$$scope={dirty:Q,ctx:j}),g.$set(W),j[0].type!=="file"?L?(L.p(j,Q),Q[0]&1&&A(L,1)):(L=Fc(j),L.c(),A(L,1),L.m(b,null)):L&&(De(),P(L,1,1,()=>{L=null}),Oe()),j[0].toDelete?H&&(De(),P(H,1,1,()=>{H=null}),Oe()):H?(H.p(j,Q),Q[0]&1&&A(H,1)):(H=Ic(j),H.c(),A(H,1),H.m(t,null))},i(j){S||(A(s.$$.fragment,j),A(r.$$.fragment,j),A(c),A(g.$$.fragment,j),A(L),A(H),S=!0)},o(j){P(s.$$.fragment,j),P(r.$$.fragment,j),P(c),P(g.$$.fragment,j),P(L),P(H),S=!1},d(j){j&&k(e),z(s),z(r),~f&&O[f].d(),z(g),L&&L.d(),H&&H.d(),M=!1,D()}}}function Rc(n){let e,t,i,s,l=n[0].system&&Hc(),o=!n[0].id&&jc(n),r=n[0].required&&qc(),a=n[0].unique&&Vc();return{c(){e=_("div"),l&&l.c(),t=T(),o&&o.c(),i=T(),r&&r.c(),s=T(),a&&a.c(),h(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),p(e,t),o&&o.m(e,null),p(e,i),r&&r.m(e,null),p(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=Hc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=jc(u),o.c(),o.m(e,i)),u[0].required?r||(r=qc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=Vc(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function Hc(n){let e;return{c(){e=_("span"),e.textContent="System",h(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function jc(n){let e;return{c(){e=_("span"),e.textContent="New",h(e,"class","label"),ee(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&257&&ee(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&k(e)}}}function qc(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Vc(n){let e;return{c(){e=_("span"),e.textContent="Unique",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function zc(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=et(Et.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Lt(()=>{t||(t=at(e,Wn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=at(e,Wn,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function Bc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Restore',h(e,"type","button"),h(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[15])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function N3(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,m,g,v,b,y=!n[0].toDelete&&Rc(n),C=n[7]&&!n[0].system&&zc(),$=n[0].toDelete&&Bc(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=T(),o=_("strong"),a=R(r),f=T(),y&&y.c(),c=T(),d=_("div"),m=T(),C&&C.c(),g=T(),$&&$.c(),v=lt(),h(i,"class",s=Ka(Y.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),h(t,"class","icon field-type"),h(o,"class","title field-name svelte-1tpxlm5"),h(o,"title",u=n[0].name),ee(o,"txt-strikethrough",n[0].toDelete),h(e,"class","inline-flex"),h(d,"class","flex-fill")},m(S,M){w(S,e,M),p(e,t),p(t,i),p(e,l),p(e,o),p(o,a),w(S,f,M),y&&y.m(S,M),w(S,c,M),w(S,d,M),w(S,m,M),C&&C.m(S,M),w(S,g,M),$&&$.m(S,M),w(S,v,M),b=!0},p(S,M){(!b||M[0]&1&&s!==(s=Ka(Y.getFieldTypeIcon(S[0].type))+" svelte-1tpxlm5"))&&h(i,"class",s),(!b||M[0]&1)&&r!==(r=(S[0].name||"-")+"")&&me(a,r),(!b||M[0]&1&&u!==(u=S[0].name))&&h(o,"title",u),M[0]&1&&ee(o,"txt-strikethrough",S[0].toDelete),S[0].toDelete?y&&(y.d(1),y=null):y?y.p(S,M):(y=Rc(S),y.c(),y.m(c.parentNode,c)),S[7]&&!S[0].system?C?M[0]&129&&A(C,1):(C=zc(),C.c(),A(C,1),C.m(g.parentNode,g)):C&&(De(),P(C,1,1,()=>{C=null}),Oe()),S[0].toDelete?$?$.p(S,M):($=Bc(S),$.c(),$.m(v.parentNode,v)):$&&($.d(1),$=null)},i(S){b||(A(C),b=!0)},o(S){P(C),b=!1},d(S){S&&k(e),S&&k(f),y&&y.d(S),S&&k(c),S&&k(d),S&&k(m),C&&C.d(S),S&&k(g),$&&$.d(S),S&&k(v)}}}function R3(n){let e,t,i={single:!0,interactive:n[8],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[N3],default:[I3]},$$scope:{ctx:n}};return e=new za({props:i}),n[32](e),e.$on("expand",n[33]),e.$on("collapse",n[34]),e.$on("toggle",n[35]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&256&&(o.interactive=s[8]),l[0]&5&&(o.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&483|l[1]&256&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[32](null),z(e,s)}}}function H3(n,e,t){let i,s,l,o,r;qt(n,rs,Z=>t(14,r=Z));const a=hn();let{key:u="0"}=e,{field:f=new Sn}=e,{disabled:c=!1}=e,{excludeNames:d=[]}=e,m,g=f.type;function v(){m==null||m.expand()}function b(){m==null||m.collapse()}function y(){f.id?t(0,f.toDelete=!0,f):(b(),a("remove"))}function C(Z){if(Z=(""+Z).toLowerCase(),!Z)return!1;for(const be of d)if(be.toLowerCase()===Z)return!1;return!0}function $(Z){return Y.slugify(Z)}Jn(()=>{f.id||v()});const S=()=>{t(0,f.toDelete=!1,f)};function M(Z){n.$$.not_equal(f.type,Z)&&(f.type=Z,t(0,f),t(13,g),t(4,m))}const D=Z=>{t(0,f.name=$(Z.target.value),f),Z.target.value=f.name};function E(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function O(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function F(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function L(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function H(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function j(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function Q(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function ie(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function U(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function K(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function W(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,m))}function J(){f.required=this.checked,t(0,f),t(13,g),t(4,m)}function se(){f.unique=this.checked,t(0,f),t(13,g),t(4,m)}const fe=()=>{i&&b()};function ke(Z){he[Z?"unshift":"push"](()=>{m=Z,t(4,m)})}function le(Z){pt.call(this,n,Z)}function ue(Z){pt.call(this,n,Z)}function Me(Z){pt.call(this,n,Z)}return n.$$set=Z=>{"key"in Z&&t(1,u=Z.key),"field"in Z&&t(0,f=Z.field),"disabled"in Z&&t(2,c=Z.disabled),"excludeNames"in Z&&t(11,d=Z.excludeNames)},n.$$.update=()=>{n.$$.dirty[0]&8193&&g!=f.type&&(t(13,g=f.type),t(0,f.options={},f),t(0,f.unique=!1,f)),n.$$.dirty[0]&17&&f.toDelete&&(m&&b(),f.originalName&&f.name!==f.originalName&&t(0,f.name=f.originalName,f)),n.$$.dirty[0]&1&&!f.originalName&&f.name&&t(0,f.originalName=f.name,f),n.$$.dirty[0]&1&&typeof f.toDelete>"u"&&t(0,f.toDelete=!1,f),n.$$.dirty[0]&1&&f.required&&t(0,f.nullable=!1,f),n.$$.dirty[0]&1&&t(6,i=!Y.isEmpty(f.name)&&f.type),n.$$.dirty[0]&80&&(i||m&&v()),n.$$.dirty[0]&69&&t(8,s=!c&&!f.system&&!f.toDelete&&i),n.$$.dirty[0]&1&&t(5,l=C(f.name)),n.$$.dirty[0]&16418&&t(7,o=!l||!Y.isEmpty(Y.getNestedVal(r,`schema.${u}`)))},[f,u,c,b,m,l,i,o,s,y,$,d,v,g,r,S,M,D,E,O,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me]}class j3 extends Fe{constructor(e){super(),Le(this,e,H3,R3,Pe,{key:1,field:0,disabled:2,excludeNames:11,expand:12,collapse:3},null,[-1,-1])}get expand(){return this.$$.ctx[12]}get collapse(){return this.$$.ctx[3]}}function Uc(n,e,t){const i=n.slice();return i[9]=e[t],i[10]=e,i[11]=t,i}function Wc(n,e){let t,i,s,l;function o(u){e[5](u,e[9],e[10],e[11])}function r(){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 j3({props:a}),he.push(()=>Re(i,"field",o)),i.$on("remove",r),{key:n,first:null,c(){t=lt(),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],He(()=>s=!1)),i.$set(c)},i(u){l||(A(i.$$.fragment,u),l=!0)},o(u){P(i.$$.fragment,u),l=!1},d(u){u&&k(t),z(i,u)}}}function q3(n){let e,t=[],i=new Map,s,l,o,r,a,u,f,c,d,m,g,v=n[0].schema;const b=y=>y[11];for(let y=0;ym.name===d)}function u(d){let m=[];if(d.toDelete)return m;for(let g of s.schema)g===d||g.toDelete||m.push(g.name);return m}function f(d,m,g,v){g[v]=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)>"u"&&(t(0,s=s||{}),t(0,s.schema=[],s))},[s,i,l,o,u,f,c]}class z3 extends Fe{constructor(e){super(),Le(this,e,V3,q3,Pe,{collection:0})}}function Yc(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 Kc(n,e,t){const i=n.slice();return i[19]=e[t],i}function Zc(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$,S,M,D,E,O,F,L,H,j,Q,ie,U=n[0].schema,K=[];for(let W=0;W@request filter:",y=T(),C=_("div"),C.innerHTML=`@request.method + `),Q[0]&2&&(U.name="schema."+j[1]+".name"),Q[0]&33|Q[1]&384&&(U.$$scope={dirty:Q,ctx:j}),r.$set(U);let K=f;f=F(j),f===K?~f&&O[f].p(j,Q):(c&&(De(),P(O[K],1,1,()=>{O[K]=null}),Oe()),~f?(c=O[f],c?c.p(j,Q):(c=O[f]=E[f](j),c.c()),A(c,1),c.m(u,null)):c=null);const W={};Q[0]&1|Q[1]&384&&(W.$$scope={dirty:Q,ctx:j}),g.$set(W),j[0].type!=="file"?L?(L.p(j,Q),Q[0]&1&&A(L,1)):(L=Ic(j),L.c(),A(L,1),L.m(b,null)):L&&(De(),P(L,1,1,()=>{L=null}),Oe()),j[0].toDelete?H&&(De(),P(H,1,1,()=>{H=null}),Oe()):H?(H.p(j,Q),Q[0]&1&&A(H,1)):(H=Nc(j),H.c(),A(H,1),H.m(t,null))},i(j){S||(A(s.$$.fragment,j),A(r.$$.fragment,j),A(c),A(g.$$.fragment,j),A(L),A(H),S=!0)},o(j){P(s.$$.fragment,j),P(r.$$.fragment,j),P(c),P(g.$$.fragment,j),P(L),P(H),S=!1},d(j){j&&k(e),z(s),z(r),~f&&O[f].d(),z(g),L&&L.d(),H&&H.d(),M=!1,D()}}}function Hc(n){let e,t,i,s,l=n[0].system&&jc(),o=!n[0].id&&qc(n),r=n[0].required&&Vc(),a=n[0].unique&&zc();return{c(){e=_("div"),l&&l.c(),t=T(),o&&o.c(),i=T(),r&&r.c(),s=T(),a&&a.c(),h(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),m(e,t),o&&o.m(e,null),m(e,i),r&&r.m(e,null),m(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=jc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=qc(u),o.c(),o.m(e,i)),u[0].required?r||(r=Vc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=zc(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function jc(n){let e;return{c(){e=_("span"),e.textContent="System",h(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function qc(n){let e;return{c(){e=_("span"),e.textContent="New",h(e,"class","label"),ee(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&257&&ee(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&k(e)}}}function Vc(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function zc(n){let e;return{c(){e=_("span"),e.textContent="Unique",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Bc(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=et(Et.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Lt(()=>{t||(t=at(e,Wn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=at(e,Wn,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function Uc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Restore',h(e,"type","button"),h(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[15])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function H3(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,p,g,v,b,y=!n[0].toDelete&&Hc(n),$=n[7]&&!n[0].system&&Bc(),C=n[0].toDelete&&Uc(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=T(),o=_("strong"),a=R(r),f=T(),y&&y.c(),c=T(),d=_("div"),p=T(),$&&$.c(),g=T(),C&&C.c(),v=lt(),h(i,"class",s=Ka(Y.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),h(t,"class","icon field-type"),h(o,"class","title field-name svelte-1tpxlm5"),h(o,"title",u=n[0].name),ee(o,"txt-strikethrough",n[0].toDelete),h(e,"class","inline-flex"),h(d,"class","flex-fill")},m(S,M){w(S,e,M),m(e,t),m(t,i),m(e,l),m(e,o),m(o,a),w(S,f,M),y&&y.m(S,M),w(S,c,M),w(S,d,M),w(S,p,M),$&&$.m(S,M),w(S,g,M),C&&C.m(S,M),w(S,v,M),b=!0},p(S,M){(!b||M[0]&1&&s!==(s=Ka(Y.getFieldTypeIcon(S[0].type))+" svelte-1tpxlm5"))&&h(i,"class",s),(!b||M[0]&1)&&r!==(r=(S[0].name||"-")+"")&&me(a,r),(!b||M[0]&1&&u!==(u=S[0].name))&&h(o,"title",u),M[0]&1&&ee(o,"txt-strikethrough",S[0].toDelete),S[0].toDelete?y&&(y.d(1),y=null):y?y.p(S,M):(y=Hc(S),y.c(),y.m(c.parentNode,c)),S[7]&&!S[0].system?$?M[0]&129&&A($,1):($=Bc(),$.c(),A($,1),$.m(g.parentNode,g)):$&&(De(),P($,1,1,()=>{$=null}),Oe()),S[0].toDelete?C?C.p(S,M):(C=Uc(S),C.c(),C.m(v.parentNode,v)):C&&(C.d(1),C=null)},i(S){b||(A($),b=!0)},o(S){P($),b=!1},d(S){S&&k(e),S&&k(f),y&&y.d(S),S&&k(c),S&&k(d),S&&k(p),$&&$.d(S),S&&k(g),C&&C.d(S),S&&k(v)}}}function j3(n){let e,t,i={single:!0,interactive:n[8],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[H3],default:[R3]},$$scope:{ctx:n}};return e=new za({props:i}),n[32](e),e.$on("expand",n[33]),e.$on("collapse",n[34]),e.$on("toggle",n[35]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&256&&(o.interactive=s[8]),l[0]&5&&(o.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&483|l[1]&256&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[32](null),z(e,s)}}}function q3(n,e,t){let i,s,l,o,r;Vt(n,rs,Z=>t(14,r=Z));const a=hn();let{key:u="0"}=e,{field:f=new Sn}=e,{disabled:c=!1}=e,{excludeNames:d=[]}=e,p,g=f.type;function v(){p==null||p.expand()}function b(){p==null||p.collapse()}function y(){f.id?t(0,f.toDelete=!0,f):(b(),a("remove"))}function $(Z){if(Z=(""+Z).toLowerCase(),!Z)return!1;for(const be of d)if(be.toLowerCase()===Z)return!1;return!0}function C(Z){return Y.slugify(Z)}Jn(()=>{f.id||v()});const S=()=>{t(0,f.toDelete=!1,f)};function M(Z){n.$$.not_equal(f.type,Z)&&(f.type=Z,t(0,f),t(13,g),t(4,p))}const D=Z=>{t(0,f.name=C(Z.target.value),f),Z.target.value=f.name};function E(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function O(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function F(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function L(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function H(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function j(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function Q(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function ie(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function U(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function K(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function W(Z){n.$$.not_equal(f.options,Z)&&(f.options=Z,t(0,f),t(13,g),t(4,p))}function J(){f.required=this.checked,t(0,f),t(13,g),t(4,p)}function se(){f.unique=this.checked,t(0,f),t(13,g),t(4,p)}const fe=()=>{i&&b()};function ke(Z){he[Z?"unshift":"push"](()=>{p=Z,t(4,p)})}function le(Z){pt.call(this,n,Z)}function ue(Z){pt.call(this,n,Z)}function Me(Z){pt.call(this,n,Z)}return n.$$set=Z=>{"key"in Z&&t(1,u=Z.key),"field"in Z&&t(0,f=Z.field),"disabled"in Z&&t(2,c=Z.disabled),"excludeNames"in Z&&t(11,d=Z.excludeNames)},n.$$.update=()=>{n.$$.dirty[0]&8193&&g!=f.type&&(t(13,g=f.type),t(0,f.options={},f),t(0,f.unique=!1,f)),n.$$.dirty[0]&17&&f.toDelete&&(p&&b(),f.originalName&&f.name!==f.originalName&&t(0,f.name=f.originalName,f)),n.$$.dirty[0]&1&&!f.originalName&&f.name&&t(0,f.originalName=f.name,f),n.$$.dirty[0]&1&&typeof f.toDelete>"u"&&t(0,f.toDelete=!1,f),n.$$.dirty[0]&1&&f.required&&t(0,f.nullable=!1,f),n.$$.dirty[0]&1&&t(6,i=!Y.isEmpty(f.name)&&f.type),n.$$.dirty[0]&80&&(i||p&&v()),n.$$.dirty[0]&69&&t(8,s=!c&&!f.system&&!f.toDelete&&i),n.$$.dirty[0]&1&&t(5,l=$(f.name)),n.$$.dirty[0]&16418&&t(7,o=!l||!Y.isEmpty(Y.getNestedVal(r,`schema.${u}`)))},[f,u,c,b,p,l,i,o,s,y,C,d,v,g,r,S,M,D,E,O,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me]}class V3 extends Fe{constructor(e){super(),Le(this,e,q3,j3,Pe,{key:1,field:0,disabled:2,excludeNames:11,expand:12,collapse:3},null,[-1,-1])}get expand(){return this.$$.ctx[12]}get collapse(){return this.$$.ctx[3]}}function Wc(n,e,t){const i=n.slice();return i[9]=e[t],i[10]=e,i[11]=t,i}function Yc(n,e){let t,i,s,l;function o(u){e[5](u,e[9],e[10],e[11])}function r(){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 V3({props:a}),he.push(()=>Re(i,"field",o)),i.$on("remove",r),{key:n,first:null,c(){t=lt(),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],He(()=>s=!1)),i.$set(c)},i(u){l||(A(i.$$.fragment,u),l=!0)},o(u){P(i.$$.fragment,u),l=!1},d(u){u&&k(t),z(i,u)}}}function z3(n){let e,t=[],i=new Map,s,l,o,r,a,u,f,c,d,p,g,v=n[0].schema;const b=y=>y[11];for(let y=0;yp.name===d)}function u(d){let p=[];if(d.toDelete)return p;for(let g of s.schema)g===d||g.toDelete||p.push(g.name);return p}function f(d,p,g,v){g[v]=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)>"u"&&(t(0,s=s||{}),t(0,s.schema=[],s))},[s,i,l,o,u,f,c]}class U3 extends Fe{constructor(e){super(),Le(this,e,B3,z3,Pe,{collection:0})}}function Kc(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 Zc(n,e,t){const i=n.slice();return i[19]=e[t],i}function Jc(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C,S,M,D,E,O,F,L,H,j,Q,ie,U=n[0].schema,K=[];for(let W=0;W@request filter:",y=T(),$=_("div"),$.innerHTML=`@request.method @request.query.* @request.data.* - @request.user.*`,$=T(),S=_("hr"),M=T(),D=_("p"),D.innerHTML="You could also add constraints and query other collections using the @collection filter:",E=T(),O=_("div"),O.innerHTML="@collection.ANY_COLLECTION_NAME.*",F=T(),L=_("hr"),H=T(),j=_("p"),j.innerHTML=`Example rule: + @request.user.*`,C=T(),S=_("hr"),M=T(),D=_("p"),D.innerHTML="You could also add constraints and query other collections using the @collection filter:",E=T(),O=_("div"),O.innerHTML="@collection.ANY_COLLECTION_NAME.*",F=T(),L=_("hr"),H=T(),j=_("p"),j.innerHTML=`Example rule:
- @request.user.id!="" && created>"2022-01-01 00:00:00"`,h(s,"class","m-b-0"),h(o,"class","inline-flex flex-gap-5"),h(g,"class","m-t-10 m-b-5"),h(b,"class","m-b-0"),h(C,"class","inline-flex flex-gap-5"),h(S,"class","m-t-10 m-b-5"),h(D,"class","m-b-0"),h(O,"class","inline-flex flex-gap-5"),h(L,"class","m-t-10 m-b-5"),h(i,"class","content"),h(t,"class","alert alert-warning m-0")},m(W,J){w(W,e,J),p(e,t),p(t,i),p(i,s),p(i,l),p(i,o),p(o,r),p(o,a),p(o,u),p(o,f),p(o,c),p(o,d);for(let se=0;se{Q||(Q=at(e,on,{duration:150},!0)),Q.run(1)}),ie=!0)},o(W){W&&(Q||(Q=at(e,on,{duration:150},!1)),Q.run(0)),ie=!1},d(W){W&&k(e),Bn(K,W),W&&Q&&Q.end()}}}function B3(n){let e,t=n[19].name+"",i;return{c(){e=_("code"),i=R(t)},m(s,l){w(s,e,l),p(e,i)},p(s,l){l&1&&t!==(t=s[19].name+"")&&me(i,t)},d(s){s&&k(e)}}}function U3(n){let e,t=n[19].name+"",i,s;return{c(){e=_("code"),i=R(t),s=R(".*")},m(l,o){w(l,e,o),p(e,i),p(e,s)},p(l,o){o&1&&t!==(t=l[19].name+"")&&me(i,t)},d(l){l&&k(e)}}}function Jc(n){let e;function t(l,o){return l[19].type==="relation"||l[19].type==="user"?U3:B3}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function W3(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const o=r=>r[14];for(let r=0;r',h(e,"class","txt-center")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function K3(n){let e,t,i;function s(){return n[9](n[14])}return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Lock and set to Admins only")),X(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function Z3(n){let e,t,i;function s(){return n[8](n[14])}return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Unlock and set custom rule")),X(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function J3(n){let e;return{c(){e=R("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function G3(n){let e;return{c(){e=R("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function X3(n){let e,t=n[15]+"",i,s,l=Ei(n[0][n[14]])?"Admins only":"Custom rule",o,r,a,u,f=n[14],c,d,m,g,v,b,y;function C(){return n[10](n[14])}const $=()=>n[11](u,f),S=()=>n[11](null,f);function M(H){n[12](H,n[14])}var D=n[4];function E(H){let j={baseCollection:H[0],disabled:Ei(H[0][H[14]])};return H[0][H[14]]!==void 0&&(j.value=H[0][H[14]]),{props:j}}D&&(u=new D(E(n)),$(),he.push(()=>Re(u,"value",M)));function O(H,j){return j&1&&(g=null),g==null&&(g=!!Ei(H[0][H[14]])),g?G3:J3}let F=O(n,-1),L=F(n);return{c(){e=_("label"),i=R(t),s=R(" - "),o=R(l),a=T(),u&&B(u.$$.fragment),d=T(),m=_("div"),L.c(),h(e,"for",r=n[18]),h(m,"class","help-block")},m(H,j){w(H,e,j),p(e,i),p(e,s),p(e,o),w(H,a,j),u&&V(u,H,j),w(H,d,j),w(H,m,j),L.m(m,null),v=!0,b||(y=X(e,"click",C),b=!0)},p(H,j){n=H,(!v||j&1)&&l!==(l=Ei(n[0][n[14]])?"Admins only":"Custom rule")&&me(o,l),(!v||j&262144&&r!==(r=n[18]))&&h(e,"for",r),f!==n[14]&&(S(),f=n[14],$());const Q={};if(j&1&&(Q.baseCollection=n[0]),j&1&&(Q.disabled=Ei(n[0][n[14]])),!c&&j&65&&(c=!0,Q.value=n[0][n[14]],He(()=>c=!1)),D!==(D=n[4])){if(u){De();const ie=u;P(ie.$$.fragment,1,0,()=>{z(ie,1)}),Oe()}D?(u=new D(E(n)),$(),he.push(()=>Re(u,"value",M)),B(u.$$.fragment),A(u.$$.fragment,1),V(u,d.parentNode,d)):u=null}else D&&u.$set(Q);F!==(F=O(n,j))&&(L.d(1),L=F(n),L&&(L.c(),L.m(m,null)))},i(H){v||(u&&A(u.$$.fragment,H),v=!0)},o(H){u&&P(u.$$.fragment,H),v=!1},d(H){H&&k(e),H&&k(a),S(),u&&z(u,H),H&&k(d),H&&k(m),L.d(),b=!1,y()}}}function Gc(n,e){let t,i,s,l,o,r,a,u;function f(m,g){return g&1&&(l=null),l==null&&(l=!!Ei(m[0][m[14]])),l?Z3:K3}let c=f(e,-1),d=c(e);return r=new Ie({props:{class:"form-field rule-field m-0 "+(Ei(e[0][e[14]])?"disabled":""),name:e[14],$$slots:{default:[X3,({uniqueId:m})=>({18:m}),({uniqueId:m})=>m?262144:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=_("hr"),i=T(),s=_("div"),d.c(),o=T(),B(r.$$.fragment),a=T(),h(t,"class","m-t-sm m-b-sm"),h(s,"class","rule-block svelte-fjxz7k"),this.first=t},m(m,g){w(m,t,g),w(m,i,g),w(m,s,g),d.m(s,null),p(s,o),V(r,s,null),p(s,a),u=!0},p(m,g){e=m,c===(c=f(e,g))&&d?d.p(e,g):(d.d(1),d=c(e),d&&(d.c(),d.m(s,o)));const v={};g&1&&(v.class="form-field rule-field m-0 "+(Ei(e[0][e[14]])?"disabled":"")),g&4456473&&(v.$$scope={dirty:g,ctx:e}),r.$set(v)},i(m){u||(A(r.$$.fragment,m),u=!0)},o(m){P(r.$$.fragment,m),u=!1},d(m){m&&k(t),m&&k(i),m&&k(s),d.d(),z(r)}}}function Q3(n){let e,t,i,s,l,o=n[2]?"Hide available fields":"Show available fields",r,a,u,f,c,d,m,g,v,b=n[2]&&Zc(n);const y=[Y3,W3],C=[];function $(S,M){return S[5]?0:1}return f=$(n),c=C[f]=y[f](n),{c(){e=_("div"),t=_("div"),i=_("p"),i.innerHTML=`All rules follow the + @request.user.id!="" && created>"2022-01-01 00:00:00"`,h(s,"class","m-b-0"),h(o,"class","inline-flex flex-gap-5"),h(g,"class","m-t-10 m-b-5"),h(b,"class","m-b-0"),h($,"class","inline-flex flex-gap-5"),h(S,"class","m-t-10 m-b-5"),h(D,"class","m-b-0"),h(O,"class","inline-flex flex-gap-5"),h(L,"class","m-t-10 m-b-5"),h(i,"class","content"),h(t,"class","alert alert-warning m-0")},m(W,J){w(W,e,J),m(e,t),m(t,i),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(o,d);for(let se=0;se{Q||(Q=at(e,on,{duration:150},!0)),Q.run(1)}),ie=!0)},o(W){W&&(Q||(Q=at(e,on,{duration:150},!1)),Q.run(0)),ie=!1},d(W){W&&k(e),Bn(K,W),W&&Q&&Q.end()}}}function W3(n){let e,t=n[19].name+"",i;return{c(){e=_("code"),i=R(t)},m(s,l){w(s,e,l),m(e,i)},p(s,l){l&1&&t!==(t=s[19].name+"")&&me(i,t)},d(s){s&&k(e)}}}function Y3(n){let e,t=n[19].name+"",i,s;return{c(){e=_("code"),i=R(t),s=R(".*")},m(l,o){w(l,e,o),m(e,i),m(e,s)},p(l,o){o&1&&t!==(t=l[19].name+"")&&me(i,t)},d(l){l&&k(e)}}}function Gc(n){let e;function t(l,o){return l[19].type==="relation"||l[19].type==="user"?Y3:W3}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function K3(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const o=r=>r[14];for(let r=0;r',h(e,"class","txt-center")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function J3(n){let e,t,i;function s(){return n[9](n[14])}return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Lock and set to Admins only")),X(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function G3(n){let e,t,i;function s(){return n[8](n[14])}return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Unlock and set custom rule")),X(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function X3(n){let e;return{c(){e=R("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Q3(n){let e;return{c(){e=R("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function x3(n){let e,t=n[15]+"",i,s,l=Ei(n[0][n[14]])?"Admins only":"Custom rule",o,r,a,u,f=n[14],c,d,p,g,v,b,y;function $(){return n[10](n[14])}const C=()=>n[11](u,f),S=()=>n[11](null,f);function M(H){n[12](H,n[14])}var D=n[4];function E(H){let j={baseCollection:H[0],disabled:Ei(H[0][H[14]])};return H[0][H[14]]!==void 0&&(j.value=H[0][H[14]]),{props:j}}D&&(u=new D(E(n)),C(),he.push(()=>Re(u,"value",M)));function O(H,j){return j&1&&(g=null),g==null&&(g=!!Ei(H[0][H[14]])),g?Q3:X3}let F=O(n,-1),L=F(n);return{c(){e=_("label"),i=R(t),s=R(" - "),o=R(l),a=T(),u&&B(u.$$.fragment),d=T(),p=_("div"),L.c(),h(e,"for",r=n[18]),h(p,"class","help-block")},m(H,j){w(H,e,j),m(e,i),m(e,s),m(e,o),w(H,a,j),u&&V(u,H,j),w(H,d,j),w(H,p,j),L.m(p,null),v=!0,b||(y=X(e,"click",$),b=!0)},p(H,j){n=H,(!v||j&1)&&l!==(l=Ei(n[0][n[14]])?"Admins only":"Custom rule")&&me(o,l),(!v||j&262144&&r!==(r=n[18]))&&h(e,"for",r),f!==n[14]&&(S(),f=n[14],C());const Q={};if(j&1&&(Q.baseCollection=n[0]),j&1&&(Q.disabled=Ei(n[0][n[14]])),!c&&j&65&&(c=!0,Q.value=n[0][n[14]],He(()=>c=!1)),D!==(D=n[4])){if(u){De();const ie=u;P(ie.$$.fragment,1,0,()=>{z(ie,1)}),Oe()}D?(u=new D(E(n)),C(),he.push(()=>Re(u,"value",M)),B(u.$$.fragment),A(u.$$.fragment,1),V(u,d.parentNode,d)):u=null}else D&&u.$set(Q);F!==(F=O(n,j))&&(L.d(1),L=F(n),L&&(L.c(),L.m(p,null)))},i(H){v||(u&&A(u.$$.fragment,H),v=!0)},o(H){u&&P(u.$$.fragment,H),v=!1},d(H){H&&k(e),H&&k(a),S(),u&&z(u,H),H&&k(d),H&&k(p),L.d(),b=!1,y()}}}function Xc(n,e){let t,i,s,l,o,r,a,u;function f(p,g){return g&1&&(l=null),l==null&&(l=!!Ei(p[0][p[14]])),l?G3:J3}let c=f(e,-1),d=c(e);return r=new Ie({props:{class:"form-field rule-field m-0 "+(Ei(e[0][e[14]])?"disabled":""),name:e[14],$$slots:{default:[x3,({uniqueId:p})=>({18:p}),({uniqueId:p})=>p?262144:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=_("hr"),i=T(),s=_("div"),d.c(),o=T(),B(r.$$.fragment),a=T(),h(t,"class","m-t-sm m-b-sm"),h(s,"class","rule-block svelte-fjxz7k"),this.first=t},m(p,g){w(p,t,g),w(p,i,g),w(p,s,g),d.m(s,null),m(s,o),V(r,s,null),m(s,a),u=!0},p(p,g){e=p,c===(c=f(e,g))&&d?d.p(e,g):(d.d(1),d=c(e),d&&(d.c(),d.m(s,o)));const v={};g&1&&(v.class="form-field rule-field m-0 "+(Ei(e[0][e[14]])?"disabled":"")),g&4456473&&(v.$$scope={dirty:g,ctx:e}),r.$set(v)},i(p){u||(A(r.$$.fragment,p),u=!0)},o(p){P(r.$$.fragment,p),u=!1},d(p){p&&k(t),p&&k(i),p&&k(s),d.d(),z(r)}}}function e$(n){let e,t,i,s,l,o=n[2]?"Hide available fields":"Show available fields",r,a,u,f,c,d,p,g,v,b=n[2]&&Jc(n);const y=[Z3,K3],$=[];function C(S,M){return S[5]?0:1}return f=C(n),c=$[f]=y[f](n),{c(){e=_("div"),t=_("div"),i=_("p"),i.innerHTML=`All rules follow the
PocketBase filter syntax and operators - .`,s=T(),l=_("span"),r=R(o),a=T(),b&&b.c(),u=T(),c.c(),d=lt(),h(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),h(t,"class","flex"),h(e,"class","block m-b-base")},m(S,M){w(S,e,M),p(e,t),p(t,i),p(t,s),p(t,l),p(l,r),p(e,a),b&&b.m(e,null),w(S,u,M),C[f].m(S,M),w(S,d,M),m=!0,g||(v=X(l,"click",n[7]),g=!0)},p(S,[M]){(!m||M&4)&&o!==(o=S[2]?"Hide available fields":"Show available fields")&&me(r,o),S[2]?b?(b.p(S,M),M&4&&A(b,1)):(b=Zc(S),b.c(),A(b,1),b.m(e,null)):b&&(De(),P(b,1,1,()=>{b=null}),Oe());let D=f;f=$(S),f===D?C[f].p(S,M):(De(),P(C[D],1,1,()=>{C[D]=null}),Oe(),c=C[f],c?c.p(S,M):(c=C[f]=y[f](S),c.c()),A(c,1),c.m(d.parentNode,d))},i(S){m||(A(b),A(c),m=!0)},o(S){P(b),P(c),m=!1},d(S){S&&k(e),b&&b.d(),S&&k(u),C[f].d(S),S&&k(d),g=!1,v()}}}function Ei(n){return n===null}function x3(n,e,t){let{collection:i=new Fn}=e,s={},l=!1,o={},r,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,r=(await Qi(()=>import("./FilterAutocompleteInput.22ad58b4.js"),[])).default)}catch(y){console.warn(y),t(4,r=null)}t(5,a=!1)}Jn(()=>{f()});const c=()=>t(2,l=!l),d=async y=>{var C;t(0,i[y]=s[y]||"",i),await di(),(C=o[y])==null||C.focus()},m=y=>{t(1,s[y]=i[y],s),t(0,i[y]=null,i)},g=y=>{var C;return(C=o[y])==null?void 0:C.focus()};function v(y,C){he[y?"unshift":"push"](()=>{o[C]=y,t(3,o)})}function b(y,C){n.$$.not_equal(i[C],y)&&(i[C]=y,t(0,i))}return n.$$set=y=>{"collection"in y&&t(0,i=y.collection)},[i,s,l,o,r,a,u,c,d,m,g,v,b]}class e$ extends Fe{constructor(e){super(),Le(this,e,x3,Q3,Pe,{collection:0})}}function Xc(n,e,t){const i=n.slice();return i[14]=e[t],i}function Qc(n,e,t){const i=n.slice();return i[14]=e[t],i}function xc(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 ed(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=R(`Renamed collection - `),s=_("strong"),o=R(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=R(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(m,g){w(m,e,g),p(e,t),p(t,i),p(t,s),p(s,o),p(t,r),p(t,a),p(t,u),p(t,f),p(f,d)},p(m,g){g&2&&l!==(l=m[1].originalName+"")&&me(o,l),g&2&&c!==(c=m[1].name+"")&&me(d,c)},d(m){m&&k(e)}}}function td(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=R(`Renamed field - `),s=_("strong"),o=R(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=R(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(m,g){w(m,e,g),p(e,t),p(t,i),p(t,s),p(s,o),p(t,r),p(t,a),p(t,u),p(t,f),p(f,d)},p(m,g){g&16&&l!==(l=m[14].originalName+"")&&me(o,l),g&16&&c!==(c=m[14].name+"")&&me(d,c)},d(m){m&&k(e)}}}function nd(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=_("li"),t=R("Removed field "),i=_("span"),l=R(s),o=T(),h(i,"class","txt-bold"),h(e,"class","txt-danger")},m(r,a){w(r,e,a),p(e,t),p(e,i),p(i,l),p(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&me(l,s)},d(r){r&&k(e)}}}function t$(n){let e,t,i,s,l,o,r,a,u,f,c,d,m=n[3].length&&xc(),g=n[5]&&ed(n),v=n[4],b=[];for(let $=0;$',i=T(),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!`,o=T(),m&&m.c(),r=T(),a=_("h6"),a.textContent="Changes:",u=T(),f=_("ul"),g&&g.c(),c=T();for(let $=0;$Cancel',t=T(),i=_("button"),i.innerHTML='Confirm',e.autofocus=!0,h(e,"type","button"),h(e,"class","btn btn-secondary"),h(i,"type","button"),h(i,"class","btn btn-expanded")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[X(e,"click",n[8]),X(i,"click",n[9])],s=!0)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,st(l)}}}function s$(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[i$],header:[n$],default:[t$]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[10](null),z(e,s)}}}function l$(n,e,t){let i,s,l;const o=hn();let r,a;async function u(y){t(1,a=y),await di(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),m=()=>c();function g(y){he[y?"unshift":"push"](()=>{r=y,t(2,r)})}function v(y){pt.call(this,n,y)}function b(y){pt.call(this,n,y)}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(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,m,g,v,b]}class o$ extends Fe{constructor(e){super(),Le(this,e,l$,s$,Pe,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function id(n){let e,t,i,s;function l(r){n[26](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new e$({props:o}),he.push(()=>Re(t,"collection",l)),{c(){e=_("div"),B(t.$$.fragment),h(e,"class","tab-item active")},m(r,a){w(r,e,a),V(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],He(()=>i=!1)),t.$set(u)},i(r){s||(A(t.$$.fragment,r),s=!0)},o(r){P(t.$$.fragment,r),s=!1},d(r){r&&k(e),z(t)}}}function r$(n){let e,t,i,s,l,o;function r(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new z3({props:a}),he.push(()=>Re(i,"collection",r));let u=n[9]===_l&&id(n);return{c(){e=_("div"),t=_("div"),B(i.$$.fragment),l=T(),u&&u.c(),h(t,"class","tab-item"),ee(t,"active",n[9]===ss),h(e,"class","tabs-content svelte-b10vi")},m(f,c){w(f,e,c),p(e,t),V(i,t,null),p(e,l),u&&u.m(e,null),o=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],He(()=>s=!1)),i.$set(d),c[0]&512&&ee(t,"active",f[9]===ss),f[9]===_l?u?(u.p(f,c),c[0]&512&&A(u,1)):(u=id(f),u.c(),A(u,1),u.m(e,null)):u&&(De(),P(u,1,1,()=>{u=null}),Oe())},i(f){o||(A(i.$$.fragment,f),A(u),o=!0)},o(f){P(i.$$.fragment,f),P(u),o=!1},d(f){f&&k(e),z(i),u&&u.d()}}}function sd(n){let e,t,i,s,l,o,r;return o=new qi({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[a$]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=T(),i=_("button"),s=_("i"),l=T(),B(o.$$.fragment),h(e,"class","flex-fill"),h(s,"class","ri-more-line"),h(i,"type","button"),h(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),p(i,s),p(i,l),V(o,i,null),r=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(A(o.$$.fragment,a),r=!0)},o(a){P(o.$$.fragment,a),r=!1},d(a){a&&k(e),a&&k(t),a&&k(i),z(o)}}}function a$(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` - Delete`,h(e,"type","button"),h(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[20]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function ld(n){let e;return{c(){e=_("div"),e.textContent="System collection",h(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function u$(n){let e,t,i,s,l,o,r,a,u,f,c,d,m=n[2].system&&ld();return{c(){e=_("label"),t=R("Name"),s=T(),l=_("input"),u=T(),m&&m.c(),f=lt(),h(e,"for",i=n[38]),h(l,"type","text"),h(l,"id",o=n[38]),l.required=!0,l.disabled=n[11],h(l,"spellcheck","false"),l.autofocus=r=n[2].isNew,h(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(g,v){w(g,e,v),p(e,t),w(g,s,v),w(g,l,v),w(g,u,v),m&&m.m(g,v),w(g,f,v),n[2].isNew&&l.focus(),c||(d=X(l,"input",n[21]),c=!0)},p(g,v){v[1]&128&&i!==(i=g[38])&&h(e,"for",i),v[1]&128&&o!==(o=g[38])&&h(l,"id",o),v[0]&2048&&(l.disabled=g[11]),v[0]&4&&r!==(r=g[2].isNew)&&(l.autofocus=r),v[0]&4&&a!==(a=g[2].name)&&l.value!==a&&(l.value=a),g[2].system?m||(m=ld(),m.c(),m.m(f.parentNode,f)):m&&(m.d(1),m=null)},d(g){g&&k(e),g&&k(s),g&&k(l),g&&k(u),m&&m.d(g),g&&k(f),c=!1,d()}}}function od(n){let e,t,i,s,l,o;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),s=!0,l||(o=et(t=Et.call(null,e,n[12])),l=!0)},p(r,a){t&&Zn(t.update)&&a[0]&4096&&t.update.call(null,r[12])},i(r){s||(r&&Lt(()=>{i||(i=at(e,Wn,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=at(e,Wn,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&k(e),r&&i&&i.end(),l=!1,o()}}}function rd(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=et(Et.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Lt(()=>{t||(t=at(e,Wn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=at(e,Wn,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function f$(n){var H,j,Q,ie,U,K;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,m,g,v=!Y.isEmpty((H=n[4])==null?void 0:H.schema),b,y,C,$,S=!Y.isEmpty((j=n[4])==null?void 0:j.listRule)||!Y.isEmpty((Q=n[4])==null?void 0:Q.viewRule)||!Y.isEmpty((ie=n[4])==null?void 0:ie.createRule)||!Y.isEmpty((U=n[4])==null?void 0:U.updateRule)||!Y.isEmpty((K=n[4])==null?void 0:K.deleteRule),M,D,E,O=!n[2].isNew&&!n[2].system&&sd(n);r=new Ie({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[u$,({uniqueId:W})=>({38:W}),({uniqueId:W})=>[0,W?128:0]]},$$scope:{ctx:n}}});let F=v&&od(n),L=S&&rd();return{c(){e=_("h4"),i=R(t),s=T(),O&&O.c(),l=T(),o=_("form"),B(r.$$.fragment),a=T(),u=_("input"),f=T(),c=_("div"),d=_("button"),m=_("span"),m.textContent="Fields",g=T(),F&&F.c(),b=T(),y=_("button"),C=_("span"),C.textContent="API Rules",$=T(),L&&L.c(),h(u,"type","submit"),h(u,"class","hidden"),h(u,"tabindex","-1"),h(o,"class","block"),h(m,"class","txt"),h(d,"type","button"),h(d,"class","tab-item"),ee(d,"active",n[9]===ss),h(C,"class","txt"),h(y,"type","button"),h(y,"class","tab-item"),ee(y,"active",n[9]===_l),h(c,"class","tabs-header stretched")},m(W,J){w(W,e,J),p(e,i),w(W,s,J),O&&O.m(W,J),w(W,l,J),w(W,o,J),V(r,o,null),p(o,a),p(o,u),w(W,f,J),w(W,c,J),p(c,d),p(d,m),p(d,g),F&&F.m(d,null),p(c,b),p(c,y),p(y,C),p(y,$),L&&L.m(y,null),M=!0,D||(E=[X(o,"submit",Qt(n[22])),X(d,"click",n[23]),X(y,"click",n[24])],D=!0)},p(W,J){var fe,ke,le,ue,Me,Z;(!M||J[0]&4)&&t!==(t=W[2].isNew?"New collection":"Edit collection")&&me(i,t),!W[2].isNew&&!W[2].system?O?(O.p(W,J),J[0]&4&&A(O,1)):(O=sd(W),O.c(),A(O,1),O.m(l.parentNode,l)):O&&(De(),P(O,1,1,()=>{O=null}),Oe());const se={};J[0]&2048&&(se.class="form-field required m-b-0 "+(W[11]?"disabled":"")),J[0]&2052|J[1]&384&&(se.$$scope={dirty:J,ctx:W}),r.$set(se),J[0]&16&&(v=!Y.isEmpty((fe=W[4])==null?void 0:fe.schema)),v?F?(F.p(W,J),J[0]&16&&A(F,1)):(F=od(W),F.c(),A(F,1),F.m(d,null)):F&&(De(),P(F,1,1,()=>{F=null}),Oe()),J[0]&512&&ee(d,"active",W[9]===ss),J[0]&16&&(S=!Y.isEmpty((ke=W[4])==null?void 0:ke.listRule)||!Y.isEmpty((le=W[4])==null?void 0:le.viewRule)||!Y.isEmpty((ue=W[4])==null?void 0:ue.createRule)||!Y.isEmpty((Me=W[4])==null?void 0:Me.updateRule)||!Y.isEmpty((Z=W[4])==null?void 0:Z.deleteRule)),S?L?J[0]&16&&A(L,1):(L=rd(),L.c(),A(L,1),L.m(y,null)):L&&(De(),P(L,1,1,()=>{L=null}),Oe()),J[0]&512&&ee(y,"active",W[9]===_l)},i(W){M||(A(O),A(r.$$.fragment,W),A(F),A(L),M=!0)},o(W){P(O),P(r.$$.fragment,W),P(F),P(L),M=!1},d(W){W&&k(e),W&&k(s),O&&O.d(W),W&&k(l),W&&k(o),z(r),W&&k(f),W&&k(c),F&&F.d(),L&&L.d(),D=!1,st(E)}}}function c$(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=R(o),h(t,"class","txt"),h(e,"type","button"),h(e,"class","btn btn-secondary"),e.disabled=n[7],h(l,"class","txt"),h(s,"type","button"),h(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ee(s,"btn-loading",n[7])},m(c,d){w(c,e,d),p(e,t),w(c,i,d),w(c,s,d),p(s,l),p(l,r),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&&o!==(o=c[2].isNew?"Create":"Save changes")&&me(r,o),d[0]&1152&&a!==(a=!c[10]||c[7])&&(s.disabled=a),d[0]&128&&ee(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,st(f)}}}function d$(n){let e,t,i,s,l={class:"overlay-panel-lg colored-header compact-header collection-panel",beforeHide:n[27],$$slots:{footer:[c$],header:[f$],default:[r$]},$$scope:{ctx:n}};e=new Ci({props:l}),n[28](e),e.$on("hide",n[29]),e.$on("show",n[30]);let o={};return i=new o$({props:o}),n[31](i),i.$on("confirm",n[32]),{c(){B(e.$$.fragment),t=T(),B(i.$$.fragment)},m(r,a){V(e,r,a),w(r,t,a),V(i,r,a),s=!0},p(r,a){const u={};a[0]&264&&(u.beforeHide=r[27]),a[0]&7828|a[1]&256&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};i.$set(f)},i(r){s||(A(e.$$.fragment,r),A(i.$$.fragment,r),s=!0)},o(r){P(e.$$.fragment,r),P(i.$$.fragment,r),s=!1},d(r){n[28](null),z(e,r),r&&k(t),n[31](null),z(i,r)}}}const ss="fields",_l="api_rules";function $r(n){return JSON.stringify(n)}function h$(n,e,t){let i,s,l,o,r,a;qt(n,ui,Z=>t(34,r=Z)),qt(n,rs,Z=>t(4,a=Z));const u=hn();let f,c,d=null,m=new Fn,g=!1,v=!1,b=ss,y=$r(m);function C(Z){t(9,b=Z)}function $(Z){return M(Z),t(8,v=!0),C(ss),f==null?void 0:f.show()}function S(){return f==null?void 0:f.hide()}async function M(Z){Ri({}),typeof Z<"u"?(d=Z,t(2,m=Z==null?void 0:Z.clone())):(d=null,t(2,m=new Fn)),t(2,m.schema=m.schema||[],m),t(2,m.originalName=m.name||"",m),await di(),t(17,y=$r(m))}function D(){if(m.isNew)return E();c==null||c.show(m)}function E(){if(g)return;t(7,g=!0);const Z=O();let be;m.isNew?be=Se.Collections.create(Z):be=Se.Collections.update(m.id,Z),be.then(x=>{t(8,v=!1),S(),_n(m.isNew?"Successfully created collection.":"Successfully updated collection."),Rw(x),m.isNew&&wn(ui,r=x,r),u("save",x)}).catch(x=>{Se.errorResponseHandler(x)}).finally(()=>{t(7,g=!1)})}function O(){const Z=m.export();Z.schema=Z.schema.slice(0);for(let be=Z.schema.length-1;be>=0;be--)Z.schema[be].toDelete&&Z.schema.splice(be,1);return Z}function F(){!(d!=null&&d.id)||Si(`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(()=>{S(),_n(`Successfully deleted collection "${d==null?void 0:d.name}".`),u("delete",d),Hw(d)}).catch(Z=>{Se.errorResponseHandler(Z)}))}const L=()=>S(),H=()=>D(),j=()=>F(),Q=Z=>{t(2,m.name=Y.slugify(Z.target.value),m),Z.target.value=m.name},ie=()=>{o&&D()},U=()=>C(ss),K=()=>C(_l);function W(Z){m=Z,t(2,m)}function J(Z){m=Z,t(2,m)}const se=()=>l&&v?(Si("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,v=!1),S()}),!1):!0;function fe(Z){he[Z?"unshift":"push"](()=>{f=Z,t(5,f)})}function ke(Z){pt.call(this,n,Z)}function le(Z){pt.call(this,n,Z)}function ue(Z){he[Z?"unshift":"push"](()=>{c=Z,t(6,c)})}const Me=()=>E();return n.$$.update=()=>{n.$$.dirty[0]&16&&t(12,i=typeof Y.getNestedVal(a,"schema.message",null)=="string"?Y.getNestedVal(a,"schema.message"):"Has errors"),n.$$.dirty[0]&4&&t(11,s=!m.isNew&&m.system),n.$$.dirty[0]&131076&&t(3,l=y!=$r(m)),n.$$.dirty[0]&12&&t(10,o=m.isNew||l)},[C,S,m,l,a,f,c,g,v,b,o,s,i,D,E,F,$,y,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me]}class Ua extends Fe{constructor(e){super(),Le(this,e,h$,d$,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 ad(n,e,t){const i=n.slice();return i[13]=e[t],i}function ud(n){let e,t=n[1].length&&fd();return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1].length?t||(t=fd(),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function fd(n){let e;return{c(){e=_("p"),e.textContent="No collections found.",h(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 p$(n){let e;return{c(){e=_("i"),h(e,"class","ri-folder-2-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function m$(n){let e;return{c(){e=_("i"),h(e,"class","ri-folder-open-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function cd(n,e){let t,i,s,l=e[13].name+"",o,r,a,u;function f(g,v){var b;return((b=g[5])==null?void 0:b.id)===g[13].id?m$:p$}let c=f(e),d=c(e);function m(){return e[10](e[13])}return{key:n,first:null,c(){var g;t=_("div"),d.c(),i=T(),s=_("span"),o=R(l),r=T(),h(s,"class","txt"),h(t,"tabindex","0"),h(t,"class","sidebar-list-item"),ee(t,"active",((g=e[5])==null?void 0:g.id)===e[13].id),this.first=t},m(g,v){w(g,t,v),d.m(t,null),p(t,i),p(t,s),p(s,o),p(t,r),a||(u=X(t,"click",m),a=!0)},p(g,v){var b;e=g,c!==(c=f(e))&&(d.d(1),d=c(e),d&&(d.c(),d.m(t,i))),v&8&&l!==(l=e[13].name+"")&&me(o,l),v&40&&ee(t,"active",((b=e[5])==null?void 0:b.id)===e[13].id)},d(g){g&&k(t),d.d(),a=!1,u()}}}function g$(n){let e,t,i,s,l,o,r,a,u,f,c,d=[],m=new Map,g,v,b,y,C,$,S,M,D=n[3];const E=L=>L[13].id;for(let L=0;L',o=T(),r=_("input"),a=T(),u=_("hr"),f=T(),c=_("div");for(let L=0;L - New collection`,y=T(),B(C.$$.fragment),h(l,"type","button"),h(l,"class","btn btn-xs btn-secondary btn-circle btn-clear"),ee(l,"hidden",!n[4]),h(s,"class","form-field-addon"),h(r,"type","text"),h(r,"placeholder","Search collections..."),h(i,"class","form-field search"),ee(i,"active",n[4]),h(t,"class","sidebar-header"),h(u,"class","m-t-5 m-b-xs"),h(c,"class","sidebar-content"),h(b,"type","button"),h(b,"class","btn btn-block btn-outline"),h(v,"class","sidebar-footer"),h(e,"class","page-sidebar collection-sidebar")},m(L,H){w(L,e,H),p(e,t),p(t,i),p(i,s),p(s,l),p(i,o),p(i,r),$e(r,n[0]),p(e,a),p(e,u),p(e,f),p(e,c);for(let j=0;jt(5,o=b)),qt(n,Ms,b=>t(7,r=b));let a,u="";function f(b){wn(ui,o=b,o)}const c=()=>t(0,u="");function d(){u=this.value,t(0,u)}const m=b=>f(b),g=()=>a==null?void 0:a.show();function v(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=r.filter(b=>b.name!="profiles"&&(b.id==u||b.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[u,i,a,l,s,o,f,r,c,d,m,g,v]}class b$ extends Fe{constructor(e){super(),Le(this,e,_$,g$,Pe,{})}}function v$(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$,S,M,D,E,O,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format + .`,s=T(),l=_("span"),r=R(o),a=T(),b&&b.c(),u=T(),c.c(),d=lt(),h(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),h(t,"class","flex"),h(e,"class","block m-b-base")},m(S,M){w(S,e,M),m(e,t),m(t,i),m(t,s),m(t,l),m(l,r),m(e,a),b&&b.m(e,null),w(S,u,M),$[f].m(S,M),w(S,d,M),p=!0,g||(v=X(l,"click",n[7]),g=!0)},p(S,[M]){(!p||M&4)&&o!==(o=S[2]?"Hide available fields":"Show available fields")&&me(r,o),S[2]?b?(b.p(S,M),M&4&&A(b,1)):(b=Jc(S),b.c(),A(b,1),b.m(e,null)):b&&(De(),P(b,1,1,()=>{b=null}),Oe());let D=f;f=C(S),f===D?$[f].p(S,M):(De(),P($[D],1,1,()=>{$[D]=null}),Oe(),c=$[f],c?c.p(S,M):(c=$[f]=y[f](S),c.c()),A(c,1),c.m(d.parentNode,d))},i(S){p||(A(b),A(c),p=!0)},o(S){P(b),P(c),p=!1},d(S){S&&k(e),b&&b.d(),S&&k(u),$[f].d(S),S&&k(d),g=!1,v()}}}function Ei(n){return n===null}function t$(n,e,t){let{collection:i=new Fn}=e,s={},l=!1,o={},r,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,r=(await Qi(()=>import("./FilterAutocompleteInput.18e2a4f4.js"),[])).default)}catch(y){console.warn(y),t(4,r=null)}t(5,a=!1)}Jn(()=>{f()});const c=()=>t(2,l=!l),d=async y=>{var $;t(0,i[y]=s[y]||"",i),await di(),($=o[y])==null||$.focus()},p=y=>{t(1,s[y]=i[y],s),t(0,i[y]=null,i)},g=y=>{var $;return($=o[y])==null?void 0:$.focus()};function v(y,$){he[y?"unshift":"push"](()=>{o[$]=y,t(3,o)})}function b(y,$){n.$$.not_equal(i[$],y)&&(i[$]=y,t(0,i))}return n.$$set=y=>{"collection"in y&&t(0,i=y.collection)},[i,s,l,o,r,a,u,c,d,p,g,v,b]}class n$ extends Fe{constructor(e){super(),Le(this,e,t$,e$,Pe,{collection:0})}}function Qc(n,e,t){const i=n.slice();return i[14]=e[t],i}function xc(n,e,t){const i=n.slice();return i[14]=e[t],i}function ed(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 td(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=R(`Renamed collection + `),s=_("strong"),o=R(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=R(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(p,g){w(p,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(p,g){g&2&&l!==(l=p[1].originalName+"")&&me(o,l),g&2&&c!==(c=p[1].name+"")&&me(d,c)},d(p){p&&k(e)}}}function nd(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=R(`Renamed field + `),s=_("strong"),o=R(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=R(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(p,g){w(p,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(p,g){g&16&&l!==(l=p[14].originalName+"")&&me(o,l),g&16&&c!==(c=p[14].name+"")&&me(d,c)},d(p){p&&k(e)}}}function id(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=_("li"),t=R("Removed field "),i=_("span"),l=R(s),o=T(),h(i,"class","txt-bold"),h(e,"class","txt-danger")},m(r,a){w(r,e,a),m(e,t),m(e,i),m(i,l),m(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&me(l,s)},d(r){r&&k(e)}}}function i$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p=n[3].length&&ed(),g=n[5]&&td(n),v=n[4],b=[];for(let C=0;C',i=T(),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!`,o=T(),p&&p.c(),r=T(),a=_("h6"),a.textContent="Changes:",u=T(),f=_("ul"),g&&g.c(),c=T();for(let C=0;CCancel',t=T(),i=_("button"),i.innerHTML='Confirm',e.autofocus=!0,h(e,"type","button"),h(e,"class","btn btn-secondary"),h(i,"type","button"),h(i,"class","btn btn-expanded")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[X(e,"click",n[8]),X(i,"click",n[9])],s=!0)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,st(l)}}}function o$(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[l$],header:[s$],default:[i$]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[10](null),z(e,s)}}}function r$(n,e,t){let i,s,l;const o=hn();let r,a;async function u(y){t(1,a=y),await di(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),p=()=>c();function g(y){he[y?"unshift":"push"](()=>{r=y,t(2,r)})}function v(y){pt.call(this,n,y)}function b(y){pt.call(this,n,y)}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(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,p,g,v,b]}class a$ extends Fe{constructor(e){super(),Le(this,e,r$,o$,Pe,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function sd(n){let e,t,i,s;function l(r){n[26](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new n$({props:o}),he.push(()=>Re(t,"collection",l)),{c(){e=_("div"),B(t.$$.fragment),h(e,"class","tab-item active")},m(r,a){w(r,e,a),V(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],He(()=>i=!1)),t.$set(u)},i(r){s||(A(t.$$.fragment,r),s=!0)},o(r){P(t.$$.fragment,r),s=!1},d(r){r&&k(e),z(t)}}}function u$(n){let e,t,i,s,l,o;function r(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new U3({props:a}),he.push(()=>Re(i,"collection",r));let u=n[9]===_l&&sd(n);return{c(){e=_("div"),t=_("div"),B(i.$$.fragment),l=T(),u&&u.c(),h(t,"class","tab-item"),ee(t,"active",n[9]===ss),h(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),o=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],He(()=>s=!1)),i.$set(d),c[0]&512&&ee(t,"active",f[9]===ss),f[9]===_l?u?(u.p(f,c),c[0]&512&&A(u,1)):(u=sd(f),u.c(),A(u,1),u.m(e,null)):u&&(De(),P(u,1,1,()=>{u=null}),Oe())},i(f){o||(A(i.$$.fragment,f),A(u),o=!0)},o(f){P(i.$$.fragment,f),P(u),o=!1},d(f){f&&k(e),z(i),u&&u.d()}}}function ld(n){let e,t,i,s,l,o,r;return o=new qi({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[f$]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=T(),i=_("button"),s=_("i"),l=T(),B(o.$$.fragment),h(e,"class","flex-fill"),h(s,"class","ri-more-line"),h(i,"type","button"),h(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(o,i,null),r=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(A(o.$$.fragment,a),r=!0)},o(a){P(o.$$.fragment,a),r=!1},d(a){a&&k(e),a&&k(t),a&&k(i),z(o)}}}function f$(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` + Delete`,h(e,"type","button"),h(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[20]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function od(n){let e;return{c(){e=_("div"),e.textContent="System collection",h(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function c$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p=n[2].system&&od();return{c(){e=_("label"),t=R("Name"),s=T(),l=_("input"),u=T(),p&&p.c(),f=lt(),h(e,"for",i=n[38]),h(l,"type","text"),h(l,"id",o=n[38]),l.required=!0,l.disabled=n[11],h(l,"spellcheck","false"),l.autofocus=r=n[2].isNew,h(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(g,v){w(g,e,v),m(e,t),w(g,s,v),w(g,l,v),w(g,u,v),p&&p.m(g,v),w(g,f,v),n[2].isNew&&l.focus(),c||(d=X(l,"input",n[21]),c=!0)},p(g,v){v[1]&128&&i!==(i=g[38])&&h(e,"for",i),v[1]&128&&o!==(o=g[38])&&h(l,"id",o),v[0]&2048&&(l.disabled=g[11]),v[0]&4&&r!==(r=g[2].isNew)&&(l.autofocus=r),v[0]&4&&a!==(a=g[2].name)&&l.value!==a&&(l.value=a),g[2].system?p||(p=od(),p.c(),p.m(f.parentNode,f)):p&&(p.d(1),p=null)},d(g){g&&k(e),g&&k(s),g&&k(l),g&&k(u),p&&p.d(g),g&&k(f),c=!1,d()}}}function rd(n){let e,t,i,s,l,o;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),s=!0,l||(o=et(t=Et.call(null,e,n[12])),l=!0)},p(r,a){t&&Zn(t.update)&&a[0]&4096&&t.update.call(null,r[12])},i(r){s||(r&&Lt(()=>{i||(i=at(e,Wn,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=at(e,Wn,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&k(e),r&&i&&i.end(),l=!1,o()}}}function ad(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=et(Et.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Lt(()=>{t||(t=at(e,Wn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=at(e,Wn,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function d$(n){var H,j,Q,ie,U,K;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,p,g,v=!Y.isEmpty((H=n[4])==null?void 0:H.schema),b,y,$,C,S=!Y.isEmpty((j=n[4])==null?void 0:j.listRule)||!Y.isEmpty((Q=n[4])==null?void 0:Q.viewRule)||!Y.isEmpty((ie=n[4])==null?void 0:ie.createRule)||!Y.isEmpty((U=n[4])==null?void 0:U.updateRule)||!Y.isEmpty((K=n[4])==null?void 0:K.deleteRule),M,D,E,O=!n[2].isNew&&!n[2].system&&ld(n);r=new Ie({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[c$,({uniqueId:W})=>({38:W}),({uniqueId:W})=>[0,W?128:0]]},$$scope:{ctx:n}}});let F=v&&rd(n),L=S&&ad();return{c(){e=_("h4"),i=R(t),s=T(),O&&O.c(),l=T(),o=_("form"),B(r.$$.fragment),a=T(),u=_("input"),f=T(),c=_("div"),d=_("button"),p=_("span"),p.textContent="Fields",g=T(),F&&F.c(),b=T(),y=_("button"),$=_("span"),$.textContent="API Rules",C=T(),L&&L.c(),h(u,"type","submit"),h(u,"class","hidden"),h(u,"tabindex","-1"),h(o,"class","block"),h(p,"class","txt"),h(d,"type","button"),h(d,"class","tab-item"),ee(d,"active",n[9]===ss),h($,"class","txt"),h(y,"type","button"),h(y,"class","tab-item"),ee(y,"active",n[9]===_l),h(c,"class","tabs-header stretched")},m(W,J){w(W,e,J),m(e,i),w(W,s,J),O&&O.m(W,J),w(W,l,J),w(W,o,J),V(r,o,null),m(o,a),m(o,u),w(W,f,J),w(W,c,J),m(c,d),m(d,p),m(d,g),F&&F.m(d,null),m(c,b),m(c,y),m(y,$),m(y,C),L&&L.m(y,null),M=!0,D||(E=[X(o,"submit",Qt(n[22])),X(d,"click",n[23]),X(y,"click",n[24])],D=!0)},p(W,J){var fe,ke,le,ue,Me,Z;(!M||J[0]&4)&&t!==(t=W[2].isNew?"New collection":"Edit collection")&&me(i,t),!W[2].isNew&&!W[2].system?O?(O.p(W,J),J[0]&4&&A(O,1)):(O=ld(W),O.c(),A(O,1),O.m(l.parentNode,l)):O&&(De(),P(O,1,1,()=>{O=null}),Oe());const se={};J[0]&2048&&(se.class="form-field required m-b-0 "+(W[11]?"disabled":"")),J[0]&2052|J[1]&384&&(se.$$scope={dirty:J,ctx:W}),r.$set(se),J[0]&16&&(v=!Y.isEmpty((fe=W[4])==null?void 0:fe.schema)),v?F?(F.p(W,J),J[0]&16&&A(F,1)):(F=rd(W),F.c(),A(F,1),F.m(d,null)):F&&(De(),P(F,1,1,()=>{F=null}),Oe()),J[0]&512&&ee(d,"active",W[9]===ss),J[0]&16&&(S=!Y.isEmpty((ke=W[4])==null?void 0:ke.listRule)||!Y.isEmpty((le=W[4])==null?void 0:le.viewRule)||!Y.isEmpty((ue=W[4])==null?void 0:ue.createRule)||!Y.isEmpty((Me=W[4])==null?void 0:Me.updateRule)||!Y.isEmpty((Z=W[4])==null?void 0:Z.deleteRule)),S?L?J[0]&16&&A(L,1):(L=ad(),L.c(),A(L,1),L.m(y,null)):L&&(De(),P(L,1,1,()=>{L=null}),Oe()),J[0]&512&&ee(y,"active",W[9]===_l)},i(W){M||(A(O),A(r.$$.fragment,W),A(F),A(L),M=!0)},o(W){P(O),P(r.$$.fragment,W),P(F),P(L),M=!1},d(W){W&&k(e),W&&k(s),O&&O.d(W),W&&k(l),W&&k(o),z(r),W&&k(f),W&&k(c),F&&F.d(),L&&L.d(),D=!1,st(E)}}}function h$(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=R(o),h(t,"class","txt"),h(e,"type","button"),h(e,"class","btn btn-secondary"),e.disabled=n[7],h(l,"class","txt"),h(s,"type","button"),h(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ee(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,r),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&&o!==(o=c[2].isNew?"Create":"Save changes")&&me(r,o),d[0]&1152&&a!==(a=!c[10]||c[7])&&(s.disabled=a),d[0]&128&&ee(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,st(f)}}}function p$(n){let e,t,i,s,l={class:"overlay-panel-lg colored-header compact-header collection-panel",beforeHide:n[27],$$slots:{footer:[h$],header:[d$],default:[u$]},$$scope:{ctx:n}};e=new Ci({props:l}),n[28](e),e.$on("hide",n[29]),e.$on("show",n[30]);let o={};return i=new a$({props:o}),n[31](i),i.$on("confirm",n[32]),{c(){B(e.$$.fragment),t=T(),B(i.$$.fragment)},m(r,a){V(e,r,a),w(r,t,a),V(i,r,a),s=!0},p(r,a){const u={};a[0]&264&&(u.beforeHide=r[27]),a[0]&7828|a[1]&256&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};i.$set(f)},i(r){s||(A(e.$$.fragment,r),A(i.$$.fragment,r),s=!0)},o(r){P(e.$$.fragment,r),P(i.$$.fragment,r),s=!1},d(r){n[28](null),z(e,r),r&&k(t),n[31](null),z(i,r)}}}const ss="fields",_l="api_rules";function $r(n){return JSON.stringify(n)}function m$(n,e,t){let i,s,l,o,r,a;Vt(n,ui,Z=>t(34,r=Z)),Vt(n,rs,Z=>t(4,a=Z));const u=hn();let f,c,d=null,p=new Fn,g=!1,v=!1,b=ss,y=$r(p);function $(Z){t(9,b=Z)}function C(Z){return M(Z),t(8,v=!0),$(ss),f==null?void 0:f.show()}function S(){return f==null?void 0:f.hide()}async function M(Z){Ri({}),typeof Z<"u"?(d=Z,t(2,p=Z==null?void 0:Z.clone())):(d=null,t(2,p=new Fn)),t(2,p.schema=p.schema||[],p),t(2,p.originalName=p.name||"",p),await di(),t(17,y=$r(p))}function D(){if(p.isNew)return E();c==null||c.show(p)}function E(){if(g)return;t(7,g=!0);const Z=O();let be;p.isNew?be=Se.Collections.create(Z):be=Se.Collections.update(p.id,Z),be.then(x=>{t(8,v=!1),S(),_n(p.isNew?"Successfully created collection.":"Successfully updated collection."),jw(x),p.isNew&&wn(ui,r=x,r),u("save",x)}).catch(x=>{Se.errorResponseHandler(x)}).finally(()=>{t(7,g=!1)})}function O(){const Z=p.export();Z.schema=Z.schema.slice(0);for(let be=Z.schema.length-1;be>=0;be--)Z.schema[be].toDelete&&Z.schema.splice(be,1);return Z}function F(){!(d!=null&&d.id)||Si(`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(()=>{S(),_n(`Successfully deleted collection "${d==null?void 0:d.name}".`),u("delete",d),qw(d)}).catch(Z=>{Se.errorResponseHandler(Z)}))}const L=()=>S(),H=()=>D(),j=()=>F(),Q=Z=>{t(2,p.name=Y.slugify(Z.target.value),p),Z.target.value=p.name},ie=()=>{o&&D()},U=()=>$(ss),K=()=>$(_l);function W(Z){p=Z,t(2,p)}function J(Z){p=Z,t(2,p)}const se=()=>l&&v?(Si("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,v=!1),S()}),!1):!0;function fe(Z){he[Z?"unshift":"push"](()=>{f=Z,t(5,f)})}function ke(Z){pt.call(this,n,Z)}function le(Z){pt.call(this,n,Z)}function ue(Z){he[Z?"unshift":"push"](()=>{c=Z,t(6,c)})}const Me=()=>E();return n.$$.update=()=>{n.$$.dirty[0]&16&&t(12,i=typeof Y.getNestedVal(a,"schema.message",null)=="string"?Y.getNestedVal(a,"schema.message"):"Has errors"),n.$$.dirty[0]&4&&t(11,s=!p.isNew&&p.system),n.$$.dirty[0]&131076&&t(3,l=y!=$r(p)),n.$$.dirty[0]&12&&t(10,o=p.isNew||l)},[$,S,p,l,a,f,c,g,v,b,o,s,i,D,E,F,C,y,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me]}class Ua extends Fe{constructor(e){super(),Le(this,e,m$,p$,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 ud(n,e,t){const i=n.slice();return i[13]=e[t],i}function fd(n){let e,t=n[1].length&&cd();return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1].length?t||(t=cd(),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function cd(n){let e;return{c(){e=_("p"),e.textContent="No collections found.",h(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 g$(n){let e;return{c(){e=_("i"),h(e,"class","ri-folder-2-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function _$(n){let e;return{c(){e=_("i"),h(e,"class","ri-folder-open-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function dd(n,e){let t,i,s,l=e[13].name+"",o,r,a,u;function f(g,v){var b;return((b=g[5])==null?void 0:b.id)===g[13].id?_$:g$}let c=f(e),d=c(e);function p(){return e[10](e[13])}return{key:n,first:null,c(){var g;t=_("div"),d.c(),i=T(),s=_("span"),o=R(l),r=T(),h(s,"class","txt"),h(t,"tabindex","0"),h(t,"class","sidebar-list-item"),ee(t,"active",((g=e[5])==null?void 0:g.id)===e[13].id),this.first=t},m(g,v){w(g,t,v),d.m(t,null),m(t,i),m(t,s),m(s,o),m(t,r),a||(u=X(t,"click",p),a=!0)},p(g,v){var b;e=g,c!==(c=f(e))&&(d.d(1),d=c(e),d&&(d.c(),d.m(t,i))),v&8&&l!==(l=e[13].name+"")&&me(o,l),v&40&&ee(t,"active",((b=e[5])==null?void 0:b.id)===e[13].id)},d(g){g&&k(t),d.d(),a=!1,u()}}}function b$(n){let e,t,i,s,l,o,r,a,u,f,c,d=[],p=new Map,g,v,b,y,$,C,S,M,D=n[3];const E=L=>L[13].id;for(let L=0;L',o=T(),r=_("input"),a=T(),u=_("hr"),f=T(),c=_("div");for(let L=0;L + New collection`,y=T(),B($.$$.fragment),h(l,"type","button"),h(l,"class","btn btn-xs btn-secondary btn-circle btn-clear"),ee(l,"hidden",!n[4]),h(s,"class","form-field-addon"),h(r,"type","text"),h(r,"placeholder","Search collections..."),h(i,"class","form-field search"),ee(i,"active",n[4]),h(t,"class","sidebar-header"),h(u,"class","m-t-5 m-b-xs"),h(c,"class","sidebar-content"),h(b,"type","button"),h(b,"class","btn btn-block btn-outline"),h(v,"class","sidebar-footer"),h(e,"class","page-sidebar collection-sidebar")},m(L,H){w(L,e,H),m(e,t),m(t,i),m(i,s),m(s,l),m(i,o),m(i,r),$e(r,n[0]),m(e,a),m(e,u),m(e,f),m(e,c);for(let j=0;jt(5,o=b)),Vt(n,Ms,b=>t(7,r=b));let a,u="";function f(b){wn(ui,o=b,o)}const c=()=>t(0,u="");function d(){u=this.value,t(0,u)}const p=b=>f(b),g=()=>a==null?void 0:a.show();function v(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=r.filter(b=>b.name!="profiles"&&(b.id==u||b.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[u,i,a,l,s,o,f,r,c,d,p,g,v]}class y$ extends Fe{constructor(e){super(),Le(this,e,v$,b$,Pe,{})}}function k$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,C,S,M,D,E,O,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format OPERAND OPERATOR OPERAND, where:`,t=T(),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=T(),o=_("li"),r=_("code"),r.textContent="OPERATOR",a=R(` - is one of: - `),u=_("br"),f=T(),c=_("ul"),d=_("li"),m=_("code"),m.textContent="=",g=T(),v=_("span"),v.textContent="Equal",b=T(),y=_("li"),C=_("code"),C.textContent="!=",$=T(),S=_("span"),S.textContent="NOT equal",M=T(),D=_("li"),E=_("code"),E.textContent=">",O=T(),F=_("span"),F.textContent="Greater than",L=T(),H=_("li"),j=_("code"),j.textContent=">=",Q=T(),ie=_("span"),ie.textContent="Greater than or equal",U=T(),K=_("li"),W=_("code"),W.textContent="<",J=T(),se=_("span"),se.textContent="Less than or equal",fe=T(),ke=_("li"),le=_("code"),le.textContent="<=",ue=T(),Me=_("span"),Me.textContent="Less than or equal",Z=T(),be=_("li"),x=_("code"),x.textContent="~",G=T(),_e=_("span"),_e.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard + `),u=_("br"),f=T(),c=_("ul"),d=_("li"),p=_("code"),p.textContent="=",g=T(),v=_("span"),v.textContent="Equal",b=T(),y=_("li"),$=_("code"),$.textContent="!=",C=T(),S=_("span"),S.textContent="NOT equal",M=T(),D=_("li"),E=_("code"),E.textContent=">",O=T(),F=_("span"),F.textContent="Greater than",L=T(),H=_("li"),j=_("code"),j.textContent=">=",Q=T(),ie=_("span"),ie.textContent="Greater than or equal",U=T(),K=_("li"),W=_("code"),W.textContent="<",J=T(),se=_("span"),se.textContent="Less than or equal",fe=T(),ke=_("li"),le=_("code"),le.textContent="<=",ue=T(),Me=_("span"),Me.textContent="Less than or equal",Z=T(),be=_("li"),x=_("code"),x.textContent="~",G=T(),_e=_("span"),_e.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)`,je=T(),Ne=_("li"),qe=_("code"),qe.textContent="!~",ae=T(),re=_("span"),re.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard match)`,ve=T(),Je=_("p"),Je.innerHTML=`To group and combine several expressions you could use brackets - (...), && (AND) and || (OR) tokens.`,h(r,"class","txt-danger"),h(m,"class","filter-op svelte-1w7s5nw"),h(v,"class","txt-hint"),h(C,"class","filter-op svelte-1w7s5nw"),h(S,"class","txt-hint"),h(E,"class","filter-op svelte-1w7s5nw"),h(F,"class","txt-hint"),h(j,"class","filter-op svelte-1w7s5nw"),h(ie,"class","txt-hint"),h(W,"class","filter-op svelte-1w7s5nw"),h(se,"class","txt-hint"),h(le,"class","filter-op svelte-1w7s5nw"),h(Me,"class","txt-hint"),h(x,"class","filter-op svelte-1w7s5nw"),h(_e,"class","txt-hint"),h(qe,"class","filter-op svelte-1w7s5nw"),h(re,"class","txt-hint")},m(nt,ut){w(nt,e,ut),w(nt,t,ut),w(nt,i,ut),p(i,s),p(i,l),p(i,o),p(o,r),p(o,a),p(o,u),p(o,f),p(o,c),p(c,d),p(d,m),p(d,g),p(d,v),p(c,b),p(c,y),p(y,C),p(y,$),p(y,S),p(c,M),p(c,D),p(D,E),p(D,O),p(D,F),p(c,L),p(c,H),p(H,j),p(H,Q),p(H,ie),p(c,U),p(c,K),p(K,W),p(K,J),p(K,se),p(c,fe),p(c,ke),p(ke,le),p(ke,ue),p(ke,Me),p(c,Z),p(c,be),p(be,x),p(be,G),p(be,_e),p(c,je),p(c,Ne),p(Ne,qe),p(Ne,ae),p(Ne,re),w(nt,ve,ut),w(nt,Je,ut)},p:oe,i:oe,o:oe,d(nt){nt&&k(e),nt&&k(t),nt&&k(i),nt&&k(ve),nt&&k(Je)}}}class y$ extends Fe{constructor(e){super(),Le(this,e,null,v$,Pe,{})}}function dd(n,e,t){const i=n.slice();return i[8]=e[t],i}function hd(n,e,t){const i=n.slice();return i[8]=e[t],i}function pd(n,e,t){const i=n.slice();return i[13]=e[t],i}function md(n,e,t){const i=n.slice();return i[13]=e[t],i}function gd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function _d(n,e){let t,i=e[13].lang+"",s,l,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function bd(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function vd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("div"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function yd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function k$(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,m,g,v,b,y=n[0].name+"",C,$,S,M,D,E,O,F=[],L=new Map,H,j,Q=[],ie=new Map,U,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Nt,Ft,Ct,Yt,Ge,Mt,ct,Rt,Ht,Tt,ht,Ut,it,N,I,q,ne,Te,Ae,Qe,Ue,xe,ze,Ye=[],gt=new Map,de,we,Ze=[],In=new Map,Gn,ce=n[1]&&gd(),Ee=n[4];const rt=Ce=>Ce[13].lang;for(let Ce=0;CeCe[13].lang;for(let Ce=0;Ce(...), && (AND) and || (OR) tokens.`,h(r,"class","txt-danger"),h(p,"class","filter-op svelte-1w7s5nw"),h(v,"class","txt-hint"),h($,"class","filter-op svelte-1w7s5nw"),h(S,"class","txt-hint"),h(E,"class","filter-op svelte-1w7s5nw"),h(F,"class","txt-hint"),h(j,"class","filter-op svelte-1w7s5nw"),h(ie,"class","txt-hint"),h(W,"class","filter-op svelte-1w7s5nw"),h(se,"class","txt-hint"),h(le,"class","filter-op svelte-1w7s5nw"),h(Me,"class","txt-hint"),h(x,"class","filter-op svelte-1w7s5nw"),h(_e,"class","txt-hint"),h(qe,"class","filter-op svelte-1w7s5nw"),h(re,"class","txt-hint")},m(nt,ut){w(nt,e,ut),w(nt,t,ut),w(nt,i,ut),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(c,d),m(d,p),m(d,g),m(d,v),m(c,b),m(c,y),m(y,$),m(y,C),m(y,S),m(c,M),m(c,D),m(D,E),m(D,O),m(D,F),m(c,L),m(c,H),m(H,j),m(H,Q),m(H,ie),m(c,U),m(c,K),m(K,W),m(K,J),m(K,se),m(c,fe),m(c,ke),m(ke,le),m(ke,ue),m(ke,Me),m(c,Z),m(c,be),m(be,x),m(be,G),m(be,_e),m(c,je),m(c,Ne),m(Ne,qe),m(Ne,ae),m(Ne,re),w(nt,ve,ut),w(nt,Je,ut)},p:oe,i:oe,o:oe,d(nt){nt&&k(e),nt&&k(t),nt&&k(i),nt&&k(ve),nt&&k(Je)}}}class w$ extends Fe{constructor(e){super(),Le(this,e,null,k$,Pe,{})}}function hd(n,e,t){const i=n.slice();return i[8]=e[t],i}function pd(n,e,t){const i=n.slice();return i[8]=e[t],i}function md(n,e,t){const i=n.slice();return i[13]=e[t],i}function gd(n,e,t){const i=n.slice();return i[13]=e[t],i}function _d(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function bd(n,e){let t,i=e[13].lang+"",s,l,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function vd(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function yd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("div"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function kd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function S$(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y=n[0].name+"",$,C,S,M,D,E,O,F=[],L=new Map,H,j,Q=[],ie=new Map,U,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Rt,Ft,Ct,Yt,Ge,Mt,ct,Ht,jt,Tt,ht,Ut,it,N,I,q,ne,Te,Ae,Qe,Ue,xe,ze,Ye=[],gt=new Map,de,we,Ze=[],In=new Map,Gn,ce=n[1]&&_d(),Ee=n[4];const rt=Ce=>Ce[13].lang;for(let Ce=0;CeCe[13].lang;for(let Ce=0;Ce'2022-01-01') - `}}),$t=new y$({}),Ht=new ln({props:{content:` + `}}),$t=new w$({}),jt=new ln({props:{content:` ?expand=rel1,rel2.subrel21.subrel22 - `}});let cs=n[5];const Al=Ce=>Ce[8].code;for(let Ce=0;CeCe[8].code;for(let Ce=0;CeParam + `}});let cs=n[5];const Al=Ce=>Ce[8].code;for(let Ce=0;CeCe[8].code;for(let Ce=0;CeParam Type Description`,fe=T(),ke=_("tbody"),le=_("tr"),le.innerHTML=`page Number @@ -98,12 +98,12 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo Add `),ve=_("code"),ve.textContent="-",Je=R(" / "),nt=_("code"),nt.textContent="+",ut=R(` (default) in front of the attribute for DESC / ASC order. Ex.: `),B(ot.$$.fragment),Xe=T(),ge=_("tr"),pe=_("td"),pe.textContent="filter",Ve=T(),mt=_("td"),mt.innerHTML='String',te=T(),ye=_("td"),Ke=R(`Filter the returned records. Ex.: - `),B(ft.$$.fragment),St=T(),B($t.$$.fragment),Nt=T(),Ft=_("tr"),Ct=_("td"),Ct.textContent="expand",Yt=T(),Ge=_("td"),Ge.innerHTML='String',Mt=T(),ct=_("td"),Rt=R(`Auto expand record relations. Ex.: - `),B(Ht.$$.fragment),Tt=R(` + `),B(ft.$$.fragment),St=T(),B($t.$$.fragment),Rt=T(),Ft=_("tr"),Ct=_("td"),Ct.textContent="expand",Yt=T(),Ge=_("td"),Ge.innerHTML='String',Mt=T(),ct=_("td"),Ht=R(`Auto expand record relations. Ex.: + `),B(jt.$$.fragment),Tt=R(` Supports up to 6-levels depth nested relations expansion. `),ht=_("br"),Ut=R(` The expanded relations will be appended to each individual record under the `),it=_("code"),it.textContent="@expand",N=R(" property (eg. "),I=_("code"),I.textContent='"@expand": {"rel1": {...}, ...}',q=R(`). Only the - relations that the user has permissions to `),ne=_("strong"),ne.textContent="view",Te=R(" will be expanded."),Ae=T(),Qe=_("div"),Qe.textContent="Responses",Ue=T(),xe=_("div"),ze=_("div");for(let Ce=0;Cet(3,o=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&&(r.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[Y.dummyCollectionRecord(s),Y.dummyCollectionRecord(s)]},null,2)}),r.push({code:400,body:` + relations that the user has permissions to `),ne=_("strong"),ne.textContent="view",Te=R(" will be expanded."),Ae=T(),Qe=_("div"),Qe.textContent="Responses",Ue=T(),xe=_("div"),ze=_("div");for(let Ce=0;Cet(3,o=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&&(r.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[Y.dummyCollectionRecord(s),Y.dummyCollectionRecord(s)]},null,2)}),r.push({code:400,body:` { "code": 400, "message": "Something went wrong while processing your request. Invalid filter.", @@ -137,9 +137,9 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo const records = await client.Records.getFullList("${s==null?void 0:s.name}", 200 /* batch size */, { sort: "-created", }); - `}])},[s,i,l,o,a,r,u,f]}class S$ extends Fe{constructor(e){super(),Le(this,e,w$,k$,Pe,{collection:0})}}function kd(n,e,t){const i=n.slice();return i[8]=e[t],i}function wd(n,e,t){const i=n.slice();return i[8]=e[t],i}function Sd(n,e,t){const i=n.slice();return i[13]=e[t],i}function $d(n,e,t){const i=n.slice();return i[13]=e[t],i}function Cd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Md(n,e){let t,i=e[13].lang+"",s,l,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function Td(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function Dd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function Od(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function $$(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,m,g,v,b,y,C=n[0].name+"",$,S,M,D,E,O,F,L=[],H=new Map,j,Q,ie=[],U=new Map,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St=[],$t=new Map,Nt,Ft,Ct=[],Yt=new Map,Ge,Mt=n[1]&&Cd(),ct=n[4];const Rt=I=>I[13].lang;for(let I=0;II[13].lang;for(let I=0;IAuthorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Td(n,e){let t,i=e[13].lang+"",s,l,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function Dd(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function Od(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function Ed(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function M$(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",C,S,M,D,E,O,F,L=[],H=new Map,j,Q,ie=[],U=new Map,K,W,J,se,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St=[],$t=new Map,Rt,Ft,Ct=[],Yt=new Map,Ge,Mt=n[1]&&Md(),ct=n[4];const Ht=I=>I[13].lang;for(let I=0;II[13].lang;for(let I=0;II[8].code;for(let I=0;II[8].code;for(let I=0;IParam + `}});let ht=n[5];const Ut=I=>I[8].code;for(let I=0;II[8].code;for(let I=0;IParam Type Description id @@ -151,7 +151,7 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo Supports up to 6-levels depth nested relations expansion. `),Je=_("br"),nt=R(` The expanded relations will be appended to the record under the `),ut=_("code"),ut.textContent="@expand",ot=R(" property (eg. "),Xe=_("code"),Xe.textContent='"@expand": {"rel1": {...}, ...}',ge=R(`). Only the - relations that the user has permissions to `),pe=_("strong"),pe.textContent="view",Ve=R(" will be expanded."),mt=T(),te=_("div"),te.textContent="Responses",ye=T(),Ke=_("div"),ft=_("div");for(let I=0;It(3,o=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&&(r.push({code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)}),i&&r.push({code:403,body:` + relations that the user has permissions to `),pe=_("strong"),pe.textContent="view",Ve=R(" will be expanded."),mt=T(),te=_("div"),te.textContent="Responses",ye=T(),Ke=_("div"),ft=_("div");for(let I=0;It(3,o=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&&(r.push({code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)}),i&&r.push({code:403,body:` { "code": 403, "message": "Only admins can access this action.", @@ -173,10 +173,10 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo const record = await client.Records.getOne("${s==null?void 0:s.name}", "RECORD_ID", { expand: "some_relation" }); - `}])},[s,i,l,o,a,r,u,f]}class M$ extends Fe{constructor(e){super(),Le(this,e,C$,$$,Pe,{collection:0})}}function Ed(n,e,t){const i=n.slice();return i[8]=e[t],i}function Ad(n,e,t){const i=n.slice();return i[8]=e[t],i}function Pd(n,e,t){const i=n.slice();return i[13]=e[t],i}function Ld(n,e,t){const i=n.slice();return i[16]=e[t],i}function Fd(n,e,t){const i=n.slice();return i[16]=e[t],i}function Id(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Nd(n,e){let t,i=e[16].lang+"",s,l,o,r;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&me(s,i),f&20&&ee(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),o=!1,r()}}}function Rd(n,e){let t,i,s,l;return i=new ln({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[16].code),i.$set(a),r&20&&ee(t,"active",e[2]===e[16].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function T$(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function D$(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function O$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("User "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function E$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("Relation record "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function A$(n){let e,t,i,s,l;return{c(){e=R("FormData object."),t=_("br"),i=R(` - Set to `),s=_("code"),s.textContent="null",l=R(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function P$(n){let e;return{c(){e=R("URL address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function L$(n){let e;return{c(){e=R("Email address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function F$(n){let e;return{c(){e=R("JSON array or object.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function I$(n){let e;return{c(){e=R("Number value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function N$(n){let e;return{c(){e=R("Plain text value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Hd(n,e){let t,i,s,l,o,r=e[13].name+"",a,u,f,c,d=Y.getFieldValueType(e[13])+"",m,g,v,b;function y(E,O){return E[13].required?D$:T$}let C=y(e),$=C(e);function S(E,O){if(E[13].type==="text")return N$;if(E[13].type==="number")return I$;if(E[13].type==="json")return F$;if(E[13].type==="email")return L$;if(E[13].type==="url")return P$;if(E[13].type==="file")return A$;if(E[13].type==="relation")return E$;if(E[13].type==="user")return O$}let M=S(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),$.c(),l=T(),o=_("span"),a=R(r),u=T(),f=_("td"),c=_("span"),m=R(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(E,O){w(E,t,O),p(t,i),p(i,s),$.m(s,null),p(s,l),p(s,o),p(o,a),p(t,u),p(t,f),p(f,c),p(c,m),p(t,g),p(t,v),D&&D.m(v,null),p(t,b)},p(E,O){e=E,C!==(C=y(e))&&($.d(1),$=C(e),$&&($.c(),$.m(s,l))),O&1&&r!==(r=e[13].name+"")&&me(a,r),O&1&&d!==(d=Y.getFieldValueType(e[13])+"")&&me(m,d),M===(M=S(e))&&D?D.p(e,O):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(E){E&&k(t),$.d(),D&&D.d()}}}function jd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&me(s,i),f&10&&ee(t,"active",e[1]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function qd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&8&&(a.content=e[8].body),i.$set(a),r&10&&ee(t,"active",e[1]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function R$(n){var gt;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,m,g,v,b,y=n[0].name+"",C,$,S,M,D,E,O,F,L,H,j,Q=[],ie=new Map,U,K,W=[],J=new Map,se,fe,ke,le,ue,Me,Z,be=[],x=new Map,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Nt,Ft,Ct,Yt,Ge,Mt,ct=[],Rt=new Map,Ht,Tt,ht=[],Ut=new Map,it,N=n[5]&&Id(),I=n[4];const q=de=>de[16].lang;for(let de=0;dede[16].lang;for(let de=0;dede[13].name;for(let de=0;deAuthorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Rd(n,e){let t,i=e[16].lang+"",s,l,o,r;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&me(s,i),f&20&&ee(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),o=!1,r()}}}function Hd(n,e){let t,i,s,l;return i=new ln({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[16].code),i.$set(a),r&20&&ee(t,"active",e[2]===e[16].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function O$(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function E$(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function A$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("User "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function P$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("Relation record "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function L$(n){let e,t,i,s,l;return{c(){e=R("FormData object."),t=_("br"),i=R(` + Set to `),s=_("code"),s.textContent="null",l=R(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function F$(n){let e;return{c(){e=R("URL address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function I$(n){let e;return{c(){e=R("Email address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function N$(n){let e;return{c(){e=R("JSON array or object.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function R$(n){let e;return{c(){e=R("Number value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function H$(n){let e;return{c(){e=R("Plain text value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function jd(n,e){let t,i,s,l,o,r=e[13].name+"",a,u,f,c,d=Y.getFieldValueType(e[13])+"",p,g,v,b;function y(E,O){return E[13].required?E$:O$}let $=y(e),C=$(e);function S(E,O){if(E[13].type==="text")return H$;if(E[13].type==="number")return R$;if(E[13].type==="json")return N$;if(E[13].type==="email")return I$;if(E[13].type==="url")return F$;if(E[13].type==="file")return L$;if(E[13].type==="relation")return P$;if(E[13].type==="user")return A$}let M=S(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=R(r),u=T(),f=_("td"),c=_("span"),p=R(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(E,O){w(E,t,O),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,p),m(t,g),m(t,v),D&&D.m(v,null),m(t,b)},p(E,O){e=E,$!==($=y(e))&&(C.d(1),C=$(e),C&&(C.c(),C.m(s,l))),O&1&&r!==(r=e[13].name+"")&&me(a,r),O&1&&d!==(d=Y.getFieldValueType(e[13])+"")&&me(p,d),M===(M=S(e))&&D?D.p(e,O):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(E){E&&k(t),C.d(),D&&D.d()}}}function qd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&me(s,i),f&10&&ee(t,"active",e[1]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function Vd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&8&&(a.content=e[8].body),i.$set(a),r&10&&ee(t,"active",e[1]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function j$(n){var gt;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y=n[0].name+"",$,C,S,M,D,E,O,F,L,H,j,Q=[],ie=new Map,U,K,W=[],J=new Map,se,fe,ke,le,ue,Me,Z,be=[],x=new Map,G,_e,je,Ne,qe,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Rt,Ft,Ct,Yt,Ge,Mt,ct=[],Ht=new Map,jt,Tt,ht=[],Ut=new Map,it,N=n[5]&&Nd(),I=n[4];const q=de=>de[16].lang;for(let de=0;dede[16].lang;for(let de=0;dede[13].name;for(let de=0;dede[8].code;for(let de=0;dede[8].code;for(let de=0;deapplication/json or + `}});let Ue=n[3];const xe=de=>de[8].code;for(let de=0;dede[8].code;for(let de=0;deapplication/json or multipart/form-data.`,D=T(),E=_("p"),E.innerHTML="File upload is supported only via multipart/form-data.",O=T(),F=_("div"),F.textContent="Client SDKs example",L=T(),H=_("div"),j=_("div");for(let de=0;deParam Type Description`,Me=T(),Z=_("tbody");for(let de=0;deParam @@ -186,7 +186,7 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo Supports up to 6-levels depth nested relations expansion. `),mt=_("br"),te=R(` The expanded relations will be appended to the record under the `),ye=_("code"),ye.textContent="@expand",Ke=R(" property (eg. "),ft=_("code"),ft.textContent='"@expand": {"rel1": {...}, ...}',St=R(`). Only the - relations that the user has permissions to `),$t=_("strong"),$t.textContent="view",Nt=R(" will be expanded."),Ft=T(),Ct=_("div"),Ct.textContent="Responses",Yt=T(),Ge=_("div"),Mt=_("div");for(let de=0;det(2,o=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,r=[{code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)},{code:400,body:` + relations that the user has permissions to `),$t=_("strong"),$t.textContent="view",Rt=R(" will be expanded."),Ft=T(),Ct=_("div"),Ct.textContent="Responses",Yt=T(),Ge=_("div"),Mt=_("div");for(let de=0;det(2,o=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,r=[{code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)},{code:400,body:` { "code": 400, "message": "Failed to create record.", @@ -213,10 +213,10 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo const data = { ... }; const record = await client.Records.create("${s==null?void 0:s.name}", data); - `}])},[s,l,o,r,a,i,u,f]}class j$ extends Fe{constructor(e){super(),Le(this,e,H$,R$,Pe,{collection:0})}}function Vd(n,e,t){const i=n.slice();return i[8]=e[t],i}function zd(n,e,t){const i=n.slice();return i[8]=e[t],i}function Bd(n,e,t){const i=n.slice();return i[13]=e[t],i}function Ud(n,e,t){const i=n.slice();return i[16]=e[t],i}function Wd(n,e,t){const i=n.slice();return i[16]=e[t],i}function Yd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Kd(n,e){let t,i=e[16].lang+"",s,l,o,r;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&me(s,i),f&20&&ee(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),o=!1,r()}}}function Zd(n,e){let t,i,s,l;return i=new ln({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[16].code),i.$set(a),r&20&&ee(t,"active",e[2]===e[16].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function q$(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function V$(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function z$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("User "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function B$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("Relation record "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function U$(n){let e,t,i,s,l;return{c(){e=R("FormData object."),t=_("br"),i=R(` - Set to `),s=_("code"),s.textContent="null",l=R(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function W$(n){let e;return{c(){e=R("URL address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Y$(n){let e;return{c(){e=R("Email address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function K$(n){let e;return{c(){e=R("JSON array or object.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Z$(n){let e;return{c(){e=R("Number value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function J$(n){let e;return{c(){e=R("Plain text value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Jd(n,e){let t,i,s,l,o,r=e[13].name+"",a,u,f,c,d=Y.getFieldValueType(e[13])+"",m,g,v,b;function y(E,O){return E[13].required?V$:q$}let C=y(e),$=C(e);function S(E,O){if(E[13].type==="text")return J$;if(E[13].type==="number")return Z$;if(E[13].type==="json")return K$;if(E[13].type==="email")return Y$;if(E[13].type==="url")return W$;if(E[13].type==="file")return U$;if(E[13].type==="relation")return B$;if(E[13].type==="user")return z$}let M=S(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),$.c(),l=T(),o=_("span"),a=R(r),u=T(),f=_("td"),c=_("span"),m=R(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(E,O){w(E,t,O),p(t,i),p(i,s),$.m(s,null),p(s,l),p(s,o),p(o,a),p(t,u),p(t,f),p(f,c),p(c,m),p(t,g),p(t,v),D&&D.m(v,null),p(t,b)},p(E,O){e=E,C!==(C=y(e))&&($.d(1),$=C(e),$&&($.c(),$.m(s,l))),O&1&&r!==(r=e[13].name+"")&&me(a,r),O&1&&d!==(d=Y.getFieldValueType(e[13])+"")&&me(m,d),M===(M=S(e))&&D?D.p(e,O):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(E){E&&k(t),$.d(),D&&D.d()}}}function Gd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&me(s,i),f&10&&ee(t,"active",e[1]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function Xd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&8&&(a.content=e[8].body),i.$set(a),r&10&&ee(t,"active",e[1]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function G$(n){var Gn;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,m,g,v,b,y,C=n[0].name+"",$,S,M,D,E,O,F,L,H,j,Q,ie=[],U=new Map,K,W,J=[],se=new Map,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne=[],qe=new Map,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Nt,Ft,Ct,Yt,Ge,Mt,ct,Rt,Ht,Tt,ht,Ut=[],it=new Map,N,I,q=[],ne=new Map,Te,Ae=n[5]&&Yd(),Qe=n[4];const Ue=ce=>ce[16].lang;for(let ce=0;cece[16].lang;for(let ce=0;cece[13].name;for(let ce=0;ceAuthorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Zd(n,e){let t,i=e[16].lang+"",s,l,o,r;function a(){return e[6](e[16])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[16].lang+"")&&me(s,i),f&20&&ee(t,"active",e[2]===e[16].lang)},d(u){u&&k(t),o=!1,r()}}}function Jd(n,e){let t,i,s,l;return i=new ln({props:{content:e[16].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[16].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[16].code),i.$set(a),r&20&&ee(t,"active",e[2]===e[16].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function z$(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function B$(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function U$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("User "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function W$(n){var l;let e,t=((l=n[13].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=R("Relation record "),i=R(t),s=R(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[13].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&me(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function Y$(n){let e,t,i,s,l;return{c(){e=R("FormData object."),t=_("br"),i=R(` + Set to `),s=_("code"),s.textContent="null",l=R(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:oe,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function K$(n){let e;return{c(){e=R("URL address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Z$(n){let e;return{c(){e=R("Email address.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function J$(n){let e;return{c(){e=R("JSON array or object.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function G$(n){let e;return{c(){e=R("Number value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function X$(n){let e;return{c(){e=R("Plain text value.")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Gd(n,e){let t,i,s,l,o,r=e[13].name+"",a,u,f,c,d=Y.getFieldValueType(e[13])+"",p,g,v,b;function y(E,O){return E[13].required?B$:z$}let $=y(e),C=$(e);function S(E,O){if(E[13].type==="text")return X$;if(E[13].type==="number")return G$;if(E[13].type==="json")return J$;if(E[13].type==="email")return Z$;if(E[13].type==="url")return K$;if(E[13].type==="file")return Y$;if(E[13].type==="relation")return W$;if(E[13].type==="user")return U$}let M=S(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=R(r),u=T(),f=_("td"),c=_("span"),p=R(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(E,O){w(E,t,O),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,p),m(t,g),m(t,v),D&&D.m(v,null),m(t,b)},p(E,O){e=E,$!==($=y(e))&&(C.d(1),C=$(e),C&&(C.c(),C.m(s,l))),O&1&&r!==(r=e[13].name+"")&&me(a,r),O&1&&d!==(d=Y.getFieldValueType(e[13])+"")&&me(p,d),M===(M=S(e))&&D?D.p(e,O):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(E){E&&k(t),C.d(),D&&D.d()}}}function Xd(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&8&&i!==(i=e[8].code+"")&&me(s,i),f&10&&ee(t,"active",e[1]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function Qd(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&8&&(a.content=e[8].body),i.$set(a),r&10&&ee(t,"active",e[1]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function Q$(n){var Gn;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",C,S,M,D,E,O,F,L,H,j,Q,ie=[],U=new Map,K,W,J=[],se=new Map,fe,ke,le,ue,Me,Z,be,x,G,_e,je,Ne=[],qe=new Map,ae,re,ve,Je,nt,ut,ot,Xe,ge,pe,Ve,mt,te,ye,Ke,ft,St,$t,Rt,Ft,Ct,Yt,Ge,Mt,ct,Ht,jt,Tt,ht,Ut=[],it=new Map,N,I,q=[],ne=new Map,Te,Ae=n[5]&&Kd(),Qe=n[4];const Ue=ce=>ce[16].lang;for(let ce=0;cece[16].lang;for(let ce=0;cece[13].name;for(let ce=0;cece[8].code;for(let ce=0;cece[8].code;for(let ce=0;ceapplication/json or + `}});let de=n[3];const we=ce=>ce[8].code;for(let ce=0;cece[8].code;for(let ce=0;ceapplication/json or multipart/form-data.`,E=T(),O=_("p"),O.innerHTML="File upload is supported only via multipart/form-data.",F=T(),L=_("div"),L.textContent="Client SDKs example",H=T(),j=_("div"),Q=_("div");for(let ce=0;ceParam Type Description @@ -230,8 +230,8 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo `),B(Ke.$$.fragment),ft=R(` Supports up to 6-levels depth nested relations expansion. `),St=_("br"),$t=R(` The expanded relations will be appended to the record under the - `),Nt=_("code"),Nt.textContent="@expand",Ft=R(" property (eg. "),Ct=_("code"),Ct.textContent='"@expand": {"rel1": {...}, ...}',Yt=R(`). Only the - relations that the user has permissions to `),Ge=_("strong"),Ge.textContent="view",Mt=R(" will be expanded."),ct=T(),Rt=_("div"),Rt.textContent="Responses",Ht=T(),Tt=_("div"),ht=_("div");for(let ce=0;cet(2,o=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,r=[{code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)},{code:400,body:` + `),Rt=_("code"),Rt.textContent="@expand",Ft=R(" property (eg. "),Ct=_("code"),Ct.textContent='"@expand": {"rel1": {...}, ...}',Yt=R(`). Only the + relations that the user has permissions to `),Ge=_("strong"),Ge.textContent="view",Mt=R(" will be expanded."),ct=T(),Ht=_("div"),Ht.textContent="Responses",jt=T(),Tt=_("div"),ht=_("div");for(let ce=0;cet(2,o=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,r=[{code:200,body:JSON.stringify(Y.dummyCollectionRecord(s),null,2)},{code:400,body:` { "code": 400, "message": "Failed to update record.", @@ -264,12 +264,12 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo const data = { ... }; const record = await client.Records.update("${s==null?void 0:s.name}", "RECORD_ID", data); - `}])},[s,l,o,r,a,i,u,f]}class Q$ extends Fe{constructor(e){super(),Le(this,e,X$,G$,Pe,{collection:0})}}function Qd(n,e,t){const i=n.slice();return i[8]=e[t],i}function xd(n,e,t){const i=n.slice();return i[8]=e[t],i}function eh(n,e,t){const i=n.slice();return i[13]=e[t],i}function th(n,e,t){const i=n.slice();return i[13]=e[t],i}function nh(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ih(n,e){let t,i=e[13].lang+"",s,l,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function sh(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function lh(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function oh(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function x$(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,m,g,v,b,y,C=n[0].name+"",$,S,M,D,E,O,F,L=[],H=new Map,j,Q,ie=[],U=new Map,K,W,J,se,fe,ke,le,ue,Me,Z=[],be=new Map,x,G,_e=[],je=new Map,Ne,qe=n[1]&&nh(),ae=n[4];const re=ge=>ge[13].lang;for(let ge=0;gege[13].lang;for(let ge=0;gege[8].code;for(let ge=0;gege[8].code;for(let ge=0;geParam + `}])},[s,l,o,r,a,i,u,f]}class eC extends Fe{constructor(e){super(),Le(this,e,x$,Q$,Pe,{collection:0})}}function xd(n,e,t){const i=n.slice();return i[8]=e[t],i}function eh(n,e,t){const i=n.slice();return i[8]=e[t],i}function th(n,e,t){const i=n.slice();return i[13]=e[t],i}function nh(n,e,t){const i=n.slice();return i[13]=e[t],i}function ih(n){let e;return{c(){e=_("p"),e.innerHTML="Requires Authorization: Admin TOKEN header",h(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,o,r;function a(){return e[6](e[13])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&16&&i!==(i=e[13].lang+"")&&me(s,i),f&24&&ee(t,"active",e[3]===e[13].lang)},d(u){u&&k(t),o=!1,r()}}}function lh(n,e){let t,i,s,l;return i=new ln({props:{content:e[13].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[3]===e[13].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&16&&(a.content=e[13].code),i.$set(a),r&24&&ee(t,"active",e[3]===e[13].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function oh(n,e){let t,i=e[8].code+"",s,l,o,r;function a(){return e[7](e[8])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&36&&ee(t,"active",e[2]===e[8].code)},d(u){u&&k(t),o=!1,r()}}}function rh(n,e){let t,i,s,l;return i=new ln({props:{content:e[8].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[2]===e[8].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&36&&ee(t,"active",e[2]===e[8].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function tC(n){let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",C,S,M,D,E,O,F,L=[],H=new Map,j,Q,ie=[],U=new Map,K,W,J,se,fe,ke,le,ue,Me,Z=[],be=new Map,x,G,_e=[],je=new Map,Ne,qe=n[1]&&ih(),ae=n[4];const re=ge=>ge[13].lang;for(let ge=0;gege[13].lang;for(let ge=0;gege[8].code;for(let ge=0;gege[8].code;for(let ge=0;geParam Type Description id String - ID of the record to delete.`,fe=T(),ke=_("div"),ke.textContent="Responses",le=T(),ue=_("div"),Me=_("div");for(let ge=0;get(3,o=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&&(r.push({code:204,body:` + ID of the record to delete.`,fe=T(),ke=_("div"),ke.textContent="Responses",le=T(),ue=_("div"),Me=_("div");for(let ge=0;get(3,o=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&&(r.push({code:204,body:` null `}),r.push({code:400,body:` { @@ -297,7 +297,7 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo ... await client.Records.delete("${s==null?void 0:s.name}", "RECORD_ID"); - `}])},[s,i,l,o,a,r,u,f]}class tC extends Fe{constructor(e){super(),Le(this,e,eC,x$,Pe,{collection:0})}}function rh(n,e,t){const i=n.slice();return i[4]=e[t],i}function ah(n,e,t){const i=n.slice();return i[4]=e[t],i}function uh(n,e){let t,i=e[4].lang+"",s,l,o,r;function a(){return e[3](e[4])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[4].lang),this.first=t},m(u,f){w(u,t,f),p(t,s),p(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[4].lang+"")&&me(s,i),f&6&&ee(t,"active",e[1]===e[4].lang)},d(u){u&&k(t),o=!1,r()}}}function fh(n,e){let t,i,s,l;return i=new ln({props:{content:e[4].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[4].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),p(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[4].code),i.$set(a),r&6&&ee(t,"active",e[1]===e[4].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function nC(n){let e,t,i,s,l,o,r,a,u=[],f=new Map,c,d,m=[],g=new Map,v,b,y,C,$,S=n[2];const M=O=>O[4].lang;for(let O=0;OO[4].lang;for(let O=0;OSSE + `}])},[s,i,l,o,a,r,u,f]}class iC extends Fe{constructor(e){super(),Le(this,e,nC,tC,Pe,{collection:0})}}function ah(n,e,t){const i=n.slice();return i[4]=e[t],i}function uh(n,e,t){const i=n.slice();return i[4]=e[t],i}function fh(n,e){let t,i=e[4].lang+"",s,l,o,r;function a(){return e[3](e[4])}return{key:n,first:null,c(){t=_("button"),s=R(i),l=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[4].lang),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=X(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[4].lang+"")&&me(s,i),f&6&&ee(t,"active",e[1]===e[4].lang)},d(u){u&&k(t),o=!1,r()}}}function ch(n,e){let t,i,s,l;return i=new ln({props:{content:e[4].code}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),ee(t,"active",e[1]===e[4].lang),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[4].code),i.$set(a),r&6&&ee(t,"active",e[1]===e[4].lang)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function sC(n){let e,t,i,s,l,o,r,a,u=[],f=new Map,c,d,p=[],g=new Map,v,b,y,$,C,S=n[2];const M=O=>O[4].lang;for(let O=0;OO[4].lang;for(let O=0;OSSE

/api/realtime

`,t=T(),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).

@@ -308,7 +308,7 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo 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=T(),l=_("div"),l.textContent="Client SDKs example",o=T(),r=_("div"),a=_("div");for(let O=0;Ot(1,s=r.lang);return n.$$set=r=>{"collection"in r&&t(0,i=r.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(2,l=[{lang:"JavaScript",code:` + the event message.

`,s=T(),l=_("div"),l.textContent="Client SDKs example",o=T(),r=_("div"),a=_("div");for(let O=0;Ot(1,s=r.lang);return n.$$set=r=>{"collection"in r&&t(0,i=r.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(2,l=[{lang:"JavaScript",code:` import PocketBase from 'pocketbase'; const client = new PocketBase("${Se.baseUrl}"); @@ -330,53 +330,53 @@ const __=function(){const e=document.createElement("link").relList;if(e&&e.suppo 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,o]}class sC extends Fe{constructor(e){super(),Le(this,e,iC,nC,Pe,{collection:0})}}function ch(n,e,t){const i=n.slice();return i[14]=e[t],i}function dh(n,e,t){const i=n.slice();return i[14]=e[t],i}function hh(n){let e,t,i,s;var l=n[14].component;function o(r){return{props:{collection:r[3]}}}return l&&(t=new l(o(n))),{c(){e=_("div"),t&&B(t.$$.fragment),i=T(),h(e,"class","tab-item active")},m(r,a){w(r,e,a),t&&V(t,e,null),p(e,i),s=!0},p(r,a){const u={};if(a&8&&(u.collection=r[3]),l!==(l=r[14].component)){if(t){De();const f=t;P(f.$$.fragment,1,0,()=>{z(f,1)}),Oe()}l?(t=new l(o(r)),B(t.$$.fragment),A(t.$$.fragment,1),V(t,e,i)):t=null}else l&&t.$set(u)},i(r){s||(t&&A(t.$$.fragment,r),s=!0)},o(r){t&&P(t.$$.fragment,r),s=!1},d(r){r&&k(e),t&&z(t)}}}function ph(n,e){let t,i,s,l=e[4]===e[14].id&&hh(e);return{key:n,first:null,c(){t=lt(),l&&l.c(),i=lt(),this.first=t},m(o,r){w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){e=o,e[4]===e[14].id?l?(l.p(e,r),r&16&&A(l,1)):(l=hh(e),l.c(),A(l,1),l.m(i.parentNode,i)):l&&(De(),P(l,1,1,()=>{l=null}),Oe())},i(o){s||(A(l),s=!0)},o(o){P(l),s=!1},d(o){o&&k(t),l&&l.d(o),o&&k(i)}}}function lC(n){let e,t=[],i=new Map,s,l=n[5];const o=r=>r[14].id;for(let r=0;rd[14].id;for(let d=0;dClose',h(e,"type","button"),h(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[8]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function aC(n){let e,t,i={class:"overlay-panel-xl colored-header collection-panel",$$slots:{footer:[rC],header:[oC],default:[lC]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&524312&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[11](null),z(e,s)}}}function uC(n,e,t){const i=[{id:"list",label:"List",component:S$},{id:"view",label:"View",component:M$},{id:"create",label:"Create",component:j$},{id:"update",label:"Update",component:Q$},{id:"delete",label:"Delete",component:tC},{id:"realtime",label:"Realtime",component:sC}];let s,l=new Fn,o=i[0].id;function r(y){return t(3,l=y),u(i[0].id),s==null?void 0:s.show()}function a(){return s==null?void 0:s.hide()}function u(y){t(4,o=y)}function f(y,C){(y.code==="Enter"||y.code==="Space")&&(y.preventDefault(),u(C))}const c=()=>a(),d=y=>u(y.id),m=(y,C)=>f(C,y.id);function g(y){he[y?"unshift":"push"](()=>{s=y,t(2,s)})}function v(y){pt.call(this,n,y)}function b(y){pt.call(this,n,y)}return[a,u,s,l,o,i,f,r,c,d,m,g,v,b]}class fC extends Fe{constructor(e){super(),Le(this,e,uC,aC,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 cC(n){let e,t,i,s=[n[3]],l={};for(let o=0;o{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight+2,o)+"px",r))},0)}function f(m){if((m==null?void 0:m.code)==="Enter"&&!(m!=null&&m.shiftKey)){m.preventDefault();const g=r.closest("form");g!=null&&g.requestSubmit&&g.requestSubmit()}}Jn(()=>(u(),()=>clearTimeout(a)));function c(m){he[m?"unshift":"push"](()=>{r=m,t(1,r)})}function d(){l=this.value,t(0,l)}return n.$$set=m=>{e=_t(_t({},e),ci(m)),t(3,s=tn(e,i)),"value"in m&&t(0,l=m.value),"maxHeight"in m&&t(4,o=m.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof l!==void 0&&u()},[l,r,f,s,o,c,d]}class hC extends Fe{constructor(e){super(),Le(this,e,dC,cC,Pe,{value:0,maxHeight:4})}}function pC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d;function m(v){n[2](v)}let g={id:n[3],required:n[1].required};return n[0]!==void 0&&(g.value=n[0]),f=new hC({props:g}),he.push(()=>Re(f,"value",m)),{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),B(f.$$.fragment),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[3])},m(v,b){w(v,e,b),p(e,t),p(e,s),p(e,l),p(l,r),w(v,u,b),V(f,v,b),d=!0},p(v,b){(!d||b&2&&i!==(i=Y.getFieldTypeIcon(v[1].type)))&&h(t,"class",i),(!d||b&2)&&o!==(o=v[1].name+"")&&me(r,o),(!d||b&8&&a!==(a=v[3]))&&h(e,"for",a);const y={};b&8&&(y.id=v[3]),b&2&&(y.required=v[1].required),!c&&b&1&&(c=!0,y.value=v[0],He(()=>c=!1)),f.$set(y)},i(v){d||(A(f.$$.fragment,v),d=!0)},o(v){P(f.$$.fragment,v),d=!1},d(v){v&&k(e),v&&k(u),z(f,v)}}}function mC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[pC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function gC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class _C extends Fe{constructor(e){super(),Le(this,e,gC,mC,Pe,{field:1,value:0})}}function bC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g,v,b;return{c(){var y,C;e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),f=_("input"),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[3]),h(f,"type","number"),h(f,"id",c=n[3]),f.required=d=n[1].required,h(f,"min",m=(y=n[1].options)==null?void 0:y.min),h(f,"max",g=(C=n[1].options)==null?void 0:C.max),h(f,"step","any")},m(y,C){w(y,e,C),p(e,t),p(e,s),p(e,l),p(l,r),w(y,u,C),w(y,f,C),$e(f,n[0]),v||(b=X(f,"input",n[2]),v=!0)},p(y,C){var $,S;C&2&&i!==(i=Y.getFieldTypeIcon(y[1].type))&&h(t,"class",i),C&2&&o!==(o=y[1].name+"")&&me(r,o),C&8&&a!==(a=y[3])&&h(e,"for",a),C&8&&c!==(c=y[3])&&h(f,"id",c),C&2&&d!==(d=y[1].required)&&(f.required=d),C&2&&m!==(m=($=y[1].options)==null?void 0:$.min)&&h(f,"min",m),C&2&&g!==(g=(S=y[1].options)==null?void 0:S.max)&&h(f,"max",g),C&1&&It(f.value)!==y[0]&&$e(f,y[0])},d(y){y&&k(e),y&&k(u),y&&k(f),v=!1,b()}}}function vC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[bC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function yC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(){s=It(this.value),t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class kC extends Fe{constructor(e){super(),Le(this,e,yC,vC,Pe,{field:1,value:0})}}function wC(n){let e,t,i,s,l=n[1].name+"",o,r,a,u;return{c(){e=_("input"),i=T(),s=_("label"),o=R(l),h(e,"type","checkbox"),h(e,"id",t=n[3]),h(s,"for",r=n[3])},m(f,c){w(f,e,c),e.checked=n[0],w(f,i,c),w(f,s,c),p(s,o),a||(u=X(e,"change",n[2]),a=!0)},p(f,c){c&8&&t!==(t=f[3])&&h(e,"id",t),c&1&&(e.checked=f[0]),c&2&&l!==(l=f[1].name+"")&&me(o,l),c&8&&r!==(r=f[3])&&h(s,"for",r)},d(f){f&&k(e),f&&k(i),f&&k(s),a=!1,u()}}}function SC(n){let e,t;return e=new Ie({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[wC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function $C(n,e,t){let{field:i=new Sn}=e,{value:s=!1}=e;function l(){s=this.checked,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class CC extends Fe{constructor(e){super(),Le(this,e,$C,SC,Pe,{field:1,value:0})}}function MC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),f=_("input"),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[3]),h(f,"type","email"),h(f,"id",c=n[3]),f.required=d=n[1].required},m(v,b){w(v,e,b),p(e,t),p(e,s),p(e,l),p(l,r),w(v,u,b),w(v,f,b),$e(f,n[0]),m||(g=X(f,"input",n[2]),m=!0)},p(v,b){b&2&&i!==(i=Y.getFieldTypeIcon(v[1].type))&&h(t,"class",i),b&2&&o!==(o=v[1].name+"")&&me(r,o),b&8&&a!==(a=v[3])&&h(e,"for",a),b&8&&c!==(c=v[3])&&h(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&f.value!==v[0]&&$e(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),m=!1,g()}}}function TC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[MC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function DC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class OC extends Fe{constructor(e){super(),Le(this,e,DC,TC,Pe,{field:1,value:0})}}function EC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),f=_("input"),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[3]),h(f,"type","url"),h(f,"id",c=n[3]),f.required=d=n[1].required},m(v,b){w(v,e,b),p(e,t),p(e,s),p(e,l),p(l,r),w(v,u,b),w(v,f,b),$e(f,n[0]),m||(g=X(f,"input",n[2]),m=!0)},p(v,b){b&2&&i!==(i=Y.getFieldTypeIcon(v[1].type))&&h(t,"class",i),b&2&&o!==(o=v[1].name+"")&&me(r,o),b&8&&a!==(a=v[3])&&h(e,"for",a),b&8&&c!==(c=v[3])&&h(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&$e(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),m=!1,g()}}}function AC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[EC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function PC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class LC extends Fe{constructor(e){super(),Le(this,e,PC,AC,Pe,{field:1,value:0})}}function FC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m;function g(b){n[2](b)}let v={id:n[3],options:Y.defaultFlatpickrOptions(),value:n[0]};return n[0]!==void 0&&(v.formattedValue=n[0]),c=new Ba({props:v}),he.push(()=>Re(c,"formattedValue",g)),{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),a=R(" (UTC)"),f=T(),B(c.$$.fragment),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",u=n[3])},m(b,y){w(b,e,y),p(e,t),p(e,s),p(e,l),p(l,r),p(l,a),w(b,f,y),V(c,b,y),m=!0},p(b,y){(!m||y&2&&i!==(i=Y.getFieldTypeIcon(b[1].type)))&&h(t,"class",i),(!m||y&2)&&o!==(o=b[1].name+"")&&me(r,o),(!m||y&8&&u!==(u=b[3]))&&h(e,"for",u);const C={};y&8&&(C.id=b[3]),y&1&&(C.value=b[0]),!d&&y&1&&(d=!0,C.formattedValue=b[0],He(()=>d=!1)),c.$set(C)},i(b){m||(A(c.$$.fragment,b),m=!0)},o(b){P(c.$$.fragment,b),m=!1},d(b){b&&k(e),b&&k(f),z(c,b)}}}function IC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[FC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function NC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class RC extends Fe{constructor(e){super(),Le(this,e,NC,IC,Pe,{field:1,value:0})}}function gh(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=R("Select up to "),s=R(i),l=R(" items."),h(e,"class","help-block")},m(o,r){w(o,e,r),p(e,t),p(e,s),p(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&me(s,i)},d(o){o&&k(e)}}}function HC(n){var C,$,S;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;function v(M){n[3](M)}let b={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],items:(C=n[1].options)==null?void 0:C.values,searchable:(($=n[1].options)==null?void 0:$.values)>5};n[0]!==void 0&&(b.selected=n[0]),f=new f_({props:b}),he.push(()=>Re(f,"selected",v));let y=((S=n[1].options)==null?void 0:S.maxSelect)>1&&gh(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),B(f.$$.fragment),d=T(),y&&y.c(),m=lt(),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[4])},m(M,D){w(M,e,D),p(e,t),p(e,s),p(e,l),p(l,r),w(M,u,D),V(f,M,D),w(M,d,D),y&&y.m(M,D),w(M,m,D),g=!0},p(M,D){var O,F,L;(!g||D&2&&i!==(i=Y.getFieldTypeIcon(M[1].type)))&&h(t,"class",i),(!g||D&2)&&o!==(o=M[1].name+"")&&me(r,o),(!g||D&16&&a!==(a=M[4]))&&h(e,"for",a);const E={};D&16&&(E.id=M[4]),D&6&&(E.toggle=!M[1].required||M[2]),D&4&&(E.multiple=M[2]),D&2&&(E.items=(O=M[1].options)==null?void 0:O.values),D&2&&(E.searchable=((F=M[1].options)==null?void 0:F.values)>5),!c&&D&1&&(c=!0,E.selected=M[0],He(()=>c=!1)),f.$set(E),((L=M[1].options)==null?void 0:L.maxSelect)>1?y?y.p(M,D):(y=gh(M),y.c(),y.m(m.parentNode,m)):y&&(y.d(1),y=null)},i(M){g||(A(f.$$.fragment,M),g=!0)},o(M){P(f.$$.fragment,M),g=!1},d(M){M&&k(e),M&&k(u),z(f,M),M&&k(d),y&&y.d(M),M&&k(m)}}}function jC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[HC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function qC(n,e,t){let i,{field:s=new Sn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof l>"u"&&t(0,l=i?[]:""),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,o]}class VC extends Fe{constructor(e){super(),Le(this,e,qC,jC,Pe,{field:1,value:0})}}function zC(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),f=_("textarea"),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[3]),h(f,"id",c=n[3]),f.required=d=n[1].required,h(f,"class","txt-mono")},m(v,b){w(v,e,b),p(e,t),p(e,s),p(e,l),p(l,r),w(v,u,b),w(v,f,b),$e(f,n[0]),m||(g=X(f,"input",n[2]),m=!0)},p(v,b){b&2&&i!==(i=Y.getFieldTypeIcon(v[1].type))&&h(t,"class",i),b&2&&o!==(o=v[1].name+"")&&me(r,o),b&8&&a!==(a=v[3])&&h(e,"for",a),b&8&&c!==(c=v[3])&&h(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&$e(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),m=!1,g()}}}function BC(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[zC,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function UC(n,e,t){let{field:i=new Sn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&typeof s!="string"&&s!==null&&t(0,s=JSON.stringify(s,null,2))},[s,i,l]}class WC extends Fe{constructor(e){super(),Le(this,e,UC,BC,Pe,{field:1,value:0})}}function YC(n){let e,t;return{c(){e=_("i"),h(e,"class","ri-file-line"),h(e,"alt",t=n[0].name)},m(i,s){w(i,e,s)},p(i,s){s&1&&t!==(t=i[0].name)&&h(e,"alt",t)},d(i){i&&k(e)}}}function KC(n){let e,t,i;return{c(){e=_("img"),ti(e.src,t=n[2])||h(e,"src",t),h(e,"width",n[1]),h(e,"height",n[1]),h(e,"alt",i=n[0].name)},m(s,l){w(s,e,l)},p(s,l){l&4&&!ti(e.src,t=s[2])&&h(e,"src",t),l&2&&h(e,"width",s[1]),l&2&&h(e,"height",s[1]),l&1&&i!==(i=s[0].name)&&h(e,"alt",i)},d(s){s&&k(e)}}}function ZC(n){let e;function t(l,o){return l[2]?KC:YC}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:oe,o:oe,d(l){s.d(l),l&&k(e)}}}function JC(n,e,t){let i,{file:s}=e,{size:l=50}=e;function o(){t(2,i=""),Y.hasImageExtension(s==null?void 0:s.name)&&Y.generateThumb(s,l,l).then(r=>{t(2,i=r)}).catch(r=>{console.warn("Unable to generate thumb: ",r)})}return n.$$set=r=>{"file"in r&&t(0,s=r.file),"size"in r&&t(1,l=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&o()},t(2,i=""),[s,l,i]}class GC extends Fe{constructor(e){super(),Le(this,e,JC,ZC,Pe,{file:0,size:1})}}function XC(n){let e,t;return{c(){e=_("img"),ti(e.src,t=n[2])||h(e,"src",t),h(e,"alt","Preview")},m(i,s){w(i,e,s)},p(i,s){s&4&&!ti(e.src,t=i[2])&&h(e,"src",t)},d(i){i&&k(e)}}}function QC(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',h(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=X(e,"click",Qt(n[0])),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function xC(n){let e,t,i=n[2].substring(n[2].lastIndexOf("/")+1)+"",s,l,o,r,a,u,f;return{c(){e=_("a"),t=R("/../"),s=R(i),l=T(),o=_("div"),r=T(),a=_("button"),a.textContent="Close",h(e,"href",n[2]),h(e,"title","Download"),h(e,"class","link-hint txt-ellipsis"),h(o,"class","flex-fill"),h(a,"type","button"),h(a,"class","btn btn-secondary")},m(c,d){w(c,e,d),p(e,t),p(e,s),w(c,l,d),w(c,o,d),w(c,r,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)+"")&&me(s,i),d&4&&h(e,"href",c[2])},d(c){c&&k(e),c&&k(l),c&&k(o),c&&k(r),c&&k(a),u=!1,f()}}}function e4(n){let e,t,i={class:"image-preview",btnClose:!1,popup:!0,$$slots:{footer:[xC],header:[QC],default:[XC]},$$scope:{ctx:n}};return e=new Ci({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 o={};l&132&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[4](null),z(e,s)}}}function t4(n,e,t){let i,s="";function l(f){f!==""&&Y.checkImageUrl(f).then(()=>{t(2,s=f),i==null||i.show()}).catch(()=>{console.warn("Invalid image preview url: ",f),o()})}function o(){return i==null?void 0:i.hide()}function r(f){he[f?"unshift":"push"](()=>{i=f,t(1,i)})}function a(f){pt.call(this,n,f)}function u(f){pt.call(this,n,f)}return[o,i,s,l,r,a,u]}class n4 extends Fe{constructor(e){super(),Le(this,e,t4,e4,Pe,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function i4(n){let e;return{c(){e=_("i"),h(e,"class","ri-file-line")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function s4(n){let e,t,i,s,l;return{c(){e=_("img"),ti(e.src,t=n[4])||h(e,"src",t),h(e,"alt",n[0]),h(e,"title",i="Preview "+n[0]),ee(e,"link-fade",n[2])},m(o,r){w(o,e,r),s||(l=[X(e,"click",n[7]),X(e,"error",n[5])],s=!0)},p(o,r){r&16&&!ti(e.src,t=o[4])&&h(e,"src",t),r&1&&h(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&h(e,"title",i),r&4&&ee(e,"link-fade",o[2])},d(o){o&&k(e),s=!1,st(l)}}}function l4(n){let e,t,i;function s(a,u){return a[2]?s4:i4}let l=s(n),o=l(n),r={};return t=new n4({props:r}),n[8](t),{c(){o.c(),e=T(),B(t.$$.fragment)},m(a,u){o.m(a,u),w(a,e,u),V(t,a,u),i=!0},p(a,[u]){l===(l=s(a))&&o?o.p(a,u):(o.d(1),o=l(a),o&&(o.c(),o.m(e.parentNode,e)));const f={};t.$set(f)},i(a){i||(A(t.$$.fragment,a),i=!0)},o(a){P(t.$$.fragment,a),i=!1},d(a){o.d(a),a&&k(e),n[8](null),z(t,a)}}}function o4(n,e,t){let i,{record:s}=e,{filename:l}=e,o,r="",a="";function u(){t(4,r="")}const f=d=>{d.stopPropagation(),o==null||o.show(a)};function c(d){he[d?"unshift":"push"](()=>{o=d,t(3,o)})}return n.$$set=d=>{"record"in d&&t(6,s=d.record),"filename"in d&&t(0,l=d.filename)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=Y.hasImageExtension(l)),n.$$.dirty&69&&i&&t(1,a=Se.Records.getFileUrl(s,`${l}`)),n.$$.dirty&2&&t(4,r=a?a+"?thumb=100x100":"")},[l,a,i,o,r,u,s,f,c]}class p_ extends Fe{constructor(e){super(),Le(this,e,o4,l4,Pe,{record:6,filename:0})}}function _h(n,e,t){const i=n.slice();return i[22]=e[t],i[24]=t,i}function bh(n,e,t){const i=n.slice();return i[25]=e[t],i[24]=t,i}function r4(n){let e,t,i;function s(){return n[14](n[24])}return{c(){e=_("button"),e.innerHTML='',h(e,"type","button"),h(e,"class","btn btn-secondary btn-sm btn-circle btn-remove txt-hint")},m(l,o){w(l,e,o),t||(i=[et(Et.call(null,e,"Remove file")),X(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,st(i)}}}function a4(n){let e,t,i;function s(){return n[13](n[24])}return{c(){e=_("button"),e.innerHTML='Restore',h(e,"type","button"),h(e,"class","btn btn-sm btn-danger btn-secondary")},m(l,o){w(l,e,o),t||(i=X(e,"click",s),t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,i()}}}function vh(n,e){let t,i,s,l,o,r,a=e[25]+"",u,f,c,d,m,g;s=new p_({props:{record:e[2],filename:e[25]}});function v(C,$){return $&18&&(m=null),m==null&&(m=!!C[1].includes(C[24])),m?a4:r4}let b=v(e,-1),y=b(e);return{key:n,first:null,c(){t=_("div"),i=_("figure"),B(s.$$.fragment),l=T(),o=_("a"),r=R("/.../"),u=R(a),d=T(),y.c(),h(i,"class","thumb"),ee(i,"fade",e[1].includes(e[24])),h(o,"href",f=Se.Records.getFileUrl(e[2],e[25])),h(o,"class","filename"),h(o,"title",c="Download "+e[25]),h(o,"target","_blank"),h(o,"rel","noopener"),ee(o,"txt-strikethrough",e[1].includes(e[24])),h(t,"class","list-item"),this.first=t},m(C,$){w(C,t,$),p(t,i),V(s,i,null),p(t,l),p(t,o),p(o,r),p(o,u),p(t,d),y.m(t,null),g=!0},p(C,$){e=C;const S={};$&4&&(S.record=e[2]),$&16&&(S.filename=e[25]),s.$set(S),$&18&&ee(i,"fade",e[1].includes(e[24])),(!g||$&16)&&a!==(a=e[25]+"")&&me(u,a),(!g||$&20&&f!==(f=Se.Records.getFileUrl(e[2],e[25])))&&h(o,"href",f),(!g||$&16&&c!==(c="Download "+e[25]))&&h(o,"title",c),$&18&&ee(o,"txt-strikethrough",e[1].includes(e[24])),b===(b=v(e,$))&&y?y.p(e,$):(y.d(1),y=b(e),y&&(y.c(),y.m(t,null)))},i(C){g||(A(s.$$.fragment,C),g=!0)},o(C){P(s.$$.fragment,C),g=!1},d(C){C&&k(t),z(s),y.d()}}}function yh(n){let e,t,i,s,l,o,r,a,u=n[22].name+"",f,c,d,m,g,v,b;i=new GC({props:{file:n[22]}});function y(){return n[15](n[24])}return{c(){e=_("div"),t=_("figure"),B(i.$$.fragment),s=T(),l=_("div"),o=_("small"),o.textContent="New",r=T(),a=_("span"),f=R(u),d=T(),m=_("button"),m.innerHTML='',h(t,"class","thumb"),h(o,"class","label label-success m-r-5"),h(a,"class","txt"),h(l,"class","filename"),h(l,"title",c=n[22].name),h(m,"type","button"),h(m,"class","btn btn-secondary btn-sm btn-circle btn-remove"),h(e,"class","list-item")},m(C,$){w(C,e,$),p(e,t),V(i,t,null),p(e,s),p(e,l),p(l,o),p(l,r),p(l,a),p(a,f),p(e,d),p(e,m),g=!0,v||(b=[et(Et.call(null,m,"Remove file")),X(m,"click",y)],v=!0)},p(C,$){n=C;const S={};$&1&&(S.file=n[22]),i.$set(S),(!g||$&1)&&u!==(u=n[22].name+"")&&me(f,u),(!g||$&1&&c!==(c=n[22].name))&&h(l,"title",c)},i(C){g||(A(i.$$.fragment,C),g=!0)},o(C){P(i.$$.fragment,C),g=!1},d(C){C&&k(e),z(i),v=!1,st(b)}}}function kh(n){let e,t,i,s,l,o;return{c(){e=_("div"),t=_("input"),i=T(),s=_("button"),s.innerHTML=` - Upload new file`,h(t,"type","file"),h(t,"class","hidden"),t.multiple=n[5],h(s,"type","button"),h(s,"class","btn btn-secondary btn-sm btn-block"),h(e,"class","list-item btn-list-item")},m(r,a){w(r,e,a),p(e,t),n[16](t),p(e,i),p(e,s),l||(o=[X(t,"change",n[17]),X(s,"click",n[18])],l=!0)},p(r,a){a&32&&(t.multiple=r[5])},d(r){r&&k(e),n[16](null),l=!1,st(o)}}}function u4(n){let e,t,i,s,l,o=n[3].name+"",r,a,u,f,c=[],d=new Map,m,g,v,b=n[4];const y=D=>D[25];for(let D=0;DP($[D],1,1,()=>{$[D]=null});let M=!n[8]&&kh(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),f=_("div");for(let D=0;D({21:i}),({uniqueId:i})=>i?2097152:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field form-field-file "+(i[3].required?"required":"")),s&8&&(l.name=i[3].name),s&136315391&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function c4(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new Sn}=e,c,d;function m(O){Y.removeByValue(u,O),t(1,u)}function g(O){Y.pushUnique(u,O),t(1,u)}function v(O){Y.isEmpty(a[O])||a.splice(O,1),t(0,a)}function b(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const y=O=>m(O),C=O=>g(O),$=O=>v(O);function S(O){he[O?"unshift":"push"](()=>{c=O,t(6,c)})}const M=()=>{for(let O of c.files)a.push(O);t(0,a),t(6,c.value=null,c)},D=()=>c==null?void 0:c.click();function E(O){he[O?"unshift":"push"](()=>{d=O,t(7,d)})}return n.$$set=O=>{"record"in O&&t(2,o=O.record),"value"in O&&t(12,r=O.value),"uploadedFiles"in O&&t(0,a=O.uploadedFiles),"deletedFileIndexes"in O&&t(1,u=O.deletedFileIndexes),"field"in O&&t(3,f=O.field)},n.$$.update=()=>{var O,F;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=Y.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=Y.toArray(u))),n.$$.dirty&8&&t(5,i=((O=f.options)==null?void 0:O.maxSelect)>1),n.$$.dirty&4128&&Y.isEmpty(r)&&t(12,r=i?[]:""),n.$$.dirty&4096&&t(4,s=Y.toArray(r)),n.$$.dirty&27&&t(8,l=(s.length||a.length)&&((F=f.options)==null?void 0:F.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&b()},[a,u,o,f,s,i,c,d,l,m,g,v,r,y,C,$,S,M,D,E]}class d4 extends Fe{constructor(e){super(),Le(this,e,c4,f4,Pe,{record:2,value:12,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function wh(n){let e,t;return{c(){e=_("small"),t=R(n[1]),h(e,"class","block txt-hint txt-ellipsis")},m(i,s){w(i,e,s),p(e,t)},p(i,s){s&2&&me(t,i[1])},d(i){i&&k(e)}}}function h4(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&wh(n);return{c(){e=_("i"),i=T(),s=_("div"),l=_("div"),r=R(o),a=T(),c&&c.c(),h(e,"class","ri-information-line link-hint"),h(l,"class","block txt-ellipsis"),h(s,"class","content svelte-1gjwqyd")},m(d,m){w(d,e,m),w(d,i,m),w(d,s,m),p(s,l),p(l,r),p(s,a),c&&c.m(s,null),u||(f=et(t=Et.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[m]){t&&Zn(t.update)&&m&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),m&1&&o!==(o=d[0].id+"")&&me(r,o),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,m):(c=wh(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:oe,o:oe,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function p4(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function o(r){r=r||{};const a=["name","title","label","key","email","heading","content",...Object.keys(r)];for(const u of a)if(typeof r[u]=="string"&&!Y.isEmpty(r[u])&&!s.includes(u))return u+": "+r[u];return""}return n.$$set=r=>{"item"in r&&t(0,l=r.item)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=o(l))},[l,i]}class m4 extends Fe{constructor(e){super(),Le(this,e,p4,h4,Pe,{item:0})}}function Sh(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',h(e,"type","button"),h(e,"class","btn btn-block btn-sm"),ee(e,"btn-loading",n[6]),ee(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[14])),t=!0)},p(s,l){l&64&&ee(e,"btn-loading",s[6]),l&64&&ee(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function g4(n){let e,t=n[7]&&Sh(n);return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=Sh(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function _4(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 o(u){n[15](u)}function r(u){n[16](u)}let a={$$slots:{afterOptions:[g4]},$$scope:{ctx:n}};for(let u=0;uRe(e,"keyOfSelected",o)),he.push(()=>Re(e,"selected",r)),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?bn(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&&hi(u[10])]):{};f&4194496&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],He(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],He(()=>i=!1)),e.$set(c)},i(u){s||(A(e.$$.fragment,u),s=!0)},o(u){P(e.$$.fragment,u),s=!1},d(u){z(e,u)}}}function b4(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent","collectionId"];let o=tn(e,l);const r="select_"+Y.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=m4}=e,{collectionId:m}=e,g=[],v=1,b=0,y=!1,C=!1;$();async function $(){const L=Y.toArray(f);if(!(!m||!L.length)){t(13,C=!0);try{const H=[];for(const j of L)H.push(`id="${j}"`);t(0,u=await Se.Records.getFullList(m,200,{sort:"-created",filter:H.join("||"),$cancelKey:r+"loadSelected"})),t(5,g=Y.filterDuplicatesByKey(g.concat(u)))}catch(H){Se.errorResponseHandler(H)}t(13,C=!1)}}async function S(L=!1){if(!!m){t(6,y=!0);try{const H=L?1:v+1,j=await Se.Records.getList(m,H,200,{sort:"-created",$cancelKey:r+"loadList"});L&&t(5,g=[]),t(5,g=Y.filterDuplicatesByKey(g.concat(j.items))),v=j.page,t(12,b=j.totalItems)}catch(H){Se.errorResponseHandler(H)}t(6,y=!1)}}const M=()=>S();function D(L){f=L,t(1,f)}function E(L){u=L,t(0,u)}function O(L){pt.call(this,n,L)}function F(L){pt.call(this,n,L)}return n.$$set=L=>{e=_t(_t({},e),ci(L)),t(10,o=tn(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,m=L.collectionId)},n.$$.update=()=>{n.$$.dirty&2048&&m&&S(!0),n.$$.dirty&8256&&t(8,i=y||C),n.$$.dirty&4128&&t(7,s=b>g.length)},[u,f,a,c,d,g,y,s,i,S,o,m,b,C,M,D,E,O,F]}class v4 extends Fe{constructor(e){super(),Le(this,e,b4,_4,Pe,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4,collectionId:11})}}function $h(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=R("Select up to "),s=R(i),l=R(" items."),h(e,"class","help-block")},m(o,r){w(o,e,r),p(e,t),p(e,s),p(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&me(s,i)},d(o){o&&k(e)}}}function y4(n){var C,$;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;function v(S){n[3](S)}let b={toggle:!0,id:n[4],multiple:n[2],collectionId:(C=n[1].options)==null?void 0:C.collectionId};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new v4({props:b}),he.push(()=>Re(f,"keyOfSelected",v));let y=(($=n[1].options)==null?void 0:$.maxSelect)>1&&$h(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),B(f.$$.fragment),d=T(),y&&y.c(),m=lt(),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[4])},m(S,M){w(S,e,M),p(e,t),p(e,s),p(e,l),p(l,r),w(S,u,M),V(f,S,M),w(S,d,M),y&&y.m(S,M),w(S,m,M),g=!0},p(S,M){var E,O;(!g||M&2&&i!==(i=Y.getFieldTypeIcon(S[1].type)))&&h(t,"class",i),(!g||M&2)&&o!==(o=S[1].name+"")&&me(r,o),(!g||M&16&&a!==(a=S[4]))&&h(e,"for",a);const D={};M&16&&(D.id=S[4]),M&4&&(D.multiple=S[2]),M&2&&(D.collectionId=(E=S[1].options)==null?void 0:E.collectionId),!c&&M&1&&(c=!0,D.keyOfSelected=S[0],He(()=>c=!1)),f.$set(D),((O=S[1].options)==null?void 0:O.maxSelect)>1?y?y.p(S,M):(y=$h(S),y.c(),y.m(m.parentNode,m)):y&&(y.d(1),y=null)},i(S){g||(A(f.$$.fragment,S),g=!0)},o(S){P(f.$$.fragment,S),g=!1},d(S){S&&k(e),S&&k(u),z(f,S),S&&k(d),y&&y.d(S),S&&k(m)}}}function k4(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[y4,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function w4(n,e,t){let i,{field:s=new Sn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.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,o]}class S4 extends Fe{constructor(e){super(),Le(this,e,w4,k4,Pe,{field:1,value:0})}}function $4(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f=n[0].email+"",c,d,m;return{c(){e=_("i"),i=T(),s=_("div"),l=_("div"),r=R(o),a=T(),u=_("small"),c=R(f),h(e,"class","ri-information-line link-hint"),h(l,"class","block txt-ellipsis"),h(u,"class","block txt-hint txt-ellipsis"),h(s,"class","content")},m(g,v){w(g,e,v),w(g,i,v),w(g,s,v),p(s,l),p(l,r),p(s,a),p(s,u),p(u,c),d||(m=et(t=Et.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),d=!0)},p(g,[v]){t&&Zn(t.update)&&v&1&&t.update.call(null,{text:JSON.stringify(g[0],null,2),position:"left",class:"code"}),v&1&&o!==(o=g[0].id+"")&&me(r,o),v&1&&f!==(f=g[0].email+"")&&me(c,f)},i:oe,o:oe,d(g){g&&k(e),g&&k(i),g&&k(s),d=!1,m()}}}function C4(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class ia extends Fe{constructor(e){super(),Le(this,e,C4,$4,Pe,{item:0})}}function Ch(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',h(e,"type","button"),h(e,"class","btn btn-block btn-sm"),ee(e,"btn-loading",n[6]),ee(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=X(e,"click",ni(n[13])),t=!0)},p(s,l){l&64&&ee(e,"btn-loading",s[6]),l&64&&ee(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function M4(n){let e,t=n[7]&&Ch(n);return{c(){t&&t.c(),e=lt()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=Ch(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function T4(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:ia},{optionComponent:n[4]},{multiple:n[2]},{class:"users-select block-options"},n[10]];function o(u){n[14](u)}function r(u){n[15](u)}let a={$$slots:{afterOptions:[M4]},$$scope:{ctx:n}};for(let u=0;uRe(e,"keyOfSelected",o)),he.push(()=>Re(e,"selected",r)),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?bn(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:ia},f&16&&{optionComponent:u[4]},f&4&&{multiple:u[2]},l[7],f&1024&&hi(u[10])]):{};f&2097344&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],He(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],He(()=>i=!1)),e.$set(c)},i(u){s||(A(e.$$.fragment,u),s=!0)},o(u){P(e.$$.fragment,u),s=!1},d(u){z(e,u)}}}function D4(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent"];let o=tn(e,l);const r="select_"+Y.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=ia}=e,m=[],g=1,v=0,b=!1,y=!1;$(!0),C();async function C(){const F=Y.toArray(f);if(!!F.length){t(12,y=!0);try{const L=[];for(const H of F)L.push(`id="${H}"`);t(0,u=await Se.Users.getFullList(100,{sort:"-created",filter:L.join("||"),$cancelKey:r+"loadSelected"})),t(5,m=Y.filterDuplicatesByKey(m.concat(u)))}catch(L){Se.errorResponseHandler(L)}t(12,y=!1)}}async function $(F=!1){t(6,b=!0);try{const L=F?1:g+1,H=await Se.Users.getList(L,200,{sort:"-created",$cancelKey:r+"loadList"});F&&t(5,m=[]),t(5,m=Y.filterDuplicatesByKey(m.concat(H.items))),g=H.page,t(11,v=H.totalItems)}catch(L){Se.errorResponseHandler(L)}t(6,b=!1)}const S=()=>$();function M(F){f=F,t(1,f)}function D(F){u=F,t(0,u)}function E(F){pt.call(this,n,F)}function O(F){pt.call(this,n,F)}return n.$$set=F=>{e=_t(_t({},e),ci(F)),t(10,o=tn(e,l)),"multiple"in F&&t(2,a=F.multiple),"selected"in F&&t(0,u=F.selected),"keyOfSelected"in F&&t(1,f=F.keyOfSelected),"selectPlaceholder"in F&&t(3,c=F.selectPlaceholder),"optionComponent"in F&&t(4,d=F.optionComponent)},n.$$.update=()=>{n.$$.dirty&4160&&t(8,i=b||y),n.$$.dirty&2080&&t(7,s=v>m.length)},[u,f,a,c,d,m,b,s,i,$,o,v,y,S,M,D,E,O]}class O4 extends Fe{constructor(e){super(),Le(this,e,D4,T4,Pe,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4})}}function Mh(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=R("Select up to "),s=R(i),l=R(" users."),h(e,"class","help-block")},m(o,r){w(o,e,r),p(e,t),p(e,s),p(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&me(s,i)},d(o){o&&k(e)}}}function E4(n){var C;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,m,g;function v($){n[4]($)}let b={toggle:!0,id:n[5],multiple:n[2],disabled:n[3]};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new O4({props:b}),he.push(()=>Re(f,"keyOfSelected",v));let y=((C=n[1].options)==null?void 0:C.maxSelect)>1&&Mh(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=R(o),u=T(),B(f.$$.fragment),d=T(),y&&y.c(),m=lt(),h(t,"class",i=Y.getFieldTypeIcon(n[1].type)),h(l,"class","txt"),h(e,"for",a=n[5])},m($,S){w($,e,S),p(e,t),p(e,s),p(e,l),p(l,r),w($,u,S),V(f,$,S),w($,d,S),y&&y.m($,S),w($,m,S),g=!0},p($,S){var D;(!g||S&2&&i!==(i=Y.getFieldTypeIcon($[1].type)))&&h(t,"class",i),(!g||S&2)&&o!==(o=$[1].name+"")&&me(r,o),(!g||S&32&&a!==(a=$[5]))&&h(e,"for",a);const M={};S&32&&(M.id=$[5]),S&4&&(M.multiple=$[2]),S&8&&(M.disabled=$[3]),!c&&S&1&&(c=!0,M.keyOfSelected=$[0],He(()=>c=!1)),f.$set(M),((D=$[1].options)==null?void 0:D.maxSelect)>1?y?y.p($,S):(y=Mh($),y.c(),y.m(m.parentNode,m)):y&&(y.d(1),y=null)},i($){g||(A(f.$$.fragment,$),g=!0)},o($){P(f.$$.fragment,$),g=!1},d($){$&&k(e),$&&k(u),z(f,$),$&&k(d),y&&y.d($),$&&k(m)}}}function A4(n){let e,t;return e=new Ie({props:{class:"form-field "+(n[1].required?"required":"")+" "+(n[3]?"disabled":""),name:n[1].name,$$slots:{default:[E4,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function P4(n,e,t){let i,s,{field:l=new Sn}=e,{value:o=void 0}=e;function r(a){o=a,t(0,o),t(2,s),t(1,l)}return n.$$set=a=>{"field"in a&&t(1,l=a.field),"value"in a&&t(0,o=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(o)&&o.length>l.options.maxSelect&&t(0,o=o.slice(l.options.maxSelect-1)),n.$$.dirty&3&&t(3,i=!Y.isEmpty(o)&&l.system)},[o,l,s,i,r]}class L4 extends Fe{constructor(e){super(),Le(this,e,P4,A4,Pe,{field:1,value:0})}}function Th(n,e,t){const i=n.slice();return i[40]=e[t],i[41]=e,i[42]=t,i}function Dh(n){let e,t;return e=new Ie({props:{class:"form-field disabled",name:"id",$$slots:{default:[F4,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function F4(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="id",l=T(),o=_("span"),a=T(),u=_("input"),h(t,"class",Y.getFieldTypeIcon("primary")),h(s,"class","txt"),h(o,"class","flex-fill"),h(e,"for",r=n[43]),h(u,"type","text"),h(u,"id",f=n[43]),u.value=c=n[2].id,u.disabled=!0},m(d,m){w(d,e,m),p(e,t),p(e,i),p(e,s),p(e,l),p(e,o),w(d,a,m),w(d,u,m)},p(d,m){m[1]&4096&&r!==(r=d[43])&&h(e,"for",r),m[1]&4096&&f!==(f=d[43])&&h(u,"id",f),m[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 Oh(n){let e;return{c(){e=_("div"),e.innerHTML=`
No custom fields to be set
- `,h(e,"class","block txt-center txt-disabled")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function I4(n){let e,t,i;function s(o){n[31](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new L4({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function N4(n){let e,t,i;function s(o){n[30](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new S4({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function R4(n){let e,t,i,s,l;function o(f){n[27](f,n[40])}function r(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 d4({props:u}),he.push(()=>Re(e,"value",o)),he.push(()=>Re(e,"uploadedFiles",r)),he.push(()=>Re(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],He(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[40].name],He(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[40].name],He(()=>s=!1)),e.$set(d)},i(f){l||(A(e.$$.fragment,f),l=!0)},o(f){P(e.$$.fragment,f),l=!1},d(f){z(e,f)}}}function H4(n){let e,t,i;function s(o){n[26](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new WC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function j4(n){let e,t,i;function s(o){n[25](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new VC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function q4(n){let e,t,i;function s(o){n[24](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new RC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function V4(n){let e,t,i;function s(o){n[23](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new LC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function z4(n){let e,t,i;function s(o){n[22](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new OC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function B4(n){let e,t,i;function s(o){n[21](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new CC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function U4(n){let e,t,i;function s(o){n[20](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new kC({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function W4(n){let e,t,i;function s(o){n[19](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new _C({props:l}),he.push(()=>Re(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function Eh(n,e){let t,i,s,l,o;const r=[W4,U4,B4,z4,V4,q4,j4,H4,R4,N4,I4],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]=r[i](e)),{key:n,first:null,c(){t=lt(),s&&s.c(),l=lt(),this.first=t},m(f,c){w(f,t,c),~i&&a[i].m(f,c),w(f,l,c),o=!0},p(f,c){e=f;let d=i;i=u(e),i===d?~i&&a[i].p(e,c):(s&&(De(),P(a[d],1,1,()=>{a[d]=null}),Oe()),~i?(s=a[i],s?s.p(e,c):(s=a[i]=r[i](e),s.c()),A(s,1),s.m(l.parentNode,l)):s=null)},i(f){o||(A(s),o=!0)},o(f){P(s),o=!1},d(f){f&&k(t),~i&&a[i].d(f),f&&k(l)}}}function Y4(n){var d;let e,t,i=[],s=new Map,l,o,r,a=!n[2].isNew&&Dh(n),u=((d=n[0])==null?void 0:d.schema)||[];const f=m=>m[40].name;for(let m=0;m{a=null}),Oe()):a?(a.p(m,g),g[0]&4&&A(a,1)):(a=Dh(m),a.c(),A(a,1),a.m(e,t)),g[0]&29&&(u=((v=m[0])==null?void 0:v.schema)||[],De(),i=dt(i,g,f,1,m,u,s,e,Bt,Eh,null,Th),Oe(),!u.length&&c?c.p(m,g):u.length?c&&(c.d(1),c=null):(c=Oh(),c.c(),c.m(e,null)))},i(m){if(!l){A(a);for(let g=0;g - Delete`,h(e,"tabindex","0"),h(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[18]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function Z4(n){let e,t=n[2].isNew?"New":"Edit",i,s,l=n[0].name+"",o,r,a,u,f,c=!n[2].isNew&&n[10]&&Ah(n);return{c(){e=_("h4"),i=R(t),s=T(),o=R(l),r=R(" record"),a=T(),c&&c.c(),u=lt()},m(d,m){w(d,e,m),p(e,i),p(e,s),p(e,o),p(e,r),w(d,a,m),c&&c.m(d,m),w(d,u,m),f=!0},p(d,m){(!f||m[0]&4)&&t!==(t=d[2].isNew?"New":"Edit")&&me(i,t),(!f||m[0]&1)&&l!==(l=d[0].name+"")&&me(o,l),!d[2].isNew&&d[10]?c?(c.p(d,m),m[0]&1028&&A(c,1)):(c=Ah(d),c.c(),A(c,1),c.m(u.parentNode,u)):c&&(De(),P(c,1,1,()=>{c=null}),Oe())},i(d){f||(A(c),f=!0)},o(d){P(c),f=!1},d(d){d&&k(e),d&&k(a),c&&c.d(d),d&&k(u)}}}function J4(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=R(o),h(t,"class","txt"),h(e,"type","button"),h(e,"class","btn btn-secondary"),e.disabled=n[7],h(l,"class","txt"),h(s,"type","submit"),h(s,"form",n[11]),h(s,"class","btn btn-expanded"),s.disabled=a=!n[9]||n[7],ee(s,"btn-loading",n[7])},m(c,d){w(c,e,d),p(e,t),w(c,i,d),w(c,s,d),p(s,l),p(l,r),u||(f=X(e,"click",n[17]),u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&me(r,o),d[0]&640&&a!==(a=!c[9]||c[7])&&(s.disabled=a),d[0]&128&&ee(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,f()}}}function G4(n){let e,t,i={class:"overlay-panel-lg record-panel",beforeHide:n[32],$$slots:{footer:[J4],header:[Z4],default:[Y4]},$$scope:{ctx:n}};return e=new Ci({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 o={};l[0]&288&&(o.beforeHide=s[32]),l[0]&1693|l[1]&8192&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[33](null),z(e,s)}}}function Ph(n){return JSON.stringify(n)}function X4(n,e,t){let i,s,l,o;const r=hn(),a="record_"+Y.randomString(5);let{collection:u}=e,f,c=null,d=new fo,m=!1,g=!1,v={},b={},y="";function C(x){return S(x),t(8,g=!0),f==null?void 0:f.show()}function $(){return f==null?void 0:f.hide()}async function S(x){Ri({}),c=x||{},t(2,d=x!=null&&x.clone?x.clone():new fo),t(3,v={}),t(4,b={}),await di(),t(15,y=Ph(d))}function M(){if(m||!l)return;t(7,m=!0);const x=E();let G;d.isNew?G=Se.Records.create(u==null?void 0:u.id,x):G=Se.Records.update(u==null?void 0:u.id,d.id,x),G.then(async _e=>{_n(d.isNew?"Successfully created record.":"Successfully updated record."),t(8,g=!1),$(),r("save",_e)}).catch(_e=>{Se.errorResponseHandler(_e)}).finally(()=>{t(7,m=!1)})}function D(){!(c!=null&&c.id)||Si("Do you really want to delete the selected record?",()=>Se.Records.delete(c["@collectionId"],c.id).then(()=>{$(),_n("Successfully deleted record."),r("delete",c)}).catch(x=>{Se.errorResponseHandler(x)}))}function E(){const x=(d==null?void 0:d.export())||{},G=new FormData,_e={};for(const je of(u==null?void 0:u.schema)||[])_e[je.name]=je;for(const je in x)!_e[je]||(typeof x[je]>"u"&&(x[je]=null),Y.addValueToFormData(G,je,x[je]));for(const je in v){const Ne=Y.toArray(v[je]);for(const qe of Ne)G.append(je,qe)}for(const je in b){const Ne=Y.toArray(b[je]);for(const qe of Ne)G.append(je+"."+qe,"")}return G}const O=()=>$(),F=()=>D();function L(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function H(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function j(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function Q(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function ie(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function U(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function K(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function W(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function J(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function se(x,G){n.$$.not_equal(v[G.name],x)&&(v[G.name]=x,t(3,v))}function fe(x,G){n.$$.not_equal(b[G.name],x)&&(b[G.name]=x,t(4,b))}function ke(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}function le(x,G){n.$$.not_equal(d[G.name],x)&&(d[G.name]=x,t(2,d))}const ue=()=>s&&g?(Si("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,g=!1),$()}),!1):!0;function Me(x){he[x?"unshift":"push"](()=>{f=x,t(6,f)})}function Z(x){pt.call(this,n,x)}function be(x){pt.call(this,n,x)}return n.$$set=x=>{"collection"in x&&t(0,u=x.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(16,i=Y.hasNonEmptyProps(v)||Y.hasNonEmptyProps(b)),n.$$.dirty[0]&98308&&t(5,s=i||y!=Ph(d)),n.$$.dirty[0]&36&&t(9,l=d.isNew||s),n.$$.dirty[0]&1&&t(10,o=(u==null?void 0:u.name)!=="profiles")},[u,$,d,v,b,s,f,m,g,l,o,a,M,D,C,y,i,O,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke,le,ue,Me,Z,be]}class m_ extends Fe{constructor(e){super(),Le(this,e,X4,G4,Pe,{collection:0,show:14,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[1]}}function Q4(n){let e;return{c(){e=_("span"),e.textContent="N/A",h(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function x4(n){let e,t;return{c(){e=_("span"),t=R(n[1]),h(e,"class","label txt-base txt-mono"),h(e,"title",n[0])},m(i,s){w(i,e,s),p(e,t)},p(i,s){s&2&&me(t,i[1]),s&1&&h(e,"title",i[0])},d(i){i&&k(e)}}}function eM(n){let e;function t(l,o){return l[0]?x4:Q4}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:oe,o:oe,d(l){s.d(l),l&&k(e)}}}function tM(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 Zo extends Fe{constructor(e){super(),Le(this,e,tM,eM,Pe,{id:0})}}function Lh(n,e,t){const i=n.slice();return i[8]=e[t],i}function Fh(n,e,t){const i=n.slice();return i[3]=e[t],i}function Ih(n,e,t){const i=n.slice();return i[3]=e[t],i}function nM(n){let e,t=n[0][n[1].name]+"",i,s;return{c(){e=_("span"),i=R(t),h(e,"class","txt txt-ellipsis"),h(e,"title",s=n[0][n[1].name])},m(l,o){w(l,e,o),p(e,i)},p(l,o){o&3&&t!==(t=l[0][l[1].name]+"")&&me(i,t),o&3&&s!==(s=l[0][l[1].name])&&h(e,"title",s)},i:oe,o:oe,d(l){l&&k(e)}}}function iM(n){let e,t,i=Y.toArray(n[0][n[1].name]),s=[];for(let o=0;oP(s[o],1,1,()=>{s[o]=null});return{c(){e=_("div");for(let o=0;oP(s[o],1,1,()=>{s[o]=null});return{c(){e=_("div");for(let o=0;o{a[d]=null}),Oe(),s=a[i],s?s.p(f,c):(s=a[i]=r[i](f),s.c()),A(s,1),s.m(e,null)),(!o||c&2&&l!==(l="col-type-"+f[1].type+" col-field-"+f[1].name))&&h(e,"class",l)},i(f){o||(A(s),o=!0)},o(f){P(s),o=!1},d(f){f&&k(e),a[i].d()}}}function dM(n,e,t){let{record:i}=e,{field:s}=e;function l(o){pt.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record),"field"in o&&t(1,s=o.field)},[i,s,l]}class g_ extends Fe{constructor(e){super(),Le(this,e,dM,cM,Pe,{record:0,field:1})}}function jh(n,e,t){const i=n.slice();return i[35]=e[t],i}function qh(n,e,t){const i=n.slice();return i[38]=e[t],i}function Vh(n,e,t){const i=n.slice();return i[38]=e[t],i}function hM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",h(t,"class",Y.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function pM(n){let e,t,i,s,l,o=n[38].name+"",r;return{c(){e=_("div"),t=_("i"),s=T(),l=_("span"),r=R(o),h(t,"class",i=Y.getFieldTypeIcon(n[38].type)),h(l,"class","txt"),h(e,"class","col-header-content")},m(a,u){w(a,e,u),p(e,t),p(e,s),p(e,l),p(l,r)},p(a,u){u[0]&2048&&i!==(i=Y.getFieldTypeIcon(a[38].type))&&h(t,"class",i),u[0]&2048&&o!==(o=a[38].name+"")&&me(r,o)},d(a){a&&k(e)}}}function zh(n,e){let t,i,s,l;function o(a){e[22](a)}let r={class:"col-type-"+e[38].type+" col-field-"+e[38].name,name:e[38].name,$$slots:{default:[pM]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.sort=e[0]),i=new rn({props:r}),he.push(()=>Re(i,"sort",o)),{key:n,first:null,c(){t=lt(),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],He(()=>s=!1)),i.$set(f)},i(a){l||(A(i.$$.fragment,a),l=!0)},o(a){P(i.$$.fragment,a),l=!1},d(a){a&&k(t),z(i,a)}}}function mM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function gM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function Bh(n){let e;function t(l,o){return l[8]?bM:_M}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function _M(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&Uh(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No records found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),p(e,t),p(t,i),p(t,s),o&&o.m(t,null),p(e,l)},p(a,u){var f;(f=a[1])!=null&&f.length?o?o.p(a,u):(o=Uh(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function bM(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function Uh(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',h(e,"type","button"),h(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:oe,d(s){s&&k(e),t=!1,i()}}}function Wh(n,e){let t,i,s;return i=new g_({props:{record:e[35],field:e[38]}}),{key:n,first:null,c(){t=lt(),B(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),V(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&8&&(r.record=e[35]),o[0]&2048&&(r.field=e[38]),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function Yh(n,e){let t,i,s,l,o,r,a,u,f,c,d,m,g,v=[],b=new Map,y,C,$,S,M,D,E,O,F,L,H,j;function Q(){return e[25](e[35])}m=new Zo({props:{id:e[35].id}});let ie=e[11];const U=J=>J[38].name;for(let J=0;J',F=T(),h(l,"type","checkbox"),h(l,"id",o="checkbox_"+e[35].id),l.checked=r=e[5][e[35].id],h(u,"for",f="checkbox_"+e[35].id),h(s,"class","form-field"),h(i,"class","bulk-select-col min-width"),h(d,"class","col-type-text col-field-id"),h(C,"class","col-type-date col-field-created"),h(M,"class","col-type-date col-field-updated"),h(O,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(J,se){w(J,t,se),p(t,i),p(i,s),p(s,l),p(s,a),p(s,u),p(t,c),p(t,d),V(m,d,null),p(t,g);for(let fe=0;feReset',c=T(),d=_("div"),m=T(),g=_("button"),g.innerHTML='Delete selected',h(t,"class","txt"),h(f,"type","button"),h(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),ee(f,"btn-disabled",n[9]),h(d,"class","flex-fill"),h(g,"type","button"),h(g,"class","btn btn-sm btn-secondary btn-danger"),ee(g,"btn-loading",n[9]),ee(g,"btn-disabled",n[9]),h(e,"class","bulkbar")},m($,S){w($,e,S),p(e,t),p(t,i),p(t,s),p(s,l),p(t,o),p(t,a),p(e,u),p(e,f),p(e,c),p(e,d),p(e,m),p(e,g),b=!0,y||(C=[X(f,"click",n[30]),X(g,"click",n[31])],y=!0)},p($,S){(!b||S[0]&64)&&me(l,$[6]),(!b||S[0]&64)&&r!==(r=$[6]===1?"record":"records")&&me(a,r),S[0]&512&&ee(f,"btn-disabled",$[9]),S[0]&512&&ee(g,"btn-loading",$[9]),S[0]&512&&ee(g,"btn-disabled",$[9])},i($){b||($&&Lt(()=>{v||(v=at(e,Un,{duration:150,y:5},!0)),v.run(1)}),b=!0)},o($){$&&(v||(v=at(e,Un,{duration:150,y:5},!1)),v.run(0)),b=!1},d($){$&&k(e),$&&v&&v.end(),y=!1,st(C)}}}function vM(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v=[],b=new Map,y,C,$,S,M,D,E,O,F,L,H=[],j=new Map,Q,ie,U,K,W,J,se;function fe(re){n[21](re)}let ke={class:"col-type-text col-field-id",name:"id",$$slots:{default:[hM]},$$scope:{ctx:n}};n[0]!==void 0&&(ke.sort=n[0]),d=new rn({props:ke}),he.push(()=>Re(d,"sort",fe));let le=n[11];const ue=re=>re[38].name;for(let re=0;reRe(C,"sort",Me));function be(re){n[24](re)}let x={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[gM]},$$scope:{ctx:n}};n[0]!==void 0&&(x.sort=n[0]),M=new rn({props:x}),he.push(()=>Re(M,"sort",be));let G=n[3];const _e=re=>re[35].id;for(let re=0;rem=!1)),d.$set(Je),ve[0]&2049&&(le=re[11],De(),v=dt(v,ve,ue,1,re,le,b,s,Bt,zh,y,Vh),Oe());const nt={};ve[1]&4096&&(nt.$$scope={dirty:ve,ctx:re}),!$&&ve[0]&1&&($=!0,nt.sort=re[0],He(()=>$=!1)),C.$set(nt);const ut={};ve[1]&4096&&(ut.$$scope={dirty:ve,ctx:re}),!D&&ve[0]&1&&(D=!0,ut.sort=re[0],He(()=>D=!1)),M.$set(ut),ve[0]&76074&&(G=re[3],De(),H=dt(H,ve,_e,1,re,G,j,L,Bt,Yh,null,jh),Oe(),!G.length&&je?je.p(re,ve):G.length?je&&(je.d(1),je=null):(je=Bh(re),je.c(),je.m(L,null))),ve[0]&256&&ee(t,"table-loading",re[8]),re[3].length?Ne?Ne.p(re,ve):(Ne=Kh(re),Ne.c(),Ne.m(ie.parentNode,ie)):Ne&&(Ne.d(1),Ne=null),re[3].length&&re[12]?qe?qe.p(re,ve):(qe=Zh(re),qe.c(),qe.m(U.parentNode,U)):qe&&(qe.d(1),qe=null),re[6]?ae?(ae.p(re,ve),ve[0]&64&&A(ae,1)):(ae=Jh(re),ae.c(),A(ae,1),ae.m(K.parentNode,K)):ae&&(De(),P(ae,1,1,()=>{ae=null}),Oe())},i(re){if(!W){A(d.$$.fragment,re);for(let ve=0;ve{t(8,v=!1),t(3,c=c.concat(ue.items)),t(7,d=ue.page),t(4,m=ue.totalItems),r("load",c)}).catch(ue=>{ue!=null&&ue.isAbort||(t(8,v=!1),console.warn(ue),C(),Se.errorResponseHandler(ue,!1))})}function C(){t(3,c=[]),t(7,d=1),t(4,m=0),t(5,g={})}function $(){o?S():M()}function S(){t(5,g={})}function M(){for(const le of c)t(5,g[le.id]=le,g);t(5,g)}function D(le){g[le.id]?delete g[le.id]:t(5,g[le.id]=le,g),t(5,g)}function E(){Si(`Do you really want to delete the selected ${l===1?"record":"records"}?`,O)}async function O(){if(b||!l)return;let le=[];for(const ue of Object.keys(g))le.push(Se.Records.delete(a==null?void 0:a.id,ue));return t(9,b=!0),Promise.all(le).then(()=>{_n(`Successfully deleted the selected ${l===1?"record":"records"}.`),S()}).catch(ue=>{Se.errorResponseHandler(ue)}).finally(()=>(t(9,b=!1),y()))}function F(le){pt.call(this,n,le)}const L=()=>$();function H(le){u=le,t(0,u)}function j(le){u=le,t(0,u)}function Q(le){u=le,t(0,u)}function ie(le){u=le,t(0,u)}const U=le=>D(le),K=le=>r("select",le),W=(le,ue)=>{ue.code==="Enter"&&(ue.preventDefault(),r("select",le))},J=()=>t(1,f=""),se=()=>y(d+1),fe=()=>S(),ke=()=>E();return n.$$set=le=>{"collection"in le&&t(18,a=le.collection),"sort"in le&&t(0,u=le.sort),"filter"in le&&t(1,f=le.filter)},n.$$.update=()=>{n.$$.dirty[0]&262147&&a&&a.id&&u!==-1&&f!==-1&&(C(),y(1)),n.$$.dirty[0]&24&&t(12,i=m>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,o=c.length&&l===c.length)},[u,f,y,c,m,g,l,d,v,b,o,s,i,r,$,S,D,E,a,F,L,H,j,Q,ie,U,K,W,J,se,fe,ke]}class kM extends Fe{constructor(e){super(),Le(this,e,yM,vM,Pe,{collection:18,sort:0,filter:1,load:2},null,[-1,-1])}get load(){return this.$$.ctx[2]}}function wM(n){let e,t,i,s,l,o,r,a,u=n[2].name+"",f,c,d,m,g,v,b,y,C,$,S,M,D,E,O,F,L,H,j;e=new b$({}),g=new zo({}),g.$on("refresh",n[13]),M=new Vo({props:{value:n[0],autocompleteCollection:n[2]}}),M.$on("submit",n[16]);function Q(K){n[18](K)}function ie(K){n[19](K)}let U={collection:n[2]};return n[0]!==void 0&&(U.filter=n[0]),n[1]!==void 0&&(U.sort=n[1]),E=new kM({props:U}),n[17](E),he.push(()=>Re(E,"filter",Q)),he.push(()=>Re(E,"sort",ie)),E.$on("select",n[20]),{c(){B(e.$$.fragment),t=T(),i=_("main"),s=_("header"),l=_("nav"),o=_("div"),o.textContent="Collections",r=T(),a=_("div"),f=R(u),c=T(),d=_("button"),d.innerHTML='',m=T(),B(g.$$.fragment),v=T(),b=_("div"),y=_("button"),y.innerHTML=` - API Preview`,C=T(),$=_("button"),$.innerHTML=` - New record`,S=T(),B(M.$$.fragment),D=T(),B(E.$$.fragment),h(o,"class","breadcrumb-item"),h(a,"class","breadcrumb-item"),h(l,"class","breadcrumbs"),h(d,"type","button"),h(d,"class","btn btn-secondary btn-circle"),h(y,"type","button"),h(y,"class","btn btn-outline"),h($,"type","button"),h($,"class","btn btn-expanded"),h(b,"class","btns-group"),h(s,"class","page-header"),h(i,"class","page-wrapper")},m(K,W){V(e,K,W),w(K,t,W),w(K,i,W),p(i,s),p(s,l),p(l,o),p(l,r),p(l,a),p(a,f),p(s,c),p(s,d),p(s,m),V(g,s,null),p(s,v),p(s,b),p(b,y),p(b,C),p(b,$),p(i,S),V(M,i,null),p(i,D),V(E,i,null),L=!0,H||(j=[et(Et.call(null,d,{text:"Edit collection",position:"right"})),X(d,"click",n[12]),X(y,"click",n[14]),X($,"click",n[15])],H=!0)},p(K,W){(!L||W&4)&&u!==(u=K[2].name+"")&&me(f,u);const J={};W&1&&(J.value=K[0]),W&4&&(J.autocompleteCollection=K[2]),M.$set(J);const se={};W&4&&(se.collection=K[2]),!O&&W&1&&(O=!0,se.filter=K[0],He(()=>O=!1)),!F&&W&2&&(F=!0,se.sort=K[1],He(()=>F=!1)),E.$set(se)},i(K){L||(A(e.$$.fragment,K),A(g.$$.fragment,K),A(M.$$.fragment,K),A(E.$$.fragment,K),L=!0)},o(K){P(e.$$.fragment,K),P(g.$$.fragment,K),P(M.$$.fragment,K),P(E.$$.fragment,K),L=!1},d(K){z(e,K),K&&k(t),K&&k(i),z(g),z(M),n[17](null),z(E),H=!1,st(j)}}}function SM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("div"),t=_("div"),t.innerHTML='',i=T(),s=_("h1"),s.textContent="Create your first collection to add records!",l=T(),o=_("button"),o.innerHTML=` - Create new collection`,h(t,"class","icon"),h(s,"class","m-b-10"),h(o,"type","button"),h(o,"class","btn btn-expanded-lg btn-lg"),h(e,"class","placeholder-section m-b-base")},m(u,f){w(u,e,f),p(e,t),p(e,i),p(e,s),p(e,l),p(e,o),r||(a=X(o,"click",n[11]),r=!0)},p:oe,i:oe,o:oe,d(u){u&&k(e),r=!1,a()}}}function $M(n){let e;return{c(){e=_("div"),e.innerHTML=` -

Loading collections...

`,h(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function CM(n){let e,t,i,s,l,o,r,a,u;const f=[$M,SM,wM],c=[];function d(b,y){return b[8]?0:b[7].length?2:1}e=d(n),t=c[e]=f[e](n);let m={};s=new Ua({props:m}),n[21](s);let g={};o=new fC({props:g}),n[22](o);let v={collection:n[2]};return a=new m_({props:v}),n[23](a),a.$on("save",n[24]),a.$on("delete",n[25]),{c(){t.c(),i=T(),B(s.$$.fragment),l=T(),B(o.$$.fragment),r=T(),B(a.$$.fragment)},m(b,y){c[e].m(b,y),w(b,i,y),V(s,b,y),w(b,l,y),V(o,b,y),w(b,r,y),V(a,b,y),u=!0},p(b,[y]){let C=e;e=d(b),e===C?c[e].p(b,y):(De(),P(c[C],1,1,()=>{c[C]=null}),Oe(),t=c[e],t?t.p(b,y):(t=c[e]=f[e](b),t.c()),A(t,1),t.m(i.parentNode,i));const $={};s.$set($);const S={};o.$set(S);const M={};y&4&&(M.collection=b[2]),a.$set(M)},i(b){u||(A(t),A(s.$$.fragment,b),A(o.$$.fragment,b),A(a.$$.fragment,b),u=!0)},o(b){P(t),P(s.$$.fragment,b),P(o.$$.fragment,b),P(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[21](null),z(s,b),b&&k(l),n[22](null),z(o,b),b&&k(r),n[23](null),z(a,b)}}}function MM(n,e,t){var K;let i,s,l,o,r;qt(n,ui,W=>t(2,s=W)),qt(n,Ms,W=>t(10,l=W)),qt(n,nn,W=>t(26,o=W)),qt(n,ea,W=>t(8,r=W));const a=Y.getQueryParams((K=window.location)==null?void 0:K.href);wn(nn,o="Collections",o);let u,f,c,d,m=a.filter||"",g=a.sort||"-created",v=a.collectionId;function b(){t(9,v=s.id),t(1,g="-created"),t(0,m="")}jw(v);const y=()=>u==null?void 0:u.show(),C=()=>u==null?void 0:u.show(s),$=()=>d==null?void 0:d.load(),S=()=>f==null?void 0:f.show(s),M=()=>c==null?void 0:c.show(),D=W=>t(0,m=W.detail);function E(W){he[W?"unshift":"push"](()=>{d=W,t(6,d)})}function O(W){m=W,t(0,m)}function F(W){g=W,t(1,g)}const L=W=>c==null?void 0:c.show(W==null?void 0:W.detail);function H(W){he[W?"unshift":"push"](()=>{u=W,t(3,u)})}function j(W){he[W?"unshift":"push"](()=>{f=W,t(4,f)})}function Q(W){he[W?"unshift":"push"](()=>{c=W,t(5,c)})}const ie=()=>d==null?void 0:d.load(),U=()=>d==null?void 0:d.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)&&v!=s.id&&b(),n.$$.dirty&7&&(g||m||(s==null?void 0:s.id))&&Y.replaceClientQueryParams({collectionId:s==null?void 0:s.id,filter:m,sort:g})},[m,g,s,u,f,c,d,i,r,v,l,y,C,$,S,M,D,E,O,F,L,H,j,Q,ie,U]}class TM extends Fe{constructor(e){super(),Le(this,e,MM,CM,Pe,{})}}function Gh(n){let e,t;return e=new Ie({props:{class:"form-field disabled",name:"id",$$slots:{default:[DM,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function DM(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="ID",o=T(),r=_("input"),h(t,"class",Y.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"for",l=n[31]),h(r,"type","text"),h(r,"id",a=n[31]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),p(e,t),p(e,i),p(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[1]&1&&l!==(l=f[31])&&h(e,"for",l),c[1]&1&&a!==(a=f[31])&&h(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Xh(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',h(e,"class","form-field-addon txt-success")},m(s,l){w(s,e,l),t||(i=et(Et.call(null,e,"Verified")),t=!0)},d(s){s&&k(e),t=!1,i()}}}function OM(n){let e,t,i,s,l,o,r,a,u,f,c,d=n[1].verified&&Xh();return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Email",o=T(),d&&d.c(),r=T(),a=_("input"),h(t,"class",Y.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"for",l=n[31]),h(a,"type","email"),h(a,"autocomplete","off"),h(a,"id",u=n[31]),a.required=!0},m(m,g){w(m,e,g),p(e,t),p(e,i),p(e,s),w(m,o,g),d&&d.m(m,g),w(m,r,g),w(m,a,g),$e(a,n[2]),f||(c=X(a,"input",n[19]),f=!0)},p(m,g){g[1]&1&&l!==(l=m[31])&&h(e,"for",l),m[1].verified?d||(d=Xh(),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[1]&1&&u!==(u=m[31])&&h(a,"id",u),g[0]&4&&a.value!==m[2]&&$e(a,m[2])},d(m){m&&k(e),m&&k(o),d&&d.d(m),m&&k(r),m&&k(a),f=!1,c()}}}function Qh(n){let e,t;return e=new Ie({props:{class:"form-field form-field-toggle",$$slots:{default:[EM,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function EM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Change password"),h(e,"type","checkbox"),h(e,"id",t=n[31]),h(s,"for",o=n[31])},m(u,f){w(u,e,f),e.checked=n[3],w(u,i,f),w(u,s,f),p(s,l),r||(a=X(e,"change",n[20]),r=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&h(e,"id",t),f[0]&8&&(e.checked=u[3]),f[1]&1&&o!==(o=u[31])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function xh(n){let e,t,i,s,l,o,r,a,u;return s=new Ie({props:{class:"form-field required",name:"password",$$slots:{default:[AM,({uniqueId:f})=>({31:f}),({uniqueId:f})=>[0,f?1:0]]},$$scope:{ctx:n}}}),r=new Ie({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[PM,({uniqueId:f})=>({31:f}),({uniqueId:f})=>[0,f?1:0]]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),i=_("div"),B(s.$$.fragment),l=T(),o=_("div"),B(r.$$.fragment),h(i,"class","col-sm-6"),h(o,"class","col-sm-6"),h(t,"class","grid"),h(e,"class","col-12")},m(f,c){w(f,e,c),p(e,t),p(t,i),V(s,i,null),p(t,l),p(t,o),V(r,o,null),u=!0},p(f,c){const d={};c[0]&128|c[1]&3&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const m={};c[0]&256|c[1]&3&&(m.$$scope={dirty:c,ctx:f}),r.$set(m)},i(f){u||(A(s.$$.fragment,f),A(r.$$.fragment,f),Lt(()=>{a||(a=at(t,on,{duration:150},!0)),a.run(1)}),u=!0)},o(f){P(s.$$.fragment,f),P(r.$$.fragment,f),a||(a=at(t,on,{duration:150},!1)),a.run(0),u=!1},d(f){f&&k(e),z(s),z(r),f&&a&&a.end()}}}function AM(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Password",o=T(),r=_("input"),h(t,"class","ri-lock-line"),h(s,"class","txt"),h(e,"for",l=n[31]),h(r,"type","password"),h(r,"autocomplete","new-password"),h(r,"id",a=n[31]),r.required=!0},m(c,d){w(c,e,d),p(e,t),p(e,i),p(e,s),w(c,o,d),w(c,r,d),$e(r,n[7]),u||(f=X(r,"input",n[21]),u=!0)},p(c,d){d[1]&1&&l!==(l=c[31])&&h(e,"for",l),d[1]&1&&a!==(a=c[31])&&h(r,"id",a),d[0]&128&&r.value!==c[7]&&$e(r,c[7])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function PM(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Password confirm",o=T(),r=_("input"),h(t,"class","ri-lock-line"),h(s,"class","txt"),h(e,"for",l=n[31]),h(r,"type","password"),h(r,"autocomplete","new-password"),h(r,"id",a=n[31]),r.required=!0},m(c,d){w(c,e,d),p(e,t),p(e,i),p(e,s),w(c,o,d),w(c,r,d),$e(r,n[8]),u||(f=X(r,"input",n[22]),u=!0)},p(c,d){d[1]&1&&l!==(l=c[31])&&h(e,"for",l),d[1]&1&&a!==(a=c[31])&&h(r,"id",a),d[0]&256&&r.value!==c[8]&&$e(r,c[8])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function ep(n){let e,t;return e=new Ie({props:{class:"form-field form-field-toggle",$$slots:{default:[LM,({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||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function LM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=R("Send verification email"),h(e,"type","checkbox"),h(e,"id",t=n[31]),h(s,"for",o=n[31])},m(u,f){w(u,e,f),e.checked=n[9],w(u,i,f),w(u,s,f),p(s,l),r||(a=X(e,"change",n[23]),r=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&h(e,"id",t),f[0]&512&&(e.checked=u[9]),f[1]&1&&o!==(o=u[31])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function FM(n){let e,t,i,s,l,o,r,a,u,f=!n[1].isNew&&Gh(n);i=new Ie({props:{class:"form-field required",name:"email",$$slots:{default:[OM,({uniqueId:g})=>({31:g}),({uniqueId:g})=>[0,g?1:0]]},$$scope:{ctx:n}}});let c=!n[1].isNew&&Qh(n),d=(n[1].isNew||n[3])&&xh(n),m=n[1].isNew&&ep(n);return{c(){e=_("form"),f&&f.c(),t=T(),B(i.$$.fragment),s=T(),c&&c.c(),l=T(),d&&d.c(),o=T(),m&&m.c(),h(e,"id",n[11]),h(e,"class","grid"),h(e,"autocomplete","off")},m(g,v){w(g,e,v),f&&f.m(e,null),p(e,t),V(i,e,null),p(e,s),c&&c.m(e,null),p(e,l),d&&d.m(e,null),p(e,o),m&&m.m(e,null),r=!0,a||(u=X(e,"submit",Qt(n[12])),a=!0)},p(g,v){g[1].isNew?f&&(De(),P(f,1,1,()=>{f=null}),Oe()):f?(f.p(g,v),v[0]&2&&A(f,1)):(f=Gh(g),f.c(),A(f,1),f.m(e,t));const b={};v[0]&6|v[1]&3&&(b.$$scope={dirty:v,ctx:g}),i.$set(b),g[1].isNew?c&&(De(),P(c,1,1,()=>{c=null}),Oe()):c?(c.p(g,v),v[0]&2&&A(c,1)):(c=Qh(g),c.c(),A(c,1),c.m(e,l)),g[1].isNew||g[3]?d?(d.p(g,v),v[0]&10&&A(d,1)):(d=xh(g),d.c(),A(d,1),d.m(e,o)):d&&(De(),P(d,1,1,()=>{d=null}),Oe()),g[1].isNew?m?(m.p(g,v),v[0]&2&&A(m,1)):(m=ep(g),m.c(),A(m,1),m.m(e,null)):m&&(De(),P(m,1,1,()=>{m=null}),Oe())},i(g){r||(A(f),A(i.$$.fragment,g),A(c),A(d),A(m),r=!0)},o(g){P(f),P(i.$$.fragment,g),P(c),P(d),P(m),r=!1},d(g){g&&k(e),f&&f.d(),z(i),c&&c.d(),d&&d.d(),m&&m.d(),a=!1,u()}}}function IM(n){let e,t=n[1].isNew?"New user":"Edit user",i;return{c(){e=_("h4"),i=R(t)},m(s,l){w(s,e,l),p(e,i)},p(s,l){l[0]&2&&t!==(t=s[1].isNew?"New user":"Edit user")&&me(i,t)},d(s){s&&k(e)}}}function tp(n){let e,t,i,s,l,o,r,a,u;return o=new qi({props:{class:"dropdown dropdown-upside dropdown-left dropdown-nowrap",$$slots:{default:[NM]},$$scope:{ctx:n}}}),{c(){e=_("button"),t=_("span"),i=T(),s=_("i"),l=T(),B(o.$$.fragment),r=T(),a=_("div"),h(s,"class","ri-more-line"),h(e,"type","button"),h(e,"class","btn btn-sm btn-circle btn-secondary"),h(a,"class","flex-fill")},m(f,c){w(f,e,c),p(e,t),p(e,i),p(e,s),p(e,l),V(o,e,null),w(f,r,c),w(f,a,c),u=!0},p(f,c){const d={};c[0]&2|c[1]&2&&(d.$$scope={dirty:c,ctx:f}),o.$set(d)},i(f){u||(A(o.$$.fragment,f),u=!0)},o(f){P(o.$$.fragment,f),u=!1},d(f){f&&k(e),z(o),f&&k(r),f&&k(a)}}}function np(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` - Send verification email`,h(e,"type","button"),h(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[16]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function NM(n){let e,t,i,s,l=!n[1].verified&&np(n);return{c(){l&&l.c(),e=T(),t=_("button"),t.innerHTML=` - Delete`,h(t,"type","button"),h(t,"class","dropdown-item")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),i||(s=X(t,"click",n[17]),i=!0)},p(o,r){o[1].verified?l&&(l.d(1),l=null):l?l.p(o,r):(l=np(o),l.c(),l.m(e.parentNode,e))},d(o){l&&l.d(o),o&&k(e),o&&k(t),i=!1,s()}}}function RM(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,m=!n[1].isNew&&tp(n);return{c(){m&&m.c(),e=T(),t=_("button"),i=_("span"),i.textContent="Cancel",s=T(),l=_("button"),o=_("span"),a=R(r),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-secondary"),t.disabled=n[5],h(o,"class","txt"),h(l,"type","submit"),h(l,"form",n[11]),h(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[5],ee(l,"btn-loading",n[5])},m(g,v){m&&m.m(g,v),w(g,e,v),w(g,t,v),p(t,i),w(g,s,v),w(g,l,v),p(l,o),p(o,a),f=!0,c||(d=X(t,"click",n[18]),c=!0)},p(g,v){g[1].isNew?m&&(De(),P(m,1,1,()=>{m=null}),Oe()):m?(m.p(g,v),v[0]&2&&A(m,1)):(m=tp(g),m.c(),A(m,1),m.m(e.parentNode,e)),(!f||v[0]&32)&&(t.disabled=g[5]),(!f||v[0]&2)&&r!==(r=g[1].isNew?"Create":"Save changes")&&me(a,r),(!f||v[0]&1056&&u!==(u=!g[10]||g[5]))&&(l.disabled=u),v[0]&32&&ee(l,"btn-loading",g[5])},i(g){f||(A(m),f=!0)},o(g){P(m),f=!1},d(g){m&&m.d(g),g&&k(e),g&&k(t),g&&k(s),g&&k(l),c=!1,d()}}}function HM(n){let e,t,i={popup:!0,class:"user-panel",beforeHide:n[24],$$slots:{footer:[RM],header:[IM],default:[FM]},$$scope:{ctx:n}};return e=new Ci({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 o={};l[0]&1088&&(o.beforeHide=s[24]),l[0]&1966|l[1]&2&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[25](null),z(e,s)}}}function jM(n,e,t){let i;const s=hn(),l="user_"+Y.randomString(5);let o,r=new co,a=!1,u=!1,f="",c="",d="",m=!1,g=!0;function v(J){return y(J),t(6,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function y(J){Ri({}),t(1,r=J!=null&&J.clone?J.clone():new co),C()}function C(){t(3,m=!1),t(9,g=!0),t(2,f=(r==null?void 0:r.email)||""),t(7,c=""),t(8,d="")}function $(){if(a||!i)return;t(5,a=!0);const J={email:f};(r.isNew||m)&&(J.password=c,J.passwordConfirm=d);let se;r.isNew?se=Se.Users.create(J):se=Se.Users.update(r.id,J),se.then(async fe=>{g&&M(!1),t(6,u=!1),b(),_n(r.isNew?"Successfully created user.":"Successfully updated user."),s("save",fe)}).catch(fe=>{Se.errorResponseHandler(fe)}).finally(()=>{t(5,a=!1)})}function S(){!(r!=null&&r.id)||Si("Do you really want to delete the selected user?",()=>Se.Users.delete(r.id).then(()=>{t(6,u=!1),b(),_n("Successfully deleted user."),s("delete",r)}).catch(J=>{Se.errorResponseHandler(J)}))}function M(J=!0){return Se.Users.requestVerification(r.isNew?f:r.email).then(()=>{t(6,u=!1),b(),J&&_n(`Successfully sent verification email to ${r.email}.`)}).catch(se=>{Se.errorResponseHandler(se)})}const D=()=>M(),E=()=>S(),O=()=>b();function F(){f=this.value,t(2,f)}function L(){m=this.checked,t(3,m)}function H(){c=this.value,t(7,c)}function j(){d=this.value,t(8,d)}function Q(){g=this.checked,t(9,g)}const ie=()=>i&&u?(Si("You have unsaved changes. Do you really want to close the panel?",()=>{t(6,u=!1),b()}),!1):!0;function U(J){he[J?"unshift":"push"](()=>{o=J,t(4,o)})}function K(J){pt.call(this,n,J)}function W(J){pt.call(this,n,J)}return n.$$.update=()=>{n.$$.dirty[0]&14&&t(10,i=r.isNew&&f!=""||m||f!==r.email)},[b,r,f,m,o,a,u,c,d,g,i,l,$,S,M,v,D,E,O,F,L,H,j,Q,ie,U,K,W]}class qM extends Fe{constructor(e){super(),Le(this,e,jM,HM,Pe,{show:15,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[0]}}function ip(n,e,t){const i=n.slice();return i[39]=e[t],i}function sp(n,e,t){const i=n.slice();return i[42]=e[t],i}function lp(n,e,t){const i=n.slice();return i[42]=e[t],i}function VM(n){let e,t,i,s,l,o,r,a,u,f,c,d,m,g,v,b,y,C,$,S,M,D,E,O,F,L,H=[],j=new Map,Q,ie,U,K,W,J,se,fe,ke,le,ue=[],Me=new Map,Z,be,x,G,_e;u=new zo({}),u.$on("refresh",n[17]),v=new Vo({props:{value:n[3],placeholder:"Search filter, eg. verified=1",extraAutocompleteKeys:["verified","email"]}}),v.$on("submit",n[19]);function je(te){n[20](te)}let Ne={class:"col-type-text col-field-id",name:"id",$$slots:{default:[BM]},$$scope:{ctx:n}};n[4]!==void 0&&(Ne.sort=n[4]),M=new rn({props:Ne}),he.push(()=>Re(M,"sort",je));function qe(te){n[21](te)}let ae={class:"col-type-email col-field-email",name:"email",$$slots:{default:[UM]},$$scope:{ctx:n}};n[4]!==void 0&&(ae.sort=n[4]),O=new rn({props:ae}),he.push(()=>Re(O,"sort",qe));let re=n[12];const ve=te=>te[42].name;for(let te=0;teRe(ie,"sort",Je));function ut(te){n[23](te)}let ot={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[YM]},$$scope:{ctx:n}};n[4]!==void 0&&(ot.sort=n[4]),W=new rn({props:ot}),he.push(()=>Re(W,"sort",ut));let Xe=n[1];const ge=te=>te[39].id;for(let te=0;te',a=T(),B(u.$$.fragment),f=T(),c=_("div"),d=T(),m=_("button"),m.innerHTML=` - New user`,g=T(),B(v.$$.fragment),b=T(),y=_("div"),C=_("table"),$=_("thead"),S=_("tr"),B(M.$$.fragment),E=T(),B(O.$$.fragment),L=T();for(let te=0;teD=!1)),M.$set(ft);const St={};ye[1]&65536&&(St.$$scope={dirty:ye,ctx:te}),!F&&ye[0]&16&&(F=!0,St.sort=te[4],He(()=>F=!1)),O.$set(St),ye[0]&4096&&(re=te[12],H=dt(H,ye,ve,1,te,re,j,S,cn,op,Q,lp));const $t={};ye[1]&65536&&($t.$$scope={dirty:ye,ctx:te}),!U&&ye[0]&16&&(U=!0,$t.sort=te[4],He(()=>U=!1)),ie.$set($t);const Nt={};ye[1]&65536&&(Nt.$$scope={dirty:ye,ctx:te}),!J&&ye[0]&16&&(J=!0,Nt.sort=te[4],He(()=>J=!1)),W.$set(Nt),ye[0]&5450&&(Xe=te[1],De(),ue=dt(ue,ye,ge,1,te,Xe,Me,le,Bt,fp,null,ip),Oe(),!Xe.length&&pe?pe.p(te,ye):Xe.length?pe&&(pe.d(1),pe=null):(pe=rp(te),pe.c(),pe.m(le,null))),ye[0]&1024&&ee(C,"table-loading",te[10]),te[1].length?Ve?Ve.p(te,ye):(Ve=cp(te),Ve.c(),Ve.m(e,be)):Ve&&(Ve.d(1),Ve=null),te[1].length&&te[13]?mt?mt.p(te,ye):(mt=dp(te),mt.c(),mt.m(e,null)):mt&&(mt.d(1),mt=null)},i(te){if(!x){A(u.$$.fragment,te),A(v.$$.fragment,te),A(M.$$.fragment,te),A(O.$$.fragment,te),A(ie.$$.fragment,te),A(W.$$.fragment,te);for(let ye=0;ye -

Loading users...

`,h(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:oe,i:oe,o:oe,d(t){t&&k(e)}}}function BM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",h(t,"class",Y.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function UM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="email",h(t,"class",Y.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function op(n,e){let t,i,s,l,o,r,a,u=e[42].name+"",f,c,d;return{key:n,first:null,c(){t=_("th"),i=_("div"),s=_("i"),o=T(),r=_("span"),a=R("profile."),f=R(u),h(s,"class",l=Y.getFieldTypeIcon(e[42].type)),h(r,"class","txt"),h(i,"class","col-header-content"),h(t,"class",c="col-type-"+e[42].type+" col-field-"+e[42].name),h(t,"name",d=e[42].name),this.first=t},m(m,g){w(m,t,g),p(t,i),p(i,s),p(i,o),p(i,r),p(r,a),p(r,f)},p(m,g){e=m,g[0]&4096&&l!==(l=Y.getFieldTypeIcon(e[42].type))&&h(s,"class",l),g[0]&4096&&u!==(u=e[42].name+"")&&me(f,u),g[0]&4096&&c!==(c="col-type-"+e[42].type+" col-field-"+e[42].name)&&h(t,"class",c),g[0]&4096&&d!==(d=e[42].name)&&h(t,"name",d)},d(m){m&&k(t)}}}function WM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function YM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",h(t,"class",Y.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),p(e,t),p(e,i),p(e,s)},p:oe,d(l){l&&k(e)}}}function rp(n){let e;function t(l,o){return l[10]?ZM:KM}let i=t(n),s=i(n);return{c(){s.c(),e=lt()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function KM(n){var r;let e,t,i,s,l,o=((r=n[3])==null?void 0:r.length)&&ap(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No users found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),p(e,t),p(t,i),p(t,s),o&&o.m(t,null),p(e,l)},p(a,u){var f;(f=a[3])!=null&&f.length?o?o.p(a,u):(o=ap(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function ZM(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:oe,d(t){t&&k(e)}}}function ap(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',h(e,"type","button"),h(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=X(e,"click",n[26]),t=!0)},p:oe,d(s){s&&k(e),t=!1,i()}}}function up(n,e){let t,i,s;return i=new g_({props:{field:e[42],record:e[39].profile||{}}}),{key:n,first:null,c(){t=lt(),B(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),V(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&4096&&(r.field=e[42]),o[0]&2&&(r.record=e[39].profile||{}),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function fp(n,e){let t,i,s,l,o,r,a,u=e[39].email+"",f,c,d,m,g=e[39].verified?"Verified":"Unverified",v,b,y=[],C=new Map,$,S,M,D,E,O,F,L,H,j,Q,ie,U,K,W;s=new Zo({props:{id:e[39].id}});let J=e[12];const se=le=>le[42].name;for(let le=0;le