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