"use strict";var tt=Object.create;var X=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty;var at=(h,e)=>{for(var t in e)X(h,t,{get:e[t],enumerable:!0})},ce=(h,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of rt(e))!st.call(h,r)&&r!==t&&X(h,r,{get:()=>e[r],enumerable:!(n=nt(e,r))||n.enumerable});return h};var m=(h,e,t)=>(t=h!=null?tt(it(h)):{},ce(e||!h||!h.__esModule?X(t,"default",{value:h,enumerable:!0}):t,h)),ot=h=>ce(X({},"__esModule",{value:!0}),h);var _t={};at(_t,{default:()=>Ye});module.exports=ot(_t);var Ue=m(require("yargs")),Ve=m(require("concat-stream")),Ke=require("vscode-oniguruma"),W=m(require("chalk")),Ge=m(require("lodash")),Qe=m(require("os")),qe=require("fs"),Ze=require("yargs/helpers");var Ne=m(require("ignore")),B=m(require("path")),H=m(require("fs")),f=m(require("process")),$=m(require("chalk")),Je=m(require("glob")),ae=m(require("util")),v=m(require("lodash")),oe=m(require("find-config"));var R=m(require("js-beautify")),i=m(require("lodash")),ft=m(require("vscode-textmate")),w=m(require("detect-indent")),Fe=m(require("aigle")),ke=m(require("xregexp")),Y=require("@shufo/tailwindcss-class-sorter"),se=require("html-attribute-sorter");var Be=require("fs"),Ie=m(require("lodash")),ie=m(require("vscode-oniguruma")),Re=m(require("path"));var S=m(require("lodash")),ge=m(require("fs")),fe=m(require("os")),K=m(require("chalk")),G=m(require("prettier/standalone")),Q=m(require("@prettier/plugin-php/standalone")),lt=m(require("detect-indent"));var z=m(require("lodash")),A="@",P=["@alert","@pushonce","@push","@slot","@switch","@unless","@verbatim","@prependonce","@prepend","@once","@error","@empty","@guest","@isset","@permission","@permissions","@canany","@cannot","@can","@role","@hasrole","@hasanyrole","@hasallroles","@unlessrole","@hasexactroles","@if","@production","@env","@while","@auth","@forelse","@for","@foreach","@php","@component","@section","@customdirective"],he=z.default.map(P,h=>h.substring(1)),E=["@endalert","@endpushonce","@endpush","@endslot","@endswitch","@endunless","@endverbatim","@show","@stop","@endprependonce","@endprepend","@endonce","@enderror","@append","@overwrite","@endempty","@endguest","@endisset","@endpermission","@endpermissions","@endcanany","@endcannot","@endcan","@endrole","@endhasrole","@endhasanyrole","@endhasallroles","@endunlessrole","@endhasexactroles","@endif","@endproduction","@endenv","@endwhile","@endauth","@endforelse","@endforeach","@endfor","@endphp","@endcomponent","@endsection","@endcustomdirective"],D=["@elseenv","@elseif","@elsecanany","@elsecannot","@elsecan","@else","@elsecustomdirective"],ee={"@section":2,"@push":2,"@prepend":2,"@slot":2},pe=["@forelse","@if"],te=["@empty"],de=["@default"],T=["@forelse","@if","@for","@foreach","@while","@sectionmissing","@case"],M=["@endforelse","@endif","@endforeach","@endfor","@endwhile","@break"],ne=["@button","@class","@include","@disabled","@checked","@json"],O=["@set","@json","@selected","@checked","@disabled","@php","@include","@includeif","@includewhen","@includeunless","@includefirst","@button","@class","@props","@aware"],ue=["@if","@while","@case","@isset","@empty","@elseif","@component","@hassection","@unless"],U=["@hassection"],V=["@charset","@color-profile","@counter-style","@font-face","@font-feature-values","@import","@keyframes","@media","@namespace","@page","@property","@supports"];function me(h,e){return z.default.filter(h.tokens,t=>{let n=e.substring(t.startIndex,t.endIndex).trim();return z.default.includes(P,n)||z.default.includes(E,n)}).length>=2}var y="\\(((?:[^)(]+|\\((?:[^)(]+|\\((?:[^)(]+|\\((?:[^)(]+|\\([^)(]*\\))*\\))*\\))*\\))*)\\)?";var _=h=>{let e={get(){return null}};return S.default.isUndefined(h)||S.default.isNull(h)?e:h};async function q(h){return new Promise((e,t)=>{ge.default.readFile(h,(n,r)=>n?t(n):e(r))})}function N(h){return h?h.split(/\r\n|\n|\r/):""}var F=1e3,ye={noPhpSyntaxCheck:!1,printWidth:F,trailingCommaPHP:!0,phpVersion:"8.1",singleQuote:!0};function L(h,e={}){let t={...ye,...e};try{return G.default.format(h.replace(/\n$/,""),{parser:"php",printWidth:1e3,singleQuote:t.singleQuote,phpVersion:t.phpVersion,trailingCommaPHP:t.trailingCommaPHP,plugins:[Q.default]})}catch(n){if(t.noPhpSyntaxCheck===!1)throw n;return h}}function C(h,e={}){let t={...ye,...e};try{return G.default.format(``,{parser:"php",printWidth:t.printWidth,singleQuote:t.singleQuote,phpVersion:t.phpVersion,trailingCommaPHP:t.trailingCommaPHP,plugins:[Q.default]}).replace(/<\?php echo (.*)?\?>/gs,(n,r)=>r.trim().replace(/;\s*$/,""))}catch(n){if(t.noPhpSyntaxCheck===!1)throw n;return h}}function _e(h){let e=``,{ast:t}=G.default.__debug.parse(e,{parser:"php",phpVersion:"8.0",plugins:[Q.default]});try{return t.children[0].expression.arguments.length||0}catch{return 0}}function we(h){return Promise.all(S.default.map(h,async e=>{process.stdout.write(`path: ${K.default.bold(e.path)}:${e.line} `),process.stdout.write(K.default.red(`--${e.original} `)),process.stdout.write(K.default.green(`++${e.formatted} `))}))}function ve(h,e,t){let n=S.default.map(e,(r,s)=>S.default.isEmpty(r)||r===t[s]?null:{path:h,line:s+1,original:r,formatted:t[s]});return S.default.without(n,null)}async function ct(h){let e=S.default.without(P,"@switch","@forelse","@php").join("|"),t=new RegExp(`(?!\\/\\*.*?\\*\\/)(${e})(\\s*?)${y}`,"gmi");return new Promise(n=>n(h)).then(n=>S.default.replace(n,t,(r,s,a,l)=>L(``).replace(/<\?php\s(.*?)(\s*?)\((.*?)\);*\s\?>\n/gs,(o,c,d,p)=>`@${c.trim()}${d}(${p.trim()})`).replace(/([\n\s]*)->([\n\s]*)/gs,"->").replace(/,\)$/,")").replace(/(?:\n\s*)* as(?= (?:&{0,1}\$[\w]+|list|\[\$[\w]+))/g," as"))).then(n=>L(n))}async function be(h){return ct(h)}function Pe(h){let e=S.default.without(T,"@case"),t=S.default.without(M,"@break");return new Promise(n=>n(h)).then(n=>{let r=new RegExp(`(${e.join("|")})([\\s]*?)${y}`,"gis");return S.default.replace(n,r,(s,a,l,o)=>``)}).then(n=>{let r=new RegExp(`(?!end=".*)(${t.join("|")})(?!.*")`,"gi");return S.default.replace(n,r,(s,a)=>``)})}function $e(h){return new Promise(e=>e(h)).then(e=>S.default.replace(e,//gs,(t,n,r)=>`${n}(${S.default.unescape(r)})`)).then(e=>S.default.replace(e,/<\/beautifyTag.*?end="(.*?)"\s*>/gs,(t,n)=>`${n}`))}var ht=["/\\*\\* phptag_start \\*\\*/","/\\*\\* end_phptag \\*\\*/","/\\*escaped\\*/","__BLADE__;","/\\* blade_comment_start \\*/","/\\* blade_comment_end \\*/","/\\*\\*\\*script_placeholder\\*\\*\\*/","beautifyTag","@customdirective","@elsecustomdirective","@endcustomdirective"];function xe(h){if(new RegExp(ht.join("|")).test(h))throw new Error(["Can't format blade: something goes wrong.","Please check if template is too complicated or not. Or simplify template might solves issue."].join(` `));return h}function re(h){return h.replace(/\$/g,"$$$$")}function Se(h){switch(h){case"LF":return` `;case"CRLF":return`\r `;default:return fe.default.EOL}}var Z=class{constructor(e,t){return(async()=>{var n;return this.vsctm=(n=e.default)!=null?n:e,this.oniguruma=t||ie.default||ie,await this.loadWasm(),this})()}async loadWasm(){var t;let e=await Be.promises.readFile(require.resolve("vscode-oniguruma/release/onig.wasm"));if(await((t=this.oniguruma)==null?void 0:t.loadWASM(e.buffer)),!this.initCalled){try{this.oniguruma.loadWASM(e.buffer)}catch{this.initCalled=!0}this.initCalled=!0}}createRegistry(){return this.registry=new this.vsctm.Registry({loadGrammar:e=>e==="text.html.php.blade"?q(Re.default.resolve(__dirname,"../syntaxes/blade.tmLanguage.json")).then(t=>this.vsctm.parseRawGrammar(t.toString(),"./blade.tmLanguage.json")):null,onigLib:Promise.resolve({createOnigScanner:e=>new this.oniguruma.OnigScanner(e),createOnigString:e=>new this.oniguruma.OnigString(e)})}),this.registry}tokenizeLines(e,t){return Ie.default.map(e,n=>{var r;return t.tokenizeLine(n,(r=this.vsctm)==null?void 0:r.INITIAL)})}};function dt(h){return h.split(` `)}function ut(h){return h.trim().startsWith("*")}function mt(h){return h.length>1}function gt(h){return` ${h}`}function Ee(h){let e=dt(h);if(!mt(e))return h;let t=!1;return e.map((r,s)=>{if(s===0||t)return r;if(!ut(r))return t=!0,r;let a=r.trim();return gt(a)}).join(` `)}var De=m(require("lodash"));function Le(h){let e=["@unless"];return De.default.replace(h,new RegExp(`(?`${n} (${r})`)}var j=class{constructor(e){this.options={noPhpSyntaxCheck:!1,...e},this.vsctm=_(this.options).vsctm||ft,this.oniguruma=_(this.options).oniguruma,this.indentCharacter=_(this.options).useTabs?" ":" ",this.indentSize=_(this.options).indentSize||4,this.wrapLineLength=_(this.options).wrapLineLength||120,this.wrapAttributes=_(this.options).wrapAttributes||"auto",this.currentIndentLevel=0,this.shouldBeIndent=!1,this.isInsideCommentBlock=!1,this.stack=[],this.ignoredLines=[],this.curlyBracesWithJSs=[],this.rawBlocks=[],this.rawPhpTags=[],this.inlineDirectives=[],this.conditions=[],this.inlinePhpDirectives=[],this.rawPropsBlocks=[],this.bladeDirectives=[],this.bladeDirectivesInStyle=[],this.bladeComments=[],this.phpComments=[],this.bladeBraces=[],this.rawBladeBraces=[],this.nonnativeScripts=[],this.scripts=[],this.htmlAttributes=[],this.xData=[],this.xInit=[],this.htmlTags=[],this.templatingStrings=[],this.stringLiteralInPhp=[],this.shorthandBindings=[],this.componentAttributes=[],this.customDirectives=[],this.directivesInScript=[],this.unbalancedDirectives=[],this.escapedBladeDirectives=[],this.result=[],this.diffs=[],this.defaultPhpFormatOption={noPhpSyntaxCheck:this.options.noPhpSyntaxCheck,printWidth:this.wrapLineLength},this.endOfLine=Se(_(this.options).endOfLine)}formatContent(e){return new Promise(t=>t(e)).then(t=>this.preserveIgnoredLines(t)).then(t=>this.preserveNonnativeScripts(t)).then(t=>this.preserveCurlyBraceForJS(t)).then(t=>this.preserveRawPhpTags(t)).then(t=>this.preserveEscapedBladeDirective(t)).then(t=>be(t)).then(t=>this.preserveBladeComment(t)).then(t=>this.preserveBladeBrace(t)).then(t=>this.preserveRawBladeBrace(t)).then(t=>this.preserveConditions(t)).then(t=>this.preserveInlineDirective(t)).then(t=>this.preserveInlinePhpDirective(t)).then(t=>this.preserveBladeDirectivesInScripts(t)).then(t=>this.preserveBladeDirectivesInStyles(t)).then(t=>this.preserveCustomDirective(t)).then(t=>this.preserveUnbalancedDirective(t)).then(t=>this.breakLineBeforeAndAfterDirective(t)).then(async t=>(this.bladeDirectives=await this.formatPreservedBladeDirectives(this.bladeDirectives),t)).then(t=>this.preserveScripts(t)).then(t=>this.sortTailwindcssClasses(t)).then(t=>this.formatXInit(t)).then(t=>this.formatXData(t)).then(t=>this.preserveComponentAttribute(t)).then(t=>this.preserveShorthandBinding(t)).then(t=>this.sortHtmlAttributes(t)).then(t=>this.preservePhpBlock(t)).then(t=>this.preserveHtmlAttributes(t)).then(t=>this.preserveHtmlTags(t)).then(t=>this.formatAsHtml(t)).then(t=>this.formatAsBlade(t)).then(t=>this.restoreHtmlTags(t)).then(t=>this.restoreHtmlAttributes(t)).then(t=>this.restorePhpBlock(t)).then(t=>this.restoreShorthandBinding(t)).then(t=>this.restoreComponentAttribute(t)).then(t=>this.restoreXData(t)).then(t=>this.restoreXInit(t)).then(t=>this.restoreScripts(t)).then(t=>this.restoreUnbalancedDirective(t)).then(t=>this.restoreCustomDirective(t)).then(t=>this.restoreBladeDirectivesInStyles(t)).then(t=>this.restoreBladeDirectivesInScripts(t)).then(t=>this.restoreInlinePhpDirective(t)).then(t=>this.restoreInlineDirective(t)).then(t=>this.restoreConditions(t)).then(t=>this.restoreRawBladeBrace(t)).then(t=>this.restoreBladeBrace(t)).then(t=>this.restoreBladeComment(t)).then(t=>this.restoreEscapedBladeDirective(t)).then(t=>this.restoreRawPhpTags(t)).then(t=>this.restoreCurlyBraceForJS(t)).then(t=>this.restoreNonnativeScripts(t)).then(t=>this.restoreIgnoredLines(t)).then(t=>Le(t)).then(t=>xe(t))}formatAsHtml(e){let t={indent_size:_(this.options).indentSize||4,wrap_line_length:_(this.options).wrapLineLength||120,wrap_attributes:_(this.options).wrapAttributes||"auto",end_with_newline:_(this.options).endWithNewline||!0,max_preserve_newlines:_(this.options).noMultipleEmptyLines?1:void 0,css:{end_with_newline:!1},eol:this.endOfLine},n=new Promise(r=>r(e)).then(r=>Pe(r)).then(r=>R.default.html_beautify(r,t)).then(r=>$e(r));return Promise.resolve(n)}async sortTailwindcssClasses(e){return this.options.sortTailwindcssClasses?i.default.replace(e,/(?<=\s+(?!:)class\s*=\s*([\"\']))(.*?)(?=\1)/gis,(t,n,r)=>{if(i.default.isEmpty(r))return r;if(this.options.tailwindcssConfigPath){let s={tailwindConfigPath:this.options.tailwindcssConfigPath};return(0,Y.sortClasses)(r,s)}if(this.options.tailwindcssConfig){let s={tailwindConfig:this.options.tailwindcssConfig};return(0,Y.sortClasses)(r,s)}return(0,Y.sortClasses)(r)}):e}async preserveIgnoredLines(e){return i.default.chain(e).replace(/(^(?this.storeIgnoredLines(`${n}${r.replace(/^\n/,"")}`)).replace(/(?:({{--\s*?blade-formatter-disable\s*?--}}||{{--\s*?prettier-ignore-start\s*?--}})).*?(?:({{--\s*?blade-formatter-enable\s*?--}}||{{--\s*?prettier-ignore-end\s*?--}}))/gis,t=>this.storeIgnoredLines(t)).replace(/(?:{{--\s*?blade-formatter-disable-next-line\s*?--}}|{{--\s*?prettier-ignore\s*?--}}|)[\r\n]+[^\r\n]+/gis,t=>this.storeIgnoredLines(t)).value()}async preserveCurlyBraceForJS(e){return i.default.replace(e,/@{{(.*?)}}/gs,(t,n)=>this.storeCurlyBraceForJS(n))}async preservePhpBlock(e){return this.preserveRawPhpBlock(e)}async preservePropsBlock(e){return i.default.replace(e,/@props\(((?:[^\\(\\)]|\([^\\(\\)]*\))*)\)/gs,(t,n)=>this.storeRawPropsBlock(n))}async preserveRawPhpBlock(e){return i.default.replace(e,/(?this.storeRawBlock(n))}async preserveHtmlTags(e){let t=["textarea","pre"];return i.default.replace(e,new RegExp(`<(${t.join("|")})\\s{0,1}.*?>.*?<\\/(${t.join("|")})>`,"gis"),n=>this.storeHtmlTag(n))}preserveCustomDirective(e){let t=[...i.default.without(P,"@unless"),...E,...D,"@unless\\(.*?\\)"].join("|"),n=i.default.chain([...i.default.without(P,"@unless","@for"),...E,...D,...O,...i.default.without(T,"@for"),"@unless[a-z]*\\(.*?\\)","@for\\(.*?\\)",...U,...V]).uniq().join("|").value(),r=new RegExp(`(?!(${n}))(@([a-zA-Z1-9_\\-]+))(?!.*?@end\\3)${y}.*?(?this.storeInlineCustomDirective(l)),a=i.default.replace(a,s,(l,o,c,d,p,u,g,x)=>{if(P.includes(c))return l;let b=l;return b=i.default.replace(b,new RegExp(`${c}(${y})*`,"gim"),I=>this.storeBeginCustomDirective(I)),b=i.default.replace(b,x,this.storeEndCustomDirective(x)),b=i.default.replace(b,new RegExp(`@else${p}(${y})*`,"gim"),I=>this.storeElseCustomDirective(I)),b}),s.test(a)&&(a=this.preserveCustomDirective(a)),a}preserveInlineDirective(e){let t=new RegExp(`(<[\\w\\-\\_]+?[^>]*?)${A}(${he.join("|")})(\\s*?)?(\\([^)]*?\\))?((?:(?!@end\\2).)+)(@end\\2|@endif)(.*?/*>)`,"gims"),n=i.default.replace(e,t,(r,s,a,l,o,c,d,p)=>l===void 0&&o===void 0?`${s}${this.storeInlineDirective(`${A}${a.trim()}${c.trim()} ${d.trim()}`)}${p}`:l===void 0?`${s}${this.storeInlineDirective(`${A}${a.trim()}${o.trim()}${c}${d.trim()}`)}${p}`:o===void 0?`${s}${this.storeInlineDirective(`${A}${a.trim()}${l}${c.trim()} ${d.trim()}`)}${p}`:`${s}${this.storeInlineDirective(`${A}${a.trim()}${l}${o.trim()} ${c.trim()} ${d.trim()}`)}${p}`);return t.test(n)?this.preserveInlineDirective(n):n}async preserveInlinePhpDirective(e){return i.default.replace(e,new RegExp(`(?!\\/\\*.*?\\*\\/)(${O.join("|")})(\\s*?)${y}`,"gmsi"),t=>this.storeInlinePhpDirective(t))}preserveBladeDirectivesInScripts(e){return i.default.replace(e,/(?<=]*?(?)(.*?)(?=<\/script>)/gis,t=>{let n=[...P,...O];if(new RegExp(n.join("|"),"gmi").test(t)===!1)return/^[\s\n]+$/.test(t)?t.trim():t;let r=O.join("|"),s=new RegExp(`(?!\\/\\*.*?\\*\\/)(${r})(\\s*?)${y}`,"gmi"),a=i.default.chain(E).without("@endphp"),l=t;return l=i.default.replace(l,s,o=>this.storeBladeDirective(C(o,{...this.defaultPhpFormatOption,printWidth:F}))),l=i.default.replace(l,new RegExp(`(${P.join("|")})\\s*?${y}`,"gis"),o=>`if ( /*${this.storeBladeDirectiveInScript(o)}*/ ) {`),l=i.default.replace(l,new RegExp(`(${[...D,...te].join("|")})(?!\\w+?\\s*?\\(.*?\\))`,"gis"),o=>`/***script_placeholder***/} /* ${this.storeBladeDirectiveInScript(o)} */ {`),l=i.default.replace(l,new RegExp(`(${a.join("|")})`,"gis"),o=>`/***script_placeholder***/} /*${this.storeBladeDirectiveInScript(o)}*/`),l=i.default.replace(l,/(?this.storeRawBlock(c)),l=this.preserveCustomDirectiveInScript(l),l})}preserveBladeDirectivesInStyles(e){return i.default.replace(e,/(?<=]*?(?)(.*?)(?=<\/style>)/gis,t=>{let n=t,r=new RegExp(`(?!${["@end","@else",...V].join("|")})@(\\w+)\\s*?(?![^\\1]*@end\\1)${y}`,"gmi");n=i.default.replace(n,r,c=>`${this.storeBladeDirectiveInStyle(c)} {/* inline_directive */}`);let s=new RegExp(`(?!${["@end","@else",...V].join("|")})@(\\w+)\\s*?(${y})`,"gmi");n=i.default.replace(n,s,c=>`${this.storeBladeDirectiveInStyle(c)} { /*start*/`);let a=new RegExp(`(${P.join("|")})\\s*?(${y})`,"gmi");n=i.default.replace(n,a,c=>`${this.storeBladeDirectiveInStyle(c)} { /*start*/`);let l=new RegExp(`(${["@else\\w+",...D].join("|")})\\s*?(${y})?`,"gmi");n=i.default.replace(n,l,c=>`} ${this.storeBladeDirectiveInStyle(c)} { /*else*/`);let o=new RegExp(`${["@end\\w+",...E].join("|")}`,"gmi");return n=i.default.replace(n,o,c=>`} /* ${this.storeBladeDirectiveInStyle(c)} */`),n})}preserveCustomDirectiveInScript(e){let t=[...i.default.without(P,"@unless"),...E,...D,"@unless\\(.*?\\)"].join("|"),n=[...i.default.without(P,"@unless"),...E,...D,...O,...T,"@unless[a-z]*\\(.*?\\)",...U].join("|"),r=new RegExp(`(?!(${n}))(@([a-zA-Z1-9_\\-]+))(?!.*?@end\\3)${y}.*?(?this.storeInlineCustomDirective(l)),a=i.default.replace(a,s,(l,o,c,d,p,u,g,x)=>{if(P.includes(c))return l;let b=l;return b=i.default.replace(b,new RegExp(`${c}(${y})*`,"gim"),I=>`if ( /*${this.storeBladeDirectiveInScript(I)}*/ ) {`),b=i.default.replace(b,new RegExp(`@else${p}(${y})*`,"gim"),I=>`/***script_placeholder***/} /* ${this.storeBladeDirectiveInScript(I)} */ {`),b=i.default.replace(b,x,I=>`/***script_placeholder***/} /*${this.storeBladeDirectiveInScript(I)}*/`),b}),s.test(a)&&(a=this.preserveCustomDirectiveInScript(a)),a}breakLineBeforeAndAfterDirective(e){e=i.default.replace(e,new RegExp(`(?<=<.*?(?)(${i.default.without(P,"@php").join("|")})(\\s*)${y}.*?(?=<.*?>)`,"gmis"),s=>` ${s.trim()} `),e=i.default.replace(e,new RegExp(`(?<=<.*?(?).*?(${i.default.without(E,"@endphp").join("|")})(?=<.*?>)`,"gmis"),s=>` ${s.trim()} `);let t=["@case",...D];e=i.default.replace(e,new RegExp(`(\\s*?)(${t.join("|")})(\\s*?)${y}(\\s*)`,"gmi"),s=>` ${s.trim()} `),e=i.default.replace(e,new RegExp(`\\s*?(?!(${i.default.without(D,"@else").join("|")}))@else\\s+`,"gim"),s=>` ${s.trim()} `),e=i.default.replace(e,/@case\S*?\s*?@case/gim,s=>`${s.replace(` `,"")}`);let n=["@break"];i.default.forEach(n,s=>{e=i.default.replace(e,new RegExp(`(\\s*?)${s}\\s+`,"gmi"),a=>` ${a.trim()} `)}),i.default.forEach(["@default"],s=>{e=i.default.replace(e,new RegExp(`(\\s*?)${s}\\s*`,"gmi"),a=>` ${a.trim()} `)});let r=i.default.chain(P).map(s=>i.default.replace(s,/@/,"")).value();return i.default.forEach(r,s=>{try{let a=ke.default.matchRecursive(e,`\\@${s}`,`\\@end${s}`,"gmi",{valueNames:[null,"left","match","right"]});if(i.default.isEmpty(a))return;for(let l of a)if(l.name==="match"){new RegExp(P.join("|")).test(l.value)&&(e=i.default.replace(e,l.value,this.breakLineBeforeAndAfterDirective(re(l.value))));let o=new RegExp(`^(\\s*?)${y}(.*)`,"gmis"),c=i.default.replace(`${l.value}`,o,(d,p,u,g)=>g.trim()===""?`${p}(${u.trim()}) ${g.trim()}`:`${p}(${u.trim()}) ${g.trim()} `);e=i.default.replace(e,l.value,re(c))}}catch{}}),e}async preserveEscapedBladeDirective(e){return i.default.replace(e,/@@\w*/gim,t=>this.storeEscapedBladeDirective(t))}async preserveBladeComment(e){return i.default.replace(e,/\{\{--(.*?)--\}\}/gs,t=>this.storeBladeComment(t))}preservePhpComment(e){return i.default.replace(e,/\/\*(?:[^*]|[\r\n]|(?:\*+(?:[^*\/]|[\r\n])))*\*+\//gi,t=>this.storePhpComment(t))}async preserveBladeBrace(e){return i.default.replace(e,/\{\{(.*?)\}\}/gs,(t,n)=>n===""?this.storeBladeBrace(n,n.length):/\S/.test(n)?this.storeBladeBrace(n.trim(),n.trim().length):this.storeBladeBrace(" ",1))}async preserveRawBladeBrace(e){return i.default.replace(e,/\{!!(.*?)!!\}/gs,(t,n)=>n===""?this.storeRawBladeBrace(n):/\S/.test(n)?this.storeRawBladeBrace(n.trim()):this.storeRawBladeBrace(" "))}async preserveConditions(e){let t=new RegExp(`(${ue.join("|")})(\\s*?)${y}`,"gi");return i.default.replace(e,t,(n,r,s,a)=>`${r}${s}(${this.storeConditions(a)})`)}preserveUnbalancedDirective(e){let t=new RegExp(`((${U.join("|")})(?!.*?\\2)(?:\\s|\\(.*?\\)))+(?=.*?@endif)`,"gis"),n=i.default.replace(e,t,(r,s)=>`${this.storeUnbalancedDirective(s)}`);return t.test(n)&&(n=this.preserveUnbalancedDirective(n)),n}async preserveRawPhpTags(e){return i.default.replace(e,/<\?php(.*?)\?>/gms,t=>this.storeRawPhpTags(t))}async preserveNonnativeScripts(e){return i.default.replace(e,/]*?type=(["'])(?!text\/javascript)[^\1]*?\1[^>]*?>.*?<\/script>/gis,t=>this.storeNonnativeScripts(t))}async preserveScripts(e){return i.default.replace(e,/.*?<\/script>/gis,t=>this.storeScripts(t))}async preserveHtmlAttributes(e){return i.default.replace(e,/(?<=<[\w]*?[\s].*?)[\w\-\_\:]+?=(["']).*?(?)/gms,t=>`${this.storeHtmlAttribute(t)}`)}async sortHtmlAttributes(e){var n;let t=(n=this.options.sortHtmlAttributes)!=null?n:"none";if(!i.default.isEmpty(t)&&t!=="none"){let r=this.options.customHtmlAttributesOrder;if(i.default.isArray(r))return(0,se.sortAttributes)(e,{order:t,customRegexes:r});let s=i.default.chain(r).split(",").map(i.default.trim).value();return(0,se.sortAttributes)(e,{order:t,customRegexes:s})}return e}async preserveShorthandBinding(e){return i.default.replace(e,/(?<=<(?!livewire:)[^<]*?(\s|x-bind)):{1}(?)[\w\-_.]*?=(["'])(?!=>)[^]*?\2(?=[^>]*?\/*?>)/gim,t=>`${this.storeShorthandBinding(t)}`)}async preserveComponentAttribute(e){return i.default.replace(e,/(?<=<(x-|livewire:)[^<]*?\s):{1,2}(?)[\w\-_.]*?=(["'])(?!=>)[^]*?\2(?=[^>]*?\/*?>)/gim,t=>`${this.storeComponentAttribute(t)}`)}async formatXData(e){return i.default.replace(e,/(\s*)x-data="(.*?)"(\s*)/gs,(t,n,r,s)=>`${n}x-data="${this.storeXData(r)}"${s}`)}async formatXInit(e){return i.default.replace(e,/(\s*)x-init="(.*?)"(\s*)/gs,(t,n,r,s)=>`${n}x-init="${this.storeXInit(r)}"${s}`)}preserveStringLiteralInPhp(e){return i.default.replace(e,/(\"([^\\]|\\.)*?\"|\'([^\\]|\\.)*?\')/gm,t=>`${this.storeStringLiteralInPhp(t)}`)}storeIgnoredLines(e){return this.getIgnoredLinePlaceholder(this.ignoredLines.push(e)-1)}storeCurlyBraceForJS(e){return this.getCurlyBraceForJSPlaceholder(this.curlyBracesWithJSs.push(e)-1)}storeRawBlock(e){return this.getRawPlaceholder(this.rawBlocks.push(e)-1)}storeInlineDirective(e){return this.getInlinePlaceholder(this.inlineDirectives.push(e)-1,e.length)}storeConditions(e){return this.getConditionPlaceholder(this.conditions.push(e)-1)}storeInlinePhpDirective(e){return this.getInlinePhpPlaceholder(this.inlinePhpDirectives.push(e)-1)}storeRawPropsBlock(e){return this.getRawPropsPlaceholder(this.rawPropsBlocks.push(e)-1)}storeBladeDirective(e){return this.getBladeDirectivePlaceholder(this.bladeDirectives.push(e)-1)}storeBladeDirectiveInStyle(e){return this.getBladeDirectiveInStylePlaceholder((this.bladeDirectivesInStyle.push(e)-1).toString())}storeEscapedBladeDirective(e){return this.getEscapedBladeDirectivePlaceholder((this.escapedBladeDirectives.push(e)-1).toString())}storeBladeComment(e){return this.getBladeCommentPlaceholder(this.bladeComments.push(e)-1)}storePhpComment(e){return this.getPhpCommentPlaceholder((this.phpComments.push(e)-1).toString())}storeHtmlTag(e){return this.getHtmlTagPlaceholder((this.htmlTags.push(e)-1).toString())}storeInlineCustomDirective(e){return this.getInlineCustomDirectivePlaceholder((this.customDirectives.push(e)-1).toString())}storeBeginCustomDirective(e){return this.getBeginCustomDirectivePlaceholder((this.customDirectives.push(e)-1).toString())}storeElseCustomDirective(e){return this.getElseCustomDirectivePlaceholder((this.customDirectives.push(e)-1).toString())}storeEndCustomDirective(e){return this.getEndCustomDirectivePlaceholder((this.customDirectives.push(e)-1).toString())}storeUnbalancedDirective(e){return this.getUnbalancedDirectivePlaceholder((this.unbalancedDirectives.push(e)-1).toString())}storeBladeBrace(e,t){let n=this.bladeBraces.push(e)-1,r="{{ }}";return this.getBladeBracePlaceholder(n,t+r.length)}storeRawBladeBrace(e){let t=this.rawBladeBraces.push(e)-1;return this.getRawBladeBracePlaceholder(t)}storeRawPhpTags(e){let t=this.rawPhpTags.push(e)-1;return this.getRawPhpTagPlaceholder(t)}storeNonnativeScripts(e){let t=this.nonnativeScripts.push(e)-1;return this.getNonnativeScriptPlaceholder(t.toString())}storeScripts(e){let t=this.scripts.push(e)-1;return this.getScriptPlaceholder(t)}storeHtmlAttribute(e){let t=this.htmlAttributes.push(e)-1;return e.length>0?this.getHtmlAttributePlaceholder(t.toString(),e.length):this.getHtmlAttributePlaceholder(t.toString(),0)}storeShorthandBinding(e){let t=this.shorthandBindings.push(e)-1;return this.getShorthandBindingPlaceholder(t.toString(),e.length)}storeComponentAttribute(e){let t=this.componentAttributes.push(e)-1;return this.getComponentAttributePlaceholder(t.toString())}storeXData(e){let t=this.xData.push(e)-1;return this.getXDataPlaceholder(t)}storeXInit(e){let t=this.xInit.push(e)-1;return this.getXInitPlaceholder(t)}storeTemplatingString(e){let t=this.templatingStrings.push(e)-1;return this.getTemplatingStringPlaceholder(t)}storeStringLiteralInPhp(e){let t=this.stringLiteralInPhp.push(e)-1;return this.getStringLiteralInPhpPlaceholder(t)}storeBladeDirectiveInScript(e){return this.getBladeDirectiveInScriptPlaceholder((this.directivesInScript.push(e)-1).toString())}getIgnoredLinePlaceholder(e){return i.default.replace("___ignored_line_#___","#",e)}getCurlyBraceForJSPlaceholder(e){return i.default.replace("___js_curly_brace_#___","#",e)}getRawPlaceholder(e){return i.default.replace("___raw_block_#___","#",e)}getInlinePlaceholder(e,t=0){if(t>0){let r=t-"___inline_directive_#___".length;return i.default.replace(`___inline_directive_${i.default.repeat("_",r>0?r:0)}#___`,"#",e)}return i.default.replace("___inline_directive_+?#___","#",e)}getConditionPlaceholder(e){return i.default.replace("___directive_condition_#___","#",e)}getInlinePhpPlaceholder(e){return i.default.replace("___inline_php_directive_#___","#",e)}getRawPropsPlaceholder(e){return i.default.replace("@__raw_props_block_#__@","#",e)}getBladeDirectivePlaceholder(e){return i.default.replace("___blade_directive_#___","#",e)}getBladeDirectiveInStylePlaceholder(e){return i.default.replace(".___blade_directive_in_style_#__","#",e)}getEscapedBladeDirectivePlaceholder(e){return i.default.replace("___escaped_directive_#___","#",e)}getBladeCommentPlaceholder(e){return i.default.replace("___blade_comment_#___","#",e)}getPhpCommentPlaceholder(e){return i.default.replace("___php_comment_#___","#",e)}getBladeBracePlaceholder(e,t=0){if(t>0){let r=t-"___blade_brace_#___".length;return i.default.replace(`___blade_brace_${i.default.repeat("_",r>0?r:0)}#___`,"#",e)}return i.default.replace("___blade_brace_+?#___","#",e)}getRawBladeBracePlaceholder(e){return i.default.replace("___raw_blade_brace_#___","#",e)}getRawPhpTagPlaceholder(e){return i.default.replace("___raw_php_tag_#___","#",e)}getNonnativeScriptPlaceholder(e){return i.default.replace("","#",e)}getScriptPlaceholder(e){return i.default.replace("","#",e)}getHtmlTagPlaceholder(e){return i.default.replace("","#",e)}getInlineCustomDirectivePlaceholder(e){return i.default.replace("___inline_cd_#___","#",e)}getBeginCustomDirectivePlaceholder(e){return i.default.replace("@customdirective(___#___)","#",e)}getElseCustomDirectivePlaceholder(e){return i.default.replace("@else(___#___)","#",e)}getEndCustomDirectivePlaceholder(e){return i.default.replace("@endcustomdirective(___#___)","#",e)}getUnbalancedDirectivePlaceholder(e){return i.default.replace("@if (unbalanced___#___)","#",e)}getHtmlAttributePlaceholder(e,t){if(t&&t>0){let r=t-"___attrs_#___".length;return i.default.replace(`___attrs${i.default.repeat("_",r>0?r:1)}#___`,"#",e)}return i.default.isNull(t)?i.default.replace("___attrs_#___","#",e):i.default.replace("___attrs_+?#___","#",e)}getShorthandBindingPlaceholder(e,t=0){if(t&&t>0){let r=t-"___short_binding_#___".length;return i.default.replace(`___short_binding_${i.default.repeat("_",r>0?r:1)}#___`,"#",e)}return i.default.replace("___short_binding_+?#___","#",e)}getComponentAttributePlaceholder(e){return i.default.replace("___attribute_#___","#",e)}getXInitPlaceholder(e){return i.default.replace("___x_init_#___","#",e)}getPlaceholder(e,t,n=null){if(n&&n>0){let r=`___${e}_#___`,s=n-r.length;return i.default.replace(`___${e}${i.default.repeat("_",s>0?s:1)}#___`,"#",t)}return i.default.isNull(n)?i.default.replace(`___${e}_#___`,"#",t):i.default.replace(`s___${e}_+?#___`,"#",t)}getXDataPlaceholder(e){return i.default.replace("___x_data_#___","#",e)}getTemplatingStringPlaceholder(e){return i.default.replace("___templating_str_#___","#",e)}getStringLiteralInPhpPlaceholder(e){return i.default.replace("'___php_content_#___'","#",e)}getBladeDirectiveInScriptPlaceholder(e){return i.default.replace("___directives_script_#___","#",e)}restoreIgnoredLines(e){return i.default.replace(e,new RegExp(`${this.getIgnoredLinePlaceholder("(\\d+)")}`,"gm"),(t,n)=>this.ignoredLines[n])}restoreCurlyBraceForJS(e){return i.default.replace(e,new RegExp(`${this.getCurlyBraceForJSPlaceholder("(\\d+)")}`,"gm"),(t,n)=>`@{{ ${R.default.js_beautify(this.curlyBracesWithJSs[n].trim())} }}`)}restorePhpBlock(e){return this.restoreRawPhpBlock(e).then(t=>this.restoreRawPropsBlock(t))}async restoreRawPhpBlock(e){return i.default.replace(e,new RegExp(`${this.getRawPlaceholder("(\\d+)")}`,"gm"),(t,n)=>{var o;let r=this.rawBlocks[n],s=this.getRawPlaceholder(n.toString()),a=(o=e.match(new RegExp(`^(.*?)${s}`,"gmi")))!=null?o:[""],l=(0,w.default)(a[0]);return this.isInline(r)&&this.isMultilineStatement(r)?r=L(``,this.defaultPhpFormatOption).trim():r.split(` `).length>1?r=L(``,this.defaultPhpFormatOption).trimRight(` `):r=``,i.default.replace(r,/^(\s*)?<\?php(.*?)\?>/gms,(c,d,p)=>{if(this.isInline(r))return`@php${p}@endphp`;let u=this.preserveStringLiteralInPhp(p);u=this.preservePhpComment(u);let g=this.indentRawBlock(l,u);return g=this.restorePhpComment(g),`@php${this.restoreStringLiteralInPhp(g)}@endphp`})})}async restoreRawPropsBlock(e){let t=this.getRawPropsPlaceholder("(\\d+)");return i.default.replace(e,new RegExp(t,"gms"),(n,r)=>`@props(${C(this.rawPropsBlocks[r],{...this.defaultPhpFormatOption,printWidth:F}).trimRight()})`)}isInline(e){return i.default.split(e,` `).length===1}isMultilineStatement(e){return L(``,this.defaultPhpFormatOption).trimRight().split(` `).length>1}indentRawBlock(e,t){if(this.isInline(t))return`${e.indent}${t}`;let r=e.amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:(r+1)*this.indentSize),a=this.indentCharacter.repeat(r<0?0:r*this.indentSize),l=t.split(` `);return i.default.chain(l).map((o,c)=>c===0?o.trim():c===l.length-1?a+o:s+o).join(` `).value()}indentBladeDirectiveBlock(e,t){if(i.default.isEmpty(e.indent))return t;if(this.isInline(t))return`${e.indent}${t}`;let r=e.amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:r*this.indentSize),a=this.indentCharacter.repeat(r<0?0:r*this.indentSize),l=t.split(` `);return i.default.chain(l).map((o,c)=>c===l.length-1?a+o:s+o).value().join(` `)}indentScriptBlock(e,t){if(i.default.isEmpty(e.indent))return t;if(this.isInline(t))return`${t}`;let r=e.amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:r*this.indentSize),a=this.indentCharacter.repeat(r<0?0:r*this.indentSize),o=i.default.replace(t,/`.*?`/gs,d=>this.storeTemplatingString(d)).split(` `),c=i.default.chain(o).map((d,p)=>p===0?d:p===o.length-1?a+d:i.default.isEmpty(d)?d:s+d).value().join(` `);return this.restoreTemplatingString(`${c}`)}indentRawPhpBlock(e,t){if(i.default.isEmpty(e.indent))return t;if(this.isInline(t))return`${t}`;let r=e.amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:r*this.indentSize),a=t.split(` `);return i.default.chain(a).map((l,o)=>o===0?l.trim():s+l).value().join(` `)}indentComponentAttribute(e,t){if(i.default.isEmpty(e))return t;if(this.isInline(t))return`${t}`;if(this.isInline(t)&&/\S/.test(e))return`${t}`;let r=(0,w.default)(e).amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:r*this.indentSize),a=t.split(` `);return i.default.chain(a).map((l,o)=>o===0?l.trim():s+l).value().join(` `)}indentPhpComment(e,t){if(i.default.isEmpty(e.indent))return t;if(this.isInline(t))return`${t}`;let r=e.amount/this.indentSize,s=this.indentCharacter.repeat(r<0?0:r*this.indentSize),a=t.split(` `),l=!1;return i.default.chain(a).map((o,c)=>c===0?o.trim():o.trim().startsWith("*")?o.trim().endsWith("*/")&&l?o:s+o:(l=!0,o)).join(` `).value()}restoreBladeDirectivesInStyles(e){return i.default.replace(e,/(?<=]*?(?)(.*?)(?=<\/style>)/gis,t=>{let n=t,r=new RegExp(`${this.getBladeDirectiveInStylePlaceholder("(\\d+)")} {\\s*?/\\* inline_directive \\*/\\s*?}`,"gmi");n=i.default.replace(n,r,(o,c)=>this.bladeDirectivesInStyle[c]);let s=new RegExp(`}\\s*?${this.getBladeDirectiveInStylePlaceholder("(\\d+)")} {\\s*?/\\*else\\*/`,"gmi");n=i.default.replace(n,s,(o,c)=>`${this.bladeDirectivesInStyle[c]}`);let a=new RegExp(`${this.getBladeDirectiveInStylePlaceholder("(\\d+)")} {\\s*?/\\*start\\*/`,"gmi");n=i.default.replace(n,a,(o,c)=>`${this.bladeDirectivesInStyle[c]}`);let l=new RegExp(`}\\s*?/\\* ${this.getBladeDirectiveInStylePlaceholder("(\\d+)")} \\*/`,"gmi");return n=i.default.replace(n,l,(o,c)=>`${this.bladeDirectivesInStyle[c]}`),n})}restoreBladeDirectivesInScripts(e){let t=new RegExp(`${this.getBladeDirectivePlaceholder("(\\d+)")}`,"gm"),n=i.default.replace(e,t,(r,s)=>{var c;let a=this.getBladeDirectivePlaceholder(s.toString()),l=(c=e.match(new RegExp(`^(.*?)${a}`,"gmi")))!=null?c:[""],o=(0,w.default)(l[0]);return this.indentBladeDirectiveBlock(o,this.bladeDirectives[s])});return n=i.default.replace(n,/(?<=]*?(?)(.*?)(?=<\/script>)/gis,r=>{let s=r;return s=i.default.replace(s,new RegExp(`if \\( \\/\\*(?:(?:${this.getBladeDirectiveInScriptPlaceholder("(\\d+)")}).*?)\\*\\/ \\) \\{`,"gis"),(a,l)=>`${this.directivesInScript[l]}`),s=i.default.replace(s,new RegExp(`} \\/\\* (?:${this.getBladeDirectiveInScriptPlaceholder("(\\d+)")}) \\*\\/ {(\\s*?\\(___directive_condition_\\d+___\\))?`,"gim"),(a,l,o)=>i.default.isUndefined(o)?`${this.directivesInScript[l].trim()}`:`${this.directivesInScript[l].trim()} ${(o!=null?o:"").trim()}`),s=i.default.replace(s,new RegExp(`} \\/\\*(?:${this.getBladeDirectiveInScriptPlaceholder("(\\d+)")})\\*\\/`,"gis"),(a,l)=>`${this.directivesInScript[l]}`),s=i.default.replace(s,new RegExp(`${this.getRawPlaceholder("(\\d+)")}`,"gm"),(a,l)=>{var u;let o=this.rawBlocks[l],c=this.getRawPlaceholder(l.toString()),d=(u=e.match(new RegExp(`^(.*?)${c}`,"gmi")))!=null?u:[""],p=(0,w.default)(d[0]);return this.isInline(o)&&this.isMultilineStatement(o)?o=L(``,this.defaultPhpFormatOption).trim():o.split(` `).length>1?o=L(``,this.defaultPhpFormatOption).trim():o=``,i.default.replace(o,/^(\s*)?<\?php(.*?)\?>/gms,(g,x,b)=>{if(this.isInline(o))return`@php${b}@endphp`;let I=this.preserveStringLiteralInPhp(b),et=this.indentRawBlock(p,I);return`@php${this.restoreStringLiteralInPhp(et)}@endphp`})}),s=i.default.replace(s,/(?<=[\S]+)(\s*?)\/\*\*\*script_placeholder\*\*\*\/(\s)?/gim,(a,l,o)=>{if(o!==void 0)return o;let c=l!=null?l:"",d=o!=null?o:"";return c+d}),s}),t.test(n)&&(n=this.restoreBladeDirectivesInScripts(n)),n}async formatPreservedBladeDirectives(e){return Fe.default.map(e,async t=>{let n=await this.formatAsHtml(t);return(await this.formatAsBlade(n)).trimRight(` `)})}restoreBladeComment(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getBladeCommentPlaceholder("(\\d+)")}`,"gms"),(n,r)=>this.bladeComments[r].replace(/{{--(?=\S)/g,"{{-- ").replace(/(?<=\S)--}}/g," --}}")))}restorePhpComment(e){return i.default.replace(e,new RegExp(`${this.getPhpCommentPlaceholder("(\\d+)")};{0,1}`,"gms"),(t,n)=>{var o;let r=this.getPhpCommentPlaceholder(n.toString()),s=(o=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?o:[""],a=(0,w.default)(s[0]),l=Ee(this.phpComments[n]);return this.indentPhpComment(a,l)})}async restoreEscapedBladeDirective(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getEscapedBladeDirectivePlaceholder("(\\d+)")}`,"gms"),(n,r)=>this.escapedBladeDirectives[r]))}restoreBladeBrace(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getBladeBracePlaceholder("(\\d+)")}`,"gm"),(n,r)=>{var c;let s=this.getBladeBracePlaceholder(r.toString()),a=(c=e.match(new RegExp(`^(.*?)${s}`,"gmi")))!=null?c:[""],l=(0,w.default)(a[0]),o=this.bladeBraces[r];return o.trim()===""?`{{${o}}}`:this.isInline(o)?`{{ ${C(o,{...this.defaultPhpFormatOption,trailingCommaPHP:!1,printWidth:F}).replace(/([\n\s]*)->([\n\s]*)/gs,"->").split(` `).map(d=>d.trim()).join("").trimRight(` `)} }}`:`{{ ${this.indentRawPhpBlock(l,C(o,this.defaultPhpFormatOption).replace(/([\n\s]*)->([\n\s]*)/gs,"->").trim().trimRight(` `))} }}`}))}restoreRawBladeBrace(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getRawBladeBracePlaceholder("(\\d+)")}`,"gms"),(n,r)=>{var c;let s=this.getRawBladeBracePlaceholder(r),a=(c=e.match(new RegExp(`^(.*?)${s}`,"gmi")))!=null?c:[""],l=(0,w.default)(a[0]),o=this.rawBladeBraces[r];return o.trim()===""?`{!!${o}!!}`:this.indentRawPhpBlock(l,`{!! ${C(o,this.defaultPhpFormatOption).replace(/([\n\s]*)->([\n\s]*)/gs,"->").trim()} !!}`)}))}restoreInlineDirective(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getInlinePlaceholder("(\\d+)")}`,"gms"),(n,r)=>this.inlineDirectives[r]))}restoreConditions(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getConditionPlaceholder("(\\d+)")}`,"gms"),(n,r)=>{var c;let s=this.getConditionPlaceholder(r),a=(c=e.match(new RegExp(`^(.*?)${s}`,"gmi")))!=null?c:[""],l=(0,w.default)(a[0]),o=this.conditions[r];return this.formatExpressionInsideBladeDirective(o,l)}))}restoreUnbalancedDirective(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,/@if \(unbalanced___(\d+)___\)/gms,(n,r)=>this.unbalancedDirectives[r]))}restoreInlinePhpDirective(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getInlinePhpPlaceholder("(\\d+)")}`,"gm"),(n,r)=>{var c;let s=this.inlinePhpDirectives[r],a=this.getInlinePhpPlaceholder(r),l=(c=e.match(new RegExp(`^(.*?)${a}`,"gmi")))!=null?c:[""],o=(0,w.default)(l[0]);return s.includes("@php")?`${C(s,{...this.defaultPhpFormatOption,printWidth:F}).replace(/([\n\s]*)->([\n\s]*)/gs,"->").trim().trimRight(` `)}`:new RegExp(ne.join("|"),"gi").test(s)?i.default.replace(s,new RegExp(`(?<=@(${i.default.map(ne,p=>p.substring(1)).join("|")}).*?\\()(.*)(?=\\))`,"gis"),(p,u,g)=>{let x=this.wrapLineLength;return["button","class"].includes(u)&&(x=80),u==="include"&&(x=this.wrapLineLength-4-r.length-o.amount),this.formatExpressionInsideBladeDirective(g,o,x)}):`${C(s,{...this.defaultPhpFormatOption,printWidth:F}).trimEnd()}`}))}restoreRawPhpTags(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getRawPhpTagPlaceholder("(\\d+)")}`,"gms"),(n,r)=>{var s;try{let a=this.rawPhpTags[r],o=/(?<=<\?php\s*?)\/\*.*?\*\/(?=\s*?\?>)/gim.test(a)&&this.isInline(a),c=this.getRawPhpTagPlaceholder(r),d=(s=e.match(new RegExp(`^(.*?)${c}`,"gmi")))!=null?s:[""],p=(0,w.default)(d[0]);if(o)return a;let u=L(this.rawPhpTags[r],this.defaultPhpFormatOption).trim().trimRight(` `);if(this.isInline(u))return u;let g=this.preservePhpComment(u);return p.indent&&(g=this.indentRawPhpBlock(p,g)),this.restorePhpComment(g)}catch{return`${this.rawPhpTags[r]}`}}))}restoreNonnativeScripts(e){return i.default.replace(e,new RegExp(`${this.getNonnativeScriptPlaceholder("(\\d+)")}`,"gmi"),(t,n)=>`${this.nonnativeScripts[n]}`)}restoreScripts(e){return new Promise(t=>t(e)).then(t=>i.default.replace(t,new RegExp(`${this.getScriptPlaceholder("(\\d+)")}`,"gim"),(n,r)=>{var p;let s=this.scripts[r],a=this.getScriptPlaceholder(r),l=(p=e.match(new RegExp(`^(.*?)${a}`,"gmi")))!=null?p:[""],o=(0,w.default)(l[0]),c=_(this.options).useTabs||!1,d={indent_size:_(this.options).indentSize||4,wrap_line_length:_(this.options).wrapLineLength||120,wrap_attributes:_(this.options).wrapAttributes||"auto",indent_with_tabs:c,end_with_newline:!1,templating:["php"]};return c?this.indentScriptBlock(o,i.default.replace(R.default.html_beautify(s,d),/\t/g," ".repeat(this.indentSize))):this.indentScriptBlock(o,R.default.html_beautify(s,d))}))}async restoreCustomDirective(e){return this.restoreInlineCustomDirective(e).then(t=>this.restoreBeginCustomDirective(t)).then(t=>this.restoreElseCustomDirective(t)).then(t=>this.restoreEndCustomDirective(t))}async restoreInlineCustomDirective(e){return i.default.replace(e,new RegExp(`${this.getInlineCustomDirectivePlaceholder("(\\d+)")}`,"gim"),(t,n)=>{var o;let r=this.getInlineCustomDirectivePlaceholder(n.toString()),s=(o=e.match(new RegExp(`^(.*?)${i.default.escapeRegExp(r)}`,"gmi")))!=null?o:[""],a=(0,w.default)(s[0]),l=`${this.customDirectives[n]}`;return i.default.replace(l,/(@[a-zA-z0-9\-_]+)(.*)/gis,(c,d,p)=>{try{let u=C(`func${p}`,{...this.defaultPhpFormatOption,printWidth:F}).replace(/([\n\s]*)->([\n\s]*)/gs,"->").replace(/,(\s*?\))$/gm,(g,x)=>x).trim().substring(4);return`${d}${this.indentComponentAttribute(a.indent,u)}`}catch{return`${c}`}})})}async restoreBeginCustomDirective(e){return i.default.replace(e,new RegExp(`@customdirective\\(___(\\d+)___\\)\\s*?(${y})*`,"gim"),(t,n)=>{var o;let r=this.getBeginCustomDirectivePlaceholder(n.toString()),s=(o=e.match(new RegExp(`^(.*?)${i.default.escapeRegExp(r)}`,"gmi")))!=null?o:[""],a=(0,w.default)(s[0]),l=`${this.customDirectives[n]}`;return i.default.replace(l,/(@[a-zA-z0-9\-_]+)(.*)/gis,(c,d,p)=>{try{let u=C(`func${p}`,{...this.defaultPhpFormatOption,trailingCommaPHP:!1}).replace(/([\n\s]*)->([\n\s]*)/gs,"->").trim().substring(4);return`${d}${this.indentComponentAttribute(a.indent,u)}`}catch{return`${c}`}})})}async restoreElseCustomDirective(e){return i.default.replace(e,/@else\(___(\d+)___\)/gim,(t,n)=>`${this.customDirectives[n]}`)}async restoreEndCustomDirective(e){return i.default.replace(e,/@endcustomdirective\(___(\d+)___\)/gim,(t,n)=>`${this.customDirectives[n]}`)}async restoreHtmlTags(e){return i.default.replace(e,new RegExp(`${this.getHtmlTagPlaceholder("(\\d+)")}`,"gim"),(t,n)=>{var p;let r=this.getHtmlTagPlaceholder(n.toString()),s=(p=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?p:[""],a=(0,w.default)(s[0]),l={indent_size:_(this.options).indentSize||4,wrap_line_length:_(this.options).wrapLineLength||120,wrap_attributes:_(this.options).wrapAttributes||"auto",end_with_newline:!1,templating:["php"]},o=this.htmlTags[n],c=i.default.first(o.match(/(<(textarea|pre).*?(?)(?=.*?<\/\2>)/gis));if(c===void 0)return`${this.indentScriptBlock(a,R.default.html_beautify(o,l))}`;let d=o.substring(c.length,o.length);return`${this.indentScriptBlock(a,R.default.html_beautify(c,l))}${d}`})}restoreHtmlAttributes(e){return i.default.replace(e,new RegExp(`${this.getHtmlAttributePlaceholder("(\\d+)")}`,"gms"),(t,n)=>this.htmlAttributes[n])}restoreXData(e){return i.default.replace(e,new RegExp(`${this.getXDataPlaceholder("(\\d+)")}`,"gm"),(t,n)=>{var u;let r=this.getXDataPlaceholder(n.toString()),s=(u=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?u:[""],a=(0,w.default)(s[0]),l=this.formatJS(this.xData[n]).split(` `),o=a.amount/(this.indentCharacter===" "?4:1),c=l[0],d=this.indentCharacter.repeat(o<0?0:o),p=l.map(g=>d+g);return p[0]=c,`${p.join(` `)}`})}restoreXInit(e){return i.default.replace(e,new RegExp(`${this.getXInitPlaceholder("(\\d+)")}`,"gm"),(t,n)=>{var u;let r=this.getXInitPlaceholder(n.toString()),s=(u=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?u:[""],a=(0,w.default)(s[0]),l=this.formatJS(this.xInit[n]).split(` `),o=a.amount/(this.indentCharacter===" "?4:1),c=l[0],d=this.indentCharacter.repeat(o<0?0:o),p=l.map(g=>d+g);return p[0]=c,`${p.join(` `)}`})}restoreTemplatingString(e){return i.default.replace(e,new RegExp(`${this.getTemplatingStringPlaceholder("(\\d+)")}`,"gms"),(t,n)=>this.templatingStrings[n])}restoreStringLiteralInPhp(e){return i.default.replace(e,new RegExp(`${this.getStringLiteralInPhpPlaceholder("(\\d+)")}`,"gms"),(t,n)=>this.stringLiteralInPhp[n])}restoreComponentAttribute(e){return i.default.replace(e,new RegExp(`${this.getComponentAttributePlaceholder("(\\d+)")}`,"gim"),(t,n)=>{var c;let r=this.getComponentAttributePlaceholder(n),s=(c=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?c:[""],a=(0,w.default)(s[0]),l=this.componentAttributes[n],o=i.default.replace(l,/(:{1,2}.*?=)(["'])(.*?)(?=\2)/gis,(d,p,u,g)=>{if(g==="")return d;if(p.startsWith("::"))return`${p}${u}${R.default.js_beautify(g,{wrap_line_length:this.wrapLineLength-a.amount,brace_style:"preserve-inline"}).trim()}`;if(this.isInline(g))try{return`${p}${u}${C(g,{...this.defaultPhpFormatOption,printWidth:this.wrapLineLength-a.amount}).trimEnd()}`}catch{return`${p}${u}${g}`}return`${p}${u}${C(g,{...this.defaultPhpFormatOption,printWidth:this.wrapLineLength-a.amount}).trimEnd()}`});return`${this.indentComponentAttribute(a.indent,o)}`})}restoreShorthandBinding(e){return i.default.replace(e,new RegExp(`${this.getShorthandBindingPlaceholder("(\\d+)")}`,"gms"),(t,n)=>{var c;let r=this.getShorthandBindingPlaceholder(n),s=(c=e.match(new RegExp(`^(.*?)${r}`,"gmi")))!=null?c:[""],a=(0,w.default)(s[0]),l=this.shorthandBindings[n],o=i.default.replace(l,/(:{1,2}.*?=)(["'])(.*?)(?=\2)/gis,(d,p,u,g)=>{let x={wrap_line_length:this.wrapLineLength-a.amount,brace_style:"preserve-inline"};if(g==="")return d;if(this.isInline(g))try{return`${p}${u}${R.default.js_beautify(g,x).trimEnd()}`}catch{return`${p}${u}${g}`}return`${p}${u}${R.default.js_beautify(g,x).trimEnd()}`});return`${this.indentComponentAttribute(a.indent,o)}`})}async formatAsBlade(e){this.currentIndentLevel=0,this.shouldBeIndent=!1;let t=N(e),n=await new Z(this.vsctm,this.oniguruma);return n.createRegistry(e).loadGrammar("text.html.php.blade").then(a=>n.tokenizeLines(t,a)).then(a=>this.formatTokenizedLines(t,a)).catch(a=>{throw a})}formatTokenizedLines(e,t){this.result=[],this.stack=[];for(let n=0;n0&&this.decrementIndentLevel(),this.shouldBeIndent=!0,this.stack.push(e)):(this.shouldBeIndent=!0,this.stack.push(e))),i.default.includes(E,e)){if(e==="@endswitch"&&i.default.last(this.stack)==="@default"){this.decrementIndentLevel(2),this.shouldBeIndent=!1;return}this.decrementIndentLevel(),this.shouldBeIndent=!1,this.stack.pop()}i.default.includes(D,e)&&(this.decrementIndentLevel(),this.shouldBeIndent=!0)}processToken(e,t){if(i.default.includes(e.scopes,"punctuation.definition.comment.begin.blade")&&(this.isInsideCommentBlock=!0),this.argumentCheck){let{count:n,inString:r,stack:s}=this.argumentCheck;if(!r&&t===")"){if(s.push(t),n[t]+=1,n["("]===n[t]){let a=s.join("");_e(a)>=this.argumentCheck.unindentOn&&(this.shouldBeIndent=!1),this.argumentCheck=!1}return}s.push(t),r===t?this.argumentCheck.inString=!1:!r&&(t==='"'||t==="'")&&(this.argumentCheck.inString=t),t==="("&&!r&&(n[t]+=1)}i.default.includes(e.scopes,"punctuation.definition.comment.end.blade")&&(this.isInsideCommentBlock=!1),(t==="{{--"||t.includes("{{--"))&&(this.isInsideCommentBlock=!0),(t==="--}}"||t.includes("--}}"))&&(this.isInsideCommentBlock=!1),i.default.includes(e.scopes,"keyword.blade")&&(this.isInsideCommentBlock||(this.processKeyword(t.toLowerCase()),i.default.includes(Object.keys(ee),t.toLowerCase())&&(this.argumentCheck={unindentOn:ee[t.toLowerCase()],stack:[],inString:!1,count:{"(":0,")":0}})))}processTokenizeResult(e,t){if(this.shouldBeIndent&&(this.incrementIndentLevel(),this.shouldBeIndent=!1),me(e,t)){this.insertFormattedLineToResult(t);return}for(let n=0;n0&&this.result.push(r),r!==e&&this.diffs.push({original:e,formatted:r})}incrementIndentLevel(e=1){this.currentIndentLevel+=e}decrementIndentLevel(e=1){this.currentIndentLevel-=e}formatExpressionInsideBladeDirective(e,t,n=void 0){let r=`func(${e})`,s=C(r,{...this.defaultPhpFormatOption,printWidth:n!=null?n:this.defaultPhpFormatOption.printWidth});if(s===r)return e;let a=s.replace(/([\n\s]*)->([\n\s]*)/gs,"->").replace(/(?`${o}] )`).replace(/,[\n\s]*?\)/gs,")").replace(/,(\s*?\))$/gm,(l,o)=>o).trim();return this.options.useTabs&&(a=i.default.replace(a,/(?<=^ *) {4}/gm," ".repeat(this.indentSize))),a=a.replace(/func\((.*)\)/gis,(l,o)=>o),this.isInline(a.trim())&&(a=a.trim()),this.indentRawPhpBlock(t,a)}formatJS(e){let t=e,n={js:[],entangle:[]};return Object.keys(n).forEach(r=>{t=t.replace(new RegExp(`@${r}\\((?:[^)(]+|\\((?:[^)(]+|\\([^)(]*\\))*\\))*\\)`,"gs"),s=>{let a=n[r].push(s)-1;return this.getPlaceholder(r,a,s.length)})}),t=R.default.js_beautify(t,{brace_style:"preserve-inline"}),Object.keys(n).forEach(r=>{t=t.replace(new RegExp(this.getPlaceholder(r,"_*(\\d+)"),"gms"),(s,a)=>n[r][a])}),t}};var Te=m(require("path")),Oe=m(require("fs")),je=m(require("ajv")),He=m(require("find-config")),yt=new je.default,Ae=[".bladeformatterrc.json",".bladeformatterrc"];function We(h){for(let e=0;e{throw new J(r)})}async formatFromCLI(){try{this.printPreamble(),await this.readIgnoreFile(f.default.cwd()),await this.processPaths(),this.printResults()}catch{}}fileExists(e){return H.default.promises.access(e,H.default.constants.F_OK).then(()=>!0).catch(()=>!1)}async readIgnoreFile(e){let t=".bladeignore",n,r=B.default.dirname(e);if(this.options.ignoreFilePath?n=this.options.ignoreFilePath:n=(0,oe.default)(t,{cwd:r}),!!n)try{this.ignoreFile=(await H.default.promises.readFile(n)).toString()}catch{}}async findTailwindConfig(e){if(!this.options.sortTailwindcssClasses)return;let t="tailwind.config.js",n;if(this.options.tailwindcssConfigPath)if(this.runtimeConfigPath){let r=B.default.dirname(this.runtimeConfigPath);n=B.default.resolve(r,this.options.tailwindcssConfigPath)}else B.default.isAbsolute(this.options.tailwindcssConfigPath)?n=B.default.resolve(this.options.tailwindcssConfigPath):n=B.default.resolve(this.options.tailwindcssConfigPath);else{let r=B.default.dirname(e);n=(0,oe.default)(t,{cwd:r})}n&&(this.options.tailwindcssConfigPath=n)}async readRuntimeConfig(e){var n,r;v.default.isEmpty(this.runtimeConfigCache)&&(this.options=v.default.merge(this.options,this.runtimeConfigCache));let t;if(this.options.runtimeConfigPath?t=this.options.runtimeConfigPath:t=We(e),!v.default.isNull(t)){this.runtimeConfigPath=t;try{let s=await ze(t);this.options=v.default.merge(this.options,s),this.runtimeConfigCache=this.options,this.options.sortTailwindcssClasses&&await this.findTailwindConfig(e)}catch(s){s instanceof SyntaxError&&(f.default.stdout.write($.default.red.bold(` Blade Formatter JSON Syntax Error: `)),f.default.stdout.write(ae.default.format(s)),f.default.exit(1)),f.default.stdout.write($.default.red.bold(` Blade Formatter Config Error: ${B.default.basename(t)} `)),f.default.stdout.write(`\`${s.errors[0].instancePath.replace("/","")}\` ${s.errors[0].message} `),(n=s.errors[0].params)!=null&&n.allowedValues&&console.log((r=s.errors[0].params)==null?void 0:r.allowedValues),f.default.exit(1)}}}async processPaths(){await Promise.all(v.default.map(this.paths,async e=>this.processPath(e)))}async processPath(e){await k.globFiles(e).then(t=>v.default.map(t,n=>B.default.relative(".",n))).then(t=>this.filterFiles(t)).then(this.fulFillFiles).then(t=>this.formatFiles(t))}static globFiles(e){return new Promise((t,n)=>{(0,Je.default)(e,(r,s)=>r?n(r):t(s))})}async filterFiles(e){if(this.ignoreFile==="")return e;let t=/^\.\.*/,n=v.default.filter(e,a=>t.test(B.default.relative(".",a))),r=v.default.xor(e,n),s=(0,Ne.default)().add(this.ignoreFile).filter(r);return v.default.concat(n,s)}static fulFillFiles(e){return this.targetFiles.push(e),Promise.resolve(e)}async formatFiles(e){await Promise.all(v.default.map(e,async t=>this.formatFile(t)))}async formatFile(e){await this.findTailwindConfig(e),await this.readRuntimeConfig(e),await q(e).then(t=>Promise.resolve(t.toString("utf-8"))).then(t=>new j(this.options).formatContent(t)).then(t=>this.checkFormatted(e,t)).then(t=>this.writeToFile(e,t)).catch(t=>{this.handleError(e,t)})}async checkFormatted(e,t){this.printFormattedOutput(e,t);let n=H.default.readFileSync(e,"utf-8"),r=N(n),s=N(t),a=ve(e,r,s);return this.diffs.push(a),this.outputs.push(t),a.length>0&&((this.options.progress||this.options.write)&&f.default.stdout.write($.default.green("F")),this.options.checkFormatted&&(f.default.stdout.write(`${e} `),f.default.exitCode=1),this.formattedFiles.push(e)),a.length===0&&(this.options.progress||this.options.write)&&f.default.stdout.write($.default.green(".")),Promise.resolve(t)}printFormattedOutput(e,t){this.options.write||this.options.checkFormatted||(f.default.stdout.write(`${t}`),v.default.last(this.paths)===e||v.default.last(this.targetFiles)===e)||(this.paths.length>1||this.targetFiles.length>1)&&f.default.stdout.write(` `)}writeToFile(e,t){this.options.write&&(this.options.checkFormatted||t.length===0||v.default.isNull(t)||v.default.isEmpty(t)||H.default.writeFile(e,t,n=>{n&&(f.default.stdout.write(`${$.default.red(n.message)} `),f.default.exit(1))}))}handleError(e,t){(this.options.progress||this.options.write)&&f.default.stdout.write($.default.red("E")),f.default.exitCode=1,this.errors.push({path:e,message:t.message,error:t})}printPreamble(){this.options.checkFormatted&&f.default.stdout.write(`Check formatting... `)}async printResults(){this.printDescription(),this.printDifferences(),this.printFormattedFiles(),this.printErrors()}printDescription(){if(!this.options.write)return;let e=` `;f.default.stdout.write(e),f.default.stdout.write($.default.bold.green(`Fixed: F `)),f.default.stdout.write($.default.bold.red(`Errors: E `)),f.default.stdout.write($.default.bold("Not Changed: ")+$.default.bold.green(`. `))}printFormattedFiles(){if(this.formattedFiles.length===0){this.options.checkFormatted&&f.default.stdout.write($.default.bold(` All matched files are formatted! `));return}if(!this.options.write){this.options.checkFormatted&&f.default.stdout.write(` Above file(s) are formattable. Forgot to run formatter? Use ${$.default.bold("--write")} option to overwrite. `);return}f.default.stdout.write($.default.bold(` Formatted Files: `)),v.default.each(this.formattedFiles,e=>f.default.stdout.write(`${$.default.bold(e)} `))}printDifferences(){if(this.options.diff){if(f.default.stdout.write($.default.bold(` Differences: `)),v.default.filter(this.diffs,e=>e.length>0).length===0){f.default.stdout.write((0,$.default)(`No changes found. `));return}v.default.each(this.diffs,e=>we(e))}}printErrors(){v.default.isEmpty(this.errors)||(f.default.stdout.write($.default.red.bold(` Errors: `)),v.default.each(this.errors,e=>f.default.stdout.write(`${ae.default.format(e)} `)))}};var le="blade-formatter";var Me="1.32.12";async function Ye(){let h=await(0,Ue.default)((0,Ze.hideBin)(process.argv)).usage(`${W.default.green(le)} ${Me} An opinionated blade template formatter for Laravel. ${W.default.yellow("Usage:")} $0 [options] [file glob | ...]`).wrap(null).example('$0 "resources/views/**/*.blade.php" --write',"Format all files in views directory").option("check-formatted",{alias:"c",type:"boolean",description:"Only checks files are formatted or not",default:!1}).option("write",{alias:"w",type:"boolean",description:"Write to file",default:!1}).option("diff",{alias:"d",type:"boolean",description:"Show diffs",default:!1}).option("end-with-newline",{alias:"e",type:"boolean",description:"End output with newline",default:!0}).option("end-of-line",{type:"string",description:"End of line character(s). [LF|CRLF]",default:Qe.default.EOL===`\r `?"CRLF":"LF"}).option("indent-size",{alias:"i",type:"integer",description:"Indentation size",default:4}).option("wrap-line-length",{alias:"wrap",type:"integer",description:"The length of line wrap size",default:120}).option("wrap-attributes",{alias:"wrap-atts",type:"string",description:`The way to wrap attributes. [auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned]`,default:"auto"}).option("sort-tailwindcss-classes",{alias:"sort-classes",type:"boolean",description:"Sort tailwindcss classes",default:!1}).option("tailwindcss-config-path",{alias:["tailwindcssConfigPath"],type:"string",description:"Specify path of tailwind config",default:null}).option("sort-html-attributes",{alias:"sort-attributes",type:"string",choices:["none","alphabetical","code-guide","idiomatic","vuejs","custom"],description:"Sort HTML attributes.",default:"none",defaultDescription:"none"}).option("custom-html-attributes-order",{type:"string",description:"Comma separated custom HTML attributes order. To enable this you must specify sort html attributes option as `custom`. You can use regex for attribute names.",default:null}).option("no-multiple-empty-lines",{type:"boolean",description:"Merge multiple blank lines into a single blank line",default:!1}).option("multiple-empty-lines",{type:"boolean",description:"this is a workaround for combine strict && boolean option",hidden:!0,default:!0}).option("no-php-syntax-check",{type:"boolean",description:"Disable PHP sytnax checking",default:!1}).option("php-syntax-check",{type:"boolean",description:"this is a workaround for combine strict && boolean option",hidden:!0,default:!0}).option("progress",{alias:"p",type:"boolean",description:"Print progress",default:!1}).option("stdin",{type:"boolean",description:"format code provided on ",default:!1}).option("config",{alias:["runtimeConfigPath"],type:"string",description:"Use this configuration, overriding .bladeformatterrc config options if present",default:null}).option("ignore-path",{alias:["ignoreFilePath"],type:"string",description:"Specify path of ignore file",default:null}).help("h").alias("h","help").strictOptions().fail(function(r,s){if(s)throw s;process.stdout.write(`${W.default.red("error: ")}${r} `),process.stdout.write(`${W.default.yellow("Usage: ")} ${le} [options] [file glob | ...] `),process.stdout.write(`For more information try ${W.default.green("--help")} `),process.exit(1)}).epilog(`Copyright Shuhei Hayashibara 2022 For more information, see https://github.com/shufo/blade-formatter`),e=await qe.promises.readFile(require.resolve("vscode-oniguruma/release/onig.wasm"));await(0,Ke.loadWASM)(e.buffer);let t=Ge.default.chain(h.argv).set("noMultipleEmptyLines",!h.argv.multipleEmptyLines).set("noPhpSyntaxCheck",!h.argv.phpSyntaxCheck).value();if(h.argv.stdin){await process.stdin.pipe((0,Ve.default)({encoding:"string"},r=>new k(t).format(r).then(s=>{s!==void 0&&process.stdout.write(s)}).catch(s=>{process.stdout.write(`${s.toString()} `),process.exit(1)})));return}if(h.argv._.length===0){h.showHelp();return}await new k(t,h.argv._).formatFromCLI()}0&&(module.exports={}); //# sourceMappingURL=cli-bundle.js.map