var Kt=Object.defineProperty;var Ze=(s,e)=>{for(var t in e)Kt(s,t,{get:e[t],enumerable:!0})};var ze={};Ze(ze,{parsers:()=>je});var je={};Ze(je,{__ng_action:()=>Ir,__ng_binding:()=>Rr,__ng_directive:()=>Lr,__ng_interpolation:()=>Pr});var me=` `,Je="\r",Ye=function(){function s(e){this.length=e.length;for(var t=[0],r=0;rthis.length)return null;for(var t=0,r=this.offsets;r[t+1]<=e;)t++;var n=e-r[t];return{line:t,column:n}},s.prototype.indexForLocation=function(e){var t=e.line,r=e.column;return t<0||t>=this.offsets.length||r<0||r>this.lengthOfLine(t)?null:this.offsets[t]+r},s.prototype.lengthOfLine=function(e){var t=this.offsets[e],r=e===this.offsets.length-1?this.length:this.offsets[e+1];return r-t},s}();var le=class{text;locator;constructor(e){this.text=e,this.locator=new Re(this.text)}},Re=class{_linesAndColumns;constructor(e){this._linesAndColumns=new Ye(e)}locationForIndex(e){let{line:t,column:r}=this._linesAndColumns.locationForIndex(e);return{line:t+1,column:r,index:e}}};var G=class{constructor(e,t,r,n){this.input=t,this.errLocation=r,this.ctxLocation=n,this.message=`Parser Error: ${e} ${r} [${t}] in ${n}`}},P=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new I(e+this.start,e+this.end)}},S=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},D=class extends S{constructor(e,t,r){super(e,t),this.nameSpan=r}},E=class extends S{visit(e,t=null){}},L=class extends S{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Se=class extends L{visit(e,t=null){var r;return(r=e.visitThisReceiver)==null?void 0:r.call(e,this,t)}},V=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitChain(this,t)}},W=class extends S{constructor(e,t,r,n,i){super(e,t),this.condition=r,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},B=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},Q=class extends D{constructor(e,t,r,n,i,a){super(e,t,r),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},H=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},j=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},z=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},q=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},X=class extends D{constructor(e,t,r,n,i,a){super(e,t,a),this.exp=r,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends S{constructor(e,t,r){super(e,t),this.value=r}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},Z=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitLiteralArray(this,t)}},J=class extends S{constructor(e,t,r,n){super(e,t),this.keys=r,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},we=class extends S{constructor(e,t,r,n){super(e,t),this.strings=r,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},$=class extends S{constructor(e,t,r,n,i){super(e,t),this.operation=r,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},K=class s extends ${static createMinus(e,t,r){return new s(e,t,"-",r,"-",new A(e,t,0),r)}static createPlus(e,t,r){return new s(e,t,"+",r,"-",r,new A(e,t,0))}constructor(e,t,r,n,i,a,h){super(e,t,i,a,h),this.operator=r,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},Y=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitPrefixNot(this,t)}},ee=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitNonNullAssert(this,t)}},te=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},re=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},I=class{constructor(e,t){this.start=e,this.end=t}},R=class extends S{constructor(e,t,r,n,i){super(new P(0,t===null?0:t.length),new I(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=r,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},se=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},ye=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let r of e)this.visit(r,t)}};var et;(function(s){s[s.DEFAULT=0]="DEFAULT",s[s.LITERAL_ATTR=1]="LITERAL_ATTR",s[s.ANIMATION=2]="ANIMATION"})(et||(et={}));function tt(s){return s>=9&&s<=32||s==160}function b(s){return 48<=s&&s<=57}function rt(s){return s>=97&&s<=122||s>=65&&s<=90}function Pe(s){return s===39||s===34||s===96}var d;(function(s){s[s.Character=0]="Character",s[s.Identifier=1]="Identifier",s[s.PrivateIdentifier=2]="PrivateIdentifier",s[s.Keyword=3]="Keyword",s[s.String=4]="String",s[s.Operator=5]="Operator",s[s.Number=6]="Number",s[s.Error=7]="Error"})(d||(d={}));var ur=["var","let","as","null","undefined","true","false","if","else","this"],xe=class{tokenize(e){let t=new Be(e),r=[],n=t.scanToken();for(;n!=null;)r.push(n),n=t.scanToken();return r}},N=class{constructor(e,t,r,n,i){this.index=e,this.end=t,this.type=r,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==d.Character&&this.numValue==e}isNumber(){return this.type==d.Number}isString(){return this.type==d.String}isOperator(e){return this.type==d.Operator&&this.strValue==e}isIdentifier(){return this.type==d.Identifier}isPrivateIdentifier(){return this.type==d.PrivateIdentifier}isKeyword(){return this.type==d.Keyword}isKeywordLet(){return this.type==d.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==d.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==d.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==d.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==d.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==d.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==d.Keyword&&this.strValue=="this"}isError(){return this.type==d.Error}toNumber(){return this.type==d.Number?this.numValue:-1}toString(){switch(this.type){case d.Character:case d.Identifier:case d.Keyword:case d.Operator:case d.PrivateIdentifier:case d.String:case d.Error:return this.strValue;case d.Number:return this.numValue.toString();default:return null}}};function ot(s,e,t){return new N(s,e,d.Character,t,String.fromCharCode(t))}function lr(s,e,t){return new N(s,e,d.Identifier,0,t)}function xr(s,e,t){return new N(s,e,d.PrivateIdentifier,0,t)}function fr(s,e,t){return new N(s,e,d.Keyword,0,t)}function be(s,e,t){return new N(s,e,d.Operator,0,t)}function dr(s,e,t){return new N(s,e,d.String,0,t)}function vr(s,e,t){return new N(s,e,d.Number,t,"")}function gr(s,e,t){return new N(s,e,d.Error,0,t)}var Ce=new N(-1,-1,d.Character,0,""),Be=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,r=this.peek,n=this.index;for(;r<=32;)if(++n>=t){r=0;break}else r=e.charCodeAt(n);if(this.peek=r,this.index=n,n>=t)return null;if(ct(r))return this.scanIdentifier();if(b(r))return this.scanNumber(n);let i=n;switch(r){case 46:return this.advance(),b(this.peek)?this.scanNumber(i):ot(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,r);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(r));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;tt(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(r)}]`,0)}scanCharacter(e,t){return this.advance(),ot(e,this.index,t)}scanOperator(e,t){return this.advance(),be(e,this.index,t)}scanComplexOperator(e,t,r,n,i,a){this.advance();let h=t;return this.peek==r&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),be(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();ht(this.peek);)this.advance();let t=this.input.substring(e,this.index);return ur.indexOf(t)>-1?fr(e,this.index,t):lr(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!ct(this.peek))return this.error("Invalid character [#]",-1);for(;ht(this.peek);)this.advance();let t=this.input.substring(e,this.index);return xr(e,this.index,t)}scanNumber(e){let t=this.index===e,r=!1;for(this.advance();;){if(!b(this.peek))if(this.peek===95){if(!b(this.input.charCodeAt(this.index-1))||!b(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);r=!0}else if(this.peek===46)t=!1;else if(mr(this.peek)){if(this.advance(),Sr(this.peek)&&this.advance(),!b(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);r&&(n=n.replace(/_/g,""));let i=t?yr(n):parseFloat(n);return vr(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let r="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){r+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let v=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(v))h=parseInt(v,16);else return this.error(`Invalid unicode escape [\\u${v}]`,0);for(let f=0;f<5;f++)this.advance()}else h=wr(this.peek),this.advance();r+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),dr(e,this.index,r+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),be(e,this.index,t)}error(e,t){let r=this.index+t;return gr(r,this.index,`Lexer Error: ${e} at column ${r} in expression [${this.input}]`)}};function ct(s){return 97<=s&&s<=122||65<=s&&s<=90||s==95||s==36}function ht(s){return rt(s)||b(s)||s==95||s==36}function mr(s){return s==101||s==69}function Sr(s){return s==45||s==43}function wr(s){switch(s){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return s}}function yr(s){let e=parseInt(s);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+s);return e}var Er=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function xt(s,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${s}' to be an array, [start, end].`);if(e!=null){let t=e[0],r=e[1];Er.forEach(n=>{if(n.test(t)||n.test(r))throw new Error(`['${t}', '${r}'] contains unusable interpolation symbol.`)})}}var Te=class s{static fromArray(e){return e?(xt("interpolation",e),new s(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new Te("{{","}}");var _e=class{constructor(e,t,r){this.strings=e,this.expressions=t,this.offsets=r}},Me=class{constructor(e,t,r){this.templateBindings=e,this.warnings=t,this.errors=r}},ve=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,r,n,i=F){this._checkNoInterpolation(e,r,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),v=1;t&&(v|=2);let f=new U(e,r,n,h,v,this.errors,0).parseChain();return new R(f,e,r,n,this.errors)}parseBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n);return new R(i,e,t,r,this.errors)}checkSimpleExpression(e){let t=new Fe;return e.visit(t),t.errors}parseSimpleBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new R(i,e,t,r,this.errors)}_reportError(e,t,r,n){this.errors.push(new G(e,t,r,n))}_parseBindingAst(e,t,r,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,r,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,r,n,i){let a=this._lexer.tokenize(t);return new U(t,r,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new I(n,n+e.length)})}parseInterpolation(e,t,r,n,i=F){let{strings:a,expressions:h,offsets:v}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let w=0;ww.text),f,e,t,r)}parseInterpolationExpression(e,t,r){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,r,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,r)}createInterpolationAst(e,t,r,n,i){let a=new P(0,r.length),h=new we(a,a.toAbsolute(i),e,t);return new R(h,r,n,i,this.errors)}splitInterpolation(e,t,r,n=F){let i=[],a=[],h=[],v=r?Ar(r):null,f=0,w=!1,k=!1,{start:C,end:y}=n;for(;f-1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${r}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,r){for(let n of this._forEachUnquotedChar(e,r)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let r=null,n=0;for(let i=t;i=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let r=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(r=t),e>r){let n=r;r=e,e=n}return new P(e,r)}sourceSpan(e,t){let r=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(r)||this.sourceSpanCache.set(r,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(r)}advance(){this.index++}withContext(e,t){this.context|=e;let r=t();return this.context^=e,r}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Ce?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parsePrefix(){if(this.next.type==d.Operator){let e=this.inputIndex,t=this.next.strValue,r;switch(t){case"+":return this.advance(),r=this.parsePrefix(),K.createPlus(this.span(e),this.sourceSpan(e),r);case"-":return this.advance(),r=this.parsePrefix(),K.createMinus(this.span(e),this.sourceSpan(e),r);case"!":return this.advance(),r=this.parsePrefix(),new Y(this.span(e),this.sourceSpan(e),r)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new ee(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Se(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new Z(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new L(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new E(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new E(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new E(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],r=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),v=this.sourceSpan(n);t.push(new B(h,v,v,new L(h,v),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new J(this.span(r),this.sourceSpan(r),e,t)}parseAccessMember(e,t,r){let n=this.inputIndex,i=this.withContext(he.Writable,()=>{let v=this.expectIdentifierOrKeyword()??"";return v.length===0&&this.error("Expected identifier for property access",e.span.end),v}),a=this.sourceSpan(n),h;if(r)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new E(this.span(t),this.sourceSpan(t))):h=new H(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new E(this.span(t),this.sourceSpan(t));let v=this.parseConditional();h=new Q(this.span(t),this.sourceSpan(t),a,e,i,v)}else h=new B(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,r){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),v=this.sourceSpan(t);return r?new re(h,v,e,i,a):new te(h,v,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,r=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new I(r,r+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index{this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof E&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(r)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new q(this.span(t),this.sourceSpan(t),e,n,i)}else return r?new z(this.span(t),this.sourceSpan(t),e,n):new j(this.span(t),this.sourceSpan(t),e,n);return new E(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let r=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new I(e.span.start,n);return t.push(new se(a,e,r)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Ce||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:r}=e.span,n=this.input.substring(t,r);return new R(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let r=new I(e.span.start,this.currentAbsoluteOffset);return new T(r,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),r=null;this.consumeOptionalOperator("=")&&(r=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new I(e,this.currentAbsoluteOffset);return new T(n,t,r)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new G(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),eh+v.length,0);r+=a,t+=a}e.set(r,t),n++}return e}var dt="angular-estree-parser",Ge="NgEstreeParser",Ue=0,De=[dt,Ue];function vt(){return new ve(new xe)}function Ve(s,e){let t=vt(),{astInput:r,comments:n}=Cr(s,t),{ast:i,errors:a}=e(r,t);return yt(a),{ast:i,comments:n}}function gt(s){return Ve(s,(e,t)=>t.parseBinding(e,...De))}function mt(s){return Ve(s,(e,t)=>t.parseAction(e,!1,...De))}function St(s){return Ve(s,(e,t)=>{let r=t.parseInterpolationExpression(e,...De);return r.ast=r.ast.expressions[0],r})}function wt(s){let e=vt(),{templateBindings:t,errors:r}=e.parseTemplateBindings(Ge,s,dt,Ue,Ue);return yt(r),t}function yt(s){if(s.length!==0){let[{message:e}]=s;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Cr(s,e){let t=e._commentStart(s);return t===null?{astInput:s,comments:[]}:{astInput:s.slice(0,t),comments:[{type:"Comment",value:s.slice(t+2),sourceSpan:{start:t,end:s.length}}]}}function Et(s){return s instanceof K?"Unary":s instanceof $?"Binary":s instanceof X?"BindingPipe":s instanceof te?"Call":s instanceof V?"Chain":s instanceof W?"Conditional":s instanceof E?"EmptyExpr":s instanceof L?"ImplicitReceiver":s instanceof j?"KeyedRead":s instanceof z?"SafeKeyedRead":s instanceof q?"KeyedWrite":s instanceof Z?"LiteralArray":s instanceof J?"LiteralMap":s instanceof A?"LiteralPrimitive":s instanceof ee?"NonNullAssert":s instanceof Y?"PrefixNot":s instanceof B?"PropertyRead":s instanceof Q?"PropertyWrite":s instanceof re?"SafeCall":s instanceof H?"SafePropertyRead":s.type}function ft({start:s,end:e},t){let r=s,n=e;for(;n!==r&&/\s/.test(t[n-1]);)n--;for(;r!==n&&/\s/.test(t[r]);)r++;return{start:r,end:n}}function Or({start:s,end:e},t){let r=s,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;r!==0&&/\s/.test(t[r-1]);)r--;return{start:r,end:n}}function Nr(s,e){return e[s.start-1]==="("&&e[s.end]===")"?{start:s.start-1,end:s.end+1}:s}function At(s,e,t){let r=0,n={start:s.start,end:s.end};for(;;){let i=Or(n,e),a=Nr(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,r++}return{hasParens:(t?r-1:r)!==0,outerSpan:ft(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:ft(s,e)}}function $t(s,e,t){let r=e;for(;!s.test(t[r]);)if(--r<0)throw new Error(`Cannot find front char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function Oe(s,e,t){let r=e;for(;!s.test(t[r]);)if(++r>=t.length)throw new Error(`Cannot find back char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function Ct(s){return s.slice(0,1).toLowerCase()+s.slice(1)}function Ot(s){return s.length===0?void 0:s[s.length-1]}var pe=(s,e,t=!1)=>{let r=Et(s);switch(r){case"Unary":{let{operator:c,expr:o}=s,x=n(o);return a("UnaryExpression",{prefix:!0,argument:x,operator:c},s.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:c,operation:o,right:x}=s,p=n(c),u=n(x);return a(o==="&&"||o==="||"||o==="??"?"LogicalExpression":"BinaryExpression",{left:p,right:u,operator:o},{start:y(p),end:m(u)},{hasParentParens:t})}case"BindingPipe":{let{exp:c,name:o,args:x}=s,p=n(c),u=f(/\S/,f(/\|/,m(p))+1),g=a("Identifier",{name:o},{start:u,end:u+o.length}),l=x.map(n);return a("NGPipeExpression",{left:p,right:g,arguments:l},{start:y(p),end:m(l.length===0?g:Ot(l))},{hasParentParens:t})}case"Chain":{let{expressions:c}=s;return a("NGChainedExpression",{expressions:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:c}=s;return a("CommentLine",{value:c},s.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:c,trueExp:o,falseExp:x}=s,p=n(c),u=n(o),g=n(x);return a("ConditionalExpression",{test:p,consequent:u,alternate:g},{start:y(p),end:m(g)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},s.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},s.sourceSpan,{hasParentParens:t});case"KeyedRead":case"SafeKeyedRead":{let c=r==="SafeKeyedRead",{key:o}=s,x=Object.prototype.hasOwnProperty.call(s,"receiver")?s.receiver:s.obj,p=n(o);return h(x,p,{computed:!0,optional:c},{end:s.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:c}=s;return a("ArrayExpression",{elements:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:c,values:o}=s,x=o.map(u=>n(u)),p=c.map(({key:u,quoted:g},l)=>{let O=x[l],ue=y(O),qe=m(O),Ie=f(/\S/,l===0?s.sourceSpan.start+1:f(/,/,m(x[l-1]))+1),bt=ue===Ie?qe:v(/\S/,v(/:/,ue-1)-1)+1,Xe={start:Ie,end:bt},ge=g?a("StringLiteral",{value:u},Xe):a("Identifier",{name:u},Xe),Bt=ge.end=c.sourceSpan.end||/^\s+$/.test(e.text.slice(c.sourceSpan.start,c.sourceSpan.end))}function k(c){return(c.type==="OptionalCallExpression"||c.type==="OptionalMemberExpression")&&!C(c)}function C(c){return c.extra&&c.extra.parenthesized}function y(c){return C(c)?c.extra.parenStart:c.start}function m(c){return C(c)?c.extra.parenEnd:c.end}};function Ne(s,e,t=!1,r=!1){if(!t){let{start:h,end:v}=s;return{start:h,end:v,loc:{start:e.locator.locationForIndex(h),end:e.locator.locationForIndex(v)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=At(s,e.text,r);return{start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function Nt(s,e){s.forEach(y);let[t]=s,{key:r}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?s.slice(1):s,i=[],a=null;for(let o=0;o({...O,...Ne({start:O.start,end:ue},e)}),g=O=>({...u(O,p.end),alias:p}),l=i.pop();if(l.type==="NGMicrosyntaxExpression")i.push(g(l));else if(l.type==="NGMicrosyntaxKeyedExpression"){let O=g(l.expression);i.push(u({...l,expression:O},O.end))}else throw new Error(`Unexpected type ${l.type}`)}else i.push(h(x,o));a=x}return f("NGMicrosyntax",{body:i},i.length===0?s[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function h(o,x){if(k(o)){let{key:p,value:u}=o;return u?x===0?f("NGMicrosyntaxExpression",{expression:v(u.ast),alias:null},u.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:w(p.source)},p.span),expression:f("NGMicrosyntaxExpression",{expression:v(u.ast),alias:null},u.sourceSpan)},{start:p.span.start,end:u.sourceSpan.end}):f("NGMicrosyntaxKey",{name:w(p.source)},p.span)}else{let{key:p,sourceSpan:u}=o;if(/^let\s$/.test(e.text.slice(u.start,u.start+4))){let{value:l}=o;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:p.source},p.span),value:l?f("NGMicrosyntaxKey",{name:l.source},l.span):null},{start:u.start,end:l?l.span.end:p.span.end})}else{let l=c(o);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:l.source},l.span),alias:f("NGMicrosyntaxKey",{name:p.source},p.span)},{start:l.span.start,end:p.span.end})}}}function v(o){return pe(o,e)}function f(o,x,p,u=!0){return{type:o,...Ne(p,e,u),...x}}function w(o){return Ct(o.slice(r.source.length))}function k(o){return o instanceof se}function C(o){return o instanceof T}function y(o){m(o.key.span),C(o)&&o.value&&m(o.value.span)}function m(o){if(e.text[o.start]!=='"'&&e.text[o.start]!=="'")return;let x=e.text[o.start],p=!1;for(let u=o.start+1;upe(h,n),a=i(t);return a.comments=r.map(h=>i(h)),a}function kt(s){return We(s,gt)}function It(s){return We(s,St)}function Qe(s){return We(s,mt)}function Rt(s){return Nt(wt(s),new le(s))}function kr(s){return Array.isArray(s)&&s.length>0}var Pt=kr;function He(s){var r;let e=s.range?s.range[0]:s.start,t=((r=s.declaration)==null?void 0:r.decorators)??s.decorators;return Pt(t)?Math.min(He(t[0]),e):e}function Lt(s){return s.range?s.range[1]:s.end}function ke(s){return{astFormat:"estree",parse(e){let t=s(e);return{type:"NGRoot",node:s===Qe&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:He,locEnd:Lt}}var Ir=ke(Qe),Rr=ke(kt),Pr=ke(It),Lr=ke(Rt);var fs=ze;export{fs as default,je as parsers};