/*!
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 e=require("../../../@lezer/javascript/dist/index.js"),t=require("../../language/dist/index.js"),n=require("../../state/dist/index.js"),o=require("../../view/dist/index.js"),i=require("../../autocomplete/dist/index.js"),a=require("../../../@lezer/common/dist/index.js"),r=[i.snippetCompletion("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),i.snippetCompletion("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),i.snippetCompletion("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),i.snippetCompletion("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),i.snippetCompletion("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),i.snippetCompletion("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),i.snippetCompletion("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),i.snippetCompletion("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),i.snippetCompletion("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),i.snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),i.snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],l=r.concat([i.snippetCompletion("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),i.snippetCompletion("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),i.snippetCompletion("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),s=new a.NodeWeakMap,p=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function c(e){return(t,n)=>{let o=t.node.getChild("VariableDefinition");return o&&n(o,e),!0}}const d=["FunctionDeclaration"],m={FunctionDeclaration:c("function"),ClassDeclaration:c("class"),ClassExpression:()=>!0,EnumDeclaration:c("constant"),TypeAliasDeclaration:c("type"),NamespaceDeclaration:c("namespace"),VariableDefinition(e,t){e.matchContext(d)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function u(e,t){let n=s.get(t);if(n)return n;let o=[],i=!0;function r(t,n){let i=e.sliceString(t.from,t.to);o.push({label:i,type:n})}return t.cursor(a.IterMode.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=m[t.name];if(e&&e(t,r)||p.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of u(e,t.node))o.push(n);return!1}}),s.set(t,o),o}const f=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,g=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function y(e){let n=t.syntaxTree(e.state).resolveInner(e.pos,-1);if(g.indexOf(n.name)>-1)return null;let o="VariableName"==n.name||n.to-n.from<20&&f.test(e.state.sliceDoc(n.from,n.to));if(!o&&!e.explicit)return null;let i=[];for(let t=n;t;t=t.parent)p.has(t.name)&&(i=i.concat(u(e.state.doc,t)));return{options:i,from:o?n.from:e.pos,validFor:f}}const S=t.LRLanguage.define({name:"javascript",parser:e.parser.configure({props:[t.indentNodeProp.add({IfStatement:t.continuedIndent({except:/^\s*({|else\b)/}),TryStatement:t.continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t.flatIndent,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),o=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:o?1:2)*e.unit},Block:t.delimitedIndent({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":t.continuedIndent({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag":e=>e.column(e.node.from)+e.unit}),t.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":t.foldInside,BlockComment:e=>({from:e.from+2,to:e.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),b={test:e=>/^JSX/.test(e.name),facet:t.defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},x=S.configure({dialect:"ts"},"typescript"),$=S.configure({dialect:"jsx",props:[t.sublanguageProp.add(e=>e.isTop?[b]:void 0)]}),w=S.configure({dialect:"jsx ts",props:[t.sublanguageProp.add(e=>e.isTop?[b]:void 0)]},"typescript");let C=e=>({label:e,type:"keyword"});const h="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(C),k=h.concat(["declare","implements","private","protected","public"].map(C));function T(e,t,n=e.length){for(let o=null==t?void 0:t.firstChild;o;o=o.nextSibling)if("JSXIdentifier"==o.name||"JSXBuiltin"==o.name||"JSXNamespacedName"==o.name||"JSXMemberExpression"==o.name)return e.sliceString(o.from,Math.min(o.to,n));return""}const v="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),J=o.EditorView.inputHandler.of((e,o,i,a,r)=>{if((v?e.composing:e.compositionStarted)||e.state.readOnly||o!=i||">"!=a&&"/"!=a||!S.isActiveAt(e.state,o,-1))return!1;let l=r(),{state:s}=l,p=s.changeByRange(e=>{var o;let i,{head:r}=e,l=t.syntaxTree(s).resolveInner(r-1,-1);if("JSXStartTag"==l.name&&(l=l.parent),s.doc.sliceString(r-1,r)!=a||"JSXAttributeValue"==l.name&&l.to>r);else{if(">"==a&&"JSXFragmentTag"==l.name)return{range:e,changes:{from:r,insert:"</>"}};if("/"==a&&"JSXStartCloseTag"==l.name){let e=l.parent,t=e.parent;if(t&&e.from==r-2&&((i=T(s.doc,t.firstChild,r))||"JSXFragmentTag"==(null===(o=t.firstChild)||void 0===o?void 0:o.name))){let e=`${i}>`;return{range:n.EditorSelection.cursor(r+e.length,-1),changes:{from:r,insert:e}}}}else if(">"==a){let t=function(e){for(;;){if("JSXOpenTag"==e.name||"JSXSelfClosingTag"==e.name||"JSXFragmentTag"==e.name)return e;if("JSXEscape"==e.name||!e.parent)return null;e=e.parent}}(l);if(t&&"JSXOpenTag"==t.name&&!/^\/?>|^<\//.test(s.doc.sliceString(r,r+2))&&(i=T(s.doc,t,r)))return{range:e,changes:{from:r,insert:`</${i}>`}}}}return{range:e}});return!p.changes.empty&&(e.dispatch([l,s.update(p,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});exports.autoCloseTags=J,exports.javascript=function(e={}){let n=e.jsx?e.typescript?w:$:e.typescript?x:S,o=e.typescript?l.concat(k):r.concat(h);return new t.LanguageSupport(n,[S.data.of({autocomplete:i.ifNotIn(g,i.completeFromList(o))}),S.data.of({autocomplete:y}),e.jsx?J:[]])},exports.javascriptLanguage=S,exports.jsxLanguage=$,exports.localCompletionSource=y,exports.snippets=r,exports.tsxLanguage=w,exports.typescriptLanguage=x,exports.typescriptSnippets=l;