!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.angular={}))}(this,(function(e){"use strict";var t=function(e){return e.length>0?e[e.length-1]:null};var n={locStart:function e(t,n){return!(n=n||{}).ignoreDecorators&&t.declaration&&t.declaration.decorators&&t.declaration.decorators.length>0?e(t.declaration.decorators[0]):!n.ignoreDecorators&&t.decorators&&t.decorators.length>0?e(t.decorators[0]):t.__location?t.__location.startOffset:t.range?t.range[0]:"number"==typeof t.start?t.start:t.loc?t.loc.start:null},locEnd:function e(n){var i=n.nodes&&t(n.nodes);if(i&&n.source&&!n.source.end&&(n=i),n.__location)return n.__location.endOffset;var r=n.range?n.range[1]:"number"==typeof n.end?n.end:null;return n.typeAnnotation?Math.max(r,e(n.typeAnnotation)):n.loc&&!r?n.loc.end:r}};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t){return e(t={exports:{}},t.exports),t.exports}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;nthis.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;return{line:t,column:e-n[t]}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length?null:n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();t.__esModule=!0,t.default=r}));i(f);var d=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.Context=function e(t){a(this,e),this.text=t,this.locator=new n(this.text)};var n=function(){function e(t){a(this,e),this._lineAndColumn=new f.default(t)}return u(e,[{key:"locationForIndex",value:function(e){var t=this._lineAndColumn.locationForIndex(e);return{line:t.line+1,column:t.column}}}]),e}()}));i(d);d.Context; /** * @license * Copyright Google Inc. 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 y=function e(t,n,i,r){a(this,e),this.input=n,this.errLocation=i,this.ctxLocation=r,this.message="Parser Error: ".concat(t," ").concat(i," [").concat(n,"] in ").concat(r)},x=function e(t,n){a(this,e),this.start=t,this.end=n},g=function(){function e(t){a(this,e),this.span=t}return u(e,[{key:"visit",value:function(e){return null}},{key:"toString",value:function(){return"AST"}}]),e}(),k=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).prefix=n,s.uninterpretedExpression=i,s.location=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitQuote(this,t)}},{key:"toString",value:function(){return"Quote"}}]),t}(g),m=function(e){function t(){return a(this,t),p(this,c(t).apply(this,arguments))}return l(t,e),u(t,[{key:"visit",value:function(e){}}]),t}(g),w=function(e){function t(){return a(this,t),p(this,c(t).apply(this,arguments))}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitImplicitReceiver(this,t)}}]),t}(g),C=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expressions=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitChain(this,t)}}]),t}(g),P=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).condition=n,s.trueExp=i,s.falseExp=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitConditional(this,t)}}]),t}(g),b=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).receiver=n,r.name=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyRead(this,t)}}]),t}(g),A=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).receiver=n,s.name=i,s.value=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyWrite(this,t)}}]),t}(g),E=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).receiver=n,r.name=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitSafePropertyRead(this,t)}}]),t}(g),S=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).obj=n,r.key=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedRead(this,t)}}]),t}(g),N=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).obj=n,s.key=i,s.value=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedWrite(this,t)}}]),t}(g),O=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).exp=n,s.name=i,s.args=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPipe(this,t)}}]),t}(g),I=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).value=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralPrimitive(this,t)}}]),t}(g),_=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expressions=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralArray(this,t)}}]),t}(g),L=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).keys=n,r.values=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralMap(this,t)}}]),t}(g),M=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).strings=n,r.expressions=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitInterpolation(this,t)}}]),t}(g),K=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).operation=n,s.left=i,s.right=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitBinary(this,t)}}]),t}(g),B=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expression=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPrefixNot(this,t)}}]),t}(g),T=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expression=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitNonNullAssert(this,t)}}]),t}(g),R=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).receiver=n,s.name=i,s.args=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitMethodCall(this,t)}}]),t}(g),j=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).receiver=n,s.name=i,s.args=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitSafeMethodCall(this,t)}}]),t}(g),F=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).target=n,r.args=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitFunctionCall(this,t)}}]),t}(g),V=function e(t,n){a(this,e),this.start=t,this.end=n},W=function(e){function t(e,n,i,r,s){var o;return a(this,t),(o=p(this,c(t).call(this,new x(0,null==n?0:n.length)))).ast=e,o.source=n,o.location=i,o.errors=s,o.sourceSpan=new V(r,r+o.span.end),o}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}},{key:"toString",value:function(){return"".concat(this.source," in ").concat(this.location)}}]),t}(g),G=function e(t,n,i,r,s){a(this,e),this.span=t,this.key=n,this.keyIsVar=i,this.name=r,this.expression=s},U=function(){function e(){a(this,e)}return u(e,[{key:"visitBinary",value:function(e,t){}},{key:"visitChain",value:function(e,t){}},{key:"visitConditional",value:function(e,t){}},{key:"visitFunctionCall",value:function(e,t){}},{key:"visitImplicitReceiver",value:function(e,t){}},{key:"visitInterpolation",value:function(e,t){}},{key:"visitKeyedRead",value:function(e,t){}},{key:"visitKeyedWrite",value:function(e,t){}},{key:"visitLiteralArray",value:function(e,t){}},{key:"visitLiteralMap",value:function(e,t){}},{key:"visitLiteralPrimitive",value:function(e,t){}},{key:"visitMethodCall",value:function(e,t){}},{key:"visitPipe",value:function(e,t){}},{key:"visitPrefixNot",value:function(e,t){}},{key:"visitNonNullAssert",value:function(e,t){}},{key:"visitPropertyRead",value:function(e,t){}},{key:"visitPropertyWrite",value:function(e,t){}},{key:"visitQuote",value:function(e,t){}},{key:"visitSafeMethodCall",value:function(e,t){}},{key:"visitSafePropertyRead",value:function(e,t){}}]),e}(),Q=function(){function e(){a(this,e)}return u(e,[{key:"visitBinary",value:function(e,t){return e.left.visit(this,t),e.right.visit(this,t),null}},{key:"visitChain",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitConditional",value:function(e,t){return e.condition.visit(this,t),e.trueExp.visit(this,t),e.falseExp.visit(this,t),null}},{key:"visitPipe",value:function(e,t){return e.exp.visit(this,t),this.visitAll(e.args,t),null}},{key:"visitFunctionCall",value:function(e,t){return e.target.visit(this,t),this.visitAll(e.args,t),null}},{key:"visitImplicitReceiver",value:function(e,t){return null}},{key:"visitInterpolation",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitKeyedRead",value:function(e,t){return e.obj.visit(this,t),e.key.visit(this,t),null}},{key:"visitKeyedWrite",value:function(e,t){return e.obj.visit(this,t),e.key.visit(this,t),e.value.visit(this,t),null}},{key:"visitLiteralArray",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitLiteralMap",value:function(e,t){return this.visitAll(e.values,t)}},{key:"visitLiteralPrimitive",value:function(e,t){return null}},{key:"visitMethodCall",value:function(e,t){return e.receiver.visit(this,t),this.visitAll(e.args,t)}},{key:"visitPrefixNot",value:function(e,t){return e.expression.visit(this,t),null}},{key:"visitNonNullAssert",value:function(e,t){return e.expression.visit(this,t),null}},{key:"visitPropertyRead",value:function(e,t){return e.receiver.visit(this,t),null}},{key:"visitPropertyWrite",value:function(e,t){return e.receiver.visit(this,t),e.value.visit(this,t),null}},{key:"visitSafePropertyRead",value:function(e,t){return e.receiver.visit(this,t),null}},{key:"visitSafeMethodCall",value:function(e,t){return e.receiver.visit(this,t),this.visitAll(e.args,t)}},{key:"visitAll",value:function(e,t){var n=this;return e.forEach((function(e){return e.visit(n,t)})),null}},{key:"visitQuote",value:function(e,t){return null}}]),e}(),z=function(){function e(){a(this,e)}return u(e,[{key:"visitImplicitReceiver",value:function(e,t){return e}},{key:"visitInterpolation",value:function(e,t){return new M(e.span,e.strings,this.visitAll(e.expressions))}},{key:"visitLiteralPrimitive",value:function(e,t){return new I(e.span,e.value)}},{key:"visitPropertyRead",value:function(e,t){return new b(e.span,e.receiver.visit(this),e.name)}},{key:"visitPropertyWrite",value:function(e,t){return new A(e.span,e.receiver.visit(this),e.name,e.value.visit(this))}},{key:"visitSafePropertyRead",value:function(e,t){return new E(e.span,e.receiver.visit(this),e.name)}},{key:"visitMethodCall",value:function(e,t){return new R(e.span,e.receiver.visit(this),e.name,this.visitAll(e.args))}},{key:"visitSafeMethodCall",value:function(e,t){return new j(e.span,e.receiver.visit(this),e.name,this.visitAll(e.args))}},{key:"visitFunctionCall",value:function(e,t){return new F(e.span,e.target.visit(this),this.visitAll(e.args))}},{key:"visitLiteralArray",value:function(e,t){return new _(e.span,this.visitAll(e.expressions))}},{key:"visitLiteralMap",value:function(e,t){return new L(e.span,e.keys,this.visitAll(e.values))}},{key:"visitBinary",value:function(e,t){return new K(e.span,e.operation,e.left.visit(this),e.right.visit(this))}},{key:"visitPrefixNot",value:function(e,t){return new B(e.span,e.expression.visit(this))}},{key:"visitNonNullAssert",value:function(e,t){return new T(e.span,e.expression.visit(this))}},{key:"visitConditional",value:function(e,t){return new P(e.span,e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))}},{key:"visitPipe",value:function(e,t){return new O(e.span,e.exp.visit(this),e.name,this.visitAll(e.args))}},{key:"visitKeyedRead",value:function(e,t){return new S(e.span,e.obj.visit(this),e.key.visit(this))}},{key:"visitKeyedWrite",value:function(e,t){return new N(e.span,e.obj.visit(this),e.key.visit(this),e.value.visit(this))}},{key:"visitAll",value:function(e){for(var t=new Array(e.length),n=0;n=this.length?J:this.input.charCodeAt(this.index)}},{key:"scanToken",value:function(){for(var e=this.input,t=this.length,n=this.peek,i=this.index;n<=ne;){if(++i>=t){n=J;break}n=e.charCodeAt(i)}if(this.peek=n,this.index=i,i>=t)return null;if(Le(n))return this.scanIdentifier();if(be(n))return this.scanNumber(i);var r,s=i;switch(n){case 46:return this.advance(),be(this.peek)?this.scanNumber(s):Ne(s,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(s,n);case se:case ie:return this.scanString();case 35:case ae:case oe:case 42:case 47:case 37:case 94:return this.scanOperator(s,String.fromCharCode(n));case 63:return this.scanComplexOperator(s,"?",46,".");case 60:case 62:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=");case 33:case 61:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=",61,"=");case 38:return this.scanComplexOperator(s,"&",38,"&");case 124:return this.scanComplexOperator(s,"|",124,"|");case Ce:for(;(r=this.peek)>=X&&r<=ne||r==Ce;)this.advance();return this.scanToken()}return this.advance(),this.error("Unexpected character [".concat(String.fromCharCode(n),"]"),0)}},{key:"scanCharacter",value:function(e,t){return this.advance(),Ne(e,t)}},{key:"scanOperator",value:function(e,t){return this.advance(),Oe(e,t)}},{key:"scanComplexOperator",value:function(e,t,n,i,r,s){this.advance();var a=t;return this.peek==n&&(this.advance(),a+=i),null!=r&&this.peek==r&&(this.advance(),a+=s),Oe(e,a)}},{key:"scanIdentifier",value:function(){var e=this.index;for(this.advance();Ke(this.peek);)this.advance();var t,n=this.input.substring(e,this.index);return Ae.indexOf(n)>-1?(t=n,new Se(e,D.Keyword,0,t)):function(e,t){return new Se(e,D.Identifier,0,t)}(e,n)}},{key:"scanNumber",value:function(e){var t,n=this.index===e;for(this.advance();;){if(be(this.peek));else if(46==this.peek)n=!1;else{if((t=this.peek)!=de&&t!=he)break;if(this.advance(),Be(this.peek)&&this.advance(),!be(this.peek))return this.error("Invalid exponent",-1);n=!1}this.advance()}var i,r=this.input.substring(e,this.index),s=n?function(e){var t=parseInt(e);if(isNaN(t))throw new Error("Invalid integer literal when parsing "+e);return t}(r):parseFloat(r);return i=s,new Se(e,D.Number,i,"")}},{key:"scanString",value:function(){var e=this.index,t=this.peek;this.advance();for(var n="",i=this.index,r=this.input;this.peek!=t;)if(92==this.peek){n+=r.substring(i,this.index),this.advance();var s=void 0;if(this.peek=this.peek,117==this.peek){var a=r.substring(this.index+1,this.index+5);if(!/^[0-9a-f]+$/i.test(a))return this.error("Invalid unicode escape [\\u".concat(a,"]"),0);s=parseInt(a,16);for(var o=0;o<5;o++)this.advance()}else s=Re(this.peek),this.advance();n+=String.fromCharCode(s),i=this.index}else{if(this.peek==J)return this.error("Unterminated quote",0);this.advance()}var u,l=r.substring(i,this.index);return this.advance(),u=n+l,new Se(e,D.String,0,u)}},{key:"error",value:function(e,t){var n=this.index+t;return function(e,t){return new Se(e,D.Error,0,t)}(n,"Lexer Error: ".concat(e," at column ").concat(n," in expression [").concat(this.input,"]"))}}]),e}();function Le(e){return fe<=e&&e<=we||ce<=e&&e<=pe||e==ve||e==re}function Me(e){if(0==e.length)return!1;var t=new _e(e);if(!Le(t.peek))return!1;for(t.advance();t.peek!==J;){if(!Ke(t.peek))return!1;t.advance()}return!0}function Ke(e){return function(e){return e>=fe&&e<=we||e>=ce&&e<=pe}(e)||be(e)||e==ve||e==re}function Be(e){return e==oe||e==ae}function Te(e){return e===se||e===ie||e===Pe}function Re(e){switch(e){case xe:return Y;case ye:return ee;case ge:return te;case ke:return X;case me:return Z;default:return e}}var je=Object.freeze({__proto__:null,get TokenType(){return D},Lexer:Ee,Token:Se,EOF:Ie,isIdentifier:Me,isQuote:Te}),Fe=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//]; /** * @license * Copyright Google Inc. 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 Ve=new(function(){function e(t,n){a(this,e),this.start=t,this.end=n}return u(e,null,[{key:"fromArray",value:function(t){return t?(function(e,t){if(!(null==t||Array.isArray(t)&&2==t.length))throw new Error("Expected '".concat(e,"' to be an array, [start, end]."));if(null!=t){var n=t[0],i=t[1];Fe.forEach((function(e){if(e.test(n)||e.test(i))throw new Error("['".concat(n,"', '").concat(i,"'] contains unusable interpolation symbol."))}))}}("interpolation",t),new e(t[0],t[1])):Ve}}]),e}())("{{","}}");function We(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self;var Ge=function e(t,n,i){a(this,e),this.strings=t,this.expressions=n,this.offsets=i},Ue=function e(t,n,i){a(this,e),this.templateBindings=t,this.warnings=n,this.errors=i};function Qe(e){var t=We(e.start)+"([\\s\\S]*?)"+We(e.end);return new RegExp(t,"g")}var ze=function(){function e(t){a(this,e),this._lexer=t,this.errors=[]}return u(e,[{key:"parseAction",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve;this._checkNoInterpolation(e,t,i);var r=this._stripComments(e),s=this._lexer.tokenize(this._stripComments(e)),a=new $e(e,t,n,s,r.length,!0,this.errors,e.length-r.length).parseChain();return new W(a,e,t,n,this.errors)}},{key:"parseBinding",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this._parseBindingAst(e,t,n,i);return new W(r,e,t,n,this.errors)}},{key:"parseSimpleBinding",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this._parseBindingAst(e,t,n,i),s=qe.check(r);return s.length>0&&this._reportError("Host binding expression cannot contain ".concat(s.join(" ")),e,t),new W(r,e,t,n,this.errors)}},{key:"_reportError",value:function(e,t,n,i){this.errors.push(new y(e,t,n,i))}},{key:"_parseBindingAst",value:function(e,t,n,i){var r=this._parseQuote(e,t);if(null!=r)return r;this._checkNoInterpolation(e,t,i);var s=this._stripComments(e),a=this._lexer.tokenize(s);return new $e(e,t,n,a,s.length,!1,this.errors,e.length-s.length).parseChain()}},{key:"_parseQuote",value:function(e,t){if(null==e)return null;var n=e.indexOf(":");if(-1==n)return null;var i=e.substring(0,n).trim();if(!Me(i))return null;var r=e.substring(n+1);return new k(new x(0,e.length),i,r,t)}},{key:"parseTemplateBindings",value:function(e,t,n,i){var r=this._lexer.tokenize(t);return new $e(t,n,i,r,t.length,!1,this.errors,0).parseTemplateBindings(e)}},{key:"parseInterpolation",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this.splitInterpolation(e,t,i);if(null==r)return null;for(var s=[],a=0;a2&&void 0!==arguments[2]?arguments[2]:Ve,i=Qe(n),r=e.split(i);if(r.length<=1)return null;for(var s=[],a=[],o=[],u=0,l=0;l0?(u+=n.start.length,a.push(c),o.push(u),u+=c.length+n.end.length):(this._reportError("Blank expressions are not allowed in interpolated strings",e,"at column ".concat(this._findInterpolationErrorColumn(r,l,n)," in"),t),a.push("$implict"),o.push(u))}return new Ge(s,a,o)}},{key:"wrapLiteralPrimitive",value:function(e,t,n){return new W(new I(new x(0,null==e?0:e.length),e),e,t,n,this.errors)}},{key:"_stripComments",value:function(e){var t=this._commentStart(e);return null!=t?e.substring(0,t).trim():e}},{key:"_commentStart",value:function(e){for(var t=null,n=0;n1&&this._reportError("Got interpolation (".concat(n.start).concat(n.end,") where expression was expected"),e,"at column ".concat(this._findInterpolationErrorColumn(r,1,n)," in"),t)}},{key:"_findInterpolationErrorColumn",value:function(e,t,n){for(var i="",r=0;r":case"<=":case">=":this.advance();var n=this.parseAdditive();e=new K(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parseAdditive",value:function(){for(var e=this.parseMultiplicative();this.next.type==D.Operator;){var t=this.next.strValue;switch(t){case"+":case"-":this.advance();var n=this.parseMultiplicative();e=new K(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parseMultiplicative",value:function(){for(var e=this.parsePrefix();this.next.type==D.Operator;){var t=this.next.strValue;switch(t){case"*":case"%":case"/":this.advance();var n=this.parsePrefix();e=new K(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parsePrefix",value:function(){if(this.next.type==D.Operator){var e,t=this.inputIndex,n=this.next.strValue;switch(n){case"+":return this.advance(),e=this.parsePrefix(),new K(this.span(t),"-",e,new I(new x(t,t),0));case"-":return this.advance(),e=this.parsePrefix(),new K(this.span(t),n,new I(new x(t,t),0),e);case"!":return this.advance(),e=this.parsePrefix(),new B(this.span(t),e)}}return this.parseCallChain()}},{key:"parseCallChain",value:function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(46))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(91)){this.rbracketsExpected++;var t=this.parsePipe();if(this.rbracketsExpected--,this.expectCharacter(93),this.optionalOperator("=")){var n=this.parseConditional();e=new N(this.span(e.span.start),e,t,n)}else e=new S(this.span(e.span.start),e,t)}else if(this.optionalCharacter(40)){this.rparensExpected++;var i=this.parseCallArguments();this.rparensExpected--,this.expectCharacter(41),e=new F(this.span(e.span.start),e,i)}else{if(!this.optionalOperator("!"))return e;e=new T(this.span(e.span.start),e)}}},{key:"parsePrimary",value:function(){var e=this.inputIndex;if(this.optionalCharacter(40)){this.rparensExpected++;var t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}if(this.next.isKeywordNull())return this.advance(),new I(this.span(e),null);if(this.next.isKeywordUndefined())return this.advance(),new I(this.span(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new I(this.span(e),!0);if(this.next.isKeywordFalse())return this.advance(),new I(this.span(e),!1);if(this.next.isKeywordThis())return this.advance(),new w(this.span(e));if(this.optionalCharacter(91)){this.rbracketsExpected++;var n=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new _(this.span(e),n)}if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(new w(this.span(e)),!1);if(this.next.isNumber()){var i=this.next.toNumber();return this.advance(),new I(this.span(e),i)}if(this.next.isString()){var r=this.next.toString();return this.advance(),new I(this.span(e),r)}return this.index>=this.tokens.length?(this.error("Unexpected end of expression: ".concat(this.input)),new m(this.span(e))):(this.error("Unexpected token ".concat(this.next)),new m(this.span(e)))}},{key:"parseExpressionList",value:function(e){var t=[];if(!this.next.isCharacter(e))do{t.push(this.parsePipe())}while(this.optionalCharacter(44));return t}},{key:"parseLiteralMap",value:function(){var e=[],t=[],n=this.inputIndex;if(this.expectCharacter(123),!this.optionalCharacter(125)){this.rbracesExpected++;do{var i=this.next.isString(),r=this.expectIdentifierOrKeywordOrString();e.push({key:r,quoted:i}),this.expectCharacter(58),t.push(this.parsePipe())}while(this.optionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new L(this.span(n),e,t)}},{key:"parseAccessMemberOrMethodCall",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.span.start,i=this.expectIdentifierOrKeyword();if(this.optionalCharacter(40)){this.rparensExpected++;var r=this.parseCallArguments();this.expectCharacter(41),this.rparensExpected--;var s=this.span(n);return t?new j(s,e,i,r):new R(s,e,i,r)}if(t)return this.optionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),new m(this.span(n))):new E(this.span(n),e,i);if(this.optionalOperator("=")){if(!this.parseAction)return this.error("Bindings cannot contain assignments"),new m(this.span(n));var a=this.parseConditional();return new A(this.span(n),e,i,a)}return new b(this.span(n),e,i)}},{key:"parseCallArguments",value:function(){if(this.next.isCharacter(41))return[];var e=[];do{e.push(this.parsePipe())}while(this.optionalCharacter(44));return e}},{key:"expectTemplateBindingKey",value:function(){var e="",t=!1;do{e+=this.expectIdentifierOrKeywordOrString(),(t=this.optionalOperator("-"))&&(e+="-")}while(t);return e.toString()}},{key:"parseTemplateBindings",value:function(e){var t=!0,n=[];do{var i=this.inputIndex,r=void 0,s=void 0,a=!1;t?(r=s=e,t=!1):((a=this.peekKeywordLet())&&this.advance(),r=this.expectTemplateBindingKey(),s=a?r:e+r[0].toUpperCase()+r.substring(1),this.optionalCharacter(58));var o=null,u=null;if(a)o=this.optionalOperator("=")?this.expectTemplateBindingKey():"$implicit";else if(this.peekKeywordAs())this.advance(),o=r,s=this.expectTemplateBindingKey(),a=!0;else if(this.next!==Ie&&!this.peekKeywordLet()){var l=this.inputIndex,c=this.parsePipe(),h=this.input.substring(l-this.offset,this.inputIndex-this.offset);u=new W(c,h,this.location,this.absoluteOffset,this.errors)}if(n.push(new G(this.span(i),s,a,o,u)),this.peekKeywordAs()&&!a){var p=this.inputIndex;this.advance();var v=this.expectTemplateBindingKey();n.push(new G(this.span(p),v,!0,s,null))}this.optionalCharacter(59)||this.optionalCharacter(44)}while(this.index1&&void 0!==arguments[1]?arguments[1]:null;this.errors.push(new y(e,this.input,this.locationText(t),this.location)),this.skip()}},{key:"locationText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null==e&&(e=this.index),e2&&void 0!==arguments[2]&&arguments[2],a=He.getNgType(e);switch(a){case"Binary":var o=e.left,u=e.operation,l=e.right,c=l.span.start===l.span.end,h=o.span.start===o.span.end;if(c||h){var p=o.span.start===o.span.end?Pe(l):Pe(o);return Ae("UnaryExpression",{prefix:!0,argument:p,operator:c?"+":"-"},{start:e.span.start,end:Le(p)},{hasParentParens:r})}var v=Pe(o),f=Pe(l);return Ae("&&"===u||"||"===u?"LogicalExpression":"BinaryExpression",{left:v,right:f,operator:u},{start:_e(v),end:Le(f)},{hasParentParens:r});case"BindingPipe":var d=e.exp,y=e.name,x=e.args,g=Pe(d),k=Ne(/\S/,Ne(/\|/,Le(g))+1),m=Ae("Identifier",{name:y},{start:k,end:k+y.length}),w=x.map(Pe);return Ae("NGPipeExpression",{left:g,right:m,arguments:w},{start:_e(g),end:Le(0===w.length?m:He.getLast(w))},{hasParentParens:r});case"Chain":var C=e.expressions;return Ae("NGChainedExpression",{expressions:C.map(Pe)},e.span,{hasParentParens:r});case"Comment":var P=e.value;return Ae("CommentLine",{value:P},e.span,{processSpan:!1});case"Conditional":var b=e.condition,A=e.trueExp,E=e.falseExp,S=Pe(b),N=Pe(A),O=Pe(E);return Ae("ConditionalExpression",{test:S,consequent:N,alternate:O},{start:_e(S),end:Le(O)},{hasParentParens:r});case"EmptyExpr":return Ae("NGEmptyExpression",{},e.span,{hasParentParens:r});case"FunctionCall":var I=e.target,_=e.args,L=1===_.length?[be(_[0])]:_.map(Pe),M=Pe(I);return Ae("CallExpression",{callee:M,arguments:L},{start:_e(M),end:e.span.end},{hasParentParens:r});case"KeyedRead":var K=e.obj,B=e.key,T=Pe(K),R=Pe(B);return Ae("MemberExpression",{computed:!0,object:T,property:R},{start:_e(T),end:e.span.end},{hasParentParens:r});case"LiteralArray":var j=e.expressions;return Ae("ArrayExpression",{elements:j.map(Pe)},e.span,{hasParentParens:r});case"LiteralMap":var F=e.keys,V=e.values,W=V.map((function(e){return Pe(e)})),G=F.map((function(t,n){var i=t.key,r=t.quoted,s=W[n],a={start:Ne(/\S/,0===n?e.span.start+1:Ne(/,/,Le(W[n-1]))+1),end:Se(/\S/,Se(/:/,_e(s)-1)-1)+1},o=r?Ae("StringLiteral",{value:i},a):Ae("Identifier",{name:i},a);return Ae("ObjectProperty",{key:o,value:s,method:!1,shorthand:!1,computed:!1},{start:_e(o),end:Le(s)})}));return Ae("ObjectExpression",{properties:G},e.span,{hasParentParens:r});case"LiteralPrimitive":var U=e.value;switch(s(U)){case"boolean":return Ae("BooleanLiteral",{value:U},e.span,{hasParentParens:r});case"number":return Ae("NumericLiteral",{value:U},e.span,{hasParentParens:r});case"object":return Ae("NullLiteral",{},e.span,{hasParentParens:r});case"string":return Ae("StringLiteral",{value:U},e.span,{hasParentParens:r});case"undefined":return Ae("Identifier",{name:"undefined"},e.span,{hasParentParens:r});default:throw new Error("Unexpected LiteralPrimitive value type ".concat(s(U)))}case"MethodCall":case"SafeMethodCall":var Q="SafeMethodCall"===a,z=e.receiver,$=e.name,q=e.args,D=1===q.length?[be(q[0])]:q.map(Pe),H=Se(/\S/,Se(/\(/,(0===D.length?Se(/\)/,e.span.end-1):_e(D[0]))-1)-1)+1,J=Ae("Identifier",{name:$},{start:H-$.length,end:H}),X=Ee(z,J,{computed:!1,optional:Q}),Y=Oe(X);return Ae(Q||Y?"OptionalCallExpression":"CallExpression",{callee:X,arguments:D},{start:_e(X),end:e.span.end},{hasParentParens:r});case"NonNullAssert":var Z=e.expression,ee=Pe(Z);return Ae("TSNonNullExpression",{expression:ee},{start:_e(ee),end:e.span.end},{hasParentParens:r});case"PrefixNot":var te=e.expression,ne=Pe(te);return Ae("UnaryExpression",{prefix:!0,operator:"!",argument:ne},{start:e.span.start,end:Le(ne)},{hasParentParens:r});case"PropertyRead":case"SafePropertyRead":var ie="SafePropertyRead"===a,re=e.receiver,se=e.name,ae=Se(/\S/,e.span.end-1)+1,oe=Ae("Identifier",{name:se},{start:ae-se.length,end:ae},re.span.start===re.span.end?{hasParentParens:r}:{});return Ee(re,oe,{computed:!1,optional:ie},{hasParentParens:r});case"KeyedWrite":var ue=e.obj,le=e.key,ce=e.value,he=Pe(le),pe=Pe(ce),ve=Ee(ue,he,{computed:!0,optional:!1},{end:Ne(/\]/,Le(he))+1});return Ae("AssignmentExpression",{left:ve,operator:"=",right:pe},{start:_e(ve),end:Le(pe)},{hasParentParens:r});case"PropertyWrite":var fe=e.receiver,de=e.name,ye=e.value,xe=Pe(ye),ge=Se(/\S/,Se(/=/,_e(xe)-1)-1)+1,ke=Ae("Identifier",{name:de},{start:ge-de.length,end:ge}),me=Ee(fe,ke,{computed:!1,optional:!1});return Ae("AssignmentExpression",{left:me,operator:"=",right:xe},{start:_e(me),end:Le(xe)},{hasParentParens:r});case"Quote":var we=e.prefix,Ce=e.uninterpretedExpression;return Ae("NGQuotedExpression",{prefix:we,value:Ce},e.span,{hasParentParens:r});default:throw new Error("Unexpected node ".concat(a))}function Pe(e){return t.transform(e,i)}function be(e){return t.transform(e,i,!0)}function Ae(e,t,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=s.processSpan,o=void 0===a||a,u=s.hasParentParens,l=void 0!==u&&u,c=Object.assign({type:e},n(r,i,o,l),t);switch(e){case"Identifier":var h=c;h.loc.identifierName=h.name;break;case"NumericLiteral":var p=c;p.extra=Object.assign({},p.extra,{raw:i.text.slice(p.start,p.end),rawValue:p.value});break;case"StringLiteral":var v=c;v.extra=Object.assign({},v.extra,{raw:i.text.slice(v.start,v.end),rawValue:v.value})}return c}function Ee(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.end,s=void 0===r?Le(t):r,a=i.hasParentParens,o=void 0!==a&&a;if(e.span.start===e.span.end)return t;var u="ImplicitReceiver"===He.getNgType(e)?Ae("ThisExpression",{},e.span):Pe(e),l=Oe(u);return Ae(n.optional||l?"OptionalMemberExpression":"MemberExpression",Object.assign({object:u,property:t,computed:n.computed},n.optional?{optional:!0}:l?{optional:!1}:null),{start:_e(u),end:s},{hasParentParens:o})}function Se(e,t){return He.findFrontChar(e,t,i.text)}function Ne(e,t){return He.findBackChar(e,t,i.text)}function Oe(e){return("OptionalCallExpression"===e.type||"OptionalMemberExpression"===e.type)&&!Ie(e)}function Ie(e){return e.extra&&e.extra.parenthesized}function _e(e){return Ie(e)?e.extra.parenStart:e.start}function Le(e){return Ie(e)?e.extra.parenEnd:e.end}},t.transformSpan=n}));i(Je);Je.transform,Je.transformSpan;var Xe=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.transformTemplateBindings=function(e,t){for(var n=v(e,1)[0],i=n.key,r=0===t.text.slice(n.span.start,n.span.end).trim().length?e.slice(1):e,s=[],a=null,o=0;o3&&void 0!==arguments[3])||arguments[3];return Object.assign({type:e},Je.transformSpan(i,t,r,!1),n)}function x(e,n){if("'"!==t.text[e]&&'"'!==t.text[e])return{start:e,end:e+n.length};for(var i=t.text[e],r=0,s=e+1;;){var a=t.text[s];if(a===i&&r%2==0)return{start:e,end:s+1};"\\"===a?r++:r=0,s++}}function g(e){return He.toLowerCamelCase(e.slice(i.length))}}}));i(Xe);Xe.transformTemplateBindings;var Ye=r((function(e,t){function n(e,t){var n=t(e),i=n.ast,r=n.comments,s=new d.Context(e),a=function(e){return Je.transform(e,s)},o=a(i);return o.comments=r.map(a),o}Object.defineProperty(t,"__esModule",{value:!0}),t.parseBinding=function(e){return n(e,He.parseNgBinding)},t.parseSimpleBinding=function(e){return n(e,He.parseNgSimpleBinding)},t.parseInterpolation=function(e){return n(e,He.parseNgInterpolation)},t.parseAction=function(e){return n(e,He.parseNgAction)},t.parseTemplateBindings=function(e){return Xe.transformTemplateBindings(He.parseNgTemplateBindings(e),new d.Context(e))}}));i(Ye);Ye.parseBinding,Ye.parseSimpleBinding,Ye.parseInterpolation,Ye.parseAction,Ye.parseTemplateBindings;function Ze(e){return Object.assign({astFormat:"estree",parse:function(t,n,i){var r=e(t,Ye);return{type:"NGRoot",node:"__ng_action"===i.parser&&"NGChainedExpression"!==r.type?Object.assign({},r,{type:"NGChainedExpression",expressions:[r]}):r}}},n)}var et={parsers:{__ng_action:Ze((function(e,t){return t.parseAction(e)})),__ng_binding:Ze((function(e,t){return t.parseBinding(e)})),__ng_interpolation:Ze((function(e,t){return t.parseInterpolation(e)})),__ng_directive:Ze((function(e,t){return t.parseTemplateBindings(e)}))}},tt=et.parsers;e.default=et,e.parsers=tt,Object.defineProperty(e,"__esModule",{value:!0})}));