1234 |
- import{g as G}from"./index-91b358e1.js";function H(v,D){for(var d=0;d<D.length;d++){const f=D[d];if(typeof f!="string"&&!Array.isArray(f)){for(const b in f)if(b!=="default"&&!(b in v)){const T=Object.getOwnPropertyDescriptor(f,b);T&&Object.defineProperty(v,b,T.get?T:{enumerable:!0,get:()=>f[b]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}};(function(v,D){ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],function(d,f,b){var T=d("../token_iterator").TokenIterator;function s(m,k){return m.type.lastIndexOf(k+".xml")>-1}f.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],f.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],f.formatOptions={lineBreaksAfterCommasInCurlyBlock:!0},f.beautify=function(m){for(var k=new T(m,0,0),t=k.getCurrentToken(),K=m.getTabString(),M=f.singletonTags,F=f.blockTags,V=f.formatOptions||{},n,p=!1,l=!1,g=!1,r="",e="",q="",a=0,R=0,L=0,c=0,y=0,$=0,N=0,_,I=0,i=0,o,B=!1,S=!1,A=!1,h=!1,P={0:0},w=[],j=!1,x=function(){n&&n.value&&n.type!=="string.regexp"&&(n.value=n.value.replace(/^\s*/,""))},O=function(){for(var C=r.length-1;!(C==0||r[C]!==" ");)C=C-1;r=r.slice(0,C+1)},u=function(){r=r.trimRight(),p=!1};t!==null;){if(I=k.getCurrentTokenRow(),k.$rowTokens,n=k.stepForward(),typeof t<"u"){if(e=t.value,y=0,A=q==="style"||m.$modeId==="ace/mode/css",s(t,"tag-open")?(S=!0,n&&(h=F.indexOf(n.value)!==-1),e==="</"&&(h&&!p&&i<1&&i++,A&&(i=1),y=1,h=!1)):s(t,"tag-close")?S=!1:s(t,"comment.start")?h=!0:s(t,"comment.end")&&(h=!1),!S&&!i&&t.type==="paren.rparen"&&t.value.substr(0,1)==="}"&&i++,I!==_&&(i=I,_&&(i-=_)),i){for(u();i>0;i--)r+=`
- `;p=!0,!s(t,"comment")&&!t.type.match(/^(comment|string)$/)&&(e=e.trimLeft())}if(e){if(t.type==="keyword"&&e.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(w[a]=e,x(),g=!0,e.match(/^(else|elseif)$/)&&r.match(/\}[\s]*$/)&&(u(),l=!0)):t.type==="paren.lparen"?(x(),e.substr(-1)==="{"&&(g=!0,B=!1,S||(i=1)),e.substr(0,1)==="{"&&(l=!0,r.substr(-1)!=="["&&r.trimRight().substr(-1)==="["?(u(),l=!1):r.trimRight().substr(-1)===")"?u():O())):t.type==="paren.rparen"?(y=1,e.substr(0,1)==="}"&&(w[a-1]==="case"&&y++,r.trimRight().substr(-1)==="{"?u():(l=!0,A&&(i+=2))),e.substr(0,1)==="]"&&r.substr(-1)!=="}"&&r.trimRight().substr(-1)==="}"&&(l=!1,c++,u()),e.substr(0,1)===")"&&r.substr(-1)!=="("&&r.trimRight().substr(-1)==="("&&(l=!1,c++,u()),O()):(t.type==="keyword.operator"||t.type==="keyword")&&e.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?(u(),x(),l=!0,g=!0):t.type==="punctuation.operator"&&e===";"?(u(),x(),g=!0,A&&i++):t.type==="punctuation.operator"&&e.match(/^(:|,)$/)?(u(),x(),e.match(/^(,)$/)&&N>0&&$===0&&V.lineBreaksAfterCommasInCurlyBlock?i++:(g=!0,p=!1)):t.type==="support.php_tag"&&e==="?>"&&!p?(u(),l=!0):s(t,"attribute-name")&&r.substr(-1).match(/^\s$/)?l=!0:s(t,"attribute-equals")?(O(),x()):s(t,"tag-close")?(O(),e==="/>"&&(l=!0)):t.type==="keyword"&&e.match(/^(case|default)$/)&&j&&(y=1),p&&!(t.type.match(/^(comment)$/)&&!e.substr(0,1).match(/^[/#]$/))&&!(t.type.match(/^(string)$/)&&!e.substr(0,1).match(/^['"@]$/))){if(c=L,a>R)for(c++,o=a;o>R;o--)P[o]=c;else a<R&&(c=P[a]);for(R=a,L=c,y&&(c-=y),B&&!$&&(c++,B=!1),o=0;o<c;o++)r+=K}if(t.type==="keyword"&&e.match(/^(case|default)$/)?j===!1&&(w[a]=e,a++,j=!0):t.type==="keyword"&&e.match(/^(break)$/)&&w[a-1]&&w[a-1].match(/^(case|default)$/)&&(a--,j=!1),t.type==="paren.lparen"&&($+=(e.match(/\(/g)||[]).length,N+=(e.match(/\{/g)||[]).length,a+=e.length),t.type==="keyword"&&e.match(/^(if|else|elseif|for|while)$/)?(B=!0,$=0):!$&&e.trim()&&t.type!=="comment"&&(B=!1),t.type==="paren.rparen")for($-=(e.match(/\)/g)||[]).length,N-=(e.match(/\}/g)||[]).length,o=0;o<e.length;o++)a--,e.substr(o,1)==="}"&&w[a]==="case"&&a--;t.type=="text"&&(e=e.replace(/\s+$/," ")),l&&!p&&(O(),r.substr(-1)!==`
- `&&(r+=" ")),r+=e,g&&(r+=" "),p=!1,l=!1,g=!1,(s(t,"tag-close")&&(h||F.indexOf(q)!==-1)||s(t,"doctype")&&e===">")&&(h&&n&&n.value==="</"?i=-1:i=1),n&&M.indexOf(n.value)===-1&&(s(t,"tag-open")&&e==="</"?a--:s(t,"tag-open")&&e==="<"?a++:s(t,"tag-close")&&e==="/>"&&a--),s(t,"tag-name")&&(q=e),_=I}}t=n}r=r.trim(),m.doc.setValue(r)},f.commands=[{name:"beautify",description:"Format selection (Beautify)",exec:function(m){f.beautify(m.session)},bindKey:"Ctrl-Shift-B"}]}),function(){ace.require(["ace/ext/beautify"],function(d){v&&(v.exports=d)})}()})(E);var z=E.exports;const J=G(z),U=H({__proto__:null,default:J},[z]);export{U as e};
- //# sourceMappingURL=ext-beautify-df15d89e.js.map
|