mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
47 lines
48 KiB
JavaScript
47 lines
48 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.angular=e())}(this,(function(){"use strict";function t(e,s){const{ignoreDecorators:n}=s||{};if(!n){const s=e.declaration&&e.declaration.decorators||e.decorators;if(s&&s.length>0)return t(s[0])}return e.range?e.range[0]:e.start}function e(t){const s=t.range?t.range[1]:t.end;return t.typeAnnotation?Math.max(s,e(t.typeAnnotation)):s}var s={locStart:t,locEnd:e,composeLoc:function(s,n=s){const r=t(s);return[r,"number"==typeof n?r+n:e(n)]}};function n(t,e,s){return t(s={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&s.path)}},s.exports),s.exports}var r,i=n((function(t,e){var s=function(){function t(t){this.string=t;for(var e=[0],s=0;s<t.length;)switch(t[s]){case"\n":s+="\n".length,e.push(s);break;case"\r":"\n"===t[s+="\r".length]&&(s+="\n".length),e.push(s);break;default:s++}this.offsets=e}return t.prototype.locationForIndex=function(t){if(t<0||t>this.string.length)return null;for(var e=0,s=this.offsets;s[e+1]<=t;)e++;return{line:e,column:t-s[e]}},t.prototype.indexForLocation=function(t){var e=t.line,s=t.column;return e<0||e>=this.offsets.length||s<0||s>this.lengthOfLine(e)?null:this.offsets[e]+s},t.prototype.lengthOfLine=function(t){var e=this.offsets[t];return(t===this.offsets.length-1?this.string.length:this.offsets[t+1])-e},t}();e.__esModule=!0,e.default=s})),a=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.Context=class{constructor(t){this.text=t,this.locator=new s(this.text)}};class s{constructor(t){this._lineAndColumn=new i.default(t)}locationForIndex(t){const{line:e,column:s}=this._lineAndColumn.locationForIndex(t);return{line:e+1,column:s}}}}));
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
class o{constructor(t,e,s,n){this.input=e,this.errLocation=s,this.ctxLocation=n,this.message="Parser Error: ".concat(t," ").concat(s," [").concat(e,"] in ").concat(n)}}class c{constructor(t,e){this.start=t,this.end=e}toAbsolute(t){return new L(t+this.start,t+this.end)}}class h{constructor(t,e){this.span=t,this.sourceSpan=e}visit(t,e=null){return null}toString(){return"AST"}}class p extends h{constructor(t,e,s){super(t,e),this.nameSpan=s}}class u extends h{constructor(t,e,s,n,r){super(t,e),this.prefix=s,this.uninterpretedExpression=n,this.location=r}visit(t,e=null){return t.visitQuote(this,e)}toString(){return"Quote"}}class l extends h{visit(t,e=null){}}class d extends h{visit(t,e=null){return t.visitImplicitReceiver(this,e)}}class f extends h{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitChain(this,e)}}class v extends h{constructor(t,e,s,n,r){super(t,e),this.condition=s,this.trueExp=n,this.falseExp=r}visit(t,e=null){return t.visitConditional(this,e)}}class x extends p{constructor(t,e,s,n,r){super(t,e,s),this.receiver=n,this.name=r}visit(t,e=null){return t.visitPropertyRead(this,e)}}class g extends p{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.value=i}visit(t,e=null){return t.visitPropertyWrite(this,e)}}class m extends p{constructor(t,e,s,n,r){super(t,e,s),this.receiver=n,this.name=r}visit(t,e=null){return t.visitSafePropertyRead(this,e)}}class y extends h{constructor(t,e,s,n){super(t,e),this.obj=s,this.key=n}visit(t,e=null){return t.visitKeyedRead(this,e)}}class S extends h{constructor(t,e,s,n,r){super(t,e),this.obj=s,this.key=n,this.value=r}visit(t,e=null){return t.visitKeyedWrite(this,e)}}class w extends p{constructor(t,e,s,n,r,i){super(t,e,i),this.exp=s,this.name=n,this.args=r}visit(t,e=null){return t.visitPipe(this,e)}}class C extends h{constructor(t,e,s){super(t,e),this.value=s}visit(t,e=null){return t.visitLiteralPrimitive(this,e)}}class P extends h{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitLiteralArray(this,e)}}class E extends h{constructor(t,e,s,n){super(t,e),this.keys=s,this.values=n}visit(t,e=null){return t.visitLiteralMap(this,e)}}class A extends h{constructor(t,e,s,n){super(t,e),this.strings=s,this.expressions=n}visit(t,e=null){return t.visitInterpolation(this,e)}}class O extends h{constructor(t,e,s,n,r){super(t,e),this.operation=s,this.left=n,this.right=r}visit(t,e=null){return t.visitBinary(this,e)}}class b extends h{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitPrefixNot(this,e)}}class k extends h{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitNonNullAssert(this,e)}}class N extends p{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.args=i}visit(t,e=null){return t.visitMethodCall(this,e)}}class I extends p{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.args=i}visit(t,e=null){return t.visitSafeMethodCall(this,e)}}class _ extends h{constructor(t,e,s,n){super(t,e),this.target=s,this.args=n}visit(t,e=null){return t.visitFunctionCall(this,e)}}class L{constructor(t,e){this.start=t,this.end=e}}class K extends h{constructor(t,e,s,n,r){super(new c(0,null===e?0:e.length),new L(n,null===e?n:n+e.length)),this.ast=t,this.source=e,this.location=s,this.errors=r}visit(t,e=null){return t.visitASTWithSource?t.visitASTWithSource(this,e):this.ast.visit(t,e)}toString(){return"".concat(this.source," in ").concat(this.location)}}class M{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class T{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class B{visit(t,e){t.visit(this,e)}visitBinary(t,e){this.visit(t.left,e),this.visit(t.right,e)}visitChain(t,e){this.visitAll(t.expressions,e)}visitConditional(t,e){this.visit(t.condition,e),this.visit(t.trueExp,e),this.visit(t.falseExp,e)}visitPipe(t,e){this.visit(t.exp,e),this.visitAll(t.args,e)}visitFunctionCall(t,e){t.target&&this.visit(t.target,e),this.visitAll(t.args,e)}visitImplicitReceiver(t,e){}visitInterpolation(t,e){this.visitAll(t.expressions,e)}visitKeyedRead(t,e){this.visit(t.obj,e),this.visit(t.key,e)}visitKeyedWrite(t,e){this.visit(t.obj,e),this.visit(t.key,e),this.visit(t.value,e)}visitLiteralArray(t,e){this.visitAll(t.expressions,e)}visitLiteralMap(t,e){this.visitAll(t.values,e)}visitLiteralPrimitive(t,e){}visitMethodCall(t,e){this.visit(t.receiver,e),this.visitAll(t.args,e)}visitPrefixNot(t,e){this.visit(t.expression,e)}visitNonNullAssert(t,e){this.visit(t.expression,e)}visitPropertyRead(t,e){this.visit(t.receiver,e)}visitPropertyWrite(t,e){this.visit(t.receiver,e),this.visit(t.value,e)}visitSafePropertyRead(t,e){this.visit(t.receiver,e)}visitSafeMethodCall(t,e){this.visit(t.receiver,e),this.visitAll(t.args,e)}visitQuote(t,e){}visitAll(t,e){for(const s of t)this.visit(s,e)}}!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.LITERAL_ATTR=1]="LITERAL_ATTR",t[t.ANIMATION=2]="ANIMATION"}(r||(r={}));var R=Object.freeze({__proto__:null,ParserError:o,ParseSpan:c,AST:h,ASTWithName:p,Quote:u,EmptyExpr:l,ImplicitReceiver:d,Chain:f,Conditional:v,PropertyRead:x,PropertyWrite:g,SafePropertyRead:m,KeyedRead:y,KeyedWrite:S,BindingPipe:w,LiteralPrimitive:C,LiteralArray:P,LiteralMap:E,Interpolation:A,Binary:O,PrefixNot:b,NonNullAssert:k,MethodCall:N,SafeMethodCall:I,FunctionCall:_,AbsoluteSourceSpan:L,ASTWithSource:K,VariableBinding:M,ExpressionBinding:T,RecursiveAstVisitor:B,AstTransformer:class{visitImplicitReceiver(t,e){return t}visitInterpolation(t,e){return new A(t.span,t.sourceSpan,t.strings,this.visitAll(t.expressions))}visitLiteralPrimitive(t,e){return new C(t.span,t.sourceSpan,t.value)}visitPropertyRead(t,e){return new x(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name)}visitPropertyWrite(t,e){return new g(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,t.value.visit(this))}visitSafePropertyRead(t,e){return new m(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name)}visitMethodCall(t,e){return new N(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,this.visitAll(t.args))}visitSafeMethodCall(t,e){return new I(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,this.visitAll(t.args))}visitFunctionCall(t,e){return new _(t.span,t.sourceSpan,t.target.visit(this),this.visitAll(t.args))}visitLiteralArray(t,e){return new P(t.span,t.sourceSpan,this.visitAll(t.expressions))}visitLiteralMap(t,e){return new E(t.span,t.sourceSpan,t.keys,this.visitAll(t.values))}visitBinary(t,e){return new O(t.span,t.sourceSpan,t.operation,t.left.visit(this),t.right.visit(this))}visitPrefixNot(t,e){return new b(t.span,t.sourceSpan,t.expression.visit(this))}visitNonNullAssert(t,e){return new k(t.span,t.sourceSpan,t.expression.visit(this))}visitConditional(t,e){return new v(t.span,t.sourceSpan,t.condition.visit(this),t.trueExp.visit(this),t.falseExp.visit(this))}visitPipe(t,e){return new w(t.span,t.sourceSpan,t.exp.visit(this),t.name,this.visitAll(t.args),t.nameSpan)}visitKeyedRead(t,e){return new y(t.span,t.sourceSpan,t.obj.visit(this),t.key.visit(this))}visitKeyedWrite(t,e){return new S(t.span,t.sourceSpan,t.obj.visit(this),t.key.visit(this),t.value.visit(this))}visitAll(t){const e=[];for(let s=0;s<t.length;++s)e[s]=t[s].visit(this);return e}visitChain(t,e){return new f(t.span,t.sourceSpan,this.visitAll(t.expressions))}visitQuote(t,e){return new u(t.span,t.sourceSpan,t.prefix,t.uninterpretedExpression,t.location)}},AstMemoryEfficientTransformer:class{visitImplicitReceiver(t,e){return t}visitInterpolation(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new A(t.span,t.sourceSpan,t.strings,s):t}visitLiteralPrimitive(t,e){return t}visitPropertyRead(t,e){const s=t.receiver.visit(this);return s!==t.receiver?new x(t.span,t.sourceSpan,t.nameSpan,s,t.name):t}visitPropertyWrite(t,e){const s=t.receiver.visit(this),n=t.value.visit(this);return s!==t.receiver||n!==t.value?new g(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitSafePropertyRead(t,e){const s=t.receiver.visit(this);return s!==t.receiver?new m(t.span,t.sourceSpan,t.nameSpan,s,t.name):t}visitMethodCall(t,e){const s=t.receiver.visit(this),n=this.visitAll(t.args);return s!==t.receiver||n!==t.args?new N(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitSafeMethodCall(t,e){const s=t.receiver.visit(this),n=this.visitAll(t.args);return s!==t.receiver||n!==t.args?new I(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitFunctionCall(t,e){const s=t.target&&t.target.visit(this),n=this.visitAll(t.args);return s!==t.target||n!==t.args?new _(t.span,t.sourceSpan,s,n):t}visitLiteralArray(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new P(t.span,t.sourceSpan,s):t}visitLiteralMap(t,e){const s=this.visitAll(t.values);return s!==t.values?new E(t.span,t.sourceSpan,t.keys,s):t}visitBinary(t,e){const s=t.left.visit(this),n=t.right.visit(this);return s!==t.left||n!==t.right?new O(t.span,t.sourceSpan,t.operation,s,n):t}visitPrefixNot(t,e){const s=t.expression.visit(this);return s!==t.expression?new b(t.span,t.sourceSpan,s):t}visitNonNullAssert(t,e){const s=t.expression.visit(this);return s!==t.expression?new k(t.span,t.sourceSpan,s):t}visitConditional(t,e){const s=t.condition.visit(this),n=t.trueExp.visit(this),r=t.falseExp.visit(this);return s!==t.condition||n!==t.trueExp||r!==t.falseExp?new v(t.span,t.sourceSpan,s,n,r):t}visitPipe(t,e){const s=t.exp.visit(this),n=this.visitAll(t.args);return s!==t.exp||n!==t.args?new w(t.span,t.sourceSpan,s,t.name,n,t.nameSpan):t}visitKeyedRead(t,e){const s=t.obj.visit(this),n=t.key.visit(this);return s!==t.obj||n!==t.key?new y(t.span,t.sourceSpan,s,n):t}visitKeyedWrite(t,e){const s=t.obj.visit(this),n=t.key.visit(this),r=t.value.visit(this);return s!==t.obj||n!==t.key||r!==t.value?new S(t.span,t.sourceSpan,s,n,r):t}visitAll(t){const e=[];let s=!1;for(let n=0;n<t.length;++n){const r=t[n],i=r.visit(this);e[n]=i,s=s||i!==r}return s?e:t}visitChain(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new f(t.span,t.sourceSpan,s):t}visitQuote(t,e){return t}},ParsedProperty:class{constructor(t,e,s,n,i){this.name=t,this.expression=e,this.type=s,this.sourceSpan=n,this.valueSpan=i,this.isLiteral=this.type===r.LITERAL_ATTR,this.isAnimation=this.type===r.ANIMATION}},get ParsedPropertyType(){return r},ParsedEvent:class{constructor(t,e,s,n,r,i){this.name=t,this.targetOrPhase=e,this.type=s,this.handler=n,this.sourceSpan=r,this.handlerSpan=i}},ParsedVariable:class{constructor(t,e,s,n,r){this.name=t,this.value=e,this.sourceSpan=s,this.keySpan=n,this.valueSpan=r}},BoundElementProperty:class{constructor(t,e,s,n,r,i,a){this.name=t,this.type=e,this.securityContext=s,this.value=n,this.unit=r,this.sourceSpan=i,this.valueSpan=a}}});
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/function j(t){return 48<=t&&t<=57}
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
var F;!function(t){t[t.Character=0]="Character",t[t.Identifier=1]="Identifier",t[t.Keyword=2]="Keyword",t[t.String=3]="String",t[t.Operator=4]="Operator",t[t.Number=5]="Number",t[t.Error=6]="Error"}(F||(F={}));const G=["var","let","as","null","undefined","true","false","if","else","this"];class V{constructor(t,e,s,n,r){this.index=t,this.end=e,this.type=s,this.numValue=n,this.strValue=r}isCharacter(t){return this.type==F.Character&&this.numValue==t}isNumber(){return this.type==F.Number}isString(){return this.type==F.String}isOperator(t){return this.type==F.Operator&&this.strValue==t}isIdentifier(){return this.type==F.Identifier}isKeyword(){return this.type==F.Keyword}isKeywordLet(){return this.type==F.Keyword&&"let"==this.strValue}isKeywordAs(){return this.type==F.Keyword&&"as"==this.strValue}isKeywordNull(){return this.type==F.Keyword&&"null"==this.strValue}isKeywordUndefined(){return this.type==F.Keyword&&"undefined"==this.strValue}isKeywordTrue(){return this.type==F.Keyword&&"true"==this.strValue}isKeywordFalse(){return this.type==F.Keyword&&"false"==this.strValue}isKeywordThis(){return this.type==F.Keyword&&"this"==this.strValue}isError(){return this.type==F.Error}toNumber(){return this.type==F.Number?this.numValue:-1}toString(){switch(this.type){case F.Character:case F.Identifier:case F.Keyword:case F.Operator:case F.String:case F.Error:return this.strValue;case F.Number:return this.numValue.toString();default:return null}}}function W(t,e,s){return new V(t,e,F.Character,s,String.fromCharCode(s))}function U(t,e,s){return new V(t,e,F.Operator,0,s)}const Q=new V(-1,-1,F.Character,0,"");class D{constructor(t){this.input=t,this.peek=0,this.index=-1,this.length=t.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){const t=this.input,e=this.length;let s=this.peek,n=this.index;for(;s<=32;){if(++n>=e){s=0;break}s=t.charCodeAt(n)}if(this.peek=s,this.index=n,n>=e)return null;if(z(s))return this.scanIdentifier();if(j(s))return this.scanNumber(n);const r=n;switch(s){case 46:return this.advance(),j(this.peek)?this.scanNumber(r):W(r,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(r,s);case 39:case 34:return this.scanString();case 35:case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(r,String.fromCharCode(s));case 63:return this.scanComplexOperator(r,"?",46,".");case 60:case 62:return this.scanComplexOperator(r,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(r,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(r,"&",38,"&");case 124:return this.scanComplexOperator(r,"|",124,"|");case 160:for(;(i=this.peek)>=9&&i<=32||160==i;)this.advance();return this.scanToken()}var i;return this.advance(),this.error("Unexpected character [".concat(String.fromCharCode(s),"]"),0)}scanCharacter(t,e){return this.advance(),W(t,this.index,e)}scanOperator(t,e){return this.advance(),U(t,this.index,e)}scanComplexOperator(t,e,s,n,r,i){this.advance();let a=e;return this.peek==s&&(this.advance(),a+=n),null!=r&&this.peek==r&&(this.advance(),a+=i),U(t,this.index,a)}scanIdentifier(){const t=this.index;for(this.advance();$(this.peek);)this.advance();const e=this.input.substring(t,this.index);return G.indexOf(e)>-1?(s=t,n=this.index,r=e,new V(s,n,F.Keyword,0,r)):function(t,e,s){return new V(t,e,F.Identifier,0,s)}(t,this.index,e);var s,n,r}scanNumber(t){let e=this.index===t;for(this.advance();;){if(j(this.peek));else if(46==this.peek)e=!1;else{if(101!=(s=this.peek)&&69!=s)break;if(this.advance(),X(this.peek)&&this.advance(),!j(this.peek))return this.error("Invalid exponent",-1);e=!1}this.advance()}var s;const n=this.input.substring(t,this.index),r=e?function(t){const e=parseInt(t);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+t);return e}(n):parseFloat(n);return i=t,a=this.index,o=r,new V(i,a,F.Number,o,"");var i,a,o}scanString(){const t=this.index,e=this.peek;this.advance();let s="",n=this.index;const r=this.input;for(;this.peek!=e;)if(92==this.peek){let t;if(s+=r.substring(n,this.index),this.advance(),this.peek=this.peek,117==this.peek){const e=r.substring(this.index+1,this.index+5);if(!/^[0-9a-f]+$/i.test(e))return this.error("Invalid unicode escape [\\u".concat(e,"]"),0);t=parseInt(e,16);for(let t=0;t<5;t++)this.advance()}else t=H(this.peek),this.advance();s+=String.fromCharCode(t),n=this.index}else{if(0==this.peek)return this.error("Unterminated quote",0);this.advance()}const i=r.substring(n,this.index);return this.advance(),a=t,o=this.index,c=s+i,new V(a,o,F.String,0,c);var a,o,c}error(t,e){const s=this.index+e;return function(t,e,s){return new V(t,e,F.Error,0,s)}(s,this.index,"Lexer Error: ".concat(t," at column ").concat(s," in expression [").concat(this.input,"]"))}}function z(t){return 97<=t&&t<=122||65<=t&&t<=90||95==t||36==t}function q(t){if(0==t.length)return!1;const e=new D(t);if(!z(e.peek))return!1;for(e.advance();0!==e.peek;){if(!$(e.peek))return!1;e.advance()}return!0}function $(t){return function(t){return t>=97&&t<=122||t>=65&&t<=90}(t)||j(t)||95==t||36==t}function X(t){return 45==t||43==t}function J(t){return 39===t||34===t||96===t}function H(t){switch(t){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return t}}var Y=Object.freeze({__proto__:null,get TokenType(){return F},Lexer:class{tokenize(t){const e=new D(t),s=[];let n=e.scanToken();for(;null!=n;)s.push(n),n=e.scanToken();return s}},Token:V,EOF:Q,isIdentifier:q,isQuote:J});
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/const Z=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
class tt{constructor(t,e){this.start=t,this.end=e}static fromArray(t){return t?(function(t,e){if(!(null==e||Array.isArray(e)&&2==e.length))throw new Error("Expected '".concat(t,"' to be an array, [start, end]."));if(null!=e){const t=e[0],s=e[1];Z.forEach(e=>{if(e.test(t)||e.test(s))throw new Error("['".concat(t,"', '").concat(s,"'] contains unusable interpolation symbol."))})}}("interpolation",t),new tt(t[0],t[1])):et}}const et=new tt("{{","}}");function st(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self;
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/class nt{constructor(t,e,s){this.strings=t,this.expressions=e,this.offsets=s}}class rt{constructor(t,e,s){this.templateBindings=t,this.warnings=e,this.errors=s}}const it=ot(et);function at(t){return t===et?it:ot(t)}function ot(t){const e=st(t.start)+"([\\s\\S]*?)"+st(t.end);return new RegExp(e,"g")}class ct{constructor(t){this._lexer=t,this.errors=[],this.simpleExpressionChecker=pt}parseAction(t,e,s,n=et){this._checkNoInterpolation(t,e,n);const r=this._stripComments(t),i=this._lexer.tokenize(this._stripComments(t)),a=new ht(t,e,s,i,r.length,!0,this.errors,t.length-r.length).parseChain();return new K(a,t,e,s,this.errors)}parseBinding(t,e,s,n=et){const r=this._parseBindingAst(t,e,s,n);return new K(r,t,e,s,this.errors)}checkSimpleExpression(t){const e=new this.simpleExpressionChecker;return t.visit(e),e.errors}parseSimpleBinding(t,e,s,n=et){const r=this._parseBindingAst(t,e,s,n),i=this.checkSimpleExpression(r);return i.length>0&&this._reportError("Host binding expression cannot contain ".concat(i.join(" ")),t,e),new K(r,t,e,s,this.errors)}_reportError(t,e,s,n){this.errors.push(new o(t,e,s,n))}_parseBindingAst(t,e,s,n){const r=this._parseQuote(t,e,s);if(null!=r)return r;this._checkNoInterpolation(t,e,n);const i=this._stripComments(t),a=this._lexer.tokenize(i);return new ht(t,e,s,a,i.length,!1,this.errors,t.length-i.length).parseChain()}_parseQuote(t,e,s){if(null==t)return null;const n=t.indexOf(":");if(-1==n)return null;const r=t.substring(0,n).trim();if(!q(r))return null;const i=t.substring(n+1),a=new c(0,t.length);return new u(a,a.toAbsolute(s),r,i,e)}parseTemplateBindings(t,e,s,n,r){const i=this._lexer.tokenize(e);return new ht(e,s,r,i,e.length,!1,this.errors,0).parseTemplateBindings({source:t,span:new L(n,n+t.length)})}parseInterpolation(t,e,s,n=et){const r=this.splitInterpolation(t,e,n);if(null==r)return null;const i=[];for(let n=0;n<r.expressions.length;++n){const a=r.expressions[n],o=this._stripComments(a),c=this._lexer.tokenize(o),h=new ht(t,e,s,c,o.length,!1,this.errors,r.offsets[n]+(a.length-o.length)).parseChain();i.push(h)}const a=new c(0,null==t?0:t.length);return new K(new A(a,a.toAbsolute(s),r.strings,i),t,e,s,this.errors)}splitInterpolation(t,e,s=et){const n=at(s),r=t.split(n);if(r.length<=1)return null;const i=[],a=[],o=[];let c=0;for(let n=0;n<r.length;n++){const h=r[n];n%2==0?(i.push(h),c+=h.length):h.trim().length>0?(c+=s.start.length,a.push(h),o.push(c),c+=h.length+s.end.length):(this._reportError("Blank expressions are not allowed in interpolated strings",t,"at column ".concat(this._findInterpolationErrorColumn(r,n,s)," in"),e),a.push("$implicit"),o.push(c))}return new nt(i,a,o)}wrapLiteralPrimitive(t,e,s){const n=new c(0,null==t?0:t.length);return new K(new C(n,n.toAbsolute(s),t),t,e,s,this.errors)}_stripComments(t){const e=this._commentStart(t);return null!=e?t.substring(0,e).trim():t}_commentStart(t){let e=null;for(let s=0;s<t.length-1;s++){const n=t.charCodeAt(s),r=t.charCodeAt(s+1);if(47===n&&47==r&&null==e)return s;e===n?e=null:null==e&&J(n)&&(e=n)}return null}_checkNoInterpolation(t,e,s){const n=at(s),r=t.split(n);r.length>1&&this._reportError("Got interpolation (".concat(s.start).concat(s.end,") where expression was expected"),t,"at column ".concat(this._findInterpolationErrorColumn(r,1,s)," in"),e)}_findInterpolationErrorColumn(t,e,s){let n="";for(let r=0;r<e;r++)n+=r%2==0?t[r]:"".concat(s.start).concat(t[r]).concat(s.end);return n.length}}class ht{constructor(t,e,s,n,r,i,a,o){this.input=t,this.location=e,this.absoluteOffset=s,this.tokens=n,this.inputLength=r,this.parseAction=i,this.errors=a,this.offset=o,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.sourceSpanCache=new Map,this.index=0}peek(t){const e=this.index+t;return e<this.tokens.length?this.tokens[e]:Q}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){if(this.index>0){return this.peek(-1).end+this.offset}return 0===this.tokens.length?this.inputLength+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(t){return new c(t,this.currentEndIndex)}sourceSpan(t){const e="".concat(t,"@").concat(this.inputIndex);return this.sourceSpanCache.has(e)||this.sourceSpanCache.set(e,this.span(t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(e)}advance(){this.index++}consumeOptionalCharacter(t){return!!this.next.isCharacter(t)&&(this.advance(),!0)}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(t){this.consumeOptionalCharacter(t)||this.error("Missing expected ".concat(String.fromCharCode(t)))}consumeOptionalOperator(t){return!!this.next.isOperator(t)&&(this.advance(),!0)}expectOperator(t){this.consumeOptionalOperator(t)||this.error("Missing expected operator ".concat(t))}expectIdentifierOrKeyword(){const t=this.next;return t.isIdentifier()||t.isKeyword()?(this.advance(),t.toString()):(this.error("Unexpected token ".concat(t,", expected identifier or keyword")),"")}expectIdentifierOrKeywordOrString(){const t=this.next;return t.isIdentifier()||t.isKeyword()||t.isString()?(this.advance(),t.toString()):(this.error("Unexpected token ".concat(t,", expected identifier, keyword, or string")),"")}parseChain(){const t=[],e=this.inputIndex;for(;this.index<this.tokens.length;){const e=this.parsePipe();if(t.push(e),this.consumeOptionalCharacter(59))for(this.parseAction||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else this.index<this.tokens.length&&this.error("Unexpected token '".concat(this.next,"'"))}return 0==t.length?new l(this.span(e),this.sourceSpan(e)):1==t.length?t[0]:new f(this.span(e),this.sourceSpan(e),t)}parsePipe(){let t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseAction&&this.error("Cannot have a pipe in an action expression");do{const e=this.inputIndex,s=this.expectIdentifierOrKeyword(),n=this.sourceSpan(e),r=[];for(;this.consumeOptionalCharacter(58);)r.push(this.parseExpression());const{start:i}=t.span;t=new w(this.span(i),this.sourceSpan(i),t,s,r,n)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){const t=this.inputIndex,e=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){const s=this.parsePipe();let n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{const e=this.inputIndex,s=this.input.substring(t,e);this.error("Conditional expression ".concat(s," requires all 3 expressions")),n=new l(this.span(t),this.sourceSpan(t))}return new v(this.span(t),this.sourceSpan(t),e,s,n)}return e}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){const e=this.parseLogicalAnd(),{start:s}=t.span;t=new O(this.span(s),this.sourceSpan(s),"||",t,e)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.consumeOptionalOperator("&&");){const e=this.parseEquality(),{start:s}=t.span;t=new O(this.span(s),this.sourceSpan(s),"&&",t,e)}return t}parseEquality(){let t=this.parseRelational();for(;this.next.type==F.Operator;){const e=this.next.strValue;switch(e){case"==":case"===":case"!=":case"!==":this.advance();const s=this.parseRelational(),{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseRelational(){let t=this.parseAdditive();for(;this.next.type==F.Operator;){const e=this.next.strValue;switch(e){case"<":case">":case"<=":case">=":this.advance();const s=this.parseAdditive(),{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.next.type==F.Operator;){const e=this.next.strValue;switch(e){case"+":case"-":this.advance();let s=this.parseMultiplicative();const{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseMultiplicative(){let t=this.parsePrefix();for(;this.next.type==F.Operator;){const e=this.next.strValue;switch(e){case"*":case"%":case"/":this.advance();let s=this.parsePrefix();const{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parsePrefix(){if(this.next.type==F.Operator){const t=this.inputIndex,e=this.next.strValue,s=new c(t,t),n=s.toAbsolute(this.absoluteOffset);let r;switch(e){case"+":return this.advance(),r=this.parsePrefix(),new O(this.span(t),this.sourceSpan(t),"-",r,new C(s,n,0));case"-":return this.advance(),r=this.parsePrefix(),new O(this.span(t),this.sourceSpan(t),e,new C(s,n,0),r);case"!":return this.advance(),r=this.parsePrefix(),new b(this.span(t),this.sourceSpan(t),r)}}return this.parseCallChain()}parseCallChain(){let t=this.parsePrimary();const e=t.span.start;for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMemberOrMethodCall(t,!1);else if(this.consumeOptionalOperator("?."))t=this.parseAccessMemberOrMethodCall(t,!0);else if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;const s=this.parsePipe();if(this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("=")){const n=this.parseConditional();t=new S(this.span(e),this.sourceSpan(e),t,s,n)}else t=new y(this.span(e),this.sourceSpan(e),t,s)}else if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const s=this.parseCallArguments();this.rparensExpected--,this.expectCharacter(41),t=new _(this.span(e),this.sourceSpan(e),t,s)}else{if(!this.consumeOptionalOperator("!"))return t;t=new k(this.span(e),this.sourceSpan(e),t)}}parsePrimary(){const t=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}if(this.next.isKeywordNull())return this.advance(),new C(this.span(t),this.sourceSpan(t),null);if(this.next.isKeywordUndefined())return this.advance(),new C(this.span(t),this.sourceSpan(t),void 0);if(this.next.isKeywordTrue())return this.advance(),new C(this.span(t),this.sourceSpan(t),!0);if(this.next.isKeywordFalse())return this.advance(),new C(this.span(t),this.sourceSpan(t),!1);if(this.next.isKeywordThis())return this.advance(),new d(this.span(t),this.sourceSpan(t));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;const e=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new P(this.span(t),this.sourceSpan(t),e)}if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(new d(this.span(t),this.sourceSpan(t)),!1);if(this.next.isNumber()){const e=this.next.toNumber();return this.advance(),new C(this.span(t),this.sourceSpan(t),e)}if(this.next.isString()){const e=this.next.toString();return this.advance(),new C(this.span(t),this.sourceSpan(t),e)}return this.index>=this.tokens.length?(this.error("Unexpected end of expression: ".concat(this.input)),new l(this.span(t),this.sourceSpan(t))):(this.error("Unexpected token ".concat(this.next)),new l(this.span(t),this.sourceSpan(t)))}parseExpressionList(t){const e=[];if(!this.next.isCharacter(t))do{e.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return e}parseLiteralMap(){const t=[],e=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{const s=this.next.isString(),n=this.expectIdentifierOrKeywordOrString();t.push({key:n,quoted:s}),this.expectCharacter(58),e.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new E(this.span(s),this.sourceSpan(s),t,e)}parseAccessMemberOrMethodCall(t,e=!1){const s=t.span.start,n=this.inputIndex,r=this.expectIdentifierOrKeyword(),i=this.sourceSpan(n);if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const n=this.parseCallArguments();this.expectCharacter(41),this.rparensExpected--;const a=this.span(s),o=this.sourceSpan(s);return e?new I(a,o,i,t,r,n):new N(a,o,i,t,r,n)}if(e)return this.consumeOptionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),new l(this.span(s),this.sourceSpan(s))):new m(this.span(s),this.sourceSpan(s),i,t,r);if(this.consumeOptionalOperator("=")){if(!this.parseAction)return this.error("Bindings cannot contain assignments"),new l(this.span(s),this.sourceSpan(s));const e=this.parseConditional();return new g(this.span(s),this.sourceSpan(s),i,t,r,e)}return new x(this.span(s),this.sourceSpan(s),i,t,r)}parseCallArguments(){if(this.next.isCharacter(41))return[];const t=[];do{t.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return t}expectTemplateBindingKey(){let t="",e=!1;const s=this.currentAbsoluteOffset;do{t+=this.expectIdentifierOrKeywordOrString(),e=this.consumeOptionalOperator("-"),e&&(t+="-")}while(e);return{source:t,span:new L(s,s+t.length)}}parseTemplateBindings(t){const e=[];for(e.push(...this.parseDirectiveKeywordBindings(t));this.index<this.tokens.length;){const s=this.parseLetBinding();if(s)e.push(s);else{const s=this.expectTemplateBindingKey(),n=this.parseAsBinding(s);n?e.push(n):(s.source=t.source+s.source[0].toUpperCase()+s.source.substring(1),e.push(...this.parseDirectiveKeywordBindings(s)))}this.consumeStatementTerminator()}return new rt(e,[],this.errors)}parseDirectiveKeywordBindings(t){const e=[];this.consumeOptionalCharacter(58);const s=this.getDirectiveBoundTarget();let n=this.currentAbsoluteOffset;const r=this.parseAsBinding(t);r||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);const i=new L(t.span.start,n);return e.push(new T(i,t,s)),r&&e.push(r),e}getDirectiveBoundTarget(){if(this.next===Q||this.peekKeywordAs()||this.peekKeywordLet())return null;const t=this.parsePipe(),{start:e,end:s}=t.span,n=this.input.substring(e,s);return new K(t,n,this.location,this.absoluteOffset+e,this.errors)}parseAsBinding(t){if(!this.peekKeywordAs())return null;this.advance();const e=this.expectTemplateBindingKey();this.consumeStatementTerminator();const s=new L(t.span.start,this.currentAbsoluteOffset);return new M(s,e,t)}parseLetBinding(){if(!this.peekKeywordLet())return null;const t=this.currentAbsoluteOffset;this.advance();const e=this.expectTemplateBindingKey();let s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();const n=new L(t,this.currentAbsoluteOffset);return new M(n,e,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(t,e=null){this.errors.push(new o(t,this.input,this.locationText(e),this.location)),this.skip()}locationText(t=null){return null==t&&(t=this.index),t<this.tokens.length?"at column ".concat(this.tokens[t].index+1," in"):"at the end of the expression"}skip(){let t=this.next;for(;this.index<this.tokens.length&&!t.isCharacter(59)&&(this.rparensExpected<=0||!t.isCharacter(41))&&(this.rbracesExpected<=0||!t.isCharacter(125))&&(this.rbracketsExpected<=0||!t.isCharacter(93));)this.next.isError()&&this.errors.push(new o(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),t=this.next}}class pt{constructor(){this.errors=[]}visitImplicitReceiver(t,e){}visitInterpolation(t,e){}visitLiteralPrimitive(t,e){}visitPropertyRead(t,e){}visitPropertyWrite(t,e){}visitSafePropertyRead(t,e){}visitMethodCall(t,e){}visitSafeMethodCall(t,e){}visitFunctionCall(t,e){}visitLiteralArray(t,e){this.visitAll(t.expressions,e)}visitLiteralMap(t,e){this.visitAll(t.values,e)}visitBinary(t,e){}visitPrefixNot(t,e){}visitNonNullAssert(t,e){}visitConditional(t,e){}visitPipe(t,e){this.errors.push("pipes")}visitKeyedRead(t,e){}visitKeyedWrite(t,e){}visitAll(t,e){return t.map(t=>t.visit(this,e))}visitChain(t,e){}visitQuote(t,e){}}class ut extends B{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}}var lt=Object.freeze({__proto__:null,SplitInterpolation:nt,TemplateBindingParseResult:rt,Parser:ct,IvyParser:class extends ct{constructor(){super(...arguments),this.simpleExpressionChecker=ut}},_ParseAST:ht}),dt=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX="NgEstreeParser";const s=["angular-estree-parser",0];function n(){return new lt.Parser(new Y.Lexer)}function r(t,e){const s=n(),{astInput:r,comments:o}=a(t,s),{ast:c,errors:h}=e(r,s);return i(h),{ast:c,comments:o}}function i(t){if(0!==t.length){const[{message:e}]=t;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function a(t,e){const s=e._commentStart(t);return null===s?{astInput:t,comments:[]}:{astInput:t.slice(0,s),comments:[{type:"Comment",value:t.slice(s+"//".length),span:{start:s,end:t.length}}]}}function o({start:t,end:e},s){let n=t,r=e;for(;r!==n&&/\s/.test(s[r-1]);)r--;for(;n!==r&&/\s/.test(s[n]);)n++;return{start:n,end:r}}function c({start:t,end:e},s){let n=t,r=e;for(;r!==s.length&&/\s/.test(s[r]);)r++;for(;0!==n&&/\s/.test(s[n-1]);)n--;return{start:n,end:r}}function h(t,e){return"("===e[t.start-1]&&")"===e[t.end]?{start:t.start-1,end:t.end+1}:t}e.parseNgBinding=function(t){return r(t,(t,e)=>e.parseBinding(t,...s))},e.parseNgSimpleBinding=function(t){return r(t,(t,e)=>e.parseSimpleBinding(t,...s))},e.parseNgAction=function(t){return r(t,(t,e)=>e.parseAction(t,...s))},e.parseNgTemplateBindings=function(t){const s=n(),{templateBindings:r,errors:a}=s.parseTemplateBindings(e.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX,t,"angular-estree-parser",0,0);return i(a),r},e.parseNgInterpolation=function(t){const e=n(),{astInput:r,comments:o}=a(t,e),{ast:c,errors:h}=e.parseInterpolation("{{"+r+"}}",...s);i(h);const p=c.expressions[0];return function t(e,s){if(!e||"object"!=typeof e)return;if(Array.isArray(e))return e.forEach(e=>t(e,s));for(const n of Object.keys(e)){const r=e[n];"span"===n?s(r):t(r,s)}}(p,t=>{t.start-="{{".length,t.end-="{{".length}),{ast:p,comments:o}},e.getNgType=function(t){return t instanceof R.Binary?"Binary":t instanceof R.BindingPipe?"BindingPipe":t instanceof R.Chain?"Chain":t instanceof R.Conditional?"Conditional":t instanceof R.EmptyExpr?"EmptyExpr":t instanceof R.FunctionCall?"FunctionCall":t instanceof R.ImplicitReceiver?"ImplicitReceiver":t instanceof R.KeyedRead?"KeyedRead":t instanceof R.KeyedWrite?"KeyedWrite":t instanceof R.LiteralArray?"LiteralArray":t instanceof R.LiteralMap?"LiteralMap":t instanceof R.LiteralPrimitive?"LiteralPrimitive":t instanceof R.MethodCall?"MethodCall":t instanceof R.NonNullAssert?"NonNullAssert":t instanceof R.PrefixNot?"PrefixNot":t instanceof R.PropertyRead?"PropertyRead":t instanceof R.PropertyWrite?"PropertyWrite":t instanceof R.Quote?"Quote":t instanceof R.SafeMethodCall?"SafeMethodCall":t instanceof R.SafePropertyRead?"SafePropertyRead":t.type},e.fitSpans=function(t,e,s){let n=0;const r={start:t.start,end:t.end};for(;;){const t=c(r,e),s=h(t,e);if(t.start===s.start&&t.end===s.end)break;r.start=s.start,r.end=s.end,n++}return{hasParens:0!==(s?n-1:n),outerSpan:o(s?{start:r.start+1,end:r.end-1}:r,e),innerSpan:o(t,e)}},e.findFrontChar=function(t,e,s){let n=e;for(;!t.test(s[n]);)if(--n<0)throw new Error("Cannot find front char ".concat(t," from index ").concat(e," in ").concat(JSON.stringify(s)));return n},e.findBackChar=function(t,e,s){let n=e;for(;!t.test(s[n]);)if(++n>=s.length)throw new Error("Cannot find back char ".concat(t," from index ").concat(e," in ").concat(JSON.stringify(s)));return n},e.toLowerCamelCase=function(t){return t.slice(0,1).toLowerCase()+t.slice(1)},e.getLast=function(t){return 0===t.length?void 0:t[t.length-1]}})),ft=n((function(t,e){function s(t,e,s=!1,n=!1){if(!s){const{start:s,end:n}=t;return{start:s,end:n,loc:{start:e.locator.locationForIndex(s),end:e.locator.locationForIndex(n)}}}const{outerSpan:r,innerSpan:i,hasParens:a}=dt.fitSpans(t,e.text,n);return Object.assign({start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)}},a&&{extra:{parenthesized:!0,parenStart:r.start,parenEnd:r.end}})}Object.defineProperty(e,"__esModule",{value:!0}),e.transform=(t,n,r=!1)=>{const i=dt.getNgType(t);switch(i){case"Binary":{const{left:e,operation:s,right:n}=t,i=n.span.start===n.span.end,o=e.span.start===e.span.end;if(i||o){const s=e.span.start===e.span.end?a(n):a(e);return c("UnaryExpression",{prefix:!0,argument:s,operator:i?"+":"-"},{start:t.span.start,end:x(s)},{hasParentParens:r})}const h=a(e),p=a(n);return c("&&"===s||"||"===s?"LogicalExpression":"BinaryExpression",{left:h,right:p,operator:s},{start:v(h),end:x(p)},{hasParentParens:r})}case"BindingPipe":{const{exp:e,name:s,args:n}=t,i=a(e),o=u(/\S/,u(/\|/,x(i))+1),h=c("Identifier",{name:s},{start:o,end:o+s.length}),p=n.map(a);return c("NGPipeExpression",{left:i,right:h,arguments:p},{start:v(i),end:x(0===p.length?h:dt.getLast(p))},{hasParentParens:r})}case"Chain":{const{expressions:e}=t;return c("NGChainedExpression",{expressions:e.map(a)},t.span,{hasParentParens:r})}case"Comment":{const{value:e}=t;return c("CommentLine",{value:e},t.span,{processSpan:!1})}case"Conditional":{const{condition:e,trueExp:s,falseExp:n}=t,i=a(e),o=a(s),h=a(n);return c("ConditionalExpression",{test:i,consequent:o,alternate:h},{start:v(i),end:x(h)},{hasParentParens:r})}case"EmptyExpr":return c("NGEmptyExpression",{},t.span,{hasParentParens:r});case"FunctionCall":{const{target:e,args:s}=t,n=1===s.length?[o(s[0])]:s.map(a),i=a(e);return c("CallExpression",{callee:i,arguments:n},{start:v(i),end:t.span.end},{hasParentParens:r})}case"ImplicitReceiver":return c("ThisExpression",{},t.span,{hasParentParens:r});case"KeyedRead":{const{obj:e,key:s}=t;return h(e,a(s),{computed:!0,optional:!1},{end:t.span.end,hasParentParens:r})}case"LiteralArray":{const{expressions:e}=t;return c("ArrayExpression",{elements:e.map(a)},t.span,{hasParentParens:r})}case"LiteralMap":{const{keys:e,values:s}=t,n=s.map(t=>a(t)),i=e.map(({key:e,quoted:s},r)=>{const i=n[r],a={start:u(/\S/,0===r?t.span.start+1:u(/,/,x(n[r-1]))+1),end:p(/\S/,p(/:/,v(i)-1)-1)+1},o=s?c("StringLiteral",{value:e},a):c("Identifier",{name:e},a);return c("ObjectProperty",{key:o,value:i,method:!1,shorthand:!1,computed:!1},{start:v(o),end:x(i)})});return c("ObjectExpression",{properties:i},t.span,{hasParentParens:r})}case"LiteralPrimitive":{const{value:e}=t;switch(typeof e){case"boolean":return c("BooleanLiteral",{value:e},t.span,{hasParentParens:r});case"number":return c("NumericLiteral",{value:e},t.span,{hasParentParens:r});case"object":return c("NullLiteral",{},t.span,{hasParentParens:r});case"string":return c("StringLiteral",{value:e},t.span,{hasParentParens:r});case"undefined":return c("Identifier",{name:"undefined"},t.span,{hasParentParens:r});default:throw new Error("Unexpected LiteralPrimitive value type ".concat(typeof e))}}case"MethodCall":case"SafeMethodCall":{const e="SafeMethodCall"===i,{receiver:s,name:n,args:u}=t,l=1===u.length?[o(u[0])]:u.map(a),f=p(/\S/,p(/\(/,(0===l.length?p(/\)/,t.span.end-1):v(l[0]))-1)-1)+1,x=h(s,c("Identifier",{name:n},{start:f-n.length,end:f}),{computed:!1,optional:e}),g=d(x);return c(e||g?"OptionalCallExpression":"CallExpression",{callee:x,arguments:l},{start:v(x),end:t.span.end},{hasParentParens:r})}case"NonNullAssert":{const{expression:e}=t,s=a(e);return c("TSNonNullExpression",{expression:s},{start:v(s),end:t.span.end},{hasParentParens:r})}case"PrefixNot":{const{expression:e}=t,s=a(e);return c("UnaryExpression",{prefix:!0,operator:"!",argument:s},{start:t.span.start,end:x(s)},{hasParentParens:r})}case"PropertyRead":case"SafePropertyRead":{const e="SafePropertyRead"===i,{receiver:s,name:n}=t,a=p(/\S/,t.span.end-1)+1;return h(s,c("Identifier",{name:n},{start:a-n.length,end:a},l(s)?{hasParentParens:r}:{}),{computed:!1,optional:e},{hasParentParens:r})}case"KeyedWrite":{const{obj:e,key:s,value:n}=t,i=a(s),o=a(n),p=h(e,i,{computed:!0,optional:!1},{end:u(/\]/,x(i))+1});return c("AssignmentExpression",{left:p,operator:"=",right:o},{start:v(p),end:x(o)},{hasParentParens:r})}case"PropertyWrite":{const{receiver:e,name:s,value:n}=t,i=a(n),o=p(/\S/,p(/=/,v(i)-1)-1)+1,u=h(e,c("Identifier",{name:s},{start:o-s.length,end:o}),{computed:!1,optional:!1});return c("AssignmentExpression",{left:u,operator:"=",right:i},{start:v(u),end:x(i)},{hasParentParens:r})}case"Quote":{const{prefix:e,uninterpretedExpression:s}=t;return c("NGQuotedExpression",{prefix:e,value:s},t.span,{hasParentParens:r})}default:throw new Error("Unexpected node ".concat(i))}function a(t){return e.transform(t,n)}function o(t){return e.transform(t,n,!0)}function c(t,e,r,{processSpan:i=!0,hasParentParens:a=!1}={}){const o=Object.assign(Object.assign({type:t},s(r,n,i,a)),e);switch(t){case"Identifier":{const t=o;t.loc.identifierName=t.name;break}case"NumericLiteral":{const t=o;t.extra=Object.assign(Object.assign({},t.extra),{raw:n.text.slice(t.start,t.end),rawValue:t.value});break}case"StringLiteral":{const t=o;t.extra=Object.assign(Object.assign({},t.extra),{raw:n.text.slice(t.start,t.end),rawValue:t.value});break}}return o}function h(t,e,s,{end:n=x(e),hasParentParens:r=!1}={}){if(l(t))return e;const i=a(t),o=d(i);return c(s.optional||o?"OptionalMemberExpression":"MemberExpression",Object.assign({object:i,property:e,computed:s.computed},s.optional?{optional:!0}:o?{optional:!1}:null),{start:v(i),end:n},{hasParentParens:r})}function p(t,e){return dt.findFrontChar(t,e,n.text)}function u(t,e){return dt.findBackChar(t,e,n.text)}function l(t){return t.span.start>=t.span.end}function d(t){return("OptionalCallExpression"===t.type||"OptionalMemberExpression"===t.type)&&!f(t)}function f(t){return t.extra&&t.extra.parenthesized}function v(t){return f(t)?t.extra.parenStart:t.start}function x(t){return f(t)?t.extra.parenEnd:t.end}},e.transformSpan=s})),vt=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.transformTemplateBindings=function(t,e){t.forEach((function(t){d(t.key.span),l(t)&&t.value&&d(t.value.span)}));const[s]=t,{key:n}=s,r=0===e.text.slice(s.sourceSpan.start,s.sourceSpan.end).trim().length?t.slice(1):t,i=[];let a=null;for(let t=0;t<r.length;t++){const s=r[t];if(a&&u(a)&&l(s)&&s.value&&s.value.source===a.key.source){const t=h("NGMicrosyntaxKey",{name:s.key.source},s.key.span),n=(t,s)=>Object.assign(Object.assign({},t),ft.transformSpan({start:t.start,end:s},e)),r=e=>Object.assign(Object.assign({},n(e,t.end)),{alias:t}),a=i.pop();if("NGMicrosyntaxExpression"===a.type)i.push(r(a));else{if("NGMicrosyntaxKeyedExpression"!==a.type)throw new Error("Unexpected type ".concat(a.type));{const t=r(a.expression);i.push(n(Object.assign(Object.assign({},a),{expression:t}),t.end))}}}else i.push(o(s,t));a=s}return h("NGMicrosyntax",{body:i},0===i.length?t[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function o(t,s){if(u(t)){const{key:e,value:n}=t;return n?0===s?h("NGMicrosyntaxExpression",{expression:c(n.ast),alias:null},n.sourceSpan):h("NGMicrosyntaxKeyedExpression",{key:h("NGMicrosyntaxKey",{name:p(e.source)},e.span),expression:h("NGMicrosyntaxExpression",{expression:c(n.ast),alias:null},n.sourceSpan)},{start:e.span.start,end:n.sourceSpan.end}):h("NGMicrosyntaxKey",{name:p(e.source)},e.span)}{const{key:s,sourceSpan:n}=t;if(/^let\s$/.test(e.text.slice(n.start,n.start+4))){const{value:e}=t;return h("NGMicrosyntaxLet",{key:h("NGMicrosyntaxKey",{name:s.source},s.span),value:e?h("NGMicrosyntaxKey",{name:e.source},e.span):null},{start:n.start,end:e?e.span.end:s.span.end})}{const n=function(t){if(!t.value||t.value.source!==dt.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX)return t.value;const s=dt.findBackChar(/\S/,t.sourceSpan.start,e.text);return{source:"$implicit",span:{start:s,end:s}}}(t);return h("NGMicrosyntaxAs",{key:h("NGMicrosyntaxKey",{name:n.source},n.span),alias:h("NGMicrosyntaxKey",{name:s.source},s.span)},{start:n.span.start,end:s.span.end})}}}function c(t){return ft.transform(t,e)}function h(t,s,n,r=!0){return Object.assign(Object.assign({type:t},ft.transformSpan(n,e,r)),s)}function p(t){return dt.toLowerCamelCase(t.slice(n.source.length))}function u(t){return t instanceof R.ExpressionBinding}function l(t){return t instanceof R.VariableBinding}function d(t){if('"'!==e.text[t.start]&&"'"!==e.text[t.start])return;const s=e.text[t.start];let n=!1;for(let r=t.start+1;r<e.text.length;r++)switch(e.text[r]){case s:if(!n)return void(t.end=r+1);default:n=!1;break;case"\\":n=!n}}}})),xt=n((function(t,e){function s(t,e){const{ast:s,comments:n}=e(t),r=new a.Context(t),i=t=>ft.transform(t,r),o=i(s);return o.comments=n.map(i),o}Object.defineProperty(e,"__esModule",{value:!0}),e.parseBinding=function(t){return s(t,dt.parseNgBinding)},e.parseSimpleBinding=function(t){return s(t,dt.parseNgSimpleBinding)},e.parseInterpolation=function(t){return s(t,dt.parseNgInterpolation)},e.parseAction=function(t){return s(t,dt.parseNgAction)},e.parseTemplateBindings=function(t){return vt.transformTemplateBindings(dt.parseNgTemplateBindings(t),new a.Context(t))}}));const{locStart:gt,locEnd:mt}=s;function yt(t){return{astFormat:"estree",parse:(e,s,n)=>{const r=t(e,xt);return{type:"NGRoot",node:"__ng_action"===n.parser&&"NGChainedExpression"!==r.type?Object.assign({},r,{type:"NGChainedExpression",expressions:[r]}):r}},locStart:gt,locEnd:mt}}return{parsers:{__ng_action:yt((t,e)=>e.parseAction(t)),__ng_binding:yt((t,e)=>e.parseBinding(t)),__ng_interpolation:yt((t,e)=>e.parseInterpolation(t)),__ng_directive:yt((t,e)=>e.parseTemplateBindings(t))}}}));
|