import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{A as t,E as n,F as r,G as i,M as a,R as o,a as s,c,it as l,j as u,m as d,n as ee,v as te,x as f}from"./dist-CknG_5Uc.js";import{a as p,n as m,r as ne,t as h}from"./dist-DaEdy156.js";function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ie(e){return e==9||e==10||e==13||e==32}function g(e,t){let n=e.pos+t;if(A==e&&j==n)return k;for(;ie(e.peek(t));)t++;let r=``;for(;;){let n=e.peek(t);if(!re(n))break;r+=String.fromCharCode(n),t++}return A=e,j=n,k=r||null}function _(e,t){this.name=e,this.parent=t}function v(e,t){return new m(n=>{let r=0,i=t.charCodeAt(0);scan:for(;!(n.next<0);n.advance(),r++)if(n.next==i){for(let e=1;e{p(),t(),y=1,b=2,x=3,S=4,C=5,w=36,T=37,E=38,D=11,O=13,k=null,A=null,j=0,M=new h({start:null,shift(e,t,n,r){return t==y?new _(g(r,1)||``,e):e},reduce(e,t){return t==D&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==y||i==O?new _(g(r,1)||``,e):e},strict:!1}),N=new m((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let n=g(e,0);if(!n)return e.acceptToken(C);if(t.context&&n==t.context.name)return e.acceptToken(b);for(let r=t.context;r;r=r.parent)if(r.name==n)return e.acceptToken(x,-2);e.acceptToken(S)}else if(e.next!=33&&e.next!=63)return e.acceptToken(y)}},{contextual:!0}),P=v(w,`-->`),F=v(T,`?>`),I=v(E,`]]>`),L=u({Text:a.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":a.angleBracket,TagName:a.tagName,"MismatchedCloseTag/TagName":[a.tagName,a.invalid],AttributeName:a.attributeName,AttributeValue:a.attributeValue,Is:a.definitionOperator,"EntityReference CharacterReference":a.character,Comment:a.blockComment,ProcessingInst:a.processingInstruction,DoctypeDecl:a.documentMeta,Cdata:a.special(a.string)}),R=ne.deserialize({version:14,states:",lOQOa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=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[N,P,F,I,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0})})))()}function B(e,t){let n=t&&t.getChild(`TagName`);return n?e.sliceString(n.from,n.to):``}function V(e,t){let n=t&&t.firstChild;return!n||n.name!=`OpenTag`?``:B(e,n)}function ae(e,t,n){let r=t&&t.getChildren(`Attribute`).find(e=>e.from<=n&&e.to>=n),i=r&&r.getChild(`AttributeName`);return i?e.sliceString(i.from,i.to):``}function H(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name==`Element`)return t;return null}function U(e,t){let r=n(e).resolveInner(t,-1),i=null;for(let e=r;!i&&e.parent;e=e.parent)(e.name==`OpenTag`||e.name==`CloseTag`||e.name==`SelfClosingTag`||e.name==`MismatchedCloseTag`)&&(i=e);if(i&&(i.to>t||i.lastChild.type.isError)){let e=i.parent;if(r.name==`TagName`)return i.name==`CloseTag`||i.name==`MismatchedCloseTag`?{type:`closeTag`,from:r.from,context:e}:{type:`openTag`,from:r.from,context:H(e)};if(r.name==`AttributeName`)return{type:`attrName`,from:r.from,context:i};if(r.name==`AttributeValue`)return{type:`attrValue`,from:r.from,context:i};let n=r==i||r.name==`Attribute`?r.childBefore(t):r;return n?.name==`StartTag`?{type:`openTag`,from:t,context:H(e)}:n?.name==`StartCloseTag`&&n.to<=t?{type:`closeTag`,from:t,context:e}:n?.name==`Is`?{type:`attrValue`,from:t,context:i}:n?{type:`attrName`,from:t,context:i}:null}if(r.name==`StartCloseTag`)return{type:`closeTag`,from:t,context:r.parent};for(;r.parent&&r.to==t&&!r.lastChild?.type.isError;)r=r.parent;return r.name==`Element`||r.name==`Text`||r.name==`Document`?{type:`tag`,from:t,context:r.name==`Element`?r:H(r)}:null}function W(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 K(e,t){let n=[],r=[],i=Object.create(null);for(let e of t){let t=W(e);n.push(t),e.global&&r.push(t),e.values&&(i[e.name]=e.values.map(G))}let a=[],o=[],s=Object.create(null);for(let t of e){let e=r,c=i;t.attributes&&(e=e.concat(t.attributes.map(e=>typeof e==`string`?n.find(t=>t.label==e)||{label:e,type:`property`}:(e.values&&(c==i&&(c=Object.create(c)),c[e.name]=e.values.map(G)),W(e)))));let l=new Y(t,e,c);s[l.name]=l,a.push(l),t.top&&o.push(l)}o.length||(o=a);for(let t=0;t{let{doc:t}=e.state,n=U(e.state,e.pos);if(!n||n.type==`tag`&&!e.explicit)return null;let{type:c,from:l,context:u}=n;if(c==`openTag`){let e=o,n=V(t,u);return n&&(e=s[n]?.children||a),{from:l,options:e.map(e=>e.completion),validFor:X}}if(c==`closeTag`){let n=V(t,u);return n?{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`>`),options:[s[n]?.closeNameCompletion||{label:n+`>`,type:`type`}],validFor:X}:null}if(c==`attrName`)return{from:l,options:s[B(t,u)]?.attrs||r,validFor:X};if(c==`attrValue`){let n=ae(t,u,l);if(!n)return null;let r=(s[B(t,u)]?.attrValues||i)[n];return!r||!r.length?null:{from:l,to:e.pos+ +(t.sliceString(e.pos,e.pos+1)==`"`),options:r,validFor:/^"[^"]*"?$/}}if(c==`tag`){let n=V(t,u),r=s[n],i=[],c=u&&u.lastChild;n&&(!c||c.name!=`CloseTag`||B(t,c)!=n)&&i.push(r?r.closeCompletion:{label:``,type:`type`,boost:2});let d=i.concat((r?.children||(u?a:o)).map(e=>e.openCompletion));if(u&&r?.text.length){let t=u.firstChild;t.to>e.pos-20&&!/\S/.test(e.state.sliceDoc(t.to,e.pos))&&(d=d.concat(r.text))}return{from:l,options:d,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}return null}}function q(e={}){let t=[Z.data.of({autocomplete:K(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(Q),new s(Z,t)}function J(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}var Y,X,Z,Q;function $(){return($=e((()=>{z(),f(),l(),o(),Y=class{constructor(e,t,n){this.attrs=t,this.attrValues=n,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:`type`},e.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=e.textContent?e.textContent.map(e=>({label:e,type:`text`})):[]}},X=/^[:\-\.\w\u00b7-\uffff]*$/,Z=ee.define({name:`xml`,parser:R.configure({props:[te.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}}),d.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}}}),c.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:``}},indentOnInput:/^\s*<\/$/}}),Q=r.inputHandler.of((e,t,r,a,o)=>{if(e.composing||e.state.readOnly||t!=r||a!=`>`&&a!=`/`||!Z.isActiveAt(e.state,t,-1))return!1;let s=o(),{state:c}=s,l=c.changeByRange(e=>{let{head:t}=e,r=c.doc.sliceString(t-1,t)==a,o=n(c).resolveInner(t,-1),s;if(r&&a==`>`&&o.name==`EndTag`){let n=o.parent;if(n.parent?.lastChild?.name!=`CloseTag`&&(s=J(c.doc,n.parent,t)))return{range:e,changes:{from:t,to:t+ +(c.doc.sliceString(t,t+1)===`>`),insert:``}}}else if(r&&a==`/`&&o.name==`StartCloseTag`){let e=o.parent;if(o.from==t-2&&e.lastChild?.name!=`CloseTag`&&(s=J(c.doc,e,t))){let e=t+ +(c.doc.sliceString(t,t+1)===`>`),n=`${s}>`;return{range:i.cursor(t+n.length,-1),changes:{from:t,to:e,insert:n}}}}return{range:e}});return!l.changes.empty&&(e.dispatch([s,c.update(l,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)})})))()}$();export{q as xml}; //# sourceMappingURL=dist-Dfje7phy.js.map