/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../@lezer/common/dist/index.js"),e=require("../../state/dist/index.js"),r=require("../../view/dist/index.js"),n=require("../../../@lezer/highlight/dist/index.js"),o=require("../../../style-mod/src/style-mod.js");var s;const i=new t.NodeProp;function a(t){return e.Facet.define({combine:t?e=>e.concat(t):void 0})}const l=new t.NodeProp;class c{constructor(t,r,n=[],o=""){this.data=t,this.name=o,e.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(e.EditorState.prototype,"tree",{get(){return d(this)}}),this.parser=r,this.extension=[y.of(this),e.EditorState.languageData.of((t,e,r)=>{let n=u(t,e,r),o=n.type.prop(i);if(!o)return[];let s=t.facet(o),a=n.type.prop(l);if(a){let o=n.resolve(e-n.from,r);for(let e of a)if(e.test(o,t)){let r=t.facet(e.facet);return"replace"==e.type?r:r.concat(s)}}return s})].concat(n)}isActiveAt(t,e,r=-1){return u(t,e,r).type.prop(i)==this.data}findRegions(e){let r=e.facet(y);if((null==r?void 0:r.data)==this.data)return[{from:0,to:e.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],o=(e,r)=>{if(e.prop(i)==this.data)return void n.push({from:r,to:r+e.length});let s=e.prop(t.NodeProp.mounted);if(s){if(s.tree.prop(i)==this.data){if(s.overlay)for(let t of s.overlay)n.push({from:t.from+r,to:t.to+r});else n.push({from:r,to:r+e.length});return}if(s.overlay){let t=n.length;if(o(s.tree,s.overlay[0].from+r),n.length>t)return}}for(let n=0;n<e.children.length;n++){let s=e.children[n];s instanceof t.Tree&&o(s,e.positions[n]+r)}};return o(d(e),0),n}get allowsNesting(){return!0}}function u(e,r,n){let o=e.facet(y),s=d(e).topNode;if(!o||o.allowsNesting)for(let i=s;i;i=i.enter(r,n,t.IterMode.ExcludeBuffers|t.IterMode.EnterBracketed))i.type.isTop&&(s=i);return s}c.setState=e.StateEffect.define();class h extends c{constructor(t,e,r){super(t,e,[],r),this.parser=e}static define(t){let e=a(t.languageData);return new h(e,t.parser.configure({props:[i.add(t=>t.isTop?e:void 0)]}),t.name)}configure(t,e){return new h(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function d(e){let r=e.field(c.state,!1);return r?r.tree:t.Tree.empty}class f{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 r=this.cursorPos-this.string.length;return t<r||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}}let p=null;class g{constructor(t,e,r=[],n,o,s,i,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=o,this.viewport=s,this.skipped=i,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,r,n){return new g(e,r,[],t.Tree.empty,0,n,[],null)}startParse(){return this.parser.startParse(new f(this.state.doc),this.fragments)}work(e,r){return null!=r&&r>=this.state.doc.length&&(r=void 0),this.tree!=t.Tree.empty&&this.isDone(null!=r?r:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=r&&(null==this.parse.stoppedAt||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let o=this.parse.advance();if(o){if(this.fragments=this.withoutTempSkipped(t.TreeFragment.addTree(o,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=o,this.parse=null,!(this.treeLen<(null!=r?r:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,r;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=e,this.tree=r,this.fragments=this.withoutTempSkipped(t.TreeFragment.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=p;p=this;try{return t()}finally{p=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=m(t,e.from,e.to);return t}changes(e,r){let{fragments:n,tree:o,treeLen:s,viewport:i,skipped:a}=this;if(this.takeTree(),!e.empty){let r=[];if(e.iterChangedRanges((t,e,n,o)=>r.push({fromA:t,toA:e,fromB:n,toB:o})),n=t.TreeFragment.applyChanges(n,r),o=t.Tree.empty,s=0,i={from:e.mapPos(i.from,-1),to:e.mapPos(i.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);r<n&&a.push({from:r,to:n})}}}return new g(this.parser,r,n,o,s,i,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 r=0;r<this.skipped.length;r++){let{from:e,to:n}=this.skipped[r];e<t.to&&n>t.from&&(this.fragments=m(this.fragments,e,n),this.skipped.splice(r--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(e){return new class extends t.Parser{createParse(r,n,o){let s=o[0].from,i=o[o.length-1].to;return{parsedPos:s,advance(){let r=p;if(r){for(let t of o)r.tempSkipped.push(t);e&&(r.scheduleOn=r.scheduleOn?Promise.all([r.scheduleOn,e]):e)}return this.parsedPos=i,new t.Tree(t.NodeType.none,[],[],i-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return p}}function m(e,r,n){return t.TreeFragment.applyChanges(e,[{fromA:r,toA:n,fromB:r,toB:n}])}class k{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),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new k(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=g.create(t.facet(y).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new k(r)}}c.state=e.StateField.define({create:k.init,update(t,e){for(let r of e.effects)if(r.is(c.setState))return r.value;return e.startState.facet(y)!=e.state.facet(y)?k.init(e.state):t.apply(e)}});let x=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(x=t=>{let e=-1,r=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(r):cancelIdleCallback(e)});const w="undefined"!=typeof navigator&&(null===(s=navigator.scheduling)||void 0===s?void 0:s.isInputPending)?()=>navigator.scheduling.isInputPending():null,v=r.ViewPlugin.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(c.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(c.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=x(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:r,viewport:{to:n}}=this.view,o=r.field(c.state);if(o.tree==o.context.tree&&o.context.isDone(n+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!w?Math.max(25,t.timeRemaining()-5):1e9),i=o.context.treeLen<n&&r.doc.length>n+1e3,a=o.context.work(()=>w&&w()||Date.now()>s,n+(i?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:c.setState.of(new k(o.context))})),this.chunkBudget>0&&(!a||i)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(t=>r.logException(this.view.state,t)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),y=e.Facet.define({combine:t=>t.length?t[0]:null,enables:t=>[c.state,v,r.EditorView.contentAttributes.compute([t],e=>{let r=e.facet(t);return r&&r.name?{"data-language":r.name}:{}})]});const b=e.Facet.define(),S=e.Facet.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function T(t){let e=t.facet(S);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function C(t,e){let r="",n=t.tabSize,o=t.facet(S)[0];if("\t"==o){for(;e>=n;)r+="\t",e-=n;o=" "}for(let s=0;s<e;s++)r+=o;return r}function A(t,r){t instanceof e.EditorState&&(t=new P(t));for(let e of t.state.facet(b)){let n=e(t,r);if(void 0!==n)return n}let n=d(t.state);return n.length>=r?function(t,e,r){let n=e.resolveStack(r),o=e.resolveInner(r,-1).resolve(r,0).enterUnfinishedNodesBefore(r);if(o!=n.node){let t=[];for(let e=o;e&&!(e.from<n.node.from||e.to>n.node.to||e.from==n.node.from&&e.type==n.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return N(n,t,r)}(t,n,r):null}class P{constructor(t,e={}){this.state=t,this.options=e,this.unit=T(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:o}=this.options;return null!=n&&n>=r.from&&n<=r.to?o&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:r.text.slice(n-r.from),from:n}:{text:r.text.slice(0,n-r.from),from:r.from}:r}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:n}=this.lineAt(t,e);return r.slice(t-n,Math.min(r.length,t+100-n))}column(t,e=1){let{text:r,from:n}=this.lineAt(t,e),o=this.countColumn(r,t-n),s=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return s>-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}countColumn(t,r=t.length){return e.countColumn(t,this.state.tabSize,r)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),o=this.options.overrideIndentation;if(o){let t=o(n);if(t>-1)return t}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const D=new t.NodeProp;function N(t,e,r){for(let n=t;n;n=n.next){let t=B(n.node);if(t)return t(E.create(e,r,n))}return 0}function B(e){let r=e.type.prop(D);if(r)return r;let n,o=e.firstChild;if(o&&(n=o.type.prop(t.NodeProp.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>M(e,!0,1,void 0,r&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?O:null}function O(){return 0}class E extends P{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new E(t,e,r)}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 r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(I(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return N(this.context.next,this.base,this.pos)}}function I(t,e){for(let r=e;r;r=r.parent)if(t==r)return!0;return!1}function M(t,e,r,n,o){let s=t.textAfter,i=s.match(/^\s*/)[0].length,a=n&&s.slice(i,i+n.length)==n||o==t.pos+i,l=e?function(t){let e=t.node,r=e.childAfter(e.from),n=e.lastChild;if(!r)return null;let o=t.options.simulateBreak,s=t.state.doc.lineAt(r.from),i=null==o||o<=s.from?s.to:Math.min(s.to,o);for(let a=r.to;;){let t=e.childAfter(a);if(!t||t==n)return null;if(!t.type.isSkipped){if(t.from>=i)return null;let e=/^ */.exec(s.text.slice(r.to-s.from))[0].length;return{from:r.from,to:r.to+e}}a=t.to}}(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*r)}const F=e.Facet.define(),L=new t.NodeProp;function R(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function V(t,e,r){for(let n of t.facet(F)){let o=n(t,e,r);if(o)return o}return function(t,e,r){let n=d(t);if(n.length<r)return null;let o=null;for(let s=n.resolveStack(r,1);s;s=s.next){let i=s.node;if(i.to<=r||i.from>r)continue;if(o&&i.from<e)break;let a=i.type.prop(L);if(a&&(i.to<n.length-50||n.length==t.doc.length||!R(i))){let n=a(i,t);n&&n.from<=r&&n.from>=e&&n.to>r&&(o=n)}}return o}(t,e,r)}function j(t,e){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return r>=n?void 0:{from:r,to:n}}const W=e.StateEffect.define({map:j}),q=e.StateEffect.define({map:j});function U(t){let e=[];for(let{head:r}of t.state.selection.ranges)e.some(t=>t.from<=r&&t.to>=r)||e.push(t.lineBlockAt(r));return e}const H=e.StateField.define({create:()=>r.Decoration.none,update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((e,r)=>t=$(t,e,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(W)&&!J(t,n.value.from,n.value.to)){let{preparePlaceholder:o}=e.state.facet(et),s=o?r.Decoration.replace({widget:new st(o(e.state,n.value))}):ot;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(q)&&(t=t.update({filter:(t,e)=>n.value.from!=t||n.value.to!=e,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=$(t,e.selection.main.head)),t},provide:t=>r.EditorView.decorations.from(t),toJSON(t,e){let r=[];return t.between(0,e.doc.length,(t,e)=>{r.push(t,e)}),r},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let r=0;r<t.length;){let n=t[r++],o=t[r++];if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");e.push(ot.range(n,o))}return r.Decoration.set(e,!0)}});function $(t,e,r=e){let n=!1;return t.between(e,r,(t,o)=>{t<r&&o>e&&(n=!0)}),n?t.update({filterFrom:e,filterTo:r,filter:(t,n)=>t>=r||n<=e}):t}function z(t,e,r){var n;let o=null;return null===(n=t.field(H,!1))||void 0===n||n.between(e,r,(t,e)=>{(!o||o.from>t)&&(o={from:t,to:e})}),o}function J(t,e,r){let n=!1;return t.between(e,e,(t,o)=>{t==e&&o==r&&(n=!0)}),n}function G(t,r){return t.field(H,!1)?r:r.concat(e.StateEffect.appendConfig.of(rt()))}const K=t=>{for(let e of U(t)){let r=V(t.state,e.from,e.to);if(r)return t.dispatch({effects:G(t.state,[W.of(r),Q(t,r)])}),!0}return!1},_=t=>{if(!t.state.field(H,!1))return!1;let e=[];for(let r of U(t)){let n=z(t.state,r.from,r.to);n&&e.push(q.of(n),Q(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Q(t,e,n=!0){let o=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return r.EditorView.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${o} ${t.state.phrase("to")} ${s}.`)}const X=t=>{let{state:e}=t,r=[];for(let n=0;n<e.doc.length;){let o=t.lineBlockAt(n),s=V(e,o.from,o.to);s&&r.push(W.of(s)),n=(s?t.lineBlockAt(s.to):o).to+1}return r.length&&t.dispatch({effects:G(t.state,r)}),!!r.length},Y=t=>{let e=t.state.field(H,!1);if(!e||!e.size)return!1;let r=[];return e.between(0,t.state.doc.length,(t,e)=>{r.push(q.of({from:t,to:e}))}),t.dispatch({effects:r}),!0},Z=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:K},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:_},{key:"Ctrl-Alt-[",run:X},{key:"Ctrl-Alt-]",run:Y}],tt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},et=e.Facet.define({combine:t=>e.combineConfig(t,tt)});function rt(t){return[H,lt]}function nt(t,e){let{state:r}=t,n=r.facet(et),o=e=>{let r=t.lineBlockAt(t.posAtDOM(e.target)),n=z(t.state,r.from,r.to);n&&t.dispatch({effects:q.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,o,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",r.phrase("folded code")),s.title=r.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=o,s}const ot=r.Decoration.replace({widget:new class extends r.WidgetType{toDOM(t){return nt(t,null)}}});class st extends r.WidgetType{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return nt(t,this.value)}}const it={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class at extends r.GutterMarker{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}}const lt=r.EditorView.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ct{constructor(t,e){let r;function s(t){let e=o.StyleModule.newName();return(r||(r=Object.create(null)))["."+e]=t,e}this.specs=t;const a="string"==typeof e.all?e.all:e.all?s(e.all):void 0,l=e.scope;this.scope=l instanceof c?t=>t.prop(i)==l.data:l?t=>t==l:void 0,this.style=n.tagHighlighter(t.map(t=>({tag:t.tag,class:t.class||s(Object.assign({},t,{tag:null}))})),{all:a}).style,this.module=r?new o.StyleModule(r):null,this.themeType=e.themeType}static define(t,e){return new ct(t,e||{})}}const ut=e.Facet.define(),ht=e.Facet.define({combine:t=>t.length?[t[0]]:null});function dt(t){let e=t.facet(ut);return e.length?e:t.facet(ht)}class ft{constructor(t){this.markCache=Object.create(null),this.tree=d(t.state),this.decorations=this.buildDeco(t,dt(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=d(t.state),r=dt(t.state),n=r!=dt(t.startState),{viewport:o}=t.view,s=t.changes.mapPos(this.decoratedTo,1);e.length<o.to&&!n&&e.type==this.tree.type&&s>=o.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=s):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=o.to)}buildDeco(t,o){if(!o||!this.tree.length)return r.Decoration.none;let s=new e.RangeSetBuilder;for(let{from:e,to:i}of t.visibleRanges)n.highlightTree(this.tree,o,(t,e,n)=>{s.add(t,e,this.markCache[n]||(this.markCache[n]=r.Decoration.mark({class:n})))},e,i);return s.finish()}}const pt=e.Prec.high(r.ViewPlugin.fromClass(ft,{decorations:t=>t.decorations})),gt=ct.define([{tag:n.tags.meta,color:"#404740"},{tag:n.tags.link,textDecoration:"underline"},{tag:n.tags.heading,textDecoration:"underline",fontWeight:"bold"},{tag:n.tags.emphasis,fontStyle:"italic"},{tag:n.tags.strong,fontWeight:"bold"},{tag:n.tags.strikethrough,textDecoration:"line-through"},{tag:n.tags.keyword,color:"#708"},{tag:[n.tags.atom,n.tags.bool,n.tags.url,n.tags.contentSeparator,n.tags.labelName],color:"#219"},{tag:[n.tags.literal,n.tags.inserted],color:"#164"},{tag:[n.tags.string,n.tags.deleted],color:"#a11"},{tag:[n.tags.regexp,n.tags.escape,n.tags.special(n.tags.string)],color:"#e40"},{tag:n.tags.definition(n.tags.variableName),color:"#00f"},{tag:n.tags.local(n.tags.variableName),color:"#30a"},{tag:[n.tags.typeName,n.tags.namespace],color:"#085"},{tag:n.tags.className,color:"#167"},{tag:[n.tags.special(n.tags.variableName),n.tags.macroName],color:"#256"},{tag:n.tags.definition(n.tags.propertyName),color:"#00c"},{tag:n.tags.comment,color:"#940"},{tag:n.tags.invalid,color:"#f00"}]),mt=r.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),kt="()[]{}",xt=e.Facet.define({combine:t=>e.combineConfig(t,{afterCursor:!0,brackets:kt,maxScanDistance:1e4,renderMatch:yt})}),wt=r.Decoration.mark({class:"cm-matchingBracket"}),vt=r.Decoration.mark({class:"cm-nonmatchingBracket"});function yt(t){let e=[],r=t.matched?wt:vt;return e.push(r.range(t.start.from,t.start.to)),t.end&&e.push(r.range(t.end.from,t.end.to)),e}function bt(t){let e=[],n=t.facet(xt);for(let r of t.selection.ranges){if(!r.empty)continue;let o=Pt(t,r.head,-1,n)||r.head>0&&Pt(t,r.head-1,1,n)||n.afterCursor&&(Pt(t,r.head,1,n)||r.head<t.doc.length&&Pt(t,r.head+1,-1,n));o&&(e=e.concat(n.renderMatch(o,t)))}return r.Decoration.set(e,!0)}const St=[r.ViewPlugin.fromClass(class{constructor(t){this.paused=!1,this.decorations=bt(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=bt(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),mt];const Tt=new t.NodeProp;function Ct(e,r,n){let o=e.prop(r<0?t.NodeProp.openedBy:t.NodeProp.closedBy);if(o)return o;if(1==e.name.length){let t=n.indexOf(e.name);if(t>-1&&t%2==(r<0?1:0))return[n[t+r]]}return null}function At(t){let e=t.type.prop(Tt);return e?e(t.node):t}function Pt(t,e,r,n={}){let o=n.maxScanDistance||1e4,s=n.brackets||kt,i=d(t),a=i.resolveInner(e,r);for(let l=a;l;l=l.parent){let n=Ct(l.type,r,s);if(n&&l.from<l.to){let o=At(l);if(o&&(r>0?e>=o.from&&e<o.to:e>o.from&&e<=o.to))return Dt(t,e,r,l,o,n,s)}}return function(t,e,r,n,o,s,i){let a=r<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=i.indexOf(a);if(l<0||l%2==0!=r>0)return null;let c={from:r<0?e-1:e,to:r>0?e+1:e},u=t.doc.iterRange(e,r>0?t.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let t=u.value;r<0&&(d+=t.length);let s=e+d*r;for(let e=r>0?0:t.length-1,a=r>0?t.length:-1;e!=a;e+=r){let a=i.indexOf(t[e]);if(!(a<0||n.resolveInner(s+e,1).type!=o))if(a%2==0==r>0)h++;else{if(1==h)return{start:c,end:{from:s+e,to:s+e+1},matched:a>>1==l>>1};h--}}r>0&&(d+=t.length)}return u.done?{start:c,matched:!1}:null}(t,e,r,i,a.type,o,s)}function Dt(t,e,r,n,o,s,i){let a=n.parent,l={from:o.from,to:o.to},c=0,u=null==a?void 0:a.cursor();if(u&&(r<0?u.childBefore(n.from):u.childAfter(n.to)))do{if(r<0?u.to<=n.from:u.from>=n.to){if(0==c&&s.indexOf(u.type.name)>-1&&u.from<u.to){let t=At(u);return{start:l,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(Ct(u.type,r,i))c++;else if(Ct(u.type,-r,i)){if(0==c){let t=At(u);return{start:l,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}c--}}}while(r<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}const Nt=Object.create(null),Bt=[t.NodeType.none],Ot=[],Et=Object.create(null),It=Object.create(null);for(let[Lt,Rt]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"]])It[Lt]=Ft(Nt,Rt);function Mt(t,e){Ot.indexOf(t)>-1||(Ot.push(t),console.warn(e))}function Ft(e,r){let o=[];for(let t of r.split(" ")){let r=[];for(let o of t.split(".")){let t=e[o]||n.tags[o];t?"function"==typeof t?r.length?r=r.map(t):Mt(o,`Modifier ${o} used at start of tag`):r.length?Mt(o,`Tag ${o} used as modifier`):r=Array.isArray(t)?t:[t]:Mt(o,`Unknown highlighting tag ${o}`)}for(let t of r)o.push(t)}if(!o.length)return 0;let s=r.replace(/ /g,"_"),i=s+" "+o.map(t=>t.id),a=Et[i];if(a)return a.id;let l=Et[i]=t.NodeType.define({id:Bt.length,name:s,props:[n.styleTags({[s]:o})]});return Bt.push(l),l.id}r.Direction.RTL,r.Direction.LTR,exports.DocInput=f,exports.HighlightStyle=ct,exports.IndentContext=P,exports.LRLanguage=h,exports.Language=c,exports.LanguageSupport=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}},exports.ParseContext=g,exports.TreeIndentContext=E,exports.bracketMatching=function(t={}){return[xt.of(t),St]},exports.bracketMatchingHandle=Tt,exports.codeFolding=rt,exports.continuedIndent=function({except:t,units:e=1}={}){return r=>{let n=t&&t.test(r.textAfter);return r.baseIndent+(n?0:e*r.unit)}},exports.defaultHighlightStyle=gt,exports.defineLanguageFacet=a,exports.delimitedIndent=function({closing:t,align:e=!0,units:r=1}){return n=>M(n,e,r,t)},exports.flatIndent=t=>t.baseIndent,exports.foldAll=X,exports.foldCode=K,exports.foldEffect=W,exports.foldGutter=function(t={}){let n={...it,...t},o=new at(n,!0),s=new at(n,!1),i=r.ViewPlugin.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(y)!=t.state.facet(y)||t.startState.field(H,!1)!=t.state.field(H,!1)||d(t.startState)!=d(t.state)||n.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let r=new e.RangeSetBuilder;for(let e of t.viewportLineBlocks){let n=z(t.state,e.from,e.to)?s:V(t.state,e.from,e.to)?o:null;n&&r.add(e.from,e.from,n)}return r.finish()}}),{domEventHandlers:a}=n;return[i,r.gutter({class:"cm-foldGutter",markers(t){var r;return(null===(r=t.plugin(i))||void 0===r?void 0:r.markers)||e.RangeSet.empty},initialSpacer:()=>new at(n,!1),domEventHandlers:{...a,click:(t,e,r)=>{if(a.click&&a.click(t,e,r))return!0;let n=z(t.state,e.from,e.to);if(n)return t.dispatch({effects:q.of(n)}),!0;let o=V(t.state,e.from,e.to);return!!o&&(t.dispatch({effects:W.of(o)}),!0)}}}),rt()]},exports.foldInside=function(t){let e=t.firstChild,r=t.lastChild;return e&&e.to<r.from?{from:e.to,to:r.type.isError?t.to:r.from}:null},exports.foldKeymap=Z,exports.foldNodeProp=L,exports.foldService=F,exports.foldState=H,exports.foldable=V,exports.getIndentUnit=T,exports.getIndentation=A,exports.indentNodeProp=D,exports.indentOnInput=function(){return e.EditorState.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let r=t.newDoc,{head:n}=t.newSelection.main,o=r.lineAt(n);if(n>o.from+200)return t;let s=r.sliceString(o.from,n);if(!e.some(t=>t.test(s)))return t;let{state:i}=t,a=-1,l=[];for(let{head:c}of i.selection.ranges){let t=i.doc.lineAt(c);if(t.from==a)continue;a=t.from;let e=A(i,t.from);if(null==e)continue;let r=/^\s*/.exec(t.text)[0],n=C(i,e);r!=n&&l.push({from:t.from,to:t.from+r.length,insert:n})}return l.length?[t,{changes:l,sequential:!0}]:t})},exports.indentService=b,exports.indentString=C,exports.indentUnit=S,exports.language=y,exports.languageDataProp=i,exports.matchBrackets=Pt,exports.sublanguageProp=l,exports.syntaxHighlighting=function(t,e){let n,o=[pt];return t instanceof ct&&(t.module&&o.push(r.EditorView.styleModule.of(t.module)),n=t.themeType),(null==e?void 0:e.fallback)?o.push(ht.of(t)):n?o.push(ut.computeN([r.EditorView.darkTheme],e=>e.facet(r.EditorView.darkTheme)==("dark"==n)?[t]:[])):o.push(ut.of(t)),o},exports.syntaxTree=d,exports.unfoldAll=Y,exports.unfoldCode=_,exports.unfoldEffect=q;