import{C as N,E as R,s as Y,t as m,b as z,L as A,i as j,f as q,q as Z,a as I,g as U}from"./index-08c4e9bb.js";import"./index-5262867b.js";import"./Bar.vue_vue_type_script_setup_true_lang-2f216bc1.js";import"./app-192cbc12.js";import"./Pie.vue_vue_type_script_setup_true_lang-fa06143e.js";import"./Line.vue_vue_type_script_setup_true_lang-07562c79.js";import"./index-771e958b.js";import"./Github.vue_vue_type_script_setup_true_lang-5f576015.js";import"./columns-d84895c5.js";import"./office-building-cc7a1721.js";import"./iphone-89710f1a.js";import"./user-3-fill-99d174b6.js";import"./index-68a687a6.js";const b=1,D=2,F=3,M=4,B=5,L=35,H=36,J=37,K=11,ee=13;function te(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function Oe(e){return e==9||e==10||e==13||e==32}let V=null,X=null,Q=0;function w(e,t){let n=e.pos+t;if(X==e&&Q==n)return V;for(;Oe(e.peek(t));)t++;let O="";for(;;){let a=e.peek(t);if(!te(a))break;O+=String.fromCharCode(a),t++}return X=e,Q=n,V=O||null}function x(e,t){this.name=e,this.parent=t,this.hash=t?t.hash:0;for(let n=0;n{if(e.next==60){if(e.advance(),e.next==47){e.advance();let n=w(e,0);if(!n)return e.acceptToken(B);if(t.context&&n==t.context.name)return e.acceptToken(D);for(let O=t.context;O;O=O.parent)if(O.name==n)return e.acceptToken(F,-2);e.acceptToken(M)}else if(e.next!=33&&e.next!=63)return e.acceptToken(b)}},{contextual:!0});function W(e,t){return new R(n=>{for(let O=0,a=0;;a++){if(n.next<0){a&&n.acceptToken(e);break}if(n.next==t.charCodeAt(O)){if(O++,O==t.length){a>=t.length&&n.acceptToken(e,1-t.length);break}}else O=n.next==t.charCodeAt(0)?1:0;n.advance()}})}const re=W(L,"-->"),le=W(H,"?>"),oe=W(J,"]]>"),se=Y({Text:m.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":m.angleBracket,TagName:m.tagName,"MismatchedCloseTag/Tagname":[m.tagName,m.invalid],AttributeName:m.attributeName,AttributeValue:m.attributeValue,Is:m.definitionOperator,"EntityReference CharacterReference":m.character,Comment:m.blockComment,ProcessingInst:m.processingInstruction,DoctypeDecl:m.documentMeta,Cdata:m.special(m.string)}),ie=z.deserialize({version:14,states:",SOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DS'#DSOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C{'#C{O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C|'#C|O$dOrO,59^OOOP,59^,59^OOOS'#C}'#C}O$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6y-E6yOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6z-E6zOOOP1G.x1G.xOOOS-E6{-E6{OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'jO!bO,59eOOOO-E6w-E6wO'xOpO1G.uO'xOpO1G.uOOOP1G.u1G.uO(QOpO7+$fOOOP7+$f7+$fO(YO!bO<`#X;'S%y;'S;=`&_<%lO%yX>eV{WOr%ysv%yw#T%y#T#U>z#U;'S%y;'S;=`&_<%lO%yX?PV{WOr%ysv%yw#h%y#h#i?f#i;'S%y;'S;=`&_<%lO%yX?kV{WOr%ysv%yw#T%y#T#Ul.from<=n&&l.to>=n),a=O&&O.getChild("AttributeName");return a?e.sliceString(a.from,a.to):""}function _(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function me(e,t){var n;let O=U(e).resolveInner(t,-1),a=null;for(let l=O;!a&&l.parent;l=l.parent)(l.name=="OpenTag"||l.name=="CloseTag"||l.name=="SelfClosingTag"||l.name=="MismatchedCloseTag")&&(a=l);if(a&&(a.to>t||a.lastChild.type.isError)){let l=a.parent;if(O.name=="TagName")return a.name=="CloseTag"||a.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:l}:{type:"openTag",from:O.from,context:_(l)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:a};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:a};let i=O==a||O.name=="Attribute"?O.childBefore(t):O;return(i==null?void 0:i.name)=="StartTag"?{type:"openTag",from:t,context:_(l)}:(i==null?void 0:i.name)=="StartCloseTag"&&i.to<=t?{type:"closeTag",from:t,context:l}:(i==null?void 0:i.name)=="Is"?{type:"attrValue",from:t,context:a}:i?{type:"attrName",from:t,context:a}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((n=O.lastChild)===null||n===void 0)&&n.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:_(O)}:null}class $e{constructor(t,n,O){this.attrs=n,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(a=>({label:a,type:"text"})):[]}}const h=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function G(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let n=[],O=[],a=Object.create(null);for(let r of t){let $=E(r);n.push($),r.global&&O.push($),r.values&&(a[r.name]=r.values.map(G))}let l=[],i=[],u=Object.create(null);for(let r of e){let $=O,o=a;r.attributes&&($=$.concat(r.attributes.map(p=>typeof p=="string"?n.find(g=>g.label==p)||{label:p,type:"property"}:(p.values&&(o==a&&(o=Object.create(o)),o[p.name]=p.values.map(G)),E(p)))));let c=new $e(r,$,o);u[c.name]=c,l.push(c),r.top&&i.push(c)}i.length||(i=l);for(let r=0;r{var $;let{doc:o}=r.state,c=me(r.state,r.pos);if(!c||c.type=="tag"&&!r.explicit)return null;let{type:p,from:g,context:f}=c;if(p=="openTag"){let s=i,y=C(o,f);if(y){let S=u[y];s=(S==null?void 0:S.children)||l}return{from:g,options:s.map(S=>S.completion),validFor:h}}else if(p=="closeTag"){let s=C(o,f);return s?{from:g,to:r.pos+(o.sliceString(r.pos,r.pos+1)==">"?1:0),options:[(($=u[s])===null||$===void 0?void 0:$.closeNameCompletion)||{label:s+">",type:"type"}],validFor:h}:null}else if(p=="attrName"){let s=u[P(o,f)];return{from:g,options:(s==null?void 0:s.attrs)||O,validFor:h}}else if(p=="attrValue"){let s=ye(o,f,g);if(!s)return null;let y=u[P(o,f)],S=((y==null?void 0:y.attrValues)||a)[s];return!S||!S.length?null:{from:g,to:r.pos+(o.sliceString(r.pos,r.pos+1)=='"'?1:0),options:S,validFor:/^"[^"]*"?$/}}else if(p=="tag"){let s=C(o,f),y=u[s],S=[],T=f&&f.lastChild;s&&(!T||T.name!="CloseTag"||P(o,T)!=s)&&S.push(y?y.closeCompletion:{label:"",type:"type",boost:2});let v=S.concat(((y==null?void 0:y.children)||(f?l:i)).map(d=>d.openCompletion));if(f&&(y!=null&&y.text.length)){let d=f.firstChild;d.to>r.pos-20&&!/\S/.test(r.state.sliceDoc(d.to,r.pos))&&(v=v.concat(y.text))}return{from:g,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const k=A.define({name:"xml",parser:ie.configure({props:[j.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),q.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),Z.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/$/}});function we(e={}){return new I(k,k.data.of({autocomplete:pe(e.elements||[],e.attributes||[])}))}export{pe as completeFromSchema,we as xml,k as xmlLanguage};