import { f as fallback } from './async-Mo2Ia14K.js';
import { f as attr_class, g as stringify, c as bind_props, b as spread_props } from './index-D1Ptw7Az.js';
import { l as w$1, o as h, e as y, g, c as G$1, a as U$1, t as e } from './2-B89dC7Mi.js';
import { i } from './Code-DrWuNqT0.js';
import { o as onDestroy } from './spring-DE8vsW2o.js';
import { B, W as Wu, T as T$1, X as Xi, j as jt$1, P as Pe, s as st$1, J, z as zt$1, A as A$1, G as G$2, n as ns, v, L as Lu, a as Wr$1, V, w as wu, g as gu, R as Ru, p as pu, b as W, c as Bu, d as bu, y as yu, f as ff, E as Eu, H as Hl, O as Oc, x as xn$1, e as Tc, h as H$1, i as yt, k as ce$1, l as vu, _ as _$1, N as Nt$2, I as I$1, $ as $t$1, m as Nu, o as $i, q as Wl, r as Iu } from './Code.svelte_svelte_type_style_lang-UrlqsTby.js';
import { N as Nt$1, U as Ut$1, k as kt } from './index11-BkmLh3k5.js';
import { l } from './Download-CXUtRxuu.js';
import { u } from './DownloadLink-CHK0Lliu.js';
import { k } from './BlockLabel-qrJKniS-.js';
import { p } from './Empty-DPmCPCDI.js';
export { default as BaseExample } from './Example2-C1QB7oes.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import 'path';
import 'url';
import 'fs';

function N(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)){var l=n[o];typeof l=="string"?e.setAttribute(o,l):l!=null&&(e[o]=l);}t++;}for(;t<arguments.length;t++)Dt(e,arguments[t]);return e}function Dt(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)Dt(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}const dn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),o=Ue(e.state,n.from);return o.line?mn(e):o.block?gn(e):false};function Fe(e,t){return ({state:n,dispatch:o})=>{if(n.readOnly)return  false;let l=e(t,n);return l?(o(n.update(l)),true):false}}const mn=Fe(yn,0),hn=Fe(Lt,0),gn=Fe((e,t)=>Lt(e,t,bn(t)),0);function Ue(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Q=50;function pn(e,{open:t,close:n},o,l){let r=e.sliceDoc(o-Q,o),i=e.sliceDoc(l,l+Q),s=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(i)[0].length,u=r.length-s;if(r.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return {open:{pos:o-s,margin:s&&1},close:{pos:l+c,margin:c&&1}};let f,d;l-o<=2*Q?f=d=e.sliceDoc(o,l):(f=e.sliceDoc(o,o+Q),d=e.sliceDoc(l-Q,l));let h=/^\s*/.exec(f)[0].length,m=/\s*$/.exec(d)[0].length,g=d.length-m-n.length;return f.slice(h,h+t.length)==t&&d.slice(g,g+n.length)==n?{open:{pos:o+h+t.length,margin:/\s/.test(f.charAt(h+t.length))?1:0},close:{pos:l-m-n.length,margin:/\s/.test(d.charAt(g-1))?1:0}}:null}function bn(e){let t=[];for(let n of e.selection.ranges){let o=e.doc.lineAt(n.from),l=n.to<=o.to?o:e.doc.lineAt(n.to);l.from>o.from&&l.from==n.to&&(l=n.to==o.to+1?o:e.doc.lineAt(n.to-1));let r=t.length-1;r>=0&&t[r].to>o.from?t[r].to=l.to:t.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:l.to});}return t}function Lt(e,t,n=t.selection.ranges){let o=n.map(r=>Ue(t,r.from).block);if(!o.every(r=>r))return null;let l=n.map((r,i)=>pn(t,o[i],r.from,r.to));if(e!=2&&!l.every(r=>r))return {changes:t.changes(n.map((r,i)=>l[i]?[]:[{from:r.from,insert:o[i].open+" "},{from:r.to,insert:" "+o[i].close}]))};if(e!=1&&l.some(r=>r)){let r=[];for(let i=0,s;i<l.length;i++)if(s=l[i]){let c=o[i],{open:u,close:f}=s;r.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:f.pos-f.margin,to:f.pos+c.close.length});}return {changes:r}}return null}function yn(e,t,n=t.selection.ranges){let o=[],l=-1;for(let{from:r,to:i}of n){let s=o.length,c=1e9,u=Ue(t,r).line;if(u){for(let f=r;f<=i;){let d=t.doc.lineAt(f);if(d.from>l&&(r==i||i>d.from)){l=d.from;let h=/^\s*/.exec(d.text)[0].length,m=h==d.length,g=d.text.slice(h,h+u.length)==u?h:-1;h<d.text.length&&h<c&&(c=h),o.push({line:d,comment:g,token:u,indent:h,empty:m,single:false});}f=d.to+1;}if(c<1e9)for(let f=s;f<o.length;f++)o[f].indent<o[f].line.text.length&&(o[f].indent=c);o.length==s+1&&(o[s].single=true);}}if(e!=2&&o.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:s,token:c,indent:u,empty:f,single:d}of o)(d||!f)&&r.push({from:s.from+u,insert:c+" "});let i=t.changes(r);return {changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&o.some(r=>r.comment>=0)){let r=[];for(let{line:i,comment:s,token:c}of o)if(s>=0){let u=i.from+s,f=u+c.length;i.text[f-i.from]==" "&&f++,r.push({from:u,to:f});}return {changes:r}}return null}const _e=Pe.define(),kn=Pe.define(),xn=T$1.define(),wt=T$1.define({combine(e){return Xi(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(o,l)=>t(o,l)||n(o,l)})}}),_t=jt$1.define({create(){return F.empty},update(e,t){let n=t.state.facet(wt),o=t.annotation(_e);if(o){let c=D.fromTransaction(t,o.selection),u=o.side,f=u==0?e.undone:e.done;return c?f=me(f,f.length,n.minDepth,c):f=Et(f,t.startState.selection),new F(u==0?o.rest:f,u==0?f:o.rest)}let l=t.annotation(kn);if((l=="full"||l=="before")&&(e=e.isolate()),t.annotation(st$1.addToHistory)===false)return t.changes.empty?e:e.addMapping(t.changes.desc);let r=D.fromTransaction(t),i=t.annotation(st$1.time),s=t.annotation(st$1.userEvent);return r?e=e.addChanges(r,i,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,s,n.newGroupDelay)),(l=="full"||l=="after")&&(e=e.isolate()),e},toJSON(e){return {done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new F(e.done.map(D.fromJSON),e.undone.map(D.fromJSON))}});function Cn(e={}){return [_t,wt.of(e),B.domEventHandlers({beforeinput(t,n){let o=t.inputType=="historyUndo"?Mt:t.inputType=="historyRedo"?Me:null;return o?(t.preventDefault(),o(n)):false}})]}function he(e,t){return function({state:n,dispatch:o}){if(!t&&n.readOnly)return  false;let l=n.field(_t,false);if(!l)return  false;let r=l.pop(e,n,t);return r?(o(r),true):false}}const Mt=he(0,false),Me=he(1,false),Bn=he(0,true),Sn=he(1,true);class D{constructor(t,n,o,l,r){this.changes=t,this.effects=n,this.mapped=o,this.startSelection=l,this.selectionsAfter=r;}setSelAfter(t){return new D(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,o;return {changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(o=this.startSelection)===null||o===void 0?void 0:o.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(t){return new D(t.changes&&J.fromJSON(t.changes),[],t.mapped&&zt$1.fromJSON(t.mapped),t.startSelection&&A$1.fromJSON(t.startSelection),t.selectionsAfter.map(A$1.fromJSON))}static fromTransaction(t,n){let o=_;for(let l of t.startState.facet(xn)){let r=l(t);r.length&&(o=o.concat(r));}return !o.length&&t.changes.empty?null:new D(t.changes.invert(t.startState.doc),o,void 0,n||t.startState.selection,_)}static selection(t){return new D(void 0,_,void 0,void 0,t)}}function me(e,t,n,o){let l=t+1>n+20?t-n-1:0,r=e.slice(l,t);return r.push(o),r}function An(e,t){let n=[],o=false;return e.iterChangedRanges((l,r)=>n.push(l,r)),t.iterChangedRanges((l,r,i,s)=>{for(let c=0;c<n.length;){let u=n[c++],f=n[c++];s>=u&&i<=f&&(o=true);}}),o}function vn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,o)=>n.empty!=t.ranges[o].empty).length===0}function Tt(e,t){return e.length?t.length?e.concat(t):e:t}const _=[],Dn=200;function Et(e,t){if(e.length){let n=e[e.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Dn));return o.length&&o[o.length-1].eq(t)?e:(o.push(t),me(e,e.length-1,1e9,n.setSelAfter(o)))}else return [D.selection([t])]}function Ln(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function ye(e,t){if(!e.length)return e;let n=e.length,o=_;for(;n;){let l=wn(e[n-1],t,o);if(l.changes&&!l.changes.empty||l.effects.length){let r=e.slice(0,n);return r[n-1]=l,r}else t=l.mapped,n--,o=l.selectionsAfter;}return o.length?[D.selection(o)]:_}function wn(e,t,n){let o=Tt(e.selectionsAfter.length?e.selectionsAfter.map(s=>s.map(t)):_,n);if(!e.changes)return D.selection(o);let l=e.changes.map(t),r=t.mapDesc(e.changes,true),i=e.mapped?e.mapped.composeDesc(r):r;return new D(l,G$2.mapEffects(e.effects,t),i,e.startSelection.map(r),o)}const _n=/^(input\.type|delete)($|\.)/;class F{constructor(t,n,o=0,l=void 0){this.done=t,this.undone=n,this.prevTime=o,this.prevUserEvent=l;}isolate(){return this.prevTime?new F(this.done,this.undone):this}addChanges(t,n,o,l,r){let i=this.done,s=i[i.length-1];return s&&s.changes&&!s.changes.empty&&t.changes&&(!o||_n.test(o))&&(!s.selectionsAfter.length&&n-this.prevTime<l.newGroupDelay&&l.joinToEvent(r,An(s.changes,t.changes))||o=="input.type.compose")?i=me(i,i.length-1,l.minDepth,new D(t.changes.compose(s.changes),Tt(G$2.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,_)):i=me(i,i.length,l.minDepth,t),new F(i,_,n,o)}addSelection(t,n,o,l){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:_;return r.length>0&&n-this.prevTime<l&&o==this.prevUserEvent&&o&&/^select($|\.)/.test(o)&&vn(r[r.length-1],t)?this:new F(Et(this.done,t),this.undone,n,o)}addMapping(t){return new F(ye(this.done,t),ye(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,o){let l=t==0?this.done:this.undone;if(l.length==0)return null;let r=l[l.length-1],i=r.selectionsAfter[0]||n.selection;if(o&&r.selectionsAfter.length)return n.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:_e.of({side:t,rest:Ln(l),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:true});if(r.changes){let s=l.length==1?_:l.slice(0,l.length-1);return r.mapped&&(s=ye(s,r.mapped)),n.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:_e.of({side:t,rest:s,selection:i}),filter:false,userEvent:t==0?"undo":"redo",scrollIntoView:true})}else return null}}F.empty=new F(_,_);const Mn=[{key:"Mod-z",run:Mt,preventDefault:true},{key:"Mod-y",mac:"Mod-Shift-z",run:Me,preventDefault:true},{linux:"Ctrl-Shift-z",run:Me,preventDefault:true},{key:"Mod-u",run:Bn,preventDefault:true},{key:"Alt-u",mac:"Mod-Shift-u",run:Sn,preventDefault:true}];function j(e,t){return A$1.create(e.ranges.map(t),e.mainIndex)}function E(e,t){return e.update({selection:t,scrollIntoView:true,userEvent:"select"})}function I({state:e,dispatch:t},n){let o=j(e.selection,n);return o.eq(e.selection,true)?false:(t(E(e,o)),true)}function ge(e,t){return A$1.cursor(t?e.to:e.from)}function It(e,t){return I(e,n=>n.empty?e.moveByChar(n,t):ge(n,t))}function A(e){return e.textDirectionAt(e.state.selection.main.head)==_$1.LTR}const Rt=e=>It(e,!A(e)),Ot=e=>It(e,A(e));function Pt(e,t){return I(e,n=>n.empty?e.moveByGroup(n,t):ge(n,t))}const Tn=e=>Pt(e,!A(e)),En=e=>Pt(e,A(e));function In(e,t,n){if(t.type.prop(n))return  true;let o=t.to-t.from;return o&&(o>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function pe(e,t,n){let o=Nt$2(e).resolveInner(t.head),l=n?I$1.closedBy:I$1.openedBy;for(let c=t.head;;){let u=n?o.childAfter(c):o.childBefore(c);if(!u)break;In(e,u,l)?o=u:c=n?u.to:u.from;}let r=o.type.prop(l),i,s;return r&&(i=n?Nu(e,o.from,1):Nu(e,o.to,-1))&&i.matched?s=n?i.end.to:i.end.from:s=n?o.to:o.from,A$1.cursor(s,n?-1:1)}const Rn=e=>I(e,t=>pe(e.state,t,!A(e))),On=e=>I(e,t=>pe(e.state,t,A(e)));function Nt(e,t){return I(e,n=>{if(!n.empty)return ge(n,t);let o=e.moveVertically(n,t);return o.head!=n.head?o:e.moveToLineBoundary(n,t)})}const Ft=e=>Nt(e,false),Ut=e=>Nt(e,true);function Vt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,o=0,l;if(t){for(let r of e.state.facet(B.scrollMargins)){let i=r(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(o=Math.max(i?.bottom,o));}l=e.scrollDOM.clientHeight-n-o;}else l=(e.dom.ownerDocument.defaultView||window).innerHeight;return {marginTop:n,marginBottom:o,selfScroll:t,height:Math.max(e.defaultLineHeight,l-5)}}function Gt(e,t){let n=Vt(e),{state:o}=e,l=j(o.selection,i=>i.empty?e.moveVertically(i,t,n.height):ge(i,t));if(l.eq(o.selection))return  false;let r;if(n.selfScroll){let i=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),c=s.top+n.marginTop,u=s.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(r=B.scrollIntoView(l.main.head,{y:"start",yMargin:i.top-c}));}return e.dispatch(E(o,l),{effects:r}),true}const Ke=e=>Gt(e,false),Te=e=>Gt(e,true);function U(e,t,n){let o=e.lineBlockAt(t.head),l=e.moveToLineBoundary(t,n);if(l.head==t.head&&l.head!=(n?o.to:o.from)&&(l=e.moveToLineBoundary(t,n,false)),!n&&l.head==o.from&&o.length){let r=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;r&&t.head!=o.from+r&&(l=A$1.cursor(o.from+r));}return l}const Pn=e=>I(e,t=>U(e,t,true)),Nn=e=>I(e,t=>U(e,t,false)),Fn=e=>I(e,t=>U(e,t,!A(e))),Un=e=>I(e,t=>U(e,t,A(e))),Vn=e=>I(e,t=>A$1.cursor(e.lineBlockAt(t.head).from,1)),Gn=e=>I(e,t=>A$1.cursor(e.lineBlockAt(t.head).to,-1));function Hn(e,t,n){let o=false,l=j(e.selection,r=>{let i=Nu(e,r.head,-1)||Nu(e,r.head,1)||r.head>0&&Nu(e,r.head-1,1)||r.head<e.doc.length&&Nu(e,r.head+1,-1);if(!i||!i.end)return r;o=true;let s=i.start.from==r.head?i.end.to:i.end.from;return A$1.cursor(s)});return o?(t(E(e,l)),true):false}const Wn=({state:e,dispatch:t})=>Hn(e,t);function M(e,t){let n=j(e.state.selection,o=>{let l=t(o);return A$1.range(o.anchor,l.head,l.goalColumn,l.bidiLevel||void 0)});return n.eq(e.state.selection)?false:(e.dispatch(E(e.state,n)),true)}function Ht(e,t){return M(e,n=>e.moveByChar(n,t))}const Wt=e=>Ht(e,!A(e)),qt=e=>Ht(e,A(e));function zt(e,t){return M(e,n=>e.moveByGroup(n,t))}const qn=e=>zt(e,!A(e)),zn=e=>zt(e,A(e)),Jn=e=>M(e,t=>pe(e.state,t,!A(e))),Kn=e=>M(e,t=>pe(e.state,t,A(e)));function Jt(e,t){return M(e,n=>e.moveVertically(n,t))}const Kt=e=>Jt(e,false),jt=e=>Jt(e,true);function Yt(e,t){return M(e,n=>e.moveVertically(n,t,Vt(e).height))}const je=e=>Yt(e,false),Ye=e=>Yt(e,true),jn=e=>M(e,t=>U(e,t,true)),Yn=e=>M(e,t=>U(e,t,false)),Zn=e=>M(e,t=>U(e,t,!A(e))),Qn=e=>M(e,t=>U(e,t,A(e))),Xn=e=>M(e,t=>A$1.cursor(e.lineBlockAt(t.head).from)),$n=e=>M(e,t=>A$1.cursor(e.lineBlockAt(t.head).to)),Ze=({state:e,dispatch:t})=>(t(E(e,{anchor:0})),true),Qe=({state:e,dispatch:t})=>(t(E(e,{anchor:e.doc.length})),true),Xe=({state:e,dispatch:t})=>(t(E(e,{anchor:e.selection.main.anchor,head:0})),true),$e=({state:e,dispatch:t})=>(t(E(e,{anchor:e.selection.main.anchor,head:e.doc.length})),true),er=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),true),tr=({state:e,dispatch:t})=>{let n=be(e).map(({from:o,to:l})=>A$1.range(o,Math.min(l+1,e.doc.length)));return t(e.update({selection:A$1.create(n),userEvent:"select"})),true},or=({state:e,dispatch:t})=>{let n=j(e.selection,o=>{let l=Nt$2(e),r=l.resolveStack(o.from,1);if(o.empty){let i=l.resolveStack(o.from,-1);i.node.from>=r.node.from&&i.node.to<=r.node.to&&(r=i);}for(let i=r;i;i=i.next){let{node:s}=i;if((s.from<o.from&&s.to>=o.to||s.to>o.to&&s.from<=o.from)&&i.next)return A$1.range(s.to,s.from)}return o});return n.eq(e.selection)?false:(t(E(e,n)),true)};function Zt(e,t){let{state:n}=e,o=n.selection,l=n.selection.ranges.slice();for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head);if(t?i.to<e.state.doc.length:i.from>0)for(let s=r;;){let c=e.moveVertically(s,t);if(c.head<i.from||c.head>i.to){l.some(u=>u.head==c.head)||l.push(c);break}else {if(c.head==s.head)break;s=c;}}}return l.length==o.ranges.length?false:(e.dispatch(E(n,A$1.create(l,l.length-1))),true)}const nr=e=>Zt(e,false),rr=e=>Zt(e,true),lr=({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=A$1.create([n.main]):n.main.empty||(o=A$1.create([A$1.cursor(n.main.head)])),o?(t(E(e,o)),true):false};function re(e,t){if(e.state.readOnly)return  false;let n="delete.selection",{state:o}=e,l=o.changeByRange(r=>{let{from:i,to:s}=r;if(i==s){let c=t(r);c<i?(n="delete.backward",c=ie(e,c,false)):c>i&&(n="delete.forward",c=ie(e,c,true)),i=Math.min(i,c),s=Math.max(s,c);}else i=ie(e,i,false),s=ie(e,s,true);return i==s?{range:r}:{changes:{from:i,to:s},range:A$1.cursor(i,i<r.head?-1:1)}});return l.changes.empty?false:(e.dispatch(o.update(l,{scrollIntoView:true,userEvent:n,effects:n=="delete.selection"?B.announce.of(o.phrase("Selection deleted")):void 0})),true)}function ie(e,t,n){if(e instanceof B)for(let o of e.state.facet(B.atomicRanges).map(l=>l(e)))o.between(t,t,(l,r)=>{l<t&&r>t&&(t=n?r:l);});return t}const Qt=(e,t,n)=>re(e,o=>{let l=o.from,{state:r}=e,i=r.doc.lineAt(l),s,c;if(n&&!t&&l>i.from&&l<i.from+200&&!/[^ \t]/.test(s=i.text.slice(0,l-i.from))){if(s[s.length-1]=="	")return l-1;let u=xn$1(s,r.tabSize),f=u%$i(r)||$i(r);for(let d=0;d<f&&s[s.length-1-d]==" ";d++)l--;c=l;}else c=yt(i.text,l-i.from,t,t)+i.from,c==l&&i.number!=(t?r.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,l-i.from))&&(c=yt(i.text,c-i.from,false,false)+i.from);return c}),Ee=e=>Qt(e,false,true),Xt=e=>Qt(e,true,false),$t=(e,t)=>re(e,n=>{let o=n.head,{state:l}=e,r=l.doc.lineAt(o),i=l.charCategorizer(o);for(let s=null;;){if(o==(t?r.to:r.from)){o==n.head&&r.number!=(t?l.doc.lines:1)&&(o+=t?1:-1);break}let c=yt(r.text,o-r.from,t)+r.from,u=r.text.slice(Math.min(o,c)-r.from,Math.max(o,c)-r.from),f=i(u);if(s!=null&&f!=s)break;(u!=" "||o!=n.head)&&(s=f),o=c;}return o}),eo=e=>$t(e,false),ir=e=>$t(e,true),sr=e=>re(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ar=e=>re(e,t=>{let n=e.moveToLineBoundary(t,false).head;return t.head>n?n:Math.max(0,t.head-1)}),cr=e=>re(e,t=>{let n=e.moveToLineBoundary(t,true).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ur=({state:e,dispatch:t})=>{if(e.readOnly)return  false;let n=e.changeByRange(o=>({changes:{from:o.from,to:o.to,insert:H$1.of(["",""])},range:A$1.cursor(o.from)}));return t(e.update(n,{scrollIntoView:true,userEvent:"input"})),true},fr=({state:e,dispatch:t})=>{if(e.readOnly)return  false;let n=e.changeByRange(o=>{if(!o.empty||o.from==0||o.from==e.doc.length)return {range:o};let l=o.from,r=e.doc.lineAt(l),i=l==r.from?l-1:yt(r.text,l-r.from,false)+r.from,s=l==r.to?l+1:yt(r.text,l-r.from,true)+r.from;return {changes:{from:i,to:s,insert:e.doc.slice(l,s).append(e.doc.slice(i,l))},range:A$1.cursor(s)}});return n.changes.empty?false:(t(e.update(n,{scrollIntoView:true,userEvent:"move.character"})),true)};function be(e){let t=[],n=-1;for(let o of e.selection.ranges){let l=e.doc.lineAt(o.from),r=e.doc.lineAt(o.to);if(!o.empty&&o.to==r.from&&(r=e.doc.lineAt(o.to-1)),n>=l.number){let i=t[t.length-1];i.to=r.to,i.ranges.push(o);}else t.push({from:l.from,to:r.to,ranges:[o]});n=r.number+1;}return t}function to(e,t,n){if(e.readOnly)return  false;let o=[],l=[];for(let r of be(e)){if(n?r.to==e.doc.length:r.from==0)continue;let i=e.doc.lineAt(n?r.to+1:r.from-1),s=i.length+1;if(n){o.push({from:r.to,to:i.to},{from:r.from,insert:i.text+e.lineBreak});for(let c of r.ranges)l.push(A$1.range(Math.min(e.doc.length,c.anchor+s),Math.min(e.doc.length,c.head+s)));}else {o.push({from:i.from,to:r.from},{from:r.to,insert:e.lineBreak+i.text});for(let c of r.ranges)l.push(A$1.range(c.anchor-s,c.head-s));}}return o.length?(t(e.update({changes:o,scrollIntoView:true,selection:A$1.create(l,e.selection.mainIndex),userEvent:"move.line"})),true):false}const dr=({state:e,dispatch:t})=>to(e,t,false),mr=({state:e,dispatch:t})=>to(e,t,true);function oo(e,t,n){if(e.readOnly)return  false;let o=[];for(let r of be(e))n?o.push({from:r.from,insert:e.doc.slice(r.from,r.to)+e.lineBreak}):o.push({from:r.to,insert:e.lineBreak+e.doc.slice(r.from,r.to)});let l=e.changes(o);return t(e.update({changes:l,selection:e.selection.map(l,n?1:-1),scrollIntoView:true,userEvent:"input.copyline"})),true}const hr=({state:e,dispatch:t})=>oo(e,t,false),gr=({state:e,dispatch:t})=>oo(e,t,true),pr=e=>{if(e.state.readOnly)return  false;let{state:t}=e,n=t.changes(be(t).map(({from:l,to:r})=>(l>0?l--:r<t.doc.length&&r++,{from:l,to:r}))),o=j(t.selection,l=>{let r;if(e.lineWrapping){let i=e.lineBlockAt(l.head),s=e.coordsAtPos(l.head,l.assoc||1);s&&(r=i.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2);}return e.moveVertically(l,true,r)}).map(n);return e.dispatch({changes:n,selection:o,scrollIntoView:true,userEvent:"delete.line"}),true};function br(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return {from:t,to:t};let n=Nt$2(e).resolveInner(t),o=n.childBefore(t),l=n.childAfter(t),r;return o&&l&&o.to<=t&&l.from>=t&&(r=o.type.prop(I$1.closedBy))&&r.indexOf(l.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(o.to,l.from))?{from:o.to,to:l.from}:null}const et=no(false),yr=no(true);function no(e){return ({state:t,dispatch:n})=>{if(t.readOnly)return  false;let o=t.changeByRange(l=>{let{from:r,to:i}=l,s=t.doc.lineAt(r),c=!e&&r==i&&br(t,r);e&&(r=i=(i<=s.to?s:t.doc.lineAt(i)).to);let u=new Hl(t,{simulateBreak:r,simulateDoubleBreak:!!c}),f=Oc(u,r);for(f==null&&(f=xn$1(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<s.to&&/\s/.test(s.text[i-s.from]);)i++;c?{from:r,to:i}=c:r>s.from&&r<s.from+100&&!/\S/.test(s.text.slice(0,r))&&(r=s.from);let d=["",Tc(t,f)];return c&&d.push(Tc(t,u.lineIndent(s.from,-1))),{changes:{from:r,to:i,insert:H$1.of(d)},range:A$1.cursor(r+1+d[1].length)}});return n(t.update(o,{scrollIntoView:true,userEvent:"input"})),true}}function Ve(e,t){let n=-1;return e.changeByRange(o=>{let l=[];for(let i=o.from;i<=o.to;){let s=e.doc.lineAt(i);s.number>n&&(o.empty||o.to>s.from)&&(t(s,l,o),n=s.number),i=s.to+1;}let r=e.changes(l);return {changes:l,range:A$1.range(r.mapPos(o.anchor,1),r.mapPos(o.head,1))}})}const kr=({state:e,dispatch:t})=>{if(e.readOnly)return  false;let n=Object.create(null),o=new Hl(e,{overrideIndentation:r=>{let i=n[r];return i??-1}}),l=Ve(e,(r,i,s)=>{let c=Oc(o,r.from);if(c==null)return;/\S/.test(r.text)||(c=0);let u=/^\s*/.exec(r.text)[0],f=Tc(e,c);(u!=f||s.from<r.from+u.length)&&(n[r.from]=c,i.push({from:r.from,to:r.from+u.length,insert:f}));});return l.changes.empty||t(e.update(l,{userEvent:"indent"})),true},ro=({state:e,dispatch:t})=>e.readOnly?false:(t(e.update(Ve(e,(n,o)=>{o.push({from:n.from,insert:e.facet(Wl)});}),{userEvent:"input.indent"})),true),lo=({state:e,dispatch:t})=>e.readOnly?false:(t(e.update(Ve(e,(n,o)=>{let l=/^\s*/.exec(n.text)[0];if(!l)return;let r=xn$1(l,e.tabSize),i=0,s=Tc(e,Math.max(0,r-$i(e)));for(;i<l.length&&i<s.length&&l.charCodeAt(i)==s.charCodeAt(i);)i++;o.push({from:n.from+i,to:n.from+l.length,insert:s.slice(i)});}),{userEvent:"delete.dedent"})),true),xr=e=>(e.setTabFocusMode(),true),Cr=[{key:"Ctrl-b",run:Rt,shift:Wt,preventDefault:true},{key:"Ctrl-f",run:Ot,shift:qt},{key:"Ctrl-p",run:Ft,shift:Kt},{key:"Ctrl-n",run:Ut,shift:jt},{key:"Ctrl-a",run:Vn,shift:Xn},{key:"Ctrl-e",run:Gn,shift:$n},{key:"Ctrl-d",run:Xt},{key:"Ctrl-h",run:Ee},{key:"Ctrl-k",run:sr},{key:"Ctrl-Alt-h",run:eo},{key:"Ctrl-o",run:ur},{key:"Ctrl-t",run:fr},{key:"Ctrl-v",run:Te}],Br=[{key:"ArrowLeft",run:Rt,shift:Wt,preventDefault:true},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Tn,shift:qn,preventDefault:true},{mac:"Cmd-ArrowLeft",run:Fn,shift:Zn,preventDefault:true},{key:"ArrowRight",run:Ot,shift:qt,preventDefault:true},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:En,shift:zn,preventDefault:true},{mac:"Cmd-ArrowRight",run:Un,shift:Qn,preventDefault:true},{key:"ArrowUp",run:Ft,shift:Kt,preventDefault:true},{mac:"Cmd-ArrowUp",run:Ze,shift:Xe},{mac:"Ctrl-ArrowUp",run:Ke,shift:je},{key:"ArrowDown",run:Ut,shift:jt,preventDefault:true},{mac:"Cmd-ArrowDown",run:Qe,shift:$e},{mac:"Ctrl-ArrowDown",run:Te,shift:Ye},{key:"PageUp",run:Ke,shift:je},{key:"PageDown",run:Te,shift:Ye},{key:"Home",run:Nn,shift:Yn,preventDefault:true},{key:"Mod-Home",run:Ze,shift:Xe},{key:"End",run:Pn,shift:jn,preventDefault:true},{key:"Mod-End",run:Qe,shift:$e},{key:"Enter",run:et,shift:et},{key:"Mod-a",run:er},{key:"Backspace",run:Ee,shift:Ee,preventDefault:true},{key:"Delete",run:Xt,preventDefault:true},{key:"Mod-Backspace",mac:"Alt-Backspace",run:eo,preventDefault:true},{key:"Mod-Delete",mac:"Alt-Delete",run:ir,preventDefault:true},{mac:"Mod-Backspace",run:ar,preventDefault:true},{mac:"Mod-Delete",run:cr,preventDefault:true}].concat(Cr.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Sr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Rn,shift:Jn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:On,shift:Kn},{key:"Alt-ArrowUp",run:dr},{key:"Shift-Alt-ArrowUp",run:hr},{key:"Alt-ArrowDown",run:mr},{key:"Shift-Alt-ArrowDown",run:gr},{key:"Mod-Alt-ArrowUp",run:nr},{key:"Mod-Alt-ArrowDown",run:rr},{key:"Escape",run:lr},{key:"Mod-Enter",run:yr},{key:"Alt-l",mac:"Ctrl-l",run:tr},{key:"Mod-i",run:or,preventDefault:true},{key:"Mod-[",run:lo},{key:"Mod-]",run:ro},{key:"Mod-Alt-\\",run:kr},{key:"Shift-Mod-k",run:pr},{key:"Shift-Mod-\\",run:Wn},{key:"Mod-/",run:dn},{key:"Alt-A",run:hn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:xr}].concat(Br),vr="#2E3235",P="#DDDDDD",ee="#B9D2FF",se="#b0b0b0",Dr="#e0e0e0",io="#808080",ke="#000000",Lr="#A54543",so="#fc6d24",G="#fda331",xe="#8abeb7",tt="#b5bd68",X="#6fb3d2",$="#cc99cc",wr="#6987AF",ot=so,nt="#292d30",ae=ee+"30",_r=vr,Ce=P,Mr="#202325",rt=P,Tr=B.theme({"&":{color:P,backgroundColor:_r},".cm-content":{caretColor:rt},".cm-cursor, .cm-dropCursor":{borderLeftColor:rt},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Mr},".cm-panels":{backgroundColor:nt,color:se},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:ee,outline:`1px solid ${se}`,color:ke},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Dr,color:ke},".cm-activeLine":{backgroundColor:ae},".cm-selectionMatch":{backgroundColor:ae},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${se}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:ee,color:ke},".cm-gutters":{borderRight:"1px solid #ffffff10",color:io,backgroundColor:nt},".cm-activeLineGutter":{backgroundColor:ae},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:ee},".cm-tooltip":{border:"none",backgroundColor:Ce},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ce,borderBottomColor:Ce},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:ae,color:se}}},{dark:true}),Er=ns.define([{tag:v.keyword,color:G},{tag:[v.name,v.deleted,v.character,v.propertyName,v.macroName],color:tt},{tag:[v.variableName],color:X},{tag:[v.function(v.variableName)],color:G},{tag:[v.labelName],color:so},{tag:[v.color,v.constant(v.name),v.standard(v.name)],color:G},{tag:[v.definition(v.name),v.separator],color:$},{tag:[v.brace],color:$},{tag:[v.annotation],color:ot},{tag:[v.number,v.changed,v.annotation,v.modifier,v.self,v.namespace],color:G},{tag:[v.typeName,v.className],color:X},{tag:[v.operator,v.operatorKeyword],color:$},{tag:[v.tagName],color:G},{tag:[v.squareBracket],color:$},{tag:[v.angleBracket],color:$},{tag:[v.attributeName],color:X},{tag:[v.regexp],color:G},{tag:[v.quote],color:P},{tag:[v.string],color:tt},{tag:v.link,color:wr,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[v.url,v.escape,v.special(v.string)],color:xe},{tag:[v.meta],color:Lr},{tag:[v.comment],color:io,fontStyle:"italic"},{tag:v.monospace,color:P},{tag:v.strong,fontWeight:"bold",color:G},{tag:v.emphasis,fontStyle:"italic",color:X},{tag:v.strikethrough,textDecoration:"line-through"},{tag:v.heading,fontWeight:"bold",color:P},{tag:v.special(v.heading1),fontWeight:"bold",color:P},{tag:v.heading1,fontWeight:"bold",color:P},{tag:[v.heading2,v.heading3,v.heading4],fontWeight:"bold",color:P},{tag:[v.heading5,v.heading6],color:P},{tag:[v.atom,v.bool,v.special(v.variableName)],color:xe},{tag:[v.processingInstruction,v.inserted],color:xe},{tag:[v.contentSeparator],color:X},{tag:v.invalid,color:ee,borderBottom:`1px dotted ${ot}`}]);[Tr,Lu(Er)];const lt="#2e3440",Ge="#3b4252",it="#434c5e",ce="#4c566a",st="#e5e9f0",Ie="#eceff4",Be="#8fbcbb",at="#88c0d0",Rr="#81a1c1",T="#5e81ac",Or="#bf616a",q="#d08770",Se="#ebcb8b",ct="#a3be8c",Pr="#b48ead",ut="#d30102",He=Ie,Ae=He,Nr="#ffffff",ve=Ge,Fr=He,ft=Ge,Ur=B.theme({"&":{color:lt,backgroundColor:Nr},".cm-content":{caretColor:ft},".cm-cursor, .cm-dropCursor":{borderLeftColor:ft},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Fr},".cm-panels":{backgroundColor:He,color:ce},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${ce}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:st},".cm-activeLine":{backgroundColor:Ae},".cm-selectionMatch":{backgroundColor:st},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${ce}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Ie},".cm-gutters":{backgroundColor:Ie,color:lt,border:"none"},".cm-activeLineGutter":{backgroundColor:Ae},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ve},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ve,borderBottomColor:ve},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ae,color:ce}}},{dark:false}),Vr=ns.define([{tag:v.keyword,color:T},{tag:[v.name,v.deleted,v.character,v.propertyName,v.macroName],color:q},{tag:[v.variableName],color:q},{tag:[v.function(v.variableName)],color:T},{tag:[v.labelName],color:Rr},{tag:[v.color,v.constant(v.name),v.standard(v.name)],color:T},{tag:[v.definition(v.name),v.separator],color:ct},{tag:[v.brace],color:Be},{tag:[v.annotation],color:ut},{tag:[v.number,v.changed,v.annotation,v.modifier,v.self,v.namespace],color:at},{tag:[v.typeName,v.className],color:Se},{tag:[v.operator,v.operatorKeyword],color:ct},{tag:[v.tagName],color:Pr},{tag:[v.squareBracket],color:Or},{tag:[v.angleBracket],color:q},{tag:[v.attributeName],color:Se},{tag:[v.regexp],color:T},{tag:[v.quote],color:Ge},{tag:[v.string],color:q},{tag:v.link,color:Be,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[v.url,v.escape,v.special(v.string)],color:q},{tag:[v.meta],color:at},{tag:[v.comment],color:it,fontStyle:"italic"},{tag:v.strong,fontWeight:"bold",color:T},{tag:v.emphasis,fontStyle:"italic",color:T},{tag:v.strikethrough,textDecoration:"line-through"},{tag:v.heading,fontWeight:"bold",color:T},{tag:v.special(v.heading1),fontWeight:"bold",color:T},{tag:v.heading1,fontWeight:"bold",color:T},{tag:[v.heading2,v.heading3,v.heading4],fontWeight:"bold",color:T},{tag:[v.heading5,v.heading6],color:T},{tag:[v.atom,v.bool,v.special(v.variableName)],color:q},{tag:[v.processingInstruction,v.inserted],color:Be},{tag:[v.contentSeparator],color:Se},{tag:v.invalid,color:it,borderBottom:`1px dotted ${ut}`}]);[Ur,Lu(Vr)];class dt{constructor(t,n,o){this.from=t,this.to=n,this.diagnostic=o;}}class H{constructor(t,n,o){this.diagnostics=t,this.panel=n,this.selected=o;}static init(t,n,o){let l=o.facet(oe).markerFilter;l&&(t=l(t,o));let r=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),i=new ce$1,s=[],c=0,u=o.doc.iter(),f=0,d=o.doc.length;for(let m=0;;){let g=m==r.length?null:r[m];if(!g&&!s.length)break;let B,C;if(s.length)B=c,C=s.reduce((y,x)=>Math.min(y,x.to),g&&g.from>B?g.from:1e8);else {if(B=g.from,B>d)break;C=g.to,s.push(g),m++;}for(;m<r.length;){let y=r[m];if(y.from==B&&(y.to>y.from||y.to==B))s.push(y),m++,C=Math.min(y.to,C);else {C=Math.min(y.from,C);break}}C=Math.min(C,d);let R=false;if(s.some(y=>y.from==B&&(y.to==C||C==d))&&(R=B==C,!R&&C-B<10)){let y=B-(f+u.value.length);y>0&&(u.next(y),f=B);for(let x=B;;){if(x>=C){R=true;break}if(!u.lineBreak&&f+u.value.length>x)break;x=f+u.value.length,f+=u.value.length,u.next();}}let Y=el(s);if(R)i.add(B,B,V.widget({widget:new Zr(Y),diagnostics:s.slice()}));else {let y=s.reduce((x,le)=>le.markClass?x+" "+le.markClass:x,"");i.add(B,C,V.mark({class:"cm-lintRange cm-lintRange-"+Y+y,diagnostics:s.slice(),inclusiveEnd:s.some(x=>x.to>C)}));}if(c=C,c==d)break;for(let y=0;y<s.length;y++)s[y].to<=c&&s.splice(y--,1);}let h=i.finish();return new H(h,n,K(h))}}function K(e,t=null,n=0){let o=null;return e.between(n,1e9,(l,r,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!o)o=new dt(l,r,t||i.diagnostics[0]);else {if(i.diagnostics.indexOf(o.diagnostic)<0)return  false;o=new dt(o.from,r,o.diagnostic);}}),o}function Hr(e,t){let n=t.pos,o=t.end||n,l=e.state.facet(oe).hideOn(e,n,o);if(l!=null)return l;let r=e.startState.doc.lineAt(t.pos);return !!(e.effects.some(i=>i.is(ao))||e.changes.touchesRange(r.from,Math.max(r.to,o)))}function Wr(e,t){return e.field(w,false)?t:t.concat(G$2.appendConfig.of(tl))}const ao=G$2.define(),We=G$2.define(),co=G$2.define(),w=jt$1.define({create(){return new H(V.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),o=null,l=e.panel;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);o=K(n,e.selected.diagnostic,r)||K(n,null,r);}!n.size&&l&&t.state.facet(oe).autoPanel&&(l=null),e=new H(n,l,o);}for(let n of t.effects)if(n.is(ao)){let o=t.state.facet(oe).autoPanel?n.value.length?ne.open:null:e.panel;e=H.init(n.value,o,t.state);}else n.is(We)?e=new H(e.diagnostics,n.value?ne.open:null,e.selected):n.is(co)&&(e=new H(e.diagnostics,e.panel,n.value));return e},provide:e=>[Wr$1.from(e,t=>t.panel),B.decorations.from(e,t=>t.diagnostics)]}),qr=V.mark({class:"cm-lintRange cm-lintRange-active"});function zr(e,t,n){let{diagnostics:o}=e.state.field(w),l,r=-1,i=-1;o.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:f})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return l=f.diagnostics,r=c,i=u,false});let s=e.state.facet(oe).tooltipFilter;return l&&s&&(l=s(l,e.state)),l?{pos:r,end:i,above:e.state.doc.lineAt(r).to<i,create(){return {dom:Jr(e,l)}}}:null}function Jr(e,t){return N("ul",{class:"cm-tooltip-lint"},t.map(n=>fo(e,n,false)))}const Kr=e=>{let t=e.state.field(w,false);(!t||!t.panel)&&e.dispatch({effects:Wr(e.state,[We.of(true)])});let n=vu(e,ne.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),true},mt=e=>{let t=e.state.field(w,false);return !t||!t.panel?false:(e.dispatch({effects:We.of(false)}),true)},jr=e=>{let t=e.state.field(w,false);if(!t)return  false;let n=e.state.selection.main,o=t.diagnostics.iter(n.to+1);return !o.value&&(o=t.diagnostics.iter(0),!o.value||o.from==n.from&&o.to==n.to)?false:(e.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:true}),true)},Yr=[{key:"Mod-Shift-m",run:Kr,preventDefault:true},{key:"F8",run:jr}],oe=T$1.define({combine(e){return {sources:e.map(t=>t.source).filter(t=>t!=null),...Xi(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ht,tooltipFilter:ht,needsRefresh:(t,n)=>t?n?o=>t(o)||n(o):t:n,hideOn:(t,n)=>t?n?(o,l,r)=>t(o,l,r)||n(o,l,r):t:n,autoPanel:(t,n)=>t||n})}}});function ht(e,t){return e?t?(n,o)=>t(e(n,o),o):e:t}function uo(e){let t=[];if(e)e:for(let{name:n}of e){for(let o=0;o<n.length;o++){let l=n[o];if(/[a-zA-Z]/.test(l)&&!t.some(r=>r.toLowerCase()==l.toLowerCase())){t.push(l);continue e}}t.push("");}return t}function fo(e,t,n){var o;let l=n?uo(t.actions):[];return N("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},N("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(o=t.actions)===null||o===void 0?void 0:o.map((r,i)=>{let s=false,c=m=>{if(m.preventDefault(),s)return;s=true;let g=K(e.state.field(w).diagnostics,t);g&&r.apply(e,g.from,g.to);},{name:u}=r,f=l[i]?u.indexOf(l[i]):-1,d=f<0?u:[u.slice(0,f),N("u",u.slice(f,f+1)),u.slice(f+1)],h=r.markClass?" "+r.markClass:"";return N("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${f<0?"":` (access key "${l[i]})"`}.`},d)}),t.source&&N("div",{class:"cm-diagnosticSource"},t.source))}class Zr extends $t$1{constructor(t){super(),this.sev=t;}eq(t){return t.sev==this.sev}toDOM(){return N("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class gt{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=fo(t,n,true),this.dom.id=this.id,this.dom.setAttribute("role","option");}}class ne{constructor(t){this.view=t,this.items=[];let n=l=>{if(l.keyCode==27)mt(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],i=uo(r.actions);for(let s=0;s<i.length;s++)if(i[s].toUpperCase().charCodeAt(0)==l.keyCode){let c=K(this.view.state.field(w).diagnostics,r);c&&r.actions[s].apply(t,c.from,c.to);}}else return;l.preventDefault();},o=l=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(l.target)&&this.moveSelection(r);};this.list=N("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:o}),this.dom=N("div",{class:"cm-panel-lint"},this.list,N("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>mt(this.view)},"×")),this.update();}get selectedIndex(){let t=this.view.state.field(w).selected;if(!t)return  -1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return  -1}update(){let{diagnostics:t,selected:n}=this.view.state.field(w),o=0,l=false,r=null,i=new Set;for(t.between(0,this.view.state.doc.length,(s,c,{spec:u})=>{for(let f of u.diagnostics){if(i.has(f))continue;i.add(f);let d=-1,h;for(let m=o;m<this.items.length;m++)if(this.items[m].diagnostic==f){d=m;break}d<0?(h=new gt(this.view,f),this.items.splice(o,0,h),l=true):(h=this.items[d],d>o&&(this.items.splice(o,d-o),l=true)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),r=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),o++;}});o<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)l=true,this.items.pop();this.items.length==0&&(this.items.push(new gt(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),l=true),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:c})=>{let u=c.height/this.list.offsetHeight;s.top<c.top?this.list.scrollTop-=(c.top-s.top)/u:s.bottom>c.bottom&&(this.list.scrollTop+=(s.bottom-c.bottom)/u);}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync();}sync(){let t=this.list.firstChild;function n(){let o=t;t=o.nextSibling,o.remove();}for(let o of this.items)if(o.dom.parentNode==this.list){for(;t!=o.dom;)n();t=o.dom.nextSibling;}else this.list.insertBefore(o.dom,t);for(;t;)n();}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(w),o=K(n.diagnostics,this.items[t].diagnostic);o&&this.view.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:true,effects:co.of(o)});}static open(t){return new ne(t)}}function Qr(e,t='viewBox="0 0 40 40"'){return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function ue(e){return Qr(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Xr=B.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:ue("#d11")},".cm-lintRange-warning":{backgroundImage:ue("orange")},".cm-lintRange-info":{backgroundImage:ue("#999")},".cm-lintRange-hint":{backgroundImage:ue("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function $r(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function el(e){let t="hint",n=1;for(let o of e){let l=$r(o.severity);l>n&&(n=l,t=o.severity);}return t}const tl=[w,B.decorations.compute([w],e=>{let{selected:t,panel:n}=e.field(w);return !t||!n||t.from==t.to?V.none:V.set([qr.range(t.from,t.to)])}),wu(zr,{hideOn:Hr}),Xr];[gu(),Cn(),Ru(),pu(),W.allowMultipleSelections.of(true),Bu(),Lu(Iu,{fallback:true}),Nt$1(),bu(),yu(),ff.of([...Ut$1,...Sr,...Mn,...Eu,...kt,...Yr])];function nl(e,t){e.component(n=>{let o=fallback(t.class_names,""),l=fallback(t.value,""),r=t.dark_mode,i=fallback(t.basic,true),s$1=t.language,c=fallback(t.lines,5),u=fallback(t.max_lines,null),f=fallback(t.extensions,()=>[],true),d=fallback(t.use_tab,true),h=fallback(t.readonly,false),m=fallback(t.placeholder,void 0),g=fallback(t.wrap_lines,false),B$1=fallback(t.show_line_numbers,true),C=fallback(t.autocomplete,false);async function le(p){await Wu(p);}B.theme({"&":{fontSize:"var(--text-sm)",backgroundColor:"var(--border-color-secondary)"},".cm-content":{paddingTop:"5px",paddingBottom:"5px",color:"var(--body-text-color)",fontFamily:"var(--font-mono)",minHeight:"100%"},".cm-gutterElement":{marginRight:"var(--spacing-xs)"},".cm-gutters":{marginRight:"1px",borderRight:"1px solid var(--border-color-primary)",backgroundColor:"var(--block-background-fill);",color:"var(--body-text-color-subdued)"},".cm-focused":{outline:"none"},".cm-scroller":{height:"auto"},".cm-cursor":{borderLeftColor:"var(--body-text-color)"}});B.theme({".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:"var(--background-fill-primary)",color:"var(--body-text-color)"},"& > ul > li[aria-selected]":{backgroundColor:"var(--color-accent-soft)",color:"var(--body-text-color)"}}});le(s$1),n.push(`<div class="wrap svelte-pndh99"><div${attr_class(`codemirror-wrapper ${stringify(o)}`,"svelte-pndh99")}></div></div>`),bind_props(t,{class_names:o,value:l,dark_mode:r,basic:i,language:s$1,lines:c,max_lines:u,extensions:f,use_tab:d,readonly:h,placeholder:m,wrap_lines:g,show_line_numbers:B$1,autocomplete:C});});}function rl(e$1,t){e$1.component(n=>{let o=false,l=t.value,r;function i(){o=true,r&&clearTimeout(r),r=setTimeout(()=>{o=false;},2e3);}async function s$1(){"clipboard"in navigator&&(await navigator.clipboard.writeText(l),i());}onDestroy(()=>{r&&clearTimeout(r);}),w$1(n,{Icon:o?e:h,onclick:s$1}),bind_props(t,{value:l});});}function ll(e,t){e.component(n=>{let o,l$1,r=t.value,i=t.language;function s$1(c){return {py:"py",python:"py",md:"md",markdown:"md",json:"json",html:"html",css:"css",js:"js",javascript:"js",ts:"ts",typescript:"ts",yaml:"yaml",yml:"yml",dockerfile:"dockerfile",sh:"sh",shell:"sh",r:"r",c:"c",cpp:"cpp",latex:"tex"}[c]||"txt"}onDestroy(()=>{}),o=s$1(i),l$1=URL.createObjectURL(new Blob([r])),u(n,{download:`file.${stringify(o)}`,href:l$1,children:c=>{w$1(c,{Icon:l});},$$slots:{default:true}}),bind_props(t,{value:r,language:i});});}function il(e,t){e.component(n=>{let o=t.value,l=t.language,r=fallback(t.buttons,null),i=fallback(t.on_custom_button_click,null);y(n,{buttons:r,on_custom_button_click:i,children:s=>{r?.some(c=>typeof c=="string"&&c==="download")?(s.push("<!--[-->"),ll(s,{value:o,language:l})):s.push("<!--[!-->"),s.push("<!--]--> "),r?.some(c=>typeof c=="string"&&c==="copy")?(s.push("<!--[-->"),rl(s,{value:o})):s.push("<!--[!-->"),s.push("<!--]-->");}}),bind_props(t,{value:o,language:l,buttons:r,on_custom_button_click:i});});}function _l(e,t){e.component(n=>{const{$$slots:o,$$events:l,...r}=t,i$1=new g(r);let s$1=i$1.shared.theme==="dark",c=i$1.shared.label||i$1.i18n("code.code");i$1.props.value;let u=true,f;function d(h){G$1(h,{height:i$1.props.max_lines&&"fit-content",variant:"solid",padding:false,elem_id:i$1.shared.elem_id,elem_classes:i$1.shared.elem_classes,visible:i$1.shared.visible,scale:i$1.shared.scale,min_width:i$1.shared.min_width,children:m=>{U$1(m,spread_props([{autoscroll:i$1.shared.autoscroll,i18n:i$1.i18n},i$1.shared.loading_status,{on_clear_status:()=>i$1.dispatch("clear_status",i$1.shared.loading_status)}])),m.push("<!----> "),i$1.shared.show_label?(m.push("<!--[-->"),k(m,{Icon:i,show_label:i$1.shared.show_label,label:c,float:false})):m.push("<!--[!-->"),m.push("<!--]--> "),!i$1.props.value&&!i$1.shared.interactive?(m.push("<!--[-->"),p(m,{unpadded_box:true,size:"large",children:g=>{i(g);},$$slots:{default:true}})):(m.push("<!--[!-->"),il(m,{language:i$1.props.language,value:i$1.props.value,buttons:i$1.props.buttons??["copy","download"],on_custom_button_click:g=>{i$1.dispatch("custom_button_click",{id:g});}}),m.push("<!----> "),nl(m,{language:i$1.props.language,lines:i$1.props.lines,max_lines:i$1.props.max_lines,dark_mode:s$1,wrap_lines:i$1.props.wrap_lines,show_line_numbers:i$1.props.show_line_numbers,autocomplete:i$1.props.autocomplete,readonly:!i$1.shared.interactive,get value(){return i$1.props.value},set value(g){i$1.props.value=g,u=false;}}),m.push("<!---->")),m.push("<!--]-->");},$$slots:{default:true}});}do u=true,f=n.copy(),d(f);while(!u);n.subsume(f);});}

export { nl as BaseCode, rl as BaseCopy, ll as BaseDownload, il as BaseWidget, _l as default };
//# sourceMappingURL=Index64-Djt3Hnkl.js.map
