mode-xml-0d69382e.js 10 KB

12345
  1. import{g as R}from"./index-b2e76ed2.js";function F(_,T){for(var o=0;o<T.length;o++){const x=T[o];if(typeof x!="string"&&!Array.isArray(x)){for(const v in x)if(v!=="default"&&!(v in _)){const d=Object.getOwnPropertyDescriptor(x,v);d&&Object.defineProperty(_,v,d.get?d:{enumerable:!0,get:()=>x[v]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}var y={exports:{}};(function(_,T){ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(o,x,v){var d=o("../lib/oop"),b=o("./text_highlight_rules").TextHighlightRules,f=function(u){var c="[_:a-zA-ZÀ-￿][-_:.a-zA-Z0-9À-￿]*";this.$rules={start:[{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:["punctuation.instruction.xml","keyword.instruction.xml"],regex:"(<\\?)("+c+")",next:"processing_instruction"},{token:"comment.start.xml",regex:"<\\!--",next:"comment"},{token:["xml-pe.doctype.xml","xml-pe.doctype.xml"],regex:"(<\\!)(DOCTYPE)(?=[\\s])",next:"doctype",caseInsensitive:!0},{include:"tag"},{token:"text.end-tag-open.xml",regex:"</"},{token:"text.tag-open.xml",regex:"<"},{include:"reference"},{defaultToken:"text.xml"}],processing_instruction:[{token:"entity.other.attribute-name.decl-attribute-name.xml",regex:c},{token:"keyword.operator.decl-attribute-equals.xml",regex:"="},{include:"whitespace"},{include:"string"},{token:"punctuation.xml-decl.xml",regex:"\\?>",next:"start"}],doctype:[{include:"whitespace"},{include:"string"},{token:"xml-pe.doctype.xml",regex:">",next:"start"},{token:"xml-pe.xml",regex:"[-_a-zA-Z0-9:]+"},{token:"punctuation.int-subset",regex:"\\[",push:"int_subset"}],int_subset:[{token:"text.xml",regex:"\\s+"},{token:"punctuation.int-subset.xml",regex:"]",next:"pop"},{token:["punctuation.markup-decl.xml","keyword.markup-decl.xml"],regex:"(<\\!)("+c+")",push:[{token:"text",regex:"\\s+"},{token:"punctuation.markup-decl.xml",regex:">",next:"pop"},{include:"string"}]}],cdata:[{token:"string.cdata.xml",regex:"\\]\\]>",next:"start"},{token:"text.xml",regex:"\\s+"},{token:"text.xml",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment.end.xml",regex:"-->",next:"start"},{defaultToken:"comment.xml"}],reference:[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],attr_reference:[{token:"constant.language.escape.reference.attribute-value.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],tag:[{token:["meta.tag.punctuation.tag-open.xml","meta.tag.punctuation.end-tag-open.xml","meta.tag.tag-name.xml"],regex:"(?:(<)|(</))((?:"+c+":)?"+c+")",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start"}]}],tag_whitespace:[{token:"text.tag-whitespace.xml",regex:"\\s+"}],whitespace:[{token:"text.whitespace.xml",regex:"\\s+"}],string:[{token:"string.xml",regex:"'",push:[{token:"string.xml",regex:"'",next:"pop"},{defaultToken:"string.xml"}]},{token:"string.xml",regex:'"',push:[{token:"string.xml",regex:'"',next:"pop"},{defaultToken:"string.xml"}]}],attributes:[{token:"entity.other.attribute-name.xml",regex:c},{token:"keyword.operator.attribute-equals.xml",regex:"="},{include:"tag_whitespace"},{include:"attribute_value"}],attribute_value:[{token:"string.attribute-value.xml",regex:"'",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]}]},this.constructor===f&&this.normalizeRules()};(function(){this.embedTagRules=function(u,c,s){this.$rules.tag.unshift({token:["meta.tag.punctuation.tag-open.xml","meta.tag."+s+".tag-name.xml"],regex:"(<)("+s+"(?=\\s|>|$))",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:c+"start"}]}),this.$rules[s+"-end"]=[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start",onMatch:function(l,i,n){return n.splice(0),this.token}}],this.embedRules(u,c,[{token:["meta.tag.punctuation.end-tag-open.xml","meta.tag."+s+".tag-name.xml"],regex:"(</)("+s+"(?=\\s|>|$))",next:s+"-end"},{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\["},{token:"string.cdata.xml",regex:"\\]\\]>"}])}}).call(b.prototype),d.inherits(f,b),x.XmlHighlightRules=f}),ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(o,x,v){var d=o("../../lib/oop"),b=o("../behaviour").Behaviour,f=o("../../token_iterator").TokenIterator;o("../../lib/lang");function u(s,l){return s&&s.type.lastIndexOf(l+".xml")>-1}var c=function(){this.add("string_dquotes","insertion",function(s,l,i,n,e){if(e=='"'||e=="'"){var t=e,a=n.doc.getTextRange(i.getSelectionRange());if(a!==""&&a!=="'"&&a!='"'&&i.getWrapBehavioursEnabled())return{text:t+a+t,selection:!1};var r=i.getCursorPosition(),g=n.doc.getLine(r.row),h=g.substring(r.column,r.column+1),w=new f(n,r.row,r.column),m=w.getCurrentToken();if(h==t&&(u(m,"attribute-value")||u(m,"string")))return{text:"",selection:[1,1]};if(m||(m=w.stepBackward()),!m)return;for(;u(m,"tag-whitespace")||u(m,"whitespace");)m=w.stepBackward();var p=!h||h.match(/\s/);if(u(m,"attribute-equals")&&(p||h==">")||u(m,"decl-attribute-equals")&&(p||h=="?"))return{text:t+t,selection:[1,1]}}}),this.add("string_dquotes","deletion",function(s,l,i,n,e){var t=n.doc.getTextRange(e);if(!e.isMultiLine()&&(t=='"'||t=="'")){var a=n.doc.getLine(e.start.row),r=a.substring(e.start.column+1,e.start.column+2);if(r==t)return e.end.column++,e}}),this.add("autoclosing","insertion",function(s,l,i,n,e){if(e==">"){var t=i.getSelectionRange().start,a=new f(n,t.row,t.column),r=a.getCurrentToken()||a.stepBackward();if(!r||!(u(r,"tag-name")||u(r,"tag-whitespace")||u(r,"attribute-name")||u(r,"attribute-equals")||u(r,"attribute-value"))||u(r,"reference.attribute-value"))return;if(u(r,"attribute-value")){var g=a.getCurrentTokenColumn()+r.value.length;if(t.column<g)return;if(t.column==g){var h=a.stepForward();if(h&&u(h,"attribute-value"))return;a.stepBackward()}}if(/^\s*>/.test(n.getLine(t.row).slice(t.column)))return;for(;!u(r,"tag-name");)if(r=a.stepBackward(),r.value=="<"){r=a.stepForward();break}var w=a.getCurrentTokenRow(),m=a.getCurrentTokenColumn();if(u(a.stepBackward(),"end-tag-open"))return;var p=r.value;return w==t.row&&(p=p.substring(0,t.column-m)),this.voidElements.hasOwnProperty(p.toLowerCase())?void 0:{text:"></"+p+">",selection:[1,1]}}}),this.add("autoindent","insertion",function(s,l,i,n,e){if(e==`
  2. `){var t=i.getCursorPosition(),a=n.getLine(t.row),r=new f(n,t.row,t.column),g=r.getCurrentToken();if(g&&g.type.indexOf("tag-close")!==-1){if(g.value=="/>")return;for(;g&&g.type.indexOf("tag-name")===-1;)g=r.stepBackward();if(!g)return;var h=g.value,w=r.getCurrentTokenRow();if(g=r.stepBackward(),!g||g.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[h]){var m=n.getTokenAt(t.row,t.column+1),a=n.getLine(w),p=this.$getIndent(a),k=p+n.getTabString();return m&&m.value==="</"?{text:`
  3. `+k+`
  4. `+p,selection:[1,k.length,1,k.length]}:{text:`
  5. `+k}}}}})};d.inherits(c,b),x.XmlBehaviour=c}),ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(o,x,v){var d=o("../../lib/oop"),b=o("../../range").Range,f=o("./fold_mode").FoldMode,u=x.FoldMode=function(l,i){f.call(this),this.voidElements=l||{},this.optionalEndTags=d.mixin({},this.voidElements),i&&d.mixin(this.optionalEndTags,i)};d.inherits(u,f);var c=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};function s(l,i){return l.type.lastIndexOf(i+".xml")>-1}(function(){this.getFoldWidget=function(l,i,n){var e=this._getFirstTagInLine(l,n);return e?e.closing||!e.tagName&&e.selfClosing?i==="markbeginend"?"end":"":!e.tagName||e.selfClosing||this.voidElements.hasOwnProperty(e.tagName.toLowerCase())||this._findEndTagInLine(l,n,e.tagName,e.end.column)?"":"start":this.getCommentFoldWidget(l,n)},this.getCommentFoldWidget=function(l,i){return/comment/.test(l.getState(i))&&/<!-/.test(l.getLine(i))?"start":""},this._getFirstTagInLine=function(l,i){for(var n=l.getTokens(i),e=new c,t=0;t<n.length;t++){var a=n[t];if(s(a,"tag-open")){if(e.end.column=e.start.column+a.value.length,e.closing=s(a,"end-tag-open"),a=n[++t],!a)return null;for(e.tagName=a.value,e.end.column+=a.value.length,t++;t<n.length;t++)if(a=n[t],e.end.column+=a.value.length,s(a,"tag-close")){e.selfClosing=a.value=="/>";break}return e}else if(s(a,"tag-close"))return e.selfClosing=a.value=="/>",e;e.start.column+=a.value.length}return null},this._findEndTagInLine=function(l,i,n,e){for(var t=l.getTokens(i),a=0,r=0;r<t.length;r++){var g=t[r];if(a+=g.value.length,!(a<e)&&s(g,"end-tag-open")&&(g=t[r+1],g&&g.value==n))return!0}return!1},this.getFoldWidgetRange=function(l,i,n){var e=l.getMatchingTags({row:n,column:0});return e?new b(e.openTag.end.row,e.openTag.end.column,e.closeTag.start.row,e.closeTag.start.column):this.getCommentFoldWidget(l,n)&&l.getCommentFoldRange(n,l.getLine(n).length)}}).call(u.prototype)}),ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"],function(o,x,v){var d=o("../lib/oop"),b=o("../lib/lang"),f=o("./text").Mode,u=o("./xml_highlight_rules").XmlHighlightRules,c=o("./behaviour/xml").XmlBehaviour,s=o("./folding/xml").FoldMode,l=o("../worker/worker_client").WorkerClient,i=function(){this.HighlightRules=u,this.$behaviour=new c,this.foldingRules=new s};d.inherits(i,f),function(){this.voidElements=b.arrayToMap([]),this.blockComment={start:"<!--",end:"-->"},this.createWorker=function(n){var e=new l(["ace"],"ace/mode/xml_worker","Worker");return e.attachToDocument(n.getDocument()),e.on("error",function(t){n.setAnnotations(t.data)}),e.on("terminate",function(){n.clearAnnotations()}),e},this.$id="ace/mode/xml"}.call(i.prototype),x.Mode=i}),function(){ace.require(["ace/mode/xml"],function(o){_&&(_.exports=o)})}()})(y);var C=y.exports;const A=R(C),M=F({__proto__:null,default:A},[C]);export{M as m};