webhook-action/node_modules/prettier/esm/parser-angular.mjs

47 lines
50 KiB
JavaScript
Raw Normal View History

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}function s(e,s){return t(e)===t(s)}var n={locStart:t,locEnd:e,composeLoc:function(s,n=s){const r=t(s);return[r,"number"==typeof n?r+n:e(n)]},hasSameLocStart:s,hasSameLoc:function(t,n){return s(t,n)&&function(t,s){return e(t)===e(s)}(t,n)}};function r(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 i,a=r((function(t,e){var s="\n",n=function(){function t(t){this.string=t;for(var e=[0],n=0;n<t.length;)switch(t[n]){case s:n+=s.length,e.push(n);break;case"\r":t[n+="\r".length]===s&&(n+=s.length),e.push(n);break;default:n++}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=n})),o=r((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 a.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 c{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 h{constructor(t,e){this.start=t,this.end=e}toAbsolute(t){return new M(t+this.start,t+this.end)}}class p{constructor(t,e){this.span=t,this.sourceSpan=e}visit(t,e=null){return null}toString(){return"AST"}}class u extends p{constructor(t,e,s){super(t,e),this.nameSpan=s}}class l extends p{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 d extends p{visit(t,e=null){}}class f extends p{visit(t,e=null){return t.visitImplicitReceiver(this,e)}}class v extends p{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitChain(this,e)}}class x extends p{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 g extends u{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 m extends u{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 y extends u{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 S extends p{constructor(t,e,s,n){super(t,e),this.obj=s,this.key=n}visit(t,e=null){return t.visitKeyedRead(this,e)}}class w extends p{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 C extends u{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 P extends p{constructor(t,e,s){super(t,e),this.value=s}visit(t,e=null){return t.visitLiteralPrimitive(this,e)}}class E extends p{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitLiteralArray(this,e)}}class A extends p{constructor(t,e,s,n){super(t,e),this.keys=s,this.values=n}visit(t,e=null){return t.visitLiteralMap(this,e)}}class O extends p{constructor(t,e,s,n){super(t,e),this.strings=s,this.expressions=n}visit(t,e=null){return t.visitInterpolation(this,e)}}class b extends p{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 k extends b{constructor(t,e,s,n,r,i,a){super(t,e,r,i,a),this.operator=s,this.expr=n}static createMinus(t,e,s){return new k(t,e,"-",s,"-",new P(t,e,0),s)}static createPlus(t,e,s){return new k(t,e,"+",s,"-",s,new P(t,e,0))}visit(t,e=null){return void 0!==t.visitUnary?t.visitUnary(this,e):t.visitBinary(this,e)}}class N extends p{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitPrefixNot(this,e)}}class I extends p{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitNonNullAssert(this,e)}}class _ extends u{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 L extends u{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 K extends p{constructor(t,e,s,n){super(t,e),this.target=s,this.args=n}visit(t,e=null){return t.visitFunctionCall(this,e)}}class M{constructor(t,e){this.start=t,this.end=e}}class T extends p{constructor(t,e,s,n,r){super(new h(0,null===e?0:e.length),new M(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 B{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class R{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class j{visit(t,e){t.visit(this,e)}visitUnary(t,e){this.visit(t.expr,e)}visitBinary(t,e){this.visit(t.left,e),this.visit(t.right,e)}visitChain(t,e){this.
/**
* @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 G(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 U;!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"}(U||(U={}));const W=["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==U.Character&&this.numValue==t}isNumber(){return this.type==U.Number}isString(){return this.type==U.String}isOperator(t){return this.type==U.Operator&&this.strValue==t}isIdentifier(){return this.type==U.Identifier}isKeyword(){return this.type==U.Keyword}isKeywordLet(){return this.type==U.Keyword&&"let"==this.strValue}isKeywordAs(){return this.type==U.Keyword&&"as"==this.strValue}isKeywordNull(){return this.type==U.Keyword&&"null"==this.strValue}isKeywordUndefined(){return this.type==U.Keyword&&"undefined"==this.strValue}isKeywordTrue(){return this.type==U.Keyword&&"true"==this.strValue}isKeywordFalse(){return this.type==U.Keyword&&"false"==this.strValue}isKeywordThis(){return this.type==U.Keyword&&"this"==this.strValue}isError(){return this.type==U.Error}toNumber(){return this.type==U.Number?this.numValue:-1}toString(){switch(this.type){case U.Character:case U.Identifier:case U.Keyword:case U.Operator:case U.String:case U.Error:return this.strValue;case U.Number:return this.numValue.toString();default:return null}}}function Q(t,e,s){return new V(t,e,U.Character,s,String.fromCharCode(s))}function D(t,e,s){return new V(t,e,U.Operator,0,s)}const z=new V(-1,-1,U.Character,0,"");class q{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($(s))return this.scanIdentifier();if(G(s))return this.scanNumber(n);const r=n;switch(s){case 46:return this.advance(),G(this.peek)?this.scanNumber(r):Q(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(),Q(t,this.index,e)}scanOperator(t,e){return this.advance(),D(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),D(t,this.index,a)}scanIdentifier(){const t=this.index;for(this.advance();J(this.peek);)this.advance();const e=this.input.substring(t,this.index);return W.indexOf(e)>-1?(s=t,n=this.index,r=e,new V(s,n,U.Keyword,0,r)):function(t,e,s){return new V(t,e,U.Identifier,0,s)}(t,this.index,e);var s,n,r}scanNumber(t){let e=this.index===t;for(this.advance();;){if(G(this.peek));else if(46==this.peek)e=!1;else{if(101!=(s=this.peek)&&69!=s)break;if(this.advance(),H(this.peek)&&this.advance(),!G(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,U.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;)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
*/const et=[/^\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 st{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];et.forEach((e=>{if(e.test(t)||e.test(s))throw new Error("['".concat(t,"', '").concat(s,"'] contains unusable interpolation symbol."))}))}}("interpolation",t),new st(t[0],t[1])):nt}}const nt=new st("{{","}}");function rt(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 it{constructor(t,e,s,n,r){this.strings=t,this.stringSpans=e,this.expressions=s,this.expressionsSpans=n,this.offsets=r}}class at{constructor(t,e,s){this.templateBindings=t,this.warnings=e,this.errors=s}}const ot=ct(nt);function ct(t){const e=rt(t.start)+"([\\s\\S]*?)"+rt(t.end);return new RegExp(e,"g")}class ht{constructor(t){this._lexer=t,this.errors=[],this.simpleExpressionChecker=lt}parseAction(t,e,s,n=nt){this._checkNoInterpolation(t,e,n);const r=this._stripComments(t),i=this._lexer.tokenize(this._stripComments(t)),a=new ut(t,e,s,i,r.length,!0,this.errors,t.length-r.length).parseChain();return new T(a,t,e,s,this.errors)}parseBinding(t,e,s,n=nt){const r=this._parseBindingAst(t,e,s,n);return new T(r,t,e,s,this.errors)}checkSimpleExpression(t){const e=new this.simpleExpressionChecker;return t.visit(e),e.errors}parseSimpleBinding(t,e,s,n=nt){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 T(r,t,e,s,this.errors)}_reportError(t,e,s,n){this.errors.push(new c(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 ut(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(!X(r))return null;const i=t.substring(n+1),a=new h(0,t.length);return new l(a,a.toAbsolute(s),r,i,e)}parseTemplateBindings(t,e,s,n,r){const i=this._lexer.tokenize(e);return new ut(e,s,r,i,e.length,!1,this.errors,0).parseTemplateBindings({source:t,span:new M(n,n+t.length)})}parseInterpolation(t,e,s,n=nt){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 ut(t,e,s,c,o.length,!1,this.errors,r.offsets[n]+(a.length-o.length)).parseChain();i.push(h)}const a=new h(0,null==t?0:t.length);return new T(new O(a,a.toAbsolute(s),r.strings,i),t,e,s,this.errors)}splitInterpolation(t,e,s=nt){const n=[],r=[],i=[],a=[],o=[];let c=0,h=!1,p=!1,{start:u,end:l}=s;for(;c<t.length;)if(h){const s=c,n=s+u.length,a=t.indexOf(l,n);if(-1===a){h=!1,p=!0;break}const d=a+l.length,f=t.substring(n,a);f.trim().length>0?r.push(f):(this._reportError("Blank expressions are not allowed in interpolated strings",t,"at column ".concat(c," in"),e),r.push("$implicit")),i.push(n),o.push({start:s,end:d}),c=d,h=!1}else{const e=c;c=t.indexOf(u,c),-1===c&&(c=t.length);const s=t.substring(e,c);n.push(s),a.push({start:e,end:c}),h=!0}return h||(p?(n[n.length-1]+=t.substring(c),a[a.length-1].end=t.length):(n.push(t.substring(c)),a.push({start:c,end:t.length}))),0===r.length?null:new it(n,a,r,o,i)}wrapLiteralPrimitive(t,e,s){const n=new h(0,null==t?0:t.length);return new T(new P(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&&Y(n)&&(e=n)}return null}_checkNoInterpolation(t,e,s){const n=(r=s)===nt?ot:ct(r);var r;const i=t.split(n);i.length>1&&this._reportError("Got interpolation (".concat(s.start).concat(s.end,") where expression was expected"),t,"at column ".concat(this._findInterpolationErrorColumn(i,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}}var pt;!function(t){t[t.None=0]="None",t[t.Writable=1]="Writable"}(pt||(pt={}));class ut{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.context=pt.None,this.sourceSpanCache=new Map,this.index=0}peek(t