@adia-ai/web-components 0.6.28 → 0.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,288 @@
1
+ var Sk=Object.defineProperty;var W=(s,t)=>()=>(s&&(t=s(s=0)),t);var Ht=(s,t)=>{for(var e in t)Sk(s,e,{get:t[e],enumerable:!0})};function nO(s,t,e,i){switch(s){case-2:return e<t;case-1:return i>=t&&e<t;case 0:return e<t&&i>t;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function Do(s,t,e,i){for(var n;s.from==s.to||(e<1?s.from>=t:s.from>t)||(e>-1?s.to<=t:s.to<t);){let o=!i&&s instanceof se&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:H.IgnoreOverlays;if(i)for(let o=s,a=o.parent;a;o=a,a=o.parent)o instanceof se&&o.index<0&&((n=a.enter(t,e,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=a);for(;;){let o=s.enter(t,e,r);if(!o)return s;s=o}}function rO(s,t,e,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(t)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function fu(s,t,e=t.length-1){for(let i=s;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}function oO(s){if(!s.length)return null;let t=0,e=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>e.from||o.to<e.to)&&(e=o,t=r)}let i=e instanceof se&&e.index<0?null:e.parent,n=s.slice();return i?n[t]=i:n.splice(t,1),new mu(n,e)}function P1(s,t,e){let i=s.resolveInner(t,e),n=null;for(let r=i instanceof se?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(t,e)),r=o}else{let o=ni.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new se(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Do(a,t,e,!1))}}return n?oO(n):i}function gu(s){return s.children.some(t=>t instanceof ri||!t.type.isAnonymous||gu(t))}function C1(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:n=1024,reused:r=[],minRepeatType:o=i.types.length}=s,a=Array.isArray(e)?new du(e,e.length):e,l=i.types,h=0,c=0;function u(S,$,k,P,T,C){let{id:I,start:X,end:N,size:_}=a,V=c,tt=h;if(_<0)if(a.next(),_==-1){let kt=r[I];k.push(kt),P.push(X-S);return}else if(_==-3){h=I;return}else if(_==-4){c=I;return}else throw new RangeError(`Unrecognized record size: ${_}`);let rt=l[I],pt,ut,yt=X-S;if(N-X<=n&&(ut=O(a.pos-$,T))){let kt=new Uint16Array(ut.size-ut.skip),vt=a.pos-ut.size,zt=kt.length;for(;a.pos>vt;)zt=g(ut.start,kt,zt);pt=new ri(kt,N-ut.start,i),yt=ut.start-S}else{let kt=a.pos-_;a.next();let vt=[],zt=[],jt=I>=o?I:-1,Qi=0,Fi=N;for(;a.pos>kt;)jt>=0&&a.id==jt&&a.size>=0?(a.end<=Fi-n&&(p(vt,zt,X,Qi,a.end,Fi,jt,V,tt),Qi=vt.length,Fi=a.end),a.next()):C>2500?d(X,kt,vt,zt):u(X,kt,vt,zt,jt,C+1);if(jt>=0&&Qi>0&&Qi<vt.length&&p(vt,zt,X,Qi,X,Fi,jt,V,tt),vt.reverse(),zt.reverse(),jt>-1&&Qi>0){let bg=f(rt,tt);pt=Ou(rt,vt,zt,0,vt.length,0,N-X,bg,bg)}else pt=m(rt,vt,zt,N-X,V-N,tt)}k.push(pt),P.push(yt)}function d(S,$,k,P){let T=[],C=0,I=-1;for(;a.pos>$;){let{id:X,start:N,end:_,size:V}=a;if(V>4)a.next();else{if(I>-1&&N<I)break;I<0&&(I=_-n),T.push(X,N,_),C++,a.next()}}if(C){let X=new Uint16Array(C*4),N=T[T.length-2];for(let _=T.length-3,V=0;_>=0;_-=3)X[V++]=T[_],X[V++]=T[_+1]-N,X[V++]=T[_+2]-N,X[V++]=V;k.push(new ri(X,T[2]-N,i)),P.push(N-S)}}function f(S,$){return(k,P,T)=>{let C=0,I=k.length-1,X,N;if(I>=0&&(X=k[I])instanceof Y){if(!I&&X.type==S&&X.length==T)return X;(N=X.prop(q.lookAhead))&&(C=P[I]+X.length+N)}return m(S,k,P,T,C,$)}}function p(S,$,k,P,T,C,I,X,N){let _=[],V=[];for(;S.length>P;)_.push(S.pop()),V.push($.pop()+k-T);S.push(m(i.types[I],_,V,C-T,X-C,N)),$.push(T-k)}function m(S,$,k,P,T,C,I){if(C){let X=[q.contextHash,C];I=I?[X].concat(I):[X]}if(T>25){let X=[q.lookAhead,T];I=I?[X].concat(I):[X]}return new Y(S,$,k,P,I)}function O(S,$){let k=a.fork(),P=0,T=0,C=0,I=k.end-n,X={size:0,start:0,skip:0};t:for(let N=k.pos-S;k.pos>N;){let _=k.size;if(k.id==$&&_>=0){X.size=P,X.start=T,X.skip=C,C+=4,P+=4,k.next();continue}let V=k.pos-_;if(_<0||V<N||k.start<I)break;let tt=k.id>=o?4:0,rt=k.start;for(k.next();k.pos>V;){if(k.size<0)if(k.size==-3||k.size==-4)tt+=4;else break t;else k.id>=o&&(tt+=4);k.next()}T=rt,P+=_,C+=tt}return($<0||P==S)&&(X.size=P,X.start=T,X.skip=C),X.size>4?X:void 0}function g(S,$,k){let{id:P,start:T,end:C,size:I}=a;if(a.next(),I>=0&&P<o){let X=k;if(I>4){let N=a.pos-(I-4);for(;a.pos>N;)k=g(S,$,k)}$[--k]=X,$[--k]=C-S,$[--k]=T-S,$[--k]=P}else I==-3?h=P:I==-4&&(c=P);return k}let y=[],v=[];for(;a.pos>0;)u(s.start||0,s.bufferStart||0,y,v,-1,0);let x=(t=s.length)!==null&&t!==void 0?t:y.length?v[0]+y[0].length:0;return new Y(l[s.topID],y.reverse(),v.reverse(),x)}function hl(s,t){if(!s.isAnonymous||t instanceof ri||t.type!=s)return 1;let e=aO.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof Y)){e=1;break}e+=hl(s,i)}aO.set(t,e)}return e}function Ou(s,t,e,i,n,r,o,a,l){let h=0;for(let p=i;p<n;p++)h+=hl(s,t[p]);let c=Math.ceil(h*1.5/8),u=[],d=[];function f(p,m,O,g,y){for(let v=O;v<g;){let x=v,S=m[v],$=hl(s,p[v]);for(v++;v<g;v++){let k=hl(s,p[v]);if($+k>=c)break;$+=k}if(v==x+1){if($>c){let k=p[x];f(k.children,k.positions,0,k.children.length,m[x]+y);continue}u.push(p[x])}else{let k=m[v-1]+p[v-1].length-S;u.push(Ou(s,p,m,x,v,S,k,null,l))}d.push(S+y-r)}}return f(t,e,i,n,0),(a||l)(u,d,o)}function os(s){return(t,e,i,n)=>new xu(t,s,e,i,n)}function lO(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}function E1(s,t,e){for(let i of s){if(i.from>=e)break;if(i.to>t)return i.from<=t&&i.to>=e?2:1}return 0}function hO(s,t,e,i,n,r){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),n.push(o-r)}}function T1(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let n=s.tree,r=n.children.indexOf(i),o=n.children[r],a=o.buffer,l=[r];function h(c,u,d,f,p,m){let O=e[m],g=[],y=[];hO(o,c,O,g,y,f);let v=a[O+1],x=a[O+2];l.push(g.length);let S=m?h(O+4,a[O+3],o.set.types[a[O]],v,x-v,m-1):t.toTree();return g.push(S),y.push(v-f),hO(o,a[O+3],u,g,y,f),new Y(d,g,y,p)}n.children[r]=h(0,a.length,ot.none,0,o.length,e.length-1);for(let c of l){let u=s.tree.children[c],d=s.tree.positions[c];s.yield(new se(u,d+s.from,c,s._tree))}}function cO(s,t){let e=null,i=t;for(let n=1,r=0;n<s.length;n++){let o=s[n-1].to,a=s[n].from;for(;r<i.length;r++){let l=i[r];if(l.from>=a)break;l.to<=o||(e||(i=e=t.slice()),l.from<o?(e[r]=new ie(l.from,o),l.to>a&&e.splice(r+1,0,new ie(a,l.to))):l.to>a?e[r--]=new ie(a,l.to):e.splice(r--,1))}}return i}function L1(s,t,e,i){let n=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=n==s.length?1e9:o?s[n].to:s[n].from,u=r==t.length?1e9:a?t[r].to:t[r].from;if(o!=a){let d=Math.max(l,e),f=Math.min(c,u,i);d<f&&h.push(new ie(d,f))}if(l=Math.min(c,u),l==1e9)break;c==l&&(o?(o=!1,n++):o=!0),u==l&&(a?(a=!1,r++):a=!0)}return h}function uO(s,t){let e=[];for(let{pos:i,mount:n,frag:r}of s){let o=i+(n.overlay?n.overlay[0].from:0),a=o+n.tree.length,l=Math.max(r.from,o),h=Math.min(r.to,a);if(n.overlay){let c=n.overlay.map(d=>new ie(d.from+i,d.to+i)),u=L1(t,c,l,h);for(let d=0,f=l;;d++){let p=d==u.length,m=p?h:u[d].from;if(m>f&&e.push(new Be(f,m,n.tree,-o,r.from>=f||r.openStart,r.to<=m||r.openEnd)),p)break;f=u[d].to}}else e.push(new Be(l,h,n.tree,-o,r.from>=o||r.openStart,r.to<=a||r.openEnd))}return e}var wu,A1,ie,q,ni,Q1,ot,ze,al,sO,H,Y,du,ri,ll,se,pu,ss,mu,ns,aO,rs,Be,je,bu,cl,yu,vu,xu,ul,Su,Ie=W(()=>{wu=1024,A1=0,ie=class{constructor(t,e){this.from=t,this.to=e}},q=class{constructor(t={}){this.id=A1++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=ot.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}};q.closedBy=new q({deserialize:s=>s.split(" ")}),q.openedBy=new q({deserialize:s=>s.split(" ")}),q.group=new q({deserialize:s=>s.split(" ")}),q.isolate=new q({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),q.contextHash=new q({perNode:!0}),q.lookAhead=new q({perNode:!0}),q.mounted=new q({perNode:!0});ni=class{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[q.mounted.id]}},Q1=Object.create(null),ot=class s{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):Q1,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new s(t.name||"",e,t.id,i);if(t.props){for(let r of t.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}}return n}prop(t){return this.props[t.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(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(q.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return i=>{for(let n=i.prop(q.group),r=-1;r<(n?n.length:0);r++){let o=e[r<0?i.name:n[r]];if(o)return o}}}};ot.none=new ot("",Object.create(null),0,8);ze=class s{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let n=null;for(let r of t){let o=r(i);if(o){n||(n=Object.assign({},i.props));let a=o[1],l=o[0];l.combine&&l.id in n&&(a=l.combine(n[l.id],a)),n[l.id]=a}}e.push(n?new ot(i.name,n,i.id,i.flags):i)}return new s(e)}},al=new WeakMap,sO=new WeakMap;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(H||(H={}));Y=class s{constructor(t,e,i,n,r){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,a]of r)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=ni.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let n=i.toString();n&&(e&&(e+=","),e+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new ns(this.topNode,t)}cursorAt(t,e=0,i=0){let n=al.get(this)||this.topNode,r=new ns(n);return r.moveTo(t,e),al.set(this,r._tree),r}get topNode(){return new se(this,0,0,null)}resolve(t,e=0){let i=Do(al.get(this)||this.topNode,t,e,!1);return al.set(this,i),i}resolveInner(t,e=0){let i=Do(sO.get(this)||this.topNode,t,e,!0);return sO.set(this,i),i}resolveStack(t,e=0){return P1(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,o=t.mode||0,a=(o&H.IncludeAnonymous)>0;for(let l=this.cursor(o|H.IncludeAnonymous);;){let h=!1;if(l.from<=r&&l.to>=n&&(!a&&l.type.isAnonymous||e(l)!==!1)){if(l.firstChild())continue;h=!0}for(;h&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ou(ot.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new s(this.type,e,i,n,this.propValues),t.makeTree||((e,i,n)=>new s(ot.none,e,i,n)))}static build(t){return C1(t)}};Y.empty=new Y(ot.none,[],[],0);du=class s{constructor(t,e){this.buffer=t,this.index=e}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 s(this.buffer,this.index)}},ri=class s{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return ot.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],n=this.set.types[e],r=n.name;if(/\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),t+=4,i==t)return r;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}findChild(t,e,i,n,r){let{buffer:o}=this,a=-1;for(let l=t;l!=e&&!(nO(r,n,o[l+1],o[l+2])&&(a=l,i>0));l=o[l+3]);return a}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),o=0;for(let a=t,l=0;a<e;){r[l++]=n[a++],r[l++]=n[a++]-i;let h=r[l++]=n[a++]-i;r[l++]=n[a++]-t,o=Math.max(o,h)}return new s(r,o,this.set)}};ll=class{cursor(t=0){return new ns(this,t)}getChild(t,e=null,i=null){let n=rO(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return rO(this,t,e,i)}resolve(t,e=0){return Do(this,t,e,!1)}resolveInner(t,e=0){return Do(this,t,e,!0)}matchContext(t){return fu(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let n=e.lastChild;if(!n||n.to!=e.to)break;n.type.isError&&n.from==n.to?(i=e,e=n.prevSibling):e=n}return i}get node(){return this}get next(){return this.parent}},se=class s extends ll{constructor(t,e,i,n){super(),this._tree=t,this.from=e,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,n,r=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,h=e>0?a.length:-1;t!=h;t+=e){let c=a[t],u=l[t]+o.from,d;if(!(!(r&H.EnterBracketed&&c instanceof Y&&(d=ni.get(c))&&!d.overlay&&d.bracketed&&i>=u&&i<=u+c.length)&&!nO(n,i,u,u+c.length))){if(c instanceof ri){if(r&H.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,e,i-u,n);if(f>-1)return new ss(new pu(o,c,t,u),null,f)}else if(r&H.IncludeAnonymous||!c.type.isAnonymous||gu(c)){let f;if(!(r&H.IgnoreMounts)&&(f=ni.get(c))&&!f.overlay)return new s(f.tree,u,t,o);let p=new s(c,u,t,o);return r&H.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?c.children.length-1:0,e,i,n,r)}}}if(r&H.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let n;if(!(i&H.IgnoreOverlays)&&(n=ni.get(this._tree))&&n.overlay){let r=t-this.from,o=i&H.EnterBracketed&&n.bracketed;for(let{from:a,to:l}of n.overlay)if((e>0||o?a<=r:a<r)&&(e<0||o?l>=r:l>r))return new s(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};pu=class{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}},ss=class s extends ll{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new s(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&H.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new s(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new s(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new s(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];t.push(i.slice(n,r,o)),e.push(0)}return new Y(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};mu=class{constructor(t,e){this.heads=t,this.node=e}get next(){return oO(this.heads)}};ns=class{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~H.EnterBracketed,t instanceof se)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return t?t instanceof se?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-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(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&H.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&H.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&H.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let r=e+t,o=t<0?-1:i._tree.children.length;r!=o;r+=t){let a=i._tree.children[r];if(this.mode&H.IncludeAnonymous||a instanceof ri||!a.type.isAnonymous||gu(a))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,r=this.stack.length;r>=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,i=r+1;break t}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)e=new ss(this.buffer,e,this.stack[n]);return this.bufferNode=new ss(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return fu(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return fu(this._tree,t,n);let o=i[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};aO=new WeakMap;rs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof ss?this.setBuffer(t.context.buffer,t.index,e):t instanceof se&&this.map.set(t.tree,e)}get(t){return t instanceof ss?this.getBuffer(t.context.buffer,t.index):t instanceof se?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},Be=class s{constructor(t,e,i,n,r=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let n=[new s(0,t.length,t,0,!1,i)];for(let r of e)r.to>t.length&&n.push(r);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=1,o=t.length?t[0]:null;for(let a=0,l=0,h=0;;a++){let c=a<e.length?e[a]:null,u=c?c.fromA:1e9;if(u-l>=i)for(;o&&o.from<u;){let d=o;if(l>=d.from||u<=d.to||h){let f=Math.max(d.from,l)-h,p=Math.min(d.to,u)-h;d=f>=p?null:new s(f,p,d.tree,d.offset+h,a>0,!!c)}if(d&&n.push(d),o.to>u)break;o=r<t.length?t[r++]:null}if(!c)break;l=c.toA,h=c.toA-c.toB}return n}},je=class{startParse(t,e,i){return typeof t=="string"&&(t=new bu(t)),i=i?i.length?i.map(n=>new ie(n.from,n.to)):[new ie(0,0)]:[new ie(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let r=n.advance();if(r)return r}}},bu=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};cl=class{constructor(t,e,i,n,r,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=n,this.target=r,this.from=o}};yu=class{constructor(t,e,i,n,r,o,a,l){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=r,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}},vu=new q({perNode:!0}),xu=class{constructor(t,e,i,n,r){this.nest=e,this.input=i,this.fragments=n,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Y(i.type,i.children,i.positions,i.length,i.propValues.concat([[vu,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[q.mounted.id]=new ni(e,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new Su(this.fragments),e=null,i=null,n=new ns(new se(this.baseTree,this.ranges[0].from,0,null),H.IncludeAnonymous|H.IgnoreMounts);t:for(let r,o;;){let a=!0,l;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)a=!1;else if(t.hasNode(n)){if(e){let h=e.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let u=c.from+h.pos,d=c.to+h.pos;u>=n.from&&d<=n.to&&!e.ranges.some(f=>f.from<d&&f.to>u)&&e.ranges.push({from:u,to:d})}}a=!1}else if(i&&(o=E1(i.ranges,n.from,n.to)))a=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.from<n.to||!r.overlay)){n.tree||(T1(n),e&&e.depth++,i&&i.depth++);let h=t.findMounts(n.from,r.parser);if(typeof r.overlay=="function")e=new yu(r.parser,r.overlay,h,this.inner.length,n.from,!!r.bracketed,n.tree,e);else{let c=cO(this.ranges,r.overlay||(n.from<n.to?[new ie(n.from,n.to)]:[]));c.length&&lO(c),(c.length||!r.overlay)&&this.inner.push(new cl(r.parser,c.length?r.parser.startParse(this.input,uO(h,c),c):r.parser.startParse(""),r.overlay?r.overlay.map(u=>new ie(u.from-n.from,u.to-n.from)):null,!!r.bracketed,n.tree,c.length?c[0].from:n.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):a=!1}}else if(e&&(l=e.predicate(n))&&(l===!0&&(l=new ie(n.from,n.to)),l.from<l.to)){let h=e.ranges.length-1;h>=0&&e.ranges[h].to==l.from?e.ranges[h]={from:e.ranges[h].from,to:l.to}:e.ranges.push(l)}if(a&&n.firstChild())e&&e.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break t;if(e&&!--e.depth){let h=cO(this.ranges,e.ranges);h.length&&(lO(h),this.inner.splice(e.index,0,new cl(e.parser,e.parser.startParse(this.input,uO(e.mounts,h),h),e.ranges.map(c=>new ie(c.from-e.start,c.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}};ul=class{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(H.IncludeAnonymous|H.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)if(!(e.to>=t&&e.enter(i,1,H.IgnoreOverlays|H.ExcludeBuffers)))if(e.to<=t)e.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(e.children.length&&e.positions[0]==0&&e.children[0]instanceof Y)e=e.children[0];else break}return!1}},Su=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(e=i.tree.prop(vu))!==null&&e!==void 0?e:i.to,this.inner=new ul(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(vu))!==null&&t!==void 0?t:e.to,this.inner=new ul(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(q.mounted);if(o&&o.parser==e)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=r.to)break;l.tree==this.curFrag.tree&&n.push({frag:l,pos:r.from-l.offset,mount:o})}}}return n}}});function qo(s,t=Uint16Array){if(typeof s!="string")return s;let e=null;for(let i=0,n=0;i<s.length;){let r=0;for(;;){let o=s.charCodeAt(i++),a=!1;if(o==126){r=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}e?e[n++]=r:e=new t(r)}return e}function fO(s,t,e,i,n,r){let o=0,a=1<<i,{dialect:l}=e.p.parser;t:for(;(a&s[o])!=0;){let h=s[o+1];for(let f=o+3;f<h;f+=2)if((s[f+1]&a)>0){let p=s[f];if(l.allows(p)&&(t.token.value==-1||t.token.value==p||M1(p,t.token.value,n,r))){t.acceptToken(p);break}}let c=t.next,u=0,d=s[o+2];if(t.next<0&&d>u&&s[h+d*3-3]==65535){o=s[h+d*3-1];continue t}for(;u<d;){let f=u+d>>1,p=h+f+(f<<1),m=s[p],O=s[p+1]||65536;if(c<m)d=f;else if(c>=O)u=f+1;else{o=s[p+2],t.advance();continue t}}break}}function pO(s,t,e){for(let i=t,n;(n=s[i])!=65535;i++)if(n==e)return i-t;return-1}function M1(s,t,e,i){let n=pO(e,i,t);return n<0||pO(e,i,s)<n}function mO(s,t,e){let i=s.cursor(H.IncludeAnonymous);for(i.moveTo(t);;)if(!(e<0?i.childBefore(t):i.childAfter(t)))for(;;){if((e<0?i.to<t:i.from>t)&&!i.type.isError)return e<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(s.length,Math.max(i.from+1,t+25));if(e<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return e<0?0:s.length}}function gO(s,t){for(let e=0;e<t.length;e++){let i=t[e];if(i.pos==s.pos&&i.sameState(s)){t[e].score<s.score&&(t[e]=s);return}}t.push(s)}function oi(s,t){return s[t]|s[t+1]<<16}function R1(s){let t=null;for(let e of s){let i=e.p.stoppedAt;(e.pos==e.p.stream.end||i!=null&&e.pos>i)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function OO(s){if(s.external){let t=s.extend?1:0;return(e,i)=>s.external(e,i)<<1|t}return s.get}var dl,fl,ku,$u,sr,dO,pl,Ei,ai,at,ge,Au,Qu,Pu,Cu,Eu,Tu,li,Nt,as=W(()=>{Ie();dl=class s{constructor(t,e,i,n,r,o,a,l,h,c=0,u){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=r,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=h,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new s(t,[],e,i,i,0,[],0,n?new fl(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=t&65535,{parser:r}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),i==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(n,this.reducePos);return}let l=this.stack.length-(i-1)*3-(t&262144?6:0),h=l?this.stack[l-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&h==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-h;c>=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let u=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-u;if(n<r.minRepeatTerm||t&131072){let f=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,h,f,d+4,!0)}if(t&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=r.getGoto(f,n,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(n,h)}storeNode(t,e,i,n=4,r=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(e==i)return;if(this.buffer[o-2]>=e){this.buffer[o-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(t,e,i,n);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>i;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(t,e,i,n){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let r=t,{parser:o}=this.p;this.pos=n;let a=o.stateFlag(r,1);!a&&(n>i||e<=o.maxNode)&&(this.reducePos=n),this.pushState(r,a?i:Math.min(i,this.reducePos)),this.shiftContext(e,i),e<=o.maxNode&&this.buffer.push(e,i,n,4)}else this.pos=n,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,n,4)}apply(t,e,i,n){t&65536?this.reduce(t):this.shift(t,e,i,n)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new ku(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(i==0)return!1;if((i&65536)==0)return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let r=0,o;r<e.length;r+=2)(o=e[r+1])!=this.state&&this.p.parser.hasAction(o,t)&&n.push(e[r],o);if(this.stack.length<120)for(let r=0;n.length<8&&r<e.length;r+=2){let o=e[r+1];n.some((a,l)=>l&1&&a==o)||n.push(e[r],o)}e=n}let i=[];for(let n=0;n<e.length&&i.length<4;n+=2){let r=e[n+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(e[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let i=e>>19,n=e&65535,r=this.stack.length-i*3;if(r<0||t.getGoto(this.stack[r],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],i=(n,r)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&t.getGoto(this.stack[h],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,r+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new fl(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},fl=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},ku=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,i=t>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},$u=class s{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new s(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new s(this.stack,this.pos,this.index)}};sr=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},dO=new sr,pl=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=dO,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,r=this.pos+t;for(;r<i.from;){if(!n)return null;let o=this.ranges[--n];r-=i.from-o.to,i=o}for(;e<0?r>i.to:r>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];r+=o.from-i.to,i=o}return r}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,i,n;if(e>=0&&e<this.chunk.length)i=this.pos+t,n=this.chunk.charCodeAt(e);else{let r=this.resolveOffset(t,1);if(r==null)return-1;if(i=r,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=i;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=i}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=dO,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}},Ei=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;fO(this.data,t,e,this.id,i.data,i.tokenPrecTable)}};Ei.prototype.contextual=Ei.prototype.fallback=Ei.prototype.extend=!1;ai=class{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data=typeof t=="string"?qo(t):t}token(t,e){let i=t.pos,n=0;for(;;){let r=t.next<0,o=t.resolveOffset(1,1);if(fO(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(r||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}};ai.prototype.contextual=Ei.prototype.fallback=Ei.prototype.extend=!1;at=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};ge=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),Au=null;Qu=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?mO(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?mO(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let i=this.trees[e],n=this.index[e];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[n],o=this.start[e]+i.positions[n];if(o>t)return this.nextStart=o,null;if(r instanceof Y){if(o==t){if(o<this.safeFrom)return null;let a=o+r.length;if(a<=this.safeTo){let l=r.prop(q.lookAhead);if(!l||a+l<this.fragment.to)return r}}this.index[e]++,o+r.length>=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}},Pu=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(i=>new sr)}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:r}=n,o=n.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,l=0;for(let h=0;h<r.length;h++){if((1<<h&o)==0)continue;let c=r[h],u=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||u.start!=t.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,c,t),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let d=e;if(u.extended>-1&&(e=this.addActions(t,u.extended,u.end,e)),e=this.addActions(t,u.value,u.end,e),!c.extend&&(i=u,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),!i&&t.pos==this.stream.end&&(i=new sr,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new sr,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:r}=i.p;for(let o=0;o<r.specialized.length;o++)if(r.specialized[o]==t.value){let a=r.specializers[o](this.stream.read(t.start,t.end),i);if(a>=0&&i.p.parser.dialect.allows(a>>1)){(a&1)==0?t.value=a>>1:t.extended=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let r=0;r<n;r+=3)if(this.actions[r]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=i,n}addActions(t,e,i,n){let{state:r}=t,{parser:o}=t.p,{data:a}=o;for(let l=0;l<2;l++)for(let h=o.stateSlot(r,l?2:1);;h+=3){if(a[h]==65535)if(a[h+1]==1)h=oi(a,h+2);else{n==0&&a[h+1]==2&&(n=this.putAction(oi(a,h+2),e,i,n));break}a[h]==e&&(n=this.putAction(oi(a,h+1),e,i,n))}return n}},Cu=class{constructor(t,e,i,n){this.parser=t,this.input=e,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new pl(e,n),this.tokens=new Pu(t,this.stream),this.topTerm=t.top[1];let{from:r}=n[0];this.stacks=[dl.start(this,t.top[0],r)],this.fragments=i.length&&this.stream.end-r>t.bufferLength*4?new Qu(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,i=this.stacks=[],n,r;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<t.length;o++){let a=t[o];for(;;){if(this.tokens.mainToken=null,a.pos>e)i.push(a);else{if(this.advanceStack(a,i,t))continue;{n||(n=[],r=[]),n.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=n&&R1(n);if(o)return ge&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ge&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,r,i);if(o)return ge&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>e)&&this.recovering--}else if(i.length>1){t:for(let o=0;o<i.length-1;o++){let a=i[o];for(let l=o+1;l<i.length;l++){let h=i[l];if(a.sameState(h)||a.buffer.length>500&&h.buffer.length>500)if((a.score-h.score||a.buffer.length-h.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue t}}}i.length>12&&(i.sort((o,a)=>a.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,i){let n=t.pos,{parser:r}=this,o=ge?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,c=h?t.curContext.hash:0;for(let u=this.fragments.nodeAt(n);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?r.getGoto(t.state,u.type.id):-1;if(d>-1&&u.length&&(!h||(u.prop(q.contextHash)||0)==c))return t.useNode(u,d),ge&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(u.type.id)})`),!0;if(!(u instanceof Y)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof Y&&u.positions[0]==0)u=f;else break}}let a=r.stateSlot(t.state,4);if(a>0)return t.reduce(a),ge&&console.log(o+this.stackID(t)+` (via always-reduce ${r.getName(a&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let l=this.tokens.getActions(t);for(let h=0;h<l.length;){let c=l[h++],u=l[h++],d=l[h++],f=h==l.length||!i,p=f?t:t.split(),m=this.tokens.mainToken;if(p.apply(c,u,m?m.start:p.pos,d),ge&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${r.getName(c&65535)}`} for ${r.getName(u)} @ ${n}${p==t?"":", split"})`),f)return!0;p.pos>n?e.push(p):i.push(p)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return gO(t,e),!0}}runRecovery(t,e,i){let n=null,r=!1;for(let o=0;o<t.length;o++){let a=t[o],l=e[o<<1],h=e[(o<<1)+1],c=ge?this.stackID(a)+" -> ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),ge&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let u=a.split(),d=c;for(let f=0;f<10&&u.forceReduce()&&(ge&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));f++)ge&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))ge&&console.log(c+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,i);this.stream.end>a.pos?(h==a.pos&&(h++,l=0),a.recoverByDelete(l,h),ge&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),gO(a,i)):(!n||n.score<u.score)&&(n=u)}return n}stackToTree(t){return t.close(),Y.build({buffer:$u.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(Au||(Au=new WeakMap)).get(t);return e||Au.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}};Eu=class{constructor(t,e,i){this.source=t,this.flags=e,this.disabled=i}allows(t){return!this.disabled||this.disabled[t]==0}},Tu=s=>s,li=class{constructor(t){this.start=t.start,this.shift=t.shift||Tu,this.reduce=t.reduce||Tu,this.reuse=t.reuse||Tu,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},Nt=class s extends je{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let a=0;a<t.repeatNodeCount;a++)e.push("");let i=Object.keys(t.topRules).map(a=>t.topRules[a][1]),n=[];for(let a=0;a<e.length;a++)n.push([]);function r(a,l,h){n[a].push([l,l.deserialize(String(h))])}if(t.nodeProps)for(let a of t.nodeProps){let l=a[0];typeof l=="string"&&(l=q[l]);for(let h=1;h<a.length;){let c=a[h++];if(c>=0)r(c,l,a[h++]);else{let u=a[h+-c];for(let d=-c;d>0;d--)r(a[h++],l,u);h++}}}this.nodeSet=new ze(e.map((a,l)=>ot.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:i.indexOf(l)>-1,error:l==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(l)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=qo(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(OO),this.states=qo(t.states,Uint32Array),this.data=qo(t.stateData),this.goto=qo(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(a=>typeof a=="number"?new Ei(o,a):a),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new Cu(this,t,e,i);for(let r of this.wrappers)n=r(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let r=n[e+1];;){let o=n[r++],a=o&1,l=n[r++];if(a&&i)return l;for(let h=r+(o>>1);r<h;r++)if(n[r]==t)return l;if(a)return-1}}hasAction(t,e){let i=this.data;for(let n=0;n<2;n++)for(let r=this.stateSlot(t,n?2:1),o;;r+=3){if((o=i[r])==65535)if(i[r+1]==1)o=i[r=oi(i,r+2)];else{if(i[r+1]==2)return oi(i,r+2);break}if(o==e||o==0)return oi(i,r+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,i=>i==e?!0:null)}allActions(t,e){let i=this.stateSlot(t,4),n=i?e(i):void 0;for(let r=this.stateSlot(t,1);n==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=oi(this.data,r+2);else break;n=e(oi(this.data,r+1))}return n}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=oi(this.data,i+2);else break;if((this.data[i+2]&1)==0){let n=this.data[i+1];e.some((r,o)=>o&1&&r==n)||e.push(this.data[i],n)}}return e}configure(t){let e=Object.assign(Object.create(s.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(i=>{let n=t.tokenizers.find(r=>r.from==i);return n?n.to:i})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((i,n)=>{let r=t.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return e.specializers[n]=OO(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map(()=>!1);if(t)for(let r of t.split(" ")){let o=e.indexOf(r);o>=0&&(i[o]=!0)}let n=null;for(let r=0;r<e.length;r++)if(!i[r])for(let o=this.dialects[e[r]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new Eu(t,i,n)}static deserialize(t){return new s(t)}}});function Z1(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function D1(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,n=t.length;i<n;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function $t(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let n of e.split(" "))if(n){let r=[],o=2,a=n;for(let u=0;;){if(a=="..."&&u>0&&u+3==n.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+n);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==n.length)break;let f=n[u++];if(u==n.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+n);a=n.slice(u)}let l=r.length-1,h=r[l];if(!h)throw new RangeError("Invalid path: "+n);let c=new ls(i,o,l>0?r.slice(0,l):null);t[h]=c.sort(t[h])}}return bO.add(t)}function yl(s,t){let e=Object.create(null);for(let r of s)if(!Array.isArray(r.tag))e[r.tag.id]=r.class;else for(let o of r.tag)e[o.id]=r.class;let{scope:i,all:n=null}=t||{};return{style:r=>{let o=n;for(let a of r)for(let l of a.set){let h=e[l.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function q1(s,t){let e=null;for(let i of s){let n=i.style(t);n&&(e=e?e+" "+n:n)}return e}function vl(s,t,e,i=0,n=s.length){let r=new Lu(i,Array.isArray(t)?t:[t],e);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}function B1(s,t,e,i,n,r=0,o=s.length){let a=r;function l(h,c){if(!(h<=a)){for(let u=s.slice(a,h),d=0;;){let f=u.indexOf(`
2
+ `,d),p=f<0?u.length:f;if(p>d&&i(u.slice(d,p),c),f<0)break;n(),d=f+1}a=h}}vl(t,e,(h,c,u)=>{l(h,""),l(c,u)},r,o),l(o,"")}function yO(s){let t=s.type.prop(bO);for(;t&&t.context&&!s.matchContext(t.context);)t=t.next;return t||null}var X1,ne,I1,ml,bO,ls,Lu,M,gl,Ti,vO,xO,Li,Ol,Mu,Ne,hs,_e,Ve,Ru,Bo,bl,b,z1,We=W(()=>{Ie();X1=0,ne=class s{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=X1++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i=typeof t=="string"?t:"?";if(t instanceof s&&(e=t),e?.base)throw new Error("Can not derive from a modified tag");let n=new s(i,[],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(t){let e=new ml(t);return i=>i.modified.indexOf(e)>-1?i:ml.get(i.base||i,i.modified.concat(e).sort((n,r)=>n.id-r.id))}},I1=0,ml=class s{constructor(t){this.name=t,this.instances=[],this.id=I1++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(a=>a.base==t&&Z1(e,a.modified));if(i)return i;let n=[],r=new ne(t.name,n,t,e);for(let a of e)a.instances.push(r);let o=D1(e);for(let a of t.set)if(!a.modified.length)for(let l of o)n.push(s.get(a,l));return r}};bO=new q({combine(s,t){let e,i,n;for(;s||t;){if(!s||t&&s.depth>=t.depth?(n=t,t=t.next):(n=s,s=s.next),e&&e.mode==n.mode&&!n.context&&!e.context)continue;let r=new ls(n.tags,n.mode,n.context);e?e.next=r:i=r,e=r}return i}}),ls=class{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}};ls.empty=new ls([],2,null);Lu=class{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,r){let{type:o,from:a,to:l}=t;if(a>=i||l<=e)return;o.isTop&&(r=this.highlighters.filter(f=>!f.scope||f.scope(o)));let h=n,c=yO(t)||ls.empty,u=q1(r,c.tags);if(u&&(h&&(h+=" "),h+=u,c.mode==1&&(n+=(n?" ":"")+u)),this.startSpan(Math.max(e,a),h),c.opaque)return;let d=t.tree&&t.tree.prop(q.mounted);if(d&&d.overlay){let f=t.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(O=>!O.scope||O.scope(d.tree.type)),m=t.firstChild();for(let O=0,g=a;;O++){let y=O<d.overlay.length?d.overlay[O]:null,v=y?y.from+a:l,x=Math.max(e,g),S=Math.min(i,v);if(x<S&&m)for(;t.from<S&&(this.highlightRange(t,x,S,n,r),this.startSpan(Math.min(S,t.to),h),!(t.to>=v||!t.nextSibling())););if(!y||v>i)break;g=y.to+a,g>e&&(this.highlightRange(f.cursor(),Math.max(e,y.from+a),Math.min(i,g),"",p),this.startSpan(Math.min(i,g),h))}m&&t.parent()}else if(t.firstChild()){d&&(n="");do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}};M=ne.define,gl=M(),Ti=M(),vO=M(Ti),xO=M(Ti),Li=M(),Ol=M(Li),Mu=M(Li),Ne=M(),hs=M(Ne),_e=M(),Ve=M(),Ru=M(),Bo=M(Ru),bl=M(),b={comment:gl,lineComment:M(gl),blockComment:M(gl),docComment:M(gl),name:Ti,variableName:M(Ti),typeName:vO,tagName:M(vO),propertyName:xO,attributeName:M(xO),className:M(Ti),labelName:M(Ti),namespace:M(Ti),macroName:M(Ti),literal:Li,string:Ol,docString:M(Ol),character:M(Ol),attributeValue:M(Ol),number:Mu,integer:M(Mu),float:M(Mu),bool:M(Li),regexp:M(Li),escape:M(Li),color:M(Li),url:M(Li),keyword:_e,self:M(_e),null:M(_e),atom:M(_e),unit:M(_e),modifier:M(_e),operatorKeyword:M(_e),controlKeyword:M(_e),definitionKeyword:M(_e),moduleKeyword:M(_e),operator:Ve,derefOperator:M(Ve),arithmeticOperator:M(Ve),logicOperator:M(Ve),bitwiseOperator:M(Ve),compareOperator:M(Ve),updateOperator:M(Ve),definitionOperator:M(Ve),typeOperator:M(Ve),controlOperator:M(Ve),punctuation:Ru,separator:M(Ru),bracket:Bo,angleBracket:M(Bo),squareBracket:M(Bo),paren:M(Bo),brace:M(Bo),content:Ne,heading:hs,heading1:M(hs),heading2:M(hs),heading3:M(hs),heading4:M(hs),heading5:M(hs),heading6:M(hs),contentSeparator:M(Ne),list:M(Ne),quote:M(Ne),emphasis:M(Ne),strong:M(Ne),link:M(Ne),monospace:M(Ne),strikethrough:M(Ne),inserted:M(),deleted:M(),changed:M(),invalid:M(),meta:bl,documentMeta:M(bl),annotation:M(bl),processingInstruction:M(bl),definition:ne.defineModifier("definition"),constant:ne.defineModifier("constant"),function:ne.defineModifier("function"),standard:ne.defineModifier("standard"),local:ne.defineModifier("local"),special:ne.defineModifier("special")};for(let s in b){let t=b[s];t instanceof ne&&(t.name=s)}z1=yl([{tag:b.link,class:"tok-link"},{tag:b.heading,class:"tok-heading"},{tag:b.emphasis,class:"tok-emphasis"},{tag:b.strong,class:"tok-strong"},{tag:b.keyword,class:"tok-keyword"},{tag:b.atom,class:"tok-atom"},{tag:b.bool,class:"tok-bool"},{tag:b.url,class:"tok-url"},{tag:b.labelName,class:"tok-labelName"},{tag:b.inserted,class:"tok-inserted"},{tag:b.deleted,class:"tok-deleted"},{tag:b.literal,class:"tok-literal"},{tag:b.string,class:"tok-string"},{tag:b.number,class:"tok-number"},{tag:[b.regexp,b.escape,b.special(b.string)],class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.local(b.variableName),class:"tok-variableName tok-local"},{tag:b.definition(b.variableName),class:"tok-variableName tok-definition"},{tag:b.special(b.variableName),class:"tok-variableName2"},{tag:b.definition(b.propertyName),class:"tok-propertyName tok-definition"},{tag:b.typeName,class:"tok-typeName"},{tag:b.namespace,class:"tok-namespace"},{tag:b.className,class:"tok-className"},{tag:b.macroName,class:"tok-macroName"},{tag:b.propertyName,class:"tok-propertyName"},{tag:b.operator,class:"tok-operator"},{tag:b.comment,class:"tok-comment"},{tag:b.meta,class:"tok-meta"},{tag:b.invalid,class:"tok-invalid"},{tag:b.punctuation,class:"tok-punctuation"}])});var j1,Xu,SO=W(()=>{as();We();j1=$t({String:b.string,Number:b.number,"True False":b.bool,PropertyName:b.propertyName,Null:b.null,", :":b.separator,"[ ]":b.squareBracket,"{ }":b.brace}),Xu=Nt.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[j1],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0})});function N1(s){if(s<768)return!1;for(let t=0,e=zo.length;;){let i=t+e>>1;if(s<zo[i])e=i;else if(s>=Iu[i])t=i+1;else return!0;if(t==e)return!1}}function wO(s){return s>=127462&&s<=127487}function $D(s){for(let t=0;t<zo.length;t++)if(Iu[t]>s)return zo[t]<=s;return!1}function CO(s,t,e=!0,i=!0){return(e?$O:_1)(s,t,i)}function $O(s,t,e){if(t==s.length)return t;t&&AO(s.charCodeAt(t))&&QO(s.charCodeAt(t-1))&&t--;let i=Zu(s,t);for(t+=PO(i);t<s.length;){let n=Zu(s,t);if(i==kO||n==kO||e&&N1(n))t+=PO(n),i=n;else if(wO(n)){let r=0,o=t-2;for(;o>=0&&wO(Zu(s,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function _1(s,t,e){for(;t>0;){let i=$O(s,t-2,e);if(i<t)return i;t--}return 0}function Zu(s,t){let e=s.charCodeAt(t);if(!QO(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return AO(i)?(e-55296<<10)+(i-56320)+65536:e}function AO(s){return s>=56320&&s<57344}function QO(s){return s>=55296&&s<56320}function PO(s){return s<65536?1:2}var zo,Iu,kO,EO=W(()=>{zo=[],Iu=[];(()=>{let s="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<s.length;t++)(t%2?Iu:zo).push(e=e+s[t])})();kO=8205});function V1(s){let t=-1;for(let e of s)t+=e.length+1;return t}function xl(s,t,e=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let a=s[r],l=n+a.length;l>=e&&(l>i&&(a=a.slice(0,i-n)),n<e&&(a=a.slice(e-n)),o?(t[t.length-1]+=a,o=!1):t.push(a)),n=l+1}return t}function TO(s,t,e){return xl(s,[""],t,e)}function rr(s,t,e){return t=Math.max(0,Math.min(s.length,t)),[t,Math.max(t,Math.min(s.length,e))]}function Ot(s,t,e=!0,i=!0){return CO(s,t,e,i)}function W1(s){return s>=56320&&s<57344}function Y1(s){return s>=55296&&s<56320}function Xt(s,t){let e=s.charCodeAt(t);if(!Y1(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return W1(i)?(e-55296<<10)+(i-56320)+65536:e}function Rl(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function we(s){return s<65536?1:2}function Mt(s,t,e,i=!1){if(t==0&&e<=0)return;let n=s.length-2;n>=0&&e<=0&&e==s[n+1]?s[n]+=t:n>=0&&t==0&&s[n]==0?s[n+1]+=e:i?(s[n]+=t,s[n+1]+=e):s.push(t,e)}function Mi(s,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<s.length)s[s.length-1]=s[s.length-1].append(e);else{for(;s.length<i;)s.push(G.empty);s.push(e)}}function qu(s,t,e){let i=s.inserted;for(let n=0,r=0,o=0;o<s.sections.length;){let a=s.sections[o++],l=s.sections[o++];if(l<0)n+=a,r+=a;else{let h=n,c=r,u=G.empty;for(;h+=a,c+=l,l&&i&&(u=u.append(i[o-2>>1])),!(e||o==s.sections.length||s.sections[o+1]<0);)a=s.sections[o++],l=s.sections[o++];t(n,h,r,c,u),n=h,r=c}}}function Bu(s,t,e,i=!1){let n=[],r=i?[]:null,o=new us(s),a=new us(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);Mt(n,h,-1),o.forward(h),a.forward(h)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!e))){let h=a.len;for(Mt(n,a.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&l<o.i&&o.len<=c&&(Mt(n,0,o.ins),r&&Mi(r,n,o.text),l=o.i),o.forward(c),h-=c}a.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(a.ins==-1){let u=Math.min(c,a.len);h+=u,c-=u,a.forward(u)}else if(a.ins==0&&a.len<c)c-=a.len,a.next();else break;Mt(n,h,l<o.i?o.ins:0),r&&l<o.i&&Mi(r,n,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&a.done)return r?Rt.createSet(n,r):Ye.create(n);throw new Error("Mismatched change set lengths")}}}function LO(s,t,e=!1){let i=[],n=e?[]:null,r=new us(s),o=new us(t);for(let a=!1;;){if(r.done&&o.done)return n?Rt.createSet(i,n):Ye.create(i);if(r.ins==0)Mt(i,r.len,0,a),r.next();else if(o.len==0&&!o.done)Mt(i,0,o.ins,a),n&&Mi(n,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Mt(i,l,c,a),n&&c&&Mi(n,i,o.text)}else o.ins==-1?(Mt(i,r.off?0:r.len,l,a),n&&Mi(n,i,r.textBit(l))):(Mt(i,r.off?0:r.len,o.off?0:o.ins,a),n&&!o.off&&Mi(n,i,o.text));a=(r.ins>l||o.ins>=0&&o.len>l)&&(a||i.length>h),r.forward2(l),o.forward(l)}}}}function MO(s,t){for(let e of s.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}function ju(s,t){return s==t||s.length==t.length&&s.every((e,i)=>e===t[i])}function RO(s,t,e){if(s.length!=t.length)return!1;for(let i=0;i<s.length;i++)if(!e(s[i],t[i]))return!1;return!0}function Nu(s,t){let e=!1;for(let i of t)_o(s,i)&1&&(e=!0);return e}function U1(s,t,e){let i=e.map(l=>s[l.id]),n=e.map(l=>l.type),r=i.filter(l=>!(l&1)),o=s[t.id]>>1;function a(l){let h=[];for(let c=0;c<i.length;c++){let u=Pl(l,i[c]);if(n[c]==2)for(let d of u)h.push(d);else h.push(u)}return t.combine(h)}return{create(l){for(let h of i)_o(l,h);return l.values[o]=a(l),1},update(l,h){if(!Nu(l,r))return 0;let c=a(l);return t.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,h){let c=Nu(l,i),u=h.config.facets[t.id],d=h.facet(t);if(u&&!c&&ju(e,u))return l.values[o]=d,0;let f=a(l);return t.compare(f,d)?(l.values[o]=d,0):(l.values[o]=f,1)}}}function jo(s){return t=>new Al(t,s)}function F1(s,t,e){let i=[[],[],[],[],[]],n=new Map;function r(o,a){let l=n.get(o);if(l!=null){if(l<=a)return;let h=i[l].indexOf(o);h>-1&&i[l].splice(h,1),o instanceof No&&e.delete(o.compartment)}if(n.set(o,a),Array.isArray(o))for(let h of o)r(h,a);else if(o instanceof No){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),r(h,a)}else if(o instanceof Al)r(o.inner,o.prec);else if(o instanceof ht)i[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof or)i[a].push(o),o.facet.extensions&&r(o.facet.extensions,fs.default);else{let h=o.extension;if(!h)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(h,a)}}return r(s,fs.default),i.reduce((o,a)=>o.concat(a))}function _o(s,t){if(t&1)return 2;let e=t>>1,i=s.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[e]=4;let n=s.computeSlot(s,s.config.dynamicSlots[e]);return s.status[e]=2|n}function Pl(s,t){return t&1?s.config.staticValues[t>>1]:s.values[t>>1]}function G1(s,t){let e=[];for(let i=0,n=0;;){let r,o;if(i<s.length&&(n==t.length||t[n]>=s[i]))r=s[i++],o=s[i++];else if(n<t.length)r=t[n++],o=t[n++];else return e;!e.length||e[e.length-1]<r?e.push(r,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function zO(s,t,e){var i;let n,r,o;return e?(n=t.changes,r=Rt.empty(t.changes.length),o=s.changes.compose(t.changes)):(n=t.changes.map(s.changes),r=s.changes.mapDesc(t.changes,!0),o=s.changes.compose(n)),{changes:o,selection:t.selection?t.selection.map(r):(i=s.selection)===null||i===void 0?void 0:i.map(n),effects:j.mapEffects(s.effects,n).concat(j.mapEffects(t.effects,r)),annotations:s.annotations.length?s.annotations.concat(t.annotations):t.annotations,scrollIntoView:s.scrollIntoView||t.scrollIntoView}}function Vu(s,t,e){let i=t.selection,n=ar(t.annotations);return t.userEvent&&(n=n.concat(dt.userEvent.of(t.userEvent))),{changes:t.changes instanceof Rt?t.changes:Rt.of(t.changes||[],e,s.facet(IO)),selection:i&&(i instanceof Q?i:Q.single(i.anchor,i.head)),effects:ar(t.effects),annotations:n,scrollIntoView:!!t.scrollIntoView}}function jO(s,t,e){let i=Vu(s,t.length?t[0]:{},s.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let r=1;r<t.length;r++){t[r].filter===!1&&(e=!1);let o=!!t[r].sequential;i=zO(i,Vu(s,t[r],o?i.changes.newLength:s.doc.length),o)}let n=dt.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return K1(e?H1(n):n)}function H1(s){let t=s.startState,e=!0;for(let n of t.facet(ZO)){let r=n(s);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:G1(e,r))}if(e!==!0){let n,r;if(e===!1)r=s.changes.invertedDesc,n=Rt.empty(t.doc.length);else{let o=s.changes.filter(e);n=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}s=dt.create(t,n,s.selection&&s.selection.map(r),j.mapEffects(s.effects,r),s.annotations,s.scrollIntoView)}let i=t.facet(DO);for(let n=i.length-1;n>=0;n--){let r=i[n](s);r instanceof dt?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof dt?s=r[0]:s=jO(t,ar(r),!1)}return s}function K1(s){let t=s.startState,e=t.facet(qO),i=s;for(let n=e.length-1;n>=0;n--){let r=e[n](s);r&&Object.keys(r).length&&(i=zO(i,Vu(t,r,s.changes.newLength),!0))}return i==s?s:dt.create(t,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}function ar(s){return s==null?J1:Array.isArray(s)?s:[s]}function e$(s){if(Wu)return Wu.test(s);for(let t=0;t<s.length;t++){let e=s[t];if(/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||t$.test(e)))return!0}return!1}function i$(s){return t=>{if(!/\S/.test(t))return lt.Space;if(e$(t))return lt.Word;for(let e=0;e<s.length;e++)if(t.indexOf(s[e])>-1)return lt.Word;return lt.Other}}function Vt(s,t,e={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[r],a=i[r];if(a===void 0)i[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let n in t)i[n]===void 0&&(i[n]=t[n]);return i}function Yu(s,t){return s==t||s.constructor==t.constructor&&s.eq(t)}function Uu(s,t){return s.from-t.from||s.value.startSide-t.value.startSide}function s$(s){if(s.length>1)for(let t=s[0],e=1;e<s.length;e++){let i=s[e];if(Uu(t,i)>0)return s.slice().sort(Uu);t=i}return s}function NO(s,t,e){let i=new Map;for(let r of s)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let n=new Set;for(let r of t)for(let o=0;o<r.chunk.length;o++){let a=i.get(r.chunk[o]);a!=null&&(e?e.mapPos(a):a)==r.chunkPos[o]&&!e?.touchesRange(a,a+r.chunk[o].length)&&n.add(r.chunk[o])}return n}function Gu(s,t){for(let e=s[t];;){let i=(t<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1<s.length&&n.compare(s[i+1])>=0&&(n=s[i+1],i++),e.compare(n)<0)break;s[i]=e,s[t]=n,t=i}}function _O(s,t,e,i,n,r){s.goto(t),e.goto(i);let o=i+n,a=i,l=i-t,h=!!r.boundChange;for(let c=!1;;){let u=s.to+l-e.to,d=u||s.endSide-e.endSide,f=d<0?s.to+l:e.to,p=Math.min(f,o);if(s.point||e.point?(s.point&&e.point&&Yu(s.point,e.point)&&Hu(s.activeForPoint(s.to),e.activeForPoint(e.to))||r.comparePoint(a,p,s.point,e.point),c=!1):(c&&r.boundChange(a),p>a&&!Hu(s.active,e.active)&&r.compareRange(a,p,s.active,e.active),h&&p<o&&(u||s.openEnd(f)!=e.openEnd(f))&&(c=!0)),f>o)break;a=f,d<=0&&s.next(),d>=0&&e.next()}}function Hu(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!=t[e]&&!Yu(s[e],t[e]))return!1;return!0}function Ll(s,t){for(let e=t,i=s.length-1;e<i;e++)s[e]=s[e+1];s.pop()}function Ml(s,t,e){for(let i=s.length-1;i>=t;i--)s[i+1]=s[i];s[t]=e}function VO(s,t){let e=-1,i=1e9;for(let n=0;n<t.length;n++)(t[n]-i||s[n].endSide-s[e].endSide)<0&&(e=n,i=t[n]);return e}function It(s,t,e=s.length){let i=0;for(let n=0;n<e&&n<s.length;)s.charCodeAt(n)==9?(i+=t-i%t,n++):(i++,n=Ot(s,n));return i}function Wo(s,t,e,i){for(let n=0,r=0;;){if(r>=t)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?e-r%e:1,n=Ot(s,n)}return i===!0?-1:s.length}var G,Oe,nr,cs,Sl,wl,kl,Du,gt,Ye,Rt,us,ds,Q,zu,R,or,$l,ht,fs,re,Al,Ri,No,Ql,XO,_u,IO,ZO,DO,qO,BO,_t,Cl,El,j,dt,J1,lt,t$,Wu,et,be,lr,Fu,U,ye,Tl,Vo,ps,Ue=W(()=>{EO();G=class s{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=rr(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),nr.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=rr(this,t,e);let i=[];return this.decompose(t,e,i,0),nr.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new cs(this),r=new cs(t);for(let o=e,a=e;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(a+=n.value.length,n.done||a>=i)return!0}}iter(t=1){return new cs(this,t)}iterRange(t,e=this.length){return new Sl(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new wl(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?s.empty:t.length<=32?new Oe(t):nr.from(Oe.split(t,[]))}},Oe=class s extends G{constructor(t,e=V1(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.text[r],a=n+o.length;if((e?i:a)>=t)return new kl(n,a,i,o);n=a+1,i++}}decompose(t,e,i,n){let r=t<=0&&e>=this.length?this:new s(TO(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=i.pop(),a=xl(r.text,o.text.slice(),0,r.length);if(a.length<=32)i.push(new s(a,o.length+r.length));else{let l=a.length>>1;i.push(new s(a.slice(0,l)),new s(a.slice(l)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof s))return super.replace(t,e,i);[t,e]=rr(this,t,e);let n=xl(this.text,xl(i.text,TO(this.text,0,t)),e),r=this.length+i.length-(e-t);return n.length<=32?new s(n,r):nr.from(s.split(n,[]),r)}sliceString(t,e=this.length,i=`
3
+ `){[t,e]=rr(this,t,e);let n="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let a=this.text[o],l=r+a.length;r>t&&o&&(n+=i),t<l&&e>r&&(n+=a.slice(Math.max(0,t-r),e-r)),r=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let r of t)i.push(r),n+=r.length+1,i.length==32&&(e.push(new s(i,n)),i=[],n=-1);return n>-1&&e.push(new s(i,n)),e}},nr=class s extends G{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.children[r],a=n+o.length,l=i+o.lines-1;if((e?l:a)>=t)return o.lineInner(t,e,i,n);n=a+1,i=l+1}}decompose(t,e,i,n){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let a=this.children[r],l=o+a.length;if(t<=l&&e>=o){let h=n&((o<=t?1:0)|(l>=e?2:0));o>=t&&l<=e&&!h?i.push(a):a.decompose(t-o,e-o,i,h)}o=l+1}}replace(t,e,i){if([t,e]=rr(this,t,e),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],a=r+o.length;if(t>=r&&e<=a){let l=o.replace(t-r,e-r,i),h=this.lines-o.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let c=this.children.slice();return c[n]=l,new s(c,this.length-(e-t)+i.length)}return super.replace(r,a,l)}r=a+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
4
+ `){[t,e]=rr(this,t,e);let n="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let a=this.children[r],l=o+a.length;o>t&&r&&(n+=i),t<l&&e>o&&(n+=a.sliceString(t-o,e-o,i)),o=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof s))return 0;let i=0,[n,r,o,a]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,r+=e){if(n==o||r==a)return i;let l=this.children[n],h=t.children[r];if(l!=h)return i+l.scanIdentical(h,e);i+=l.length+1}}static from(t,e=t.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let f of t)i+=f.lines;if(i<32){let f=[];for(let p of t)p.flatten(f);return new Oe(f,e)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,a=[],l=0,h=-1,c=[];function u(f){let p;if(f.lines>r&&f instanceof s)for(let m of f.children)u(m);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof Oe&&l&&(p=c[c.length-1])instanceof Oe&&f.lines+p.lines<=32?(l+=f.lines,h+=f.length+1,c[c.length-1]=new Oe(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>n&&d(),l+=f.lines,h+=f.length+1,c.push(f))}function d(){l!=0&&(a.push(c.length==1?c[0]:s.from(c,h)),h=-1,l=c.length=0)}for(let f of t)u(f);return d(),a.length==1?a[0]:new s(a,e)}};G.empty=new Oe([""],0);cs=class{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof Oe?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,a=n instanceof Oe?n.text.length:n.children.length;if(o==(e>0?a:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
5
+ `,this;t--}else if(n instanceof Oe){let l=n.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,l.length>Math.max(0,t))return this.value=t==0?l:e>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=n.children[o+(e<0?-1:0)];t>l.length?(t-=l.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(e>0?1:(l instanceof Oe?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},Sl=class{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new cs(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},wl=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(G.prototype[Symbol.iterator]=function(){return this.iter()},cs.prototype[Symbol.iterator]=Sl.prototype[Symbol.iterator]=wl.prototype[Symbol.iterator]=function(){return this});kl=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}};Du=/\r\n?|\n/,gt=(function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s})(gt||(gt={})),Ye=class s{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let r=this.sections[e++],o=this.sections[e++];o<0?(t(i,n,r),n+=r):n+=o,i+=r}}iterChangedRanges(t,e=!1){qu(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new s(t)}composeDesc(t){return this.empty?t:t.empty?this:LO(this,t)}mapDesc(t,e=!1){return t.empty?this:Bu(this,t,e)}mapPos(t,e=-1,i=gt.Simple){let n=0,r=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],h=n+a;if(l<0){if(h>t)return r+(t-n);r+=a}else{if(i!=gt.Simple&&h>=t&&(i==gt.TrackDel&&n<t&&h>t||i==gt.TrackBefore&&n<t||i==gt.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!a)return t==n||e<0?r:r+l;r+=l}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i<this.sections.length&&n<=e;){let r=this.sections[i++],o=this.sections[i++],a=n+r;if(o>=0&&n<=e&&a>=t)return n<t&&a>e?"cover":!0;n=a}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new s(t)}static create(t){return new s(t)}},Rt=class s extends Ye{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return qu(this,(e,i,n,r,o)=>t=t.replace(n,n+(i-e),o),!1),t}mapDesc(t,e=!1){return Bu(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,r=0;n<e.length;n+=2){let o=e[n],a=e[n+1];if(a>=0){e[n]=a,e[n+1]=o;let l=n>>1;for(;i.length<l;)i.push(G.empty);i.push(o?t.slice(r,r+o):G.empty)}r+=o}return new s(e,i)}compose(t){return this.empty?t:t.empty?this:LO(this,t,!0)}map(t,e=!1){return t.empty?this:Bu(this,t,e,!0)}iterChanges(t,e=!1){qu(this,t,e)}get desc(){return Ye.create(this.sections)}filter(t){let e=[],i=[],n=[],r=new us(this);t:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&r.len==0;){if(r.done)break t;let c=Math.min(r.len,l-a);Mt(n,c,-1);let u=r.ins==-1?-1:r.off==0?r.ins:0;Mt(e,c,u),u>0&&Mi(i,e,r.text),r.forward(c),a+=c}let h=t[o++];for(;a<h;){if(r.done)break t;let c=Math.min(r.len,h-a);Mt(e,c,-1),Mt(n,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),a+=c}}return{changes:new s(e,i),filtered:Ye.create(n)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):n==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let n=[],r=[],o=0,a=null;function l(c=!1){if(!c&&!n.length)return;o<e&&Mt(n,e-o,-1);let u=new s(n,r);a=a?a.compose(u.map(a)):u,n=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let u of c)h(u);else if(c instanceof s){if(c.length!=e)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${e})`);l(),a=a?a.compose(c.map(a)):c}else{let{from:u,to:d=u,insert:f}=c;if(u>d||u<0||d>e)throw new RangeError(`Invalid change range ${u} to ${d} (in doc of length ${e})`);let p=f?typeof f=="string"?G.of(f.split(i||Du)):f:G.empty,m=p.length;if(u==d&&m==0)return;u<o&&l(),u>o&&Mt(n,u-o,-1),Mt(n,d-u,m),Mi(r,n,p),o=d}}return h(t),l(!a),a}static empty(t){return new s(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="number")e.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)e.push(r[0],0);else{for(;i.length<n;)i.push(G.empty);i[n]=G.of(r.slice(1)),e.push(r[0],i[n].length)}}}return new s(e,i)}static createSet(t,e){return new s(t,e)}};us=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?G.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?G.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},ds=class s{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new s(i,n,this.flags)}extend(t,e=t,i=0){if(t<=this.anchor&&e>=this.anchor)return Q.range(t,e,void 0,void 0,i);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return Q.range(this.anchor,n,void 0,void 0,i)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Q.range(t.anchor,t.head)}static create(t,e,i){return new s(t,e,i)}},Q=class s{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:s.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(t.ranges[i],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new s([this.main],0)}addRange(t,e=!0){return s.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,s.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new s(t.ranges.map(e=>ds.fromJSON(e)),t.main)}static single(t,e=t){return new s([s.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<t.length;n++){let r=t[n];if(r.empty?r.from<=i:r.from<i)return s.normalized(t.slice(),e);i=r.to}return new s(t,e)}static cursor(t,e=0,i,n){return ds.create(t,t,(e==0?0:e<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(t,e,i,n,r){let o=(i??16777215)<<6|(n==null?7:Math.min(6,n));return!r&&t!=e&&(r=e<t?1:-1),e<t?ds.create(e,t,48|o):ds.create(t,e,(r?r<0?8:16:0)|o)}static normalized(t,e=0){let i=t[e];t.sort((n,r)=>n.from-r.from),e=t.indexOf(i);for(let n=1;n<t.length;n++){let r=t[n],o=t[n-1];if(r.empty?r.from<=o.to:r.from<o.to){let a=o.from,l=Math.max(r.to,o.to);n<=e&&e--,t.splice(--n,2,r.anchor>r.head?s.range(l,a):s.range(a,l))}}return new s(t,e)}};zu=0,R=class s{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=zu++,this.default=t([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(t={}){return new s(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:ju),!!t.static,t.enables)}of(t){return new or([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new or(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new or(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}};or=class{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=zu++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,o=t[r]>>1,a=this.type==2,l=!1,h=!1,c=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?h=!0:(((e=t[u.id])!==null&&e!==void 0?e:1)&1)==0&&c.push(t[u.id]);return{create(u){return u.values[o]=i(u),1},update(u,d){if(l&&d.docChanged||h&&(d.docChanged||d.selection)||Nu(u,c)){let f=i(u);if(a?!RO(f,u.values[o],n):!n(f,u.values[o]))return u.values[o]=f,1}return 0},reconfigure:(u,d)=>{let f,p=d.config.address[r];if(p!=null){let m=Pl(d,p);if(this.dependencies.every(O=>O instanceof R?d.facet(O)===u.facet(O):O instanceof ht?d.field(O,!1)==u.field(O,!1):!0)||(a?RO(f=i(u),m,n):n(f=i(u),m)))return u.values[o]=m,0}else f=i(u);return u.values[o]=f,1}}}};$l=R.define({static:!0}),ht=class s{constructor(t,e,i,n,r){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=r,this.provides=void 0}static define(t){let e=new s(zu++,t.create,t.update,t.compare||((i,n)=>i===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet($l).find(i=>i.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:i=>(i.values[e]=this.create(i),1),update:(i,n)=>{let r=i.values[e],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[e]=o,1)},reconfigure:(i,n)=>{let r=i.facet($l),o=n.facet($l),a;return(a=r.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(i.values[e]=a.create(i),1):n.config.address[this.id]!=null?(i.values[e]=n.field(this),0):(i.values[e]=this.create(i),1)}}}init(t){return[this,$l.of({field:this,create:t})]}get extension(){return this}},fs={lowest:4,low:3,default:2,high:1,highest:0};re={highest:jo(fs.highest),high:jo(fs.high),default:jo(fs.default),low:jo(fs.low),lowest:jo(fs.lowest)},Al=class{constructor(t,e){this.inner=t,this.prec=e}},Ri=class s{of(t){return new No(this,t)}reconfigure(t){return s.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},No=class{constructor(t,e){this.compartment=t,this.inner=e}},Ql=class s{constructor(t,e,i,n,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let n=[],r=Object.create(null),o=new Map;for(let d of F1(t,e,o))d instanceof ht?n.push(d):(r[d.facet.id]||(r[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],h=[];for(let d of n)a[d.id]=h.length<<1,h.push(f=>d.slot(f));let c=i?.config.facets;for(let d in r){let f=r[d],p=f[0].facet,m=c&&c[d]||[];if(f.every(O=>O.type==0))if(a[p.id]=l.length<<1|1,ju(m,f))l.push(i.facet(p));else{let O=p.combine(f.map(g=>g.value));l.push(i&&p.compare(O,i.facet(p))?i.facet(p):O)}else{for(let O of f)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=h.length<<1,h.push(g=>O.dynamicSlot(g)));a[p.id]=h.length<<1,h.push(O=>U1(O,p,f))}}let u=h.map(d=>d(a));return new s(t,o,u,a,l,r)}};XO=R.define(),_u=R.define({combine:s=>s.some(t=>t),static:!0}),IO=R.define({combine:s=>s.length?s[0]:void 0,static:!0}),ZO=R.define(),DO=R.define(),qO=R.define(),BO=R.define({combine:s=>s.length?s[0]:!1}),_t=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Cl}},Cl=class{of(t){return new _t(this,t)}},El=class{constructor(t){this.map=t}of(t){return new j(this,t)}},j=class s{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new s(this.type,e)}is(t){return this.type==t}static define(t={}){return new El(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let r=n.map(e);r&&i.push(r)}return i}};j.reconfigure=j.define(),j.appendConfig=j.define();dt=class s{constructor(t,e,i,n,r,o){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&MO(i,e.newLength),r.some(a=>a.type==s.time)||(this.annotations=r.concat(s.time.of(Date.now())))}static create(t,e,i,n,r,o){return new s(t,e,i,n,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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(s.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}};dt.time=_t.define(),dt.userEvent=_t.define(),dt.addToHistory=_t.define(),dt.remote=_t.define();J1=[];lt=(function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s})(lt||(lt={})),t$=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Wu=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}et=class s{constructor(t,e,i,n,r,o){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)_o(this,a<<1);this.computeSlot=null}field(t,e=!0){let i=this.config.address[t.id];if(i==null){if(e)throw new RangeError("Field is not present in this state");return}return _o(this,i),Pl(this,i)}update(...t){return jO(this,t,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:n}=e;for(let a of t.effects)a.is(Ri.reconfigure)?(e&&(n=new Map,e.compartments.forEach((l,h)=>n.set(h,l)),e=null),n.set(a.value.compartment,a.value.extension)):a.is(j.reconfigure)?(e=null,i=a.value):a.is(j.appendConfig)&&(e=null,i=ar(i).concat(a.value));let r;e?r=t.startState.values.slice():(e=Ql.resolve(i,n,this),r=new s(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values);let o=t.startState.facet(_u)?t.newSelection:t.newSelection.asSingle();new s(e,t.newDoc,o,r,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:Q.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),r=[i.range],o=ar(i.effects);for(let a=1;a<e.ranges.length;a++){let l=t(e.ranges[a]),h=this.changes(l.changes),c=h.map(n);for(let d=0;d<a;d++)r[d]=r[d].map(c);let u=n.mapDesc(h,!0);r.push(l.range.map(u)),n=n.compose(c),o=j.mapEffects(o,c).concat(j.mapEffects(ar(l.effects),u))}return{changes:n,selection:Q.create(r,e.mainIndex),effects:o}}changes(t=[]){return t instanceof Rt?t:Rt.of(t,this.doc.length,this.facet(s.lineSeparator))}toText(t){return G.of(t.split(this.facet(s.lineSeparator)||Du))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(_o(this,e),Pl(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let n=t[i];n instanceof ht&&this.config.address[n.id]!=null&&(e[i]=n.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t,e={},i){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(t,r)){let o=i[r],a=t[r];n.push(o.init(l=>o.spec.fromJSON(a,l)))}}return s.create({doc:t.doc,selection:Q.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=Ql.resolve(t.extensions||[],new Map),i=t.doc instanceof G?t.doc:G.of((t.doc||"").split(e.staticFacet(s.lineSeparator)||Du)),n=t.selection?t.selection instanceof Q?t.selection:Q.single(t.selection.anchor,t.selection.head):Q.single(0);return MO(n,i.length),e.staticFacet(_u)||(n=n.asSingle()),new s(e,i,n,e.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(s.tabSize)}get lineBreak(){return this.facet(s.lineSeparator)||`
6
+ `}get readOnly(){return this.facet(BO)}phrase(t,...e){for(let i of this.facet(s.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>e.length?i:e[r-1]})),t}languageDataAt(t,e,i=-1){let n=[];for(let r of this.facet(XO))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){let e=this.languageDataAt("wordChars",t);return i$(e.length?e[0]:"")}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,a=t-i;for(;o>0;){let l=Ot(e,o,!1);if(r(e.slice(l,o))!=lt.Word)break;o=l}for(;a<n;){let l=Ot(e,a);if(r(e.slice(a,l))!=lt.Word)break;a=l}return o==a?null:Q.range(o+i,a+i)}};et.allowMultipleSelections=_u,et.tabSize=R.define({combine:s=>s.length?s[0]:4}),et.lineSeparator=IO,et.readOnly=BO,et.phrases=R.define({compare(s,t){let e=Object.keys(s),i=Object.keys(t);return e.length==i.length&&e.every(n=>s[n]==t[n])}}),et.languageData=XO,et.changeFilter=ZO,et.transactionFilter=DO,et.transactionExtender=qO,Ri.reconfigure=j.define();be=class{eq(t){return this==t}range(t,e=t){return lr.create(t,e,this)}};be.prototype.startSide=be.prototype.endSide=0,be.prototype.point=!1,be.prototype.mapMode=gt.TrackDel;lr=class s{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new s(t,e,i)}};Fu=class s{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let o=n,a=r.length;;){if(o==a)return o;let l=o+a>>1,h=r[l]-t||(i?this.value[l].endSide:this.value[l].startSide)-e;if(l==o)return h>=0?o:a;h>=0?a=l:o=l+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(n(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e){let i=[],n=[],r=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let h=this.value[l],c=this.from[l]+t,u=this.to[l]+t,d,f;if(c==u){let p=e.mapPos(c,h.startSide,h.mapMode);if(p==null||(d=f=p,h.startSide!=h.endSide&&(f=e.mapPos(c,h.endSide),f<d)))continue}else if(d=e.mapPos(c,h.startSide),f=e.mapPos(u,h.endSide),d>f||d==f&&h.startSide>0&&h.endSide<=0)continue;(f-d||h.endSide-h.startSide)<0||(o<0&&(o=d),h.point&&(a=Math.max(a,f-d)),i.push(h),n.push(d-o),r.push(f-o))}return{mapped:i.length?new s(n,r,i,a):null,pos:o}}},U=class s{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new s(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(Uu)),this.isEmpty)return e.length?s.of(e):this;let a=new Tl(this,null,-1).goto(0),l=0,h=[],c=new ye;for(;a.value||l<e.length;)if(l<e.length&&(a.from-e[l].from||a.startSide-e[l].value.startSide)>=0){let u=e[l++];c.addInner(u.from,u.to,u.value)||h.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(a.chunkIndex)<e[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||r<this.chunkPos[a.chunkIndex])&&c.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||r<a.from||o(a.from,a.to,a.value))&&(c.addInner(a.from,a.to,a.value)||h.push(lr.create(a.from,a.to,a.value))),a.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?s.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],i=[],n=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],h=t.touchesRange(a,a+l.length);if(h===!1)n=Math.max(n,l.maxPoint),e.push(l),i.push(t.mapPos(a));else if(h===!0){let{mapped:c,pos:u}=l.map(a,t);c&&(n=Math.max(n,c.maxPoint),e.push(c),i.push(u))}}let r=this.nextLayer.map(t);return e.length==0?r:new s(i,e,r||s.empty,n)}between(t,e,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let r=this.chunkPos[n],o=this.chunk[n];if(e>=r&&t<=r+o.length&&o.between(r,t-r,e-r,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return Vo.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Vo.from(t).goto(e)}static compare(t,e,i,n,r=-1){let o=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),a=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),l=NO(o,a,i),h=new ps(o,l,r),c=new ps(a,l,r);i.iterGaps((u,d,f)=>_O(h,u,c,d,f,n)),i.empty&&i.length==0&&_O(h,0,c,0,0,n)}static eq(t,e,i=0,n){n==null&&(n=999999999);let r=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),o=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=NO(r,o),l=new ps(r,a,0).goto(i),h=new ps(o,a,0).goto(i);for(;;){if(l.to!=h.to||!Hu(l.active,h.active)||l.point&&(!h.point||!Yu(l.point,h.point)))return!1;if(l.to>n)return!0;l.next(),h.next()}}static spans(t,e,i,n,r=-1){let o=new ps(t,null,r).goto(e),a=e,l=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),u=o.pointFrom<e?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,l);n.point(a,h,o.point,c,u,o.pointRank),l=Math.min(o.openEnd(h),c.length)}else h>a&&(n.span(a,h,o.active,l),l=o.openEnd(h));if(o.to>i)return l+(o.point&&o.to>i?1:0);a=o.to,o.next()}}static of(t,e=!1){let i=new ye;for(let n of t instanceof lr?[t]:e?s$(t):t)i.add(n.from,n.to,n.value);return i.finish()}static join(t){if(!t.length)return s.empty;let e=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let n=t[i];n!=s.empty;n=n.nextLayer)e=new s(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};U.empty=new U([],[],null,-1);U.empty.nextLayer=U.empty;ye=class s{finishChunk(t){this.chunks.push(new Fu(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new s)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(U.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=U.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};Tl=class{constructor(t,e,i,n=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<t||n.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}},Vo=class s{constructor(t){this.heap=t}static from(t,e=null,i=-1){let n=[];for(let r=0;r<t.length;r++)for(let o=t[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&n.push(new Tl(o,e,i,r));return n.length==1?n[0]:new s(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)Gu(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)Gu(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Gu(this.heap,0)}}};ps=class{constructor(t,e,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=Vo.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Ll(this.active,t),Ll(this.activeTo,t),Ll(this.activeRank,t),this.minActive=VO(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||n-this.activeTo[e])>0;)e++;Ml(this.active,e,i),Ml(this.activeTo,e,n),Ml(this.activeRank,e,r),t&&Ml(t,e,this.cursor.from),this.minActive=VO(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Ll(i,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let n=i.length-1;n>=0&&i[n]<t;n--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}});var CD,WO,Ku,YO,ke,UO,Ju,td=W(()=>{CD="\u037C",WO=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),Ku=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),YO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},ke=class{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,a,l,h){let c=[],u=/^@(\w+)\b/.exec(o[0]),d=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f))r(f.split(/,\s*/).map(m=>o.map(O=>m.replace(/&/,O))).reduce((m,O)=>m.concat(O)),p,l);else if(p&&typeof p=="object"){if(!u)throw new RangeError("The value of a property ("+f+") should be a primitive value.");r(n(f),p,c,d)}else p!=null&&c.push(f.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||d)&&l.push((i&&!u&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)r(n(o),t[o],this.rules)}getRules(){return this.rules.join(`
7
+ `)}static newName(){let t=YO[WO]||1;return YO[WO]=t+1,"\u037C"+t.toString(36)}static mount(t,e,i){let n=t[Ku],r=i&&i.nonce;n?r&&n.setNonce(r):n=new Ju(t,r),n.mount(Array.isArray(e)?e:[e],t)}},UO=new Map,Ju=class{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let r=UO.get(i);if(r)return t[Ku]=r;this.sheet=new n.CSSStyleSheet,UO.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ku]=this}mount(t,e){let i=this.sheet,n=0,r=0;for(let o=0;o<t.length;o++){let a=t[o],l=this.modules.indexOf(a);if(l<r&&l>-1&&(this.modules.splice(l,1),r--,l=-1),l==-1){if(this.modules.splice(r++,0,a),i)for(let h=0;h<a.rules.length;h++)i.insertRule(a.rules[h],n++)}else{for(;r<l;)n+=this.modules[r++].rules.length;n+=a.rules.length,r++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
8
+ `;this.styleTag.textContent=o;let a=e.head||e;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}});function FO(s){var t=n$&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||r$&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",e=!t&&s.key||(s.shiftKey?hr:hi)[s.keyCode]||s.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}var hi,hr,n$,r$,bt,Xl,GO=W(()=>{hi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},hr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},n$=typeof navigator<"u"&&/Mac/.test(navigator.platform),r$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(bt=0;bt<10;bt++)hi[48+bt]=hi[96+bt]=String(bt);for(bt=1;bt<=24;bt++)hi[bt+111]="F"+bt;for(bt=65;bt<=90;bt++)hi[bt]=String.fromCharCode(bt+32),hr[bt]=String.fromCharCode(bt);for(Xl in hi)hr.hasOwnProperty(Xl)||(hr[Xl]=hi[Xl])});function xt(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var t=1,e=arguments[1];if(e&&typeof e=="object"&&e.nodeType==null&&!Array.isArray(e)){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}t++}for(;t<arguments.length;t++)HO(s,arguments[t]);return s}function HO(s,t){if(typeof t=="string")s.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)s.appendChild(t);else if(Array.isArray(t))for(var e=0;e<t.length;e++)HO(s,t[e]);else throw new RangeError("Unsupported child node: "+t)}var ed=W(()=>{});function ad(s,t){for(let e in s)e=="class"&&t.class?t.class+=" "+s.class:e=="style"&&t.style?t.style+=";"+s.style:t[e]=s[e];return t}function ld(s,t,e){if(s==t)return!0;s||(s=Zl),t||(t=Zl);let i=Object.keys(s),n=Object.keys(t);if(i.length-(e&&i.indexOf(e)>-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let r of i)if(r!=e&&(n.indexOf(r)==-1||s[r]!==t[r]))return!1;return!0}function o$(s,t){for(let e=s.attributes.length-1;e>=0;e--){let i=s.attributes[e].name;t[i]==null&&s.removeAttribute(i)}for(let e in t){let i=t[e];e=="style"?s.style.cssText=i:s.getAttribute(e)!=i&&s.setAttribute(e,i)}}function ib(s,t,e){let i=!1;if(t)for(let n in t)e&&n in e||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(i=!0,n=="style"?s.style.cssText=e[n]:s.setAttribute(n,e[n]));return i}function a$(s){let t=Object.create(null);for(let e=0;e<s.attributes.length;e++){let i=s.attributes[e];t[i.name]=i.value}return t}function sb(s,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=s;return e==null&&(e=s.inclusive),i==null&&(i=s.inclusive),{start:e??t,end:i??t}}function l$(s,t){return s==t||!!(s&&t&&s.compare(t))}function cr(s,t,e,i=0){let n=e.length-1;n>=0&&e[n]+i>=s?e[n]=Math.max(e[n],t):e.push(s,t)}function Go(s){let t;return s.nodeType==11?t=s.getSelection?s:s.ownerDocument:t=s,t.getSelection()}function hd(s,t){return t?s==t||s.contains(t.nodeType!=1?t.parentNode:t):!1}function Ho(s,t){if(!t.anchorNode)return!1;try{return hd(s,t.anchorNode)}catch{return!1}}function Ko(s){return s.nodeType==3?ea(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function Jo(s,t,e,i){return e?nb(s,t,e,i,-1)||nb(s,t,e,i,1):!1}function Xi(s){for(var t=0;;t++)if(s=s.previousSibling,!s)return t}function Dl(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}function nb(s,t,e,i,n){for(;;){if(s==e&&t==i)return!0;if(t==(n<0?0:ci(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;t=Xi(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[t+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;t=n<0?ci(s):0}else return!1}}function ci(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function ta(s,t){let e=t?s.left:s.right;return{left:e,right:e,top:s.top,bottom:s.bottom}}function h$(s){let t=s.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function rb(s,t){let e=t.width/s.offsetWidth,i=t.height/s.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-s.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-s.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function c$(s,t,e,i,n,r,o,a){let l=s.ownerDocument,h=l.defaultView||window;for(let c=s,u=!1;c&&!u;)if(c.nodeType==1){let d,f=c==l.body,p=1,m=1;if(f)d=h$(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let y=c.getBoundingClientRect();({scaleX:p,scaleY:m}=rb(c,y)),d={left:y.left,right:y.left+c.clientWidth*p,top:y.top,bottom:y.top+c.clientHeight*m}}let O=0,g=0;if(n=="nearest")t.top<d.top+o?(g=t.top-(d.top+o),e>0&&t.bottom>d.bottom+g&&(g=t.bottom-d.bottom+o)):t.bottom>d.bottom-o&&(g=t.bottom-d.bottom+o,e<0&&t.top-g<d.top&&(g=t.top-(d.top+o)));else{let y=t.bottom-t.top,v=d.bottom-d.top;g=(n=="center"&&y<=v?t.top+y/2-v/2:n=="start"||n=="center"&&e<0?t.top-o:t.bottom-v+o)-d.top}if(i=="nearest"?t.left<d.left+r?(O=t.left-(d.left+r),e>0&&t.right>d.right+O&&(O=t.right-d.right+r)):t.right>d.right-r&&(O=t.right-d.right+r,e<0&&t.left<d.left+O&&(O=t.left-(d.left+r))):O=(i=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:i=="start"==a?t.left-r:t.right-(d.right-d.left)+r)-d.left,O||g)if(f)h.scrollBy(O,g);else{let y=0,v=0;if(g){let x=c.scrollTop;c.scrollTop+=g/m,v=(c.scrollTop-x)*m}if(O){let x=c.scrollLeft;c.scrollLeft+=O/p,y=(c.scrollLeft-x)*p}t={left:t.left-y,top:t.top-v,right:t.right-y,bottom:t.bottom-v},y&&Math.abs(y-O)<1&&(i="nearest"),v&&Math.abs(v-g)<1&&(n="nearest")}if(f)break;(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)&&(t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function ob(s,t=!0){let e=s.ownerDocument,i=null,n=null;for(let r=s.parentNode;r&&!(r==e.body||(!t||i)&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),t&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:n}}function ab(s){if(s.setActive)return s.setActive();if(gs)return s.focus(gs);let t=[];for(let e=s;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(s.focus(gs==null?{get preventScroll(){return gs={preventScroll:!0},!0}}:void 0),!gs){gs=!1;for(let e=0;e<t.length;){let i=t[e++],n=t[e++],r=t[e++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=r&&(i.scrollLeft=r)}}}function ea(s,t,e=t){let i=lb||(lb=document.createRange());return i.setEnd(s,e),i.setStart(s,t),i}function ur(s,t,e,i){let n={key:t,code:t,keyCode:e,which:e,cancelable:!0};i&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=i);let r=new KeyboardEvent("keydown",n);r.synthetic=!0,s.dispatchEvent(r);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,s.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function u$(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function d$(s,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(i=Math.min(i,ci(e));;)if(i){if(e.nodeType!=1)return!1;let n=e.childNodes[i-1];n.contentEditable=="false"?i--:(e=n,i=ci(e))}else{if(e==s)return!0;i=Xi(e),e=e.parentNode}}function hb(s){return s instanceof Window?s.pageYOffset>Math.max(0,s.document.documentElement.scrollHeight-s.innerHeight-4):s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}function cb(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i>0)return{node:e,offset:i};if(e.nodeType==1&&i>0){if(e.contentEditable=="false")return null;e=e.childNodes[i-1],i=ci(e)}else if(e.parentNode&&!Dl(e))i=Xi(e),e=e.parentNode;else return null}}function ub(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i<e.nodeValue.length)return{node:e,offset:i};if(e.nodeType==1&&i<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[i],i=0}else if(e.parentNode&&!Dl(e))i=Xi(e)+1,e=e.parentNode;else return null}}function db(s){let t=[];for(let e=0;e<s.length;e++)t.push(1<<+s[e]);return t}function fb(s){return s<=247?f$[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?p$[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8204?256:64336<=s&&s<=65023?4:1}function pb(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++){let i=s[e],n=t[e];if(i.from!=n.from||i.to!=n.to||i.direction!=n.direction||!pb(i.inner,n.inner))return!1}return!0}function g$(s,t,e,i,n){for(let r=0;r<=i.length;r++){let o=r?i[r-1].to:t,a=r<i.length?i[r].from:e,l=r?256:n;for(let h=o,c=l,u=l;h<a;h++){let d=fb(s.charCodeAt(h));d==512?d=c:d==8&&u==4&&(d=16),it[h]=d==4?2:d,d&7&&(u=d),c=d}for(let h=o,c=l,u=l;h<a;h++){let d=it[h];if(d==128)h<a-1&&c==it[h+1]&&c&24?d=it[h]=c:it[h]=256;else if(d==64){let f=h+1;for(;f<a&&it[f]==64;)f++;let p=h&&c==8||f<e&&it[f]==8?u==1?1:8:256;for(let m=h;m<f;m++)it[m]=p;h=f-1}else d==8&&u==1&&(it[h]=1);c=d,d&7&&(u=d)}}}function O$(s,t,e,i,n){let r=n==1?2:1;for(let o=0,a=0,l=0;o<=i.length;o++){let h=o?i[o-1].to:t,c=o<i.length?i[o].from:e;for(let u=h,d,f,p;u<c;u++)if(f=dd[d=s.charCodeAt(u)])if(f<0){for(let m=a-3;m>=0;m-=3)if(Ge[m+1]==-f){let O=Ge[m+2],g=O&2?n:O&4?O&1?r:n:0;g&&(it[u]=it[Ge[m]]=g),a=m;break}}else{if(Ge.length==189)break;Ge[a++]=u,Ge[a++]=d,Ge[a++]=l}else if((p=it[u])==2||p==1){let m=p==n;l=m?0:1;for(let O=a-3;O>=0;O-=3){let g=Ge[O+2];if(g&2)break;if(m)Ge[O+2]|=2;else{if(g&4)break;Ge[O+2]|=4}}}}}function b$(s,t,e,i){for(let n=0,r=i;n<=e.length;n++){let o=n?e[n-1].to:s,a=n<e.length?e[n].from:t;for(let l=o;l<a;){let h=it[l];if(h==256){let c=l+1;for(;;)if(c==a){if(n==e.length)break;c=e[n++].to,a=n<e.length?e[n].from:t}else if(it[c]==256)c++;else break;let u=r==1,d=(c<t?it[c]:i)==1,f=u==d?u?1:2:i;for(let p=c,m=n,O=m?e[m-1].to:s;p>l;)p==O&&(p=e[--m].from,O=m?e[m-1].to:s),it[--p]=f;l=c}else r=h,l++}}}function fd(s,t,e,i,n,r,o){let a=i%2?2:1;if(i%2==n%2)for(let l=t,h=0;l<e;){let c=!0,u=!1;if(h==r.length||l<r[h].from){let m=it[l];m!=a&&(c=!1,u=m==16)}let d=!c&&a==1?[]:null,f=c?i:i+1,p=l;t:for(;;)if(h<r.length&&p==r[h].from){if(u)break t;let m=r[h];if(!c)for(let O=m.to,g=h+1;;){if(O==e)break t;if(g<r.length&&r[g].from==O)O=r[g++].to;else{if(it[O]==a)break t;break}}if(h++,d)d.push(m);else{m.from>l&&o.push(new ve(l,m.from,f));let O=m.direction==Os!=!(f%2);pd(s,O?i+1:i,n,m.inner,m.from,m.to,o),l=m.to}p=m.to}else{if(p==e||(c?it[p]!=a:it[p]==a))break;p++}d?fd(s,l,p,i+1,n,d,o):l<p&&o.push(new ve(l,p,f)),l=p}else for(let l=e,h=r.length;l>t;){let c=!0,u=!1;if(!h||l>r[h-1].to){let m=it[l-1];m!=a&&(c=!1,u=m==16)}let d=!c&&a==1?[]:null,f=c?i:i+1,p=l;t:for(;;)if(h&&p==r[h-1].to){if(u)break t;let m=r[--h];if(!c)for(let O=m.from,g=h;;){if(O==t)break t;if(g&&r[g-1].to==O)O=r[--g].from;else{if(it[O-1]==a)break t;break}}if(d)d.push(m);else{m.to<l&&o.push(new ve(m.to,l,f));let O=m.direction==Os!=!(f%2);pd(s,O?i+1:i,n,m.inner,m.from,m.to,o),l=m.from}p=m.from}else{if(p==t||(c?it[p-1]!=a:it[p-1]==a))break;p--}d?fd(s,p,l,i+1,n,d,o):p<l&&o.push(new ve(p,l,f)),l=p}}function pd(s,t,e,i,n,r,o){let a=t%2?2:1;g$(s,n,r,i,a),O$(s,n,r,i,a),b$(n,r,i,a),fd(s,n,r,t,e,i,o)}function mb(s,t,e){if(!s)return[new ve(0,0,t==ud?1:0)];if(t==Os&&!e.length&&!m$.test(s))return gb(s.length);if(e.length)for(;s.length>it.length;)it[it.length]=256;let i=[],n=t==Os?0:1;return pd(s,n,n,e,0,s.length,i),i}function gb(s){return[new ve(0,s,0)]}function bb(s,t,e,i,n){var r;let o=i.head-s.from,a=ve.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),l=t[a],h=l.side(n,e);if(o==h){let d=a+=n?1:-1;if(d<0||d>=t.length)return null;l=t[a=d],o=l.side(!n,e),h=l.side(n,e)}let c=Ot(s.text,o,l.forward(n,e));(c<l.from||c>l.to)&&(c=h),Ob=s.text.slice(Math.min(o,c),Math.max(o,c));let u=a==(n?t.length-1:0)?null:t[a+(n?1:-1)];return u&&c==h&&u.level+(n?0:1)<l.level?Q.cursor(u.side(!n,e)+s.from,u.forward(n,e)?1:-1,u.level):Q.cursor(c+s.from,l.forward(n,e)?-1:1,l.level)}function y$(s,t,e){for(let i=t;i<e;i++){let n=fb(s.charCodeAt(i));if(n==1)return Os;if(n==2||n==4)return ud}return Os}function St(s,t,e){let i=s.facet(Sb);i.length?i[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}function Lb(s,t){let e=s.state.facet(Tb);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(s):r),n=[];return U.spans(i,t.from,t.to,{point(){},span(r,o,a,l){let h=r-t.from,c=o-t.from,u=n;for(let d=a.length-1;d>=0;d--,l--){let f=a[d].spec.bidiIsolate,p;if(f==null&&(f=y$(t.text,h,c)),l>0&&u.length&&(p=u[u.length-1]).to==h&&p.direction==f)p.to=c,u=p.inner;else{let m={from:h,to:c,direction:f,inner:[]};u.push(m),u=m.inner}}}}),n}function yd(s){let t=0,e=0,i=0,n=0;for(let r of s.state.facet(Mb)){let o=r(s);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:i,bottom:n}}function Rb(s){let t=s.nextSibling;return s.parentNode.removeChild(s),t}function S$(s){let t=s.dom.lastChild;if(!t)return s.dom.getBoundingClientRect();let e=Ko(t);return e[e.length-1]||null}function w$(s,t){let e=s.coordsIn(0,1),i=t.coordsIn(0,1);return e&&i&&i.top<e.bottom}function Xb(s,t){let e=i=>{for(let n of i.children)if((t?n.isText():n.length)||e(n))return!0;return!1};return e(s)}function k$(s){let t=s.isReplace?(s.startSide<0?64:0)|(s.endSide>0?128:0):s.startSide>0?32:16;return s.block&&(t|=256),t}function $$(s,t){let e=t.spec.attributes,i=t.spec.class;return!e&&!i||(s||(s={class:"cm-line"}),e&&ad(e,s),i&&(s.class+=" "+i)),s}function A$(s){let t=[];for(let e=s.parents.length;e>1;e--){let i=e==s.parents.length?s.tile:s.parents[e].tile;i instanceof oe&&t.push(i.mark)}return t}function Ad(s){let t=ct.get(s);return t&&t.setDOM(s.cloneNode()),s}function Pd(s,t){let e=t?.get(s);if(e!=1){e==null&&s.destroy();for(let i of s.children)Pd(i,t)}}function Q$(s){return s.node.nodeType==1&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}function Zb(s,t){let e=s.observer.selectionRange;if(!e.focusNode)return null;let i=cb(e.focusNode,e.focusOffset),n=ub(e.focusNode,e.focusOffset),r=i||n;if(n&&i&&n.node!=i.node){let a=ct.get(n.node);if(!a||a.isText()&&a.text!=n.node.nodeValue)r=n;else if(s.docView.lastCompositionAfterCursor){let l=ct.get(i.node);!l||l.isText()&&l.text!=i.node.nodeValue||(r=n)}}if(s.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=t-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function P$(s,t,e){let i=Zb(s,e);if(!i)return null;let{node:n,from:r,to:o}=i,a=n.nodeValue;if(/[\n\r]/.test(a)||s.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc;return{range:new $e(l.mapPos(r),l.mapPos(o),r,o),text:n}}function C$(s,t){return s.nodeType!=1?0:(t&&s.childNodes[t-1].contentEditable=="false"?1:0)|(t<s.childNodes.length&&s.childNodes[t].contentEditable=="false"?2:0)}function T$(s,t,e){let i=new E$;return U.compare(s,t,e,i),i.changes}function L$(s,t,e){let i=new Cd;return U.compare(s,t,e,i),i.changes}function M$(s,t){for(let e=s;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function R$(s,t){let e=!1;return t&&s.iterChangedRanges((i,n)=>{i<t.to&&n>t.from&&(e=!0)}),e}function X$(s,t,e=1){let i=s.charCategorizer(t),n=s.doc.lineAt(t),r=t-n.from;if(n.length==0)return Q.cursor(t);r==0?e=1:r==n.length&&(e=-1);let o=r,a=r;e<0?o=Ot(n.text,r,!1):a=Ot(n.text,r);let l=i(n.text.slice(o,a));for(;o>0;){let h=Ot(n.text,o,!1);if(i(n.text.slice(h,o))!=l)break;o=h}for(;a<n.length;){let h=Ot(n.text,a);if(i(n.text.slice(a,h))!=l)break;a=h}return Q.range(o+n.from,a+n.from)}function I$(s,t,e,i,n){let r=Math.round((i-t.left)*s.defaultCharacterWidth);if(s.lineWrapping&&e.height>s.defaultLineHeight*1.5){let a=s.viewState.heightOracle.textHeight,l=Math.floor((n-e.top-(s.defaultLineHeight-a)*.5)/a);r+=l*s.viewState.heightOracle.lineLength}let o=s.state.sliceDoc(e.from,e.to);return e.from+Wo(o,r,s.state.tabSize)}function Ed(s,t,e){let i=s.lineBlockAt(t);if(Array.isArray(i.type)){let n;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;(!n||r.type==At.Text&&(n.type!=r.type||(e<0?r.from<t:r.to>t)))&&(n=r)}}return n||i}return i}function Z$(s,t,e,i){let n=Ed(s,t.head,t.assoc||-1),r=!i||n.type!=At.Text||!(s.lineWrapping||n.widgetLineBreaks)?null:s.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(r){let o=s.dom.getBoundingClientRect(),a=s.textDirectionAt(n.from),l=s.posAtCoords({x:e==(a==J.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(l!=null)return Q.cursor(l,e?-1:1)}return Q.cursor(e?n.to:n.from,e?-1:1)}function Db(s,t,e,i){let n=s.state.doc.lineAt(t.head),r=s.bidiSpans(n),o=s.textDirectionAt(n.from);for(let a=t,l=null;;){let h=bb(n,r,o,a,e),c=Ob;if(!h){if(n.number==(e?s.state.doc.lines:1))return a;c=`
9
+ `,n=s.state.doc.line(n.number+(e?1:-1)),r=s.bidiSpans(n),h=s.visualLineSide(n,!e)}if(l){if(!l(c))return a}else{if(!i)return h;l=i(c)}a=h}}function D$(s,t,e){let i=s.state.charCategorizer(t),n=i(e);return r=>{let o=i(r);return n==lt.Space&&(n=o),n==o}}function q$(s,t,e,i){let n=t.head,r=e?1:-1;if(n==(e?s.state.doc.length:0))return Q.cursor(n,t.assoc);let o=t.goalColumn,a,l=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n,t.assoc||((t.empty?e:t.head==t.from)?1:-1)),c=s.documentTop;if(h)o==null&&(o=h.left-l.left),a=r<0?h.top:h.bottom;else{let p=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,s.defaultCharacterWidth*(n-p.from))),a=(r<0?p.top:p.bottom)+c}let u=l.left+o,d=s.viewState.heightOracle.textHeight>>1,f=i??d;for(let p=0;;p+=d){let m=a+(f+p)*r,O=Ld(s,{x:u,y:m},!1,r);if(e?m>l.bottom:m<l.top)return Q.cursor(O.pos,O.assoc);let g=s.coordsAtPos(O.pos,O.assoc),y=g?(g.top+g.bottom)/2:0;if(!g||(e?y>a:y<a))return Q.cursor(O.pos,O.assoc,void 0,o)}}function la(s,t,e){for(;;){let i=0;for(let n of s)n.between(t-1,t+1,(r,o,a)=>{if(t>r&&t<o){let l=i||e||(t-r<o-t?-1:1);t=l<0?r:o,i=l}});if(!i)return t}}function qb(s,t){let e=null;for(let i=0;i<t.ranges.length;i++){let n=t.ranges[i],r=null;if(n.empty){let o=la(s,n.from,0);o!=n.from&&(r=Q.cursor(o,-1))}else{let o=la(s,n.from,-1),a=la(s,n.to,1);(o!=n.from||a!=n.to)&&(r=Q.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}r&&(e||(e=t.ranges.slice()),e[i]=r)}return e?Q.create(e,t.mainIndex):t}function Td(s,t,e){let i=la(s.state.facet(na).map(n=>n(s)),e.from,t.head>e.from?-1:1);return i==e.from?e:Q.cursor(i,i<e.from?1:-1)}function Ld(s,t,e,i){let n=s.contentDOM.getBoundingClientRect(),r=n.top+s.viewState.paddingTop,{x:o,y:a}=t,l=a-r,h;for(;;){if(l<0)return new Ae(0,1);if(l>s.viewState.docHeight)return new Ae(s.state.doc.length,-1);if(h=s.elementAtHeight(l),i==null)break;if(h.type==At.Text){if(i<0?h.to<s.viewport.from:h.from>s.viewport.to)break;let d=s.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(d&&(i<0?d.top<=l+r:d.bottom>=l+r))break}let u=s.viewState.heightOracle.textHeight/2;l=i>0?h.bottom+u:h.top-u}if(s.viewport.from>=h.to||s.viewport.to<=h.from){if(e)return null;if(h.type==At.Text){let u=I$(s,n,h,o,a);return new Ae(u,u==h.from?1:-1)}}if(h.type!=At.Text)return l<(h.top+h.bottom)/2?new Ae(h.from,1):new Ae(h.to,-1);let c=s.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=s.docView.lineAt(h.from,-2)),new Md(s,o,a,s.textDirectionAt(h.from)).scanTile(c,h.from)}function B$(s,t,e){for(;;){if(!t||e<ci(t))return!1;if(t==s)return!0;e=Xi(t)+1,t=t.parentNode}}function z$(s,t){let e;for(;!(s==t||!s);s=s.nextSibling){let i=ct.get(s);if(!i?.isWidget())return!1;i&&(e||(e=[])).push(i)}if(e)for(let i of e){let n=i.overrideDOMText;if(n?.length)return!1}return!0}function Bb(s,t,e,i){if(s.isComposite()){let n=-1,r=-1,o=-1,a=-1;for(let l=0,h=i,c=i;l<s.children.length;l++){let u=s.children[l],d=h+u.length;if(h<t&&d>e)return Bb(u,t,e,h);if(d>=t&&n==-1&&(n=l,r=h),h>e&&u.dom.parentNode==s.dom){o=l,a=c;break}c=d,h=d+u.breakAfter}return{from:r,to:a<0?i+s.length:a,startDOM:(n?s.children[n-1].dom.nextSibling:null)||s.dom.firstChild,endDOM:o<s.children.length&&o>=0?s.children[o].dom:null}}else return s.isText()?{from:i,to:i+s.length,startDOM:s.dom,endDOM:s.dom.nextSibling}:null}function zb(s,t){let e,{newSel:i}=t,{state:n}=s,r=n.selection.main,o=s.inputState.lastKeyTime>Date.now()-100?s.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,h=r.from,c=null;(o===8||Z.android&&t.text.length<l-a)&&(h=r.to,c="end");let u=n.doc.sliceString(a,l,Or),d,f;!r.empty&&r.from>=a&&r.to<=l&&(t.typeOver||u!=t.text)&&u.slice(0,r.from-a)==t.text.slice(0,r.from-a)&&u.slice(r.to-a)==t.text.slice(d=t.text.length-(u.length-(r.to-a)))?e={from:r.from,to:r.to,insert:G.of(t.text.slice(r.from-a,d).split(Or))}:(f=jb(u,t.text,h-a,c))&&(Z.chrome&&o==13&&f.toB==f.from+2&&t.text.slice(f.from,f.toB)==Or+Or&&f.toB--,e={from:a+f.from,to:a+f.toA,insert:G.of(t.text.slice(f.from,f.toB).split(Or))})}else i&&(!s.hasFocus&&n.facet(ui)||Vl(i,r))&&(i=null);if(!e&&!i)return!1;if((Z.mac||Z.android)&&e&&e.from==e.to&&e.from==r.head-1&&/^\. ?$/.test(e.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=Q.single(i.main.anchor-1,i.main.head-1)),e={from:e.from,to:e.to,insert:G.of([e.insert.toString().replace("."," ")])}):n.doc.lineAt(r.from).to<r.to&&s.docView.lineHasWidget(r.to)&&s.inputState.insertingTextAt>Date.now()-50?e={from:r.from,to:r.to,insert:n.toText(s.inputState.insertingText)}:Z.chrome&&e&&e.from==e.to&&e.from==r.head&&e.insert.toString()==`
10
+ `&&s.lineWrapping&&(i&&(i=Q.single(i.main.anchor-1,i.main.head-1)),e={from:r.from,to:r.to,insert:G.of([" "])}),e)return Id(s,e,i,o);if(i&&!Vl(i,r)){let a=!1,l="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(a=!0),l=s.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=qb(n.facet(na).map(h=>h(s)),i))),s.dispatch({selection:i,scrollIntoView:a,userEvent:l}),!0}else return!1}function Id(s,t,e,i=-1){if(Z.ios&&s.inputState.flushIOSKey(t))return!0;let n=s.state.selection.main;if(Z.android&&(t.to==n.to&&(t.from==n.from||t.from==n.from-1&&s.state.sliceDoc(t.from,n.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&ur(s.contentDOM,"Enter",13)||(t.from==n.from-1&&t.to==n.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>n.head)&&ur(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&ur(s.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let o,a=()=>o||(o=j$(s,t,e));return s.state.facet(wb).some(l=>l(s,t.from,t.to,r,a))||s.dispatch(a()),!0}function j$(s,t,e){let i,n=s.state,r=n.selection.main,o=-1;if(t.from==t.to&&t.from<r.from||t.from>r.to){let l=t.from<r.from?-1:1,h=l<0?r.from:r.to,c=la(n.facet(na).map(u=>u(s)),h,l);t.from==c&&(o=c)}if(o>-1)i={changes:t,selection:Q.cursor(t.from+t.insert.length,-1)};else if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&s.inputState.composing<0){let l=r.from<t.from?n.sliceDoc(r.from,t.from):"",h=r.to>t.to?n.sliceDoc(t.to,r.to):"";i=n.replaceSelection(s.state.toText(l+t.insert.sliceString(0,void 0,s.state.lineBreak)+h))}else{let l=n.changes(t),h=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&(s.inputState.composing>=0||s.inputState.compositionPendingChange)&&t.to<=r.to+10&&t.to>=r.to-10){let c=s.state.sliceDoc(t.from,t.to),u,d=e&&Zb(s,e.main.head);if(d){let p=t.insert.length-(t.to-t.from);u={from:d.from,to:d.to-p}}else u=s.state.doc.lineAt(r.head);let f=r.to-t.to;i=n.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:h||p.map(l)};let m=p.to-f,O=m-c.length;if(s.state.sliceDoc(O,m)!=c||m>=u.from&&O<=u.to)return{range:p};let g=n.changes({from:O,to:m,insert:t.insert}),y=p.to-r.to;return{changes:g,range:h?Q.range(Math.max(0,h.anchor+y),Math.max(0,h.head+y)):p.map(g)}})}else i={changes:l,selection:h&&n.selection.replaceRange(h)}}let a="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,a+=".compose",s.inputState.compositionFirstChange&&(a+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:a,scrollIntoView:!0})}function jb(s,t,e,i){let n=Math.min(s.length,t.length),r=0;for(;r<n&&s.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==n&&s.length==t.length)return null;let o=s.length,a=t.length;for(;o>0&&a>0&&s.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,r-Math.min(o,a));e-=o+l-r}if(o<r&&s.length<t.length){let l=e<=r&&e>=o?r-e:0;r-=l,a=r+(a-o),o=r}else if(a<r){let l=e<=r&&e>=a?r-e:0;r-=l,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}function N$(s){let t=[];if(s.root.activeElement!=s.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return e&&(t.push(new _l(e,i)),(n!=e||r!=i)&&t.push(new _l(n,r))),t}function _$(s,t){if(s.length==0)return null;let e=s[0].pos,i=s.length==2?s[1].pos:e;return e>-1&&i>-1?Q.single(e+t,i+t):null}function Vl(s,t){return t.head==s.main.head&&t.anchor==s.main.anchor}function Nb(s,t){return(e,i)=>{try{return t.call(s,i,e)}catch(n){St(e.state,n)}}}function V$(s){let t=Object.create(null);function e(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of s){let n=i.spec,r=n&&n.plugin.domEventHandlers,o=n&&n.plugin.domEventObservers;if(r)for(let a in r){let l=r[a];l&&e(a).handlers.push(Nb(i.value,l))}if(o)for(let a in o){let l=o[a];l&&e(a).observers.push(Nb(i.value,l))}}for(let i in Ze)e(i).handlers.push(Ze[i]);for(let i in ae)e(i).observers.push(ae[i]);return t}function Yl(s){return Math.max(0,s)*.7+8}function Y$(s,t){return Math.max(Math.abs(s.clientX-t.clientX),Math.abs(s.clientY-t.clientY))}function U$(s,t){let e=s.state.facet(yb);return e.length?e[0](t):Z.mac?t.metaKey:t.ctrlKey}function F$(s,t){let e=s.state.facet(vb);return e.length?e[0](t):Z.mac?!t.altKey:!t.ctrlKey}function G$(s,t){let{main:e}=s.state.selection;if(e.empty)return!1;let i=Go(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r<n.length;r++){let o=n[r];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function H$(s,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=s.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=ct.get(e))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}function K$(s){let t=s.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{s.focus(),e.remove(),Yb(s,e.value)},50)}function Ul(s,t,e){for(let i of s.facet(t))e=i(e,s);return e}function Yb(s,t){t=Ul(s.state,gd,t);let{state:e}=s,i,n=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(qd!=null&&e.selection.ranges.every(l=>l.empty)&&qd==r.toString()){let l=-1;i=e.changeByRange(h=>{let c=e.doc.lineAt(h.from);if(c.from==l)return{range:h};l=c.from;let u=e.toText((o?r.line(n++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:u},range:Q.cursor(h.from+u.length)}})}else o?i=e.changeByRange(l=>{let h=r.line(n++);return{changes:{from:l.from,to:l.to,insert:h.text},range:Q.cursor(l.from+h.length)}}):i=e.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Ub(s,t,e,i){if(i==1)return Q.cursor(t,e);if(i==2)return X$(s.state,t,e);{let n=s.docView.lineAt(t,e),r=s.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:r.from,a=n?n.posAtEnd:r.to;return a<s.state.doc.length&&a==r.to&&a++,Q.range(o,a)}}function Kb(s){if(!J$)return s.detail;let t=Fb,e=Hb;return Fb=s,Hb=Date.now(),Gb=!t||e>Date.now()-400&&Math.abs(t.clientX-s.clientX)<2&&Math.abs(t.clientY-s.clientY)<2?(Gb+1)%3:1}function tA(s,t){let e=s.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=Kb(t),n=s.state.selection;return{update(r){r.docChanged&&(e.pos=r.changes.mapPos(e.pos),n=n.map(r.changes))},get(r,o,a){let l=s.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=Ub(s,l.pos,l.assoc,i);if(e.pos!=l.pos&&!o){let u=Ub(s,e.pos,e.assoc,i),d=Math.min(u.from,c.from),f=Math.max(u.to,c.to);c=d<c.from?Q.range(d,f,c.assoc):Q.range(f,d,c.assoc)}return o?n.replaceRange(n.main.extend(c.from,c.to,c.assoc)):a&&i==1&&n.ranges.length>1&&(h=eA(n,l.pos))?h:a?n.addRange(c):Q.create([c])}}}function eA(s,t){for(let e=0;e<s.ranges.length;e++){let{from:i,to:n}=s.ranges[e];if(i<=t&&n>=t)return Q.create(s.ranges.slice(0,e).concat(s.ranges.slice(e+1)),s.mainIndex==e?0:s.mainIndex-(s.mainIndex>e?1:0))}return null}function Jb(s,t,e,i){if(e=Ul(s.state,gd,e),!e)return;let n=s.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=s.inputState,o=i&&r&&F$(s,t)?{from:r.from,to:r.to}:null,a={from:n,insert:e},l=s.state.changes(o?[o,a]:a);s.focus(),s.dispatch({changes:l,selection:{anchor:l.mapPos(n,-1),head:l.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),s.inputState.draggedContent=null}function iA(s,t){let e=s.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),s.focus()},50)}function sA(s){let t=[],e=[],i=!1;for(let n of s.selection.ranges)n.empty||(t.push(s.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:r}of s.selection.ranges){let o=s.doc.lineAt(r);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(s.doc.length,o.to+1)})),n=o.number}i=!0}return{text:Ul(s,Od,t.join(s.lineBreak)),ranges:e,linewise:i}}function ey(s,t){let e=[];for(let i of s.facet(kb)){let n=i(s,t);n&&e.push(n)}return e.length?s.update({effects:e,annotations:ty.of(!0)}):null}function iy(s){setTimeout(()=>{let t=s.hasFocus;if(t!=s.inputState.notifiedFocused){let e=ey(s.state,t);e?s.dispatch(e):s.update([])}},10)}function nA(s){sy.has(s)||(sy.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}function Bd(){vs=!1}function Kl(s,t){return s==t?s:(s.constructor!=t.constructor&&(vs=!0),t)}function ry(s,t){let e,i;s[t]==null&&(e=s[t-1])instanceof Zi&&(i=s[t+1])instanceof Zi&&s.splice(t-1,3,new Zi(e.length+1+i.length))}function aA(s,t,e){let i=new Nd;return U.compare(s,t,e,i,0),i.changes}function lA(s,t){let e=s.getBoundingClientRect(),i=s.ownerDocument,n=i.defaultView||window,r=Math.max(0,e.left),o=Math.min(n.innerWidth,e.right),a=Math.max(0,e.top),l=Math.min(n.innerHeight,e.bottom);for(let h=s.parentNode;h&&h!=i.body;)if(h.nodeType==1){let c=h,u=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&u.overflow!="visible"){let d=c.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(h==s.parentNode?n.innerHeight:l,d.bottom)}h=u.position=="absolute"||u.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-e.left,right:Math.max(r,o)-e.left,top:a-(e.top+t),bottom:Math.max(a,l)-(e.top+t)}}function hA(s){let t=s.getBoundingClientRect(),e=s.ownerDocument.defaultView||window;return t.left<e.innerWidth&&t.right>0&&t.top<e.innerHeight&&t.bottom>0}function cA(s,t){let e=s.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}function uA(s,t,e){let i=[],n=s,r=0;return U.spans(e,s,t,{span(){},point(o,a){o>n&&(i.push({from:n,to:o}),r+=o-n),n=a}},20),n<t&&(i.push({from:n,to:t}),r+=t-n),{total:r,ranges:i}}function eh({total:s,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(s*e);for(let n=0;;n++){let{from:r,to:o}=t[n],a=o-r;if(i<=a)return r+i;i-=a}}function ih(s,t){let e=0;for(let{from:i,to:n}of s.ranges){if(t<=n){e+=t-i;break}e+=n-i}return e/s.total}function dA(s,t){for(let e of s)if(t(e))return e}function ay(s){let t=s.facet(zl).filter(i=>typeof i!="function"),e=s.facet(bd).filter(i=>typeof i!="function");return e.length&&t.push(U.join(e)),t}function ca(s,t){if(t.scale==1)return s;let e=t.toDOM(s.top),i=t.toDOM(s.bottom);return new Qe(s.from,s.length,e,i-e,Array.isArray(s._content)?s._content.map(n=>ca(n,t)):s._content)}function Ud(s,t,e){return new ke(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return s;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):s+" "+i}})}function uy(s,t,e){for(;t;){let i=ct.get(t);if(i&&i.parent==s)return i;let n=t.parentNode;t=n!=s.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function dy(s,t){let e=t.startContainer,i=t.startOffset,n=t.endContainer,r=t.endOffset,o=s.docView.domAtPos(s.state.selection.main.anchor,1);return Jo(o.node,o.offset,n,r)&&([e,i,n,r]=[n,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:n,focusOffset:r}}function mA(s,t){if(t.getComposedRanges){let n=t.getComposedRanges(s.root)[0];if(n)return dy(s,n)}let e=null;function i(n){n.preventDefault(),n.stopImmediatePropagation(),e=n.getTargetRanges()[0]}return s.contentDOM.addEventListener("beforeinput",i,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",i,!0),e?dy(s,e):null}function py(s,t,e){for(let i=s.state.facet(t),n=i.length-1;n>=0;n--){let r=i[n],o=typeof r=="function"?r(s):r;o&&ad(o,e)}return e}function bA(s,t){let e=s.split(/-(?!$)/),i=e[e.length-1];i=="Space"&&(i=" ");let n,r,o,a;for(let l=0;l<e.length-1;++l){let h=e[l];if(/^(cmd|meta|m)$/i.test(h))a=!0;else if(/^a(lt)?$/i.test(h))n=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))t=="mac"?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+h)}return n&&(i="Alt-"+i),r&&(i="Ctrl-"+i),a&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function rh(s,t,e){return t.altKey&&(s="Alt-"+s),t.ctrlKey&&(s="Ctrl-"+s),t.metaKey&&(s="Meta-"+s),e!==!1&&t.shiftKey&&(s="Shift-"+s),s}function gy(s){let t=s.facet(He),e=my.get(t);return e||my.set(t,e=SA(t.reduce((i,n)=>i.concat(n),[]))),e}function vA(s,t,e){return Oy(gy(s.state),t,s,e)}function SA(s,t=OA){let e=Object.create(null),i=Object.create(null),n=(o,a)=>{let l=i[o];if(l==null)i[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,l,h,c)=>{var u,d;let f=e[o]||(e[o]=Object.create(null)),p=a.split(/ (?!$)/).map(g=>bA(g,t));for(let g=1;g<p.length;g++){let y=p.slice(0,g).join(" ");n(y,!0),f[y]||(f[y]={preventDefault:!0,stopPropagation:!1,run:[v=>{let x=Di={view:v,prefix:y,scope:o};return setTimeout(()=>{Di==x&&(Di=null)},xA),!0}]})}let m=p.join(" ");n(m,!1);let O=f[m]||(f[m]={preventDefault:!1,stopPropagation:!1,run:((d=(u=f._any)===null||u===void 0?void 0:u.run)===null||d===void 0?void 0:d.slice())||[]});l&&O.run.push(l),h&&(O.preventDefault=!0),c&&(O.stopPropagation=!0)};for(let o of s){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let c=e[h]||(e[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let d in c)c[d].run.push(f=>u(f,Kd))}let l=o[t]||o.key;if(l)for(let h of a)r(h,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return e}function Oy(s,t,e,i){Kd=t;let n=FO(t),r=Xt(n,0),o=we(r)==n.length&&n!=" ",a="",l=!1,h=!1,c=!1;Di&&Di.view==e&&Di.scope==i&&(a=Di.prefix+" ",Vb.indexOf(t.keyCode)<0&&(h=!0,Di=null));let u=new Set,d=O=>{if(O){for(let g of O.run)if(!u.has(g)&&(u.add(g),g(e)))return O.stopPropagation&&(c=!0),!0;O.preventDefault&&(O.stopPropagation&&(c=!0),h=!0)}return!1},f=s[i],p,m;return f&&(d(f[a+rh(n,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Z.windows&&t.ctrlKey&&t.altKey)&&!(Z.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=hi[t.keyCode])&&p!=n?(d(f[a+rh(p,t,!0)])||t.shiftKey&&(m=hr[t.keyCode])!=n&&m!=p&&d(f[a+rh(m,t,!1)]))&&(l=!0):o&&t.shiftKey&&d(f[a+rh(n,t,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),h&&(l=!0),l&&c&&t.stopPropagation(),Kd=null,l}function by(s){let t=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==J.LTR?t.left:t.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:t.top-s.scrollDOM.scrollTop*s.scaleY}}function yy(s,t,e,i){let n=s.coordsAtPos(t,e*2);if(!n)return i;let r=s.dom.getBoundingClientRect(),o=(n.top+n.bottom)/2,a=s.posAtCoords({x:r.left+1,y:o}),l=s.posAtCoords({x:r.right-1,y:o});return a==null||l==null?i:{from:Math.max(i.from,Math.min(a,l)),to:Math.min(i.to,Math.max(a,l))}}function wA(s,t,e){if(e.to<=s.viewport.from||e.from>=s.viewport.to)return[];let i=Math.max(e.from,s.viewport.from),n=Math.min(e.to,s.viewport.to),r=s.textDirection==J.LTR,o=s.contentDOM,a=o.getBoundingClientRect(),l=by(s),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Ed(s,i,1),p=Ed(s,n,-1),m=f.type==At.Text?f:null,O=p.type==At.Text?p:null;if(m&&(s.lineWrapping||f.widgetLineBreaks)&&(m=yy(s,i,1,m)),O&&(s.lineWrapping||p.widgetLineBreaks)&&(O=yy(s,n,-1,O)),m&&O&&m.from==O.from&&m.to==O.to)return y(v(e.from,e.to,m));{let S=m?v(e.from,null,m):x(f,!1),$=O?v(null,e.to,O):x(p,!0),k=[];return(m||f).to<(O||p).from-(m&&O?1:0)||f.widgetLineBreaks>1&&S.bottom+s.defaultLineHeight/2<$.top?k.push(g(u,S.bottom,d,$.top)):S.bottom<$.top&&s.elementAtHeight((S.bottom+$.top)/2).type==At.Text&&(S.bottom=$.top=(S.bottom+$.top)/2),y(S).concat(k).concat(y($))}function g(S,$,k,P){return new qi(t,S-l.left,$-l.top,Math.max(0,k-S),P-$)}function y({top:S,bottom:$,horizontal:k}){let P=[];for(let T=0;T<k.length;T+=2)P.push(g(k[T],S,k[T+1],$));return P}function v(S,$,k){let P=1e9,T=-1e9,C=[];function I(_,V,tt,rt,pt){let ut=s.coordsAtPos(_,_==k.to?-2:2),yt=s.coordsAtPos(tt,tt==k.from?2:-2);!ut||!yt||(P=Math.min(ut.top,yt.top,P),T=Math.max(ut.bottom,yt.bottom,T),pt==J.LTR?C.push(r&&V?u:ut.left,r&&rt?d:yt.right):C.push(!r&&rt?u:yt.left,!r&&V?d:ut.right))}let X=S??k.from,N=$??k.to;for(let _ of s.visibleRanges)if(_.to>X&&_.from<N)for(let V=Math.max(_.from,X),tt=Math.min(_.to,N);;){let rt=s.state.doc.lineAt(V);for(let pt of s.bidiSpans(rt)){let ut=pt.from+rt.from,yt=pt.to+rt.from;if(ut>=tt)break;yt>V&&I(Math.max(ut,V),S==null&&ut<=X,Math.min(yt,tt),$==null&&yt>=N,pt.dir)}if(V=rt.to+1,V>=tt)break}return C.length==0&&I(X,S==null,N,$==null,s.textDirection),{top:P,bottom:T,horizontal:C}}function x(S,$){let k=a.top+($?S.top:S.bottom);return{top:k,bottom:k,horizontal:[]}}}function kA(s,t){return s.constructor==t.constructor&&s.eq(t)}function tf(s){return[nt.define(t=>new Jd(t,s)),oh.of(s)]}function bh(s={}){return[xs.of(s),AA,QA,PA,Ab.of(!0)]}function $A(s){return s.facet(xs)}function vy(s){return s.startState.facet(xs)!=s.state.facet(xs)}function xy(s,t){t.style.animationDuration=s.facet(xs).cursorBlinkRate+"ms"}function EA(){return[ua,CA]}function wy(s,t,e,i,n){t.lastIndex=0;for(let r=s.iterRange(e,i),o=e,a;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=t.exec(r.value);)n(o+a.index,a)}function TA(s,t){let e=s.visibleRanges;if(e.length==1&&e[0].from==s.viewport.from&&e[0].to==s.viewport.to)return e;let i=[];for(let{from:n,to:r}of e)n=Math.max(s.state.doc.lineAt(n).from,n-t),r=Math.min(s.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=n?i[i.length-1].to=r:i.push({from:n,to:r});return i}function RA(){var s;if(sf==null&&typeof document<"u"&&document.body){let t=document.body.style;sf=((s=t.tabSize)!==null&&s!==void 0?s:t.MozTabSize)!=null}return sf||!1}function XA(s={}){return[ah.of(s),IA()]}function IA(){return ky||(ky=nt.fromClass(class{constructor(s){this.view=s,this.decorations=B.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(ah)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new yr({regexp:s.specialChars,decoration:(t,e,i)=>{let{doc:n}=e.state,r=Xt(t[0],0);if(r==9){let o=n.lineAt(i),a=e.state.tabSize,l=It(o.text,a,i-o.from);return B.replace({widget:new rf((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=B.replace({widget:new nf(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let t=s.state.facet(ah);s.startState.facet(ah)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}function DA(s){return s>=32?ZA:s==10?"\u2424":String.fromCharCode(9216+s)}function qA(){return[$y,Bl.of(s=>{var t;return((t=s.plugin($y))===null||t===void 0?void 0:t.attrs)||null})]}function yh(){return zA}function vh(s){let t=nt.fromClass(class{constructor(e){this.view=e,this.placeholder=s?B.set([B.widget({widget:new of(s),side:1}).range(0)]):B.none}get decorations(){return this.view.state.doc.length?B.none:this.placeholder}},{decorations:e=>e.decorations});return typeof s=="string"?[t,L.contentAttributes.of({"aria-placeholder":s})]:t}function jA(s,t,e){let i=Math.min(t.line,e.line),n=Math.max(t.line,e.line),r=[];if(t.off>af||e.off>af||t.col<0||e.col<0){let o=Math.min(t.off,e.off),a=Math.max(t.off,e.off);for(let l=i;l<=n;l++){let h=s.doc.line(l);h.length<=a&&r.push(Q.range(h.from+o,h.to+a))}}else{let o=Math.min(t.col,e.col),a=Math.max(t.col,e.col);for(let l=i;l<=n;l++){let h=s.doc.line(l),c=Wo(h.text,o,s.tabSize,!0);if(c<0)r.push(Q.cursor(h.to));else{let u=Wo(h.text,a,s.tabSize);r.push(Q.range(h.from+c,h.from+u))}}}return r}function NA(s,t){let e=s.coordsAtPos(s.viewport.from);return e?Math.round(Math.abs((e.left-t)/s.defaultCharacterWidth)):-1}function Ay(s,t){let e=s.posAtCoords({x:t.clientX,y:t.clientY},!1),i=s.state.doc.lineAt(e),n=e-i.from,r=n>af?-1:n==i.length?NA(s,t.clientX):It(i.text,s.state.tabSize,e-i.from);return{line:i.number,col:r,off:n}}function _A(s,t){let e=Ay(s,t),i=s.state.selection;return e?{update(n){if(n.docChanged){let r=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(r);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},i=i.map(n.changes)}},get(n,r,o){let a=Ay(s,n);if(!a)return i;let l=jA(s.state,e,a);return l.length?o?Q.create(l.concat(i.ranges)):Q.create(l):i}}:null}function VA(s){let t=s?.eventFilter||(e=>e.altKey&&e.button==0);return L.mouseSelectionStyle.of((e,i)=>t(i)?_A(e,i):null)}function UA(s={}){let[t,e]=WA[s.key||"Alt"],i=nt.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[i,L.contentAttributes.of(n=>{var r;return!((r=n.plugin(i))===null||r===void 0)&&r.isDown?YA:null})]}function FA(s={}){return ch.of(s)}function GA(s){let t=s.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}function Py(s,t){let e=parseInt(s.style.left,10);(isNaN(e)||Math.abs(t-e)>1)&&(s.style.left=t+"px")}function tQ(s,t){let{left:e,right:i,top:n,bottom:r}=s.getBoundingClientRect(),o;if(o=s.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();n=Math.min(a.top,n),r=Math.max(a.bottom,r)}return t.clientX>=e-fh&&t.clientX<=i+fh&&t.clientY>=n-fh&&t.clientY<=r+fh}function eQ(s,t,e,i,n,r){let o=s.scrollDOM.getBoundingClientRect(),a=s.documentTop+s.documentPadding.top+s.contentHeight;if(o.left>i||o.right<i||o.top>n||Math.min(o.bottom,a)<n)return!1;let l=s.posAtCoords({x:i,y:n},!1);return l>=t&&l<=e}function mf(s,t={}){let e=j.define(),i=ht.define({create(){return[]},update(n,r){if(n.length&&(t.hideOnChange&&(r.docChanged||r.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(r,o))),r.docChanged)){let o=[];for(let a of n){let l=r.changes.mapPos(a.pos,-1,gt.TrackDel);if(l!=null){let h=Object.assign(Object.create(null),a);h.pos=l,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of r.effects)o.is(e)&&(n=o.value),o.is(Cy)&&(n=[]);return n},provide:n=>da.from(n)});return{active:i,extension:[i,nt.define(n=>new lf(n,s,i,e,t.hoverTime||300)),JA]}}function xh(s,t){let e=s.plugin(uh);if(!e)return null;let i=e.manager.tooltips.indexOf(t);return i<0?null:e.manager.tooltipViews[i]}function iQ(s){return s.facet(da).some(t=>t)}function nQ(s){let t=s.plugin(uh);t&&t.maybeMeasure()}function rQ(s){return s?[hf.of(s)]:[]}function Oh(s,t){let e=s.plugin(Ey),i=e?e.specs.indexOf(t):-1;return i>-1?e.panels[i]:null}function Ty(s){let t=s.nextSibling;return s.remove(),t}function oQ(s,t){let e,i=new Promise(o=>e=o),n=o=>lQ(o,t,e);s.state.field(ph,!1)?s.dispatch({effects:Ly.of(n)}):s.dispatch({effects:j.appendConfig.of(ph.init(()=>[n]))});let r=My.of(n);return{close:r,result:i.then(o=>((s.win.queueMicrotask||(l=>s.win.setTimeout(l,10)))(()=>{s.state.field(ph).indexOf(n)>-1&&s.dispatch({effects:r})}),o))}}function aQ(s,t){let e=s.state.field(ph,!1)||[];for(let i of e){let n=Oh(s,i);if(n&&n.dom.classList.contains(t))return n}return null}function lQ(s,t,e){let i=t.content?t.content(s,()=>o(null)):null;if(!i){if(i=xt("form"),t.input){let a=xt("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),i.appendChild(xt("label",(t.label||"")+": ",a))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(xt("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let n=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let a=0;a<n.length;a++){let l=n[a];l.addEventListener("keydown",h=>{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(l))}),l.addEventListener("submit",h=>{h.preventDefault(),o(l)})}let r=xt("div",i,xt("button",{onclick:()=>o(null),"aria-label":s.state.phrase("close"),class:"cm-dialog-close",type:"button"},["\xD7"]));t.class&&(r.className=t.class),r.classList.add("cm-dialog");function o(a){r.contains(r.ownerDocument.activeElement)&&s.focus(),e(a)}return{dom:r,top:t.top,mount:()=>{if(t.focus){let a;typeof t.focus=="string"?a=i.querySelector(t.focus):a=i.querySelector("input")||i.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}function ga(s){return[uf(),pa.of({...hQ,...s})]}function uf(s){let t=[cQ];return s&&s.fixed===!1&&t.push(cf.of(!0)),t}function Xy(s){return Array.isArray(s)?s:[s]}function df(s,t,e){for(;s.value&&s.from<=e;)s.from==e&&t.push(s.value),s.next()}function uQ(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(!s[e].compare(t[e]))return!1;return!0}function pf(s,t){return s.state.facet(xr).formatNumber(t,s.state)}function Sh(s={}){return[xr.of(s),uf(),dQ]}function Dy(s){let t=9;for(;t<s;)t=t*10+9;return t}function wh(){return pQ}function qy(s){return nt.define(t=>({decorations:s.createDeco(t),update(e){this.decorations=s.updateDeco(e,this.decorations)}}),{decorations:t=>t.decorations})}function bQ(){return OQ}function vQ(){return yQ}var Wt,id,sd,KO,nd,Il,JO,rd,tb,od,eb,Z,Zl,Ct,At,B,Yo,Uo,ms,Fo,cd,gs,lb,Fe,J,Os,ud,f$,p$,dd,Ge,m$,ve,it,Ob,yb,vb,xb,Sb,md,wb,kb,gd,Od,$b,Ab,Qb,ia,ql,Pb,ui,v$,dr,nt,sa,Cb,Bl,zl,Eb,bd,na,Tb,Mb,ra,$e,oa,x$,ct,fr,pr,di,mr,oe,bs,ys,gr,vd,xd,Sd,wd,jl,kd,$d,Ib,Ii,Qd,Nl,E$,Cd,aa,Ae,Md,Or,Rd,_l,Xd,Zd,_b,W$,Vb,Wl,Dd,Ze,ae,Wb,J$,Fb,Gb,Hb,qd,ty,sy,ny,vs,Fl,Gl,Qe,st,Hl,le,rA,Jl,Pe,Zi,zd,oA,jd,Nd,ha,_d,th,br,oy,Vd,sh,Wd,Yd,ly,hy,cy,fA,pA,Fd,Gd,Hd,L,gA,fy,nh,OA,yA,He,my,Di,xA,Kd,qi,Jd,oh,xs,AA,QA,PA,Sy,ua,CA,yr,ef,LA,MA,sf,ah,ky,ZA,nf,rf,$y,BA,zA,of,af,WA,YA,lh,hh,ch,Qy,uh,HA,KA,Ss,da,dh,JA,lf,fh,Cy,sQ,hf,Ey,vr,Sr,ph,Ly,My,Yt,fa,Ry,hQ,pa,cf,cQ,ff,mh,gh,Iy,Zy,xr,ma,dQ,fQ,pQ,mQ,gQ,OQ,yQ,xQ,fi=W(()=>{Ue();td();GO();ed();Wt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},id=typeof document<"u"?document:{documentElement:{style:{}}},sd=/Edge\/(\d+)/.exec(Wt.userAgent),KO=/MSIE \d/.test(Wt.userAgent),nd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wt.userAgent),Il=!!(KO||nd||sd),JO=!Il&&/gecko\/(\d+)/i.test(Wt.userAgent),rd=!Il&&/Chrome\/(\d+)/.exec(Wt.userAgent),tb="webkitFontSmoothing"in id.documentElement.style,od=!Il&&/Apple Computer/.test(Wt.vendor),eb=od&&(/Mobile\/\w+/.test(Wt.userAgent)||Wt.maxTouchPoints>2),Z={mac:eb||/Mac/.test(Wt.platform),windows:/Win/.test(Wt.platform),linux:/Linux|X11/.test(Wt.platform),ie:Il,ie_version:KO?id.documentMode||6:nd?+nd[1]:sd?+sd[1]:0,gecko:JO,gecko_version:JO?+(/Firefox\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,chrome:!!rd,chrome_version:rd?+rd[1]:0,ios:eb,android:/Android\b/.test(Wt.userAgent),webkit:tb,webkit_version:tb?+(/\bAppleWebKit\/(\d+)/.exec(Wt.userAgent)||[0,0])[1]:0,safari:od,safari_version:od?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Wt.userAgent)||[0,0])[1]:0,tabSize:id.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};Zl=Object.create(null);Ct=class{eq(t){return!1}updateDOM(t,e,i){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},At=(function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s})(At||(At={})),B=class extends be{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Yo(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new ms(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,n;if(t.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=sb(t,e);i=(r?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new ms(t,i,n,e,t.widget||null,!0)}static line(t){return new Uo(t)}static set(t,e=!1){return U.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};B.none=U.empty;Yo=class s extends B{constructor(t){let{start:e,end:i}=sb(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?ad(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Zl}eq(t){return this==t||t instanceof s&&this.tagName==t.tagName&&ld(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}};Yo.prototype.point=!1;Uo=class s extends B{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof s&&this.spec.class==t.spec.class&&ld(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}};Uo.prototype.mapMode=gt.TrackBefore,Uo.prototype.point=!0;ms=class s extends B{constructor(t,e,i,n,r,o){super(e,i,r,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?gt.TrackBefore:gt.TrackAfter:gt.TrackDel}get type(){return this.startSide!=this.endSide?At.WidgetRange:this.startSide<=0?At.WidgetBefore:At.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof s&&l$(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}};ms.prototype.point=!0;Fo=class s extends be{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof s&&this.tagName==t.tagName&&ld(this.attributes,t.attributes)}static create(t){return new s(t.tagName,t.attributes||Zl)}static set(t,e=!1){return U.of(t,e)}};Fo.prototype.startSide=Fo.prototype.endSide=-1;cd=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ci(e):0),i,Math.min(t.focusOffset,i?ci(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}},gs=null;Z.safari&&Z.safari_version>=26&&(gs=!1);Fe=class s{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new s(t.parentNode,Xi(t),e)}static after(t,e){return new s(t.parentNode,Xi(t)+1,e)}},J=(function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s})(J||(J={})),Os=J.LTR,ud=J.RTL;f$=db("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),p$=db("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),dd=Object.create(null),Ge=[];for(let s of["()","[]","{}"]){let t=s.charCodeAt(0),e=s.charCodeAt(1);dd[t]=e,dd[e]=-t}m$=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,ve=class{get dir(){return this.level%2?ud:Os}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,n){let r=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=e&&a.to>=e){if(a.level==i)return o;(r<0||(n!=0?n<0?a.from<e:a.to>e:t[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}};it=[];Ob="";yb=R.define(),vb=R.define(),xb=R.define(),Sb=R.define(),md=R.define(),wb=R.define(),kb=R.define(),gd=R.define(),Od=R.define(),$b=R.define({combine:s=>s.some(t=>t)}),Ab=R.define({combine:s=>s.some(t=>t)}),Qb=R.define(),ia=class s{constructor(t,e,i,n,r,o=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new s(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new s(Q.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},ql=j.define({map:(s,t)=>s.map(t)}),Pb=j.define();ui=R.define({combine:s=>s.length?s[0]:!0}),v$=0,dr=R.define({combine(s){return s.filter((t,e)=>{for(let i=0;i<e;i++)if(s[i].plugin==t.plugin)return!1;return!0})}}),nt=class s{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(dr.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(dr.of({plugin:this,arg:t}))}static define(t,e){let{eventHandlers:i,eventObservers:n,provide:r,decorations:o}=e||{};return new s(v$++,t,i,n,a=>{let l=[];return o&&l.push(zl.of(h=>{let c=h.plugin(a);return c?o(c):B.none})),r&&l.push(r(a)),l})}static fromClass(t,e){return s.define((i,n)=>new t(i,n),e)}},sa=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(St(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){St(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){St(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Cb=R.define(),Bl=R.define(),zl=R.define(),Eb=R.define(),bd=R.define(),na=R.define(),Tb=R.define();Mb=R.define();ra=R.define(),$e=class s{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new s(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(e.length==0)return t;let i=[];for(let n=0,r=0,o=0;;){let a=n<t.length?t[n].fromB:1e9,l=r<e.length?e[r]:1e9,h=Math.min(a,l);if(h==1e9)break;let c=h+o,u=h,d=c;for(;;)if(r<e.length&&e[r]<=u){let f=e[r+1];r+=2,u=Math.max(u,f);for(let p=n;p<t.length&&t[p].fromB<=u;p++)o=t[p].toA-t[p].toB;d=Math.max(d,f+o)}else if(n<t.length&&t[n].fromB<=u){let f=t[n++];u=Math.max(u,f.toB),d=Math.max(d,f.toA),o=f.toA-f.toB}else break;i.push(new s(c,d,h,u))}return i}},oa=class s{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=Rt.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,a,l)=>n.push(new $e(r,o,a,l))),this.changedRanges=n}static create(t,e,i){return new s(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},x$=[],ct=class{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return x$}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&o$(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let n of this.children){if(n==t)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let i=Xi(this.dom),n=this.length?t>0:e>0;return new Fe(this.parent.dom,i+(n?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof pr)return t;return null}static get(t){return t.cmTile}},fr=class extends ct{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,i=null,n,r=t?.node==e?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,n=i?i.nextSibling:e.firstChild,r&&n!=a.dom&&(r.written=!0),a.dom.parentNode==e)for(;n&&n!=a.dom;)n=Rb(n);else e.insertBefore(a.dom,n);i=a.dom}for(n=i?i.nextSibling:e.firstChild,r&&n&&(r.written=!0);n;)n=Rb(n);this.length=o}};pr=class extends fr{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=ct.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,n=0,r=0;;)if(n==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&r++,n=e.pop()}else{let o=i.children[n++];if(o instanceof di)e.push(n),i=o,n=0;else{let a=r+o.length,l=t(o,r);if(l!==void 0)return l;r=a+o.breakAfter}}}resolveBlock(t,e){let i,n=-1,r,o=-1;if(this.blockTiles((a,l)=>{let h=l+a.length;if(t>=l&&t<=h){if(a.isWidget()&&e>=-1&&e<=1){if(a.flags&32)return!0;a.flags&16&&(i=void 0)}(l<t||t==h&&(e<-1?a.length:a.covers(1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,n=t-l),(h>t||t==l&&(e>1?a.length:a.covers(-1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,o=t-l)}}),!i&&!r)throw new Error("No tile at position "+t);return i&&e<0||!r?{tile:i,offset:n}:{tile:r,offset:o}}},di=class s extends fr{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let i=new s(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}},mr=class s extends fr{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,i){let n=new s(e||document.createElement("div"),t);return(!e||!i)&&(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(t,e,i){let n=null,r=-1,o=null,a=-1;function l(c,u){for(let d=0,f=0;d<c.children.length&&f<=u;d++){let p=c.children[d],m=f+p.length;m>=u&&(p.isComposite()?l(p,u-f):(!o||o.isHidden&&(e>0||i&&w$(o,p)))&&(m>u||p.flags&32)?(o=p,a=u-f):(f<u||p.flags&16&&!p.isHidden)&&(n=p,r=u-f)),f=m}}l(this,t);let h=(e<0?n:o)||n||o;return h?{tile:h,offset:h==n?r:a}:null}coordsIn(t,e){let i=this.resolveInline(t,e,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),e):S$(this)}domIn(t,e){let i=this.resolveInline(t,e);if(i){let{tile:n,offset:r}=i;if(this.dom.contains(n.dom))return n.isText()?new Fe(n.dom,Math.min(n.dom.nodeValue.length,r)):n.domPosFor(r,n.flags&16?1:n.flags&32?-1:e);let o=i.tile.parent,a=!1;for(let l of o.children){if(a)return new Fe(l.dom,0);l==i.tile&&(a=!0)}}return new Fe(this.dom,0)}};oe=class s extends fr{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let i=new s(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}},bs=class s extends ct{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let i=this.dom.nodeValue.length;t>i&&(t=i);let n=t,r=t,o=0;t==0&&e<0||t==i&&e>=0?Z.chrome||Z.gecko||(t?(n--,o=1):r<i&&(r++,o=-1)):e<0?n--:r<i&&r++;let a=ea(this.dom,n,r).getClientRects();if(!a.length)return null;let l=a[(o?o<0:e>=0)?0:a.length-1];return Z.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,h=>h.width)||l),o?ta(l,o<0):l||null}static of(t,e){let i=new s(e||document.createTextNode(t),t);return e||(i.flags|=2),i}},ys=class s extends ct{constructor(t,e,i,n){super(t,e,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;if(i)return ta(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=a?r.length-1:0;o=r[l],!(t>0?l==0:l==r.length-1||o.top<o.bottom);l+=a?-1:1);return ta(o,!a)}}get overrideDOMText(){if(!this.length)return G.empty;let{root:t}=this;if(!t)return G.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,i,n,r){return r||(r=t.toDOM(e),t.editable||(r.contentEditable="false")),new s(r,i,t,n)}},gr=class extends ct{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return G.empty}coordsIn(t){return this.dom.getBoundingClientRect()}},vd=class{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,i){let{tile:n,index:r,beforeBreak:o,parents:a}=this;for(;t||e>0;)if(n.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(r==n.children.length){if(!t&&!a.length)break;i&&i.leave(n),o=!!n.breakAfter,{tile:n,index:r}=a.pop(),r++}else{let l=n.children[r],h=l.breakAfter;(e>0?l.length<=t:l.length<t)&&(!i||i.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!h,r++,t-=l.length):(a.push({tile:n,index:r}),n=l,r=0,i&&l.isComposite()&&i.enter(l))}else if(r==n.length)o=!!n.breakAfter,{tile:n,index:r}=a.pop(),r++;else if(t){let l=Math.min(t,n.length-r);i&&i.skip(n,r,r+l),t-=l,r+=l}else break;return this.tile=n,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},xd=class{constructor(t,e,i,n){this.from=t,this.to=e,this.wrapper=i,this.rank=n}},Sd=class{constructor(t,e,i){this.cache=t,this.root=e,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,i,n){var r;this.flushBuffer();let o=this.ensureMarks(e,i),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new bs(a.dom,a.text+t);l.parent=o}else o.append(n||bs.of(t,(r=this.cache.find(bs))===null||r===void 0?void 0:r.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let i=this.curLine;i.dom!=e.line.dom&&(i.setDOM(this.cache.reused.has(e.line)?Ad(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let n=i;for(let a=e.marks.length-1;a>=0;a--){let l=e.marks[a],h=n.lastChild;if(h instanceof oe&&h.mark.eq(l.mark))h.dom!=l.dom&&h.setDOM(Ad(l.dom)),n=h;else{if(this.cache.reused.get(l)){let u=ct.get(l.dom);u&&u.setDOM(Ad(l.dom))}let c=oe.of(l.mark,l.dom);n.append(c),n=c}this.cache.reused.set(l,2)}let r=ct.get(t.text);r&&this.cache.reused.set(r,2);let o=new bs(t.text,t.text.nodeValue);o.flags|=8,n.append(o)}addInlineWidget(t,e,i){let n=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);n||this.flushBuffer();let r=this.ensureMarks(e,i);!n&&!(t.flags&16)&&r.append(this.getBuffer(1)),r.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=Ib);let n=mr.start(t,e||((i=this.cache.find(mr))===null||i===void 0?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let n=this.curLine;for(let r=t.length-1;r>=0;r--){let o=t[r],a;if(e>0&&(a=n.lastChild)&&a instanceof oe&&a.mark.eq(o))n=a,e--;else{let l=oe.of(o,(i=this.cache.find(oe,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);n.append(l),n=l,e=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!Xb(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Z.ios&&Xb(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Qd,0,32)||new ys(Qd.toDOM(),0,Qd,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new xd(t.from,t.to,t.value,t.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-e.rank||this.wrappers[i-1].to-e.to)<0;)i--;this.wrappers.splice(i,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let n=e.lastChild;if(i.from<this.pos&&n instanceof di&&n.wrapper.eq(i.wrapper))e=n;else{let r=di.of(i.wrapper,(t=this.cache.find(di,o=>o.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);e.append(r),e=r}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(gr,void 0,1);return i&&(i.flags=e),i||new gr(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},wd=class{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:n,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=n;let a=this.textOff=Math.min(t,n.length);return r?null:n.slice(0,a)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}},jl=[ys,mr,bs,oe,gr,di,pr];for(let s=0;s<jl.length;s++)jl[s].bucket=s;kd=class{constructor(t){this.view=t,this.buckets=jl.map(()=>[]),this.index=jl.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let n=t.bucket,r=this.buckets[n],o=this.index[n];for(let a=r.length-1;a>=0;a--){let l=(a+o)%r.length,h=r[l];if((!e||e(h))&&!this.reused.has(h))return r.splice(l,1),l<o&&this.index[n]--,this.reused.set(h,i),h}return null}findWidget(t,e,i){let n=this.buckets[0];if(n.length)for(let r=0,o=0;;r++){if(r==n.length){if(o)return null;o=1,r=0}let a=n[r];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return n.splice(r,1),r<this.index[0]&&this.index[0]--,a.widget==t&&a.length==e&&(a.flags&497)==i?(this.reused.set(a,1),a):(this.reused.set(a,2),new ys(a.dom,e,t,a.flags&-498|i))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}},$d=class{constructor(t,e,i,n,r){this.view=t,this.decorations=n,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new kd(t),this.text=new wd(t.state.doc),this.builder=new Sd(this.cache,new pr(t,t.contentDOM),U.iter(i)),this.cache.reused.set(e,2),this.old=new vd(e),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let n=0,r=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>n){let h=l-n;this.preserve(h,!o,!a),n=l,r+=h}if(!a)break;e&&a.fromA<=e.range.fromA&&a.toA>=e.range.toA?(this.forward(a.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(r,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,i),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,a.toA),this.emit(e.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(r,a.toB)),r=a.toB,n=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,i){let n=A$(this.old),r=this.openMarks;this.old.advance(t,i?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let h=l>0||a<o.length?ys.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,n,r),r=n.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,n,r,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),n,r)),r=n.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof gr)this.cache.add(o);else if(o instanceof oe)this.builder.ensureLine(null),this.builder.addMark(o,n,r),this.cache.reused.set(o,1),r=n.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof oe&&n.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?n.length&&(n.length=r=0):o instanceof oe&&(n.shift(),r=Math.min(r,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,n=this.builder,r=0,o=U.spans(this.decorations,t,e,{point:(a,l,h,c,u,d)=>{if(h instanceof ms){if(this.disallowBlockEffectsFor[d]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,u>c.length)n.continueWidget(l-a);else{let f=h.widget||(h.block?Ii.block:Ii.inline),p=k$(h),m=this.cache.findWidget(f,l-a,p)||ys.of(f,this.view,l-a,p);h.block?(h.startSide>0&&n.addLineStartIfNotCovered(i),n.addBlockWidget(m)):(n.ensureLine(i),n.addInlineWidget(m,c,u))}i=null}else i=$$(i,h);l>a&&this.text.skip(l-a)},span:(a,l,h,c)=>{for(let u=a;u<l;){let d=this.text.next(Math.min(512,l-u));d==null?(n.addLineStartIfNotCovered(i),n.addBreak(),u++):(n.ensureLine(i),n.addText(d,h,u==a?c:h.length),u+=d.length),i=null}}});n.addLineStartIfNotCovered(i),this.openWidget=o>r,this.openMarks=o}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let n=t.parentNode;;n=n.parentNode){let r=ct.get(n);if(n==this.view.contentDOM)break;r instanceof oe?e.push(r):r?.isLine()?i=r:r instanceof di||(n.nodeName=="DIV"&&!i&&n!=this.view.contentDOM?i=new mr(n,Ib):i||e.push(oe.of(new Yo({tagName:n.nodeName.toLowerCase(),attributes:a$(n)}),n)))}return{line:i,marks:e}}};Ib={class:"cm-line"};Ii=class extends Ct{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};Ii.inline=new Ii("span"),Ii.block=new Ii("div");Qd=new class extends Ct{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Nl=class{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=B.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new pr(t,t.contentDOM),this.updateInner([new $e(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!R$(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let r=n>-1?P$(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:u}=this.hasComposition;i=new $e(c,u,t.changes.mapPos(c,-1),t.changes.mapPos(u,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Z.ie||Z.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=T$(o,this.decorations,t.changes);l.length&&(i=$e.extendWithRanges(i,l));let h=L$(a,this.blockWrappers,t.changes);return h.length&&(i=$e.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let o=this.tile,a=new $d(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);e&&ct.get(e.text)&&a.cache.reused.set(ct.get(e.text),2),this.tile=a.run(t,e),Pd(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=Z.chrome||Z.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.tile.children)r.isWidget()&&r.widget instanceof aa&&n.push(r.dom);i.updateGaps(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(Pb)&&(this.editContextFormatting=i.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,n=this.view.root.activeElement,r=n==i,o=!r&&!(this.view.state.facet(ui)||i.tabIndex>-1)&&Ho(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(r||e||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,h,c;if(l.empty?c=h=this.inlineDOMNearPos(l.anchor,l.assoc||1):(c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),h=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Z.gecko&&l.empty&&!this.hasComposition&&Q$(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=c=new Fe(d,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!Jo(h.node,h.offset,u.anchorNode,u.anchorOffset)||!Jo(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{Z.android&&Z.chrome&&i.contains(u.focusNode)&&M$(u.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let d=Go(this.view.root);if(d)if(l.empty){if(Z.gecko){let f=C$(h.node,h.offset);if(f&&f!=3){let p=(f==1?cb:ub)(h.node,h.offset);p&&(h=new Fe(p.node,p.offset))}}d.collapse(h.node,h.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([h,c]=[c,h]),f.setEnd(c.node,c.offset),f.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(f)}o&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new Fe(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Fe(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Jo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Go(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let a=o.posAtStart;if(e.head==a||e.head==a+o.length)return;let l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!l||!h||l.bottom>h.top)return;let c=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(c.node,c.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let u=t.observer.selectionRange;t.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=e.from&&i.collapse(n,r)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let n=i.posAtStart;if(i.isComposite()){let r;if(t==i.dom)r=i.dom.childNodes[e];else{let o=ci(t)==0?0:e==0?-1:1;for(;;){let a=t.parentNode;if(a==i.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?r=t:r=t.nextSibling}if(r==i.dom.firstChild)return n;for(;r&&!ct.get(r);)r=r.nextSibling;if(!r)return n+i.length;for(let o=0,a=n;;o++){let l=i.children[o];if(l.dom==r)return a;a+=l.length+l.breakAfter}}else return i.isText()?t==i.dom?n+e:n+(e?i.length:0):n}domAtPos(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.domPosFor(t,e):i.domIn(n,e)}inlineDOMNearPos(t,e){let i,n=-1,r=!1,o,a=-1,l=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=t)return!0;h.flags&16&&(r=!0)}else{let u=c+h.length;if(c<=t&&(i=h,n=t-c,r=u<t),u>=t&&!o&&(o=h,a=t-c,l=c>t),c>t&&o)return!0}}),!i&&!o?this.domAtPos(t,e):(r&&o?i=null:l&&i&&(o=null),i&&e<0||!o?i.domIn(n,e):o.domIn(a,e))}coordsAt(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.widget instanceof aa?null:i.coordsInWidget(n,e,!0):i.coordsIn(n,e)}lineAt(t,e){let{tile:i}=this.tile.resolveBlock(t,e);return i.isLine()?i:null}coordsForChar(t){let{tile:e,offset:i}=this.tile.resolveBlock(t,1);if(!e.isLine())return null;function n(r,o){if(r.isComposite())for(let a of r.children){if(a.length>=o){let l=n(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(r.isText()&&o<r.length){let a=Ot(r.text,o);if(a==o)return null;let l=ea(r.dom,o,a).getClientRects();for(let h=0;h<l.length;h++){let c=l[h];if(h==l.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return n(e,i)}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==J.LTR,h=0,c=(u,d,f)=>{for(let p=0;p<u.children.length&&!(d>n);p++){let m=u.children[p],O=d+m.length,g=m.dom.getBoundingClientRect(),{height:y}=g;if(f&&!p&&(h+=g.top-f.top),m instanceof di)O>i&&c(m,d,g);else if(d>=i&&(h>0&&e.push(-h),e.push(y+h),h=0,o)){let v=m.dom.lastChild,x=v?Ko(v):[];if(x.length){let S=x[x.length-1],$=l?S.right-g.left:g.right-S.left;$>a&&(a=$,this.minWidth=r,this.minWidthFrom=d,this.minWidthTo=O)}}f&&p==u.children.length-1&&(h+=f.bottom-g.bottom),d=O+m.breakAfter}};return c(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return getComputedStyle(e.dom).direction=="rtl"?J.RTL:J.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=Ko(h.dom);if(c.length!=1)return;a+=c[0].width,l=c[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(t)return t;let e=document.createElement("div"),i,n,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(e);let o=Ko(e.firstChild)[0];i=e.getBoundingClientRect().height,n=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,e.remove()}),{lineHeight:i,charWidth:n,textHeight:r}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let r=n==e.viewports.length?null:e.viewports[n],o=r?r.from-1:this.view.state.doc.length;if(o>i){let a=(e.lineBlockAt(o).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(B.replace({widget:new aa(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(t)}updateDeco(){let t=1,e=this.view.state.facet(zl).map(r=>(this.dynamicDecorationMap[t++]=typeof r=="function")?r(this.view):r),i=!1,n=this.view.state.facet(bd).map((r,o)=>{let a=typeof r=="function";return a&&(i=!0),a?r(this.view):r});for(n.length&&(this.dynamicDecorationMap[t++]=i,e.push(U.join(n))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(Eb).map(r=>typeof r=="function"?r(this.view):r)}scrollIntoView(t){var e;if(t.isSnapshot){let c=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=c.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let c of this.view.state.facet(Qb))try{if(c(this.view,t.range,t))return!0}catch(u){St(this.view.state,u,"scroll handler")}let{range:i}=t,n=this.coordsAt(i.head,(e=i.assoc)!==null&&e!==void 0?e:i.empty?0:i.head>i.anchor?-1:1),r;if(!n)return;!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let o=yd(this.view),a={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:l,offsetHeight:h}=this.view.scrollDOM;if(c$(this.view.scrollDOM,a,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,h),-h),this.view.textDirection==J.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(i.head,1);c&&c.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let e=i=>i.isWidget()||i.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){Pd(this.tile)}};E$=class{constructor(){this.changes=[]}compareRange(t,e){cr(t,e,this.changes)}comparePoint(t,e){cr(t,e,this.changes)}boundChange(t){cr(t,t,this.changes)}};Cd=class{constructor(){this.changes=[]}compareRange(t,e){cr(t,e,this.changes)}comparePoint(){}boundChange(t){cr(t,t,this.changes)}};aa=class extends Ct{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};Ae=class{constructor(t,e){this.pos=t,this.assoc=e}};Md=class{constructor(t,e,i,n){this.view=t,this.x=e,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[ve.find(n,t-i.from,-1,e)].level==this.baseDir}dirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[ve.find(n,t-i.from,-1,e)].dir}bidiIn(t,e){let{spans:i,line:n}=this.bidiSpansAt(t);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<e)}scan(t,e){let i=0,n=t.length-1,r=new Set,o=this.bidiIn(t[0],t[n]),a,l,h=-1,c=1e9,u;t:for(;i<n;){let f=n-i,p=i+n>>1;e:if(r.has(p)){let O=i+Math.floor(Math.random()*f);for(let g=0;g<f;g++){if(!r.has(O)){p=O;break e}O++,O==n&&(O=i)}break t}r.add(p);let m=e(p);if(m)for(let O=0;O<m.length;O++){let g=m[O],y=0;if(!(g.width==0&&m.length>1)){if(g.bottom<this.y)(!a||a.bottom<g.bottom)&&(a=g),y=1;else if(g.top>this.y)(!l||l.top>g.top)&&(l=g),y=-1;else{let v=g.left>this.x?this.x-g.left:g.right<this.x?this.x-g.right:0,x=Math.abs(v);x<c&&(h=p,c=x,u=g),v&&(y=v<0==(this.baseDir==J.LTR)?-1:1)}y==-1&&(!o||this.baseDirAt(t[p],1))?n=p:y==1&&(!o||this.baseDirAt(t[p+1],-1))&&(i=p+1)}}}if(!u){let f=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(f.top+f.bottom)/2,this.scan(t,e)}if(c){let{top:f,bottom:p}=u;if(a&&a.bottom>(f+f+p)/3)return this.y=a.bottom-1,this.scan(t,e);if(l&&l.top<(f+p+p)/3)return this.y=l.top+1,this.scan(t,e)}let d=(o?this.dirAt(t[h],1):this.baseDir)==J.LTR;return{i:h,after:this.x>(u.left+u.right)/2==d}}scanText(t,e){let i=[];for(let r=0;r<t.length;r=Ot(t.text,r))i.push(e+r);i.push(e+t.length);let n=this.scan(i,r=>{let o=i[r]-e,a=i[r+1]-e;return ea(t.dom,o,a).getClientRects()});return n.after?new Ae(i[n.i+1],-1):new Ae(i[n.i],1)}scanTile(t,e){if(!t.length)return new Ae(e,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,e);if(a.isComposite())return this.scanTile(a,e)}let i=[e];for(let a=0,l=e;a<t.children.length;a++)i.push(l+=t.children[a].length);let n=this.scan(i,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:ea(l.dom,0,l.length)).getClientRects()}),r=t.children[n.i],o=i[n.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):n.after?new Ae(i[n.i+1],-1):new Ae(o,1)}},Or="\uFFFF",Rd=class{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(et.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Or}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let r=this.text.length;this.readNode(n);let o=ct.get(n),a=n.nextSibling;if(a==e){o?.breakAfter&&!a&&i!=this.view.contentDOM&&this.lineBreak();break}let l=ct.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Dl(n))||Dl(a)&&(n.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!z$(a,e)&&this.lineBreak(),n=a}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,a;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(a=n.exec(e))&&(r=a.index,o=a[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=o-1);i=r+o}}readNode(t){let e=ct.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(B$(t,i.node,i.offset)?e:0))}};_l=class{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}},Xd=class{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=Bb(t.docView.tile,e,i,0))){let l=r||o?[]:N$(t),h=new Rd(l,t);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=_$(l,this.bounds.from)}else{let l=t.observer.selectionRange,h=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!hd(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!hd(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=t.viewport;if((Z.ios||Z.chrome)&&a.main.empty&&h!=c&&(u.from>0||u.to<t.state.doc.length)){let d=Math.min(h,c),f=Math.max(h,c),p=u.from-d,m=u.to-f;(p==0||p==1||d==0)&&(m==0||m==-1||f==t.state.doc.length)&&(h=0,c=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Q.range(c,h));else if(t.lineWrapping&&c==h&&!(a.main.empty&&a.main.head==h)&&t.inputState.lastTouchTime>Date.now()-100){let d=t.coordsAtPos(h,-1),f=0;d&&(f=t.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=Q.create([Q.cursor(h,f)])}else this.newSel=Q.single(c,h)}}};Zd=class{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Z.safari&&t.contentDOM.addEventListener("input",()=>null),Z.gecko&&nA(t.contentDOM.ownerDocument)}handleEvent(t){!H$(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let n of i.observers)n(this.view,e);for(let n of i.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=V$(t),i=this.handlers,n=this.view.contentDOM;for(let r in e)if(r!="scroll"){let o=!e[r].handlers.length,a=i[r];a&&o!=!a.handlers.length&&(n.removeEventListener(r,this.handleEvent),a=null),a||n.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!e[r]&&n.removeEventListener(r,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&Vb.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Z.android&&Z.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return Z.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((e=_b.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||W$.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,ur(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:Z.safari&&!Z.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};_b=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],W$="dthko",Vb=[16,17,18,20,91,92,224,225],Wl=6;Dd=class{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=ob(t.contentDOM),this.atoms=t.state.facet(na).map(o=>o(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(et.allowMultipleSelections)&&U$(t,e),this.dragging=G$(t,e)&&Kb(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Y$(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,i=0,n=0,r=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:n,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=yd(this.view);t.clientX-l.left<=n+Wl?e=-Yl(n-t.clientX):t.clientX+l.right>=o-Wl&&(e=Yl(t.clientX-o)),t.clientY-l.top<=r+Wl?i=-Yl(r-t.clientY):t.clientY+l.bottom>=a-Wl&&(i=Yl(t.clientY-a)),this.setScrollSpeed(e,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=qb(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!i.eq(e.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}};Ze=Object.create(null),ae=Object.create(null),Wb=Z.ie&&Z.ie_version<15||Z.ios&&Z.webkit_version<604;ae.scroll=s=>{s.inputState.lastScrollTop=s.scrollDOM.scrollTop,s.inputState.lastScrollLeft=s.scrollDOM.scrollLeft},ae.wheel=ae.mousewheel=s=>{s.inputState.lastWheelEvent=Date.now()},Ze.keydown=(s,t)=>(s.inputState.setSelectionOrigin("select"),t.keyCode==27&&s.inputState.tabFocusMode!=0&&(s.inputState.tabFocusMode=Date.now()+2e3),!1),ae.touchstart=(s,t)=>{let e=s.inputState,i=t.targetTouches[0];e.lastTouchTime=Date.now(),i&&(e.lastTouchX=i.clientX,e.lastTouchY=i.clientY),e.setSelectionOrigin("select.pointer")},ae.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")},Ze.mousedown=(s,t)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let i of s.state.facet(xb))if(e=i(s,t),e)break;if(!e&&t.button==0&&(e=tA(s,t)),e){let i=!s.hasFocus;s.inputState.startMouseSelection(new Dd(s,t,e,i)),i&&s.observer.ignore(()=>{ab(s.contentDOM);let r=s.root.activeElement;r&&!r.contains(s.contentDOM)&&r.blur()});let n=s.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}else s.inputState.setSelectionOrigin("select.pointer");return!1};J$=Z.ie&&Z.ie_version<=11,Fb=null,Gb=0,Hb=0;Ze.dragstart=(s,t)=>{let{selection:{main:e}}=s.state;if(t.target.draggable){let n=s.docView.tile.nearest(t.target);if(n&&n.isWidget()){let r=n.posAtStart,o=r+n.length;(r>=e.to||o<=e.from)&&(e=Q.range(r,o))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",Ul(s.state,Od,s.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Ze.dragend=s=>(s.inputState.draggedContent=null,!1);Ze.drop=(s,t)=>{if(!t.dataTransfer)return!1;if(s.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let i=Array(e.length),n=0,r=()=>{++n==e.length&&Jb(s,t,i.filter(o=>o!=null).join(s.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let a=new FileReader;a.onerror=r,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[o]=a.result),r()},a.readAsText(e[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return Jb(s,t,i,!0),!0}return!1},Ze.paste=(s,t)=>{if(s.state.readOnly)return!0;s.observer.flush();let e=Wb?null:t.clipboardData;return e?(Yb(s,e.getData("text/plain")||e.getData("text/uri-list")),!0):(K$(s),!1)};qd=null;Ze.copy=Ze.cut=(s,t)=>{if(!Ho(s.contentDOM,s.observer.selectionRange))return!1;let{text:e,ranges:i,linewise:n}=sA(s.state);if(!e&&!n)return!1;qd=n?e:null,t.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Wb?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(iA(s,e),!1)};ty=_t.define();ae.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),iy(s)},ae.blur=s=>{s.observer.clearSelectionRange(),iy(s)},ae.compositionstart=ae.compositionupdate=s=>{s.observer.editContext||(s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0))},ae.compositionend=s=>{s.observer.editContext||(s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,Z.chrome&&Z.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50))},ae.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()},Ze.beforeinput=(s,t)=>{var e,i;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(s.inputState.insertingText=t.data,s.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&s.observer.editContext){let r=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(r&&o.length){let a=o[0],l=s.posAtDOM(a.startContainer,a.startOffset),h=s.posAtDOM(a.endContainer,a.endOffset);return Id(s,{from:l,to:h,insert:s.state.toText(r)},null),!0}}let n;if(Z.chrome&&Z.android&&(n=_b.find(r=>r.inputType==t.inputType))&&(s.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return Z.ios&&t.inputType=="deleteContentForward"&&s.observer.flushSoon(),Z.safari&&t.inputType=="insertText"&&s.inputState.composing>=0&&setTimeout(()=>ae.compositionend(s,t),20),!1};sy=new Set;ny=["pre-wrap","normal","pre-line","break-spaces"],vs=!1;Fl=class{constructor(t){this.lineWrapping=t,this.doc=G.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return ny.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let n=t[i];n<0?i++:this.heightSamples[Math.floor(n*10)]||(e=!0,this.heightSamples[Math.floor(n*10)]=!0)}return e}refresh(t,e,i,n,r,o){let a=ny.indexOf(t)>-1,l=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=a||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=a,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,l){this.heightSamples={};for(let h=0;h<o.length;h++){let c=o[h];c<0?h++:this.heightSamples[Math.floor(c*10)]=!0}}return l}},Gl=class{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}},Qe=class s{constructor(t,e,i,n,r){this.from=t,this.length=e,this.top=i,this.height=n,this._content=r}get type(){return typeof this._content=="number"?At.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ms?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new s(this.from,this.length+t.length,this.top,this.height+t.height,e)}},st=(function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s})(st||(st={})),Hl=.001,le=class s{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Hl&&(vs=!0),this.height=t)}replace(t,e,i){return s.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let r=this,o=i.doc;for(let a=n.length-1;a>=0;a--){let{fromA:l,toA:h,fromB:c,toB:u}=n[a],d=r.lineAt(l,st.ByPosNoHeight,i.setDoc(e),0,0),f=d.to>=h?d:r.lineAt(h,st.ByPosNoHeight,i,0,0);for(u+=f.to-h,h=f.to;a>0&&d.from<=n[a-1].toA;)l=n[a-1].fromA,c=n[a-1].fromB,a--,l<d.from&&(d=r.lineAt(l,st.ByPosNoHeight,i,0,0));c+=d.from-l,l=d.from;let p=jd.build(i.setDoc(o),t,c,u);r=Kl(r,r.replace(l,h,p))}return r.updateHeight(i,0)}static empty(){return new Pe(0,0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,n=0,r=0;for(;;)if(e==i)if(n>r*2){let a=t[e-1];a.break?t.splice(--e,1,a.left,null,a.right):t.splice(--e,1,a.left,a.right),i+=1+a.break,n-=a.size}else if(r>n*2){let a=t[i];a.break?t.splice(i,1,a.left,null,a.right):t.splice(i,1,a.left,a.right),i+=2+a.break,r-=a.size}else break;else if(n<r){let a=t[e++];a&&(n+=a.size)}else{let a=t[--i];a&&(r+=a.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,i++),new zd(s.of(t.slice(0,e)),o,s.of(t.slice(i)))}};le.prototype.size=1;rA=B.replace({}),Jl=class extends le{constructor(t,e,i){super(t,e),this.deco=i,this.spaceAbove=0}mainBlock(t,e){return new Qe(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,i,n){return this.spaceAbove&&t<i+this.spaceAbove?new Qe(n,0,i,this.spaceAbove,rA):this.mainBlock(i,n)}lineAt(t,e,i,n,r){let o=this.mainBlock(n,r);return this.spaceAbove?this.blockAt(0,i,n,r).join(o):o}forEachLine(t,e,i,n,r,o){t<=r+this.length&&e>=r&&o(this.lineAt(0,st.ByPos,i,n,r))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}},Pe=class s extends Jl{constructor(t,e,i){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,e){return new Qe(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,i){let n=i[0];return i.length==1&&(n instanceof s||n instanceof Zi&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Zi?n=new s(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):le.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setMeasuredHeight(n):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Zi=class s extends le{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,r=n-i+1,o,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*r);o=l/r,this.length>r+1&&(a=(this.height-l)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:n,perLine:o,perChar:a}}blockAt(t,e,i,n){let{firstLine:r,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),c=e.doc.lineAt(h),u=a+c.length*l,d=Math.max(i,t-u/2);return new Qe(c.from,c.length,d,u,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((t-i)/a))),{from:c,length:u}=e.doc.line(r+h);return new Qe(c,u,i+a*h,a,0)}}lineAt(t,e,i,n,r){if(e==st.ByHeight)return this.blockAt(t,i,n,r);if(e==st.ByPosNoHeight){let{from:f,to:p}=i.doc.lineAt(t);return new Qe(f,p-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(i,r),h=i.doc.lineAt(t),c=a+h.length*l,u=h.number-o,d=n+a*u+l*(h.from-r-u);return new Qe(h.from,h.length,Math.max(n,Math.min(d,n+this.height-c)),c,0)}forEachLine(t,e,i,n,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:a,perLine:l,perChar:h}=this.heightMetrics(i,r);for(let c=t,u=n;c<=e;){let d=i.doc.lineAt(c);if(c==t){let p=d.number-a;u+=l*p+h*(t-r-p)}let f=l+h*d.length;o(new Qe(d.from,d.length,u,f,0)),u+=f,c=d.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let r=i[i.length-1];r instanceof s?i[i.length-1]=new s(r.length+n):i.push(null,new s(n-1))}if(t>0){let r=i[0];r instanceof s?i[0]=new s(t+r.length):i.unshift(new s(t-1),null)}return le.of(i)}decomposeLeft(t,e){e.push(new s(t-1),null)}decomposeRight(t,e){e.push(null,new s(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let r=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],a=Math.max(e,n.from),l=-1;for(n.from>e&&o.push(new s(n.from-e-1).updateHeight(t,e));a<=r&&n.more;){let c=t.doc.lineAt(a).length;o.length&&o.push(null);let u=n.heights[n.index++],d=0;u<0&&(d=-u,u=n.heights[n.index++]),l==-1?l=u:Math.abs(u-l)>=Hl&&(l=-2);let f=new Pe(c,u,d);f.outdated=!1,o.push(f),a+=c+1}a<=r&&o.push(null,new s(r-a).updateHeight(t,a));let h=le.of(o);return(l<0||Math.abs(h.height-this.height)>=Hl||Math.abs(l-this.heightMetrics(t,e).perLine)>=Hl)&&(vs=!0),Kl(this,h)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},zd=class extends le{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,n){let r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,r,n+this.left.length+this.break)}lineAt(t,e,i,n,r){let o=n+this.left.height,a=r+this.left.length+this.break,l=e==st.ByHeight?t<o:t<a,h=l?this.left.lineAt(t,e,i,n,r):this.right.lineAt(t,e,i,o,a);if(this.break||(l?h.to<a:h.from>a))return h;let c=e==st.ByPosNoHeight?st.ByPosNoHeight:st.ByPos;return l?h.join(this.right.lineAt(a,c,i,o,a)):this.left.lineAt(a,c,i,n,r).join(h)}forEachLine(t,e,i,n,r,o){let a=n+this.left.height,l=r+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,n,r,o),e>=l&&this.right.forEachLine(t,e,i,a,l,o);else{let h=this.lineAt(l,st.ByPos,i,n,r);t<h.from&&this.left.forEachLine(t,h.from-1,i,n,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,a,l,o)}}replace(t,e,i){let n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let a of i)r.push(a);if(t>0&&ry(r,o-1),e<this.length){let a=r.length;this.decomposeRight(e,r),ry(r,a)}return le.of(r)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?le.of(this.break?[t,null,e]:[t,e]):(this.left=Kl(this.left,t),this.right=Kl(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:r,right:o}=this,a=e+r.length+this.break,l=null;return n&&n.from<=e+r.length&&n.more?l=r=r.updateHeight(t,e,i,n):r.updateHeight(t,e,i),n&&n.from<=a+o.length&&n.more?l=o=o.updateHeight(t,a,i,n):o.updateHeight(t,a,i),l?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};oA=5,jd=class s{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Pe?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Pe(i-this.pos,-1,0)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let o=e-t;i.block?this.addBlock(new Jl(o,n,i)):(o||r||n>=oA)&&this.addLineDeco(n,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Pe(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new Zi(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Pe)return t;let e=new Pe(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Pe)&&!this.isCovered?this.nodes.push(new Pe(0,-1,0)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let n of this.nodes)n instanceof Pe&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(t,e,i,n){let r=new s(i,t);return U.spans(e,i,n,r,0),r.finish(i)}};Nd=class{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&cr(t,e,this.changes,5)}};ha=class{constructor(t,e,i,n){this.from=t,this.to=e,this.size=i,this.displaySize=n}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],r=e[i];if(n.from!=r.from||n.to!=r.to||n.size!=r.size)return!1}return!0}draw(t,e){return B.replace({widget:new _d(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}},_d=class extends Ct{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}},th=class{constructor(t,e){this.view=t,this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=oy,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=J.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(Bl).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Fl(i),this.stateDeco=ay(e),this.heightMap=le.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle.setDoc(e.doc),[new $e(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(n=>n.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some(({from:r,to:o})=>n>=r&&n<=o)){let{from:r,to:o}=this.lineBlockAt(n);t.push(new br(r,o))}}return this.viewports=t.sort((i,n)=>i.from-n.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?oy:new Vd(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(ca(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=ay(this.state);let n=t.changedRanges,r=$e.extendWithRanges(n,aA(i,this.stateDeco,t?t.changes:Rt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Bd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||vs)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(h||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Ab)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,e=t.contentDOM,i=window.getComputedStyle(e),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?J.RTL:J.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",a=e.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:S,scaleY:$}=rb(e,a);(S>.005&&Math.abs(this.scaleX-S)>.005||$>.005&&Math.abs(this.scaleY-$)>.005)&&(this.scaleX=S,this.scaleY=$,h|=16,o=l=!0)}let u=(parseInt(i.paddingTop)||0)*this.scaleY,d=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let f=ob(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=hb(this.scrollParent||t.win);let m=(this.printing?cA:lA)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!hA(t.dom))return 0;let v=a.width;if((this.contentDOMWidth!=v||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),l){let S=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(S)&&(o=!0),o||n.lineWrapping&&Math.abs(v-this.contentDOMWidth)>n.charWidth){let{lineHeight:$,charWidth:k,textHeight:P}=t.docView.measureTextSize();o=$>0&&n.refresh(r,$,k,P,Math.max(5,v/k),S),o&&(t.docView.minWidth=0,h|=16)}O>0&&g>0?c=Math.max(O,g):O<0&&g<0&&(c=Math.min(O,g)),Bd();for(let $ of this.viewports){let k=$.from==this.viewport.from?S:t.docView.measureVisibleLineHeights($);this.heightMap=(o?le.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle,[new $e(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Gl($.from,k))}vs&&(h|=2)}let x=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new br(n.lineAt(o-i*1e3,st.ByHeight,r,0,0).from,n.lineAt(a+(1-i)*1e3,st.ByHeight,r,0,0).to);if(e){let{head:h}=e.range;if(h<l.from||h>l.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=n.lineAt(h,st.ByPos,r,0,0),d;e.y=="center"?d=(u.top+u.bottom)/2-c/2:e.y=="start"||e.y=="nearest"&&h<l.from?d=u.top:d=u.bottom-c,l=new br(n.lineAt(d-1e3/2,st.ByHeight,r,0,0).from,n.lineAt(d+c+1e3/2,st.ByHeight,r,0,0).to)}}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new br(this.heightMap.lineAt(i,st.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,st.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(t,st.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,st.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||n<=o-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=a+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&r<a+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let n of t)e.touchesRange(n.from,n.to)||i.push(new ha(e.mapPos(n.from),e.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,r=n>>1,o=n<<1;if(this.defaultTextDirection!=J.LTR&&!i)return[];let a=[],l=(c,u,d,f)=>{if(u-c<r)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let g of m)if(g>c&&g<u){l(c,g-10,d,f),l(g+10,u,d,f);return}let O=dA(t,g=>g.from>=d.from&&g.to<=d.to&&Math.abs(g.from-c)<r&&Math.abs(g.to-u)<r&&!m.some(y=>g.from<y&&g.to>y));if(!O){if(u<d.to&&e&&i&&e.visibleRanges.some(v=>v.from<=u&&v.to>=u)){let v=e.moveToLineBoundary(Q.cursor(u),!1,!0).head;v>c&&(u=v)}let g=this.gapSize(d,c,u,f),y=i||g<2e6?g:2e6;O=new ha(c,u,g,y)}a.push(O)},h=c=>{if(c.length<o||c.type!=At.Text)return;let u=uA(c.from,c.to,this.stateDeco);if(u.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(i){let m=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,O,g;if(d!=null){let y=ih(u,d),v=((this.visibleBottom-this.visibleTop)/2+m)/c.height;O=y-v,g=y+v}else O=(this.visibleTop-c.top-m)/c.height,g=(this.visibleBottom-c.top+m)/c.height;f=eh(u,O),p=eh(u,g)}else{let m=u.total*this.heightOracle.charWidth,O=n*this.heightOracle.charWidth,g=0;if(m>2e6)for(let $ of t)$.from>=c.from&&$.from<c.to&&$.size!=$.displaySize&&$.from*this.heightOracle.charWidth+g<this.pixelViewport.left&&(g=$.size-$.displaySize);let y=this.pixelViewport.left+g,v=this.pixelViewport.right+g,x,S;if(d!=null){let $=ih(u,d),k=((v-y)/2+O)/m;x=$-k,S=$+k}else x=(y-O)/m,S=(v+O)/m;f=eh(u,x),p=eh(u,S)}f>c.from&&l(c.from,f,c,u),p<c.to&&l(p,c.to,c,u)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(h):h(c);return a}gapSize(t,e,i,n){let r=ih(n,i)-ih(n,e);return this.heightOracle.lineWrapping?t.height*r:n.total*this.heightOracle.charWidth*r}updateLineGaps(t){ha.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=B.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];U.spans(e,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let r=0;r<i.length&&!(n&8);r++){let o=this.visibleRanges[r],a=i[r];(o.from!=a.from||o.to!=a.to)&&(n|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||ca(this.heightMap.lineAt(t,st.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||ca(this.heightMap.lineAt(this.scaler.fromDOM(t),st.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return ca(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},br=class{constructor(t,e){this.from=t,this.to=e}};oy={toDOM(s){return s},fromDOM(s){return s},scale:1,eq(s){return s==this}};Vd=class s{constructor(t,e,i){let n=0,r=0,o=0;this.viewports=i.map(({from:a,to:l})=>{let h=e.lineAt(a,st.ByPos,t,0,0).top,c=e.lineAt(l,st.ByPos,t,0,0).bottom;return n+=c-h,{from:a,to:l,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let a of this.viewports)a.domTop=o+(a.top-r)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),r=a.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return n+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,n=r.domBottom}}fromDOM(t){for(let e=0,i=0,n=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-n)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,n=r.domBottom}}eq(t){return t instanceof s?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to):!1}};sh=R.define({combine:s=>s.join(" ")}),Wd=R.define({combine:s=>s.indexOf(!0)>-1}),Yd=ke.newName(),ly=ke.newName(),hy=ke.newName(),cy={"&light":"."+ly,"&dark":"."+hy};fA=Ud("."+Yd,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},cy),pA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Fd=Z.ie&&Z.ie_version<=11,Gd=class{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new cd,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(Z.ie&&Z.ie_version<=11||Z.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Z.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Z.chrome&&Z.chrome_version<126)&&(this.editContext=new Hd(t),t.state.facet(ui)&&(t.contentDOM.editContext=this.editContext.editContext)),Fd&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(ui)?i.root.activeElement!=this.dom:!Ho(this.dom,n))return;let r=n.anchorNode&&i.docView.tile.nearest(n.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Z.ie&&Z.ie_version<=11||Z.android&&Z.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Jo(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Go(t.root);if(!e)return!1;let i=Z.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&mA(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=Ho(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&d$(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(i.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=e)i.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,pA),Fd&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Fd&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let n=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ur(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let r of t){let o=this.readMutation(r);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Ho(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Xd(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=zb(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!Vl(this.view.state.selection,e.newSel.main))&&this.view.update([]),n}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty(t.type=="attributes"),t.type=="childList"){let i=uy(e,t.previousSibling||t.target.previousSibling,-1),n=uy(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(ui)!=t.state.facet(ui)&&(t.view.contentDOM.editContext=t.state.facet(ui)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};Hd=class{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let n=t.state.selection.main,{anchor:r,head:o}=n,a=this.toEditorPos(i.updateRangeStart),l=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:a,drifted:!1});let h=l-a>i.text.length;a==this.from&&r<this.from?a=r:l==this.to&&r>this.to&&(l=r);let c=jb(t.state.sliceDoc(a,l),i.text,(h?n.from:n.to)-a,h?"end":null);if(!c){let d=Q.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Vl(d,n)||t.dispatch({selection:d,userEvent:"select"});return}let u={from:c.from+a,to:c.toA+a,insert:G.of(i.text.slice(c.from,c.toB).split(`
11
+ `))};if((Z.mac||Z.android)&&u.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:G.of([i.text.replace("."," ")])}),this.pendingContextChange=u,!t.state.readOnly){let d=this.to-this.from+(u.to-u.from+u.insert.length);Id(t,u,Q.single(this.toEditorPos(i.selectionStart,d),this.toEditorPos(i.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),u.from<u.to&&!u.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],r=null;for(let o=this.toEditorPos(i.rangeStart),a=this.toEditorPos(i.rangeEnd);o<a;o++){let l=t.coordsForChar(o);r=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||r||new DOMRect,n.push(r)}e.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,a=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(l<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;n.push(B.mark({attributes:{style:c}}).range(l,h))}}}t.dispatch({effects:Pb.of(B.set(n))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(t.state)}};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let n=Go(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,n=this.pendingContextChange;return t.changes.iterChanges((r,o,a,l,h)=>{if(i)return;let c=h.length-(o-r);if(n&&o>=n.to)if(n.from==r&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,e+=c,this.to+=c;return}else n=null,this.revertPending(t.state);if(r+=e,o+=e,o<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}e+=c}),n&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(n=>!n.isUserEvent("input.type")&&n.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),n=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}},L=class s{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var 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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(n=>n.forEach(r=>i(r,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=t.root||u$(t.parent)||document,this.viewState=new th(this,t.state||et.create(t)),t.scrollTo&&t.scrollTo.is(ql)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(dr).map(n=>new sa(n));for(let n of this.plugins)n.update(this);this.observer=new Gd(this),this.inputState=new Zd(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Nl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let e=t.length==1&&t[0]instanceof dt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,n,r=this.state;for(let d of t){if(d.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=d.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,l=null;t.some(d=>d.annotation(ty))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=ey(r,o),l||(a=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(et.phrases)!=this.state.facet(et.phrases))return this.setState(r);n=oa.create(this,r,t),n.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let d of t){if(u&&(u=u.map(d.changes)),d.scrollIntoView){let{main:f}=d.state.selection,{x:p,y:m}=this.state.facet(s.cursorScrollMargin);u=new ia(f.empty?f:Q.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",m,p)}for(let f of d.effects)f.is(ql)&&(u=f.value.clip(this.state))}this.viewState.update(n,u),this.bidiCache=nh.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(ra)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(sh)!=n.state.facet(sh)&&(this.viewState.mustMeasureContent=!0),(e||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!n.empty)for(let d of this.state.facet(md))try{d(n)}catch(f){St(this.state,f,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!zb(this,c)&&h.force&&ur(this.contentDOM,h.key,h.keyCode)})}setState(t){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=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new th(this,t),this.plugins=t.facet(dr).map(i=>new sa(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Nl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(dr),i=t.state.facet(dr);if(e!=i){let n=[];for(let r of i){let o=e.indexOf(r);if(o<0)n.push(new sa(r));else{let a=this.plugins[o];a.mustUpdate=t,n.push(a)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(i){St(this.state,i,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(hb(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(n);r=f.from,o=f.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];l&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(f=>{try{return f.read(this)}catch(p){return St(this.state,p),fy}}),u=oa.create(this,this.state,[]),d=!1;u.flags|=l,e?e.flags|=l:e=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let f=0;f<h.length;f++)if(c[f]!=fy)try{let p=h[f];p.write&&p.write(c[f],this)}catch(p){St(this.state,p)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o)/this.scaleY;if((p>1||p<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n=n+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let a of this.state.facet(md))a(e)}get themeClasses(){return Yd+" "+(this.state.facet(Wd)?hy:ly)+" "+this.state.facet(sh)}updateAttrs(){let t=py(this,Cb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ui)?"true":"false",class:"cm-content",style:`${Z.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),py(this,Bl,e);let i=this.observer.ignore(()=>{let n=ib(this.contentDOM,this.contentAttrs,e),r=ib(this.dom,this.editorAttrs,t);return n||r});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let n of i.effects)if(n.is(s.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(ra);let t=this.state.facet(s.cspNonce);ke.mount(this.root,this.styleModules.concat(fA).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return Td(this,t,Db(this,t,e,i))}moveByGroup(t,e){return Td(this,t,Db(this,t,e,i=>D$(this,t.head,i)))}visualLineSide(t,e){let i=this.bidiSpans(t),n=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return Q.cursor(r.side(e,n)+t.from,r.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,i=!0){return Z$(this,t,e,i)}moveVertically(t,e,i){return Td(this,t,q$(this,t,e,i))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let i=Ld(this,t,e);return i&&i.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),Ld(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),r=this.bidiSpans(n),o=r[ve.find(r,t-n.from,-1,e)];return ta(i,o.dir==J.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet($b)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>gA)return gb(t.length);let e=this.textDirectionAt(t.from),i;for(let r of this.bidiCache)if(r.from==t.from&&r.dir==e&&(r.fresh||pb(r.isolates,i=Lb(this,t))))return r.order;i||(i=Lb(this,t));let n=mb(t.text,e,i);return this.bidiCache.push(new nh(t.from,t.to,e,i,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Z.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ab(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){var i,n,r,o;return ql.of(new ia(typeof t=="number"?Q.cursor(t):t,(i=e.y)!==null&&i!==void 0?i:"nearest",(n=e.x)!==null&&n!==void 0?n:"nearest",(r=e.yMargin)!==null&&r!==void 0?r:5,(o=e.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return ql.of(new ia(Q.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return nt.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return nt.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=ke.newName(),n=[sh.of(i),ra.of(Ud(`.${i}`,t))];return e&&e.dark&&n.push(Wd.of(!0)),n}static baseTheme(t){return re.lowest(ra.of(Ud("."+Yd,t,cy)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&ct.get(i)||ct.get(t);return((e=n?.root)===null||e===void 0?void 0:e.view)||null}};L.styleModule=ra,L.inputHandler=wb,L.clipboardInputFilter=gd,L.clipboardOutputFilter=Od,L.scrollHandler=Qb,L.focusChangeEffect=kb,L.perLineTextDirection=$b,L.exceptionSink=Sb,L.updateListener=md,L.editable=ui,L.mouseSelectionStyle=xb,L.dragMovesSelection=vb,L.clickAddsSelectionRange=yb,L.decorations=zl,L.blockWrappers=Eb,L.outerDecorations=bd,L.atomicRanges=na,L.bidiIsolatedRanges=Tb,L.cursorScrollMargin=R.define({combine:s=>{let t=5,e=5;for(let i of s)typeof i=="number"?t=e=i:{x:t,y:e}=i;return{x:t,y:e}}}),L.scrollMargins=Mb,L.darkTheme=Wd,L.cspNonce=R.define({combine:s=>s.length?s[0]:""}),L.contentAttributes=Bl,L.editorAttributes=Cb,L.lineWrapping=L.contentAttributes.of({class:"cm-lineWrapping"}),L.announce=j.define();gA=4096,fy={},nh=class s{constructor(t,e,i,n,r,o){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=r,this.order=o}static update(t,e){if(e.empty&&!t.some(r=>r.fresh))return t;let i=[],n=t.length?t[t.length-1].dir:J.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let o=t[r];o.dir==n&&!e.touchesRange(o.from,o.to)&&i.push(new s(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}};OA=Z.mac?"mac":Z.windows?"win":Z.linux?"linux":"key";yA=re.default(L.domEventHandlers({keydown(s,t){return Oy(gy(t.state),s,t,"editor")}})),He=R.define({enables:yA}),my=new WeakMap;Di=null,xA=4e3;Kd=null;qi=class s{constructor(t,e,i,n,r){this.className=t,this.left=e,this.top=i,this.width=n,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=by(t);return[new s(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return wA(t,e,i)}};Jd=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(oh)!=t.state.facet(oh)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(oh);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:e}=this.view;(t!=this.scaleX||e!=this.scaleY)&&(this.scaleX=t,this.scaleY=e,this.dom.style.transform=`scale(${1/t}, ${1/e})`)}draw(t){if(t.length!=this.drawn.length||t.some((e,i)=>!kA(e,this.drawn[i]))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t,Z.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},oh=R.define();xs=R.define({combine(s){return Vt(s,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});AA=tf({above:!0,markers(s){let{state:t}=s,e=t.facet(xs),i=[];for(let n of t.selection.ranges){let r=n==t.selection.main;if(n.empty||e.drawRangeCursor&&!(r&&Z.ios&&e.iosSelectionHandles)){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=n.empty?n:Q.cursor(n.head,n.assoc);for(let l of qi.forRange(s,o,a))i.push(l)}}return i},update(s,t){s.transactions.some(i=>i.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let e=vy(s);return e&&xy(s.state,t),s.docChanged||s.selectionSet||e},mount(s,t){xy(t.state,s)},class:"cm-cursorLayer"});QA=tf({above:!1,markers(s){let t=[],{main:e,ranges:i}=s.state.selection;for(let n of i)if(!n.empty)for(let r of qi.forRange(s,"cm-selectionBackground",n))t.push(r);if(Z.ios&&!e.empty&&s.state.facet(xs).iosSelectionHandles){for(let n of qi.forRange(s,"cm-selectionHandle cm-selectionHandle-start",Q.cursor(e.from,1)))t.push(n);for(let n of qi.forRange(s,"cm-selectionHandle cm-selectionHandle-end",Q.cursor(e.to,1)))t.push(n)}return t},update(s,t){return s.docChanged||s.selectionSet||s.viewportChanged||vy(s)},class:"cm-selectionLayer"}),PA=re.highest(L.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Sy=j.define({map(s,t){return s==null?null:t.mapPos(s)}}),ua=ht.define({create(){return null},update(s,t){return s!=null&&(s=t.changes.mapPos(s)),t.effects.reduce((e,i)=>i.is(Sy)?i.value:e,s)}}),CA=nt.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var t;let e=s.state.field(ua);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(s.startState.field(ua)!=e||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:s}=this,t=s.state.field(ua),e=t!=null&&s.coordsAtPos(t);if(!e)return null;let i=s.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+s.scrollDOM.scrollLeft*s.scaleX,top:e.top-i.top+s.scrollDOM.scrollTop*s.scaleY,height:e.bottom-e.top}}drawCursor(s){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;s?(this.cursor.style.left=s.left/t+"px",this.cursor.style.top=s.top/e+"px",this.cursor.style.height=s.height/e+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(ua)!=s&&this.view.dispatch({effects:Sy.of(s)})}},{eventObservers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});yr=class{constructor(t){let{regexp:e,decoration:i,decorate:n,boundary:r,maxLength:o=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(a,l,h,c)=>n(c,h,h+a[0].length,a,l);else if(typeof i=="function")this.addMatch=(a,l,h,c)=>{let u=i(a,l,h);u&&c(h,h+a[0].length,u)};else if(i)this.addMatch=(a,l,h,c)=>c(h,h+a[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(t){let e=new ye,i=e.add.bind(e);for(let{from:n,to:r}of TA(t,this.maxLength))wy(t.state.doc,this.regexp,n,r,(o,a)=>this.addMatch(a,t,o,i));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges((r,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(i=Math.min(a,i),n=Math.max(l,n))}),t.viewportMoved||n-i>1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let r of t.visibleRanges){let o=Math.max(r.from,i),a=Math.min(r.to,n);if(a>=o){let l=t.state.doc.lineAt(o),h=l.to<a?t.state.doc.lineAt(a):l,c=Math.max(r.from,l.from),u=Math.min(r.to,h.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){c=o;break}for(;a<h.to;a++)if(this.boundary.test(h.text[a-h.from])){u=a;break}}let d=[],f,p=(m,O,g)=>d.push(g.range(m,O));if(l==h)for(this.regexp.lastIndex=c-l.from;(f=this.regexp.exec(l.text))&&f.index<u-l.from;)this.addMatch(f,t,f.index+l.from,p);else wy(t.state.doc,this.regexp,c,u,(m,O)=>this.addMatch(O,t,m,p));e=e.update({filterFrom:c,filterTo:u,filter:(m,O)=>m<c||O>u,add:d})}}return e}},ef=/x/.unicode!=null?"gu":"g",LA=new RegExp(`[\0-\b
12
+ -\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,ef),MA={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"},sf=null;ah=R.define({combine(s){let t=Vt(s,{render:null,specialChars:LA,addSpecialChars:null});return(t.replaceTabs=!RA())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,ef)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,ef)),t}});ky=null;ZA="\u2022";nf=class extends Ct{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=DA(this.code),i=t.state.phrase("Control character")+" "+(MA[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}},rf=class extends Ct{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}},$y=nt.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(s){let{view:t}=s,e=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;e>=0&&e!=this.height&&(this.height=e,this.attrs={style:`padding-bottom: ${e}px`})}});BA=B.line({class:"cm-activeLine"}),zA=nt.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let t=-1,e=[];for(let i of s.state.selection.ranges){let n=s.lineBlockAt(i.head);n.from>t&&(e.push(BA.range(n.from)),t=n.from)}return B.set(e)}},{decorations:s=>s.decorations}),of=class extends Ct{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?Ko(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),n=ta(e[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}};af=2e3;WA={Alt:[18,s=>!!s.altKey],Control:[17,s=>!!s.ctrlKey],Shift:[16,s=>!!s.shiftKey],Meta:[91,s=>!!s.metaKey]},YA={style:"cursor: crosshair"};lh="-10000px",hh=class{constructor(t,e,i,n){this.facet=e,this.createTooltipView=i,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(t,e){var i;let n=t.state.facet(this.facet),r=n.filter(l=>l);if(n===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let o=[],a=e?[]:null;for(let l=0;l<r.length;l++){let h=r[l],c=-1;if(h){for(let u=0;u<this.tooltips.length;u++){let d=this.tooltips[u];d&&d.create==h.create&&(c=u)}if(c<0)o[l]=this.createTooltipView(h,l?o[l-1]:null),a&&(a[l]=!!h.above);else{let u=o[l]=this.tooltipViews[c];a&&(a[l]=e[c]),u.update&&u.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(i=l.destroy)===null||i===void 0||i.call(l));return e&&(a.forEach((l,h)=>e[h]=l),e.length=a.length),this.input=n,this.tooltips=r,this.tooltipViews=o,!0}};ch=R.define({combine:s=>{var t,e,i;return{position:Z.ios?"absolute":((t=s.find(n=>n.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((e=s.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((i=s.find(n=>n.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||GA}}}),Qy=new WeakMap,uh=nt.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=s.state.facet(ch);this.position=t.position,this.parent=t.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hh(s,Ss,(e,i)=>this.createTooltip(e,i),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),s.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(s,this.above);t&&this.observeIntersection();let e=t||s.geometryChanged,i=s.state.facet(ch);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(s,t){let e=s.create(this.view),i=t?t.dom:null;if(e.dom.classList.add("cm-tooltip"),s.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",e.dom.appendChild(n)}return e.dom.style.position=this.position,e.dom.style.top=lh,e.dom.style.left="0px",this.container.insertBefore(e.dom,i),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var s,t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(s=i.destroy)===null||s===void 0||s.call(i);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=1,t=1,e=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Z.safari){let o=r.getBoundingClientRect();e=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else e=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(e||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(s=r.width/this.parent.offsetWidth,t=r.height/this.parent.offsetHeight)}else({scaleX:s,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),n=yd(this.view);return{visible:{left:i.left+n.left,top:i.top+n.top,right:i.right-n.right,bottom:i.bottom-n.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(ch).tooltipSpace(this.view),scaleX:s,scaleY:t,makeAbsolute:e}}writeMeasure(s){var t;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:e,space:i,scaleX:n,scaleY:r}=s,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],h=this.manager.tooltipViews[a],{dom:c}=h,u=s.pos[a],d=s.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(e.top,i.top)||u.top>=Math.min(e.bottom,i.bottom)||u.right<Math.max(e.left,i.left)-.1||u.left>Math.min(e.right,i.right)+.1)){c.style.top=lh;continue}let f=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,m=d.right-d.left,O=(t=Qy.get(h))!==null&&t!==void 0?t:d.bottom-d.top,g=h.offset||KA,y=this.view.textDirection==J.LTR,v=d.width>i.right-i.left?y?i.left:i.right-d.width:y?Math.max(i.left,Math.min(u.left-(f?14:0)+g.x,i.right-m)):Math.min(Math.max(i.left,u.left-m+(f?14:0)-g.x),i.right-m),x=this.above[a];!l.strictSide&&(x?u.top-O-p-g.y<i.top:u.bottom+O+p+g.y>i.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[a]=!x);let S=(x?u.top-i.top:i.bottom-u.bottom)-p;if(S<O&&h.resize!==!1){if(S<this.view.defaultLineHeight){c.style.top=lh;continue}Qy.set(h,O),c.style.height=(O=S)/r+"px"}else c.style.height&&(c.style.height="");let $=x?u.top-O-p-g.y:u.bottom+p+g.y,k=v+m;if(h.overlap!==!0)for(let P of o)P.left<k&&P.right>v&&P.top<$+O&&P.bottom>$&&($=x?P.top-O-2-p:P.bottom+p+2);if(this.position=="absolute"?(c.style.top=($-s.parent.top)/r+"px",Py(c,(v-s.parent.left)/n)):(c.style.top=$/r+"px",Py(c,v/n)),f){let P=u.left+(y?g.x:-g.x)-(v+14-7);f.style.left=P/n+"px"}h.overlap!==!0&&o.push({left:v,top:$,right:k,bottom:$+O}),c.classList.toggle("cm-tooltip-above",x),c.classList.toggle("cm-tooltip-below",!x),h.positioned&&h.positioned(s.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let s of this.manager.tooltipViews)s.dom.style.top=lh}},{eventObservers:{scroll(){this.maybeMeasure()}}});HA=L.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),KA={x:0,y:0},Ss=R.define({enables:[uh,HA]}),da=R.define({combine:s=>s.reduce((t,e)=>t.concat(e),[])}),dh=class s{static create(t){return new s(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hh(t,da,(e,i)=>this.createHostedView(e,i),e=>e.dom.remove())}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let n=i[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},JA=Ss.compute([da],s=>{let t=s.facet(da);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var i;return(i=e.end)!==null&&i!==void 0?i:e.pos})),create:dh.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),lf=class{constructor(t,e,i,n,r){this.view=t,this.source=e,this.field=i,this.setHover=n,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,i=t.docView.tile.nearest(e.target);if(!i)return;let n,r=1;if(i.isWidget())n=i.posAtStart;else{if(n=t.posAtCoords(e),n==null)return;let a=t.coordsAtPos(n);if(!a||e.y<a.top||e.y>a.bottom||e.x<a.left-t.defaultCharacterWidth||e.x>a.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(n)).find(c=>c.from<=n&&c.to>=n),h=l&&l.dir==J.RTL?-1:1;r=e.x<a.left?-h:h}let o=this.source(t,n,r);if(o?.then){let a=this.pending={pos:n};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>St(t.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(uh),e=t?t.manager.tooltips.findIndex(i=>i.create==dh.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:r}=this;if(n.length&&r&&!tQ(r.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,a=(i=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&i!==void 0?i:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!eQ(this.view,o,a,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:i}=this;i&&i.dom.contains(t.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},fh=4;Cy=j.define(),sQ=Cy.of(null);hf=R.define({combine(s){let t,e;for(let i of s)t=t||i.topContainer,e=e||i.bottomContainer;return{topContainer:t,bottomContainer:e}}});Ey=nt.fromClass(class{constructor(s){this.input=s.state.facet(Sr),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(s));let t=s.state.facet(hf);this.top=new vr(s,!0,t.topContainer),this.bottom=new vr(s,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(s){let t=s.state.facet(hf);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new vr(s.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new vr(s.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=s.state.facet(Sr);if(e!=this.input){let i=e.filter(l=>l),n=[],r=[],o=[],a=[];for(let l of i){let h=this.specs.indexOf(l),c;h<0?(c=l(s.view),a.push(c)):(c=this.panels[h],c.update&&c.update(s)),n.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=n,this.top.sync(r),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let i of this.panels)i.update&&i.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>L.scrollMargins.of(t=>{let e=t.plugin(s);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),vr=class{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,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 e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Ty(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Ty(t)}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 t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}};Sr=R.define({enables:Ey});ph=ht.define({create(){return[]},update(s,t){for(let e of t.effects)e.is(Ly)?s=[e.value].concat(s):e.is(My)&&(s=s.filter(i=>i!=e.value));return s},provide:s=>Sr.computeN([s],t=>t.field(s))}),Ly=j.define(),My=j.define();Yt=class extends be{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};Yt.prototype.elementClass="",Yt.prototype.toDOM=void 0,Yt.prototype.mapMode=gt.TrackBefore,Yt.prototype.startSide=Yt.prototype.endSide=-1,Yt.prototype.point=!0;fa=R.define(),Ry=R.define(),hQ={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>U.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},pa=R.define();cf=R.define({combine:s=>s.some(t=>t)});cQ=nt.fromClass(class{constructor(s){this.view=s,this.domAfter=null,this.prevViewport=s.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=s.state.facet(pa).map(t=>new mh(s,t)),this.fixed=!s.state.facet(cf);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),s.scrollDOM.insertBefore(this.dom,s.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(s){if(this.updateGutters(s)){let t=this.prevViewport,e=s.view.viewport,i=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(i<(e.to-e.from)*.8)}if(s.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(cf)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=s.view.viewport}syncGutters(s){let t=this.dom.nextSibling;s&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let e=U.iter(this.view.state.facet(fa),this.view.viewport.from),i=[],n=this.gutters.map(r=>new ff(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==At.Text&&o){df(e,i,a.from);for(let l of n)l.line(this.view,a,i);o=!1}else if(a.widget)for(let l of n)l.widget(this.view,a)}else if(r.type==At.Text){df(e,i,r.from);for(let o of n)o.line(this.view,r,i)}else if(r.widget)for(let o of n)o.widget(this.view,r);for(let r of n)r.finish();s&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(s){let t=s.startState.facet(pa),e=s.state.facet(pa),i=s.docChanged||s.heightChanged||s.viewportChanged||!U.eq(s.startState.facet(fa),s.state.facet(fa),s.view.viewport.from,s.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(s)&&(i=!0);else{i=!0;let n=[];for(let r of e){let o=t.indexOf(r);o<0?n.push(new mh(this.view,r)):(this.gutters[o].update(s),n.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),n.indexOf(r)<0&&r.destroy();for(let r of n)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=n}return i}destroy(){for(let s of this.gutters)s.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:s=>L.scrollMargins.of(t=>{let e=t.plugin(s);if(!e||e.gutters.length==0||!e.fixed)return null;let i=e.dom.offsetWidth*t.scaleX,n=e.domAfter?e.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==J.LTR?{left:i,right:n}:{right:i,left:n}})});ff=class{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=U.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,r=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let a=new gh(t,o,r,i);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(t,o,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];df(this.cursor,n,e.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e),n=i?[i]:null;for(let r of t.state.facet(Ry)){let o=r(t,e.widget,e);o&&(n||(n=[])).push(o)}n&&this.addElement(t,e,n)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},mh=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,n=>{let r=n.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let l=r.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=n.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[i](t,a,n)&&n.preventDefault()});this.markers=Xy(e.markers(t)),e.initialSpacer&&(this.spacer=new gh(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Xy(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let i=t.view.viewport;return!U.eq(this.markers,e,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},gh=class{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),uQ(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let i="cm-gutterElement",n=this.dom.firstChild;for(let r=0,o=0;;){let a=o,l=r<e.length?e[r++]:null,h=!1;if(l){let c=l.elementClass;c&&(i+=" "+c);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,h=!0;break}}else a=this.markers.length;for(;o<a;){let c=this.markers[o++];if(c.toDOM){c.destroy(n);let u=n.nextSibling;n.remove(),n=u}}if(!l)break;l.toDOM&&(h?n=n.nextSibling:this.dom.insertBefore(l.toDOM(t),n)),h&&o++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}};Iy=R.define(),Zy=R.define(),xr=R.define({combine(s){return Vt(s,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let n in e){let r=i[n],o=e[n];i[n]=r?(a,l,h)=>r(a,l,h)||o(a,l,h):o}return i}})}}),ma=class extends Yt{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};dQ=pa.compute([xr],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Iy)},lineMarker(t,e,i){return i.some(n=>n.toDOM)?null:new ma(pf(t,t.state.doc.lineAt(e.from).number))},widgetMarker:(t,e,i)=>{for(let n of t.state.facet(Zy)){let r=n(t,e,i);if(r)return r}return null},lineMarkerChange:t=>t.startState.facet(xr)!=t.state.facet(xr),initialSpacer(t){return new ma(pf(t,Dy(t.state.doc.lines)))},updateSpacer(t,e){let i=pf(e.view,Dy(e.view.state.doc.lines));return i==t.number?t:new ma(i)},domEventHandlers:s.facet(xr).domEventHandlers,side:"before"}));fQ=new class extends Yt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},pQ=fa.compute(["selection"],s=>{let t=[],e=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.head).from;n>e&&(e=n,t.push(fQ.range(n)))}return U.of(t)});mQ=B.mark({class:"cm-highlightTab"}),gQ=B.mark({class:"cm-highlightSpace"}),OQ=qy(new yr({regexp:/\t| /g,decoration:s=>s[0]==" "?mQ:gQ,boundary:/\S/}));yQ=qy(new yr({regexp:/\s+$/g,decoration:B.mark({class:"cm-trailingSpace"})}));xQ={HeightMap:le,HeightOracle:Fl,MeasuredHeights:Gl,QueryType:st,ChangedRange:$e,computeOrder:mb,moveVisually:bb,clearHeightChangeFlag:Bd,getHeightChangeFlag:()=>vs}});function ks(s){return R.define({combine:s?t=>t.concat(s):void 0})}function By(s,t,e){let i=s.facet(pi),n=F(s).topNode;if(!i||i.allowsNesting)for(let r=n;r;r=r.enter(t,e,H.ExcludeBuffers|H.EnterBracketed))r.type.isTop&&(n=r);return n}function F(s){let t=s.field(wt.state,!1);return t?t.tree:Y.empty}function zy(s,t,e=50){var i;let n=(i=s.field(wt.state,!1))===null||i===void 0?void 0:i.context;if(!n)return null;let r=n.viewport;n.updateViewport({from:0,to:t});let o=n.isDone(t)||n.work(e,t)?n.tree:null;return n.updateViewport(r),o}function SQ(s,t=s.doc.length){var e;return((e=s.field(wt.state,!1))===null||e===void 0?void 0:e.context.isDone(t))||!1}function wQ(s,t=s.viewport.to,e=100){let i=zy(s.state,t,e);return i!=F(s.state)&&s.dispatch({}),!!i}function kQ(s){var t;return((t=s.plugin(_y))===null||t===void 0?void 0:t.isWorking())||!1}function jy(s,t,e){return Be.applyChanges(s,[{fromA:t,toA:e,fromB:t,toB:e}])}function Oi(s){let t=s.facet(yi);return t.charCodeAt(0)==9?s.tabSize*t.length:t.length}function zi(s,t){let e="",i=s.tabSize,n=s.facet(yi)[0];if(n==" "){for(;t>=i;)e+=" ",t-=i;n=" "}for(let r=0;r<t;r++)e+=n;return e}function Ar(s,t){s instanceof et&&(s=new gi(s));for(let i of s.state.facet(Vy)){let n=i(s,t);if(n!==void 0)return n}let e=F(s.state);return e.length>=t?AQ(s,e,t):null}function $Q(s,t,e){let i=Object.create(null),n=new gi(s,{overrideIndentation:o=>{var a;return(a=i[o])!==null&&a!==void 0?a:-1}}),r=[];for(let o=t;o<=e;){let a=s.doc.lineAt(o);o=a.to+1;let l=Ar(n,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let h=/^\s*/.exec(a.text)[0],c=zi(s,l);h!=c&&(i[a.from]=l,r.push({from:a.from,to:a.from+h.length,insert:c}))}return s.changes(r)}function AQ(s,t,e){let i=t.resolveStack(e),n=t.resolveInner(e,-1).resolve(e,0).enterUnfinishedNodesBefore(e);if(n!=i.node){let r=[];for(let o=n;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Wy(i,s,e)}function Wy(s,t,e){for(let i=s;i;i=i.next){let n=PQ(i.node);if(n)return n($h.create(t,e,i))}return 0}function QQ(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function PQ(s){let t=s.type.prop(Ut);if(t)return t;let e=s.firstChild,i;if(e&&(i=e.type.prop(q.closedBy))){let n=s.lastChild,r=n&&i.indexOf(n.name)>-1;return o=>Yy(o,!0,1,void 0,r&&!QQ(o)?n.from:void 0)}return s.parent==null?CQ:null}function CQ(){return 0}function EQ(s,t){for(let e=t;e;e=e.parent)if(s==e)return!0;return!1}function TQ(s){let t=s.node,e=t.childAfter(t.from),i=t.lastChild;if(!e)return null;let n=s.options.simulateBreak,r=s.state.doc.lineAt(e.from),o=n==null||n<=r.from?r.to:Math.min(r.to,n);for(let a=e.to;;){let l=t.childAfter(a);if(!l||l==i)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let h=/^ */.exec(r.text.slice(e.to-r.from))[0].length;return{from:e.from,to:e.to+h}}a=l.to}}function Qr({closing:s,align:t=!0,units:e=1}){return i=>Yy(i,t,e,s)}function Yy(s,t,e,i,n){let r=s.textAfter,o=r.match(/^\s*/)[0].length,a=i&&r.slice(o,o+i.length)==i||n==s.pos+o,l=t?TQ(s):null;return l?a?s.column(l.from):s.column(l.to):s.baseIndent+(a?0:s.unit*e)}function Je({except:s,units:t=1}={}){return e=>{let i=s&&s.test(e.textAfter);return e.baseIndent+(i?0:t*e.unit)}}function MQ(){return et.transactionFilter.of(s=>{if(!s.docChanged||!s.isUserEvent("input.type")&&!s.isUserEvent("input.complete"))return s;let t=s.startState.languageDataAt("indentOnInput",s.startState.selection.main.head);if(!t.length)return s;let e=s.newDoc,{head:i}=s.newSelection.main,n=e.lineAt(i);if(i>n.from+LQ)return s;let r=e.sliceString(n.from,i);if(!t.some(h=>h.test(r)))return s;let{state:o}=s,a=-1,l=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==a)continue;a=c.from;let u=Ar(o,c.from);if(u==null)continue;let d=/^\s*/.exec(c.text)[0],f=zi(o,u);d!=f&&l.push({from:c.from,to:c.from+d.length,insert:f})}return l.length?[s,{changes:l,sequential:!0}]:s})}function vi(s){let t=s.firstChild,e=s.lastChild;return t&&t.to<e.from?{from:t.to,to:e.type.isError?s.to:e.from}:null}function RQ(s,t,e){let i=F(s);if(i.length<e)return null;let n=i.resolveStack(e,1),r=null;for(let o=n;o;o=o.next){let a=o.node;if(a.to<=e||a.from>e)continue;if(r&&a.from<t)break;let l=a.type.prop(Ft);if(l&&(a.to<i.length-50||i.length==s.doc.length||!XQ(a))){let h=l(a,s);h&&h.from<=e&&h.from>=t&&h.to>e&&(r=h)}}return r}function XQ(s){let t=s.lastChild;return t&&t.to==s.to&&t.type.isError}function wr(s,t,e){for(let i of s.facet(Ch)){let n=i(s,t,e);if(n)return n}return RQ(s,t,e)}function Uy(s,t){let e=t.mapPos(s.from,1),i=t.mapPos(s.to,-1);return e>=i?void 0:{from:e,to:i}}function bf(s){let t=[];for(let{head:e}of s.state.selection.ranges)t.some(i=>i.from<=e&&i.to>=e)||t.push(s.lineBlockAt(e));return t}function Fy(s,t,e=t){let i=!1;return s.between(t,e,(n,r)=>{n<e&&r>t&&(i=!0)}),i?s.update({filterFrom:t,filterTo:e,filter:(n,r)=>n>=e||r<=t}):s}function IQ(s){return s.field(mi,!1)||U.empty}function ya(s,t,e){var i;let n=null;return(i=s.field(mi,!1))===null||i===void 0||i.between(t,e,(r,o)=>{(!n||n.from>r)&&(n={from:r,to:o})}),n}function ZQ(s,t,e){let i=!1;return s.between(t,t,(n,r)=>{n==t&&r==e&&(i=!0)}),i}function yf(s,t){return s.field(mi,!1)?t:t.concat(j.appendConfig.of(xf()))}function Ah(s,t,e=!0){let i=s.state.doc.lineAt(t.from).number,n=s.state.doc.lineAt(t.to).number;return L.announce.of(`${s.state.phrase(e?"Folded lines":"Unfolded lines")} ${i} ${s.state.phrase("to")} ${n}.`)}function DQ(s,t){for(let e=t;;){let i=wr(s.state,e.from,e.to);if(i&&i.to>t.from)return i;if(!e.from)return null;e=s.lineBlockAt(e.from-1)}}function xf(s){let t=[mi,_Q];return s&&t.push(vf.of(s)),t}function tv(s,t){let{state:e}=s,i=e.facet(vf),n=o=>{let a=s.lineBlockAt(s.posAtDOM(o.target)),l=ya(s.state,a.from,a.to);l&&s.dispatch({effects:ws.of(l)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(s,n,t);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",e.phrase("folded code")),r.title=e.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=n,r}function NQ(s={}){let t={...jQ,...s},e=new va(t,!0),i=new va(t,!1),n=nt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(pi)!=o.state.facet(pi)||o.startState.field(mi,!1)!=o.state.field(mi,!1)||F(o.startState)!=F(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new ye;for(let l of o.viewportLineBlocks){let h=ya(o.state,l.from,l.to)?i:wr(o.state,l.from,l.to)?e:null;h&&a.add(l.from,l.from,h)}return a.finish()}}),{domEventHandlers:r}=t;return[n,ga({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(n))===null||a===void 0?void 0:a.markers)||U.empty},initialSpacer(){return new va(t,!1)},domEventHandlers:{...r,click:(o,a,l)=>{if(r.click&&r.click(o,a,l))return!0;let h=ya(o.state,a.from,a.to);if(h)return o.dispatch({effects:ws.of(h)}),!0;let c=wr(o.state,a.from,a.to);return c?(o.dispatch({effects:kr.of(c)}),!0):!1}}}),xf()]}function Qh(s){let t=s.facet(wf);return t.length?t:s.facet(iv)}function Th(s,t){let e=[WQ],i;return s instanceof bi&&(s.module&&e.push(L.styleModule.of(s.module)),i=s.themeType),t?.fallback?e.push(iv.of(s)):i?e.push(wf.computeN([L.darkTheme],n=>n.facet(L.darkTheme)==(i=="dark")?[s]:[])):e.push(wf.of(s)),e}function VQ(s,t,e){let i=Qh(s),n=null;if(i){for(let r of i)if(!r.scope||e&&r.scope(e)){let o=r.style(t);o&&(n=n?n+" "+o:o)}}return n}function GQ(s){let t=[],e=s.matched?UQ:FQ;return t.push(e.range(s.start.from,s.start.to)),s.end&&t.push(e.range(s.end.from,s.end.to)),t}function ov(s){let t=[],e=s.facet(rv);for(let i of s.selection.ranges){if(!i.empty)continue;let n=Ce(s,i.head,-1,e)||i.head>0&&Ce(s,i.head-1,1,e)||e.afterCursor&&(Ce(s,i.head,1,e)||i.head<s.doc.length&&Ce(s,i.head+1,-1,e));n&&(t=t.concat(e.renderMatch(n,s)))}return B.set(t,!0)}function JQ(s={}){return[rv.of(s),KQ]}function $f(s,t,e){let i=s.prop(t<0?q.openedBy:q.closedBy);if(i)return i;if(s.name.length==1){let n=e.indexOf(s.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function Af(s){let t=s.type.prop(Eh);return t?t(s.node):s}function Ce(s,t,e,i={}){let n=i.maxScanDistance||sv,r=i.brackets||nv,o=F(s),a=o.resolveInner(t,e);for(let l=a;l;l=l.parent){let h=$f(l.type,e,r);if(h&&l.from<l.to){let c=Af(l);if(c&&(e>0?t>=c.from&&t<c.to:t>c.from&&t<=c.to))return tP(s,t,e,l,c,h,r)}}return eP(s,t,e,o,a.type,n,r)}function tP(s,t,e,i,n,r,o){let a=i.parent,l={from:n.from,to:n.to},h=0,c=a?.cursor();if(c&&(e<0?c.childBefore(i.from):c.childAfter(i.to)))do if(e<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from<c.to){let u=Af(c);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if($f(c.type,e,o))h++;else if($f(c.type,-e,o)){if(h==0){let u=Af(c);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}h--}}while(e<0?c.prevSibling():c.nextSibling());return{start:l,matched:!1}}function eP(s,t,e,i,n,r,o){if(e<0?!t:t==s.doc.length)return null;let a=e<0?s.sliceDoc(t-1,t):s.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=e>0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},c=s.doc.iterRange(t,e>0?s.doc.length:0),u=0;for(let d=0;!c.next().done&&d<=r;){let f=c.value;e<0&&(d+=f.length);let p=t+d*e;for(let m=e>0?0:f.length-1,O=e>0?f.length:-1;m!=O;m+=e){let g=o.indexOf(f[m]);if(!(g<0||i.resolveInner(p+m,1).type!=n))if(g%2==0==e>0)u++;else{if(u==1)return{start:h,end:{from:p+m,to:p+m+1},matched:g>>1==l>>1};u--}}e>0&&(d+=f.length)}return c.done?{start:h,matched:!1}:null}function av(s,t,e,i=0,n=0){t==null&&(t=s.search(/[^\s\u00a0]/),t==-1&&(t=s.length));let r=n;for(let o=i;o<t;o++)s.charCodeAt(o)==9?r+=e-r%e:r++;return r}function iP(s){return{name:s.name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||sP,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Ef,mergeTokens:s.mergeTokens!==!1}}function sP(s){if(typeof s!="object")return s;let t={};for(let e in s){let i=s[e];t[e]=i instanceof Array?i.slice():i}return t}function Pf(s,t,e,i,n){let r=e>=i&&e+t.length<=n&&t.prop(s.stateAfter);if(r)return{state:s.streamParser.copyState(r),pos:e+t.length};for(let o=t.children.length-1;o>=0;o--){let a=t.children[o],l=e+t.positions[o],h=a instanceof Y&&l<n&&Pf(s,a,l,i,n);if(h)return h}return null}function hv(s,t,e,i,n){if(n&&e<=0&&i>=t.length)return t;!n&&e==0&&t.type==s.topNode&&(n=!0);for(let r=t.children.length-1;r>=0;r--){let o=t.positions[r],a=t.children[r],l;if(o<i&&a instanceof Y){if(!(l=hv(s,a,e-o,i-o,n)))break;return n?new Y(t.type,t.children.slice(0,r).concat(l),t.positions.slice(0,r+1),o+l.length):l}}return null}function nP(s,t,e,i,n){for(let r of t){let o=r.from+(r.openStart?25:0),a=r.to-(r.openEnd?25:0),l=o<=e&&a>e&&Pf(s,r.tree,0-r.offset,e,a),h;if(l&&l.pos<=i&&(h=hv(s,r.tree,e+r.offset,l.pos+r.offset,!1)))return{state:l.state,tree:h}}return{state:s.streamParser.startState(n?Oi(n):4),tree:Y.empty}}function cv(s,t,e){t.start=t.pos;for(let i=0;i<10;i++){let n=s(t,e);if(t.pos>t.start)return n}throw new Error("Stream parser failed to advance stream.")}function Tf(s,t){uv.indexOf(s)>-1||(uv.push(s),console.warn(t))}function pv(s,t){let e=[];for(let a of t.split(" ")){let l=[];for(let h of a.split(".")){let c=s[h]||b[h];c?typeof c=="function"?l.length?l=l.map(c):Tf(h,`Modifier ${h} used at start of tag`):l.length?Tf(h,`Tag ${h} used as modifier`):l=Array.isArray(c)?c:[c]:Tf(h,`Unknown highlighting tag ${h}`)}for(let h of l)e.push(h)}if(!e.length)return 0;let i=t.replace(/ /g,"_"),n=i+" "+e.map(a=>a.id),r=dv[n];if(r)return r.id;let o=dv[n]=ot.define({id:Sa.length,name:i,props:[$t({[i]:e})]});return Sa.push(o),o.id}function aP(s,t){let e=ot.define({id:Sa.length,name:"Document",props:[Ke.add(()=>s),Ut.add(()=>i=>t.getIndent(i))],top:!0});return Sa.push(e),e}function mv(s){return s.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(s)}function gv(s){for(let t=s.iter();!t.next().done;)if(mv(t.value))return!0;return!1}function lP(s){let t=!1;return s.iterChanges((e,i,n,r,o)=>{!t&&gv(o)&&(t=!0)}),t}function hP(s={}){let t=[cP];return s.alwaysIsolate&&t.push(Lf.of(!0)),t}function Ov(s,t,e){let i=new ye,n=s.visibleRanges;e||(n=uP(n,s.state.doc));for(let{from:r,to:o}of n)t.iterate({enter:a=>{let l=a.type.prop(q.isolate);l&&i.add(a.from,a.to,dP[l])},from:r,to:o});return i.finish()}function uP(s,t){let e=t.iter(),i=0,n=[],r=null;for(let{from:o,to:a}of s)if(!(r&&r.to>o&&(o=r.to,o>=a)))for(i+e.value.length<o&&(e.next(o-(i+e.value.length)),i=o);;){let l=i,h=i+e.value.length;if(!e.lineBreak&&mv(e.value)&&(r&&r.to>l-10?r.to=Math.min(a,h):n.push(r={from:l,to:Math.min(a,h)})),h>=a)break;i=h,e.next()}return n}var gf,Ke,wa,wt,he,kh,Oa,Bi,ba,Ny,Of,_y,pi,ft,$r,Vy,yi,gi,Ut,$h,Mf,LQ,Ch,Ft,kr,ws,mi,Gy,Hy,Ky,Jy,qQ,BQ,zQ,vf,ev,Sf,jQ,va,_Q,bi,wf,iv,kf,WQ,Lh,YQ,sv,nv,rv,UQ,FQ,HQ,KQ,Eh,xa,lv,Qf,Cf,Ef,Sa,rP,uv,dv,fv,Ph,oP,Lf,cP,dP,ti=W(()=>{Ie();Ue();fi();We();td();Ke=new q;wa=new q,wt=class{constructor(t,e,i=[],n=""){this.data=t,this.name=n,et.prototype.hasOwnProperty("tree")||Object.defineProperty(et.prototype,"tree",{get(){return F(this)}}),this.parser=e,this.extension=[pi.of(this),et.languageData.of((r,o,a)=>{let l=By(r,o,a),h=l.type.prop(Ke);if(!h)return[];let c=r.facet(h),u=l.type.prop(wa);if(u){let d=l.resolve(o-l.from,a);for(let f of u)if(f.test(d,r)){let p=r.facet(f.facet);return f.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(t,e,i=-1){return By(t,e,i).type.prop(Ke)==this.data}findRegions(t){let e=t.facet(pi);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(Ke)==this.data){i.push({from:o,to:o+r.length});return}let a=r.prop(q.mounted);if(a){if(a.tree.prop(Ke)==this.data){if(a.overlay)for(let l of a.overlay)i.push({from:l.from+o,to:l.to+o});else i.push({from:o,to:o+r.length});return}else if(a.overlay){let l=i.length;if(n(a.tree,a.overlay[0].from+o),i.length>l)return}}for(let l=0;l<r.children.length;l++){let h=r.children[l];h instanceof Y&&n(h,r.positions[l]+o)}};return n(F(t),0),i}get allowsNesting(){return!0}};wt.setState=j.define();he=class s extends wt{constructor(t,e,i){super(t,e,[],i),this.parser=e}static define(t){let e=ks(t.languageData);return new s(e,t.parser.configure({props:[Ke.add(i=>i.isTop?e:void 0)]}),t.name)}configure(t,e){return new s(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};kh=class{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}},Oa=null,Bi=class s{constructor(t,e,i=[],n,r,o,a,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new s(t,e,[],Y.empty,0,i,[],null)}startParse(){return this.parser.startParse(new kh(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=Y.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(Be.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(e??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Be.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Oa;Oa=this;try{return t()}finally{Oa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=jy(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((h,c,u,d)=>l.push({fromA:h,toA:c,fromB:u,toB:d})),i=Be.applyChanges(i,l),n=Y.empty,r=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let h of this.skipped){let c=t.mapPos(h.from,1),u=t.mapPos(h.to,-1);c<u&&a.push({from:c,to:u})}}}return new s(this.parser,e,i,n,r,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:n,to:r}=this.skipped[i];n<t.to&&r>t.from&&(this.fragments=jy(this.fragments,n,r),this.skipped.splice(i--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends je{createParse(e,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let l=Oa;if(l){for(let h of n)l.tempSkipped.push(h);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new Y(ot.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Oa}};ba=class s{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new s(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Bi.create(t.facet(pi).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new s(i)}};wt.state=ht.define({create:ba.init,update(s,t){for(let e of t.effects)if(e.is(wt.setState))return e.value;return t.startState.facet(pi)!=t.state.facet(pi)?ba.init(t.state):s.apply(t)}});Ny=s=>{let t=setTimeout(()=>s(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Ny=s=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(s,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});Of=typeof navigator<"u"&&(!((gf=navigator.scheduling)===null||gf===void 0)&&gf.isInputPending)?()=>navigator.scheduling.isInputPending():null,_y=nt.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=Ny(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,r=i.field(wt.state);if(r.tree==r.context.tree&&r.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!Of?Math.max(25,t.timeRemaining()-5):1e9),a=r.context.treeLen<n&&i.doc.length>n+1e3,l=r.context.work(()=>Of&&Of()||Date.now()>o,n+(a?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:wt.setState.of(new ba(r.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>St(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),pi=R.define({combine(s){return s.length?s[0]:null},enables:s=>[wt.state,_y,L.contentAttributes.compute([s],t=>{let e=t.facet(s);return e&&e.name?{"data-language":e.name}:{}})]}),ft=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}},$r=class s{constructor(t,e,i,n,r,o=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=r,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new s(t.name,(t.alias||[]).concat(t.name).map(n=>n.toLowerCase()),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let n of t)if(n.filename&&n.filename.test(e))return n;let i=/\.([^.]+)$/.exec(e);if(i){for(let n of t)if(n.extensions.indexOf(i[1])>-1)return n}return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let n of t)if(n.alias.some(r=>r==e))return n;if(i)for(let n of t)for(let r of n.alias){let o=e.indexOf(r);if(o>-1&&(r.length>2||!/\w/.test(e[o-1])&&!/\w/.test(e[o+r.length])))return n}return null}},Vy=R.define(),yi=R.define({combine:s=>{if(!s.length)return" ";let t=s[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return t}});gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=Oi(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return n!=null&&n>=i.from&&n<=i.to?r&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(t,e);return i.slice(t-n,Math.min(i.length,t+100-n))}column(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.countColumn(i,t-n),o=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return o>-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(t,e=t.length){return It(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let o=r(n);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Ut=new q;$h=class s extends gi{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(t,e,i){return new s(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(EQ(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return Wy(this.context.next,this.base,this.pos)}};Mf=s=>s.baseIndent;LQ=200;Ch=R.define(),Ft=new q;kr=j.define({map:Uy}),ws=j.define({map:Uy});mi=ht.define({create(){return B.none},update(s,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((e,i)=>s=Fy(s,e,i)),s=s.map(t.changes);for(let e of t.effects)if(e.is(kr)&&!ZQ(s,e.value.from,e.value.to)){let{preparePlaceholder:i}=t.state.facet(vf),n=i?B.replace({widget:new Sf(i(t.state,e.value))}):ev;s=s.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(ws)&&(s=s.update({filter:(i,n)=>e.value.from!=i||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));return t.selection&&(s=Fy(s,t.selection.main.head)),s},provide:s=>L.decorations.from(s),toJSON(s,t){let e=[];return s.between(0,t.doc.length,(i,n)=>{e.push(i,n)}),e},fromJSON(s){if(!Array.isArray(s)||s.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let e=0;e<s.length;){let i=s[e++],n=s[e++];if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid JSON for fold state");t.push(ev.range(i,n))}return B.set(t,!0)}});Gy=s=>{for(let t of bf(s)){let e=wr(s.state,t.from,t.to);if(e)return s.dispatch({effects:yf(s.state,[kr.of(e),Ah(s,e)])}),!0}return!1},Hy=s=>{if(!s.state.field(mi,!1))return!1;let t=[];for(let e of bf(s)){let i=ya(s.state,e.from,e.to);i&&t.push(ws.of(i),Ah(s,i,!1))}return t.length&&s.dispatch({effects:t}),t.length>0};Ky=s=>{let{state:t}=s,e=[];for(let i=0;i<t.doc.length;){let n=s.lineBlockAt(i),r=wr(t,n.from,n.to);r&&e.push(kr.of(r)),i=(r?s.lineBlockAt(r.to):n).to+1}return e.length&&s.dispatch({effects:yf(s.state,e)}),!!e.length},Jy=s=>{let t=s.state.field(mi,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,s.state.doc.length,(i,n)=>{e.push(ws.of({from:i,to:n}))}),s.dispatch({effects:e}),!0};qQ=s=>{let t=[];for(let e of bf(s)){let i=ya(s.state,e.from,e.to);if(i)t.push(ws.of(i),Ah(s,i,!1));else{let n=DQ(s,e);n&&t.push(kr.of(n),Ah(s,n))}}return t.length>0&&s.dispatch({effects:yf(s.state,t)}),!!t.length},BQ=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Gy},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Hy},{key:"Ctrl-Alt-[",run:Ky},{key:"Ctrl-Alt-]",run:Jy}],zQ={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},vf=R.define({combine(s){return Vt(s,zQ)}});ev=B.replace({widget:new class extends Ct{toDOM(s){return tv(s,null)}}}),Sf=class extends Ct{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return tv(t,this.value)}},jQ={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},va=class extends Yt{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}};_Q=L.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),bi=class s{constructor(t,e){this.specs=t;let i;function n(a){let l=ke.newName();return(i||(i=Object.create(null)))["."+l]=a,l}let r=typeof e.all=="string"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof wt?a=>a.prop(Ke)==o.data:o?a=>a==o:void 0,this.style=yl(t.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:r}).style,this.module=i?new ke(i):null,this.themeType=e.themeType}static define(t,e){return new s(t,e||{})}},wf=R.define(),iv=R.define({combine(s){return s.length?[s[0]]:null}});kf=class{constructor(t){this.markCache=Object.create(null),this.tree=F(t.state),this.decorations=this.buildDeco(t,Qh(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=F(t.state),i=Qh(t.state),n=i!=Qh(t.startState),{viewport:r}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!n&&e.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return B.none;let i=new ye;for(let{from:n,to:r}of t.visibleRanges)vl(this.tree,e,(o,a,l)=>{i.add(o,a,this.markCache[l]||(this.markCache[l]=B.mark({class:l})))},n,r);return i.finish()}},WQ=re.high(nt.fromClass(kf,{decorations:s=>s.decorations})),Lh=bi.define([{tag:b.meta,color:"#404740"},{tag:b.link,textDecoration:"underline"},{tag:b.heading,textDecoration:"underline",fontWeight:"bold"},{tag:b.emphasis,fontStyle:"italic"},{tag:b.strong,fontWeight:"bold"},{tag:b.strikethrough,textDecoration:"line-through"},{tag:b.keyword,color:"#708"},{tag:[b.atom,b.bool,b.url,b.contentSeparator,b.labelName],color:"#219"},{tag:[b.literal,b.inserted],color:"#164"},{tag:[b.string,b.deleted],color:"#a11"},{tag:[b.regexp,b.escape,b.special(b.string)],color:"#e40"},{tag:b.definition(b.variableName),color:"#00f"},{tag:b.local(b.variableName),color:"#30a"},{tag:[b.typeName,b.namespace],color:"#085"},{tag:b.className,color:"#167"},{tag:[b.special(b.variableName),b.macroName],color:"#256"},{tag:b.definition(b.propertyName),color:"#00c"},{tag:b.comment,color:"#940"},{tag:b.invalid,color:"#f00"}]),YQ=L.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),sv=1e4,nv="()[]{}",rv=R.define({combine(s){return Vt(s,{afterCursor:!0,brackets:nv,maxScanDistance:sv,renderMatch:GQ})}}),UQ=B.mark({class:"cm-matchingBracket"}),FQ=B.mark({class:"cm-nonmatchingBracket"});HQ=nt.fromClass(class{constructor(s){this.paused=!1,this.decorations=ov(s.state)}update(s){(s.docChanged||s.selectionSet||this.paused)&&(s.view.composing?(this.decorations=this.decorations.map(s.changes),this.paused=!0):(this.decorations=ov(s.state),this.paused=!1))}},{decorations:s=>s.decorations}),KQ=[HQ,YQ];Eh=new q;xa=class{constructor(t,e,i,n){this.string=t,this.tabSize=e,this.indentUnit=i,this.overrideIndent=n,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let e=this.string.charAt(this.pos),i;if(typeof t=="string"?i=e==t:i=e&&(t instanceof RegExp?t.test(e):t(e)),i)return++this.pos,e}eatWhile(t){let e=this.pos;for(;this.eat(t););return this.pos>e}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=av(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var t;return(t=this.overrideIndent)!==null&&t!==void 0?t:av(this.string,null,this.tabSize)}match(t,e,i){if(typeof t=="string"){let n=o=>i?o.toLowerCase():o,r=this.string.substr(this.pos,t.length);return n(r)==n(t)?(e!==!1&&(this.pos+=t.length),!0):null}else{let n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}};lv=new WeakMap,Qf=class s extends wt{constructor(t){let e=ks(t.languageData),i=iP(t),n,r=new class extends je{createParse(o,a,l){return new Cf(n,o,a,l)}};super(e,r,[],t.name),this.topNode=aP(e,this),n=this,this.streamParser=i,this.stateAfter=new q({perNode:!0}),this.tokenTable=t.tokenTable?new Ph(i.tokenTable):oP}static define(t){return new s(t)}getIndent(t){let e,{overrideIndentation:i}=t.options;i&&(e=lv.get(t.state),e!=null&&e<t.pos-1e4&&(e=void 0));let n=Pf(this,t.node.tree,t.node.from,t.node.from,e??t.pos),r,o;if(n?(o=n.state,r=n.pos+1):(o=this.streamParser.startState(t.unit),r=t.node.from),t.pos-r>1e4)return null;for(;r<t.pos;){let l=t.state.doc.lineAt(r),h=Math.min(t.pos,l.to);if(l.length){let c=i?i(l.from):-1,u=new xa(l.text,t.state.tabSize,t.unit,c<0?void 0:c);for(;u.pos<h-l.from;)cv(this.streamParser.token,u,o)}else this.streamParser.blankLine(o,t.unit);if(h==t.pos)break;r=l.to+1}let a=t.lineAt(t.pos);return i&&e==null&&lv.set(t.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],t)}get allowsNesting(){return!1}};Cf=class{constructor(t,e,i,n){this.lang=t,this.input=e,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let r=Bi.get(),o=n[0].from,{state:a,tree:l}=nP(t,i,o,this.to,r?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let h=0;h<l.children.length;h++)this.chunks.push(l.children[h]),this.chunkPos.push(l.positions[h]);r&&this.parsedPos<r.viewport.from-1e5&&n.some(h=>h.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Oi(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let t=Bi.get(),e=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(e,this.chunkStart+512);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos<i;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)e==`
13
+ `&&(e="");else{let i=e.indexOf(`
14
+ `);i>-1&&(e=e.slice(0,i))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let n=this.rangeIndex;;){let r=this.ranges[n].to;if(r>=i||(e=e.slice(0,r-(i-e.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);e+=a,i=o+a.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?n>r:n>=r)break;let o=this.ranges[++this.rangeIndex].from;e+=o-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,e,i,n){let r=4;if(this.ranges.length>1){n=this.skipGapsTo(e,n,1),e+=n;let a=this.chunk.length;n=this.skipGapsTo(i,n,-1),i+=n,r+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==t&&this.chunk[o+2]==e?this.chunk[o+2]=i:this.chunk.push(t,e,i,r),n}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,o=new xa(e,t?t.state.tabSize:4,t?Oi(t.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=cv(r.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=Y.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:rP,topID:0,maxBufferLength:512,reused:this.chunkReused});t=new Y(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Y(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};Ef=Object.create(null),Sa=[ot.none],rP=new ze(Sa),uv=[],dv=Object.create(null),fv=Object.create(null);for(let[s,t]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"]])fv[s]=pv(Ef,t);Ph=class{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),fv)}resolve(t){return t?this.table[t]||(this.table[t]=pv(this.extra,t)):0}},oP=new Ph(Ef);Lf=R.define({combine:s=>s.some(t=>t)});cP=nt.fromClass(class{constructor(s){this.always=s.state.facet(Lf)||s.textDirection!=J.LTR||s.state.facet(L.perLineTextDirection),this.hasRTL=!this.always&&gv(s.state.doc),this.tree=F(s.state),this.decorations=this.always||this.hasRTL?Ov(s,this.tree,this.always):B.none}update(s){let t=s.state.facet(Lf)||s.view.textDirection!=J.LTR||s.state.facet(L.perLineTextDirection);if(!t&&!this.hasRTL&&lP(s.changes)&&(this.hasRTL=!0),!t&&!this.hasRTL)return;let e=F(s.state);(t!=this.always||e!=this.tree||s.docChanged||s.viewportChanged)&&(this.tree=e,this.always=t,this.decorations=Ov(s.view,e,t))}},{provide:s=>{function t(e){var i,n;return(n=(i=e.plugin(s))===null||i===void 0?void 0:i.decorations)!==null&&n!==void 0?n:B.none}return[L.outerDecorations.of(t),re.lowest(L.bidiIsolatedRanges.of(t))]}});dP={rtl:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:J.RTL}),ltr:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:J.LTR}),auto:B.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})}});var vv={};Ht(vv,{json:()=>yv,jsonLanguage:()=>Rf,jsonParseLinter:()=>bv});function fP(s,t){let e;return(e=s.message.match(/at position (\d+)/))?Math.min(+e[1],t.length):(e=s.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+e[1]).from+ +e[2]-1,t.length):0}function yv(){return new ft(Rf)}var bv,Rf,xv=W(()=>{SO();ti();bv=()=>s=>{try{JSON.parse(s.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;let e=fP(t,s.state.doc);return[{from:e,message:t.message,severity:"error",to:e}]}return[]};Rf=he.define({name:"json",parser:Xu.configure({props:[Ut.add({Object:Je({except:/^\s*\}/}),Array:Je({except:/^\s*\]/})}),Ft.add({"Object Array":vi})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}})});function ZP(s){return s==45||s==46||s==58||s>=65&&s<=90||s==95||s>=97&&s<=122||s>=161}function Df(s,t){let e=s.pos+t;if(Rv==e&&Mv==s)return Lv;let i=s.peek(t),n="";for(;ZP(i);)n+=String.fromCharCode(i),i=s.peek(++t);return Mv=s,Rv=e,Lv=n?n.toLowerCase():i==DP||i==qP?void 0:null}function Iv(s,t){this.name=s,this.parent=t}function VP(s){for(;s;s=s.parent)if(s.name=="svg"||s.name=="math")return!0;return!1}function Bf(s,t,e){let i=2+s.length;return new at(n=>{for(let r=0,o=0,a=0;;a++){if(n.next<0){a&&n.acceptToken(t);break}if(r==0&&n.next==Xv||r==1&&n.next==qf||r>=2&&r<i&&n.next==s.charCodeAt(r-2))r++,o++;else if(r==i&&n.next==Mh){a>o?n.acceptToken(t,-o):n.acceptToken(e,-(o-2));break}else if((n.next==10||n.next==13)&&a){n.acceptToken(t,1);break}else r=o=0;n.advance()}})}function Zv(s,t){let e=Object.create(null);for(let i of s.getChildren(Cv)){let n=i.getChild(QP),r=i.getChild(Zf)||i.getChild(Ev);n&&(e[t.read(n.from,n.to)]=r?r.type.id==Zf?t.read(r.from+1,r.to-1):t.read(r.from,r.to):"")}return e}function Dv(s,t){let e=s.getChild(AP);return e?t.read(e.from,e.to):" "}function zf(s,t,e){let i;for(let n of e)if(!n.attrs||n.attrs(i||(i=Zv(s.node.parent.firstChild,t))))return{parser:n.parser,bracketed:!0};return null}function Rh(s=[],t=[]){let e=[],i=[],n=[],r=[];for(let a of s)(a.tag=="script"?e:a.tag=="style"?i:a.tag=="textarea"?n:r).push(a);let o=t.length?Object.create(null):null;for(let a of t)(o[a.name]||(o[a.name]=[])).push(a);return os((a,l)=>{let h=a.type.id;if(h==PP)return zf(a,l,e);if(h==CP)return zf(a,l,i);if(h==EP)return zf(a,l,n);if(h==Pv&&r.length){let c=a.node,u=c.firstChild,d=u&&Dv(u,l),f;if(d){for(let p of r)if(p.tag==d&&(!p.attrs||p.attrs(f||(f=Zv(u,l))))){let m=c.lastChild,O=m.type.id==LP?m.from:c.to;if(O>u.to)return{parser:p.parser,overlay:[{from:u.to,to:O}]}}}}if(o&&h==Cv){let c=a.node,u;if(u=c.firstChild){let d=o[l.read(u.from,u.to)];if(d)for(let f of d){if(f.tagName&&f.tagName!=Dv(c.parent,l))continue;let p=c.lastChild;if(p.type.id==Zf){let m=p.from+1,O=p.lastChild,g=p.to-(O&&O.isError?0:1);if(g>m)return{parser:f.parser,overlay:[{from:m,to:g}],bracketed:!0}}else if(p.type.id==Ev)return{parser:f.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}var pP,mP,gP,OP,bP,yP,Sv,vP,Xf,wv,kv,$v,Av,xP,SP,wP,If,kP,$P,Qv,Pv,AP,Cv,QP,Zf,Ev,PP,CP,EP,TP,LP,MP,RP,XP,IP,Tv,Lv,Mv,Rv,Xv,Mh,qf,DP,qP,BP,zP,jP,NP,_P,WP,YP,UP,FP,GP,jf,qv=W(()=>{as();We();Ie();pP=55,mP=1,gP=56,OP=2,bP=57,yP=3,Sv=4,vP=5,Xf=6,wv=7,kv=8,$v=9,Av=10,xP=11,SP=12,wP=13,If=58,kP=14,$P=15,Qv=59,Pv=21,AP=23,Cv=24,QP=25,Zf=27,Ev=28,PP=29,CP=32,EP=35,TP=37,LP=38,MP=0,RP=1,XP={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},IP={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Tv={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};Lv=null,Mv=null,Rv=0;Xv=60,Mh=62,qf=47,DP=63,qP=33,BP=45;zP=[Xf,Av,wv,kv,$v],jP=new li({start:null,shift(s,t,e,i){return zP.indexOf(t)>-1?new Iv(Df(i,1)||"",s):s},reduce(s,t){return t==Pv&&s?s.parent:s},reuse(s,t,e,i){let n=t.type.id;return n==Xf||n==TP?new Iv(Df(i,1)||"",s):s},strict:!1}),NP=new at((s,t)=>{if(s.next!=Xv){s.next<0&&t.context&&s.acceptToken(If);return}s.advance();let e=s.next==qf;e&&s.advance();let i=Df(s,0);if(i===void 0)return;if(!i)return s.acceptToken(e?$P:kP);let n=t.context?t.context.name:null;if(e){if(i==n)return s.acceptToken(xP);if(n&&IP[n])return s.acceptToken(If,-2);if(t.dialectEnabled(MP))return s.acceptToken(SP);for(let r=t.context;r;r=r.parent)if(r.name==i)return;s.acceptToken(wP)}else{if(i=="script")return s.acceptToken(wv);if(i=="style")return s.acceptToken(kv);if(i=="textarea")return s.acceptToken($v);if(XP.hasOwnProperty(i))return s.acceptToken(Av);n&&Tv[n]&&Tv[n][i]?s.acceptToken(If,-1):s.acceptToken(Xf)}},{contextual:!0}),_P=new at(s=>{for(let t=0,e=0;;e++){if(s.next<0){e&&s.acceptToken(Qv);break}if(s.next==BP)t++;else if(s.next==Mh&&t>=2){e>=3&&s.acceptToken(Qv,-2);break}else t=0;s.advance()}});WP=new at((s,t)=>{if(s.next==qf&&s.peek(1)==Mh){let e=t.dialectEnabled(RP)||VP(t.context);s.acceptToken(e?vP:Sv,2)}else s.next==Mh&&s.acceptToken(Sv,1)});YP=Bf("script",pP,mP),UP=Bf("style",gP,OP),FP=Bf("textarea",bP,yP),GP=$t({"Text RawText IncompleteTag IncompleteCloseTag":b.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":b.angleBracket,TagName:b.tagName,"MismatchedCloseTag/TagName":[b.tagName,b.invalid],AttributeName:b.attributeName,"AttributeValue UnquotedAttributeValue":b.attributeValue,Is:b.definitionOperator,"EntityReference CharacterReference":b.character,Comment:b.blockComment,ProcessingInst:b.processingInstruction,DoctypeDecl:b.documentMeta}),jf=Nt.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/X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O!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:jP,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[GP],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!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ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[YP,UP,FP,WP,NP,_P,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517})});function ka(s){return s>=65&&s<=90||s>=97&&s<=122||s>=161}function Nf(s){return s>=48&&s<=57}function _v(s){return Nf(s)||s>=97&&s<=102||s>=65&&s<=70}var HP,Bv,KP,JP,zv,tC,eC,iC,jv,sC,nC,Nv,rC,Xh,oC,aC,lC,hC,cC,uC,dC,Vv,fC,pC,mC,gC,OC,bC,yC,vC,xC,SC,_f,Wv=W(()=>{as();We();HP=135,Bv=1,KP=136,JP=137,zv=2,tC=138,eC=3,iC=4,jv=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],sC=58,nC=40,Nv=95,rC=91,Xh=45,oC=46,aC=35,lC=37,hC=38,cC=92,uC=10,dC=42;Vv=(s,t,e)=>(i,n)=>{for(let r=!1,o=0,a=0;;a++){let{next:l}=i;if(ka(l)||l==Xh||l==Nv||r&&Nf(l))!r&&(l!=Xh||a>0)&&(r=!0),o===a&&l==Xh&&o++,i.advance();else if(l==cC&&i.peek(1)!=uC){if(i.advance(),_v(i.next)){do i.advance();while(_v(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();r=!0}else{r&&i.acceptToken(o==2&&n.canShift(zv)?t:l==nC?e:s);break}}},fC=new at(Vv(KP,zv,JP),{contextual:!0}),pC=new at(Vv(tC,eC,iC),{contextual:!0}),mC=new at(s=>{if(jv.includes(s.peek(-1))){let{next:t}=s;(ka(t)||t==Nv||t==aC||t==oC||t==dC||t==rC||t==sC&&ka(s.peek(1))||t==Xh||t==hC)&&s.acceptToken(HP)}}),gC=new at(s=>{if(!jv.includes(s.peek(-1))){let{next:t}=s;if(t==lC&&(s.advance(),s.acceptToken(Bv)),ka(t)){do s.advance();while(ka(s.next)||Nf(s.next));s.acceptToken(Bv)}}}),OC=$t({"AtKeyword import charset namespace keyframes media supports font-feature-values":b.definitionKeyword,"from to selector scope MatchFlag":b.keyword,NamespaceName:b.namespace,KeyframeName:b.labelName,KeyframeRangeName:b.operatorKeyword,TagName:b.tagName,ClassName:b.className,PseudoClassName:b.constant(b.className),IdName:b.labelName,"FeatureName PropertyName":b.propertyName,AttributeName:b.attributeName,NumberLiteral:b.number,KeywordQuery:b.keyword,UnaryQueryOp:b.operatorKeyword,"CallTag ValueName FontName":b.atom,VariableName:b.variableName,Callee:b.operatorKeyword,Unit:b.unit,"UniversalSelector NestingSelector":b.definitionOperator,"MatchOp CompareOp":b.compareOperator,"ChildOp SiblingOp, LogicOp":b.logicOperator,BinOp:b.arithmeticOperator,Important:b.modifier,Comment:b.blockComment,ColorLiteral:b.color,"ParenthesizedContent StringLiteral":b.string,":":b.punctuation,"PseudoOp #":b.derefOperator,"; , |":b.separator,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace}),bC={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},yC={__proto__:null,or:104,and:104,not:112,only:112,layer:186},vC={__proto__:null,selector:118,layer:182},xC={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},SC={__proto__:null,to:223},_f=Nt.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO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udoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:159,nodeProps:[["isolate",-2,5,39,""],["openedBy",23,"(",31,"[",34,"{"],["closedBy",24,")",32,"]",35,"}"]],propSources:[OC],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!P;u!P!Q<^!Q![=V![!]>Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%l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{<%lO%jbHoU!e`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$cQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$XUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU!uQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[mC,gC,fC,pC,1,2,3,4,new ai("m~RRYZ[z{a~~g~aO$T~~dP!P!Qg~lO$U~~",28,142)],topRules:{StyleSheet:[0,6],Styles:[1,116]},dynamicPrecedences:{84:1},specialized:[{term:137,get:s=>bC[s]||-1},{term:138,get:s=>yC[s]||-1},{term:4,get:s=>vC[s]||-1},{term:28,get:s=>xC[s]||-1},{term:136,get:s=>SC[s]||-1}],tokenPrec:2256})});var Hv={};Ht(Hv,{css:()=>Ih,cssCompletionSource:()=>Uf,cssLanguage:()=>$s,defineCSSCompletionSource:()=>Yf});function Wf(){if(!Vf&&typeof document=="object"&&document.body){let{style:s}=document.body,t=[],e=new Set;for(let i in s)i!="cssText"&&i!="cssFloat"&&typeof s[i]=="string"&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())),e.has(i)||(t.push(i),e.add(i)));Vf=t.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return Vf||[]}function AC(s,t){var e;if((s.name=="("||s.type.isError)&&(s=s.parent||s),s.name!="ArgList")return!1;let i=(e=s.parent)===null||e===void 0?void 0:e.firstChild;return i?.name!="Callee"?!1:t.sliceString(i.from,i.to)=="var"}function PC(s){for(let t=s;;){if(t.type.isTop)return t;if(!(t=t.parent))return s}}function Gv(s,t,e){if(t.to-t.from>4096){let i=Fv.get(t);if(i)return i;let n=[],r=new Set,o=t.cursor(H.IncludeAnonymous);if(o.firstChild())do for(let a of Gv(s,o.node,e))r.has(a.label)||(r.add(a.label),n.push(a));while(o.nextSibling());return Fv.set(t,n),n}else{let i=[],n=new Set;return t.cursor().iterate(r=>{var o;if(e(r)&&r.matchContext(QC)&&((o=r.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=s.sliceString(r.from,r.to);n.has(a)||(n.add(a),i.push({label:a,type:"variable"}))}}),i}}function Ih(){return new ft($s,$s.data.of({autocomplete:Uf}))}var Vf,Yv,Uv,wC,kC,xi,$C,Fv,QC,Yf,Uf,$s,Ff=W(()=>{Wv();ti();Ie();Vf=null;Yv=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(s=>({type:"class",label:s})),Uv=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(s=>({type:"keyword",label:s})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(s=>({type:"constant",label:s}))),wC=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(s=>({type:"type",label:s})),kC=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(s=>({type:"keyword",label:s})),xi=/^(\w[\w-]*|-\w[\w-]*|)$/,$C=/^-(-[\w-]*)?$/;Fv=new rs,QC=["Declaration"];Yf=s=>t=>{let{state:e,pos:i}=t,n=F(e).resolveInner(i,-1),r=n.type.isError&&n.from==n.to-1&&e.doc.sliceString(n.from,n.to)=="-";if(n.name=="PropertyName"||(r||n.name=="TagName")&&/^(Block|Styles)$/.test(n.resolve(n.to).name))return{from:n.from,options:Wf(),validFor:xi};if(n.name=="ValueName")return{from:n.from,options:Uv,validFor:xi};if(n.name=="PseudoClassName")return{from:n.from,options:Yv,validFor:xi};if(s(n)||(t.explicit||r)&&AC(n,e.doc))return{from:s(n)||r?n.from:i,options:Gv(e.doc,PC(n),s),validFor:$C};if(n.name=="TagName"){for(let{parent:l}=n;l;l=l.parent)if(l.name=="Block")return{from:n.from,options:Wf(),validFor:xi};return{from:n.from,options:wC,validFor:xi}}if(n.name=="AtKeyword")return{from:n.from,options:kC,validFor:xi};if(!t.explicit)return null;let o=n.resolve(i),a=o.childBefore(i);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:i,options:Yv,validFor:xi}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:i,options:Uv,validFor:xi}:o.name=="Block"||o.name=="Styles"?{from:i,options:Wf(),validFor:xi}:null},Uf=Yf(s=>s.name=="VariableName"),$s=he.define({name:"css",parser:_f.configure({props:[Ut.add({Declaration:Je()}),Ft.add({"Block KeyframeList":vi})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}})});function Kf(s,t){return s>=65&&s<=90||s>=97&&s<=122||s==95||s>=192||!t&&s>=48&&s<=57}var CC,EC,Kv,TC,LC,MC,RC,XC,IC,ZC,DC,qC,Gf,Jv,BC,Hf,zC,jC,NC,_C,VC,WC,YC,UC,FC,GC,HC,KC,JC,tE,eE,iE,sE,nE,Jf,t0=W(()=>{as();We();CC=316,EC=317,Kv=1,TC=2,LC=3,MC=4,RC=318,XC=320,IC=321,ZC=5,DC=6,qC=0,Gf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Jv=125,BC=59,Hf=47,zC=42,jC=43,NC=45,_C=60,VC=44,WC=63,YC=46,UC=91,FC=new li({start:!1,shift(s,t){return t==ZC||t==DC||t==XC?s:t==IC},strict:!1}),GC=new at((s,t)=>{let{next:e}=s;(e==Jv||e==-1||t.context)&&s.acceptToken(RC)},{contextual:!0,fallback:!0}),HC=new at((s,t)=>{let{next:e}=s,i;Gf.indexOf(e)>-1||e==Hf&&((i=s.peek(1))==Hf||i==zC)||e!=Jv&&e!=BC&&e!=-1&&!t.context&&s.acceptToken(CC)},{contextual:!0}),KC=new at((s,t)=>{s.next==UC&&!t.context&&s.acceptToken(EC)},{contextual:!0}),JC=new at((s,t)=>{let{next:e}=s;if(e==jC||e==NC){if(s.advance(),e==s.next){s.advance();let i=!t.context&&t.canShift(Kv);s.acceptToken(i?Kv:TC)}}else e==WC&&s.peek(1)==YC&&(s.advance(),s.advance(),(s.next<48||s.next>57)&&s.acceptToken(LC))},{contextual:!0});tE=new at((s,t)=>{if(s.next!=_C||!t.dialectEnabled(qC)||(s.advance(),s.next==Hf))return;let e=0;for(;Gf.indexOf(s.next)>-1;)s.advance(),e++;if(Kf(s.next,!0)){for(s.advance(),e++;Kf(s.next,!1);)s.advance(),e++;for(;Gf.indexOf(s.next)>-1;)s.advance(),e++;if(s.next==VC)return;for(let i=0;;i++){if(i==7){if(!Kf(s.next,!0))return;break}if(s.next!="extends".charCodeAt(i))break;s.advance(),e++}}s.acceptToken(MC,-e)}),eE=$t({"get set async static":b.modifier,"for while do if else switch try catch finally return throw break continue default case defer":b.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":b.operatorKeyword,"let var const using function class extends":b.definitionKeyword,"import export from":b.moduleKeyword,"with debugger new":b.keyword,TemplateString:b.special(b.string),super:b.atom,BooleanLiteral:b.bool,this:b.self,null:b.null,Star:b.modifier,VariableName:b.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":b.function(b.variableName),VariableDefinition:b.definition(b.variableName),Label:b.labelName,PropertyName:b.propertyName,PrivatePropertyName:b.special(b.propertyName),"CallExpression/MemberExpression/PropertyName":b.function(b.propertyName),"FunctionDeclaration/VariableDefinition":b.function(b.definition(b.variableName)),"ClassDeclaration/VariableDefinition":b.definition(b.className),"NewExpression/VariableName":b.className,PropertyDefinition:b.definition(b.propertyName),PrivatePropertyDefinition:b.definition(b.special(b.propertyName)),UpdateOp:b.updateOperator,"LineComment Hashbang":b.lineComment,BlockComment:b.blockComment,Number:b.number,String:b.string,Escape:b.escape,ArithOp:b.arithmeticOperator,LogicOp:b.logicOperator,BitOp:b.bitwiseOperator,CompareOp:b.compareOperator,RegExp:b.regexp,Equals:b.definitionOperator,Arrow:b.function(b.punctuation),": Spread":b.punctuation,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace,"InterpolationStart InterpolationEnd":b.special(b.brace),".":b.derefOperator,", ;":b.separator,"@":b.meta,TypeName:b.typeName,TypeDefinition:b.definition(b.typeName),"type enum interface implements namespace module declare":b.definitionKeyword,"abstract global Privacy readonly override":b.modifier,"is keyof unique infer asserts":b.operatorKeyword,JSXAttributeValue:b.attributeValue,JSXText:b.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":b.angleBracket,"JSXIdentifier JSXNameSpacedName":b.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":b.attributeName,"JSXBuiltin/JSXIdentifier":b.standard(b.tagName)}),iE={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},sE={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},nE={__proto__:null,"<":193},Jf=Nt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQ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z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:"\u26A0 ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:FC,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[eE],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$<r#p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%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[HC,KC,JC,tE,2,3,4,5,6,7,8,9,10,11,12,13,14,GC,new ai("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new ai("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:s=>iE[s]||-1},{term:343,get:s=>sE[s]||-1},{term:95,get:s=>nE[s]||-1}],tokenPrec:15201})});function e0(s){let t=Object.keys(s).join(""),e=/\w/.test(t);return e&&(t=t.replace(/\w/g,"")),`[${e?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function rE(s){let t=Object.create(null),e=Object.create(null);for(let{label:n}of s){t[n[0]]=!0;for(let r=1;r<n.length;r++)e[n[r]]=!0}let i=e0(t)+e0(e)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function _h(s){let t=s.map(n=>typeof n=="string"?{label:n}:n),[e,i]=t.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:rE(t);return n=>{let r=n.matchBefore(i);return r||n.explicit?{from:r?r.from:n.pos,options:t,validFor:e}:null}}function oE(s,t){return e=>{for(let i=F(e.state).resolveInner(e.pos,-1);i;i=i.parent){if(s.indexOf(i.name)>-1)return t(e);if(i.type.isTop)break}return null}}function gp(s,t){return e=>{for(let i=F(e.state).resolveInner(e.pos,-1);i;i=i.parent){if(s.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return t(e)}}function As(s){return s.selection.main.from}function i0(s,t){var e;let{source:i}=s,n=t&&i[0]!="^",r=i[i.length-1]!="$";return!n&&!r?s:new RegExp(`${n?"^":""}(?:${i})${r?"$":""}`,(e=s.flags)!==null&&e!==void 0?e:s.ignoreCase?"i":"")}function s0(s,t,e,i){let{main:n}=s.selection,r=e-n.from,o=i-n.from;return{...s.changeByRange(a=>{if(a!=n&&e!=i&&s.sliceDoc(a.from+r,a.from+o)!=s.sliceDoc(e,i))return{range:a};let l=s.toText(t);return{changes:{from:a.from+r,to:i==n.from?a.to:a.from+o,insert:l},range:Q.cursor(a.from+r+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}function aE(s){if(!Array.isArray(s))return s;let t=n0.get(s);return t||n0.set(s,t=_h(s)),t}function r0(s,t){return s?t?s+" "+t:s:t}function lE(s,t,e,i,n,r){let o=s.textDirection==J.RTL,a=o,l=!1,h="top",c,u,d=t.left-n.left,f=n.right-t.right,p=i.right-i.left,m=i.bottom-i.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))c=Math.max(n.top,Math.min(e.top,n.bottom-m))-t.top,u=Math.min(400,a?d:f);else{l=!0,u=Math.min(400,(o?t.right:n.right-t.left)-30);let y=n.bottom-t.bottom;y>=m||y>t.top?c=e.bottom-t.top:(h="bottom",c=t.bottom-e.top)}let O=(t.bottom-t.top)/r.offsetHeight,g=(t.right-t.left)/r.offsetWidth;return{style:`${h}: ${c/O}px; max-width: ${u/g}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function hE(s){let t=s.addToOptions.slice();return s.icons&&t.push({render(e){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),e.type&&i.classList.add(...e.type.split(/\s+/g).map(n=>"cm-completionIcon-"+n)),i.setAttribute("aria-hidden","true"),i},position:20}),t.push({render(e,i,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let a=e.displayLabel||e.label,l=0;for(let h=0;h<r.length;){let c=r[h++],u=r[h++];c>l&&o.appendChild(document.createTextNode(a.slice(l,c)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(c,u))),d.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(e){if(!e.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=e.detail,i},position:80}),t.sort((e,i)=>e.position-i.position).map(e=>e.render)}function ip(s,t,e){if(s<=e)return{from:0,to:s};if(t<0&&(t=0),t<=s>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let i=Math.floor((s-t)/e);return{from:s-(i+1)*e,to:s-i*e}}function cE(s,t){return e=>new sp(e,s,t)}function uE(s,t){let e=s.getBoundingClientRect(),i=t.getBoundingClientRect(),n=e.height/s.offsetHeight;i.top<e.top?s.scrollTop-=(e.top-i.top)/n:i.bottom>e.bottom&&(s.scrollTop+=(i.bottom-e.bottom)/n)}function o0(s){return(s.boost||0)*100+(s.apply?10:0)+(s.info?5:0)+(s.type?1:0)}function dE(s,t){let e=[],i=null,n=null,r=c=>{e.push(c);let{section:u}=c.completion;if(u){i||(i=[]);let d=typeof u=="string"?u:u.name;i.some(f=>f.name==d)||i.push(typeof u=="string"?{name:d}:u)}},o=t.facet(Qt);for(let c of s)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)r(new Zh(d,c.source,u?u(d):[],1e9-e.length));else{let d=t.sliceDoc(c.from,c.to),f,p=o.filterStrict?new ep(d):new tp(d);for(let m of c.result.options)if(f=p.match(m.label)){let O=m.displayLabel?u?u(m,f.matched):[]:f.matched,g=f.score+(m.boost||0);if(r(new Zh(m,c.source,O,g)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:y}=m.section;n||(n=Object.create(null)),n[y]=Math.max(g,n[y]||-1e9)}}}}if(i){let c=Object.create(null),u=0,d=(f,p)=>(f.rank==="dynamic"&&p.rank==="dynamic"?n[p.name]-n[f.name]:0)||(typeof f.rank=="number"?f.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(f.name<p.name?-1:1);for(let f of i.sort(d))u-=1e5,c[f.name]=u;for(let f of e){let{section:p}=f.completion;p&&(f.score+=c[typeof p=="string"?p:p.name])}}let a=[],l=null,h=o.compareCompletions;for(let c of e.sort((u,d)=>d.score-u.score||h(u.completion,d.completion))){let u=c.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(c):o0(c.completion)>o0(l)&&(a[a.length-1]=c),l=c.completion}return a}function fE(s,t){if(s==t)return!0;for(let e=0,i=0;;){for(;e<s.length&&!s[e].hasResult();)e++;for(;i<t.length&&!t[i].hasResult();)i++;let n=e==s.length,r=i==t.length;if(n||r)return n==r;if(s[e++].result!=t[i++].result)return!1}}function a0(s,t){let e={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":s};return t>-1&&(e["aria-activedescendant"]=s+"-"+t),e}function l0(s,t){if(s.isUserEvent("input.complete")){let i=s.annotation(Dh);if(i&&t.activateOnCompletion(i))return 12}let e=s.isUserEvent("input.type");return e&&t.activateOnTyping?5:e?1:s.isUserEvent("delete.backward")?2:s.selection?8:s.docChanged?16:0}function OE(s,t,e,i){if(!s)return!1;let n=t.sliceDoc(e,i);return typeof s=="function"?s(n,e,i,t):i0(s,!0).test(n)}function ap(s,t){let e=t.completion.apply||t.completion.label,i=s.state.field(Pt).active.find(n=>n.source==t.source);return i instanceof zh?(typeof e=="string"?s.dispatch({...s0(s.state,e,i.from,i.to),annotations:Dh.of(t.completion)}):e(s,t.completion,i.from,i.to),!0):!1}function Aa(s,t="option"){return e=>{let i=e.state.field(Pt,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<e.state.facet(Qt).interactionDelay)return!1;let n=1,r;t=="page"&&(r=xh(e,i.open.tooltip))&&(n=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,a=i.open.selected>-1?i.open.selected+n*(s?1:-1):s?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),e.dispatch({effects:Bh.of(a)}),!0}}function dp(s,t){return Q.create(s.filter(e=>e.field==t).map(e=>Q.range(e.from,e.to)))}function d0(s){let t=up.parse(s);return(e,i,n,r)=>{let{text:o,ranges:a}=t.instantiate(e.state,n),{main:l}=e.state.selection,h={changes:{from:n,to:r==l.from?l.to:r,insert:G.of(o)},scrollIntoView:!0,annotations:i?[Dh.of(i),dt.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=dp(a,0)),a.some(c=>c.field>0)){let c=new Pr(a,0),u=h.effects=[Qa.of(c)];e.state.field(Qs,!1)===void 0&&u.push(j.appendConfig.of([Qs,EE,TE,u0]))}e.dispatch(e.state.update(h))}}function f0(s){return({state:t,dispatch:e})=>{let i=t.field(Qs,!1);if(!i||s<0&&i.active==0)return!1;let n=i.active+s,r=s>0&&!i.ranges.some(o=>o.field==n+s);return e(t.update({selection:dp(i.ranges,n),effects:Qa.of(r?null:new Pr(i.ranges,n)),scrollIntoView:!0})),!0}}function QE(s){let t=s.field(Qs,!1);return!!(t&&t.ranges.some(e=>e.field==t.active+1))}function PE(s){let t=s.field(Qs,!1);return!!(t&&t.active>0)}function Zt(s,t){return{...t,apply:d0(s)}}function LE(s){let t=s.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${t}]+`,"ug")}catch{return new RegExp(`[w${t}]`,"g")}}function O0(s,t){return new RegExp(t(s.source),s.unicode?"u":"")}function ME(s){return b0[s]||(b0[s]=new WeakMap)}function y0(s,t,e,i,n){for(let r=s.iterLines(),o=0;!r.next().done;){let{value:a}=r,l;for(t.lastIndex=0;l=t.exec(a);)if(!i[l[0]]&&o+l.index!=n&&(e.push({type:"text",label:l[0]}),i[l[0]]=!0,e.length>=2e3))return;o+=a.length+1}}function v0(s,t,e,i,n){let r=s.length>=1e3,o=r&&t.get(s);if(o)return o;let a=[],l=Object.create(null);if(s.children){let h=0;for(let c of s.children){if(c.length>=1e3)for(let u of v0(c,t,e,i-h,n-h))l[u.label]||(l[u.label]=!0,a.push(u));else y0(c,e,a,l,n-h);h+=c.length+1}}else y0(s,e,a,l,n);return r&&a.length<2e3&&t.set(s,a),a}function XE(){return[ZE,x0]}function S0(s){for(let t=0;t<mp.length;t+=2)if(mp.charCodeAt(t)==s)return mp.charAt(t+1);return Rl(s<128?s:s+1)}function w0(s,t){return s.languageDataAt("closeBrackets",t)[0]||Pa}function $0(s,t){let e=w0(s,s.selection.main.head),i=e.brackets||Pa.brackets;for(let n of i){let r=S0(Xt(n,0));if(t==n)return r==n?jE(s,n,i.indexOf(n+n+n)>-1,e):BE(s,n,r,e.before||Pa.before);if(t==r&&A0(s,s.selection.main.from))return zE(s,n,r)}return null}function A0(s,t){let e=!1;return s.field(x0).between(0,s.doc.length,i=>{i==t&&(e=!0)}),e}function Nh(s,t){let e=s.sliceString(t,t+2);return e.slice(0,we(Xt(e,0)))}function qE(s,t){let e=s.sliceString(t-2,t);return we(Xt(e,0))==e.length?e:e.slice(1)}function BE(s,t,e,i){let n=null,r=s.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Ps.of(o.to+t.length),range:Q.range(o.anchor+t.length,o.head+t.length)};let a=Nh(s.doc,o.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:t+e,from:o.head},effects:Ps.of(o.head+t.length),range:Q.cursor(o.head+t.length)}:{range:n=o}});return n?null:s.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function zE(s,t,e){let i=null,n=s.changeByRange(r=>r.empty&&Nh(s.doc,r.head)==e?{changes:{from:r.head,to:r.head+e.length,insert:e},range:Q.cursor(r.head+e.length)}:i={range:r});return i?null:s.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function jE(s,t,e,i){let n=i.stringPrefixes||Pa.stringPrefixes,r=null,o=s.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Ps.of(a.to+t.length),range:Q.range(a.anchor+t.length,a.head+t.length)};let l=a.head,h=Nh(s.doc,l),c;if(h==t){if(Q0(s,l))return{changes:{insert:t+t,from:l},effects:Ps.of(l+t.length),range:Q.cursor(l+t.length)};if(A0(s,l)){let d=e&&s.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+d.length,insert:d},range:Q.cursor(l+d.length)}}}else{if(e&&s.sliceDoc(l-2*t.length,l)==t+t&&(c=P0(s,l-2*t.length,n))>-1&&Q0(s,c))return{changes:{insert:t+t+t+t,from:l},effects:Ps.of(l+t.length),range:Q.cursor(l+t.length)};if(s.charCategorizer(l)(h)!=lt.Word&&P0(s,l,n)>-1&&!NE(s,l,t,n))return{changes:{insert:t+t,from:l},effects:Ps.of(l+t.length),range:Q.cursor(l+t.length)}}return{range:r=a}});return r?null:s.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Q0(s,t){let e=F(s).resolveInner(t+1);return e.parent&&e.from==t}function NE(s,t,e,i){let n=F(s).resolveInner(t,-1),r=i.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=s.sliceDoc(n.from,Math.min(n.to,n.from+e.length+r)),l=a.indexOf(e);if(!l||l>-1&&i.indexOf(a.slice(0,l))>-1){let c=n.firstChild;for(;c&&c.from==n.from&&c.to-c.from>e.length+l;){if(s.sliceDoc(c.to-e.length,c.to)==e)return!1;c=c.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function P0(s,t,e){let i=s.charCategorizer(t);if(i(s.sliceDoc(t-1,t))!=lt.Word)return t;for(let n of e){let r=t-n.length;if(s.sliceDoc(r,t)==n&&i(s.sliceDoc(r-1,r))!=lt.Word)return r}return-1}function _E(s={}){return[wE,Pt,Qt.of(s),xE,VE,u0]}function WE(s){let t=s.field(Pt,!1);return t&&t.active.some(e=>e.isPending)?"pending":t&&t.active.some(e=>e.state!=0)?"active":null}function YE(s){var t;let e=(t=s.field(Pt,!1))===null||t===void 0?void 0:t.open;if(!e||e.disabled)return[];let i=E0.get(e.options);return i||E0.set(e.options,i=e.options.map(n=>n.completion)),i}function UE(s){var t;let e=(t=s.field(Pt,!1))===null||t===void 0?void 0:t.open;return e&&!e.disabled&&e.selected>=0?e.options[e.selected].completion:null}function FE(s){var t;let e=(t=s.field(Pt,!1))===null||t===void 0?void 0:t.open;return e&&!e.disabled&&e.selected>=0?e.selected:null}function GE(s){return Bh.of(s)}var Cs,Zh,Dh,n0,qh,$a,tp,ep,Qt,Bh,sp,np,rp,pE,mE,gE,Si,zh,op,Pt,bE,h0,jh,c0,lp,yE,vE,xE,SE,wE,u0,hp,cp,up,kE,$E,Pr,Qa,AE,Qs,p0,m0,g0,CE,fp,EE,TE,b0,RE,Pa,Ps,pp,x0,mp,IE,ZE,k0,DE,C0,VE,E0,Op=W(()=>{Ue();fi();ti();Cs=class{constructor(t,e,i,n){this.state=t,this.pos=e,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=F(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),r=n.search(i0(t,!1));return r<0?null:{from:i+r,to:this.pos,text:n.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(t,e,i){t=="abort"&&this.abortListeners&&(this.abortListeners.push(e),i&&i.onDocChange&&(this.abortOnDocChange=!0))}};Zh=class{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}};Dh=_t.define();n0=new WeakMap;qh=j.define(),$a=j.define(),tp=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e<t.length;){let i=Xt(t,e),n=we(i);this.chars.push(i);let r=t.slice(e,e+n),o=r.toUpperCase();this.folded.push(Xt(o==r?r.toLowerCase():o,0)),e+=n}this.astral=t.length!=this.chars.length}ret(t,e){return this.score=t,this.matched=e,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:e,folded:i,any:n,precise:r,byWord:o}=this;if(e.length==1){let y=Xt(t,0),v=we(y),x=v==t.length?0:-100;if(y!=e[0])if(y==i[0])x+=-200;else return null;return this.ret(x,[0,v])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=e.length,h=0;if(a<0){for(let y=0,v=Math.min(t.length,200);y<v&&h<l;){let x=Xt(t,y);(x==e[h]||x==i[h])&&(n[h++]=y),y+=we(x)}if(h<l)return null}let c=0,u=0,d=!1,f=0,p=-1,m=-1,O=/[a-z]/.test(t),g=!0;for(let y=0,v=Math.min(t.length,200),x=0;y<v&&u<l;){let S=Xt(t,y);a<0&&(c<l&&S==e[c]&&(r[c++]=y),f<l&&(S==e[f]||S==i[f]?(f==0&&(p=y),m=y+1,f++):f=0));let $,k=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:($=Rl(S))!=$.toLowerCase()?1:$!=$.toUpperCase()?2:0;(!y||k==1&&O||x==0&&k!=0)&&(e[u]==S||i[u]==S&&(d=!0)?o[u++]=y:o.length&&(g=!1)),x=k,y+=we(S)}return u==l&&o[0]==0&&g?this.result(-100+(d?-200:0),o,t):f==l&&p==0?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):f==l?this.ret(-900-t.length,[p,m]):u==l?this.result(-100+(d?-200:0)+-700+(g?0:-1100),o,t):e.length==2?null:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,i){let n=[],r=0;for(let o of e){let a=o+(this.astral?we(Xt(i,o)):1);r&&n[r-1]==o?n[r-1]=a:(n[r++]=o,n[r++]=a)}return this.ret(t-i.length,n)}},ep=class{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let e=t.slice(0,this.pattern.length),i=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,e.length],this.score=i+(t.length==this.pattern.length?0:-100),this)}},Qt=R.define({combine(s){return Vt(s,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:lE,filterStrict:!1,compareCompletions:(t,e)=>(t.sortText||t.label).localeCompare(e.sortText||e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>r0(t(i),e(i)),optionClass:(t,e)=>i=>r0(t(i),e(i)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})}});Bh=j.define();sp=class{constructor(t,e,i){this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let n=t.state.field(e),{options:r,selected:o}=n.open,a=t.state.facet(Qt);this.optionContent=hE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=ip(r.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:h}=t.state.field(e).open;for(let c=l.target,u;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(u=/-(\d+)$/.exec(c.id))&&+u[1]<h.length){this.applyCompletion(t,h[+u[1]]),l.preventDefault();return}if(l.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(t.dispatch({effects:Bh.of(c)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(Qt).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:$a.of(null)})}),this.showOptions(r,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let i=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=n){let{options:r,selected:o,disabled:a}=i.open;(!n.open||n.open.options!=r)&&(this.range=ip(r.length,o,t.state.facet(Qt).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),a!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of e.split(" "))i&&this.dom.classList.add(i);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;(e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=ip(e.options.length,e.selected,this.view.state.facet(Qt).maxRenderedOptions),this.showOptions(e.options,t.id));let i=this.updateSelectedOption(e.selected);if(i){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:r}=n;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(n);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,n)}).catch(a=>St(this.view.state,a,"completion info")):(this.addInfoPane(o,n),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,e){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)i.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:r}=t;i.appendChild(n),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)i.nodeName!="LI"||!i.id?n--:n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return e&&uE(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return n.top>Math.min(r.bottom,e.bottom)-10||n.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(Qt).positionInfo(this.view,e,n,i,r,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,e,i){let n=document.createElement("ul");n.id=e,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions")),n.addEventListener("mousedown",o=>{o.target==n&&o.preventDefault()});let r=null;for(let o=i.from;o<i.to;o++){let{completion:a,match:l}=t[o],{section:h}=a;if(h){let d=typeof h=="string"?h:h.name;if(d!=r&&(o>i.from||i.from==0))if(r=d,typeof h!="string"&&h.header)n.appendChild(h.header(h));else{let f=n.appendChild(document.createElement("completion-section"));f.textContent=d}}let c=n.appendChild(document.createElement("li"));c.id=e+"-"+o,c.setAttribute("role","option");let u=this.optionClass(a);u&&(c.className=u);for(let d of this.optionContent){let f=d(a,this.view.state,this.view,l);f&&c.appendChild(f)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}};np=class s{constructor(t,e,i,n,r,o){this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=n,this.selected=r,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new s(this.options,a0(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,r,o){if(n&&!o&&t.some(h=>h.isPending))return n.setDisabled();let a=dE(t,e);if(!a.length)return n&&t.some(h=>h.isPending)?n.setDisabled():null;let l=e.facet(Qt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let h=n.options[n.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){l=c;break}}return new s(a,a0(i,l),{pos:t.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:bE,above:r.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new s(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new s(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},rp=class s{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new s(gE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,i=e.facet(Qt),r=(i.override||e.languageDataAt("autocomplete",As(e)).map(aE)).map(l=>(this.active.find(c=>c.source==l)||new Si(l,this.active.some(c=>c.state!=0)?1:0)).update(t,i));r.length==this.active.length&&r.every((l,h)=>l==this.active[h])&&(r=this.active);let o=this.open,a=t.effects.some(l=>l.is(op));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||r.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!fE(r,this.active)||a?o=np.build(r,e,this.id,o,i,a):o&&o.disabled&&!r.some(l=>l.isPending)&&(o=null),!o&&r.every(l=>!l.isPending)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new Si(l.source,0):l));for(let l of t.effects)l.is(Bh)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new s(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?pE:mE}};pE={"aria-autocomplete":"list"},mE={};gE=[];Si=class s{constructor(t,e,i=!1){this.source=t,this.state=e,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(t,e){let i=l0(t,e),n=this;(i&8||i&16&&this.touches(t))&&(n=new s(n.source,0)),i&4&&n.state==0&&(n=new s(this.source,1)),n=n.updateFor(t,i);for(let r of t.effects)if(r.is(qh))n=new s(n.source,1,r.value);else if(r.is($a))n=new s(n.source,0);else if(r.is(op))for(let o of r.value)o.source==n.source&&(n=o);return n}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(As(t.state))}},zh=class s extends Si{constructor(t,e,i,n,r,o){super(t,3,e),this.limit=i,this.result=n,this.from=r,this.to=o}hasResult(){return!0}updateFor(t,e){var i;if(!(e&3))return this.map(t.changes);let n=this.result;n.map&&!t.changes.empty&&(n=n.map(n,t.changes));let r=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=As(t.state);if(a>o||!n||e&2&&(As(t.startState)==this.from||a<this.limit))return new Si(this.source,e&4?1:0);let l=t.changes.mapPos(this.limit);return OE(n.validFor,t.state,r,o)?new s(this.source,this.explicit,l,n,r,o):n.update&&(n=n.update(n,r,o,new Cs(t.state,a,!1)))?new s(this.source,this.explicit,l,n,n.from,(i=n.to)!==null&&i!==void 0?i:As(t.state)):new Si(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new s(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Si(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}};op=j.define({map(s,t){return s.map(e=>e.map(t))}}),Pt=ht.define({create(){return rp.start()},update(s,t){return s.update(t)},provide:s=>[Ss.from(s,t=>t.tooltip),L.contentAttributes.from(s,t=>t.attrs)]});bE=cE(Pt,ap);h0=s=>{let t=s.state.field(Pt,!1);return s.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<s.state.facet(Qt).interactionDelay?!1:ap(s,t.open.options[t.open.selected])},jh=s=>s.state.field(Pt,!1)?(s.dispatch({effects:qh.of(!0)}),!0):!1,c0=s=>{let t=s.state.field(Pt,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(s.dispatch({effects:$a.of(null)}),!0)},lp=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},yE=50,vE=1e3,xE=nt.fromClass(class{constructor(s){this.view=s,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of s.state.field(Pt).active)t.isPending&&this.startQuery(t)}update(s){let t=s.state.field(Pt),e=s.state.facet(Qt);if(!s.selectionSet&&!s.docChanged&&s.startState.field(Pt)==t)return;let i=s.transactions.some(r=>{let o=l0(r,e);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;r<this.running.length;r++){let o=this.running[r];if(i||o.context.abortOnDocChange&&s.docChanged||o.updates.length+s.transactions.length>yE&&Date.now()-o.time>vE){for(let a of o.context.abortListeners)try{a()}catch(l){St(this.view.state,l)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...s.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),s.transactions.some(r=>r.effects.some(o=>o.is(qh)))&&(this.pendingStart=!0);let n=this.pendingStart?50:e.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let r of s.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:s}=this.view,t=s.field(Pt);for(let e of t.active)e.isPending&&!this.running.some(i=>i.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}startQuery(s){let{state:t}=this.view,e=As(t),i=new Cs(t,e,s.explicit,this.view),n=new lp(s,i);this.running.push(n),Promise.resolve(s.source(i)).then(r=>{n.context.aborted||(n.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:$a.of(null)}),St(this.view.state,r)})}scheduleAccept(){this.running.every(s=>s.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}accept(){var s;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(Qt),i=this.view.state.field(Pt);for(let n=0;n<this.running.length;n++){let r=this.running[n];if(r.done===void 0)continue;if(this.running.splice(n--,1),r.done){let a=As(r.updates.length?r.updates[0].startState:this.view.state),l=Math.min(a,r.done.from+(r.active.explicit?0:1)),h=new zh(r.active.source,r.active.explicit,l,r.done,r.done.from,(s=r.done.to)!==null&&s!==void 0?s:a);for(let c of r.updates)h=h.update(c,e);if(h.hasResult()){t.push(h);continue}}let o=i.active.find(a=>a.source==r.active.source);if(o&&o.isPending)if(r.done==null){let a=new Si(r.active.source,0);for(let l of r.updates)a=a.update(l,e);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:op.of(t)})}},{eventHandlers:{blur(s){let t=this.view.state.field(Pt,!1);if(t&&t.tooltip&&this.view.state.facet(Qt).closeOnBlur){let e=t.open&&xh(this.view,t.open.tooltip);(!e||!e.dom.contains(s.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:$a.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qh.of(!1)}),20),this.composing=0}}}),SE=typeof navigator=="object"&&/Win/.test(navigator.platform),wE=re.highest(L.domEventHandlers({keydown(s,t){let e=t.state.field(Pt,!1);if(!e||!e.open||e.open.disabled||e.open.selected<0||s.key.length>1||s.ctrlKey&&!(SE&&s.altKey)||s.metaKey)return!1;let i=e.open.options[e.open.selected],n=e.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||n.result.commitCharacters;return r&&r.indexOf(s.key)>-1&&ap(t,i),!1}})),u0=L.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\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"}}}),hp=class{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}},cp=class s{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,gt.TrackDel),i=t.mapPos(this.to,1,gt.TrackDel);return e==null||i==null?null:new s(this.field,e,i)}},up=class s{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],r=t.doc.lineAt(e),o=/^\s*/.exec(r.text)[0];for(let l of this.lines){if(i.length){let h=o,c=/^\t*/.exec(l)[0].length;for(let u=0;u<c;u++)h+=t.facet(yi);n.push(e+h.length-c),l=h+l.slice(c)}i.push(l),e+=l.length+1}let a=this.fieldPositions.map(l=>new cp(l.field,n[l.line]+l.from,n[l.line]+l.to));return{text:i,ranges:a}}static parse(t){let e=[],i=[],n=[],r;for(let o of t.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=r[1]?+r[1]:null,l=r[2]||r[3]||"",h=-1,c=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u<e.length;u++)(a!=null?e[u].seq==a:c&&e[u].name==c)&&(h=u);if(h<0){let u=0;for(;u<e.length&&(a==null||e[u].seq!=null&&e[u].seq<a);)u++;e.splice(u,0,{seq:a,name:c}),h=u;for(let d of n)d.field>=h&&d.field++}for(let u of n)if(u.line==i.length&&u.from>r.index){let d=r[2]?3+(r[1]||"").length:2;u.from-=d,u.to-=d}n.push(new hp(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+l+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(a,l,h)=>{for(let c of n)c.line==i.length&&c.from>h&&(c.from--,c.to--);return l}),i.push(o)}return new s(i,n)}},kE=B.widget({widget:new class extends Ct{toDOM(){let s=document.createElement("span");return s.className="cm-snippetFieldPosition",s}ignoreEvent(){return!1}}}),$E=B.mark({class:"cm-snippetField"}),Pr=class s{constructor(t,e){this.ranges=t,this.active=e,this.deco=B.set(t.map(i=>(i.from==i.to?kE:$E).range(i.from,i.to)),!0)}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new s(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(i=>i.field==this.active&&i.from<=e.from&&i.to>=e.to))}},Qa=j.define({map(s,t){return s&&s.map(t)}}),AE=j.define(),Qs=ht.define({create(){return null},update(s,t){for(let e of t.effects){if(e.is(Qa))return e.value;if(e.is(AE)&&s)return new Pr(s.ranges,e.value)}return s&&t.docChanged&&(s=s.map(t.changes)),s&&t.selection&&!s.selectionInsideField(t.selection)&&(s=null),s},provide:s=>L.decorations.from(s,t=>t?t.deco:B.none)});p0=({state:s,dispatch:t})=>s.field(Qs,!1)?(t(s.update({effects:Qa.of(null)})),!0):!1,m0=f0(1),g0=f0(-1);CE=[{key:"Tab",run:m0,shift:g0},{key:"Escape",run:p0}],fp=R.define({combine(s){return s.length?s[0]:CE}}),EE=re.highest(He.compute([fp],s=>s.facet(fp)));TE=L.domEventHandlers({mousedown(s,t){let e=t.state.field(Qs,!1),i;if(!e||(i=t.posAtCoords({x:s.clientX,y:s.clientY}))==null)return!1;let n=e.ranges.find(r=>r.from<=i&&r.to>=i);return!n||n.field==e.active?!1:(t.dispatch({selection:dp(e.ranges,n.field),effects:Qa.of(e.ranges.some(r=>r.field>n.field)?new Pr(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});b0=Object.create(null);RE=s=>{var t;let e=(t=s.state.languageDataAt("wordChars",s.pos)[0])!==null&&t!==void 0?t:"",i=LE(e),n=s.matchBefore(O0(i,a=>a+"$"));if(!n&&!s.explicit)return null;let r=n?n.from:s.pos,o=v0(s.state.doc,ME(e),i,5e4,r);return{from:r,options:o,validFor:O0(i,a=>"^"+a)}},Pa={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ps=j.define({map(s,t){let e=t.mapPos(s,-1,gt.TrackAfter);return e??void 0}}),pp=new class extends be{};pp.startSide=1,pp.endSide=-1;x0=ht.define({create(){return U.empty},update(s,t){if(s=s.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);s=s.update({filter:i=>i>=e.from&&i<=e.to})}for(let e of t.effects)e.is(Ps)&&(s=s.update({add:[pp.range(e.value,e.value+1)]}));return s}});mp="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";IE=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ZE=L.inputHandler.of((s,t,e,i)=>{if((IE?s.composing:s.compositionStarted)||s.state.readOnly)return!1;let n=s.state.selection.main;if(i.length>2||i.length==2&&we(Xt(i,0))==1||t!=n.from||e!=n.to)return!1;let r=$0(s.state,i);return r?(s.dispatch(r),!0):!1}),k0=({state:s,dispatch:t})=>{if(s.readOnly)return!1;let i=w0(s,s.selection.main.head).brackets||Pa.brackets,n=null,r=s.changeByRange(o=>{if(o.empty){let a=qE(s.doc,o.head);for(let l of i)if(l==a&&Nh(s.doc,o.head)==S0(Xt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Q.cursor(o.head-l.length)}}return{range:n=o}});return n||t(s.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!n},DE=[{key:"Backspace",run:k0}];C0=[{key:"Ctrl-Space",run:jh},{mac:"Alt-`",run:jh},{mac:"Alt-i",run:jh},{key:"Escape",run:c0},{key:"ArrowDown",run:Aa(!0)},{key:"ArrowUp",run:Aa(!1)},{key:"PageDown",run:Aa(!0,"page")},{key:"PageUp",run:Aa(!1,"page")},{key:"Enter",run:h0}],VE=re.highest(He.computeN([Qt],s=>s.facet(Qt).defaultKeymap?[C0]:[]));E0=new WeakMap});var z0={};Ht(z0,{autoCloseTags:()=>wp,completionPath:()=>Sp,esLint:()=>B0,javascript:()=>Yh,javascriptLanguage:()=>ce,jsxLanguage:()=>Ta,localCompletionSource:()=>xp,scopeCompletionSource:()=>q0,snippets:()=>Wh,tsxLanguage:()=>La,typescriptLanguage:()=>Ea,typescriptSnippets:()=>vp});function Ca(s){return(t,e)=>{let i=t.node.getChild("VariableDefinition");return i&&e(i,s),!0}}function M0(s,t){let e=T0.get(t);if(e)return e;let i=[],n=!0;function r(o,a){let l=s.sliceString(o.from,o.to);i.push({label:l,type:a})}return t.cursor(H.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let a=KE[o.name];if(a&&a(o,r)||L0.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of M0(s,o.node))i.push(a);return!1}}),T0.set(t,i),i}function xp(s){let t=F(s.state).resolveInner(s.pos,-1);if(bp.indexOf(t.name)>-1)return null;let e=t.name=="VariableName"||t.to-t.from<20&&Vh.test(s.state.sliceDoc(t.from,t.to));if(!e&&!s.explicit)return null;let i=[];for(let n=t;n;n=n.parent)L0.has(n.name)&&(i=i.concat(M0(s.state.doc,n)));return{options:i,from:e?t.from:s.pos,validFor:Vh}}function yp(s,t,e){var i;let n=[];for(;;){let r=t.firstChild,o;if(r?.name=="VariableName")return n.push(s(r)),{path:n.reverse(),name:e};if(r?.name=="MemberExpression"&&((i=o=r.lastChild)===null||i===void 0?void 0:i.name)=="PropertyName")n.push(s(o)),t=r;else return null}}function Sp(s){let t=i=>s.state.doc.sliceString(i.from,i.to),e=F(s.state).resolveInner(s.pos,-1);return e.name=="PropertyName"?yp(t,e.parent,t(e)):(e.name=="."||e.name=="?.")&&e.parent.name=="MemberExpression"?yp(t,e.parent,""):bp.indexOf(e.name)>-1?null:e.name=="VariableName"||e.to-e.from<20&&Vh.test(t(e))?{path:[],name:t(e)}:e.name=="MemberExpression"?yp(t,e,""):s.explicit?{path:[],name:""}:null}function JE(s,t){let e=s,i=[],n=new Set;for(let r=0;;r++){for(let a of(Object.getOwnPropertyNames||Object.keys)(s)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(a)||n.has(a))continue;n.add(a);let l;try{l=e[a]}catch{continue}i.push({label:a,type:typeof l=="function"?/^[A-Z]/.test(a)?"class":t?"function":"method":t?"variable":"property",boost:-r})}let o=Object.getPrototypeOf(s);if(!o)return i;s=o}}function q0(s){let t=new Map;return e=>{let i=Sp(e);if(!i)return null;let n=s;for(let o of i.path)if(n=n[o],!n)return null;let r=t.get(n);return r||t.set(n,r=JE(n,!i.path.length)),{from:e.pos-i.name.length,options:r,validFor:Vh}}}function Yh(s={}){let t=s.jsx?s.typescript?La:Ta:s.typescript?Ea:ce,e=s.typescript?vp.concat(tT):Wh.concat(I0);return new ft(t,[ce.data.of({autocomplete:gp(bp,_h(e))}),ce.data.of({autocomplete:xp}),s.jsx?wp:[]])}function eT(s){for(;;){if(s.name=="JSXOpenTag"||s.name=="JSXSelfClosingTag"||s.name=="JSXFragmentTag")return s;if(s.name=="JSXEscape"||!s.parent)return null;s=s.parent}}function Z0(s,t,e=s.length){for(let i=t?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return s.sliceString(i.from,Math.min(i.to,e));return""}function B0(s,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},s.getRules().forEach((e,i)=>{var n;!((n=e.meta.docs)===null||n===void 0)&&n.recommended&&(t.rules[i]=2)})),e=>{let{state:i}=e,n=[];for(let{from:r,to:o}of ce.findRegions(i)){let a=i.doc.lineAt(r),l={line:a.number-1,col:r-a.from,pos:r};for(let h of s.verify(i.sliceDoc(r,o),t))n.push(sT(h,i.doc,l))}return n}}function D0(s,t,e,i){return e.line(s+i.line).from+t+(s==1?i.col-1:-1)}function sT(s,t,e){let i=D0(s.line,s.column,t,e),n={from:i,to:s.endLine!=null&&s.endColumn!=1?D0(s.endLine,s.endColumn,t,e):i,message:s.message,source:s.ruleId?"eslint:"+s.ruleId:"eslint",severity:s.severity==1?"warning":"error"};if(s.fix){let{range:r,text:o}=s.fix,a=r[0]+e.pos-i,l=r[1]+e.pos-i;n.actions=[{name:"fix",apply(h,c){h.dispatch({changes:{from:c+a,to:c+l,insert:o},scrollIntoView:!0})}}]}return n}var Wh,vp,T0,L0,HE,KE,Vh,bp,ce,R0,Ea,Ta,La,X0,I0,tT,iT,wp,kp=W(()=>{t0();ti();Ue();fi();Op();Ie();Wh=[Zt("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Zt("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Zt("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Zt("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Zt("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Zt(`try {
15
+ \${}
16
+ } catch (\${error}) {
17
+ \${}
18
+ }`,{label:"try",detail:"/ catch block",type:"keyword"}),Zt("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Zt(`if (\${}) {
19
+ \${}
20
+ } else {
21
+ \${}
22
+ }`,{label:"if",detail:"/ else block",type:"keyword"}),Zt(`class \${name} {
23
+ constructor(\${params}) {
24
+ \${}
25
+ }
26
+ }`,{label:"class",detail:"definition",type:"keyword"}),Zt('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Zt('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],vp=Wh.concat([Zt("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Zt("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Zt("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),T0=new rs,L0=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);HE=["FunctionDeclaration"],KE={FunctionDeclaration:Ca("function"),ClassDeclaration:Ca("class"),ClassExpression:()=>!0,EnumDeclaration:Ca("constant"),TypeAliasDeclaration:Ca("type"),NamespaceDeclaration:Ca("namespace"),VariableDefinition(s,t){s.matchContext(HE)||t(s,"variable")},TypeDefinition(s,t){t(s,"type")},__proto__:null};Vh=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,bp=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];ce=he.define({name:"javascript",parser:Jf.configure({props:[Ut.add({IfStatement:Je({except:/^\s*({|else\b)/}),TryStatement:Je({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Mf,SwitchBody:s=>{let t=s.textAfter,e=/^\s*\}/.test(t),i=/^\s*(case|default)\b/.test(t);return s.baseIndent+(e?0:i?1:2)*s.unit},Block:Qr({closing:"}"}),ArrowFunction:s=>s.baseIndent+s.unit,"TemplateString BlockComment":()=>null,"Statement Property":Je({except:/^\s*{/}),JSXElement(s){let t=/^\s*<\//.test(s.textAfter);return s.lineIndent(s.node.from)+(t?0:s.unit)},JSXEscape(s){let t=/\s*\}/.test(s.textAfter);return s.lineIndent(s.node.from)+(t?0:s.unit)},"JSXOpenTag JSXSelfClosingTag"(s){return s.column(s.node.from)+s.unit}}),Ft.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":vi,BlockComment(s){return{from:s.from+2,to:s.to-2}},JSXElement(s){let t=s.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let e=s.lastChild;return{from:t.to,to:e.type.isError?s.to:e.from}},"JSXSelfClosingTag JSXOpenTag"(s){var t;let e=(t=s.firstChild)===null||t===void 0?void 0:t.nextSibling,i=s.lastChild;return!e||e.type.isError?null:{from:e.to,to:i.type.isError?s.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),R0={test:s=>/^JSX/.test(s.name),facet:ks({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Ea=ce.configure({dialect:"ts"},"typescript"),Ta=ce.configure({dialect:"jsx",props:[wa.add(s=>s.isTop?[R0]:void 0)]}),La=ce.configure({dialect:"jsx ts",props:[wa.add(s=>s.isTop?[R0]:void 0)]},"typescript"),X0=s=>({label:s,type:"keyword"}),I0="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(X0),tT=I0.concat(["declare","implements","private","protected","public"].map(X0));iT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),wp=L.inputHandler.of((s,t,e,i,n)=>{if((iT?s.composing:s.compositionStarted)||s.state.readOnly||t!=e||i!=">"&&i!="/"||!ce.isActiveAt(s.state,t,-1))return!1;let r=n(),{state:o}=r,a=o.changeByRange(l=>{var h;let{head:c}=l,u=F(o).resolveInner(c-1,-1),d;if(u.name=="JSXStartTag"&&(u=u.parent),!(o.doc.sliceString(c-1,c)!=i||u.name=="JSXAttributeValue"&&u.to>c)){if(i==">"&&u.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:"</>"}};if(i=="/"&&u.name=="JSXStartCloseTag"){let f=u.parent,p=f.parent;if(p&&f.from==c-2&&((d=Z0(o.doc,p.firstChild,c))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=`${d}>`;return{range:Q.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(i==">"){let f=eT(u);if(f&&f.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(d=Z0(o.doc,f,c)))return{range:l,changes:{from:c,insert:`</${d}>`}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch([r,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})});var J0={};Ht(J0,{autoCloseTags:()=>Ep,html:()=>Fh,htmlCompletionSource:()=>Uh,htmlCompletionSourceWith:()=>Cp,htmlLanguage:()=>Tr});function Cr(s,t,e=s.length){if(!t)return"";let i=t.firstChild,n=i&&i.getChild("TagName");return n?s.sliceString(n.from,Math.min(n.to,e)):""}function Er(s,t=!1){for(;s;s=s.parent)if(s.name=="Element")if(t)t=!1;else return s;return null}function _0(s,t,e){let i=e.tags[Cr(s,Er(t))];return i?.children||e.allTags}function Pp(s,t){let e=[];for(let i=Er(t);i&&!i.type.isTop;i=Er(i.parent)){let n=Cr(s,i);if(n&&i.lastChild.name=="CloseTag")break;n&&e.indexOf(n)<0&&(t.name=="EndTag"||t.from>=i.firstChild.to)&&e.push(n)}return e}function W0(s,t,e,i,n){let r=/\s*>/.test(s.sliceDoc(n,n+5))?"":">",o=Er(e,e.name=="StartTag"||e.name=="TagName");return{from:i,to:n,options:_0(s.doc,o,t).map(a=>({label:a,type:"type"})).concat(Pp(s.doc,e).map((a,l)=>({label:"/"+a,apply:"/"+a+r,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Y0(s,t,e,i){let n=/\s*>/.test(s.sliceDoc(i,i+5))?"":">";return{from:e,to:i,options:Pp(s.doc,t).map((r,o)=>({label:r,apply:r+n,type:"type",boost:99-o})),validFor:V0}}function rT(s,t,e,i){let n=[],r=0;for(let o of _0(s.doc,e,t))n.push({label:"<"+o,type:"type"});for(let o of Pp(s.doc,e))n.push({label:"</"+o+">",type:"type",boost:99-r++});return{from:i,to:i,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function oT(s,t,e,i,n){let r=Er(e),o=r?t.tags[Cr(s.doc,r)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(t.globalAttrNames):t.globalAttrNames;return{from:i,to:n,options:l.map(h=>({label:h,type:"property"})),validFor:V0}}function aT(s,t,e,i,n){var r;let o=(r=e.parent)===null||r===void 0?void 0:r.getChild("AttributeName"),a=[],l;if(o){let h=s.sliceDoc(o.from,o.to),c=t.globalAttrs[h];if(!c){let u=Er(e),d=u?t.tags[Cr(s.doc,u)]:null;c=d?.attrs&&d.attrs[h]}if(c){let u=s.sliceDoc(i,n).toLowerCase(),d='"',f='"';/^['"]/.test(u)?(l=u[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",f=s.sliceDoc(n,n+1)==u[0]?"":u[0],u=u.slice(1),i++):l=/^[^\s<>='"]*$/;for(let p of c)a.push({label:p,apply:d+p+f,type:"constant"})}}return{from:i,to:n,options:a,validFor:l}}function U0(s,t){let{state:e,pos:i}=t,n=F(e).resolveInner(i,-1),r=n.resolve(i);for(let o=i,a;r==n&&(a=n.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;r=n=a,o=l.from}return n.name=="TagName"?n.parent&&/CloseTag$/.test(n.parent.name)?Y0(e,n,n.from,i):W0(e,s,n,n.from,i):n.name=="StartTag"||n.name=="IncompleteTag"?W0(e,s,n,i,i):n.name=="StartCloseTag"||n.name=="IncompleteCloseTag"?Y0(e,n,i,i):n.name=="OpenTag"||n.name=="SelfClosingTag"||n.name=="AttributeName"?oT(e,s,n,n.name=="AttributeName"?n.from:i,i):n.name=="Is"||n.name=="AttributeValue"||n.name=="UnquotedAttributeValue"?aT(e,s,n,n.name=="Is"?i:n.from,i):t.explicit&&(r.name=="Element"||r.name=="Text"||r.name=="Document")?rT(e,s,n,i):null}function Uh(s){return U0(Es.default,s)}function Cp(s){let{extraTags:t,extraGlobalAttributes:e}=s,i=e||t?new Es(t,e):Es.default;return n=>U0(i,n)}function Fh(s={}){let t="",e;s.matchClosingTags===!1&&(t="noMatch"),s.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(s.nestedLanguages&&s.nestedLanguages.length||s.nestedAttributes&&s.nestedAttributes.length)&&(e=Rh((s.nestedLanguages||[]).concat(F0),(s.nestedAttributes||[]).concat(G0)));let i=e?H0.configure({wrap:e,dialect:t}):t?Tr.configure({dialect:t}):Tr;return new ft(i,[Tr.data.of({autocomplete:Cp(s)}),s.autoCloseTags!==!1?Ep:[],Yh().support,Ih().support])}var Ma,$p,Ap,Qp,xe,D,nT,j0,N0,Es,V0,lT,F0,G0,H0,Tr,K0,Ep,Tp=W(()=>{qv();Ff();kp();fi();Ue();ti();Ma=["_blank","_self","_top","_parent"],$p=["ascii","utf-8","utf-16","latin1","latin1"],Ap=["get","post","put","delete"],Qp=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],xe=["true","false"],D={},nT={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ma,hreflang:null}},abbr:D,address:D,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:D,aside:D,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:D,base:{attrs:{href:null,target:Ma}},bdi:D,bdo:D,blockquote:{attrs:{cite:null}},body:D,br:D,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Qp,formmethod:Ap,formnovalidate:["novalidate"],formtarget:Ma,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:D,center:D,cite:D,code:D,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:D,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:D,div:D,dl:D,dt:D,em:D,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:D,figure:D,footer:D,form:{attrs:{action:null,name:null,"accept-charset":$p,autocomplete:["on","off"],enctype:Qp,method:Ap,novalidate:["novalidate"],target:Ma}},h1:D,h2:D,h3:D,h4:D,h5:D,h6:D,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:D,hgroup:D,hr:D,html:{attrs:{manifest:null}},i:D,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Qp,formmethod:Ap,formnovalidate:["novalidate"],formtarget:Ma,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:D,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:D,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:D,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:$p,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:D,noscript:D,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:D,param:{attrs:{name:null,value:null}},pre:D,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:D,rt:D,ruby:D,samp:D,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:$p}},section:D,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:D,source:{attrs:{src:null,type:null,media:null}},span:D,strong:D,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:D,summary:D,sup:D,table:D,tbody:D,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:D,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:D,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:D,time:{attrs:{datetime:null}},title:D,tr:D,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:D,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:D},j0={accesskey:null,class:null,contenteditable:xe,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:xe,autocorrect:xe,autocapitalize:xe,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":xe,"aria-autocomplete":["inline","list","both","none"],"aria-busy":xe,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":xe,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":xe,"aria-hidden":xe,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":xe,"aria-multiselectable":xe,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":xe,"aria-relevant":null,"aria-required":xe,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},N0="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(s=>"on"+s);for(let s of N0)j0[s]=null;Es=class{constructor(t,e){this.tags={...nT,...t},this.globalAttrs={...j0,...e},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Es.default=new Es;V0=/^[:\-\.\w\u00b7-\uffff]*$/;lT=ce.parser.configure({top:"SingleExpression"}),F0=[{tag:"script",attrs:s=>s.type=="text/typescript"||s.lang=="ts",parser:Ea.parser},{tag:"script",attrs:s=>s.type=="text/babel"||s.type=="text/jsx",parser:Ta.parser},{tag:"script",attrs:s=>s.type=="text/typescript-jsx",parser:La.parser},{tag:"script",attrs(s){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(s.type)},parser:lT},{tag:"script",attrs(s){return!s.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(s.type)},parser:ce.parser},{tag:"style",attrs(s){return(!s.lang||s.lang=="css")&&(!s.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(s.type))},parser:$s.parser}],G0=[{name:"style",parser:$s.parser.configure({top:"Styles"})}].concat(N0.map(s=>({name:s,parser:ce.parser}))),H0=he.define({name:"html",parser:jf.configure({props:[Ut.add({Element(s){let t=/^(\s*)(<\/)?/.exec(s.textAfter);return s.node.to<=s.pos+t[0].length?s.continue():s.lineIndent(s.node.from)+(t[2]?0:s.unit)},"OpenTag CloseTag SelfClosingTag"(s){return s.column(s.node.from)+s.unit},Document(s){if(s.pos+/\s*/.exec(s.textAfter)[0].length<s.node.to)return s.continue();let t=null,e;for(let i=s.node;;){let n=i.lastChild;if(!n||n.name!="Element"||n.to!=i.to)break;t=i=n}return t&&!((e=t.lastChild)&&(e.name=="CloseTag"||e.name=="SelfClosingTag"))?s.lineIndent(t.from)+s.unit:null}}),Ft.add({Element(s){let t=s.firstChild,e=s.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:e.name=="CloseTag"?e.from:s.to}}}),Eh.add({"OpenTag CloseTag":s=>s.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Tr=H0.configure({wrap:Rh(F0,G0)});K0=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Ep=L.inputHandler.of((s,t,e,i,n)=>{if(s.composing||s.state.readOnly||t!=e||i!=">"&&i!="/"||!Tr.isActiveAt(s.state,t,-1))return!1;let r=n(),{state:o}=r,a=o.changeByRange(l=>{var h,c,u;let d=o.doc.sliceString(l.from-1,l.to)==i,{head:f}=l,p=F(o).resolveInner(f,-1),m;if(d&&i==">"&&p.name=="EndTag"){let O=p.parent;if(((c=(h=O.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(m=Cr(o.doc,O.parent,f))&&!K0.has(m)){let g=f+(o.doc.sliceString(f,f+1)===">"?1:0),y=`</${m}>`;return{range:l,changes:{from:f,to:g,insert:y}}}}else if(d&&i=="/"&&p.name=="IncompleteCloseTag"){let O=p.parent;if(p.from==f-2&&((u=O.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(m=Cr(o.doc,O,f))&&!K0.has(m)){let g=f+(o.doc.sliceString(f,f+1)===">"?1:0),y=`${m}>`;return{range:Q.cursor(f+y.length,-1),changes:{from:f,to:g,insert:y}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch([r,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})});function tx(s,t,e){if(e.pos==e.text.length||s!=t.block&&e.indent>=t.stack[e.depth+1].value+e.baseIndent)return!0;if(e.indent>=e.baseIndent+4)return!1;let i=(s.type==E.OrderedList?Rp:Mp)(e,t,!1);return i>0&&(s.type!=E.BulletList||Lp(e,t,!1)<0)&&e.text.charCodeAt(e.pos+i-1)==s.value}function Ee(s){return s==32||s==9||s==10||s==13}function Ra(s,t=0){for(;t<s.length&&Ee(s.charCodeAt(t));)t++;return t}function ix(s,t,e){for(;t>e&&Ee(s.charCodeAt(t-1));)t--;return t}function sx(s){if(s.next!=96&&s.next!=126)return-1;let t=s.pos+1;for(;t<s.text.length&&s.text.charCodeAt(t)==s.next;)t++;if(t<s.pos+3)return-1;if(s.next==96){for(let e=t;e<s.text.length;e++)if(s.text.charCodeAt(e)==96)return-1}return t}function nx(s){return s.next!=62?-1:s.text.charCodeAt(s.pos+1)==32?2:1}function Lp(s,t,e){if(s.next!=42&&s.next!=45&&s.next!=95)return-1;let i=1;for(let n=s.pos+1;n<s.text.length;n++){let r=s.text.charCodeAt(n);if(r==s.next)i++;else if(!Ee(r))return-1}return e&&s.next==45&&ax(s)>-1&&s.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(dx.SetextHeading)>-1||i<3?-1:1}function rx(s,t){for(let e=s.stack.length-1;e>=0;e--)if(s.stack[e].type==t)return!0;return!1}function Mp(s,t,e){return(s.next==45||s.next==43||s.next==42)&&(s.pos==s.text.length-1||Ee(s.text.charCodeAt(s.pos+1)))&&(!e||rx(t,E.BulletList)||s.skipSpace(s.pos+2)<s.text.length)?1:-1}function Rp(s,t,e){let i=s.pos,n=s.next;for(;n>=48&&n<=57;){i++;if(i==s.text.length)return-1;n=s.text.charCodeAt(i)}return i==s.pos||i>s.pos+9||n!=46&&n!=41||i<s.text.length-1&&!Ee(s.text.charCodeAt(i+1))||e&&!rx(t,E.OrderedList)&&(s.skipSpace(i+1)==s.text.length||i>s.pos+1||s.next!=49)?-1:i+1-s.pos}function ox(s){if(s.next!=35)return-1;let t=s.pos+1;for(;t<s.text.length&&s.text.charCodeAt(t)==35;)t++;if(t<s.text.length&&s.text.charCodeAt(t)!=32)return-1;let e=t-s.pos;return e>6?-1:e}function ax(s){if(s.next!=45&&s.next!=61||s.indent>=s.baseIndent+4)return-1;let t=s.pos+1;for(;t<s.text.length&&s.text.charCodeAt(t)==s.next;)t++;let e=t;for(;t<s.text.length&&Ee(s.text.charCodeAt(t));)t++;return t==s.text.length?e:-1}function cx(s,t,e){if(s.next!=60)return-1;let i=s.text.slice(s.pos);for(let n=0,r=Ip.length-(e?1:0);n<r;n++)if(Ip[n][0].test(i))return n;return-1}function ux(s,t){let e=s.countIndent(t,s.pos,s.indent),i=s.countIndent(s.skipSpace(t),t,e);return i>=e+5?e+1:i}function ji(s,t,e){let i=s.length-1;i>=0&&s[i].to==t&&s[i].type==E.CodeText?s[i].to=e:s.push(K(E.CodeText,t,e))}function Dp(s,t){for(;t<s.length;t++){let e=s.charCodeAt(t);if(e==10)break;if(!Ee(e))return-1}return t}function fx(s,t,e,i,n){let r=s[t].to,o=[],a=[],l=e.from+i;function h(c,u){for(;u?c>=r:c>r;){let d=s[t+1].from-r;i+=d,c+=d,t++,r=s[t].to}}for(let c=e.firstChild;c;c=c.nextSibling){h(c.from+i,!0);let u=c.from+i,d,f=n.get(c.tree);f?d=f:c.to+i>r?(d=fx(s,t,c,i,n),h(c.to+i,!1)):d=c.toTree(),o.push(d),a.push(u-l)}return h(e.to+i,!1),new Y(e.type,o,a,e.to+i-l,e.tree?e.tree.propValues:void 0)}function Xa(s){return s!=null&&s.length>0}function Bp(s){if(!Array.isArray(s))return s;if(s.length==0)return null;let t=Bp(s[0]);if(s.length==1)return t;let e=Bp(s.slice(1));if(!e||!t)return t||e;let i=(o,a)=>(o||Lr).concat(a||Lr),n=t.wrap,r=e.wrap;return{props:i(t.props,e.props),defineNodes:i(t.defineNodes,e.defineNodes),parseBlock:i(t.parseBlock,e.parseBlock),parseInline:i(t.parseInline,e.parseInline),remove:i(t.remove,e.remove),wrap:n?r?(o,a,l,h)=>n(r(o,a,l,h),a,l,h):n:r}}function ec(s,t){let e=s.indexOf(t);if(e<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return e}function K(s,t,e,i){return new Ni(s,t,e,i)}function uT(s,t,e,i,n){let{text:r}=s,o=s.char(n),a=n;if(t.unshift(K(E.LinkMark,i,i+(e==E.Image?2:1))),t.push(K(E.LinkMark,n-1,n)),o==40){let l=s.skipSpace(n+1),h=bx(r,l-s.offset,s.offset),c;h&&(l=s.skipSpace(h.to),l!=h.to&&(c=yx(r,l-s.offset,s.offset),c&&(l=s.skipSpace(c.to)))),s.char(l)==41&&(t.push(K(E.LinkMark,n,n+1)),a=l+1,h&&t.push(h),c&&t.push(c),t.push(K(E.LinkMark,l,a)))}else if(o==91){let l=vx(r,n-s.offset,s.offset,!1);l&&(t.push(l),a=l.to)}return K(e,i,a,t)}function bx(s,t,e){if(s.charCodeAt(t)==60){for(let n=t+1;n<s.length;n++){let r=s.charCodeAt(n);if(r==62)return K(E.URL,t+e,n+1+e);if(r==60||r==10)return!1}return null}else{let n=0,r=t;for(let o=!1;r<s.length;r++){let a=s.charCodeAt(r);if(Ee(a))break;if(o)o=!1;else if(a==40)n++;else if(a==41){if(!n)break;n--}else a==92&&(o=!0)}return r>t?K(E.URL,t+e,r+e):r==s.length?null:!1}}function yx(s,t,e){let i=s.charCodeAt(t);if(i!=39&&i!=34&&i!=40)return!1;let n=i==40?41:i;for(let r=t+1,o=!1;r<s.length;r++){let a=s.charCodeAt(r);if(o)o=!1;else{if(a==n)return K(E.LinkTitle,t+e,r+1+e);a==92&&(o=!0)}}return null}function vx(s,t,e,i){for(let n=!1,r=t+1,o=Math.min(s.length,r+999);r<o;r++){let a=s.charCodeAt(r);if(n)n=!1;else{if(a==93)return i?!1:K(E.LinkLabel,t+e,r+1+e);if(i&&!Ee(a)&&(i=!1),a==91)return!1;a==92&&(n=!0)}}return null}function jp(s,t){if(!t.length)return s;if(!s.length)return t;let e=s.slice(),i=0;for(let n of t){for(;i<e.length&&e[i].to<n.to;)i++;if(i<e.length&&e[i].from<n.from){let r=e[i];r instanceof Ni&&(e[i]=new Ni(r.type,r.from,r.to,jp(r.children,[n])))}else e.splice(i++,0,n)}return e}function xx(s,t){let e=s;for(let i=1;i<t.length;i++){let n=t[i-1].to,r=t[i].from;n<s&&(e-=r-n)}return e}function pT(s,t,e){let i=[];for(let n=s.firstChild,r=t;;n=n.nextSibling){let o=n?n.from:e;if(o>r&&i.push({from:r,to:o}),!n)break;r=n.to}return i}function Wp(s){let{codeParser:t,htmlParser:e}=s;return{wrap:os((n,r)=>{let o=n.type.id;if(t&&(o==E.CodeBlock||o==E.FencedCode)){let a="";if(o==E.FencedCode){let h=n.node.getChild(E.CodeInfo);h&&(a=r.read(h.from,h.to))}let l=t(a);if(l)return{parser:l,overlay:h=>h.type.id==E.CodeText,bracketed:o==E.FencedCode}}else if(e&&(o==E.HTMLBlock||o==E.HTMLTag||o==E.CommentBlock))return{parser:e,overlay:pT(n.node,n.from,n.to)};return null})}}function Za(s,t,e=0,i,n=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{i.push(s.elt("TableCell",n+a,n+l,s.parser.parseInline(t.slice(a,l),n+a)))};for(let u=e;u<t.length;u++){let d=t.charCodeAt(u);d==124&&!h?((!o||a>-1)&&r++,o=!1,i&&(a>-1&&c(),i.push(s.elt("TableDelimiter",u+n,u+n+1))),a=l=-1):(h||d!=32&&d!=9)&&(a<0&&(a=u),l=u+1),h=!h&&d==92}return a>-1&&(r++,i&&c()),r}function wx(s,t){for(let e=t;e<s.length;e++){let i=s.charCodeAt(e);if(i==124)return!0;i==92&&e++}return!1}function Tx(s,t,e,i){let n=0;for(let r=t;r<e;r++)s[r]==i&&n++;return n}function OT(s,t){Px.lastIndex=t;let e=Px.exec(s);if(!e||gT.exec(e[0])[0].indexOf("_")>-1)return-1;let i=t+e[0].length;for(;;){let n=s[i-1],r;if(/[?!.,:*_~]/.test(n)||n==")"&&Tx(s,t,i,")")>Tx(s,t,i,"("))i--;else if(n==";"&&(r=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(s.slice(t,i))))i=t+r.index;else break}return i}function Lx(s,t){Cx.lastIndex=t;let e=Cx.exec(s);if(!e)return-1;let i=e[0][e[0].length-1];return i=="_"||i=="-"?-1:t+e[0].length-(i=="."?1:0)}function Rx(s,t,e){return(i,n,r)=>{if(n!=s||i.char(r+1)==s)return-1;let o=[i.elt(e,r,r+1)];for(let a=r+1;a<i.end;a++){let l=i.char(a);if(l==s)return i.addElement(i.elt(t,r,a+1,o.concat(i.elt(e,a,a+1))));if(l==92&&o.push(i.elt("Escape",a,a+++2)),Ee(l))break}return-1}}var Gh,E,Hh,Kh,ex,Xp,lx,hx,Ip,Jh,Zp,qp,dx,hT,cT,tc,Rr,px,Lr,ic,Ni,sc,mx,gx,Ts,nc,Gt,Ox,Ia,zp,Mr,dT,Np,fT,Vp,mT,Sx,kx,rc,$x,_p,Ax,Qx,Px,gT,Cx,Ex,Mx,Yp,Up,Fp,Gp,Xx=W(()=>{Ie();We();Gh=class s{static create(t,e,i,n,r){let o=n+(n<<8)+t+(e<<4)|0;return new s(t,e,i,o,r,[],[])}constructor(t,e,i,n,r,o,a){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=r,this.children=o,this.positions=a,this.hashProp=[[q.contextHash,n]]}addChild(t,e){t.prop(q.contextHash)!=this.hash&&(t=new Y(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new Y(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(n,r,o)=>new Y(ot.none,n,r,o,this.hashProp)})}};(function(s){s[s.Document=1]="Document",s[s.CodeBlock=2]="CodeBlock",s[s.FencedCode=3]="FencedCode",s[s.Blockquote=4]="Blockquote",s[s.HorizontalRule=5]="HorizontalRule",s[s.BulletList=6]="BulletList",s[s.OrderedList=7]="OrderedList",s[s.ListItem=8]="ListItem",s[s.ATXHeading1=9]="ATXHeading1",s[s.ATXHeading2=10]="ATXHeading2",s[s.ATXHeading3=11]="ATXHeading3",s[s.ATXHeading4=12]="ATXHeading4",s[s.ATXHeading5=13]="ATXHeading5",s[s.ATXHeading6=14]="ATXHeading6",s[s.SetextHeading1=15]="SetextHeading1",s[s.SetextHeading2=16]="SetextHeading2",s[s.HTMLBlock=17]="HTMLBlock",s[s.LinkReference=18]="LinkReference",s[s.Paragraph=19]="Paragraph",s[s.CommentBlock=20]="CommentBlock",s[s.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",s[s.Escape=22]="Escape",s[s.Entity=23]="Entity",s[s.HardBreak=24]="HardBreak",s[s.Emphasis=25]="Emphasis",s[s.StrongEmphasis=26]="StrongEmphasis",s[s.Link=27]="Link",s[s.Image=28]="Image",s[s.InlineCode=29]="InlineCode",s[s.HTMLTag=30]="HTMLTag",s[s.Comment=31]="Comment",s[s.ProcessingInstruction=32]="ProcessingInstruction",s[s.Autolink=33]="Autolink",s[s.HeaderMark=34]="HeaderMark",s[s.QuoteMark=35]="QuoteMark",s[s.ListMark=36]="ListMark",s[s.LinkMark=37]="LinkMark",s[s.EmphasisMark=38]="EmphasisMark",s[s.CodeMark=39]="CodeMark",s[s.CodeText=40]="CodeText",s[s.CodeInfo=41]="CodeInfo",s[s.LinkTitle=42]="LinkTitle",s[s.LinkLabel=43]="LinkLabel",s[s.URL=44]="URL"})(E||(E={}));Hh=class{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}},Kh=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return Ra(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n<t;n++)i+=this.text.charCodeAt(n)==9?4-i%4:1;return i}findColumn(t){let e=0;for(let i=0;e<this.text.length&&i<t;e++)i+=this.text.charCodeAt(e)==9?4-i%4:1;return e}scrub(){if(!this.baseIndent)return this.text;let t="";for(let e=0;e<this.basePos;e++)t+=" ";return t+this.text.slice(this.basePos)}};ex={[E.Blockquote](s,t,e){return e.next!=62?!1:(e.markers.push(K(E.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1)),e.moveBase(e.pos+(Ee(e.text.charCodeAt(e.pos+1))?2:1)),s.end=t.lineStart+e.text.length,!0)},[E.ListItem](s,t,e){return e.indent<e.baseIndent+s.value&&e.next>-1?!1:(e.moveBaseColumn(e.baseIndent+s.value),!0)},[E.OrderedList]:tx,[E.BulletList]:tx,[E.Document](){return!0}};Xp=/^[ \t]*$/,lx=/-->/,hx=/\?>/,Ip=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,lx],[/^\s*<\?/,hx],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Xp],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Xp]];Jh={LinkReference:void 0,IndentedCode(s,t){let e=t.baseIndent+4;if(t.indent<e)return!1;let i=t.findColumn(e),n=s.lineStart+i,r=s.lineStart+t.text.length,o=[],a=[];for(ji(o,n,r);s.nextLine()&&t.depth>=s.stack.length;)if(t.pos==t.text.length){ji(a,s.lineStart-1,s.lineStart);for(let l of t.markers)a.push(l)}else{if(t.indent<e)break;{if(a.length){for(let h of a)h.type==E.CodeText?ji(o,h.from,h.to):o.push(h);a=[]}ji(o,s.lineStart-1,s.lineStart);for(let h of t.markers)o.push(h);r=s.lineStart+t.text.length;let l=s.lineStart+t.findColumn(t.baseIndent+4);l<r&&ji(o,l,r)}}return a.length&&(a=a.filter(l=>l.type!=E.CodeText),a.length&&(t.markers=a.concat(t.markers))),s.addNode(s.buffer.writeElements(o,-n).finish(E.CodeBlock,r-n),n),!0},FencedCode(s,t){let e=sx(t);if(e<0)return!1;let i=s.lineStart+t.pos,n=t.next,r=e-t.pos,o=t.skipSpace(e),a=ix(t.text,t.text.length,o),l=[K(E.CodeMark,i,i+r)];o<a&&l.push(K(E.CodeInfo,s.lineStart+o,s.lineStart+a));for(let h=!0,c=!0,u=!1;s.nextLine()&&t.depth>=s.stack.length;h=!1){let d=t.pos;if(t.indent-t.baseIndent<4)for(;d<t.text.length&&t.text.charCodeAt(d)==n;)d++;if(d-t.pos>=r&&t.skipSpace(d)==t.text.length){for(let f of t.markers)l.push(f);c&&u&&ji(l,s.lineStart-1,s.lineStart),l.push(K(E.CodeMark,s.lineStart+t.pos,s.lineStart+d)),s.nextLine();break}else{u=!0,h||(ji(l,s.lineStart-1,s.lineStart),c=!1);for(let m of t.markers)l.push(m);let f=s.lineStart+t.basePos,p=s.lineStart+t.text.length;f<p&&(ji(l,f,p),c=!1)}}return s.addNode(s.buffer.writeElements(l,-i).finish(E.FencedCode,s.prevLineEnd()-i),i),!0},Blockquote(s,t){let e=nx(t);return e<0?!1:(s.startContext(E.Blockquote,t.pos),s.addNode(E.QuoteMark,s.lineStart+t.pos,s.lineStart+t.pos+1),t.moveBase(t.pos+e),null)},HorizontalRule(s,t){if(Lp(t,s,!1)<0)return!1;let e=s.lineStart+t.pos;return s.nextLine(),s.addNode(E.HorizontalRule,e),!0},BulletList(s,t){let e=Mp(t,s,!1);if(e<0)return!1;s.block.type!=E.BulletList&&s.startContext(E.BulletList,t.basePos,t.next);let i=ux(t,t.pos+1);return s.startContext(E.ListItem,t.basePos,i-t.baseIndent),s.addNode(E.ListMark,s.lineStart+t.pos,s.lineStart+t.pos+e),t.moveBaseColumn(i),null},OrderedList(s,t){let e=Rp(t,s,!1);if(e<0)return!1;s.block.type!=E.OrderedList&&s.startContext(E.OrderedList,t.basePos,t.text.charCodeAt(t.pos+e-1));let i=ux(t,t.pos+e);return s.startContext(E.ListItem,t.basePos,i-t.baseIndent),s.addNode(E.ListMark,s.lineStart+t.pos,s.lineStart+t.pos+e),t.moveBaseColumn(i),null},ATXHeading(s,t){let e=ox(t);if(e<0)return!1;let i=t.pos,n=s.lineStart+i,r=ix(t.text,t.text.length,i),o=r;for(;o>i&&t.text.charCodeAt(o-1)==t.next;)o--;(o==r||o==i||!Ee(t.text.charCodeAt(o-1)))&&(o=t.text.length);let a=s.buffer.write(E.HeaderMark,0,e).writeElements(s.parser.parseInline(t.text.slice(i+e+1,o),n+e+1),-n);o<t.text.length&&a.write(E.HeaderMark,o-i,r-i);let l=a.finish(E.ATXHeading1-1+e,t.text.length-i);return s.nextLine(),s.addNode(l,n),!0},HTMLBlock(s,t){let e=cx(t,s,!1);if(e<0)return!1;let i=s.lineStart+t.pos,n=Ip[e][1],r=[],o=n!=Xp;for(;!n.test(t.text)&&s.nextLine();){if(t.depth<s.stack.length){o=!1;break}for(let h of t.markers)r.push(h)}o&&s.nextLine();let a=n==lx?E.CommentBlock:n==hx?E.ProcessingInstructionBlock:E.HTMLBlock,l=s.prevLineEnd();return s.addNode(s.buffer.writeElements(r,-i).finish(a,l-i),i),!0},SetextHeading:void 0},Zp=class{constructor(t){this.stage=0,this.elts=[],this.pos=0,this.start=t.start,this.advance(t.content)}nextLine(t,e,i){if(this.stage==-1)return!1;let n=i.content+`
27
+ `+e.scrub(),r=this.advance(n);return r>-1&&r<n.length?this.complete(t,i,r):!1}finish(t,e){return(this.stage==2||this.stage==3)&&Ra(e.content,this.pos)==e.content.length?this.complete(t,e,e.content.length):!1}complete(t,e,i){return t.addLeafElement(e,K(E.LinkReference,this.start,this.start+i,this.elts)),!0}nextStage(t){return t?(this.pos=t.to-this.start,this.elts.push(t),this.stage++,!0):(t===!1&&(this.stage=-1),!1)}advance(t){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(vx(t,this.pos,this.start,!0)))return-1;if(t.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(K(E.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(bx(t,Ra(t,this.pos),this.start)))return-1}else if(this.stage==2){let e=Ra(t,this.pos),i=0;if(e>this.pos){let n=yx(t,e,this.start);if(n){let r=Dp(t,n.to-this.start);r>0&&(this.nextStage(n),i=r)}}return i||(i=Dp(t,this.pos)),i>0&&i<t.length?i:-1}else return Dp(t,this.pos)}}};qp=class{nextLine(t,e,i){let n=e.depth<t.stack.length?-1:ax(e),r=e.next;if(n<0)return!1;let o=K(E.HeaderMark,t.lineStart+e.pos,t.lineStart+n);return t.nextLine(),t.addLeafElement(i,K(r==61?E.SetextHeading1:E.SetextHeading2,i.start,t.prevLineEnd(),[...t.parser.parseInline(i.content,i.start),o])),!0}finish(){return!1}},dx={LinkReference(s,t){return t.content.charCodeAt(0)==91?new Zp(t):null},SetextHeading(){return new qp}},hT=[(s,t)=>ox(t)>=0,(s,t)=>sx(t)>=0,(s,t)=>nx(t)>=0,(s,t)=>Mp(t,s,!0)>=0,(s,t)=>Rp(t,s,!0)>=0,(s,t)=>Lp(t,s,!0)>=0,(s,t)=>cx(t,s,!0)>=0],cT={text:"",end:0},tc=class{constructor(t,e,i,n){this.parser=t,this.input=e,this.ranges=n,this.line=new Kh,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=n[n.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=n[0].from,this.block=Gh.create(E.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new Np(i,e):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:t}=this;for(;;){for(let i=0;;){let n=t.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<t.markers.length&&(!n||t.markers[i].from<n.end);){let r=t.markers[i++];this.addNode(r.type,r.from,r.to)}if(!n)break;this.finishContext()}if(t.pos<t.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(t.basePos))return null;t:for(;;){for(let i of this.parser.blockParsers)if(i){let n=i(this,t);if(n!=!1){if(n==!0)return null;t.forward();continue t}}break}let e=new Hh(this.lineStart+t.pos,t.text.slice(t.pos));for(let i of this.parser.leafBlockParsers)if(i){let n=i(this,e);n&&e.parsers.push(n)}t:for(;this.nextLine()&&t.pos!=t.text.length;){if(t.indent<t.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,t,e))break t}for(let i of e.parsers)if(i.nextLine(this,t,e))return null;e.content+=`
28
+ `+t.scrub();for(let i of t.markers)e.marks.push(i)}return this.finishLeaf(e),null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}reuseFragment(t){if(!this.fragments.moveTo(this.absoluteLineStart+t,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let e=this.fragments.takeNodes(this);return e?(this.absoluteLineStart+=e,this.lineStart=xx(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(t=this.depth-1){return this.parser.nodeSet.types[this.stack[t].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(t){let e=cT;if(e.end=t,t>=this.to)e.text="";else if(e.text=this.lineChunkAt(t),e.end+=e.text.length,this.ranges.length>1){let i=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<e.end;){n++;let r=this.ranges[n].from,o=this.lineChunkAt(r);e.end=r+o.length,e.text=e.text.slice(0,this.ranges[n-1].to-i)+o,i=e.end-e.text.length}}return e}readLine(){let{line:t}=this,{text:e,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,t.reset(e);t.depth<this.stack.length;t.depth++){let n=this.stack[t.depth],r=this.parser.skipContextMarkup[n.type];if(!r)throw new Error("Unhandled block context "+E[n.type]);let o=this.line.markers.length;if(!r(n,this,t)){this.line.markers.length>o&&(n.end=this.line.markers[this.line.markers.length-1].to),t.forward();break}t.forward()}}lineChunkAt(t){let e=this.input.chunk(t),i;if(this.input.lineChunks)i=e==`
29
+ `?"":e;else{let n=e.indexOf(`
30
+ `);i=n<0?e:e.slice(0,n)}return t+i.length>this.to?i.slice(0,this.to-t):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,e,i=0){this.block=Gh.create(t,i,this.lineStart+e,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,e,i=0){this.startContext(this.parser.getNodeType(t),e,i)}addNode(t,e,i){typeof t=="number"&&(t=new Y(this.parser.nodeSet.types[t],Lr,Lr,(i??this.prevLineEnd())-e)),this.block.addChild(t,e-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,e){this.addNode(this.buffer.writeElements(jp(e.children,t.marks),-e.from).finish(e.type,e.to-e.from),e.from)}finishContext(){let t=this.stack.pop(),e=this.stack[this.stack.length-1];e.addChild(t.toTree(this.parser.nodeSet),t.from-e.from),this.block=e}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?fx(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let i of t.parsers)if(i.finish(this,t))return;let e=jp(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(e,-t.start).finish(E.Paragraph,t.content.length),t.start)}elt(t,e,i,n){return typeof t=="string"?K(this.parser.getNodeType(t),e,i,n):new sc(t,e)}get buffer(){return new ic(this.parser.nodeSet)}};Rr=class s extends je{constructor(t,e,i,n,r,o,a,l,h){super(),this.nodeSet=t,this.blockParsers=e,this.leafBlockParsers=i,this.blockNames=n,this.endLeafBlock=r,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of t.types)this.nodeTypes[c.name]=c.id}createParse(t,e,i){let n=new tc(this,t,e,i);for(let r of this.wrappers)n=r(n,t,e,i);return n}configure(t){let e=Bp(t);if(!e)return this;let{nodeSet:i,skipContextMarkup:n}=this,r=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),u=this.wrappers;if(Xa(e.defineNodes)){n=Object.assign({},n);let d=i.types.slice(),f;for(let p of e.defineNodes){let{name:m,block:O,composite:g,style:y}=typeof p=="string"?{name:p}:p;if(d.some(S=>S.name==m))continue;g&&(n[d.length]=(S,$,k)=>g($,k,S.value));let v=d.length,x=g?["Block","BlockContext"]:O?v>=E.ATXHeading1&&v<=E.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(ot.define({id:v,name:m,props:x&&[[q.group,x]]})),y&&(f||(f={}),Array.isArray(y)||y instanceof ne?f[m]=y:Object.assign(f,y))}i=new ze(d),f&&(i=i.extend($t(f)))}if(Xa(e.props)&&(i=i.extend(...e.props)),Xa(e.remove))for(let d of e.remove){let f=this.blockNames.indexOf(d),p=this.inlineNames.indexOf(d);f>-1&&(r[f]=o[f]=void 0),p>-1&&(l[p]=void 0)}if(Xa(e.parseBlock))for(let d of e.parseBlock){let f=a.indexOf(d.name);if(f>-1)r[f]=d.parse,o[f]=d.leaf;else{let p=d.before?ec(a,d.before):d.after?ec(a,d.after)+1:a.length-1;r.splice(p,0,d.parse),o.splice(p,0,d.leaf),a.splice(p,0,d.name)}d.endLeaf&&c.push(d.endLeaf)}if(Xa(e.parseInline))for(let d of e.parseInline){let f=h.indexOf(d.name);if(f>-1)l[f]=d.parse;else{let p=d.before?ec(h,d.before):d.after?ec(h,d.after)+1:h.length-1;l.splice(p,0,d.parse),h.splice(p,0,d.name)}}return e.wrap&&(u=u.concat(e.wrap)),new s(i,r,o,a,c,n,l,h,u)}getNodeType(t){let e=this.nodeTypes[t];if(e==null)throw new RangeError(`Unknown node type '${t}'`);return e}parseInline(t,e){let i=new Mr(this,t,e);t:for(let n=e;n<i.end;){let r=i.char(n);for(let o of this.inlineParsers)if(o){let a=o(i,r,n);if(a>=0){n=a;continue t}}n++}return i.resolveMarkers(0)}};px=[ot.none];for(let s=1,t;t=E[s];s++)px[s]=ot.define({id:s,name:t,props:s>=E.Escape?[]:[[q.group,s in ex?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});Lr=[],ic=class{constructor(t){this.nodeSet=t,this.content=[],this.nodes=[]}write(t,e,i,n=0){return this.content.push(t,e,i,4+n*4),this}writeElements(t,e=0){for(let i of t)i.writeTo(this,e);return this}finish(t,e){return Y.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:e})}},Ni=class{constructor(t,e,i,n=Lr){this.type=t,this.from=e,this.to=i,this.children=n}writeTo(t,e){let i=t.content.length;t.writeElements(this.children,e),t.content.push(this.type,this.from+e,this.to+e,t.content.length+4-i)}toTree(t){return new ic(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},sc=class{constructor(t,e){this.tree=t,this.from=e}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return Lr}writeTo(t,e){t.nodes.push(this.tree),t.content.push(t.nodes.length-1,this.from+e,this.to+e,-1)}toTree(){return this.tree}};mx={resolve:"Emphasis",mark:"EmphasisMark"},gx={resolve:"Emphasis",mark:"EmphasisMark"},Ts={},nc={},Gt=class{constructor(t,e,i,n){this.type=t,this.from=e,this.to=i,this.side=n}},Ox="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",Ia=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Ia=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}zp={Escape(s,t,e){if(t!=92||e==s.end-1)return-1;let i=s.char(e+1);for(let n=0;n<Ox.length;n++)if(Ox.charCodeAt(n)==i)return s.append(K(E.Escape,e,e+2));return-1},Entity(s,t,e){if(t!=38)return-1;let i=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(s.slice(e+1,e+31));return i?s.append(K(E.Entity,e,e+1+i[0].length)):-1},InlineCode(s,t,e){if(t!=96||e&&s.char(e-1)==96)return-1;let i=e+1;for(;i<s.end&&s.char(i)==96;)i++;let n=i-e,r=0;for(;i<s.end;i++)if(s.char(i)==96){if(r++,r==n&&s.char(i+1)!=96)return s.append(K(E.InlineCode,e,i+1,[K(E.CodeMark,e,e+n),K(E.CodeMark,i+1-n,i+1)]))}else r=0;return-1},HTMLTag(s,t,e){if(t!=60||e==s.end-1)return-1;let i=s.slice(e+1,s.end),n=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(i);if(n)return s.append(K(E.Autolink,e,e+1+n[0].length,[K(E.LinkMark,e,e+1),K(E.URL,e+1,e+n[0].length),K(E.LinkMark,e+n[0].length,e+1+n[0].length)]));let r=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(i);if(r)return s.append(K(E.Comment,e,e+1+r[0].length));let o=/^\?[^]*?\?>/.exec(i);if(o)return s.append(K(E.ProcessingInstruction,e,e+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return a?s.append(K(E.HTMLTag,e,e+1+a[0].length)):-1},Emphasis(s,t,e){if(t!=95&&t!=42)return-1;let i=e+1;for(;s.char(i)==t;)i++;let n=s.slice(e-1,e),r=s.slice(i,i+1),o=Ia.test(n),a=Ia.test(r),l=/\s|^$/.test(n),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(t==42||!u||o),f=u&&(t==42||!c||a);return s.append(new Gt(t==95?mx:gx,e,i,(d?1:0)|(f?2:0)))},HardBreak(s,t,e){if(t==92&&s.char(e+1)==10)return s.append(K(E.HardBreak,e,e+2));if(t==32){let i=e+1;for(;s.char(i)==32;)i++;if(s.char(i)==10&&i>=e+2)return s.append(K(E.HardBreak,e,i+1))}return-1},Link(s,t,e){return t==91?s.append(new Gt(Ts,e,e+1,1)):-1},Image(s,t,e){return t==33&&s.char(e+1)==91?s.append(new Gt(nc,e,e+2,1)):-1},LinkEnd(s,t,e){if(t!=93)return-1;for(let i=s.parts.length-1;i>=0;i--){let n=s.parts[i];if(n instanceof Gt&&(n.type==Ts||n.type==nc)){if(!n.side||s.skipSpace(n.to)==e&&!/[(\[]/.test(s.slice(e+1,e+2)))return s.parts[i]=null,-1;let r=s.takeContent(i),o=s.parts[i]=uT(s,r,n.type==Ts?E.Link:E.Image,n.from,e+1);if(n.type==Ts)for(let a=0;a<i;a++){let l=s.parts[a];l instanceof Gt&&l.type==Ts&&(l.side=0)}return o.to}}return-1}};Mr=class{constructor(t,e,i){this.parser=t,this.text=e,this.offset=i,this.parts=[]}char(t){return t>=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,r){return this.append(new Gt(t,e,i,(n?1:0)|(r?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let e=this.parts[t];if(e instanceof Gt&&(e.type==Ts||e.type==nc))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let i=t;i<this.parts.length;i++){let n=this.parts[i];if(!(n instanceof Gt&&n.type.resolve&&n.side&2))continue;let r=n.type==mx||n.type==gx,o=n.to-n.from,a,l=i-1;for(;l>=t;l--){let m=this.parts[l];if(m instanceof Gt&&m.side&1&&m.type==n.type&&!(r&&(n.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let h=n.type.resolve,c=[],u=a.from,d=n.to;if(r){let m=Math.min(2,a.to-a.from,o);u=a.to-m,d=n.from+m,h=m==1?"Emphasis":"StrongEmphasis"}a.type.mark&&c.push(this.elt(a.type.mark,u,a.to));for(let m=l+1;m<i;m++)this.parts[m]instanceof Ni&&c.push(this.parts[m]),this.parts[m]=null;n.type.mark&&c.push(this.elt(n.type.mark,n.from,d));let f=this.elt(h,u,d,c);this.parts[l]=r&&a.from!=u?new Gt(a.type,a.from,u,a.side):null,(this.parts[i]=r&&n.to!=d?new Gt(n.type,d,n.to,n.side):null)?this.parts.splice(i,0,f):this.parts[i]=f}let e=[];for(let i=t;i<this.parts.length;i++){let n=this.parts[i];n instanceof Ni&&e.push(n)}return e}findOpeningDelimiter(t){for(let e=this.parts.length-1;e>=0;e--){let i=this.parts[e];if(i instanceof Gt&&i.type==t&&i.side&1)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}getDelimiterAt(t){let e=this.parts[t];return e instanceof Gt?e:null}skipSpace(t){return Ra(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return typeof t=="string"?K(this.parser.getNodeType(t),e,i,n):new sc(t,e)}};Mr.linkStart=Ts,Mr.imageStart=nc;dT=[E.CodeBlock,E.ListItem,E.OrderedList,E.BulletList],Np=class{constructor(t,e){this.fragments=t,this.input=e,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,t.length&&(this.fragment=t[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(t,e){for(;this.fragment&&this.fragment.to<=t;)this.nextFragment();if(!this.fragment||this.fragment.from>(t?t-1:0))return!1;if(this.fragmentEnd<0){let r=this.fragment.to;for(;r>0&&this.input.read(r-1,r)!=`
31
+ `;)r--;this.fragmentEnd=r?r-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(q.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),r=t.absoluteLineStart,o=r,a=t.block.children.length,l=o,h=a;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}let c=xx(e.from-i,t.ranges);if(e.to-i<=t.ranges[t.rangeI].to)t.addNode(e.tree,c);else{let u=new Y(t.parser.nodeSet.types[E.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(u,e.tree),t.addNode(u,c)}if(e.type.is("Block")&&(dT.indexOf(e.type.id)<0?(o=e.to-i,a=t.block.children.length):(o=l,a=h),l=e.to-i,h=t.block.children.length),!e.nextSibling())break}for(;t.block.children.length>a;)t.block.children.pop(),t.block.positions.pop();return o-r}};fT=$t({"Blockquote/...":b.quote,HorizontalRule:b.contentSeparator,"ATXHeading1/... SetextHeading1/...":b.heading1,"ATXHeading2/... SetextHeading2/...":b.heading2,"ATXHeading3/...":b.heading3,"ATXHeading4/...":b.heading4,"ATXHeading5/...":b.heading5,"ATXHeading6/...":b.heading6,"Comment CommentBlock":b.comment,Escape:b.escape,Entity:b.character,"Emphasis/...":b.emphasis,"StrongEmphasis/...":b.strong,"Link/... Image/...":b.link,"OrderedList/... BulletList/...":b.list,"BlockQuote/...":b.quote,"InlineCode CodeText":b.monospace,"URL Autolink":b.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":b.processingInstruction,"CodeInfo LinkLabel":b.labelName,LinkTitle:b.string,Paragraph:b.content}),Vp=new Rr(new ze(px).extend(fT),Object.keys(Jh).map(s=>Jh[s]),Object.keys(Jh).map(s=>dx[s]),Object.keys(Jh),hT,ex,Object.keys(zp).map(s=>zp[s]),Object.keys(zp),[]);mT={resolve:"Strikethrough",mark:"StrikethroughMark"},Sx={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":b.strikethrough}},{name:"StrikethroughMark",style:b.processingInstruction}],parseInline:[{name:"Strikethrough",parse(s,t,e){if(t!=126||s.char(e+1)!=126||s.char(e+2)==126)return-1;let i=s.slice(e-1,e),n=s.slice(e+2,e+3),r=/\s|^$/.test(i),o=/\s|^$/.test(n),a=Ia.test(i),l=Ia.test(n);return s.addDelimiter(mT,e,e+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};kx=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,rc=class{constructor(){this.rows=null}nextLine(t,e,i){if(this.rows==null){this.rows=!1;let n;if((e.next==45||e.next==58||e.next==124)&&kx.test(n=e.text.slice(e.pos))){let r=[];Za(t,i.content,0,r,i.start)==Za(t,n,e.pos)&&(this.rows=[t.elt("TableHeader",i.start,i.start+i.content.length,r),t.elt("TableDelimiter",t.lineStart+e.pos,t.lineStart+e.text.length)])}}else if(this.rows){let n=[];Za(t,e.text,e.pos,n,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+e.pos,t.lineStart+e.text.length,n))}return!1}finish(t,e){return this.rows?(t.addLeafElement(e,t.elt("Table",e.start,e.start+e.content.length,this.rows)),!0):!1}},$x={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":b.heading}},"TableRow",{name:"TableCell",style:b.content},{name:"TableDelimiter",style:b.processingInstruction}],parseBlock:[{name:"Table",leaf(s,t){return wx(t.content,0)?new rc:null},endLeaf(s,t,e){if(e.parsers.some(n=>n instanceof rc)||!wx(t.text,t.basePos))return!1;let i=s.peekLine();return kx.test(i)&&Za(s,t.text,t.basePos)==Za(s,i,t.basePos)},before:"SetextHeading"}]},_p=class{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}},Ax={defineNodes:[{name:"Task",block:!0,style:b.list},{name:"TaskMarker",style:b.atom}],parseBlock:[{name:"TaskList",leaf(s,t){return/^\[[ xX]\][ \t]/.test(t.content)&&s.parentType().name=="ListItem"?new _p:null},after:"SetextHeading"}]},Qx=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Px=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,gT=/[\w-]+\.[\w-]+($|\/)/,Cx=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Ex=/\/[a-zA-Z\d@.]+/gy;Mx={parseInline:[{name:"Autolink",parse(s,t,e){let i=e-s.offset;if(i&&/\w/.test(s.text[i-1]))return-1;Qx.lastIndex=i;let n=Qx.exec(s.text),r=-1;if(!n)return-1;if(n[1]||n[2]){if(r=OT(s.text,i+n[0].length),r>-1&&s.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(s.text.slice(i,r));r=i+o[0].length}}else n[3]?r=Lx(s.text,i):(r=Lx(s.text,i+n[0].length),r>-1&&n[0]=="xmpp:"&&(Ex.lastIndex=r,n=Ex.exec(s.text),n&&(r=n.index+n[0].length)));return r<0?-1:(s.addElement(s.elt("URL",e,r+s.offset)),r+s.offset)}}]},Yp=[$x,Ax,Sx,Mx];Up={defineNodes:[{name:"Superscript",style:b.special(b.content)},{name:"SuperscriptMark",style:b.processingInstruction}],parseInline:[{name:"Superscript",parse:Rx(94,"Superscript","SuperscriptMark")}]},Fp={defineNodes:[{name:"Subscript",style:b.special(b.content)},{name:"SubscriptMark",style:b.processingInstruction}],parseInline:[{name:"Subscript",parse:Rx(126,"Subscript","SubscriptMark")}]},Gp={defineNodes:[{name:"Emoji",style:b.character}],parseInline:[{name:"Emoji",parse(s,t,e){let i;return t!=58||!(i=/^[a-zA-Z_0-9]+:/.exec(s.slice(e+1,s.end)))?-1:s.addElement(s.elt("Emoji",e,e+1+i[0].length))}}]}});var Vx={};Ht(Vx,{commonmarkLanguage:()=>im,deleteMarkupBackward:()=>rm,insertNewlineContinueMarkup:()=>nm,insertNewlineContinueMarkupCommand:()=>sm,markdown:()=>_x,markdownKeymap:()=>om,markdownLanguage:()=>Xr,pasteURLAsLink:()=>am});function Hp(s){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(s.name);return t?+t[1]:void 0}function bT(s){return s.name=="OrderedList"||s.name=="BulletList"}function yT(s,t){let e=s;for(;;){let i=e.nextSibling,n;if(!i||(n=Hp(i.type))!=null&&n<=t)break;e=i}return e.to}function Kp(s){return new wt(Ix,s,[],"markdown")}function ST(s,t){return e=>{if(e&&s){let i=null;if(e=/\S*/.exec(e)[0],typeof s=="function"?i=s(e):i=$r.matchLanguageName(s,e,!0),i instanceof $r)return i.support?i.support.language.parser:Bi.getSkippingParser(i.load());if(i)return i.parser}return t?t.parser:null}}function qx(s,t){let e=[],i=[];for(let n=s;n;n=n.parent){if(n.name=="FencedCode")return i;(n.name=="ListItem"||n.name=="Blockquote")&&e.push(n)}for(let n=e.length-1;n>=0;n--){let r=e[n],o,a=t.lineAt(r.from),l=r.from-a.from;if(r.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))i.push(new Da(r,l,l+o[0].length,"",o[1],">",null));else if(r.name=="ListItem"&&r.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],c=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),c-=4),i.push(new Da(r.parent,l,l+c,o[1],h,o[2],r))}else if(r.name=="ListItem"&&r.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let h=o[4],c=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),c-=4);let u=o[2];o[3]&&(u+=o[3].replace(/[xX]/," ")),i.push(new Da(r.parent,l,l+c,o[1],h,u,r))}}return i}function Bx(s,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(s.from,s.from+10))}function Jp(s,t,e,i=0){for(let n=-1,r=s;;){if(r.name=="ListItem"){let a=Bx(r,t),l=+a[2];if(n>=0){if(l!=n+1)return;e.push({from:r.from+a[1].length,to:r.from+a[0].length,insert:String(n+2+i)})}n=l}let o=r.nextSibling;if(!o)break;r=o}}function tm(s,t){let e=/^[ \t]*/.exec(s)[0].length;if(!e||t.facet(yi)!=" ")return s;let i=It(s,4,e),n="";for(let r=i;r>0;)r>=4?(n+=" ",r-=4):(n+=" ",r--);return n+s.slice(e)}function zx(s){return s.name=="QuoteMark"||s.name=="ListMark"}function wT(s,t){if(s.name!="OrderedList"&&s.name!="BulletList")return!1;let e=s.firstChild,i=s.getChild("ListItem","ListItem");if(!i)return!1;let n=t.lineAt(e.to),r=t.lineAt(i.from),o=/^[\s>]*$/.test(n.text);return n.number+(o?0:1)<r.number}function jx(s,t,e){let i="";for(let n=0,r=s.length-2;n<=r;n++)i+=s[n].blank(n<r?It(e.text,4,s[n+1].from)-i.length:null,n<r);return tm(i,t)}function kT(s,t){let e=s.resolveInner(t,-1),i=t;zx(e)&&(i=e.from,e=e.parent);for(let n;n=e.childBefore(i);)if(zx(n))i=n.from;else if(n.name=="OrderedList"||n.name=="BulletList")e=n.lastChild,i=e.to;else break;return e}function _x(s={}){let{codeLanguages:t,defaultCodeLanguage:e,addKeymap:i=!0,base:{parser:n}=im,completeHTMLTags:r=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=Nx}=s;if(!(n instanceof Rr))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=s.extensions?[s.extensions]:[],h=[a.support,vT],c;o&&h.push(am),e instanceof ft?(h.push(e.support),c=e.language):e&&(c=e);let u=t||c?ST(t,c):void 0;l.push(Wp({codeParser:u,htmlParser:a.language.parser})),i&&h.push(re.high(He.of(om)));let d=Kp(n.configure(l));return r&&h.push(d.data.of({autocomplete:$T})),new ft(d,h)}function $T(s){let{state:t,pos:e}=s,i=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(e-25,e));if(!i)return null;let n=F(t).resolveInner(e,-1);for(;n&&!n.type.isTop;){if(n.name=="CodeBlock"||n.name=="FencedCode"||n.name=="ProcessingInstructionBlock"||n.name=="CommentBlock"||n.name=="Link"||n.name=="Image")return null;n=n.parent}return{from:e-i[0].length,to:e,options:AT(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}function AT(){if(em)return em;let s=Uh(new Cs(et.create({extensions:Nx}),0,!0));return em=s?s.options:[]}var Ix,Zx,Dx,vT,im,xT,Xr,Da,sm,nm,rm,om,Nx,em,QT,am,Wx=W(()=>{Ue();fi();ti();Op();Xx();Tp();Ie();Ix=ks({commentTokens:{block:{open:"<!--",close:"-->"}}}),Zx=new q,Dx=Vp.configure({props:[Ft.add(s=>!s.is("Block")||s.is("Document")||Hp(s)!=null||bT(s)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})),Zx.add(Hp),Ut.add({Document:()=>null}),Ke.add({Document:Ix})]});vT=Ch.of((s,t,e)=>{for(let i=F(s).resolveInner(e,-1);i&&!(i.from<t);i=i.parent){let n=i.type.prop(Zx);if(n==null)continue;let r=yT(i,n);if(r>e)return{from:e,to:r}}return null});im=Kp(Dx),xT=Dx.configure([Yp,Fp,Up,Gp,{props:[Ft.add({Table:(s,t)=>({from:t.doc.lineAt(s.from).to,to:s.to})})]}]),Xr=Kp(xT);Da=class{constructor(t,e,i,n,r,o,a){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=r,this.type=o,this.item=a}blank(t,e=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;i.length<t;)i+=" ";return i}else{for(let n=this.to-this.from-i.length-this.spaceAfter.length;n>0;n--)i+=" ";return i+(e?this.spaceAfter:"")}}marker(t,e){let i=this.node.name=="OrderedList"?String(+Bx(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}};sm=(s={})=>({state:t,dispatch:e})=>{let i=F(t),{doc:n}=t,r=null,o=t.changeByRange(a=>{if(!a.empty||!Xr.isActiveAt(t,a.from,-1)&&!Xr.isActiveAt(t,a.from,1))return r={range:a};let l=a.from,h=n.lineAt(l),c=qx(i.resolveInner(l,-1),n);for(;c.length&&c[c.length-1].from>l-h.from;)c.pop();if(!c.length)return r={range:a};let u=c[c.length-1];if(u.to-u.spaceAfter.length>l-h.from)return r={range:a};let d=l>=u.to-u.spaceAfter.length&&!/\S/.test(h.text.slice(u.to));if(u.item&&d){let g=u.node.firstChild,y=u.node.getChild("ListItem","ListItem");if(g.to>=l||y&&y.to<l||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)||s.nonTightLists===!1){let v=c.length>1?c[c.length-2]:null,x,S="";v&&v.item?(x=h.from+v.from,S=v.marker(n,1)):x=h.from+(v?v.to:0);let $=[{from:x,to:l,insert:S}];return u.node.name=="OrderedList"&&Jp(u.item,n,$,-2),v&&v.node.name=="OrderedList"&&Jp(v.item,n,$),{range:Q.cursor(x+S.length),changes:$}}else{let v=jx(c,t,h);return{range:Q.cursor(l+v.length+1),changes:{from:h.from,insert:v+t.lineBreak}}}}if(u.node.name=="Blockquote"&&d&&h.from){let g=n.lineAt(h.from-1),y=/>\s*$/.exec(g.text);if(y&&y.index==u.from){let v=t.changes([{from:g.from+y.index,to:g.to},{from:h.from+u.from,to:h.to}]);return{range:a.map(v),changes:v}}}let f=[];u.node.name=="OrderedList"&&Jp(u.item,n,f);let p=u.item&&u.item.from<h.from,m="";if(!p||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=u.to)for(let g=0,y=c.length-1;g<=y;g++)m+=g==y&&!p?c[g].marker(n,1):c[g].blank(g<y?It(h.text,4,c[g+1].from)-m.length:null);let O=l;for(;O>h.from&&/\s/.test(h.text.charAt(O-h.from-1));)O--;return m=tm(m,t),wT(u.node,t.doc)&&(m=jx(c,t,h)+t.lineBreak+m),f.push({from:O,to:l,insert:t.lineBreak+m}),{range:Q.cursor(O+m.length+1),changes:f}});return r?!1:(e(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},nm=sm();rm=({state:s,dispatch:t})=>{let e=F(s),i=null,n=s.changeByRange(r=>{let o=r.from,{doc:a}=s;if(r.empty&&Xr.isActiveAt(s,r.from)){let l=a.lineAt(o),h=qx(kT(e,o),a);if(h.length){let c=h[h.length-1],u=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-l.from>u&&!/\S/.test(l.text.slice(u,o-l.from)))return{range:Q.cursor(l.from+u),changes:{from:l.from+u,to:o}};if(o-l.from==u&&(!c.item||l.from<=c.item.from||!/\S/.test(l.text.slice(0,c.to)))){let d=l.from+c.from;if(c.item&&c.node.from<c.item.from&&/\S/.test(l.text.slice(c.from,c.to))){let f=c.blank(It(l.text,4,c.to)-It(l.text,4,c.from));return d==l.from&&(f=tm(f,s)),{range:Q.cursor(d+f.length),changes:{from:d,to:l.from+c.to,insert:f}}}if(d<o)return{range:Q.cursor(d),changes:{from:d,to:o}}}}}return i={range:r}});return i?!1:(t(s.update(n,{scrollIntoView:!0,userEvent:"delete"})),!0)},om=[{key:"Enter",run:nm},{key:"Backspace",run:rm}],Nx=Fh({matchClosingTags:!1});em=null;QT=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,am=L.domEventHandlers({paste:(s,t)=>{var e;let{main:i}=t.state.selection;if(i.empty)return!1;let n=(e=s.clipboardData)===null||e===void 0?void 0:e.getData("text/plain");if(!n||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(n)||(/^www\./.test(n)&&(n="https://"+n),!Xr.isActiveAt(t.state,i.from,1)))return!1;let r=F(t.state),o=!1;return r.iterate({from:i.from,to:i.to,enter:a=>{(a.from>i.from||QT.test(a.name))&&(o=!0)},leave:a=>{a.to<i.to&&(o=!0)}}),o?!1:(t.dispatch({changes:[{from:i.from,insert:"["},{from:i.to,insert:`](${n})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}})});function Ba(s,t){for(let e=0,i=t-s.pos-1;;i--,e++){let n=s.peek(i);if(ki(n)||n==-1)return e}}function um(s){return s==32||s==9}function ki(s){return s==10||s==13}function Kx(s){return um(s)||ki(s)}function Ls(s){return s<0||Kx(s)}function Zr(s,t,e=0){return s.peek(e)==t&&s.peek(e+1)==t&&s.peek(e+2)==t&&Ls(s.peek(e+3))}function FT(s){return s>32&&s<127&&s!=34&&s!=37&&s!=44&&s!=60&&s!=62&&s!=92&&s!=94&&s!=96&&s!=123&&s!=124&&s!=125}function Jx(s){return s>=48&&s<=57||s>=97&&s<=102||s>=65&&s<=70}function tS(s,t){return s.next==37?(s.advance(),Jx(s.next)&&s.advance(),Jx(s.next)&&s.advance(),!0):FT(s.next)||t&&s.next==44?(s.advance(),!0):!1}function eS(s){if(s.advance(),s.next==60){for(s.advance();;)if(!tS(s,!0)){s.next==62&&s.advance();break}}else for(;tS(s,!1););}function dm(s){for(s.advance();!Ls(s.next)&&oc(s.next)!="f";)s.advance()}function fm(s,t){let e=s.next,i=!1,n=s.pos;for(s.advance();;){let r=s.next;if(r<0)break;if(s.advance(),r==e)if(r==39)if(s.next==39)s.advance();else break;else break;else if(r==92&&e==34)s.next>=0&&s.advance();else if(ki(r)){if(t)return!1;i=!0}else if(t&&s.pos>=n+1024)return!1}return!i}function GT(s){for(let t=[],e=s.pos+1024;;)if(s.next==91||s.next==123)t.push(s.next),s.advance();else if(s.next==39||s.next==34){if(!fm(s,!0))return!1}else if(s.next==93||s.next==125){if(t[t.length-1]!=s.next-2)return!1;if(t.pop(),s.advance(),!t.length)return!0}else{if(s.next<0||s.pos>e||ki(s.next))return!1;s.advance()}}function oc(s){return s<33?"u":s>125?"s":HT[s-33]}function pm(s,t){let e=oc(s);return e!="u"&&!(t&&e=="f")}function iS(s,t,e,i){if(oc(s.next)=="s"||(s.next==63||s.next==58||s.next==45)&&pm(s.peek(1),e))s.advance();else return!1;let n=s.pos;for(;;){let r=s.next,o=0,a=i+1;for(;Kx(r);){if(ki(r)){if(t)return!1;a=0}else a++;r=s.peek(++o)}if(!(r>=0&&(r==58?pm(s.peek(o+1),e):r==35?s.peek(o-1)!=32:pm(r,e)))||!e&&a<=i||a==0&&!e&&(Zr(s,45,o)||Zr(s,46,o)))break;if(t&&oc(r)=="f")return!1;for(let h=o;h>=0;h--)s.advance();if(t&&s.pos>n+1024)return!1}return!0}var Ir,Yx,PT,CT,Ux,ET,Fx,TT,LT,Gx,MT,RT,XT,IT,ZT,DT,Hx,qT,BT,zT,jT,NT,_T,VT,lm,hm,qa,cm,wi,WT,YT,UT,HT,KT,JT,tL,mm,sS=W(()=>{as();We();Ir=63,Yx=64,PT=1,CT=2,Ux=3,ET=4,Fx=5,TT=6,LT=7,Gx=65,MT=66,RT=8,XT=9,IT=10,ZT=11,DT=12,Hx=13,qT=19,BT=20,zT=29,jT=33,NT=34,_T=47,VT=0,lm=1,hm=2,qa=3,cm=4,wi=class{constructor(t,e,i){this.parent=t,this.depth=e,this.type=i,this.hash=(t?t.hash+t.hash<<8:0)+e+(e<<4)+i}};wi.top=new wi(null,-1,VT);WT=new li({start:wi.top,reduce(s,t){return s.type==qa&&(t==BT||t==NT)?s.parent:s},shift(s,t,e,i){if(t==Ux)return new wi(s,Ba(i,i.pos),lm);if(t==Gx||t==Fx)return new wi(s,Ba(i,i.pos),hm);if(t==Ir)return s.parent;if(t==qT||t==jT)return new wi(s,0,qa);if(t==Hx&&s.type==cm)return s.parent;if(t==_T){let n=/[1-9]/.exec(i.read(i.pos,e.pos));if(n)return new wi(s,s.depth+ +n[0],cm)}return s},hash(s){return s.hash}});YT=new at((s,t)=>{if(s.next==-1&&t.canShift(Yx))return s.acceptToken(Yx);let e=s.peek(-1);if((ki(e)||e<0)&&t.context.type!=qa){if(Zr(s,45))if(t.canShift(Ir))s.acceptToken(Ir);else return s.acceptToken(PT,3);if(Zr(s,46))if(t.canShift(Ir))s.acceptToken(Ir);else return s.acceptToken(CT,3);let i=0;for(;s.next==32;)i++,s.advance();(i<t.context.depth||i==t.context.depth&&t.context.type==lm&&(s.next!=45||!Ls(s.peek(1))))&&s.next!=-1&&!ki(s.next)&&s.next!=35&&s.acceptToken(Ir,-i)}},{contextual:!0}),UT=new at((s,t)=>{if(t.context.type==qa){s.next==63&&(s.advance(),Ls(s.next)&&s.acceptToken(LT));return}if(s.next==45)s.advance(),Ls(s.next)&&s.acceptToken(t.context.type==lm&&t.context.depth==Ba(s,s.pos-1)?ET:Ux);else if(s.next==63)s.advance(),Ls(s.next)&&s.acceptToken(t.context.type==hm&&t.context.depth==Ba(s,s.pos-1)?TT:Fx);else{let e=s.pos;for(;;)if(um(s.next)){if(s.pos==e)return;s.advance()}else if(s.next==33)eS(s);else if(s.next==38)dm(s);else if(s.next==42){dm(s);break}else if(s.next==39||s.next==34){if(fm(s,!0))break;return}else if(s.next==91||s.next==123){if(!GT(s))return;break}else{iS(s,!0,!1,0);break}for(;um(s.next);)s.advance();if(s.next==58){if(s.pos==e&&t.canShift(zT))return;let i=s.peek(1);Ls(i)&&s.acceptTokenTo(t.context.type==hm&&t.context.depth==Ba(s,e)?MT:Gx,e)}}},{contextual:!0});HT="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";KT=new at((s,t)=>{if(s.next==33)eS(s),s.acceptToken(DT);else if(s.next==38||s.next==42){let e=s.next==38?IT:ZT;dm(s),s.acceptToken(e)}else s.next==39||s.next==34?(fm(s,!1),s.acceptToken(XT)):iS(s,!1,t.context.type==qa,t.context.depth)&&s.acceptToken(RT)}),JT=new at((s,t)=>{let e=t.context.type==cm?t.context.depth:-1,i=s.pos;t:for(;;){let n=0,r=s.next;for(;r==32;)r=s.peek(++n);if(!n&&(Zr(s,45,n)||Zr(s,46,n))||!ki(r)&&(e<0&&(e=Math.max(t.context.depth+1,n)),n<e))break;for(;;){if(s.next<0)break t;let o=ki(s.next);if(s.advance(),o)continue t;i=s.pos}}s.acceptTokenTo(Hx,i)}),tL=$t({DirectiveName:b.keyword,DirectiveContent:b.attributeValue,"DirectiveEnd DocEnd":b.meta,QuotedLiteral:b.string,BlockLiteralHeader:b.special(b.string),BlockLiteralContent:b.content,Literal:b.content,"Key/Literal Key/QuotedLiteral":b.definition(b.propertyName),"Anchor Alias":b.labelName,Tag:b.typeName,Comment:b.lineComment,": , -":b.separator,"?":b.punctuation,"[ ]":b.squareBracket,"{ }":b.brace}),mm=Nt.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'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!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"\u26A0 DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:WT,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[tL],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[YT,UT,KT,JT,0,1],topRules:{Stream:[0,15]},tokenPrec:0})});var oS={};Ht(oS,{yaml:()=>nS,yamlFrontmatter:()=>rS,yamlLanguage:()=>ac});function nS(){return new ft(ac)}function rS(s){let{language:t,support:e}=s.content instanceof ft?s.content:{language:s.content,support:[]};return new ft(iL.configure({wrap:os(i=>i.name=="FrontmatterContent"?{parser:ac.parser}:i.name=="Body"?{parser:t.parser}:null)}),e)}var eL,ac,iL,aS=W(()=>{sS();ti();Ie();We();as();eL=Nt.deserialize({version:14,states:"!vOQOPOOO]OPO'#C_OhOPO'#C^OOOO'#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d",stateData:"!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~",goto:"vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS",nodeNames:"\u26A0 Document Frontmatter DashLine FrontmatterContent Body",maxTerm:10,skippedNodes:[0],repeatNodeCount:2,tokenData:"$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),ac=he.define({name:"yaml",parser:mm.configure({props:[Ut.add({Stream:s=>{for(let t=s.node.resolve(s.pos,-1);t&&t.to>=s.pos;t=t.parent){if(t.name=="BlockLiteralContent"&&t.from<t.to)return s.baseIndentFor(t);if(t.name=="BlockLiteral")return s.baseIndentFor(t)+s.unit;if(t.name=="BlockSequence"||t.name=="BlockMapping")return s.column(t.firstChild.from,1);if(t.name=="QuotedLiteral")return null;if(t.name=="Literal"){let e=s.column(t.from,1);if(e==s.lineIndent(t.from,1))return e;if(t.to>s.pos)return null}}return null},FlowMapping:Qr({closing:"}"}),FlowSequence:Qr({closing:"]"})}),Ft.add({"FlowMapping FlowSequence":vi,"Item Pair BlockLiteral":(s,t)=>({from:t.doc.lineAt(s.from).to,to:s.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});iL=he.define({name:"yaml-frontmatter",parser:eL.configure({props:[$t({DashLine:b.meta})]})})});function Ms(s,t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=s(t,e);return n?(i(e.update(n)),!0):!1}}function gm(s,t){let e=s.languageDataAt("commentTokens",t,1);return e.length?e[0]:{}}function aL(s,{open:t,close:e},i,n){let r=s.sliceDoc(i-za,i),o=s.sliceDoc(n,n+za),a=/\s*$/.exec(r)[0].length,l=/^\s*/.exec(o)[0].length,h=r.length-a;if(r.slice(h-t.length,h)==t&&o.slice(l,l+e.length)==e)return{open:{pos:i-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let c,u;n-i<=2*za?c=u=s.sliceDoc(i,n):(c=s.sliceDoc(i,i+za),u=s.sliceDoc(n-za,n));let d=/^\s*/.exec(c)[0].length,f=/\s*$/.exec(u)[0].length,p=u.length-f-e.length;return c.slice(d,d+t.length)==t&&u.slice(p,p+e.length)==e?{open:{pos:i+d+t.length,margin:/\s/.test(c.charAt(d+t.length))?1:0},close:{pos:n-f-e.length,margin:/\s/.test(u.charAt(p-1))?1:0}}:null}function lL(s){let t=[];for(let e of s.selection.ranges){let i=s.doc.lineAt(e.from),n=e.to<=i.to?i:s.doc.lineAt(e.to);n.from>i.from&&n.from==e.to&&(n=e.to==i.to+1?i:s.doc.lineAt(e.to-1));let r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=n.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:n.to})}return t}function lc(s,t,e=t.selection.ranges){let i=e.map(r=>gm(t,r.from).block);if(!i.every(r=>r))return null;let n=e.map((r,o)=>aL(t,i[o],r.from,r.to));if(s!=2&&!n.every(r=>r))return{changes:t.changes(e.map((r,o)=>n[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(s!=1&&n.some(r=>r)){let r=[];for(let o=0,a;o<n.length;o++)if(a=n[o]){let l=i[o],{open:h,close:c}=a;r.push({from:h.pos-l.open.length,to:h.pos+h.margin},{from:c.pos-c.margin,to:c.pos+l.close.length})}return{changes:r}}return null}function Om(s,t,e=t.selection.ranges){let i=[],n=-1;t:for(let{from:r,to:o}of e){let a=i.length,l=1e9,h;for(let c=r;c<=o;){let u=t.doc.lineAt(c);if(h==null&&(h=gm(t,u.from).line,!h))continue t;if(u.from>n&&(r==o||o>u.from)){n=u.from;let d=/^\s*/.exec(u.text)[0].length,f=d==u.length,p=u.text.slice(d,d+h.length)==h?d:-1;d<u.text.length&&d<l&&(l=d),i.push({line:u,comment:p,token:h,indent:d,empty:f,single:!1})}c=u.to+1}if(l<1e9)for(let c=a;c<i.length;c++)i[c].indent<i[c].line.text.length&&(i[c].indent=l);i.length==a+1&&(i[a].single=!0)}if(s!=2&&i.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:l,indent:h,empty:c,single:u}of i)(u||!c)&&r.push({from:a.from+h,insert:l+" "});let o=t.changes(r);return{changes:o,selection:t.selection.map(o,1)}}else if(s!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:l}of i)if(a>=0){let h=o.from+a,c=h+l.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}function wc(s={}){return[hc,pS.of(s),L.domEventHandlers({beforeinput(t,e){let i=t.inputType=="historyUndo"?ym:t.inputType=="historyRedo"?uc:null;return i?(t.preventDefault(),i(e)):!1}})]}function cc(s,t){return function({state:e,dispatch:i}){if(!t&&e.readOnly)return!1;let n=e.field(hc,!1);if(!n)return!1;let r=n.pop(s,e,t);return r?(i(r),!0):!1}}function OS(s){return function(t){let e=t.field(hc,!1);if(!e)return 0;let i=s==0?e.done:e.undone;return i.length-(i.length&&!i[0].changes?1:0)}}function dc(s,t,e,i){let n=t+1>e+20?t-e-1:0,r=s.slice(n,t);return r.push(i),r}function dL(s,t){let e=[],i=!1;return s.iterChangedRanges((n,r)=>e.push(n,r)),t.iterChangedRanges((n,r,o,a)=>{for(let l=0;l<e.length;){let h=e[l++],c=e[l++];a>=h&&o<=c&&(i=!0)}}),i}function fL(s,t){return s.ranges.length==t.ranges.length&&s.ranges.filter((e,i)=>e.empty!=t.ranges[i].empty).length===0}function bS(s,t){return s.length?t.length?s.concat(t):s:t}function yS(s,t){if(s.length){let e=s[s.length-1],i=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-pL));return i.length&&i[i.length-1].eq(t)?s:(i.push(t),dc(s,s.length-1,1e9,e.setSelAfter(i)))}else return[De.selection([t])]}function mL(s){let t=s[s.length-1],e=s.slice();return e[s.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function vm(s,t){if(!s.length)return s;let e=s.length,i=Te;for(;e;){let n=gL(s[e-1],t,i);if(n.changes&&!n.changes.empty||n.effects.length){let r=s.slice(0,e);return r[e-1]=n,r}else t=n.mapped,e--,i=n.selectionsAfter}return i.length?[De.selection(i)]:Te}function gL(s,t,e){let i=bS(s.selectionsAfter.length?s.selectionsAfter.map(a=>a.map(t)):Te,e);if(!s.changes)return De.selection(i);let n=s.changes.map(t),r=t.mapDesc(s.changes,!0),o=s.mapped?s.mapped.composeDesc(r):r;return new De(n,j.mapEffects(s.effects,t),o,s.startSelection.map(r),i)}function Dr(s,t){return Q.create(s.ranges.map(t),s.mainIndex)}function qe(s,t){return s.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function ue({state:s,dispatch:t},e){let i=Dr(s.selection,e);return i.eq(s.selection,!0)?!1:(t(qe(s,i)),!0)}function Xs(s,t){return Q.cursor(t?s.to:s.from)}function fc(s,t){return ue(s,e=>e.empty?s.moveByChar(e,t):Xs(e,t))}function Dt(s){return s.textDirectionAt(s.state.selection.main.head)==J.LTR}function wm(s,t,e){let i=t.head,n=s.doc.lineAt(i);return i==(e?n.to:n.from)?i=e?Math.min(s.doc.length,n.to+1):Math.max(0,n.from-1):i=n.from+Ot(n.text,i-n.from,e),Q.cursor(i,e?-1:1)}function vS(s,t){return ue(s,e=>e.empty?wm(s.state,e,t):Xs(e,t))}function pc(s,t){return ue(s,e=>e.empty?s.moveByGroup(e,t):Xs(e,t))}function km(s,t,e){let i=s.state.charCategorizer(t),n=i(e),r=n!=lt.Space;return o=>{let a=i(o);return a!=lt.Space?r&&a==n:(r=!1,!0)}}function kS(s,t,e){let i=s.state.charCategorizer(t.from),n=lt.Space,r=t.from,o=0,a=!1,l=!1,h=!1,c=d=>{if(a)return!1;r+=e?d.length:-d.length;let f=i(d),p;if(f==lt.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(f=-1),n==lt.Space&&(n=f),n!=f)return!1;if(n==lt.Word)if(d.toLowerCase()==d){if(!e&&l)return!1;h=!0}else if(h){if(e)return!1;a=!0}else{if(l&&e&&i(p=s.state.sliceDoc(r,r+1))==lt.Word&&p.toLowerCase()==p)return!1;l=!0}return o++,!0},u=s.moveByChar(t,e,d=>(c(d),c));if(wS&&n==lt.Word&&u.from==t.from+o*(e?1:-1)){let d=Math.min(t.head,u.head),f=Math.max(t.head,u.head),p=s.state.sliceDoc(d,f);if(p.length>1&&/[\u4E00-\uffff]/.test(p)){let m=Array.from(wS.segment(p));if(m.length>1)return e?Q.cursor(t.head+m[1].index,-1):Q.cursor(u.head+m[m.length-1].index,1)}}return u}function $S(s,t){return ue(s,e=>e.empty?kS(s,e,t):Xs(e,t))}function QL(s,t,e){if(t.type.prop(e))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(s.sliceDoc(t.from,t.to)))||t.firstChild}function mc(s,t,e){let i=F(s).resolveInner(t.head),n=e?q.closedBy:q.openedBy;for(let l=t.head;;){let h=e?i.childAfter(l):i.childBefore(l);if(!h)break;QL(s,h,n)?i=h:l=e?h.to:h.from}let r=i.type.prop(n),o,a;return r&&(o=e?Ce(s,i.from,1):Ce(s,i.to,-1))&&o.matched?a=e?o.end.to:o.end.from:a=e?i.to:i.from,Q.cursor(a,e?-1:1)}function PS(s,t){return ue(s,e=>{if(!e.empty)return Xs(e,t);let i=s.moveVertically(e,t);return i.head!=e.head?i:s.moveToLineBoundary(e,t)})}function CS(s){let t=s.scrollDOM.clientHeight<s.scrollDOM.scrollHeight-2,e=0,i=0,n;if(t){for(let r of s.state.facet(L.scrollMargins)){let o=r(s);o?.top&&(e=Math.max(o?.top,e)),o?.bottom&&(i=Math.max(o?.bottom,i))}n=s.scrollDOM.clientHeight-e-i}else n=(s.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:e,marginBottom:i,selfScroll:t,height:Math.max(s.defaultLineHeight,n-5)}}function ES(s,t){let e=CS(s),{state:i}=s,n=Dr(i.selection,o=>o.empty?s.moveVertically(o,t,e.height):Xs(o,t));if(n.eq(i.selection))return!1;let r;if(e.selfScroll){let o=s.coordsAtPos(i.selection.main.head),a=s.scrollDOM.getBoundingClientRect(),l=a.top+e.marginTop,h=a.bottom-e.marginBottom;o&&o.top>l&&o.bottom<h&&(r=L.scrollIntoView(n.main.head,{y:"start",yMargin:o.top-l}))}return s.dispatch(qe(i,n),{effects:r}),!0}function _i(s,t,e){let i=s.lineBlockAt(t.head),n=s.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?i.to:i.from)&&(n=s.moveToLineBoundary(t,e,!1)),!e&&n.head==i.from&&i.length){let r=/^\s*/.exec(s.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&t.head!=i.from+r&&(n=Q.cursor(i.from+r))}return n}function ZS(s,t,e){let i=!1,n=Dr(s.selection,r=>{let o=Ce(s,r.head,-1)||Ce(s,r.head,1)||r.head>0&&Ce(s,r.head-1,1)||r.head<s.doc.length&&Ce(s,r.head+1,-1);if(!o||!o.end)return r;i=!0;let a=o.start.from==r.head?o.end.to:o.end.from;return e?Q.range(r.anchor,a):Q.cursor(a)});return i?(t(qe(s,n)),!0):!1}function qt(s,t){let e=Dr(s.state.selection,i=>{let n=t(i);return Q.range(i.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return e.eq(s.state.selection)?!1:(s.dispatch(qe(s.state,e)),!0)}function Oc(s,t){return qt(s,e=>s.moveByChar(e,t))}function bc(s,t){return qt(s,e=>s.moveByGroup(e,t))}function zS(s,t){return qt(s,e=>kS(s,e,t))}function _S(s,t){return qt(s,e=>s.moveVertically(e,t))}function VS(s,t){return qt(s,e=>s.moveVertically(e,t,CS(s).height))}function ew(s,t){let{state:e}=s,i=e.selection,n=e.selection.ranges.slice();for(let r of e.selection.ranges){let o=e.doc.lineAt(r.head);if(t?o.to<s.state.doc.length:o.from>0)for(let a=r;;){let l=s.moveVertically(a,t);if(l.head<o.from||l.head>o.to){n.some(h=>h.head==l.head)||n.push(l);break}else{if(l.head==a.head)break;a=l}}}return n.length==i.ranges.length?!1:(s.dispatch(qe(e,Q.create(n,n.length-1))),!0)}function Is(s,t){if(s.state.readOnly)return!1;let e="delete.selection",{state:i}=s,n=i.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let l=t(r);l<o?(e="delete.backward",l=yc(s,l,!1)):l>o&&(e="delete.forward",l=yc(s,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=yc(s,o,!1),a=yc(s,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:Q.cursor(o,o<r.head?-1:1)}});return n.changes.empty?!1:(s.dispatch(i.update(n,{scrollIntoView:!0,userEvent:e,effects:e=="delete.selection"?L.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function yc(s,t,e){if(s instanceof L)for(let i of s.state.facet(L.atomicRanges).map(n=>n(s)))i.between(t,t,(n,r)=>{n<t&&r>t&&(t=e?r:n)});return t}function xc(s){let t=[],e=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.from),r=s.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=s.doc.lineAt(i.to-1)),e>=n.number){let o=t[t.length-1];o.to=r.to,o.ranges.push(i)}else t.push({from:n.from,to:r.to,ranges:[i]});e=r.number+1}return t}function dw(s,t,e){if(s.readOnly)return!1;let i=[],n=[];for(let r of xc(s)){if(e?r.to==s.doc.length:r.from==0)continue;let o=s.doc.lineAt(e?r.to+1:r.from-1),a=o.length+1;if(e){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+s.lineBreak});for(let l of r.ranges)n.push(Q.range(Math.min(s.doc.length,l.anchor+a),Math.min(s.doc.length,l.head+a)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:s.lineBreak+o.text});for(let l of r.ranges)n.push(Q.range(l.anchor-a,l.head-a))}}return i.length?(t(s.update({changes:i,scrollIntoView:!0,selection:Q.create(n,s.selection.mainIndex),userEvent:"move.line"})),!0):!1}function mw(s,t,e){if(s.readOnly)return!1;let i=[];for(let r of xc(s))e?i.push({from:r.from,insert:s.doc.slice(r.from,r.to)+s.lineBreak}):i.push({from:r.to,insert:s.lineBreak+s.doc.slice(r.from,r.to)});let n=s.changes(i);return t(s.update({changes:n,selection:s.selection.map(n,e?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}function _L(s,t){if(/\(\)|\[\]|\{\}/.test(s.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=F(s).resolveInner(t),i=e.childBefore(t),n=e.childAfter(t),r;return i&&n&&i.to<=t&&n.from>=t&&(r=i.type.prop(q.closedBy))&&r.indexOf(n.name)>-1&&s.doc.lineAt(i.to).from==s.doc.lineAt(n.from).from&&!/\S/.test(s.sliceDoc(i.to,n.from))?{from:i.to,to:n.from}:null}function vw(s){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{let{from:r,to:o}=n,a=t.doc.lineAt(r),l=!s&&r==o&&_L(t,r);s&&(r=o=(o<=a.to?a:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:r,simulateDoubleBreak:!!l}),c=Ar(h,r);for(c==null&&(c=It(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:r,to:o}=l:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let u=["",zi(t,c)];return l&&u.push(zi(t,h.lineIndent(a.from,-1))),{changes:{from:r,to:o,insert:G.of(u)},range:Q.cursor(r+1+u[1].length)}});return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function jm(s,t){let e=-1;return s.changeByRange(i=>{let n=[];for(let o=i.from;o<=i.to;){let a=s.doc.lineAt(o);a.number>e&&(i.empty||i.to>a.from)&&(t(a,n,i),e=a.number),o=a.to+1}let r=s.changes(n);return{changes:n,range:Q.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}var lS,hS,sL,nL,cS,rL,oL,uS,za,bm,dS,fS,pS,hc,hL,ym,uc,mS,gS,cL,uL,De,Te,pL,OL,Rs,kc,xm,Sm,bL,yL,vL,xL,xS,SS,SL,wL,kL,wS,$L,AL,AS,QS,$m,Am,Qm,gc,TS,LS,MS,RS,XS,IS,DS,PL,Pm,Cm,CL,EL,TL,LL,qS,BS,ML,RL,XL,IL,ZL,jS,NS,Em,Tm,Lm,Mm,WS,YS,US,FS,GS,HS,Rm,Xm,Im,Zm,KS,JS,tw,iw,sw,nw,Dm,vc,DL,qm,rw,Bm,ow,qL,aw,BL,lw,hw,zL,cw,uw,fw,pw,gw,Ow,bw,jL,NL,zm,yw,xw,Sc,Nm,Sw,VL,WL,ww,kw,$c,Ac,$w=W(()=>{Ue();fi();ti();Ie();lS=s=>{let{state:t}=s,e=t.doc.lineAt(t.selection.main.from),i=gm(s.state,e.from);return i.line?hS(s):i.block?uS(s):!1};hS=Ms(Om,0),sL=Ms(Om,1),nL=Ms(Om,2),cS=Ms(lc,0),rL=Ms(lc,1),oL=Ms(lc,2),uS=Ms((s,t)=>lc(s,t,lL(t)),0);za=50;bm=_t.define(),dS=_t.define(),fS=R.define(),pS=R.define({combine(s){return Vt(s,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}}),hc=ht.define({create(){return Rs.empty},update(s,t){let e=t.state.facet(pS),i=t.annotation(bm);if(i){let l=De.fromTransaction(t,i.selection),h=i.side,c=h==0?s.undone:s.done;return l?c=dc(c,c.length,e.minDepth,l):c=yS(c,t.startState.selection),new Rs(h==0?i.rest:c,h==0?c:i.rest)}let n=t.annotation(dS);if((n=="full"||n=="before")&&(s=s.isolate()),t.annotation(dt.addToHistory)===!1)return t.changes.empty?s:s.addMapping(t.changes.desc);let r=De.fromTransaction(t),o=t.annotation(dt.time),a=t.annotation(dt.userEvent);return r?s=s.addChanges(r,o,a,e,t):t.selection&&(s=s.addSelection(t.startState.selection,o,a,e.newGroupDelay)),(n=="full"||n=="after")&&(s=s.isolate()),s},toJSON(s){return{done:s.done.map(t=>t.toJSON()),undone:s.undone.map(t=>t.toJSON())}},fromJSON(s){return new Rs(s.done.map(De.fromJSON),s.undone.map(De.fromJSON))}});hL=hc;ym=cc(0,!1),uc=cc(1,!1),mS=cc(0,!0),gS=cc(1,!0);cL=OS(0),uL=OS(1),De=class s{constructor(t,e,i,n,r){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(t){return new s(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new s(t.changes&&Rt.fromJSON(t.changes),[],t.mapped&&Ye.fromJSON(t.mapped),t.startSelection&&Q.fromJSON(t.startSelection),t.selectionsAfter.map(Q.fromJSON))}static fromTransaction(t,e){let i=Te;for(let n of t.startState.facet(fS)){let r=n(t);r.length&&(i=i.concat(r))}return!i.length&&t.changes.empty?null:new s(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Te)}static selection(t){return new s(void 0,Te,void 0,void 0,t)}};Te=[],pL=200;OL=/^(input\.type|delete)($|\.)/,Rs=class s{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new s(this.done,this.undone):this}addChanges(t,e,i,n,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!i||OL.test(i))&&(!a.selectionsAfter.length&&e-this.prevTime<n.newGroupDelay&&n.joinToEvent(r,dL(a.changes,t.changes))||i=="input.type.compose")?o=dc(o,o.length-1,n.minDepth,new De(t.changes.compose(a.changes),bS(j.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Te)):o=dc(o,o.length,n.minDepth,t),new s(o,Te,e,i)}addSelection(t,e,i,n){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Te;return r.length>0&&e-this.prevTime<n&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&fL(r[r.length-1],t)?this:new s(yS(this.done,t),this.undone,e,i)}addMapping(t){return new s(vm(this.done,t),vm(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=t==0?this.done:this.undone;if(n.length==0)return null;let r=n[n.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):e.selection);if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:bm.of({side:t,rest:mL(n),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let a=n.length==1?Te:n.slice(0,n.length-1);return r.mapped&&(a=vm(a,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:bm.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}};Rs.empty=new Rs(Te,Te);kc=[{key:"Mod-z",run:ym,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:uc,preventDefault:!0},{linux:"Ctrl-Shift-z",run:uc,preventDefault:!0},{key:"Mod-u",run:mS,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gS,preventDefault:!0}];xm=s=>fc(s,!Dt(s)),Sm=s=>fc(s,Dt(s)),bL=s=>fc(s,!0),yL=s=>fc(s,!1);vL=s=>vS(s,!0),xL=s=>vS(s,!1);xS=s=>pc(s,!Dt(s)),SS=s=>pc(s,Dt(s)),SL=s=>pc(s,!0),wL=s=>pc(s,!1);kL=s=>ue(s,t=>t.empty?s.moveByChar(t,!0,e=>km(s,t.head,e)):Xs(t,!0)),wS=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;$L=s=>$S(s,!0),AL=s=>$S(s,!1);AS=s=>ue(s,t=>mc(s.state,t,!Dt(s))),QS=s=>ue(s,t=>mc(s.state,t,Dt(s)));$m=s=>PS(s,!1),Am=s=>PS(s,!0);Qm=s=>ES(s,!1),gc=s=>ES(s,!0);TS=s=>ue(s,t=>_i(s,t,!0)),LS=s=>ue(s,t=>_i(s,t,!1)),MS=s=>ue(s,t=>_i(s,t,!Dt(s))),RS=s=>ue(s,t=>_i(s,t,Dt(s))),XS=s=>ue(s,t=>Q.cursor(s.lineBlockAt(t.head).from,1)),IS=s=>ue(s,t=>Q.cursor(s.lineBlockAt(t.head).to,-1));DS=({state:s,dispatch:t})=>ZS(s,t,!1),PL=({state:s,dispatch:t})=>ZS(s,t,!0);Pm=s=>Oc(s,!Dt(s)),Cm=s=>Oc(s,Dt(s)),CL=s=>Oc(s,!0),EL=s=>Oc(s,!1),TL=s=>qt(s,t=>wm(s.state,t,!0)),LL=s=>qt(s,t=>wm(s.state,t,!1));qS=s=>bc(s,!Dt(s)),BS=s=>bc(s,Dt(s)),ML=s=>bc(s,!0),RL=s=>bc(s,!1),XL=s=>qt(s,t=>s.moveByChar(t,!0,e=>km(s,t.head,e)));IL=s=>zS(s,!0),ZL=s=>zS(s,!1),jS=s=>qt(s,t=>mc(s.state,t,!Dt(s))),NS=s=>qt(s,t=>mc(s.state,t,Dt(s)));Em=s=>_S(s,!1),Tm=s=>_S(s,!0);Lm=s=>VS(s,!1),Mm=s=>VS(s,!0),WS=s=>qt(s,t=>_i(s,t,!0)),YS=s=>qt(s,t=>_i(s,t,!1)),US=s=>qt(s,t=>_i(s,t,!Dt(s))),FS=s=>qt(s,t=>_i(s,t,Dt(s))),GS=s=>qt(s,t=>Q.cursor(s.lineBlockAt(t.head).from)),HS=s=>qt(s,t=>Q.cursor(s.lineBlockAt(t.head).to)),Rm=({state:s,dispatch:t})=>(t(qe(s,{anchor:0})),!0),Xm=({state:s,dispatch:t})=>(t(qe(s,{anchor:s.doc.length})),!0),Im=({state:s,dispatch:t})=>(t(qe(s,{anchor:s.selection.main.anchor,head:0})),!0),Zm=({state:s,dispatch:t})=>(t(qe(s,{anchor:s.selection.main.anchor,head:s.doc.length})),!0),KS=({state:s,dispatch:t})=>(t(s.update({selection:{anchor:0,head:s.doc.length},userEvent:"select"})),!0),JS=({state:s,dispatch:t})=>{let e=xc(s).map(({from:i,to:n})=>Q.range(i,Math.min(n+1,s.doc.length)));return t(s.update({selection:Q.create(e),userEvent:"select"})),!0},tw=({state:s,dispatch:t})=>{let e=Dr(s.selection,i=>{let n=F(s),r=n.resolveStack(i.from,1);if(i.empty){let o=n.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:a}=o;if((a.from<i.from&&a.to>=i.to||a.to>i.to&&a.from<=i.from)&&o.next)return Q.range(a.to,a.from)}return i});return e.eq(s.selection)?!1:(t(qe(s,e)),!0)};iw=s=>ew(s,!1),sw=s=>ew(s,!0),nw=({state:s,dispatch:t})=>{let e=s.selection,i=null;return e.ranges.length>1?i=Q.create([e.main]):e.main.empty||(i=Q.create([Q.cursor(e.main.head)])),i?(t(qe(s,i)),!0):!1};Dm=(s,t,e)=>Is(s,i=>{let n=i.from,{state:r}=s,o=r.doc.lineAt(n),a,l;if(e&&!t&&n>o.from&&n<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,n-o.from))){if(a[a.length-1]==" ")return n-1;let h=It(a,r.tabSize),c=h%Oi(r)||Oi(r);for(let u=0;u<c&&a[a.length-1-u]==" ";u++)n--;l=n}else l=Ot(o.text,n-o.from,t,t)+o.from,l==n&&o.number!=(t?r.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,n-o.from))&&(l=Ot(o.text,l-o.from,!1,!1)+o.from);return l}),vc=s=>Dm(s,!1,!0),DL=s=>Dm(s,!1,!1),qm=s=>Dm(s,!0,!1),rw=(s,t)=>Is(s,e=>{let i=e.head,{state:n}=s,r=n.doc.lineAt(i),o=n.charCategorizer(i);for(let a=null;;){if(i==(t?r.to:r.from)){i==e.head&&r.number!=(t?n.doc.lines:1)&&(i+=t?1:-1);break}let l=Ot(r.text,i-r.from,t)+r.from,h=r.text.slice(Math.min(i,l)-r.from,Math.max(i,l)-r.from),c=o(h);if(a!=null&&c!=a)break;(h!=" "||i!=e.head)&&(a=c),i=l}return i}),Bm=s=>rw(s,!1),ow=s=>rw(s,!0),qL=s=>Is(s,t=>s.moveByChar(t,!0,e=>km(s,t.head,e)).head),aw=s=>Is(s,t=>{let e=s.lineBlockAt(t.head).to;return t.head<e?e:Math.min(s.state.doc.length,t.head+1)}),BL=s=>Is(s,t=>{let e=s.lineBlockAt(t.head).from;return t.head>e?e:Math.max(0,t.head-1)}),lw=s=>Is(s,t=>{let e=s.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),hw=s=>Is(s,t=>{let e=s.moveToLineBoundary(t,!0).head;return t.head<e?e:Math.min(s.state.doc.length,t.head+1)}),zL=({state:s,dispatch:t})=>{if(s.readOnly)return!1;let e=[];for(let i=0,n="",r=s.doc.iter();;){if(r.next(),r.lineBreak||r.done){let o=n.search(/\s+$/);if(o>-1&&e.push({from:i-(n.length-o),to:i}),r.done)break;n=""}else n=r.value;i+=r.value.length}return e.length?(t(s.update({changes:e,userEvent:"delete"})),!0):!1},cw=({state:s,dispatch:t})=>{if(s.readOnly)return!1;let e=s.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:G.of(["",""])},range:Q.cursor(i.from)}));return t(s.update(e,{scrollIntoView:!0,userEvent:"input"})),!0},uw=({state:s,dispatch:t})=>{if(s.readOnly)return!1;let e=s.changeByRange(i=>{if(!i.empty||i.from==0||i.from==s.doc.length)return{range:i};let n=i.from,r=s.doc.lineAt(n),o=n==r.from?n-1:Ot(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Ot(r.text,n-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:s.doc.slice(n,a).append(s.doc.slice(o,n))},range:Q.cursor(a)}});return e.changes.empty?!1:(t(s.update(e,{scrollIntoView:!0,userEvent:"move.character"})),!0)};fw=({state:s,dispatch:t})=>dw(s,t,!1),pw=({state:s,dispatch:t})=>dw(s,t,!0);gw=({state:s,dispatch:t})=>mw(s,t,!1),Ow=({state:s,dispatch:t})=>mw(s,t,!0),bw=s=>{if(s.state.readOnly)return!1;let{state:t}=s,e=t.changes(xc(t).map(({from:n,to:r})=>(n>0?n--:r<t.doc.length&&r++,{from:n,to:r}))),i=Dr(t.selection,n=>{let r;if(s.lineWrapping){let o=s.lineBlockAt(n.head),a=s.coordsAtPos(n.head,n.assoc||1);a&&(r=o.bottom+s.documentTop-a.bottom+s.defaultLineHeight/2)}return s.moveVertically(n,!0,r)}).map(e);return s.dispatch({changes:e,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0},jL=({state:s,dispatch:t})=>(t(s.update(s.replaceSelection(s.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),NL=({state:s,dispatch:t})=>(t(s.update(s.changeByRange(e=>{let i=/^\s*/.exec(s.doc.lineAt(e.from).text)[0];return{changes:{from:e.from,to:e.to,insert:s.lineBreak+i},range:Q.cursor(e.from+i.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);zm=vw(!1),yw=vw(!0);xw=({state:s,dispatch:t})=>{if(s.readOnly)return!1;let e=Object.create(null),i=new gi(s,{overrideIndentation:r=>{let o=e[r];return o??-1}}),n=jm(s,(r,o,a)=>{let l=Ar(i,r.from);if(l==null)return;/\S/.test(r.text)||(l=0);let h=/^\s*/.exec(r.text)[0],c=zi(s,l);(h!=c||a.from<r.from+h.length)&&(e[r.from]=l,o.push({from:r.from,to:r.from+h.length,insert:c}))});return n.changes.empty||t(s.update(n,{userEvent:"indent"})),!0},Sc=({state:s,dispatch:t})=>s.readOnly?!1:(t(s.update(jm(s,(e,i)=>{i.push({from:e.from,insert:s.facet(yi)})}),{userEvent:"input.indent"})),!0),Nm=({state:s,dispatch:t})=>s.readOnly?!1:(t(s.update(jm(s,(e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=It(n,s.tabSize),o=0,a=zi(s,Math.max(0,r-Oi(s)));for(;o<n.length&&o<a.length&&n.charCodeAt(o)==a.charCodeAt(o);)o++;i.push({from:e.from+o,to:e.from+n.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),Sw=s=>(s.setTabFocusMode(),!0),VL=s=>(s.setTabFocusMode(2e3),!0),WL=({state:s,dispatch:t})=>s.selection.ranges.some(e=>!e.empty)?Sc({state:s,dispatch:t}):(t(s.update(s.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),ww=[{key:"Ctrl-b",run:xm,shift:Pm,preventDefault:!0},{key:"Ctrl-f",run:Sm,shift:Cm},{key:"Ctrl-p",run:$m,shift:Em},{key:"Ctrl-n",run:Am,shift:Tm},{key:"Ctrl-a",run:XS,shift:GS},{key:"Ctrl-e",run:IS,shift:HS},{key:"Ctrl-d",run:qm},{key:"Ctrl-h",run:vc},{key:"Ctrl-k",run:aw},{key:"Ctrl-Alt-h",run:Bm},{key:"Ctrl-o",run:cw},{key:"Ctrl-t",run:uw},{key:"Ctrl-v",run:gc}],kw=[{key:"ArrowLeft",run:xm,shift:Pm,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:xS,shift:qS,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:MS,shift:US,preventDefault:!0},{key:"ArrowRight",run:Sm,shift:Cm,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:SS,shift:BS,preventDefault:!0},{mac:"Cmd-ArrowRight",run:RS,shift:FS,preventDefault:!0},{key:"ArrowUp",run:$m,shift:Em,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Rm,shift:Im},{mac:"Ctrl-ArrowUp",run:Qm,shift:Lm},{key:"ArrowDown",run:Am,shift:Tm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xm,shift:Zm},{mac:"Ctrl-ArrowDown",run:gc,shift:Mm},{key:"PageUp",run:Qm,shift:Lm},{key:"PageDown",run:gc,shift:Mm},{key:"Home",run:LS,shift:YS,preventDefault:!0},{key:"Mod-Home",run:Rm,shift:Im},{key:"End",run:TS,shift:WS,preventDefault:!0},{key:"Mod-End",run:Xm,shift:Zm},{key:"Enter",run:zm,shift:zm},{key:"Mod-a",run:KS},{key:"Backspace",run:vc,shift:vc,preventDefault:!0},{key:"Delete",run:qm,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Bm,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:ow,preventDefault:!0},{mac:"Mod-Backspace",run:lw,preventDefault:!0},{mac:"Mod-Delete",run:hw,preventDefault:!0}].concat(ww.map(s=>({mac:s.key,run:s.run,shift:s.shift}))),$c=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:AS,shift:jS},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:QS,shift:NS},{key:"Alt-ArrowUp",run:fw},{key:"Shift-Alt-ArrowUp",run:gw},{key:"Alt-ArrowDown",run:pw},{key:"Shift-Alt-ArrowDown",run:Ow},{key:"Mod-Alt-ArrowUp",run:iw},{key:"Mod-Alt-ArrowDown",run:sw},{key:"Escape",run:nw},{key:"Mod-Enter",run:yw},{key:"Alt-l",mac:"Ctrl-l",run:JS},{key:"Mod-i",run:tw,preventDefault:!0},{key:"Mod-[",run:Nm},{key:"Mod-]",run:Sc},{key:"Mod-Alt-\\",run:xw},{key:"Shift-Mod-k",run:bw},{key:"Shift-Mod-\\",run:DS},{key:"Mod-/",run:lS},{key:"Alt-A",run:cS},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Sw}].concat(kw),Ac={key:"Tab",run:Sc,shift:Nm}});function Vi(s,t=null,e=0){let i=null;return s.between(e,1e9,(n,r,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!i)i=new Qc(n,r,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Qc(i.from,r,i.diagnostic)}}),i}function Aw(s,t){let e=t.pos,i=t.end||e,n=s.state.facet(ei).hideOn(s,e,i);if(n!=null)return n;let r=s.startState.doc.lineAt(t.pos);return!!(s.effects.some(o=>o.is(ja))||s.changes.touchesRange(r.from,Math.max(r.to,i)))}function Qw(s,t){return s.field(Bt,!1)?t:t.concat(j.appendConfig.of(qw))}function Pw(s,t){return{effects:Qw(s,[ja.of(t)])}}function YL(s){let t=s.field(Bt,!1);return t?t.diagnostics.size:0}function FL(s,t,e){let{diagnostics:i}=s.state.field(Bt),n,r=-1,o=-1;i.between(t-(e<0?1:0),t+(e>0?1:0),(l,h,{spec:c})=>{if(t>=l&&t<=h&&(l==h||(t>l||e>0)&&(t<h||e<0)))return n=c.diagnostics,r=l,o=h,!1});let a=s.state.facet(ei).tooltipFilter;return n&&a&&(n=a(n,s.state)),n?{pos:r,end:o,above:s.state.doc.lineAt(r).to<o,create(){return{dom:Ew(s,n)}}}:null}function Ew(s,t){return xt("ul",{class:"cm-tooltip-lint"},t.map(e=>Iw(s,e,!1)))}function KL(s,t,e){let i=[],n=-1;for(let r of s)r.then(o=>{i.push(o),clearTimeout(n),i.length==s.length?t(i):n=setTimeout(()=>t(i),200)},e)}function Rw(s,t){return s?t?(e,i)=>t(s(e,i),i):s:t}function _a(s,t={}){return[ei.of({source:s,config:t}),Mw,qw]}function JL(s){let t=s.plugin(Mw);t&&t.force()}function Xw(s){let t=[];if(s)t:for(let{name:e}of s){for(let i=0;i<e.length;i++){let n=e[i];if(/[a-zA-Z]/.test(n)&&!t.some(r=>r.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push("")}return t}function Iw(s,t,e){var i;let n=e?Xw(t.actions):[];return xt("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},xt("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(s):t.message),(i=t.actions)===null||i===void 0?void 0:i.map((r,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let p=Vi(s.state.field(Bt).diagnostics,t);p&&r.apply(s,p.from,p.to)},{name:h}=r,c=n[o]?h.indexOf(n[o]):-1,u=c<0?h:[h.slice(0,c),xt("u",h.slice(c,c+1)),h.slice(c+1)],d=r.markClass?" "+r.markClass:"";return xt("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:l,onmousedown:l,"aria-label":` Action: ${h}${c<0?"":` (access key "${n[o]})"`}.`},u)}),t.source&&xt("div",{class:"cm-diagnosticSource"},t.source))}function Cc(s,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(s)}</svg>')`}function Ec(s){return Cc(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${s}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}function eM(s){return s=="error"?4:s=="warning"?3:s=="info"?2:1}function Zw(s){let t="hint",e=1;for(let i of s){let n=eM(i.severity);n>e&&(e=n,t=i.severity)}return t}function iM(s,t){let e=i=>{let n=t.getBoundingClientRect();if(!(i.clientX>n.left-10&&i.clientX<n.right+10&&i.clientY>n.top-10&&i.clientY<n.bottom+10)){for(let r=i.target;r;r=r.parentNode)if(r.nodeType==1&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",e),s.state.field(Dw)&&s.dispatch({effects:Um.of(null)})}};window.addEventListener("mousemove",e)}function sM(s,t,e){function i(){let o=s.elementAtHeight(t.getBoundingClientRect().top+5-s.documentTop);s.coordsAtPos(o.from)&&s.dispatch({effects:Um.of({pos:o.from,above:!1,clip:!1,create(){return{dom:Ew(s,e),getCoords:()=>t.getBoundingClientRect()}}})}),t.onmouseout=t.onmousemove=null,iM(s,t)}let{hoverTime:n}=s.state.facet(Lc),r=setTimeout(i,n);t.onmouseout=()=>{clearTimeout(r),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(r),r=setTimeout(i,n)}}function nM(s,t){let e=Object.create(null);for(let n of t){let r=s.lineAt(n.from);(e[r.from]||(e[r.from]=[])).push(n)}let i=[];for(let n in e)i.push(new Tc(e[n]).range(+n));return U.of(i,!0)}function Mc(s={}){return[Lc.of(s),Ym,rM,oM,Dw]}function aM(s,t){let e=s.field(Bt,!1);if(e&&e.diagnostics.size){let i=[],n=[],r=-1;for(let o=U.iter([e.diagnostics]);;o.next()){for(let a=0;a<i.length;a++)(!o.value||o.value.spec.diagnostics.indexOf(i[a])<0)&&(t(i[a],n[a],r),i.splice(a,1),n.splice(a--,1));if(!o.value)break;for(let a of o.value.spec.diagnostics)i.indexOf(a)<0&&(i.push(a),n.push(o.from));r=o.to}}}var Qc,Zs,ja,_m,Cw,Bt,UL,Tw,Vm,Lw,GL,HL,Mw,ei,Wm,Pc,Na,tM,Tc,rM,Ym,Um,Dw,oM,qw,Lc,Bw=W(()=>{fi();Ue();ed();Qc=class{constructor(t,e,i){this.from=t,this.to=e,this.diagnostic=i}},Zs=class s{constructor(t,e,i){this.diagnostics=t,this.panel=e,this.selected=i}static init(t,e,i){let n=i.facet(ei).markerFilter;n&&(t=n(t,i));let r=t.slice().sort((f,p)=>f.from-p.from||f.to-p.to),o=new ye,a=[],l=0,h=i.doc.iter(),c=0,u=i.doc.length;for(let f=0;;){let p=f==r.length?null:r[f];if(!p&&!a.length)break;let m,O;if(a.length)m=l,O=a.reduce((v,x)=>Math.min(v,x.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>u)break;O=p.to,a.push(p),f++}for(;f<r.length;){let v=r[f];if(v.from==m&&(v.to>v.from||v.to==m))a.push(v),f++,O=Math.min(v.to,O);else{O=Math.min(v.from,O);break}}O=Math.min(O,u);let g=!1;if(a.some(v=>v.from==m&&(v.to==O||O==u))&&(g=m==O,!g&&O-m<10)){let v=m-(c+h.value.length);v>0&&(h.next(v),c=m);for(let x=m;;){if(x>=O){g=!0;break}if(!h.lineBreak&&c+h.value.length>x)break;x=c+h.value.length,c+=h.value.length,h.next()}}let y=Zw(a);if(g)o.add(m,m,B.widget({widget:new Wm(y),diagnostics:a.slice()}));else{let v=a.reduce((x,S)=>S.markClass?x+" "+S.markClass:x,"");o.add(m,O,B.mark({class:"cm-lintRange cm-lintRange-"+y+v,diagnostics:a.slice(),inclusiveEnd:a.some(x=>x.to>O)}))}if(l=O,l==u)break;for(let v=0;v<a.length;v++)a[v].to<=l&&a.splice(v--,1)}let d=o.finish();return new s(d,e,Vi(d))}};ja=j.define(),_m=j.define(),Cw=j.define(),Bt=ht.define({create(){return new Zs(B.none,null,null)},update(s,t){if(t.docChanged&&s.diagnostics.size){let e=s.diagnostics.map(t.changes),i=null,n=s.panel;if(s.selected){let r=t.changes.mapPos(s.selected.from,1);i=Vi(e,s.selected.diagnostic,r)||Vi(e,null,r)}!e.size&&n&&t.state.facet(ei).autoPanel&&(n=null),s=new Zs(e,n,i)}for(let e of t.effects)if(e.is(ja)){let i=t.state.facet(ei).autoPanel?e.value.length?Na.open:null:s.panel;s=Zs.init(e.value,i,t.state)}else e.is(_m)?s=new Zs(s.diagnostics,e.value?Na.open:null,s.selected):e.is(Cw)&&(s=new Zs(s.diagnostics,s.panel,e.value));return s},provide:s=>[Sr.from(s,t=>t.panel),L.decorations.from(s,t=>t.diagnostics)]});UL=B.mark({class:"cm-lintRange cm-lintRange-active"});Tw=s=>{let t=s.state.field(Bt,!1);(!t||!t.panel)&&s.dispatch({effects:Qw(s.state,[_m.of(!0)])});let e=Oh(s,Na.open);return e&&e.dom.querySelector(".cm-panel-lint ul").focus(),!0},Vm=s=>{let t=s.state.field(Bt,!1);return!t||!t.panel?!1:(s.dispatch({effects:_m.of(!1)}),!0)},Lw=s=>{let t=s.state.field(Bt,!1);if(!t)return!1;let e=s.state.selection.main,i=Vi(t.diagnostics,null,e.to+1);return!i&&(i=Vi(t.diagnostics,null,0),!i||i.from==e.from&&i.to==e.to)?!1:(s.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},GL=s=>{let{state:t}=s,e=t.field(Bt,!1);if(!e)return!1;let i=t.selection.main,n,r,o,a;return e.diagnostics.between(0,t.doc.length,(l,h)=>{h<i.to&&(n==null||n<l)&&(n=l,r=h),(o==null||l>o)&&(o=l,a=h)}),o==null||n==null&&o==i.from?!1:(s.dispatch({selection:{anchor:n??o,head:r??a},scrollIntoView:!0}),!0)},HL=[{key:"Mod-Shift-m",run:Tw,preventDefault:!0},{key:"F8",run:Lw}],Mw=nt.fromClass(class{constructor(s){this.view=s,this.timeout=-1,this.set=!0;let{delay:t}=s.state.facet(ei);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let s=Date.now();if(s<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-s);else{this.set=!1;let{state:t}=this.view,{sources:e}=t.facet(ei);e.length&&KL(e.map(i=>Promise.resolve(i(this.view))),i=>{this.view.state.doc==t.doc&&this.view.dispatch(Pw(this.view.state,i.reduce((n,r)=>n.concat(r))))},i=>{St(this.view.state,i)})}}update(s){let t=s.state.facet(ei);(s.docChanged||t!=s.startState.facet(ei)||t.needsRefresh&&t.needsRefresh(s))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});ei=R.define({combine(s){return{sources:s.map(t=>t.source).filter(t=>t!=null),...Vt(s.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Rw,tooltipFilter:Rw,needsRefresh:(t,e)=>t?e?i=>t(i)||e(i):t:e,hideOn:(t,e)=>t?e?(i,n,r)=>t(i,n,r)||e(i,n,r):t:e,autoPanel:(t,e)=>t||e})}}});Wm=class extends Ct{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return xt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},Pc=class{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Iw(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Na=class s{constructor(t){this.view=t,this.items=[];let e=n=>{if(!(n.ctrlKey||n.altKey||n.metaKey)){if(n.keyCode==27)Vm(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Xw(r.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==n.keyCode){let l=Vi(this.view.state.field(Bt).diagnostics,r);l&&r.actions[a].apply(t,l.from,l.to)}}else return;n.preventDefault()}},i=n=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(n.target)&&this.moveSelection(r)};this.list=xt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e,onclick:i}),this.dom=xt("div",{class:"cm-panel-lint"},this.list,xt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Vm(this.view)},"\xD7")),this.update()}get selectedIndex(){let t=this.view.state.field(Bt).selected;if(!t)return-1;for(let e=0;e<this.items.length;e++)if(this.items[e].diagnostic==t.diagnostic)return e;return-1}update(){let{diagnostics:t,selected:e}=this.view.state.field(Bt),i=0,n=!1,r=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,l,{spec:h})=>{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let u=-1,d;for(let f=i;f<this.items.length;f++)if(this.items[f].diagnostic==c){u=f;break}u<0?(d=new Pc(this.view,c),this.items.splice(i,0,d),n=!0):(d=this.items[u],u>i&&(this.items.splice(i,u-i),n=!0)),e&&d.diagnostic==e.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),r=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();this.items.length==0&&(this.items.push(new Pc(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let h=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/h:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let i=t;t=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)e();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Bt),i=Vi(e.diagnostics,this.items[t].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Cw.of(i)})}static open(t){return new s(t)}};tM=L.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ec("#d11")},".cm-lintRange-warning":{backgroundImage:Ec("orange")},".cm-lintRange-info":{backgroundImage:Ec("#999")},".cm-lintRange-hint":{backgroundImage:Ec("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});Tc=class extends Yt{constructor(t){super(),this.diagnostics=t,this.severity=Zw(t)}toDOM(t){let e=document.createElement("div");e.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,n=t.state.facet(Lc).tooltipFilter;return n&&(i=n(i,t.state)),i.length&&(e.onmouseover=()=>sM(t,e,i)),e}};rM=ga({class:"cm-gutter-lint",markers:s=>s.state.field(Ym),widgetMarker:(s,t,e)=>{let i=[];return s.state.field(Ym).between(e.from,e.to,(n,r,o)=>{n>e.from&&n<e.to&&i.push(...o.diagnostics)}),i.length?new Tc(i):null}}),Ym=ht.define({create(){return U.empty},update(s,t){s=s.map(t.changes);let e=t.state.facet(Lc).markerFilter;for(let i of t.effects)if(i.is(ja)){let n=i.value;e&&(n=e(n||[],t.state)),s=nM(t.state.doc,n.slice(0))}return s}}),Um=j.define(),Dw=ht.define({create(){return null},update(s,t){return s&&t.docChanged&&(s=Aw(t,s)?null:{...s,pos:t.changes.mapPos(s.pos)}),t.effects.reduce((e,i)=>i.is(Um)?i.value:e,s)},provide:s=>Ss.from(s)}),oM=L.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Cc('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Cc('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Cc('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),qw=[Bt,L.decorations.compute([Bt],s=>{let{selected:t,panel:e}=s.field(Bt);return!t||!e||t.from==t.to?B.none:B.set([UL.range(t.from,t.to)])}),mf(FL,{hideOn:Aw}),tM],Lc=R.define({combine(s){return Vt(s,{hoverTime:300,markerFilter:null,tooltipFilter:null})}})});var Gm={};Ht(Gm,{Compartment:()=>Ri,EditorSelection:()=>Q,EditorState:()=>et,EditorView:()=>L,HighlightStyle:()=>bi,LOAD_TIMEOUT_MS:()=>Fm,LanguageSupport:()=>ft,StateEffect:()=>j,adiaBaseTheme:()=>lM,adiaHighlightStyle:()=>hM,defaultHighlightStyle:()=>Lh,defaultKeymap:()=>$c,drawSelection:()=>bh,highlightActiveLine:()=>yh,highlightActiveLineGutter:()=>wh,history:()=>wc,historyKeymap:()=>kc,importWithTimeout:()=>uM,indentWithTab:()=>Ac,jsonLinter:()=>dM,keymap:()=>He,languages:()=>cM,lineNumbers:()=>Sh,lintGutter:()=>Mc,linter:()=>_a,placeholder:()=>vh,syntaxHighlighting:()=>Th});function uM(s,t){return Promise.race([s(),new Promise((e,i)=>setTimeout(()=>i(new Error(`code-editor: ${t} load timed out after ${Fm}ms`)),Fm))])}function fM(s,t){let e=t.length,i=s.match(/at position (\d+)/);if(i){let o=Math.min(e,Number(i[1]));return{from:o,to:Math.min(e,o+1)}}let n=s.match(/line (\d+) column (\d+)/);if(n){let o=Number(n[1]),a=Number(n[2]),l=0,h=1;for(let u=0;u<t.length&&h<o;u++)t[u]===`
32
+ `&&(h++,l=u+1);let c=Math.min(e,l+Math.max(0,a-1));return{from:c,to:Math.min(e,c+1)}}let r=Math.max(0,e);return{from:Math.max(0,r-1),to:r}}var lM,hM,cM,Fm,dM,Hm=W(()=>{"use strict";Ue();fi();$w();ti();Bw();We();lM=L.theme({"&":{fontFamily:"inherit",fontSize:"inherit",color:"inherit",backgroundColor:"transparent"},".cm-content":{padding:"0",caretColor:"inherit"},".cm-focused":{outline:"none"}}),hM=bi.define([{tag:[b.comment,b.lineComment,b.blockComment,b.docComment],class:"tok-comment"},{tag:[b.keyword,b.controlKeyword,b.modifier,b.operatorKeyword],class:"tok-keyword"},{tag:[b.string,b.character,b.regexp,b.escape,b.special(b.string)],class:"tok-string"},{tag:[b.number,b.integer,b.float],class:"tok-number"},{tag:[b.bool,b.null,b.atom],class:"tok-boolean"},{tag:[b.operator,b.logicOperator,b.arithmeticOperator,b.compareOperator,b.updateOperator,b.definitionOperator],class:"tok-operator"},{tag:[b.punctuation,b.bracket,b.paren,b.brace,b.squareBracket,b.angleBracket,b.separator],class:"tok-punctuation"},{tag:[b.function(b.variableName),b.function(b.propertyName),b.macroName],class:"tok-function"},{tag:[b.variableName,b.local(b.variableName),b.self],class:"tok-variable"},{tag:[b.typeName,b.className,b.namespace],class:"tok-type"},{tag:[b.propertyName,b.labelName,b.definition(b.variableName)],class:"tok-property"},{tag:[b.tagName,b.heading,b.contentSeparator],class:"tok-tag"},{tag:[b.attributeName,b.attributeValue],class:"tok-attribute"},{tag:[b.url,b.link],class:"tok-url"},{tag:[b.invalid,b.deleted],class:"tok-invalid"}]),cM={json:()=>Promise.resolve().then(()=>(xv(),vv)).then(s=>({extension:s.json()})),html:()=>Promise.resolve().then(()=>(Tp(),J0)).then(s=>({extension:s.html()})),javascript:()=>Promise.resolve().then(()=>(kp(),z0)).then(s=>({extension:s.javascript({jsx:!1,typescript:!1})})),css:()=>Promise.resolve().then(()=>(Ff(),Hv)).then(s=>({extension:s.css()})),markdown:()=>Promise.resolve().then(()=>(Wx(),Vx)).then(s=>({extension:s.markdown()})),yaml:()=>Promise.resolve().then(()=>(aS(),oS)).then(s=>({extension:s.yaml()}))},Fm=1e4;dM=_a(s=>{let t=s.state.doc.toString();if(t.trim()==="")return[];try{return JSON.parse(t),[]}catch(e){let i=e instanceof Error?e.message:String(e),{from:n,to:r}=fM(i,t);return[{from:n,to:r,severity:"error",message:i.replace(/^SyntaxError:\s*/,""),source:"json"}]}})});function Gw(s,t){if(!t||t==="/")return s;let e=t.replace(/^\//,"").split("/"),i=s;for(let n of e){if(i==null)return;i=i[n]}return i}function $M(s,t,e){if(!t||t==="/")return;let i=t.replace(/^\//,"").split("/"),n=s;for(let r=0;r<i.length-1;r++){let o=i[r];n[o]==null&&(n[o]={}),n=n[o]}n[i[i.length-1]]=e}var Ic,po,tg=W(()=>{"use strict";Ic={provider:0,controller:1,source:2,action:3,lifecycle:4},po=class{surfaceId;#t=new Map;#e={};#i={};#s=new Map;#n;#r;constructor(t,e,i){this.surfaceId=t,this.#n=e,this.#r=i}get context(){return{surfaceId:this.surfaceId,getElement:t=>this.#r.get(t)||null,getRootElement:()=>this.#n,getModel:t=>t?Gw(this.#e,t):this.#e,setModel:(t,e)=>this.#o(t,e),getDockable:(t,e)=>this.#l(t,e),listDockables:t=>this.#u(t),emit:t=>this.#h(t),getParam:t=>this.#i[t],watchModel:(t,e)=>this.#a(t,e)}}dock(t){this.#t.has(t.id)&&this.undock(t.id);let e=t.dock(this.context);this.#t.set(t.id,{dockable:t,cleanup:typeof e=="function"?e:null})}dockAll(t){let e=[...t].sort((i,n)=>(Ic[i.kind]??9)-(Ic[n.kind]??9));for(let i of e)this.dock(i)}undock(t){let e=this.#t.get(t);e&&(e.cleanup?.(),e.dockable.undock(),this.#t.delete(t))}undockAll(){let t=[...this.#t.entries()].sort((e,i)=>(Ic[i[1].dockable.kind]??9)-(Ic[e[1].dockable.kind]??9));for(let[e]of t)this.undock(e)}undockMany(t){for(let e of t)this.undock(e)}setInitialModel(t){Object.assign(this.#e,t)}setParams(t){Object.assign(this.#i,t)}updateElements(t){this.#r=t}#o(t,e){$M(this.#e,t,e);for(let[i,n]of this.#s)if(t===i||t.startsWith(i+"/"))for(let r of n)r(Gw(this.#e,i))}#a(t,e){return this.#s.has(t)||this.#s.set(t,new Set),this.#s.get(t).add(e),()=>{let i=this.#s.get(t);i?.delete(e),i?.size===0&&this.#s.delete(t)}}#l(t,e){let i=this.#t.get(e);return i&&i.dockable.kind===t?i.dockable:null}#u(t){let e=[];for(let{dockable:i}of this.#t.values())(!t||i.kind===t)&&e.push(i);return e}#h(t){let e=t.target?this.#r.get(t.target):this.#n;e&&e.dispatchEvent(new CustomEvent(t.event,{bubbles:!0,detail:t}))}}});var de,Ds=W(()=>{"use strict";de=class{get kind(){throw new Error("Dockable subclass must define kind")}get id(){throw new Error("Dockable subclass must define id")}dock(t){throw new Error("Dockable subclass must implement dock()")}undock(){}}});var mo,eg=W(()=>{"use strict";Ds();mo=class extends de{kind="controller";id;type;hostId;config;bind;controller=null;#t;constructor(t,e){super(),this.id=t.id,this.type=t.type,this.hostId=t.host,this.config=t.config||{},this.bind=t.bind||null,this.#t=e}async dock(t){let e=t.getElement(this.hostId);if(!e){console.warn(`ControllerDock: host element "${this.hostId}" not found`);return}let i=await this.#t(this.type);if(!i){console.warn(`ControllerDock: unknown controller type "${this.type}"`);return}this.controller=new i(this.config),this.controller.connect(e);let n=[];if(this.bind)for(let[r,o]of Object.entries(this.bind)){if(this.controller.subscribe){let l=this.controller.subscribe(r,h=>{t.setModel(o,h)});l&&n.push(l)}let a=t.getModel(o);a!==void 0&&this.controller.setState&&this.controller.setState(r,a)}return e.controller=this.controller,()=>{e.controller=null,n.forEach(r=>r())}}undock(){this.controller&&(this.controller.disconnect?.(),this.controller=null)}}});var go,ig=W(()=>{"use strict";Ds();go=class extends de{kind="source";id;uri;path;refresh;#t;#e=null;constructor(t,e){super(),this.id=t.id,this.uri=t.uri,this.path=t.path,this.refresh=t.refresh||"once",this.#t=e}dock(t){if(this.#e=t,this.#i(t),this.refresh==="on-focus"){let e=()=>this.#i(t);return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)}if(this.refresh.startsWith("interval:")){let e=parseInt(this.refresh.split(":")[1],10);if(e>0){let i=setInterval(()=>this.#i(t),e);return()=>clearInterval(i)}}if(this.refresh==="stream"){let e=this.#s(t);try{let i=new EventSource(e);return i.onmessage=n=>{try{t.setModel(this.path,JSON.parse(n.data))}catch{}},()=>i.close()}catch{console.warn(`DataSourceDock: stream failed for ${e}`)}}}undock(){this.#e=null}refetch(){this.#e&&this.#i(this.#e)}async#i(t){let e=this.#s(t);try{let i=await this.#t(e,t);i!==void 0&&t.setModel(this.path,i)}catch(i){console.warn(`DataSourceDock: fetch failed for ${e}`,i)}}#s(t){return this.uri.replace(/\{(\w+)\}/g,(e,i)=>t.getParam(i)??t.getModel("/"+i)??"")}}});var Zc,Oo,sg=W(()=>{"use strict";Ds();Zc={press:"click",submit:"submit",input:"input",change:"change",select:"select",toggle:"change",dismiss:"close",navigate:"click",mount:"connectedCallback",unmount:"disconnectedCallback",focus:"focusin",blur:"focusout",drag:"dragstart",drop:"drop"},Oo=class extends de{kind="action";id;event;handler;config;onSuccess;onError;#t;constructor(t,e){super(),this.event=t.event,this.handler=t.handler,this.config=t.config||{},this.onSuccess=t.onSuccess||null,this.onError=t.onError||null,this.#t=e,this.id=`action:${this.event.event}:${this.event.target||"root"}:${this.handler}`}dock(t){let e=this.event.target?t.getElement(this.event.target):t.getRootElement();if(!e){console.warn(`ActionDock: target "${this.event.target}" not found`);return}let i=Zc[this.event.event]||this.event.event,n=this.#t(this.handler);if(!n){console.warn(`ActionDock: unknown handler "${this.handler}"`);return}let r=async o=>{if(this.event.condition){let a=t.getModel(this.event.condition.path);if("equals"in this.event.condition&&a!==this.event.condition.equals||"notEquals"in this.event.condition&&a===this.event.condition.notEquals||"exists"in this.event.condition&&this.event.condition.exists&&a==null)return}try{let a=await n(this.config,t,o);if(this.onSuccess)for(let l of this.onSuccess){let h=this.#t(l.handler);h&&await h(l.config||{},t,a)}}catch(a){if(this.onError)for(let l of this.onError){let h=this.#t(l.handler);h&&await h(l.config||{},t,a)}else console.error(`ActionDock: handler "${this.handler}" failed`,a)}};if(this.event.debounce>0){let o=r,a;r=(...l)=>{clearTimeout(a),a=setTimeout(()=>o(...l),this.event.debounce)}}if(this.event.throttle>0){let o=r,a=0;r=(...l)=>{let h=Date.now();h-a>=this.event.throttle&&(a=h,o(...l))}}return e.addEventListener(i,r),()=>e.removeEventListener(i,r)}undock(){}}});var bo,ng=W(()=>{"use strict";Ds();bo=class extends de{kind="provider";id;hostId;value;constructor(t){super(),this.id=`provider:${t.name}`,this.hostId=t.host||null,this.value=t.value??null}dock(t){let e=this.hostId?t.getElement(this.hostId):t.getRootElement();if(!e){console.warn(`ProviderDock: host "${this.hostId}" not found`);return}let i=document.createElement("a2ui-provider");return i.setAttribute("name",this.id.replace("provider:","")),i.value=this.value,e.parentNode?.insertBefore(i,e),i.appendChild(e),()=>{i.parentNode&&(i.parentNode.insertBefore(e,i),i.remove())}}undock(){}}});var yo,rg=W(()=>{"use strict";Ds();yo=class extends de{kind="lifecycle";id="lifecycle";onMount;onUnmount;onModelChange;#t;#e=null;constructor(t,e){super(),this.onMount=t.onMount||[],this.onUnmount=t.onUnmount||[],this.onModelChange=t.onModelChange||[],this.#t=e}dock(t){this.#e=t;for(let i of this.onMount)this.#i(i,t);let e=this.onModelChange.map(i=>{let n=()=>this.#i(i,t);if(i.debounce>0){let r=n,o;n=()=>{clearTimeout(o),o=setTimeout(r,i.debounce)}}return t.watchModel(i.path,n)});return()=>e.forEach(i=>i())}undock(){if(this.#e){for(let t of this.onUnmount)this.#i(t,this.#e);this.#e=null}}async#i(t,e){let i=this.#t(t.handler);if(i)try{await i(t.config||{},e)}catch(n){console.warn(`LifecycleDock: ${t.handler} failed`,n)}}}});var Hw,fe,qs=W(()=>{"use strict";Hw=new WeakSet,fe=class s{#t=null;#e=new Set;get host(){return this.#t}connect(t){let e=this.constructor;!Hw.has(e)&&e!==s&&(Hw.add(e),e.schema||console.warn(`AdiaUI: ${e.name} extends BaseController without static schema`),this.getState===s.prototype.getState&&console.error(`AdiaUI: ${e.schema?.name??e.name} must implement getState()`)),this.#t&&this.#t!==t&&console.warn(`AdiaUI: ${e.schema?.name??e.name} already connected to a different host`),this.#t=t,this.onConnect(t),this.reflect()}disconnect(t){let e=t??this.#t;e&&(this.onDisconnect(e),this.#t=null)}subscribe(t){return this.#e.add(t),()=>this.#e.delete(t)}notify(){this.reflect();for(let t of this.#e)t()}onConnect(t){}onDisconnect(t){}reflect(){}getState(){throw new Error(`${this.constructor.schema?.name??this.constructor.name}: getState() not implemented`)}}});var Kw={};Ht(Kw,{FormController:()=>og});var og,Jw=W(()=>{"use strict";qs();og=class extends fe{static schema=Object.freeze({name:"form",state:{values:"object",errors:"object",dirty:"boolean",valid:"boolean"},commands:["set","validate","reset","setInitial"],attributes:["data-form-valid","data-form-invalid","data-form-dirty"]});#t={};#e={};#i={};#s={};constructor(t={}){super(),this.#t={...t},this.#e={...t}}onDisconnect(t){t.removeAttribute("data-form-valid"),t.removeAttribute("data-form-invalid"),t.removeAttribute("data-form-dirty")}getState(){let t=Object.keys(this.#e).some(i=>this.#e[i]!==this.#t[i]),e=Object.keys(this.#i).length===0;return{values:{...this.#e},errors:{...this.#i},dirty:t,valid:e}}reflect(){if(!this.host)return;let{dirty:t,valid:e}=this.getState();e?(this.host.setAttribute("data-form-valid",""),this.host.removeAttribute("data-form-invalid")):(this.host.setAttribute("data-form-invalid",""),this.host.removeAttribute("data-form-valid")),t?this.host.setAttribute("data-form-dirty",""):this.host.removeAttribute("data-form-dirty")}#n(t){let e=this.#s[t];if(!e){delete this.#i[t];return}let i=e(this.#e[t]);i===!0||i==null?delete this.#i[t]:this.#i[t]=typeof i=="string"?i:"Invalid"}commands={set:(t,e)=>{this.#e[t]=e,this.#n(t),this.notify()},validate:(t,e)=>{this.#s[t]=e,this.#n(t),this.notify()},reset:()=>{this.#e={...this.#t},this.#i={};for(let t of Object.keys(this.#s))this.#n(t);this.notify()},setInitial:t=>{this.#t={...t}}}}});var tk={};Ht(tk,{DataStreamController:()=>ag});var ag,ek=W(()=>{"use strict";qs();ag=class extends fe{static schema=Object.freeze({name:"data-stream",state:{data:"array",status:"string",error:"string"},commands:["push","pushMany","connect","poll","consume","stop","clear"],attributes:["data-stream-status"]});#t=[];#e;#i="idle";#s=null;#n=null;#r=0;#o=1;#a=null;#l=0;constructor({max:t=100,throttle:e=0,sample:i=1,initial:n=[]}={}){super(),this.#e=t,this.#r=e,this.#o=Math.max(1,Math.round(i)),this.#t=n.slice(-t)}getState(){return{data:this.#t,status:this.#i,error:this.#s}}reflect(){this.host&&this.host.setAttribute("data-stream-status",this.#i)}onDisconnect(){this.commands.stop()}#u(t){this.#l++,!(this.#o>1&&this.#l%this.#o!==0)&&(this.#t.push(t),this.#t.length>this.#e&&(this.#t=this.#t.slice(-this.#e)),this.#c())}#h(t){if(this.#o>1){let e=[];for(let i of t)this.#l++,this.#l%this.#o===0&&e.push(i);this.#t.push(...e)}else this.#t.push(...t);this.#t.length>this.#e&&(this.#t=this.#t.slice(-this.#e)),this.#c()}#c(){if(this.#r<=0){this.notify();return}this.#a===null&&(this.#a=setTimeout(()=>{this.#a=null,this.notify()},this.#r))}#d(t,e=null){this.#i=t,this.#s=e,this.notify()}commands={push:t=>{this.#u(t)},pushMany:t=>{this.#h(t)},connect:(t,e)=>{this.commands.stop(),this.#n=new AbortController,t==="sse"?this.#f(e):t==="ws"?this.#p(e):this.#d("error",`Unknown stream type: ${t}`)},poll:(t,e=2e3)=>{this.commands.stop(),this.#n=new AbortController,this.#g(t,e)},consume:t=>{this.commands.stop(),this.#n=new AbortController,this.#O(t)},stop:()=>{this.#n&&(this.#n.abort(),this.#n=null),this.#a!==null&&(clearTimeout(this.#a),this.#a=null),(this.#i==="streaming"||this.#i==="connecting")&&this.#d("stopped")},clear:()=>{this.#t=[],this.notify()}};#f(t){this.#d("connecting");let e=new EventSource(t),i=this.#n.signal;i.addEventListener("abort",()=>e.close()),e.onopen=()=>this.#d("streaming"),e.onmessage=n=>{try{let r=JSON.parse(n.data);this.#u(r)}catch{}},e.onerror=()=>{i.aborted||(this.#d("error","SSE connection lost"),e.close())}}#p(t){this.#d("connecting");let e=new WebSocket(t),i=this.#n.signal;i.addEventListener("abort",()=>e.close()),e.onopen=()=>this.#d("streaming"),e.onmessage=n=>{try{let r=JSON.parse(n.data);Array.isArray(r)?this.#h(r):this.#u(r)}catch{}},e.onerror=()=>{i.aborted||this.#d("error","WebSocket error")},e.onclose=()=>{i.aborted||this.#d("stopped")}}async#g(t,e){this.#d("streaming");let i=this.#n.signal;for(;!i.aborted;){try{let r=await(await fetch(t,{signal:i})).json();Array.isArray(r)?this.#h(r):this.#u(r)}catch(n){if(i.aborted)break;this.#d("error",n.message);break}await new Promise(n=>setTimeout(n,e))}}async#O(t){this.#d("streaming");let e=this.#n.signal;try{for await(let i of t){if(e.aborted)break;Array.isArray(i)?this.#h(i):this.#u(i)}e.aborted||this.#d("idle")}catch(i){e.aborted||this.#d("error",i.message)}}}});var ik={};Ht(ik,{SelectionController:()=>lg});var lg,sk=W(()=>{"use strict";qs();lg=class extends fe{static schema=Object.freeze({name:"selection",state:{selected:"Set",multiple:"boolean"},commands:["select","deselect","toggle","clear","selectAll"],attributes:["data-selection-active","data-selection-selected"]});#t=new Set;#e=!1;constructor({multiple:t=!1,initial:e=[]}={}){super(),this.#e=t;for(let i of e)this.#t.add(String(i))}onConnect(t){t.setAttribute("data-selection-active","")}onDisconnect(t){this.#i(t),t.removeAttribute("data-selection-active")}getState(){return{selected:new Set(this.#t),multiple:this.#e}}reflect(){if(!this.host)return;let t=this.host.querySelectorAll("[data-selection-key]");for(let e of t){let i=e.getAttribute("data-selection-key");this.#t.has(i)?e.setAttribute("data-selection-selected",""):e.removeAttribute("data-selection-selected")}}#i(t){let e=t.querySelectorAll("[data-selection-selected]");for(let i of e)i.removeAttribute("data-selection-selected")}commands={select:t=>{t=String(t),this.#e||this.#t.clear(),this.#t.add(t),this.notify()},deselect:t=>{this.#t.delete(String(t)),this.notify()},toggle:t=>{t=String(t),this.#t.has(t)?this.#t.delete(t):(this.#e||this.#t.clear(),this.#t.add(t)),this.notify()},clear:()=>{this.#t.clear(),this.notify()},selectAll:t=>{if(this.#e){for(let e of t)this.#t.add(String(e));this.notify()}}}}});var nk={};Ht(nk,{ToggleController:()=>hg});var hg,rk=W(()=>{"use strict";qs();hg=class extends fe{static schema=Object.freeze({name:"toggle",state:{on:"boolean"},commands:["toggle","set"],attributes:["data-toggle-on"]});#t=!1;constructor(t=!1){super(),this.#t=t}getState(){return{on:this.#t}}onDisconnect(t){t.removeAttribute("data-toggle-on")}reflect(){this.host&&(this.#t?this.host.setAttribute("data-toggle-on",""):this.host.removeAttribute("data-toggle-on"))}commands={toggle:()=>{this.#t=!this.#t,this.notify()},set:t=>{this.#t=!!t,this.notify()}}}});var ok={};Ht(ok,{AccordionController:()=>cg});var cg,ak=W(()=>{"use strict";qs();cg=class extends fe{static schema=Object.freeze({name:"accordion",state:{expanded:"Set",multiple:"boolean"},commands:["toggle","expand","collapse","collapseAll","expandAll"],attributes:["data-accordion-expanded"]});#t=new Set;#e=!1;constructor({multiple:t=!1,initial:e=[]}={}){super(),this.#e=t;for(let i of e)this.#t.add(String(i))}onDisconnect(t){let e=t.querySelectorAll("[data-accordion-expanded]");for(let i of e)i.removeAttribute("data-accordion-expanded")}getState(){return{expanded:new Set(this.#t),multiple:this.#e}}reflect(){if(!this.host)return;let t=this.host.querySelectorAll("[data-accordion-key]");for(let e of t){let i=e.getAttribute("data-accordion-key");this.#t.has(i)?e.setAttribute("data-accordion-expanded",""):e.removeAttribute("data-accordion-expanded")}}commands={toggle:t=>{t=String(t),this.#t.has(t)?this.#t.delete(t):(this.#e||this.#t.clear(),this.#t.add(t)),this.notify()},expand:t=>{t=String(t),this.#e||this.#t.clear(),this.#t.add(t),this.notify()},collapse:t=>{this.#t.delete(String(t)),this.notify()},collapseAll:()=>{this.#t.clear(),this.notify()},expandAll:t=>{if(this.#e){for(let e of t)this.#t.add(String(e));this.notify()}}}}});var lk={};Ht(lk,{StateMachineController:()=>ug});var ug,hk=W(()=>{"use strict";qs();ug=class extends fe{static schema={name:"state-machine",state:{current:"string",history:"string[]"},commands:["send","transition","reset"],attributes:["data-state"],config:{initial:"string",states:"object"}};#t="";#e="";#i={};#s=[];onConnect(t){let e=this.config||{};this.#e=e.initial||t.dataset?.initial||Object.keys(e.states||{})[0]||"",this.#i=this._validateStates(e.states||{}),this.#t=this.#e,this.#s=this.#t?[this.#t]:[],this.#t&&this._emit("stateEntered",{state:this.#t,initial:!0})}getState(){return{current:this.#t,history:[...this.#s]}}reflect(){this.host&&(this.#t?this.host.setAttribute("data-state",this.#t):this.host.removeAttribute("data-state"))}commands={send:t=>{if(!t||!this.#t)return;let i=(this.#i[this.#t]?.on||{})[t];i&&this._moveTo(i,{event:t})},transition:t=>{!t||!(t in this.#i)||this._moveTo(t,{forced:!0})},reset:()=>{this.#e&&this._moveTo(this.#e,{reset:!0})}};_moveTo(t,e){if(t===this.#t)return;let i=this.#t;i&&this._emit("stateExited",{state:i,target:t,...e}),this.#t=t,this.#s.push(t),this.notify(),this._emit("stateEntered",{state:t,from:i,...e})}_emit(t,e){this.host&&this.host.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e}))}_validateStates(t){let e={},i=Object.keys(t);for(let n of i){let r=t[n]||{},o={};for(let[a,l]of Object.entries(r.on||{})){if(typeof l!="string"||!(l in t)){console.warn(`[state-machine] state "${n}" transition "${a}" \u2192 "${l}" \u2014 target not declared`);continue}o[a]=l}e[n]={on:o}}return e}}});function ck(s,t){Ai.controllers.set(s,t)}function uk(s,t){Ai.handlers.set(s,t)}function dk(s,t){Ai.resolvers.set(s,t)}async function Dc(s){let t=Ai.controllers.get(s);return t?t():null}function qc(s){return Ai.handlers.get(s)||null}async function Wa(s,t={}){let e=s;for(let[o,a]of Object.entries(t))e=e.replace(`{${o}}`,encodeURIComponent(a));let i=e.indexOf("://");if(i===-1)throw new Error(`Invalid URI: ${s}`);let n=e.slice(0,i),r=Ai.resolvers.get(n);if(!r)throw new Error(`No resolver for scheme "${n}"`);return r(e,t)}async function AM(s){let{action:t,params:e}=s,i=dg(t.body,s),n=t.uri;for(let[c,u]of Object.entries(e))n=n.replace(`{${c}}`,encodeURIComponent(u));let r=n.indexOf("://"),o=r>-1?n.slice(0,r):"api",a=Ai.resolvers.get(o),l=n.replace(/^\w+:\/\//,"/api/"),h=await fetch(l,{method:t.method||"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!h.ok){let c=await h.text().catch(()=>"Request failed");throw new Error(c)}return h.json().catch(()=>({}))}async function QM(s){let{action:t}=s,e=dg(t.value,s);s.updateModel(t.path,e)}async function PM(s){let{action:t,params:e}=s,i=t.navigate||t.path||"";for(let[n,r]of Object.entries(e))i=i.replace(`{${n}}`,encodeURIComponent(r));i==="back"?history.back():i&&(location.hash=i)}async function CM(){history.back()}async function EM(s){let{action:t,controllers:e}=s,i=e[t.controllerId];if(!i?.commands?.[t.command]){console.warn(`Wiring: controller "${t.controllerId}" or command "${t.command}" not found`);return}return i.commands[t.command](t.args)}async function TM(s){let{action:t,source:e}=s,i=dg(t.detail,s);e.dispatchEvent(new CustomEvent(t.eventName||t.event,{bubbles:!0,detail:i}))}async function LM(s){let t=s.action.sourceId;return document.dispatchEvent(new CustomEvent("a2ui-refresh-source",{detail:{sourceId:t}})),{refreshSource:t}}async function MM(s){let{action:t}=s,e=typeof t=="string"?t:t.message||t.notify;document.dispatchEvent(new CustomEvent("a2ui-notify",{bubbles:!0,detail:{message:e,variant:t.variant||"info"}}))}function dg(s,t){if(s){if(typeof s!="object")return s;switch(s.from){case"event-detail":return s.key?t.event?.detail?.[s.key]:t.event?.detail;case"event-target":return s.key?t.source?.[s.key]:t.source?.value;case"model":return RM(t.dataModel,s.path);case"literal":return s.value;case"param":return t.params?.[s.key];default:return s}}}function RM(s,t){if(!t||!s)return;let e=t.split("/").filter(Boolean),i=s;for(let n of e){if(i==null||typeof i!="object")return;i=i[n]}return i}async function XM(s,t){let e=s.replace(/^resource:\/\//,"/api/"),i=await fetch(e);if(!i.ok)throw new Error(`Resource fetch failed: ${i.status}`);return i.json()}async function IM(s,t){let e=s.replace(/^api:\/\//,"https://"),i=await fetch(e);if(!i.ok)throw new Error(`API fetch failed: ${i.status}`);return i.json()}async function ZM(s,t){return{_source:s,_mock:!0}}var Ai,fg=W(()=>{"use strict";Ai={controllers:new Map([["FormController",async()=>(await Promise.resolve().then(()=>(Jw(),Kw))).FormController],["DataStreamController",async()=>(await Promise.resolve().then(()=>(ek(),tk))).DataStreamController],["SelectionController",async()=>(await Promise.resolve().then(()=>(sk(),ik))).SelectionController],["ToggleController",async()=>(await Promise.resolve().then(()=>(rk(),nk))).ToggleController],["AccordionController",async()=>(await Promise.resolve().then(()=>(ak(),ok))).AccordionController],["StateMachineController",async()=>(await Promise.resolve().then(()=>(hk(),lk))).StateMachineController]]),handlers:new Map([["submit-resource",AM],["update-model",QM],["navigate",PM],["navigate-back",CM],["controller-command",EM],["emit-event",TM],["refresh-source",LM],["notify",MM]]),resolvers:new Map([["resource",XM],["api",IM],["mock",ZM]])}});function DM(s){return async(t,e,i)=>{let n={action:t,event:i instanceof Event?i:null,source:i instanceof Event?i.target:null,dataModel:e.getModel(),updateModel:(r,o)=>e.setModel(r,o),controllers:Object.fromEntries(e.listDockables("controller").map(r=>[r.id,r.controller])),params:{},resolveData:Wa};return s(n)}}function qM(){let s=new Map;return t=>{if(s.has(t))return s.get(t);let e=qc(t);if(!e)return null;let i=DM(e);return s.set(t,i),i}}function BM(){return async s=>Dc(s)}function zM(){return async(s,t)=>Wa(s,{})}function Bc(s){let t=[],e=qM(),i=BM(),n=zM();if(s.data?.sources)for(let o of s.data.sources)t.push(new go(o,n));if(s.state?.controllers)for(let o of s.state.controllers)t.push(new mo(o,i));if(s.actions)for(let o of s.actions)t.push(new Oo(o,e));if(s.provides){let o=Array.isArray(s.provides)?s.provides:[s.provides];for(let a of o)t.push(new bo(a))}s.lifecycle&&t.push(new yo(s.lifecycle,e));let r=s.state?.model||null;return{dockables:t,initialModel:r}}var pg=W(()=>{"use strict";eg();ig();sg();ng();rg();fg()});var fk={};Ht(fk,{WiringEngine:()=>Ya});var Ya,mg=W(()=>{"use strict";tg();pg();Ya=class{#t=new Map;#e;#i;constructor({updateDataModel:t,getElement:e}){this.#e=t,this.#i=e}async process(t){let{surfaceId:e}=t;if(!e)return;let i=this.#t.get(e);i||(i=this.#s(e),this.#t.set(e,i));try{t.data?.params&&i.setParams(this.#n(t.data.params));let{dockables:n,initialModel:r}=Bc(t);r&&i.setInitialModel(r),t.undock&&i.undockMany(t.undock);for(let o of n)await i.dock(o)}catch(n){console.warn(`Wiring: error processing wireComponents for "${e}":`,n.message)}}teardown(t){let e=this.#t.get(t);e&&(e.undockAll(),this.#t.delete(t))}teardownAll(){for(let t of this.#t.keys())this.teardown(t)}getSurface(t){return this.#t.get(t)||null}getSurfaceState(t){let e=this.#t.get(t);if(!e)return null;let i=e.context.listDockables();return{surfaceId:t,controllerCount:i.filter(n=>n.kind==="controller").length,sourceCount:i.filter(n=>n.kind==="source").length,actionCount:i.filter(n=>n.kind==="action").length,providerCount:i.filter(n=>n.kind==="provider").length,hasLifecycle:i.some(n=>n.kind==="lifecycle"),totalDocked:i.length}}#s(t){let e={get:h=>this.#i(t,h),has:h=>!!this.#i(t,h)},i=this.#i(t,"root")||document.createElement("div"),n=new Proxy(new Map,{get(h,c){return c==="get"?u=>e.get(u):c==="has"?u=>e.has(u):h[c]}}),r=new po(t,i,n),o=r.context,a=o.setModel,l=this.#e;return Object.defineProperty(r,"context",{get(){return{...o,setModel(c,u){a(c,u),l(t,c,u)}}}}),r}#n(t){let e={};for(let[i,n]of Object.entries(t))switch(n.from){case"route":{let o=location.hash.slice(1).match(new RegExp(`${n.key}/([^/]+)`));o&&(e[i]=o[1]);break}case"query":{let o=new URL(location.href).searchParams.get(n.key);o&&(e[i]=o);break}case"literal":e[i]=n.value;break;default:typeof n=="string"&&(e[i]=n)}return e}}});var UM=["regular","thin","light","bold","fill","duotone"],Me="regular",Bs=(s,t)=>`${t}:${s}`,Gi=new Map,Fa=new Set;function FM(s,t,e=Me){Gi.set(Bs(s,e),t)}function GM(s,t=Me){for(let[e,i]of Object.entries(s))Gi.set(Bs(e,t),i)}function Qg(s,t=Me){if(!s)return"";let e=Bs(s,t);return Gi.has(e)?Gi.get(e):(Ag(s,t),"")}function HM(s,t=Me){return Gi.has(Bs(s,t))}function KM(){return[...Gi.keys()]}var yg={regular:{},thin:{},light:{},bold:{},fill:{},duotone:{}},vg=new Set(["regular","thin","light","bold","fill","duotone"]),zs=yg;function wk(s){let t=Object.keys(s);if(t.length===0)return!1;for(let e of t)if(vg.has(e))return!1;for(let e of t)if(e.endsWith(".svg"))return!0;return!1}var xg=new WeakSet,Sg=!1,wg,Pg=new Promise(s=>{wg=s});function Ka(s){if(!s||typeof s!="object"){console.error(`[icons] installIconLoaders: expected per-weight map { regular: { ... }, bold: { ... }, ... }, got ${s===null?"null":typeof s}. Install aborted; registry unchanged.`);return}let t=s;if(wk(s))xg.has(s)||(xg.add(s),console.warn(`[icons] installIconLoaders received a flat path\u2192svg map. Auto-promoting to { regular: <flat> }. Wrap explicitly to silence this warning and to load bold/fill/etc. weights:
33
+ installIconLoaders({ regular: import.meta.glob('.../regular/*.svg', { ... }) });`)),t={regular:s};else if(!Object.keys(s).some(i=>vg.has(i))){let i=Object.keys(s).slice(0,5).join(", ");console.error(`[icons] installIconLoaders: shape unrecognized. Expected per-weight map keyed by regular/thin/light/bold/fill/duotone, or a flat path\u2192svg map. Received keys: ${i||"(empty)"}. Install aborted; registry unchanged.`);return}if(zs={...yg,...t},Sg=!0,typeof document<"u")for(let e of document.querySelectorAll("icon-ui[name]")){let i=e.getAttribute("name"),n=e.getAttribute("weight")||Me;i&&Ag(i,n)}wg()}function kk(s){let t=kg();return Ka(s),t}function kg(){let s=new Set;if(typeof customElements>"u")return[];let t=["accordion-ui","agent-questions-ui","agent-reasoning-ui","agent-trace-ui","calendar-picker-ui","color-picker-ui","command-ui","pane-ui","select-ui","table-ui","tag-ui","tree-ui"];for(let e of t){let i=customElements.get(e);if(i&&Array.isArray(i.requiredIcons))for(let n of i.requiredIcons)s.add(n)}return[...s]}kk.discover=kg;var $g=new Set;function $k(s,t){let e=Bs(s,t);if($g.has(e))return;$g.add(e);let i=t!==Me?` at weight="${t}"`:"",n=Ha[s],r=n?` (alias "${s}" \u2192 "${n}" \u2014 also not found)`:"";console.warn(`[icon-ui] Icon "${s}"${i} not found in the registry${r}. Check the name against @phosphor-icons/core, use an alias in ICON_ALIASES, or register a custom SVG via registerIcon().`)}function Ak(s,t){return t==="regular"?`${s}.svg`:`${s}-${t}.svg`}function Ga(s,t=Me){let e=zs[t];if(!e)return null;let i=Ak(s,t),n=`/node_modules/@phosphor-icons/core/assets/${t}/${i}`;if(e[n])return e[n];let r=`/${i}`;for(let o in e)if(o.endsWith(r))return e[o];if(t===Me&&s.endsWith("-fill")){let o=`${s}.svg`,a=`/node_modules/@phosphor-icons/core/assets/fill/${o}`;if(zs.fill[a])return zs.fill[a];let l=`/${o}`;for(let h in zs.fill)if(h.endsWith(l))return zs.fill[h]}return null}function Uc(s,t=Me){if(!s||typeof s!="string")return!1;if(Ga(s,t))return!0;let e=Ha[s];return!!(e&&Ga(e,t))}var Ha={google:"google-logo",github:"github-logo",microsoft:"windows-logo",apple:"apple-logo",twitter:"twitter-logo",facebook:"facebook-logo",discord:"discord-logo",slack:"slack-logo",linkedin:"linkedin-logo",youtube:"youtube-logo",instagram:"instagram-logo",figma:"figma-logo",dribbble:"dribbble-logo",stripe:"stripe-logo",paypal:"paypal-logo","alert-circle":"warning-circle",alert:"warning",error:"x-circle",success:"check-circle",close:"x",delete:"trash",edit:"pencil-simple",save:"floppy-disk",search:"magnifying-glass",settings:"gear",home:"house",mail:"envelope",email:"envelope",phone:"phone",location:"map-pin",calendar:"calendar-blank",time:"clock",user:"user",users:"users-three",menu:"list",more:"dots-three","dots-vertical":"dots-three-vertical",filter:"funnel",inbox:"tray","text-bold":"text-b",bold:"text-b",italic:"text-italic",underline:"text-underline",reset:"arrow-counter-clockwise",undo:"arrow-counter-clockwise",redo:"arrow-clockwise","success-checkmark":"seal-check",circuit:"circuitry",contrast:"circle-half",theme:"circle-half","dark-mode":"moon","light-mode":"sun","alert-triangle":"warning","alert-octagon":"warning-octagon","alert-diamond":"warning-diamond",number:"hash","numbered-list":"list-numbers",numeric:"hash","circle-warning":"warning-circle","circle-x":"x-circle","circle-check":"check-circle","circle-info":"info","circle-question":"question","circle-plus":"plus-circle","circle-minus":"minus-circle",sort:"sort-ascending",refresh:"arrow-clockwise",download:"download-simple",upload:"upload-simple",share:"share-network",copy:"copy-simple",link:"link-simple","external-link":"arrow-square-out","chevron-down":"caret-down","chevron-up":"caret-up","chevron-left":"caret-left","chevron-right":"caret-right","arrow-left":"arrow-left","arrow-right":"arrow-right",plus:"plus",minus:"minus",send:"paper-plane-right",submit:"paper-plane-right",attachment:"paperclip",attach:"paperclip",expand:"arrows-out",collapse:"arrows-in",fullscreen:"arrows-out","exit-fullscreen":"arrows-in",fade:"gradient","fade-presence":"gradient",notification:"bell",notifications:"bell",bookmark:"bookmark-simple",favorite:"heart",like:"heart",comment:"chat-circle",chat:"chat-circle",image:"image",photo:"image",picture:"image",video:"video-camera",camera:"camera",file:"file",document:"file-text",folder:"folder",lock:"lock-simple",unlock:"lock-simple-open","eye-off":"eye-slash",hide:"eye-slash",show:"eye",logout:"sign-out",login:"sign-in",dot:"circle-fill",circle:"circle-fill",marker:"circle-fill"};async function Ag(s,t=Me){let e=Bs(s,t);if(!Fa.has(e)){Fa.add(e);try{let i=Ga(s,t);if(!i&&Ha[s]&&(i=Ga(Ha[s],t)),!i){Fa.delete(e),Sg&&$k(s,t);return}let n=typeof i=="function"?await i():i;Gi.set(e,n);let r=t===Me?`icon-ui[name="${s}"]:not([weight]), icon-ui[name="${s}"][weight="regular"]`:`icon-ui[name="${s}"][weight="${t}"]`;for(let o of document.querySelectorAll(r))o.innerHTML=n}catch{}finally{Fa.delete(e)}}}var Fc,Cg=!1;try{Fc={regular:import.meta.glob("/node_modules/@phosphor-icons/core/assets/regular/*.svg",{query:"?raw",import:"default"}),thin:import.meta.glob("/node_modules/@phosphor-icons/core/assets/thin/*.svg",{query:"?raw",import:"default"}),light:import.meta.glob("/node_modules/@phosphor-icons/core/assets/light/*.svg",{query:"?raw",import:"default"}),bold:import.meta.glob("/node_modules/@phosphor-icons/core/assets/bold/*.svg",{query:"?raw",import:"default"}),fill:import.meta.glob("/node_modules/@phosphor-icons/core/assets/fill/*.svg",{query:"?raw",import:"default"}),duotone:import.meta.glob("/node_modules/@phosphor-icons/core/assets/duotone/*.svg",{query:"?raw",import:"default"})},Cg=!0}catch(s){s&&!(s instanceof ReferenceError)&&console.warn(`[icons-phosphor] import.meta.glob threw an unexpected error (not a vanilla ReferenceError): ${s.message}. Falling back to manifest fetch. If you're using Vite, this likely means a misconfigured plugin order or glob root.`)}Cg?(Object.values(Fc).reduce((t,e)=>t+Object.keys(e).length,0)===0&&console.warn(`[icons-phosphor] No Phosphor icons matched the auto-install glob \`/node_modules/@phosphor-icons/core/assets/<weight>/*.svg\`. This usually means your Vite root sits below node_modules, you use pnpm/yarn-berry virtual paths, or this module is loaded from a published package directory. Install loaders manually from your app entry:
34
+ import { installIconLoaders } from '@adia-ai/web-components/core/icons';
35
+ installIconLoaders({
36
+ regular: import.meta.glob(
37
+ '../node_modules/@phosphor-icons/core/assets/regular/*.svg',
38
+ { query: '?raw', import: 'default', eager: true }
39
+ ),
40
+ });`),Ka(Fc)):import("./icons-manifest.js").then(({default:t})=>{let e=Object.fromEntries(Object.entries(t).map(([i,n])=>{let r=`/node_modules/@phosphor-icons/core/assets/${i}/`,o=n.map(a=>{let l=r+a;return[l,()=>fetch(l).then(c=>c.ok?c.text():Promise.reject(new Error(`icon fetch failed: ${l}`)))]});return[i,Object.fromEntries(o)]}));Ka(e)}).catch(()=>{});var Ja=Symbol("signal"),pe=null,Hi=null,tl=!1;function Eg(s){for(let t of s){if(t.disposed){s.delete(t);continue}t.dirty=!0,Hi||(Hi=new Set,tl||queueMicrotask(Tg)),Hi.add(t)}}function Tg(){let s,t=0;for(;s=Hi;){if(++t>100){Hi=null,console.error("signals: drain loop exceeded 100 iterations");break}Hi=null;for(let e of s)if(!e.disposed&&e.dirty){e.dirty=!1;try{e.run()}catch(i){e.onError?e.onError(i):(e.disposed=!0,queueMicrotask(()=>{throw i}))}}}}function Qk(s){if(tl){s();return}tl=!0;try{s()}finally{tl=!1,Hi&&Tg()}}function Eo(s){let t=pe;pe=null;try{return s()}finally{pe=t}}function Pi(s){let t=new Set;return{[Ja]:!0,get value(){return pe&&t.add(pe),s},set value(e){Object.is(s,e)||(s=e,Eg(t))},peek(){return s}}}function Gc(s){let t=new Set,e,i=!0,n={dirty:!1,disposed:!1,run(){i=!0,Eg(t)}};return{[Ja]:!0,get value(){if(pe&&t.add(pe),i){let r=pe;pe=n;try{e=s(),i=!1}finally{pe=r}}return e},peek(){return e}}}function Ki(s,t){let e={dirty:!1,disposed:!1,host:t?.host??null,onError:t?.onError??null,run(){let i=pe;pe=e;try{s()}finally{pe=i}}};return e.run(),()=>{e.disposed=!0}}function Hc(s){return s!=null&&typeof s=="object"&&s[Ja]===!0}function i2(s,t){customElements.define(s,t)}function w(s,t){return customElements.get(s)?!1:(customElements.define(s,t),!0)}function s2(s){return!!customElements.get(s)}var[Kc,Ns]=[Symbol(),Symbol()];function Kt(s,...t){return{strings:s,values:t}}function Pk(s,...t){let e="";for(let n=0;n<s.length;n++)e+=s[n],n<t.length&&(e+=t[n]);let i=new CSSStyleSheet;return i.replaceSync(e),i}var Lg=new WeakMap;function Ck(s){let t=0,e=0,i=0;for(;i<s.length;){if(t===0&&s.charCodeAt(i)===60&&s.charCodeAt(i+1)===33&&s.charCodeAt(i+2)===45&&s.charCodeAt(i+3)===45){let r=s.indexOf("-->",i+4);if(r===-1){e=0;break}i=r+3,e=0;continue}let n=s.charCodeAt(i);t?n===(t===1?39:34)&&(t=0):n===39?t=1:n===34?t=2:n===60?e=1:n===62&&(e=0),i++}return e===1}function Ek(s){let t=Lg.get(s);if(t)return t;let e="";for(let i=0;i<s.length;i++)e+=s[i],i<s.length-1&&(e+=Ck(e)?`{{p:${i}}}`:`<!--p:${i}-->`);return t=document.createElement("template"),t.innerHTML=e,Lg.set(s,t),t}var Mg={classname:"className",innertext:"innerText",innerhtml:"innerHTML",outerhtml:"outerHTML",textcontent:"textContent",tabindex:"tabIndex",arialabel:"ariaLabel",ariadescribedby:"ariaDescribedBy",arialabelledby:"ariaLabelledBy",ariarole:"role",contenteditable:"contentEditable",readonly:"readOnly",maxlength:"maxLength",minlength:"minLength",colspan:"colSpan",rowspan:"rowSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",usemap:"useMap",ismap:"isMap",accesskey:"accessKey",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",defaultselected:"defaultSelected"};function Rg(s,t){if(Mg[t])return Mg[t];let e=Object.getOwnPropertyNames(s);for(let n=0;n<e.length;n++){let r=e[n];if(r!==t&&r.toLowerCase()===t)return r}let i=Object.getPrototypeOf(s);for(;i&&i!==Object.prototype;){let n=Object.getOwnPropertyNames(i);for(let r=0;r<n.length;r++){let o=n[r];if(o!==t&&o.toLowerCase()===t)return o}i=Object.getPrototypeOf(i)}return t}function js(s,t){let e=t._i;(!e||e.s!==s.strings)&&(e&&il(e.p),e=Tk(s,t),t._i=e),Xk(e.p,s.values)}function Tk(s,t){let{strings:e}=s,n=Ek(e).content.cloneNode(!0),r=Lk(t);r&&(n=Mk(n,r));let o=Rk(n,s.values.length);return t.replaceChildren(n),{s:e,p:o}}var el="http://www.w3.org/2000/svg",To="http://www.w3.org/1998/Math/MathML",Xg="http://www.w3.org/1999/xhtml";function Lk(s){if(!s||s.nodeType!==1)return null;if(s.namespaceURI===el)return el;if(s.namespaceURI===To)return To;if(typeof s.closest!="function")return null;let t=s.closest("svg, math, foreignObject, annotation-xml");if(!t)return null;let e=t.localName;if(e==="foreignobject"||e==="foreignObject")return null;if(e==="annotation-xml"){let i=(t.getAttribute("encoding")||"").toLowerCase();return i==="text/html"||i==="application/xhtml+xml"?null:To}return e==="svg"?el:e==="math"?To:null}function Mk(s,t){let e=document.createDocumentFragment();return Ig(s,e,t),e}function Ig(s,t,e){for(let i of[...s.childNodes])if(i.nodeType===1){let r=document.createElementNS(e,i.localName);for(let l of i.attributes)l.namespaceURI?r.setAttributeNS(l.namespaceURI,l.name,l.value):r.setAttribute(l.name,l.value);t.appendChild(r);let o=i.localName,a=e;if(e===el&&(o==="foreignObject"||o==="foreignobject"))a=Xg;else if(e===To&&o==="annotation-xml"){let l=(i.getAttribute("encoding")||"").toLowerCase();(l==="text/html"||l==="application/xhtml+xml")&&(a=Xg)}Ig(i,r,a)}else t.appendChild(i.cloneNode(!0))}function Rk(s,t){let e=new Array(t),i=document.createTreeWalker(s,129),n;for(;n=i.nextNode();)if(n.nodeType===8){let r=n.data.match(/^p:(\d+)$/);if(r){let o=document.createTextNode("");n.replaceWith(o),i.currentNode=o,e[+r[1]]={t:"n",n:o,c:void 0,_fx:null}}}else if(n.nodeType===1)for(let r of[...n.attributes]){let o=r.value.match(/^\{\{p:(\d+)\}\}$/);if(!o){if(r.value.includes("{{p:")){let h=r.name,c=h==="class"?' class="${expression}" \u2190 full replacement (whole class string is the expression)\n .className=${expression} \u2190 writes to the className property (resolved camelCase since FB-55 fix)\n':h==="style"?' style="${expression}" \u2190 full replacement of the style string\n .style.cssText=${expression} \u2190 write CSS text via the style.cssText accessor\n':` ${h}="\${expression}" \u2190 full replacement (whole attr is the placeholder)
41
+ .${h}=\${expression} \u2190 property assignment (preferred for objects/functions)
42
+ `;console.warn(`[template] Partial attribute interpolation is not supported.
43
+ Element: <${n.tagName.toLowerCase()}>
44
+ Attribute: ${h}="${r.value.slice(0,80)}${r.value.length>80?"\u2026":""}"
45
+ Use one of:
46
+ `+c+" Compute the full attr value as a single expression and interpolate the whole.")}continue}let a=+o[1],l=r.name;l[0]==="@"?(n.removeAttribute(l),e[a]={t:"e",n,name:l.slice(1),c:void 0,_fx:null}):l[0]==="."?(n.removeAttribute(l),e[a]={t:"p",n,name:Rg(n,l.slice(1)),c:void 0,_fx:null,_resolved:!1}):l[0]==="?"?(n.removeAttribute(l),console.warn(`[template] Lit-style boolean attribute "${l}=" is not supported.
47
+ Element: <${n.tagName.toLowerCase()}>
48
+ Use .${l.slice(1)}=\${value} (property binding) instead \u2014 the primitive reflects the property to the DOM attribute for you.
49
+ See USAGE.md \xA7 Template parser \u2014 invariants + unsupported syntaxes.`),e[a]={t:"n",n:document.createTextNode(""),c:void 0,_fx:null}):e[a]={t:"a",n,name:l,c:void 0,_fx:null}}return e}function il(s){for(let t of s)t&&t._fx&&(t._fx(),t._fx=null)}function Jc(s){if(s.n.nodeType===1&&s.n[Kc])return s.n;let t=document.createElement("span");return t.style.display="contents",t[Kc]=!0,s.n.replaceWith(t),s.n=t,t}var Zg=s=>s!=null&&typeof s=="object"&&s.strings,Dg=s=>typeof s=="function"||s!=null&&typeof s.handleEvent=="function";function tu(s,t){if(t!==s.c){if(s.t==="n")if(t!=null&&t._directive)t._commit(Jc(s));else if(Zg(t))js(t,Jc(s));else if(Array.isArray(t)){let e=Jc(s);e.replaceChildren();for(let i of t)if(Zg(i)){let n=document.createElement("span");n.style.display="contents",e.appendChild(n),js(i,n)}else e.appendChild(document.createTextNode(i??""))}else if(t instanceof Node)s.n.replaceWith(t),s.n=t;else if(s.n[Kc]){let e=document.createTextNode(t??"");s.n.replaceWith(e),s.n=e}else s.n.textContent=t??"";else if(s.t==="a")t==null||t===!1?s.n.removeAttribute(s.name):s.n.setAttribute(s.name,t===!0?"":t);else if(s.t==="p"){if(!s._resolved){let e=Rg(s.n,s.name);e!==s.name&&(s.name=e),s._resolved=!0}s.n[s.name]=t}else s.t==="e"&&(Dg(s.c)&&s.n.removeEventListener(s.name,s.c),Dg(t)&&s.n.addEventListener(s.name,t));s.c=t}}function Xk(s,t){for(let e=0;e<s.length;e++){let i=s[e];if(!i)continue;let n=t[e],r=i.t!=="e"&&typeof n=="function",o=!r&&i.t!=="e"&&Hc(n);if(i._fx&&!r&&!o&&(i._fx(),i._fx=null),r){i._fx||(i._fx=Ki(()=>tu(i,n())));continue}if(o){i._fx||(i._fx=Ki(()=>tu(i,n.value)));continue}tu(i,n)}}function Ik(s,t,e){return{_directive:!0,_commit(i){let n=i[Ns]||new Map,r=new Map,o=[];for(let l=0;l<s.length;l++){let h=t(s[l],l);if(r.has(h))continue;o.push(h);let c=e(s[l],l);if(n.has(h)){let u=n.get(h);js(c,u),r.set(h,u)}else{let u=document.createElement("span");u.style.display="contents",js(c,u),r.set(h,u)}}for(let[l,h]of n)r.has(l)||(h._i&&il(h._i.p),h.remove());let a=null;for(let l=o.length-1;l>=0;l--){let h=r.get(o[l]);(h.nextSibling!==a||h.parentNode!==i)&&i.insertBefore(h,a),a=h}i[Ns]=r}}}var sl=new Map,qg=new Set(["input-interaction","keyboard-navigation","forms-data","layout-measurement","motion-positioning","animation-feedback","visual-dynamics","interaction-delight","audio-haptics-sensory"]);function Bg(s){if(!s.name)throw new Error("Trait requires a name");if(!s.setup)throw new Error(`Trait "${s.name}" requires a setup function`);if(!s.category)throw new Error(`Trait "${s.name}" requires a category`);if(!qg.has(s.category))throw new Error(`Trait "${s.name}" has unknown category "${s.category}". Known: ${[...qg].join(", ")}`);if(!s.description)throw new Error(`Trait "${s.name}" requires a description`);let t=Object.freeze({name:s.name,category:s.category,description:s.description,attributes:Object.freeze(s.attributes||[]),events:Object.freeze(s.events||[]),config:Object.freeze(s.config||[])});function e(){let i=null;return{schema:t,connect(n,r){i=s.setup({host:n,...r||{}})},disconnect(n){i&&(i(),i=null);for(let r of t.attributes)n.hasAttribute(r)&&(console.warn(`Trait "${t.name}": attribute "${r}" still present after disconnect`),n.removeAttribute(r))}}}return e.schema=t,sl.set(s.name,e),e}function zg(s){return sl.get(s)||null}function a2(s){return sl.get(s)?.schema||null}function l2(){return[...sl.keys()]}var eu=Symbol(),Lo=Symbol();function Zk(s,t){s[Lo]=new Map,s[eu]=new Map;for(let[e,i]of Object.entries(t)){let n=i.attribute??e.toLowerCase(),r=i.type??String,o=Pi(i.default??void 0);s[eu].set(e,o),Object.defineProperty(s,e,{get(){return o.value},set(a){let l=o.peek();Object.is(l,a)||(s[Lo].set(e,l),o.value=a,i.reflect&&Dk(s,n,a,r))},configurable:!0})}}function Dk(s,t,e,i){i===Boolean?e?s.setAttribute(t,""):s.removeAttribute(t):e==null?s.removeAttribute(t):s.setAttribute(t,String(e))}var qk=(s,t)=>t===Boolean?s!==null:t===Number?s===null?null:+s:s;function Bk(s){if(Object.hasOwn(s,"_sa"))return;s._sa=!0;let t=s.styles;if(!t)return;let e=Array.isArray(t)?t:[t];document.adoptedStyleSheets=[...document.adoptedStyleSheets,...e.filter(i=>!document.adoptedStyleSheets.includes(i))]}function jg(s){if(Object.hasOwn(s,"_pp"))return;s._pp={};let t=s.parts;if(t)for(let[e,i]of Object.entries(t)){let n=document.createElement("template");n.innerHTML=i,s._pp[e]=n.content.firstElementChild}}var A=class extends HTMLElement{static get properties(){return{}}static get traits(){return[]}static get observedAttributes(){let t=Object.entries(this.properties).map(([e,i])=>i.attribute??e.toLowerCase());return t.includes("traits")?t:[...t,"traits"]}#t=[];#e=[];#i=[];#s=null;#n=null;#r=null;#o=Pi(0);constructor(){super(),this.internals=this.attachInternals(),Zk(this,this.constructor.properties)}connectedCallback(){let t=this.constructor;t._tag||(t._tag=this.localName),Bk(t),jg(t),Eo(()=>this.connected()),this.#t.push(Ki(()=>{for(let i of this[eu].values())i.value;this.#o.value;let e=t.template(this);if(e&&js(e,this),this.render(),this[Lo].size){let i=new Map(this[Lo]);this[Lo].clear(),this.updated(i)}},{host:this.localName,onError:this.onError?e=>this.onError(e):null})),this.#r||(this.#r=new Set);for(let e of t.traits)this.#l(e);this.#u(),this.#s&&this.#a()}disconnectedCallback(){this._i&&il(this._i.p);for(let t of this.#t)t();this.#t.length=0;for(let t of this.#i)t.value=void 0;this.#i.length=0;for(let t of this.#e)t.disconnect(this);this.#e.length=0,this.#r?.clear(),this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.disconnected()}#a(){let t=this.#s;t.connect?.(this),this.#n=t.subscribe?.(()=>{this.#o.value++})}get controller(){return this.#s}set controller(t){this.#n?.(),this.#n=null,this.#s?.disconnect?.(this),this.#s=t,t&&this.isConnected&&this.#a()}#l(t,{declarative:e=!1}={}){this.#r.add(t);let i=t();i.connect(this,{host:this,signal:Pi,computed:Gc,effect:Ki}),e&&(i._declarative=!0),this.#e.push(i)}addTrait(t){return this.#r||(this.#r=new Set),this.#r.has(t)?this:(this.#l(t),this)}#u(){let t=this.getAttribute("traits");if(t)for(let e of t.split(/\s+/).filter(Boolean)){let i=zg(e);if(!i){console.warn(`<${this.localName}> traits="${e}" \u2014 trait not found. Did you forget to import it?`);continue}this.#r.has(i)||this.#l(i,{declarative:!0})}}#h(){if(!this.#r)return;let t=[];for(let e of this.#e)if(e._declarative){e.disconnect(this);for(let i of this.#r)if(i.schema?.name&&e.schema?.name===i.schema.name){this.#r.delete(i);break}}else t.push(e);this.#e.length=0,this.#e.push(...t),this.#u()}attributeChangedCallback(t,e,i){if(t==="traits"){this.isConnected&&this.#h();return}for(let[n,r]of Object.entries(this.constructor.properties))if((r.attribute??n.toLowerCase())===t){this[n]=qk(i,r.type??String);break}}static template=()=>null;static create(t={}){let e=this._tag??customElements.getName?.(this);if(!e)throw new Error("Component not registered");let i=document.createElement(e);for(let[n,r]of Object.entries(t))i[n]=r;return i}signal(t){let e=Pi(t);return this.#i.push(e),e}ensure(t){for(let r of this.children)if(r.getAttribute("slot")===t)return r;let e=this.#c(t);if(e)return e;jg(this.constructor);let i=this.constructor._pp?.[t];if(!i)return null;let n=i.cloneNode(!0);return n._uiPart=!0,this.appendChild(n),n}drop(t){for(let i of this.children)if(i.getAttribute("slot")===t){i.remove();return}let e=this.#c(t);e&&e.remove()}#c(t){for(let e of this.querySelectorAll(`[slot="${t}"]`)){let i=e.parentElement,n=!0;for(;i&&i!==this;){if(i.localName.includes("-")){n=!1;break}i=i.parentElement}if(n&&i===this)return e}return null}reconcile(t,e,i,n){let r=t[Ns]||new Map,o=new Map,a=[];for(let h=0;h<e.length;h++){let c=e[h],u=i(c,h);if(o.has(u))continue;let d=r.get(u);d?n(c,h,d):d=n(c,h,null),o.set(u,d),a.push(u)}for(let[h,c]of r)o.has(h)||c.remove();let l=null;for(let h=a.length-1;h>=0;h--){let c=o.get(a[h]);(c.nextSibling!==l||c.parentNode!==t)&&t.insertBefore(c,l),l=c}t[Ns]=o}connected(){}render(){}disconnected(){}updated(t){}};var _s=class extends A{static properties={name:{type:String,default:"",reflect:!0},size:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},weight:{type:String,default:"regular",reflect:!0}};connected(){this.setAttribute("role",this.label?"img":"presentation"),this.label||this.setAttribute("aria-hidden","true")}render(){this.label&&this.setAttribute("aria-label",this.label);let t=Qg(this.name,this.weight||"regular");t&&this.innerHTML!==t&&(this.innerHTML=t),this.size&&this.#t(this.size)?this.style.setProperty("--icon-size",this.#e(this.size)):this.style.getPropertyValue("--icon-size")&&this.style.removeProperty("--icon-size")}#t(t){return/^\d+(\.\d+)?(px|rem|em)?$/.test(t)}#e(t){return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}};w("icon-ui",_s);var zk={plus:["+","\uFF0B"],minus:["-","\u2212","\u2013"],x:["\xD7","x ","X "],check:["\u2713","\u2714"],"arrow-right":["\u2192",">"],"arrow-left":["\u2190","<"]},Vs=class s extends A{static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"solid",reflect:!0},color:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},stretch:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0},type:{type:String,default:"button",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#i),this.addEventListener("keydown",this.#s)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.icon){let t=this.querySelector("icon-ui");if(!t||t.name!==this.icon){t&&t.remove();let e=document.createElement("icon-ui");e.setAttribute("name",this.icon),this.prepend(e)}}if(this.icon&&this.text){let t=zk[this.icon];t&&t.some(e=>this.text.startsWith(e))&&(s.#e.has(this)||(s.#e.add(this),console.warn(`[button-ui] text="${this.text}" begins with a symbol that icon="${this.icon}" already renders \u2014 the glyph appears twice. Drop the leading symbol from text= (the icon provides it).`,this)))}if(this.icon&&!this.text){let t=this.getAttribute("aria-label"),e=this.getAttribute("aria-labelledby"),i=this.getAttribute("title");!t&&!e&&i?this.setAttribute("aria-label",i):!t&&!e&&!i&&(s.#t.has(this)||(s.#t.add(this),console.warn(`[button-ui] Icon-only button is missing an accessible name.
50
+ Element: <button-ui icon="${this.icon}">
51
+ Add one of:
52
+ aria-label="Undo" \u2190 explicit accessible name
53
+ title="Undo" \u2190 auto-mirrored to aria-label + tooltip
54
+ aria-labelledby="..." \u2190 reference an existing label element
55
+ Without an accessible name screen readers announce nothing meaningful.`)))}}static#t=new WeakSet;static#e=new WeakSet;#i=t=>{if(this.disabled){t.stopPropagation();return}if(this.type==="submit"){let e=this.closest("form");e?.requestSubmit&&e.requestSubmit()}else if(this.type==="reset"){let e=this.closest("form");e?.reset&&e.reset()}this.dispatchEvent(new Event("press",{bubbles:!0}))};#s=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.click())};disconnected(){this.removeEventListener("click",this.#i),this.removeEventListener("keydown",this.#s)}};w("button-ui",Vs);var Ws=class extends A{static properties={text:{type:String,default:"",reflect:!0},href:{type:String,default:"",reflect:!0},target:{type:String,default:"",reflect:!0},rel:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},block:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0}};static template=()=>null;#t=t=>{if(this.disabled){t.preventDefault();return}let e={href:this.href,target:this.target},i=new CustomEvent("press",{bubbles:!0,cancelable:!0,detail:e});this.dispatchEvent(i)||t.preventDefault()};#e=t=>{this.disabled&&t.key==="Enter"&&t.preventDefault()};#i(){let t=this.querySelector(":scope > a");t||(t=document.createElement("a"),t.dataset.autostamped="true",this.appendChild(t));let e=[];for(let i of this.childNodes)i!==t&&i.parentNode===this&&e.push(i);for(let i of e)t.appendChild(i);return t}connected(){let t=this.#i();this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e),this.disabled&&this.setAttribute("aria-disabled","true")}render(){let t=this.querySelector(":scope > a");if(!t)return;let e=t.dataset.autostamped==="true";if(e&&(this.href?t.setAttribute("href",this.href):t.removeAttribute("href"),this.target?t.setAttribute("target",this.target):t.removeAttribute("target"),this.rel?t.setAttribute("rel",this.rel):this.target==="_blank"?t.setAttribute("rel","noopener noreferrer"):t.removeAttribute("rel")),this.disabled?(this.setAttribute("aria-disabled","true"),t.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),t.removeAttribute("tabindex")),e){let i=this.icon?`<icon-ui name="${this.icon}"></icon-ui>`:"",n=this.text?`<span>${this.text}</span>`:"";t.innerHTML=`${i}${n}`}}disconnected(){this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}};w("link-ui",Ws);var z=class s extends A{static formAssociated=!0;static get properties(){return{name:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},required:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0},error:{type:String,default:"",reflect:!0},hint:{type:String,default:"",reflect:!0},pattern:{type:String,default:"",reflect:!0},minlength:{type:Number,default:null,reflect:!0},maxlength:{type:Number,default:null,reflect:!0},throttle:{type:Number,default:0,reflect:!0}}}#t=!1;#e=null;#i=void 0;get form(){return this.internals.form}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}syncValue(t){t=t??this.value??"",this.internals.setFormValue(t),this.#s(t)}setValid(){this.internals.setValidity({}),this.removeAttribute("aria-invalid"),this.error&&(this.error="")}setInvalid(t,e){this.internals.setValidity({customError:!0},t||"Invalid",e||this),this.setAttribute("aria-invalid","true"),this.error=t||"Invalid"}validate(){let t=this.#s(this.value??"");return t?(this.removeAttribute("aria-invalid"),this.error&&(this.error="")):(this.setAttribute("aria-invalid","true"),this.error=this.validationMessage),t}scheduleThrottledInput(t=null){let e=Number(this.throttle)||0,i=()=>new CustomEvent("input",{bubbles:!0,detail:t||{value:this.value}});if(e>0){this.#e!=null&&clearTimeout(this.#e),this.#i=this.value,this.#e=setTimeout(()=>{this.#e=null,this.#i=void 0,this.dispatchEvent(i())},e);return}this.dispatchEvent(i())}flushPendingInput(t=null){this.#e!=null&&(clearTimeout(this.#e),this.#e=null,this.#i=void 0,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:t||{value:this.value}})))}dropPendingInput(){this.#e!=null&&(clearTimeout(this.#e),this.#e=null,this.#i=void 0)}#s(t){t=t??this.value??"";let e=String(t);if(this.required&&!e.trim())return this.internals.setValidity({valueMissing:!0},this.getAttribute("data-msg-required")||"This field is required.",this),!1;if(this.pattern&&e)try{if(!new RegExp(`^(?:${this.pattern})$`).test(e))return this.internals.setValidity({patternMismatch:!0},this.getAttribute("data-msg-pattern")||"Please match the requested format.",this),!1}catch{}return this.minlength!=null&&this.minlength>0&&e.length>0&&e.length<this.minlength?(this.internals.setValidity({tooShort:!0},this.getAttribute("data-msg-minlength")||`Please use at least ${this.minlength} characters.`,this),!1):this.maxlength!=null&&this.maxlength>0&&e.length>this.maxlength?(this.internals.setValidity({tooLong:!0},this.getAttribute("data-msg-maxlength")||`Please use no more than ${this.maxlength} characters.`,this),!1):(this.internals.setValidity({}),!0)}#n=t=>{t.preventDefault(),this.setAttribute("aria-invalid","true"),this.error=this.validationMessage};#r=()=>{this.#t=!0,this.error&&this.validate()};#o=()=>{this.#t&&this.validate()};connected(){super.connected(),this.syncValue(),this.addEventListener("invalid",this.#n),this.addEventListener("input",this.#r),this.addEventListener("blur",this.#o,!0),this.#a()}#a(){let t=this.constructor;t.labelDeprecated!==!1&&t.properties?.label&&this.hasAttribute("label")&&(s.#l.has(t)||(s.#l.add(t),console.warn(`[AdiaUI] <${this.localName} label="\u2026"> is deprecated \u2014 wrap in <field-ui label="\u2026"> for proper label association. Docs: https://ui-kit.exe.xyz/site/components/field`)))}static#l=new Set;disconnected(){super.disconnected(),this.removeEventListener("invalid",this.#n),this.removeEventListener("input",this.#r),this.removeEventListener("blur",this.#o,!0),this.dropPendingInput()}formResetCallback(){this.#t=!1,this.setValid(),this.onFormReset()}formDisabledCallback(t){this.disabled=t,this.onFormDisabled(t)}formAssociatedCallback(t){this.onFormAssociated(t)}formStateRestoreCallback(t,e){this.onFormStateRestore(t,e)}onFormReset(){}onFormDisabled(t){}onFormAssociated(t){}onFormStateRestore(t,e){}};var Ng=s=>Uc(s)?`<icon-ui name="${s}"></icon-ui>`:s,Ys=class s extends z{static labelDeprecated=!1;static properties={...z.properties,placeholder:{type:String,default:"",reflect:!0},type:{type:String,default:"text",reflect:!0},label:{type:String,default:"",reflect:!0},prefix:{type:String,default:"",reflect:!0},suffix:{type:String,default:"",reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},min:{type:Number,default:null,reflect:!0},max:{type:Number,default:null,reflect:!0},step:{type:Number,default:1,reflect:!0},precision:{type:Number,default:null,reflect:!0},locale:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n="";#r=null;#o=null;#a=".";#l="";#u=null;static#h=0;static#c=400;static#d=60;get#f(){return this.type==="password"}get#p(){return this.type==="number"}get valueAsNumber(){let t=String(this.value??"").trim();if(!t)return NaN;let e=this.#k(t);if(e==="-"||e==="."||e==="-.")return NaN;let i=Number(e);return Number.isFinite(i)?i:NaN}set valueAsNumber(t){if(!Number.isFinite(t)){this.value="";return}this.value=this.#y(t)}connected(){super.connected(),this.setAttribute("role",this.#p?"spinbutton":"textbox");let t=Array.from(this.querySelectorAll(':scope > [slot="leading"]')),e=Array.from(this.querySelectorAll(':scope > [slot="trailing"]'));if(!this.querySelector('[slot="text"]')){let i=this.label?`input-label-${++s.#h}`:"";this.innerHTML=this.#g(i),this.#O(t,e)}this.#t=this.querySelector('[slot="text"]'),this.#e=this.querySelector('[slot="label"]'),this.#i=this.querySelector('[data-step="up"]'),this.#s=this.querySelector('[data-step="down"]'),!this.#f&&this.value&&(this.#t.textContent=this.#p?this.#Q(this.value):this.value),this.#t&&(this.#t.addEventListener("input",this.#L),this.#t.addEventListener("keydown",this.#A),this.#t.addEventListener("blur",this.#q),this.#t.addEventListener("focus",this.#D),this.#t.addEventListener("paste",this.#W),this.#p&&this.#t.addEventListener("beforeinput",this.#E)),this.#i?.addEventListener("pointerdown",this.#U),this.#s?.addEventListener("pointerdown",this.#_),(this.prefix||this.suffix)&&Pg.then(()=>this.#m())}#g(t){let e=this.prefix?`<span slot="prefix">${Ng(this.prefix)}</span>`:"",i=this.label?`<span slot="label" id="${t}">${this.label}</span>`:"",n=this.suffix?`<span slot="suffix">${Ng(this.suffix)}</span>`:"",r=t?`aria-labelledby="${t}"`:"";if(this.#f)return`
56
+ <div slot="field">
57
+ ${e}${i}
58
+ <input slot="text" type="password" tabindex="0"
59
+ placeholder="${this.placeholder}" value="${this.value||""}"
60
+ autocomplete="current-password" ${r}
61
+ ${this.disabled?"disabled":""} ${this.readonly?"readonly":""} />
62
+ ${n}
63
+ </div>
64
+ `;let o=`
65
+ <span slot="text" contenteditable="plaintext-only" tabindex="0"
66
+ ${this.value?"":'data-empty=""'}
67
+ ${r}
68
+ data-placeholder="${this.placeholder}"
69
+ ${this.#p?'inputmode="decimal"':""}></span>`,a=this.#p?`
70
+ <span slot="controls" data-controls aria-hidden="true">
71
+ <button-ui type="button" tabindex="-1" variant="ghost" size="xs"
72
+ icon="caret-up" data-step="up" aria-label="Increase"></button-ui>
73
+ <button-ui type="button" tabindex="-1" variant="ghost" size="xs"
74
+ icon="caret-down" data-step="down" aria-label="Decrease"></button-ui>
75
+ </span>`:"";return`
76
+ <div slot="field"${this.#p?" data-number":""}>
77
+ ${e}${i}${o}${n}${a}
78
+ </div>
79
+ `}#O(t,e){let i=this.querySelector(':scope > [slot="field"]');if(i){if(t.length){let n=i.querySelector(':scope > [slot="label"]')||i.querySelector(':scope > [slot="prefix"]');if(n){let r=n;for(let o of t)r.after(o),r=o}else for(let r of t.slice().reverse())i.prepend(r)}if(e.length){let n=i.querySelector(':scope > [slot="controls"]'),r=i.querySelector(':scope > [slot="suffix"]')||i.querySelector(':scope > [slot="text"]');if(r){let o=r;for(let a of e)o.after(a),o=a}else if(n){let o=n.previousElementSibling||n;for(let a of e)o.after(a),o=a}else for(let o of e)i.appendChild(o)}}}#m(){if(this.isConnected)for(let t of["prefix","suffix"]){let e=this[t];if(!e)continue;let i=this.querySelector(`:scope [slot="${t}"]`);if(i&&!i.querySelector(":scope > icon-ui")&&Uc(e)){i.replaceChildren();let n=document.createElement("icon-ui");n.setAttribute("name",e),i.appendChild(n)}}}render(){if(!this.#t)return;let t=this.value??"";if(this.#f)this.#t.placeholder=this.placeholder,this.#t.disabled=this.disabled,this.#t.readOnly=this.readonly,this.#t.value!==t&&(this.#t.value=t);else{this.#t.setAttribute("data-placeholder",this.placeholder),this.disabled||this.readonly?this.#t.contentEditable="false":this.#t.contentEditable="plaintext-only";let e=this.#p&&document.activeElement!==this.#t?this.#Q(t):String(t);this.#t.textContent!==e&&(this.#t.textContent=e,this.#t.toggleAttribute("data-empty",!e))}if(this.#e&&(this.#e.textContent=this.label||""),this.label?this.removeAttribute("aria-label"):this.placeholder?this.setAttribute("aria-label",this.placeholder):this.removeAttribute("aria-label"),this.#p){let e=this.valueAsNumber;Number.isFinite(e)?(this.setAttribute("aria-valuenow",String(e)),this.setAttribute("aria-valuetext",`${this.#y(e)}${this.suffix?" "+this.suffix:""}`)):(this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuetext")),this.min!=null?this.setAttribute("aria-valuemin",String(this.min)):this.removeAttribute("aria-valuemin"),this.max!=null?this.setAttribute("aria-valuemax",String(this.max)):this.removeAttribute("aria-valuemax");let i=this.disabled||this.readonly||this.max!=null&&Number.isFinite(e)&&e>=this.max,n=this.disabled||this.readonly||this.min!=null&&Number.isFinite(e)&&e<=this.min;this.#i?.toggleAttribute("disabled",!!i),this.#s?.toggleAttribute("disabled",!!n)}}syncValue(t){t=t??this.value??"",super.syncValue(String(t)),this.#p&&this.#b(String(t))}validate(){let t=super.validate();if(!this.#p)return t;if(!t)return!1;let e=this.#b(this.value??"");return e||(this.setAttribute("aria-invalid","true"),this.error=this.validationMessage),e}#b(t){let e=String(t??"").trim();if(!e)return!0;let i=this.#k(e),n=Number(i);return Number.isFinite(n)?this.min!=null&&n<this.min?(this.internals.setValidity({rangeUnderflow:!0},this.getAttribute("data-msg-min")||`Value must be ${this.min} or greater.`,this),!1):this.max!=null&&n>this.max?(this.internals.setValidity({rangeOverflow:!0},this.getAttribute("data-msg-max")||`Value must be ${this.max} or less.`,this),!1):!0:(this.internals.setValidity({badInput:!0},this.getAttribute("data-msg-bad-input")||"Please enter a valid number.",this),!1)}#v(){return this.precision!=null?Math.max(0,this.precision|0):(String(this.step??1).split(".")[1]||"").length}#S(){return this.locale?this.#u===this.locale?this.#a:(this.#w(),this.#a):"."}#x(){return this.locale?this.#u===this.locale?this.#l:(this.#w(),this.#l):""}#w(){try{let t=new Intl.NumberFormat(this.locale).formatToParts(123456789e-2);this.#a=t.find(e=>e.type==="decimal")?.value||".",this.#l=t.find(e=>e.type==="group")?.value||""}catch{this.#a=".",this.#l=""}this.#u=this.locale}#k(t){let e=this.#S(),i=this.#x(),n=String(t);return i&&(n=n.split(i).join("")),e!=="."&&(n=n.replace(new RegExp(`\\${e}`,"g"),".")),n}#y(t){if(!Number.isFinite(t))return"";let e=this.#v();if(this.locale)try{return new Intl.NumberFormat(this.locale,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}catch{}return e>0?t.toFixed(e):String(Math.round(t))}#$(t){if(!Number.isFinite(t))return"";if(!this.locale)return this.#y(t);let e=this.#v();try{return new Intl.NumberFormat(this.locale,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!0}).format(t)}catch{return this.#y(t)}}#Q(t){let e=String(t??"");if(!e)return"";let i=Number(this.#k(e));return Number.isFinite(i)?document.activeElement===this.#t?this.#y(i):this.#$(i):e}#P(t){let e=this.step||1,i=this.min!=null?this.min:0,n=Math.round((t-i)/e)*e+i,r=Math.max(this.min!=null?this.min:-1/0,Math.min(this.max!=null?this.max:1/0,n));return parseFloat(r.toFixed(10))}#C(t){if(this.disabled||this.readonly)return;let e=(this.step||1)*t,i=Number.isFinite(this.valueAsNumber)?this.valueAsNumber:this.min!=null?this.min:0,n=this.#P(i+e);n!==this.valueAsNumber&&(this.value=this.#y(n),this.syncValue(this.value),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#L=()=>{let t;if(this.#f)t=this.#t.value||"";else if(this.#p){let e=this.#t.textContent||"";t=this.#X(e),t!==e&&(this.#t.textContent=t,this.#I())}else t=this.#t.textContent||"";this.value=t,this.#f||this.#t.toggleAttribute("data-empty",!t),this.syncValue(t),this.scheduleThrottledInput()};#E=t=>{let e=t.inputType;if(!e||!e.startsWith("insert")||e==="insertCompositionText")return;let i=t.data??"";if(!i)return;let n=this.#t.textContent||"",r=window.getSelection(),o=n.length,a=n.length;if(r&&r.rangeCount&&this.#t.contains(r.anchorNode)){let h=r.getRangeAt(0);o=this.#M(h.startContainer,h.startOffset),a=this.#M(h.endContainer,h.endOffset),o>a&&([o,a]=[a,o])}let l=n.slice(0,o)+i+n.slice(a);this.#Z(l)||t.preventDefault()};#Z(t){let e=this.#k(t);return e===""||e==="-"||e==="."||e==="-."?e===""||e==="-"||this.min==null||this.min<0:!(!/^-?\d*\.?\d*$/.test(e)||e.startsWith("-")&&this.min!=null&&this.min>=0)}#X(t){let e=this.#S(),i="",n=!1;for(let r=0;r<t.length;r++){let o=t[r];o>="0"&&o<="9"||o==="-"&&i===""&&(this.min==null||this.min<0)?i+=o:o===e&&!n&&(i+=e,n=!0)}return i}#M(t,e){if(!this.#t.contains(t))return 0;let i=0,n=document.createTreeWalker(this.#t,NodeFilter.SHOW_TEXT),r;for(;r=n.nextNode();){if(r===t)return i+e;i+=r.textContent.length}return t===this.#t?e:i}#I(){let t=window.getSelection(),e=document.createRange();e.selectNodeContents(this.#t),e.collapse(!1),t.removeAllRanges(),t.addRange(e)}#A=t=>{if(this.#p){switch(t.key){case"ArrowUp":t.preventDefault(),this.#C(1);return;case"ArrowDown":t.preventDefault(),this.#C(-1);return;case"PageUp":t.preventDefault(),this.#C(10);return;case"PageDown":t.preventDefault(),this.#C(-10);return;case"Home":this.min!=null&&(t.preventDefault(),this.#N(this.min));return;case"End":this.max!=null&&(t.preventDefault(),this.#N(this.max));return;case"Escape":t.preventDefault(),this.value=this.#n,this.#t.textContent=this.#Q(this.value),this.#t.toggleAttribute("data-empty",!this.value),this.syncValue(this.value),this.#t.blur();return;case"Enter":t.preventDefault(),this.#z(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new Event("submit",{bubbles:!0}));return}return}t.key==="Enter"&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new Event("submit",{bubbles:!0})))};#D=()=>{if(this.#n=this.value??"",this.#p&&this.locale){let t=String(this.value??"").trim();if(!t)return;let e=Number(this.#k(t));if(!Number.isFinite(e))return;let i=this.#y(e);this.#t.textContent!==i&&(this.#t.textContent=i)}};#q=()=>{this.#p&&this.#z(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#z(){let t=String(this.value??"").trim();if(!t)return;let e=Number(this.#k(t));if(!Number.isFinite(e))return;let i=this.#P(e),n=this.#y(i),r=this.#$(i);this.value!==n&&(this.value=n,this.syncValue(n),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}}))),this.#t.textContent!==r&&(this.#t.textContent=r,this.#t.toggleAttribute("data-empty",!r))}#N(t){let e=this.#P(t);e!==this.valueAsNumber&&(this.value=this.#y(e),this.syncValue(this.value),this.#t.textContent=this.value,this.#t.toggleAttribute("data-empty",!this.value),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#W=t=>{t.preventDefault();let e=t.clipboardData?.getData("text/plain")||"",i=this.#p?this.#X(e):e;document.execCommand("insertText",!1,i)};#U=t=>this.#B(t,1);#_=t=>this.#B(t,-1);#B(t,e){t.preventDefault(),!(this.disabled||this.readonly)&&(this.#C(e),this.#Y(),document.addEventListener("pointerup",this.#j,{once:!0}),document.addEventListener("pointercancel",this.#j,{once:!0}),this.#o=window.setTimeout(()=>{this.#o=null,this.#r=window.setInterval(()=>{let i=this.valueAsNumber;this.#C(e),this.valueAsNumber===i&&this.#Y()},s.#d)},s.#c))}#j=()=>this.#Y();#Y(){this.#o!=null&&(window.clearTimeout(this.#o),this.#o=null),this.#r!=null&&(window.clearInterval(this.#r),this.#r=null),document.removeEventListener("pointerup",this.#j),document.removeEventListener("pointercancel",this.#j)}focus(){this.#t?.focus()}clear(){this.value="",this.#t&&(this.#f?this.#t.value="":(this.#t.textContent="",this.#t.setAttribute("data-empty",""))),this.syncValue("")}disconnected(){super.disconnected(),this.#t&&(this.#t.removeEventListener("input",this.#L),this.#t.removeEventListener("keydown",this.#A),this.#t.removeEventListener("blur",this.#q),this.#t.removeEventListener("focus",this.#D),this.#t.removeEventListener("paste",this.#W),this.#t.removeEventListener("beforeinput",this.#E)),this.#i?.removeEventListener("pointerdown",this.#U),this.#s?.removeEventListener("pointerdown",this.#_),this.#Y(),this.#t=null,this.#e=null,this.#i=null,this.#s=null}};w("input-ui",Ys);var Us=class extends z{static labelDeprecated=!1;static properties={...z.properties,placeholder:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},rows:{type:Number,default:3,reflect:!0},resize:{type:String,default:"vertical",reflect:!0}};static template=()=>null;#t=null;connected(){super.connected(),this.setAttribute("role","textbox"),this.setAttribute("aria-multiline","true"),this.querySelector('[slot="text"]')||(this.innerHTML=`
80
+ ${this.label?`<label slot="label" label="${this.label}"></label>`:""}
81
+ <div slot="text" contenteditable="plaintext-only" tabindex="0"
82
+ ${this.value?"":'data-empty=""'}
83
+ data-placeholder="${this.placeholder}"></div>
84
+ `),this.#t=this.querySelector('[slot="text"]'),this.value&&(this.#t.textContent=this.value),this.#t&&(this.#t.addEventListener("input",this.#e),this.#t.addEventListener("keydown",this.#i),this.#t.addEventListener("blur",this.#s),this.#t.addEventListener("paste",this.#n))}render(){if(!this.#t)return;this.#t.setAttribute("data-placeholder",this.placeholder),this.disabled||this.readonly?this.#t.contentEditable="false":this.#t.contentEditable="plaintext-only";let t=this.value||"";this.#t.textContent!==t&&(this.#t.textContent=t,this.#t.toggleAttribute("data-empty",!t));let e=this.querySelector('[slot="label"]');e&&this.label&&e.setAttribute("label",this.label),this.setAttribute("aria-label",this.label||this.placeholder||"")}#e=()=>{let t=this.#t.textContent||"";this.value=t,this.#t.toggleAttribute("data-empty",!t),this.syncValue(t),this.scheduleThrottledInput()};#i=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.flushPendingInput(),this.dispatchEvent(new Event("submit",{bubbles:!0})))};#s=()=>{this.flushPendingInput(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#n=t=>{t.preventDefault();let e=t.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,e)};focus(){this.#t?.focus()}clear(){this.value="",this.#t&&(this.#t.textContent="",this.#t.setAttribute("data-empty","")),this.syncValue("")}disconnected(){super.disconnected(),this.#t&&(this.#t.removeEventListener("input",this.#e),this.#t.removeEventListener("keydown",this.#i),this.#t.removeEventListener("blur",this.#s),this.#t.removeEventListener("paste",this.#n)),this.#t=null}};w("textarea-ui",Us);var Fs=class extends z{static labelDeprecated=!1;static properties={...z.properties,checked:{type:Boolean,default:!1,reflect:!0},indeterminate:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"",reflect:!0}};static template=()=>Kt`<span slot="box"></span>`;connected(){super.connected(),this.setAttribute("role","checkbox"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}render(){this.indeterminate?this.setAttribute("aria-checked","mixed"):this.setAttribute("aria-checked",String(this.checked)),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),this.label&&this.setAttribute("aria-label",this.label),this.syncValue(this.checked?this.value||"on":"")}#t=()=>{this.disabled||(this.checked=!this.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,checked:this.checked}})))};#e=t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.#t())};disconnected(){super.disconnected(),this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}};w("check-ui",Fs);var Gs=class extends z{static labelDeprecated=!1;static properties={...z.properties,checked:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"",reflect:!0}};static template=()=>Kt`<span slot="dot"></span>`;connected(){super.connected(),this.setAttribute("role","radio"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}render(){this.setAttribute("aria-checked",String(this.checked)),this.label&&this.setAttribute("aria-label",this.label),this.checked&&this.syncValue(this.value||"on")}#t=()=>{if(this.disabled||this.checked)return;let t=this.closest('fieldset, [role="radiogroup"]')||this.parentElement;if(t)for(let e of t.querySelectorAll(`radio-ui[name="${this.name}"]`))e!==this&&e.checked&&(e.checked=!1);this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,checked:this.checked}}))};#e=t=>{if((t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.#t()),t.key==="ArrowDown"||t.key==="ArrowRight"){t.preventDefault();let e=this.#i(1);e&&(e.focus(),e.click())}if(t.key==="ArrowUp"||t.key==="ArrowLeft"){t.preventDefault();let e=this.#i(-1);e&&(e.focus(),e.click())}};#i(t){let i=[...(this.closest('fieldset, [role="radiogroup"]')||this.parentElement)?.querySelectorAll(`radio-ui[name="${this.name}"]`)||[]],n=i.indexOf(this);return i[(n+t+i.length)%i.length]||null}disconnected(){super.disconnected(),this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}};w("radio-ui",Gs);var Hs=class extends z{static properties={...z.properties,checked:{type:Boolean,default:!1,reflect:!0},heading:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},layout:{type:String,default:"default",reflect:!0}};static template=()=>null;connected(){super.connected(),this.setAttribute("role","radio"),this.setAttribute("tabindex","0"),this.#t(),this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i)}disconnected(){super.disconnected(),this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i)}render(){this.setAttribute("aria-checked",String(this.checked)),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled");let t=this.querySelector(':scope > [slot="heading"]');t&&t.dataset.fromAttr==="true"&&(t.textContent=this.heading||"");let e=this.querySelector(':scope > [slot="description"]');e&&e.dataset.fromAttr==="true"&&(e.textContent=this.description||"");let i=this.querySelector(':scope > [slot="icon"]');i&&i.dataset.fromAttr==="true"&&i.setAttribute("name",this.icon||""),this.checked?this.syncValue(this.value||"on"):this.syncValue("")}#t(){if(this.heading&&!this.querySelector(':scope > [slot="heading"]')){let t=document.createElement("span");t.setAttribute("slot","heading"),t.dataset.fromAttr="true",t.textContent=this.heading,this.appendChild(t)}if(this.description&&!this.querySelector(':scope > [slot="description"]')){let t=document.createElement("span");t.setAttribute("slot","description"),t.dataset.fromAttr="true",t.textContent=this.description,this.appendChild(t)}if(this.icon&&!this.querySelector(':scope > [slot="icon"]')){let t=document.createElement("icon-ui");t.setAttribute("slot","icon"),t.dataset.fromAttr="true",t.setAttribute("name",this.icon),this.appendChild(t)}}#e=()=>{if(this.disabled||this.readonly||this.checked)return;let t=this.#s();if(t)for(let e of t.querySelectorAll(`option-card-ui[name="${this.name}"]`))e!==this&&e.checked&&(e.checked=!1);this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,checked:this.checked}}))};#i=t=>{if(t.target===this){if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.#e();return}if(t.key==="ArrowDown"||t.key==="ArrowRight"){t.preventDefault();let e=this.#n(1);e&&(e.focus(),e.click())}if(t.key==="ArrowUp"||t.key==="ArrowLeft"){t.preventDefault();let e=this.#n(-1);e&&(e.focus(),e.click())}}};#s(){return this.closest('fieldset, [role="radiogroup"]')||this.parentElement}#n(t){let i=[...this.#s()?.querySelectorAll(`option-card-ui[name="${this.name}"]`)||[]],n=i.indexOf(this);return n<0?null:i[(n+t+i.length)%i.length]||null}};w("option-card-ui",Hs);var Ks=class s extends z{static labelDeprecated=!1;static properties={...z.properties,checked:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"",reflect:!0},size:{type:String,default:"",reflect:!0},hint:{type:String,default:"",reflect:!0}};static#t=0;static template=t=>{let e=t.hint?`switch-hint-${++s.#t}`:"";return e?t.setAttribute("aria-describedby",e):t.removeAttribute("aria-describedby"),Kt`
85
+ <span slot="track"><span slot="thumb"></span></span>
86
+ ${t.label?Kt`<span slot="label">${t.label}</span>`:null}
87
+ ${t.hint?Kt`<span slot="hint" id=${e}>${t.hint}</span>`:null}
88
+ `};connected(){super.connected(),this.setAttribute("role","switch"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i)}render(){this.setAttribute("aria-checked",String(this.checked)),this.syncValue(this.checked?this.value||"on":"")}#e=()=>{this.disabled||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,checked:this.checked}})))};#i=t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.#e())};disconnected(){super.disconnected(),this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i)}};w("switch-ui",Ks);var Js=class s extends z{static labelDeprecated=!1;static properties={...z.properties,value:{type:Number,default:50,reflect:!0},min:{type:Number,default:0,reflect:!0},max:{type:Number,default:100,reflect:!0},step:{type:Number,default:1,reflect:!0},label:{type:String,default:"",reflect:!0},suffix:{type:String,default:"",reflect:!0}};static template=()=>null;static#t=0;#e=null;#i=null;#s=!1;#n=0;get#r(){let t=this.max-this.min;return t>0?(this.value-this.min)/t*100:0}#o(t){let e=(String(this.step).split(".")[1]||"").length;return e>0?t.toFixed(e):String(t)}connected(){if(super.connected(),this.setAttribute("role","slider"),this.setAttribute("tabindex","0"),this.setAttribute("aria-valuemin",this.min),this.setAttribute("aria-valuemax",this.max),this.label&&this.setAttribute("aria-label",this.label),!this.querySelector('[slot="track"]')){let t=this.hint?`slider-hint-${++s.#t}`:"";this.innerHTML=`
89
+ <div slot="header">
90
+ ${this.label?`<span slot="label">${this.label}</span>`:""}
91
+ <span slot="readout">
92
+ <span slot="value">${this.#o(this.value)}</span>
93
+ ${this.suffix?`<span slot="suffix">${this.suffix}</span>`:""}
94
+ </span>
95
+ </div>
96
+ <div slot="track">
97
+ <div slot="fill"></div>
98
+ <div slot="thumb" tabindex="0"></div>
99
+ </div>
100
+ ${this.hint?`<span slot="hint" id="${t}">${this.hint}</span>`:""}
101
+ `,this.hint&&this.setAttribute("aria-describedby",t)}this.#e=this.querySelector('[slot="track"]'),this.#i=this.querySelector('[slot="thumb"]'),this.#i&&this.#i.addEventListener("pointerdown",this.#h),this.#e&&this.#e.addEventListener("click",this.#f),this.addEventListener("keydown",this.#p)}render(){if(!this.#e)return;if(typeof this.value=="function"){console.warn(`[slider-ui] .value received a function. Did you mean:
102
+ .value=\${fn()} \u2190 call the function to get the current value
103
+ .value=\${signal.value} \u2190 read the signal's current value
104
+ Functions are not auto-invoked at render time; the slider reads
105
+ .value synchronously. See USAGE.md "Reactive binding" for the
106
+ parent-template-re-read pattern that works across frameworks.`);return}let t=this.#r;this.style.setProperty("--slider-pct",String(t/100));let e=this.querySelector('[slot="value"]');e&&(e.textContent=this.#o(this.value));let i=this.querySelector('[slot="label"]');if(i)i.textContent=this.label;else if(this.label){let r=this.querySelector('[slot="header"]');if(r){let o=document.createElement("span");o.slot="label",o.textContent=this.label,r.prepend(o)}}this.label&&this.setAttribute("aria-label",this.label);let n=this.querySelector('[slot="suffix"]');n&&(n.textContent=this.suffix),this.setAttribute("aria-valuenow",this.value),this.setAttribute("aria-valuetext",`${this.#o(this.value)}${this.suffix?" "+this.suffix:""}`),this.syncValue(String(this.value))}#a(t){if(!this.#e||!this.#i)return this.min;let e=this.#e.getBoundingClientRect(),i=this.#i.getBoundingClientRect(),n=e.width,r=i.width,o=n-r;if(o<=0)return this.min;let a=t-e.left,l=Math.max(0,Math.min(1,(a-r/2)/o)),h=this.min+l*(this.max-this.min);return this.#l(h)}#l(t){let e=Math.round((t-this.min)/this.step)*this.step+this.min;return Math.max(this.min,Math.min(this.max,parseFloat(e.toFixed(10))))}#u(t){t!==this.value&&(this.value=t,this.scheduleThrottledInput())}#h=t=>{if(!this.disabled){if(t.preventDefault(),this.#s=!0,this.setAttribute("data-dragging",""),this.#e&&this.#i){let e=this.#e.getBoundingClientRect(),i=this.#i.getBoundingClientRect(),n=e.width,r=i.width,o=n-r,a=this.max-this.min,l=a>0?(this.value-this.min)/a:0,h=e.left+r/2+l*o;this.#n=t.clientX-h}else this.#n=0;this.#i.setPointerCapture(t.pointerId),this.#i.addEventListener("pointermove",this.#c),this.#i.addEventListener("pointerup",this.#d)}};#c=t=>{this.#s&&this.#u(this.#a(t.clientX-this.#n))};#d=t=>{this.#s=!1,this.#n=0,this.removeAttribute("data-dragging"),this.#i.releasePointerCapture(t.pointerId),this.#i.removeEventListener("pointermove",this.#c),this.#i.removeEventListener("pointerup",this.#d),this.flushPendingInput(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#f=t=>{this.disabled||t.target===this.#i||(this.#u(this.#a(t.clientX)),this.flushPendingInput(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))};#p=t=>{if(this.disabled)return;let e=this.value;switch(t.key){case"ArrowRight":case"ArrowUp":e+=this.step;break;case"ArrowLeft":case"ArrowDown":e-=this.step;break;case"Home":e=this.min;break;case"End":e=this.max;break;case"PageUp":e+=this.step*10;break;case"PageDown":e-=this.step*10;break;default:return}t.preventDefault(),this.#u(this.#l(e)),this.flushPendingInput(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};disconnected(){super.disconnected(),this.#i?.removeEventListener("pointerdown",this.#h),this.#e?.removeEventListener("click",this.#f),this.#i?.removeEventListener("pointermove",this.#c),this.#i?.removeEventListener("pointerup",this.#d),this.removeEventListener("keydown",this.#p),this.#e=null,this.#i=null}};w("slider-ui",Js);var jk=typeof CSS<"u"?(CSS.supports?.("anchor-name: --x")??!1)&&(CSS.supports?.("position-area: bottom")??!1):!1,Nk=0;function Tt(s,t,e={}){let{placement:i="bottom-start",gap:n=4,matchWidth:r=!1}=e;return jk?_k(s,t,{placement:i,gap:n,matchWidth:r}):Yk(s,t,{placement:i,gap:n,matchWidth:r})}function _k(s,t,{placement:e,gap:i,matchWidth:n}){let r=`--a-anchor-${++Nk}`,o=s.style.anchorName,a={position:t.style.position,positionAnchor:t.style.positionAnchor,positionArea:t.style.positionArea,positionTryFallbacks:t.style.positionTryFallbacks,margin:t.style.margin,width:t.style.width,top:t.style.top,left:t.style.left};return s.style.anchorName=r,t.style.position="fixed",t.style.positionAnchor=r,t.style.positionArea=Wk(e),t.style.margin=Vk(e,i),t.style.positionTryFallbacks="flip-block, flip-inline, flip-block flip-inline",n&&(t.style.width=`anchor-size(${r} width)`),t.style.top="",t.style.left="",()=>{s.style.anchorName=o;for(let[l,h]of Object.entries(a))t.style[l]=h}}function Vk(s,t){return s.startsWith("bottom")?`${t}px 0 0 0`:s.startsWith("top")?`0 0 ${t}px 0`:s.startsWith("left")?`0 ${t}px 0 0`:s.startsWith("right")?`0 0 0 ${t}px`:`${t}px`}function Wk(s){switch(s){case"bottom":return"bottom span-all";case"bottom-start":return"bottom span-right";case"bottom-end":return"bottom span-left";case"top":return"top span-all";case"top-start":return"top span-right";case"top-end":return"top span-left";case"left":return"left span-all";case"left-start":return"left span-bottom";case"left-end":return"left span-top";case"right":return"right span-all";case"right-start":return"right span-bottom";case"right-end":return"right span-top";default:return"bottom span-right"}}function Yk(s,t,{placement:e,gap:i,matchWidth:n}){function r(){if(!s||!t)return;let a=s.getBoundingClientRect(),l=t.getBoundingClientRect(),h=window.innerWidth,c=window.innerHeight,u=e;u.startsWith("bottom")&&a.bottom+i+l.height>c&&a.top-i-l.height>0?u=u.replace("bottom","top"):u.startsWith("top")&&a.top-i-l.height<0&&a.bottom+i+l.height<c&&(u=u.replace("top","bottom"));let d,f;u.startsWith("top")?d=a.top-l.height-i:u.startsWith("bottom")?d=a.bottom+i:u.startsWith("left")?(f=a.left-l.width-i,u==="left-start"?d=a.top:u==="left-end"?d=a.bottom-l.height:d=a.top+(a.height-l.height)/2):u.startsWith("right")&&(f=a.right+i,u==="right-start"?d=a.top:u==="right-end"?d=a.bottom-l.height:d=a.top+(a.height-l.height)/2),f===void 0&&(u.endsWith("-start")?f=a.left:u.endsWith("-end")?f=a.right-l.width:f=a.left+(a.width-l.width)/2),f+l.width>h-i&&(f=a.right-l.width),f<i&&(f=a.left),d=Math.max(i,Math.min(d,c-l.height-i)),f=Math.max(i,Math.min(f,h-l.width-i)),t.style.position="fixed",t.style.top=`${d}px`,t.style.left=`${f}px`,n&&(t.style.width=`${a.width}px`)}t.style.opacity="0",requestAnimationFrame(()=>{r(),t.style.opacity=""});let o=Uk(s);for(let a of o)a.addEventListener("scroll",r,{passive:!0});return window.addEventListener("resize",r,{passive:!0}),()=>{for(let a of o)a.removeEventListener("scroll",r);window.removeEventListener("resize",r)}}function Uk(s){let t=[document],e=s?.parentElement;for(;e;){let i=getComputedStyle(e);/auto|scroll/.test(i.overflow+i.overflowX+i.overflowY)&&t.push(e),e=e.parentElement}return t}function Re(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var tn=class s extends z{static labelDeprecated=!1;static requiredIcons=["caret-up-down"];static#t=new WeakSet;static properties={...z.properties,placeholder:{type:String,default:"Select...",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},avatar:{type:String,default:"",reflect:!0},multiple:{type:Boolean,default:!1,reflect:!0},searchable:{type:Boolean,default:!1,reflect:!0},freeText:{type:Boolean,default:!1,reflect:!0,attribute:"free-text"},divider:{type:Boolean,default:!1,reflect:!0},hint:{type:String,default:"",reflect:!0}};static#e=0;static template=()=>null;#i=[];#s=null;#n=null;#r="";#o=null;#a=null;#l=()=>{this.disabled||(this.open=!0)};#u=t=>{t.stopPropagation(),this.disabled||(this.open=!0)};#h=t=>{let e=t.currentTarget;t.stopPropagation();let i=e.__adiaOption;if(i&&!i.disabled){if(i.action){this.open=!1,this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{action:i.action}}));return}this.value=i.value,this.open=!1,this.#r="",this.syncValue(i.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))}};connected(){super.connected(),this.setAttribute("role","combobox"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#p),this.addEventListener("keydown",this.#O),this.#i.length===0&&this.#c()}render(){if(this.querySelector('[slot="trigger"]')){let t=this.querySelector('[slot="display"]');t&&(t.tagName==="INPUT"?this.#r||(t.value=this.#f()===this.placeholder?"":this.#f()):t.textContent=this.#f())}else{let t=this.#s;t?.parentNode===this&&this.removeChild(t);let e=this.avatar?`<img slot="leading" src="${this.avatar}" alt="" />`:this.icon?`<icon-ui slot="leading" name="${this.icon}"></icon-ui>`:"",i=this.searchable?`<input slot="display" type="text" role="combobox" aria-autocomplete="list" autocomplete="off" placeholder="${Re(this.placeholder||"")}" value="${Re(this.#f()===this.placeholder?"":this.#f())}" />`:`<span slot="display">${Re(this.#f())}</span>`,n=this.hint?`select-hint-${++s.#e}`:"",r=this.hint?`<span slot="hint" id="${n}">${Re(this.hint)}</span>`:"";this.innerHTML=`
107
+ <span slot="trigger">
108
+ ${e}
109
+ ${i}
110
+ <icon-ui name="caret-up-down" slot="caret"></icon-ui>
111
+ </span>
112
+ ${r}
113
+ `,this.hint&&this.setAttribute("aria-describedby",n),this.searchable&&(this.#o&&(this.#o.removeEventListener("input",this.#m),this.#o.removeEventListener("focus",this.#l),this.#o.removeEventListener("click",this.#u)),this.#o=this.querySelector('input[slot="display"]'),this.#o&&(this.#o.addEventListener("input",this.#m),this.#o.addEventListener("focus",this.#l),this.#o.addEventListener("click",this.#u))),t&&this.appendChild(t)}if(this.#s||(this.#s=this.querySelector('[slot="listbox"]'),this.#s||(this.#s=document.createElement("div"),this.#s.setAttribute("slot","listbox"),this.#s.setAttribute("role","listbox"),this.#s.setAttribute("popover","manual"),this.appendChild(this.#s)),this.#d()),this.#s){let t=this.multiple?new Set(this.value.split(",").map(e=>e.trim()).filter(Boolean)):null;for(let e of this.#s.querySelectorAll('[role="option"]')){let i=e.getAttribute("data-value");(t?t.has(i):i===this.value)?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected")}}if(this.setAttribute("aria-expanded",String(this.open)),this.open){this.#s?.showPopover?.();let t=this.querySelector('[slot="trigger"]')||this;this.#s.style.minWidth=`${t.getBoundingClientRect().width}px`,this.#s.style.width="max-content",this.#n=Tt(t,this.#s,{placement:this.getAttribute("placement")||"bottom-start",gap:4,matchWidth:!1}),this.#a=requestAnimationFrame(()=>{this.#a=null,document.addEventListener("pointerdown",this.#g,{once:!0})})}else this.#n?.(),this.#n=null,this.#s?.hidePopover?.(),this.#a!=null&&(cancelAnimationFrame(this.#a),this.#a=null),document.removeEventListener("pointerdown",this.#g)}#c(){this.#i=[];let t=new Set,e=[];for(let i of this.children)if(i.tagName==="OPTGROUP"){let n={label:i.label||i.getAttribute("label")||"",options:[]};for(let r of i.querySelectorAll("option"))n.options.push({value:r.value,label:r.textContent.trim(),disabled:r.disabled}),r.hasAttribute("selected")&&e.push(r.value);this.#i.push(n)}else i.tagName==="OPTION"?(this.#i.push({value:i.value,label:i.textContent.trim(),disabled:i.disabled}),i.hasAttribute("selected")&&e.push(i.value)):i.hasAttribute("slot")||t.add(i.tagName.toLowerCase());for(let i of[...this.querySelectorAll("option, optgroup")])i.remove();!this.value&&e.length&&(this.value=this.multiple?e.join(","):e[0]),t.size>0&&!s.#t.has(this)&&(s.#t.add(this),console.warn(`<select-ui>: ignoring unrecognized child element(s) [${[...t].join(", ")}]. Consumer-authored children must be native <option> or <optgroup>, NOT <select-option> or other <*-ui> shapes. Or set element.options = [...] programmatically. (Once-per-element warn; see select.yaml usage: for details.)`))}set options(t){Eo(()=>{this.#i=t,this.#s||(this.#s=this.querySelector('[slot="listbox"]'),this.#s||(this.#s=document.createElement("div"),this.#s.setAttribute("slot","listbox"),this.#s.setAttribute("role","listbox"),this.#s.setAttribute("popover","manual"),this.appendChild(this.#s))),this.#d();let e=this.querySelector('[slot="display"]');e&&(e.textContent=this.#f())})}get options(){return this.#i}#d(){if(!this.#s)return;this.#s.innerHTML="";let t=e=>{if(e.separator){let r=document.createElement("hr");return r.setAttribute("data-separator",""),r}let i=document.createElement("div");i.setAttribute("role","option"),i.setAttribute("data-value",e.value||""),e.icon?i.innerHTML=`<icon-ui name="${Re(e.icon)}"></icon-ui>${Re(e.label)}`:i.textContent=e.label;let n=this.multiple?new Set(this.value.split(",").map(r=>r.trim()).filter(Boolean)):null;return(n?n.has(e.value):e.value===this.value)&&i.setAttribute("aria-selected","true"),e.disabled&&i.setAttribute("aria-disabled","true"),e.action&&(i.dataset.action=e.action),i.__adiaOption=e,i.addEventListener("click",this.#h),i};for(let e of this.#i)if(e.separator)this.#s.appendChild(t(e));else if(e.header){let i=document.createElement("div");i.setAttribute("data-menu-header",""),i.innerHTML=e.avatar?`<img src="${e.avatar}" alt="" /><div><strong>${Re(e.label)}</strong><span>${Re(e.description||"")}</span></div>`:`<div><strong>${Re(e.label)}</strong><span>${Re(e.description||"")}</span></div>`,this.#s.appendChild(i)}else if(e.options){let i=document.createElement("div");i.setAttribute("role","group"),i.innerHTML=`<div slot="group-label">${Re(e.label)}</div>`;for(let n of e.options)i.appendChild(t(n));this.#s.appendChild(i)}else this.#s.appendChild(t(e));this.#r&&this.#b()}#f(){return this.#i.flatMap(i=>i.options||[i]).find(i=>i.value===this.value||i.header&&i.label===this.value)?.label||this.value||this.placeholder}#p=t=>{this.disabled||this.#s&&t.composedPath().includes(this.#s)||(this.open=!this.open)};#g=t=>{!this.contains(t.target)&&!(this.#s&&t.composedPath().includes(this.#s))&&(this.open=!1)};#O=t=>{if(t.key==="Escape"){if(this.searchable&&this.#r){this.#r="";let e=this.querySelector('input[slot="display"]');e&&(e.value=""),this.#b();return}this.open=!1;return}if(t.key==="Enter"){if(t.preventDefault(),this.open){let e=this.#s?.querySelector('[role="option"][data-focused]:not([data-filtered-out])');if(e)e.click();else if(this.searchable&&this.freeText&&this.#r){let i=this.#r;this.value=i,this.#r="",this.open=!1,this.syncValue?.(i),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))}else this.open=!1}else this.open=!0;return}if(t.key===" "&&!this.searchable){if(t.preventDefault(),this.open){let e=this.#s?.querySelector('[role="option"][data-focused]');e?e.click():this.open=!1}else this.open=!0;return}t.key==="ArrowDown"&&this.open&&(t.preventDefault(),this.#v(1)),t.key==="ArrowUp"&&this.open&&(t.preventDefault(),this.#v(-1))};#m=t=>{this.#r=t.target.value||"",this.open||(this.open=!0),this.#b()};#b(){if(!this.#s)return;let t=this.#r.toLowerCase(),e=this.#s.querySelectorAll('[role="option"]'),i=!1;for(let r of e){let o=(r.textContent||"").toLowerCase();!t||o.includes(t)?(r.removeAttribute("data-filtered-out"),r.style.display="",i=!0):(r.setAttribute("data-filtered-out",""),r.style.display="none")}for(let r of this.#s.querySelectorAll('[role="group"]')){let o=r.querySelectorAll('[role="option"]:not([data-filtered-out])').length;r.style.display=o?"":"none"}let n=this.#s.querySelector('[role="option"][data-focused]');n&&n.hasAttribute("data-filtered-out")&&n.removeAttribute("data-focused")}#v(t){if(!this.#s)return;let e=[...this.#s.querySelectorAll('[role="option"]:not([aria-disabled]):not([data-filtered-out])')];if(!e.length)return;let i=this.#s.querySelector('[role="option"][data-focused]'),n=i?e.indexOf(i):-1,r=e[(n+t+e.length)%e.length];i&&i.removeAttribute("data-focused"),r&&(r.setAttribute("data-focused",""),r.scrollIntoView({block:"nearest"}))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#p),this.removeEventListener("keydown",this.#O),this.#a!=null&&(cancelAnimationFrame(this.#a),this.#a=null),document.removeEventListener("pointerdown",this.#g),this.#o&&(this.#o.removeEventListener("input",this.#m),this.#o.removeEventListener("focus",this.#l),this.#o.removeEventListener("click",this.#u),this.#o=null),this.#n?.(),this.#n=null,this.#s?.hidePopover?.(),this.#s=null}};w("select-ui",tn);var en=class extends A{static properties={value:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","radio"),this.getAttribute("tabindex")||this.setAttribute("tabindex","-1")}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.setAttribute("aria-checked",this.selected?"true":"false"),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),this.icon){let t=this.querySelector(":scope > icon-ui");if(!t||t.getAttribute("name")!==this.icon){t?.remove();let e=document.createElement("icon-ui");e.setAttribute("name",this.icon),e.setAttribute("aria-hidden","true"),this.prepend(e)}}else this.querySelector(":scope > icon-ui")?.remove()}};w("segment-ui",en);var sn=class s extends z{static properties={...z.properties,value:{type:String,default:"",reflect:!0}};static template=()=>null;static#t=new WeakSet;#e=null;#i=!1;#s=null;#n=null;#r=null;connected(){if(super.connected(),this.setAttribute("role","radiogroup"),this.#i||(this.#i=!0,this.addEventListener("click",this.#h),this.addEventListener("keydown",this.#c)),!this.value){let t=this.querySelector("segment-ui:not([disabled])");t&&(this.value=t.value||t.getAttribute("value")||"")}typeof ResizeObserver<"u"&&(this.#n=new ResizeObserver(()=>this.#l(this.#o)),this.#n.observe(this)),document.fonts?.ready&&(this.#r=document.fonts.ready.then(()=>{this.#r=null,this.#l(this.#o)}))}disconnected(){super.disconnected(),this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#n?.disconnect(),this.#n=null,this.#r&&(this.#r=null),this.removeEventListener("click",this.#h),this.removeEventListener("keydown",this.#c),this.#e=null,this.#i=!1}get#o(){return[...this.querySelectorAll("segment-ui")]}get#a(){return this.#o.filter(t=>!t.disabled)}render(){if(!s.#t.has(this)){let e=[...this.children].find(i=>i.tagName!=="SEGMENT-UI"&&!i.hasAttribute("data-indicator"));e&&(s.#t.add(this),console.warn(`[segmented-ui] child <${e.tagName.toLowerCase()}> is not <segment-ui> \u2014 bare <segment> tags render text but receive no sliding indicator or aria-checked state. Use <segment-ui>.`))}let t=this.#o;if(t.length){for(let e of t){let n=(e.value||e.getAttribute("value")||"")===this.value;n?e.setAttribute("selected",""):e.removeAttribute("selected"),e.setAttribute("tabindex",n?"0":"-1")}this.label&&this.setAttribute("aria-label",this.label),this.#l(t)}}#l(t){let e=t.findIndex(n=>(n.value||n.getAttribute("value")||"")===this.value);if(e<0){this.removeAttribute("data-indicator-ready");return}let i=!this.#e;i&&(this.#e=document.createElement("span"),this.#e.setAttribute("data-indicator",""),this.prepend(this.#e)),this.style.setProperty("--_segment-count",`${t.length}`),i?(this.#e.style.transition="none",this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""),this.#s=requestAnimationFrame(()=>{this.#s=null,this.#e&&(this.#e.style.transition="")})):(this.#e.style.transform=`translateX(${e*100}%)`,this.setAttribute("data-indicator-ready",""))}#u(t){t.disabled||(this.value=t.value,this.syncValue(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#h=t=>{let e=t.target.closest("segment-ui");e&&this.contains(e)&&this.#u(e)};#c=t=>{let e=t.target;if(e.tagName!=="SEGMENT-UI")return;let i=this.#a,n=i.indexOf(e);if(n<0)return;let r;switch(t.key){case"ArrowRight":case"ArrowDown":r=n<i.length-1?n+1:0;break;case"ArrowLeft":case"ArrowUp":r=n>0?n-1:i.length-1;break;case"Home":r=0;break;case"End":r=i.length-1;break;default:return}t.preventDefault(),i[r].focus(),this.#u(i[r])}};w("segmented-ui",sn);var nn=class extends z{static labelDeprecated=!1;static properties={...z.properties,value:{type:Number,default:0,reflect:!0},min:{type:Number,default:0,reflect:!0},max:{type:Number,default:100,reflect:!0},step:{type:Number,default:1,reflect:!0},label:{type:String,default:"",reflect:!0},suffix:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=0;#n=0;connected(){if(super.connected(),this.setAttribute("role","spinbutton"),this.setAttribute("tabindex","0"),!this.querySelector('[slot="field"]')){let t=`
114
+ <span slot="label">${this.label}</span>
115
+ <span slot="value">${this.#r(this.value)}</span>
116
+ ${this.suffix?`<span slot="suffix">${this.suffix}</span>`:""}
117
+ `;this.innerHTML=`
118
+ <div slot="field">
119
+ <div slot="layer" data-layer="base">${t}</div>
120
+ <div slot="layer" data-layer="fill" aria-hidden="true">${t}</div>
121
+ </div>
122
+ `}this.#t=this.querySelector('[slot="field"]'),this.#e=this.querySelector('[data-layer="base"] [slot="value"]'),this.#t&&this.#t.addEventListener("pointerdown",this.#u),this.addEventListener("keydown",this.#d)}render(){if(!this.#t)return;let t=this.#r(this.value);this.#e&&(this.#e.textContent=t);let e=this.querySelector('[data-layer="fill"] [slot="value"]');e&&(e.textContent=t);let i=this.max-this.min,n=i>0?(this.value-this.min)/i*100:0;this.style.setProperty("--range-fill-pct",`${n}%`),this.setAttribute("aria-valuemin",this.min),this.setAttribute("aria-valuemax",this.max),this.setAttribute("aria-valuenow",this.value),this.setAttribute("aria-valuetext",`${this.value}${this.suffix?" "+this.suffix:""}`),this.setAttribute("aria-label",this.label||""),this.syncValue(String(this.value))}#r(t){let e=(String(this.step).split(".")[1]||"").length;return e>0?t.toFixed(e):String(t)}#o(t){let e=Math.round((t-this.min)/this.step)*this.step+this.min;return Math.max(this.min,Math.min(this.max,parseFloat(e.toFixed(10))))}#a(t){let e=this.#o(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})))}#l(t){let e=this.#t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-e.left)/e.width));return this.#o(this.min+i*(this.max-this.min))}#u=t=>{this.disabled||(t.preventDefault(),this.#a(this.#l(t.clientX)),this.#i=!0,this.#s=t.clientX,this.#n=this.value,this.setAttribute("data-dragging",""),this.#t.setPointerCapture(t.pointerId),this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#c))};#h=t=>{if(!this.#i)return;let e=t.clientX-this.#s,i=this.#t.getBoundingClientRect().width,n=this.max-this.min,r=e/i*n;this.#a(this.#n+r)};#c=t=>{this.#i=!1,this.removeAttribute("data-dragging"),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#h),this.#t.removeEventListener("pointerup",this.#c),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};#d=t=>{if(this.disabled)return;let e=this.value;switch(t.key){case"ArrowRight":case"ArrowUp":e+=this.step;break;case"ArrowLeft":case"ArrowDown":e-=this.step;break;case"Home":e=this.min;break;case"End":e=this.max;break;case"PageUp":e+=this.step*10;break;case"PageDown":e-=this.step*10;break;default:return}t.preventDefault(),this.#a(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))};disconnected(){super.disconnected(),this.#t?.removeEventListener("pointerdown",this.#u),this.#t?.removeEventListener("pointermove",this.#h),this.#t?.removeEventListener("pointerup",this.#c),this.removeEventListener("keydown",this.#d),this.#t=null,this.#e=null}};w("range-ui",nn);var rn=class extends A{static requiredIcons=["caret-right"];static template=()=>null;connected(){this.setAttribute("role","tree"),this.addEventListener("click",this.#e),this.addEventListener("keydown",this.#i)}get selectedItem(){return this.querySelector("tree-item-ui[selected]")}select(t,e=null){let i=this.selectedItem;i&&i!==t&&i.removeAttribute("selected"),t.setAttribute("selected",""),this.dispatchEvent(new CustomEvent("tree-select",{bubbles:!0,detail:{item:t,text:t.text,value:t.value,ctrlKey:!!e?.ctrlKey,metaKey:!!e?.metaKey,shiftKey:!!e?.shiftKey}}))}#t(t){if(!t)return null;if(t instanceof Element)return t.matches?.("tree-item-ui")?t:null;if(typeof t=="string"){let e=t.replace(/"/g,'\\"');return this.querySelector(`tree-item-ui[value="${e}"]`)||this.querySelector(`tree-item-ui[text="${e}"]`)||null}return null}expand(t){let e=this.#t(t);e&&e.hasChildren&&!e.open&&(e.open=!0)}collapse(t){let e=this.#t(t);e&&e.open&&(e.open=!1)}expandAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.hasChildren&&!t.open&&(t.open=!0)}collapseAll(){for(let t of this.querySelectorAll("tree-item-ui"))t.open&&(t.open=!1)}expandTo(t){let e=this.#t(t);if(!e)return;let i=e.parentElement?.closest("tree-item-ui");for(;i;)i.hasChildren&&!i.open&&(i.open=!0),i=i.parentElement?.closest("tree-item-ui");e.querySelector(':scope > [slot="row"]')?.scrollIntoView?.({block:"nearest",inline:"nearest"})}#e=t=>{let e=t.target.closest("tree-item-ui");if(!e||!this.contains(e)||t.target.closest('[slot="actions"] *'))return;let i=e.querySelector(':scope > [slot="row"]');!i||!(t.target===i||i.contains(t.target))||(this.select(e,t),e.hasChildren&&(e.open=!e.open))};#i=t=>{let e=t.target.closest("tree-item-ui");if(e)switch(t.key){case"ArrowRight":if(t.preventDefault(),e.hasChildren&&!e.open)e.open=!0;else{let i=e.querySelector(":scope > tree-item-ui");i&&i.querySelector('[slot="row"]')?.focus()}break;case"ArrowLeft":if(t.preventDefault(),e.hasChildren&&e.open)e.open=!1;else{let i=e.parentElement?.closest("tree-item-ui");i&&i.querySelector(':scope > [slot="row"]')?.focus()}break;case"ArrowDown":{t.preventDefault();let i=this.#s(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"ArrowUp":{t.preventDefault();let i=this.#n(e);i&&i.querySelector(':scope > [slot="row"]')?.focus();break}case"Enter":case" ":t.preventDefault(),this.select(e,t);break}};#s(t){if(t.open&&t.hasChildren)return t.querySelector(":scope > tree-item-ui");let e=t;for(;e;){let i=e.nextElementSibling;if(i&&i.matches("tree-item-ui"))return i;e=e.parentElement?.closest("tree-item-ui")}return null}#n(t){let e=t.previousElementSibling;if(e&&e.matches("tree-item-ui")){let n=e;for(;n.open&&n.hasChildren;){let r=n.querySelectorAll(":scope > tree-item-ui");n=r[r.length-1]}return n}return t.parentElement?.closest("tree-item-ui")||null}disconnected(){this.removeEventListener("click",this.#e),this.removeEventListener("keydown",this.#i)}},on=class extends A{static properties={text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},badge:{type:String,default:"",reflect:!0}};static template=()=>null;get hasChildren(){return this.querySelector(":scope > tree-item-ui")!==null}get depth(){let t=0,e=this.parentElement;for(;e;)e.matches("tree-item-ui")&&t++,e=e.parentElement;return t}connected(){this.setAttribute("role","treeitem"),this.querySelector(':scope > [slot="row"]')||this.#t()}#t(){let t=document.createElement("div");t.setAttribute("slot","row"),t.setAttribute("tabindex","0");let e=document.createElement("icon-ui");if(e.setAttribute("slot","chevron"),e.setAttribute("name","caret-right"),t.appendChild(e),this.icon){let o=document.createElement("icon-ui");o.setAttribute("name",this.icon),o.setAttribute("slot","icon"),t.appendChild(o)}let i=document.createElement("span");i.setAttribute("slot","text"),i.textContent=this.text,t.appendChild(i);let n=document.createElement("span");n.setAttribute("slot","badge"),this.badge&&(n.textContent=this.badge),t.appendChild(n);let r=document.createElement("span");r.setAttribute("slot","actions"),t.appendChild(r),this.prepend(t)}render(){let t=this.querySelector(':scope > [slot="row"]');if(!t)return;t.style.paddingInlineStart=`${this.depth*16+4}px`,this.hasChildren?this.setAttribute("aria-expanded",String(this.open)):this.removeAttribute("aria-expanded");let e=t.querySelector('[slot="text"]');e&&this.text&&(e.textContent=this.text);let i=t.querySelector('[slot="badge"]');i&&(i.textContent=this.badge||"")}};w("tree-ui",rn),w("tree-item-ui",on);var an=class extends A{static requiredIcons=["caret-right"];static properties={collapsed:{type:Boolean,default:!1,reflect:!0},resizable:{type:Boolean,default:!1,reflect:!0},minWidth:{type:Number,default:200,attribute:"min-width",reflect:!0},maxWidth:{type:Number,default:9999,attribute:"max-width",reflect:!0},side:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=!1;#i=0;#s=0;#n=null;#r="";#o=!1;connected(){this.#o||(this.#o=!0,this.addEventListener("click",this.#a),this.addEventListener("keydown",this.#l)),this.resizable&&!this.querySelector('[slot="resize"]')&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","resize"),this.appendChild(this.#t)),(this.#t||this.resizable)&&(this.#t=this.#t||this.querySelector('[slot="resize"]'),this.#t?.addEventListener("pointerdown",this.#u))}render(){let t=this.querySelector(":scope > header");if(t&&(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-expanded",String(!this.collapsed)),!t.querySelector('[slot="chevron"]'))){let e=document.createElement("icon-ui");e.setAttribute("slot","chevron"),e.setAttribute("name","caret-right"),t.append(e)}}toggle(){this.collapsed=!this.collapsed,this.dispatchEvent(new Event("toggle",{bubbles:!0}))}#a=t=>{let e=this.querySelector(":scope > header");e&&(t.target===e||e.contains(t.target))&&this.toggle()};#l=t=>{t.target===this.querySelector(":scope > header")&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.toggle())};#u=t=>{if(t.isPrimary){t.preventDefault(),this.#e=!0,this.#i=t.clientX,this.#s=this.getBoundingClientRect().width,this.#n=t.pointerId,this.setAttribute("data-resizing","");try{this.#t.setPointerCapture(t.pointerId)}catch{}this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#c,{once:!0}),this.#t.addEventListener("pointercancel",this.#c,{once:!0}),this.#r=document.documentElement.style.cursor,document.documentElement.style.cursor="col-resize"}};#h=t=>{if(!this.#e)return;let e=this.side==="trailing"?-1:1,i=(t.clientX-this.#i)*e,n=Math.max(this.minWidth,Math.min(this.maxWidth,this.#s+i));this.style.width=`${n}px`};#c=()=>{if(this.#e){this.#e=!1,this.removeAttribute("data-resizing");try{this.#t?.releasePointerCapture(this.#n)}catch{}this.#n=null,this.#t?.removeEventListener("pointermove",this.#h),document.documentElement.style.cursor=this.#r}};disconnected(){this.removeEventListener("click",this.#a),this.removeEventListener("keydown",this.#l),this.#t?.removeEventListener("pointerdown",this.#u),this.#t?.removeEventListener("pointermove",this.#h),this.#e&&(document.documentElement.style.cursor=this.#r),this.#o=!1}};w("pane-ui",an);var ln=class extends A{static properties={scroll:{type:Boolean,default:!1,reflect:!0},maxWidth:{type:String,default:"",attribute:"max-width",reflect:!0},padding:{type:String,default:"",reflect:!0},stickyHeader:{type:Boolean,default:!1,attribute:"sticky-header",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.stickyHeader&&this.#i()}disconnected(){this.#s()}render(){this.stickyHeader&&!this.#t&&this.#i(),!this.stickyHeader&&this.#t&&this.#s()}#i(){let t=this.querySelector(":scope > :is(header, header-ui)");t&&(this.#t||(this.#t=document.createElement("div"),this.#t.setAttribute("data-page-sentinel",""),this.#t.style.cssText="height: 0; width: 0; pointer-events: none;",t.insertAdjacentElement("beforebegin",this.#t)),this.#e||(this.#e=new IntersectionObserver(e=>{this.toggleAttribute("data-header-stuck",!e[0].isIntersecting)},{threshold:0})),this.#e.observe(this.#t))}#s(){this.#e?.disconnect(),this.#e=null,this.#t?.remove(),this.#t=null,this.removeAttribute("data-header-stuck")}};w("page-ui",ln);var Mo=class extends A{static properties={disabled:{type:Boolean,default:!1,reflect:!0},loading:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"Type a message...",reflect:!0},model:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=[];#r=[];#o=null;#a=null;#l=null;#u=()=>this.#a?.click();#h=()=>{this.#a?.files?.length&&this.#g(this.#a.files),this.#a&&(this.#a.value="")};get value(){return this.#t?.value?.trim()??""}get attachments(){return[...this.#r]}set models(t){this.#n=t||[],this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model))}get models(){return this.#n}connected(){this.querySelector('[slot="toolbar"]')||(this.innerHTML=`
123
+ <textarea-ui placeholder="${this.placeholder}" rows="1"></textarea-ui>
124
+ <div slot="toolbar">
125
+ <select-ui slot="model" placeholder="Model" aria-label="Select model" divider></select-ui>
126
+ <button-ui icon="paper-plane-right" variant="ghost" slot="send" aria-label="Send message"></button-ui>
127
+ </div>
128
+ `),this.#t=this.querySelector("textarea-ui"),this.#e=this.querySelector('[slot="send"]'),this.#i=this.querySelector('[slot="model"]'),this.#e&&!this.#e.hasAttribute("aria-label")&&this.#e.setAttribute("aria-label","Send message"),this.#i&&!this.#i.hasAttribute("aria-label")&&this.#i.setAttribute("aria-label","Select model"),this.#n.length&&this.#i&&(this.#i.options=this.#n,this.model&&(this.#i.value=this.model));let t=this.querySelector('[slot="toolbar"]');if(t&&!t.querySelector('[slot="attach"]')){this.#a=document.createElement("input"),this.#a.type="file",this.#a.accept="image/*",this.#a.multiple=!0,this.#a.style.display="none",this.appendChild(this.#a),this.#s=document.createElement("button-ui"),this.#s.setAttribute("icon","image"),this.#s.setAttribute("variant","ghost"),this.#s.setAttribute("slot","attach"),this.#s.setAttribute("size","sm"),this.#s.setAttribute("aria-label","Attach image");let e=t.querySelector('[slot="send"]');t.insertBefore(this.#s,e),this.#s.addEventListener("press",this.#u),this.#a.addEventListener("change",this.#h)}this.#o=document.createElement("div"),this.#o.setAttribute("slot","preview"),this.#o.hidden=!0,this.insertBefore(this.#o,this.querySelector('[slot="toolbar"]')),this.addEventListener("paste",this.#p),this.#e?.addEventListener("press",this.#f),this.#t?.addEventListener("submit",this.#f),this.#i?.addEventListener("change",this.#d),this.addEventListener("pointerdown",this.#c)}render(){this.#t&&(this.#t.disabled=this.disabled,this.#t.placeholder=this.placeholder),this.#e&&(this.#e.disabled=this.disabled||this.loading),this.#i&&this.model&&this.#i.value!==this.model&&(this.#i.value=this.model)}#c=t=>{t.target.closest("button-ui, select-ui, input-ui, a")||(this.#l=requestAnimationFrame(()=>{this.#l=null,this.#t?.focus()}))};#d=()=>{this.model=this.#i?.value||""};#f=()=>{if(this.disabled||this.loading)return;let t=this.value;!t&&!this.#r.length||this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,detail:{text:t,model:this.model,attachments:this.attachments}}))};#p=t=>{let e=t.clipboardData?.items;if(!e)return;let i=[...e].filter(r=>r.type.startsWith("image/"));if(i.length===0)return;t.preventDefault();let n=i.map(r=>r.getAsFile()).filter(Boolean);n.length&&this.#g(n)};#g(t){for(let e of t){let i=new FileReader;i.onload=()=>{this.#r.push({type:"image",dataUrl:i.result,name:e.name}),this.#m()},i.readAsDataURL(e)}}#O(t){this.#r.splice(t,1),this.#m()}#m(){this.#o&&(this.#o.innerHTML="",this.#o.hidden=this.#r.length===0,this.#r.forEach((t,e)=>{let i=document.createElement("div");i.setAttribute("data-preview-item","");let n=document.createElement("img");n.src=t.dataUrl,n.alt=t.name||"attachment";let r=document.createElement("button");r.textContent="\xD7",r.setAttribute("data-preview-remove",""),r.addEventListener("click",()=>this.#O(e)),i.appendChild(n),i.appendChild(r),this.#o.appendChild(i)}))}clear(){this.#t?.clear(),this.#r=[],this.#o&&(this.#o.innerHTML="",this.#o.hidden=!0)}focus(){this.#t?.focus()}disconnected(){this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),this.removeEventListener("paste",this.#p),this.#e?.removeEventListener("press",this.#f),this.#t?.removeEventListener("submit",this.#f),this.#i?.removeEventListener("change",this.#d),this.#s?.removeEventListener("press",this.#u),this.#a?.removeEventListener("change",this.#h),this.removeEventListener("pointerdown",this.#c),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#o=null,this.#a=null}};customElements.define("chat-input-ui",Mo);var Fk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},_g=s=>s.replace(/[&<>"]/g,t=>Fk[t]);function hn(s){let t=s.split(`
129
+ `),e=[],i=0;for(;i<t.length;){let n=t[i],r=n.match(/^```(\w*)/);if(r){let l=r[1],h=[];for(i++;i<t.length&&!t[i].startsWith("```");)h.push(_g(t[i])),i++;i++;let c=h.join(`
130
+ `);e.push(l?`<code-ui language="${l}">${c}</code-ui>`:`<pre><code>${c}</code></pre>`);continue}if(!n.trim()){i++;continue}let o=n.match(/^(#{1,6})\s+(.+)/);if(o){let l=o[1].length;e.push(`<h${l}>${nl(o[2])}</h${l}>`),i++;continue}if(/^[-*]\s/.test(n)){let l=[];for(;i<t.length&&/^[-*]\s/.test(t[i]);)l.push(`<li>${nl(t[i].replace(/^[-*]\s/,""))}</li>`),i++;e.push(`<ul>${l.join("")}</ul>`);continue}if(/^\d+\.\s/.test(n)){let l=[];for(;i<t.length&&/^\d+\.\s/.test(t[i]);)l.push(`<li>${nl(t[i].replace(/^\d+\.\s/,""))}</li>`),i++;e.push(`<ol>${l.join("")}</ol>`);continue}let a=[];for(;i<t.length&&t[i].trim()&&!/^```|^#{1,6}\s|^[-*]\s|^\d+\.\s/.test(t[i]);)a.push(t[i]),i++;e.push(`<p>${nl(a.join(" "))}</p>`)}return e.join(`
131
+ `)}function nl(s){return _g(s).replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/_(.+?)_/g,"<em>$1</em>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>')}function Gk(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var cn=class extends A{static properties={streaming:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=null;#i=null;#s=null;get messages(){return[...this.#t]}connected(){!this.querySelector("header")&&!this.querySelector("section")&&(this.innerHTML=`
132
+ <header>
133
+ <span slot="avatar">AI</span>
134
+ <span slot="name">Assistant</span>
135
+ </header>
136
+ <section></section>
137
+ <footer>
138
+ <chat-input-ui placeholder="Type a message..."></chat-input-ui>
139
+ </footer>
140
+ `),this.#e=this.querySelector("section"),this.#i=this.querySelector("chat-input-ui"),this.#i?.addEventListener("submit",this.#n)}disconnected(){this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#i?.removeEventListener("submit",this.#n),this.#e=null,this.#i=null}#n=t=>{if(this.streaming)return;let{text:e,model:i}=t.detail||{};e&&(this.#i.clear(),this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,detail:{text:e,model:i}})))};appendMessage({role:t,content:e="",render:i=!1}){this.#t.push({role:t,content:e});let n=document.createElement("div");n.setAttribute("data-role",t);let r=i?hn(e):Gk(e);if(t==="user")n.innerHTML=`<div slot="bubble">${r}</div>`;else{let o=i?"":'<span slot="cursor"></span>';n.innerHTML=`
141
+ <span slot="avatar">${t==="assistant"?"AI":t[0].toUpperCase()}</span>
142
+ <div slot="bubble">${r}${o}</div>
143
+ `}return this.#e?.appendChild(n),this.#r(),n}appendChunk(t){let e=this.#t[this.#t.length-1];if(!e||e.role==="user")return;e.content+=t;let i=this.#e?.querySelector('[data-role]:last-child [slot="bubble"]');if(i){let n=i.querySelector('[slot="cursor"]');n&&n.remove(),i.insertAdjacentText("beforeend",t),i.insertAdjacentHTML("beforeend",'<span slot="cursor"></span>')}this.#r()}startStreaming(){this.streaming=!0,this.#i&&(this.#i.disabled=!0)}stopStreaming(){this.streaming=!1,this.#i&&(this.#i.disabled=!1),this.#e?.querySelector('[data-role]:last-child [slot="cursor"]')?.remove();let t=this.#t[this.#t.length-1];if(t&&t.role==="assistant"&&t.content){let e=this.#e?.querySelector('[data-role]:last-child [slot="bubble"]');e&&(e.innerHTML=hn(t.content))}this.#i?.focus()}clear(){this.#t.length=0,this.#e&&(this.#e.innerHTML="")}#r(){let t=this.#e;t&&(this.#s!=null&&cancelAnimationFrame(this.#s),this.#s=requestAnimationFrame(()=>{this.#s=null,this.isConnected&&(t.scrollTop=t.scrollHeight)}))}};w("chat-thread-ui",cn);var un=class extends A{#t=!1;#e=!1;#i=null;#s=null;#n=null;#r=null;#o="programmatic";static properties={text:{type:String,default:"",reflect:!0},side:{type:String,default:"right",reflect:!0},size:{type:String,default:"md",reflect:!0},permanent:{type:Boolean,default:!1,reflect:!0},open:{type:Boolean,default:!1,reflect:!0}};static parts={dialog:'<dialog slot="dialog"></dialog>',panel:'<div slot="panel"></div>',header:'<header slot="header"></header>',close:'<button-ui slot="close" icon="x" variant="ghost" size="sm" aria-label="Close"></button-ui>',body:'<section slot="body"></section>',footer:'<footer slot="footer"></footer>'};constructor(){super();let t=Object.getOwnPropertyDescriptor(this,"open");if(t?.set){let e=t.set;Object.defineProperty(this,"open",{get:t.get,set:i=>{e.call(this,i),this.#f()},configurable:!0})}}#a=t=>{t.target.closest('[slot="close"]')&&(this.#o="close-button",this.open=!1)};#l=t=>{t.preventDefault(),this.#o="escape",this.permanent||(this.open=!1)};#u=()=>{this.open=!1,this.#i?.focus(),this.#i=null;let t=this.#o;this.#o="programmatic",this.dispatchEvent(new CustomEvent("close",{detail:{reason:t},bubbles:!0}))};#h=t=>{t.target===this.#r&&!this.permanent&&(this.#o="backdrop",this.open=!1)};connected(){this.addEventListener("press",this.#a);let t=this.ensure("dialog");t&&!this.#t&&(this.#t=!0,this.#r=t,t.addEventListener("cancel",this.#l),t.addEventListener("close",this.#u),t.addEventListener("click",this.#h))}disconnected(){this.removeEventListener("press",this.#a),this.#r&&(this.#r.removeEventListener("cancel",this.#l),this.#r.removeEventListener("close",this.#u),this.#r.removeEventListener("click",this.#h)),this.#s!=null&&(clearTimeout(this.#s),this.#s=null),this.#n!=null&&(clearTimeout(this.#n),this.#n=null),this.#t=!1,this.#r=null}#c(){let t=getComputedStyle(this).getPropertyValue("--drawer-duration").trim();return parseFloat(t)||200}#d(t,e,i="append"){let n={header:"header",body:"section",footer:"footer"}[t],r=h=>h.getAttribute("slot")===t||n&&!h.getAttribute("slot")&&h.localName===n,o=[...this.children].find(r),a=[...e.children].find(h=>h.getAttribute("slot")===t);o&&a&&o!==a&&a.remove();let l=o||a||(()=>{let h=this.constructor._pp?.[t];if(!h)return null;let c=h.cloneNode(!0);return c.setAttribute("data-stamped",""),c})();return l?(l.getAttribute("slot")!==t&&l.setAttribute("slot",t),l.parentElement!==e&&(i==="prepend"?e.prepend(l):e.appendChild(l)),l):null}render(){let t=this.ensure("dialog");t!==this.#r&&(this.#r&&(this.#r.removeEventListener("cancel",this.#l),this.#r.removeEventListener("close",this.#u),this.#r.removeEventListener("click",this.#h)),this.#r=t,t.addEventListener("cancel",this.#l),t.addEventListener("close",this.#u),t.addEventListener("click",this.#h)),this.text?(t.setAttribute("aria-label",this.text),this.setAttribute("aria-label",this.text)):(t.removeAttribute("aria-label"),this.removeAttribute("aria-label"));let e=this.ensure("panel");e.parentElement!==t&&t.appendChild(e);let i=this.#d("header",e,"prepend");if(i){let o=i.querySelector(':scope > [slot="heading"][data-stamped]'),a=[...i.children].some(l=>!l.hasAttribute("data-stamped")&&(l.getAttribute("slot")==="heading"||/^h[1-6]$/.test(l.localName)));this.text&&!a?(o||(o=document.createElement("span"),o.setAttribute("slot","heading"),o.setAttribute("data-stamped",""),i.prepend(o)),o.textContent!==this.text&&(o.textContent=this.text)):o&&o.remove()}if(this.permanent)this.drop("close");else{let o=this.ensure("close");i&&o.parentElement!==i&&i.appendChild(o)}let n=[...this.children].filter(o=>o.getAttribute("slot")==="body"||o.localName==="section"&&!o.getAttribute("slot"));if(n.length===0)this.#d("body",e,"append");else for(let o of n)o.getAttribute("slot")!=="body"&&o.setAttribute("slot","body"),o.parentElement!==e&&e.appendChild(o);let r=[...this.children].find(o=>o.getAttribute("slot")==="footer"||!o.getAttribute("slot")&&o.localName==="footer");r&&(r.getAttribute("slot")!=="footer"&&r.setAttribute("slot","footer"),r.parentElement!==e&&e.appendChild(r)),this.#f()}#f(){let t=this.#r;if(t&&t.isConnected)if(this.open&&!t.open){this.#e=!1,this.#i=document.activeElement;try{t.showModal()}catch(e){console.error("[drawer-ui] showModal() failed \u2014 dialog may be detached:",e)}t.offsetHeight,t.setAttribute("data-open",""),this.#n!=null&&clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=null,this.dispatchEvent(new CustomEvent("opened",{bubbles:!0}))},this.#c())}else!this.open&&t.open&&!this.#e&&this.#p(t)}#p(t){this.#e=!0,this.#n!=null&&(clearTimeout(this.#n),this.#n=null),t.setAttribute("data-closing",""),t.offsetHeight,t.removeAttribute("data-open"),this.#s=setTimeout(()=>{this.#s=null,this.#e=!1,t.removeAttribute("data-closing"),t.open&&t.close()},this.#c())}show(){this.open=!0}hide(){this.open=!1}};w("drawer-ui",un);var dn=class extends A{#t=!1;#e=!1;#i=null;#s=null;#n=null;static properties={text:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},permanent:{type:Boolean,default:!1,reflect:!0},open:{type:Boolean,default:!1,reflect:!0}};static parts={dialog:'<dialog slot="dialog"></dialog>',panel:'<div slot="panel"></div>',header:'<header slot="header"></header>',close:'<button-ui slot="close" icon="x" variant="ghost" size="sm" aria-label="Close"></button-ui>',body:'<section slot="body"></section>',footer:'<footer slot="footer"></footer>'};#r=t=>{t.target.closest('[slot="close"]')&&(this.open=!1)};#o=t=>{t.preventDefault(),this.permanent||(this.open=!1)};#a=()=>{this.open=!1,this.#i?.focus(),this.#i=null,this.dispatchEvent(new Event("close",{bubbles:!0}))};#l=t=>{t.target===this.#n&&!this.permanent&&(this.open=!1)};connected(){this.addEventListener("press",this.#r);let t=this.ensure("dialog");t&&!this.#t&&(this.#t=!0,this.#n=t,t.addEventListener("cancel",this.#o),t.addEventListener("close",this.#a),t.addEventListener("click",this.#l))}disconnected(){this.removeEventListener("press",this.#r),this.#n&&(this.#n.removeEventListener("cancel",this.#o),this.#n.removeEventListener("close",this.#a),this.#n.removeEventListener("click",this.#l)),this.#s!=null&&(clearTimeout(this.#s),this.#s=null),this.#t=!1,this.#n=null}#u(){let t=getComputedStyle(this).getPropertyValue("--modal-duration").trim();return parseFloat(t)||200}render(){let t=this.ensure("dialog");this.text?(t.setAttribute("aria-label",this.text),this.setAttribute("aria-label",this.text)):(t.removeAttribute("aria-label"),this.removeAttribute("aria-label"));let e=this.ensure("panel");e.parentElement!==t&&t.appendChild(e);let i=this.ensure("header");if(i.parentElement!==e&&e.prepend(i),i.setAttribute("text",this.text),this.permanent)this.drop("close");else{let l=this.ensure("close");l.parentElement!==i&&i.appendChild(l)}let n=[...this.children].find(l=>l.getAttribute("slot")==="body"||!l.getAttribute("slot")&&l.localName==="section"),r=[...this.children].filter(l=>!l.getAttribute("slot")&&l.localName!=="section"&&l.localName!=="dialog"&&l.localName!=="footer"),o;n?(n.getAttribute("slot")!=="body"&&n.setAttribute("slot","body"),n.parentElement!==e&&e.appendChild(n),e.querySelector(':scope > [slot="body"][data-stamped]')?.remove(),o=n):(o=this.ensure("body"),o.setAttribute("data-stamped",""),o.parentElement!==e&&e.appendChild(o));for(let l of r)l!==o&&o.appendChild(l);let a=[...this.children].find(l=>l.getAttribute("slot")==="footer"||!l.getAttribute("slot")&&l.localName==="footer");if(a)a.getAttribute("slot")!=="footer"&&a.setAttribute("slot","footer"),a.parentElement!==e&&e.appendChild(a),e.querySelector(':scope > [slot="footer"][data-stamped]')?.remove();else{let l=this.ensure("footer");l.setAttribute("data-stamped",""),l.parentElement!==e&&e.appendChild(l)}this.open&&!t.open?(this.#e=!1,this.#i=document.activeElement,t.showModal(),t.offsetHeight,t.setAttribute("data-open","")):!this.open&&t.open&&!this.#e&&this.#h(t)}#h(t){this.#e=!0,t.setAttribute("data-closing",""),t.offsetHeight,t.removeAttribute("data-open"),this.#s=setTimeout(()=>{this.#s=null,this.#e=!1,t.removeAttribute("data-closing"),t.open&&t.close()},this.#u())}show(){this.open=!0}hide(){this.open=!1}};w("modal-ui",dn);var fn=class extends A{static properties={position:{type:String,default:"bottom-right",reflect:!0},max:{type:Number,default:5,reflect:!0}};static template=()=>Kt``;connected(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Feed")}},pn=class s extends A{#t=null;#e=!1;#i=null;#s=null;static properties={text:{type:String,default:"",reflect:!0},heading:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},duration:{type:Number,default:4e3,reflect:!0},dismissible:{type:Boolean,default:!1,reflect:!0},action:{type:String,default:"",reflect:!0}};static parts={body:'<div slot="body"></div>'};static template=()=>Kt``;#n=t=>{if(t.target.closest("[data-feed-close]")){this.dismiss();return}if(t.target.closest("[data-feed-action]")){try{this.#r?.()}catch(e){console.warn("[feed-item] action handler threw:",e)}this.dismiss()}};#r=null;#o=null;#a=null;connected(){this.addEventListener("press",this.#n)}#l(){let t=getComputedStyle(this).getPropertyValue("--feed-item-duration").trim();return parseFloat(t)||200}render(){let t=this.ensure("body");if(t.textContent="",this.heading){let h=document.createElement("strong");h.textContent=this.heading,h.style.display="block",t.appendChild(h)}if(this.text){let h=document.createElement("span");h.textContent=this.text,t.appendChild(h)}let e=!this.duration||this.duration<=0,i=this.variant==="danger"||this.variant==="warning",n=e&&!!this.action,r="status";n?r="alertdialog":e&&i&&(r="alert"),this.setAttribute("role",r),this.setAttribute("aria-live",r==="alert"||r==="alertdialog"?"assertive":"polite"),n&&this.setAttribute("aria-modal","false");let o=this.dismissible||e,a=this.querySelector(":scope > [data-feed-close]");o&&!a?(a=document.createElement("button-ui"),a.setAttribute("data-feed-close",""),a.setAttribute("icon","x"),a.setAttribute("variant","ghost"),a.setAttribute("size","sm"),a.setAttribute("aria-label","Dismiss"),this.appendChild(a)):!o&&a&&a.remove();let l=this.querySelector(":scope > [data-feed-action]");this.action?(l||(l=document.createElement("button-ui"),l.setAttribute("data-feed-action",""),l.setAttribute("variant","ghost"),l.setAttribute("size","sm"),a&&a.parentElement===this?this.insertBefore(l,a):this.appendChild(l)),l.setAttribute("text",this.action)):l&&l.remove(),n?this.#h():this.#c(),!this.hasAttribute("data-open")&&!this.#e&&(this.#s=requestAnimationFrame(()=>{this.#s=null,this.setAttribute("data-open","")})),this.#u()}#u(){this.#t&&clearTimeout(this.#t),this.duration&&this.duration>0&&(this.#t=setTimeout(()=>this.dismiss(),this.duration))}dismiss(){this.#e||(this.#e=!0,this.#t&&(clearTimeout(this.#t),this.#t=null),this.removeAttribute("data-open"),this.setAttribute("data-closing",""),this.#i=setTimeout(()=>{this.#i=null;let t=this.parentElement;this.dispatchEvent(new Event("close",{bubbles:!0})),this.remove(),t?.matches?.("feed-ui")&&Xe.releaseContainerIfEmpty(t)},this.#l()))}update(t){if(!(!t||typeof t!="object")){for(let e of Object.keys(t))e in s.properties&&(this[e]=t[e]);typeof t.onAction=="function"&&(this.#r=t.onAction),this.#u()}}#h(){if(this.#a)return;this.#o=document.activeElement;let t=()=>[...this.querySelectorAll('button, button-ui, [tabindex]:not([tabindex="-1"]), input, [data-feed-action], [data-feed-close]')].filter(e=>!e.hasAttribute("disabled")&&e.offsetParent!==null);this.#a=e=>{if(e.key==="Escape"){e.stopPropagation(),this.dismiss();return}if(e.key!=="Tab")return;let i=t();if(!i.length)return;let n=i[0],r=i[i.length-1],o=document.activeElement;e.shiftKey&&o===n?(e.preventDefault(),r.focus()):!e.shiftKey&&o===r&&(e.preventDefault(),n.focus())},this.addEventListener("keydown",this.#a,!0),queueMicrotask(()=>{let e=t();(this.querySelector("[data-feed-action]")||e[0])?.focus?.()})}#c(){if(this.#a){this.removeEventListener("keydown",this.#a,!0),this.#a=null;try{this.#o?.focus?.()}catch{}this.#o=null}}disconnected(){this.removeEventListener("press",this.#n),this.#t&&(clearTimeout(this.#t),this.#t=null),this.#i&&(clearTimeout(this.#i),this.#i=null),this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#c()}},Xe=class s{static#t=new Map;static get(t="bottom-right"){let e=s.#t.get(t);if(e&&e.isConnected)return e;e=document.createElement("feed-ui"),e.setAttribute("position",t),"popover"in HTMLElement.prototype&&e.setAttribute("popover","manual"),document.body.appendChild(e);try{e.showPopover?.()}catch{}return s.#t.set(t,e),e}static post(t={}){let{text:e="",heading:i="",icon:n="",variant:r="default",duration:o=4e3,position:a="bottom-right",dismissible:l,id:h,action:c="",onAction:u}=t,d=r==="error"?"danger":r,f=s.get(a),p=parseInt(f.getAttribute("max")||"5",10),m=[...f.children].filter(g=>g.tagName==="FEED-ITEM-UI"&&!g.hasAttribute("data-queued")).length,O=document.createElement("feed-item-ui");return h&&O.setAttribute("data-id",h),O.text=e,O.heading=i,O.icon=n,O.variant=d,O.duration=c?0:o,l!=null&&(O.dismissible=!!l),c&&(O.action=c),m>=p&&O.setAttribute("data-queued",""),f.appendChild(O),typeof u=="function"&&O.update({onAction:u}),{id:h??null,dismiss:()=>O.dismiss(),update:g=>O.update(g)}}static clear(t="bottom-right"){let e=s.#t.get(t);if(e)for(let i of[...e.children])i.tagName==="FEED-ITEM-UI"&&i.dismiss?.()}static purge(){for(let t of s.#t.values()){try{t.hidePopover?.()}catch{}t.remove()}s.#t.clear()}static releaseContainerIfEmpty(t){if(!t)return;let e=t.querySelector("feed-item-ui[data-queued]");if(e&&e.removeAttribute("data-queued"),!(t.children.length>0)){try{t.hidePopover?.()}catch{}t.remove();for(let[i,n]of s.#t)n===t&&s.#t.delete(i)}}};w("feed-ui",fn),w("feed-item-ui",pn),typeof window<"u"&&!window.__adiaFeedListenerInstalled&&(window.__adiaFeedListenerInstalled=!0,window.addEventListener("feed",s=>{s?.detail&&typeof s.detail=="object"&&Xe.post(s.detail)}));var Ji=class extends A{static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"info",reflect:!0},duration:{type:Number,default:4e3,reflect:!0},position:{type:String,default:"bottom-right",reflect:!0}};static template=()=>Kt``;connected(){this.__routedToFeed||(this.__routedToFeed=!0,Xe.post({text:this.text,variant:this.variant==="error"?"danger":this.variant,duration:this.duration,position:this.position}),queueMicrotask(()=>{try{this.remove()}catch{}}))}static show(t={}){let{text:e,variant:i="info",duration:n=4e3,position:r="bottom-right"}=t,o=Xe.get(r);return o&&!o.hasAttribute("data-spawned-by")&&o.setAttribute("data-spawned-by","toast"),Xe.post({text:e,variant:i==="error"?"danger":i,duration:n,position:r})}};w("toast-ui",Ji),typeof window<"u"&&!window.__adiaToastListenerInstalled&&(window.__adiaToastListenerInstalled=!0,window.addEventListener("toast",s=>{s?.detail&&typeof s.detail=="object"&&Ji.show(s.detail)}));var Ro=class extends A{static properties={text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","tabpanel")}render(){this.text&&this.setAttribute("aria-label",this.text),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}};customElements.define("tab-ui",Ro);var mn=class extends A{static properties={value:{type:String,default:"",reflect:!0},orientation:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;connected(){if(this.setAttribute("role","tablist"),this.addEventListener("click",this.#a),this.addEventListener("keydown",this.#l),!this.value){let t=this.querySelector("tab-ui:not([disabled])");t&&(this.value=t.value||t.getAttribute("value")||"")}}disconnected(){this.#i!=null&&(cancelAnimationFrame(this.#i),this.#i=null),this.removeEventListener("click",this.#a),this.removeEventListener("keydown",this.#l),this.#t=null,this.#e=null}get#s(){return[...this.querySelectorAll("tab-ui")]}get#n(){return this.#s.filter(t=>!t.disabled)}render(){let t=this.#s;if(t.length){this.#t||(this.#t=document.createElement("div"),this.#t.setAttribute("slot","strip"),this.#t.setAttribute("role","presentation")),this.#t.parentElement!==this&&this.prepend(this.#t),this.reconcile(this.#t,t,e=>e.value||e.getAttribute("value")||"",(e,i,n)=>{let r=e.value||e.getAttribute("value")||"",o=e.text||e.getAttribute("text")||"",a=e.icon||e.getAttribute("icon")||"",l=r===this.value,h=e.disabled||e.hasAttribute("disabled");if(n){if(n.textContent="",a){let u=document.createElement("icon-ui");u.setAttribute("name",a),n.appendChild(u)}return o&&n.appendChild(document.createTextNode(o)),n.setAttribute("aria-selected",String(l)),n.setAttribute("tabindex",l?"0":"-1"),h?n.setAttribute("disabled",""):n.removeAttribute("disabled"),l?n.setAttribute("data-active",""):n.removeAttribute("data-active"),n.dataset.value=r,n}let c=document.createElement("div");if(c.setAttribute("role","tab"),c.setAttribute("slot","tab-button"),c.dataset.value=r,c.setAttribute("aria-selected",String(l)),c.setAttribute("tabindex",l?"0":"-1"),h&&c.setAttribute("disabled",""),l&&c.setAttribute("data-active",""),a){let u=document.createElement("icon-ui");u.setAttribute("name",a),c.appendChild(u)}return o&&c.appendChild(document.createTextNode(o)),c}),this.#r();for(let e of t)(e.value||e.getAttribute("value")||"")===this.value?(e.removeAttribute("hidden"),e.setAttribute("role","tabpanel")):e.setAttribute("hidden","")}}#r(){let t=this.#t?.querySelector('[slot="tab-button"][data-active]');if(!t){this.#e&&(this.#e.style.opacity="0");return}let e=!this.#e;e&&(this.#e=document.createElement("span"),this.#e.setAttribute("slot","indicator"),this.#t.appendChild(this.#e));let i=this.#t.getBoundingClientRect(),n=t.getBoundingClientRect(),r=this.orientation==="vertical",o=()=>{if(r){let a=n.top-i.top;this.#e.style.transform=`translateY(${a}px)`,this.#e.style.height=`${n.height}px`,this.#e.style.width=""}else{let a=n.left-i.left;this.#e.style.transform=`translateX(${a}px)`,this.#e.style.width=`${n.width}px`,this.#e.style.height=""}this.#e.style.opacity="1"};e?(this.#e.style.transition="none",o(),this.#i=requestAnimationFrame(()=>{this.#i=null,this.#e&&(this.#e.style.transition="")})):o()}#o(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#a=t=>{let e=t.target.closest('[slot="tab-button"]');!e||!this.contains(e)||e.hasAttribute("disabled")||this.#o(e.dataset.value)};#l=t=>{let e=t.target.closest('[slot="tab-button"]');if(!e||!this.contains(e))return;let i=[...this.#t.querySelectorAll('[slot="tab-button"]:not([disabled])')],n=i.indexOf(e);if(n<0)return;let r=this.orientation==="vertical",o=r?"ArrowDown":"ArrowRight",a=r?"ArrowUp":"ArrowLeft",l;switch(t.key){case o:l=n<i.length-1?n+1:0;break;case a:l=n>0?n-1:i.length-1;break;case"Home":l=0;break;case"End":l=i.length-1;break;default:return}t.preventDefault(),i[l].focus(),this.#o(i[l].dataset.value)}};w("tabs-ui",mn);var gn=class s extends A{static properties={text:{type:String,default:"",reflect:!0},placement:{type:String,default:"top",reflect:!0},delay:{type:Number,default:400,reflect:!0},follows:{type:String,default:"trigger",reflect:!0},for:{type:String,default:"",reflect:!0},indicator:{type:String,default:"none",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;connected(){this.follows==="pointer"?this.#u():(this.addEventListener("mouseenter",this.#r),this.addEventListener("focusin",this.#r),this.addEventListener("mouseleave",this.#o),this.addEventListener("focusout",this.#o))}disconnected(){this.removeEventListener("mouseenter",this.#r),this.removeEventListener("focusin",this.#r),this.removeEventListener("mouseleave",this.#o),this.removeEventListener("focusout",this.#o),this.#h(),this.#l()}render(){this.#t&&this.follows!=="pointer"&&(this.#t.textContent=this.text),this.#t&&this.follows==="pointer"&&this.#n&&this.#g(this.#n)}#r=()=>{this.text&&(this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>this.#a(),this.delay))};#o=()=>{this.#e&&(clearTimeout(this.#e),this.#e=null),this.#l()};#a(){if(this.#t)return;let t=document.createElement("div"),e=`tooltip-${Date.now()}`;t.id=e,t.setAttribute("popover","manual"),t.setAttribute("role","tooltip"),t.classList.add("tooltip-popup"),t.textContent=this.text,document.body.appendChild(t),this.setAttribute("aria-describedby",e);try{t.showPopover()}catch{}this.#t=t,this.#i=Tt(this,t,{placement:this.placement,gap:6})}#l(){if(this.#e&&(clearTimeout(this.#e),this.#e=null),!!this.#t){this.removeAttribute("aria-describedby"),this.#i?.(),this.#i=null;try{this.#t.hidePopover()}catch{}this.#t.remove(),this.#t=null,this.#n=null}}#u(){if(this.#h(),!this.for)return;let t=this.getRootNode();if(this.#s=t&&t.getElementById?t.getElementById(this.for):document.getElementById(this.for),!this.#s){s._warnedMissing||(s._warnedMissing=new WeakSet),s._warnedMissing.has(this)||(console.warn(`[tooltip-ui] follows="pointer" [for="${this.for}"] did not resolve to an element.`),s._warnedMissing.add(this));return}this.#s.addEventListener("chart-hover",this.#d),this.#s.addEventListener("chart-leave",this.#c)}#h(){this.#s&&(this.#s.removeEventListener("chart-hover",this.#d),this.#s.removeEventListener("chart-leave",this.#c)),this.#s=null}#c=()=>this.#l();#d=t=>{let e=t.detail;if(e){if(this.#n=e,!this.#t){this.#t=this.#f(),this.#p();try{this.#t.showPopover()}catch{}}this.#g(e),this.#O(e.pointerX,e.pointerY)}};#f(){let t=document.createElement("div");return t.setAttribute("popover","manual"),t.setAttribute("role","tooltip"),t.setAttribute("data-follows","pointer"),t.setAttribute("data-indicator",this.indicator||"none"),t.classList.add("tooltip-popup"),document.body.appendChild(t),t}#p(){if(!this.#s||!this.#t)return;let t=this.#s.style;for(let i=0;i<t.length;i++){let n=t[i];n.startsWith("--color-")&&this.#t.style.setProperty(n,t.getPropertyValue(n))}let e=getComputedStyle(this.#s);for(let i=0;i<10;i++){let n=e.getPropertyValue(`--chart-${i}`).trim();n&&this.#t.style.setProperty(`--chart-${i}`,n)}}#g(t){if(!this.#t)return;let{label:e,value:i,pct:n,series:r,slot:o,payload:a}=t,l=this.indicator||"none",h=Array.isArray(a)&&a.length>0?a:[{series:r,label:e,value:i,pct:n,slot:o,hovered:!0}],c=[];e!=null&&c.push(`<span data-tip-role="label">${this.#m(String(e))}</span>`);for(let u of h){let d=u.series??null,f=u.value,p=u.pct,m=u.slot!=null?u.slot:0,O=d?`var(--color-${d}, var(--chart-${m}))`:`var(--chart-${m})`;if(f==null&&p==null)continue;let g=f!=null?this.#m(String(f)):"",y=p!=null?`<span data-tip-role="pct"> (${p}%)</span>`:"",v=l!=="none"?`<span data-indicator style="--tooltip-indicator-color: ${O}"></span>`:"",x=d?`<span data-tip-role="name">${this.#m(d)}</span>`:"",S=u.hovered?" data-hovered":"";c.push(`<span data-tip-row${S}>${v}${x}<span data-tip-role="value">${g}${y}</span></span>`)}this.#t.setAttribute("data-indicator",l),this.#t.setAttribute("aria-live","polite"),this.#t.innerHTML=c.join("")}#O(t,e){if(!this.#t||t==null||e==null)return;let i=12,n=8,r=this.#t;r.style.position="fixed",r.style.left="0",r.style.top="0";let o=r.offsetWidth||0,a=r.offsetHeight||0,l=t-o/2,h=e-a-i;l<n&&(l=n),l+o>window.innerWidth-n&&(l=window.innerWidth-o-n),h<n&&(h=e+i),r.style.left=`${l}px`,r.style.top=`${h}px`}#m(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}};w("tooltip-ui",gn);var Hk={new:{variant:"success",text:"New"},updated:{variant:"info",text:"Updated"},deprecated:{variant:"warning",text:"Deprecated"},removed:{variant:"danger",text:"Removed"},beta:{variant:"accent",text:"Beta"}},On=class extends A{static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"md",reflect:!0},icon:{type:String,default:"",reflect:!0},status:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.hasAttribute("role")||this.setAttribute("role","status")}render(){if(this.status){let t=Hk[this.status];t&&(this.variant!==t.variant&&(this.variant=t.variant),this.text!==t.text&&(this.text=t.text))}if(this.text&&this.setAttribute("aria-label",this.text),this.icon){let t=this.querySelector(":scope > icon-ui");if(!t||t.getAttribute("name")!==this.icon){t&&t.remove();let e=document.createElement("icon-ui");e.setAttribute("name",this.icon),e.setAttribute("size","sm"),this.prepend(e)}}else this.querySelector(":scope > icon-ui")?.remove()}};w("badge-ui",On);var bn=class extends A{static properties={separator:{type:String,default:"/",reflect:!0},collapse:{type:Boolean,default:!1,reflect:!0},collapseKeepLeading:{type:Number,default:1,attribute:"collapse-keep-leading",reflect:!0},collapseKeepTrailing:{type:Number,default:2,attribute:"collapse-keep-trailing",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","navigation"),this.setAttribute("aria-label","Breadcrumb")}render(){this.querySelectorAll("[data-sep], [data-overflow]").forEach(l=>l.remove());let t=Array.from(this.children).filter(l=>!l.hasAttribute("data-sep")&&!l.hasAttribute("data-overflow")),e=t.length-1;t.forEach((l,h)=>{l.setAttribute("data-item",""),l.removeAttribute("data-collapsed"),h===e?l.setAttribute("aria-current","page"):l.removeAttribute("aria-current")});let i=Math.max(0,this.collapseKeepLeading|0),n=Math.max(0,this.collapseKeepTrailing|0),r=i+n+1;if(this.collapse&&t.length>=Math.max(r,4)){let l=t.slice(i,t.length-n);l.forEach(c=>c.setAttribute("data-collapsed",""));let h=this.#t(l);i>0?t[i-1].after(h):this.prepend(h)}let a=Array.from(this.children).filter(l=>!l.hasAttribute("data-sep")&&!l.hasAttribute("data-collapsed"));for(let l=0;l<a.length-1;l++){let h=document.createElement("span");h.setAttribute("data-sep",""),h.setAttribute("aria-hidden","true"),h.textContent=this.separator,a[l].after(h)}}#t(t){let e=document.createElement("menu-ui");e.setAttribute("data-overflow",""),e.setAttribute("data-item",""),e.setAttribute("placement","bottom-start");let i=document.createElement("button-ui");i.setAttribute("slot","trigger"),i.setAttribute("text","\u2026"),i.setAttribute("variant","ghost"),i.setAttribute("size","sm"),i.setAttribute("aria-label","Show collapsed crumbs"),e.appendChild(i);for(let n of t){let r=document.createElement("menu-item-ui");r.setAttribute("text",n.textContent.trim()),n.tagName==="A"&&n.hasAttribute("href")&&r.setAttribute("value",n.getAttribute("href")),e.appendChild(r)}return e.addEventListener("action",n=>{let r=n.detail?.value;r&&r!=="#"&&(window.location.href=r)}),e}};w("breadcrumb-ui",bn);var yn=class s extends A{static requiredIcons=["magnifying-glass"];static properties={placeholder:{type:String,default:"Type a command...",reflect:!0},open:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=[];#i=-1;#s=null;#n=null;#r=null;#o=null;#a=!1;#l=new WeakMap;static#u=3;#h=t=>{let e=t.target instanceof Element?t.target.closest('[role="option"]:not([aria-disabled])'):null;if(!e)return;let i=this.#l.get(e);i&&this.#x(i)};#c=t=>{let e=t.target instanceof Element?t.target.closest('[role="option"]:not([aria-disabled])'):null;if(!e)return;let i=parseInt(e.dataset.idx);Number.isFinite(i)&&i!==this.#i&&this.#v(i)};connected(){this.#a||(this.#a=!0,this.addEventListener("keydown",this.#y))}render(){this.#s||(this.#d(),this.innerHTML=`
144
+ <header>
145
+ <icon-ui name="magnifying-glass" slot="icon"></icon-ui>
146
+ <input type="text" placeholder="${this.placeholder}" slot="input" />
147
+ </header>
148
+ <section slot="list"></section>
149
+ <footer>
150
+ <span data-hint><kbd>\u2191</kbd><kbd>\u2193</kbd> Navigate</span>
151
+ <span data-hint><kbd>\u21B5</kbd> Select</span>
152
+ <span data-hint><kbd>\u238B</kbd> Close</span>
153
+ </footer>
154
+ `,this.#s=this.querySelector("input"),this.#n=this.querySelector('[slot="list"]'),this.#o=this.querySelector("footer"),this.#s.addEventListener("input",this.#k),this.#n.addEventListener("click",this.#h),this.#n.addEventListener("pointerover",this.#c),this.#p()),this.open&&(this.#r=requestAnimationFrame(()=>{this.#r=null,this.#s?.focus()}))}get value(){return this.#s?.value||""}set value(t){if(!this.#s)return;let e=t??"";this.#s.value=e,this.#p(e)}focus(){this.#s?.focus()}setItems(t){this.#t=t,this.#p()}#d(){let t=[];for(let e of this.children)if(e.tagName==="OPTGROUP"){let i=e.label,n={label:i,items:[]};for(let r of e.querySelectorAll("option"))n.items.push(this.#f(r,i));t.push(n)}else e.tagName==="OPTION"&&t.push(this.#f(e,""));this.#t=t}#f(t,e=""){return{value:t.value,label:t.textContent.trim(),icon:t.dataset.icon||"",shortcut:t.dataset.shortcut||"",keywords:t.dataset.keywords||"",disabled:t.disabled,category:e}}#p(t=""){if(!this.#n)return;this.#n.innerHTML="",this.#i=-1;let e=t.toLowerCase(),i=this.#t,n=0;if(!e&&this.#e.length){let r=this.#e.map(o=>this.#g(o)).filter(o=>o&&!o.disabled);if(r.length){let o=document.createElement("div");o.setAttribute("data-group",""),o.setAttribute("data-recent",""),o.innerHTML="<div data-group-label>Recent</div>";for(let a of r)o.appendChild(this.#m(a,n)),n++;this.#n.appendChild(o)}}for(let r of i)if(r.items){let o=r.items.filter(l=>this.#b(l,e));if(!o.length)continue;let a=document.createElement("div");a.setAttribute("data-group",""),a.innerHTML=`<div data-group-label>${r.label}</div>`;for(let l of o)a.appendChild(this.#m(l,n)),n++;this.#n.appendChild(a)}else{if(!this.#b(r,e))continue;this.#n.appendChild(this.#m(r,n)),n++}if(!n){let r=document.createElement("div");r.setAttribute("data-empty",""),r.textContent="No results found.",this.#n.appendChild(r)}n>0&&this.#v(0)}#g(t){for(let e of this.#t)if(e.items){let i=e.items.find(n=>n.value===t);if(i)return i}else if(e.value===t)return e;return null}#O(t){t&&(this.#e=[t,...this.#e.filter(e=>e!==t)].slice(0,s.#u))}#m(t,e){let i=document.createElement("div");return i.setAttribute("role","option"),i.setAttribute("data-value",t.value),i.setAttribute("data-idx",e),t.disabled&&i.setAttribute("aria-disabled","true"),i.innerHTML=`
155
+ ${t.icon?`<icon-ui name="${t.icon}"></icon-ui>`:""}
156
+ <span data-text>${t.label}</span>
157
+ ${t.shortcut?`<span data-shortcut>${t.shortcut}</span>`:""}
158
+ `,this.#l.set(i,t),i}#b(t,e){return e?(t.label||"").toLowerCase().includes(e)||(t.value||"").toLowerCase().includes(e)||(t.keywords||"").toLowerCase().includes(e):!0}#v(t){let e=this.#n.querySelectorAll('[role="option"]:not([aria-disabled])'),i=this.#n.querySelector("[data-active]");i&&i.removeAttribute("data-active");let n=[...e].find(r=>parseInt(r.dataset.idx)===t);n&&(n.setAttribute("data-active",""),n.scrollIntoView({block:"nearest"}),this.#i=t)}#S(t){let e=[...this.#n.querySelectorAll('[role="option"]:not([aria-disabled])')];if(!e.length)return;let i=this.#n.querySelector("[data-active]"),r=(i?e.indexOf(i):-1)+t;r<0&&(r=e.length-1),r>=e.length&&(r=0),this.#v(parseInt(e[r].dataset.idx))}#x(t){this.#O(t.value),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{value:t.value,label:t.label,category:t.category||""}}))}#w(){let t=this.#n.querySelector("[data-active]");if(!t)return;let e=t.dataset.value,i=t.querySelector("[data-text]")?.textContent||"",r=(this.#l.get(t)||this.#g(e))?.category||"";this.#O(e),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{value:e,label:i,category:r}}))}#k=()=>{this.#p(this.#s.value)};#y=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),this.#S(1);break;case"ArrowUp":t.preventDefault(),this.#S(-1);break;case"Enter":t.preventDefault(),this.#w();break;case"Tab":t.preventDefault(),this.#w();break;case"Escape":t.preventDefault(),this.dispatchEvent(new Event("dismiss",{bubbles:!0}));break}};disconnected(){this.#r!=null&&(cancelAnimationFrame(this.#r),this.#r=null),this.removeEventListener("keydown",this.#y),this.#s?.removeEventListener("input",this.#k),this.#n?.removeEventListener("click",this.#h),this.#n?.removeEventListener("pointerover",this.#c),this.#s=null,this.#n=null,this.#o=null,this.#a=!1}};w("command-ui",yn);var Xo=.4;function iu(s,t,e){let i=e*Math.PI/180;return{L:s,a:t*Math.cos(i),b:t*Math.sin(i)}}function su(s,t,e){let i=s+.3963377774*t+.2158037573*e,n=s-.1055613458*t-.0638541728*e,r=s-.0894841775*t-1.291485548*e,o=i*i*i,a=n*n*n,l=r*r*r;return[4.0767416621*o-3.3077115913*a+.2309699292*l,-1.2684380046*o+2.6097574011*a-.3413193965*l,-.0041960863*o-.7034186147*a+1.707614701*l]}function ii(s){return s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055}function nu(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Vg(s,t,e){let{a:i,b:n}=iu(s,t,e),[r,o,a]=su(s,i,n);return[Math.max(0,Math.min(1,ii(r))),Math.max(0,Math.min(1,ii(o))),Math.max(0,Math.min(1,ii(a)))]}function Kk(s,t,e){let i=n=>Math.round(n*255).toString(16).padStart(2,"0");return`#${i(s)}${i(t)}${i(e)}`}function vn(s,t,e){let[i,n,r]=Vg(s,t,e);return Kk(i,n,r)}function Jk(s){s=s.replace("#",""),s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]);let t=nu(parseInt(s.slice(0,2),16)/255),e=nu(parseInt(s.slice(2,4),16)/255),i=nu(parseInt(s.slice(4,6),16)/255),n=Math.cbrt(.4122214708*t+.5363325363*e+.0514459929*i),r=Math.cbrt(.2119034982*t+.6806995451*e+.1073969566*i),o=Math.cbrt(.0883024619*t+.2817188376*e+.6299787005*i),a=.2104542553*n+.793617785*r-.0040720468*o,l=1.9779984951*n-2.428592205*r+.4505937099*o,h=.0259040371*n+.7827717662*r-.808675766*o,c=Math.sqrt(l*l+h*h),u=Math.atan2(h,l)*180/Math.PI;return u<0&&(u+=360),{L:a,C:c,H:u}}function Wg(s,t,e){return s>=-.001&&s<=1+.001&&t>=-.001&&t<=1+.001&&e>=-.001&&e<=1+.001}function Io(s,t,e){let{a:i,b:n}=iu(s,t,e),[r,o,a]=su(s,i,n);if(Wg(ii(r),ii(o),ii(a)))return t;let l=0,h=t;for(let c=0;c<8;c++){let u=(l+h)/2,{a:d,b:f}=iu(s,u,e),[p,m,O]=su(s,d,f);Wg(ii(p),ii(m),ii(O))?l=u:h=u}return l}var xn=class s extends z{static requiredIcons=["copy","check","warning"];static#t=new WeakSet;static properties={...z.properties,value:{type:String,default:"#3b82f6",reflect:!0},format:{type:String,default:"hex",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},maxChroma:{type:Number,default:1/0,reflect:!0,attribute:"max-chroma"},maxL:{type:Number,default:1,reflect:!0,attribute:"max-l"},minL:{type:Number,default:0,reflect:!0,attribute:"min-l"},hueDriftMax:{type:Number,default:NaN,reflect:!0,attribute:"hue-drift-max"},baseHue:{type:Number,default:NaN,reflect:!0,attribute:"base-hue"}};#e=.6;#i=.15;#s=230;#n=NaN;#r=!1;#o=null;#a=!1;#l=null;#u=null;#h=null;#c=null;#d=null;#f=null;#p=null;#g=null;#O=null;#m=null;#b=null;#v=null;#S=[];#x=null;static template=()=>null;#w=t=>{let e=t.currentTarget,i=e.getAttribute("data-channel");i==="hue"?this.#s=+e.value:i==="chroma"?this.#i=+e.value:i==="lightness"&&(this.#e=+e.value),this.#I("input")};#k=t=>{this.disabled||(this.#o="area",this.#h.setPointerCapture(t.pointerId),this.#Z(t))};#y=t=>{this.#o==="area"&&this.#Z(t)};#$=()=>{this.#o==="area"&&(this.#o=null,this.#I("change"))};#Q=t=>{this.disabled||(this.#o="hue",this.#d.setPointerCapture(t.pointerId),this.#X(t))};#P=t=>{this.#o==="hue"&&this.#X(t)};#C=()=>{this.#o==="hue"&&(this.#o=null,this.#I("change"))};#L=t=>{if(this.disabled)return;let e=t.shiftKey?.05:.01,i=t.shiftKey?.04:.004;switch(t.key){case"ArrowRight":t.preventDefault(),this.#i=Math.min(Xo,this.#i+i);break;case"ArrowLeft":t.preventDefault(),this.#i=Math.max(0,this.#i-i);break;case"ArrowUp":t.preventDefault(),this.#e=Math.min(1,this.#e+e);break;case"ArrowDown":t.preventDefault(),this.#e=Math.max(0,this.#e-e);break;default:return}this.#I("change")};#E=t=>{if(this.disabled)return;let e=t.shiftKey?10:1;switch(t.key){case"ArrowRight":case"ArrowUp":t.preventDefault(),this.#s=(this.#s+e)%360;break;case"ArrowLeft":case"ArrowDown":t.preventDefault(),this.#s=(this.#s-e+360)%360;break;default:return}this.#I("change")};connected(){if(super.connected(),this.#M(this.value),this.#r)return;this.#r=!0,this.#h=document.createElement("div"),this.#h.setAttribute("data-area",""),this.#h.setAttribute("tabindex","0"),this.#h.setAttribute("role","slider"),this.#h.setAttribute("aria-label","Color area: chroma and lightness"),this.#l=document.createElement("canvas"),this.#l.style.cssText="width:100%;height:100%;display:block;border-radius:inherit;",this.#h.appendChild(this.#l),this.#u=this.#l.getContext("2d",{willReadFrequently:!0}),this.#c=document.createElement("div"),this.#c.setAttribute("data-area-thumb",""),this.#h.appendChild(this.#c),this.appendChild(this.#h);let t=document.createElement("div");t.setAttribute("data-sliders","");let e=(r,o,a,l,h)=>{let c=document.createElement("slider-ui");return c.setAttribute("data-channel",o),c.setAttribute("label",r),c.setAttribute("min",a),c.setAttribute("max",l),c.setAttribute("step",h),c.addEventListener("input",this.#w),t.appendChild(c),c};this.#m=e("H","hue",0,360,1),this.#b=e("C","chroma",0,Xo,.001),this.#v=e("L","lightness",0,1,.001),this.appendChild(t),this.#d=document.createElement("div"),this.#d.setAttribute("data-hue-track",""),this.#d.setAttribute("tabindex","0"),this.#d.setAttribute("role","slider"),this.#d.setAttribute("aria-label","Hue"),this.#f=document.createElement("div"),this.#f.setAttribute("data-hue-thumb",""),this.#d.appendChild(this.#f),this.appendChild(this.#d);let i=document.createElement("div");i.setAttribute("data-output","");let n=r=>{let o=document.createElement("div");o.setAttribute("data-output-group","");let a=document.createElement("span");a.setAttribute("data-output-value",""),a.setAttribute("data-format",r);let l=document.createElement("div");l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("data-copy",r),l.setAttribute("aria-label",`Copy ${r}`),l.innerHTML='<icon-ui name="copy"></icon-ui>';let h=()=>this.#D(r,l);return l.addEventListener("click",h),this.#S.push({el:l,handler:h}),o.appendChild(a),o.appendChild(l),i.appendChild(o),a};this.#p=n("oklch"),this.#g=n("hex"),this.appendChild(i),this.#h.addEventListener("pointerdown",this.#k),this.#h.addEventListener("pointermove",this.#y),this.#h.addEventListener("pointerup",this.#$),this.#d.addEventListener("pointerdown",this.#Q),this.#d.addEventListener("pointermove",this.#P),this.#d.addEventListener("pointerup",this.#C),this.#h.addEventListener("keydown",this.#L),this.#d.addEventListener("keydown",this.#E),this.#O=new ResizeObserver(()=>this.#q()),this.#O.observe(this.#h)}disconnected(){super.disconnected(),this.#x!=null&&(clearTimeout(this.#x),this.#x=null),this.#O&&(this.#O.disconnect(),this.#O=null),this.#h&&(this.#h.removeEventListener("pointerdown",this.#k),this.#h.removeEventListener("pointermove",this.#y),this.#h.removeEventListener("pointerup",this.#$),this.#h.removeEventListener("keydown",this.#L)),this.#d&&(this.#d.removeEventListener("pointerdown",this.#Q),this.#d.removeEventListener("pointermove",this.#P),this.#d.removeEventListener("pointerup",this.#C),this.#d.removeEventListener("keydown",this.#E)),this.#m?.removeEventListener("input",this.#w),this.#b?.removeEventListener("input",this.#w),this.#v?.removeEventListener("input",this.#w);for(let{el:t,handler:e}of this.#S)t.removeEventListener("click",e);this.#S=[],this.#r=!1}#Z(t){let e=this.#h.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t.clientX-e.left)/e.width)),n=Math.max(0,Math.min(1,(t.clientY-e.top)/e.height));this.#i=i*Xo,this.#e=1-n,this.#I("input")}#X(t){let e=this.#d.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t.clientX-e.left)/e.width));this.#s=i*360,this.#I("input")}#M(t){if(t){if(t.startsWith("#")){let e=Jk(t);this.#e=e.L,this.#i=e.C,this.#s=e.H;return}if(t.startsWith("oklch(")){let e=t.match(/oklch\(\s*([\d.]+%?|NaN|none)\s+([\d.]+%?|NaN|none)\s+([\d.]+|NaN|none)/i);if(e){let i=(n,r)=>n==="none"||/^NaN$/i.test(n)?0:r&&n.endsWith("%")||n.endsWith("%")?+n.slice(0,-1)/100:+n;this.#e=i(e[1],!0),this.#i=i(e[2],!1),this.#s=i(e[3],!1);return}s.#t.has(this)||(s.#t.add(this),console.warn(`<color-picker-ui>: could not parse value=${JSON.stringify(t)}. Expected #rrggbb or oklch(L C H) with numeric, NaN, 'none' (CSS L4 powerless), or % channels. Picker is keeping prior state.`))}}}#I(t){let e=[];if(this.#e>this.maxL&&(e.push({axis:"l",requested:this.#e,clamped:this.maxL,reason:"max-l"}),this.#e=this.maxL),this.#e<this.minL&&(e.push({axis:"l",requested:this.#e,clamped:this.minL,reason:"min-l"}),this.#e=this.minL),this.#i>this.maxChroma&&(e.push({axis:"c",requested:this.#i,clamped:this.maxChroma,reason:"max-chroma"}),this.#i=this.maxChroma),Number.isFinite(this.hueDriftMax)){let a=Number.isFinite(this.baseHue)?this.baseHue:Number.isFinite(this.#n)?this.#n:this.#s;Number.isFinite(this.#n)||(this.#n=a);let l=(this.#s-a+540)%360-180,h=this.hueDriftMax;if(l>h){let c=this.#s;this.#s=(a+h+360)%360,e.push({axis:"h",requested:c,clamped:this.#s,reason:"hue-drift-max"})}else if(l<-h){let c=this.#s;this.#s=(a-h+360)%360,e.push({axis:"h",requested:c,clamped:this.#s,reason:"hue-drift-max"})}}let i=Io(this.#e,this.#i,this.#s),n=vn(this.#e,i,this.#s),r=this.#A();this.#a=!0,this.value=this.format==="oklch"?r:n,this.syncValue(),e.length&&this.dispatchEvent(new CustomEvent("constraint-clamp",{bubbles:!0,detail:{clamps:e}}));let o={value:this.value,l:this.#e,c:this.#i,h:this.#s,hex:n,oklch:r};this.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}#A(){return`oklch(${this.#e.toFixed(2)} ${this.#i.toFixed(3)} ${Math.round(this.#s)})`}#D(t,e){let i=t==="oklch"?this.#A():vn(this.#e,Io(this.#e,this.#i,this.#s),this.#s),n=e.querySelector("icon-ui"),r=o=>{n&&(n.setAttribute("name",o?"check":"warning"),this.#x!=null&&clearTimeout(this.#x),this.#x=setTimeout(()=>{this.#x=null,n.setAttribute("name","copy")},1500))};if(navigator.clipboard?.writeText)navigator.clipboard.writeText(i).then(()=>{this.isConnected&&r(!0)},()=>{this.isConnected&&r(!1)});else{let o=Object.assign(document.createElement("textarea"),{value:i});o.style.cssText="position:fixed;opacity:0",document.body.appendChild(o),o.select(),r(document.execCommand("copy")),o.remove()}}#q(){if(!this.#l||!this.#u||!this.#h)return;let t=Math.min(window.devicePixelRatio||1,2)*.5,e=Math.round(this.#h.clientWidth*t),i=Math.round(this.#h.clientHeight*t);if(e<=0||i<=0)return;this.#l.width=e,this.#l.height=i;let n=this.#u.createImageData(e,i),r=n.data,o=this.#s;for(let a=0;a<i;a++){let l=1-a/(i-1);for(let h=0;h<e;h++){let c=h/(e-1)*Xo,u=Io(l,c,o),[d,f,p]=Vg(l,u,o),m=(a*e+h)*4;r[m]=Math.round(d*255),r[m+1]=Math.round(f*255),r[m+2]=Math.round(p*255),r[m+3]=255}}this.#u.putImageData(n,0,0)}render(){if(this.#a?this.#a=!1:this.#M(this.value),this.#q(),this.#c){let r=this.#i/Xo*100,o=(1-this.#e)*100;this.#c.style.left=`${r}%`,this.#c.style.top=`${o}%`,this.#c.style.background=vn(this.#e,Io(this.#e,this.#i,this.#s),this.#s)}if(this.#d){let r=[];for(let o=0;o<=360;o+=30)r.push(vn(.7,.15,o));this.#d.style.background=`linear-gradient(to right, ${r.join(", ")})`,this.#d.setAttribute("aria-valuenow",String(Math.round(this.#s)))}this.#f&&(this.#f.style.left=`${this.#s/360*100}%`,this.#f.style.background=vn(.7,.15,this.#s)),this.#h&&this.#h.setAttribute("aria-valuetext",this.#A());let t=this.querySelector('slider-ui[data-channel="hue"]'),e=this.querySelector('slider-ui[data-channel="chroma"]'),i=this.querySelector('slider-ui[data-channel="lightness"]');t&&(t.value=Math.round(this.#s)),e&&(e.value=+this.#i.toFixed(3)),i&&(i.value=+this.#e.toFixed(3)),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled");let n=vn(this.#e,Io(this.#e,this.#i,this.#s),this.#s);this.#p&&(this.#p.textContent=this.#A()),this.#g&&(this.#g.textContent=n)}onFormReset(){this.value="#3b82f6"}};w("color-picker-ui",xn);var Sn=class extends z{static get properties(){return{...z.properties,value:{type:String,default:"#3b82f6",reflect:!0},format:{type:String,default:"hex",reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},maxChroma:{type:Number,default:1/0,reflect:!0},maxL:{type:Number,default:1,reflect:!0},minL:{type:Number,default:0,reflect:!0},hueDriftMax:{type:Number,default:NaN,reflect:!0},baseHue:{type:Number,default:NaN,reflect:!0}}}#t=null;#e=null;#i=null;#s=null;#n=null;#r=!1;connected(){this.#o(),this.#a(),this.#c(),this.syncValue(this.value)}render(){this.#c(),this.#t&&this.#t.open!==this.open&&(this.#t.open=this.open),this.#i&&(this.#i.format!==this.format&&(this.#i.format=this.format),Object.is(this.#i.maxChroma,this.maxChroma)||(this.#i.maxChroma=this.maxChroma),Object.is(this.#i.maxL,this.maxL)||(this.#i.maxL=this.maxL),Object.is(this.#i.minL,this.minL)||(this.#i.minL=this.minL),Object.is(this.#i.hueDriftMax,this.hueDriftMax)||(this.#i.hueDriftMax=this.hueDriftMax),Object.is(this.#i.baseHue,this.baseHue)||(this.#i.baseHue=this.baseHue)),this.#e&&(this.disabled?this.#e.setAttribute("disabled",""):this.#e.removeAttribute("disabled"))}showPicker(){this.open=!0}hidePicker(){this.open=!1}#o(){if(this.firstElementChild&&(this.#t=this.querySelector(":scope > popover-ui"),this.#e=this.querySelector(':scope > popover-ui > button-ui[slot="trigger"]'),this.#i=this.querySelector(':scope > popover-ui > color-picker-ui[slot="content"]'),this.#s=this.querySelector(".color-input__swatch"),this.#n=this.querySelector(".color-input__value"),this.#t&&this.#e&&this.#i))return;let t=document.createElement("popover-ui");t.setAttribute("trigger","click"),t.setAttribute("placement",this.placement);let e=document.createElement("button-ui");e.setAttribute("slot","trigger"),e.setAttribute("variant","outline"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-label",this.getAttribute("aria-label")||"Pick a color");let i=document.createElement("span");i.className="color-input__swatch",i.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="color-input__value",e.append(i,n);let r=document.createElement("color-picker-ui");r.setAttribute("slot","content"),r.setAttribute("format",this.format),r.setAttribute("value",this.value),r.maxChroma=this.maxChroma,r.maxL=this.maxL,r.minL=this.minL,r.hueDriftMax=this.hueDriftMax,r.baseHue=this.baseHue,t.append(e,r),this.append(t),this.#t=t,this.#e=e,this.#i=r,this.#s=i,this.#n=n}#a(){if(this.#r)return;this.#r=!0,this.#i.addEventListener("change",this.#l),this.#i.addEventListener("input",this.#u);let t=()=>{let e=!!this.#t?.open;this.open!==e&&(this.open=e)};this.#t.addEventListener("toggle",t),new MutationObserver(t).observe(this.#t,{attributes:!0,attributeFilter:["open"]})}#l=t=>{this.#h(t.detail,"change")};#u=t=>{this.#h(t.detail,"input")};#h(t,e){if(!t)return;let i=this.format==="oklch"?t.oklch:t.hex;i&&i!==this.value&&(this.value=i,this.syncValue(i)),this.#c(),this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:{value:i??this.value,hex:t.hex,oklch:t.oklch,l:t.l,c:t.c,h:t.h}}))}#c(){this.#s&&this.#s.style.setProperty("--swatch-color",this.value),this.#n&&(this.#n.textContent=this.value)}disconnected(){this.#i?.removeEventListener("change",this.#l),this.#i?.removeEventListener("input",this.#u),this.#r=!1}};w("color-input-ui",Sn);var ru=0,wn=class extends A{static properties={editable:{type:Boolean,default:!1,reflect:!0},color:{type:String,default:"",reflect:!0},strokeWidth:{type:Number,default:2,reflect:!0,attribute:"stroke-width"},tension:{type:Number,default:.5,reflect:!0},showPorts:{type:Boolean,default:!1,reflect:!0,attribute:"show-ports"},portSize:{type:Number,default:10,attribute:"port-size",reflect:!0},curve:{type:String,default:"bezier",reflect:!0},animated:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=[];#i=new Map;#s=null;#n=null;#r=null;#o=!1;#a=null;#l=null;#u=null;get connections(){return this.#e.map(t=>({...t}))}connect(t,e,i="right",n="left"){let r=`noodle-${++ru}`,o={id:r,from:t,to:e,fromPort:i,toPort:n};return this.#e.push(o),this.#h(),this.dispatchEvent(new CustomEvent("noodle-connect",{bubbles:!0,detail:{...o}})),r}disconnect(t){let e=this.#e.findIndex(n=>n.id===t);if(e===-1)return;let[i]=this.#e.splice(e,1);this.#h(),this.dispatchEvent(new CustomEvent("noodle-disconnect",{bubbles:!0,detail:{...i}}))}setConnections(t){this.#e=t.map(e=>({id:e.id||`noodle-${++ru}`,from:e.from,to:e.to,fromPort:e.fromPort||"right",toPort:e.toPort||"left"})),this.#h()}clear(){this.#e=[],this.#h()}update(){this.#f()}connected(){this.#t=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.#t.setAttribute("data-noodle-svg",""),this.prepend(this.#t),this.#s=new ResizeObserver(()=>this.#h()),this.#n=new MutationObserver(()=>{this.#w(),this.#h()}),this.#s.observe(this),this.#c();for(let t of this.#g())this.#s.observe(t);this.#w(),this.#h()}render(){this.#t&&(this.color?this.#t.style.setProperty("--noodles-stroke",this.color):this.#t.style.removeProperty("--noodles-stroke"))}disconnected(){this.#u?.(),this.#s?.disconnect(),this.#n?.disconnect(),this.#r&&cancelAnimationFrame(this.#r),this.#r=null,this.#k(),this.#t?.remove(),this.#t=null,this.#o=!1}#h(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=null,this.#f()}))}#c(){this.#n?.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-noodle-port","style"]})}#d(){this.#n?.disconnect()}#f(){if(!this.#t)return;this.#d();let t=this.#g();for(let r of t)this.#s.observe(r);this.#y();let e=this.#e.map(r=>{let o=this.#p(r.from),a=this.#p(r.to);if(!o||!a)return null;let l=this.#O(o,r.fromPort),h=this.#O(a,r.toPort);return!l||!h?null:{id:r.id,d:this.#m(l,h,r.fromPort,r.toPort)}}).filter(Boolean),i=new Map;for(let r of this.#t.querySelectorAll("path[data-noodle-id]"))i.set(r.getAttribute("data-noodle-id"),r);let n=new Set(e.map(r=>r.id));for(let[r,o]of i)n.has(r)||o.remove();for(let{id:r,d:o}of e){let a=i.get(r);a||(a=document.createElementNS("http://www.w3.org/2000/svg","path"),a.setAttribute("data-noodle-id",r),this.#t.appendChild(a)),a.setAttribute("d",o),a.setAttribute("stroke-width",this.strokeWidth)}if(this.#a&&this.#l){let r=this.#t.querySelector("path[data-noodle-preview]");r||(r=document.createElementNS("http://www.w3.org/2000/svg","path"),r.setAttribute("data-noodle-preview",""),r.style.opacity="0.5",r.style.strokeDasharray="6 3",this.#t.appendChild(r)),r.setAttribute("d",this.#l),r.setAttribute("stroke-width",this.strokeWidth)}else this.#t.querySelector("path[data-noodle-preview]")?.remove();this.#c()}#p(t){return t instanceof HTMLElement?t:typeof t=="string"?this.querySelector(`#${CSS.escape(t)}`):typeof t=="number"?this.#g()[t]??null:null}#g(){return[...this.querySelectorAll("[data-noodle-port]")]}#O(t,e){let i=t.getBoundingClientRect(),n=this.getBoundingClientRect(),r=this.offsetWidth&&n.width?n.width/this.offsetWidth:1,o=(i.left-n.left)/r,a=(i.top-n.top)/r,l=i.width/r,h=i.height/r;switch(e){case"left":return{x:o,y:a+h/2};case"right":return{x:o+l,y:a+h/2};case"top":return{x:o+l/2,y:a};case"bottom":return{x:o+l/2,y:a+h};default:return{x:o+l/2,y:a+h/2}}}#m(t,e,i,n){switch(this.curve){case"step":return this.#S(t,e);case"straight":return this.#x(t,e);default:return this.#b(t,e,i,n)}}#b(t,e,i,n){let r=Math.abs(e.x-t.x),o=Math.abs(e.y-t.y),a=Math.sqrt(r*r+o*o),l=Math.max(50,a*this.tension),h=this.#v(t,i,l),c=this.#v(e,n,l);return`M ${t.x} ${t.y} C ${h.x} ${h.y}, ${c.x} ${c.y}, ${e.x} ${e.y}`}#v(t,e,i){switch(e){case"left":return{x:t.x-i,y:t.y};case"right":return{x:t.x+i,y:t.y};case"top":return{x:t.x,y:t.y-i};case"bottom":return{x:t.x,y:t.y+i};default:return{x:t.x+i,y:t.y}}}#S(t,e){let i=(t.x+e.x)/2;return`M ${t.x} ${t.y} L ${i} ${t.y} L ${i} ${e.y} L ${e.x} ${e.y}`}#x(t,e){return`M ${t.x} ${t.y} L ${e.x} ${e.y}`}#w(){this.#d(),this.#k();let t=this.#g();for(let e of t){let i=(e.getAttribute("data-noodle-port")||"").split(/\s+/).filter(Boolean);for(let n of i){let r=this.#$(e,n),o=document.createElement("div");o.setAttribute("data-noodle-port-indicator",""),o.setAttribute("data-noodle-side",n),o.dataset.portElement=e.id||"",this.editable&&o.addEventListener("pointerdown",a=>this.#Q(a,e,n)),this.appendChild(o),this.#i.set(r,o)}}this.#y(),this.#c()}#k(){for(let[,t]of this.#i)t.remove();this.#i.clear()}#y(){let t=this.#g();for(let e of t){let i=(e.getAttribute("data-noodle-port")||"").split(/\s+/).filter(Boolean);for(let n of i){let r=this.#$(e,n),o=this.#i.get(r);if(!o)continue;let a=this.#O(e,n);o.style.left=`${a.x}px`,o.style.top=`${a.y}px`}}}#$(t,e){return t._noodleId||(t._noodleId=`_n${++ru}`),`${t._noodleId}:${e}`}#Q=(t,e,i)=>{if(!this.editable||this.readonly)return;t.preventDefault(),t.stopPropagation();let n=t.currentTarget;n.setPointerCapture(t.pointerId),n.setAttribute("data-noodle-dragging","");let r=this.#O(e,i),o=l=>{if(!this.#a)return;let h=this.getBoundingClientRect(),c=l.clientX-h.left,u=l.clientY-h.top;this.#l=this.#m(r,{x:c,y:u},i,this.#P(r,{x:c,y:u})),this.#h(),this.#C(l.clientX,l.clientY,e),this.dispatchEvent(new CustomEvent("noodle-drag",{bubbles:!0,detail:{from:e,fromPort:i,x:c,y:u}}))},a=l=>{try{n.releasePointerCapture(l.pointerId)}catch{}if(n.removeAttribute("data-noodle-dragging"),n.removeEventListener("pointermove",o),n.removeEventListener("pointerup",a),l.type==="pointerup"&&l.clientX!==void 0){let h=this.#L(l.clientX,l.clientY,e);h&&this.connect(e,h.el,i,h.side)}this.#E(),this.#a=null,this.#l=null,this.#u=null,this.#h()};this.#u=()=>{this.#a=null,n.removeAttribute("data-noodle-dragging"),n.removeEventListener("pointermove",o),n.removeEventListener("pointerup",a),this.#E(),this.#l=null,this.#u=null},this.#a={fromEl:e,fromSide:i,startPos:r,pointerId:t.pointerId},this.#l=null,n.addEventListener("pointermove",o),n.addEventListener("pointerup",a)};#P(t,e){let i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"left":"right":n>0?"top":"bottom"}#C(t,e,i){this.#E();let n=this.#L(t,e,i);n?.dot&&n.dot.setAttribute("data-noodle-drop-ready","")}#L(t,e,i){let n=this.portSize*2,r=null,o=1/0;for(let[a,l]of this.#i){let h=l.getBoundingClientRect(),c=h.left+h.width/2,u=h.top+h.height/2,d=Math.sqrt((t-c)**2+(e-u)**2),[f,p]=a.split(":"),m=this.#g().find(O=>O._noodleId===f);!m||m===i||d<n&&d<o&&(o=d,r={el:m,side:p,dot:l})}return r}#E(){for(let[,t]of this.#i)t.removeAttribute("data-noodle-drop-ready")}};w("noodles-ui",wn);var Ci={};function me(s,t){Ci[s]=t}function kn(s,t){let e=s.firstElementChild;(!e||e.tagName!=="SPAN")&&(s.replaceChildren(),e=s.appendChild(document.createElement("span"))),e.textContent=t,s.title=t}var ou={basic:(s,t)=>s<t?-1:s>t?1:0,alphanumeric:(s,t)=>String(s??"").localeCompare(String(t??""),void 0,{numeric:!0,sensitivity:"base"}),numeric:(s,t)=>(Number(s)||0)-(Number(t)||0),datetime:(s,t)=>new Date(s||0).getTime()-new Date(t||0).getTime()};me("text",{render(s,t,e){kn(e,String(s??""))},format(s){return String(s??"")},align:"left",sortFn:"alphanumeric"}),me("number",{render(s,t,e){kn(e,s!=null?new Intl.NumberFormat().format(s):"")},format(s){return String(s??"")},align:"right",sortFn:"numeric"}),me("currency",{render(s,t,e,i){kn(e,s!=null?new Intl.NumberFormat("en-US",{style:"currency",currency:i?.currency||"USD"}).format(s):"")},format(s,t,e){return s!=null?new Intl.NumberFormat("en-US",{style:"currency",currency:e?.currency||"USD"}).format(s):""},align:"right",sortFn:"numeric"}),me("percent",{render(s,t,e){kn(e,s!=null?`${s}%`:"")},format(s){return s!=null?`${s}%`:""},align:"right",sortFn:"numeric"});var Yg={year:"numeric",month:"short",day:"numeric"};me("date",{render(s,t,e){kn(e,s?new Intl.DateTimeFormat("en-US",Yg).format(new Date(s)):"")},format(s){return s?new Intl.DateTimeFormat("en-US",Yg).format(new Date(s)):""},align:"left",sortFn:"datetime"});var Ug={year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"};me("datetime",{render(s,t,e){kn(e,s?new Intl.DateTimeFormat("en-US",Ug).format(new Date(s)):"")},format(s){return s?new Intl.DateTimeFormat("en-US",Ug).format(new Date(s)):""},align:"left",sortFn:"datetime"}),me("boolean",{render(s,t,e){let i=e.querySelector("check-ui");i||(e.textContent="",i=document.createElement("check-ui"),i.setAttribute("disabled",""),e.appendChild(i)),s?i.setAttribute("checked",""):i.removeAttribute("checked")},format(s){return s?"Yes":"No"},align:"center",sortFn:"basic"}),me("badge",{render(s,t,e,i){let n=e.querySelector("badge-ui");n||(e.textContent="",n=document.createElement("badge-ui"),e.appendChild(n)),n.setAttribute("text",String(s??""));let r=i?.variants||{};n.setAttribute("variant",r[s]||"neutral")},format(s){return String(s??"")},align:"left",sortFn:"alphanumeric"}),me("avatar",{render(s,t,e){let i=e.querySelector("row-ui");if(!i){e.textContent="",i=document.createElement("row-ui"),i.setAttribute("gap","2"),i.setAttribute("align","center");let o=document.createElement("avatar-ui");o.setAttribute("size","sm");let a=document.createElement("span");i.appendChild(o),i.appendChild(a),e.appendChild(i)}let n=i.querySelector("avatar-ui"),r=i.querySelector("span");n.setAttribute("text",String(s??"")),r.textContent=String(s??""),e.title=String(s??"")},format(s){return String(s??"")},align:"left",sortFn:"alphanumeric"}),me("link",{render(s,t,e,i){let n=e.querySelector("a");n||(e.textContent="",n=document.createElement("a"),n.style.color="var(--table-accent, var(--a-primary))",n.style.textDecoration="none",e.appendChild(n));let r=String(s??""),o=r.includes("@")&&!r.startsWith("http");n.href=o?`mailto:${r}`:r,n.textContent=i?.label??r},format(s){return String(s??"")},align:"left",sortFn:"alphanumeric"}),me("progress",{render(s,t,e){let i=e.querySelector("row-ui");if(!i){e.textContent="",i=document.createElement("row-ui"),i.setAttribute("gap","2"),i.setAttribute("align","center");let o=document.createElement("progress-ui");o.setAttribute("size","sm"),o.style.flex="1";let a=document.createElement("span");i.appendChild(o),i.appendChild(a),e.appendChild(i)}let n=i.querySelector("progress-ui"),r=i.querySelector("span");n.setAttribute("value",s!=null?String(s):"0"),r.textContent=s!=null?`${s}%`:""},format(s){return s!=null?`${s}%`:""},align:"left",sortFn:"numeric"}),me("actions",{render(s,t,e,i){let n=i?.actions||[],r=e.querySelector("row-ui");if(r&&r.children.length!==n.length&&(r.remove(),r=null),!r){e.textContent="",r=document.createElement("row-ui"),r.setAttribute("gap","1");for(let o of n){let a=document.createElement("button-ui");a.setAttribute("icon",o.icon||""),a.setAttribute("variant","ghost"),a.setAttribute("size","sm"),a.setAttribute("aria-label",o.label||""),a.addEventListener("click",()=>{a.dispatchEvent(new CustomEvent(o.event,{bubbles:!0,detail:{row:t}}))}),r.appendChild(a)}e.appendChild(r)}},format(){return""},align:"center",sortFn:null});function t1(s,t){if(!t||!s)return;let e=t.split("."),i=s;for(let n of e){if(i==null)return;i=i[n]}return i}function si(s,t){return typeof t.accessor=="function"?t.accessor(s):t1(s,t.key)}function rl(s){let t=String(s??"");return t.includes(",")||t.includes('"')||t.includes(`
159
+ `)?'"'+t.replace(/"/g,'""')+'"':t}var $n=class extends A{static requiredIcons=["caret-right","caret-up-down","table","arrow-up","arrow-down","funnel-simple","funnel-simple-fill"];static properties={sortable:{type:Boolean,default:!1,reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},expandable:{type:Boolean,default:!1,reflect:!0},striped:{type:Boolean,default:!1,reflect:!0},wrap:{type:Boolean,default:!1,reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},density:{type:String,default:"standard",reflect:!0},paginate:{type:Number,default:0,reflect:!0},loading:{type:Boolean,default:!1,reflect:!0},search:{type:String,default:"",reflect:!0}};static template=()=>null;#t=[];#e=[];#i=[];#s=new Map;#n=new Set;#r=null;#o=0;#a=new Set;#l=new Map;#u=null;#h=!1;#c=-1;#d=null;#f=null;set columns(t){this.#t=Array.isArray(t)?t:[],this.#b()}get columns(){return this.#t}set data(t){this.#e=Array.isArray(t)?t:[],this.#a.clear(),this.#o=0,this.#b()}get data(){return this.#e}get selected(){return[...this.#a].sort((t,e)=>t-e)}set selected(t){if(this.#a.clear(),t)for(let e of t)Number.isInteger(e)&&e>=0&&e<this.#e.length&&this.#a.add(e);this.#b(),this.dispatchEvent(new CustomEvent("select",{detail:{selected:this.selected},bubbles:!0}))}clearSelection(){this.#a.size!==0&&(this.#a.clear(),this.#b(),this.dispatchEvent(new CustomEvent("select",{detail:{selected:[]},bubbles:!0})))}get sortState(){return this.#i.map(t=>({...t}))}setFilter(t,e,i="contains"){e==null||e===""?this.#s.delete(t):this.#s.set(t,{op:i,value:e}),this.#o=0,this.#b(),this.dispatchEvent(new CustomEvent("filter-change",{detail:{filters:Object.fromEntries(this.#s)},bubbles:!0}))}clearFilters(){this.#s.clear(),this.#d=null,this.#o=0,this.#b(),this.dispatchEvent(new CustomEvent("filter-change",{detail:{filters:{}},bubbles:!0}))}get filters(){return Object.fromEntries(this.#s)}toggleExpand(t){this.#n.has(t)?(this.#n.delete(t),this.dispatchEvent(new CustomEvent("row-collapse",{detail:{index:t,row:this.#e[t]},bubbles:!0}))):(this.#n.add(t),this.dispatchEvent(new CustomEvent("row-expand",{detail:{index:t,row:this.#e[t]},bubbles:!0}))),this.#b()}get expanded(){return[...this.#n]}expandRenderer=null;getState(){return{sort:this.#i.map(t=>({...t})),filters:Object.fromEntries(this.#s),columnWidths:Object.fromEntries(this.#l),hiddenColumns:this.#t.filter(t=>t.hidden).map(t=>t.key),page:this.#o,density:this.density}}setState(t){if(t){if(t.sort&&(this.#i=t.sort),t.filters){this.#s.clear();for(let[e,i]of Object.entries(t.filters))this.#s.set(e,i)}if(t.columnWidths){this.#l.clear();for(let[e,i]of Object.entries(t.columnWidths))this.#l.set(e,i)}if(t.hiddenColumns)for(let e of this.#t)e.hidden=t.hiddenColumns.includes(e.key);t.page!=null&&(this.#o=t.page),t.density&&(this.density=t.density),this.#b()}}#p(){let t=this.getAttribute("state-key");if(t)try{localStorage.setItem(`table-state:${t}`,JSON.stringify(this.getState()))}catch{}}#g(){let t=this.getAttribute("state-key");if(t)try{let e=localStorage.getItem(`table-state:${t}`);e&&this.setState(JSON.parse(e))}catch{}}connected(){this.#O(),this.setAttribute("role","grid"),this.setAttribute("tabindex","0"),this.#g(),this.#h||(this.#h=!0,this.addEventListener("click",this.#X),this.addEventListener("keydown",this.#z))}disconnected(){this.removeEventListener("click",this.#X),this.removeEventListener("keydown",this.#z),this.#h=!1,this.#q(),this.#m&&(cancelAnimationFrame(this.#m),this.#m=null),this.#f!=null&&(cancelAnimationFrame(this.#f),this.#f=null)}#O(){let t=this.querySelectorAll(":scope > col-def");if(!t.length)return;let e=[];for(let i of t){let n={key:i.getAttribute("key")||"",label:i.getAttribute("label")||i.getAttribute("key")||"",type:i.getAttribute("type")||"text",pinned:i.getAttribute("pinned")||null,hidden:i.hasAttribute("hidden"),sortable:i.hasAttribute("sortable"),resizable:i.hasAttribute("resizable"),filterable:i.hasAttribute("filterable"),filterType:i.getAttribute("filter-type")||null},r=i.getAttribute("width");r&&(n.width=Number(r));let o=i.getAttribute("min-width");o&&(n.minWidth=Number(o));let a=i.getAttribute("max-width");a&&(n.maxWidth=Number(a));let l=i.getAttribute("flex");l&&(n.flex=Number(l)),e.push(n),i.remove()}e.length&&!this.#t.length&&(this.#t=e)}#m=null;#b(){!this.isConnected||this.#m||(this.#m=requestAnimationFrame(()=>{this.#m=null,this.render(),this.#p()}))}get#v(){return this.#t.filter(t=>!t.hidden)}#S(){let t=[];this.expandable&&t.push("2.5rem"),this.selectable&&t.push("2.5rem");for(let e of this.#v)this.#l.has(e.key)?t.push(`${this.#l.get(e.key)}px`):e.width?t.push(`${e.width}px`):e.flex?t.push(`minmax(6rem, ${e.flex}fr)`):t.push("minmax(6rem, 1fr)");return t.join(" ")}#x(){let t=this.#e.map((e,i)=>i);if(this.search){let e=this.search.toLowerCase();t=t.filter(i=>{let n=this.#e[i];return this.#v.some(r=>{let o=si(n,r);return o!=null&&String(o).toLowerCase().includes(e)})})}return this.#s.size&&(t=t.filter(e=>{let i=this.#e[e];for(let[n,{op:r,value:o}]of this.#s){let a=this.#t.find(u=>u.key===n),l=si(i,a||{key:n}),h=String(l??"").toLowerCase(),c=String(o).toLowerCase();switch(r){case"contains":if(!h.includes(c))return!1;break;case"equals":if(h!==c)return!1;break;case"startsWith":if(!h.startsWith(c))return!1;break;case"gt":if(Number(l)<=Number(o))return!1;break;case"lt":if(Number(l)>=Number(o))return!1;break;case"gte":if(Number(l)<Number(o))return!1;break;case"lte":if(Number(l)>Number(o))return!1;break;case"between":{let[u,d]=String(o).split(",").map(Number),f=Number(l);if(f<u||f>d)return!1;break}case"select":{if(!c.split(",").map(d=>d.trim()).includes(h))return!1;break}default:if(!h.includes(c))return!1}}return!0})),this.#i.length&&t.sort((e,i)=>{for(let{key:n,dir:r}of this.#i){let o=this.#t.find(u=>u.key===n),a=si(this.#e[e],o||{key:n}),l=si(this.#e[i],o||{key:n}),h;if(typeof o?.sortFn=="function")h=o.sortFn;else{let u=Ci[o?.type||"text"],d=o?.sortFn||u?.sortFn||"alphanumeric";h=ou[d]||ou.alphanumeric}if(a==null&&l==null)continue;if(a==null)return 1;if(l==null)return-1;let c=h(a,l);if(c!==0)return r==="asc"?c:-c}return 0}),t}#w(t){if(!this.paginate||this.paginate<=0)return t;let e=this.#o*this.paginate;return t.slice(e,e+this.paginate)}get#k(){if(!this.paginate||this.paginate<=0)return 1;let t=this.#x().length;return Math.max(1,Math.ceil(t/this.paginate))}render(){let t=this.#v;this.style.gridTemplateColumns=this.#S();let e=this.querySelector(":scope > [data-header]");e||(e=document.createElement("div"),e.setAttribute("role","row"),e.setAttribute("data-header",""),this.prepend(e)),this.#y(e,t),this.#Z();let i=this.querySelector(":scope > [data-body]");i||(i=document.createElement("div"),i.setAttribute("role","rowgroup"),i.setAttribute("data-body",""),e.after(i));let n=this.#x(),r=this.#w(n),o=[];for(let c of r){let u=i.querySelector(`:scope > [role="row"][data-index="${c}"]`),d=u||this.#$(c,t);if(u&&this.#Q(u,c,t),this.expandable&&(this.#n.has(c)?d.setAttribute("data-expanded",""):d.removeAttribute("data-expanded")),o.push(d),this.expandable&&this.#n.has(c)){let f=i.querySelector(`:scope > [data-detail-row][data-for="${c}"]`);if(!f&&(f=document.createElement("div"),f.setAttribute("data-detail-row",""),f.dataset.for=c,this.expandRenderer)){let p=this.expandRenderer(this.#e[c],c);p instanceof Node?f.appendChild(p):f.textContent=String(p)}o.push(f)}}let a=[...i.children];for(let c of a)o.includes(c)||c.remove();for(let c=0;c<o.length;c++)i.children[c]!==o[c]&&(i.children[c]?i.insertBefore(o[c],i.children[c]):i.appendChild(o[c]));this.#P(i),this.#C(i,n,t);let l=this.paginate>0&&this.#e.length>0,h=this.querySelector(":scope > [data-footer]");l?(h||(h=document.createElement("div"),h.setAttribute("data-footer",""),this.appendChild(h)),this.#L(h,n.length)):h&&h.remove()}#y(t,e){let i=this.#e.length>0&&this.#a.size===this.#e.length,n=[];if(this.selectable){let r=document.createElement("div");r.setAttribute("role","columnheader"),r.setAttribute("data-check-col","");let o=document.createElement("check-ui");i&&o.setAttribute("checked",""),o.setAttribute("aria-label","Select all rows"),r.appendChild(o),n.push(r)}for(let r of e){let o=document.createElement("div");o.setAttribute("role","columnheader");let a=document.createElement("span");if(a.textContent=r.label||r.key,o.appendChild(a),r.sortable!==!1&&this.sortable){o.dataset.sortKey=r.key,o.setAttribute("aria-label",`Sort by ${r.label||r.key}`);let h=document.createElement("icon-ui");h.setAttribute("data-sort-icon","");let c=this.#i.find(u=>u.key===r.key);c?(o.setAttribute("aria-sort",c.dir==="asc"?"ascending":"descending"),h.setAttribute("name",c.dir==="asc"?"arrow-up":"arrow-down")):h.setAttribute("name","caret-up-down"),o.appendChild(h)}if(r.pinned&&o.setAttribute("data-pinned",r.pinned),r.resizable!==!1){let h=document.createElement("div");h.setAttribute("data-resize-handle",""),h.dataset.resizeKey=r.key,o.appendChild(h)}if(r.filter){let h=document.createElement("button");h.setAttribute("data-filter-btn",""),h.dataset.filterKey=r.key,h.setAttribute("aria-label",`Filter ${r.label||r.key}`);let c=document.createElement("icon-ui");if(c.setAttribute("name",this.#s.has(r.key)?"funnel-simple-fill":"funnel-simple"),c.setAttribute("size","xs"),h.appendChild(c),o.appendChild(h),this.#d===r.key){let u=this.#E(r);o.appendChild(u),o.setAttribute("data-filter-open","")}}n.push(o)}for(;t.children.length>n.length;)t.lastChild.remove();for(let r=0;r<n.length;r++)t.children[r]?t.replaceChild(n[r],t.children[r]):t.appendChild(n[r])}#$(t,e){let i=document.createElement("div");return i.setAttribute("role","row"),this.#Q(i,t,e),i}#Q(t,e,i){let n=this.#e[e],r=this.#a.has(e);t.dataset.index=e,r?(t.setAttribute("data-selected",""),t.setAttribute("aria-selected","true")):(t.removeAttribute("data-selected"),t.removeAttribute("aria-selected"));let o=[];if(this.expandable){let a=document.createElement("div");a.setAttribute("role","gridcell"),a.setAttribute("data-expand-col","");let l=document.createElement("button");l.setAttribute("data-expand-toggle",""),l.setAttribute("aria-label","Expand row");let h=document.createElement("icon-ui");h.setAttribute("name","caret-right"),h.setAttribute("size","xs"),l.appendChild(h),a.appendChild(l),o.push(a)}if(this.selectable){let a=document.createElement("div");a.setAttribute("role","gridcell"),a.setAttribute("data-check-col","");let l=document.createElement("check-ui");r&&l.setAttribute("checked",""),l.setAttribute("aria-label",`Select row ${e+1}`),a.appendChild(l),o.push(a)}for(let a of i){let l=document.createElement("div");l.setAttribute("role","gridcell"),l.dataset.key=a.key;let h=si(n,a);if(typeof a.render=="function"){let u=a.render(h,n,l,e);u instanceof Node?l.replaceChildren(u):typeof u=="string"&&(l.innerHTML=u)}else if(typeof a.format=="function"){let u=a.format(h,n);l.appendChild(Object.assign(document.createElement("span"),{textContent:u})),l.title=u}else{let u=Ci[a.type||"text"];if(u?.render)u.render(h,n,l,a.meta);else{let d=h!=null?String(h):"";l.appendChild(Object.assign(document.createElement("span"),{textContent:d})),l.title=d}}let c=Ci[a.type||"text"];c?.align&&(l.dataset.align=c.align),a.pinned&&l.setAttribute("data-pinned",a.pinned),a.wrap&&l.setAttribute("data-wrap",""),o.push(l)}for(;t.children.length>o.length;)t.lastChild.remove();for(let a=0;a<o.length;a++)t.children[a]?t.replaceChild(o[a],t.children[a]):t.appendChild(o[a])}#P(t){let e=this.querySelector(":scope > [data-empty]"),i=this.querySelector(":scope > [data-loading]");if(this.loading){this.setAttribute("aria-busy","true");let n=this.#v,r=this.paginate>0?Math.min(this.paginate,8):5,o=(this.expandable?1:0)+(this.selectable?1:0)+n.length;for(;t.firstChild;)t.firstChild.remove();for(let a=0;a<r;a++){let l=document.createElement("div");l.setAttribute("role","row"),l.setAttribute("data-skeleton-row","");for(let h=0;h<o;h++){let c=document.createElement("div");c.setAttribute("role","gridcell");let u=document.createElement("skeleton-ui"),d=["60%","80%","70%","50%","90%"];u.setAttribute("width",d[h%d.length]),u.setAttribute("height","1em"),u.setAttribute("radius","sm"),c.appendChild(u),l.appendChild(c)}t.appendChild(l)}i&&i.remove(),e&&e.remove()}else if(this.#e.length===0){if(this.removeAttribute("aria-busy"),!e){e=document.createElement("div"),e.setAttribute("data-empty","");let n=document.createElement("icon-ui");n.setAttribute("name","table");let r=document.createElement("span");r.textContent="No data",e.appendChild(n),e.appendChild(r),t.after(e)}i&&i.remove()}else this.removeAttribute("aria-busy"),e&&e.remove(),i&&i.remove()}#C(t,e,i){let n=i.some(a=>a.aggregate),r=this.querySelector(":scope > [data-agg-row]");if(!n||this.#e.length===0){r&&r.remove();return}r||(r=document.createElement("div"),r.setAttribute("role","row"),r.setAttribute("data-agg-row",""),t.after(r));let o=[];if(this.expandable){let a=document.createElement("div");a.setAttribute("role","gridcell"),o.push(a)}if(this.selectable){let a=document.createElement("div");a.setAttribute("role","gridcell"),o.push(a)}for(let a of i){let l=document.createElement("div");if(l.setAttribute("role","gridcell"),a.aggregate){let h=e.map(d=>{let f=si(this.#e[d],a);return f!=null?Number(f):NaN}).filter(d=>!isNaN(d)),c;switch(a.aggregate){case"sum":c=h.reduce((d,f)=>d+f,0);break;case"avg":c=h.length?h.reduce((d,f)=>d+f,0)/h.length:0;break;case"min":c=h.length?Math.min(...h):0;break;case"max":c=h.length?Math.max(...h):0;break;case"count":c=e.length;break;default:c=""}let u=Ci[a.type||"text"];typeof c=="number"&&u?.render?u.render(c,{},l,a.meta):l.textContent=typeof c=="number"?c.toLocaleString():c}o.push(l)}for(;r.children.length>o.length;)r.lastChild.remove();for(let a=0;a<o.length;a++)r.children[a]?r.replaceChild(o[a],r.children[a]):r.appendChild(o[a])}#L(t,e){let i=t.querySelector("pagination-ui");i||(t.innerHTML="",i=document.createElement("pagination-ui"),i.addEventListener("page-change",r=>{this.#o=r.detail.page-1,this.render(),this.dispatchEvent(new CustomEvent("page",{bubbles:!0,detail:{page:this.#o}}))}),t.appendChild(i));let n=this.paginate>0?Math.max(1,Math.ceil(e/this.paginate)):1;i.setAttribute("page",String(this.#o+1)),i.setAttribute("total",String(n))}#E(t){let e=document.createElement("div");e.setAttribute("data-filter-dropdown","");let i=this.#s.get(t.key);if(t.filter==="select"){let n=[...new Set(this.#e.map(o=>{let a=si(o,t);return a!=null?String(a):""}))].filter(Boolean).sort(),r=new Set(i?.op==="select"?String(i.value).split(","):[]);for(let o of n){let a=document.createElement("label");a.setAttribute("data-filter-option","");let l=document.createElement("input");l.type="checkbox",l.value=o,l.checked=r.has(o.toLowerCase()),l.addEventListener("change",()=>{let h=[...e.querySelectorAll("input[type=checkbox]:checked")].map(c=>c.value);h.length?this.setFilter(t.key,h.join(","),"select"):this.setFilter(t.key,null)}),a.appendChild(l),a.appendChild(document.createTextNode(` ${o}`)),e.appendChild(a)}}else if(t.filter==="number"){let n=document.createElement("input");n.type="number",n.placeholder="Filter...",n.value=i?.value??"",n.setAttribute("data-filter-input","");let r=document.createElement("select");r.setAttribute("data-filter-op","");for(let[a,l]of[["gte","\u2265"],["lte","\u2264"],["gt",">"],["lt","<"],["equals","="]]){let h=document.createElement("option");h.value=a,h.textContent=l,i?.op===a&&(h.selected=!0),r.appendChild(h)}let o=()=>{n.value?this.setFilter(t.key,n.value,r.value):this.setFilter(t.key,null)};n.addEventListener("input",o),r.addEventListener("change",o),e.appendChild(r),e.appendChild(n)}else{let n=document.createElement("input");n.type="text",n.placeholder=`Filter ${t.label||t.key}...`,n.value=i?.value??"",n.setAttribute("data-filter-input",""),n.addEventListener("input",()=>{n.value?this.setFilter(t.key,n.value,"contains"):this.setFilter(t.key,null)}),e.appendChild(n)}if(i){let n=document.createElement("button");n.textContent="Clear",n.setAttribute("data-filter-clear",""),n.addEventListener("click",()=>{this.setFilter(t.key,null),this.#d=null,this.#b()}),e.appendChild(n)}return this.#f!=null&&cancelAnimationFrame(this.#f),this.#f=requestAnimationFrame(()=>{if(this.#f=null,!this.isConnected)return;let n=e.querySelector("input");n&&n.focus()}),e}#Z(){let t=this.querySelector(":scope > [data-filter-bar]");if(this.#s.size===0){t&&t.remove();return}if(!t){t=document.createElement("div"),t.setAttribute("data-filter-bar",""),t.setAttribute("role","status");let i=this.querySelector(":scope > [data-header]");i?i.after(t):this.prepend(t)}t.innerHTML="";for(let[i,{op:n,value:r}]of this.#s){let a=this.#t.find(u=>u.key===i)?.label||i,l=document.createElement("badge-ui"),h=n==="select"?`${r.split(",").length} selected`:r;l.setAttribute("text",`${a}: ${h}`),l.setAttribute("size","xs"),l.setAttribute("data-filter-chip",i);let c=document.createElement("button");c.textContent="\xD7",c.setAttribute("data-chip-dismiss",""),c.addEventListener("click",u=>{u.stopPropagation(),this.setFilter(i,null)}),l.appendChild(c),t.appendChild(l)}let e=document.createElement("button");e.textContent="Clear all",e.setAttribute("data-filter-clear-all",""),e.addEventListener("click",()=>this.clearFilters()),t.appendChild(e)}#X=t=>{let e=t.target,i=e.closest("[data-filter-btn]");if(i&&this.contains(i)){let c=i.dataset.filterKey;this.#d=this.#d===c?null:c,this.#b();return}this.#d&&!e.closest("[data-filter-dropdown]")&&!e.closest("[data-filter-btn]")&&(this.#d=null,this.#b());let n=e.closest("[data-expand-toggle]");if(n&&this.expandable&&this.contains(n)){let c=n.closest('[role="row"]');c?.dataset?.index!=null&&this.toggleExpand(Number(c.dataset.index));return}let r=e.closest("[data-resize-handle]");if(r&&this.contains(r)){this.#I(t,r);return}let o=e.closest("[data-sort-key]");if(o&&this.sortable&&this.contains(o)){let c=o.dataset.sortKey,u=this.#i.findIndex(m=>m.key===c),f=this.#t.find(m=>m.key===c)?.sortDescFirst?"desc":"asc",p=f==="asc"?"desc":"asc";if(t.shiftKey)if(u>=0){let m=this.#i[u];m.dir===p?this.#i.splice(u,1):m.dir=m.dir===f?p:f}else this.#i.push({key:c,dir:f});else if(u>=0&&this.#i.length===1){let m=this.#i[0];m.dir===p?this.#i=[]:m.dir=m.dir===f?p:f}else this.#i=[{key:c,dir:f}];this.render(),this.dispatchEvent(new CustomEvent("sort",{bubbles:!0,detail:{key:c,dir:this.#i.find(m=>m.key===c)?.dir||null,sortState:this.sortState}}));return}let a=e.closest("[data-header] check-ui");if(a&&this.selectable){if(a.hasAttribute("checked"))for(let u=0;u<this.#e.length;u++)this.#a.add(u);else this.#a.clear();this.render(),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{selected:this.selected}}));return}let l=e.closest('[role="row"]:not([data-header]) check-ui');if(l&&this.selectable){let c=l.closest('[role="row"]'),u=c?+c.dataset.index:-1;if(u>=0){let d=l.hasAttribute("checked");if(t.shiftKey&&this.#c>=0){let f=Math.min(this.#c,u),p=Math.max(this.#c,u);for(let m=f;m<=p;m++)d?this.#a.add(m):this.#a.delete(m)}else d?this.#a.add(u):this.#a.delete(u);this.#c=u,this.render(),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{selected:this.selected}}))}return}let h=e.closest('[role="gridcell"][data-key]');if(h&&this.contains(h)){let c=h.closest('[role="row"]'),u=c?+c.dataset.index:-1;if(u>=0){let d=h.dataset.key,f=this.#e[u],p=this.#t.find(O=>O.key===d),m=p?si(f,p):void 0;this.dispatchEvent(new CustomEvent("cell-click",{bubbles:!0,detail:{key:d,row:f,value:m,dataIndex:u}})),this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,detail:{row:f,dataIndex:u}}))}}};#M=null;#I(t,e){t.preventDefault(),t.stopPropagation();let i=e.dataset.resizeKey,n=this.#t.find(l=>l.key===i);if(!n)return;let r=e.closest('[role="columnheader"]'),o=r?r.getBoundingClientRect().width:100,a=t.clientX;this.setAttribute("data-resizing",""),this.#M={key:i,col:n,startX:a,startWidth:o},document.addEventListener("mousemove",this.#A),document.addEventListener("mouseup",this.#D)}#A=t=>{if(!this.#M)return;let{key:e,col:i,startX:n,startWidth:r}=this.#M,o=t.clientX-n,a=r+o,l=i.minWidth||48,h=i.maxWidth||1/0;a=Math.max(l,Math.min(h,a)),this.#l.set(e,Math.round(a)),this.style.gridTemplateColumns=this.#S()};#D=t=>{if(!this.#M)return;let{key:e}=this.#M;document.removeEventListener("mousemove",this.#A),document.removeEventListener("mouseup",this.#D),this.removeAttribute("data-resizing");let i=this.#l.get(e);this.#M=null,this.dispatchEvent(new CustomEvent("resize",{bubbles:!0,detail:{key:e,width:i}})),this.render()};#q(){document.removeEventListener("mousemove",this.#A),document.removeEventListener("mouseup",this.#D),this.#M=null}#z=t=>{let i=this.#v.length+(this.selectable?1:0),n=this.querySelector(":scope > [data-body]"),r=n?n.children.length:0;this.#u||(this.#u={row:0,col:0});let{row:o,col:a}=this.#u,l=!0;switch(t.key){case"ArrowDown":o=Math.min(o+1,r-1);break;case"ArrowUp":o=Math.max(o-1,-1);break;case"ArrowRight":a=Math.min(a+1,i-1);break;case"ArrowLeft":a=Math.max(a-1,0);break;case"Tab":if(t.shiftKey?(a--,a<0&&(a=i-1,o--)):(a++,a>=i&&(a=0,o++)),o<-1||o>=r){l=!1;break}break;case"Enter":if(o===-1){let c=this.querySelector(":scope > [data-header]")?.children[a];c?.dataset.sortKey&&c.click()}else{let h=this.querySelector("[data-focused]");h&&h.click()}break;default:l=!1}l&&(t.preventDefault(),this.#u={row:o,col:a},this.#N())};#N(){let t=this.querySelector("[data-focused]");if(t&&t.removeAttribute("data-focused"),!this.#u)return;let{row:e,col:i}=this.#u,n;e===-1?n=this.querySelector(":scope > [data-header]")?.children[i]:n=this.querySelector(":scope > [data-body]")?.children[e]?.children[i],n&&(n.setAttribute("data-focused",""),n.scrollIntoView?.({block:"nearest",inline:"nearest"}))}exportCSV(t="export.csv"){let e=this.#v,i=this.#x(),n=e.map(c=>rl(c.label||c.key)),r=i.map(c=>{let u=this.#e[c];return e.map(d=>{let f=si(u,d);if(typeof d.format=="function")return rl(d.format(f,u));let p=Ci[d.type||"text"];return p?.format?rl(p.format(f,u,d.meta)):rl(f)})}),o=[n.join(","),...r.map(c=>c.join(","))].join(`
160
+ `),a=new Blob([o],{type:"text/csv;charset=utf-8;"}),l=URL.createObjectURL(a),h=document.createElement("a");h.href=l,h.download=t,h.style.display="none",document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(l)}};w("table-ui",$n);var e1=200;function au(s){let t=document.createElement("text-ui");return t.setAttribute("data-popover-empty",""),t.setAttribute("color","subtle"),t.setAttribute("variant","caption"),t.textContent=s,t}function lu(s){let t=document.createElement("text-ui");return t.setAttribute("data-popover-head",""),t.setAttribute("variant","kicker"),t.setAttribute("color","subtle"),t.textContent=s,t}var i1=50,Fg=500;function Gg(s,t){if(typeof t?.accessor=="function")return t.accessor(s);let e=t?.key;if(!e||s==null)return;let i=String(e).split("."),n=s;for(let r of i){if(n==null)return;n=n[r]}return n}function s1(s){if(!s)return!1;let t=String(s);return!!(t==="id"||t==="ID"||t==="uuid"||t==="guid"||/[a-z](Id|ID)$/.test(t)||/_id$/i.test(t))}function n1(s,t){if(s?.filter==="select"||s?.filter==="text")return s.filter;if(s1(s?.key))return"text";let e=[],i=Math.min(t?.length??0,Fg),n=new Set;for(let r=0;r<i;r++){let o=Gg(t[r],s);if(!(o==null||o==="")&&(e.push(o),n.add(String(o)),n.size>i1))return"text"}return e.length?"select":"text"}function r1(s,t){let e=new Set,i=Math.min(t?.length??0,Fg);for(let n=0;n<i;n++){let r=Gg(t[n],s);r==null||r===""||e.add(String(r))}return[...e].sort((n,r)=>n.localeCompare(r,void 0,{numeric:!0}))}var An=class s extends A{static properties={for:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!1},count:{type:String,default:"",reflect:!1},noFilter:{type:Boolean,default:!1,reflect:!0,attribute:"no-filter"},noSort:{type:Boolean,default:!1,reflect:!0,attribute:"no-sort"},noColumns:{type:Boolean,default:!1,reflect:!0,attribute:"no-columns"},noSearch:{type:Boolean,default:!1,reflect:!0,attribute:"no-search"},placeholder:{type:String,default:"Search...",reflect:!1},variant:{type:String,default:"default",reflect:!0}};static requiredIcons=["arrow-up","arrow-down","caret-up-down"];static template=()=>null;#t=null;#e=[];#i=null;#s=!1;#n=null;#r=new Set;static _warnedUnknownAttrs=new WeakSet;static _CANONICAL_OPT_OUT_ATTRS=new Set(["no-search","no-filter","no-sort","no-columns"]);static _OPT_OUT_PREFIX_RE=/^(search|export|sort|filter|column)/i;connected(){this.setAttribute("role","toolbar"),this.#o(),this.#h(),this.#a(),this.#O()}disconnected(){this.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null);for(let t of this.#r)cancelAnimationFrame(t);this.#r.clear(),this.#b(),this.#u()}render(){this.#a(),this.#O(),this.#f()}#o(){if(s._warnedUnknownAttrs.has(this))return;let t=[];for(let i of this.attributes){let n=i.name.toLowerCase();s._CANONICAL_OPT_OUT_ATTRS.has(n)||s._OPT_OUT_PREFIX_RE.test(n)&&t.push(n)}if(t.length===0)return;s._warnedUnknownAttrs.add(this);let e=t.map(i=>`"${i}"`).join(", ");console.warn(`[table-toolbar-ui] Unknown opt-out attribute(s) ${e}. Canonical opt-out attrs are: no-search, no-filter, no-sort, no-columns. See packages/web-components/components/table-toolbar/table-toolbar.yaml or run \`npx adia-ui-doc table-toolbar\` for the full attribute reference.`)}#a(){let t=this.#l();if(t===this.#t||(this.#u(),!t))return;this.#t=t;let e=()=>this.#y(),i=()=>this.#w();t.addEventListener("sort",e),t.addEventListener("filter-change",i),this.#e.push(["sort",e],["filter-change",i])}#l(){if(this.for){let i=this.getRootNode?.()?.getElementById?.(this.for)||document.getElementById(this.for);return i&&i.tagName?.toLowerCase()==="table-ui"?i:null}let t=this.parentElement;return t&&t.querySelector(":scope table-ui")||null}#u(){if(this.#t)for(let[t,e]of this.#e)this.#t.removeEventListener(t,e);this.#e=[],this.#t=null}#h(){if(this.querySelector(":scope > [data-toolbar]"))return;let t=document.createElement("div");t.setAttribute("data-toolbar","");let e=document.createElement("div");e.setAttribute("data-title","");let i=document.createElement("span");i.setAttribute("data-heading",""),e.appendChild(i);let n=document.createElement("badge-ui");n.setAttribute("data-count-badge",""),n.setAttribute("size","sm"),n.setAttribute("variant","muted"),n.hidden=!0,e.appendChild(n);let r=document.createElement("div");r.setAttribute("data-controls",""),r.appendChild(this.#d("filter","Filter","funnel-simple")),r.appendChild(this.#d("sort","Sort","arrows-down-up")),r.appendChild(this.#d("columns","Columns","columns"));let o=document.createElement("search-ui");o.setAttribute("data-search",""),o.setAttribute("placeholder",this.placeholder),o.setAttribute("debounce",String(e1)),o.addEventListener("search",this.#g);let a=document.createElement("div");a.setAttribute("data-actions","");for(let l of[...this.children])l!==t&&l.getAttribute?.("slot")==="actions"&&a.appendChild(l);t.appendChild(e),t.appendChild(r),t.appendChild(o),t.appendChild(a),this.appendChild(t),this.#f(),this.#p()}#c(t,e){let i=document.createElement("button-ui");return i.setAttribute("data-popover-action",""),i.setAttribute("text",t),i.setAttribute("variant","ghost"),i.setAttribute("size","sm"),i.setAttribute("stretch",""),i.addEventListener("click",e),i}#d(t,e,i){let n=document.createElement("button-ui");return n.setAttribute("data-toolbar-btn",t),n.setAttribute("icon",i),n.setAttribute("text",e),n.setAttribute("variant","outline"),n.setAttribute("size","sm"),n.setAttribute("aria-haspopup","menu"),n.addEventListener("click",r=>{r.stopPropagation(),this.#m(t,n)}),n}#f(){let t=this.querySelector(":scope [data-heading]");if(!t)return;this.text?(t.textContent=this.text,t.hidden=!1):t.textContent.trim()?t.hidden=!1:t.hidden=!0;let e=this.querySelector(":scope [data-count-badge]");if(!e)return;let i=this.count?.toString().trim(),n=this.#t?.data?.length,r=i||(Number.isFinite(n)?String(n):"");r?(e.setAttribute("text",r),e.hidden=!1):e.hidden=!0}#p(){let t=this.querySelector(":scope > [data-toolbar]");if(!t)return;let e=(i,n)=>{let r=t.querySelector(i);r&&(r.hidden=n)};e('[data-toolbar-btn="filter"]',this.noFilter),e('[data-toolbar-btn="sort"]',this.noSort),e('[data-toolbar-btn="columns"]',this.noColumns),e("[data-search]",this.noSearch)}attributeChanged(t){["no-filter","no-sort","no-columns","no-search"].includes(t)&&this.#p(),t==="placeholder"&&this.querySelector(":scope [data-search]")?.setAttribute("placeholder",this.placeholder)}#g=t=>{let e=t.detail?.value??"";this.#t&&(this.#t.search=e),this.dispatchEvent(new CustomEvent("search",{bubbles:!0,detail:{value:e}}))};#O(){if(!this.#t)return;let t=this.querySelector(":scope [data-search]");t&&this.#t.search&&(t.value=this.#t.search),this.#f()}#m(t,e){if(this.#i?.kind===t){this.#b();return}this.#b();let i=document.createElement("div");i.setAttribute("data-toolbar-popover",t),i.setAttribute("popover","manual"),i.setAttribute("role","menu"),t==="filter"&&this.#x(i),t==="sort"&&this.#k(i),t==="columns"&&this.#$(i),document.body.appendChild(i);try{i.showPopover()}catch{}let n=Tt(e,i,{placement:"bottom-start",gap:4});this.#i={kind:t,btn:e,panel:i,cleanup:n},this.#s||(this.#s=!0,this.#n=requestAnimationFrame(()=>{this.#n=null,!(!this.isConnected||!this.#s)&&(document.addEventListener("pointerdown",this.#v,!0),document.addEventListener("keydown",this.#S,!0))}))}#b(){let t=this.#i;if(t){if(t.cleanup?.(),t.panel?.matches?.(":popover-open"))try{t.panel.hidePopover()}catch{}t.panel?.remove(),this.#i=null,this.#s&&(this.#s=!1,document.removeEventListener("pointerdown",this.#v,!0),document.removeEventListener("keydown",this.#S,!0))}}#v=t=>{let e=this.#i;e&&(e.btn.contains(t.target)||e.panel.contains(t.target)||this.#b())};#S=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#b(),this.#i?.btn?.focus?.({preventScroll:!0}))};#x(t){let e=this.#t;if(!e?.columns?.length){t.appendChild(au("No filterable columns"));return}let i=e.filters||{};t.appendChild(lu("Filter rows"));let n=document.createElement("div");n.setAttribute("data-popover-list","");let r=e.data||[];for(let o of e.columns){if(o.hidden)continue;let a=document.createElement("field-ui");a.setAttribute("data-filter-row",""),a.setAttribute("inline",""),a.setAttribute("label",o.label||o.key);let l=n1(o,r),h=i[o.key];if(l==="select"){let c=document.createElement("select-ui");c.setAttribute("data-filter-input",""),c.setAttribute("multiple",""),c.setAttribute("placeholder","\u2014");let u=r1(o,r);u.length>=12&&c.setAttribute("searchable","");for(let d of u){let f=document.createElement("option");f.setAttribute("value",d),f.textContent=d,c.appendChild(f)}h?.op==="select"&&h.value&&(c.value=h.value),c.addEventListener("change",()=>{let d=c.value||"";d?e.setFilter(o.key,d,"select"):e.setFilter(o.key,null),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,detail:{filters:e.filters}}))}),a.appendChild(c)}else{let c=document.createElement("input-ui");c.setAttribute("type","text"),c.setAttribute("size","sm"),c.setAttribute("data-filter-input",""),c.setAttribute("placeholder","\u2014"),h?.op==="contains"&&(c.value=h.value??""),c.addEventListener("input",()=>{let u=c.value;u?e.setFilter(o.key,u,"contains"):e.setFilter(o.key,null),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,detail:{filters:e.filters}}))}),a.appendChild(c)}n.appendChild(a)}if(t.appendChild(n),Object.keys(i).length){let o=this.#c("Clear all filters",()=>{e.clearFilters(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,detail:{filters:{}}})),this.#w()});t.appendChild(o)}}#w(){let t=this.#i;!t||t.kind!=="filter"||(t.panel.replaceChildren(),this.#x(t.panel))}#k(t){let e=this.#t;if(!e?.columns?.length){t.appendChild(au("No sortable columns"));return}t.appendChild(lu("Sort by"));let i=e.sortState||[],n=new Map(i.map(o=>[o.key,o.dir])),r=document.createElement("div");r.setAttribute("data-popover-list","");for(let o of e.columns){if(o.hidden||o.sortable===!1)continue;let a=n.get(o.key),l=document.createElement("menu-item-ui");l.setAttribute("data-sort-row",""),l.setAttribute("text",o.label||o.key),l.dataset.key=o.key,a&&(l.dataset.active=a);let h=requestAnimationFrame(()=>{if(this.#r.delete(h),!this.isConnected)return;let c=document.createElement("icon-ui");c.setAttribute("data-sort-indicator",""),c.setAttribute("size","xs"),c.setAttribute("name",a==="asc"?"arrow-up":a==="desc"?"arrow-down":"caret-up-down"),l.appendChild(c)});this.#r.add(h),l.addEventListener("click",c=>{let u=e.querySelector(`:scope > [data-header] [data-sort-key="${o.key}"]`);if(!u)return;let d=new MouseEvent("click",{bubbles:!0,cancelable:!0,shiftKey:c.shiftKey});u.dispatchEvent(d),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,detail:{sortState:e.sortState}})),this.#y()}),r.appendChild(l)}if(t.appendChild(r),i.length){let o=this.#c("Clear sort",()=>{for(let a of[...i]){let l=e.querySelector(`:scope > [data-header] [data-sort-key="${a.key}"]`);if(!l)continue;let h=c=>l.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,shiftKey:c}));i.length>1?(h(!0),h(!0)):(h(!1),h(!1))}this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,detail:{sortState:e.sortState}})),this.#y()});t.appendChild(o)}}#y(){let t=this.#i;!t||t.kind!=="sort"||(t.panel.replaceChildren(),this.#k(t.panel))}#$(t){let e=this.#t;if(!e?.columns?.length){t.appendChild(au("No columns"));return}t.appendChild(lu("Visible columns"));let i=document.createElement("div");i.setAttribute("data-popover-list","");for(let n of e.columns){let r=document.createElement("field-ui");r.setAttribute("data-columns-row",""),r.setAttribute("inline",""),r.setAttribute("label",n.label||n.key);let o=document.createElement("check-ui");n.hidden||o.setAttribute("checked",""),o.dataset.key=n.key,o.addEventListener("change",()=>{let a=e.columns.map(l=>l.key===n.key?{...l,hidden:!o.hasAttribute("checked")}:{...l});e.columns=a,this.dispatchEvent(new CustomEvent("columns-change",{bubbles:!0,detail:{hiddenColumns:a.filter(l=>l.hidden).map(l=>l.key)}}))}),r.appendChild(o),i.appendChild(r)}t.appendChild(i)}};w("table-toolbar-ui",An);var Qn=class extends A{static properties={orientation:{type:String,default:"vertical",reflect:!0},size:{type:String,default:"md",reflect:!0}};static template=()=>null;render(){let t=[...this.querySelectorAll(":scope > timeline-item-ui")];for(let i of t)i.removeAttribute("data-last");let e=t[t.length-1];e&&e.setAttribute("data-last","")}},Pn=class extends A{static properties={text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},time:{type:String,default:"",reflect:!0},duration:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},status:{type:String,default:"idle",reflect:!0},spinner:{type:Boolean,default:!1,reflect:!0}};static requiredIcons=["caret-down","caret-right"];static template=()=>null;#t=[];#e=!1;get outcomes(){return this.#t}set outcomes(t){this.#t=Array.isArray(t)?t.slice():[],this.render()}connected(){this.querySelector(':scope > [slot="label"]')||(this.innerHTML=`
161
+ <span slot="label"></span>
162
+ <span slot="description"></span>
163
+ <span slot="time"></span>
164
+ `)}render(){let t=this.querySelector(':scope > [slot="label"]'),e=this.querySelector(':scope > [slot="description"]'),i=this.querySelector(':scope > [slot="time"]');if(t&&(t.textContent=this.text),e&&(e.textContent=this.description),i&&(i.textContent=this.duration||this.time),this.icon){let r=this.querySelector(':scope > [slot="icon"]');r||(r=document.createElement("icon-ui"),r.setAttribute("slot","icon"),this.prepend(r)),r.setAttribute("name",this.icon)}else this.querySelector(':scope > [slot="icon"]')?.remove();let n=this.querySelector(':scope > [slot="outcomes"]');if(this.#t.length>0){n||(n=document.createElement("ul"),n.setAttribute("slot","outcomes"),this.appendChild(n)),n.innerHTML="";for(let a of this.#t){let l=document.createElement("li");l.textContent=a,n.appendChild(l)}n.hidden=!this.#e;let r=this.querySelector(":scope > [data-timeline-toggle]");r||(r=document.createElement("button"),r.type="button",r.setAttribute("data-timeline-toggle",""),r.setAttribute("aria-label","Toggle details"),r.addEventListener("click",a=>{a.stopPropagation(),this.#e=!this.#e,this.render(),this.dispatchEvent(new CustomEvent("timeline-toggle",{bubbles:!0,detail:{expanded:this.#e}}))}),this.appendChild(r)),r.innerHTML="";let o=document.createElement("icon-ui");o.setAttribute("name",this.#e?"caret-down":"caret-right"),o.setAttribute("color","muted"),o.setAttribute("size","sm"),r.appendChild(o)}else this.querySelector(":scope > [data-timeline-toggle]")?.remove(),n?.remove()}};w("timeline-ui",Qn),w("timeline-item-ui",Pn);var Cn=class extends A{static properties={step:{type:Number,default:0,reflect:!0},orientation:{type:String,default:"horizontal",reflect:!0}};static template=()=>null;render(){let t=[...this.querySelectorAll("stepper-item-ui")];for(let i of t)i.removeAttribute("data-last");let e=t[t.length-1];e&&e.setAttribute("data-last",""),t.forEach((i,n)=>{i.setAttribute("data-index",n),n<this.step?i.setAttribute("status","completed"):n===this.step?i.setAttribute("status","active"):i.setAttribute("status","idle")})}next(){let t=this.querySelectorAll("stepper-item-ui").length;this.step<t-1&&this.step++}prev(){this.step>0&&this.step--}goTo(t){let e=this.querySelectorAll("stepper-item-ui").length-1;this.step=Math.max(0,Math.min(t,e))}},En=class extends A{static properties={text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},status:{type:String,default:"idle",reflect:!0}};static template=()=>null;connected(){this.querySelector('[slot="label"]')||(this.innerHTML=`
165
+ <span slot="label"></span>
166
+ <span slot="description"></span>
167
+ `)}render(){let t=this.querySelector('[slot="label"]'),e=this.querySelector('[slot="description"]');if(t&&(t.textContent=this.text),e&&(e.textContent=this.description),this.icon){let i=this.querySelector('[slot="icon"]');i||(i=document.createElement("icon-ui"),i.setAttribute("slot","icon"),this.prepend(i)),i.setAttribute("name",this.icon)}else this.querySelector('[slot="icon"]')?.remove()}};w("stepper-ui",Cn),w("stepper-item-ui",En);var Tn=class extends A{static properties={autoplay:{type:Boolean,default:!1,reflect:!0},interval:{type:Number,default:5e3,reflect:!0},noPauseOnHover:{type:Boolean,default:!1,reflect:!0,attribute:"no-pause-on-hover"},loop:{type:Boolean,default:!1,reflect:!0},peek:{type:Boolean,default:!1,reflect:!0},snap:{type:String,default:"start",reflect:!0},gap:{type:String,default:"",reflect:!0},slidesPerView:{type:String,default:"",reflect:!0,attribute:"slides-per-view"},chrome:{type:String,default:"default",reflect:!0},label:{type:String,default:""},counter:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=0;#r=!1;#o=!1;#a=null;get slides(){return this.#t?[...this.#t.children]:[]}get activeIndex(){return this.#n}connected(){if(!this.#t){for(this.#t=document.createElement("div"),this.#t.setAttribute("data-swiper-track","");this.firstChild;)this.#t.appendChild(this.firstChild);this.appendChild(this.#t)}this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),this.getAttribute("aria-label")||this.setAttribute("aria-label","Carousel"),this.#l(),this.#u(),this.#O(),this.#r||(this.#r=!0,this.noPauseOnHover||(this.addEventListener("pointerenter",this.#w),this.addEventListener("pointerleave",this.#k),this.addEventListener("focusin",this.#y),this.addEventListener("focusout",this.#$)),this.addEventListener("keydown",this.#Q),this.#t.addEventListener("pointerdown",this.#C),this.#t.addEventListener("pointermove",this.#L),this.#t.addEventListener("pointerup",this.#E),this.#t.addEventListener("pointercancel",this.#E),this.#t.addEventListener("click",this.#Z,!0),this.#t.addEventListener("dragstart",this.#X)),this.autoplay&&this.play()}render(){if(this.gap&&this.#t){let e=/^[0-9]+$/.test(this.gap)?`var(--a-space-${this.gap})`:this.gap;this.style.setProperty("--swiper-gap",e)}}disconnected(){this.pause(),this.#i?.disconnect(),this.#i=null,this.#t&&this.#s&&this.#t.removeEventListener("scroll",this.#s),this.#s=null,this.removeEventListener("pointerenter",this.#w),this.removeEventListener("pointerleave",this.#k),this.removeEventListener("focusin",this.#y),this.removeEventListener("focusout",this.#$),this.removeEventListener("keydown",this.#Q),this.#t&&(this.#t.removeEventListener("pointerdown",this.#C),this.#t.removeEventListener("pointermove",this.#L),this.#t.removeEventListener("pointerup",this.#E),this.#t.removeEventListener("pointercancel",this.#E),this.#t.removeEventListener("click",this.#Z,!0),this.#t.removeEventListener("dragstart",this.#X)),this.#a=null,this.#t=null,this.#r=!1}next(){let t=this.#c()-1,e=this.#g(this.#n),i=Math.min(e+1,t);if(i!==e||this.loop){let n=this.loop&&i===e?0:i;this.goTo(this.#p(n))}}prev(){let t=this.#c()-1,e=this.#g(this.#n),i=Math.max(e-1,0);if(i!==e||this.loop){let n=this.loop&&i===e?t:i;this.goTo(this.#p(n))}}goTo(t){let e=this.slides[t];if(!e||!this.#t)return;let i=Math.max(0,this.#d(e));this.#t.scrollTo({left:i,behavior:"smooth"})}play(){this.pause(),!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&(this.#e=setInterval(()=>{let t=this.#c()-1,i=this.#g(this.#n)>=t;i&&this.loop?this.goTo(this.#p(0)):i?this.pause():this.next()},this.interval||5e3))}pause(){this.#e&&(clearInterval(this.#e),this.#e=null)}#l(){let t=this.slides;t.forEach((e,i)=>{e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.getAttribute("aria-label")||e.setAttribute("aria-label",`${i+1} of ${t.length}`)})}#u(){this.#s=()=>{let t=this.#f();t!==this.#n&&(this.#n=t,this.#x(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{index:t,slide:this.slides[t]}})))},this.#t.addEventListener("scroll",this.#s,{passive:!0}),this.#n=this.#f()}#h(){if(!this.#t)return 1;let t=getComputedStyle(this.#t).getPropertyValue("--swiper-columns").trim(),e=parseInt(t,10);return Number.isFinite(e)&&e>0?e:1}#c(){let t=this.slides.length;return t===0?0:this.snap==="center"?t:Math.max(1,t-this.#h()+1)}#d(t){let e=this.#t.clientWidth,i=t.offsetLeft-this.#t.offsetLeft,n=t.offsetWidth;return this.snap==="center"?i+n/2-e/2:this.snap==="end"?i+n-e:i}#f(){if(!this.#t)return 0;let t=this.slides;if(t.length===0)return 0;let e=this.#t.scrollLeft,i=Math.max(0,this.#t.scrollWidth-this.#t.clientWidth),n=0,r=1/0;for(let o=0;o<t.length;o++){let a=Math.max(0,Math.min(i,this.#d(t[o]))),l=Math.abs(e-a);l<r&&(r=l,n=o)}return n}#p(t){if(this.snap!=="end")return t;let e=this.#h();return Math.min(this.slides.length-1,t+e-1)}#g(t){if(this.snap!=="end")return t;let e=this.#h();return Math.max(0,t-e+1)}#O(){this.#o||(this.#o=!0,this.chrome==="toolbar"?this.#b():this.#m(),this.#S(),typeof ResizeObserver<"u"&&(this.#i=new ResizeObserver(()=>this.#S()),this.#i.observe(this)))}#m(){let t=document.createElement("button-ui");t.setAttribute("data-swiper-btn",""),t.setAttribute("data-swiper-prev",""),t.setAttribute("icon","caret-left"),t.setAttribute("variant","ghost"),t.setAttribute("aria-label","Previous slide"),t.addEventListener("press",()=>this.prev());let e=document.createElement("button-ui");e.setAttribute("data-swiper-btn",""),e.setAttribute("data-swiper-next",""),e.setAttribute("icon","caret-right"),e.setAttribute("variant","ghost"),e.setAttribute("aria-label","Next slide"),e.addEventListener("press",()=>this.next()),this.appendChild(t),this.appendChild(e);let i=document.createElement("div");i.setAttribute("data-swiper-dots",""),i.setAttribute("role","tablist"),i.setAttribute("aria-label","Slide indicators"),this.appendChild(i)}#b(){let t=document.createElement("div");t.setAttribute("data-swiper-head","");let e=document.createElement("span");e.setAttribute("data-swiper-label",""),e.textContent=this.label||"",t.appendChild(e);let i=document.createElement("div");i.setAttribute("data-swiper-paddles","");let n=document.createElement("button-ui");n.setAttribute("icon","caret-left"),n.setAttribute("variant","ghost"),n.setAttribute("size","sm"),n.setAttribute("aria-label","Previous slide"),n.addEventListener("press",()=>this.prev());let r=document.createElement("button-ui");r.setAttribute("icon","caret-right"),r.setAttribute("variant","ghost"),r.setAttribute("size","sm"),r.setAttribute("aria-label","Next slide"),r.addEventListener("press",()=>this.next()),i.appendChild(n),i.appendChild(r),t.appendChild(i),this.insertBefore(t,this.#t);let o=document.createElement("div");o.setAttribute("data-swiper-foot","");let a=document.createElement("span");a.setAttribute("data-swiper-counter",""),o.appendChild(a);let l=document.createElement("div");l.setAttribute("data-swiper-dots",""),l.setAttribute("role","tablist"),l.setAttribute("aria-label","Slide indicators"),o.appendChild(l),this.appendChild(o),this.#v()}#v(){let t=this.querySelector("[data-swiper-counter]");if(!t)return;if(!this.counter){t.textContent="";return}let e=this.#g(this.#n)+1,i=this.#c();t.textContent=`${e} / ${i}`}#S(){let t=this.querySelector("[data-swiper-dots]");if(!t)return;let e=this.#c();if(t.children.length!==e){for(;t.firstChild;)t.removeChild(t.firstChild);for(let i=0;i<e;i++){let n=document.createElement("button");n.setAttribute("role","tab"),n.setAttribute("aria-label",`Page ${i+1}`),n.addEventListener("click",()=>this.goTo(this.#p(i))),t.appendChild(n)}}this.#x()}#x(){if(!this.#o)return;let t=this.querySelector("[data-swiper-dots]");if(t){let e=this.#c()-1,i=Math.min(Math.max(this.#g(this.#n),0),e);[...t.children].forEach((n,r)=>{n.setAttribute("aria-current",r===i?"true":"false")})}this.#v()}#w=()=>{this.#e&&(this.pause(),this.dispatchEvent(new CustomEvent("autoplay-pause",{bubbles:!0,detail:{reason:"hover"}})))};#k=()=>{this.autoplay&&!this.#e&&(this.play(),this.dispatchEvent(new CustomEvent("autoplay-resume",{bubbles:!0})))};#y=()=>{this.#e&&(this.pause(),this.dispatchEvent(new CustomEvent("autoplay-pause",{bubbles:!0,detail:{reason:"focus"}})))};#$=t=>{this.autoplay&&!this.contains(t.relatedTarget)&&(this.play(),this.dispatchEvent(new CustomEvent("autoplay-resume",{bubbles:!0})))};#Q=t=>{t.key==="ArrowRight"&&(t.preventDefault(),this.next()),t.key==="ArrowLeft"&&(t.preventDefault(),this.prev())};#P=5;#C=t=>{t.pointerType!=="touch"&&t.button===0&&(t.target.closest("button, button-ui, a, input, select, textarea")||(this.#a={pointerId:t.pointerId,startX:t.clientX,startScrollLeft:this.#t.scrollLeft,hasMoved:!1},this.#t.style.scrollBehavior="auto",this.#t.setAttribute("data-dragging","")))};#L=t=>{if(!this.#a||t.pointerId!==this.#a.pointerId)return;let e=t.clientX-this.#a.startX;if(Math.abs(e)>=this.#P){if(!this.#a.hasMoved){this.#a.hasMoved=!0;try{this.#t.setPointerCapture(t.pointerId)}catch{}}this.#t.scrollLeft=this.#a.startScrollLeft-e,t.preventDefault()}};#E=t=>{if(!this.#a||t.pointerId!==this.#a.pointerId)return;let e=this.#a.hasMoved;if(e)try{this.#t.releasePointerCapture(t.pointerId)}catch{}this.#a=null,this.#t.style.scrollBehavior="",this.#t.removeAttribute("data-dragging"),e&&(this.#t.setAttribute("data-just-dragged",""),requestAnimationFrame(()=>this.#t?.removeAttribute("data-just-dragged")))};#Z=t=>{this.#t?.hasAttribute("data-just-dragged")&&(t.preventDefault(),t.stopPropagation())};#X=t=>{this.#a&&t.preventDefault()}};w("swiper-ui",Tn);var Ln=class extends z{static labelDeprecated=!1;static properties={...z.properties,label:{type:String,default:"",reflect:!0},accept:{type:String,default:"",reflect:!0},multiple:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=null;connected(){super.connected(),this.querySelector("[data-dropzone]")||(this.innerHTML=`
168
+ <div data-dropzone tabindex="0" role="button">Drop files here or click to browse</div>
169
+ <span hint="${this.hint||""}"></span>
170
+ <div data-filelist></div>
171
+ `),this.#e=this.querySelector("[data-dropzone]"),this.#e&&(this.#e.addEventListener("click",this.#i),this.#e.addEventListener("keydown",this.#s),this.#e.addEventListener("dragover",this.#a),this.#e.addEventListener("dragleave",this.#l),this.#e.addEventListener("drop",this.#u))}render(){let t=this.querySelector("[data-filelist]");if(!this.#e||!t)return;let e=this.querySelector("span[hint]");e&&this.hint&&e.setAttribute("hint",this.hint),t.innerHTML="";for(let i of this.#t){let n=document.createElement("span");n.textContent=i.name,t.appendChild(n)}}get files(){return this.#t}#i=()=>{this.disabled||this.#n()};#s=t=>{this.disabled||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n())};async#n(){try{if(window.showOpenFilePicker){let t=this.#o(),e={multiple:this.multiple};t.length&&(e.types=t);let i=await window.showOpenFilePicker(e);if(!this.isConnected)return;let n=await Promise.all(i.map(r=>r.getFile()));if(!this.isConnected)return;this.#h(n)}else this.#r()}catch(t){if(t.name!=="AbortError")throw t}}#r(){let t=document.createElement("input");t.type="file",this.accept&&(t.accept=this.accept),this.multiple&&(t.multiple=!0),t.style.display="none",document.body.appendChild(t),t.addEventListener("change",()=>{t.files?.length&&this.#h([...t.files]),t.remove()},{once:!0}),t.addEventListener("cancel",()=>t.remove(),{once:!0}),t.click()}#o(){if(!this.accept)return[];let t={};for(let e of this.accept.split(",")){let i=e.trim();i&&(i.startsWith(".")?(t["application/octet-stream"]=t["application/octet-stream"]||[],t["application/octet-stream"].push(i)):t[i]=t[i]||[])}return Object.keys(t).length?[{accept:t}]:[]}#a=t=>{t.preventDefault(),this.querySelector("[data-dropzone]")?.setAttribute("data-dragover","")};#l=()=>{this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover")};#u=t=>{if(t.preventDefault(),this.querySelector("[data-dropzone]")?.removeAttribute("data-dragover"),this.disabled)return;let e=t.dataTransfer;e?.files?.length&&this.#h([...e.files])};#h(t){this.#t=t;let e=new FormData;for(let i of this.#t)e.append(this.name||"file",i);this.internals.setFormValue(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value,files:this.files}})),this.render()}disconnected(){super.disconnected(),this.#e&&(this.#e.removeEventListener("click",this.#i),this.#e.removeEventListener("keydown",this.#s),this.#e.removeEventListener("dragover",this.#a),this.#e.removeEventListener("dragleave",this.#l),this.#e.removeEventListener("drop",this.#u)),this.#e=null}};w("upload-ui",Ln);var Mn=Bg({name:"draggable",category:"motion-positioning",description:"Pointer drag to reposition",attributes:["data-draggable-dragging"],events:["drag-end"],config:[],setup({host:s}){let t=!1,e=0,i=0,n=0,r=0;function o(){return s.hasAttribute("disabled")}function a(c){if(o())return;t=!0,e=c.clientX,i=c.clientY;let u=getComputedStyle(s),d=u.translate;if(d&&d!=="none"){let f=d.split(/\s+/).map(parseFloat);n=f[0]||0,r=f[1]||0}else{let f=new DOMMatrixReadOnly(u.transform);n=f.m41,r=f.m42}s.setPointerCapture(c.pointerId),s.setAttribute("data-draggable-dragging",""),s.style.touchAction="none"}function l(c){if(!t)return;let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.style.translate=`${f}px ${p}px`}function h(c){if(!t)return;t=!1,s.removeAttribute("data-draggable-dragging");let u=c.clientX-e,d=c.clientY-i,f=n+u,p=r+d;s.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{x:f,y:p}}))}return s.addEventListener("pointerdown",a),s.addEventListener("pointermove",l),s.addEventListener("pointerup",h),()=>{s.removeEventListener("pointerdown",a),s.removeEventListener("pointermove",l),s.removeEventListener("pointerup",h),s.removeAttribute("data-draggable-dragging"),s.style.touchAction=""}}});var Rn=class extends A{static properties={variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"",reflect:!0},elevation:{type:Number,default:1,reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(Mn),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(Mn),this.#t=!0)}};w("card-ui",Rn);var Xn=class s extends A{static properties={src:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},name:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},size:{type:String,default:"md",reflect:!0},shape:{type:String,default:"circle",reflect:!0}};get displayName(){return this.text||this.name}static template=()=>null;static#t=!1;#e=null;#i=null;#s=null;connected(){this.setAttribute("role","img"),this.name&&!this.text&&!s.#t&&(s.#t=!0,console.warn('[AdiaUI] <avatar-ui name="\u2026"> is deprecated \u2014 use text="\u2026" instead. Docs: https://ui-kit.exe.xyz/site/components/avatar'))}render(){!this.src&&!this.displayName&&!this.icon||(this.src?(this.#e||(this.#e=document.createElement("img"),this.#e.setAttribute("slot","img"),this.#e.onerror=()=>{this.#e.remove(),this.#e=null,this.#n()}),this.#e.src=this.src,this.#e.alt=this.name||"",this.#e.parentElement||this.appendChild(this.#e),this.#i&&(this.#i.remove(),this.#i=null)):this.icon?(this.#e&&(this.#e.remove(),this.#e=null),this.#i&&(this.#i.remove(),this.#i=null),this.#s||(this.#s=document.createElement("icon-ui"),this.#s.setAttribute("slot","icon"),this.appendChild(this.#s)),this.#s.setAttribute("name",this.icon)):(this.#e&&(this.#e.remove(),this.#e=null),this.#s&&(this.#s.remove(),this.#s=null),this.#n()),this.setAttribute("aria-label",this.displayName||this.icon||""))}#n(){if(!this.displayName)return;let t=this.displayName.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase();this.#i||(this.#i=document.createElement("span"),this.#i.setAttribute("slot","initials"),this.appendChild(this.#i)),this.#i.textContent=t}},In=class extends A{static properties={max:{type:Number,default:5,reflect:!0},size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Avatar group")}render(){let t=[...this.querySelectorAll("avatar-ui")],e=this.max,i=t.length-e;if(this.size)for(let r of t)r.setAttribute("size",this.size);t.forEach((r,o)=>{r.style.display=o<e?"":"none",r.style.zIndex=String(t.length-o)});let n=this.querySelector('[slot="overflow"]');i>0?(n||(n=document.createElement("span"),n.setAttribute("slot","overflow"),this.appendChild(n)),n.textContent=`+${i}`,n.setAttribute("aria-label",`${i} more`),n.style.zIndex="0"):n&&n.remove()}};w("avatar-ui",Xn),w("avatar-group-ui",In);var Zn=class extends A{static properties={value:{type:Number,default:null,reflect:!0},variant:{type:String,default:"bar",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"),this.variant==="bar"&&(this.#t=document.createElement("div"),this.#t.setAttribute("slot","track"),this.#e=document.createElement("div"),this.#e.setAttribute("slot","fill"),this.#t.appendChild(this.#e),this.appendChild(this.#t))}render(){let t=this.value==null||this.value<0,e=Math.max(0,Math.min(100,this.value));this.setAttribute("aria-busy",String(t)),t?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",String(e)),this.#e&&(this.#e.style.width=t?"100%":`${e}%`)}disconnected(){this.#t?.remove(),this.#t=null,this.#e=null}};w("progress-ui",Zn);var Dn=class extends A{static properties={value:{type:Number,default:0,reflect:!0},total:{type:Number,default:0,reflect:!0},caption:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),!this.querySelector(':scope > [slot="caption"]')&&!this.querySelector(':scope > [slot="track"]')?(this.#t=document.createElement("span"),this.#t.setAttribute("slot","caption"),this.appendChild(this.#t),this.#e=document.createElement("div"),this.#e.setAttribute("slot","track"),this.appendChild(this.#e)):(this.#t=this.querySelector(':scope > [slot="caption"]'),this.#e=this.querySelector(':scope > [slot="track"]'))}render(){let t=Math.max(0,this.total|0),e=Math.max(0,Math.min(t,this.value|0));if(this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(e)),this.#t&&!this.#t.dataset.custom&&(this.#t.textContent=this.caption||"",this.#t.toggleAttribute("hidden",!this.caption)),this.#e){let i=this.#e.children.length;for(;this.#e.children.length<t;)this.#e.appendChild(document.createElement("span"));for(;this.#e.children.length>t;)this.#e.lastElementChild.remove();for(let n=0;n<this.#e.children.length;n++)this.#e.children[n].toggleAttribute("data-active",n<e)}}disconnected(){this.#t=null,this.#e=null}};w("step-progress-ui",Dn);var qn=class extends A{static properties={width:{type:String,default:"100%",reflect:!0},height:{type:String,default:"1.2em",reflect:!0},radius:{type:String,default:"sm",reflect:!0},static:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("aria-hidden","true"),this.#t()}render(){this.#t()}#t(){this.style.width=this.width,this.style.height=this.height}};w("skeleton-ui",qn);var Hg=new Set;function Kg(s,t){Hg.has(s)||(Hg.add(s),console.warn(`[alert-ui] ${t}`))}var Bn=class extends A{static properties={text:{type:String,default:"",reflect:!0},title:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},closable:{type:Boolean,default:!1,reflect:!0},dismissible:{type:Boolean,default:!1,reflect:!0},icon:{type:String,default:"",reflect:!0}};static parts={leading:'<icon-ui slot="leading"></icon-ui>',content:'<span slot="content"></span>',close:'<button-ui slot="close" icon="x" variant="ghost" size="sm" aria-label="Close"></button-ui>'};static template=()=>null;#t(){this.getAttribute("variant")==="error"&&(Kg("variant-error",'variant="error" is not in the canonical enum [default, info, success, warning, danger, muted, neutral]. Mapping to "danger". Fix the source (LLM prompt / corpus pattern) to emit "danger" directly.'),this.setAttribute("variant","danger")),this.hasAttribute("closeable")&&!this.hasAttribute("closable")&&!this.hasAttribute("dismissible")&&(Kg("alias-closeable","attribute [closeable] is a misspelled alias of canonical [closable]. Mapping. Fix the source to use [closable] or [dismissible]."),this.setAttribute("closable",""),this.removeAttribute("closeable")),this.hasAttribute("dismissible")&&!this.hasAttribute("closable")&&this.setAttribute("closable","")}#e=t=>{t.target.closest('[slot="close"]')&&this.#s()};connected(){this.#t(),this.#i(),this.icon&&this.ensure("leading"),this.ensure("content"),this.closable&&this.ensure("close"),this.addEventListener("press",this.#e)}disconnected(){this.removeEventListener("press",this.#e)}render(){if(this.icon){let e=this.ensure("leading");e&&e.setAttribute("name",this.icon)}else this.drop("leading");let t=this.ensure("content");if(t){let e=t.hasAttribute("data-alert-auto"),i=t.childNodes.length>0;if(!e&&i){if(this.title||this.description){let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}}else if(this.title||this.description){if(t.setAttribute("data-alert-auto","title-desc"),t.replaceChildren(),this.title){let r=document.createElement("strong");r.textContent=this.title,t.appendChild(r),this.description&&t.appendChild(document.createTextNode(" "))}this.description&&t.appendChild(document.createTextNode(this.description));let n=[this.title,this.description].filter(Boolean).join(". ");this.setAttribute("aria-label",n)}else this.text&&(t.setAttribute("data-alert-auto","text"),t.textContent=this.text)}this.closable||this.dismissible?this.ensure("close"):this.drop("close"),this.#i()}#i(){let t=this.variant==="danger"||this.variant==="warning"?"alert":"status";this.setAttribute("role",t)}#s(){this.dispatchEvent(new Event("close",{bubbles:!0})),this.remove()}};w("alert-ui",Bn);var zn=class extends A{static properties={size:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","presentation")}};w("kbd-ui",zn);var jn=class extends A{static requiredIcons=["x"];static properties={text:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},size:{type:String,default:"md",reflect:!0},removable:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static parts={dismiss:'<button slot="dismiss" type="button" aria-label="Remove"><icon-ui name="x"></icon-ui></button>'};static template=()=>null;#t=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};#e=t=>{this.disabled||t.target.closest('[slot="dismiss"]')&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{text:this.text,value:this.text}})),this.remove())};connected(){this.setAttribute("role","status"),this.setAttribute("tabindex","0"),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}disconnected(){this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}render(){if(this.text&&this.setAttribute("aria-label",this.text),this.disabled?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0")),this.removable&&!this.disabled){let t=this.ensure("dismiss");t&&t.parentElement!==this&&this.appendChild(t)}else this.drop("dismiss")}};w("tag-ui",jn);var o1=new Set(["block","dot","square","line","dashed"]),a1=new Set(["sm","md","lg"]),l1=new Set(["out-of-gamut","p3-only","apca-pass","apca-fail"]),h1={"out-of-gamut":"\u25B3","p3-only":"\u2726","apca-pass":"\u2713","apca-fail":"\u2717"},c1={"out-of-gamut":"Outside sRGB gamut","p3-only":"Display-P3 only","apca-pass":"Contrast passes APCA","apca-fail":"Contrast fails APCA"};function u1(s){return s?s.split(/[\s,]+/).map(t=>t.trim()).filter(t=>t&&l1.has(t)):[]}var ts=null;function d1(s){if(!s||typeof s!="string"||typeof document>"u")return null;try{if(!ts){let u=document.createElement("canvas");u.width=1,u.height=1,ts=u.getContext("2d")}ts.fillStyle="#000",ts.clearRect(0,0,1,1),ts.fillStyle=s,ts.fillRect(0,0,1,1);let[t,e,i]=ts.getImageData(0,0,1,1).data;if(t===0&&e===0&&i===0&&s!=="#000"&&s!=="black"&&s!=="#000000")return null;let n=u=>{let d=u/255;return d<=.04045?d/12.92:Math.pow((d+.055)/1.055,2.4)},r=n(t),o=n(e),a=n(i),l=Math.cbrt(.4122214708*r+.5363325363*o+.0514459929*a),h=Math.cbrt(.2119034982*r+.6806995451*o+.1073969566*a),c=Math.cbrt(.0883024619*r+.2817188376*o+.6299787005*a);return .2104542553*l+.793617785*h-.0040720468*c}catch{return null}}var Nn=class extends A{static properties={shape:{type:String,default:"square",reflect:!0},size:{type:String,default:"md",reflect:!0},color:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},detail:{type:String,default:"",reflect:!0},badge:{type:String,default:"",reflect:!0},copyable:{type:Boolean,default:!1,reflect:!0},copyValue:{type:String,default:""},selectable:{type:Boolean,default:!1,reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},autoContrast:{type:Boolean,default:!1,reflect:!0},labelPosition:{type:String,default:"below",reflect:!0,attribute:"label-position"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=!1;#o=null;#a=null;#l=null;#u=null;#h=null;#c=null;connected(){this.#d(),this.#S(),this.#c=new MutationObserver(t=>{let e=!1;for(let i of t){for(let n of i.addedNodes)if(n.nodeType===1){if(n.getAttribute?.("slot")==="chrome"){e=!0;break}if(n.tagName==="SPAN"&&n.style?.display==="contents"&&n.querySelector?.('[slot="chrome"]')){e=!0;break}}if(e)break}e&&(this.#f(),this.#c.takeRecords())}),this.#c.observe(this,{childList:!0})}render(){this.#d(),this.#p(),this.#g(),this.#m(),this.#b(),this.#v(),this.#O()}#d(){if(this.#r)return;let t=Array.from(this.children).filter(r=>r.getAttribute&&r.getAttribute("slot")==="chrome");for(let r of t)r.remove();let e=Array.from(this.children).filter(r=>r.tagName==="SPAN"&&r.style?.display==="contents"&&r.querySelector?.('[slot="chrome"]'));for(let r of e)r.remove();let i=[];for(let r of Array.from(this.childNodes))(r.nodeType===3&&!r.data||r.nodeType===8)&&i.push(r);for(let r of i)r.remove();let n=Array.from(this.childNodes).filter(r=>!(r.nodeType===1&&r.dataset&&(r.dataset.tile!==void 0||r.dataset.label!==void 0||r.dataset.detail!==void 0||r.dataset.badge!==void 0||r.dataset.copy!==void 0))&&!(r.nodeType===3&&!r.textContent.trim()));this.innerHTML="",this.#t=document.createElement("span"),this.#t.setAttribute("data-tile",""),this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t);for(let r of t)this.appendChild(r);for(let r of e)this.appendChild(r);for(let r of i)this.appendChild(r);if(this.#s=document.createElement("span"),this.#s.setAttribute("data-badge",""),this.#s.setAttribute("hidden",""),this.appendChild(this.#s),this.#e=document.createElement("span"),this.#e.setAttribute("data-label",""),n.length)for(let r of n)this.#e.appendChild(r);this.appendChild(this.#e),this.#i=document.createElement("span"),this.#i.setAttribute("data-detail",""),this.#i.setAttribute("hidden",""),this.appendChild(this.#i),this.#n=document.createElement("button"),this.#n.setAttribute("data-copy",""),this.#n.setAttribute("type","button"),this.#n.setAttribute("aria-label","Copy value"),this.#n.setAttribute("hidden",""),this.#n.textContent="\u29C9",this.appendChild(this.#n),this.#r=!0}#f(){if(!this.#t||!this.#s)return;let t=[];for(let e of this.children)if(e!==this.#t){if(e===this.#s)break;e.getAttribute?.("slot")==="chrome"&&t.push(e)}for(let e of Array.from(this.children))e!==this.#t&&e!==this.#s&&e!==this.#e&&e!==this.#i&&e!==this.#n&&e.getAttribute?.("slot")==="chrome"&&this.insertBefore(e,this.#s);for(let e of Array.from(this.children))e===this.#t||e===this.#s||e===this.#e||e===this.#i||e===this.#n||!(e.tagName==="SPAN"&&e.style?.display==="contents")||!e.querySelector?.('[slot="chrome"]')||this.insertBefore(e,this.#s)}#p(){if(!this.#t||!this.#e)return;this.#f();let t=o1.has(this.shape)?this.shape:"square",e=a1.has(this.size)?this.size:"md";t!==this.shape&&this.setAttribute("shape",t),e!==this.size&&this.setAttribute("size",e),this.color&&this.style.setProperty("--swatch-color",this.color),!this.#e.firstChild&&this.label?this.#e.textContent=this.label:this.#e.firstChild?.nodeType===3&&this.label&&(this.#e.textContent=this.label);let i=this.#e.textContent.trim().length>0||this.#e.firstElementChild!=null;this.#e.toggleAttribute("hidden",!i)}#g(){if(!this.#s)return;let t=u1(this.badge);if(t.length===0){this.#s.setAttribute("hidden",""),this.#s.replaceChildren();return}this.#s.removeAttribute("hidden");let e=Array.from(this.#s.children).map(r=>r.dataset.badgeVariant);if(e.length===t.length&&e.every((r,o)=>r===t[o]))return;let n=document.createDocumentFragment();for(let r of t){let o=document.createElement("span");o.setAttribute("data-badge-variant",r),o.setAttribute("role","img"),o.setAttribute("aria-label",c1[r]),o.textContent=h1[r],n.appendChild(o)}this.#s.replaceChildren(n)}#O(){if(!this.#e)return;if(!this.autoContrast){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark"),this.#o=null;return}let t=this.color||getComputedStyle(this).getPropertyValue("--swatch-color").trim();if(t===this.#o)return;this.#o=t;let e=d1(t);if(e==null){this.#e.removeAttribute("data-on-light"),this.#e.removeAttribute("data-on-dark");return}let i=e<.62;this.#e.toggleAttribute("data-on-dark",i),this.#e.toggleAttribute("data-on-light",!i)}#m(){if(!this.#i)return;let t=(this.detail||"").trim();if(!t){this.#i.setAttribute("hidden",""),this.#i.textContent="";return}this.#i.removeAttribute("hidden"),this.#i.textContent!==t&&(this.#i.textContent=t)}#b(){if(!this.#n)return;if(!this.copyable){this.#n.setAttribute("hidden","");return}this.#n.removeAttribute("hidden");let t=this.#w();t?this.#n.setAttribute("aria-label",`Copy ${t}`):this.#n.setAttribute("aria-label","Copy value")}#v(){this.selectable?(this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.setAttribute("aria-pressed",this.selected?"true":"false")):(this.getAttribute("role")==="button"&&this.removeAttribute("role"),this.getAttribute("tabindex")==="0"&&this.removeAttribute("tabindex"),this.removeAttribute("aria-pressed"))}#S(){this.#a=t=>{!this.selectable||(t.composedPath?t.composedPath():[]).includes(this.#n)||this.#x()},this.#l=t=>{this.selectable&&(t.key!=="Enter"&&t.key!==" "||t.target!==this.#n&&(t.preventDefault(),this.#x()))},this.addEventListener("click",this.#a),this.addEventListener("keydown",this.#l),this.#u=t=>{if(t.stopPropagation(),!this.copyable)return;let e=this.#w();e&&this.#k(e)},this.#n.addEventListener("click",this.#u)}#x(){this.dispatchEvent(new CustomEvent("select",{bubbles:!0,detail:{value:this.color||this.label,color:this.color,label:this.label}}))}#w(){return this.copyValue?this.copyValue:this.color?this.color:""}async#k(t){let e=!1;try{navigator?.clipboard?.writeText&&(await navigator.clipboard.writeText(t),e=!0)}catch{}this.#y(e)}#y(t){this.#n&&(this.#h!=null&&clearTimeout(this.#h),this.#n.setAttribute("data-copy-state",t?"ok":"fail"),this.#n.textContent=t?"\u2713":"\u26A0",this.#h=setTimeout(()=>{this.#n&&(this.#n.removeAttribute("data-copy-state"),this.#n.textContent="\u29C9",this.#h=null)},1200))}disconnected(){this.#h!=null&&(clearTimeout(this.#h),this.#h=null),this.#c&&(this.#c.disconnect(),this.#c=null),this.#a&&this.removeEventListener("click",this.#a),this.#l&&this.removeEventListener("keydown",this.#l),this.#n&&this.#u&&this.#n.removeEventListener("click",this.#u),this.#t=null,this.#e=null,this.#i=null,this.#s=null,this.#n=null,this.#r=!1}};w("swatch-ui",Nn);var Jg={xs:0,sm:480,md:768,lg:1024,xl:1280},es=Object.keys(Jg),hu=Object.values(Jg);function tO(){if(typeof window>"u")return"lg";let s=window.innerWidth;for(let t=es.length-1;t>=0;t--)if(s>=hu[t])return es[t];return"xs"}var Se=Pi(tO());if(typeof window<"u")for(let s=1;s<hu.length;s++)window.matchMedia(`(min-width: ${hu[s]}px)`).addEventListener("change",()=>{Se.value=tO()});function Lt(s,t=Se.value){if(!s)return null;if(!s.includes("@"))return s;let e=null,i=new Map;for(let a of s.trim().split(/\s+/)){let l=a.lastIndexOf("@");l===-1?e=a:i.set(a.slice(l+1),a.slice(0,l))}let n=es.indexOf(t),r=null,o=-1;for(let[a,l]of i){let h=es.indexOf(a);h!==-1&&h<=n&&h>o&&(r=l,o=h)}return r??e}var _n=class extends A{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"stretch",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;render(){let t=this.gap,e=this.align,i=this.justify,r=t?.includes("@")||e?.includes("@")||i?.includes("@")?Se.value:"";if(t?.includes("@")?this.style.setProperty("--col-gap",m1(Lt(t,r))):this.style.removeProperty("--col-gap"),e?.includes("@")){let o=Lt(e,r);this.style.setProperty("--col-align",g1(o)),this.style.textAlign=O1(o)}else this.style.removeProperty("--col-align"),this.style.textAlign="";i?.includes("@")?this.style.setProperty("--col-justify",b1(Lt(i,r))):this.style.removeProperty("--col-justify")}},f1={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},p1={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function m1(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function g1(s){return f1[s]??s}function O1(s){return{start:"start",center:"center",end:"end"}[s]??""}function b1(s){return p1[s]??s}w("col-ui",_n);var Vn=class s extends A{static properties={label:{type:String,default:"",reflect:!0},hint:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},align:{type:String,default:"start",reflect:!0}};get error(){return this.#O()?.error??""}static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=t=>{let e=this.#O();if(!e)return;let i=this.#m(e);i&&(t.preventDefault(),i.focus())};connected(){this.#c(),this.#d(),this.#f(),this.#p(),this.#u(),this.#t?.addEventListener("click",this.#r),this.#n=new MutationObserver(()=>{this.#p(),this.#u(),this.#g(),this.#o()}),this.#n.observe(this,{childList:!0}),this.#o()}disconnected(){this.#n?.disconnect(),this.#n=null,this.#h(),this.#t?.removeEventListener("click",this.#r),this.#t=null,this.#e=null,this.#i=null,this.#s=null}render(){this.#t&&this.#t.childNodes[0]&&(this.#t.childNodes[0].nodeValue=this.label||""),this.#e&&(this.#e.hidden=!this.required),this.#i&&(this.#i.textContent=this.hint||"",this.#i.hidden=!this.hint||!!this.error),this.#o(),this.#g()}#o(){if(!this.#s)return;let t=this.error;this.#s.textContent=t||"",this.#s.hidden=!t}#a=()=>{this.#o(),this.#g()};#l=null;#u(){let t=this.#O();t!==this.#l&&(this.#h(),t&&(this.#l=t,t.addEventListener("invalid",this.#a,!0),t.addEventListener("change",this.#a),t.addEventListener("input",this.#a)))}#h(){let t=this.#l;t&&(t.removeEventListener("invalid",this.#a,!0),t.removeEventListener("change",this.#a),t.removeEventListener("input",this.#a),this.#l=null)}#c(){if(this.#t=this.querySelector(":scope > [data-field-label]"),!this.#t){let t=document.createElement("label");t.setAttribute("slot","label"),t.setAttribute("data-field-label",""),t.appendChild(document.createTextNode(this.label||"")),this.prepend(t),this.#t=t}if(this.#e=this.#t.querySelector("[data-field-required]"),!this.#e){let t=document.createElement("span");t.setAttribute("data-field-required",""),t.setAttribute("aria-hidden","true"),t.textContent="*",t.hidden=!0,this.#t.appendChild(t),this.#e=t}}#d(){if(this.#i=this.querySelector(":scope > [data-field-hint]"),this.#i)return;let t=document.createElement("div");t.setAttribute("slot","hint"),t.setAttribute("data-field-hint",""),t.setAttribute("id",s.#x("hint")),t.hidden=!0,this.appendChild(t),this.#i=t}#f(){if(this.#s=this.querySelector(":scope > [data-field-error]"),this.#s)return;let t=document.createElement("div");t.setAttribute("slot","error"),t.setAttribute("data-field-error",""),t.setAttribute("id",s.#x("err")),t.setAttribute("role","alert"),t.hidden=!0,this.appendChild(t),this.#s=t}#p(){if(!this.#t)return;let t=this.#O();if(!t){this.#t.removeAttribute("for");return}t.id||(t.id=s.#v()),this.#t.setAttribute("for",t.id)}#g(){let t=this.#O();if(!t)return;let e=new Set;this.#i&&!this.#i.hidden&&e.add(this.#i.id),this.#s&&!this.#s.hidden&&e.add(this.#s.id);let n=[...(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(r=>r&&!r.startsWith("field-hint-")&&!r.startsWith("field-err-")),...e].join(" ").trim();n?t.setAttribute("aria-describedby",n):t.removeAttribute("aria-describedby")}#O(){for(let t of this.children)if(!t.hasAttribute("slot"))return t;return null}#m(t){let e='input, textarea, select, button, [contenteditable], [tabindex]:not([tabindex="-1"])';return t.matches?.(e)?t:t.querySelector?.(e)??null}static#b=0;static#v(){return`field-ctl-${++s.#b}`}static#S=0;static#x(t){return`field-${t}-${++s.#S}`}};w("field-ui",Vn);var Wn=class extends A{static properties={inline:{type:Boolean,default:!1,reflect:!0},columns:{type:Number,default:6,reflect:!0}};static template=()=>null;#t=null;connected(){this.#e(),this.#t=new MutationObserver(t=>{for(let e of t)if(e.type==="childList"&&(this.#i(e.addedNodes)||this.#i(e.removedNodes))){this.#e();return}}),this.#t.observe(this,{childList:!0})}disconnected(){this.#t?.disconnect(),this.#t=null}render(){this.#e()}#e(){let t=this.hasAttribute("inline");for(let e of this.children)e.localName==="field-ui"&&(t?e.hasAttribute("inline")||e.setAttribute("inline",""):e.hasAttribute("inline")&&e.removeAttribute("inline"))}#i(t){for(let e of t)if(e.nodeType===1&&e.localName==="field-ui")return!0;return!1}};w("fields-ui",Wn);var Yn=class extends A{static properties={justify:{type:String,default:"start",reflect:!0},align:{type:String,default:"center",reflect:!0},gap:{type:String,default:"md",reflect:!0},grow:{type:Boolean,default:!1,reflect:!0},wrap:{type:Boolean,default:!1,reflect:!0},wrapAt:{type:String,default:"",reflect:!0,attribute:"wrap-at"},draggable:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.draggable&&!this.#t&&(this.addTrait(Mn),this.#t=!0)}updated(t){t.has("draggable")&&this.draggable&&!this.#t&&(this.addTrait(Mn),this.#t=!0)}render(){let t=this.gap,e=this.align,i=this.justify,n=this.wrapAt,o=t?.includes("@")||e?.includes("@")||i?.includes("@")||!!n?Se.value:"";if(t?.includes("@")?this.style.setProperty("--row-gap",x1(Lt(t,o))):this.style.removeProperty("--row-gap"),e?.includes("@")?this.style.setProperty("--row-align",S1(Lt(e,o))):this.style.removeProperty("--row-align"),i?.includes("@")?this.style.setProperty("--row-justify",w1(Lt(i,o))):this.style.removeProperty("--row-justify"),n){let a=es.indexOf(o),l=es.indexOf(n);this.style.flexWrap=l!==-1&&a>=l?"wrap":""}else this.style.flexWrap=""}},y1={start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},v1={start:"flex-start",end:"flex-end",center:"center",between:"space-between","space-between":"space-between","space-around":"space-around"};function x1(s){return!s||s==="0"?"0":/^\d+$/.test(s)?`var(--a-space-${s})`:`var(--a-gap-${s})`}function S1(s){return y1[s]??s}function w1(s){return v1[s]??s}w("row-ui",Yn);var Un=class extends A{static properties={columns:{type:String,default:"3",reflect:!0},gap:{type:String,default:"md",reflect:!0},columnGap:{type:String,default:"",reflect:!0,attribute:"column-gap"},rowGap:{type:String,default:"",reflect:!0,attribute:"row-gap"}};static template=()=>null;render(){let t=Se.value,e=this.columns;if(e?.includes("@")){let n=Lt(e,t);this.style.gridTemplateColumns=this.#t(n),this.style.gridAutoFlow=n?"row":"",this.style.gridAutoColumns=n?"auto":""}else this.style.gridTemplateColumns="",this.style.gridAutoFlow="",this.style.gridAutoColumns="";let i=this.gap;if(i?.includes("@")){let n=Lt(i,t),r=this.#e(n);this.style.columnGap=r,this.style.rowGap=r}else this.style.columnGap="",this.style.rowGap=""}#t(t){return t?/^\d+$/.test(t)?`repeat(${t}, 1fr)`:t==="auto-fill"?"repeat(auto-fill, minmax(12rem, 1fr))":t==="auto-fit"?"repeat(auto-fit, minmax(12rem, 1fr))":t:""}#e(t){return!t||t==="0"?"0":/^\d+$/.test(t)?`var(--a-space-${t})`:`var(--a-gap-${t})`}};w("grid-ui",Un);var Fn=class extends A{static properties={align:{type:String,default:"center",reflect:!0}};static template=()=>null};w("stack-ui",Fn);function is(s,t,e=5){let n=(t-s||1)/e,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r,l=(o<=1.5?1:o<=3?2:o<=7?5:10)*r,h=Math.floor(s/l)*l,c=Math.ceil(t/l)*l,u=[];for(let d=h;d<=c+l*.5;d+=l)u.push(+d.toFixed(10));return u}function eO(s){if(s==null)return"";let t=+s;return Number.isNaN(t)?String(s):Math.abs(t)>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":Math.abs(t)>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":Number.isInteger(t)?String(t):t.toFixed(1)}function Jt(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mt({label:s,value:t,pct:e,series:i}){let n="";return s!=null&&(n+=` data-tip-label="${Jt(String(s))}"`),t!=null&&(n+=` data-tip-value="${t}"`),e!=null&&(n+=` data-tip-pct="${e}"`),i!=null&&(n+=` data-tip-series="${Jt(String(i))}"`),n}function te(s,t,e){return s+t*Math.cos(e)}function ee(s,t,e){return s+t*Math.sin(e)}function k1(s,t,e,i,n){let r=te(s,e,i),o=ee(t,e,i),a=te(s,e,n),l=ee(t,e,n),h=n-i>Math.PI?1:0;return`M ${s} ${t} L ${r} ${o} A ${e} ${e} 0 ${h} 1 ${a} ${l} Z`}function cu(s,t,e,i,n,r,o=0){let a=(e-i)/2,l=r-n,h=Math.max(0,Math.min(o,a)),c=()=>{let pt=te(s,e,n),ut=ee(t,e,n),yt=te(s,e,r),kt=ee(t,e,r),vt=te(s,i,r),zt=ee(t,i,r),jt=te(s,i,n),Qi=ee(t,i,n),Fi=l>Math.PI?1:0;return`M ${pt} ${ut} A ${e} ${e} 0 ${Fi} 1 ${yt} ${kt} L ${vt} ${zt} A ${i} ${i} 0 ${Fi} 0 ${jt} ${Qi} Z`};if(h<=0)return c();let u=h/e,d=h/i;if(l<=(u+d)*1.05)return c();let f=n+u,p=r-u,m=n+d,O=r-d,g=p-f>Math.PI?1:0,y=te(s,e,f),v=ee(t,e,f),x=te(s,e,p),S=ee(t,e,p),$=te(s,i,O),k=ee(t,i,O),P=te(s,i,m),T=ee(t,i,m),C=te(s,e-h,n),I=ee(t,e-h,n),X=te(s,i+h,n),N=ee(t,i+h,n),_=te(s,e-h,r),V=ee(t,e-h,r),tt=te(s,i+h,r),rt=ee(t,i+h,r);return`M ${y} ${v} A ${e} ${e} 0 ${g} 1 ${x} ${S} A ${h} ${h} 0 0 1 ${_} ${V} L ${tt} ${rt} A ${h} ${h} 0 0 1 ${$} ${k} A ${i} ${i} 0 ${g} 0 ${P} ${T} A ${h} ${h} 0 0 1 ${X} ${N} L ${C} ${I} A ${h} ${h} 0 0 1 ${y} ${v} Z`}function Zo(s,t=.4){if(s.length<2)return"";if(t<=0)return"M"+s.map(n=>`${n.x},${n.y}`).join(" L");let e=s.length,i=`M${s[0].x},${s[0].y}`;for(let n=0;n<e-1;n++){let r=s[Math.max(n-1,0)],o=s[n],a=s[n+1],l=s[Math.min(n+2,e-1)],h=o.x+(a.x-r.x)*t/3,c=o.y+(a.y-r.y)*t/3,u=a.x-(l.x-o.x)*t/3,d=a.y-(l.y-o.y)*t/3;i+=` C${h},${c} ${u},${d} ${a.x},${a.y}`}return i}function uu(s,t,e=.4){let i=Zo(s,e),n=s[s.length-1],r=s[0];return`${i} L${n.x},${t} L${r.x},${t} Z`}function ol(s,t,e,i,n=0){if(i<=0||e<=0)return"";let r=Math.max(0,Math.min(n,e/2,i));return r===0?`M${s},${t} H${s+e} V${t+i} H${s} Z`:`M${s},${t+i} V${t+r} Q${s},${t} ${s+r},${t} H${s+e-r} Q${s+e},${t} ${s+e},${t+r} V${t+i} Z`}var iO={std:{ratio:4/3},wide:{ratio:16/9},square:{ratio:1},tall:{ratio:3/4}},Gn=class extends A{static properties={type:{type:String,default:"bar",reflect:!0},heading:{type:String,default:"",reflect:!0},x:{type:String,default:"",reflect:!0},y:{type:String,default:"",reflect:!0},hideAverage:{type:Boolean,default:!1,reflect:!0,attribute:"hide-average"},color:{type:String,default:"",reflect:!0},hideGrid:{type:Boolean,default:!1,reflect:!0,attribute:"hide-grid"},hideValues:{type:Boolean,default:!1,reflect:!0,attribute:"hide-values"},radius:{type:Number,default:null,reflect:!0},smooth:{type:Number,default:.4,reflect:!0},aspect:{type:String,default:"std",reflect:!0},size:{type:String,default:"",reflect:!0},format:{type:String,default:"abbr",reflect:!0},loading:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];#e=!1;#i=null;#s=null;#n=0;#r=0;#o=new Set;#a(){if(this.radius!=null)return this.radius;let t=getComputedStyle(this).getPropertyValue("--a-radius").trim(),e=parseFloat(t);return Number.isFinite(e)&&e>0?e:6}set data(t){!Array.isArray(t)&&!this.#e&&(this.#e=!0,console.warn(`[chart-ui] .data must be an array of plain objects \u2014 received ${t===null?"null":typeof t}. The {labels, datasets} envelope is the Chart.js API, not the chart-ui API.
172
+ Correct shape for <chart-ui x="label" y="value">:
173
+ [{ label: "Jan", value: 100 }, { label: "Feb", value: 200 }]`)),this.#t=Array.isArray(t)?t:[],this.#u(),this.#f()}get data(){return this.#t}#l=!1;#u(){if(this.#l)return;let t=this.#h();this.#t.length>t&&(console.warn(`[chart-ui] .data has ${this.#t.length} rows which exceeds the recommended perf budget of ${t}. Consider downsampling at the data layer (e.g., LTTB, bucket aggregation). Override the budget via CSS: chart-ui { --chart-perf-budget: 10000 }.`),this.#l=!0)}#h(){let t=getComputedStyle(this).getPropertyValue("--chart-perf-budget").trim(),e=parseInt(t,10);return Number.isFinite(e)&&e>0?e:5e3}connected(){if(this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.heading||`${this.type} chart`),this.#t.length===0&&this.hasAttribute("data"))try{let t=JSON.parse(this.getAttribute("data"));Array.isArray(t)&&(this.data=t)}catch{}document.addEventListener("toggle",this.#S),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this.#I),this.addEventListener("focus",this.#X),this.addEventListener("blur",this.#M),this.addEventListener("pointerover",this.#D),this.addEventListener("pointermove",this.#q),this.addEventListener("pointerleave",this.#z),this.addEventListener("pointerdown",this.#N),this.addEventListener("click",this.#U),this.#k(),this.#i=new ResizeObserver(t=>{let{inlineSize:e,blockSize:i}=t[0].contentBoxSize[0];if(!this.#t.length)return;let n=Math.round(e),r=Math.round(i);n===this.#n&&(!this.hasAttribute("resize")||r===this.#r)||(this.#n=n,this.#r=r,!this.#s&&(this.#s=requestAnimationFrame(()=>{this.#s=null,this.#f()})))}),this.#i.observe(this)}render(){if(this.loading){let e=this.querySelector("skeleton-ui[data-chart-skel]");e||(e=document.createElement("skeleton-ui"),e.setAttribute("data-chart-skel",""),e.style.cssText="display:block;width:100%;height:100%;min-height:4rem;border-radius:var(--a-radius-md)"),this.innerHTML="",this.appendChild(e);return}let t=this.querySelector("skeleton-ui[data-chart-skel]");t&&t.remove(),this.#f()}#c(){let t=this.clientWidth||300,e=this.clientHeight||0,i=iO[this.aspect]||iO.std,n=this.#t.length||1,r=Math.max(t,120),a=(this.hasAttribute("resize")||this.style.height)&&e>40?e:Math.round(r/i.ratio),l=parseFloat(getComputedStyle(this).maxHeight);isFinite(l)&&l>0&&a>l&&(a=Math.round(l));let h=Math.min(r,a),c=this.size||(h<150?"sm":h<300?"md":"lg"),u=c==="sm"?9:c==="md"?10:11,d=u,f=c==="sm"?8:c==="md"?9:10,p=this.hideGrid,m=p?0:u*3.2,O=!!this.x,g={top:p?2:u*1.6,right:p?2:u*1.2,bottom:!O||p?2:u*2.2,left:m},y=r-g.left-g.right,v=Math.max(4,y/n*.6);return{width:r,height:a,pad:g,fontSize:u,labelSize:d,valueSize:f,barMinW:v,plotW:y,n,sizeClass:c}}#d=null;#f(){if(!this.isConnected)return;let t=this.querySelector(':scope > [slot="empty"]');if(t&&!this.#d&&(this.#d=t.cloneNode(!0)),this.innerHTML="",this.#d&&this.appendChild(this.#d.cloneNode(!0)),!this.#t.length){this.removeAttribute("data-has-data");return}if(this.setAttribute("data-has-data",""),this.#p(),this.heading){let o=document.createElement("div");o.setAttribute("data-chart-heading",""),o.textContent=this.heading,this.appendChild(o)}let e=document.createElement("div");this.type==="sparkline"&&e.setAttribute("data-sparkline",""),this.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");e.appendChild(i);let n="",r="";switch(this.type){case"bar":({svg:n,viewBox:r}=this.#H());break;case"line":({svg:n,viewBox:r}=this.#K());break;case"pie":({svg:n,viewBox:r}=this.#J());break;case"donut":({svg:n,viewBox:r}=this.#tt());break;case"radar":({svg:n,viewBox:r}=this.#et());break;case"sparkline":({svg:n,viewBox:r}=this.#it());break;case"segments":({svg:n,viewBox:r}=this.#ut());break;case"area":({svg:n,viewBox:r}=this.#st());break;case"scatter":({svg:n,viewBox:r}=this.#nt());break;case"radial-bar":({svg:n,viewBox:r}=this.#rt());break;case"gauge":({svg:n,viewBox:r}=this.#ot());break;case"funnel":({svg:n,viewBox:r}=this.#at());break;case"treemap":({svg:n,viewBox:r}=this.#lt());break;case"sankey":({svg:n,viewBox:r}=this.#ht());break;case"composed":({svg:n,viewBox:r}=this.#ct());break;case"stacked-bar":({svg:n,viewBox:r}=this.#dt());break;case"grouped-bar":({svg:n,viewBox:r}=this.#ft());break;case"multi-line":({svg:n,viewBox:r}=this.#pt());break;default:({svg:n,viewBox:r}=this.#H());break}if(i.setAttribute("viewBox",r),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.innerHTML=n,["pie","donut","stacked-bar","grouped-bar","multi-line","radial-bar"].includes(this.type)&&!this.#b()){let o=this.#mt();o&&this.appendChild(o)}this.dispatchEvent(new CustomEvent("legend-update",{bubbles:!0}))}#p(){let t=this.#T();for(let e=0;e<t.length;e++){let i=e%10;this.style.setProperty(`--color-${t[e]}`,`var(--chart-${i})`)}}#g(t,e){return e?` data-slice="${t}" data-series-key="${Jt(e)}" style="fill: var(--color-${e}, var(--chart-${t}))"`:` data-slice="${t}"`}#O(t,e){return e?` data-slice="${t}" data-series-key="${Jt(e)}" style="stroke: var(--color-${e}, var(--chart-${t}))"`:` data-slice="${t}"`}#m=null;disconnected(){this.#i?.disconnect(),this.#i=null,this.#s&&(cancelAnimationFrame(this.#s),this.#s=null),document.removeEventListener("toggle",this.#S),document.removeEventListener("pointerdown",this.#W),this.removeEventListener("keydown",this.#I),this.removeEventListener("focus",this.#X),this.removeEventListener("blur",this.#M),this.removeEventListener("pointerover",this.#D),this.removeEventListener("pointermove",this.#q),this.removeEventListener("pointerleave",this.#z),this.removeEventListener("pointerdown",this.#N),this.removeEventListener("click",this.#U),this.#F()}#b(){return this.id?!!document.querySelector(`chart-legend-ui[for="${CSS.escape(this.id)}"]`):!1}#v(){return this.id?!!document.querySelector(`tooltip-ui[follows="pointer"][for="${CSS.escape(this.id)}"]`):!1}#S=t=>{let e=t.target?.closest?.("chart-legend-ui[for]");if(!e||e.getAttribute("for")!==this.id)return;let{key:i,active:n}=t.detail||{};i&&(n?this.#o.delete(i):this.#o.add(i),this.#f())};#x(t){return!!t&&this.#o.has(t)}#w=!1;#k(){this.#w||(this.aspect&&this.aspect!=="std"&&(console.warn(`[chart-ui] aspect="${this.aspect}" is deprecated. Parents should size the chart directly (width/height on the card or container). The attribute will be removed in a future major.`),this.#w=!0),this.heading&&(console.warn(`[chart-ui] heading="${this.heading}" is deprecated. Place the title in an enclosing card-ui <header><span slot="heading"> instead. The attribute will be removed in a future major.`),this.#w=!0))}#y(t){if(t==null||t==="")return"";let e=+t;if(!Number.isFinite(e))return String(t);switch(this.format||"abbr"){case"decimal":return e.toFixed(2);case"percent":return`${(e*100).toFixed(1)}%`;case"currency":{let n=getComputedStyle(this).getPropertyValue("--chart-currency-prefix").trim();return(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1)),`${n||"$"}${eO(e)}`}default:return eO(e)}}#$=-1;#Q(){return Array.from(this.querySelectorAll("[data-tip-label], [data-tip-value]"))}#P(t){let e=this.#Q();if(!e.length){this.#L();return}this.#$=Math.max(0,Math.min(t,e.length-1)),this.#C(),this.#E()}#C(){let t=this.#Q();for(let i of t)i.removeAttribute("data-a11y-focus");let e=t[this.#$];if(!e)return this.removeAttribute("data-a11y-focused");e.setAttribute("data-a11y-focus",""),this.setAttribute("data-a11y-focused","")}#L(){this.#$=-1;for(let t of this.#Q())t.removeAttribute("data-a11y-focus");this.removeAttribute("data-a11y-focused")}#E(){let t=this.#Q()[this.#$];if(!t)return;let e=t.getBoundingClientRect(),i={clientX:e.left+e.width/2,clientY:e.top+e.height/2};this.#_(t,i)}#Z(){let t=this.#Q()[this.#$];if(!t)return;let e=t.getBoundingClientRect(),i={clientX:e.left+e.width/2,clientY:e.top+e.height/2};this.dispatchEvent(new CustomEvent("chart-select",{bubbles:!0,detail:this.#j(t,i)}))}#X=()=>{this.#$===-1&&this.#P(0)};#M=()=>{this.#L(),this.#A&&this.#B()};#I=t=>{let e=this.#Q();if(e.length)switch(t.key){case"ArrowRight":case"ArrowDown":t.preventDefault(),this.#P(this.#$+1);break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),this.#P(Math.max(0,this.#$-1));break;case"Home":t.preventDefault(),this.#P(0);break;case"End":t.preventDefault(),this.#P(e.length-1);break;case"Enter":case" ":t.preventDefault(),this.#Z();break;case"Escape":t.preventDefault(),this.#L(),this.#A&&this.#B();break}};#A=null;#D=t=>{if(t.pointerType==="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");e&&(this.#G(e,t),this.#_(e,t))};#q=t=>{if(t.pointerType==="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");if(!e)return this.#A&&this.#B(),this.#F();this.#G(e,t),e!==this.#A&&this.#_(e,t)};#z=t=>{t&&t.pointerType==="touch"||(this.#F(),this.#A&&this.#B())};#N=t=>{if(t.pointerType!=="touch")return;let e=t.target.closest("[data-tip-label], [data-tip-value]");if(!e)return this.#A&&this.#B(),this.#F();this.#G(e,t),e!==this.#A&&this.#_(e,t),document.addEventListener("pointerdown",this.#W)};#W=t=>{t.pointerType==="touch"&&(this.contains(t.target)||(this.#F(),this.#A&&this.#B(),document.removeEventListener("pointerdown",this.#W)))};#U=t=>{let e=t.target.closest("[data-tip-label], [data-tip-value]");e&&this.dispatchEvent(new CustomEvent("chart-select",{bubbles:!0,detail:this.#j(e,t)}))};#_(t,e){this.#A=t,this.dispatchEvent(new CustomEvent("chart-hover",{bubbles:!0,detail:this.#j(t,e)}))}#B(){this.#A=null,this.dispatchEvent(new CustomEvent("chart-leave",{bubbles:!0}))}#j(t,e){let{tipLabel:i,tipValue:n,tipPct:r,tipSeries:o}=t.dataset,a=t.dataset.slice!=null?Number(t.dataset.slice):null,l=n!=null?Number(n):null,h=r!=null?Number(r):null,c=i??null,u=o??null,d=this.#Y(c,u)??[{series:u,label:c,value:Number.isFinite(l)?l:n??null,pct:Number.isFinite(h)?h:null,slot:a}];return{label:c,value:Number.isFinite(l)?l:n??null,pct:Number.isFinite(h)?h:null,series:u,slot:a,payload:d,pointerX:e?.clientX??null,pointerY:e?.clientY??null}}#Y(t,e){if(t==null)return null;let i=this.x,n=this.#T();if(!i||n.length===0)return null;let r=this.#t.find(l=>String(l[i]??"")===String(t));if(!r)return null;let o=n.filter(l=>!this.#x(l)),a=e||(o.length===1?o[0]:null);return o.map((l,h)=>{let c=+(r[l]??0);return{series:l,label:t,value:Number.isFinite(c)?c:null,pct:null,slot:h%10,hovered:l===a}})}#G(t,e){if(this.#v())return;let{tipLabel:i,tipValue:n,tipPct:r,tipSeries:o}=t.dataset;if(!this.#m){let O=document.createElement("div");O.setAttribute("popover","manual"),O.setAttribute("role","tooltip"),O.classList.add("chart-tooltip-popup"),document.body.appendChild(O),this.#m=O}let a=[];if(o&&a.push(`<span data-tip-role="series">${Jt(o)}</span>`),i&&a.push(`<span data-tip-role="label">${Jt(i)}</span>`),n!==void 0){let O=r!==void 0?` <span data-tip-role="pct">(${r}%)</span>`:"";a.push(`<span data-tip-role="value">${this.#y(n)}${O}</span>`)}this.#m.innerHTML=a.join("");try{this.#m.showPopover()}catch{}let l=12,h=8,{clientX:c,clientY:u}=e,d=this.#m.offsetWidth||0,f=this.#m.offsetHeight||0,p=c-d/2,m=u-f-l;p<h&&(p=h),p+d>window.innerWidth-h&&(p=window.innerWidth-d-h),m<h&&(m=u+l),this.#m.style.left=`${p}px`,this.#m.style.top=`${m}px`}#F(){if(this.#m){try{this.#m.hidePopover()}catch{}this.#m.remove(),this.#m=null}}#T(){return this.y?this.y.split(",").map(t=>t.trim()).filter(Boolean):[]}#V(t,e,i,n,r,o){let a=r,l=o?.fontSize||10,h=o?.labelSize||l,c="",u=i;if(o?.sizeClass==="sm"&&i.length>4&&(u=i.filter((d,f)=>f%2===0||f===i.length-1)),!this.hideGrid){let f=i[i.length-1]-i[0]||1;for(let p of u){let m=a.top+(e-a.top-a.bottom)*(1-(p-i[0])/f);c+=`<line data-grid x1="${a.left}" y1="${m}" x2="${t-a.right}" y2="${m}"/>`}for(let p of u){let m=a.top+(e-a.top-a.bottom)*(1-(p-i[0])/f);c+=`<text data-y-label x="${a.left-4}" y="${m+l*.35}" text-anchor="end" font-size="${l}">${this.#y(p)}</text>`}if(n){let m=(t-a.left-a.right)/n.length,g=n.reduce((x,S)=>Math.max(x,String(S).length),1)*h*.6+h*.75,y=Math.max(1,Math.ceil(g/m)),v=n.length-1;for(let x=0;x<n.length;x++){if(x%y!==0&&x!==v||x!==v&&v-x<y)continue;let S=a.left+m*x+m/2;c+=`<text data-x-label x="${S}" y="${e-l*.5}" text-anchor="middle" font-size="${h}">${Jt(n[x])}</text>`}}}return c}#H(){let t=this.#c(),e=this.#t,i=this.#T()[0]||this.y,n=e.map(v=>+(v[i]??0)),r=e.map(v=>v[this.x]??""),o=is(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/e.length,p=f*.6,m=(f-p)/2,O=this.#V(l,h,o,r,c,t),g=!this.hideValues&&t.sizeClass!=="sm",y=!this.hideAverage&&n.length>1&&t.sizeClass!=="sm"&&!this.hideGrid;for(let v=0;v<e.length;v++){let x=n[v],S=a?x/a*u:0,$=c.left+f*v+m,k=c.top+u-S;O+=`<path data-bar${mt({label:r[v],value:x})} d="${ol($,k,p,S,this.#a())}"/>`,g&&(O+=`<text data-value x="${$+p/2}" y="${k-4}" text-anchor="middle" font-size="${t.valueSize}">${this.#y(x)}</text>`)}if(y){let v=n.reduce((S,$)=>S+$,0)/n.length,x=c.top+u-(a?v/a*u:0);O+=`<line data-avg x1="${c.left}" y1="${x}" x2="${l-c.right}" y2="${x}"/>`,O+=`<text data-avg-label x="${l-c.right+2}" y="${x+3}" text-anchor="start" font-size="${t.valueSize}">${this.#y(v)}</text>`,O+=`<line data-hit${mt({label:"Average",value:v})} x1="${c.left}" y1="${x}" x2="${l-c.right}" y2="${x}" stroke="transparent" stroke-width="12"/>`}return{svg:O,viewBox:`0 0 ${l} ${h}`}}#K(){let t=this.#c(),e=this.#t,i=this.#T()[0]||this.y,n=e.map(k=>+(k[i]??0)),r=e.map(k=>k[this.x]??""),o=is(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(e.length-1,1),p=this.#V(l,h,o,r,c,t),m=n.map((k,P)=>{let T=c.left+f*P,C=c.top+u-(a?k/a*u:0);return{x:T,y:C,v:k,label:r[P]}}),O=c.top+u,g=Math.max(0,Math.min(1,this.smooth));p+=`<path data-area d="${uu(m,O,g)}"/>`,p+=`<path data-line d="${Zo(m,g)}"/>`;let y=t.sizeClass==="sm",v=y?1.5:3,x=Math.max(v,10),S=!this.hideValues&&!y,$=!this.hideAverage&&n.length>1&&!y&&!this.hideGrid;for(let k of m)p+=`<circle data-dot cx="${k.x}" cy="${k.y}" r="${v}"/>`,p+=`<circle data-hit${mt({label:k.label,value:k.v})} cx="${k.x}" cy="${k.y}" r="${x}" fill="transparent"/>`,S&&(p+=`<text data-value x="${k.x}" y="${k.y-8}" text-anchor="middle" font-size="${t.valueSize}">${this.#y(k.v)}</text>`);if($){let k=n.reduce((T,C)=>T+C,0)/n.length,P=c.top+u-(a?k/a*u:0);p+=`<line data-avg x1="${c.left}" y1="${P}" x2="${l-c.right}" y2="${P}"/>`,p+=`<text data-avg-label x="${l-c.right+2}" y="${P+3}" text-anchor="start" font-size="${t.valueSize}">${this.#y(k)}</text>`,p+=`<line data-hit${mt({label:"Average",value:k})} x1="${c.left}" y1="${P}" x2="${l-c.right}" y2="${P}" stroke="transparent" stroke-width="12"/>`}return{svg:p,viewBox:`0 0 ${l} ${h}`}}#J(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(p=>+(p[e]??0)),n=i.reduce((p,m)=>p+m,0)||1,r=t.map(p=>p[this.x]??""),o=this.#c(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.42),d="",f=-Math.PI/2;for(let p=0;p<i.length;p++){let m=i[p]/n*Math.PI*2;if(m===0)continue;let O=f+m,g=(i[p]/n*100).toFixed(1),y=` data-slice="${p%10}"${mt({label:r[p],value:i[p],pct:g})}`;Math.abs(m-Math.PI*2)<.001?d+=`<circle${y} cx="${h}" cy="${c}" r="${u}"/>`:d+=`<path${y} d="${k1(h,c,u,f,O)}"/>`,f=O}return this.#R=t.map((p,m)=>({label:r[m],value:i[m],pct:(i[m]/n*100).toFixed(1),slot:m%10})),{svg:d,viewBox:`0 0 ${a} ${l}`}}#tt(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(g=>+(g[e]??0)),n=i.reduce((g,y)=>g+y,0)||1,r=t.map(g=>g[this.x]??""),o=this.#c(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.42),d=u*.72,f="",p=-Math.PI/2;for(let g=0;g<i.length;g++){let y=i[g]/n*Math.PI*2;if(y===0)continue;let v=p+y,x=(i[g]/n*100).toFixed(1),S=` data-slice="${g%10}"${mt({label:r[g],value:i[g],pct:x})}`;Math.abs(y-Math.PI*2)<.001?(f+=`<circle${S} cx="${h}" cy="${c}" r="${(u+d)/2}" fill="none" stroke-width="${u-d}" style="fill:none"/>`,f+=`<path${S} d="M ${h-u} ${c} A ${u} ${u} 0 1 1 ${h+u} ${c} A ${u} ${u} 0 1 1 ${h-u} ${c} Z M ${h-d} ${c} A ${d} ${d} 0 1 0 ${h+d} ${c} A ${d} ${d} 0 1 0 ${h-d} ${c} Z" fill-rule="evenodd"/>`):f+=`<path${S} d="${cu(h,c,u,d,p,v,this.#a())}"/>`,p=v}let m=Math.max(14,Math.round(u*.32)),O=Math.max(9,Math.round(u*.16));return f+=`<text data-donut-total x="${h}" y="${c}" text-anchor="middle" dominant-baseline="central" font-size="${m}">${this.#y(n)}</text>`,f+=`<text data-donut-label x="${h}" y="${c+m}" text-anchor="middle" dominant-baseline="central" font-size="${O}">Total</text>`,this.#R=t.map((g,y)=>({label:r[y],value:i[y],pct:(i[y]/n*100).toFixed(1),slot:y%10})),{svg:f,viewBox:`0 0 ${a} ${l}`}}#et(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(S=>+(S[e]??0)),n=t.map(S=>S[this.x]??""),r=Math.max(...i)||1,o=t.length,a=this.#c(),{width:l,height:h,fontSize:c}=a,u=l/2,d=h/2,f=c*3.5,p=Math.max(40,Math.min(l,h)/2-f),m="",O=Math.PI*2/o;for(let S=1;S<=3;S++){let $=p*S/3,k="";for(let P=0;P<o;P++){let T=-Math.PI/2+O*P,C=u+$*Math.cos(T),I=d+$*Math.sin(T);k+=(P===0?"M":"L")+` ${C} ${I}`}k+=" Z",m+=`<path data-grid d="${k}"/>`}for(let S=0;S<o;S++){let $=-Math.PI/2+O*S,k=u+p*Math.cos($),P=d+p*Math.sin($);m+=`<line data-grid x1="${u}" y1="${d}" x2="${k}" y2="${P}"/>`}let g="",y=[];for(let S=0;S<o;S++){let $=-Math.PI/2+O*S,k=i[S]/r*p,P=u+k*Math.cos($),T=d+k*Math.sin($);g+=(S===0?"M":"L")+` ${P} ${T}`,y.push({px:P,py:T})}g+=" Z",m+=`<path data-radar-fill d="${g}"/>`,m+=`<path data-radar-line d="${g}"/>`;let v=Math.max(c,10);for(let S=0;S<o;S++){let{px:$,py:k}=y[S];m+=`<circle data-hit${mt({label:n[S],value:i[S]})} cx="${$}" cy="${k}" r="${v}" fill="transparent"/>`}let x=c*1.3;for(let S=0;S<o;S++){let $=-Math.PI/2+O*S,k=u+(p+x)*Math.cos($),P=d+(p+x)*Math.sin($),T=Math.abs(Math.cos($))<.1?"middle":Math.cos($)>0?"start":"end";m+=`<text data-x-label x="${k}" y="${P}" text-anchor="${T}" dominant-baseline="central" font-size="${c}">${Jt(n[S])}</text>`}return{svg:m,viewBox:`0 0 ${l} ${h}`}}#it(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(y=>+(y[e]??0)),n=Math.max(...i)||1,r=Math.min(...i),o=n-r||1,a=this.clientWidth||120,l=this.clientHeight||32,h=Math.max(40,a),c=Math.max(16,l),u=h/Math.max(i.length-1,1),d=Math.max(2,Math.min(6,c*.1)),f=t.map(y=>y[this.x]??""),p=i.map((y,v)=>({x:u*v,y:c-(y-r)/o*(c-d*2)-d,v:y,label:f[v]})),m=Math.max(0,Math.min(1,this.smooth)),O="";O+=`<path data-area d="${uu(p,c,m)}"/>`,O+=`<path data-line d="${Zo(p,m)}"/>`;let g=Math.max(u/2,6);for(let y of p)O+=`<circle data-hit${mt({label:y.label,value:y.v})} cx="${y.x}" cy="${y.y}" r="${g}" fill="transparent"/>`;return{svg:O,viewBox:`0 0 ${h} ${c}`}}#st(){return this.#K()}#nt(){let t=this.#c(),e=this.#t,i=this.#T()[0]||this.y,n=e.map(g=>+(g[i]??0)),r=e.map(g=>g[this.x]??""),o=is(0,Math.max(...n),5),a=o[o.length-1],{width:l,height:h,pad:c}=t,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(e.length-1,1),p=this.#V(l,h,o,r,c,t),m=t.sizeClass==="sm"?2.5:4,O=Math.max(m*2,10);for(let g=0;g<n.length;g++){let y=c.left+f*g,v=c.top+u-(a?n[g]/a*u:0);p+=`<circle data-dot data-scatter cx="${y}" cy="${v}" r="${m}"/>`,p+=`<circle data-hit${mt({label:r[g],value:n[g]})} cx="${y}" cy="${v}" r="${O}" fill="transparent"/>`}return{svg:p,viewBox:`0 0 ${l} ${h}`}}#rt(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(g=>+(g[e]??0)),n=t.map(g=>g[this.x]??""),r=Math.max(...i)||1,o=this.#c(),{width:a,height:l}=o,h=a/2,c=l/2,u=Math.max(30,Math.min(a,l)*.45),d=u*.3,f=i.length||1,p=(u-d)/f,m=Math.min(2,p*.15),O="";for(let g=0;g<i.length;g++){let y=d+p*g+m/2,v=d+p*(g+1)-m/2,x=(y+v)/2,S=v-y,$=2*Math.PI*x,k=Math.max(0,Math.min(1,i[g]/r))*$;if(O+=`<circle data-radial-track cx="${h}" cy="${c}" r="${x}" fill="none" stroke-width="${S}"/>`,k<=0)continue;let P=(i[g]/r*100).toFixed(1),T=mt({label:n[g],value:i[g],pct:P}),C=Math.abs(k-$)<.5,I=C?"butt":"round",X=C?`${$} 0`:`${k} ${$-k}`;O+=`<circle data-slice="${g%10}"${T} data-radial-bar cx="${h}" cy="${c}" r="${x}" fill="none" stroke-width="${S}" stroke-linecap="${I}" stroke-dasharray="${X}" transform="rotate(-90 ${h} ${c})"/>`}return this.#R=t.map((g,y)=>({label:n[y],key:n[y],value:i[y],pct:(i[y]/r*100).toFixed(1),slot:y%10})),{svg:O,viewBox:`0 0 ${a} ${l}`}}#ot(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(x=>+(x[e]??0)),n=i.reduce((x,S)=>x+S,0)||1,r=i[0]??0,o=t[0]?.max!=null?+t[0].max:i.length===1?Math.max(r,1):n,a=Math.max(0,Math.min(1,r/o)),l=this.#c(),{width:h,height:c}=l,u=h/2,d=c*.68,f=Math.max(40,Math.min(h*.45,c*.6)),p=f*.72,m=(f-p)/2,O="";if(O+=`<path data-radial-track d="${cu(u,d,f,p,Math.PI,2*Math.PI,m)}"/>`,a>0){let x=Math.PI+Math.PI*a,S=mt({label:t[0]?.[this.x]??"Value",value:r,pct:(a*100).toFixed(1)});O+=`<path data-slice="0"${S} data-gauge-fill d="${cu(u,d,f,p,Math.PI,x,m)}"/>`}let g=Math.max(18,Math.round(f*.42)),y=Math.max(10,Math.round(f*.2)),v=d-f*.15;return O+=`<text data-gauge-value x="${u}" y="${v}" text-anchor="middle" dominant-baseline="central" font-size="${g}">${this.#y(r)}</text>`,o!==r&&(O+=`<text data-gauge-max x="${u}" y="${v+g*.8}" text-anchor="middle" dominant-baseline="central" font-size="${y}">of ${this.#y(o)}</text>`),{svg:O,viewBox:`0 0 ${h} ${c}`}}#at(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(v=>+(v[e]??0)),n=t.map(v=>v[this.x]??""),r=i.length;if(r===0)return{svg:"",viewBox:"0 0 100 100"};let o=Math.max(...i)||1,a=this.#c(),{width:l,height:h}=a,c=a.fontSize,u=Math.max(l*.18,80),d=c*.8,f=l-u*2,m=(h-d*2)/r,O=Math.max(2,m*.08),g=l/2,y="";for(let v=0;v<r;v++){let x=i[v],S=v<r-1?i[v+1]:i[v],$=x/o*(f/2),k=S/o*(f/2),P=d+m*v+O/2,T=d+m*(v+1)-O/2,C=(x/o*100).toFixed(1),I=mt({label:n[v],value:x,pct:C}),X=`M ${g-$} ${P} L ${g+$} ${P} L ${g+k} ${T} L ${g-k} ${T} Z`;if(y+=`<path data-slice="${v%10}" data-funnel-stage${I} d="${X}"/>`,y+=`<text data-funnel-label x="${u-8}" y="${P+m/2}" text-anchor="end" dominant-baseline="central" font-size="${c}">${Jt(n[v])}</text>`,y+=`<text data-funnel-value x="${l-u+8}" y="${P+m/2}" text-anchor="start" dominant-baseline="central" font-size="${c}">${this.#y(x)}</text>`,v>0){let N=(i[v]/i[0]*100).toFixed(0);y+=`<text data-funnel-drop x="${l-u+8}" y="${P+m/2+c*1.1}" text-anchor="start" dominant-baseline="central" font-size="${c*.85}">${N}%</text>`}}return this.#R=t.map((v,x)=>({label:n[x],value:i[x],pct:(i[x]/o*100).toFixed(1),slot:x%10})),{svg:y,viewBox:`0 0 ${l} ${h}`}}#lt(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(C=>+(C[e]??0)),n=t.map(C=>C[this.x]??""),r=i.length;if(r===0)return{svg:"",viewBox:"0 0 100 100"};let o=this.#c(),{width:a,height:l,fontSize:h}=o,c=i.reduce((C,I)=>C+I,0)||1,u=Array.from({length:r},(C,I)=>I).sort((C,I)=>i[I]-i[C]),d=[],f=a*l,p=u.map(C=>i[C]/c*f),m=0,O=0,g=a,y=l,v=[],x=0,S=(C,I)=>{if(C.length===0)return 1/0;let X=C.reduce((rt,pt)=>rt+pt,0),N=Math.max(...C),_=Math.min(...C),V=I*I,tt=X*X;return Math.max(V*N/tt,tt/(V*_))},$=(C,I,X,N,_,V)=>{let tt=C.reduce((kt,vt)=>kt+vt,0),rt=_>=V,pt=rt?tt/_:V,ut=rt?_:tt/V,yt=0;for(let kt=0;kt<C.length;kt++){let vt=C[kt]/tt,zt=u[I+kt];if(rt){let jt=vt*_;d.push({i:zt,x:X+yt,y:N,w:jt,h:pt}),yt+=jt}else{let jt=vt*V;d.push({i:zt,x:X,y:N+yt,w:ut,h:jt}),yt+=jt}}return rt?{x:X,y:N+pt,w:_,h:V-pt}:{x:X+ut,y:N,w:_-ut,h:V}},k=p.slice();for(;k.length>0;){v=[k[0]],x=p.length-k.length;let C=Math.min(g,y),I=1;for(;I<k.length;){let N=v.concat(k[I]);if(S(N,C)>S(v,C))break;v=N,I++}let X=$(v,x,m,O,g,y);m=X.x,O=X.y,g=X.w,y=X.h,k=k.slice(v.length)}let P="",T=2;for(let C of d){let I=(i[C.i]/c*100).toFixed(1),X=mt({label:n[C.i],value:i[C.i],pct:I});P+=`<rect data-slice="${C.i%10}" data-treemap-tile${X} x="${C.x+T}" y="${C.y+T}" width="${Math.max(0,C.w-T*2)}" height="${Math.max(0,C.h-T*2)}" rx="${this.#a()}"/>`;let N=C.x+8,_=C.w>h*4,V=_&&C.h>h*2.5,tt=_&&!V&&C.h>h*1.2;if(V)P+=`<text data-treemap-label x="${N}" y="${C.y+h+4}" font-size="${h}" dominant-baseline="hanging">${Jt(n[C.i])}</text>`,P+=`<text data-treemap-value x="${N}" y="${C.y+h*2+6}" font-size="${h*.9}" dominant-baseline="hanging">${this.#y(i[C.i])}</text>`;else if(tt){let rt=C.y+C.h/2;P+=`<text data-treemap-label x="${N}" y="${rt}" font-size="${h}" dominant-baseline="central">${Jt(n[C.i])}</text>`}}return this.#R=t.map((C,I)=>({label:n[I],value:i[I],pct:(i[I]/c*100).toFixed(1),slot:I%10})),{svg:P,viewBox:`0 0 ${a} ${l}`}}#ht(){let t=this.#t;if(!t.length)return{svg:"",viewBox:"0 0 100 100"};let e=new Map,i=new Map;for(let x of t){let S=x.source??x.from??"",$=x.target??x.to??"",k=+(x.value??x.v??0);e.has(S)||e.set(S,{name:S,flow:0}),i.has($)||i.set($,{name:$,flow:0}),e.get(S).flow+=k,i.get($).flow+=k}let n=this.#c(),{width:r,height:o,fontSize:a}=n,l=Math.max(8,r*.03),h=l+a*5,c=[...e.values()].reduce((x,S)=>x+S.flow,0)||1,u=[...i.values()].reduce((x,S)=>x+S.flow,0)||1,d=a*.6,f=[...e.values()],p=[...i.values()],m=o-d*(f.length-1),O=o-d*(p.length-1),g=0;for(let x of f){let S=x.flow/c*m;x.y0=g,x.y1=g+S,x.cursor=g,g+=S+d}g=0;for(let x of p){let S=x.flow/u*O;x.y0=g,x.y1=g+S,x.cursor=g,g+=S+d}let y="",v=Math.min(this.#a(),l/2);f.forEach((x,S)=>{y+=`<rect data-sankey-node data-slice="${S%10}" x="${h-l}" y="${x.y0}" width="${l}" height="${x.y1-x.y0}" rx="${v}"/>`,y+=`<text data-sankey-label x="${h-l-6}" y="${(x.y0+x.y1)/2}" text-anchor="end" dominant-baseline="central" font-size="${a}">${Jt(x.name)}</text>`}),p.forEach((x,S)=>{y+=`<rect data-sankey-node data-slice="${(f.length+S)%10}" x="${r-h}" y="${x.y0}" width="${l}" height="${x.y1-x.y0}" rx="${v}"/>`,y+=`<text data-sankey-label x="${r-h+l+6}" y="${(x.y0+x.y1)/2}" text-anchor="start" dominant-baseline="central" font-size="${a}">${Jt(x.name)}</text>`});for(let x of t){let S=e.get(x.source??x.from??""),$=i.get(x.target??x.to??"");if(!S||!$)continue;let k=+(x.value??x.v??0);if(k<=0)continue;let P=k/c*m,T=k/u*O,C=S.cursor,I=C+P,X=$.cursor,N=X+T;S.cursor+=P,$.cursor+=T;let _=h,V=r-h,tt=(_+V)/2,rt=mt({label:`${S.name} \u2192 ${$.name}`,value:k}),pt=`M ${_} ${C} C ${tt} ${C}, ${tt} ${X}, ${V} ${X} L ${V} ${N} C ${tt} ${N}, ${tt} ${I}, ${_} ${I} Z`;y+=`<path data-sankey-link${rt} d="${pt}"/>`}return{svg:y,viewBox:`0 0 ${r} ${o}`}}#ct(){let t=this.#c(),e=this.#t,i=this.#T(),n=i[0]||"bar",r=i[1]||"line",o=e.map($=>$[this.x]??""),a=e.map($=>+($[n]??0)),l=e.map($=>+($[r]??0)),h=[...a,...l],c=is(0,Math.max(...h),5),u=c[c.length-1],{width:d,height:f,pad:p}=t,m=f-p.top-p.bottom,O=d-p.left-p.right,g=O/e.length,y=g*.6,v=(g-y)/2,x=O/Math.max(e.length-1,1),S=this.#V(d,f,c,o,p,t);if(!this.#x(n))for(let $=0;$<e.length;$++){let k=a[$],P=u?k/u*m:0,T=p.left+g*$+v,C=p.top+m-P;S+=`<path${this.#g(0,n)}${mt({label:o[$],value:k,series:n})} d="${ol(T,C,y,P,this.#a())}"/>`}if(!this.#x(r)){let $=l.map((P,T)=>({x:p.left+g*T+g/2,y:p.top+m-(u?P/u*m:0),v:P,label:o[T]})),k=Math.max(0,Math.min(1,this.smooth));S+=`<path data-line${this.#O(1,r)} d="${Zo($,k)}"/>`;for(let P of $)S+=`<circle data-dot${this.#g(1,r)} cx="${P.x}" cy="${P.y}" r="3"/>`,S+=`<circle data-hit${mt({label:P.label,value:P.v,series:r})} cx="${P.x}" cy="${P.y}" r="10" fill="transparent"/>`}return this.#R=[{label:n,key:n,slot:0},{label:r,key:r,slot:1}],{svg:S,viewBox:`0 0 ${d} ${f}`}}#ut(){let t=this.#t,e=this.#T()[0]||this.y,i=t.map(p=>+(p[e]??0)),n=i.reduce((p,m)=>p+m,0)||1,r=t.map(p=>p[this.x]??""),o=getComputedStyle(this),a=Math.max(40,this.clientWidth||200),l=24,h=Math.min(this.#a(),l/2),c=Math.max(0,parseFloat(o.getPropertyValue("--chart-segments-gap"))||2),u=[],d=0;for(let p=0;p<i.length;p++){let m=p===i.length-1?a:Math.round((d*n+i[p]*a)/n),O=p===i.length-1?a:i.slice(0,p+1).reduce((y,v)=>y+v,0)/n*a,g=p===0?0:i.slice(0,p).reduce((y,v)=>y+v,0)/n*a;u.push({x:g,w:Math.max(0,O-g)}),d=m}let f="";for(let p=0;p<u.length;p++){let{x:m,w:O}=u[p];if(O<=0)continue;let g=p===0,y=p===u.length-1,v=Math.max(0,O-(y?0:c)),x=(i[p]/n*100).toFixed(1),S=mt({label:r[p],value:i[p],pct:x}),$=`<title>${Jt(r[p])}: ${i[p]} (${x}%)</title>`;if(g&&y||!g&&!y||h===0)f+=`<rect data-slice="${p%10}"${S} x="${m}" y="0" width="${v}" height="${l}"${(g||y)&&h?` rx="${h}"`:""}>${$}</rect>`;else{let k=h,P=m+v,T;g?T=`M ${m+k} 0 H ${P} V ${l} H ${m+k} A ${k} ${k} 0 0 1 ${m} ${l-k} V ${k} A ${k} ${k} 0 0 1 ${m+k} 0 Z`:T=`M ${m} 0 H ${P-k} A ${k} ${k} 0 0 1 ${P} ${k} V ${l-k} A ${k} ${k} 0 0 1 ${P-k} ${l} H ${m} Z`,f+=`<path data-slice="${p%10}"${S} d="${T}">${$}</path>`}}return this.#R=t.map((p,m)=>({label:r[m],value:i[m],pct:(i[m]/n*100).toFixed(1),slot:m%10})),{svg:f,viewBox:`0 0 ${a} ${l}`}}#dt(){let t=this.#t,e=this.#T(),i=t.map(g=>g[this.x]??""),n=t.map(g=>e.reduce((y,v)=>y+ +(g[v]??0),0)),r=is(0,Math.max(...n),5),o=r[r.length-1],a=this.#c(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/t.length,p=f*.6,m=(f-p)/2,O=this.#V(l,h,r,i,c,a);for(let g=0;g<t.length;g++){let y=c.top+u,v=e.length;for(let x=0;x<v;x++){if(this.#x(e[x]))continue;let S=+(t[g][e[x]]??0),$=o?S/o*u:0;if($<=0){y-=$;continue}y-=$;let k=c.left+f*g+m,P=y,T=$,C=x===v-1,I=this.#a(),X=`${this.#g(x%10,e[x])}${mt({label:i[g],value:S,series:e[x]})}`;C?O+=`<path${X} d="${ol(k,P,p,T,I)}"/>`:O+=`<rect${X} x="${k}" y="${P}" width="${p}" height="${T}"/>`}}return this.#R=e.map((g,y)=>({label:g,key:g,slot:y%10})),{svg:O,viewBox:`0 0 ${l} ${h}`}}#ft(){let t=this.#t,e=this.#T(),i=t.map(v=>v[this.x]??""),n=t.flatMap(v=>e.map(x=>+(v[x]??0))),r=is(0,Math.max(...n),5),o=r[r.length-1],a=this.#c(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/t.length,p=3,m=f*.7,O=(m-p*(e.length-1))/e.length,g=(f-m)/2,y=this.#V(l,h,r,i,c,a);for(let v=0;v<t.length;v++)for(let x=0;x<e.length;x++){if(this.#x(e[x]))continue;let S=+(t[v][e[x]]??0),$=o?S/o*u:0,k=c.left+f*v+g+(O+p)*x,P=c.top+u-$;y+=`<path${this.#g(x%10,e[x])}${mt({label:i[v],value:S,series:e[x]})} d="${ol(k,P,O,$,this.#a())}"/>`,this.hideValues||(y+=`<text data-value x="${k+O/2}" y="${P-4}" text-anchor="middle" font-size="${a.valueSize}">${this.#y(S)}</text>`)}return this.#R=e.map((v,x)=>({label:v,key:v,slot:x%10})),{svg:y,viewBox:`0 0 ${l} ${h}`}}#pt(){let t=this.#t,e=this.#T(),i=t.map(m=>m[this.x]??""),n=t.flatMap(m=>e.map(O=>+(m[O]??0))),r=is(0,Math.max(...n),5),o=r[r.length-1],a=this.#c(),{width:l,height:h,pad:c}=a,u=h-c.top-c.bottom,f=(l-c.left-c.right)/Math.max(t.length-1,1),p=this.#V(l,h,r,i,c,a);for(let m=0;m<e.length;m++){if(this.#x(e[m]))continue;let g=t.map(x=>+(x[e[m]]??0)).map((x,S)=>{let $=c.left+f*S,k=c.top+u-(o?x/o*u:0);return{x:$,y:k,v:x,label:i[S]}}),y=c.top+u,v=Math.max(0,Math.min(1,this.smooth));p+=`<path data-area${this.#g(m%10,e[m])} d="${uu(g,y,v)}"/>`,p+=`<path data-line${this.#O(m%10,e[m])} d="${Zo(g,v)}"/>`;for(let x of g)p+=`<circle data-dot${this.#g(m%10,e[m])} cx="${x.x}" cy="${x.y}" r="3"/>`,p+=`<circle data-hit${mt({label:x.label,value:x.v,series:e[m]})} cx="${x.x}" cy="${x.y}" r="10" fill="transparent"/>`}return this.#R=e.map((m,O)=>({label:m,key:m,slot:O%10})),{svg:p,viewBox:`0 0 ${l} ${h}`}}#R=null;get legendData(){return this.#R?this.#R.map(t=>({...t})):null}#mt(){if(!this.#R||!this.#R.length)return null;let t=document.createElement("div");t.setAttribute("data-legend","");for(let e of this.#R){let i=document.createElement("span");i.setAttribute("data-legend-item",""),e.key&&i.setAttribute("data-series-key",e.key);let n=document.createElement("span");n.setAttribute("data-legend-dot",""),n.setAttribute("data-slice",String(e.slot)),e.key&&(n.style.background=`var(--color-${e.key}, var(--chart-${e.slot}))`),i.appendChild(n);let r=document.createElement("span");r.textContent=e.pct?`${e.label} (${e.pct}%)`:e.label,i.appendChild(r),t.appendChild(i)}return t}};w("chart-ui",Gn);var Hn=class s extends A{static properties={for:{type:String,default:"",reflect:!0},items:{type:String,default:"",reflect:!1},shape:{type:String,default:"dot",reflect:!0},position:{type:String,default:"bottom",reflect:!0},static:{type:Boolean,default:!1,reflect:!0},onToggle:{type:String,default:"hide",reflect:!0,attribute:"on-toggle"}};static template=()=>null;#t=null;#e=null;#i=new Set;connected(){this.setAttribute("role","list"),this.#s(),this.#o()}disconnected(){this.#n()}render(){this.#s(),this.#o()}#s(){if(this.#n(),!this.for)return;let t=this.getRootNode()?.getElementById?.(this.for)||document.getElementById(this.for);if(!t){s._warned||(s._warned=new WeakSet);let e={el:this,id:this.for};s._warned.has(this)||(console.warn(`[chart-legend-ui] [for="${this.for}"] did not resolve to an element.`),s._warned.add(this));return}this.#t=t,this.#e=()=>this.#o(),t.addEventListener("legend-update",this.#e)}#n(){this.#t&&this.#e&&this.#t.removeEventListener("legend-update",this.#e),this.#t=null,this.#e=null}#r(){if(this.items)try{let t=JSON.parse(this.items);if(Array.isArray(t))return t}catch{}return this.#t&&Array.isArray(this.#t.legendData)?this.#t.legendData:[]}#o(){let t=this.#r();if(this.innerHTML="",!!t.length)for(let e of t){let i=e.key??e.label??"",n=e.label??i,r=e.slot!=null?e.slot:0,o=!this.#i.has(i),a=document.createElement("badge-ui");a.setAttribute("data-row",""),a.setAttribute("role",this.static?"listitem":"button"),a.setAttribute("text",n),i&&a.setAttribute("data-key",i),o&&a.setAttribute("data-active",""),this.static||(a.setAttribute("tabindex","0"),a.setAttribute("aria-pressed",o?"true":"false"));let l=this.shape||"dot",h=document.createElement("swatch-ui");h.setAttribute("shape",l),h.setAttribute("size","sm");let c=i?`var(--color-${i}, var(--a-data-${r}))`:`var(--a-data-${r})`;h.style.setProperty("--swatch-color",c),a.appendChild(h),this.static||(a.addEventListener("click",u=>this.#a(u,i)),a.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this.#a(u,i))})),this.appendChild(a)}}#a(t,e){if(!e)return;let n=!!this.#i.has(e);n?this.#i.delete(e):this.#i.add(e);let r=t.currentTarget;n?r.setAttribute("data-active",""):r.removeAttribute("data-active"),r.setAttribute("aria-pressed",n?"true":"false"),this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,detail:{key:e,active:n,mode:this.onToggle||"hide"}}))}};w("chart-legend-ui",Hn);var $1=120,Kn=class extends A{static properties={placement:{type:String,default:"bottom",reflect:!0},gap:{type:Number,default:4,reflect:!0},open:{type:Boolean,default:!1,reflect:!0},trigger:{type:String,default:"click",reflect:!0}};static template=()=>null;#t=null;#e=!1;#i=null;#s=null;#n=null;connected(){let t=this.querySelector('[slot="content"]');t&&(t.hasAttribute("popover")||t.setAttribute("popover","manual"),t.addEventListener("toggle",this.#d),this.#s=t),this.#e||(this.#e=!0,this.trigger==="click"&&this.addEventListener("click",this.#a),this.trigger==="hover"&&(this.addEventListener("pointerenter",this.#h),this.addEventListener("pointerleave",this.#c),t&&(t.addEventListener("pointerenter",this.#h),t.addEventListener("pointerleave",this.#c))))}render(){this.open?this.#r():this.#o()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#r(){let t=this.querySelector('[slot="trigger"]'),e=this.#s??this.querySelector('[slot="content"]');if(!(!t||!e)){if(!e.matches(":popover-open"))try{e.showPopover()}catch{}this.#t?.(),this.#t=Tt(t,e,{placement:this.placement,gap:this.gap}),(this.trigger==="click"||this.trigger==="manual")&&(this.#n=requestAnimationFrame(()=>{this.#n=null,document.addEventListener("pointerdown",this.#l),document.addEventListener("keydown",this.#u)}))}}#o(){this.#t?.(),this.#t=null;let t=this.#s??this.querySelector('[slot="content"]');if(t?.matches(":popover-open"))try{t.hidePopover()}catch{}this.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null),document.removeEventListener("pointerdown",this.#l),document.removeEventListener("keydown",this.#u)}#a=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.open=!this.open)};#l=t=>{if(!this.open)return;let e=this.#s;this.contains(t.target)||e?.contains(t.target)||(this.open=!1)};#u=t=>{t.key==="Escape"&&this.open&&(t.stopPropagation(),this.open=!1)};#h=()=>{clearTimeout(this.#i),this.open=!0};#c=()=>{clearTimeout(this.#i),this.#i=setTimeout(()=>{this.open=!1},$1)};#d=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){clearTimeout(this.#i),this.#o(),this.trigger==="click"&&this.removeEventListener("click",this.#a),this.trigger==="hover"&&(this.removeEventListener("pointerenter",this.#h),this.removeEventListener("pointerleave",this.#c),this.#s&&(this.#s.removeEventListener("pointerenter",this.#h),this.#s.removeEventListener("pointerleave",this.#c))),this.#s?.removeEventListener("toggle",this.#d),this.#s=null,this.#e=!1}};w("popover-ui",Kn);var Jn=class extends A{static requiredIcons=["caret-down"];static properties={multiple:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.addEventListener("toggle",this.#t)}disconnected(){this.removeEventListener("toggle",this.#t)}#t=t=>{if(this.multiple)return;let e=t.target;if(!e.open)return;let i=this.querySelectorAll("accordion-item-ui");for(let n of i)n!==e&&n.open&&(n.open=!1)}},tr=class extends A{static properties={text:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){if(!this.querySelector('[slot="header"]')){let t=document.createElement("div");t.setAttribute("slot","header");let e=document.createElement("span");e.setAttribute("slot","header-text"),t.appendChild(e);let i=document.createElement("icon-ui");i.setAttribute("name","caret-down"),i.setAttribute("slot","caret"),t.appendChild(i),this.prepend(t)}if(!this.querySelector('[slot="body"]')){let t=document.createElement("div");t.setAttribute("slot","body");let e=[...this.childNodes].filter(i=>i.nodeType===1?!i.hasAttribute("slot"):i.nodeType===3&&i.textContent.trim());for(let i of e)t.appendChild(i);this.appendChild(t)}this.#t||(this.#t=!0,this.addEventListener("click",this.#e))}disconnected(){this.removeEventListener("click",this.#e),this.#t=!1}render(){let t=this.querySelector('[slot="header-text"]');t&&(t.textContent=this.text)}#e=t=>{let e=this.querySelector('[slot="header"]');!e||!e.contains(t.target)||t.target.closest('[slot="action"], [slot="actions"], [data-no-toggle]')||(this.open=!this.open,this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,detail:{open:this.open}})))}};w("accordion-ui",Jn),w("accordion-item-ui",tr);var er=class extends A{static properties={label:{type:String,default:"",reflect:!0},vertical:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","separator")}render(){if(this.vertical?this.setAttribute("aria-orientation","vertical"):this.removeAttribute("aria-orientation"),this.label){let t=this.querySelector('[slot="label"]');t||(t=document.createElement("span"),t.setAttribute("slot","label"),this.appendChild(t)),t.textContent=this.label}else{let t=this.querySelector('[slot="label"]');t&&t.remove()}}};w("divider-ui",er);var ir=class extends A{static properties={page:{type:Number,default:1,reflect:!0},total:{type:Number,default:1,reflect:!0},siblings:{type:Number,default:1,reflect:!0},variant:{type:String,default:"default",reflect:!0}};static template=()=>null;#t=null;#e=!1;connected(){this.#t||(this.#t=document.createElement("nav"),this.#t.setAttribute("slot","nav"),this.#t.setAttribute("aria-label","Pagination"),this.appendChild(this.#t)),this.#e||(this.#e=!0,this.#t.addEventListener("click",this.#r))}disconnected(){this.#t?.removeEventListener("click",this.#r),this.#t=null,this.#e=!1}render(){if(!this.#t)return;let t=Math.max(1,Math.min(this.page,this.total)),e=Math.max(1,this.total),i=Math.max(0,this.siblings),n=this.#i(t,e,i);this.reconcile(this.#t,n,r=>r.key,(r,o,a)=>a?(this.#n(a,r,t),a):this.#s(r,t))}#i(t,e,i){let n=[];n.push({key:"prev",type:"prev",value:t-1}),n.push({key:"page-1",type:"page",value:1});let r=Math.max(2,t-i),o=Math.min(e-1,t+i);r>2&&n.push({key:"ellipsis-start",type:"ellipsis"});for(let a=r;a<=o;a++)n.push({key:`page-${a}`,type:"page",value:a});return o<e-1&&n.push({key:"ellipsis-end",type:"ellipsis"}),e>1&&n.push({key:`page-${e}`,type:"page",value:e}),n.push({key:"next",type:"next",value:t+1}),n}#s(t,e){if(t.type==="ellipsis"){let n=document.createElement("span");return n.setAttribute("data-ellipsis",""),n.textContent="\u2026",n}let i=document.createElement("button");return i.setAttribute("type","button"),t.type==="prev"?(i.setAttribute("data-prev",""),i.setAttribute("aria-label","Previous page"),i.textContent="\u2039"):t.type==="next"?(i.setAttribute("data-next",""),i.setAttribute("aria-label","Next page"),i.textContent="\u203A"):(i.setAttribute("data-page",""),i.dataset.value=String(t.value),i.textContent=String(t.value),i.setAttribute("aria-label",`Page ${t.value}`)),this.#n(i,t,e),i}#n(t,e,i){e.type!=="ellipsis"&&(e.type==="prev"?i<=1?(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1")):(t.removeAttribute("disabled"),t.setAttribute("tabindex","0")):e.type==="next"?i>=this.total?(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1")):(t.removeAttribute("disabled"),t.setAttribute("tabindex","0")):(t.dataset.value=String(e.value),t.textContent=String(e.value),t.setAttribute("aria-label",`Page ${e.value}`),e.value===i?(t.setAttribute("data-active",""),t.setAttribute("aria-current","page")):(t.removeAttribute("data-active"),t.removeAttribute("aria-current"))))}#r=t=>{let e=t.target.closest("[data-prev], [data-next], [data-page]");if(!e||e.hasAttribute("disabled")||!this.#t.contains(e))return;let i;e.hasAttribute("data-prev")?i=this.page-1:e.hasAttribute("data-next")?i=this.page+1:e.hasAttribute("data-page")&&(i=Number(e.dataset.value)),!(i==null||i<1||i>this.total||i===this.page)&&(this.page=i,this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,detail:{page:this.page}})))}};w("pagination-ui",ir);var pM=new Set(["json","html","javascript","js","css","markdown","md","yaml","yml"]),mM={js:"javascript",md:"markdown",yml:"yaml"};function Km(s){if(!s)return"";let t=String(s).toLowerCase();return mM[t]??t}var qr=class s extends A{static formAssociated=!0;static properties={language:{type:String,default:"",reflect:!0},inline:{type:Boolean,default:!1,reflect:!0},text:{type:String,default:"",reflect:!0},lineNumbers:{type:Boolean,default:!1,reflect:!0,attribute:"line-numbers"},editable:{type:Boolean,default:!1,reflect:!0},bare:{type:Boolean,default:!1,reflect:!0},placeholder:{type:String,default:"",reflect:!0},name:{type:String,default:"",reflect:!0},required:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=0;#n=!1;#r=null;#o="";#a=null;#l=()=>this.#b();connected(){this.#s+=1,!this.inline&&!this.querySelector(":scope > pre")&&this.#u(),this.#t=this.querySelector(':scope > header [slot="copy"]'),this.#t&&this.#t.addEventListener("click",this.#l);let t=Km(this.language),e=this.hasAttribute("data-line-states")||t==="diff";!this.inline&&!e&&(pM.has(t)||this.editable)&&this.#c()}disconnected(){this.#s+=1,this.#e!=null&&(clearTimeout(this.#e),this.#e=null),this.#t&&(this.#t.removeEventListener("click",this.#l),this.#t=null),this.#i&&(this.#i.destroy(),this.#i=null)}#u(){let t=this.querySelector(":scope > template"),e=this.text?this.text.trim():t?s.#h(t.innerHTML):(this.textContent||"").trim();if(this.textContent="",!this.bare){let l=document.createElement("header"),h=document.createElement("span");h.setAttribute("slot","label"),h.textContent=this.language||"code",l.appendChild(h);let c=document.createElement("div");c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("slot","copy"),c.textContent="Copy",l.appendChild(c),this.appendChild(l)}let i=document.createElement("pre"),n=document.createElement("code"),r=Km(this.language),o=this.getAttribute("data-line-states");if(o!=null||r==="diff"){n.setAttribute("data-line-state-mode",""),this.lineNumbers&&n.setAttribute("data-line-numbers","");let l=o?.split(",").map(c=>c.trim())??null;e.split(`
174
+ `).forEach((c,u)=>{let d="unchanged";if(l&&l[u])d=l[u];else if(r==="diff"){let m=c.charAt(0);m==="+"?d="added":m==="-"&&(d="removed")}let f=document.createElement("span");if(f.setAttribute("data-line-state",d),this.lineNumbers){let m=document.createElement("span");m.setAttribute("data-line-num",""),m.textContent=String(u+1),f.appendChild(m)}let p=document.createElement("span");p.setAttribute("data-line-body",""),p.textContent=c,f.appendChild(p),n.appendChild(f)})}else n.textContent=e;i.appendChild(n),this.appendChild(i)}static#h(t){let e=t.replace(/^\n+|\n+$/g,"");if(!e)return"";let i=e.split(`
175
+ `),n=i.filter(o=>o.trim().length>0).map(o=>o.match(/^[ \t]*/)[0].length),r=n.length?Math.min(...n):0;return r>0?i.map(o=>o.slice(r)).join(`
176
+ `):e}async#c(){if(this.#n||this.#i)return;let t=this.#s,e=Km(this.language);this.#n=!0;try{let i=await Promise.resolve().then(()=>(Hm(),Gm)),n=null;try{n=(await i.importWithTimeout(i.languages[e],`lang-${e}`))?.extension??null}catch(r){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"language",language:e,error:r}}))}if(t!==this.#s||!this.isConnected)return;this.#d(i,n,e)}catch(i){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"core",error:i}})),console.warn("[code-ui] CodeMirror failed to load; staying on static fallback.",i)}finally{this.#n=!1}}#d(t,e,i){let{EditorState:n,EditorView:r,Compartment:o,lineNumbers:a,placeholder:l,syntaxHighlighting:h,history:c,historyKeymap:u,defaultKeymap:d,indentWithTab:f,keymap:p,adiaBaseTheme:m,adiaHighlightStyle:O,lintGutter:g,jsonLinter:y}=t,v=this.querySelector(":scope > pre"),x=v?v.querySelector("code")?.textContent??"":"",S=this.text||x||"";this.#o=S;let $=document.createElement("div");$.setAttribute("data-cm-mount",""),v?v.replaceWith($):this.appendChild($);let k=[m,h(O)];this.editable&&k.push(c(),p.of([{key:"Mod-s",run:P=>(this.#m(P),!0)},...d,...u,f]),r.updateListener.of(P=>{if(!P.docChanged)return;let T=P.state.doc.toString();this.#g(T),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:T}}))}),r.domEventHandlers({focus:(P,T)=>(this.#r=T.state.doc.toString(),!1),blur:(P,T)=>{let C=T.state.doc.toString();return this.#r!==null&&C!==this.#r&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:C}})),this.#r=null,!1}})),this.#a=new o,k.push(this.#a.of(this.#f(r,n))),e&&k.push(e),this.lineNumbers&&k.push(a()),this.placeholder&&k.push(l(this.placeholder)),this.editable&&i==="json"&&k.push(y,g()),this.#i=new r({parent:$,state:n.create({doc:S,extensions:k})}),this.editable&&this.#g(S)}#f(t,e){return this.editable&&!this.disabled&&!this.readonly?[]:[t.editable.of(!1),e.readOnly.of(!0)]}async#p(){if(!this.#i||!this.#a)return;let t=await Promise.resolve().then(()=>(Hm(),Gm));this.#i.dispatch({effects:this.#a.reconfigure(this.#f(t.EditorView,t.EditorState))})}get form(){return this.internals.form}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}#g(t){this.editable&&(t=t??this.value??"",this.internals.setFormValue(t),this.#O(t))}#O(t){return t=t??"",this.required&&!t.trim()?(this.internals.setValidity({valueMissing:!0},this.getAttribute("data-msg-required")||"This field is required.",this),this.setAttribute("aria-invalid","true"),!1):(this.internals.setValidity({}),this.removeAttribute("aria-invalid"),!0)}formResetCallback(){this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:this.#o}}):this.text=this.#o}formDisabledCallback(t){this.disabled=t}formStateRestoreCallback(t,e){typeof t=="string"&&(this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:t}}):this.text=t)}#m(t){this.dispatchEvent(new CustomEvent("save",{bubbles:!0,cancelable:!0,detail:{value:t.state.doc.toString()}}))}get value(){return this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??this.text??""}set value(t){this.text=String(t??"")}#b(){let t=this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??"";t&&navigator.clipboard.writeText(t).then(()=>{let e=this.querySelector(':scope > header [slot="copy"]');if(!e)return;let i=e.textContent;e.textContent="Copied!",this.#e!=null&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#e=null,e.textContent=i},1500)})}render(){let t=this.querySelector(':scope > header [slot="label"]');if(t&&this.language&&(t.textContent=this.language),this.#p(),!this.inline&&this.text!=="")if(this.#i){if(this.editable&&this.#i.hasFocus)return;let e=this.#i.state.doc.toString();e!==this.text&&this.#i.dispatch({changes:{from:0,to:e.length,insert:this.text}})}else{let e=this.querySelector(":scope > pre > code");e&&e.textContent!==this.text&&(e.textContent=this.text)}}};w("code-ui",qr);var Br=class extends A{static properties={divider:{type:Boolean,default:!1,reflect:!0},spacing:{type:String,default:"md",reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},selectedKey:{type:String,default:"",reflect:!0,attribute:"selected-key"}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#n),this.addEventListener("keydown",this.#r))}disconnected(){this.removeEventListener("click",this.#n),this.removeEventListener("keydown",this.#r),this.#t=!1}render(){if(!this.selectable){for(let n of this.#e())n.removeAttribute("aria-selected"),n.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let n of e){let r=this.#i(n),o=r&&r===t;n.setAttribute("aria-selected",o?"true":"false"),n.setAttribute("tabindex",o?"0":"-1"),o&&(i=n)}!i&&e.length&&e[0].setAttribute("tabindex","0")}#e(){return[...this.children].filter(t=>t.getAttribute&&t.getAttribute("role")==="listitem")}#i(t){return t.id||t.getAttribute("data-key")||""}#s(t,{focus:e=!1}={}){if(!this.selectable||!t)return;let i=this.selectedKey||"";t!==i&&(this.selectedKey=t,this.dispatchEvent(new CustomEvent("selection-change",{detail:{key:t,previousKey:i},bubbles:!0})),e&&[...this.#e()].find(r=>this.#i(r)===t)?.focus?.())}#n=t=>{if(!this.selectable)return;let e=t.target.closest?.('[role="listitem"]');if(!e||e.parentElement!==this)return;let i=this.#i(e);i&&this.#s(i)};#r=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,n=e.indexOf(i);if(n<0)return;let r=n;switch(t.key){case"ArrowDown":r=Math.min(e.length-1,n+1);break;case"ArrowUp":r=Math.max(0,n-1);break;case"Home":r=0;break;case"End":r=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[n]);o&&this.#s(o);return}default:return}r!==n&&(t.preventDefault(),e[r]?.focus?.())}},zr=class extends A{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.#s()}#t(t){for(let e of this.children)if(e.matches(t))return e;return null}#e(t){return t.dataset.listStamped="1",t}#i(t){return t?.dataset?.listStamped==="1"}#s(){if(!this.#t('[slot="content"]')){if(this.icon){let t=this.#t('[slot="icon"]')||this.#t("icon-ui");t||(t=this.#e(document.createElement("icon-ui")),t.setAttribute("slot","icon"),this.prepend(t)),t.setAttribute("name",this.icon)}if(this.text){let t=this.#t('[slot="text"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","text"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.text)}if(this.description){let t=this.#t('[slot="description"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","description"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.description)}}}render(){let t=this.#t('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let n=this.#e(document.createElement("icon-ui"));n.setAttribute("slot","icon"),n.setAttribute("name",this.icon),this.prepend(n)}else this.#i(t)&&t.remove();let e=this.#t('[slot="text"]');if(this.text)if(e)this.#i(e)&&(e.textContent=this.text);else{let n=this.#e(document.createElement("span"));n.setAttribute("slot","text"),n.textContent=this.text,this.appendChild(n)}else this.#i(e)&&e.remove();let i=this.#t('[slot="description"]');if(this.description)if(i)this.#i(i)&&(i.textContent=this.description);else{let n=this.#e(document.createElement("span"));n.setAttribute("slot","description"),n.textContent=this.description,this.appendChild(n)}else this.#i(i)&&i.remove()}};w("list-ui",Br),w("list-item-ui",zr);var jr=class extends A{static properties={open:{type:Boolean,default:!1,reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},gap:{type:Number,default:4,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=null;#n=null;connected(){this.#i||(this.#i=!0,this.addEventListener("click",this.#d),this.addEventListener("keydown",this.#f))}render(){this.open?this.#o():this.#a()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#r(){if(this.#e)return this.#e;let t=document.createElement("div");return t.setAttribute("data-menu-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.addEventListener("toggle",this.#b),t.addEventListener("click",this.#p),t.addEventListener("keydown",this.#g),this.appendChild(t),this.#e=t,t}#o(){let t=this.querySelector('[slot="trigger"]');if(!t)return;let e=this.#r(),i=this.querySelectorAll(":scope > menu-item-ui, :scope > menu-divider-ui");for(let n of i)e.appendChild(n);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=Tt(t,e,{placement:this.placement,gap:this.gap}),this.#c&&(this.#c=!1,this.#n=requestAnimationFrame(()=>{this.#n=null,this.#u(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#O),document.addEventListener("keydown",this.#m,!0)})}#a(){this.#t?.(),this.#t=null;let t=this.#e;if(t){t.matches(":popover-open")&&t.hidePopover?.();let e=t.querySelectorAll("menu-item-ui, menu-divider-ui");for(let i of e)this.insertBefore(i,t)}this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#n!=null&&(cancelAnimationFrame(this.#n),this.#n=null),document.removeEventListener("pointerdown",this.#O),document.removeEventListener("keydown",this.#m,!0)}#l(){return Array.from(this.#e?.querySelectorAll("menu-item-ui")??[]).filter(t=>!t.disabled)}#u(t){let e=this.#l();if(!e.length)return;let i=(t+e.length)%e.length,n=e[i];n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0})}#h(){return this.#l().indexOf(document.activeElement)}#c=!1;#d=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.#c=!1,this.open=!this.open)};#f=t=>{let e=this.querySelector('[slot="trigger"]');!e||!(t.target===e||e.contains(t.target))||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#c=!0,this.open=!0)};#p=t=>{let e=t.target.closest("menu-item-ui");!e||e.disabled||(this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.value,text:e.text}})),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0}))};#g=t=>{let e=this.#l();if(!e.length)return;let i=this.#h();switch(t.key){case"ArrowDown":t.preventDefault(),this.#u(i+1);break;case"ArrowUp":t.preventDefault(),this.#u(i-1);break;case"Home":t.preventDefault(),this.#u(0);break;case"End":t.preventDefault(),this.#u(e.length-1);break;case"Enter":case" ":{t.preventDefault(),(e[i]??e[0])?.click();break}}};#O=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#m=t=>{t.key==="Escape"&&this.open?(t.stopPropagation(),t.preventDefault(),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0})):t.key==="Tab"&&this.open&&(this.open=!1)};#b=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#a(),this.#e&&(this.#e.removeEventListener("toggle",this.#b),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#g)),this.#e=null,this.#i=!1}},Nr=class extends A{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","menuitem"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.#s(),this.#n()}#t(t){return t.dataset.menuItemStamped="1",t}#e(t){return t?.dataset?.menuItemStamped==="1"}#i(t){for(let e of this.children)if(e.matches(t))return e;return null}#s(){if(!this.#i('[slot="text"]')){if(this.icon&&!this.#i('[slot="icon"]')){let t=this.#t(document.createElement("icon-ui"));t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=this.#t(document.createElement("span"));t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}}}#n(){this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}render(){let t=this.#i('[slot="icon"]');if(this.icon)if(t)this.#e(t)&&t.setAttribute("name",this.icon);else{let i=this.#t(document.createElement("icon-ui"));i.setAttribute("slot","icon"),i.setAttribute("name",this.icon),this.prepend(i)}else this.#e(t)&&t.remove();let e=this.#i('[slot="text"]');this.#e(e)&&(e.textContent=this.text),this.#n()}},_r=class extends A{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}};w("menu-ui",jr),w("menu-item-ui",Nr),w("menu-divider-ui",_r);var zw="data-toolbar-spillover",gM="data-toolbar-spillover-menu",jw=8,Rc="data-toolbar-spillover-label";function Nw(s){return s?.tagName&&s.tagName.toLowerCase()==="divider-ui"}function OM(s){return s?s.split("-").filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join(" "):""}function bM(s){let t=s.matches?.("button-ui")?[s]:Array.from(s.querySelectorAll?.("button-ui")||[]);for(let e of t){if(e.hasAttribute(Rc)||e.getAttribute("text"))continue;let i=e.getAttribute("aria-label")||OM(e.getAttribute("icon"));i&&(e.setAttribute(Rc,""),e.setAttribute("text",i))}}function yM(s){let t=s.matches?.("button-ui")?[s]:Array.from(s.querySelectorAll?.("button-ui")||[]);for(let e of t)e.hasAttribute(Rc)&&(e.removeAttribute(Rc),e.removeAttribute("text"))}function _w(s){let t=s.getBoundingClientRect(),e=getComputedStyle(s),i=parseFloat(e.marginLeft)||0,n=parseFloat(e.marginRight)||0;return t.width+i+n}var Vr=class extends A{static properties={gap:{type:String,default:"sm",reflect:!0},align:{type:String,default:"start",reflect:!0},overflow:{type:String,default:"menu",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=!1;#o=!1;#a=null;#l=null;connected(){this.setAttribute("role","toolbar"),this.#u(),this.#t=new ResizeObserver(()=>this.#m()),this.#t.observe(this),this.#e=new MutationObserver(()=>{this.#r||this.#m()}),this.#b(),this.#m()}disconnected(){this.#a!=null&&(cancelAnimationFrame(this.#a),this.#a=null),this.#o=!1,this.#t?.disconnect(),this.#e?.disconnect(),this.#c(),this.#t=null,this.#e=null,this.#i=null,this.#s=null}#u(){if(this.#i)return;let t=document.createElement("button-ui");t.setAttribute("icon","dots-three"),t.setAttribute("variant","ghost"),t.setAttribute("size","sm"),t.setAttribute(zw,""),t.setAttribute("aria-label","More actions"),t.setAttribute("aria-haspopup","menu"),t.hidden=!0;let e=document.createElement("div");e.setAttribute(gM,""),e.setAttribute("popover","manual"),e.setAttribute("role","menu"),t.addEventListener("click",this.#d),e.addEventListener("click",this.#f),e.addEventListener("toggle",this.#O),this.appendChild(t),this.appendChild(e),this.#i=t,this.#s=e}#h(){let t=this.#s;!t||t.matches(":popover-open")||(t.showPopover?.(),this.#n?.(),this.#n=Tt(this.#i,t,{placement:"bottom-end",gap:4}),this.#l=requestAnimationFrame(()=>{this.#l=null,document.addEventListener("pointerdown",this.#p,!0),document.addEventListener("keydown",this.#g,!0)}))}#c(){this.#n?.(),this.#n=null,this.#s?.matches(":popover-open")&&this.#s.hidePopover?.(),this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#p,!0),document.removeEventListener("keydown",this.#g,!0)}#d=t=>{t.stopPropagation(),this.#s?.matches(":popover-open")?this.#c():this.#h()};#f=t=>{let e=t.target.closest("button-ui");e&&(e.matches(`[${zw}]`)||queueMicrotask(()=>this.#c()))};#p=t=>{if(this.#i?.contains(t.target)||this.#s?.contains(t.target))return;let e=t.composedPath?.()||[];for(let i of e){if(i===document)break;if(i?.nodeType===1&&i.hasAttribute?.("popover"))return}this.#c()};#g=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#c(),this.#i?.focus?.({preventScroll:!0}))};#O=t=>{t.newState==="closed"&&(this.#n?.(),this.#n=null,this.#l!=null&&(cancelAnimationFrame(this.#l),this.#l=null),document.removeEventListener("pointerdown",this.#p,!0),document.removeEventListener("keydown",this.#g,!0))};#m(){this.#o||(this.#o=!0,this.#a=requestAnimationFrame(()=>{this.#a=null,this.#o=!1,this.isConnected&&this.#S()}))}#b(){this.#e?.observe(this,{childList:!0})}#v(){this.#e&&(this.#e.disconnect(),this.#e.takeRecords())}#S(){if(!this.isConnected)return;let t=this.#i,e=this.#s;if(!(!t||!e)){this.#r=!0,this.#v();try{for(;e.firstChild;)yM(e.firstChild),this.insertBefore(e.firstChild,t);let i=0;for(let y of this.children)y===t||y===e||(y.dataset.toolbarOrder==null&&(y.dataset.toolbarOrder=String(i)),i+=1);let n=Array.from(this.children).filter(y=>y!==t&&y!==e).sort((y,v)=>Number(y.dataset.toolbarOrder)-Number(v.dataset.toolbarOrder));for(let y of n)this.insertBefore(y,t);let r=n;for(let y of r)y.hidden=!1;t.hidden=!0;let o=getComputedStyle(this),a=parseFloat(o.paddingLeft)||0,l=parseFloat(o.paddingRight)||0,h=parseFloat(o.columnGap||o.gap)||0,c=this.clientWidth-a-l,u=r.map(y=>_w(y)),d=u.reduce((y,v)=>y+v,0)+Math.max(0,r.length-1)*h,f=d<=c-jw;if(this.overflow==="none"||f)return;t.hidden=!1;let p=_w(t),m=r.length,O=d;for(;m>0&&!(O+h+p<=c-jw);)m-=1,O-=u[m],m>0&&(O-=h);for(;m>0&&Nw(r[m-1]);)m-=1;let g=r.slice(m);for(let y of g){if(Nw(y)){y.hidden=!0;continue}bM(y),e.appendChild(y)}e.firstElementChild||(t.hidden=!0)}finally{this.#r=!1,queueMicrotask(()=>{this.#e?.takeRecords(),this.#b()})}}}},Wr=class extends A{static template=()=>null;connected(){this.setAttribute("role","group")}};w("toolbar-ui",Vr),w("toolbar-group-ui",Wr);var Yr=class extends A{static properties={variant:{type:String,default:"primary",reflect:!0},collapsed:{type:Boolean,default:!1,reflect:!0},divider:{type:Boolean,default:!1,reflect:!0},heading:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;connected(){this.setAttribute("role","navigation"),this.heading&&this.setAttribute("aria-label",this.heading),this.addEventListener("click",this.#i),this.variant!=="section"&&(this.#t=new ResizeObserver(()=>this.#e()),this.#t.observe(this))}render(){this.heading?this.setAttribute("aria-label",this.heading):this.removeAttribute("aria-label"),this.variant!=="section"&&this.#e()}#e(){let t=this.collapsed||this.getBoundingClientRect().width<=96;for(let e of this.querySelectorAll(":scope > nav-group-ui")){let i=e.querySelector(':scope > [slot="header"]');i&&(i.title=t?e.text:"")}for(let e of this.querySelectorAll(":scope > nav-item-ui"))e.title=t?e.text:""}get selectedItem(){return this.querySelector("nav-item-ui[selected]")}select(t){let e=this.selectedItem;e&&e!==t&&e.removeAttribute("selected"),t&&(t.setAttribute("selected",""),this.dispatchEvent(new CustomEvent("nav-select",{bubbles:!0,detail:{item:t,text:t.text,value:t.value}})))}toggle(){this.variant!=="section"&&(this.collapsed=!this.collapsed)}#i=t=>{let e=t.target.closest("nav-item-ui");if(e&&this.contains(e)){if(e.disabled)return;this.select(e),this.#s();return}if(this.variant==="section")return;let i=t.target.closest("nav-group-ui");if(i&&this.contains(i))if(this.collapsed||this.getBoundingClientRect().width<=96)i.showPopover?.();else{let r=i.querySelector(':scope > [slot="header"]');r&&(t.target===r||r.contains(t.target))&&(i.open=!i.open)}};#s(){this.style.pointerEvents="none",requestAnimationFrame(()=>{this.style.pointerEvents=""})}disconnected(){this.removeEventListener("click",this.#i),this.#t?.disconnect(),this.#t=null}};w("nav-ui",Yr);var Ur=class extends A{static properties={text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},badge:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},collapsible:{type:Boolean,default:!0,reflect:!0},variant:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=t=>{this.collapsible&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.open=!this.open,this.dispatchEvent(new CustomEvent("group-toggle",{bubbles:!0,detail:{text:this.text,open:this.open}})))};connected(){this.setAttribute("role","group"),this.querySelector(':scope > [slot="header"]')?this.#i=this.querySelector(':scope > [slot="header"]'):(this.#i=document.createElement("div"),this.#i.setAttribute("slot","header"),this.#i.setAttribute("tabindex","0"),this.#i.innerHTML=`
177
+ <span slot="icon">${this.icon?`<icon-ui name="${this.icon}"></icon-ui>`:""}</span>
178
+ <span slot="text">${this.text}</span>
179
+ ${this.badge?`<span slot="badge">${this.badge}</span>`:""}
180
+ <icon-ui slot="caret" name="caret-right"></icon-ui>
181
+ `,this.prepend(this.#i)),this.#i?.addEventListener("keydown",this.#s)}render(){let t=this.querySelector('[slot="header"] [slot="text"]');t&&(t.textContent=this.text);let e=this.querySelector('[slot="header"] [slot="badge"]');e&&(e.textContent=this.badge),this.setAttribute("aria-expanded",String(this.open))}showPopover(){if(!this.#t){this.#t=document.createElement("div"),this.#t.setAttribute("slot","popover"),this.#t.setAttribute("popover","auto");let t=document.createElement("div");t.setAttribute("slot","popover-label"),t.textContent=this.text,this.#t.appendChild(t);for(let e of this.querySelectorAll(":scope > nav-item-ui")){let i=document.createElement("div");i.setAttribute("role","option"),i.dataset.sourceValue=e.getAttribute("value")||"",i.textContent=e.text,i.addEventListener("click",()=>{let n=this.closest("nav-ui");n&&n.select(e),this.#t.hidePopover()}),this.#t.appendChild(i)}this.appendChild(this.#t),this.#t.addEventListener("toggle",e=>{e.newState==="closed"&&(this.#e?.(),this.#e=null)})}for(let t of this.#t.querySelectorAll('[role="option"]')){let e=t.dataset.sourceValue;(e?this.querySelector(`:scope > nav-item-ui[value="${e}"]`):null)?.hasAttribute("selected")?(t.setAttribute("aria-current","page"),t.setAttribute("aria-selected","true")):(t.removeAttribute("aria-current"),t.removeAttribute("aria-selected"))}this.#t.showPopover(),this.#e?.(),this.#e=Tt(this,this.#t,{placement:"right",gap:4})}disconnected(){this.#i?.removeEventListener("keydown",this.#s),this.#e?.(),this.#e=null,this.#t?.hidePopover?.()}};w("nav-group-ui",Ur);var Fr=class extends A{static properties={text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},badge:{type:String,default:"",reflect:!0},selected:{type:Boolean,default:!1,reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},variant:{type:String,default:"",reflect:!0}};static template=()=>null;#t=t=>{if(this.disabled){t.preventDefault();return}this.closest("nav-ui")?.select?.(this),this.dispatchEvent(new CustomEvent("nav-select",{bubbles:!0,detail:{item:this,text:this.text,value:this.value}}))};#e=t=>{this.disabled||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#t(t))};connected(){this.setAttribute("role","link"),this.setAttribute("tabindex",this.disabled?"-1":"0"),this.querySelector('[slot="text"]')||(this.innerHTML=`
182
+ <span slot="icon">${this.icon?`<icon-ui name="${this.icon}"></icon-ui>`:""}</span>
183
+ <span slot="text">${this.text}</span>
184
+ ${this.badge?`<span slot="badge">${this.badge}</span>`:""}
185
+ `),this.addEventListener("click",this.#t),this.addEventListener("keydown",this.#e)}render(){let t=this.querySelector('[slot="text"]');t&&(t.textContent=this.text),this.setAttribute("tabindex",this.disabled?"-1":"0"),this.selected?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")}disconnected(){this.removeEventListener("click",this.#t),this.removeEventListener("keydown",this.#e)}};w("nav-item-ui",Fr);var Gr=class extends z{static properties={...z.properties,length:{type:Number,default:6,reflect:!0}};static template=()=>null;#t=[];#e=t=>{let e=this.#t.indexOf(t.currentTarget);e<0||this.#a(t,e)};#i=t=>{let e=this.#t.indexOf(t.currentTarget);e<0||this.#l(t,e)};#s=t=>{this.#u(t)};connected(){super.connected(),this.setAttribute("role","group"),this.setAttribute("aria-label","One-time password"),this.#n(),this.#r()}#n(){let t=this.length||6;this.innerHTML="",this.#t=[];for(let e=0;e<t;e++){let i=document.createElement("input");i.type="text",i.maxLength=1,i.inputMode="numeric",i.autocomplete="one-time-code",i.setAttribute("slot","digit"),i.setAttribute("aria-label",`Digit ${e+1}`),this.appendChild(i),this.#t.push(i)}}#r(){for(let t of this.#t)t.addEventListener("input",this.#e),t.addEventListener("keydown",this.#i),t.addEventListener("paste",this.#s)}#o(){for(let t of this.#t)t.removeEventListener("input",this.#e),t.removeEventListener("keydown",this.#i),t.removeEventListener("paste",this.#s)}render(){if(!this.#t.length)return;let t=this.disabled;for(let e of this.#t)e.disabled=t}#a(t,e){let i=this.#t[e];i.value=i.value.replace(/\D/g,"").slice(0,1),this.#h(),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),i.value&&e<this.#t.length-1&&this.#t[e+1].focus(),this.#c()}#l(t,e){t.key==="Backspace"&&!this.#t[e].value&&e>0&&(this.#t[e-1].focus(),this.#t[e-1].value="",this.#h(),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})))}#u(t){t.preventDefault();let e=(t.clipboardData?.getData("text/plain")||"").replace(/\D/g,"");for(let n=0;n<this.#t.length;n++)this.#t[n].value=e[n]||"";this.#h(),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}));let i=this.#t.findIndex(n=>!n.value);i>=0?this.#t[i].focus():this.#t[this.#t.length-1].focus(),this.#c()}#h(){let t=this.#t.map(e=>e.value).join("");this.value=t,this.syncValue(t)}#c(){let t=this.#t.map(e=>e.value).join("");t.length===this.#t.length&&this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,detail:{value:t}}))}focus(){let t=this.#t.findIndex(e=>!e.value);this.#t[t>=0?t:0]?.focus()}clear(){for(let t of this.#t)t.value="";this.value="",this.syncValue(""),this.#t[0]?.focus()}disconnected(){super.disconnected(),this.#o(),this.#t=[]}};w("otp-input-ui",Gr);var Hr=class extends A{static properties={src:{type:String,default:"",reflect:!0},alt:{type:String,default:"",reflect:!0},width:{type:String,default:"",reflect:!0},height:{type:String,default:"",reflect:!0},size:{type:String,default:"",reflect:!0},fit:{type:String,default:"cover",reflect:!0},radius:{type:String,default:"",reflect:!0},raw:{type:Boolean,default:!1,reflect:!0},fallback:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;#e=null;connected(){this.#e=this.querySelector(':scope > [slot="skeleton"]'),this.#e||(this.#e=document.createElement("skeleton-ui"),this.#e.setAttribute("slot","skeleton"),this.#e.setAttribute("width","100%"),this.#e.setAttribute("height","100%"),this.appendChild(this.#e)),this.#t=this.querySelector(':scope > [slot="image"]'),this.#t||(this.#t=document.createElement("img"),this.#t.setAttribute("slot","image"),this.#t.loading="lazy",this.appendChild(this.#t)),this.#t.addEventListener("load",this.#s),this.#t.addEventListener("error",this.#n),this.#i()}render(){this.#t&&(this.#t.getAttribute("src")!==this.src&&(this.removeAttribute("data-loaded"),this.removeAttribute("data-error"),this.#t.src=this.src||""),this.#t.alt=this.alt||"",this.#i())}#i(){this.width&&(this.style.width=this.width),this.height&&(this.style.height=this.height)}#s=()=>{this.setAttribute("data-loaded",""),this.removeAttribute("data-error")};#n=()=>{this.fallback&&this.#t.src!==this.fallback?this.#t.src=this.fallback:this.setAttribute("data-error","")};disconnected(){this.#t&&(this.#t.removeEventListener("load",this.#s),this.#t.removeEventListener("error",this.#n)),this.#t=null,this.#e=null}};w("image-ui",Hr);var Kr=class extends z{static properties={...z.properties,placeholder:{type:String,default:"Search...",reflect:!0},debounce:{type:Number,default:300,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;connected(){super.connected(),this.setAttribute("role","search"),this.querySelector("input-ui")||(this.innerHTML=`<input-ui
186
+ type="search"
187
+ prefix="magnifying-glass"
188
+ suffix="x-circle"
189
+ placeholder="${this.placeholder}"
190
+ ${this.disabled?"disabled":""}
191
+ ></input-ui>`),this.#t=this.querySelector("input-ui"),this.#t&&(this.#t.addEventListener("input",this.#s),this.#t.addEventListener("keydown",this.#n),this.#e=this.#t.querySelector('[slot="suffix"]'),this.#e&&(this.#e.style.cursor="pointer",this.#e.addEventListener("click",this.#r)))}render(){this.#t&&(this.#t.setAttribute("placeholder",this.placeholder),this.disabled?this.#t.setAttribute("disabled",""):this.#t.removeAttribute("disabled"),this.setAttribute("value",this.value||""))}#s=()=>{this.value=this.#t.value,this.syncValue(this.value),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),clearTimeout(this.#i),this.#i=setTimeout(()=>{this.dispatchEvent(new CustomEvent("search",{bubbles:!0,detail:{value:this.value}}))},this.debounce||300)};#n=t=>{t.key==="Enter"&&(clearTimeout(this.#i),this.dispatchEvent(new CustomEvent("search",{bubbles:!0,detail:{value:this.value}}))),t.key==="Escape"&&this.#r()};#r=()=>{clearTimeout(this.#i),this.value="",this.#t&&(this.#t.value=""),this.syncValue(""),this.setAttribute("value",""),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),this.dispatchEvent(new CustomEvent("search",{bubbles:!0,detail:{value:""}})),this.#t?.focus()};focus(){this.#t?.focus()}clear(){this.#r()}disconnected(){super.disconnected(),clearTimeout(this.#i),this.#i=null,this.#t&&(this.#t.removeEventListener("input",this.#s),this.#t.removeEventListener("keydown",this.#n)),this.#e&&this.#e.removeEventListener("click",this.#r),this.#t=null,this.#e=null}};w("search-ui",Kr);var Va=class extends A{static properties={value:{type:String,default:"",reflect:!0},label:{type:String,default:"",reflect:!0},change:{type:String,default:"",reflect:!0},trend:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},loading:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;connected(){this.#t=this.querySelector(':scope > [slot="value"]'),this.#t||(this.#t=document.createElement("span"),this.#t.setAttribute("slot","value"),this.appendChild(this.#t)),this.#e=this.querySelector(':scope > [slot="label"]'),this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","label"),this.appendChild(this.#e)),this.#i=this.querySelector(':scope > [slot="change"]'),this.#i||(this.#i=document.createElement("span"),this.#i.setAttribute("slot","change"),this.appendChild(this.#i)),this.#s=this.querySelector(':scope > [slot="icon"]'),this.#s||(this.#s=document.createElement("icon-ui"),this.#s.setAttribute("slot","icon"),this.appendChild(this.#s))}render(){if(this.#t){if(this.loading){this.setAttribute("aria-busy","true"),this.#t.textContent="",this.#t.innerHTML='<skeleton-ui width="60%" height="2em" radius="sm"></skeleton-ui>',this.#i.textContent="",this.#i.innerHTML='<skeleton-ui width="40%" height="1em" radius="sm"></skeleton-ui>',this.#i.hidden=!1,this.icon?(this.#s.setAttribute("name",this.icon),this.#s.hidden=!1):this.#s.hidden=!0,this.#e.textContent=this.label;return}this.removeAttribute("aria-busy"),this.#t.textContent=this.value,this.#e.textContent=this.label,this.change?(this.#i.textContent=this.change,this.#i.hidden=!1):this.#i.hidden=!0,this.icon?(this.#s.setAttribute("name",this.icon),this.#s.hidden=!1):this.#s.hidden=!0}}disconnected(){this.#t=null,this.#e=null,this.#i=null,this.#s=null}};customElements.define("stat-ui",Va);var Jr=class extends A{static properties={label:{type:String,default:"",reflect:!0},value:{type:Number,default:null,reflect:!0},meta:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;connected(){this.setAttribute("role","group"),this.#t=this.querySelector(':scope > [slot="label"]'),this.#t||(this.#t=document.createElement("span"),this.#t.setAttribute("slot","label"),this.appendChild(this.#t)),this.#e=this.querySelector(':scope > [slot="meta"]'),this.#e||(this.#e=document.createElement("span"),this.#e.setAttribute("slot","meta"),this.appendChild(this.#e)),this.#i=this.querySelector(":scope > progress-ui"),this.#i||(this.#i=document.createElement("progress-ui"),this.value!=null&&this.value>=0&&this.#i.setAttribute("value",String(this.value)),this.appendChild(this.#i))}disconnected(){this.#t=null,this.#e=null,this.#i=null}render(){this.#t&&(this.#t.textContent=this.label,this.#t.hidden=!this.label,this.#e.textContent=this.meta,this.#e.hidden=!this.meta,this.value!=null&&this.value>=0?this.#i.setAttribute("value",String(this.value)):this.#i.removeAttribute("value"),this.label?this.setAttribute("aria-label",this.meta?`${this.label}, ${this.meta}`:this.label):this.removeAttribute("aria-label"))}};w("progress-row-ui",Jr);var to=class extends A{static properties={};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#i),this.addEventListener("keydown",this.#s))}disconnected(){this.removeEventListener("click",this.#i),this.removeEventListener("keydown",this.#s),this.#t=!1}#e(){return Array.from(this.querySelectorAll(":scope > action-item-ui:not([disabled])"))}#i=t=>{let e=t.target.closest("action-item-ui");!e||e.hasAttribute("disabled")||this.contains(e)&&this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.getAttribute("value")||"",text:e.getAttribute("text")||e.textContent.trim(),item:e}}))};#s=t=>{let e=this.#e();if(!e.length)return;let i=document.activeElement?.closest?.("action-item-ui"),n=i?e.indexOf(i):-1,r=o=>{e[(o+e.length)%e.length]?.focus?.({preventScroll:!0})};switch(t.key){case"ArrowDown":t.preventDefault(),r(n+1);break;case"ArrowUp":t.preventDefault(),r(n-1);break;case"Home":t.preventDefault(),r(0);break;case"End":t.preventDefault(),r(e.length-1);break;case"Enter":case" ":{i&&(t.preventDefault(),i.click());break}}}},eo=class extends A{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.#t(),this.#e()}#t(){if(!this.querySelector('[slot="text"]')){if(this.icon){let t=document.createElement("icon-ui");t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=document.createElement("span");t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}}}#e(){this.disabled?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0"))}render(){let t=this.querySelector('[slot="icon"]');if(this.icon)if(t)t.setAttribute("name",this.icon);else{let i=document.createElement("icon-ui");i.setAttribute("slot","icon"),i.setAttribute("name",this.icon),this.prepend(i)}else t&&t.remove();let e=this.querySelector('[slot="text"]');e&&(e.textContent=this.text),this.#e()}};w("action-list-ui",to),w("action-item-ui",eo);var io=class extends A{static properties={icon:{type:String,default:"",reflect:!0},heading:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0},minimal:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s(t){return t.dataset.emptyStateStamped="1",t}#n(t){return t?.dataset?.emptyStateStamped==="1"}connected(){this.#t=this.querySelector(':scope > [slot="icon"]'),this.#t||(this.#t=this.#s(document.createElement("icon-ui")),this.#t.setAttribute("slot","icon"),this.minimal||this.#t.setAttribute("size","lg"),this.insertBefore(this.#t,this.firstChild)),this.#e=this.querySelector(':scope > [slot="heading"]'),this.#e||(this.#e=this.#s(document.createElement("span")),this.#e.setAttribute("slot","heading"),this.insertBefore(this.#e,this.querySelector('[slot="action"]'))),this.#i=this.querySelector(':scope > [slot="description"]'),this.#i||(this.#i=this.#s(document.createElement("span")),this.#i.setAttribute("slot","description"),this.insertBefore(this.#i,this.querySelector('[slot="action"]')))}render(){this.#t&&(this.#n(this.#t)&&(this.icon?(this.#t.setAttribute("name",this.icon),this.#t.hidden=!1):this.#t.hidden=!0),this.#n(this.#e)&&(this.heading?(this.#e.textContent=this.heading,this.#e.hidden=!1):this.#e.hidden=!0),this.#n(this.#i)&&(this.description?(this.#i.textContent=this.description,this.#i.hidden=!1):this.#i.hidden=!0))}disconnected(){this.#t=null,this.#e=null,this.#i=null}};w("empty-state-ui",io);var vM=["S","M","T","W","T","F","S"],xM=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vw=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ww(s,t,e){return`${s}-${String(t+1).padStart(2,"0")}-${String(e).padStart(2,"0")}`}function Wi(s){if(!s)return null;let[t,e,i]=s.split("-").map(Number);return isNaN(t)||isNaN(e)||isNaN(i)?null:new Date(t,e-1,i)}function Yw(s,t){return s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()&&s.getDate()===t.getDate()}var so=class extends z{static labelDeprecated=!1;static requiredIcons=["calendar","caret-left","caret-right"];static properties={...z.properties,label:{type:String,default:"",reflect:!0},placeholder:{type:String,default:"Select date...",reflect:!0},format:{type:String,default:"short",reflect:!0},min:{type:String,default:"",reflect:!0},max:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=new Date().getFullYear();#n=new Date().getMonth();#r=null;#o=!1;#a=null;#l=t=>{let e=t.target instanceof Element?t.target:null;if(!e)return;if(e.closest("[data-cal-prev]")){t.stopPropagation(),this.#c(-1);return}if(e.closest("[data-cal-next]")){t.stopPropagation(),this.#c(1);return}let r=e.closest("[data-cal-day][data-date]:not([disabled])");r&&(t.stopPropagation(),this.#d(r.dataset.date))};connected(){super.connected(),this.setAttribute("role","group"),this.addEventListener("click",this.#f),this.addEventListener("keydown",this.#g);let t=Wi(this.value);t&&(this.#s=t.getFullYear(),this.#n=t.getMonth())}render(){if(!this.querySelector('[slot="trigger"]'))this.innerHTML=`
192
+ <span slot="trigger">
193
+ <span slot="display">${this.#u()}</span>
194
+ <icon-ui name="calendar" slot="caret"></icon-ui>
195
+ </span>
196
+ `,this.#e=this.querySelector('[slot="trigger"]'),this.#t=document.createElement("div"),this.#t.setAttribute("slot","popover"),this.#t.setAttribute("popover","manual"),this.appendChild(this.#t),this.#t.addEventListener("click",this.#l),this.#o=!0;else{let t=this.querySelector('[slot="display"]');t&&(t.textContent=this.#u())}this.#t||(this.#t=this.querySelector('[slot="popover"]')),this.#e||(this.#e=this.querySelector('[slot="trigger"]')),this.#t&&!this.#o&&(this.#t.addEventListener("click",this.#l),this.#o=!0),this.open?(this.#h(),this.#t?.showPopover?.(),this.#i=Tt(this.#e,this.#t,{placement:"bottom-start",gap:4}),this.#a=requestAnimationFrame(()=>{this.#a=null,!(!this.isConnected||!this.open)&&document.addEventListener("pointerdown",this.#p,{once:!0})})):(this.#i?.(),this.#i=null,this.#a!=null&&(cancelAnimationFrame(this.#a),this.#a=null),this.#t?.hidePopover?.(),document.removeEventListener("pointerdown",this.#p))}#u(){if(!this.value)return this.placeholder;let t=Wi(this.value);if(!t)return this.value;switch(this.format){case"long":return`${Vw[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`;case"iso":return this.value;default:return`${xM[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`}}#h(){if(!this.#t)return;let t=this.#s,e=this.#n,i=new Date,n=Wi(this.value),r=Wi(this.min),o=Wi(this.max),a=`<div data-cal-header>
197
+ <button data-cal-prev type="button" aria-label="Previous month"><icon-ui name="caret-left"></icon-ui></button>
198
+ <span data-cal-title>${Vw[e]} ${t}</span>
199
+ <button data-cal-next type="button" aria-label="Next month"><icon-ui name="caret-right"></icon-ui></button>
200
+ </div>`;a+=`<div data-cal-weekdays>${vM.map(f=>`<span>${f}</span>`).join("")}</div>`;let l=new Date(t,e,1).getDay(),h=new Date(t,e+1,0).getDate(),c=new Date(t,e,0).getDate();a+="<div data-cal-grid>";for(let f=l-1;f>=0;f--){let p=c-f;a+=`<button type="button" data-cal-day data-outside disabled tabindex="-1">${p}</button>`}for(let f=1;f<=h;f++){let p=new Date(t,e,f),m=Ww(t,e,f),O=Yw(p,i),g=n&&Yw(p,n),y=r&&p<r||o&&p>o,v=this.#r===f,x=['type="button"',"data-cal-day",`data-date="${m}"`,O?"data-today":"",g?"data-selected":"",y?"disabled":"",v?"data-focused":"",`tabindex="${v?"0":"-1"}"`].filter(Boolean).join(" ");a+=`<button ${x}>${f}</button>`}let d=(7-(l+h)%7)%7;for(let f=1;f<=d;f++)a+=`<button type="button" data-cal-day data-outside disabled tabindex="-1">${f}</button>`;a+="</div>",this.#t.innerHTML=a}#c(t){this.#n+=t,this.#n>11&&(this.#n=0,this.#s++),this.#n<0&&(this.#n=11,this.#s--),this.#r=null,this.#h()}#d(t){this.value=t,this.syncValue(t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),this.open&&this.#h()}#f=t=>{if(!this.disabled&&!(this.#t&&t.composedPath().includes(this.#t))&&(this.open=!this.open,this.open)){let e=Wi(this.value);if(e)this.#s=e.getFullYear(),this.#n=e.getMonth(),this.#r=e.getDate();else{let i=new Date;this.#s=i.getFullYear(),this.#n=i.getMonth(),this.#r=i.getDate()}}};#p=t=>{!this.contains(t.target)&&!(this.#t&&t.composedPath().includes(this.#t))&&(this.open=!1)};#g=t=>{if(!this.open){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.open=!0);return}if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}if(t.key==="Enter"){if(t.preventDefault(),this.#r){let i=Ww(this.#s,this.#n,this.#r),n=new Date(this.#s,this.#n,this.#r),r=Wi(this.min),o=Wi(this.max);(!r||n>=r)&&(!o||n<=o)&&this.#d(i)}return}let e={ArrowUp:-7,ArrowDown:7,ArrowLeft:-1,ArrowRight:1};if(e[t.key]!==void 0){t.preventDefault();let i=new Date(this.#s,this.#n+1,0).getDate(),n=(this.#r||1)+e[t.key];if(n<1){this.#c(-1);let o=new Date(this.#s,this.#n+1,0).getDate();this.#r=o+n}else n>i?(this.#c(1),this.#r=n-i):this.#r=n;this.#h(),this.#t?.querySelector("[data-focused]")?.focus()}};disconnected(){super.disconnected(),this.#a!=null&&(cancelAnimationFrame(this.#a),this.#a=null),this.removeEventListener("click",this.#f),this.removeEventListener("keydown",this.#g),document.removeEventListener("pointerdown",this.#p),this.#t&&this.#o&&this.#t.removeEventListener("click",this.#l),this.#o=!1,this.#i?.(),this.#i=null,this.#t?.hidePopover?.(),this.#t=null,this.#e=null}};w("calendar-picker-ui",so);var no=class extends A{static properties={src:{type:String,default:"",reflect:!0},height:{type:String,default:"400",reflect:!0},width:{type:String,default:"100%",reflect:!0},aspect:{type:String,default:"",reflect:!0}};static template=()=>null;#t=null;connected(){this.#t||(this.#t=document.createElement("iframe"),this.#t.setAttribute("sandbox","allow-scripts allow-same-origin"),this.#t.setAttribute("loading","lazy"),this.#t.setAttribute("allowfullscreen",""),this.appendChild(this.#t))}render(){this.#t&&(this.src&&(this.#t.src=this.src),this.aspect?(this.style.aspectRatio=this.aspect,this.#t.style.width="100%",this.#t.style.height="100%",this.style.width=this.width,this.style.height=""):(this.style.aspectRatio="",this.#t.style.width="100%",this.#t.style.height=this.height.match(/^\d+$/)?`${this.height}px`:this.height,this.style.width=this.width,this.style.height=""))}disconnected(){this.#t=null}};w("embed-ui",no);var SM={none:"0",xs:"var(--a-space-1)",sm:"var(--a-space-2)",md:"var(--a-space-4)",lg:"var(--a-space-6)",xl:"var(--a-space-10)"};function Uw(s){return SM[s]??(/^\d+$/.test(s??"")?`var(--a-space-${s})`:s??"")}var ro=class extends A{static properties={padding:{type:String,default:"md",reflect:!0},margin:{type:String,default:"none",reflect:!0}};static template=()=>null;render(){let t=this.padding,e=this.margin,n=t?.includes("@")||e?.includes("@")?Se.value:"";t?.includes("@")?this.style.setProperty("--block-padding",Uw(Lt(t,n))):this.style.removeProperty("--block-padding"),e?.includes("@")?this.style.setProperty("--block-margin",Uw(Lt(e,n))):this.style.removeProperty("--block-margin")}};w("block-ui",ro);var wM={sm:"var(--a-body-sm)",md:"var(--a-body-md)",lg:"var(--a-body-lg)"};function kM(s){return wM[s]??s}var oo=class extends A{static properties={variant:{type:String,default:"body",reflect:!0},strong:{type:Boolean,default:!1,reflect:!0},truncate:{type:Boolean,default:!1,reflect:!0},lines:{type:Number,default:0,reflect:!0},size:{type:String,default:"",reflect:!0},color:{type:String,default:"",reflect:!0},weight:{type:String,default:"",reflect:!0},"text-align":{type:String,default:"",reflect:!0}};static template=()=>null;render(){this.lines>0?this.style.setProperty("--_text-lines",String(this.lines)):this.style.removeProperty("--_text-lines");let t=this.size;if(t?.includes("@")){let e=Se.value;this.style.setProperty("--text-size",kM(Lt(t,e)))}else this.style.removeProperty("--text-size")}};w("text-ui",oo);var ao=class extends A{static properties={value:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","button"),this.setAttribute("tabindex","0")}render(){this.#t||(this.#t=!0,this.#e()),this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}#e(){let t="";this.icon&&(t+=`<icon-ui name="${this.icon}"></icon-ui>`),this.text&&(t+=`<span data-text>${this.text}</span>`),this.innerHTML=t}disconnected(){this.#t=!1}},lo=class extends A{static properties={value:{type:String,default:"",reflect:!0},single:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;get#e(){return new Set(this.value?this.value.split(",").map(t=>t.trim()).filter(Boolean):[])}connected(){this.#t||(this.#t=!0,this.addEventListener("click",this.#s),this.addEventListener("keydown",this.#n)),this.setAttribute("role","group")}render(){let t=this.#e;for(let e of this.querySelectorAll("toggle-option-ui")){let i=e.value||e.getAttribute("value")||"";t.has(i)?(e.setAttribute("data-selected",""),e.setAttribute("aria-pressed","true")):(e.removeAttribute("data-selected"),e.setAttribute("aria-pressed","false"))}}#i(t){if(t.disabled)return;let e=t.value||t.getAttribute("value")||"";if(!e)return;let i=this.#e;this.single?i.has(e)?i.clear():(i.clear(),i.add(e)):i.has(e)?i.delete(e):i.add(e),this.value=[...i].join(","),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}}))}#s=t=>{let e=t.target.closest("toggle-option-ui");e&&this.contains(e)&&this.#i(e)};#n=t=>{if(t.key==="Enter"||t.key===" "){t.preventDefault();let e=t.target.closest("toggle-option-ui");e&&this.contains(e)&&this.#i(e)}};disconnected(){this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#n),this.#t=!1}};w("toggle-option-ui",ao),w("toggle-group-ui",lo);var $i="light",Le="dark",Jm="auto",ho=class extends A{static properties={scheme:{type:String,default:Jm,reflect:!0},target:{type:String,default:":root",reflect:!0},persist:{type:Boolean,default:!1,reflect:!0},storagePrefix:{type:String,default:"adia-theme-",reflect:!0,attribute:"storage-prefix"},iconLight:{type:String,default:"sun",reflect:!0,attribute:"icon-light"},iconDark:{type:String,default:"moon",reflect:!0,attribute:"icon-dark"},labelLight:{type:String,default:"Switch to dark mode",reflect:!0,attribute:"label-light"},labelDark:{type:String,default:"Switch to light mode",reflect:!0,attribute:"label-dark"},size:{type:String,default:"md",reflect:!0},variant:{type:String,default:"ghost",reflect:!0},color:{type:String,default:"",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0},activeScheme:{type:String,default:"",reflect:!0,attribute:"active-scheme"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=!1;#r=!1;connected(){this.#n||(this.#o(),this.#n=!0),this.#a()}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),t==="scheme"&&this.isConnected&&this.#n&&!this.#r&&e!==i&&this.#a()}disconnected(){this.#t&&this.#s&&this.#t.removeEventListener("press",this.#s),this.#O()}toggle(){this.#r=!0;let t=this.activeScheme===Le?$i:Le;this.#l(t,"programmatic")}setScheme(t){if(this.#r=!0,t===Jm){this.#f();let e=this.#p();this.activeScheme=e,this.#u(),this.#g(),this.#h("programmatic")}else(t===$i||t===Le)&&this.#l(t,"programmatic")}#o(){let t=document.createElement("button-ui");t.setAttribute("part","button"),t.setAttribute("variant",this.variant||"ghost"),t.setAttribute("size",this.size||"md"),this.color&&t.setAttribute("color",this.color),this.disabled&&t.setAttribute("disabled",""),this.appendChild(t),this.#t=t,this.#s=e=>{if(e.stopPropagation(),this.disabled)return;this.#r=!0;let i=this.activeScheme===Le?$i:Le;this.#l(i,"press")},t.addEventListener("press",this.#s)}#a(){let t=null;if(this.persist)try{let e=localStorage.getItem(`${this.storagePrefix}scheme`);(e===$i||e===Le)&&(t=e)}catch{}if(t===null){let e=this.scheme||Jm;(e===$i||e===Le)&&(t=e)}t===$i||t===Le?(this.#d(t),this.activeScheme=t):(this.activeScheme=this.#p(),this.#g()),this.#u()}#l(t,e){if(!(t!==$i&&t!==Le)){if(this.#d(t),this.activeScheme=t,this.persist)try{localStorage.setItem(`${this.storagePrefix}scheme`,t)}catch{}this.#O(),this.#u(),this.#h(e)}}#u(){if(!this.#t)return;let t=this.activeScheme===Le,e=t?this.iconDark:this.iconLight,i=t?this.labelDark:this.labelLight;this.#t.getAttribute("icon")!==e&&this.#t.setAttribute("icon",e),this.#t.setAttribute("aria-label",i),this.#t.setAttribute("title",i),this.#t.getAttribute("variant")!==this.variant&&this.#t.setAttribute("variant",this.variant||"ghost"),this.#t.getAttribute("size")!==this.size&&this.#t.setAttribute("size",this.size||"md"),this.color?this.#t.setAttribute("color",this.color):this.#t.removeAttribute("color"),this.disabled?this.#t.setAttribute("disabled",""):this.#t.removeAttribute("disabled")}render(){this.#u()}#h(t){this.dispatchEvent(new CustomEvent("scheme-change",{bubbles:!0,detail:{scheme:this.activeScheme,source:t}}))}#c(){let t=this.target||":root";if(t===":root")return document.documentElement;try{return document.querySelector(t)??document.documentElement}catch{return document.documentElement}}#d(t){let e=this.#c();e.style.setProperty("color-scheme",t),e.setAttribute("data-scheme",t)}#f(){let t=this.#c();if(t.style.removeProperty("color-scheme"),t.removeAttribute("data-scheme"),this.persist)try{localStorage.removeItem(`${this.storagePrefix}scheme`)}catch{}}#p(){try{if(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches)return Le}catch{}return $i}#g(){if(!(this.#e||typeof matchMedia!="function"))try{this.#e=matchMedia("(prefers-color-scheme: dark)"),this.#i=()=>{let t=this.#e.matches?Le:$i;t!==this.activeScheme&&(this.activeScheme=t,this.#u(),this.#h("media"))},this.#e.addEventListener("change",this.#i)}catch{}}#O(){if(this.#e&&this.#i)try{this.#e.removeEventListener("change",this.#i)}catch{}this.#e=null,this.#i=null}};w("toggle-scheme-ui",ho);var co=class extends A{static properties={labelOn:{type:String,default:"On",attribute:"label-on",reflect:!0},labelOff:{type:String,default:"Off",attribute:"label-off",reflect:!0},initial:{type:String,default:"off",reflect:!0},state:{type:String,default:"",reflect:!0}};static parts={bar:`
201
+ <row-ui slot="bar" gap="3" align="center" data-demo-toggle-bar>
202
+ <text-ui slot="label" data-demo-toggle-label></text-ui>
203
+ <switch-ui slot="switch" data-demo-toggle-switch></switch-ui>
204
+ </row-ui>
205
+ `};static template=()=>null;#t=null;#e=null;#i=null;#s=!1;connected(){if(this.state)this.state=this.state==="on"?"on":"off";else{let t=this.initial==="on"?"on":"off";this.state=t}this.#t=this.ensure("bar"),this.#e=this.#t.querySelector("[data-demo-toggle-switch]"),this.#i=this.#t.querySelector("[data-demo-toggle-label]"),this.#s||(this.#s=!0,this.#e.addEventListener("change",this.#n))}disconnected(){this.#e&&this.#e.removeEventListener("change",this.#n),this.#t=null,this.#e=null,this.#i=null,this.#s=!1}render(){if(!this.#t)return;let t=this.state==="on";this.#e.checked!==t&&(this.#e.checked=t),this.#i&&(this.#i.textContent=t?this.labelOn:this.labelOff)}toggle(){this.state=this.state==="on"?"off":"on",this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{state:this.state}}))}#n=t=>{t.stopPropagation();let e=this.#e.checked?"on":"off";e!==this.state&&(this.state=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{state:this.state}})))}};w("demo-toggle-ui",co);var uo=class extends A{static properties={src:{type:String,default:"",reflect:!0},markdown:{type:String,default:"",reflect:!1}};static template=()=>null;#t=null;#e="";#i="";connected(){this.#t||(this.#t=document.createElement("div"),this.#t.setAttribute("data-richtext-body",""),this.appendChild(this.#t))}render(){if(this.src&&this.src!==this.#e){this.#e=this.src,this.#i="",this.#s();return}this.markdown&&this.markdown!==this.#i&&(this.#i=this.markdown,this.#e="",this.#t.innerHTML=hn(this.markdown))}async#s(){try{let t=await fetch(this.src);if(!this.isConnected)return;if(!t.ok){this.#t.innerHTML=`<p>Failed to load: ${this.src}</p>`;return}let e=await t.text();if(!this.isConnected)return;this.#t.innerHTML=hn(e)}catch(t){if(!this.isConnected)return;this.#t.innerHTML=`<p>Error: ${t.message}</p>`}}};w("richtext-ui",uo);var fo=class extends A{static properties={pace:{type:Number,default:0,reflect:!0},hideCursor:{type:Boolean,default:!1,reflect:!0,attribute:"hide-cursor"},streaming:{type:Boolean,default:!1,reflect:!0}};#t=null;#e=null;#i="";get tokens(){return this.#t}set tokens(t){this.#t=t,t&&this.#s(t)}static template=()=>null;async#s(t){this.#e?.abort(),this.#e=new AbortController;let e=this.#e.signal;this.#i="",this.textContent="",this.streaming=!0,this.dispatchEvent(new Event("stream-start",{bubbles:!0}));try{for await(let i of t){if(e.aborted)break;if(this.#i+=i,this.pace>0)for(let n of i){if(e.aborted)break;this.textContent+=n,await new Promise(r=>setTimeout(r,this.pace))}else this.textContent=this.#i}}catch(i){e.aborted||this.dispatchEvent(new CustomEvent("stream-error",{bubbles:!0,detail:{error:i}}))}e.aborted||(this.streaming=!1,this.dispatchEvent(new Event("stream-end",{bubbles:!0})))}stop(){this.#e?.abort(),this.streaming=!1}clear(){this.stop(),this.#i="",this.textContent=""}disconnected(){this.stop()}};w("stream-ui",fo);var Et=new Map([["Row","row-ui"],["Column","col-ui"],["List","list-ui"],["ListItem","list-item-ui"],["Grid","grid-ui"],["Stack","stack-ui"],["Block","block-ui"],["Text","text-ui"],["Image","image-ui"],["Icon","icon-ui"],["Divider","divider-ui"],["Badge","badge-ui"],["Avatar","avatar-ui"],["AvatarGroup","avatar-group-ui"],["Progress","progress-ui"],["Skeleton","skeleton-ui"],["Code","code-ui"],["Stat","stat-ui"],["EmptyState","empty-state-ui"],["Input","input-ui"],["TextField","input-ui"],["TextArea","textarea-ui"],["Field","field-ui"],["CheckBox","check-ui"],["Toggle","switch-ui"],["Switch","switch-ui"],["Slider","slider-ui"],["Range","range-ui"],["Rating","rating-ui"],["ChoicePicker","select-ui"],["Select","select-ui"],["Radio","radio-ui"],["DateTimeInput","calendar-picker-ui"],["CalendarPicker","calendar-picker-ui"],["ColorPicker","color-picker-ui"],["Upload","upload-ui"],["OtpInput","otp-input-ui"],["Button","button-ui"],["LoadingIndicator","progress-ui"],["ErrorContainer","card-ui"],["Card","card-ui"],["Tabs","tabs-ui"],["Tab","tab-ui"],["Panel","pane-ui"],["Pane","pane-ui"],["Modal","modal-ui"],["Dialog","modal-ui"],["Drawer","drawer-ui"],["Toast","toast-ui"],["Popover","popover-ui"],["Accordion","accordion-ui"],["AccordionItem","accordion-item-ui"],["Alert","alert-ui"],["Tooltip","tooltip-ui"],["Menu","menu-ui"],["Section","section"],["Header","header"],["Footer","footer"],["Stream","stream-ui"],["Table","table-ui"],["Chart","chart-ui"],["Embed","embed-ui"],["Swiper","swiper-ui"],["Slideshow","swiper-ui"],["Carousel","swiper-ui"],["Breadcrumb","breadcrumb-ui"],["Link","link-ui"],["Anchor","link-ui"],["Hyperlink","link-ui"],["NavLink","link-ui"],["Nav","nav-ui"],["NavGroup","nav-group-ui"],["NavItem","nav-item-ui"],["Noodles","noodles-ui"],["Pagination","pagination-ui"],["SegmentedControl","segmented-ui"],["Segment","segment-ui"],["ToggleGroup","toggle-group-ui"],["Command","command-ui"],["Kbd","kbd-ui"],["Toolbar","toolbar-ui"],["Tag","tag-ui"],["Timeline","timeline-ui"],["TimelineItem","timeline-item-ui"],["button-ui","button-ui"],["card-ui","card-ui"],["text-ui","text-ui"],["input-ui","input-ui"],["text-field-ui","input-ui"],["select-ui","select-ui"],["toggle-ui","switch-ui"],["check-ui","check-ui"],["slider-ui","slider-ui"],["badge-ui","badge-ui"],["avatar-ui","avatar-ui"],["icon-ui","icon-ui"],["image-ui","image-ui"],["divider-ui","divider-ui"],["progress-ui","progress-ui"],["skeleton-ui","skeleton-ui"],["tabs-ui","tabs-ui"],["tab-ui","tab-ui"],["modal-ui","modal-ui"],["dialog-ui","modal-ui"],["drawer-ui","drawer-ui"],["toast-ui","toast-ui"],["popover-ui","popover-ui"],["panel-ui","pane-ui"],["accordion-ui","accordion-ui"],["alert-ui","alert-ui"],["tooltip-ui","tooltip-ui"],["menu-ui","menu-ui"],["table-ui","table-ui"],["chart-ui","chart-ui"],["code-ui","code-ui"],["textarea-ui","textarea-ui"],["radio-ui","radio-ui"],["tag-ui","tag-ui"],["search-ui","search-ui"],["upload-ui","upload-ui"],["breadcrumb-ui","breadcrumb-ui"],["link-ui","link-ui"],["nav-ui","nav-ui"],["noodles-ui","noodles-ui"],["pagination-ui","pagination-ui"],["segmented-control-ui","segmented-ui"],["segment-ui","segment-ui"],["command-ui","command-ui"],["calendar-picker-ui","calendar-picker-ui"],["color-picker-ui","color-picker-ui"],["kbd-ui","kbd-ui"],["toolbar-ui","toolbar-ui"],["otp-input-ui","otp-input-ui"],["embed-ui","embed-ui"],["stream-ui","stream-ui"],["row-ui","row-ui"],["col-ui","col-ui"],["grid-ui","grid-ui"],["stack-ui","stack-ui"],["block-ui","block-ui"],["list-ui","list-ui"],["range-ui","range-ui"],["datetime-ui","calendar-picker-ui"],["timeline-ui","timeline-ui"],["timeline-item-ui","timeline-item-ui"],["avatar-group-ui","avatar-group-ui"],["Keyboard","kbd-ui"],["DatePicker","calendar-picker-ui"],["CommandPalette","command-ui"],["FormContainer","form"],["Sidebar","admin-sidebar"],["Segmented","segmented-ui"],["OTP","otp-input-ui"],["Textarea","textarea-ui"],["RichText","richtext-ui"],["Richtext","richtext-ui"],["DescriptionList","description-list-ui"],["ActionItem","action-item-ui"],["ActionList","action-list-ui"],["Inspector","inspector-ui"],["Heatmap","heatmap-ui"],["ChatThread","chat-thread"],["ChatInput","chat-input-ui"],["OptionCard","option-card-ui"],["Option","option-card-ui"],["AdminCommand","admin-command"],["AdminContent","admin-content"],["AdminPage","admin-page"],["AdminPageBody","admin-page-body"],["AdminPageHeader","admin-page-header"],["AdminScroll","admin-scroll"],["AdminShell","admin-shell"],["AdminSidebar","admin-sidebar"],["AdminStatusbar","admin-statusbar"],["AdminTopbar","admin-topbar"],["ChatComposer","chat-composer"],["ChatEmpty","chat-empty"],["ChatHeader","chat-header"],["ChatShell","chat-shell"],["ChatSidebar","chat-sidebar"],["ChatStatus","chat-status"],["EditorCanvas","editor-canvas"],["EditorCanvasEmpty","editor-canvas-empty"],["EditorShell","editor-shell"],["EditorSidebar","editor-sidebar"],["EditorStatusbar","editor-statusbar"],["EditorToolbar","editor-toolbar"],["GenRoot","gen-root"],["SimpleContent","simple-content"],["SimpleHero","simple-hero"],["SimpleShell","simple-shell"],["ThemePanel","theme-panel"]]);function Xc(s){return Et.get(s)||null}function Fw(s,t){Et.set(s,t)}var Yi=class s{#t;#e;#i=new Map;#s=new Map;#n=new Map;#r=[];#o=null;#a=!1;constructor(t,e=Et,{batch:i=!1}={}){this.#t=t,this.#e=e,this.#a=i}process(t){t&&(this.#a?(this.#r.push(t),this.#o===null&&(this.#o=requestAnimationFrame(()=>this.#l()))):this.#u(t))}#l(){this.#o=null;let t=this.#r.splice(0);for(let e of t)this.#u(e)}#u(t){switch(t.type||t.messageType){case"createSurface":this.#d(t);break;case"updateComponents":this.#f(t);break;case"updateDataModel":this.#k(t);break;case"wireComponents":this.#c(t);break;case"deleteSurface":this.#y(t);break;case"meta":break;default:console.warn("A2UI: unknown message type",t.type)}}#h=null;async#c(t){if(!this.#h){let{WiringEngine:e}=await Promise.resolve().then(()=>(mg(),fk));this.#h=new e({updateDataModel:(i,n,r)=>{this.#k({surfaceId:i,path:n,value:r})},getElement:(i,n)=>this.#i.get(i)?.elements.get(n)||null})}await this.#h.process(t)}async processStream(t){for await(let e of t)this.process(e)}#d({surfaceId:t,catalogId:e,root:i}){if(this.#i.has(t))return;let n=document.createElement("div");n.setAttribute("data-a2ui-surface",t),e&&n.setAttribute("data-catalog",e),this.#t.appendChild(n),this.#i.set(t,{root:n,rootId:typeof i=="string"&&i?i:"root",elements:new Map,dataModel:{},bindings:new Map})}#f({surfaceId:t,components:e}){let i=this.#i.get(t);i||(i={root:this.#t,rootId:"root",elements:new Map,dataModel:{},bindings:new Map},this.#i.set(t,i));for(let l of e)if(!(!l.id&&l.id!==0)){if(l.component==="ContextBindings"){i.contextBindings=l;continue}try{let h=i.elements.get(l.id),c=l.component==="Text"?this.#b(l.variant,l):Xc(l.component,this.#e);if(!c){h||(h=document.createElement("div"),h.setAttribute("data-a2ui-id",l.id),h.setAttribute("data-a2ui-unknown",l.component),h.textContent=`[unknown: ${l.component}]`,i.elements.set(l.id,h),this.#s.set(l.id,h));continue}if(!h)h=document.createElement(c),h.setAttribute("data-a2ui-id",l.id),i.elements.set(l.id,h),this.#s.set(l.id,h);else if(h.localName!==c){let d=document.createElement(c);d.setAttribute("data-a2ui-id",l.id),h.replaceWith(d),h=d,i.elements.set(l.id,h),this.#s.set(l.id,h)}l._surfaceId=t,Object.values(l).some(d=>d&&typeof d=="object"&&d.path)&&i.bindings.set(l.id,l),this.#v(h,l)}catch(h){console.warn(`A2UI: component "${l.id}" (${l.component}) failed:`,h.message)}}let n=new Map;for(let l of e){for(let h of Array.isArray(l.children)?l.children:[])n.set(h,l.id);l.child&&n.set(l.child,l.id)}let r=(l,h)=>{let c=new Set,u=l;for(;u!=null;){if(u===h||c.has(u))return!0;c.add(u),u=n.get(u)}return!1};for(let l of e){let h=i.elements.get(l.id);if(h)try{let c=Array.isArray(l.children)?l.children:[];for(let u of c){if(u===l.id||r(l.id,u))continue;let d=i.elements.get(u);d&&d.parentElement!==h&&h.appendChild(d)}if(l.child&&l.child!==l.id&&!r(l.id,l.child)){let u=i.elements.get(l.child);u&&u.parentElement!==h&&h.appendChild(u)}}catch(c){console.warn(`A2UI: tree build failed for "${l.id}":`,c.message)}}let o=i.rootId??"root";if(e.find(l=>l.id===o)){let l=i.elements.get(o);l&&l.parentElement!==i.root&&i.root.appendChild(l)}}static#p=new Set(["data","columns","options","itemRenderer","textContent"]);static#g=new Set(["h1","h2","h3","h4","h5","h6","p","small","span","em","strong","code","text-ui"]);static#O={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"p",caption:"small"};static#m=new Set(["autocomplete","autofocus","autocapitalize","autocorrect","inputmode","enterkeyhint","spellcheck","maxlength","minlength","readonly","novalidate","formnovalidate","formaction","formenctype","formmethod","formtarget","multiple","pattern","placeholder","required","tabindex","accesskey","autoplay","autopictureinpicture","controls","crossorigin","disablepictureinpicture","disableremoteplayback","loop","muted","playsinline","preload","srcset","srcdoc","srclang","sizes","loading","decoding","fetchpriority","ismap","usemap","hreflang","referrerpolicy","download","contenteditable","contextmenu","draggable","dirname","colspan","rowspan","headers","allowfullscreen","allowpaymentrequest","itemid","itemprop","itemref","itemscope","itemtype","nomodule","nonce"]);#b(t,e){return!e?.slot&&s.#O[t]?s.#O[t]:"text-ui"}#v(t,e){let i=new Set(["id","component","children","child","_surfaceId"]);e.component==="Text"&&e.variant&&!e.slot&&s.#O[e.variant]&&i.add("variant");let n=this.#n.get(e.id),r={};for(let[o,a]of Object.entries(e)){if(i.has(o))continue;let l=a&&typeof a=="object"&&a.path,h=this.#x(a,e._surfaceId);if(r[o]=h,!(n&&Object.is(n[o],h))){if(o==="style"&&typeof h=="string"){t.style.cssText=h;continue}if(s.#p.has(o)&&h!=null){if(o==="textContent"&&!s.#g.has(t.localName)){t.setAttribute("text",String(h));continue}t[o]=h;continue}typeof h=="boolean"?h?t.setAttribute(o,""):t.removeAttribute(o):h!=null?t.setAttribute(this.#S(o),String(h)):l&&t.removeAttribute(this.#S(o))}}if(n)for(let o of Object.keys(n))!(o in r)&&!i.has(o)&&t.removeAttribute(this.#S(o));this.#n.set(e.id,r)}#S(t){return s.#m.has(t.toLowerCase())?t.toLowerCase():t.replace(/([A-Z])/g,"-$1").toLowerCase()}#x(t,e){if(t==null)return null;if(typeof t!="object")return t;if(t.path){let i=e?this.#i.get(e):null;return i?this.#w(i.dataModel,t.path):t.path}return t}#w(t,e){return!e||e==="/"?t:e.split("/").filter(Boolean).reduce((i,n)=>i?.[n],t)}#k({surfaceId:t,path:e,value:i}){let n=this.#i.get(t);if(n){if(!e||e==="/")n.dataModel=i??{};else{let r=e.split("/").filter(Boolean),o=n.dataModel;for(let a=0;a<r.length-1;a++)o[r[a]]==null&&(o[r[a]]={}),o=o[r[a]];o[r[r.length-1]]=i}for(let[r,o]of n.bindings){let a=n.elements.get(r);a&&this.#v(a,o)}}}#y({surfaceId:t}){let e=this.#i.get(t);if(e){this.#h?.teardown(t);for(let[i]of e.elements)this.#s.delete(i);e.root.remove(),this.#i.delete(t)}}getSurface(t){return this.#i.get(t)}getElement(t){return this.#s.get(t)}get surfaces(){return[...this.#i.keys()]}reset(){this.#o!==null&&(cancelAnimationFrame(this.#o),this.#o=null),this.#r.length=0;for(let[,t]of this.#i)t.root===this.#t?t.root.innerHTML="":t.root.remove();this.#i.clear(),this.#s.clear(),this.#n.clear()}set batching(t){this.#a=!!t}get batching(){return this.#a}};function zc(s,t={}){let e=s;if(t.catalog){let i=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog),n=s.includes("?")?"&":"?";e=`${s}${n}a2ui_catalog=${encodeURIComponent(i.join(","))}`}return{[Symbol.asyncIterator](){let i=new EventSource(e),n=[],r=null,o=!1;return i.onmessage=a=>{try{let l=JSON.parse(a.data);if(r){let h=r;r=null,h({value:l,done:!1})}else n.push(l)}catch{console.warn("A2UI SSE: invalid JSON",a.data)}},i.onerror=()=>{if(o=!0,i.close(),r){let a=r;r=null,a({value:void 0,done:!0})}},t.signal&&t.signal.addEventListener("abort",()=>{if(o=!0,i.close(),r){let a=r;r=null,a({value:void 0,done:!0})}}),{next(){return n.length>0?Promise.resolve({value:n.shift(),done:!1}):o?Promise.resolve({value:void 0,done:!0}):new Promise(a=>{r=a})},return(){return o=!0,i.close(),Promise.resolve({value:void 0,done:!0})}}}}}function jc(s,t={}){return{[Symbol.asyncIterator](){let e=new WebSocket(s),i=[],n=null,r=!1;return e.onopen=()=>{if(t.catalog){let o=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog);e.send(JSON.stringify({type:"a2ui:catalog",supportedTypes:o}))}},e.onmessage=o=>{try{let a=JSON.parse(o.data);if(n){let l=n;n=null,l({value:a,done:!1})}else i.push(a)}catch{console.warn("A2UI WS: invalid JSON",o.data)}},e.onclose=()=>{if(r=!0,n){let o=n;n=null,o({value:void 0,done:!0})}},e.onerror=()=>{r=!0,e.close()},{next(){return i.length>0?Promise.resolve({value:i.shift(),done:!1}):r?Promise.resolve({value:void 0,done:!0}):new Promise(o=>{n=o})},return(){return r=!0,e.close(),Promise.resolve({value:void 0,done:!0})}}}}}function gk(s,t=0){return{async*[Symbol.asyncIterator](){for(let e of s)t>0&&await new Promise(i=>setTimeout(i,t)),yield e}}}function Nc(s,t={}){let e=(s.split(":")[0]||"").toLowerCase();return e==="ws"||e==="wss"?jM(s,t):mk(s,t)}function pk(s,t){if(s.result?.content){for(let e of s.result.content)if(e.type==="resource"&&e.resource?.mimeType==="application/json+a2ui")try{let i=JSON.parse(e.resource.text);for(let n of Array.isArray(i)?i:[i])t(n)}catch{}else if(e.type==="text")try{let i=JSON.parse(e.text);i.type&&(i.type.startsWith("create")||i.type.startsWith("update")||i.type.startsWith("delete"))&&t(i)}catch{}}}function jM(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:n}=t,r=new WebSocket(s);if(await new Promise((c,u)=>{r.onopen=c,r.onerror=u,e&&e.addEventListener("abort",()=>{r.close(),u(new DOMException("Aborted","AbortError"))},{once:!0})}),i){let c=i instanceof Map?[...i.keys()]:Object.keys(i);r.send(JSON.stringify({jsonrpc:"2.0",method:"a2ui/catalog",params:{supportedTypes:c}}))}let o=[],a=null,l=!1,h=c=>{if(a){let u=a;a=null,u({value:c,done:!1})}else o.push(c)};for(r.onmessage=c=>{try{let u=JSON.parse(c.data);pk(u,h),u.method==="a2ui/action"&&n&&n(u.params?.name,u.params?.arguments).then(d=>{r.send(JSON.stringify({jsonrpc:"2.0",id:u.id,result:d}))}).catch(d=>{r.send(JSON.stringify({jsonrpc:"2.0",id:u.id,error:{code:-1,message:d.message}}))})}catch{console.warn("A2UI MCP: invalid message",c.data)}},r.onclose=()=>{if(l=!0,a){let c=a;a=null,c({value:void 0,done:!0})}},r.onerror=()=>{l=!0,r.close()},e&&e.addEventListener("abort",()=>{if(l=!0,r.close(),a){let c=a;a=null,c({value:void 0,done:!0})}});!l||o.length>0;)if(o.length>0)yield o.shift();else{if(l)break;{let c=await new Promise(u=>{a=u});if(c.done)break;yield c.value}}}}}function mk(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:n}=t,r=[],o=null,a=!1,l=g=>{if(o){let y=o;o=null,y({value:g,done:!1})}else r.push(g)},h=()=>{if(a=!0,o){let g=o;o=null,g({value:void 0,done:!0})}},c={jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-11-25",capabilities:{},clientInfo:{name:"a2ui-runtime",version:"0.0.0"}}},u;try{u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(c),signal:e})}catch(g){console.warn("A2UI MCP HTTP: initialize failed",g);return}if(!u.ok){console.warn(`A2UI MCP HTTP: initialize returned ${u.status}`);return}let d=u.headers.get("mcp-session-id");if(!d){console.warn("A2UI MCP HTTP: server did not return mcp-session-id header");try{await u.text()}catch{}return}try{if((u.headers.get("content-type")||"").includes("text/event-stream")){let y=u.body.getReader(),v=new TextDecoder,x="";for(;;){let{done:S,value:$}=await y.read();if(S||(x+=v.decode($,{stream:!0}),x.includes(`
206
+
207
+ `)))break}try{y.cancel()}catch{}}else await u.json().catch(()=>null)}catch{}try{await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),signal:e}).then(g=>g.text()).catch(()=>null)}catch{}if(i){let g=i instanceof Map?[...i.keys()]:Object.keys(i);try{await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify({jsonrpc:"2.0",method:"a2ui/catalog",params:{supportedTypes:g}}),signal:e}).then(y=>y.text()).catch(()=>null)}catch{}}let f=g=>fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify(g),signal:e}).then(y=>y.text()).catch(()=>null),p=g=>{pk(g,l),g.method==="a2ui/action"&&n&&Promise.resolve().then(()=>n(g.params?.name,g.params?.arguments)).then(y=>f({jsonrpc:"2.0",id:g.id,result:y})).catch(y=>f({jsonrpc:"2.0",id:g.id,error:{code:-1,message:y.message}}))},m;try{m=await fetch(s,{method:"GET",headers:{Accept:"text/event-stream","mcp-session-id":d},signal:e})}catch(g){g?.name!=="AbortError"&&console.warn("A2UI MCP HTTP: GET stream failed",g);return}if(!m.ok||!m.body){console.warn(`A2UI MCP HTTP: GET stream returned ${m.status}`);return}e&&e.addEventListener("abort",h,{once:!0});let O=()=>{try{fetch(s,{method:"DELETE",headers:{"mcp-session-id":d}}).catch(()=>null)}catch{}};for((async()=>{let g=m.body.getReader(),y=new TextDecoder,v="";try{for(;!a;){let{done:x,value:S}=await g.read();if(x)break;v+=y.decode(S,{stream:!0});let $;for(;($=v.indexOf(`
208
+
209
+ `))!==-1;){let k=v.slice(0,$);v=v.slice($+2);let P=[];for(let C of k.split(`
210
+ `))C.startsWith("data:")&&P.push(C.slice(5).trimStart());if(P.length===0)continue;let T=P.join(`
211
+ `);try{let C=JSON.parse(T);p(C)}catch{console.warn("A2UI MCP HTTP: invalid JSON-RPC SSE payload",T)}}}}catch(x){x?.name!=="AbortError"&&console.warn("A2UI MCP HTTP: stream read error",x)}finally{h(),O()}})();!a||r.length>0;)if(r.length>0)yield r.shift();else{if(a)break;{let g=await new Promise(y=>{o=y});if(g.done)break;yield g.value}}}}}function _c(s,t={}){return{async*[Symbol.asyncIterator](){let e={};if(t.catalog){let a=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog);e["X-A2UI-Catalog"]=a.join(",")}let n=(await fetch(s,{signal:t.signal,headers:e})).body.getReader(),r=new TextDecoder,o="";for(;;){let{done:a,value:l}=await n.read();if(a)break;o+=r.decode(l,{stream:!0});let h=o.split(`
212
+ `);o=h.pop();for(let c of h){let u=c.trim();if(u)try{yield JSON.parse(u)}catch{console.warn("A2UI JSONL: invalid JSON",u)}}}if(o.trim())try{yield JSON.parse(o.trim())}catch{}}}}var Vc=class s{#t;#e;#i;#s=new Map;#n=[];#r=new Map;constructor({id:t,name:e,version:i="1.0.0"}){this.#t=t,this.#e=e,this.#i=i}addSurface(t,e){this.#s.set(t,{...e})}removeSurface(t){this.#s.delete(t),this.#n=this.#n.filter(e=>e.from!==t&&e.to!==t)}getSurface(t){return this.#s.get(t)??null}get surfaceIds(){return[...this.#s.keys()]}addAssociation(t){if(!this.#s.has(t.from)){console.warn(`Manifest: surface "${t.from}" not found`);return}if(!this.#s.has(t.to)){console.warn(`Manifest: surface "${t.to}" not found`);return}this.#n=this.#n.filter(e=>!(e.type===t.type&&e.from===t.from&&e.to===t.to)),this.#n.push({...t})}getAssociationsFrom(t,e){return this.#n.filter(i=>i.from===t&&(!e||i.type===e))}getAssociationsTo(t,e){return this.#n.filter(i=>i.to===t&&(!e||i.type===e))}getSharedContextPeers(t){let e=[];for(let i of this.#n)i.type==="shares-context"&&(i.from===t&&e.push({surfaceId:i.to,context:i.context}),i.to===t&&e.push({surfaceId:i.from,context:i.context}));return e}defineSharedContext(t,e){this.#r.set(t,{...e})}getSharedContext(t){return this.#r.get(t)??null}validate(){let t=[];for(let i of this.#s.keys())!this.#n.some(r=>r.from===i||r.to===i)&&this.#s.size>1&&t.push({severity:"warning",message:`Surface "${i}" has no associations`});[...this.#s.entries()].filter(([,i])=>i.entryPoint).length===0&&this.#s.size>0&&t.push({severity:"warning",message:"No surface marked as entryPoint"});for(let i of this.#n)i.type==="depends-on"&&!i.fallback&&t.push({severity:"warning",message:`depends-on from "${i.from}" to "${i.to}" has no fallback`});for(let i of this.#n)i.type==="shares-context"&&i.context&&!this.#r.has(i.context)&&t.push({severity:"error",message:`Shared context "${i.context}" referenced but not defined`});for(let i of this.#n)i.type==="feeds"&&!i.trigger&&t.push({severity:"warning",message:`feeds from "${i.from}" to "${i.to}" has no trigger`});for(let i of this.#n)if(i.type==="routes-to"){let n=this.#s.get(i.to);n&&!n.route&&t.push({severity:"error",message:`routes-to target "${i.to}" has no route defined`})}return{valid:!t.some(i=>i.severity==="error"),issues:t}}toJSON(){return{$schema:"https://a2ui.dev/schema/relationships/v1",id:this.#t,name:this.#e,version:this.#i,surfaces:Object.fromEntries(this.#s),associations:[...this.#n],sharedContexts:Object.fromEntries(this.#r)}}static fromJSON(t){let e=new s({id:t.id,name:t.name,version:t.version});if(t.surfaces)for(let[i,n]of Object.entries(t.surfaces))e.addSurface(i,n);if(t.sharedContexts)for(let[i,n]of Object.entries(t.sharedContexts))e.defineSharedContext(i,n);if(t.associations)for(let i of t.associations)e.addAssociation(i);return e}};tg();pg();mg();fg();Ds();eg();ig();sg();ng();rg();var Wc=class extends A{static properties={src:{type:String,default:"",reflect:!0},transport:{type:String,default:"sse",reflect:!0},loading:{type:Boolean,default:!1,reflect:!0},active:{type:Boolean,default:!1,reflect:!0},batch:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=!1;#n=t=>{let e=t.target.closest("[data-action]");e&&this.dispatchEvent(new CustomEvent("a2ui-action",{bubbles:!0,detail:{name:e.getAttribute("data-action"),sourceComponentId:e.getAttribute("data-a2ui-id")||"",timestamp:Date.now(),context:{}}}))};connected(){this.#t=new Yi(this,Et,{batch:this.batch}),this.#s||(this.#s=!0,this.addEventListener("click",this.#n))}render(){this.src&&!this.active&&this.#r()}async#r(){this.#e?.abort(),this.#e=new AbortController;let t=this.#e.signal;this.loading=!0,this.active=!1;let e;try{switch(this.transport){case"sse":e=zc(this.src,{signal:t,catalog:Et});break;case"ws":case"websocket":e=jc(this.src,{signal:t,catalog:Et});break;case"jsonl":e=_c(this.src,{signal:t,catalog:Et});break;case"mcp":e=Nc(this.src,{signal:t,catalog:Et,onAction:(i,n)=>(this.dispatchEvent(new CustomEvent("a2ui-action",{bubbles:!0,detail:{name:i,params:n,timestamp:Date.now()}})),Promise.resolve({status:"dispatched"}))});break;default:console.warn(`a2ui-root: unknown transport "${this.transport}"`);return}this.active=!0,this.loading=!1,this.dispatchEvent(new Event("a2ui-connected",{bubbles:!0}));for await(let i of e){if(t.aborted)break;this.#t.process(i),this.dispatchEvent(new CustomEvent("a2ui-message",{bubbles:!0,detail:{message:i}}))}}catch(i){t.aborted||this.dispatchEvent(new CustomEvent("a2ui-error",{bubbles:!0,detail:{error:i}}))}this.active=!1,this.loading=!1,this.dispatchEvent(new Event("a2ui-closed",{bubbles:!0}))}process(t){this.#t||(this.#t=new Yi(this,Et)),this.#t.process(t)}processAll(t){for(let e of t)this.process(e)}get doc(){return this.#i}set doc(t){this.#i=Array.isArray(t)?t:[],this.#t||(this.#t=new Yi(this,Et)),this.#t.reset();for(let e of this.#i)this.#t.process(e);this.dispatchEvent(new CustomEvent("doc-replaced",{bubbles:!0,detail:{count:this.#i.length}}))}reset(){this.#t?.reset()}disconnect(){this.#e?.abort(),this.active=!1}disconnected(){this.#e?.abort(),this.removeEventListener("click",this.#n),this.#s=!1,this.active=!1}get renderer(){return this.#t}};customElements.define("a2ui-root",Wc);var Yc=class s extends A{static properties={theme:{type:String,default:"",reflect:!0}};static template=()=>null;#t=!1;#e=null;#i=null;#s=[];#n=-1;static MAX_HISTORY=10;#r=t=>{t.target.closest("input, textarea, [contenteditable]")||!this.contains(document.activeElement)&&(document.activeElement,document.body)};#o=t=>{this.#e?.contains(t.target)&&this.#c("click",t.target)};#a=t=>{this.#e?.contains(t.target)&&this.#c("change",t.target)};#l=t=>{this.#e?.contains(t.target)&&this.#c("input",t.target)};#u=t=>{this.dispatchEvent(new CustomEvent("canvas-interaction",{bubbles:!0,detail:{type:"retry",targetTag:"button-ui",targetId:"retry",value:"",...t.detail}}))};connected(){document.addEventListener("keydown",this.#r),this.addEventListener("click",this.#o),this.addEventListener("change",this.#a),this.addEventListener("input",this.#l),this.addEventListener("a2ui-retry",this.#u)}disconnected(){document.removeEventListener("keydown",this.#r),this.removeEventListener("click",this.#o),this.removeEventListener("change",this.#a),this.removeEventListener("input",this.#l),this.removeEventListener("a2ui-retry",this.#u),this.#e=null,this.#i=null,this.#t=!1}render(){if(!this.#t){if(this.#t=!0,this.#i=document.createElement("div"),this.#i.setAttribute("data-canvas-surface",""),this.#e=document.createElement("a2ui-root"),this.theme){let t=document.createElement("theme-ui");t.setAttribute("preset",this.theme),t.appendChild(this.#e),this.#i.appendChild(t)}else this.#i.appendChild(this.#e);this.appendChild(this.#i)}}process(t){this.#e?.process(t)}processAll(t){if(this.#e)for(let e of t)this.#e.process(e)}reset(){this.#e?.reset()}getHTML(){return this.#e?.innerHTML??""}pushVersion(t){this.#n<this.#s.length-1&&(this.#s=this.#s.slice(0,this.#n+1)),this.#s.push(t?[...t]:[]),this.#s.length>s.MAX_HISTORY&&this.#s.shift(),this.#n=this.#s.length-1}back(){return this.#n<=0?!1:(this.#n--,this.#h(),!0)}forward(){return this.#n>=this.#s.length-1?!1:(this.#n++,this.#h(),!0)}get historyLength(){return this.#s.length}get historyIndex(){return this.#n}#h(){let t=this.#s[this.#n];if(this.#e?.reset(),t)for(let e of t)this.#e?.process(e)}#c(t,e){this.dispatchEvent(new CustomEvent("canvas-interaction",{bubbles:!0,detail:{type:t,targetTag:e.localName,targetId:e.id||"",value:e.value??e.getAttribute("text")??""}}))}};customElements.define("canvas-ui",Yc);var vo=class extends A{static properties={value:{type:String,default:"surface",reflect:!0}};static template=()=>null;#t=null;#e={};connected(){let t=this.textContent?.trim()||"";this.innerHTML="",this.#s(t)}disconnected(){this.#t?.removeEventListener("change",this.#i),this.#t=null,this.#e={}}render(){this.#t&&this.#t.getAttribute("value")!==this.value&&this.#t.setAttribute("value",this.value)}#i=t=>{t.detail?.value&&t.detail.value!==this.value&&(this.value=t.detail.value)};#s(t){let e=[...Et.entries()].map(([i,n])=>`${i} \u2192 <${n}>`).join(`
213
+ `);this.#t=document.createElement("tabs-ui"),this.#t.setAttribute("value",this.value||"surface"),this.#t.addEventListener("change",this.#i),this.#n("catalog",`Catalog (${Et.size})`,e),this.#n("surface","Surface",t||"{}",{language:"json"}),this.#n("messages","Messages","(no messages)"),this.#n("code","Code","(empty)",{language:"html",lineNumbers:!0}),this.appendChild(this.#t)}#n(t,e,i,n={}){let r=document.createElement("tab-ui");r.setAttribute("value",t),r.setAttribute("text",e);let o=document.createElement("code-ui");n.language&&o.setAttribute("language",n.language),n.lineNumbers&&o.setAttribute("line-numbers",""),o.setAttribute("text",i),r.appendChild(o),this.#t.appendChild(r),this.#e[t]=o}update(t,e){if(this.#e.surface&&this.#e.surface.setAttribute("text",JSON.stringify(t,null,2)),this.#e.messages){let n=Array.isArray(e)&&e.length?e.map((r,o)=>`${o+1}. ${r.type||r.messageType||"unknown"}${r.surfaceId?` [${r.surfaceId}]`:""}`).join(`
214
+ `):"(no messages)";this.#e.messages.setAttribute("text",n)}let i=this.#t?.querySelector('tab-ui[value="messages"]');if(i){let n=Array.isArray(e)?e.length:0;i.setAttribute("text",`Messages (${n})`)}}setHTML(t){this.#e.code&&this.#e.code.setAttribute("text",t||"(empty)")}};w("inspector-ui",vo);var Ok={interpret:"Interpreting",analyze:"Analyzing",plan:"Planning",generate:"Generating",validate:"Validating",render:"Rendering"},xo=class extends A{static properties={stage:{type:String,default:"",reflect:!0},message:{type:String,default:"",reflect:!0},status:{type:String,default:"idle",reflect:!0}};static template=()=>null;#t=[];#e=!1;#i=null;#s=null;#n=null;#r=null;#o=null;#a=null;#l=null;#u=null;#h="";#c="";connected(){this.setAttribute("role","status"),this.setAttribute("aria-label","Pipeline status")}render(){this.#e||(this.#e=!0,this.#d()),this.#f()}#d(){this.#i=document.createElement("div"),this.#i.setAttribute("data-pipeline-status",""),this.#s=document.createElement("div"),this.#s.setAttribute("data-pipeline-current",""),this.#n=document.createElement("span"),this.#n.setAttribute("data-pipeline-dot",""),this.#r=document.createElement("span"),this.#r.setAttribute("data-pipeline-label",""),this.#o=document.createElement("span"),this.#o.setAttribute("data-pipeline-msg",""),this.#s.append(this.#n,this.#r,this.#o),this.#a=document.createElement("details"),this.#a.setAttribute("data-pipeline-history",""),this.#a.hidden=!0,this.#l=document.createElement("summary"),this.#a.appendChild(this.#l),this.#u=document.createElement("ol"),this.#u.setAttribute("data-pipeline-log",""),this.#a.appendChild(this.#u),this.#i.append(this.#s,this.#a),this.appendChild(this.#i)}#f(){let{stage:t,message:e}=this;if(this.status==="completed"){this.#h&&this.#h!==this.#t[this.#t.length-1]?.stage&&this.#p(this.#h,this.#c),this.#n.setAttribute("data-pipeline-dot","complete"),this.#r.textContent="Complete",this.#o.textContent="",this.#g();return}t&&t!==this.#h&&this.#h&&this.#p(this.#h,this.#c);let i=Ok[t]||t;this.#n.setAttribute("data-pipeline-dot","active"),this.#n.setAttribute("data-stage",t),this.#r.textContent=i,this.#o.textContent=e?`\u2014 ${e}`:"",this.#h=t,this.#c=e,this.#g()}#p(t,e){this.#t.push({stage:t,message:e,timestamp:Date.now()})}#g(){if(this.#t.length===0){this.#a.hidden=!0;return}this.#a.hidden=!1,this.#l.textContent=`${this.#t.length} step${this.#t.length>1?"s":""} completed`,this.#u.innerHTML="";for(let t of this.#t){let e=document.createElement("li"),i=document.createElement("span");i.setAttribute("data-pipeline-dot","complete");let n=document.createElement("span"),r=Ok[t.stage]||t.stage;n.textContent=t.message?`${r} \u2014 ${t.message}`:r,e.append(i,n),this.#u.appendChild(e)}this.status==="completed"&&this.#a.removeAttribute("open")}disconnected(){this.#i=null,this.#s=null,this.#n=null,this.#r=null,this.#o=null,this.#a=null,this.#l=null,this.#u=null,this.#e=!1}};w("pipeline-status-ui",xo);var So=class extends z{static properties={...z.properties,value:{type:Number,default:0,reflect:!0},max:{type:Number,default:5,reflect:!0},icon:{type:String,default:"star",reflect:!0},readonly:{type:Boolean,default:!1,reflect:!0},allowHalf:{type:Boolean,default:!1,reflect:!0,attribute:"allow-half"},size:{type:String,default:"md",reflect:!0}};static template=()=>null;#t=null;connected(){super.connected(),this.setAttribute("role","slider"),this.setAttribute("aria-orientation","horizontal"),this.setAttribute("aria-valuemin","0"),this.hasAttribute("tabindex")||this.setAttribute("tabindex",this.readonly?"-1":"0"),this.addEventListener("pointermove",this.#i),this.addEventListener("pointerleave",this.#s),this.addEventListener("click",this.#n),this.addEventListener("keydown",this.#r)}render(){let t=Number(this.max)||5,e=this.#t??(Number(this.value)||0),i=Array.from({length:t},(n,r)=>{let o=r+1;return`
215
+ <span data-rating-symbol data-fill="${e>=o?"full":e>=o-.5?"half":"empty"}" aria-hidden="true">
216
+ <icon-ui name="${this.icon}" data-rating-symbol-bg></icon-ui>
217
+ <icon-ui name="${this.icon}" weight="fill" data-rating-symbol-fg></icon-ui>
218
+ </span>
219
+ `}).join("");this.innerHTML=i,this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(Number(this.value)||0)),this.setAttribute("aria-valuetext",`${Number(this.value)||0} out of ${t}`),this.readonly?this.setAttribute("aria-readonly","true"):this.removeAttribute("aria-readonly")}#e(t){let e=[...this.querySelectorAll("[data-rating-symbol]")],i=e.find(r=>r.contains(t.target));if(!i)return null;let n=e.indexOf(i);if(n===-1)return null;if(this.allowHalf){let r=i.getBoundingClientRect(),o=t.clientX-r.left<r.width/2;return n+(o?.5:1)}return n+1}#i=t=>{if(this.readonly||this.disabled)return;let e=this.#e(t);e!=null&&e!==this.#t&&(this.#t=e,this.render())};#s=()=>{this.#t!=null&&(this.#t=null,this.render())};#n=t=>{if(this.readonly||this.disabled)return;let e=this.#e(t);e!=null&&this.#o(e)};#r=t=>{if(this.readonly||this.disabled)return;let e=this.allowHalf?.5:1,i=Number(this.max)||5,n=Number(this.value)||0,r=n;if(t.key==="ArrowRight"||t.key==="ArrowUp")r=Math.min(i,n+e);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")r=Math.max(0,n-e);else if(t.key==="Home")r=0;else if(t.key==="End")r=i;else return;t.preventDefault(),this.#o(r)};#o(t){this.value=t,this.#t=null,this.syncValue(String(t)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:this.value}})),this.render()}disconnected(){super.disconnected(),this.removeEventListener("pointermove",this.#i),this.removeEventListener("pointerleave",this.#s),this.removeEventListener("click",this.#n),this.removeEventListener("keydown",this.#r)}};w("rating-ui",So);var wo=class extends A{static properties={layout:{type:String,default:"stacked",reflect:!0},align:{type:String,default:"start",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","group")}render(){let t=this.#t();t.length&&(this.innerHTML=t.map(({term:e,description:i})=>`
220
+ <dt data-dl-term>${this.#e(e)}</dt>
221
+ <dd data-dl-desc>${this.#e(i)}</dd>
222
+ `).join(""))}#t(){if(Array.isArray(this._items)&&this._items.length)return this._items;let t=this.getAttribute("items");if(t)try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return[]}set items(t){this._items=Array.isArray(t)?t:[],this.render()}get items(){return this._items||[]}#e(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}};w("description-list-ui",wo);var NM=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ko=class extends A{static properties={type:{type:String,default:"matrix",reflect:!0},rows:{type:Number,default:7,reflect:!0},cols:{type:Number,default:12,reflect:!0},scale:{type:String,default:"linear",reflect:!0},noLegend:{type:Boolean,default:!1,reflect:!0,attribute:"no-legend"},colorScheme:{type:String,default:"data-ramp",reflect:!0,attribute:"color-scheme"},startDate:{type:String,default:"",reflect:!0,attribute:"start-date"},aspect:{type:String,default:"wide",reflect:!0}};static template=()=>null;#t=[];#e=!1;set data(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{t=[]}this.#t=Array.isArray(t)?t:[],this.#s()}get data(){return this.#t}connected(){this.setAttribute("role","img");let t=this.getAttribute("data");if(t&&!this.#t.length)try{this.#t=JSON.parse(t)}catch{}this.#e||(this.#e=!0,this.addEventListener("pointerover",this.#l),this.addEventListener("pointermove",this.#u),this.addEventListener("pointerleave",this.#h),this.addEventListener("click",this.#c))}disconnected(){this.removeEventListener("pointerover",this.#l),this.removeEventListener("pointermove",this.#u),this.removeEventListener("pointerleave",this.#h),this.removeEventListener("click",this.#c),this.#e=!1,this.#i!=null&&(cancelAnimationFrame(this.#i),this.#i=null)}#i=null;#s(){!this.isConnected||this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=null,this.render()}))}#n(){let t=this.#t.map(r=>Number(r.v)||0);if(!t.length)return r=>0;let e=Math.min(...t),i=Math.max(...t);if(e===i)return r=>4;let n=this.scale;if(n==="log"){let r=Math.log(Math.max(1,e)),o=Math.log(Math.max(1,i));return a=>{let h=(Math.log(Math.max(1,Number(a)||0))-r)/(o-r);return Math.min(4,Math.max(0,Math.round(h*4)))}}if(n==="quantile"){let r=[...t].sort((l,h)=>l-h),o=l=>r[Math.floor(l*(r.length-1))],a=[o(.2),o(.4),o(.6),o(.8)];return l=>{let h=Number(l)||0;return h<=a[0]?0:h<=a[1]?1:h<=a[2]?2:h<=a[3]?3:4}}return r=>{let a=((Number(r)||0)-e)/(i-e);return Math.min(4,Math.max(0,Math.round(a*4)))}}render(){let t=Math.max(1,this.rows||7),e=Math.max(1,this.cols||12),i=new Map;for(let a of this.#t)a&&a.r!=null&&a.c!=null&&i.set(`${a.r},${a.c}`,a);let n=this.#n(),r=this.querySelector(':scope > [slot="title"]');if(this.replaceChildren(),r&&this.appendChild(r),this.type==="day-grid"&&this.startDate){let a=document.createElement("div");a.setAttribute("data-months","");let l=new Date(this.startDate);if(!Number.isNaN(l.getTime())){let h=[];for(let c=0;c<e;c++){let u=new Date(l);u.setDate(u.getDate()+c*7),(c===0||u.getDate()<=7)&&h.push({col:c,label:NM[u.getMonth()]})}for(let c of h){let u=document.createElement("span");u.setAttribute("data-month-label",""),u.style.gridColumn=String(c.col+1),u.textContent=c.label,a.appendChild(u)}}a.style.gridTemplateColumns=`repeat(${e}, minmax(0, 1fr))`,this.appendChild(a)}let o=document.createElement("div");o.setAttribute("data-grid",""),o.style.gridTemplateColumns=`repeat(${e}, minmax(0, 1fr))`,o.style.gridTemplateRows=`repeat(${t}, 1fr)`;for(let a=0;a<t;a++)for(let l=0;l<e;l++){let h=i.get(`${a},${l}`),c=document.createElement("div");if(c.setAttribute("data-cell",""),c.setAttribute("role","gridcell"),c.dataset.r=String(a),c.dataset.c=String(l),h!=null){let u=Number(h.v)||0,d=n(u);c.dataset.bucket=String(d),c.dataset.v=String(u),h.label&&c.setAttribute("aria-label",h.label)}else c.dataset.empty="";o.appendChild(c)}if(this.appendChild(o),!this.noLegend){let a=document.createElement("div");a.setAttribute("data-legend","");let l=document.createElement("span");l.setAttribute("data-legend-label",""),l.textContent="Less",a.appendChild(l);for(let c=0;c<5;c++){let u=document.createElement("span");u.setAttribute("data-legend-swatch",""),u.dataset.bucket=String(c),a.appendChild(u)}let h=document.createElement("span");h.setAttribute("data-legend-label",""),h.textContent="More",a.appendChild(h),this.appendChild(a)}}#r(t){return t?.closest?.("[data-cell]")}#o(t,e){let i=Number(t.dataset.r),n=Number(t.dataset.c),r=Number(t.dataset.v),o=t.getAttribute("aria-label")||"";return{r:i,c:n,label:o,value:Number.isFinite(r)?r:null,pct:null,series:null,slot:0,pointerX:e?.clientX??null,pointerY:e?.clientY??null}}#a=null;#l=t=>{let e=this.#r(t.target);if(!e||!e.dataset.v)return;this.#a=e;let i=this.#o(e,t);this.dispatchEvent(new CustomEvent("cell-hover",{detail:i,bubbles:!0})),this.dispatchEvent(new CustomEvent("chart-hover",{detail:i,bubbles:!0}))};#u=t=>{let e=this.#r(t.target);if(!e||!e.dataset.v){this.#a&&(this.#a=null,this.dispatchEvent(new CustomEvent("chart-leave",{bubbles:!0})));return}if(e!==this.#a){this.#a=e;let i=this.#o(e,t);this.dispatchEvent(new CustomEvent("cell-hover",{detail:i,bubbles:!0})),this.dispatchEvent(new CustomEvent("chart-hover",{detail:i,bubbles:!0}))}else{let i=this.#o(e,t);this.dispatchEvent(new CustomEvent("chart-hover",{detail:i,bubbles:!0}))}};#h=()=>{this.#a&&(this.#a=null,this.dispatchEvent(new CustomEvent("chart-leave",{bubbles:!0})))};#c=t=>{let e=this.#r(t.target);if(!e||!e.dataset.v)return;let i=this.#o(e,t);this.dispatchEvent(new CustomEvent("cell-click",{detail:i,bubbles:!0})),this.dispatchEvent(new CustomEvent("chart-select",{detail:i,bubbles:!0}))}};w("heatmap-ui",ko);var bk=new Set(["idle","active","done","error"]);function gg(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _M(s){return s<1e3?s+"ms":Math.round(s/1e3)+"s"}var $o=class extends A{static requiredIcons=["check-circle","circle","warning","warning-circle"];static properties={collapsed:{type:Boolean,default:!1,reflect:!0},noAutocollapse:{type:Boolean,default:!1,reflect:!0,attribute:"no-autocollapse"},heading:{type:String,default:"",reflect:!0},status:{type:String,default:"active",reflect:!0}};static template=()=>null;#t=[];#e=[];#i=Date.now();#s=null;#n=null;#r=null;#o=null;#a=!1;get entries(){return this.#t}connected(){this.#a||(this.#a=!0,this.#i=Date.now(),this.#s=setInterval(()=>this.#y(),1e3),this.#f())}#l=t=>{let e=t.target.closest("timeline-item-ui[data-step-id]");!e||!this.#o?.contains(e)||this.dispatchEvent(new CustomEvent("reasoning-step-toggle",{bubbles:!0,detail:{stepId:e.dataset.stepId}}))};disconnected(){this.#s!=null&&(clearInterval(this.#s),this.#s=null),this.#n!=null&&(clearTimeout(this.#n),this.#n=null),this.#r?.removeEventListener("click",this.#c),this.#r?.removeEventListener("keydown",this.#d),this.#o?.removeEventListener("timeline-toggle",this.#l),this.#r=null,this.#o=null,this.#a=!1}addStep(t){let e={kind:"step",status:"active",duration:null,outcomes:[],children:[],...t};return this.#u(e),this.#m(),e}updateStep(t,e){let i=this.#h(t);i&&(Object.assign(i,e),this.#m())}completeStep(t,e){let i=this.#h(t);i&&(i.status="done",e!=null&&(i.duration=e),this.#m())}failStep(t,e){let i=this.#h(t);i&&(i.status="error",e&&(i.outcomes=[...i.outcomes||[],String(e)]),this.#m())}addThought(t,e=`thought-${this.#t.length}`){this.#u({kind:"thought",id:e,text:t}),this.#m()}setPlan(t,e="plan"){let i=this.#t.find(n=>n.kind==="plan"&&n.id===e);i?i.items=t.slice():this.#t.push({kind:"plan",id:e,items:t.slice()}),this.#m()}startIteration(t,e=`Attempt ${t}`,i=`iter-${t}`){let n={kind:"iteration",id:i,n:t,label:e,status:"active",summary:"",steps:[]};return this.#t.push(n),this.#e.push(i),this.#m(),n}endIteration(t,{status:e="done",summary:i=""}={}){let n=`iter-${t}`,r=this.#t.find(a=>a.kind==="iteration"&&a.id===n);if(!r)return;r.status=e,r.summary=i;let o=this.#e.lastIndexOf(n);o>=0&&this.#e.splice(o,1),this.#m()}finish(t,{status:e="done"}={}){let i=bk.has(e)?e:"done",n=i==="error";for(let r of this.#t)if(r.kind==="step"&&r.status==="active"&&(r.status=n?"error":"done"),r.kind==="iteration"){r.status==="active"&&(r.status=n?"error":"done");for(let o of r.steps||[])o.status==="active"&&(o.status=n?"error":"done")}this.#s!=null&&(clearInterval(this.#s),this.#s=null),this.status=i,t&&(this.dataset.summary=t),this.#m(),this.dispatchEvent(new CustomEvent("reasoning-finish",{bubbles:!0,detail:{summary:t||"",status:i}})),this.#n!=null&&clearTimeout(this.#n),!this.noAutocollapse&&!n&&(this.#n=setTimeout(()=>{this.#n=null,this.collapsed=!0,this.#m()},1200))}fail(t){this.finish(t,{status:"error"})}#u(t){if(this.#e.length>0){let e=this.#e[this.#e.length-1],i=this.#t.find(n=>n.kind==="iteration"&&n.id===e);if(i){t.kind==="step"?i.steps.push(t):this.#t.push(t);return}}this.#t.push(t)}#h(t){for(let e of this.#t){if(e.kind==="step"&&e.id===t)return e;if(e.kind==="iteration"){for(let i of e.steps||[])if(i.id===t)return i}}return null}#c=()=>{this.collapsed=!this.collapsed,this.dispatchEvent(new CustomEvent("reasoning-toggle",{bubbles:!0,detail:{collapsed:this.collapsed}})),this.#m()};#d=t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.#c())};#f(){this.innerHTML="",this.#r=document.createElement("div"),this.#r.setAttribute("data-reasoning-summary",""),this.#r.setAttribute("role","button"),this.#r.setAttribute("tabindex","0"),this.#r.setAttribute("aria-expanded",String(!this.collapsed)),this.#r.addEventListener("click",this.#c),this.#r.addEventListener("keydown",this.#d),this.appendChild(this.#r),this.#o=document.createElement("div"),this.#o.setAttribute("data-reasoning-body",""),this.#o.addEventListener("timeline-toggle",this.#l),this.appendChild(this.#o),this.#m()}#p(){for(let e=this.#t.length-1;e>=0;e--){let i=this.#t[e];if(i.kind==="step"&&i.status==="active")return i.label;if(i.kind==="iteration")for(let n=(i.steps||[]).length-1;n>=0;n--){let r=i.steps[n];if(r.status==="active")return r.label}if(i.kind==="thought")return i.text}return this.#t.findLast?.(e=>e.kind==="step")?.label||this.heading||"Thinking\u2026"}#g(t){switch(t){case"done":return'<icon-ui name="check-circle" color="success" data-reasoning-check></icon-ui>';case"error":return'<icon-ui name="warning-circle" color="danger" data-reasoning-check data-error></icon-ui>';case"idle":return'<icon-ui name="circle" color="muted" data-reasoning-check data-idle></icon-ui>';default:return"<span data-reasoning-spinner></span>"}}#O(){let t=0,e=0,i=n=>{t++,n.status==="done"&&e++};for(let n of this.#t)if(n.kind==="step"&&i(n),n.kind==="iteration")for(let r of n.steps||[])i(r);return{total:t,done:e}}#m(){if(!this.#r)return;let t=bk.has(this.status)?this.status:"active",e=t==="done"||t==="error",{total:i,done:n}=this.#O(),r=Math.round((Date.now()-this.#i)/1e3),o=e&&this.dataset.summary?this.dataset.summary:this.#p();if(this.#r.innerHTML=`
223
+ ${this.#g(t)}
224
+ <span data-reasoning-label>${gg(o)}</span>
225
+ <span data-reasoning-meta>
226
+ ${i?`<span data-reasoning-counter>${n}/${i}</span>`:""}
227
+ <span data-reasoning-time>${r}s</span>
228
+ <icon-ui name="${this.collapsed?"caret-right":"caret-up"}" color="muted" data-reasoning-chevron></icon-ui>
229
+ </span>
230
+ `,this.#o.hidden=this.collapsed,this.#r.setAttribute("aria-expanded",String(!this.collapsed)),this.collapsed)return;this.#o.innerHTML="";let a=null;for(let l of this.#t)l.kind==="step"?(a||(a=this.#b(),this.#o.appendChild(a)),a.appendChild(this.#v(l))):(a=null,this.#o.appendChild(this.#S(l)))}#b(){let t=document.createElement("timeline-ui");return t.setAttribute("size","sm"),t}#v(t){let e=document.createElement("timeline-item-ui");e.setAttribute("text",t.label||""),t.status==="done"&&e.setAttribute("status","completed"),t.status==="error"&&e.setAttribute("status","error"),t.status==="active"&&(e.setAttribute("status","active"),e.setAttribute("spinner",""));let i=t.durationLabel||(t.duration!=null?_M(t.duration):"");return i&&e.setAttribute("duration",i),t.outcomes?.length&&(e.outcomes=t.outcomes),e.dataset.stepId=t.id||"",e}#S(t){switch(t.kind){case"thought":return this.#x(t);case"plan":return this.#w(t);case"iteration":return this.#k(t);default:return document.createTextNode("")}}#x(t){let e=document.createElement("div");e.setAttribute("data-reasoning-thought","");let i=document.createElement("span");return i.setAttribute("data-reasoning-thought-text",""),i.textContent=t.text||"",e.appendChild(i),e}#w(t){let e=document.createElement("div");e.setAttribute("data-reasoning-plan","");let i=document.createElement("div");i.setAttribute("data-reasoning-plan-label",""),i.textContent="Plan",e.appendChild(i);let n=document.createElement("ol");n.setAttribute("data-reasoning-plan-list","");for(let r of t.items||[]){let o=document.createElement("li");o.textContent=r,n.appendChild(o)}return e.appendChild(n),e}#k(t){let e=document.createElement("div");e.setAttribute("data-reasoning-iteration",""),t.status==="active"&&e.setAttribute("data-active",""),t.status==="done"&&e.setAttribute("data-done",""),t.status==="error"&&e.setAttribute("data-error","");let i=document.createElement("div");i.setAttribute("data-reasoning-iter-header","");let n=t.status==="done"?'<icon-ui name="check-circle" color="success" size="sm"></icon-ui>':t.status==="error"?'<icon-ui name="warning" color="danger" size="sm"></icon-ui>':"<span data-reasoning-spinner data-small></span>";if(i.innerHTML=`
231
+ ${n}
232
+ <span data-reasoning-iter-n>#${t.n}</span>
233
+ <span data-reasoning-iter-label>${gg(t.label||"")}</span>
234
+ ${t.summary?`<span data-reasoning-iter-summary>${gg(t.summary)}</span>`:""}
235
+ `,e.appendChild(i),t.steps?.length){let r=this.#b();for(let o of t.steps)r.appendChild(this.#v(o));e.appendChild(r)}return e}#y(){if(this.status==="done"||this.status==="error")return;let t=Math.round((Date.now()-this.#i)/1e3),e=this.#r?.querySelector("[data-reasoning-time]");e&&(e.textContent=t+"s");let i=t+"s";for(let n of this.querySelectorAll("timeline-item-ui[active]:not([completed])"))n.dataset._frozenDuration||n.setAttribute("duration",i)}};w("agent-reasoning-ui",$o);var Ua=class extends A{static requiredIcons=["caret-right","circle-fill"];static properties={collapsed:{type:Boolean,default:!1,reflect:!0},label:{type:String,default:"",reflect:!0}};static template=()=>null;#t=[];#e=[];#i=[];#s=null;get pills(){return this.#t}set pills(t){this.#t=Array.isArray(t)?t.slice():[],this.#o()}get metrics(){return this.#e}set metrics(t){this.#e=Array.isArray(t)?t.slice():[],this.#o()}get feedback(){return this.#i}set feedback(t){this.#i=Array.isArray(t)?t.slice():[],this.#o()}connected(){this.#r()}disconnected(){this.#s?.removeEventListener("toggle",this.#n),this.#s=null}#n=()=>{this.collapsed=!this.#s.hasAttribute("open"),this.dispatchEvent(new CustomEvent("trace-toggle",{bubbles:!0,detail:{collapsed:this.collapsed}}))};#r(){this.innerHTML="",this.#s=document.createElement("details"),this.#s.setAttribute("data-trace-root",""),this.collapsed||this.#s.setAttribute("open",""),this.#s.addEventListener("toggle",this.#n),this.appendChild(this.#s),this.#o()}#o(){if(!this.#s)return;let t=this.#t.length?this.#t.map(a=>this.#h(a)).join("<span data-trace-sep>\xB7</span>"):`<span>${Ui(this.label||"Trace")}</span>`,e=this.#e.some(a=>a.aux!=null&&String(a.aux).trim()!==""),i=this.#e.some(a=>this.#a(a)),n=this.#e.length?`
236
+ <div data-trace-headers>
237
+ <span data-trace-header>Stage</span>
238
+ <span data-trace-header>Score</span>
239
+ <span data-trace-header>${e?"Detail":""}</span>
240
+ ${i?'<span data-trace-header-spacer aria-hidden="true"></span>':""}
241
+ </div>
242
+ `:"",r=this.#e.map(a=>this.#l(a,i)).join(""),o=this.#i.length?`
243
+ <div data-trace-feedback>
244
+ <div data-trace-feedback-label>Training feedback</div>
245
+ ${this.#i.map(a=>`
246
+ <div data-trace-line>
247
+ <icon-ui name="${yk(a.icon||"circle")}" color="${yk(a.tone||"muted")}"></icon-ui>
248
+ <span>${Ui(a.text||"")}</span>
249
+ </div>
250
+ `).join("")}
251
+ </div>
252
+ `:"";this.#s.innerHTML=`
253
+ <summary>
254
+ <span data-trace-status>${t}</span>
255
+ <icon-ui name="caret-right" color="muted" size="sm" data-trace-chevron></icon-ui>
256
+ </summary>
257
+ <div data-trace-body>
258
+ ${this.#e.length?`<div data-trace-rows${i?" data-has-details":""}>${n}${r}</div>`:""}
259
+ ${o}
260
+ </div>
261
+ `}#a(t){let e=t?.details;return Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!1}#l(t,e){let i=Ui(t.label||""),n=Ui(t.value!=null?String(t.value):""),r=Ui(t.aux!=null?String(t.aux):""),o=this.#a(t),a=`
262
+ <span data-trace-label>${i}</span>
263
+ <span data-trace-value>${n}</span>
264
+ <span data-trace-aux>${r}</span>
265
+ ${e?o?'<icon-ui name="caret-right" color="muted" data-trace-row-chevron></icon-ui>':'<span data-trace-row-chevron-spacer aria-hidden="true"></span>':""}
266
+ `;return o?`
267
+ <details data-trace-row>
268
+ <summary>${a}</summary>
269
+ <div data-trace-row-body>${this.#u(t.details)}</div>
270
+ </details>
271
+ `:`<div data-trace-row>${a}</div>`}#u(t){return Array.isArray(t)?`
272
+ <dl data-trace-dl>
273
+ ${t.map(e=>`
274
+ <dt>${Ui(e.label||"")}</dt>
275
+ <dd>${Ui(e.value!=null?String(e.value):"")}</dd>
276
+ `).join("")}
277
+ </dl>
278
+ `:typeof t=="string"?t:""}#h(t){let e=t.tone||"neutral",i={success:"var(--a-success-strong)",warning:"var(--a-warning-strong)",danger:"var(--a-danger-strong)",info:"var(--a-accent-strong)",neutral:"var(--a-fg-muted)"}[e]||"var(--a-fg-muted)",n=t.dot===!1?"":`<icon-ui name="circle-fill" data-trace-dot style="color:${i}"></icon-ui>`,r=t.label!=null?String(t.label):"",o=t.value!=null?String(t.value):"",a=o?`${o}${r?` ${r}`:""}`:r;return`<span data-trace-pill>${n}<span>${Ui(a)}</span></span>`}};function Ui(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yk(s){return String(s).replace(/"/g,"&quot;")}customElements.define("agent-trace-ui",Ua);function Og({icon:s,text:t="",title:e=""}){let i=document.createElement("button-ui");return i.setAttribute("icon",s),i.setAttribute("variant","ghost"),i.setAttribute("size","sm"),t&&i.setAttribute("text",t),!t&&e&&i.setAttribute("title",e),i}var Ao=class extends A{static properties={saveLabel:{type:String,default:"",reflect:!0,attribute:"save-label"},saveIcon:{type:String,default:"bookmark-simple",reflect:!0,attribute:"save-icon"},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=!1;#r=!1;connected(){this.#c()}disconnected(){this.#t?.removeEventListener("press",this.#o),this.#e?.removeEventListener("press",this.#a),this.#i?.removeEventListener("press",this.#l),this.#t=this.#e=this.#i=this.#s=null}setStatus(t,{lock:e=""}={}){this.#s&&(this.#s.textContent=t||"",(e==="rate"||e==="all")&&(this.#n=!0,this.#t&&(this.#t.disabled=!0),this.#e&&(this.#e.disabled=!0)),(e==="save"||e==="all")&&(this.#r=!0,this.#i&&(this.#i.disabled=!0)))}reset(){this.#n=!1,this.#r=!1,this.#s&&(this.#s.textContent=""),this.#t&&(this.#t.disabled=!1),this.#e&&(this.#e.disabled=!1),this.#i&&(this.#i.disabled=!1)}#o=()=>{!this.#n&&!this.disabled&&this.#u(5)};#a=()=>{!this.#n&&!this.disabled&&this.#u(2)};#l=()=>{!this.#r&&!this.disabled&&this.#h()};#u(t){this.dispatchEvent(new CustomEvent("feedback-rate",{bubbles:!0,detail:{rating:t}})),this.#s?.textContent||this.setStatus(t>=4?"Thanks!":"Noted",{lock:"rate"})}#h(){this.dispatchEvent(new CustomEvent("feedback-save",{bubbles:!0,detail:{}}))}render(){let t=this.saveLabel,e=this.saveIcon;this.#i&&(t?(this.#i.setAttribute("text",t),this.#i.hidden=!1):this.#i.hidden=!0,e&&this.#i.setAttribute("icon",e))}#c(){this.innerHTML="",this.#t=Og({icon:"thumbs-up",title:"Rate this response positively"}),this.#e=Og({icon:"thumbs-down",title:"Rate this response negatively"}),this.#i=Og({icon:this.saveIcon||"bookmark-simple",text:this.saveLabel||"",title:this.saveLabel?"":"Save this response"}),this.saveLabel||(this.#i.hidden=!0),this.#t.addEventListener("press",this.#o),this.#e.addEventListener("press",this.#a),this.#i.addEventListener("press",this.#l),this.#s=document.createElement("span"),this.#s.setAttribute("data-feedback-status",""),this.append(this.#t,this.#e,this.#i,this.#s)}};w("agent-feedback-bar-ui",Ao);function VM(s,t){return typeof s!="string"?"":s.length>t?s.slice(0,t-1)+"\u2026":s}var Qo=class extends A{static properties={variant:{type:String,default:"outline",reflect:!0},size:{type:String,default:"sm",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=[];get suggestions(){return this.#t}set suggestions(t){this.#t=Array.isArray(t)?t.slice():[],this.#e()}connected(){this.#e()}disconnected(){this.innerHTML=""}#e(){this.innerHTML="";for(let t=0;t<this.#t.length;t++){let e=this.#t[t],i=typeof e=="string"?e:e.label||e.prompt||"",n=typeof e=="string"?e:e.prompt||e.label||"",r=typeof e=="object"?e.icon:null,o=document.createElement("button-ui");o.setAttribute("text",VM(i,42)),o.setAttribute("variant",this.variant),o.setAttribute("size",this.size),r&&o.setAttribute("icon",r),this.disabled&&o.setAttribute("disabled",""),o.addEventListener("press",()=>{this.disabled||this.dispatchEvent(new CustomEvent("suggestion-select",{bubbles:!0,detail:{label:i,prompt:n,index:t}}))}),this.appendChild(o)}}};w("agent-suggestions-ui",Qo);function vk(s){return String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WM(s){return String(s).replace(/"/g,"&quot;")}var Po=class extends A{static requiredIcons=["check"];static properties={multi:{type:Boolean,default:!1,reflect:!0},question:{type:String,default:"",reflect:!0},helper:{type:String,default:"",reflect:!0},submitLabel:{type:String,default:"Continue",reflect:!0,attribute:"submit-label"}};static template=()=>null;#t=[];#e=new Set;#i=!1;#s=null;#n=null;#r=null;#o=null;get options(){return this.#t}set options(t){this.#t=Array.isArray(t)?t.slice():[],this.#e.clear(),this.#i=!1,this.#l()}connected(){this.#a()}disconnected(){this.#o?.removeEventListener("press",this.#h),this.#s=this.#n=this.#r=this.#o=null}render(){this.#s&&(this.#s.textContent=this.question||"",this.#s.hidden=!this.question),this.#n&&(this.#n.textContent=this.helper||"",this.#n.hidden=!this.helper),this.#o&&(this.#o.setAttribute("text",this.submitLabel||"Continue"),this.#o.hidden=!this.multi)}#a(){this.innerHTML="",this.#s=document.createElement("div"),this.#s.setAttribute("data-questions-q",""),this.question?this.#s.textContent=this.question:this.#s.hidden=!0,this.#n=document.createElement("div"),this.#n.setAttribute("data-questions-helper",""),this.helper?this.#n.textContent=this.helper:this.#n.hidden=!0,this.#r=document.createElement("div"),this.#r.setAttribute("data-questions-options",""),this.#o=document.createElement("button-ui"),this.#o.setAttribute("text",this.submitLabel||"Continue"),this.#o.setAttribute("variant","primary"),this.#o.setAttribute("size","sm"),this.#o.setAttribute("disabled",""),this.multi||(this.#o.hidden=!0),this.#o.addEventListener("press",this.#h),this.append(this.#s,this.#n,this.#r,this.#o),this.#l()}#l(){if(this.#r){this.#r.innerHTML="";for(let t of this.#t){let e=document.createElement("button");e.type="button",e.setAttribute("data-questions-option",""),e.setAttribute("role",this.multi?"checkbox":"radio"),e.setAttribute("aria-checked",this.#e.has(t.id)?"true":"false"),this.#e.has(t.id)&&e.setAttribute("data-selected",""),this.#i&&e.setAttribute("disabled","");let i=t.icon?`<icon-ui name="${WM(t.icon)}" color="muted" data-questions-option-icon></icon-ui>`:"",n=`
279
+ <span data-questions-option-check aria-hidden="true">
280
+ <icon-ui name="check" size="sm" color="accent"></icon-ui>
281
+ </span>`;e.innerHTML=`
282
+ ${i}
283
+ <span data-questions-option-body>
284
+ <span data-questions-option-label>${vk(t.label||"")}</span>
285
+ ${t.description?`<span data-questions-option-desc>${vk(t.description)}</span>`:""}
286
+ </span>
287
+ ${n}
288
+ `,e.addEventListener("click",()=>this.#u(t)),this.#r.appendChild(e)}this.#o&&(this.#o.disabled=this.#i||this.#e.size===0)}}#u(t){this.#i||(this.multi?(this.#e.has(t.id)?this.#e.delete(t.id):this.#e.add(t.id),this.#l()):(this.#e.clear(),this.#e.add(t.id),this.#i=!0,this.#l(),this.dispatchEvent(new CustomEvent("questions-answer",{bubbles:!0,detail:{selected:[t.id],option:t}}))))}#h=()=>{if(this.#i||this.#e.size===0)return;this.#i=!0,this.#l();let t=[...this.#e],e=this.#t.find(i=>i.id===t[0])||null;this.dispatchEvent(new CustomEvent("questions-answer",{bubbles:!0,detail:{selected:t,option:e}}))}};w("agent-questions-ui",Po);var xk={neutral:"default",accent:"accent",warning:"warning",danger:"danger"},Co=class extends A{static properties={title:{type:String,default:"",reflect:!0},kind:{type:String,default:"",reflect:!0},icon:{type:String,default:"",reflect:!0},collapsed:{type:Boolean,default:!1,reflect:!0},tone:{type:String,default:"neutral",reflect:!0}};static requiredIcons=["caret-right","caret-down"];static template=()=>null;#t=null;#e=null;#i=null;#s=null;#n=null;#r=null;connected(){this.#l()}disconnected(){this.#t?.removeEventListener("click",this.#o),this.#t?.removeEventListener("keydown",this.#a),this.#t=this.#e=this.#i=null,this.#s=this.#n=this.#r=null}#o=t=>{t.target.closest('[slot="primary"], [slot="secondary"]')||(this.collapsed=!this.collapsed,this.dispatchEvent(new CustomEvent("artifact-toggle",{bubbles:!0,detail:{collapsed:this.collapsed}})),this.render())};#a=t=>{if(t.key===" "||t.key==="Enter"){if(t.target.closest('[slot="primary"], [slot="secondary"]'))return;t.preventDefault(),this.#o(t)}};render(){this.#t&&(this.#e&&(this.icon?(this.#e.setAttribute("name",this.icon),this.#e.hidden=!1):this.#e.hidden=!0),this.#i&&(this.#i.textContent=this.title||"",this.#i.hidden=!this.title),this.#s&&(this.#s.setAttribute("text",(this.kind||"").toUpperCase()),this.#s.setAttribute("variant",xk[this.tone]||"default"),this.#s.hidden=!this.kind),this.#n&&this.#n.setAttribute("name",this.collapsed?"caret-right":"caret-down"),this.#r&&(this.#r.hidden=this.collapsed),this.#t&&this.#t.setAttribute("aria-expanded",String(!this.collapsed)))}#l(){let t=Array.from(this.childNodes).filter(r=>{if(r.nodeType===1){let o=r.getAttribute?.("slot")||"";return o!=="primary"&&o!=="secondary"}return!0}),e=this.querySelectorAll(':scope > [slot="primary"]'),i=this.querySelectorAll(':scope > [slot="secondary"]');this.innerHTML="",this.#t=document.createElement("div"),this.#t.setAttribute("data-artifact-header",""),this.#t.setAttribute("role","button"),this.#t.setAttribute("tabindex","0"),this.#t.setAttribute("aria-expanded",String(!this.collapsed)),this.#t.addEventListener("click",this.#o),this.#t.addEventListener("keydown",this.#a),this.#e=document.createElement("icon-ui"),this.#e.setAttribute("data-artifact-icon",""),this.#e.setAttribute("color","muted"),this.icon?this.#e.setAttribute("name",this.icon):this.#e.hidden=!0,this.#i=document.createElement("span"),this.#i.setAttribute("data-artifact-title",""),this.title?this.#i.textContent=this.title:this.#i.hidden=!0,this.#s=document.createElement("badge-ui"),this.#s.setAttribute("data-artifact-kind",""),this.#s.setAttribute("size","sm"),this.#s.setAttribute("variant",xk[this.tone]||"default"),this.kind?this.#s.setAttribute("text",this.kind.toUpperCase()):this.#s.hidden=!0;let n=document.createElement("span");n.setAttribute("data-artifact-actions","");for(let r of i)n.appendChild(r);for(let r of e)n.appendChild(r);this.#n=document.createElement("icon-ui"),this.#n.setAttribute("color","muted"),this.#n.setAttribute("data-artifact-chevron",""),this.#n.setAttribute("name",this.collapsed?"caret-right":"caret-down"),this.#t.append(this.#e,this.#i,this.#s,n,this.#n),this.#r=document.createElement("div"),this.#r.setAttribute("data-artifact-body","");for(let r of t)this.#r.appendChild(r);this.collapsed&&(this.#r.hidden=!0),this.append(this.#t,this.#r)}};w("agent-artifact-ui",Co);export{Jn as UIAccordion,tr as UIAccordionItem,eo as UIActionItem,to as UIActionList,Co as UIAgentArtifact,Ao as UIAgentFeedbackBar,Po as UIAgentQuestions,$o as UIAgentReasoning,Qo as UIAgentSuggestions,Ua as UIAgentTrace,Bn as UIAlert,Xn as UIAvatar,In as UIAvatarGroup,On as UIBadge,ro as UIBlock,bn as UIBreadcrumb,Vs as UIButton,so as UICalendarPicker,Yc as UICanvas,Rn as UICard,Gn as UIChart,Hn as UIChartLegend,Mo as UIChatInput,cn as UIChatThread,Fs as UICheck,qr as UICode,_n as UICol,Sn as UIColorInput,xn as UIColorPicker,yn as UICommand,co as UIDemoToggle,wo as UIDescriptionList,er as UIDivider,un as UIDrawer,no as UIEmbed,io as UIEmptyState,Xe as UIFeed,fn as UIFeedContainer,pn as UIFeedItem,Vn as UIField,Wn as UIFields,Un as UIGrid,ko as UIHeatmap,_s as UIIcon,Hr as UIImage,Ys as UIInput,vo as UIInspector,zn as UIKbd,Ws as UILink,Br as UIList,zr as UIListItem,jr as UIMenu,_r as UIMenuDivider,Nr as UIMenuItem,dn as UIModal,Yr as UINav,Ur as UINavGroup,Fr as UINavItem,wn as UINoodles,Hs as UIOptionCard,Gr as UIOtpInput,ln as UIPage,ir as UIPagination,an as UIPane,xo as UIPipelineStatus,Kn as UIPopover,Zn as UIProgress,Jr as UIProgressRow,Gs as UIRadio,nn as UIRange,So as UIRating,uo as UIRichText,Yn as UIRow,Kr as UISearch,en as UISegment,sn as UISegmented,tn as UISelect,qn as UISkeleton,Js as UISlider,Fn as UIStack,Va as UIStat,Dn as UIStepProgress,Cn as UIStepper,En as UIStepperItem,fo as UIStream,Nn as UISwatch,Tn as UISwiper,Ks as UISwitch,Ro as UITab,$n as UITable,An as UITableToolbar,mn as UITabs,jn as UITag,oo as UIText,Us as UITextarea,Qn as UITimeline,Pn as UITimelineItem,Ji as UIToast,lo as UIToggleGroup,ao as UIToggleOption,ho as UIToggleScheme,Vr as UIToolbar,Wr as UIToolbarGroup,gn as UITooltip,rn as UITree,on as UITreeItem,Ln as UIUpload};