@kurtinatlanta/prettier 3.8.0-dev → 3.8.0-hoyt.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,7 @@ Expecting `+Qt.join(", ")+", got '"+(this.terminals_[L]||L)+"'":De="Parse error
27
27
  `:"",c=new Error(`${e}: ${o}(error occurred in '${r}' @ line ${n} : column ${i})`);return c.name="SyntaxError",c.location=t,c.code=a,c}var be={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"]},dr=(function(){function e(t,r,s,n){let i=Error.call(this,t);this.key=n,this.message=t,this.node=r,this.parent=s,i.stack&&(this.stack=i.stack)}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e})();function tn(e,t,r){return new dr("Cannot remove a node unless it is part of an array",e,t,r)}function Us(e,t,r){return new dr("Cannot replace a node with multiple nodes unless it is part of an array",e,t,r)}function en(e,t){return new dr("Replacing and removing in key handlers is not yet supported.",e,null,t)}var Ct=class{constructor(t,r=null,s=null){this.node=t,this.parent=r,this.parentKey=s}get parentNode(){return this.parent?this.parent.node:null}parents(){return{[Symbol.iterator]:()=>new cr(this)}}},cr=class{constructor(t){this.path=t}next(){return this.path.parent?(this.path=this.path.parent,{done:!1,value:this.path}):{done:!0,value:null}}};function un(e){return typeof e=="function"?e:e.enter}function hn(e){return typeof e=="function"?void 0:e.exit}function ye(e,t){let r,s,n,{node:i,parent:a,parentKey:o}=t,c=(function(h,f){if(h.Program&&(f==="Template"&&!h.Template||f==="Block"&&!h.Block))return h.Program;let p=h[f];return p!==void 0?p:h.All})(e,i.type);if(c!==void 0&&(r=un(c),s=hn(c)),r!==void 0&&(n=r(i,t)),n!=null){if(JSON.stringify(i)!==JSON.stringify(n))return Array.isArray(n)?(pn(e,n,a,o),n):ye(e,new Ct(n,a,o))||n;n=void 0}if(n===void 0){let h=be[i.type];for(let f=0;f<h.length;f++)Ms(e,c,t,h[f]);s!==void 0&&(n=s(i,t))}return n}function rn(e,t,r){e[t]=r}function Ms(e,t,r,s){let n,i,{node:a}=r,o=(function(c,h){return c[h]})(a,s);if(o){if(t!==void 0){let c=(function(h,f){let p=typeof h!="function"?h.keys:void 0;if(p===void 0)return;let g=p[f];return g!==void 0?g:p.All})(t,s);c!==void 0&&(n=un(c),i=hn(c))}if(n!==void 0&&n(a,s)!==void 0)throw en(a,s);if(Array.isArray(o))pn(e,o,r,s);else{let c=ye(e,new Ct(o,r,s));c!==void 0&&(function(h,f,p,g){if(g===null)throw tn(p,h,f);if(Array.isArray(g)){if(g.length!==1)throw g.length===0?tn(p,h,f):Us(p,h,f);rn(h,f,g[0])}else rn(h,f,g)})(a,s,o,c)}if(i!==void 0&&i(a,s)!==void 0)throw en(a,s)}}function pn(e,t,r,s){for(let n=0;n<t.length;n++){let i=t[n],a=ye(e,new Ct(i,r,s));a!==void 0&&(n+=zs(t,n,a)-1)}}function zs(e,t,r){return r===null?(e.splice(t,1),0):Array.isArray(r)?(e.splice(t,1,...r),r.length):(e.splice(t,1,r),1)}function Ys(e,t){ye(t,new Ct(e))}function At(e,t){(function(r){switch(r.type){case"Block":case"Template":return r.body;case"ElementNode":return r.children}})(e).push(t)}function fn(e){return e.type==="StringLiteral"||e.type==="BooleanLiteral"||e.type==="NumberLiteral"||e.type==="NullLiteral"||e.type==="UndefinedLiteral"}var tr;function er(){return tr||(tr=new pt("","(synthetic)")),tr}function nn(e,t){return d.var({name:e,loc:v(t||null)})}function rt(e,t){let r=v(t||null);if(typeof e!="string"){if("type"in e)return e;{e.head.indexOf(".");let{head:i,tail:a}=e;return d.path({head:d.head({original:i,loc:r.sliceStartChars({chars:i.length})}),tail:a,loc:v(t||null)})}}let{head:s,tail:n}=(function(i,a){let[o,...c]=i.split("."),h=d.head({original:o,loc:v(a||null)});return d.path({head:h,tail:c,loc:v(a||null)})})(e,r);return d.path({head:s,tail:n,loc:r})}function me(e,t,r){return d.literal({type:e,value:t,loc:v(r||null)})}function Ht(e=[],t){return d.hash({pairs:e,loc:v(t||null)})}function mn(e){return e.map((t=>typeof t=="string"?d.var({name:t,loc:A.synthetic(t)}):t))}function sn(e=[],t=[],r=!1,s){return d.blockItself({body:e,params:mn(t),chained:r,loc:v(s||null)})}function an(e=[],t=[],r){return d.template({body:e,blockParams:t,loc:v(r||null)})}function v(...e){if(e.length===1){let t=e[0];return t&&typeof t=="object"?A.forHbsLoc(er(),t):A.forHbsLoc(er(),Fs)}{let[t,r,s,n,i]=e,a=i?new pt("",i):er();return A.forHbsLoc(a,{start:{line:t,column:r},end:{line:s||t,column:n||r}})}}var Gs={mustache:function(e,t=[],r=Ht([]),s=!1,n,i){return d.mustache({path:rt(e),params:t,hash:r,trusting:s,strip:i,loc:v(n||null)})},block:function(e,t,r,s,n=null,i,a,o,c){let h,f=null;return h=s.type==="Template"?d.blockItself({params:mn(s.blockParams),body:s.body,loc:s.loc}):s,n?.type==="Template"?(n.blockParams.length,f=d.blockItself({params:[],body:n.body,loc:n.loc})):f=n,d.block({path:rt(e),params:t||[],hash:r||Ht([]),defaultBlock:h,elseBlock:f,loc:v(i||null),openStrip:a,inverseStrip:o,closeStrip:c})},comment:function(e,t){return d.comment({value:e,loc:v(t||null)})},mustacheComment:function(e,t){return d.mustacheComment({value:e,loc:v(t||null)})},element:function(e,t={}){let r,s,{attrs:n,blockParams:i,modifiers:a,comments:o,children:c,openTag:h,closeTag:f,loc:p}=t;typeof e=="string"?e.endsWith("/")?(r=rt(e.slice(0,-1)),s=!0):r=rt(e):"type"in e?(e.type,e.type,r=e):"path"in e?(e.path.type,e.path.type,r=e.path,s=e.selfClosing):(r=rt(e.name),s=e.selfClosing);let g=i?.map((T=>typeof T=="string"?nn(T):T)),E=null;return f?E=v(f):f===void 0&&(E=s||qs(r.original)?null:v(null)),d.element({path:r,selfClosing:s||!1,attributes:n||[],params:g||[],modifiers:a||[],comments:o||[],children:c||[],openTag:v(h||null),closeTag:E,loc:v(p||null)})},elementModifier:function(e,t,r,s){return d.elementModifier({path:rt(e),params:t||[],hash:r||Ht([]),loc:v(s||null)})},attr:function(e,t,r){return d.attr({name:e,value:t,loc:v(r||null)})},text:function(e="",t){return d.text({chars:e,loc:v(t||null)})},sexpr:function(e,t=[],r=Ht([]),s){return d.sexpr({path:rt(e),params:t,hash:r,loc:v(s||null)})},concat:function(e,t){if(!Yt(e))throw new Error("b.concat requires at least one part");return d.concat({parts:e,loc:v(t||null)})},hash:Ht,pair:function(e,t,r){return d.pair({key:e,value:t,loc:v(r||null)})},literal:me,program:function(e,t,r){return t&&t.length?sn(e,t,!1,r):an(e,[],r)},blockItself:sn,template:an,loc:v,pos:function(e,t){return d.pos({line:e,column:t})},path:rt,fullPath:function(e,t=[],r){return d.path({head:e,tail:t,loc:v(r||null)})},head:function(e,t){return d.head({original:e,loc:v(t||null)})},at:function(e,t){return d.atName({name:e,loc:v(t||null)})},var:nn,this:function(e){return d.this({loc:v(e||null)})},string:rr("StringLiteral"),boolean:rr("BooleanLiteral"),number:rr("NumberLiteral"),undefined:()=>me("UndefinedLiteral",void 0),null:()=>me("NullLiteral",null)};function rr(e){return function(t,r){return me(e,t,r)}}var fe={close:!1,open:!1},d=new class{pos({line:e,column:t}){return{line:e,column:t}}blockItself({body:e,params:t,chained:r=!1,loc:s}){return{type:"Block",body:e,params:t,get blockParams(){return this.params.map((n=>n.name))},set blockParams(n){this.params=n.map((i=>d.var({name:i,loc:A.synthetic(i)})))},chained:r,loc:s}}template({body:e,blockParams:t,loc:r}){return{type:"Template",body:e,blockParams:t,loc:r}}mustache({path:e,params:t,hash:r,trusting:s,loc:n,strip:i=fe}){return(function({path:a,params:o,hash:c,trusting:h,strip:f,loc:p}){let g={type:"MustacheStatement",path:a,params:o,hash:c,trusting:h,strip:f,loc:p};return Object.defineProperty(g,"escaped",{enumerable:!1,get(){return!this.trusting},set(E){this.trusting=!E}}),g})({path:e,params:t,hash:r,trusting:s,strip:i,loc:n})}block({path:e,params:t,hash:r,defaultBlock:s,elseBlock:n=null,loc:i,openStrip:a=fe,inverseStrip:o=fe,closeStrip:c=fe}){return{type:"BlockStatement",path:e,params:t,hash:r,program:s,inverse:n,loc:i,openStrip:a,inverseStrip:o,closeStrip:c}}comment({value:e,loc:t}){return{type:"CommentStatement",value:e,loc:t}}mustacheComment({value:e,loc:t}){return{type:"MustacheCommentStatement",value:e,loc:t}}concat({parts:e,loc:t}){return{type:"ConcatStatement",parts:e,loc:t}}element({path:e,selfClosing:t,attributes:r,modifiers:s,params:n,comments:i,children:a,openTag:o,closeTag:c,loc:h}){let f=t;return{type:"ElementNode",path:e,attributes:r,modifiers:s,params:n,comments:i,children:a,openTag:o,closeTag:c,loc:h,get tag(){return this.path.original},set tag(p){this.path.original=p},get blockParams(){return this.params.map((p=>p.name))},set blockParams(p){this.params=p.map((g=>d.var({name:g,loc:A.synthetic(g)})))},get selfClosing(){return f},set selfClosing(p){f=p,this.closeTag=p?null:A.synthetic(`</${this.tag}>`)}}}elementModifier({path:e,params:t,hash:r,loc:s}){return{type:"ElementModifierStatement",path:e,params:t,hash:r,loc:s}}attr({name:e,value:t,loc:r}){return{type:"AttrNode",name:e,value:t,loc:r}}text({chars:e,loc:t}){return{type:"TextNode",chars:e,loc:t}}sexpr({path:e,params:t,hash:r,loc:s}){return{type:"SubExpression",path:e,params:t,hash:r,loc:s}}path({head:e,tail:t,loc:r}){return(function({head:s,tail:n,loc:i}){let a={type:"PathExpression",head:s,tail:n,get original(){return[this.head.original,...this.tail].join(".")},set original(o){let[c,...h]=o.split(".");this.head=Gs.head(c,this.head.loc),this.tail=h},loc:i};return Object.defineProperty(a,"parts",{enumerable:!1,get(){let o=this.original.split(".");return o[0]==="this"?o.shift():o[0].startsWith("@")&&(o[0]=o[0].slice(1)),Object.freeze(o)},set(o){let c=[...o];c[0]==="this"||c[0]?.startsWith("@")||(this.head.type==="ThisHead"?c.unshift("this"):this.head.type==="AtHead"&&(c[0]=`@${c[0]}`)),this.original=c.join(".")}}),Object.defineProperty(a,"this",{enumerable:!1,get(){return this.head.type==="ThisHead"}}),Object.defineProperty(a,"data",{enumerable:!1,get(){return this.head.type==="AtHead"}}),a})({head:e,tail:t,loc:r})}head({original:e,loc:t}){return e==="this"?this.this({loc:t}):e[0]==="@"?this.atName({name:e,loc:t}):this.var({name:e,loc:t})}this({loc:e}){return{type:"ThisHead",get original(){return"this"},loc:e}}atName({name:e,loc:t}){let r="",s={type:"AtHead",get name(){return r},set name(n){n[0],n.indexOf("."),r=n},get original(){return this.name},set original(n){this.name=n},loc:t};return s.name=e,s}var({name:e,loc:t}){let r="",s={type:"VarHead",get name(){return r},set name(n){n[0],n.indexOf("."),r=n},get original(){return this.name},set original(n){this.name=n},loc:t};return s.name=e,s}hash({pairs:e,loc:t}){return{type:"Hash",pairs:e,loc:t}}pair({key:e,value:t,loc:r}){return{type:"HashPair",key:e,value:t,loc:r}}literal({type:e,value:t,loc:r}){return(function({type:s,value:n,loc:i}){let a={type:s,value:n,loc:i};return Object.defineProperty(a,"original",{enumerable:!1,get(){return this.value},set(o){this.value=o}}),a})({type:e,value:t,loc:r})}},ur=class{constructor(t,r=new Xe(Xr),s="precompile"){this.elementStack=[],this.currentAttribute=null,this.currentNode=null,this.source=t,this.lines=t.source.split(/\r\n?|\n/u),this.tokenizer=new Ze(this,r,s)}offset(){let{line:t,column:r}=this.tokenizer;return this.source.offsetFor(t,r)}pos({line:t,column:r}){return this.source.offsetFor(t,r)}finish(t){return Ye({},t,{loc:t.start.until(this.offset())})}get currentAttr(){return this.currentAttribute}get currentTag(){let t=this.currentNode;return t&&(t.type==="StartTag"||t.type),t}get currentStartTag(){let t=this.currentNode;return t&&t.type,t}get currentEndTag(){let t=this.currentNode;return t&&t.type,t}get currentComment(){let t=this.currentNode;return t&&t.type,t}get currentData(){let t=this.currentNode;return t&&t.type,t}acceptNode(t){return this[t.type](t)}currentElement(){return mr(this.elementStack)}sourceForNode(t,r){let s,n,i,a=t.loc.start.line-1,o=a-1,c=t.loc.start.column,h=[];for(r?(n=r.loc.end.line-1,i=r.loc.end.column):(n=t.loc.end.line-1,i=t.loc.end.column);o<n;)o++,s=this.lines[o],o===a?a===n?h.push(s.slice(c,i)):h.push(s.slice(c)):o===n?h.push(s.slice(0,i)):h.push(s);return h.join(`
28
28
  `)}},hr=class extends ur{parse(t,r){t.loc;let s=d.template({body:[],blockParams:r,loc:this.source.spanFor(t.loc)}),n=this.parseProgram(s,t);return this.pendingError?.eof(n.loc.getEnd()),n}Program(t,r){t.loc;let s=d.blockItself({body:[],params:r,chained:t.chained,loc:this.source.spanFor(t.loc)});return this.parseProgram(s,t)}parseProgram(t,r){if(r.body.length===0)return t;let s;try{this.elementStack.push(t);for(let n of r.body)this.acceptNode(n)}finally{s=this.elementStack.pop()}if(t!==s){if(s?.type==="ElementNode")throw k(`Unclosed element \`${s.tag}\``,s.loc);t.type}return t}BlockStatement(t){if(this.tokenizer.state==="comment")return t.loc,void this.appendToCommentData(this.sourceForNode(t));if(this.tokenizer.state!=="data"&&this.tokenizer.state!=="beforeData")throw k("A block may only be used inside an HTML element or another block.",this.source.spanFor(t.loc));let{path:r,params:s,hash:n}=nr(this,t),i=this.source.spanFor(t.loc),a,o=[];if(t.program.blockParams?.length){let p=n.loc.collapse("end");p=t.program.loc?p.withEnd(this.source.spanFor(t.program.loc).getStart()):t.program.body[0]?p.withEnd(this.source.spanFor(t.program.body[0].loc).getStart()):p.withEnd(i.getEnd()),a=on(this.source,t,p);let g=p.asString(),E=g.indexOf("|")+1,T=g.indexOf("|",E);for(let D of t.program.blockParams){let I,O;I=E>=T?-1:g.indexOf(D,E),I===-1||I+D.length>T?(E=T,O=this.source.spanFor(ir)):(E=I,O=p.sliceStartChars({skipStart:E,chars:D.length}),E+=D.length),o.push(d.var({name:D,loc:O}))}}else a=on(this.source,t,i);let c=this.Program(a.program,o),h=a.inverse?this.Program(a.inverse,[]):null,f=d.block({path:r,params:s,hash:n,defaultBlock:c,elseBlock:h,loc:this.source.spanFor(t.loc),openStrip:t.openStrip,inverseStrip:t.inverseStrip,closeStrip:t.closeStrip});At(this.currentElement(),f)}MustacheStatement(t){this.pendingError?.mustache(this.source.spanFor(t.loc));let{tokenizer:r}=this;if(r.state==="comment")return void this.appendToCommentData(this.sourceForNode(t));let s,{escaped:n,loc:i,strip:a}=t;if("original"in t.path&&t.path.original==="...attributes")throw k("Illegal use of ...attributes",this.source.spanFor(t.loc));if(fn(t.path))s=d.mustache({path:this.acceptNode(t.path),params:[],hash:d.hash({pairs:[],loc:this.source.spanFor(t.path.loc).collapse("end")}),trusting:!n,loc:this.source.spanFor(i),strip:a});else{let{path:o,params:c,hash:h}=nr(this,t);s=d.mustache({path:o,params:c,hash:h,trusting:!n,loc:this.source.spanFor(i),strip:a})}switch(r.state){case"tagOpen":case"tagName":throw k("Cannot use mustaches in an elements tagname",s.loc);case"beforeAttributeName":sr(this.currentStartTag,s);break;case"attributeName":case"afterAttributeName":this.beginAttributeValue(!1),this.finishAttributeValue(),sr(this.currentStartTag,s),r.transitionTo("beforeAttributeName");break;case"afterAttributeValueQuoted":sr(this.currentStartTag,s),r.transitionTo("beforeAttributeName");break;case"beforeAttributeValue":this.beginAttributeValue(!1),this.appendDynamicAttributeValuePart(s),r.transitionTo("attributeValueUnquoted");break;case"attributeValueDoubleQuoted":case"attributeValueSingleQuoted":case"attributeValueUnquoted":this.appendDynamicAttributeValuePart(s);break;default:At(this.currentElement(),s)}return s}appendDynamicAttributeValuePart(t){this.finalizeTextPart();let r=this.currentAttr;r.isDynamic=!0,r.parts.push(t)}finalizeTextPart(){let t=this.currentAttr.currentPart;t!==null&&(this.currentAttr.parts.push(t),this.startTextPart())}startTextPart(){this.currentAttr.currentPart=null}ContentStatement(t){(function(r,s){let n=s.loc.start.line,i=s.loc.start.column,a=(function(o,c){if(c==="")return{lines:o.split(`
29
29
  `).length-1,columns:0};let[h]=o.split(c),f=h.split(/\n/u),p=f.length-1;return{lines:p,columns:f[p].length}})(s.original,s.value);n+=a.lines,a.lines?i=a.columns:i+=a.columns,r.line=n,r.column=i})(this.tokenizer,t),this.tokenizer.tokenizePart(t.value),this.tokenizer.flushData()}CommentStatement(t){let{tokenizer:r}=this;if(r.state==="comment")return this.appendToCommentData(this.sourceForNode(t)),null;let{value:s,loc:n}=t,i=d.mustacheComment({value:s,loc:this.source.spanFor(n)});switch(r.state){case"beforeAttributeName":case"afterAttributeName":this.currentStartTag.comments.push(i);break;case"beforeData":case"data":At(this.currentElement(),i);break;default:throw k(`Using a Handlebars comment when in the \`${r.state}\` state is not supported`,this.source.spanFor(t.loc))}return i}PartialStatement(t){throw k("Handlebars partials are not supported",this.source.spanFor(t.loc))}PartialBlockStatement(t){throw k("Handlebars partial blocks are not supported",this.source.spanFor(t.loc))}Decorator(t){throw k("Handlebars decorators are not supported",this.source.spanFor(t.loc))}DecoratorBlock(t){throw k("Handlebars decorator blocks are not supported",this.source.spanFor(t.loc))}SubExpression(t){let{path:r,params:s,hash:n}=nr(this,t);return d.sexpr({path:r,params:s,hash:n,loc:this.source.spanFor(t.loc)})}PathExpression(t){let{original:r}=t,s;if(r.indexOf("/")!==-1){if(r.slice(0,2)==="./")throw k('Using "./" is not supported in Glimmer and unnecessary',this.source.spanFor(t.loc));if(r.slice(0,3)==="../")throw k('Changing context using "../" is not supported in Glimmer',this.source.spanFor(t.loc));if(r.indexOf(".")!==-1)throw k("Mixing '.' and '/' in paths is not supported in Glimmer; use only '.' to separate property paths",this.source.spanFor(t.loc));s=[t.parts.join("/")]}else{if(r===".")throw k("'.' is not a supported path in Glimmer; check for a path with a trailing '.'",this.source.spanFor(t.loc));s=t.parts}let n,i=!1;if(/^this(?:\..+)?$/u.test(r)&&(i=!0),i)n=d.this({loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+4}})});else if(t.data){let a=s.shift();if(a===void 0)throw k("Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z.",this.source.spanFor(t.loc));n=d.atName({name:`@${a}`,loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+a.length+1}})})}else{let a=s.shift();if(a===void 0)throw k("Attempted to parse a path expression, but it was not valid. Paths must start with a-z or A-Z.",this.source.spanFor(t.loc));n=d.var({name:a,loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+a.length}})})}return d.path({head:n,tail:s,loc:this.source.spanFor(t.loc)})}Hash(t){let r=t.pairs.map((s=>d.pair({key:s.key,value:this.acceptNode(s.value),loc:this.source.spanFor(s.loc)})));return d.hash({pairs:r,loc:this.source.spanFor(t.loc)})}StringLiteral(t){return d.literal({type:"StringLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}BooleanLiteral(t){return d.literal({type:"BooleanLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}NumberLiteral(t){return d.literal({type:"NumberLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}UndefinedLiteral(t){return d.literal({type:"UndefinedLiteral",value:void 0,loc:this.source.spanFor(t.loc)})}NullLiteral(t){return d.literal({type:"NullLiteral",value:null,loc:this.source.spanFor(t.loc)})}constructor(...t){super(...t),this.pendingError=null}};function nr(e,t){let r;switch(t.path.type){case"PathExpression":r=e.PathExpression(t.path);break;case"SubExpression":r=e.SubExpression(t.path);break;case"StringLiteral":case"UndefinedLiteral":case"NullLiteral":case"NumberLiteral":case"BooleanLiteral":{let i;throw i=t.path.type==="BooleanLiteral"?t.path.original.toString():t.path.type==="StringLiteral"?`"${t.path.original}"`:t.path.type==="NullLiteral"?"null":t.path.type==="NumberLiteral"?t.path.value.toString():"undefined",k(`${t.path.type} "${t.path.type==="StringLiteral"?t.path.original:i}" cannot be called as a sub-expression, replace (${i}) with ${i}`,e.source.spanFor(t.path.loc))}}let s=t.params.map((i=>e.acceptNode(i))),n=Yt(s)?mr(s).loc:r.loc;return{path:r,params:s,hash:t.hash?e.Hash(t.hash):d.hash({pairs:[],loc:e.source.spanFor(n).collapse("end")})}}function sr(e,t){let{path:r,params:s,hash:n,loc:i}=t;if(fn(r)){let o=`{{${(function(c){return c.type==="UndefinedLiteral"?"undefined":JSON.stringify(c.value)})(r)}}}`;throw k(`In <${e.name} ... ${o} ..., ${o} is not a valid modifier`,t.loc)}let a=d.elementModifier({path:r,params:s,hash:n,loc:i});e.modifiers.push(a)}function on(e,t,r){if(!t.program.loc){let n=V(0,t.program.body,0),i=V(0,t.program.body,-1);if(n&&i)t.program.loc={...n.loc,end:i.loc.end};else{let a=e.spanFor(t.loc);t.program.loc=r.withEnd(a.getEnd())}}let s=e.spanFor(t.program.loc).getEnd();return t.inverse&&!t.inverse.loc&&(t.inverse.loc=s.collapsed()),t}function xt(e){return/[\t\n\f ]/u.test(e)}var pr=class extends hr{reset(){this.currentNode=null}beginComment(){this.currentNode={type:"CommentStatement",value:"",start:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}appendToCommentData(t){this.currentComment.value+=t}finishComment(){At(this.currentElement(),d.comment(this.finish(this.currentComment)))}beginData(){this.currentNode={type:"TextNode",chars:"",start:this.offset()}}appendToData(t){this.currentData.chars+=t}finishData(){At(this.currentElement(),d.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 t=this.finish(this.currentTag);if(t.type==="StartTag"){if(this.finishStartTag(),t.name===":")throw k("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()}));(de.has(t.name)||t.selfClosing)&&this.finishEndTag(!0)}else t.type,t.type,this.finishEndTag(!1)}finishStartTag(){let{name:t,nameStart:r,nameEnd:s}=this.currentStartTag,n=r.until(s),[i,...a]=t.split("."),o=d.path({head:d.head({original:i,loc:n.sliceStartChars({chars:i.length})}),tail:a,loc:n}),{attributes:c,modifiers:h,comments:f,params:p,selfClosing:g,loc:E}=this.finish(this.currentStartTag),T=d.element({path:o,selfClosing:g,attributes:c,modifiers:h,comments:f,params:p,children:[],openTag:E,closeTag:g?null:A.broken(),loc:E});this.elementStack.push(T)}finishEndTag(t){let{start:r}=this.currentTag,s=this.finish(this.currentTag),n=this.elementStack.pop();this.validateEndTag(s,n,t);let i=this.currentElement();t?n.closeTag=null:n.selfClosing?n.closeTag:n.closeTag=r.until(this.offset()),n.loc=n.loc.withEnd(this.offset()),At(i,d.element(n))}markTagAsSelfClosing(){let t=this.currentTag;if(t.type!=="StartTag")throw k("Invalid end tag: closing tag must not be self-closing",this.source.spanFor({start:t.start.toJSON(),end:this.offset().toJSON()}));t.selfClosing=!0}appendToTagName(t){let r=this.currentTag;if(r.name+=t,r.type==="StartTag"){let s=this.offset();r.nameStart===null&&(r.nameEnd,r.nameStart=s.move(-1)),r.nameEnd=s}}beginAttribute(){let t=this.offset();this.currentAttribute={name:"",parts:[],currentPart:null,isQuoted:!1,isDynamic:!1,start:t,valueSpan:t.collapsed()}}appendToAttributeName(t){this.currentAttr.name+=t,this.currentAttr.name==="as"&&this.parsePossibleBlockParams()}beginAttributeValue(t){this.currentAttr.isQuoted=t,this.startTextPart(),this.currentAttr.valueSpan=this.offset().collapsed()}appendToAttributeValue(t){let r=this.currentAttr.parts,s=r[r.length-1],n=this.currentAttr.currentPart;if(n)n.chars+=t,n.loc=n.loc.withEnd(this.offset());else{let i=this.offset();i=t===`
30
- `?s?s.loc.getEnd():this.currentAttr.valueSpan.getStart():i.move(-1),this.currentAttr.currentPart=d.text({chars:t,loc:i.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let t=this.currentTag,r=this.offset();if(t.type==="EndTag")throw k("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:t.start.toJSON(),end:r.toJSON()}));let{name:s,parts:n,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr;if(s.startsWith("|")&&n.length===0&&!a&&!o)throw k("Invalid block parameters syntax: block parameters must be preceded by the `as` keyword",i.until(i.move(s.length)));let h=this.assembleAttributeValue(n,a,o,i.until(r));h.loc=c.withEnd(r);let f=d.attr({name:s,value:h,loc:i.until(r)});this.currentStartTag.attributes.push(f)}parsePossibleBlockParams(){let t=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;this.tokenizer.state;let r=this.currentStartTag,s=this.currentAttr,n={state:"PossibleAs"},i={PossibleAs:o=>{if(n.state,xt(o))n={state:"BeforeStartPipe"},this.tokenizer.transitionTo("afterAttributeName"),this.tokenizer.consume();else{if(o==="|")throw k('Invalid block parameters syntax: expecting at least one space character between "as" and "|"',s.start.until(this.offset().move(1)));n={state:"Done"}}},BeforeStartPipe:o=>{n.state,xt(o)?this.tokenizer.consume():o==="|"?(n={state:"BeforeBlockParamName"},this.tokenizer.transitionTo("beforeAttributeName"),this.tokenizer.consume()):n={state:"Done"}},BeforeBlockParamName:o=>{if(n.state,xt(o))this.tokenizer.consume();else if(o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"){if(r.params.length===0)throw k("Invalid block parameters syntax: empty parameters list, expecting at least one identifier",s.start.until(this.offset().move(1)));n={state:"AfterEndPipe"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: incomplete parameters list, expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n={state:"BlockParamName",name:o,start:this.offset()},this.tokenizer.consume()}},BlockParamName:o=>{if(n.state,o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"||xt(o)){let c=n.start.until(this.offset());if(n.name==="this"||t.test(n.name))throw k(`Invalid block parameters syntax: invalid identifier name \`${n.name}\``,c);r.params.push(d.var({name:n.name,loc:c})),n=o==="|"?{state:"AfterEndPipe"}:{state:"BeforeBlockParamName"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n.name+=o,this.tokenizer.consume()}},AfterEndPipe:o=>{n.state,xt(o)?this.tokenizer.consume():o===""?(n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: modifiers cannot follow parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}}):o===">"||o==="/"?n={state:"Done"}:(n={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:o=>{if(n.state,o===""||o==="/"||o===">"||xt(o))throw k(n.message,n.start.until(this.offset()));this.tokenizer.consume()},Done:()=>{}},a;do a=this.tokenizer.peek(),i[n.state](a);while(n.state!=="Done"&&a!=="");n.state}reportSyntaxError(t){throw k(t,this.offset().collapsed())}assembleConcatenatedValue(t){let r=Vs(t),s=mr(t);return d.concat({parts:t,loc:this.source.spanFor(r.loc).extend(this.source.spanFor(s.loc))})}validateEndTag(t,r,s){if(de.has(t.name)&&!s)throw k(`<${t.name}> elements do not need end tags. You should remove it`,t.loc);if(r.type!=="ElementNode")throw k(`Closing tag </${t.name}> without an open tag`,t.loc);if(r.tag!==t.name)throw k(`Closing tag </${t.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`,t.loc)}assembleAttributeValue(t,r,s,n){if(s){if(r)return this.assembleConcatenatedValue(t);{let[i,a]=t;if(a===void 0||a.type==="TextNode"&&a.chars==="/")return i;throw k("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'",n)}}return Yt(t)?t[0]:d.text({chars:"",loc:n})}constructor(...t){super(...t),this.tagOpenLine=0,this.tagOpenColumn=0}},Ks={},fr=class extends Xe{constructor(){super({})}parse(){}};function dn(e,t={}){let r,s,n,i=t.mode||"precompile";typeof e=="string"?(r=new pt(e,t.meta?.moduleName),s=i==="codemod"?he(e,t.parseOptions):$e(e,t.parseOptions)):e instanceof pt?(r=e,s=i==="codemod"?he(e.source,t.parseOptions):$e(e.source,t.parseOptions)):(r=new pt("",t.meta?.moduleName),s=e),i==="codemod"&&(n=new fr);let a=A.forCharPositions(r,0,r.source.length);s.loc={source:"(program)",start:a.startPosition,end:a.endPosition};let o=new pr(r,n,i).parse(s,t.locals??[]);if(t.plugins?.ast)for(let c of t.plugins.ast)Ys(o,c(Ye({},t,{syntax:Ks},{plugins:void 0})).visitor);return o}var Ws={resolution:()=>pe.GetStrictKeyword,serialize:()=>"Strict",isAngleBracket:!1},_o={...Ws,isAngleBracket:!0};var js=Mr(be),gn=js;var mt=e=>e.loc.start.offset,Gt=e=>e.loc.end.offset;var Qs=new Set(ln());function yn(e){return e.toUpperCase()===e}function Js(e){return e.type==="ElementNode"&&typeof e.tag=="string"&&!e.tag.startsWith(":")&&(yn(e.tag[0])||e.tag.includes("."))}function $s(e){return Qs.has(e.toLowerCase())&&!yn(e[0])}function gr(e){return e.selfClosing===!0||$s(e.tag)||Js(e)&&e.children.every(t=>Se(t))}function Se(e){return e.type==="TextNode"&&!/\S/.test(e.chars)}function bn(e){return e?.type==="MustacheCommentStatement"&&typeof e.value=="string"&&e.value.trim()==="prettier-ignore"}function Sn(e){return bn(e.node)||e.isInArray&&(e.key==="children"||e.key==="body"||e.key==="parts")&&bn(e.siblings[e.index-2])}var xn=2;function Xs(e,t,r){let{node:s}=e;switch(s.type){case"Block":case"Program":case"Template":return B(e.map(r,"body"));case"ElementNode":{let n=t.htmlWhitespaceSensitivity!=="ignore",i=[!n&&e.previous?.type==="ElementNode"?H:"",B([ti(e,r)])];if(gr(s))return[i];let a=["</",s.tag,">"],o=s.tag==="style";if(s.children.length===0||(!n||o)&&s.children.every(h=>Se(h)))return[i,a];let c=e.map(r,"children");return o||!n?[i,F([H,...c]),H,a]:[i,F(B(c)),a]}case"BlockStatement":return Cn(e)?[oi(e,r),vn(e,t,r),wn(e,t,r)]:[si(e,r),B([vn(e,t,r),wn(e,t,r),li(e,t,r)])];case"ElementModifierStatement":return B(["{{",Nn(e,r),"}}"]);case"MustacheStatement":return B([ke(s),Nn(e,r),Ee(s)]);case"SubExpression":return B(["(",mi(e,r),H,")"]);case"AttrNode":{let{name:n,value:i}=s,a=i.type==="TextNode";if(a&&i.chars===""&&mt(i)===Gt(i))return n;let c=a?oe(i.chars,t.singleQuote):i.type==="ConcatStatement"?oe(i.parts.map(f=>f.type==="TextNode"?f.chars:"").join(""),t.singleQuote):"",h=r("value");return[n,"=",c,n==="class"&&c?B(F(h)):h,c]}case"ConcatStatement":return e.map(r,"parts");case"Hash":return ct(x,e.map(r,"pairs"));case"HashPair":return[s.key,"=",r("value")];case"TextNode":{let n=s.chars,{parent:i}=e;if(i.type==="ElementNode"){if(i.tag==="pre")return ie(n);if(i.tag==="style")return n=St(0,n,/^\n+/g,""),n=R.trimEnd(n),n=R.dedentString(n),ie(n,ut)}n=St(0,n,"{{","\\{{");let a=ci(e);if(a){if(a==="class"){let D=n.trim().split(/\s+/).join(" "),I=!1,O=!1;return e.parent.type==="ConcatStatement"&&(e.previous?.type==="MustacheStatement"&&/^\s/.test(n)&&(I=!0),e.next?.type==="MustacheStatement"&&/\s$/.test(n)&&D!==""&&(O=!0)),[I?x:"",D,O?x:""]}return ie(n)}let o=R.isWhitespaceOnly(n),{isFirst:c,isLast:h}=e;if(t.htmlWhitespaceSensitivity!=="ignore"){let D=h&&e.parent.type==="Template",I=c&&e.parent.type==="Template";if(o){if(I||D)return"";let C=[x],$=_t(n);return $&&(C=Kt($)),h&&(C=C.map(W=>Re(W))),C}let O=R.getLeadingWhitespace(n),z=[];if(O){z=[x];let C=_t(O);C&&(z=Kt(C)),n=n.slice(O.length)}let P=R.getTrailingWhitespace(n),U=[];if(P){if(!D){U=[x];let C=_t(P);C&&(U=Kt(C)),h&&(U=U.map($=>Re($)))}n=n.slice(0,-P.length)}return[...z,Ve(Tn(n)),...U]}let f=_t(n),p=ui(n),g=hi(n);if((c||h)&&o&&(e.parent.type==="Block"||e.parent.type==="ElementNode"||e.parent.type==="Template"))return"";o&&f?(p=Math.min(f,xn),g=0):((e.next?.type==="BlockStatement"||e.next?.type==="ElementNode")&&(g=Math.max(g,1)),(e.previous?.type==="BlockStatement"||e.previous?.type==="ElementNode")&&(p=Math.max(p,1)));let E="",T="";return g===0&&e.next?.type==="MustacheStatement"&&(T=" "),p===0&&e.previous?.type==="MustacheStatement"&&(E=" "),c&&(p=0,E=""),h&&(g=0,T=""),R.hasLeadingWhitespace(n)&&(n=E+R.trimStart(n)),R.hasTrailingWhitespace(n)&&(n=R.trimEnd(n)+T),[...Kt(p),Ve(Tn(n)),...Kt(g)]}case"MustacheCommentStatement":{let n=mt(s),i=Gt(s),a=t.originalText.charAt(n+2)==="~",o=t.originalText.charAt(i-3)==="~",c=s.value.includes("}}")?"--":"";return["{{",a?"~":"","!",c,s.value,c,o?"~":"","}}"]}case"PathExpression":return yi(s);case"BooleanLiteral":return String(s.value);case"CommentStatement":return["<!--",s.value,"-->"];case"StringLiteral":return pi(e,t);case"NumberLiteral":return String(s.value);case"UndefinedLiteral":return"undefined";case"NullLiteral":return"null";case"FrontMatter":case"AtHead":case"VarHead":case"ThisHead":default:throw new Vr(s,"Handlebars")}}function Zs(e,t){return mt(e)-mt(t)}function ti(e,t){let{node:r}=e,s=["attributes","modifiers","comments"].filter(i=>It(r[i])),n=s.flatMap(i=>r[i]).sort(Zs);for(let i of s)e.each(({node:a})=>{let o=n.indexOf(a);n.splice(o,1,[x,t()])},i);return It(r.blockParams)&&n.push(x,yr(r)),["<",r.tag,F(n),ei(r)]}function ei(e){return gr(e)?Fe([H,"/>"],[" />",H]):Fe([H,">"],">")}function ke(e){let t=e.trusting?"{{{":"{{",r=e.strip?.open?"~":"";return[t,r]}function Ee(e){let t=e.trusting?"}}}":"}}";return[e.strip?.close?"~":"",t]}function ri(e){let t=ke(e),r=e.openStrip.open?"~":"";return[t,r,"#"]}function ni(e){let t=Ee(e);return[e.openStrip.close?"~":"",t]}function kn(e){let t=ke(e),r=e.closeStrip.open?"~":"";return[t,r,"/"]}function En(e){let t=Ee(e);return[e.closeStrip.close?"~":"",t]}function An(e){let t=ke(e),r=e.inverseStrip.open?"~":"";return[t,r]}function Pn(e){let t=Ee(e);return[e.inverseStrip.close?"~":"",t]}function si(e,t){let{node:r}=e,s=[],n=ve(e,t);return n&&s.push(B(n)),It(r.program.blockParams)&&s.push(yr(r.program)),B([ri(r),br(e,t),s.length>0?F([x,ct(x,s)]):"",H,ni(r)])}function ii(e,t){return[t.htmlWhitespaceSensitivity==="ignore"?ut:"",An(e),"else",Pn(e)]}var ai=({path:e},{path:t})=>[e,t].every(r=>r.type==="PathExpression"&&r.head.type==="VarHead")&&e.head.name===t.head.name;function Cn(e){if(!e.match(r=>r.type==="BlockStatement",(r,s)=>s==="body"&&r.type==="Block"&&r.body.length===1,(r,s)=>s==="inverse"&&r.type==="BlockStatement"))return!1;let{node:t}=e;return t.path.type==="PathExpression"&&t.path.head.type==="VarHead"&&t.path.head.name==="if"||ai(t,e.grandparent)}function oi(e,t){let{node:r,grandparent:s}=e;return B([An(s),["else"," ",s.inverse.body[0].path.head.name],F([x,B(ve(e,t)),...It(r.program.blockParams)?[x,yr(r.program)]:[]]),H,Pn(s)])}function li(e,t,r){let{node:s}=e;return t.htmlWhitespaceSensitivity==="ignore"?[_n(s)?H:ut,kn(s),r("path"),En(s)]:[kn(s),r("path"),En(s)]}function _n(e){return e.type==="BlockStatement"&&e.program.body.every(t=>Se(t))}function vn(e,t,r){let{node:s}=e;if(_n(s))return"";let n=r("program");return t.htmlWhitespaceSensitivity==="ignore"?F([ut,n]):F(n)}function wn(e,t,r){let{node:s}=e;if(!s.inverse)return"";let n=r("inverse"),i=t.htmlWhitespaceSensitivity==="ignore"?[ut,n]:n;return e.call(Cn,"inverse","body",0)?i:[ii(s,t),F(i)]}function Tn(e){return ct(x,R.split(e))}function ci(e){for(let t=0;t<2;t++){let r=e.getParentNode(t);if(r?.type==="AttrNode")return r.name.toLowerCase()}}function _t(e){return e=typeof e=="string"?e:"",e.split(`
30
+ `?s?s.loc.getEnd():this.currentAttr.valueSpan.getStart():i.move(-1),this.currentAttr.currentPart=d.text({chars:t,loc:i.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let t=this.currentTag,r=this.offset();if(t.type==="EndTag")throw k("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:t.start.toJSON(),end:r.toJSON()}));let{name:s,parts:n,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr;if(s.startsWith("|")&&n.length===0&&!a&&!o)throw k("Invalid block parameters syntax: block parameters must be preceded by the `as` keyword",i.until(i.move(s.length)));let h=this.assembleAttributeValue(n,a,o,i.until(r));h.loc=c.withEnd(r);let f=d.attr({name:s,value:h,loc:i.until(r)});this.currentStartTag.attributes.push(f)}parsePossibleBlockParams(){let t=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;this.tokenizer.state;let r=this.currentStartTag,s=this.currentAttr,n={state:"PossibleAs"},i={PossibleAs:o=>{if(n.state,xt(o))n={state:"BeforeStartPipe"},this.tokenizer.transitionTo("afterAttributeName"),this.tokenizer.consume();else{if(o==="|")throw k('Invalid block parameters syntax: expecting at least one space character between "as" and "|"',s.start.until(this.offset().move(1)));n={state:"Done"}}},BeforeStartPipe:o=>{n.state,xt(o)?this.tokenizer.consume():o==="|"?(n={state:"BeforeBlockParamName"},this.tokenizer.transitionTo("beforeAttributeName"),this.tokenizer.consume()):n={state:"Done"}},BeforeBlockParamName:o=>{if(n.state,xt(o))this.tokenizer.consume();else if(o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"){if(r.params.length===0)throw k("Invalid block parameters syntax: empty parameters list, expecting at least one identifier",s.start.until(this.offset().move(1)));n={state:"AfterEndPipe"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: incomplete parameters list, expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n={state:"BlockParamName",name:o,start:this.offset()},this.tokenizer.consume()}},BlockParamName:o=>{if(n.state,o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"||xt(o)){let c=n.start.until(this.offset());if(n.name==="this"||t.test(n.name))throw k(`Invalid block parameters syntax: invalid identifier name \`${n.name}\``,c);r.params.push(d.var({name:n.name,loc:c})),n=o==="|"?{state:"AfterEndPipe"}:{state:"BeforeBlockParamName"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n.name+=o,this.tokenizer.consume()}},AfterEndPipe:o=>{n.state,xt(o)?this.tokenizer.consume():o===""?(n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: modifiers cannot follow parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}}):o===">"||o==="/"?n={state:"Done"}:(n={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:o=>{if(n.state,o===""||o==="/"||o===">"||xt(o))throw k(n.message,n.start.until(this.offset()));this.tokenizer.consume()},Done:()=>{}},a;do a=this.tokenizer.peek(),i[n.state](a);while(n.state!=="Done"&&a!=="");n.state}reportSyntaxError(t){throw k(t,this.offset().collapsed())}assembleConcatenatedValue(t){let r=Vs(t),s=mr(t);return d.concat({parts:t,loc:this.source.spanFor(r.loc).extend(this.source.spanFor(s.loc))})}validateEndTag(t,r,s){if(de.has(t.name)&&!s)throw k(`<${t.name}> elements do not need end tags. You should remove it`,t.loc);if(r.type!=="ElementNode")throw k(`Closing tag </${t.name}> without an open tag`,t.loc);if(r.tag!==t.name)throw k(`Closing tag </${t.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`,t.loc)}assembleAttributeValue(t,r,s,n){if(s){if(r)return this.assembleConcatenatedValue(t);{let[i,a]=t;if(a===void 0||a.type==="TextNode"&&a.chars==="/")return i;throw k("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'",n)}}return Yt(t)?t[0]:d.text({chars:"",loc:n})}constructor(...t){super(...t),this.tagOpenLine=0,this.tagOpenColumn=0}},Ks={},fr=class extends Xe{constructor(){super({})}parse(){}};function dn(e,t={}){let r,s,n,i=t.mode||"precompile";typeof e=="string"?(r=new pt(e,t.meta?.moduleName),s=i==="codemod"?he(e,t.parseOptions):$e(e,t.parseOptions)):e instanceof pt?(r=e,s=i==="codemod"?he(e.source,t.parseOptions):$e(e.source,t.parseOptions)):(r=new pt("",t.meta?.moduleName),s=e),i==="codemod"&&(n=new fr);let a=A.forCharPositions(r,0,r.source.length);s.loc={source:"(program)",start:a.startPosition,end:a.endPosition};let o=new pr(r,n,i).parse(s,t.locals??[]);if(t.plugins?.ast)for(let c of t.plugins.ast)Ys(o,c(Ye({},t,{syntax:Ks},{plugins:void 0})).visitor);return o}var Ws={resolution:()=>pe.GetStrictKeyword,serialize:()=>"Strict",isAngleBracket:!1},_o={...Ws,isAngleBracket:!0};var js=Mr(be),gn=js;var mt=e=>e.loc.start.offset,Gt=e=>e.loc.end.offset;var Qs=new Set(ln());function yn(e){return e.toUpperCase()===e}function Js(e){return e.type==="ElementNode"&&typeof e.tag=="string"&&!e.tag.startsWith(":")&&(yn(e.tag[0])||e.tag.includes("."))}function $s(e){return Qs.has(e.toLowerCase())&&!yn(e[0])}function gr(e){return e.selfClosing===!0||$s(e.tag)||Js(e)&&e.children.every(t=>Se(t))}function Se(e){return e.type==="TextNode"&&!/\S/.test(e.chars)}function bn(e){return e?.type==="MustacheCommentStatement"&&typeof e.value=="string"&&e.value.trim()==="prettier-ignore"}function Sn(e){return bn(e.node)||e.isInArray&&(e.key==="children"||e.key==="body"||e.key==="parts")&&bn(e.siblings[e.index-2])}var xn=2;function Xs(e,t,r){let{node:s}=e;switch(s.type){case"Block":case"Program":case"Template":return B(e.map(r,"body"));case"ElementNode":{let n=t.htmlWhitespaceSensitivity!=="ignore",i=[!n&&e.previous?.type==="ElementNode"?H:"",B([ti(e,r)])];if(gr(s))return[i];let a=["</",s.tag,">"],o=s.tag==="style";if(s.children.length===0||(!n||o)&&s.children.every(h=>Se(h)))return[i,a];let c=e.map(r,"children");return o||!n?[i,F([H,...c]),H,a]:[i,F(B(c)),a]}case"BlockStatement":return Cn(e)?[oi(e,r),vn(e,t,r),wn(e,t,r)]:[si(e,r),B([vn(e,t,r),wn(e,t,r),li(e,t,r)])];case"ElementModifierStatement":return B(["{{",Nn(e,r),"}}"]);case"MustacheStatement":return B([ke(s),Nn(e,r),Ee(s)]);case"SubExpression":return B(["(",mi(e,r),H,")"]);case"AttrNode":{let{name:n,value:i}=s,a=i.type==="TextNode";if(a&&i.chars===""&&mt(i)===Gt(i))return n;let c=a?oe(i.chars,t.singleQuote):i.type==="ConcatStatement"?oe(i.parts.map(f=>f.type==="TextNode"?f.chars:"").join(""),t.singleQuote):"",h=r("value");return[n,"=",c,n==="class"&&c?B(F(h)):h,c]}case"ConcatStatement":return e.map(r,"parts");case"Hash":return ct(x,e.map(r,"pairs"));case"HashPair":return[s.key,"=",r("value")];case"TextNode":{let n=s.chars,{parent:i}=e;if(i.type==="ElementNode"){if(i.tag==="pre")return ie(n);if(i.tag==="style")return n=St(0,n,/^\n+/g,""),n=R.trimEnd(n),n=R.dedentString(n),ie(n,ut)}n=St(0,n,"{{","\\{{");let a=ci(e);if(a){if(a==="class"){let D=n.trim().split(/\s+/).join(" "),I=!1,O=!1;return e.parent.type==="ConcatStatement"&&(e.previous?.type==="MustacheStatement"&&/^\s/.test(n)&&(I=!0),e.next?.type==="MustacheStatement"&&/\s$/.test(n)&&D!==""&&(O=!0)),[I?x:"",D,O?x:""]}return ie(n)}let o=R.isWhitespaceOnly(n),{isFirst:c,isLast:h}=e;if(t.htmlWhitespaceSensitivity!=="ignore"){let D=h&&e.parent.type==="Template",I=c&&e.parent.type==="Template";if(o){if(I||D)return"";let C=[x],$=_t(n);return $&&(C=Kt($)),h&&(C=C.map(W=>Re(W))),C}let O=R.getLeadingWhitespace(n),z=[];if(O){z=[x];let C=_t(O);C&&(z=Kt(C)),n=n.slice(O.length)}let P=R.getTrailingWhitespace(n),U=[];if(P){if(!D){U=[x];let C=_t(P);C&&(U=Kt(C)),h&&(U=U.map($=>Re($)))}n=n.slice(0,-P.length)}return[...z,Ve(Tn(n)),...U]}let f=_t(n),p=ui(n),g=hi(n);if((c||h)&&o&&(e.parent.type==="Block"||e.parent.type==="ElementNode"||e.parent.type==="Template"))return"";o&&f?(p=Math.min(f,xn),g=0):((e.next?.type==="BlockStatement"||e.next?.type==="ElementNode")&&(g=Math.max(g,1)),(e.previous?.type==="BlockStatement"||e.previous?.type==="ElementNode")&&(p=Math.max(p,1)));let E="",T="";return g===0&&e.next?.type==="MustacheStatement"&&(T=" "),p===0&&e.previous?.type==="MustacheStatement"&&(E=" "),c&&(p=0,E=""),h&&(g=0,T=""),R.hasLeadingWhitespace(n)&&(n=E+R.trimStart(n)),R.hasTrailingWhitespace(n)&&(n=R.trimEnd(n)+T),[...Kt(p),Ve(Tn(n)),...Kt(g)]}case"MustacheCommentStatement":{let n=mt(s),i=Gt(s),a=t.originalText.charAt(n+2)==="~",o=t.originalText.charAt(i-3)==="~",c=s.value.includes("}}")?"--":"";return["{{",a?"~":"","!",c,s.value,c,o?"~":"","}}"]}case"PathExpression":return yi(s);case"BooleanLiteral":return String(s.value);case"CommentStatement":return["<!--",s.value,"-->"];case"StringLiteral":return pi(e,t);case"NumberLiteral":return String(s.value);case"UndefinedLiteral":return"undefined";case"NullLiteral":return"null";default:throw new Vr(s,"Handlebars")}}function Zs(e,t){return mt(e)-mt(t)}function ti(e,t){let{node:r}=e,s=["attributes","modifiers","comments"].filter(i=>It(r[i])),n=s.flatMap(i=>r[i]).sort(Zs);for(let i of s)e.each(({node:a})=>{let o=n.indexOf(a);n.splice(o,1,[x,t()])},i);return It(r.blockParams)&&n.push(x,yr(r)),["<",r.tag,F(n),ei(r)]}function ei(e){return gr(e)?Fe([H,"/>"],[" />",H]):Fe([H,">"],">")}function ke(e){let t=e.trusting?"{{{":"{{",r=e.strip?.open?"~":"";return[t,r]}function Ee(e){let t=e.trusting?"}}}":"}}";return[e.strip?.close?"~":"",t]}function ri(e){let t=ke(e),r=e.openStrip.open?"~":"";return[t,r,"#"]}function ni(e){let t=Ee(e);return[e.openStrip.close?"~":"",t]}function kn(e){let t=ke(e),r=e.closeStrip.open?"~":"";return[t,r,"/"]}function En(e){let t=Ee(e);return[e.closeStrip.close?"~":"",t]}function An(e){let t=ke(e),r=e.inverseStrip.open?"~":"";return[t,r]}function Pn(e){let t=Ee(e);return[e.inverseStrip.close?"~":"",t]}function si(e,t){let{node:r}=e,s=[],n=ve(e,t);return n&&s.push(B(n)),It(r.program.blockParams)&&s.push(yr(r.program)),B([ri(r),br(e,t),s.length>0?F([x,ct(x,s)]):"",H,ni(r)])}function ii(e,t){return[t.htmlWhitespaceSensitivity==="ignore"?ut:"",An(e),"else",Pn(e)]}var ai=({path:e},{path:t})=>[e,t].every(r=>r.type==="PathExpression"&&r.head.type==="VarHead")&&e.head.name===t.head.name;function Cn(e){if(!e.match(r=>r.type==="BlockStatement",(r,s)=>s==="body"&&r.type==="Block"&&r.body.length===1,(r,s)=>s==="inverse"&&r.type==="BlockStatement"))return!1;let{node:t}=e;return t.path.type==="PathExpression"&&t.path.head.type==="VarHead"&&t.path.head.name==="if"||ai(t,e.grandparent)}function oi(e,t){let{node:r,grandparent:s}=e;return B([An(s),["else"," ",s.inverse.body[0].path.head.name],F([x,B(ve(e,t)),...It(r.program.blockParams)?[x,yr(r.program)]:[]]),H,Pn(s)])}function li(e,t,r){let{node:s}=e;return t.htmlWhitespaceSensitivity==="ignore"?[_n(s)?H:ut,kn(s),r("path"),En(s)]:[kn(s),r("path"),En(s)]}function _n(e){return e.type==="BlockStatement"&&e.program.body.every(t=>Se(t))}function vn(e,t,r){let{node:s}=e;if(_n(s))return"";let n=r("program");return t.htmlWhitespaceSensitivity==="ignore"?F([ut,n]):F(n)}function wn(e,t,r){let{node:s}=e;if(!s.inverse)return"";let n=r("inverse"),i=t.htmlWhitespaceSensitivity==="ignore"?[ut,n]:n;return e.call(Cn,"inverse","body",0)?i:[ii(s,t),F(i)]}function Tn(e){return ct(x,R.split(e))}function ci(e){for(let t=0;t<2;t++){let r=e.getParentNode(t);if(r?.type==="AttrNode")return r.name.toLowerCase()}}function _t(e){return e=typeof e=="string"?e:"",e.split(`
31
31
  `).length-1}function ui(e){e=typeof e=="string"?e:"";let t=(e.match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"";return _t(t)}function hi(e){e=typeof e=="string"?e:"";let t=(e.match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"";return _t(t)}function Kt(e=0){return Array.from({length:Math.min(e,xn)}).fill(ut)}function pi(e,t){let{node:{value:r}}=e,s=oe(r,fi(e)?!t.singleQuote:t.singleQuote);return[s,St(0,r,s,`\\${s}`),s]}function fi(e){let{ancestors:t}=e,r=t.findIndex(s=>s.type!=="SubExpression");return r!==-1&&t[r+1].type==="ConcatStatement"&&t[r+2].type==="AttrNode"}function mi(e,t){let r=br(e,t),s=ve(e,t);return s?F([r,x,B(s)]):r}function Nn(e,t){let r=br(e,t),s=ve(e,t);return s?[F([r,x,s]),H]:r}function br(e,t){return t("path")}function ve(e,t){let{node:r}=e,s=[];return r.params.length>0&&s.push(...e.map(t,"params")),r.hash?.pairs.length>0&&s.push(t("hash")),s.length===0?"":ct(x,s)}function yr(e){return["as |",e.blockParams.join(" "),"|"]}var di=new Set("!\"#%&'()*+,./;<=>@[\\]^`{|}~"),gi=new Set(["true","false","null","undefined"]),bi=(e,t)=>t===0&&e.startsWith("@")?!1:t!==0&&gi.has(e)||/\s/.test(e)||/^\d/.test(e)||Array.prototype.some.call(e,r=>di.has(r));function yi(e){return e.tail.length===0&&e.original.includes("/")?e.original:[e.head.original,...e.tail].map((r,s)=>bi(r,s)?`[${r}]`:r).join(".")}var Si={features:{experimental_frontMatterSupport:{massageAstNode:!0,embed:!0,print:!0}},print:Xs,massageAstNode:Hr,hasPrettierIgnore:Sn,getVisitorKeys:gn,embed:Ur},Ln=Si;var Dn=[{name:"Handlebars",type:"markup",aceMode:"handlebars",extensions:[".handlebars",".hbs"],tmScope:"text.html.handlebars",aliases:["hbs","htmlbars"],parsers:["glimmer"],vscodeLanguageIds:["handlebars"],linguistLanguageId:155}];var Sr={};Be(Sr,{glimmer:()=>Li});function ki(e,t){let r=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(r,t)}var On=ki;function Ei(e){return St(0,e,/[^\n]/g," ")}var Bn=Ei;var In=Symbol.for("PRETTIER_IS_FRONT_MATTER");var Wt=3;function vi(e){let t=e.slice(0,Wt);if(t!=="---"&&t!=="+++")return;let r=e.indexOf(`
32
32
  `,Wt);if(r===-1)return;let s=e.slice(Wt,r).trim(),n=e.indexOf(`
33
33
  ${t}`,r),i=s;if(i||(i=t==="+++"?"toml":"yaml"),n===-1&&t==="---"&&i==="yaml"&&(n=e.indexOf(`
@@ -27,7 +27,7 @@ Expecting `+Qt.join(", ")+", got '"+(this.terminals_[L]||L)+"'":De="Parse error
27
27
  `:"",c=new Error(`${e}: ${o}(error occurred in '${r}' @ line ${n} : column ${i})`);return c.name="SyntaxError",c.location=t,c.code=a,c}var be={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"]},mr=(function(){function e(t,r,s,n){let i=Error.call(this,t);this.key=n,this.message=t,this.node=r,this.parent=s,i.stack&&(this.stack=i.stack)}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e})();function Zr(e,t,r){return new mr("Cannot remove a node unless it is part of an array",e,t,r)}function qs(e,t,r){return new mr("Cannot replace a node with multiple nodes unless it is part of an array",e,t,r)}function tn(e,t){return new mr("Replacing and removing in key handlers is not yet supported.",e,null,t)}var Ct=class{constructor(t,r=null,s=null){this.node=t,this.parent=r,this.parentKey=s}get parentNode(){return this.parent?this.parent.node:null}parents(){return{[Symbol.iterator]:()=>new lr(this)}}},lr=class{constructor(t){this.path=t}next(){return this.path.parent?(this.path=this.path.parent,{done:!1,value:this.path}):{done:!0,value:null}}};function cn(e){return typeof e=="function"?e:e.enter}function un(e){return typeof e=="function"?void 0:e.exit}function ye(e,t){let r,s,n,{node:i,parent:a,parentKey:o}=t,c=(function(h,f){if(h.Program&&(f==="Template"&&!h.Template||f==="Block"&&!h.Block))return h.Program;let p=h[f];return p!==void 0?p:h.All})(e,i.type);if(c!==void 0&&(r=cn(c),s=un(c)),r!==void 0&&(n=r(i,t)),n!=null){if(JSON.stringify(i)!==JSON.stringify(n))return Array.isArray(n)?(hn(e,n,a,o),n):ye(e,new Ct(n,a,o))||n;n=void 0}if(n===void 0){let h=be[i.type];for(let f=0;f<h.length;f++)Vs(e,c,t,h[f]);s!==void 0&&(n=s(i,t))}return n}function en(e,t,r){e[t]=r}function Vs(e,t,r,s){let n,i,{node:a}=r,o=(function(c,h){return c[h]})(a,s);if(o){if(t!==void 0){let c=(function(h,f){let p=typeof h!="function"?h.keys:void 0;if(p===void 0)return;let g=p[f];return g!==void 0?g:p.All})(t,s);c!==void 0&&(n=cn(c),i=un(c))}if(n!==void 0&&n(a,s)!==void 0)throw tn(a,s);if(Array.isArray(o))hn(e,o,r,s);else{let c=ye(e,new Ct(o,r,s));c!==void 0&&(function(h,f,p,g){if(g===null)throw Zr(p,h,f);if(Array.isArray(g)){if(g.length!==1)throw g.length===0?Zr(p,h,f):qs(p,h,f);en(h,f,g[0])}else en(h,f,g)})(a,s,o,c)}if(i!==void 0&&i(a,s)!==void 0)throw tn(a,s)}}function hn(e,t,r,s){for(let n=0;n<t.length;n++){let i=t[n],a=ye(e,new Ct(i,r,s));a!==void 0&&(n+=Fs(t,n,a)-1)}}function Fs(e,t,r){return r===null?(e.splice(t,1),0):Array.isArray(r)?(e.splice(t,1,...r),r.length):(e.splice(t,1,r),1)}function Hs(e,t){ye(t,new Ct(e))}function At(e,t){(function(r){switch(r.type){case"Block":case"Template":return r.body;case"ElementNode":return r.children}})(e).push(t)}function pn(e){return e.type==="StringLiteral"||e.type==="BooleanLiteral"||e.type==="NumberLiteral"||e.type==="NullLiteral"||e.type==="UndefinedLiteral"}var Ze;function tr(){return Ze||(Ze=new pt("","(synthetic)")),Ze}function rn(e,t){return d.var({name:e,loc:v(t||null)})}function rt(e,t){let r=v(t||null);if(typeof e!="string"){if("type"in e)return e;{e.head.indexOf(".");let{head:i,tail:a}=e;return d.path({head:d.head({original:i,loc:r.sliceStartChars({chars:i.length})}),tail:a,loc:v(t||null)})}}let{head:s,tail:n}=(function(i,a){let[o,...c]=i.split("."),h=d.head({original:o,loc:v(a||null)});return d.path({head:h,tail:c,loc:v(a||null)})})(e,r);return d.path({head:s,tail:n,loc:r})}function me(e,t,r){return d.literal({type:e,value:t,loc:v(r||null)})}function Ht(e=[],t){return d.hash({pairs:e,loc:v(t||null)})}function fn(e){return e.map((t=>typeof t=="string"?d.var({name:t,loc:A.synthetic(t)}):t))}function nn(e=[],t=[],r=!1,s){return d.blockItself({body:e,params:fn(t),chained:r,loc:v(s||null)})}function sn(e=[],t=[],r){return d.template({body:e,blockParams:t,loc:v(r||null)})}function v(...e){if(e.length===1){let t=e[0];return t&&typeof t=="object"?A.forHbsLoc(tr(),t):A.forHbsLoc(tr(),Is)}{let[t,r,s,n,i]=e,a=i?new pt("",i):tr();return A.forHbsLoc(a,{start:{line:t,column:r},end:{line:s||t,column:n||r}})}}var Us={mustache:function(e,t=[],r=Ht([]),s=!1,n,i){return d.mustache({path:rt(e),params:t,hash:r,trusting:s,strip:i,loc:v(n||null)})},block:function(e,t,r,s,n=null,i,a,o,c){let h,f=null;return h=s.type==="Template"?d.blockItself({params:fn(s.blockParams),body:s.body,loc:s.loc}):s,n?.type==="Template"?(n.blockParams.length,f=d.blockItself({params:[],body:n.body,loc:n.loc})):f=n,d.block({path:rt(e),params:t||[],hash:r||Ht([]),defaultBlock:h,elseBlock:f,loc:v(i||null),openStrip:a,inverseStrip:o,closeStrip:c})},comment:function(e,t){return d.comment({value:e,loc:v(t||null)})},mustacheComment:function(e,t){return d.mustacheComment({value:e,loc:v(t||null)})},element:function(e,t={}){let r,s,{attrs:n,blockParams:i,modifiers:a,comments:o,children:c,openTag:h,closeTag:f,loc:p}=t;typeof e=="string"?e.endsWith("/")?(r=rt(e.slice(0,-1)),s=!0):r=rt(e):"type"in e?(e.type,e.type,r=e):"path"in e?(e.path.type,e.path.type,r=e.path,s=e.selfClosing):(r=rt(e.name),s=e.selfClosing);let g=i?.map((T=>typeof T=="string"?rn(T):T)),E=null;return f?E=v(f):f===void 0&&(E=s||Os(r.original)?null:v(null)),d.element({path:r,selfClosing:s||!1,attributes:n||[],params:g||[],modifiers:a||[],comments:o||[],children:c||[],openTag:v(h||null),closeTag:E,loc:v(p||null)})},elementModifier:function(e,t,r,s){return d.elementModifier({path:rt(e),params:t||[],hash:r||Ht([]),loc:v(s||null)})},attr:function(e,t,r){return d.attr({name:e,value:t,loc:v(r||null)})},text:function(e="",t){return d.text({chars:e,loc:v(t||null)})},sexpr:function(e,t=[],r=Ht([]),s){return d.sexpr({path:rt(e),params:t,hash:r,loc:v(s||null)})},concat:function(e,t){if(!Yt(e))throw new Error("b.concat requires at least one part");return d.concat({parts:e,loc:v(t||null)})},hash:Ht,pair:function(e,t,r){return d.pair({key:e,value:t,loc:v(r||null)})},literal:me,program:function(e,t,r){return t&&t.length?nn(e,t,!1,r):sn(e,[],r)},blockItself:nn,template:sn,loc:v,pos:function(e,t){return d.pos({line:e,column:t})},path:rt,fullPath:function(e,t=[],r){return d.path({head:e,tail:t,loc:v(r||null)})},head:function(e,t){return d.head({original:e,loc:v(t||null)})},at:function(e,t){return d.atName({name:e,loc:v(t||null)})},var:rn,this:function(e){return d.this({loc:v(e||null)})},string:er("StringLiteral"),boolean:er("BooleanLiteral"),number:er("NumberLiteral"),undefined:()=>me("UndefinedLiteral",void 0),null:()=>me("NullLiteral",null)};function er(e){return function(t,r){return me(e,t,r)}}var fe={close:!1,open:!1},d=new class{pos({line:e,column:t}){return{line:e,column:t}}blockItself({body:e,params:t,chained:r=!1,loc:s}){return{type:"Block",body:e,params:t,get blockParams(){return this.params.map((n=>n.name))},set blockParams(n){this.params=n.map((i=>d.var({name:i,loc:A.synthetic(i)})))},chained:r,loc:s}}template({body:e,blockParams:t,loc:r}){return{type:"Template",body:e,blockParams:t,loc:r}}mustache({path:e,params:t,hash:r,trusting:s,loc:n,strip:i=fe}){return(function({path:a,params:o,hash:c,trusting:h,strip:f,loc:p}){let g={type:"MustacheStatement",path:a,params:o,hash:c,trusting:h,strip:f,loc:p};return Object.defineProperty(g,"escaped",{enumerable:!1,get(){return!this.trusting},set(E){this.trusting=!E}}),g})({path:e,params:t,hash:r,trusting:s,strip:i,loc:n})}block({path:e,params:t,hash:r,defaultBlock:s,elseBlock:n=null,loc:i,openStrip:a=fe,inverseStrip:o=fe,closeStrip:c=fe}){return{type:"BlockStatement",path:e,params:t,hash:r,program:s,inverse:n,loc:i,openStrip:a,inverseStrip:o,closeStrip:c}}comment({value:e,loc:t}){return{type:"CommentStatement",value:e,loc:t}}mustacheComment({value:e,loc:t}){return{type:"MustacheCommentStatement",value:e,loc:t}}concat({parts:e,loc:t}){return{type:"ConcatStatement",parts:e,loc:t}}element({path:e,selfClosing:t,attributes:r,modifiers:s,params:n,comments:i,children:a,openTag:o,closeTag:c,loc:h}){let f=t;return{type:"ElementNode",path:e,attributes:r,modifiers:s,params:n,comments:i,children:a,openTag:o,closeTag:c,loc:h,get tag(){return this.path.original},set tag(p){this.path.original=p},get blockParams(){return this.params.map((p=>p.name))},set blockParams(p){this.params=p.map((g=>d.var({name:g,loc:A.synthetic(g)})))},get selfClosing(){return f},set selfClosing(p){f=p,this.closeTag=p?null:A.synthetic(`</${this.tag}>`)}}}elementModifier({path:e,params:t,hash:r,loc:s}){return{type:"ElementModifierStatement",path:e,params:t,hash:r,loc:s}}attr({name:e,value:t,loc:r}){return{type:"AttrNode",name:e,value:t,loc:r}}text({chars:e,loc:t}){return{type:"TextNode",chars:e,loc:t}}sexpr({path:e,params:t,hash:r,loc:s}){return{type:"SubExpression",path:e,params:t,hash:r,loc:s}}path({head:e,tail:t,loc:r}){return(function({head:s,tail:n,loc:i}){let a={type:"PathExpression",head:s,tail:n,get original(){return[this.head.original,...this.tail].join(".")},set original(o){let[c,...h]=o.split(".");this.head=Us.head(c,this.head.loc),this.tail=h},loc:i};return Object.defineProperty(a,"parts",{enumerable:!1,get(){let o=this.original.split(".");return o[0]==="this"?o.shift():o[0].startsWith("@")&&(o[0]=o[0].slice(1)),Object.freeze(o)},set(o){let c=[...o];c[0]==="this"||c[0]?.startsWith("@")||(this.head.type==="ThisHead"?c.unshift("this"):this.head.type==="AtHead"&&(c[0]=`@${c[0]}`)),this.original=c.join(".")}}),Object.defineProperty(a,"this",{enumerable:!1,get(){return this.head.type==="ThisHead"}}),Object.defineProperty(a,"data",{enumerable:!1,get(){return this.head.type==="AtHead"}}),a})({head:e,tail:t,loc:r})}head({original:e,loc:t}){return e==="this"?this.this({loc:t}):e[0]==="@"?this.atName({name:e,loc:t}):this.var({name:e,loc:t})}this({loc:e}){return{type:"ThisHead",get original(){return"this"},loc:e}}atName({name:e,loc:t}){let r="",s={type:"AtHead",get name(){return r},set name(n){n[0],n.indexOf("."),r=n},get original(){return this.name},set original(n){this.name=n},loc:t};return s.name=e,s}var({name:e,loc:t}){let r="",s={type:"VarHead",get name(){return r},set name(n){n[0],n.indexOf("."),r=n},get original(){return this.name},set original(n){this.name=n},loc:t};return s.name=e,s}hash({pairs:e,loc:t}){return{type:"Hash",pairs:e,loc:t}}pair({key:e,value:t,loc:r}){return{type:"HashPair",key:e,value:t,loc:r}}literal({type:e,value:t,loc:r}){return(function({type:s,value:n,loc:i}){let a={type:s,value:n,loc:i};return Object.defineProperty(a,"original",{enumerable:!1,get(){return this.value},set(o){this.value=o}}),a})({type:e,value:t,loc:r})}},cr=class{constructor(t,r=new $e($r),s="precompile"){this.elementStack=[],this.currentAttribute=null,this.currentNode=null,this.source=t,this.lines=t.source.split(/\r\n?|\n/u),this.tokenizer=new Xe(this,r,s)}offset(){let{line:t,column:r}=this.tokenizer;return this.source.offsetFor(t,r)}pos({line:t,column:r}){return this.source.offsetFor(t,r)}finish(t){return ze({},t,{loc:t.start.until(this.offset())})}get currentAttr(){return this.currentAttribute}get currentTag(){let t=this.currentNode;return t&&(t.type==="StartTag"||t.type),t}get currentStartTag(){let t=this.currentNode;return t&&t.type,t}get currentEndTag(){let t=this.currentNode;return t&&t.type,t}get currentComment(){let t=this.currentNode;return t&&t.type,t}get currentData(){let t=this.currentNode;return t&&t.type,t}acceptNode(t){return this[t.type](t)}currentElement(){return fr(this.elementStack)}sourceForNode(t,r){let s,n,i,a=t.loc.start.line-1,o=a-1,c=t.loc.start.column,h=[];for(r?(n=r.loc.end.line-1,i=r.loc.end.column):(n=t.loc.end.line-1,i=t.loc.end.column);o<n;)o++,s=this.lines[o],o===a?a===n?h.push(s.slice(c,i)):h.push(s.slice(c)):o===n?h.push(s.slice(0,i)):h.push(s);return h.join(`
28
28
  `)}},ur=class extends cr{parse(t,r){t.loc;let s=d.template({body:[],blockParams:r,loc:this.source.spanFor(t.loc)}),n=this.parseProgram(s,t);return this.pendingError?.eof(n.loc.getEnd()),n}Program(t,r){t.loc;let s=d.blockItself({body:[],params:r,chained:t.chained,loc:this.source.spanFor(t.loc)});return this.parseProgram(s,t)}parseProgram(t,r){if(r.body.length===0)return t;let s;try{this.elementStack.push(t);for(let n of r.body)this.acceptNode(n)}finally{s=this.elementStack.pop()}if(t!==s){if(s?.type==="ElementNode")throw k(`Unclosed element \`${s.tag}\``,s.loc);t.type}return t}BlockStatement(t){if(this.tokenizer.state==="comment")return t.loc,void this.appendToCommentData(this.sourceForNode(t));if(this.tokenizer.state!=="data"&&this.tokenizer.state!=="beforeData")throw k("A block may only be used inside an HTML element or another block.",this.source.spanFor(t.loc));let{path:r,params:s,hash:n}=rr(this,t),i=this.source.spanFor(t.loc),a,o=[];if(t.program.blockParams?.length){let p=n.loc.collapse("end");p=t.program.loc?p.withEnd(this.source.spanFor(t.program.loc).getStart()):t.program.body[0]?p.withEnd(this.source.spanFor(t.program.body[0].loc).getStart()):p.withEnd(i.getEnd()),a=an(this.source,t,p);let g=p.asString(),E=g.indexOf("|")+1,T=g.indexOf("|",E);for(let D of t.program.blockParams){let I,O;I=E>=T?-1:g.indexOf(D,E),I===-1||I+D.length>T?(E=T,O=this.source.spanFor(sr)):(E=I,O=p.sliceStartChars({skipStart:E,chars:D.length}),E+=D.length),o.push(d.var({name:D,loc:O}))}}else a=an(this.source,t,i);let c=this.Program(a.program,o),h=a.inverse?this.Program(a.inverse,[]):null,f=d.block({path:r,params:s,hash:n,defaultBlock:c,elseBlock:h,loc:this.source.spanFor(t.loc),openStrip:t.openStrip,inverseStrip:t.inverseStrip,closeStrip:t.closeStrip});At(this.currentElement(),f)}MustacheStatement(t){this.pendingError?.mustache(this.source.spanFor(t.loc));let{tokenizer:r}=this;if(r.state==="comment")return void this.appendToCommentData(this.sourceForNode(t));let s,{escaped:n,loc:i,strip:a}=t;if("original"in t.path&&t.path.original==="...attributes")throw k("Illegal use of ...attributes",this.source.spanFor(t.loc));if(pn(t.path))s=d.mustache({path:this.acceptNode(t.path),params:[],hash:d.hash({pairs:[],loc:this.source.spanFor(t.path.loc).collapse("end")}),trusting:!n,loc:this.source.spanFor(i),strip:a});else{let{path:o,params:c,hash:h}=rr(this,t);s=d.mustache({path:o,params:c,hash:h,trusting:!n,loc:this.source.spanFor(i),strip:a})}switch(r.state){case"tagOpen":case"tagName":throw k("Cannot use mustaches in an elements tagname",s.loc);case"beforeAttributeName":nr(this.currentStartTag,s);break;case"attributeName":case"afterAttributeName":this.beginAttributeValue(!1),this.finishAttributeValue(),nr(this.currentStartTag,s),r.transitionTo("beforeAttributeName");break;case"afterAttributeValueQuoted":nr(this.currentStartTag,s),r.transitionTo("beforeAttributeName");break;case"beforeAttributeValue":this.beginAttributeValue(!1),this.appendDynamicAttributeValuePart(s),r.transitionTo("attributeValueUnquoted");break;case"attributeValueDoubleQuoted":case"attributeValueSingleQuoted":case"attributeValueUnquoted":this.appendDynamicAttributeValuePart(s);break;default:At(this.currentElement(),s)}return s}appendDynamicAttributeValuePart(t){this.finalizeTextPart();let r=this.currentAttr;r.isDynamic=!0,r.parts.push(t)}finalizeTextPart(){let t=this.currentAttr.currentPart;t!==null&&(this.currentAttr.parts.push(t),this.startTextPart())}startTextPart(){this.currentAttr.currentPart=null}ContentStatement(t){(function(r,s){let n=s.loc.start.line,i=s.loc.start.column,a=(function(o,c){if(c==="")return{lines:o.split(`
29
29
  `).length-1,columns:0};let[h]=o.split(c),f=h.split(/\n/u),p=f.length-1;return{lines:p,columns:f[p].length}})(s.original,s.value);n+=a.lines,a.lines?i=a.columns:i+=a.columns,r.line=n,r.column=i})(this.tokenizer,t),this.tokenizer.tokenizePart(t.value),this.tokenizer.flushData()}CommentStatement(t){let{tokenizer:r}=this;if(r.state==="comment")return this.appendToCommentData(this.sourceForNode(t)),null;let{value:s,loc:n}=t,i=d.mustacheComment({value:s,loc:this.source.spanFor(n)});switch(r.state){case"beforeAttributeName":case"afterAttributeName":this.currentStartTag.comments.push(i);break;case"beforeData":case"data":At(this.currentElement(),i);break;default:throw k(`Using a Handlebars comment when in the \`${r.state}\` state is not supported`,this.source.spanFor(t.loc))}return i}PartialStatement(t){throw k("Handlebars partials are not supported",this.source.spanFor(t.loc))}PartialBlockStatement(t){throw k("Handlebars partial blocks are not supported",this.source.spanFor(t.loc))}Decorator(t){throw k("Handlebars decorators are not supported",this.source.spanFor(t.loc))}DecoratorBlock(t){throw k("Handlebars decorator blocks are not supported",this.source.spanFor(t.loc))}SubExpression(t){let{path:r,params:s,hash:n}=rr(this,t);return d.sexpr({path:r,params:s,hash:n,loc:this.source.spanFor(t.loc)})}PathExpression(t){let{original:r}=t,s;if(r.indexOf("/")!==-1){if(r.slice(0,2)==="./")throw k('Using "./" is not supported in Glimmer and unnecessary',this.source.spanFor(t.loc));if(r.slice(0,3)==="../")throw k('Changing context using "../" is not supported in Glimmer',this.source.spanFor(t.loc));if(r.indexOf(".")!==-1)throw k("Mixing '.' and '/' in paths is not supported in Glimmer; use only '.' to separate property paths",this.source.spanFor(t.loc));s=[t.parts.join("/")]}else{if(r===".")throw k("'.' is not a supported path in Glimmer; check for a path with a trailing '.'",this.source.spanFor(t.loc));s=t.parts}let n,i=!1;if(/^this(?:\..+)?$/u.test(r)&&(i=!0),i)n=d.this({loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+4}})});else if(t.data){let a=s.shift();if(a===void 0)throw k("Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z.",this.source.spanFor(t.loc));n=d.atName({name:`@${a}`,loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+a.length+1}})})}else{let a=s.shift();if(a===void 0)throw k("Attempted to parse a path expression, but it was not valid. Paths must start with a-z or A-Z.",this.source.spanFor(t.loc));n=d.var({name:a,loc:this.source.spanFor({start:t.loc.start,end:{line:t.loc.start.line,column:t.loc.start.column+a.length}})})}return d.path({head:n,tail:s,loc:this.source.spanFor(t.loc)})}Hash(t){let r=t.pairs.map((s=>d.pair({key:s.key,value:this.acceptNode(s.value),loc:this.source.spanFor(s.loc)})));return d.hash({pairs:r,loc:this.source.spanFor(t.loc)})}StringLiteral(t){return d.literal({type:"StringLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}BooleanLiteral(t){return d.literal({type:"BooleanLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}NumberLiteral(t){return d.literal({type:"NumberLiteral",value:t.value,loc:this.source.spanFor(t.loc)})}UndefinedLiteral(t){return d.literal({type:"UndefinedLiteral",value:void 0,loc:this.source.spanFor(t.loc)})}NullLiteral(t){return d.literal({type:"NullLiteral",value:null,loc:this.source.spanFor(t.loc)})}constructor(...t){super(...t),this.pendingError=null}};function rr(e,t){let r;switch(t.path.type){case"PathExpression":r=e.PathExpression(t.path);break;case"SubExpression":r=e.SubExpression(t.path);break;case"StringLiteral":case"UndefinedLiteral":case"NullLiteral":case"NumberLiteral":case"BooleanLiteral":{let i;throw i=t.path.type==="BooleanLiteral"?t.path.original.toString():t.path.type==="StringLiteral"?`"${t.path.original}"`:t.path.type==="NullLiteral"?"null":t.path.type==="NumberLiteral"?t.path.value.toString():"undefined",k(`${t.path.type} "${t.path.type==="StringLiteral"?t.path.original:i}" cannot be called as a sub-expression, replace (${i}) with ${i}`,e.source.spanFor(t.path.loc))}}let s=t.params.map((i=>e.acceptNode(i))),n=Yt(s)?fr(s).loc:r.loc;return{path:r,params:s,hash:t.hash?e.Hash(t.hash):d.hash({pairs:[],loc:e.source.spanFor(n).collapse("end")})}}function nr(e,t){let{path:r,params:s,hash:n,loc:i}=t;if(pn(r)){let o=`{{${(function(c){return c.type==="UndefinedLiteral"?"undefined":JSON.stringify(c.value)})(r)}}}`;throw k(`In <${e.name} ... ${o} ..., ${o} is not a valid modifier`,t.loc)}let a=d.elementModifier({path:r,params:s,hash:n,loc:i});e.modifiers.push(a)}function an(e,t,r){if(!t.program.loc){let n=V(0,t.program.body,0),i=V(0,t.program.body,-1);if(n&&i)t.program.loc={...n.loc,end:i.loc.end};else{let a=e.spanFor(t.loc);t.program.loc=r.withEnd(a.getEnd())}}let s=e.spanFor(t.program.loc).getEnd();return t.inverse&&!t.inverse.loc&&(t.inverse.loc=s.collapsed()),t}function Nt(e){return/[\t\n\f ]/u.test(e)}var hr=class extends ur{reset(){this.currentNode=null}beginComment(){this.currentNode={type:"CommentStatement",value:"",start:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}appendToCommentData(t){this.currentComment.value+=t}finishComment(){At(this.currentElement(),d.comment(this.finish(this.currentComment)))}beginData(){this.currentNode={type:"TextNode",chars:"",start:this.offset()}}appendToData(t){this.currentData.chars+=t}finishData(){At(this.currentElement(),d.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 t=this.finish(this.currentTag);if(t.type==="StartTag"){if(this.finishStartTag(),t.name===":")throw k("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()}));(de.has(t.name)||t.selfClosing)&&this.finishEndTag(!0)}else t.type,t.type,this.finishEndTag(!1)}finishStartTag(){let{name:t,nameStart:r,nameEnd:s}=this.currentStartTag,n=r.until(s),[i,...a]=t.split("."),o=d.path({head:d.head({original:i,loc:n.sliceStartChars({chars:i.length})}),tail:a,loc:n}),{attributes:c,modifiers:h,comments:f,params:p,selfClosing:g,loc:E}=this.finish(this.currentStartTag),T=d.element({path:o,selfClosing:g,attributes:c,modifiers:h,comments:f,params:p,children:[],openTag:E,closeTag:g?null:A.broken(),loc:E});this.elementStack.push(T)}finishEndTag(t){let{start:r}=this.currentTag,s=this.finish(this.currentTag),n=this.elementStack.pop();this.validateEndTag(s,n,t);let i=this.currentElement();t?n.closeTag=null:n.selfClosing?n.closeTag:n.closeTag=r.until(this.offset()),n.loc=n.loc.withEnd(this.offset()),At(i,d.element(n))}markTagAsSelfClosing(){let t=this.currentTag;if(t.type!=="StartTag")throw k("Invalid end tag: closing tag must not be self-closing",this.source.spanFor({start:t.start.toJSON(),end:this.offset().toJSON()}));t.selfClosing=!0}appendToTagName(t){let r=this.currentTag;if(r.name+=t,r.type==="StartTag"){let s=this.offset();r.nameStart===null&&(r.nameEnd,r.nameStart=s.move(-1)),r.nameEnd=s}}beginAttribute(){let t=this.offset();this.currentAttribute={name:"",parts:[],currentPart:null,isQuoted:!1,isDynamic:!1,start:t,valueSpan:t.collapsed()}}appendToAttributeName(t){this.currentAttr.name+=t,this.currentAttr.name==="as"&&this.parsePossibleBlockParams()}beginAttributeValue(t){this.currentAttr.isQuoted=t,this.startTextPart(),this.currentAttr.valueSpan=this.offset().collapsed()}appendToAttributeValue(t){let r=this.currentAttr.parts,s=r[r.length-1],n=this.currentAttr.currentPart;if(n)n.chars+=t,n.loc=n.loc.withEnd(this.offset());else{let i=this.offset();i=t===`
30
- `?s?s.loc.getEnd():this.currentAttr.valueSpan.getStart():i.move(-1),this.currentAttr.currentPart=d.text({chars:t,loc:i.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let t=this.currentTag,r=this.offset();if(t.type==="EndTag")throw k("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:t.start.toJSON(),end:r.toJSON()}));let{name:s,parts:n,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr;if(s.startsWith("|")&&n.length===0&&!a&&!o)throw k("Invalid block parameters syntax: block parameters must be preceded by the `as` keyword",i.until(i.move(s.length)));let h=this.assembleAttributeValue(n,a,o,i.until(r));h.loc=c.withEnd(r);let f=d.attr({name:s,value:h,loc:i.until(r)});this.currentStartTag.attributes.push(f)}parsePossibleBlockParams(){let t=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;this.tokenizer.state;let r=this.currentStartTag,s=this.currentAttr,n={state:"PossibleAs"},i={PossibleAs:o=>{if(n.state,Nt(o))n={state:"BeforeStartPipe"},this.tokenizer.transitionTo("afterAttributeName"),this.tokenizer.consume();else{if(o==="|")throw k('Invalid block parameters syntax: expecting at least one space character between "as" and "|"',s.start.until(this.offset().move(1)));n={state:"Done"}}},BeforeStartPipe:o=>{n.state,Nt(o)?this.tokenizer.consume():o==="|"?(n={state:"BeforeBlockParamName"},this.tokenizer.transitionTo("beforeAttributeName"),this.tokenizer.consume()):n={state:"Done"}},BeforeBlockParamName:o=>{if(n.state,Nt(o))this.tokenizer.consume();else if(o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"){if(r.params.length===0)throw k("Invalid block parameters syntax: empty parameters list, expecting at least one identifier",s.start.until(this.offset().move(1)));n={state:"AfterEndPipe"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: incomplete parameters list, expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n={state:"BlockParamName",name:o,start:this.offset()},this.tokenizer.consume()}},BlockParamName:o=>{if(n.state,o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"||Nt(o)){let c=n.start.until(this.offset());if(n.name==="this"||t.test(n.name))throw k(`Invalid block parameters syntax: invalid identifier name \`${n.name}\``,c);r.params.push(d.var({name:n.name,loc:c})),n=o==="|"?{state:"AfterEndPipe"}:{state:"BeforeBlockParamName"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n.name+=o,this.tokenizer.consume()}},AfterEndPipe:o=>{n.state,Nt(o)?this.tokenizer.consume():o===""?(n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: modifiers cannot follow parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}}):o===">"||o==="/"?n={state:"Done"}:(n={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:o=>{if(n.state,o===""||o==="/"||o===">"||Nt(o))throw k(n.message,n.start.until(this.offset()));this.tokenizer.consume()},Done:()=>{}},a;do a=this.tokenizer.peek(),i[n.state](a);while(n.state!=="Done"&&a!=="");n.state}reportSyntaxError(t){throw k(t,this.offset().collapsed())}assembleConcatenatedValue(t){let r=Bs(t),s=fr(t);return d.concat({parts:t,loc:this.source.spanFor(r.loc).extend(this.source.spanFor(s.loc))})}validateEndTag(t,r,s){if(de.has(t.name)&&!s)throw k(`<${t.name}> elements do not need end tags. You should remove it`,t.loc);if(r.type!=="ElementNode")throw k(`Closing tag </${t.name}> without an open tag`,t.loc);if(r.tag!==t.name)throw k(`Closing tag </${t.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`,t.loc)}assembleAttributeValue(t,r,s,n){if(s){if(r)return this.assembleConcatenatedValue(t);{let[i,a]=t;if(a===void 0||a.type==="TextNode"&&a.chars==="/")return i;throw k("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'",n)}}return Yt(t)?t[0]:d.text({chars:"",loc:n})}constructor(...t){super(...t),this.tagOpenLine=0,this.tagOpenColumn=0}},Ms={},pr=class extends $e{constructor(){super({})}parse(){}};function mn(e,t={}){let r,s,n,i=t.mode||"precompile";typeof e=="string"?(r=new pt(e,t.meta?.moduleName),s=i==="codemod"?he(e,t.parseOptions):Je(e,t.parseOptions)):e instanceof pt?(r=e,s=i==="codemod"?he(e.source,t.parseOptions):Je(e.source,t.parseOptions)):(r=new pt("",t.meta?.moduleName),s=e),i==="codemod"&&(n=new pr);let a=A.forCharPositions(r,0,r.source.length);s.loc={source:"(program)",start:a.startPosition,end:a.endPosition};let o=new hr(r,n,i).parse(s,t.locals??[]);if(t.plugins?.ast)for(let c of t.plugins.ast)Hs(o,c(ze({},t,{syntax:Ms},{plugins:void 0})).visitor);return o}var zs={resolution:()=>pe.GetStrictKeyword,serialize:()=>"Strict",isAngleBracket:!1},xo={...zs,isAngleBracket:!0};var Ys=Ur(be),dn=Ys;var mt=e=>e.loc.start.offset,Gt=e=>e.loc.end.offset;var Gs=new Set(on());function bn(e){return e.toUpperCase()===e}function Ks(e){return e.type==="ElementNode"&&typeof e.tag=="string"&&!e.tag.startsWith(":")&&(bn(e.tag[0])||e.tag.includes("."))}function Ws(e){return Gs.has(e.toLowerCase())&&!bn(e[0])}function dr(e){return e.selfClosing===!0||Ws(e.tag)||Ks(e)&&e.children.every(t=>Se(t))}function Se(e){return e.type==="TextNode"&&!/\S/.test(e.chars)}function gn(e){return e?.type==="MustacheCommentStatement"&&typeof e.value=="string"&&e.value.trim()==="prettier-ignore"}function yn(e){return gn(e.node)||e.isInArray&&(e.key==="children"||e.key==="body"||e.key==="parts")&&gn(e.siblings[e.index-2])}var xn=2;function js(e,t,r){let{node:s}=e;switch(s.type){case"Block":case"Program":case"Template":return B(e.map(r,"body"));case"ElementNode":{let n=t.htmlWhitespaceSensitivity!=="ignore",i=[!n&&e.previous?.type==="ElementNode"?H:"",B([Js(e,r)])];if(dr(s))return[i];let a=["</",s.tag,">"],o=s.tag==="style";if(s.children.length===0||(!n||o)&&s.children.every(h=>Se(h)))return[i,a];let c=e.map(r,"children");return o||!n?[i,F([H,...c]),H,a]:[i,F(B(c)),a]}case"BlockStatement":return Pn(e)?[ni(e,r),En(e,t,r),vn(e,t,r)]:[ti(e,r),B([En(e,t,r),vn(e,t,r),si(e,t,r)])];case"ElementModifierStatement":return B(["{{",Tn(e,r),"}}"]);case"MustacheStatement":return B([ke(s),Tn(e,r),Ee(s)]);case"SubExpression":return B(["(",ui(e,r),H,")"]);case"AttrNode":{let{name:n,value:i}=s,a=i.type==="TextNode";if(a&&i.chars===""&&mt(i)===Gt(i))return n;let c=a?oe(i.chars,t.singleQuote):i.type==="ConcatStatement"?oe(i.parts.map(f=>f.type==="TextNode"?f.chars:"").join(""),t.singleQuote):"",h=r("value");return[n,"=",c,n==="class"&&c?B(F(h)):h,c]}case"ConcatStatement":return e.map(r,"parts");case"Hash":return ct(N,e.map(r,"pairs"));case"HashPair":return[s.key,"=",r("value")];case"TextNode":{let n=s.chars,{parent:i}=e;if(i.type==="ElementNode"){if(i.tag==="pre")return ie(n);if(i.tag==="style")return n=St(0,n,/^\n+/g,""),n=R.trimEnd(n),n=R.dedentString(n),ie(n,ut)}n=St(0,n,"{{","\\{{");let a=ii(e);if(a){if(a==="class"){let D=n.trim().split(/\s+/).join(" "),I=!1,O=!1;return e.parent.type==="ConcatStatement"&&(e.previous?.type==="MustacheStatement"&&/^\s/.test(n)&&(I=!0),e.next?.type==="MustacheStatement"&&/\s$/.test(n)&&D!==""&&(O=!0)),[I?N:"",D,O?N:""]}return ie(n)}let o=R.isWhitespaceOnly(n),{isFirst:c,isLast:h}=e;if(t.htmlWhitespaceSensitivity!=="ignore"){let D=h&&e.parent.type==="Template",I=c&&e.parent.type==="Template";if(o){if(I||D)return"";let C=[N],$=_t(n);return $&&(C=Kt($)),h&&(C=C.map(W=>Ie(W))),C}let O=R.getLeadingWhitespace(n),z=[];if(O){z=[N];let C=_t(O);C&&(z=Kt(C)),n=n.slice(O.length)}let P=R.getTrailingWhitespace(n),U=[];if(P){if(!D){U=[N];let C=_t(P);C&&(U=Kt(C)),h&&(U=U.map($=>Ie($)))}n=n.slice(0,-P.length)}return[...z,qe(wn(n)),...U]}let f=_t(n),p=ai(n),g=oi(n);if((c||h)&&o&&(e.parent.type==="Block"||e.parent.type==="ElementNode"||e.parent.type==="Template"))return"";o&&f?(p=Math.min(f,xn),g=0):((e.next?.type==="BlockStatement"||e.next?.type==="ElementNode")&&(g=Math.max(g,1)),(e.previous?.type==="BlockStatement"||e.previous?.type==="ElementNode")&&(p=Math.max(p,1)));let E="",T="";return g===0&&e.next?.type==="MustacheStatement"&&(T=" "),p===0&&e.previous?.type==="MustacheStatement"&&(E=" "),c&&(p=0,E=""),h&&(g=0,T=""),R.hasLeadingWhitespace(n)&&(n=E+R.trimStart(n)),R.hasTrailingWhitespace(n)&&(n=R.trimEnd(n)+T),[...Kt(p),qe(wn(n)),...Kt(g)]}case"MustacheCommentStatement":{let n=mt(s),i=Gt(s),a=t.originalText.charAt(n+2)==="~",o=t.originalText.charAt(i-3)==="~",c=s.value.includes("}}")?"--":"";return["{{",a?"~":"","!",c,s.value,c,o?"~":"","}}"]}case"PathExpression":return mi(s);case"BooleanLiteral":return String(s.value);case"CommentStatement":return["<!--",s.value,"-->"];case"StringLiteral":return li(e,t);case"NumberLiteral":return String(s.value);case"UndefinedLiteral":return"undefined";case"NullLiteral":return"null";case"FrontMatter":case"AtHead":case"VarHead":case"ThisHead":default:throw new qr(s,"Handlebars")}}function Qs(e,t){return mt(e)-mt(t)}function Js(e,t){let{node:r}=e,s=["attributes","modifiers","comments"].filter(i=>It(r[i])),n=s.flatMap(i=>r[i]).sort(Qs);for(let i of s)e.each(({node:a})=>{let o=n.indexOf(a);n.splice(o,1,[N,t()])},i);return It(r.blockParams)&&n.push(N,br(r)),["<",r.tag,F(n),$s(r)]}function $s(e){return dr(e)?Ve([H,"/>"],[" />",H]):Ve([H,">"],">")}function ke(e){let t=e.trusting?"{{{":"{{",r=e.strip?.open?"~":"";return[t,r]}function Ee(e){let t=e.trusting?"}}}":"}}";return[e.strip?.close?"~":"",t]}function Xs(e){let t=ke(e),r=e.openStrip.open?"~":"";return[t,r,"#"]}function Zs(e){let t=Ee(e);return[e.openStrip.close?"~":"",t]}function Sn(e){let t=ke(e),r=e.closeStrip.open?"~":"";return[t,r,"/"]}function kn(e){let t=Ee(e);return[e.closeStrip.close?"~":"",t]}function Nn(e){let t=ke(e),r=e.inverseStrip.open?"~":"";return[t,r]}function An(e){let t=Ee(e);return[e.inverseStrip.close?"~":"",t]}function ti(e,t){let{node:r}=e,s=[],n=ve(e,t);return n&&s.push(B(n)),It(r.program.blockParams)&&s.push(br(r.program)),B([Xs(r),gr(e,t),s.length>0?F([N,ct(N,s)]):"",H,Zs(r)])}function ei(e,t){return[t.htmlWhitespaceSensitivity==="ignore"?ut:"",Nn(e),"else",An(e)]}var ri=({path:e},{path:t})=>[e,t].every(r=>r.type==="PathExpression"&&r.head.type==="VarHead")&&e.head.name===t.head.name;function Pn(e){if(!e.match(r=>r.type==="BlockStatement",(r,s)=>s==="body"&&r.type==="Block"&&r.body.length===1,(r,s)=>s==="inverse"&&r.type==="BlockStatement"))return!1;let{node:t}=e;return t.path.type==="PathExpression"&&t.path.head.type==="VarHead"&&t.path.head.name==="if"||ri(t,e.grandparent)}function ni(e,t){let{node:r,grandparent:s}=e;return B([Nn(s),["else"," ",s.inverse.body[0].path.head.name],F([N,B(ve(e,t)),...It(r.program.blockParams)?[N,br(r.program)]:[]]),H,An(s)])}function si(e,t,r){let{node:s}=e;return t.htmlWhitespaceSensitivity==="ignore"?[Cn(s)?H:ut,Sn(s),r("path"),kn(s)]:[Sn(s),r("path"),kn(s)]}function Cn(e){return e.type==="BlockStatement"&&e.program.body.every(t=>Se(t))}function En(e,t,r){let{node:s}=e;if(Cn(s))return"";let n=r("program");return t.htmlWhitespaceSensitivity==="ignore"?F([ut,n]):F(n)}function vn(e,t,r){let{node:s}=e;if(!s.inverse)return"";let n=r("inverse"),i=t.htmlWhitespaceSensitivity==="ignore"?[ut,n]:n;return e.call(Pn,"inverse","body",0)?i:[ei(s,t),F(i)]}function wn(e){return ct(N,R.split(e))}function ii(e){for(let t=0;t<2;t++){let r=e.getParentNode(t);if(r?.type==="AttrNode")return r.name.toLowerCase()}}function _t(e){return e=typeof e=="string"?e:"",e.split(`
30
+ `?s?s.loc.getEnd():this.currentAttr.valueSpan.getStart():i.move(-1),this.currentAttr.currentPart=d.text({chars:t,loc:i.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let t=this.currentTag,r=this.offset();if(t.type==="EndTag")throw k("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:t.start.toJSON(),end:r.toJSON()}));let{name:s,parts:n,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr;if(s.startsWith("|")&&n.length===0&&!a&&!o)throw k("Invalid block parameters syntax: block parameters must be preceded by the `as` keyword",i.until(i.move(s.length)));let h=this.assembleAttributeValue(n,a,o,i.until(r));h.loc=c.withEnd(r);let f=d.attr({name:s,value:h,loc:i.until(r)});this.currentStartTag.attributes.push(f)}parsePossibleBlockParams(){let t=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;this.tokenizer.state;let r=this.currentStartTag,s=this.currentAttr,n={state:"PossibleAs"},i={PossibleAs:o=>{if(n.state,Nt(o))n={state:"BeforeStartPipe"},this.tokenizer.transitionTo("afterAttributeName"),this.tokenizer.consume();else{if(o==="|")throw k('Invalid block parameters syntax: expecting at least one space character between "as" and "|"',s.start.until(this.offset().move(1)));n={state:"Done"}}},BeforeStartPipe:o=>{n.state,Nt(o)?this.tokenizer.consume():o==="|"?(n={state:"BeforeBlockParamName"},this.tokenizer.transitionTo("beforeAttributeName"),this.tokenizer.consume()):n={state:"Done"}},BeforeBlockParamName:o=>{if(n.state,Nt(o))this.tokenizer.consume();else if(o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"){if(r.params.length===0)throw k("Invalid block parameters syntax: empty parameters list, expecting at least one identifier",s.start.until(this.offset().move(1)));n={state:"AfterEndPipe"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: incomplete parameters list, expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n={state:"BlockParamName",name:o,start:this.offset()},this.tokenizer.consume()}},BlockParamName:o=>{if(n.state,o==="")n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: mustaches cannot be used inside parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}};else if(o==="|"||Nt(o)){let c=n.start.until(this.offset());if(n.name==="this"||t.test(n.name))throw k(`Invalid block parameters syntax: invalid identifier name \`${n.name}\``,c);r.params.push(d.var({name:n.name,loc:c})),n=o==="|"?{state:"AfterEndPipe"}:{state:"BeforeBlockParamName"},this.tokenizer.consume()}else{if(o===">"||o==="/")throw k('Invalid block parameters syntax: expecting "|" but the tag was closed prematurely',s.start.until(this.offset().move(1)));n.name+=o,this.tokenizer.consume()}},AfterEndPipe:o=>{n.state,Nt(o)?this.tokenizer.consume():o===""?(n={state:"Done"},this.pendingError={mustache(c){throw k("Invalid block parameters syntax: modifiers cannot follow parameters list",c)},eof(c){throw k('Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',s.start.until(c))}}):o===">"||o==="/"?n={state:"Done"}:(n={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:o=>{if(n.state,o===""||o==="/"||o===">"||Nt(o))throw k(n.message,n.start.until(this.offset()));this.tokenizer.consume()},Done:()=>{}},a;do a=this.tokenizer.peek(),i[n.state](a);while(n.state!=="Done"&&a!=="");n.state}reportSyntaxError(t){throw k(t,this.offset().collapsed())}assembleConcatenatedValue(t){let r=Bs(t),s=fr(t);return d.concat({parts:t,loc:this.source.spanFor(r.loc).extend(this.source.spanFor(s.loc))})}validateEndTag(t,r,s){if(de.has(t.name)&&!s)throw k(`<${t.name}> elements do not need end tags. You should remove it`,t.loc);if(r.type!=="ElementNode")throw k(`Closing tag </${t.name}> without an open tag`,t.loc);if(r.tag!==t.name)throw k(`Closing tag </${t.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`,t.loc)}assembleAttributeValue(t,r,s,n){if(s){if(r)return this.assembleConcatenatedValue(t);{let[i,a]=t;if(a===void 0||a.type==="TextNode"&&a.chars==="/")return i;throw k("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'",n)}}return Yt(t)?t[0]:d.text({chars:"",loc:n})}constructor(...t){super(...t),this.tagOpenLine=0,this.tagOpenColumn=0}},Ms={},pr=class extends $e{constructor(){super({})}parse(){}};function mn(e,t={}){let r,s,n,i=t.mode||"precompile";typeof e=="string"?(r=new pt(e,t.meta?.moduleName),s=i==="codemod"?he(e,t.parseOptions):Je(e,t.parseOptions)):e instanceof pt?(r=e,s=i==="codemod"?he(e.source,t.parseOptions):Je(e.source,t.parseOptions)):(r=new pt("",t.meta?.moduleName),s=e),i==="codemod"&&(n=new pr);let a=A.forCharPositions(r,0,r.source.length);s.loc={source:"(program)",start:a.startPosition,end:a.endPosition};let o=new hr(r,n,i).parse(s,t.locals??[]);if(t.plugins?.ast)for(let c of t.plugins.ast)Hs(o,c(ze({},t,{syntax:Ms},{plugins:void 0})).visitor);return o}var zs={resolution:()=>pe.GetStrictKeyword,serialize:()=>"Strict",isAngleBracket:!1},xo={...zs,isAngleBracket:!0};var Ys=Ur(be),dn=Ys;var mt=e=>e.loc.start.offset,Gt=e=>e.loc.end.offset;var Gs=new Set(on());function bn(e){return e.toUpperCase()===e}function Ks(e){return e.type==="ElementNode"&&typeof e.tag=="string"&&!e.tag.startsWith(":")&&(bn(e.tag[0])||e.tag.includes("."))}function Ws(e){return Gs.has(e.toLowerCase())&&!bn(e[0])}function dr(e){return e.selfClosing===!0||Ws(e.tag)||Ks(e)&&e.children.every(t=>Se(t))}function Se(e){return e.type==="TextNode"&&!/\S/.test(e.chars)}function gn(e){return e?.type==="MustacheCommentStatement"&&typeof e.value=="string"&&e.value.trim()==="prettier-ignore"}function yn(e){return gn(e.node)||e.isInArray&&(e.key==="children"||e.key==="body"||e.key==="parts")&&gn(e.siblings[e.index-2])}var xn=2;function js(e,t,r){let{node:s}=e;switch(s.type){case"Block":case"Program":case"Template":return B(e.map(r,"body"));case"ElementNode":{let n=t.htmlWhitespaceSensitivity!=="ignore",i=[!n&&e.previous?.type==="ElementNode"?H:"",B([Js(e,r)])];if(dr(s))return[i];let a=["</",s.tag,">"],o=s.tag==="style";if(s.children.length===0||(!n||o)&&s.children.every(h=>Se(h)))return[i,a];let c=e.map(r,"children");return o||!n?[i,F([H,...c]),H,a]:[i,F(B(c)),a]}case"BlockStatement":return Pn(e)?[ni(e,r),En(e,t,r),vn(e,t,r)]:[ti(e,r),B([En(e,t,r),vn(e,t,r),si(e,t,r)])];case"ElementModifierStatement":return B(["{{",Tn(e,r),"}}"]);case"MustacheStatement":return B([ke(s),Tn(e,r),Ee(s)]);case"SubExpression":return B(["(",ui(e,r),H,")"]);case"AttrNode":{let{name:n,value:i}=s,a=i.type==="TextNode";if(a&&i.chars===""&&mt(i)===Gt(i))return n;let c=a?oe(i.chars,t.singleQuote):i.type==="ConcatStatement"?oe(i.parts.map(f=>f.type==="TextNode"?f.chars:"").join(""),t.singleQuote):"",h=r("value");return[n,"=",c,n==="class"&&c?B(F(h)):h,c]}case"ConcatStatement":return e.map(r,"parts");case"Hash":return ct(N,e.map(r,"pairs"));case"HashPair":return[s.key,"=",r("value")];case"TextNode":{let n=s.chars,{parent:i}=e;if(i.type==="ElementNode"){if(i.tag==="pre")return ie(n);if(i.tag==="style")return n=St(0,n,/^\n+/g,""),n=R.trimEnd(n),n=R.dedentString(n),ie(n,ut)}n=St(0,n,"{{","\\{{");let a=ii(e);if(a){if(a==="class"){let D=n.trim().split(/\s+/).join(" "),I=!1,O=!1;return e.parent.type==="ConcatStatement"&&(e.previous?.type==="MustacheStatement"&&/^\s/.test(n)&&(I=!0),e.next?.type==="MustacheStatement"&&/\s$/.test(n)&&D!==""&&(O=!0)),[I?N:"",D,O?N:""]}return ie(n)}let o=R.isWhitespaceOnly(n),{isFirst:c,isLast:h}=e;if(t.htmlWhitespaceSensitivity!=="ignore"){let D=h&&e.parent.type==="Template",I=c&&e.parent.type==="Template";if(o){if(I||D)return"";let C=[N],$=_t(n);return $&&(C=Kt($)),h&&(C=C.map(W=>Ie(W))),C}let O=R.getLeadingWhitespace(n),z=[];if(O){z=[N];let C=_t(O);C&&(z=Kt(C)),n=n.slice(O.length)}let P=R.getTrailingWhitespace(n),U=[];if(P){if(!D){U=[N];let C=_t(P);C&&(U=Kt(C)),h&&(U=U.map($=>Ie($)))}n=n.slice(0,-P.length)}return[...z,qe(wn(n)),...U]}let f=_t(n),p=ai(n),g=oi(n);if((c||h)&&o&&(e.parent.type==="Block"||e.parent.type==="ElementNode"||e.parent.type==="Template"))return"";o&&f?(p=Math.min(f,xn),g=0):((e.next?.type==="BlockStatement"||e.next?.type==="ElementNode")&&(g=Math.max(g,1)),(e.previous?.type==="BlockStatement"||e.previous?.type==="ElementNode")&&(p=Math.max(p,1)));let E="",T="";return g===0&&e.next?.type==="MustacheStatement"&&(T=" "),p===0&&e.previous?.type==="MustacheStatement"&&(E=" "),c&&(p=0,E=""),h&&(g=0,T=""),R.hasLeadingWhitespace(n)&&(n=E+R.trimStart(n)),R.hasTrailingWhitespace(n)&&(n=R.trimEnd(n)+T),[...Kt(p),qe(wn(n)),...Kt(g)]}case"MustacheCommentStatement":{let n=mt(s),i=Gt(s),a=t.originalText.charAt(n+2)==="~",o=t.originalText.charAt(i-3)==="~",c=s.value.includes("}}")?"--":"";return["{{",a?"~":"","!",c,s.value,c,o?"~":"","}}"]}case"PathExpression":return mi(s);case"BooleanLiteral":return String(s.value);case"CommentStatement":return["<!--",s.value,"-->"];case"StringLiteral":return li(e,t);case"NumberLiteral":return String(s.value);case"UndefinedLiteral":return"undefined";case"NullLiteral":return"null";default:throw new qr(s,"Handlebars")}}function Qs(e,t){return mt(e)-mt(t)}function Js(e,t){let{node:r}=e,s=["attributes","modifiers","comments"].filter(i=>It(r[i])),n=s.flatMap(i=>r[i]).sort(Qs);for(let i of s)e.each(({node:a})=>{let o=n.indexOf(a);n.splice(o,1,[N,t()])},i);return It(r.blockParams)&&n.push(N,br(r)),["<",r.tag,F(n),$s(r)]}function $s(e){return dr(e)?Ve([H,"/>"],[" />",H]):Ve([H,">"],">")}function ke(e){let t=e.trusting?"{{{":"{{",r=e.strip?.open?"~":"";return[t,r]}function Ee(e){let t=e.trusting?"}}}":"}}";return[e.strip?.close?"~":"",t]}function Xs(e){let t=ke(e),r=e.openStrip.open?"~":"";return[t,r,"#"]}function Zs(e){let t=Ee(e);return[e.openStrip.close?"~":"",t]}function Sn(e){let t=ke(e),r=e.closeStrip.open?"~":"";return[t,r,"/"]}function kn(e){let t=Ee(e);return[e.closeStrip.close?"~":"",t]}function Nn(e){let t=ke(e),r=e.inverseStrip.open?"~":"";return[t,r]}function An(e){let t=Ee(e);return[e.inverseStrip.close?"~":"",t]}function ti(e,t){let{node:r}=e,s=[],n=ve(e,t);return n&&s.push(B(n)),It(r.program.blockParams)&&s.push(br(r.program)),B([Xs(r),gr(e,t),s.length>0?F([N,ct(N,s)]):"",H,Zs(r)])}function ei(e,t){return[t.htmlWhitespaceSensitivity==="ignore"?ut:"",Nn(e),"else",An(e)]}var ri=({path:e},{path:t})=>[e,t].every(r=>r.type==="PathExpression"&&r.head.type==="VarHead")&&e.head.name===t.head.name;function Pn(e){if(!e.match(r=>r.type==="BlockStatement",(r,s)=>s==="body"&&r.type==="Block"&&r.body.length===1,(r,s)=>s==="inverse"&&r.type==="BlockStatement"))return!1;let{node:t}=e;return t.path.type==="PathExpression"&&t.path.head.type==="VarHead"&&t.path.head.name==="if"||ri(t,e.grandparent)}function ni(e,t){let{node:r,grandparent:s}=e;return B([Nn(s),["else"," ",s.inverse.body[0].path.head.name],F([N,B(ve(e,t)),...It(r.program.blockParams)?[N,br(r.program)]:[]]),H,An(s)])}function si(e,t,r){let{node:s}=e;return t.htmlWhitespaceSensitivity==="ignore"?[Cn(s)?H:ut,Sn(s),r("path"),kn(s)]:[Sn(s),r("path"),kn(s)]}function Cn(e){return e.type==="BlockStatement"&&e.program.body.every(t=>Se(t))}function En(e,t,r){let{node:s}=e;if(Cn(s))return"";let n=r("program");return t.htmlWhitespaceSensitivity==="ignore"?F([ut,n]):F(n)}function vn(e,t,r){let{node:s}=e;if(!s.inverse)return"";let n=r("inverse"),i=t.htmlWhitespaceSensitivity==="ignore"?[ut,n]:n;return e.call(Pn,"inverse","body",0)?i:[ei(s,t),F(i)]}function wn(e){return ct(N,R.split(e))}function ii(e){for(let t=0;t<2;t++){let r=e.getParentNode(t);if(r?.type==="AttrNode")return r.name.toLowerCase()}}function _t(e){return e=typeof e=="string"?e:"",e.split(`
31
31
  `).length-1}function ai(e){e=typeof e=="string"?e:"";let t=(e.match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"";return _t(t)}function oi(e){e=typeof e=="string"?e:"";let t=(e.match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"";return _t(t)}function Kt(e=0){return Array.from({length:Math.min(e,xn)}).fill(ut)}function li(e,t){let{node:{value:r}}=e,s=oe(r,ci(e)?!t.singleQuote:t.singleQuote);return[s,St(0,r,s,`\\${s}`),s]}function ci(e){let{ancestors:t}=e,r=t.findIndex(s=>s.type!=="SubExpression");return r!==-1&&t[r+1].type==="ConcatStatement"&&t[r+2].type==="AttrNode"}function ui(e,t){let r=gr(e,t),s=ve(e,t);return s?F([r,N,B(s)]):r}function Tn(e,t){let r=gr(e,t),s=ve(e,t);return s?[F([r,N,s]),H]:r}function gr(e,t){return t("path")}function ve(e,t){let{node:r}=e,s=[];return r.params.length>0&&s.push(...e.map(t,"params")),r.hash?.pairs.length>0&&s.push(t("hash")),s.length===0?"":ct(N,s)}function br(e){return["as |",e.blockParams.join(" "),"|"]}var hi=new Set("!\"#%&'()*+,./;<=>@[\\]^`{|}~"),pi=new Set(["true","false","null","undefined"]),fi=(e,t)=>t===0&&e.startsWith("@")?!1:t!==0&&pi.has(e)||/\s/.test(e)||/^\d/.test(e)||Array.prototype.some.call(e,r=>hi.has(r));function mi(e){return e.tail.length===0&&e.original.includes("/")?e.original:[e.head.original,...e.tail].map((r,s)=>fi(r,s)?`[${r}]`:r).join(".")}var di={features:{experimental_frontMatterSupport:{massageAstNode:!0,embed:!0,print:!0}},print:js,massageAstNode:Fr,hasPrettierIgnore:yn,getVisitorKeys:dn,embed:Hr},_n=di;var Ln=[{name:"Handlebars",type:"markup",aceMode:"handlebars",extensions:[".handlebars",".hbs"],tmScope:"text.html.handlebars",aliases:["hbs","htmlbars"],parsers:["glimmer"],vscodeLanguageIds:["handlebars"],linguistLanguageId:155}];var yr={};Oe(yr,{glimmer:()=>Ai});function gi(e,t){let r=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(r,t)}var Dn=gi;function bi(e){return St(0,e,/[^\n]/g," ")}var On=bi;var Bn=Symbol.for("PRETTIER_IS_FRONT_MATTER");var Wt=3;function yi(e){let t=e.slice(0,Wt);if(t!=="---"&&t!=="+++")return;let r=e.indexOf(`
32
32
  `,Wt);if(r===-1)return;let s=e.slice(Wt,r).trim(),n=e.indexOf(`
33
33
  ${t}`,r),i=s;if(i||(i=t==="+++"?"toml":"yaml"),n===-1&&t==="---"&&i==="yaml"&&(n=e.indexOf(`
@@ -25,4 +25,4 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
25
25
  Duplicate "graphql" modules cannot be used at the same time since different
26
26
  versions may have different capabilities and behavior. The data from one
27
27
  version used in the function from another could produce confusing and
28
- spurious results.`)}}return!1};var B=class{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${ee(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function ot(e){return st(e,B)}function at(e,t){let n=new he(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}var he=class{constructor(t,n={}){let{lexer:i,...r}=n;if(i)this._lexer=i;else{let s=ot(t)?t:new B(t);this._lexer=new z(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(n.value){case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),i,r;return this.expectOptionalToken(o.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:c.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let i=this._lexer.token.value;throw h(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let i=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(o.COLON);let r=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw h(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),i=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(W,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),i=this.parseName(),r;!n&&this.expectOptionalToken(o.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:c.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new H(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw h(this._lexer.source,n.start,`Expected ${ct(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw h(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return h(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,i){this.expectToken(t);let r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);let i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw h(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return ct(e.kind)+(t!=null?` "${t}"`:"")}function ct(e){return nt(e)?`"${e}"`:e}function en(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var pt=en;function tn(e){let t=[],{startToken:n,endToken:i}=e.loc;for(let r=n;r!==i;r=r.next)r.kind==="Comment"&&t.push({...r,loc:{start:r.start,end:r.end}});return t}var nn={allowLegacyFragmentVariables:!0};function rn(e){if(e?.name==="GraphQLError"){let{message:t,locations:[n]}=e;return pt(t,{loc:{start:n},cause:e})}return e}function sn(e){let t;try{t=at(e,nn)}catch(n){throw rn(n)}return t.comments=tn(t),t}var on={parse:sn,astFormat:"graphql",hasPragma:Me,hasIgnorePragma:Ve,locStart:J,locEnd:q};var an={graphql:Ye};return dt(cn);});
28
+ spurious results.`)}}return!1};var B=class{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${ee(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function ot(e){return st(e,B)}function at(e,t){let n=new he(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}var he=class{constructor(t,n={}){let{lexer:i,...r}=n;if(i)this._lexer=i;else{let s=ot(t)?t:new B(t);this._lexer=new z(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),i,r;return this.expectOptionalToken(o.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:c.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let i=this._lexer.token.value;throw h(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let i=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(o.COLON);let r=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw h(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),i=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(W,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),i=this.parseName(),r;!n&&this.expectOptionalToken(o.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:c.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new H(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw h(this._lexer.source,n.start,`Expected ${ct(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw h(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return h(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,i){this.expectToken(t);let r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);let i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw h(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return ct(e.kind)+(t!=null?` "${t}"`:"")}function ct(e){return nt(e)?`"${e}"`:e}function en(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var pt=en;function tn(e){let t=[],{startToken:n,endToken:i}=e.loc;for(let r=n;r!==i;r=r.next)r.kind==="Comment"&&t.push({...r,loc:{start:r.start,end:r.end}});return t}var nn={allowLegacyFragmentVariables:!0};function rn(e){if(e?.name==="GraphQLError"){let{message:t,locations:[n]}=e;return pt(t,{loc:{start:n},cause:e})}return e}function sn(e){let t;try{t=at(e,nn)}catch(n){throw rn(n)}return t.comments=tn(t),t}var on={parse:sn,astFormat:"graphql",hasPragma:Me,hasIgnorePragma:Ve,locStart:J,locEnd:q};var an={graphql:Ye};return dt(cn);});
@@ -25,4 +25,4 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
25
25
  Duplicate "graphql" modules cannot be used at the same time since different
26
26
  versions may have different capabilities and behavior. The data from one
27
27
  version used in the function from another could produce confusing and
28
- spurious results.`)}}return!1};var B=class{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${ee(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function st(e){return it(e,B)}function ot(e,t){let n=new fe(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}var fe=class{constructor(t,n={}){let{lexer:i,...r}=n;if(i)this._lexer=i;else{let s=st(t)?t:new B(t);this._lexer=new z(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(n.value){case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),i,r;return this.expectOptionalToken(o.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:c.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let i=this._lexer.token.value;throw h(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let i=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(o.COLON);let r=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw h(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),i=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(W,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),i=this.parseName(),r;!n&&this.expectOptionalToken(o.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:c.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new H(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw h(this._lexer.source,n.start,`Expected ${at(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw h(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return h(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,i){this.expectToken(t);let r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);let i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw h(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return at(e.kind)+(t!=null?` "${t}"`:"")}function at(e){return tt(e)?`"${e}"`:e}function Wt(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var ct=Wt;function zt(e){let t=[],{startToken:n,endToken:i}=e.loc;for(let r=n;r!==i;r=r.next)r.kind==="Comment"&&t.push({...r,loc:{start:r.start,end:r.end}});return t}var Kt={allowLegacyFragmentVariables:!0};function Zt(e){if(e?.name==="GraphQLError"){let{message:t,locations:[n]}=e;return ct(t,{loc:{start:n},cause:e})}return e}function en(e){let t;try{t=ot(e,Kt)}catch(n){throw Zt(n)}return t.comments=zt(t),t}var tn={parse:en,astFormat:"graphql",hasPragma:Fe,hasIgnorePragma:Me,locStart:J,locEnd:q};var nn={graphql:Ge};export{pt as default,Ye as languages,$e as options,he as parsers,nn as printers};
28
+ spurious results.`)}}return!1};var B=class{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${ee(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function st(e){return it(e,B)}function ot(e,t){let n=new fe(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}var fe=class{constructor(t,n={}){let{lexer:i,...r}=n;if(i)this._lexer=i;else{let s=st(t)?t:new B(t);this._lexer=new z(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),i,r;return this.expectOptionalToken(o.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:c.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let i=this._lexer.token.value;throw h(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let i=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(o.COLON);let r=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw h(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),i=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(W,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),i=this.parseName(),r;!n&&this.expectOptionalToken(o.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:c.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new H(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw h(this._lexer.source,n.start,`Expected ${at(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw h(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return h(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,i){this.expectToken(t);let r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);let i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw h(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return at(e.kind)+(t!=null?` "${t}"`:"")}function at(e){return tt(e)?`"${e}"`:e}function Wt(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var ct=Wt;function zt(e){let t=[],{startToken:n,endToken:i}=e.loc;for(let r=n;r!==i;r=r.next)r.kind==="Comment"&&t.push({...r,loc:{start:r.start,end:r.end}});return t}var Kt={allowLegacyFragmentVariables:!0};function Zt(e){if(e?.name==="GraphQLError"){let{message:t,locations:[n]}=e;return ct(t,{loc:{start:n},cause:e})}return e}function en(e){let t;try{t=ot(e,Kt)}catch(n){throw Zt(n)}return t.comments=zt(t),t}var tn={parse:en,astFormat:"graphql",hasPragma:Fe,hasIgnorePragma:Me,locStart:J,locEnd:q};var nn={graphql:Ge};export{pt as default,Ye as languages,$e as options,he as parsers,nn as printers};