site/node_modules/prettier/plugins/glimmer.mjs

31 lines
139 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
var rs=Object.defineProperty;var Fr=t=>{throw TypeError(t)};var zt=(t,e)=>{for(var r in e)rs(t,r,{get:e[r],enumerable:!0})};var Mr=(t,e,r)=>e.has(t)||Fr("Cannot "+r);var $=(t,e,r)=>(Mr(t,e,"read from private field"),r?r.call(t):e.get(t)),Gt=(t,e,r)=>e.has(t)?Fr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Yt=(t,e,r,n)=>(Mr(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var Rr={};zt(Rr,{languages:()=>Sn,parsers:()=>Ir,printers:()=>pa});var ns=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},Kt=ns;var ze="string",Ge="array",Ye="cursor",Le="indent",_e="align",Ke="trim",De="group",Oe="fill",Be="if-break",We="indent-if-break",$e="line-suffix",je="line-suffix-boundary",ee="line",Qe="label",Ie="break-parent",ft=new Set([Ye,Le,_e,Ke,De,Oe,Be,We,$e,je,ee,Qe,Ie]);function ss(t){if(typeof t=="string")return ze;if(Array.isArray(t))return Ge;if(!t)return;let{type:e}=t;if(ft.has(e))return e}var Xe=ss;var is=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function as(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
Expected it to be 'string' or 'object'.`;if(Xe(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=is([...ft].map(s=>`'${s}'`));return`Unexpected doc.type '${t.type}'.
Expected it to be ${n}.`}var Wt=class extends Error{name="InvalidDocError";constructor(e){super(as(e)),this.doc=e}},$t=Wt;var zr=()=>{},be=zr,dt=zr;function R(t){return be(t),{type:Le,contents:t}}function os(t,e){return be(e),{type:_e,contents:e,n:t}}function q(t,e={}){return be(t),dt(e.expandedStates,!0),{type:De,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function jt(t){return os(-1,t)}function Qt(t){return dt(t),{type:Oe,parts:t}}function Xt(t,e="",r={}){return be(t),e!==""&&be(e),{type:Be,breakContents:t,flatContents:e,groupId:r.groupId}}var Gr={type:Ie};var ls={type:ee,hard:!0},cs={type:ee,hard:!0,literal:!0},D={type:ee},Y={type:ee,soft:!0},ye=[ls,Gr],Yr=[cs,Gr];function Ee(t,e){be(t),dt(e);let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}var us=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},oe=us;function hs(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(i){if(r.has(i))return r.get(i);let a=s(i);return r.set(i,a),a}function s(i){switch(Xe(i)){case Ge:return e(i.map(n));case Oe:return e({...i,parts:i.parts.map(n)});case Be:return e({...i,breakContents:n(i.breakContents),flatContents:n(i.flatContents)});case De:{let{expandedStates:a,contents:o}=i;return a?(a=a.map(n),o=a[0]):o=n(o),e({...i,contents:o,expandedStates:a})}case _e:case Le:case We:case Qe:case $e:return e({...i,contents:n(i.contents)});case ze:case Ye:case Ke:case je:case ee:case Ie:return e(i);default:throw new $t(i)}}}function Kr(t,e=Yr){return hs(t,r=>typeof r=="string"?Ee(e,r.split(`
`)):r)}var mt="'",Wr='"';function ps(t,e){let r=e===!0||e===mt?mt:Wr,n=r===mt?Wr:mt,s=0,i=0;for(let a of t)a===r?s++:a===n&&i++;return s>i?n:r}var gt=ps;function Jt(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var G,Zt=class{constructor(e){Gt(this,G);Yt(this,G,new Set(e))}getLeadingWhitespaceCount(e){let r=$(this,G),n=0;for(let s=0;s<e.length&&r.has(e.charAt(s));s++)n++;return n}getTrailingWhitespaceCount(e){let r=$(this,G),n=0;for(let s=e.length-1;s>=0&&r.has(e.charAt(s));s--)n++;return n}getLeadingWhitespace(e){let r=this.getLeadingWhitespaceCount(e);return e.slice(0,r)}getTrailingWhitespace(e){let r=this.getTrailingWhitespaceCount(e);return e.slice(e.length-r)}hasLeadingWhitespace(e){return $(this,G).has(e.charAt(0))}hasTrailingWhitespace(e){return $(this,G).has(oe(!1,e,-1))}trimStart(e){let r=this.getLeadingWhitespaceCount(e);return e.slice(r)}trimEnd(e){let r=this.getTrailingWhitespaceCount(e);return e.slice(0,e.length-r)}trim(e){return this.trimEnd(this.trimStart(e))}split(e,r=!1){let n=`[${Jt([...$(this,G)].join(""))}]+`,s=new RegExp(r?`(${n})`:n);return e.split(s)}hasWhitespaceCharacter(e){let r=$(this,G);return Array.prototype.some.call(e,n=>r.has(n))}hasNonWhitespaceCharacter(e){let r=$(this,G);return Array.prototype.some.call(e,n=>!r.has(n))}isWhitespaceOnly(e){let r=$(this,G);return Array.prototype.every.call(e,n=>r.has(n))}};G=new WeakMap;var $r=Zt;var fs=[" ",`
`,"\f","\r"," "],ds=new $r(fs),K=ds;function ms(t){return Array.isArray(t)&&t.length>0}var Je=ms;var er=class extends Error{name="UnexpectedNodeError";constructor(e,r,n="type"){super(`Unexpected ${r} node ${n}: ${JSON.stringify(e[n])}.`),this.node=e}},jr=er;function Qr(t,e){if(t.type==="TextNode"){let r=t.chars.trim();if(!r)return null;e.chars=K.split(r).join(" ")}t.type==="ElementNode"&&(delete e.startTag,delete e.openTag,delete e.parts,delete e.endTag,delete e.closeTag,delete e.nameNode,delete e.body,delete e.blockParamNodes,delete e.params,delete e.path),t.type==="Block"&&(delete e.blockParamNodes,delete e.params),t.type==="AttrNode"&&t.name.toLowerCase()==="class"&&delete e.value,t.type==="PathExpression"&&(e.head=t.head.original)}Qr.ignoredProperties=new Set(["loc","selfClosing"]);var Xr=Qr;var Ze=null;function et(t){if(Ze!==null&&typeof Ze.property){let e=Ze;return Ze=et.prototype=null,e}return Ze=et.prototype=t??Object.create(null),new et}var gs=10;for(let t=0;t<=gs;t++)et();function tr(t){return et(t)}function bs(t,e="type"){tr(t);function r(n){let s=n[e],i=t[s];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${s}'.`),{node:n});return i}return r}var Jr=bs;var Zr={Template:["body"],Block:["body"],MustacheStatement:["path","params","hash"],BlockStatement:["path","params","hash","program","inverse"],ElementModifierStatement:["path","params","hash"],CommentStatement:[],MustacheCommentStatement:[],ElementNode:["attributes","modifiers","children","comments"],AttrNode:["value"],TextNode:[],ConcatStatement:["parts"],SubExpression:["path","params","hash"],PathExpression:[],StringLiteral:[],BooleanLiteral:[],NumberLiteral:[],NullLiteral:[],UndefinedLiteral:[],Hash:["pairs"],HashPair:["value"]};var ys=Jr(Zr),en=ys;function Se(t){return t.loc.start.offset}function tt(t){return t.loc.end.offset}var tn=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function nn(t){return t.toUpperCase()===t}function Es(t){return t.type==="ElementNode"&&typeof t.tag=="string"&&!t.tag.startsWith(":")&&(nn(t.tag[0])||t.tag.includes("."))}function Ss(t){return tn.has(t.toLowerCase())&&!nn(t[0])}function rr(t){return t.selfClosing===!0||Ss(t.tag)||Es(t)&&t.children.every(e=>bt(e))}function bt(t){return t.type==="TextNode"&&!/\S/.test(t.chars)}function rn(t){return(t==null?void 0:t.type)==="MustacheCommentStatement"&&typeof t.value=="string"&&t.value.trim()==="prettier-ignore"}function sn(t){return rn(t.node)||t.isInArray&&(t.key==="children"||t.key==="body"||t.key==="parts")&&rn(t.siblings[t.index-2])}var fn=2;function ws(t,e,r){var s,i,a,o,c,p,h,d,N;let{node:n}=t;switch(n.type){case"Block":case"Program":case"Template":return q(t.map(r,"body"));case"ElementNode":{let g=q(Ts(t,r)),T=e.htmlWhitespaceSensitivity==="ignore"&&((s=t.next)==null?void 0:s.type)==="ElementNode"?Y:"";if(rr(n))return[g,T];let x=["</",n.tag,">"];return n.children.length===0?[g,R(x),T]:e.htmlWhitespaceSensitivity==="ignore"?[g,R(an(t,e,r)),ye,R(x),T]:[g,R(q(an(t,e,r))),R(x),T]}case"BlockStatement":return Cs(t)?[Ls(t,r),cn(t,r,e),un(t,r,e)]:[Ps(t,r),q([cn(t,r,e),un(t,r,e),_s(t,r,e)])];case"ElementModifierStatement":return q(["{{",pn(t,r),"}}"]);case"MustacheStatement":return q([yt(n),pn(t,r),Et(n)]);case"SubExpression":return q(["(",Hs(t,r),Y,")"]);case"AttrNode":{let{name:g,value:T}=n,x=T.type==="TextNode";if(x&&T.chars===""&&Se(T)===tt(T))return g;let v=x?gt(T.chars,e.singleQuote):T.type==="ConcatStatement"?gt(T.parts.map(H=>H.type==="TextNode"?H.chars:"").join(""),e.singleQuote):"",M=r("value");return[g,"=",v,g==="class"&&v?q(R(M)):M,v]}case"ConcatStatement":return t.map(r,"parts");case"Hash":return Ee(D,t.map(r,"pairs"));case"HashPair":return[n.key,"=",r("value")];case"TextNode":{let g=Kt(!1,n.chars,"{{",String.raw`\{{`),T=Os(t);if(T){if(T==="class"){let J=g.trim().split(/\s+/).join(" "),re=!1,V=!1;return t.parent.type==="ConcatStatement"&&(((i=t.previous)==null?void 0:i.type)==="MustacheStatement"&&/^\s/.test(g)&&(re=!0),((a=t.next)==null?void 0:a.type)==="MustacheS
`).length-1}function Bs(t){t=typeof t=="string"?t:"";let e=(t.match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"";return Re(e)}function Is(t){t=typeof t=="string"?t:"";let e=(t.match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"";return Re(e)}function rt(t=0){return Array.from({length:Math.min(t,fn)}).fill(ye)}function Rs(t,e){let{node:{value:r}}=t,n=gt(r,qs(t)?!e.singleQuote:e.singleQuote);return[n,Kt(!1,r,n,`\\${n}`),n]}function qs(t){let{ancestors:e}=t,r=e.findIndex(n=>n.type!=="SubExpression");return r!==-1&&e[r+1].type==="ConcatStatement"&&e[r+2].type==="AttrNode"}function Hs(t,e){let r=nr(t,e),n=St(t,e);return n?R([r,D,q(n)]):r}function pn(t,e){let r=nr(t,e),n=St(t,e);return n?[R([r,D,n]),Y]:r}function nr(t,e){return e("path")}function St(t,e){var s;let{node:r}=t,n=[];return r.params.length>0&&n.push(...t.map(e,"params")),((s=r.hash)==null?void 0:s.pairs.length)>0&&n.push(e("hash")),n.length===0?"":Ee(D,n)}function sr(t){return["as |",t.blockParams.join(" "),"|"]}var Vs=new Set("!\"#%&'()*+,./;<=>@[\\]^`{|}~"),Us=new Set(["true","false","null","undefined"]),Fs=(t,e)=>e===0&&t.startsWith("@")?!1:e!==0&&Us.has(t)||/\s/.test(t)||/^\d/.test(t)||Array.prototype.some.call(t,r=>Vs.has(r));function Ms(t){return t.tail.length===0&&t.original.includes("/")?t.original:[t.head.original,...t.tail].map((r,n)=>Fs(r,n)?`[${r}]`:r).join(".")}var zs={print:ws,massageAstNode:Xr,hasPrettierIgnore:sn,getVisitorKeys:en},En=zs;var Sn=[{linguistLanguageId:155,name:"Handlebars",type:"markup",color:"#f7931e",aliases:["hbs","htmlbars"],extensions:[".handlebars",".hbs"],tmScope:"text.html.handlebars",aceMode:"handlebars",parsers:["glimmer"],vscodeLanguageIds:["handlebars"]}];var Ir={};zt(Ir,{glimmer:()=>ha});var Gs=Object.freeze([]);function kn(){return Gs}var Po=kn(),xo=kn();function w(t,e){if(!t)throw new Error(e||"assertion failure")}function F(t){Js.warn(`DEPRECATION: ${t}`)}function kt(t){if(t==null)throw new Error("Expected value to be present");return t}function Tn(t,e){if(t==null)throw new Error(e);return t}function we(t){return t.length>0}function Tt(t,e="unexpected empty list"){if(!we(t))throw new Error(e)}function qe(t,e="unexpected empty list"){return Tt(t,e),t}function Nt(t){return t.length===0?void 0:t[t.length-1]}function Nn(t){return t.length===0?void 0:t[0]}var Ys;if(!1){let t=n=>{let s=n.name;if(s===void 0){let i=/function (\w+)\s*\(/u.exec(String(n));s=i&&i[1]||""}return s.replace(/^bound /u,"")},e=n=>{let s,i;return n.constructor&&typeof n.constructor=="function"&&(i=t(n.constructor)),"toString"in n&&n.toString!==Object.prototype.toString&&n.toString!==Function.prototype.toString&&(s=n.toString()),s&&/<.*:ember\d+>/u.test(s)&&i&&i[0]!=="_"&&i.length>2&&i!=="Class"?s.replace(/<.*:/u,`<${i}:`):s||i},r=n=>String(n);Ys=n=>typeof n=="function"?t(n)||"(unknown function)":typeof n=="object"&&n!==null?e(n)||"(unknown object)":r(n)}var ir=function(t){return t[t.MAX_SMI=1073741823]="MAX_SMI",t[t.MIN_SMI=-1073741824]="MIN_SMI",t[t.SIGN_BIT=-536870913]="SIGN_BIT",t[t.MAX_INT=536870911]="MAX_INT",t[t.MIN_INT=-536870912]="MIN_INT",t[t.FALSE_HANDLE=0]="FALSE_HANDLE",t[t.TRUE_HANDLE=1]="TRUE_HANDLE",t[t.NULL_HANDLE=2]="NULL_HANDLE",t[t.UNDEFINED_HANDLE=3]="UNDEFINED_HANDLE",t[t.ENCODED_FALSE_HANDLE=0]="ENCODED_FALSE_HANDLE",t[t.ENCODED_TRUE_HANDLE=1]="ENCODED_TRUE_HANDLE",t[t.ENCODED_NULL_HANDLE=2]="ENCODED_NULL_HANDLE",t[t.ENCODED_UNDEFINED_HANDLE=3]="ENCODED_UNDEFINED_HANDLE",t}({});function Ks(t){return t&ir.SIGN_BIT}function Ws(t){return t|~ir.SIGN_BIT}function $s(t){return~t}function js(t){return~t}function Qs(t){return t|=0,t<0?Ks(t):$s(t)}function Xs(t){return t|=0,t>ir.SIGN_BIT?js(t):Ws(t)}[1,-1].forEach(t=>Xs(Qs(t)));var ar=Object.assign;var Js=console,wn=console;function vn(t,e="unexpected unreachable branch"){throw wn.log("unreachable",t),wn.log(`${e} :: ${JSON.stringify(t)} (${t})`),new Error("code reached unreachable")}var Zs=function(){var t=function(ie,m,E,b){for(E=E||{},b=ie.length;b--;E[ie[b]]=m);return E},e=[2,44],r=[1,20],n=[5,14,15,19,29,34,39,44,47,48,52,56,60],s=[1,35],i=[1,38],a=[1,30],o=[1,31],c=[1,32],p=[1,33],h=[1,34],d=[1,37],N=[
`+L.showPosition()+`
Expecting `+pt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Mt="Parse error on line "+(ae+1)+": Unexpected "+(I==Vr?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Mt,{text:L.match,token:this.terminals_[I]||I,line:L.yylineno,loc:Vt,expected:pt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ge+", token: "+I);switch(z[0]){case 1:b.push(I),P.push(L.yytext),l.push(L.yylloc),b.push(z[1]),I=null,Ut?(I=Ut,Ut=null):(Me=L.yyleng,u=L.yytext,ae=L.yylineno,Vt=L.yylloc,Hr>0&&Hr--);break;case 2:if(Z=this.productions_[z[1]][1],Ce.$=P[P.length-Z],Ce._$={first_line:l[l.length-(Z||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(Z||1)].first_column,last_column:l[l.length-1].last_column},es&&(Ce._$.range=[l[l.length-(Z||1)].range[0],l[l.length-1].range[1]]),Ft=this.performAction.apply(Ce,[u,Me,ae,me.yy,z[1],P,l].concat(Zn)),typeof Ft<"u")return Ft;Z&&(b=b.slice(0,-1*Z*2),P=P.slice(0,-1*Z),l=l.slice(0,-1*Z)),b.push(this.productions_[z[1]][0]),P.push(Ce.$),l.push(Ce._$),Ur=xe[b[b.length-2]][b[b.length-1]],b.push(Ur);break;case 3:return!0}}return!0}},Xn=function(){var ie={EOF:1,parseError:function(E,b){if(this.yy.parser)this.yy.parser.parseError(E,b);else throw new Error(E)},setInput:function(m,E){return this.yy=E||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var E=m.match(/(?:\r\n?|\n).*/g);return E?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},unput:function(m){var E=m.length,b=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-E),this.offset-=E;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var P=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===y.length?this.yylloc.first_column:0)+y[y.length-b.length].length-b[0].length:this.yylloc.first_column-E},this.options.ranges&&(this.yylloc.range=[P[0],P[0]+this.yyleng-E]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(m){this.unput(this.match.slice(m))},pastInput:function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var m=this.pastInput(),E=new Array(m.length+1).join("-");return m+this.upcomingInput()+`
`+E+"^"},test_match:function(m,E){var b,y,P;if(this.options.backtrack_lexer&&(P={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(P.yylloc.range=this.yylloc.range.slice(0))),y=m[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(m[0].length),this.matched+=m[0],b=this.performAction.call(this,this.yy,this,E,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),b)return b;if(this._backtrack){for(var l in P)this[l]=P[l];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,E,b,y;this._more||(this.yytext="",this.match="");for(var P=this._currentRules(),l=0;l<P.length;l++)if(b=this._input.match(this.rules[P[l]]),b&&(!E||b[0].length>E[0].length)){if(E=b,y=l,this.options.backtrack_lexer){if(m=this.test_match(b,P[l]),m!==!1)return m;if(this._backtrack){E=!1;continue}else return!1}else if(!this.options.flex)break}return E?(m=this.test_match(E,P[y]),m!==!1?m:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var E=this.next();return E||this.lex()},begin:function(E){this.conditionStack.push(E)},popState:function(){var E=this.conditionStack.length-1;return E>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(E){return E=this.conditionStack.length-1-Math.abs(E||0),E>=0?this.conditionStack[E]:"INITIAL"},pushState:function(E){this.begin(E)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(E,b,y,P){function l(u,ae){return b.yytext=b.yytext.substring(u,b.yyleng-ae+u)}var xe=P;switch(y){case 0:if(b.yytext.slice(-2)==="\\\\"?(l(0,1),this.begin("mu")):b.yytext.slice(-1)==="\\"?(l(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;break;case 3:return this.begin("raw"),15;break;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(l(5,9),18);case 5:return 15;case 6:return this.popState(),14;break;case 7:return 64;case 8:return 67;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;break;case 11:return 56;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;break;case 16:return this.popState(),44;break;case 17:return 34;case 18:return 39;case 19:return 52;case 20:return 48;case 21:this.unput(b.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;break;case 23:return 48;case 24:return 72;case 25:return 71;case 26:return 71;case 27:return 86;case 28:break;case 29:return this.popState(),55;break;case 30:return this.popState(),33;break;case 31:return b.yytext=l(1,2).replace(/\\"/g,'"'),79;break;case 32:return b.yytext=l(1,2).replace(/\\'/g,"'"),79;break;case 33:return 84;case 34:return 81;case 35:return 81;case 36:return 82;case 37:return 83;case 38:return 80;case 39:return 74;case 40:return 76;case 41:return 71;case 42:return b.yytext=b.yytext.replace(/\\([\\\]])/g,"$1"),71;break;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return ie}();Rt.lexer=Xn;function qt(){this.yy={}}return qt.prototype=Rt,Rt.Parser=qt,new qt}(),vt=Zs;var or=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function lr(t,e){var r=e&&e.loc,n,s,i,a;r&&(n=r.start.line,s=r.end.line,i=r.start.column,a=r.end.column,t+=" - "+n+":"+i);for(var o=Error.prototype.constructor.call(this,t),c=0;c<or.length;c++)this[or[c]]=o[or[c]];Error.captureStackTrace&&Error.captureStackTrace(this,lr);try{r&&(this.lineNumber=n,this.endLineNumber=s,Objec
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u01
`)}var mr=function(){function t(e,r,n){n===void 0&&(n="precompile"),this.delegate=e,this.entityParser=r,this.mode=n,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var s=this.peek();if(s==="<"&&!this.isIgnoredEndTag())this.transitionTo("tagOpen"),this.markTagStart(),this.consume();else{if(this.mode==="precompile"&&s===`
`){var i=this.tagNameBuffer.toLowerCase();(i==="pre"||i==="textarea")&&this.consume()}this.transitionTo("data"),this.delegate.beginData()}},data:function(){var s=this.peek(),i=this.tagNameBuffer;s==="<"&&!this.isIgnoredEndTag()?(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume()):s==="&"&&i!=="script"&&i!=="style"?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(s))},tagOpen:function(){var s=this.consume();s==="!"?this.transitionTo("markupDeclarationOpen"):s==="/"?this.transitionTo("endTagOpen"):(s==="@"||s===":"||_n(s))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(s))},markupDeclarationOpen:function(){var s=this.consume();if(s==="-"&&this.peek()==="-")this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment();else{var i=s.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase();i==="DOCTYPE"&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())}},doctype:function(){var s=this.consume();B(s)&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var s=this.consume();B(s)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(s.toLowerCase()))},doctypeName:function(){var s=this.consume();B(s)?this.transitionTo("afterDoctypeName"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(s.toLowerCase())},afterDoctypeName:function(){var s=this.consume();if(!B(s))if(s===">")this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var i=s.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),a=i.toUpperCase()==="PUBLIC",o=i.toUpperCase()==="SYSTEM";(a||o)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),a?this.transitionTo("afterDoctypePublicKeyword"):o&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var s=this.peek();B(s)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):s==='"'?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):s==="'"?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):s===">"&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var s=this.consume();s==='"'?this.transitionTo("afterDoctypePublicIdentifier"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(s)},doctypePublicIdentifierSingleQuoted:function(){var s=this.consume();s==="'"?this.transitionTo("afterDoctypePublicIdentifier"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(s)},afterDoctypePublicIdentifier:function(){var s=this.consume();B(s)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):s==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):s==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var s=this.consume();B(s)||(s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):s==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):s==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var s=this.consume();s==='"'?this.transitionTo("afterDoctypeSystemIdentifier"):s===">"?(this.delegate.endDoctype&&this.delegat
`?(this.line++,this.column=0):this.column++,e},t.prototype.consumeCharRef=function(){var e=this.input.indexOf(";",this.index);if(e!==-1){var r=this.input.slice(this.index,e),n=this.entityParser.parse(r);if(n){for(var s=r.length;s;)this.consume(),s--;return this.consume(),n}}},t.prototype.markTagStart=function(){this.delegate.tagOpen()},t.prototype.appendToTagName=function(e){this.tagNameBuffer+=e,this.delegate.appendToTagName(e)},t.prototype.isIgnoredEndTag=function(){var e=this.tagNameBuffer;return e==="title"&&this.input.substring(this.index,this.index+8)!=="</title>"||e==="style"&&this.input.substring(this.index,this.index+8)!=="</style>"||e==="script"&&this.input.substring(this.index,this.index+9)!=="<\/script>"},t}(),Uo=function(){function t(e,r){r===void 0&&(r={}),this.options=r,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new mr(this,e,r.mode),this._currentAttribute=void 0}return t.prototype.tokenize=function(e){return this.tokens=[],this.tokenizer.tokenize(e),this.tokens},t.prototype.tokenizePart=function(e){return this.tokens=[],this.tokenizer.tokenizePart(e),this.tokens},t.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},t.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},t.prototype.current=function(){var e=this.token;if(e===null)throw new Error("token was unexpectedly null");if(arguments.length===0)return e;for(var r=0;r<arguments.length;r++)if(e.type===arguments[r])return e;throw new Error("token type was unexpectedly "+e.type)},t.prototype.push=function(e){this.token=e,this.tokens.push(e)},t.prototype.currentAttribute=function(){return this._currentAttribute},t.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},t.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},t.prototype.appendToDoctypeName=function(e){this.current("Doctype").name+=e},t.prototype.appendToDoctypePublicIdentifier=function(e){var r=this.current("Doctype");r.publicIdentifier===void 0?r.publicIdentifier=e:r.publicIdentifier+=e},t.prototype.appendToDoctypeSystemIdentifier=function(e){var r=this.current("Doctype");r.systemIdentifier===void 0?r.systemIdentifier=e:r.systemIdentifier+=e},t.prototype.endDoctype=function(){this.addLocInfo()},t.prototype.beginData=function(){this.push({type:"Chars",chars:""})},t.prototype.appendToData=function(e){this.current("Chars").chars+=e},t.prototype.finishData=function(){this.addLocInfo()},t.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},t.prototype.appendToCommentData=function(e){this.current("Comment").chars+=e},t.prototype.finishComment=function(){this.addLocInfo()},t.prototype.tagOpen=function(){},t.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},t.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},t.prototype.finishTag=function(){this.addLocInfo()},t.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},t.prototype.appendToTagName=function(e){this.current("StartTag","EndTag").tagName+=e},t.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},t.prototype.appendToAttributeName=function(e){this.currentAttribute()[0]+=e},t.prototype.beginAttributeValue=function(e){this.currentAttribute()[2]=e},t.prototype.appendToAttributeValue=function(e){this.currentAttribute()[1]+=e},t.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},t.prototype.reportSyntaxError=function(e){this.current().syntaxError=e},t}();var gr={Append:1,TrustingAppend:2,Comment:3,Modifier:4,StrictModifier:5,Block:6,StrictBlock:7,Component:8,OpenElement:10,OpenElementWithSplat:11,FlushElement:12,CloseElement:13,StaticAttr:14,DynamicAttr:15,ComponentAttr:16,AttrSplat:17,Yield:18,DynamicArg:20,StaticArg:21
`,n);if(e<=s||s===-1)return{line:r+1,column:e-n};r+=1,n=s+1}}charPosFor(e){let{line:r,column:n}=e,i=this.source.length,a=0,o=0;for(;o<i;){let c=this.source.indexOf(`
`,o);if(c===-1&&(c=this.source.length),a===r-1){if(o+n>c)return c;if(!1){let p=this.hbsPosFor(o+n);w(p!==null,"the returned offset failed to round-trip"),w(p.line===r,"the round-tripped line didn't match the original line"),w(p.column===n,"the round-tripped column didn't match the original column")}return o+n}else{if(c===-1)return 0;a+=1,o=c+1}}return i}};function S(t,e){let{module:r,loc:n}=e,{line:s,column:i}=n.start,a=e.asString(),o=a?`
|
| ${a.split(`
`).join(`
| `)}
|
`:"",c=new Error(`${t}: ${o}(error occurred in '${r}' @ line ${s} : column ${i})`);return c.name="SyntaxError",c.location=e,c.code=a,c}var ki={Template:["body"],Block:["body"],MustacheStatement:["path","params","hash"],BlockStatement:["path","params","hash","program","inverse"],ElementModifierStatement:["path","params","hash"],CommentStatement:[],MustacheCommentStatement:[],ElementNode:["attributes","modifiers","children","comments"],AttrNode:["value"],TextNode:[],ConcatStatement:["parts"],SubExpression:["path","params","hash"],PathExpression:[],StringLiteral:[],BooleanLiteral:[],NumberLiteral:[],NullLiteral:[],UndefinedLiteral:[],Hash:["pairs"],HashPair:["value"]},Or=function(){t.prototype=Object.create(Error.prototype),t.prototype.constructor=t;function t(e,r,n,s){let i=Error.call(this,e);this.key=s,this.message=e,this.node=r,this.parent=n,i.stack&&(this.stack=i.stack)}return t}();function Bn(t,e,r){return new Or("Cannot remove a node unless it is part of an array",t,e,r)}function Ti(t,e,r){return new Or("Cannot replace a node with multiple nodes unless it is part of an array",t,e,r)}function In(t,e){return new Or("Replacing and removing in key handlers is not yet supported.",t,null,e)}var Fe=class{node;parent;parentKey;constructor(e,r=null,n=null){this.node=e,this.parent=r,this.parentKey=n}get parentNode(){return this.parent?this.parent.node:null}parents(){return{[Symbol.iterator]:()=>new Pr(this)}}},Pr=class{path;constructor(e){this.path=e}next(){return this.path.parent?(this.path=this.path.parent,{done:!1,value:this.path}):{done:!0,value:null}}};function Vn(t){return typeof t=="function"?t:t.enter}function Un(t){if(typeof t!="function")return t.exit}function Ni(t,e){let r=typeof t!="function"?t.keys:void 0;if(r===void 0)return;let n=r[e];return n!==void 0?n:r.All}function vi(t,e){if(t.Program&&(e==="Template"&&!t.Template||e==="Block"&&!t.Block))return F(`The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was '${e}') `),t.Program;let r=t[e];return r!==void 0?r:t.All}function Ot(t,e){let{node:r,parent:n,parentKey:s}=e,i=vi(t,r.type),a,o;i!==void 0&&(a=Vn(i),o=Un(i));let c;if(a!==void 0&&(c=a(r,e)),c!=null)if(JSON.stringify(r)===JSON.stringify(c))c=void 0;else{if(Array.isArray(c))return Fn(t,c,n,s),c;{let p=new Fe(c,n,s);return Ot(t,p)||c}}if(c===void 0){let p=ki[r.type];for(let h=0;h<p.length;h++){let d=p[h];Pi(t,i,e,d)}o!==void 0&&(c=o(r,e))}return c}function Ai(t,e){return t[e]}function Rn(t,e,r){t[e]=r}function Pi(t,e,r,n){let{node:s}=r,i=Ai(s,n);if(!i)return;let a,o;if(e!==void 0){let c=Ni(e,n);c!==void 0&&(a=Vn(c),o=Un(c))}if(a!==void 0&&a(s,n)!==void 0)throw In(s,n);if(Array.isArray(i))Fn(t,i,r,n);else{let c=new Fe(i,r,n),p=Ot(t,c);p!==void 0&&xi(s,n,i,p)}if(o!==void 0&&o(s,n)!==void 0)throw In(s,n)}function Fn(t,e,r,n){for(let s=0;s<e.length;s++){let i=kt(e[s]),a=new Fe(i,r,n),o=Ot(t,a);o!==void 0&&(s+=Ci(e,s,o)-1)}}function xi(t,e,r,n){if(n===null)throw Bn(r,t,e);if(Array.isArray(n))if(n.length===1)Rn(t,e,n[0]);else throw n.length===0?Bn(r,t,e):Ti(r,t,e);else Rn(t,e,n)}function Ci(t,e,r){return r===null?(t.splice(e,1),0):Array.isArray(r)?(t.splice(e,1,...r),r.length):(t.splice(e,1,r),1)}function Li(t,e){let r=new Fe(t);Ot(e,r)}function _i(t){switch(t.type){case"Block":case"Template":return t.body;case"ElementNode":return t.children}}function Ve(t,e){_i(t).push(e)}function Mn(t){return t.type==="StringLiteral"||t.type==="BooleanLiteral"||t.type==="NumberLiteral"||t.type==="NullLiteral"||t.type==="UndefinedLiteral"}function Di(t){return t.type==="UndefinedLiteral"?"undefined":JSON.stringify(t.value)}var br;function yr(){return br||(br=new Te("","(synthetic)")),br}function Oi(t,e=[],r=ct([]),n=!1,s,i){return f.mustache({path:he(t),params:e,hash:r,trusting:n,strip:i,loc:A(s||null)})}function Bi(t,e,r,n,s=null,i,a,o,c){let p,h=null;return n.type==="Template"?(F("b.program is deprecated. Use b.blockItself instead."),p=f.blockItself({params:Gn(n.blockParams),body:n.body,loc:n.loc})):p=n,(s==null?void 0:s.type)==="Template"?(F("b.program is deprecated. Use b.blockItself instead."),w(s.
`)}},qn="beforeAttributeName",ta="attributeValueUnquoted",Lr=class extends Cr{pendingError=null;parse(e,r){var i;let n=f.template({body:[],blockParams:r,loc:this.source.spanFor(e.loc)}),s=this.parseProgram(n,e);return(i=this.pendingError)==null||i.eof(s.loc.getEnd()),s}Program(e,r){w(Array.isArray(r),"[BUG] Program in parser unexpectedly called without block params");let n=f.blockItself({body:[],params:r,chained:e.chained,loc:this.source.spanFor(e.loc)});return this.parseProgram(n,e)}parseProgram(e,r){if(r.body.length===0)return e;let n;try{this.elementStack.push(e);for(let s of r.body)this.acceptNode(s)}finally{n=this.elementStack.pop()}if(e!==n){if((n==null?void 0:n.type)==="ElementNode")throw S(`Unclosed element \`${n.tag}\``,n.loc);w(n!==void 0,"[BUG] empty parser elementStack"),w(!1,`[BUG] mismatched parser elementStack node: ${e.type}`)}return e}BlockStatement(e){var d;if(this.tokenizer.state==="comment"){this.appendToCommentData(this.sourceForNode(e));return}if(this.tokenizer.state!=="data"&&this.tokenizer.state!=="beforeData")throw S("A block may only be used inside an HTML element or another block.",this.source.spanFor(e.loc));let{path:r,params:n,hash:s}=Sr(this,e),i=this.source.spanFor(e.loc),a=[];if((d=e.program.blockParams)!=null&&d.length){let N=s.loc.collapse("end");e.program.loc?N=N.withEnd(this.source.spanFor(e.program.loc).getStart()):e.program.body[0]?N=N.withEnd(this.source.spanFor(e.program.body[0].loc).getStart()):N=N.withEnd(i.getEnd());let g=N.asString(),T=g.indexOf("|")+1,x=g.indexOf("|",T);for(let C of e.program.blockParams){let v,M;T>=x?v=-1:v=g.indexOf(C,T),v===-1||v+C.length>x?(T=x,M=this.source.spanFor(st)):(T=v,M=N.sliceStartChars({skipStart:T,chars:C.length}),T+=C.length),a.push(f.var({name:C,loc:M}))}}e.program.loc||(e.program.loc=st),e.inverse&&!e.inverse.loc&&(e.inverse.loc=st);let o=this.Program(e.program,a),c=e.inverse?this.Program(e.inverse,[]):null,p=f.block({path:r,params:n,hash:s,defaultBlock:o,elseBlock:c,loc:this.source.spanFor(e.loc),openStrip:e.openStrip,inverseStrip:e.inverseStrip,closeStrip:e.closeStrip}),h=this.currentElement();Ve(h,p)}MustacheStatement(e){var o;(o=this.pendingError)==null||o.mustache(this.source.spanFor(e.loc));let{tokenizer:r}=this;if(r.state==="comment"){this.appendToCommentData(this.sourceForNode(e));return}let n,{escaped:s,loc:i,strip:a}=e;if("original"in e.path&&e.path.original==="...attributes")throw S("Illegal use of ...attributes",this.source.spanFor(e.loc));if(Mn(e.path))n=f.mustache({path:this.acceptNode(e.path),params:[],hash:f.hash({pairs:[],loc:this.source.spanFor(e.path.loc).collapse("end")}),trusting:!s,loc:this.source.spanFor(i),strip:a});else{let{path:c,params:p,hash:h}=Sr(this,e);n=f.mustache({path:c,params:p,hash:h,trusting:!s,loc:this.source.spanFor(i),strip:a})}switch(r.state){case"tagOpen":case"tagName":throw S("Cannot use mustaches in an elements tagname",n.loc);case"beforeAttributeName":wr(this.currentStartTag,n);break;case"attributeName":case"afterAttributeName":this.beginAttributeValue(!1),this.finishAttributeValue(),wr(this.currentStartTag,n),r.transitionTo(qn);break;case"afterAttributeValueQuoted":wr(this.currentStartTag,n),r.transitionTo(qn);break;case"beforeAttributeValue":this.beginAttributeValue(!1),this.appendDynamicAttributeValuePart(n),r.transitionTo(ta);break;case"attributeValueDoubleQuoted":case"attributeValueSingleQuoted":case"attributeValueUnquoted":this.appendDynamicAttributeValuePart(n);break;default:Ve(this.currentElement(),n)}return n}appendDynamicAttributeValuePart(e){this.finalizeTextPart();let r=this.currentAttr;r.isDynamic=!0,r.parts.push(e)}finalizeTextPart(){let r=this.currentAttr.currentPart;r!==null&&(this.currentAttr.parts.push(r),this.startTextPart())}startTextPart(){this.currentAttr.currentPart=null}ContentStatement(e){na(this.tokenizer,e),this.tokenizer.tokenizePart(e.value),this.tokenizer.flushData()}CommentStatement(e){let{tokenizer:r}=this;if(r.state==="comment")return this.appendToCommentData(this.sourceForNode(e)),null;let{value:n,loc:s}=e,i=f.mustacheComment({value:n,loc:this.source.spanFor(s)});
`).length-1,columns:0};let[r]=t.split(e),n=r.split(/\n/u),s=n.length-1;return{lines:s,columns:kt(n[s]).length}}function na(t,e){let r=e.loc.start.line,n=e.loc.start.column,s=ra(e.original,e.value);r=r+s.lines,s.lines?n=s.columns:n=n+s.columns,t.line=r,t.column=n}function Sr(t,e){let r;switch(e.path.type){case"PathExpression":r=t.PathExpression(e.path);break;case"SubExpression":r=t.SubExpression(e.path);break;case"StringLiteral":case"UndefinedLiteral":case"NullLiteral":case"NumberLiteral":case"BooleanLiteral":{let a;throw e.path.type==="BooleanLiteral"?a=e.path.original.toString():e.path.type==="StringLiteral"?a=`"${e.path.original}"`:e.path.type==="NullLiteral"?a="null":e.path.type==="NumberLiteral"?a=e.path.value.toString():a="undefined",S(`${e.path.type} "${e.path.type==="StringLiteral"?e.path.original:a}" cannot be called as a sub-expression, replace (${a}) with ${a}`,t.source.spanFor(e.path.loc))}}let n=e.params?e.params.map(a=>t.acceptNode(a)):[],s=we(n)?Nt(n).loc:r.loc,i=e.hash?t.Hash(e.hash):f.hash({pairs:[],loc:t.source.spanFor(s).collapse("end")});return{path:r,params:n,hash:i}}function wr(t,e){let{path:r,params:n,hash:s,loc:i}=e;if(Mn(r)){let o=`{{${Di(r)}}}`,c=`<${t.name} ... ${o} ...`;throw S(`In ${c}, ${o} is not a valid modifier`,e.loc)}let a=f.elementModifier({path:r,params:n,hash:s,loc:i});t.modifiers.push(a)}function He(t){return/[\t\n\f ]/u.test(t)}var _r=class extends Lr{tagOpenLine=0;tagOpenColumn=0;reset(){this.currentNode=null}beginComment(){this.currentNode={type:"CommentStatement",value:"",start:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}appendToCommentData(e){this.currentComment.value+=e}finishComment(){Ve(this.currentElement(),f.comment(this.finish(this.currentComment)))}beginData(){this.currentNode={type:"TextNode",chars:"",start:this.offset()}}appendToData(e){this.currentData.chars+=e}finishData(){Ve(this.currentElement(),f.text(this.finish(this.currentData)))}tagOpen(){this.tagOpenLine=this.tokenizer.line,this.tagOpenColumn=this.tokenizer.column}beginStartTag(){this.currentNode={type:"StartTag",name:"",nameStart:null,nameEnd:null,attributes:[],modifiers:[],comments:[],params:[],selfClosing:!1,start:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}beginEndTag(){this.currentNode={type:"EndTag",name:"",start:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}finishTag(){let e=this.finish(this.currentTag);if(e.type==="StartTag"){if(this.finishStartTag(),e.name===":")throw S("Invalid named block named detected, you may have created a named block without a name, or you may have began your name with a number. Named blocks must have names that are at least one character long, and begin with a lower case letter",this.source.spanFor({start:this.currentTag.start.toJSON(),end:this.offset().toJSON()}));(kr.has(e.name)||e.selfClosing)&&this.finishEndTag(!0)}else e.type==="EndTag"&&this.finishEndTag(!1)}finishStartTag(){let{name:e,nameStart:r,nameEnd:n}=this.currentStartTag;w(e!=="","tag name cannot be empty"),w(r!==null,"nameStart unexpectedly null"),w(n!==null,"nameEnd unexpectedly null");let s=r.until(n),[i,...a]=qe(e.split(".")),o=f.path({head:f.head({original:i,loc:s.sliceStartChars({chars:i.length})}),tail:a,loc:s}),{attributes:c,modifiers:p,comments:h,params:d,selfClosing:N,loc:g}=this.finish(this.currentStartTag),T=f.element({path:o,selfClosing:N,attributes:c,modifiers:p,comments:h,params:d,children:[],openTag:g,closeTag:N?null:O.broken(),loc:g});this.elementStack.push(T)}finishEndTag(e){let{start:r}=this.currentTag,n=this.finish(this.currentTag),s=this.elementStack.pop();this.validateEndTag(n,s,e);let i=this.currentElement();e?s.closeTag=null:s.selfClosing?w(s.closeTag===null,"element.closeTag unexpectedly present"):s.closeTag=r.until(this.offset()),s.loc=s.loc.withEnd(this.offset()),Ve(i,f.element(s))}markTagAsSelfClosing(){let e=this.currentTag;if(e.type==="StartTag")e.selfClosing=!0;else throw S("Invalid end tag: closing tag must not be self-closing",this.source.spanFor({start:e.start.toJSON(),end:this.offset().toJSON()}))}appendToTagName(e){let r=this.curre
`?i=n?n.loc.getEnd():this.currentAttr.valueSpan.getStart():i=i.move(-1),this.currentAttr.currentPart=f.text({chars:e,loc:i.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let e=this.currentTag,r=this.offset();if(e.type==="EndTag")throw S("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:e.start.toJSON(),end:r.toJSON()}));let{name:n,parts:s,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr;if(n.startsWith("|")&&s.length===0&&!a&&!o)throw S("Invalid block parameters syntax: block parameters must be preceded by the `as` keyword",i.until(i.move(n.length)));let p=this.assembleAttributeValue(s,a,o,i.until(r));p.loc=c.withEnd(r);let h=f.attr({name:n,value:p,loc:i.until(r)});this.currentStartTag.attributes.push(h)}parsePossibleBlockParams(){let e="beforeAttributeName",r="attributeName",n="afterAttributeName",s=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;w(this.tokenizer.state===r,"must be in TokenizerState.attributeName");let i=this.currentStartTag,a=this.currentAttr,o={state:"PossibleAs"},c={PossibleAs:h=>{if(w(o.state==="PossibleAs","bug in block params parser"),He(h))o={state:"BeforeStartPipe"},this.tokenizer.transitionTo(n),this.tokenizer.consume();else{if(h==="|")throw S('Invalid block parameters syntax: expecting at least one space character between "as" and "|"',a.start.until(this.offset().move(1)));o={state:"Done"}}},BeforeStartPipe:h=>{w(o.state==="BeforeStartPipe","bug in block params parser"),He(h)?this.tokenizer.consume():h==="|"?(o={state:"BeforeBlockParamName"},this.tokenizer.transitionTo(e),this.tokenizer.consume()):o={state:"Done"}},BeforeBlockParamName:h=>{if(w(o.state==="BeforeBlockParamName","bug in block params parser"),He(h))this.tokenizer.consume();else if(h==="")o={state:"Done"},this.pendingError={mustache(d){throw S("Invalid block parameters syntax: mustaches cannot be used inside parameters list",d)},eof(d){throw S('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',a.start.until(d))}};else if(h==="|"){if(i.params.length===0)throw S("Invalid block parameters syntax: empty parameters list, expecting at least one identifier",a.start.until(this.offset().move(1)));o={state:"AfterEndPipe"},this.tokenizer.consume()}else{if(h===">"||h==="/")throw S('Invalid block parameters syntax: incomplete parameters list, expecting "|" but the tag was closed prematurely',a.start.until(this.offset().move(1)));o={state:"BlockParamName",name:h,start:this.offset()},this.tokenizer.consume()}},BlockParamName:h=>{if(w(o.state==="BlockParamName","bug in block params parser"),h==="")o={state:"Done"},this.pendingError={mustache(d){throw S("Invalid block parameters syntax: mustaches cannot be used inside parameters list",d)},eof(d){throw S('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',a.start.until(d))}};else if(h==="|"||He(h)){let d=o.start.until(this.offset());if(o.name==="this"||s.test(o.name))throw S(`Invalid block parameters syntax: invalid identifier name \`${o.name}\``,d);i.params.push(f.var({name:o.name,loc:d})),o=h==="|"?{state:"AfterEndPipe"}:{state:"BeforeBlockParamName"},this.tokenizer.consume()}else{if(h===">"||h==="/")throw S('Invalid block parameters syntax: expecting "|" but the tag was closed prematurely',a.start.until(this.offset().move(1)));o.name+=h,this.tokenizer.consume()}},AfterEndPipe:h=>{w(o.state==="AfterEndPipe","bug in block params parser"),He(h)?this.tokenizer.consume():h===""?(o={state:"Done"},this.pendingError={mustache(d){throw S("Invalid block parameters syntax: modifiers cannot follow parameters list",d)},eof(d){throw S('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',a.start.until(d))}}):h===">"||h==="/"?o={state:"Done"}:(o={state:"Error",message:'Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',start:this.offset()},this.tokenizer.consume())},Error:h=>{if(w(o.state==="Error","bug in block params parser"),h===""||h==="/"||h===">"||He(
`,$n="\r",jn=function(){function t(e){this.length=e.length;for(var r=[0],n=0;n<e.length;)switch(e[n]){case Bt:n+=Bt.length,r.push(n);break;case $n:n+=$n.length,e[n]===Bt&&(n+=Bt.length),r.push(n);break;default:n++;break}this.offsets=r}return t.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var r=0,n=this.offsets;n[r+1]<=e;)r++;var s=e-n[r];return{line:r,column:s}},t.prototype.indexForLocation=function(e){var r=e.line,n=e.column;return r<0||r>=this.offsets.length||n<0||n>this.lengthOfLine(r)?null:this.offsets[r]+n},t.prototype.lengthOfLine=function(e){var r=this.offsets[e],n=e===this.offsets.length-1?this.length:this.offsets[e+1];return n-r},t}();function ia(t,e){let r=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(r,e)}var Qn=ia;function aa(t){let e=t.children??t.body;if(e)for(let r=0;r<e.length-1;r++)e[r].type==="TextNode"&&e[r+1].type==="MustacheStatement"&&(e[r].chars=e[r].chars.replace(/\\$/,"\\\\"))}function oa(t){let e=new jn(t),r=({line:s,column:i})=>e.indexForLocation({line:s-1,column:i}),n=s=>{let{start:i,end:a}=s.loc;i.offset=r(i),a.offset=r(a)};return()=>({name:"prettierParsePlugin",visitor:{All(s){n(s),aa(s)}}})}function la(t){let e;try{e=Wn(t,{mode:"codemod",plugins:{ast:[oa(t)]}})}catch(r){let n=ua(r);if(n){let s=ca(r);throw Qn(s,{loc:n,cause:r})}throw r}return e}function ca(t){let{message:e}=t,r=e.split(`
`);return r.length>=4&&/^Parse error on line \d+:$/.test(r[0])&&/^-*\^$/.test(oe(!1,r,-2))?oe(!1,r,-1):r.length>=4&&/:\s?$/.test(r[0])&&/^\(error occurred in '.*?' @ line \d+ : column \d+\)$/.test(oe(!1,r,-1))&&r[1]===""&&oe(!1,r,-2)===""&&r.slice(2,-2).every(n=>n.startsWith("|"))?r[0].trim().slice(0,-1):e}function ua(t){let{location:e,hash:r}=t;if(e){let{start:n,end:s}=e;return typeof s.line!="number"?{start:n}:e}if(r){let{loc:{last_line:n,last_column:s}}=r;return{start:{line:n,column:s+1}}}}var ha={parse:la,astFormat:"glimmer",locStart:Se,locEnd:tt};var pa={glimmer:En};var bl=Rr;export{bl as default,Sn as languages,Ir as parsers,pa as printers};