pinets 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,28 +15,28 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
- var yr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],_i=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],wr="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Si="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",vt={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},_t="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",br={5:_t,"5module":_t+" export import",6:_t+" const class extends export import super"},vr=/^in(stanceof)?$/,_r=new RegExp("["+Si+"]"),Sr=new RegExp("["+Si+wr+"]");function It(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function _e(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&_r.test(String.fromCharCode(e)):t===!1?!1:It(e,_i)}function $e(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Sr.test(String.fromCharCode(e)):t===!1?!1:It(e,_i)||It(e,yr)}var O=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function ne(e,t){return new O(e,{beforeExpr:!0,binop:t})}var ae={beforeExpr:!0},ee={startsExpr:!0},Lt={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,Lt[e]=new O(e,t)}var u={num:new O("num",ee),regexp:new O("regexp",ee),string:new O("string",ee),name:new O("name",ee),privateId:new O("privateId",ee),eof:new O("eof"),bracketL:new O("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new O("]"),braceL:new O("{",{beforeExpr:!0,startsExpr:!0}),braceR:new O("}"),parenL:new O("(",{beforeExpr:!0,startsExpr:!0}),parenR:new O(")"),comma:new O(",",ae),semi:new O(";",ae),colon:new O(":",ae),dot:new O("."),question:new O("?",ae),questionDot:new O("?."),arrow:new O("=>",ae),template:new O("template"),invalidTemplate:new O("invalidTemplate"),ellipsis:new O("...",ae),backQuote:new O("`",ee),dollarBraceL:new O("${",{beforeExpr:!0,startsExpr:!0}),eq:new O("=",{beforeExpr:!0,isAssign:!0}),assign:new O("_=",{beforeExpr:!0,isAssign:!0}),incDec:new O("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new O("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ne("||",1),logicalAND:ne("&&",2),bitwiseOR:ne("|",3),bitwiseXOR:ne("^",4),bitwiseAND:ne("&",5),equality:ne("==/!=/===/!==",6),relational:ne("</>/<=/>=",7),bitShift:ne("<</>>/>>>",8),plusMin:new O("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ne("%",10),star:ne("*",10),slash:ne("/",10),starstar:new O("**",{beforeExpr:!0}),coalesce:ne("??",1),_break:V("break"),_case:V("case",ae),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",ae),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",ae),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",ee),_if:V("if"),_return:V("return",ae),_switch:V("switch"),_throw:V("throw",ae),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",ee),_super:V("super",ee),_class:V("class",ee),_extends:V("extends",ae),_export:V("export"),_import:V("import",ee),_null:V("null",ee),_true:V("true",ee),_false:V("false",ee),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},pe=/\r\n?|\n|\u2028|\u2029/,Er=new RegExp(pe.source,"g");function qe(e){return e===10||e===13||e===8232||e===8233}function Ei(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(qe(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Ni=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,he=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ci=Object.prototype,Nr=Ci.hasOwnProperty,Cr=Ci.toString,Ue=Object.hasOwn||function(e,t){return Nr.call(e,t)},Qt=Array.isArray||function(e){return Cr.call(e)==="[object Array]"},Xt=Object.create(null);function ke(e){return Xt[e]||(Xt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Se(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var kr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ze=function(t,i){this.line=t,this.column=i};Ze.prototype.offset=function(t){return new Ze(this.line,this.column+t)};var dt=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function ki(e,t){for(var i=1,r=0;;){var s=Ei(e,r,t);if(s<0)return new Ze(i,t-r);++i,r=s}}var At={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Zt=!1;function Ir(e){var t={};for(var i in At)t[i]=e&&Ue(e,i)?e[i]:At[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Zt&&typeof console=="object"&&console.warn&&(Zt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
19
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Qt(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}return Qt(t.onComment)&&(t.onComment=Ar(t,t.onComment)),t}function Ar(e,t){return function(i,r,s,n,a,o){var h={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(h.loc=new dt(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}var Je=1,Ke=2,Bt=4,Ii=8,Ai=16,Pi=32,Ft=64,Ti=128,et=256,jt=Je|Ke|et;function $t(e,t){return Ke|(e?Bt:0)|(t?Ii:0)}var ht=0,Wt=1,Ne=2,Ri=3,Di=4,Vi=5,U=function(t,i,r){this.options=t=Ir(t),this.sourceFile=t.sourceFile,this.keywords=ke(br[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=vt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=ke(s);var n=(s?s+" ":"")+vt.strict;this.reservedWordsStrict=ke(n),this.reservedWordsStrictBind=ke(n+" "+vt.strictBind),this.input=String(i),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
20
- `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(pe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Je),this.regexpState=null,this.privateNameStack=[]},we={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};U.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};we.inFunction.get=function(){return(this.currentVarScope().flags&Ke)>0};we.inGenerator.get=function(){return(this.currentVarScope().flags&Ii)>0&&!this.currentVarScope().inClassFieldInit};we.inAsync.get=function(){return(this.currentVarScope().flags&Bt)>0&&!this.currentVarScope().inClassFieldInit};we.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&et)return!1;if(t.flags&Ke)return(t.flags&Bt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};we.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Ft)>0||i||this.options.allowSuperOutsideMethod};we.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ti)>0};we.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};we.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Ke|et))>0||i};we.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&et)>0};U.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r};U.parse=function(t,i){return new this(i,t).parse()};U.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()};U.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(U.prototype,we);var J=U.prototype,Pr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;J.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){he.lastIndex=e,e+=he.exec(this.input)[0].length;var t=Pr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){he.lastIndex=e+t[0].length;var i=he.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||pe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,he.lastIndex=e,e+=he.exec(this.input)[0].length,this.input[e]===";"&&e++}};J.eat=function(e){return this.type===e?(this.next(),!0):!1};J.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc};J.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};J.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};J.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||pe.test(this.input.slice(this.lastTokEnd,this.start))};J.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};J.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()};J.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};J.expect=function(e){this.eat(e)||this.unexpected()};J.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var gt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};J.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};J.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};J.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};J.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var N=U.prototype;N.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var qt={kind:"loop"},Tr={kind:"switch"};N.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;he.lastIndex=this.pos;var t=he.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(_e(r,!0)){for(var s=i+1;$e(r=this.input.charCodeAt(s),!0);)++s;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!vr.test(n))return!0}return!1};N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;he.lastIndex=this.pos;var e=he.exec(this.input),t=this.pos+e[0].length,i;return!pe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!($e(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};N.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),n;switch(this.isLet(e)&&(r=u._var,n="let"),r){case u._break:case u._continue:return this.parseBreakContinueStatement(s,r.keyword);case u._debugger:return this.parseDebuggerStatement(s);case u._do:return this.parseDoStatement(s);case u._for:return this.parseForStatement(s);case u._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case u._class:return e&&this.unexpected(),this.parseClass(s,!0);case u._if:return this.parseIfStatement(s);case u._return:return this.parseReturnStatement(s);case u._switch:return this.parseSwitchStatement(s);case u._throw:return this.parseThrowStatement(s);case u._try:return this.parseTryStatement(s);case u._const:case u._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(s,n);case u._while:return this.parseWhileStatement(s);case u._with:return this.parseWithStatement(s);case u.braceL:return this.parseBlock(!0,s);case u.semi:return this.parseEmptyStatement(s);case u._export:case u._import:if(this.options.ecmaVersion>10&&r===u._import){he.lastIndex=this.pos;var a=he.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(h===40||h===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===u._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var c=this.value,l=this.parseExpression();return r===u.name&&l.type==="Identifier"&&this.eat(u.colon)?this.parseLabeledStatement(s,c,l,e):this.parseExpressionStatement(s,l)}};N.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(u.semi)||this.insertSemicolon()?e.label=null:this.type!==u.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};N.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};N.parseDoStatement=function(e){return this.next(),this.labels.push(qt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(u._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(u.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};N.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(qt),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===u._var||this.type===u._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===u._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new gt,c=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===u._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===u._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===c&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};N.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Qe|(i?0:Pt),!1,t)};N.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(u._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};N.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(u.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};N.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(Tr),this.enterScope(0);for(var t,i=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var r=this.type===u._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(u.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};N.parseThrowStatement=function(e){return this.next(),pe.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Rr=[];N.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Pi:0),this.checkLValPattern(e,t?Di:Ne),this.expect(u.parenR),e};N.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===u._catch){var t=this.startNode();this.next(),this.eat(u.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(u._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};N.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};N.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(qt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};N.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};N.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};N.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){var a=n[s];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===u._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};N.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};N.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(u.braceL),e&&this.enterScope(0);this.type!==u.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};N.parseFor=function(e,t){return e.init=t,this.expect(u.semi),e.test=this.type===u.semi?null:this.parseExpression(),this.expect(u.semi),e.update=this.type===u.parenR?null:this.parseExpression(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};N.parseForIn=function(e,t){var i=this.type===u._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};N.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(u.eq)?s.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&s.id.type!=="Identifier"&&!(t&&(this.type===u._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(u.comma))break}return e};N.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Wt:Ne,!1)};var Qe=1,Pt=2,Oi=4;N.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===u.star&&t&Pt&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Qe&&(e.id=t&Oi&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&Pt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Wt:Ne:Ri));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope($t(e.async,e.generator)),t&Qe||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Qe?"FunctionDeclaration":"FunctionExpression")};N.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};N.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(u.braceL);this.type!==u.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(n&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&a.key.type==="PrivateIdentifier"&&Dr(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};N.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===u.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===u.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(u.star)&&(s=!0),!r&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===u.parenL||a!=="method"||s||n){var c=!i.static&&ct(i,"constructor"),l=c&&e;c&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":a,this.parseClassMethod(i,s,n,l)}else this.parseClassField(i);return i};N.isClassElementNameStart=function(){return this.type===u.name||this.type===u.privateId||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword};N.parseClassElementName=function(e){this.type===u.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};N.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&ct(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};N.parseClassField=function(e){if(ct(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ct(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};N.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(et|Ft);this.type!==u.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};N.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Ne,!1)):(t===!0&&this.unexpected(),e.id=null)};N.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null};N.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};N.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];Ue(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Dr(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function ct(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}N.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};N.parseExport=function(e,t){if(this.next(),this.eat(u.star))return this.parseExportAllDeclaration(e,t);if(this.eat(u._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};N.parseExportDeclaration=function(e){return this.parseStatement(null)};N.parseExportDefaultDeclaration=function(){var e;if(this.type===u._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Qe|Oi,!1,e)}else if(this.type===u._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};N.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ue(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};N.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};N.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}};N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};N.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")};N.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t};N.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=Rr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===u.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};N.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportSpecifier")};N.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportDefaultSpecifier")};N.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportNamespaceSpecifier")};N.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===u.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(u.comma)))return e;if(this.type===u.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(u.braceL);!this.eat(u.braceR);){if(t)t=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;e.push(this.parseImportSpecifier())}return e};N.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},i=!0;!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;Ue(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e};N.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(u.colon),this.type!==u.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return kr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};N.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)};N.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var fe=U.prototype;fe.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e};fe.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e};fe.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};fe.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==u.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};fe.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case u.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(u.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case u.braceL:return this.parseObj(!0)}return this.parseIdent()};fe.parseBindingList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(u.comma),t&&this.type===u.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===u.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else s.push(this.parseAssignableListItem(r))}return s};fe.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};fe.parseBindingListItem=function(e){return e};fe.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};fe.checkLValSimple=function(e,t,i){t===void 0&&(t=ht);var r=t!==ht;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===Ne&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ue(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Vi&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}};fe.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ht),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}};fe.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ht),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var de=function(t,i,r,s,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!n},$={b_stat:new de("{",!1),b_expr:new de("{",!0),b_tmpl:new de("${",!1),p_stat:new de("(",!1),p_expr:new de("(",!0),q_tmpl:new de("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new de("function",!1),f_expr:new de("function",!0),f_expr_gen:new de("function",!0,!1,null,!0),f_gen:new de("function",!1,!1,null,!0)},ze=U.prototype;ze.initialContext=function(){return[$.b_stat]};ze.curContext=function(){return this.context[this.context.length-1]};ze.braceIsBlock=function(e){var t=this.curContext();return t===$.f_expr||t===$.f_stat?!0:e===u.colon&&(t===$.b_stat||t===$.b_expr)?!t.isExpr:e===u._return||e===u.name&&this.exprAllowed?pe.test(this.input.slice(this.lastTokEnd,this.start)):e===u._else||e===u.semi||e===u.eof||e===u.parenR||e===u.arrow?!0:e===u.braceL?t===$.b_stat:e===u._var||e===u._const||e===u.name?!1:!this.exprAllowed};ze.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};ze.updateContext=function(e){var t,i=this.type;i.keyword&&e===u.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};ze.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};u.parenR.updateContext=u.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===$.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};u.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$.b_stat:$.b_expr),this.exprAllowed=!0};u.dollarBraceL.updateContext=function(){this.context.push($.b_tmpl),this.exprAllowed=!0};u.parenL.updateContext=function(e){var t=e===u._if||e===u._for||e===u._with||e===u._while;this.context.push(t?$.p_stat:$.p_expr),this.exprAllowed=!0};u.incDec.updateContext=function(){};u._function.updateContext=u._class.updateContext=function(e){e.beforeExpr&&e!==u._else&&!(e===u.semi&&this.curContext()!==$.p_stat)&&!(e===u._return&&pe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===u.colon||e===u.braceL)&&this.curContext()===$.b_stat)?this.context.push($.f_expr):this.context.push($.f_stat),this.exprAllowed=!1};u.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};u.backQuote.updateContext=function(){this.curContext()===$.q_tmpl?this.context.pop():this.context.push($.q_tmpl),this.exprAllowed=!1};u.star.updateContext=function(e){if(e===u._function){var t=this.context.length-1;this.context[t]===$.f_expr?this.context[t]=$.f_expr_gen:this.context[t]=$.f_gen}this.exprAllowed=!0};u.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==u.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var P=U.prototype;P.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var a=t[s];if(a){var o;n==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[n],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[s]={init:!1,get:!1,set:!1};a[n]=!0}};P.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===u.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(u.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s};P.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new gt,r=!0);var o=this.start,h=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var c=this.parseMaybeConditional(e,t);if(i&&(c=i.call(this,c,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===u.eq&&(c=this.toAssignable(c,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(c):this.checkLValSimple(c),l.left=c,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),c};P.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(u.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(u.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s};P.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)};P.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(n!=null&&(!s||this.type!==u._in)&&n>r){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(n=u.logicalAND.binop);var h=this.value;this.next();var c=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),c,l,n,s),g=this.buildBinary(t,i,e,f,h,a||o);return(a&&this.type===u.coalesce||o&&(this.type===u.logicalOR||this.type===u.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,s)}return e};P.buildBinary=function(e,t,i,r,s,n){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")};P.parseMaybeUnary=function(e,t,i,r){var s=this.start,n=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Mi(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Tt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===u.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,n);c.operator=this.value,c.prefix=!1,c.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(c,"UpdateExpression")}}if(!i&&this.eat(u.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,n,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function Mi(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Mi(e.expression)}function Tt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Tt(e.expression)||e.type==="ParenthesizedExpression"&&Tt(e.expression)}P.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};P.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}};P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)};P.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};P.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(u.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(u.bracketL);if(c||h&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var l=this.startNodeAt(t,i);l.object=e,c?(l.property=this.parseExpression(),this.expect(u.bracketR)):this.type===u.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!c,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(u.parenL)){var f=new gt,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=g,this.awaitPos=p,this.awaitIdentPos=x,this.parseSubscriptAsyncArrow(t,i,y,a);this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=x||this.awaitIdentPos;var w=this.startNodeAt(t,i);w.callee=e,w.arguments=y,o&&(w.optional=h),e=this.finishNode(w,"CallExpression")}else if(this.type===u.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};P.parseExprAtom=function(e,t,i){this.type===u.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(r,"Super");case u._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case u.name:var n=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(u._function))return this.overrideContext($.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(u.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case u.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return r=this.startNode(),r.value=this.type===u._null?null:this.type===u._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case u.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case u.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case u.braceL:return this.overrideContext($.b_expr),this.parseObj(!1,e);case u._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case u._class:return this.parseClass(this.startNode(),!1);case u._new:return this.parseNew();case u.backQuote:return this.parseTemplate();case u._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};P.parseExprAtomDefault=function(){this.unexpected()};P.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===u.parenL&&!e)return this.parseDynamicImport(t);if(this.type===u.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};P.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(u.parenR)?e.options=null:(this.expect(u.comma),this.afterTrailingComma(u.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(u.parenR)||(this.expect(u.comma),this.afterTrailingComma(u.parenR)||this.unexpected())));else if(!this.eat(u.parenR)){var t=this.start;this.eat(u.comma)&&this.eat(u.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};P.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};P.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};P.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e};P.shouldParseArrow=function(e){return!this.canInsertSemicolon()};P.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,h=[],c=!0,l=!1,f=new gt,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==u.parenR;)if(c?c=!1:this.expect(u.comma),n&&this.afterTrailingComma(u.parenR,!0)){l=!0;break}else if(this.type===u.ellipsis){x=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(h)&&this.eat(u.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,h,t);(!h.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(s=this.startNodeAt(a,o),s.expressions=h,this.finishNodeAt(s,"SequenceExpression",y,w)):s=h[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,r);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}else return s};P.parseParenItem=function(e){return e};P.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Vr=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===u.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Vr,this.finishNode(e,"NewExpression")};P.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
18
+ var Sr=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],_i=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Er="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Si="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",_t={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},St="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Nr={5:St,"5module":St+" export import",6:St+" const class extends export import super"},Cr=/^in(stanceof)?$/,kr=new RegExp("["+Si+"]"),Ir=new RegExp("["+Si+Er+"]");function At(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function _e(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&kr.test(String.fromCharCode(e)):t===!1?!1:At(e,_i)}function $e(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ir.test(String.fromCharCode(e)):t===!1?!1:At(e,_i)||At(e,Sr)}var O=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function ne(e,t){return new O(e,{beforeExpr:!0,binop:t})}var ae={beforeExpr:!0},ee={startsExpr:!0},Bt={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,Bt[e]=new O(e,t)}var u={num:new O("num",ee),regexp:new O("regexp",ee),string:new O("string",ee),name:new O("name",ee),privateId:new O("privateId",ee),eof:new O("eof"),bracketL:new O("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new O("]"),braceL:new O("{",{beforeExpr:!0,startsExpr:!0}),braceR:new O("}"),parenL:new O("(",{beforeExpr:!0,startsExpr:!0}),parenR:new O(")"),comma:new O(",",ae),semi:new O(";",ae),colon:new O(":",ae),dot:new O("."),question:new O("?",ae),questionDot:new O("?."),arrow:new O("=>",ae),template:new O("template"),invalidTemplate:new O("invalidTemplate"),ellipsis:new O("...",ae),backQuote:new O("`",ee),dollarBraceL:new O("${",{beforeExpr:!0,startsExpr:!0}),eq:new O("=",{beforeExpr:!0,isAssign:!0}),assign:new O("_=",{beforeExpr:!0,isAssign:!0}),incDec:new O("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new O("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ne("||",1),logicalAND:ne("&&",2),bitwiseOR:ne("|",3),bitwiseXOR:ne("^",4),bitwiseAND:ne("&",5),equality:ne("==/!=/===/!==",6),relational:ne("</>/<=/>=",7),bitShift:ne("<</>>/>>>",8),plusMin:new O("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ne("%",10),star:ne("*",10),slash:ne("/",10),starstar:new O("**",{beforeExpr:!0}),coalesce:ne("??",1),_break:V("break"),_case:V("case",ae),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",ae),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",ae),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",ee),_if:V("if"),_return:V("return",ae),_switch:V("switch"),_throw:V("throw",ae),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",ee),_super:V("super",ee),_class:V("class",ee),_extends:V("extends",ae),_export:V("export"),_import:V("import",ee),_null:V("null",ee),_true:V("true",ee),_false:V("false",ee),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},pe=/\r\n?|\n|\u2028|\u2029/,Ar=new RegExp(pe.source,"g");function qe(e){return e===10||e===13||e===8232||e===8233}function Ei(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(qe(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Ni=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,he=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ci=Object.prototype,Pr=Ci.hasOwnProperty,Tr=Ci.toString,Ue=Object.hasOwn||function(e,t){return Pr.call(e,t)},Qt=Array.isArray||function(e){return Tr.call(e)==="[object Array]"},Xt=Object.create(null);function ke(e){return Xt[e]||(Xt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Se(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Rr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Je=function(t,i){this.line=t,this.column=i};Je.prototype.offset=function(t){return new Je(this.line,this.column+t)};var gt=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function ki(e,t){for(var i=1,r=0;;){var s=Ei(e,r,t);if(s<0)return new Je(i,t-r);++i,r=s}}var Pt={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Zt=!1;function Dr(e){var t={};for(var i in Pt)t[i]=e&&Ue(e,i)?e[i]:Pt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Zt&&typeof console=="object"&&console.warn&&(Zt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
19
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Qt(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}return Qt(t.onComment)&&(t.onComment=Vr(t,t.onComment)),t}function Vr(e,t){return function(i,r,s,n,a,o){var h={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(h.loc=new gt(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}var et=1,Ke=2,Ft=4,Ii=8,Ai=16,Pi=32,jt=64,Ti=128,tt=256,$t=et|Ke|tt;function Wt(e,t){return Ke|(e?Ft:0)|(t?Ii:0)}var ct=0,qt=1,Ne=2,Ri=3,Di=4,Vi=5,U=function(t,i,r){this.options=t=Dr(t),this.sourceFile=t.sourceFile,this.keywords=ke(Nr[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=_t[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=ke(s);var n=(s?s+" ":"")+_t.strict;this.reservedWordsStrict=ke(n),this.reservedWordsStrictBind=ke(n+" "+_t.strictBind),this.input=String(i),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
20
+ `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(pe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},we={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};U.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};we.inFunction.get=function(){return(this.currentVarScope().flags&Ke)>0};we.inGenerator.get=function(){return(this.currentVarScope().flags&Ii)>0&&!this.currentVarScope().inClassFieldInit};we.inAsync.get=function(){return(this.currentVarScope().flags&Ft)>0&&!this.currentVarScope().inClassFieldInit};we.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&tt)return!1;if(t.flags&Ke)return(t.flags&Ft)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};we.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&jt)>0||i||this.options.allowSuperOutsideMethod};we.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ti)>0};we.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};we.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Ke|tt))>0||i};we.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&tt)>0};U.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r};U.parse=function(t,i){return new this(i,t).parse()};U.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()};U.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(U.prototype,we);var J=U.prototype,Or=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;J.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){he.lastIndex=e,e+=he.exec(this.input)[0].length;var t=Or.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){he.lastIndex=e+t[0].length;var i=he.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||pe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,he.lastIndex=e,e+=he.exec(this.input)[0].length,this.input[e]===";"&&e++}};J.eat=function(e){return this.type===e?(this.next(),!0):!1};J.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc};J.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};J.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};J.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||pe.test(this.input.slice(this.lastTokEnd,this.start))};J.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};J.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()};J.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};J.expect=function(e){this.eat(e)||this.unexpected()};J.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};J.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};J.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};J.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};J.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var N=U.prototype;N.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ut={kind:"loop"},Mr={kind:"switch"};N.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;he.lastIndex=this.pos;var t=he.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(_e(r,!0)){for(var s=i+1;$e(r=this.input.charCodeAt(s),!0);)++s;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!Cr.test(n))return!0}return!1};N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;he.lastIndex=this.pos;var e=he.exec(this.input),t=this.pos+e[0].length,i;return!pe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!($e(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};N.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),n;switch(this.isLet(e)&&(r=u._var,n="let"),r){case u._break:case u._continue:return this.parseBreakContinueStatement(s,r.keyword);case u._debugger:return this.parseDebuggerStatement(s);case u._do:return this.parseDoStatement(s);case u._for:return this.parseForStatement(s);case u._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case u._class:return e&&this.unexpected(),this.parseClass(s,!0);case u._if:return this.parseIfStatement(s);case u._return:return this.parseReturnStatement(s);case u._switch:return this.parseSwitchStatement(s);case u._throw:return this.parseThrowStatement(s);case u._try:return this.parseTryStatement(s);case u._const:case u._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(s,n);case u._while:return this.parseWhileStatement(s);case u._with:return this.parseWithStatement(s);case u.braceL:return this.parseBlock(!0,s);case u.semi:return this.parseEmptyStatement(s);case u._export:case u._import:if(this.options.ecmaVersion>10&&r===u._import){he.lastIndex=this.pos;var a=he.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(h===40||h===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===u._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var c=this.value,l=this.parseExpression();return r===u.name&&l.type==="Identifier"&&this.eat(u.colon)?this.parseLabeledStatement(s,c,l,e):this.parseExpressionStatement(s,l)}};N.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(u.semi)||this.insertSemicolon()?e.label=null:this.type!==u.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};N.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};N.parseDoStatement=function(e){return this.next(),this.labels.push(Ut),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(u._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(u.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};N.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ut),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===u._var||this.type===u._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===u._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new xt,c=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===u._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===u._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===c&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};N.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Qe|(i?0:Tt),!1,t)};N.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(u._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};N.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(u.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};N.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(Mr),this.enterScope(0);for(var t,i=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var r=this.type===u._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(u.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};N.parseThrowStatement=function(e){return this.next(),pe.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Lr=[];N.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Pi:0),this.checkLValPattern(e,t?Di:Ne),this.expect(u.parenR),e};N.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===u._catch){var t=this.startNode();this.next(),this.eat(u.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(u._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};N.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};N.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ut),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};N.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};N.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};N.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){var a=n[s];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===u._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};N.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};N.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(u.braceL),e&&this.enterScope(0);this.type!==u.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};N.parseFor=function(e,t){return e.init=t,this.expect(u.semi),e.test=this.type===u.semi?null:this.parseExpression(),this.expect(u.semi),e.update=this.type===u.parenR?null:this.parseExpression(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};N.parseForIn=function(e,t){var i=this.type===u._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};N.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(u.eq)?s.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&s.id.type!=="Identifier"&&!(t&&(this.type===u._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(u.comma))break}return e};N.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?qt:Ne,!1)};var Qe=1,Tt=2,Oi=4;N.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===u.star&&t&Tt&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Qe&&(e.id=t&Oi&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&Tt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?qt:Ne:Ri));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Wt(e.async,e.generator)),t&Qe||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Qe?"FunctionDeclaration":"FunctionExpression")};N.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};N.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(u.braceL);this.type!==u.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(n&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&a.key.type==="PrivateIdentifier"&&Br(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};N.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===u.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===u.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(u.star)&&(s=!0),!r&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===u.parenL||a!=="method"||s||n){var c=!i.static&&ut(i,"constructor"),l=c&&e;c&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":a,this.parseClassMethod(i,s,n,l)}else this.parseClassField(i);return i};N.isClassElementNameStart=function(){return this.type===u.name||this.type===u.privateId||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword};N.parseClassElementName=function(e){this.type===u.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};N.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&ut(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};N.parseClassField=function(e){if(ut(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ut(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};N.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(tt|jt);this.type!==u.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};N.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Ne,!1)):(t===!0&&this.unexpected(),e.id=null)};N.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null};N.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};N.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];Ue(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Br(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function ut(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}N.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};N.parseExport=function(e,t){if(this.next(),this.eat(u.star))return this.parseExportAllDeclaration(e,t);if(this.eat(u._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};N.parseExportDeclaration=function(e){return this.parseStatement(null)};N.parseExportDefaultDeclaration=function(){var e;if(this.type===u._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Qe|Oi,!1,e)}else if(this.type===u._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};N.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ue(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};N.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};N.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}};N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};N.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")};N.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t};N.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=Lr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===u.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};N.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportSpecifier")};N.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportDefaultSpecifier")};N.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Ne),this.finishNode(e,"ImportNamespaceSpecifier")};N.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===u.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(u.comma)))return e;if(this.type===u.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(u.braceL);!this.eat(u.braceR);){if(t)t=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;e.push(this.parseImportSpecifier())}return e};N.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},i=!0;!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;Ue(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e};N.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(u.colon),this.type!==u.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return Rr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};N.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)};N.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var fe=U.prototype;fe.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e};fe.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e};fe.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};fe.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==u.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};fe.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case u.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(u.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case u.braceL:return this.parseObj(!0)}return this.parseIdent()};fe.parseBindingList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(u.comma),t&&this.type===u.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===u.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else s.push(this.parseAssignableListItem(r))}return s};fe.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};fe.parseBindingListItem=function(e){return e};fe.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};fe.checkLValSimple=function(e,t,i){t===void 0&&(t=ct);var r=t!==ct;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===Ne&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ue(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Vi&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}};fe.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ct),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}};fe.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ct),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var de=function(t,i,r,s,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!n},$={b_stat:new de("{",!1),b_expr:new de("{",!0),b_tmpl:new de("${",!1),p_stat:new de("(",!1),p_expr:new de("(",!0),q_tmpl:new de("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new de("function",!1),f_expr:new de("function",!0),f_expr_gen:new de("function",!0,!1,null,!0),f_gen:new de("function",!1,!1,null,!0)},ze=U.prototype;ze.initialContext=function(){return[$.b_stat]};ze.curContext=function(){return this.context[this.context.length-1]};ze.braceIsBlock=function(e){var t=this.curContext();return t===$.f_expr||t===$.f_stat?!0:e===u.colon&&(t===$.b_stat||t===$.b_expr)?!t.isExpr:e===u._return||e===u.name&&this.exprAllowed?pe.test(this.input.slice(this.lastTokEnd,this.start)):e===u._else||e===u.semi||e===u.eof||e===u.parenR||e===u.arrow?!0:e===u.braceL?t===$.b_stat:e===u._var||e===u._const||e===u.name?!1:!this.exprAllowed};ze.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};ze.updateContext=function(e){var t,i=this.type;i.keyword&&e===u.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};ze.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};u.parenR.updateContext=u.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===$.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};u.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$.b_stat:$.b_expr),this.exprAllowed=!0};u.dollarBraceL.updateContext=function(){this.context.push($.b_tmpl),this.exprAllowed=!0};u.parenL.updateContext=function(e){var t=e===u._if||e===u._for||e===u._with||e===u._while;this.context.push(t?$.p_stat:$.p_expr),this.exprAllowed=!0};u.incDec.updateContext=function(){};u._function.updateContext=u._class.updateContext=function(e){e.beforeExpr&&e!==u._else&&!(e===u.semi&&this.curContext()!==$.p_stat)&&!(e===u._return&&pe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===u.colon||e===u.braceL)&&this.curContext()===$.b_stat)?this.context.push($.f_expr):this.context.push($.f_stat),this.exprAllowed=!1};u.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};u.backQuote.updateContext=function(){this.curContext()===$.q_tmpl?this.context.pop():this.context.push($.q_tmpl),this.exprAllowed=!1};u.star.updateContext=function(e){if(e===u._function){var t=this.context.length-1;this.context[t]===$.f_expr?this.context[t]=$.f_expr_gen:this.context[t]=$.f_gen}this.exprAllowed=!0};u.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==u.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var P=U.prototype;P.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var a=t[s];if(a){var o;n==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[n],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[s]={init:!1,get:!1,set:!1};a[n]=!0}};P.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===u.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(u.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s};P.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xt,r=!0);var o=this.start,h=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var c=this.parseMaybeConditional(e,t);if(i&&(c=i.call(this,c,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===u.eq&&(c=this.toAssignable(c,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(c):this.checkLValSimple(c),l.left=c,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),c};P.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(u.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(u.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s};P.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)};P.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(n!=null&&(!s||this.type!==u._in)&&n>r){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(n=u.logicalAND.binop);var h=this.value;this.next();var c=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),c,l,n,s),g=this.buildBinary(t,i,e,f,h,a||o);return(a&&this.type===u.coalesce||o&&(this.type===u.logicalOR||this.type===u.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,s)}return e};P.buildBinary=function(e,t,i,r,s,n){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")};P.parseMaybeUnary=function(e,t,i,r){var s=this.start,n=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Mi(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Rt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===u.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,n);c.operator=this.value,c.prefix=!1,c.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(c,"UpdateExpression")}}if(!i&&this.eat(u.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,n,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function Mi(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Mi(e.expression)}function Rt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Rt(e.expression)||e.type==="ParenthesizedExpression"&&Rt(e.expression)}P.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};P.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}};P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)};P.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};P.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(u.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(u.bracketL);if(c||h&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var l=this.startNodeAt(t,i);l.object=e,c?(l.property=this.parseExpression(),this.expect(u.bracketR)):this.type===u.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!c,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(u.parenL)){var f=new xt,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=g,this.awaitPos=p,this.awaitIdentPos=x,this.parseSubscriptAsyncArrow(t,i,y,a);this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=x||this.awaitIdentPos;var w=this.startNodeAt(t,i);w.callee=e,w.arguments=y,o&&(w.optional=h),e=this.finishNode(w,"CallExpression")}else if(this.type===u.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};P.parseExprAtom=function(e,t,i){this.type===u.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(r,"Super");case u._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case u.name:var n=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(u._function))return this.overrideContext($.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(u.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case u.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return r=this.startNode(),r.value=this.type===u._null?null:this.type===u._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case u.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case u.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case u.braceL:return this.overrideContext($.b_expr),this.parseObj(!1,e);case u._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case u._class:return this.parseClass(this.startNode(),!1);case u._new:return this.parseNew();case u.backQuote:return this.parseTemplate();case u._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};P.parseExprAtomDefault=function(){this.unexpected()};P.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===u.parenL&&!e)return this.parseDynamicImport(t);if(this.type===u.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};P.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(u.parenR)?e.options=null:(this.expect(u.comma),this.afterTrailingComma(u.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(u.parenR)||(this.expect(u.comma),this.afterTrailingComma(u.parenR)||this.unexpected())));else if(!this.eat(u.parenR)){var t=this.start;this.eat(u.comma)&&this.eat(u.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};P.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};P.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};P.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e};P.shouldParseArrow=function(e){return!this.canInsertSemicolon()};P.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,h=[],c=!0,l=!1,f=new xt,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==u.parenR;)if(c?c=!1:this.expect(u.comma),n&&this.afterTrailingComma(u.parenR,!0)){l=!0;break}else if(this.type===u.ellipsis){x=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(h)&&this.eat(u.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,h,t);(!h.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(s=this.startNodeAt(a,o),s.expressions=h,this.finishNodeAt(s,"SequenceExpression",y,w)):s=h[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,r);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}else return s};P.parseParenItem=function(e){return e};P.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Fr=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===u.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Fr,this.finishNode(e,"NewExpression")};P.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
21
21
  `),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
22
- `),cooked:this.value},this.next(),i.tail=this.type===u.backQuote,this.finishNode(i,"TemplateElement")};P.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(u.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};P.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!pe.test(this.input.slice(this.lastTokEnd,this.start))};P.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(u.braceR);){if(r)r=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};P.parseProperty=function(e,t){var i=this.startNode(),r,s,n,a;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===u.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,a=this.startLoc),e||(r=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,n,a,t,o),this.finishNode(i,"Property")};P.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};P.parsePropertyValue=function(e,t,i,r,s,n,a,o){(i||r)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==u.comma&&this.type!==u.braceR&&this.type!==u.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===u.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};P.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};P.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};P.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope($t(t,r.generator)|Ft|(i?Ti:0)),this.expect(u.parenL),r.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};P.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope($t(i,!1)|Ai),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")};P.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==u.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Vi),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};P.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0};P.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,Wt,t?null:i)}};P.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(u.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(r),r&&this.type===u.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s};P.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}};P.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};P.parseIdentNode=function(){var e=this.startNode();return this.type===u.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=u.name):this.unexpected(),e};P.parsePrivateIdent=function(){var e=this.startNode();return this.type===u.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e};P.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===u.semi||this.canInsertSemicolon()||this.type!==u.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(u.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};P.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var ut=U.prototype;ut.raise=function(e,t){var i=ki(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r};ut.raiseRecoverable=ut.raise;ut.curPosition=function(){if(this.options.locations)return new Ze(this.curLine,this.pos-this.lineStart)};var Pe=U.prototype,Or=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Pe.enterScope=function(e){this.scopeStack.push(new Or(e))};Pe.exitScope=function(){this.scopeStack.pop()};Pe.treatFunctionsAsVarInScope=function(e){return e.flags&Ke||!this.inModule&&e.flags&Je};Pe.declareName=function(e,t,i){var r=!1;if(t===Ne){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&Je&&delete this.undefinedExports[e]}else if(t===Di){var n=this.currentScope();n.lexical.push(e)}else if(t===Ri){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(e)>-1:r=a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var h=this.scopeStack[o];if(h.lexical.indexOf(e)>-1&&!(h.flags&Pi&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){r=!0;break}if(h.var.push(e),this.inModule&&h.flags&Je&&delete this.undefinedExports[e],h.flags&jt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};Pe.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};Pe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Pe.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&jt)return t}};Pe.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&jt&&!(t.flags&Ai))return t}};var xt=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new dt(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},tt=U.prototype;tt.startNode=function(){return new xt(this,this.start,this.startLoc)};tt.startNodeAt=function(e,t){return new xt(this,e,t)};function Li(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}tt.finishNode=function(e,t){return Li.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};tt.finishNodeAt=function(e,t,i,r){return Li.call(this,e,t,i,r)};tt.copyNode=function(e){var t=new xt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Mr="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Bi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Fi=Bi+" Extended_Pictographic",ji=Fi,$i=ji+" EBase EComp EMod EPres ExtPict",Wi=$i,Lr=Wi,Br={9:Bi,10:Fi,11:ji,12:$i,13:Wi,14:Lr},Fr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",jr={9:"",10:"",11:"",12:"",13:"",14:Fr},Jt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",qi="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ui=qi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ki=Ui+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",zi=Ki+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Hi=zi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",$r=Hi+" "+Mr,Wr={9:qi,10:Ui,11:Ki,12:zi,13:Hi,14:$r},Gi={};function qr(e){var t=Gi[e]={binary:ke(Br[e]+" "+Jt),binaryOfStrings:ke(jr[e]),nonBinary:{General_Category:ke(Jt),Script:ke(Wr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var St=0,ei=[9,10,11,12,13,14];St<ei.length;St+=1){var Ur=ei[St];qr(Ur)}var S=U.prototype,lt=function(t,i){this.parent=t,this.base=i||this};lt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var r=t;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1};lt.prototype.sibling=function(){return new lt(this.parent,this.base)};var be=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Gi[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};be.prototype.reset=function(t,i,r){var s=r.indexOf("v")!==-1,n=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)};be.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};be.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=s)return n;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n};be.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var n=r.charCodeAt(t),a;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=s||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2};be.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};be.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};be.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};be.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};be.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,n=t;s<n.length;s+=1){var a=n[s],o=this.at(r,i);if(o===-1||o!==a)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};S.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,n=0;n<i.length;n++){var a=i.charAt(n);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")};function Kr(e){for(var t in e)return!0;return!1}S.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Kr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};S.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}};S.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new lt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};S.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};S.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1};S.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};S.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};S.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};S.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1};S.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)};S.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};S.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var n=i.charAt(s);i.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);!i&&!a&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1};S.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};S.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&zr(i);)t+=Se(i),e.advance();return t};function zr(e){return e===105||e===109||e===115}S.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};S.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};S.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Yi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Yi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}S.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Yi(i);)e.advance();return e.pos!==t};S.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};S.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){var n=s[r];n.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}};S.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};S.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Se(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Se(e.lastIntValue);return!0}return!1};S.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Hr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Hr(e){return _e(e,!0)||e===36||e===95}S.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Gr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Gr(e){return $e(e,!0)||e===36||e===95||e===8204||e===8205}S.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};S.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};S.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};S.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};S.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};S.regexp_eatZero=function(e){return e.current()===48&&!yt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};S.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};S.regexp_eatControlLetter=function(e){var t=e.current();return Qi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Qi(e){return e>=65&&e<=90||e>=97&&e<=122}S.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}e.pos=n,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Yr(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Yr(e){return e>=0&&e<=1114111}S.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};S.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Xi=0,Ee=1,ce=2;S.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Qr(t))return e.lastIntValue=-1,e.advance(),Ee;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&r===ce&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Xi};function Qr(e){return e===100||e===68||e===115||e===83||e===119||e===87}S.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),Ee}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return Xi};S.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ue(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};S.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ee;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ce;e.raise("Invalid property name")};S.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Zi(t=e.current());)e.lastStringValue+=Se(t),e.advance();return e.lastStringValue!==""};function Zi(e){return Qi(e)||e===95}S.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Xr(t=e.current());)e.lastStringValue+=Se(t),e.advance();return e.lastStringValue!==""};function Xr(e){return Zi(e)||yt(e)}S.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};S.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===ce&&e.raise("Negated character class may contain strings"),!0}return!1};S.regexp_classContents=function(e){return e.current()===93?Ee:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ee)};S.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};S.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||tr(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1};S.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};S.regexp_classSetExpression=function(e){var t=Ee,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ce&&(t=ce);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ce&&(t=Ee);continue}e.raise("Invalid character in character class")}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===ce&&(t=ce)}};S.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return i!==-1&&r!==-1&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};S.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ee:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};S.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&r===ce&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null};S.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};S.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ce&&(t=ce);return t};S.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ee:ce};S.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zr(i)||Jr(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zr(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Jr(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}S.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return es(t)?(e.lastIntValue=t,e.advance(),!0):!1};function es(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}S.regexp_eatClassControlLetter=function(e){var t=e.current();return yt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};S.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};S.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;yt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function yt(e){return e>=48&&e<=57}S.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ji(i=e.current());)e.lastIntValue=16*e.lastIntValue+er(i),e.advance();return e.pos!==t};function Ji(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function er(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}S.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};S.regexp_eatOctalDigit=function(e){var t=e.current();return tr(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function tr(e){return e>=48&&e<=55}S.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Ji(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+er(s),e.advance()}return!0};var Ut=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new dt(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},D=U.prototype;D.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ut(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};D.getToken=function(){return this.next(),new Ut(this)};typeof Symbol<"u"&&(D[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}});D.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(u.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};D.readToken=function(e){return _e(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};D.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};D.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=Ei(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};D.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!qe(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())};D.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&Ni.test(String.fromCharCode(e)))++this.pos;else break e}}};D.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};D.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(u.ellipsis)):(++this.pos,this.finishToken(u.dot))};D.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(u.assign,2):this.finishOp(u.slash,1)};D.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?u.star:u.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=u.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(u.assign,i+1):this.finishOp(r,i)};D.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(u.assign,3)}return this.finishOp(e===124?u.logicalOR:u.logicalAND,2)}return t===61?this.finishOp(u.assign,2):this.finishOp(e===124?u.bitwiseOR:u.bitwiseAND,1)};D.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)};D.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||pe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.incDec,2):t===61?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)};D.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(u.assign,i+1):this.finishOp(u.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(u.relational,i))};D.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(u.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(e===61?u.eq:u.prefix,1)};D.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(u.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(u.assign,3)}return this.finishOp(u.coalesce,2)}}return this.finishOp(u.question,1)};D.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),_e(t,!0)||t===92))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Se(t)+"'")};D.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(u.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Se(e)+"'")};D.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};D.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(pe.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new be(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch{}return this.finishToken(u.regexp,{pattern:s,flags:a,value:h})};D.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,o=0,h=0,c=t??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),h===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;continue}if(l>=97?f=l-97+10:l>=65?f=l-65+10:l>=48&&l<=57?f=l-48:f=1/0,f>=e)break;o=l,a=a*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:a};function ts(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function ir(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}D.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=ir(this.input.slice(t,this.pos)),++this.pos):_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)};D.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=ir(this.input.slice(t,this.pos));return++this.pos,_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=ts(this.input.slice(t,this.pos),i);return this.finishToken(u.num,n)};D.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};D.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(qe(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(u.string,t)};var rr={};D.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===rr)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};D.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw rr;this.raise(e,t)};D.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===u.template||this.type===u.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(qe(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
22
+ `),cooked:this.value},this.next(),i.tail=this.type===u.backQuote,this.finishNode(i,"TemplateElement")};P.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(u.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};P.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!pe.test(this.input.slice(this.lastTokEnd,this.start))};P.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(u.braceR);){if(r)r=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};P.parseProperty=function(e,t){var i=this.startNode(),r,s,n,a;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===u.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,a=this.startLoc),e||(r=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,n,a,t,o),this.finishNode(i,"Property")};P.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};P.parsePropertyValue=function(e,t,i,r,s,n,a,o){(i||r)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==u.comma&&this.type!==u.braceR&&this.type!==u.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===u.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};P.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};P.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};P.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Wt(t,r.generator)|jt|(i?Ti:0)),this.expect(u.parenL),r.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};P.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Wt(i,!1)|Ai),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")};P.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==u.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Vi),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};P.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0};P.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,qt,t?null:i)}};P.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(u.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(r),r&&this.type===u.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s};P.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}};P.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};P.parseIdentNode=function(){var e=this.startNode();return this.type===u.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=u.name):this.unexpected(),e};P.parsePrivateIdent=function(){var e=this.startNode();return this.type===u.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e};P.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===u.semi||this.canInsertSemicolon()||this.type!==u.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(u.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};P.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var lt=U.prototype;lt.raise=function(e,t){var i=ki(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r};lt.raiseRecoverable=lt.raise;lt.curPosition=function(){if(this.options.locations)return new Je(this.curLine,this.pos-this.lineStart)};var Pe=U.prototype,jr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Pe.enterScope=function(e){this.scopeStack.push(new jr(e))};Pe.exitScope=function(){this.scopeStack.pop()};Pe.treatFunctionsAsVarInScope=function(e){return e.flags&Ke||!this.inModule&&e.flags&et};Pe.declareName=function(e,t,i){var r=!1;if(t===Ne){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&et&&delete this.undefinedExports[e]}else if(t===Di){var n=this.currentScope();n.lexical.push(e)}else if(t===Ri){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(e)>-1:r=a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var h=this.scopeStack[o];if(h.lexical.indexOf(e)>-1&&!(h.flags&Pi&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){r=!0;break}if(h.var.push(e),this.inModule&&h.flags&et&&delete this.undefinedExports[e],h.flags&$t)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};Pe.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};Pe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Pe.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&$t)return t}};Pe.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&$t&&!(t.flags&Ai))return t}};var yt=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new gt(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},it=U.prototype;it.startNode=function(){return new yt(this,this.start,this.startLoc)};it.startNodeAt=function(e,t){return new yt(this,e,t)};function Li(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}it.finishNode=function(e,t){return Li.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};it.finishNodeAt=function(e,t,i,r){return Li.call(this,e,t,i,r)};it.copyNode=function(e){var t=new yt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var $r="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Bi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Fi=Bi+" Extended_Pictographic",ji=Fi,$i=ji+" EBase EComp EMod EPres ExtPict",Wi=$i,Wr=Wi,qr={9:Bi,10:Fi,11:ji,12:$i,13:Wi,14:Wr},Ur="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Kr={9:"",10:"",11:"",12:"",13:"",14:Ur},Jt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",qi="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ui=qi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ki=Ui+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",zi=Ki+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Hi=zi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",zr=Hi+" "+$r,Hr={9:qi,10:Ui,11:Ki,12:zi,13:Hi,14:zr},Gi={};function Gr(e){var t=Gi[e]={binary:ke(qr[e]+" "+Jt),binaryOfStrings:ke(Kr[e]),nonBinary:{General_Category:ke(Jt),Script:ke(Hr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Et=0,ei=[9,10,11,12,13,14];Et<ei.length;Et+=1){var Yr=ei[Et];Gr(Yr)}var S=U.prototype,pt=function(t,i){this.parent=t,this.base=i||this};pt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var r=t;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1};pt.prototype.sibling=function(){return new pt(this.parent,this.base)};var be=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Gi[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};be.prototype.reset=function(t,i,r){var s=r.indexOf("v")!==-1,n=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)};be.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};be.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=s)return n;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n};be.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var n=r.charCodeAt(t),a;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=s||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2};be.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};be.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};be.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};be.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};be.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,n=t;s<n.length;s+=1){var a=n[s],o=this.at(r,i);if(o===-1||o!==a)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};S.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,n=0;n<i.length;n++){var a=i.charAt(n);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")};function Qr(e){for(var t in e)return!0;return!1}S.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Qr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};S.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}};S.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new pt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};S.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};S.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1};S.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};S.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};S.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};S.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1};S.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)};S.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};S.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var n=i.charAt(s);i.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);!i&&!a&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1};S.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};S.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&Xr(i);)t+=Se(i),e.advance();return t};function Xr(e){return e===105||e===109||e===115}S.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};S.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};S.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Yi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Yi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}S.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Yi(i);)e.advance();return e.pos!==t};S.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};S.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){var n=s[r];n.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}};S.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};S.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Se(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Se(e.lastIntValue);return!0}return!1};S.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Zr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Zr(e){return _e(e,!0)||e===36||e===95}S.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Jr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Jr(e){return $e(e,!0)||e===36||e===95||e===8204||e===8205}S.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};S.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};S.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};S.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};S.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};S.regexp_eatZero=function(e){return e.current()===48&&!wt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};S.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};S.regexp_eatControlLetter=function(e){var t=e.current();return Qi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Qi(e){return e>=65&&e<=90||e>=97&&e<=122}S.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}e.pos=n,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&es(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function es(e){return e>=0&&e<=1114111}S.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};S.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Xi=0,Ee=1,ce=2;S.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(ts(t))return e.lastIntValue=-1,e.advance(),Ee;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&r===ce&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Xi};function ts(e){return e===100||e===68||e===115||e===83||e===119||e===87}S.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),Ee}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return Xi};S.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ue(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};S.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ee;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ce;e.raise("Invalid property name")};S.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Zi(t=e.current());)e.lastStringValue+=Se(t),e.advance();return e.lastStringValue!==""};function Zi(e){return Qi(e)||e===95}S.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";is(t=e.current());)e.lastStringValue+=Se(t),e.advance();return e.lastStringValue!==""};function is(e){return Zi(e)||wt(e)}S.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};S.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===ce&&e.raise("Negated character class may contain strings"),!0}return!1};S.regexp_classContents=function(e){return e.current()===93?Ee:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ee)};S.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};S.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||tr(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1};S.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};S.regexp_classSetExpression=function(e){var t=Ee,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ce&&(t=ce);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ce&&(t=Ee);continue}e.raise("Invalid character in character class")}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===ce&&(t=ce)}};S.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return i!==-1&&r!==-1&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};S.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ee:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};S.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&r===ce&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null};S.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};S.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ce&&(t=ce);return t};S.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ee:ce};S.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&rs(i)||ss(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function rs(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function ss(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}S.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ns(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ns(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}S.regexp_eatClassControlLetter=function(e){var t=e.current();return wt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};S.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};S.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;wt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function wt(e){return e>=48&&e<=57}S.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ji(i=e.current());)e.lastIntValue=16*e.lastIntValue+er(i),e.advance();return e.pos!==t};function Ji(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function er(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}S.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};S.regexp_eatOctalDigit=function(e){var t=e.current();return tr(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function tr(e){return e>=48&&e<=55}S.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Ji(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+er(s),e.advance()}return!0};var Kt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new gt(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},D=U.prototype;D.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Kt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};D.getToken=function(){return this.next(),new Kt(this)};typeof Symbol<"u"&&(D[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}});D.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(u.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};D.readToken=function(e){return _e(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};D.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};D.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=Ei(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};D.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!qe(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())};D.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&Ni.test(String.fromCharCode(e)))++this.pos;else break e}}};D.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};D.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(u.ellipsis)):(++this.pos,this.finishToken(u.dot))};D.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(u.assign,2):this.finishOp(u.slash,1)};D.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?u.star:u.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=u.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(u.assign,i+1):this.finishOp(r,i)};D.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(u.assign,3)}return this.finishOp(e===124?u.logicalOR:u.logicalAND,2)}return t===61?this.finishOp(u.assign,2):this.finishOp(e===124?u.bitwiseOR:u.bitwiseAND,1)};D.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)};D.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||pe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.incDec,2):t===61?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)};D.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(u.assign,i+1):this.finishOp(u.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(u.relational,i))};D.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(u.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(e===61?u.eq:u.prefix,1)};D.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(u.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(u.assign,3)}return this.finishOp(u.coalesce,2)}}return this.finishOp(u.question,1)};D.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),_e(t,!0)||t===92))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Se(t)+"'")};D.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(u.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Se(e)+"'")};D.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};D.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(pe.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new be(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch{}return this.finishToken(u.regexp,{pattern:s,flags:a,value:h})};D.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,o=0,h=0,c=t??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),h===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;continue}if(l>=97?f=l-97+10:l>=65?f=l-65+10:l>=48&&l<=57?f=l-48:f=1/0,f>=e)break;o=l,a=a*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:a};function as(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function ir(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}D.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=ir(this.input.slice(t,this.pos)),++this.pos):_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)};D.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=ir(this.input.slice(t,this.pos));return++this.pos,_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),_e(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=as(this.input.slice(t,this.pos),i);return this.finishToken(u.num,n)};D.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};D.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(qe(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(u.string,t)};var rr={};D.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===rr)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};D.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw rr;this.raise(e,t)};D.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===u.template||this.type===u.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(qe(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
23
23
  `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};D.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(u.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
24
24
  `&&++this.pos;case`
25
25
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};D.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
26
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Se(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return qe(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};D.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};D.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if($e(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?_e:$e)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=Se(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};D.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=Lt[e]),this.finishToken(t,e)};var is="8.14.0";U.acorn={Parser:U,version:is,defaultOptions:At,Position:Ze,SourceLocation:dt,getLineInfo:ki,Node:xt,TokenType:O,tokTypes:u,keywordTypes:Lt,TokContext:de,tokContexts:$,isIdentifierChar:$e,isIdentifierStart:_e,Token:Ut,isNewLine:qe,lineBreak:pe,lineBreakG:Er,nonASCIIwhitespace:Ni};function sr(e,t){return U.parse(e,t)}const{stringify:rs}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");const nt={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},ge=17,ss={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:ge,ClassExpression:ge,FunctionExpression:ge,ObjectExpression:ge,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Fe(e,t){const{generator:i}=e;if(e.write("("),t!=null&&t.length>0){i[t[0].type](t[0],e);const{length:r}=t;for(let s=1;s<r;s++){const n=t[s];e.write(", "),i[n.type](n,e)}}e.write(")")}function nr(e,t,i,r){const s=e.expressionsPrecedence[t.type];if(s===ge)return!0;const n=e.expressionsPrecedence[i.type];return s!==n?!r&&s===15&&n===14&&i.operator==="**"||s<n:s!==13&&s!==14?!1:t.operator==="**"&&i.operator==="**"?!r:s===13&&n===13&&(t.operator==="??"||i.operator==="??")?!0:r?nt[t.operator]<=nt[i.operator]:nt[t.operator]<nt[i.operator]}function at(e,t,i,r){const{generator:s}=e;nr(e,t,i,r)?(e.write("("),s[t.type](t,e),e.write(")")):s[t.type](t,e)}function ns(e,t,i,r){const s=t.split(`
26
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Se(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return qe(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};D.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};D.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if($e(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?_e:$e)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=Se(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};D.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=Bt[e]),this.finishToken(t,e)};var os="8.14.0";U.acorn={Parser:U,version:os,defaultOptions:Pt,Position:Je,SourceLocation:gt,getLineInfo:ki,Node:yt,TokenType:O,tokTypes:u,keywordTypes:Bt,TokContext:de,tokContexts:$,isIdentifierChar:$e,isIdentifierStart:_e,Token:Kt,isNewLine:qe,lineBreak:pe,lineBreakG:Ar,nonASCIIwhitespace:Ni};function sr(e,t){return U.parse(e,t)}const{stringify:hs}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");const at={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},ge=17,cs={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:ge,ClassExpression:ge,FunctionExpression:ge,ObjectExpression:ge,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Fe(e,t){const{generator:i}=e;if(e.write("("),t!=null&&t.length>0){i[t[0].type](t[0],e);const{length:r}=t;for(let s=1;s<r;s++){const n=t[s];e.write(", "),i[n.type](n,e)}}e.write(")")}function nr(e,t,i,r){const s=e.expressionsPrecedence[t.type];if(s===ge)return!0;const n=e.expressionsPrecedence[i.type];return s!==n?!r&&s===15&&n===14&&i.operator==="**"||s<n:s!==13&&s!==14?!1:t.operator==="**"&&i.operator==="**"?!r:s===13&&n===13&&(t.operator==="??"||i.operator==="??")?!0:r?at[t.operator]<=at[i.operator]:at[t.operator]<at[i.operator]}function ot(e,t,i,r){const{generator:s}=e;nr(e,t,i,r)?(e.write("("),s[t.type](t,e),e.write(")")):s[t.type](t,e)}function us(e,t,i,r){const s=t.split(`
27
27
  `),n=s.length-1;if(e.write(s[0].trim()),n>0){e.write(r);for(let a=1;a<n;a++)e.write(i+s[a].trim()+r);e.write(i+s[n].trim())}}function X(e,t,i,r){const{length:s}=t;for(let n=0;n<s;n++){const a=t[n];e.write(i),a.type[0]==="L"?e.write("// "+a.value.trim()+`
28
- `,a):(e.write("/*"),ns(e,a.value,i,r),e.write("*/"+r))}}function as(e){let t=e;for(;t!=null;){const{type:i}=t;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")t=t.object;else return!1}}function Et(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],e);for(let n=1;n<s;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}let ti,ii,ri,si,ni,ai;const Kt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:s}=t;s&&e.comments!=null&&X(t,e.comments,i,r);const n=e.body,{length:a}=n;for(let o=0;o<a;o++){const h=n[o];s&&h.comments!=null&&X(t,h.comments,i,r),t.write(i),this[h.type](h,t),t.write(r)}s&&e.trailingComments!=null&&X(t,e.trailingComments,i,r)},BlockStatement:ai=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const{length:o}=a;for(let h=0;h<o;h++){const c=a[h];s&&c.comments!=null&&X(t,c.comments,n,r),t.write(n),this[c.type](c,t),t.write(r)}t.write(i)}else s&&e.comments!=null&&(t.write(r),X(t,e.comments,n,r),t.write(i));s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:ai,StaticBlock(e,t){t.write("static "),this.BlockStatement(e,t)},EmptyStatement(e,t){t.write(";")},ExpressionStatement(e,t){const i=t.expressionsPrecedence[e.expression.type];i===ge||i===3&&e.expression.left.type[0]==="O"?(t.write("("),this[e.expression.type](e.expression,t),t.write(")")):this[e.expression.type](e.expression,t),t.write(";")},IfStatement(e,t){t.write("if ("),this[e.test.type](e.test,t),t.write(") "),this[e.consequent.type](e.consequent,t),e.alternate!=null&&(t.write(" else "),this[e.alternate.type](e.alternate,t))},LabeledStatement(e,t){this[e.label.type](e.label,t),t.write(": "),this[e.body.type](e.body,t)},BreakStatement(e,t){t.write("break"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},ContinueStatement(e,t){t.write("continue"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},WithStatement(e,t){t.write("with ("),this[e.object.type](e.object,t),t.write(") "),this[e.body.type](e.body,t)},SwitchStatement(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t;t.indentLevel++;const n=i+t.indent,a=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:h}=o;for(let c=0;c<h;c++){const l=o[c];s&&l.comments!=null&&X(t,l.comments,n,r),l.test?(t.write(n+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(n+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];s&&x.comments!=null&&X(t,x.comments,a,r),t.write(a),this[x.type](x,t),t.write(r)}}t.indentLevel-=2,t.write(i+"}")},ReturnStatement(e,t){t.write("return"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t)),t.write(";")},ThrowStatement(e,t){t.write("throw "),this[e.argument.type](e.argument,t),t.write(";")},TryStatement(e,t){if(t.write("try "),this[e.block.type](e.block,t),e.handler){const{handler:i}=e;i.param==null?t.write(" catch "):(t.write(" catch ("),this[i.param.type](i.param,t),t.write(") ")),this[i.body.type](i.body,t)}e.finalizer&&(t.write(" finally "),this[e.finalizer.type](e.finalizer,t))},WhileStatement(e,t){t.write("while ("),this[e.test.type](e.test,t),t.write(") "),this[e.body.type](e.body,t)},DoWhileStatement(e,t){t.write("do "),this[e.body.type](e.body,t),t.write(" while ("),this[e.test.type](e.test,t),t.write(");")},ForStatement(e,t){if(t.write("for ("),e.init!=null){const{init:i}=e;i.type[0]==="V"?Et(t,i):this[i.type](i,t)}t.write("; "),e.test&&this[e.test.type](e.test,t),t.write("; "),e.update&&this[e.update.type](e.update,t),t.write(") "),this[e.body.type](e.body,t)},ForInStatement:ti=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Et(t,i):this[i.type](i,t),t.write(e.type[3]==="I"?" in ":" of "),this[e.right.type](e.right,t),t.write(") "),this[e.body.type](e.body,t)},ForOfStatement:ti,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:ii=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Fe(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:ii,VariableDeclaration(e,t){Et(t,e),t.write(";")},VariableDeclarator(e,t){this[e.id.type](e.id,t),e.init!=null&&(t.write(" = "),this[e.init.type](e.init,t))},ClassDeclaration(e,t){if(t.write("class "+(e.id?`${e.id.name} `:""),e),e.superClass){t.write("extends ");const{superClass:i}=e,{type:r}=i,s=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===ge||s<t.expressionsPrecedence.ClassExpression)?(t.write("("),this[e.superClass.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ")}this.ClassBody(e.body,t)},ImportDeclaration(e,t){t.write("import ");const{specifiers:i,attributes:r}=e,{length:s}=i;let n=0;if(s>0){for(;n<s;){n>0&&t.write(", ");const a=i[n],o=a.type[6];if(o==="D")t.write(a.local.name,a),n++;else if(o==="N")t.write("* as "+a.local.name,a),n++;else break}if(n<s){for(t.write("{");;){const a=i[n],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++n<s)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let a=0;a<r.length;a++)this.ImportAttribute(r[a],t),a<r.length-1&&t.write(", ");t.write(" }")}t.write(";")},ImportAttribute(e,t){this.Identifier(e.key,t),t.write(": "),this.Literal(e.value,t)},ImportExpression(e,t){t.write("import("),this[e.source.type](e.source,t),t.write(")")},ExportDefaultDeclaration(e,t){t.write("export default "),this[e.declaration.type](e.declaration,t),t.expressionsPrecedence[e.declaration.type]!=null&&e.declaration.type[0]!=="F"&&t.write(";")},ExportNamedDeclaration(e,t){if(t.write("export "),e.declaration)this[e.declaration.type](e.declaration,t);else{t.write("{");const{specifiers:i}=e,{length:r}=i;if(r>0)for(let s=0;;){const n=i[s],{name:a}=n.local;if(t.write(a,n),a!==n.exported.name&&t.write(" as "+n.exported.name),++s<r)t.write(", ");else break}if(t.write("}"),e.source&&(t.write(" from "),this.Literal(e.source,t)),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let s=0;s<e.attributes.length;s++)this.ImportAttribute(e.attributes[s],t),s<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")}},ExportAllDeclaration(e,t){if(e.exported!=null?t.write("export * as "+e.exported.name+" from "):t.write("export * from "),this.Literal(e.source,t),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let i=0;i<e.attributes.length;i++)this.ImportAttribute(e.attributes[i],t),i<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")},MethodDefinition(e,t){e.static&&t.write("static ");const i=e.kind[0];(i==="g"||i==="s")&&t.write(e.kind+" "),e.value.async&&t.write("async "),e.value.generator&&t.write("*"),e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),Fe(t,e.value.params),t.write(" "),this[e.value.body.type](e.value.body,t)},ClassExpression(e,t){this.ClassDeclaration(e,t)},ArrowFunctionExpression(e,t){t.write(e.async?"async ":"",e);const{params:i}=e;i!=null&&(i.length===1&&i[0].type[0]==="I"?t.write(i[0].name,i[0]):Fe(t,e.params)),t.write(" => "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:ri=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:ri,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),at(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:s}=r;for(let a=0;a<s;a++){const o=r[a],h=i[a];t.write(h.value.raw,h),t.write("${"),this[o.type](o,t),t.write("}")}const n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){at(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:ni=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let s=0;;){const n=i[s];if(n!=null&&this[n.type](n,t),++s<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:ni,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const a=","+r,{properties:o}=e,{length:h}=o;for(let c=0;;){const l=o[c];if(s&&l.comments!=null&&X(t,l.comments,n,r),t.write(n),this[l.type](l,t),++c<h)t.write(a);else break}t.write(r),s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")}else s?e.comments!=null?(t.write(r),X(t,e.comments,n,r),e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),X(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){const{properties:i}=e,{length:r}=i;for(let s=0;this[i[s].type](i[s],t),++s<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Fe(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:s}}=e;t.write(i);const n=nr(t,r,e);!n&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[s](r,t),t.write(")")):this[s](r,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:si=function(e,t){const i=e.operator==="in";i&&t.write("("),at(t,e.left,e,!1),t.write(" "+e.operator+" "),at(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:si,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ge||r<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[i.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");const i=t.expressionsPrecedence[e.callee.type];i===ge||i<t.expressionsPrecedence.CallExpression||as(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Fe(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ge||i<t.expressionsPrecedence.CallExpression?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),e.optional&&t.write("?."),Fe(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ge||i<t.expressionsPrecedence.MemberExpression?(t.write("("),this[e.object.type](e.object,t),t.write(")")):this[e.object.type](e.object,t),e.computed?(e.optional&&t.write("?."),t.write("["),this[e.property.type](e.property,t),t.write("]")):(e.optional?t.write("?."):t.write("."),this[e.property.type](e.property,t))},MetaProperty(e,t){t.write(e.meta.name+"."+e.property.name,e)},Identifier(e,t){t.write(e.name,e)},PrivateIdentifier(e,t){t.write(`#${e.name}`,e)},Literal(e,t){e.raw!=null?t.write(e.raw,e):e.regex!=null?this.RegExpLiteral(e,t):e.bigint!=null?t.write(e.bigint+"n",e):t.write(rs(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},os={},hs=Kt;class cs{constructor(t){const i=t??os;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Kt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:ss,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
28
+ `,a):(e.write("/*"),us(e,a.value,i,r),e.write("*/"+r))}}function ls(e){let t=e;for(;t!=null;){const{type:i}=t;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")t=t.object;else return!1}}function Nt(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],e);for(let n=1;n<s;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}let ti,ii,ri,si,ni,ai;const zt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:s}=t;s&&e.comments!=null&&X(t,e.comments,i,r);const n=e.body,{length:a}=n;for(let o=0;o<a;o++){const h=n[o];s&&h.comments!=null&&X(t,h.comments,i,r),t.write(i),this[h.type](h,t),t.write(r)}s&&e.trailingComments!=null&&X(t,e.trailingComments,i,r)},BlockStatement:ai=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const{length:o}=a;for(let h=0;h<o;h++){const c=a[h];s&&c.comments!=null&&X(t,c.comments,n,r),t.write(n),this[c.type](c,t),t.write(r)}t.write(i)}else s&&e.comments!=null&&(t.write(r),X(t,e.comments,n,r),t.write(i));s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:ai,StaticBlock(e,t){t.write("static "),this.BlockStatement(e,t)},EmptyStatement(e,t){t.write(";")},ExpressionStatement(e,t){const i=t.expressionsPrecedence[e.expression.type];i===ge||i===3&&e.expression.left.type[0]==="O"?(t.write("("),this[e.expression.type](e.expression,t),t.write(")")):this[e.expression.type](e.expression,t),t.write(";")},IfStatement(e,t){t.write("if ("),this[e.test.type](e.test,t),t.write(") "),this[e.consequent.type](e.consequent,t),e.alternate!=null&&(t.write(" else "),this[e.alternate.type](e.alternate,t))},LabeledStatement(e,t){this[e.label.type](e.label,t),t.write(": "),this[e.body.type](e.body,t)},BreakStatement(e,t){t.write("break"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},ContinueStatement(e,t){t.write("continue"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},WithStatement(e,t){t.write("with ("),this[e.object.type](e.object,t),t.write(") "),this[e.body.type](e.body,t)},SwitchStatement(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t;t.indentLevel++;const n=i+t.indent,a=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:h}=o;for(let c=0;c<h;c++){const l=o[c];s&&l.comments!=null&&X(t,l.comments,n,r),l.test?(t.write(n+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(n+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];s&&x.comments!=null&&X(t,x.comments,a,r),t.write(a),this[x.type](x,t),t.write(r)}}t.indentLevel-=2,t.write(i+"}")},ReturnStatement(e,t){t.write("return"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t)),t.write(";")},ThrowStatement(e,t){t.write("throw "),this[e.argument.type](e.argument,t),t.write(";")},TryStatement(e,t){if(t.write("try "),this[e.block.type](e.block,t),e.handler){const{handler:i}=e;i.param==null?t.write(" catch "):(t.write(" catch ("),this[i.param.type](i.param,t),t.write(") ")),this[i.body.type](i.body,t)}e.finalizer&&(t.write(" finally "),this[e.finalizer.type](e.finalizer,t))},WhileStatement(e,t){t.write("while ("),this[e.test.type](e.test,t),t.write(") "),this[e.body.type](e.body,t)},DoWhileStatement(e,t){t.write("do "),this[e.body.type](e.body,t),t.write(" while ("),this[e.test.type](e.test,t),t.write(");")},ForStatement(e,t){if(t.write("for ("),e.init!=null){const{init:i}=e;i.type[0]==="V"?Nt(t,i):this[i.type](i,t)}t.write("; "),e.test&&this[e.test.type](e.test,t),t.write("; "),e.update&&this[e.update.type](e.update,t),t.write(") "),this[e.body.type](e.body,t)},ForInStatement:ti=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Nt(t,i):this[i.type](i,t),t.write(e.type[3]==="I"?" in ":" of "),this[e.right.type](e.right,t),t.write(") "),this[e.body.type](e.body,t)},ForOfStatement:ti,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:ii=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Fe(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:ii,VariableDeclaration(e,t){Nt(t,e),t.write(";")},VariableDeclarator(e,t){this[e.id.type](e.id,t),e.init!=null&&(t.write(" = "),this[e.init.type](e.init,t))},ClassDeclaration(e,t){if(t.write("class "+(e.id?`${e.id.name} `:""),e),e.superClass){t.write("extends ");const{superClass:i}=e,{type:r}=i,s=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===ge||s<t.expressionsPrecedence.ClassExpression)?(t.write("("),this[e.superClass.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ")}this.ClassBody(e.body,t)},ImportDeclaration(e,t){t.write("import ");const{specifiers:i,attributes:r}=e,{length:s}=i;let n=0;if(s>0){for(;n<s;){n>0&&t.write(", ");const a=i[n],o=a.type[6];if(o==="D")t.write(a.local.name,a),n++;else if(o==="N")t.write("* as "+a.local.name,a),n++;else break}if(n<s){for(t.write("{");;){const a=i[n],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++n<s)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let a=0;a<r.length;a++)this.ImportAttribute(r[a],t),a<r.length-1&&t.write(", ");t.write(" }")}t.write(";")},ImportAttribute(e,t){this.Identifier(e.key,t),t.write(": "),this.Literal(e.value,t)},ImportExpression(e,t){t.write("import("),this[e.source.type](e.source,t),t.write(")")},ExportDefaultDeclaration(e,t){t.write("export default "),this[e.declaration.type](e.declaration,t),t.expressionsPrecedence[e.declaration.type]!=null&&e.declaration.type[0]!=="F"&&t.write(";")},ExportNamedDeclaration(e,t){if(t.write("export "),e.declaration)this[e.declaration.type](e.declaration,t);else{t.write("{");const{specifiers:i}=e,{length:r}=i;if(r>0)for(let s=0;;){const n=i[s],{name:a}=n.local;if(t.write(a,n),a!==n.exported.name&&t.write(" as "+n.exported.name),++s<r)t.write(", ");else break}if(t.write("}"),e.source&&(t.write(" from "),this.Literal(e.source,t)),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let s=0;s<e.attributes.length;s++)this.ImportAttribute(e.attributes[s],t),s<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")}},ExportAllDeclaration(e,t){if(e.exported!=null?t.write("export * as "+e.exported.name+" from "):t.write("export * from "),this.Literal(e.source,t),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let i=0;i<e.attributes.length;i++)this.ImportAttribute(e.attributes[i],t),i<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")},MethodDefinition(e,t){e.static&&t.write("static ");const i=e.kind[0];(i==="g"||i==="s")&&t.write(e.kind+" "),e.value.async&&t.write("async "),e.value.generator&&t.write("*"),e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),Fe(t,e.value.params),t.write(" "),this[e.value.body.type](e.value.body,t)},ClassExpression(e,t){this.ClassDeclaration(e,t)},ArrowFunctionExpression(e,t){t.write(e.async?"async ":"",e);const{params:i}=e;i!=null&&(i.length===1&&i[0].type[0]==="I"?t.write(i[0].name,i[0]):Fe(t,e.params)),t.write(" => "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:ri=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:ri,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),ot(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:s}=r;for(let a=0;a<s;a++){const o=r[a],h=i[a];t.write(h.value.raw,h),t.write("${"),this[o.type](o,t),t.write("}")}const n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){ot(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:ni=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let s=0;;){const n=i[s];if(n!=null&&this[n.type](n,t),++s<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:ni,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const a=","+r,{properties:o}=e,{length:h}=o;for(let c=0;;){const l=o[c];if(s&&l.comments!=null&&X(t,l.comments,n,r),t.write(n),this[l.type](l,t),++c<h)t.write(a);else break}t.write(r),s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")}else s?e.comments!=null?(t.write(r),X(t,e.comments,n,r),e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),X(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){const{properties:i}=e,{length:r}=i;for(let s=0;this[i[s].type](i[s],t),++s<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Fe(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:s}}=e;t.write(i);const n=nr(t,r,e);!n&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[s](r,t),t.write(")")):this[s](r,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:si=function(e,t){const i=e.operator==="in";i&&t.write("("),ot(t,e.left,e,!1),t.write(" "+e.operator+" "),ot(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:si,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ge||r<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[i.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");const i=t.expressionsPrecedence[e.callee.type];i===ge||i<t.expressionsPrecedence.CallExpression||ls(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Fe(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ge||i<t.expressionsPrecedence.CallExpression?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),e.optional&&t.write("?."),Fe(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ge||i<t.expressionsPrecedence.MemberExpression?(t.write("("),this[e.object.type](e.object,t),t.write(")")):this[e.object.type](e.object,t),e.computed?(e.optional&&t.write("?."),t.write("["),this[e.property.type](e.property,t),t.write("]")):(e.optional?t.write("?."):t.write("."),this[e.property.type](e.property,t))},MetaProperty(e,t){t.write(e.meta.name+"."+e.property.name,e)},Identifier(e,t){t.write(e.name,e)},PrivateIdentifier(e,t){t.write(`#${e.name}`,e)},Literal(e,t){e.raw!=null?t.write(e.raw,e):e.regex!=null?this.RegExpLiteral(e,t):e.bigint!=null?t.write(e.bigint+"n",e):t.write(hs(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},ps={},fs=zt;class ms{constructor(t){const i=t??ps;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:zt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:cs,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
29
29
  `,this.indentLevel=i.startingIndentLevel!=null?i.startingIndentLevel:0,this.writeComments=i.comments?i.comments:!1,i.sourceMap!=null&&(this.write=i.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=i.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
30
30
  `).length-1,this.mapping={original:null,generated:this,name:void 0,source:i.sourceMap.file||i.sourceMap._file})}write(t){this.output+=t}writeToStream(t){this.output.write(t)}writeAndMap(t,i){this.output+=t,this.map(t,i)}writeToStreamAndMap(t,i){this.output.write(t),this.map(t,i)}map(t,i){if(i!=null){const{type:n}=i;if(n[0]==="L"&&n[2]==="n"){this.column=0,this.line++;return}if(i.loc!=null){const{mapping:a}=this;a.original=i.loc.start,a.name=i.name,this.sourceMap.addMapping(a)}if(n[0]==="T"&&n[8]==="E"||n[0]==="L"&&n[1]==="i"&&typeof i.value=="string"){const{length:a}=t;let{column:o,line:h}=this;for(let c=0;c<a;c++)t[c]===`
31
- `?(o=0,h++):o++;this.column=o,this.line=h;return}}const{length:r}=t,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?t[r-1]===s:t.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function ar(e,t){const i=new cs(t);return i.generator[e.type](e,i),i.output}var us=Object.defineProperty,ls=(e,t,i)=>t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Y=(e,t,i)=>ls(e,typeof t!="symbol"?t+"":t,i);const ps=new Set(["Infinity","NaN","undefined","null","true","false"]),fs=new Set(["Math","Array","Object","String","Number","Boolean","Date","RegExp","Error","JSON","Promise","Set","Map","WeakSet","WeakMap","Symbol","BigInt","Proxy","Reflect","console","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]);class ms{constructor(){Y(this,"scopes",[]),Y(this,"scopeTypes",[]),Y(this,"scopeCounts",new Map),Y(this,"contextBoundVars",new Set),Y(this,"arrayPatternElements",new Set),Y(this,"rootParams",new Set),Y(this,"localSeriesVars",new Set),Y(this,"varKinds",new Map),Y(this,"loopVars",new Set),Y(this,"loopVarNames",new Map),Y(this,"paramIdCounter",0),Y(this,"cacheIdCounter",0),Y(this,"tempVarCounter",0),Y(this,"taCallIdCounter",0),Y(this,"hoistingStack",[]),Y(this,"suppressHoisting",!1),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}pushScope(t){this.scopes.push(new Map),this.scopeTypes.push(t),this.scopeCounts.set(t,(this.scopeCounts.get(t)||0)+1)}popScope(){this.scopes.pop(),this.scopeTypes.pop()}getCurrentScopeType(){return this.scopeTypes[this.scopeTypes.length-1]}getCurrentScopeCount(){return this.scopeCounts.get(this.getCurrentScopeType())||1}addLocalSeriesVar(t){this.localSeriesVars.add(t)}isLocalSeriesVar(t){return this.localSeriesVars.has(t)}addContextBoundVar(t,i=!1){this.contextBoundVars.add(t),i&&this.rootParams.add(t)}removeContextBoundVar(t){this.contextBoundVars.has(t)&&(this.contextBoundVars.delete(t),this.rootParams.has(t)&&this.rootParams.delete(t))}addArrayPatternElement(t){this.arrayPatternElements.add(t)}isContextBound(t){return ps.has(t)||fs.has(t)?!1:this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],n=this.scopeCounts.get(s)||1,a=`${s}${n}_${t}`;return r.set(t,a),this.varKinds.set(a,i),a}getVariable(t){if(this.loopVars.has(t)){const i=this.loopVarNames.get(t);if(i)return[i,"let"]}if(this.isContextBound(t))return[t,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(t)){const s=r.get(t),n=this.varKinds.get(s)||"let";return[s,n]}}return[t,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(t){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(t)}setSuppressHoisting(t){this.suppressHoisting=t}shouldSuppressHoisting(){return this.suppressHoisting}generateParamId(){return`p${this.paramIdCounter++}`}}function zt(e,t,i,r,s){i||(i=b),function n(a,o,h){var c=h||a.type;i[c](a,o,n),t[c]&&t[c](a,o)}(e,r,s)}function H(e,t,i,r,s){var n=i?ds(i,r||void 0):r;(function a(o,h,c){n[c||o.type](o,h,a)})(e,t,s)}function ds(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Ht(e,t,i){i(e,t)}function Le(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}};b.Statement=Ht;b.EmptyStatement=Le;b.ExpressionStatement=b.ParenthesizedExpression=b.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")};b.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")};b.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")};b.BreakStatement=b.ContinueStatement=Le;b.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")};b.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,s=e.cases;r<s.length;r+=1){var n=s[r];i(n,t)}};b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,s=e.consequent;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}};b.ReturnStatement=b.YieldExpression=b.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")};b.ThrowStatement=b.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")};b.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")};b.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")};b.WhileStatement=b.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")};b.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")};b.ForInStatement=b.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")};b.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")};b.DebuggerStatement=Le;b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};b.VariableDeclaration=function(e,t,i){for(var r=0,s=e.declarations;r<s.length;r+=1){var n=s[r];i(n,t)}};b.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")};b.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,s=e.params;r<s.length;r+=1){var n=s[r];i(n,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")};b.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)};b.VariablePattern=Le;b.MemberPattern=Ht;b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};b.ArrayPattern=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Pattern")}};b.ObjectPattern=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];n.type==="Property"?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):n.type==="RestElement"&&i(n.argument,t,"Pattern")}};b.Expression=Ht;b.ThisExpression=b.Super=b.MetaProperty=Le;b.ArrayExpression=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Expression")}};b.ObjectExpression=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];i(n,t)}};b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration;b.SequenceExpression=function(e,t,i){for(var r=0,s=e.expressions;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}};b.TemplateLiteral=function(e,t,i){for(var r=0,s=e.quasis;r<s.length;r+=1){var n=s[r];i(n,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var h=o[a];i(h,t,"Expression")}};b.TemplateElement=Le;b.UnaryExpression=b.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")};b.BinaryExpression=b.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")};b.AssignmentExpression=b.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")};b.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")};b.NewExpression=b.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,s=e.arguments;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}};b.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")};b.ExportNamedDeclaration=b.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")};b.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")};b.ImportDeclaration=function(e,t,i){for(var r=0,s=e.specifiers;r<s.length;r+=1){var n=s[r];i(n,t)}i(e.source,t,"Expression")};b.ImportExpression=function(e,t,i){i(e.source,t,"Expression")};b.ImportSpecifier=b.ImportDefaultSpecifier=b.ImportNamespaceSpecifier=b.Identifier=b.PrivateIdentifier=b.Literal=Le;b.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")};b.ClassDeclaration=b.ClassExpression=function(e,t,i){return i(e,t,"Class")};b.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)};b.ClassBody=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t)}};b.MethodDefinition=b.PropertyDefinition=b.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const q="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(q)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),s=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createArrayAccess(e,t){const i=typeof t=="number"?this.createLiteral(t):t;return this.createMemberExpression(e,i,!0)},createCallExpression(e,t){return{type:"CallExpression",callee:e,arguments:t}},createAssignmentExpression(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},createExpressionStatement(e){return{type:"ExpressionStatement",expression:e}},createInitCall(e,t,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[e,t];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[e,t];return this.createCallExpression(i,r)},createGetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof t=="number"?this.createLiteral(t):t;return this.createCallExpression(i,[e,r])},createSetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[e,t])},createMathEqCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}},createVariableDeclaration(e,t){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(e),init:t}]}},createAwaitExpression(e){return{type:"AwaitExpression",argument:e}}},it=["ta","math","request","array","input"],gs=["hline"],xs=["request.security","request.security_lower_tf"],or=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],hr=[...it,"plotchar","plot","hline","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","order","currency","display","dayofweek"],ys=["na","nz","plot","plotchar","color","hline"];function ws(e){let t=null,i=q;if(e.type==="Program"&&e.body.length>0){const p=e.body[0];if(p.type==="ExpressionStatement"&&(p.expression.type==="ArrowFunctionExpression"||p.expression.type==="FunctionExpression")){const x=p.expression;x.body.type==="BlockStatement"&&(t=x.body.body,x.params.length>0&&x.params[0].type==="Identifier"&&(i=x.params[0].name))}}if(!t)return;const r=new Set,s=new Set,n=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>n(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&n(x)})};H(e,{},{VariableDeclarator(p,x,y){n(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){n(p.id),y(p.body,x)},Identifier(p,x,y){s.add(p.name)},MemberExpression(p,x,y){y(p.object,x),p.computed&&y(p.property,x)},Property(p,x,y){p.computed&&y(p.key,x),y(p.value,x)}}),t.forEach(p=>{p.type==="VariableDeclaration"?p.declarations.forEach(x=>n(x.id)):p.type==="FunctionDeclaration"&&n(p.id)});const a=or,o=hr,h=a.filter(p=>!r.has(p)),c=o.filter(p=>!r.has(p)),l=h.filter(p=>s.has(p)),f=c.filter(p=>s.has(p)),g=[];l.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:l.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),g.length>0&&t.unshift(...g)}function bs(e){let t=null,i=q;if(e.type==="Program"&&e.body.length>0){const o=e.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const h=o.expression;h.body.type==="BlockStatement"&&(t=h.body.body,h.params.length>0&&h.params[0].type==="Identifier"&&(i=h.params[0].name))}}if(!t)return;const r=new Set(or),s=new Set(hr),n=new Set(ys),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(h=>{if(h.init&&h.init.type==="MemberExpression"&&h.init.object.type==="Identifier"&&h.init.object.name===i&&h.init.property.type==="Identifier"){const c=h.init.property.name;let l=null;if(c==="data"?l=r:c==="pine"?l=s:c==="core"&&(l=n),l&&h.id.type==="ObjectPattern")h.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const g=f.key.name,p=f.value.name;l.has(g)&&g!==p&&(a.set(p,g),f.value.name=g,f.shorthand=!0)}});else if(h.id.type==="Identifier"&&it.includes(c)){const f=c,g=h.id.name;f!==g&&(a.set(g,f),h.id.name=f)}}})}),a.size>0&&H(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,h,c){c(o.object,h),o.computed&&c(o.property,h)},Property(o,h,c){o.computed&&c(o.key,h),c(o.value,h)}})}function vs(e){try{const t=sr(e,{ecmaVersion:"latest",sourceType:"module"});if(t.type==="Program"&&t.body.length===1){const i=t.body[0];if(i.type==="ExpressionStatement"){const r=i.expression;if(r.type==="ArrowFunctionExpression"||r.type==="FunctionExpression")return{isWrapped:!0,isAsync:r.async||!1,functionNode:r}}if(i.type==="FunctionDeclaration")return{isWrapped:!0,isAsync:i.async||!1,functionNode:i}}return{isWrapped:!1,isAsync:!1}}catch{return{isWrapped:!1,isAsync:!1}}}function _s(e){return e.async=!0,ar(e)}function Ss(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=vs(e);return t&&r?i?e:_s(r):`async (context) => {
31
+ `?(o=0,h++):o++;this.column=o,this.line=h;return}}const{length:r}=t,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?t[r-1]===s:t.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function ar(e,t){const i=new ms(t);return i.generator[e.type](e,i),i.output}var ds=Object.defineProperty,gs=(e,t,i)=>t in e?ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Y=(e,t,i)=>gs(e,typeof t!="symbol"?t+"":t,i);const xs=new Set(["Infinity","NaN","undefined","null","true","false"]),ys=new Set(["Math","Array","Object","String","Number","Boolean","Date","RegExp","Error","JSON","Promise","Set","Map","WeakSet","WeakMap","Symbol","BigInt","Proxy","Reflect","console","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]);class ws{constructor(){Y(this,"scopes",[]),Y(this,"scopeTypes",[]),Y(this,"scopeCounts",new Map),Y(this,"contextBoundVars",new Set),Y(this,"arrayPatternElements",new Set),Y(this,"rootParams",new Set),Y(this,"localSeriesVars",new Set),Y(this,"varKinds",new Map),Y(this,"loopVars",new Set),Y(this,"loopVarNames",new Map),Y(this,"paramIdCounter",0),Y(this,"cacheIdCounter",0),Y(this,"tempVarCounter",0),Y(this,"taCallIdCounter",0),Y(this,"hoistingStack",[]),Y(this,"suppressHoisting",!1),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}pushScope(t){this.scopes.push(new Map),this.scopeTypes.push(t),this.scopeCounts.set(t,(this.scopeCounts.get(t)||0)+1)}popScope(){this.scopes.pop(),this.scopeTypes.pop()}getCurrentScopeType(){return this.scopeTypes[this.scopeTypes.length-1]}getCurrentScopeCount(){return this.scopeCounts.get(this.getCurrentScopeType())||1}addLocalSeriesVar(t){this.localSeriesVars.add(t)}isLocalSeriesVar(t){return this.localSeriesVars.has(t)}addContextBoundVar(t,i=!1){this.contextBoundVars.add(t),i&&this.rootParams.add(t)}removeContextBoundVar(t){this.contextBoundVars.has(t)&&(this.contextBoundVars.delete(t),this.rootParams.has(t)&&this.rootParams.delete(t))}addArrayPatternElement(t){this.arrayPatternElements.add(t)}isContextBound(t){return xs.has(t)||ys.has(t)?!1:this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],n=this.scopeCounts.get(s)||1,a=`${s}${n}_${t}`;return r.set(t,a),this.varKinds.set(a,i),a}getVariable(t){if(this.loopVars.has(t)){const i=this.loopVarNames.get(t);if(i)return[i,"let"]}if(this.isContextBound(t))return[t,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(t)){const s=r.get(t),n=this.varKinds.get(s)||"let";return[s,n]}}return[t,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(t){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(t)}setSuppressHoisting(t){this.suppressHoisting=t}shouldSuppressHoisting(){return this.suppressHoisting}generateParamId(){return`p${this.paramIdCounter++}`}}function Ht(e,t,i,r,s){i||(i=b),function n(a,o,h){var c=h||a.type;i[c](a,o,n),t[c]&&t[c](a,o)}(e,r,s)}function H(e,t,i,r,s){var n=i?bs(i,r||void 0):r;(function a(o,h,c){n[c||o.type](o,h,a)})(e,t,s)}function bs(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Gt(e,t,i){i(e,t)}function Le(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}};b.Statement=Gt;b.EmptyStatement=Le;b.ExpressionStatement=b.ParenthesizedExpression=b.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")};b.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")};b.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")};b.BreakStatement=b.ContinueStatement=Le;b.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")};b.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,s=e.cases;r<s.length;r+=1){var n=s[r];i(n,t)}};b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,s=e.consequent;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}};b.ReturnStatement=b.YieldExpression=b.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")};b.ThrowStatement=b.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")};b.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")};b.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")};b.WhileStatement=b.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")};b.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")};b.ForInStatement=b.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")};b.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")};b.DebuggerStatement=Le;b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};b.VariableDeclaration=function(e,t,i){for(var r=0,s=e.declarations;r<s.length;r+=1){var n=s[r];i(n,t)}};b.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")};b.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,s=e.params;r<s.length;r+=1){var n=s[r];i(n,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")};b.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)};b.VariablePattern=Le;b.MemberPattern=Gt;b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};b.ArrayPattern=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Pattern")}};b.ObjectPattern=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];n.type==="Property"?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):n.type==="RestElement"&&i(n.argument,t,"Pattern")}};b.Expression=Gt;b.ThisExpression=b.Super=b.MetaProperty=Le;b.ArrayExpression=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Expression")}};b.ObjectExpression=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];i(n,t)}};b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration;b.SequenceExpression=function(e,t,i){for(var r=0,s=e.expressions;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}};b.TemplateLiteral=function(e,t,i){for(var r=0,s=e.quasis;r<s.length;r+=1){var n=s[r];i(n,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var h=o[a];i(h,t,"Expression")}};b.TemplateElement=Le;b.UnaryExpression=b.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")};b.BinaryExpression=b.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")};b.AssignmentExpression=b.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")};b.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")};b.NewExpression=b.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,s=e.arguments;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}};b.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")};b.ExportNamedDeclaration=b.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")};b.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")};b.ImportDeclaration=function(e,t,i){for(var r=0,s=e.specifiers;r<s.length;r+=1){var n=s[r];i(n,t)}i(e.source,t,"Expression")};b.ImportExpression=function(e,t,i){i(e.source,t,"Expression")};b.ImportSpecifier=b.ImportDefaultSpecifier=b.ImportNamespaceSpecifier=b.Identifier=b.PrivateIdentifier=b.Literal=Le;b.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")};b.ClassDeclaration=b.ClassExpression=function(e,t,i){return i(e,t,"Class")};b.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)};b.ClassBody=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t)}};b.MethodDefinition=b.PropertyDefinition=b.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const q="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(q)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),s=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createArrayAccess(e,t){const i=typeof t=="number"?this.createLiteral(t):t;return this.createMemberExpression(e,i,!0)},createCallExpression(e,t){return{type:"CallExpression",callee:e,arguments:t}},createAssignmentExpression(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},createExpressionStatement(e){return{type:"ExpressionStatement",expression:e}},createInitCall(e,t,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[e,t];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[e,t];return this.createCallExpression(i,r)},createGetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof t=="number"?this.createLiteral(t):t;return this.createCallExpression(i,[e,r])},createSetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[e,t])},createMathEqCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}},createVariableDeclaration(e,t){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(e),init:t}]}},createAwaitExpression(e){return{type:"AwaitExpression",argument:e}}},rt=["ta","math","request","array","input"],vs=["hline"],_s=["request.security","request.security_lower_tf"],or=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],hr=[...rt,"plotchar","plotshape","plotarrow","plot","hline","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","order","currency","display","shape","location","size","format","dayofweek"],Ss=["na","nz","plot","plotchar","color","hline"];function Es(e){let t=null,i=q;if(e.type==="Program"&&e.body.length>0){const p=e.body[0];if(p.type==="ExpressionStatement"&&(p.expression.type==="ArrowFunctionExpression"||p.expression.type==="FunctionExpression")){const x=p.expression;x.body.type==="BlockStatement"&&(t=x.body.body,x.params.length>0&&x.params[0].type==="Identifier"&&(i=x.params[0].name))}}if(!t)return;const r=new Set,s=new Set,n=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>n(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&n(x)})};H(e,{},{VariableDeclarator(p,x,y){n(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){n(p.id),y(p.body,x)},Identifier(p,x,y){s.add(p.name)},MemberExpression(p,x,y){y(p.object,x),p.computed&&y(p.property,x)},Property(p,x,y){p.computed&&y(p.key,x),y(p.value,x)}}),t.forEach(p=>{p.type==="VariableDeclaration"?p.declarations.forEach(x=>n(x.id)):p.type==="FunctionDeclaration"&&n(p.id)});const a=or,o=hr,h=a.filter(p=>!r.has(p)),c=o.filter(p=>!r.has(p)),l=h.filter(p=>s.has(p)),f=c.filter(p=>s.has(p)),g=[];l.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:l.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),g.length>0&&t.unshift(...g)}function Ns(e){let t=null,i=q;if(e.type==="Program"&&e.body.length>0){const o=e.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const h=o.expression;h.body.type==="BlockStatement"&&(t=h.body.body,h.params.length>0&&h.params[0].type==="Identifier"&&(i=h.params[0].name))}}if(!t)return;const r=new Set(or),s=new Set(hr),n=new Set(Ss),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(h=>{if(h.init&&h.init.type==="MemberExpression"&&h.init.object.type==="Identifier"&&h.init.object.name===i&&h.init.property.type==="Identifier"){const c=h.init.property.name;let l=null;if(c==="data"?l=r:c==="pine"?l=s:c==="core"&&(l=n),l&&h.id.type==="ObjectPattern")h.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const g=f.key.name,p=f.value.name;l.has(g)&&g!==p&&(a.set(p,g),f.value.name=g,f.shorthand=!0)}});else if(h.id.type==="Identifier"&&rt.includes(c)){const f=c,g=h.id.name;f!==g&&(a.set(g,f),h.id.name=f)}}})}),a.size>0&&H(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,h,c){c(o.object,h),o.computed&&c(o.property,h)},Property(o,h,c){o.computed&&c(o.key,h),c(o.value,h)}})}function Cs(e){try{const t=sr(e,{ecmaVersion:"latest",sourceType:"module"});if(t.type==="Program"&&t.body.length===1){const i=t.body[0];if(i.type==="ExpressionStatement"){const r=i.expression;if(r.type==="ArrowFunctionExpression"||r.type==="FunctionExpression")return{isWrapped:!0,isAsync:r.async||!1,functionNode:r}}if(i.type==="FunctionDeclaration")return{isWrapped:!0,isAsync:i.async||!1,functionNode:i}}return{isWrapped:!1,isAsync:!1}}catch{return{isWrapped:!1,isAsync:!1}}}function ks(e){return e.async=!0,ar(e)}function Is(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=Cs(e);return t&&r?i?e:ks(r):`async (context) => {
32
32
  ${e}
33
- }`}function Es(e){H(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const n={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(t,n)}}),t.body&&t.body.body&&t.body.body.forEach(s=>r(s,i))}})}function Ns(e,t){zt(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===q||r.init.object.name==="context2"),n=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===q||r.init.object.object.name==="context2");(s||n)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(a=>{a.key.name&&t.addContextBoundVar(a.key.name)}))})}})}function Cs(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function ks(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function Is(e,t){let i;return zt(e,{FunctionDeclaration(r){ks(r,t)},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=q),Cs(r,t,s)},VariableDeclaration(r){r.declarations.forEach(s=>{if(s.id.type==="ArrayPattern"){const n=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:s.init}]};s.id.elements?.forEach(h=>{h.type==="Identifier"&&t.addArrayPatternElement(h.name)});const o=s.id.elements.map((h,c)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:h,init:{type:"MemberExpression",object:{type:"Identifier",name:n},property:{type:"Literal",value:c},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const Rt={type:"Identifier",name:"undefined"};function Ae(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name)){if(e.object.type==="Identifier"&&!t.isLoopVariable(e.object.name)&&!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name),s=v.createContextVariableReference(r,i),n=v.createGetCall(s,e.property);Object.assign(e,n),e._indexTransformed=!0}return}if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Ae(i,t),i._indexTransformed=!0)}}}function ve(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function ie(e,t){if(e.name!==q){if(e.name==="na"&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e)){e.name="NaN";return}if(e.name==="Math"||e.name==="NaN"||e.name==="undefined"||e.name==="Infinity"||e.name==="null"||e.name.startsWith("'")&&e.name.endsWith("'")||e.name.startsWith('"')&&e.name.endsWith('"')||e.name.startsWith("`")&&e.name.endsWith("`")||t.isLoopVariable(e.name))return;let i=!1;if(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)){const g=e.parent.callee;if(g.type==="MemberExpression"&&g.object&&g.object.name===q&&["get","set","init","param"].includes(g.property.name))e.parent.arguments.indexOf(e)===0&&(i=!0);else{const p=g.type==="MemberExpression"&&g.object&&g.object.type==="Identifier"&&it.includes(g.object.name);g.type==="MemberExpression"&&!p?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),s=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.property.name==="param";e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left;const n=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,a=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.object===e,o=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.property===e&&e.parent.parent&&e.parent.parent.type==="CallExpression"&&e.parent.parent.callee&&e.parent.parent.callee.type==="MemberExpression"&&t.isContextBound(e.parent.parent.callee.object.name);if(r||s||i||o||n){if(n||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const[g,p]=t.getVariable(e.name),x=v.createContextVariableReference(p,g);Object.assign(e,x);return}const h=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(h&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)))return;if(t.isLocalSeriesVar(e.name)){if(!a){const g=v.createIdentifier(e.name),p=v.createGetCall(g,0);Object.assign(e,p)}return}const[c,l]=t.getVariable(e.name);let f;if(h)f=v.createIdentifier(e.name);else{if(c===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,c)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function ue(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&it.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const h=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,c=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!h&&!c){const l={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(l.start=e.start),e.end!==void 0&&(l.end=e.end),Object.assign(e,l);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",n=i.getCurrentScopeType()=="for";if(!r&&!s&&!n&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Ae(e,i),e._indexTransformed=!0);const a=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&e.object.object.object.name===q,o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(a||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const h=v.createGetCall(e.object,e.property);e.start&&(h.start=e.start),e.end&&(h.end=e.end),Object.assign(e,h),delete e.object,delete e.property,delete e.computed}}function Xe(e,t){if(e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(t.isLoopVariable(e.name))return e;if(t.isRootParam(e.name)){const[s,n]=t.getVariable(e.name);return v.createContextVariableReference(n,s)}if(t.isContextBound(e.name)||t.isLocalSeriesVar(e.name))return e;const[i,r]=t.getVariable(e.name);return i===e.name&&!t.isContextBound(e.name)?e:v.createContextVariableReference(r,i)}return e}function Ie(e,t,i=""){switch(e.type){case"BinaryExpression":return Dt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?Xe(e.object,t):e.object,property:e.property,computed:e.computed};case"Identifier":{if(t.isLoopVariable(e.name)||e.parent&&e.parent.type==="MemberExpression"&&e.parent.property===e)return e;const r=Xe(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:v.createGetCall(r,0)}case"UnaryExpression":return Vt(e,t,i);case"ConditionalExpression":{const r=Ie(e.test,t,i),s=Ie(e.consequent,t,i),n=Ie(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:n,start:e.start,end:e.end}}}return e}function Dt(e,t,i){const r=Ie(e.left,t,i),s=Ie(e.right,t,i),n={type:"BinaryExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return H(n,t,{CallExpression(a,o){a._transformed||le(a,o)},MemberExpression(a){ue(a,"",t)}}),n}function oi(e,t,i){const r=Ie(e.left,t,i),s=Ie(e.right,t,i),n={type:"LogicalExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return H(n,t,{CallExpression(a,o){a._transformed||le(a,o)}}),n}function hi(e,t,i){H(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,h){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,ie(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?Ae(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===q&&a.parent.callee.property.name==="get"||ve(a)))},MemberExpression(a,o,h){Ae(a,t),a.object&&h(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,h){const c={...o,parent:a};a.test&&h(a.test,c),a.consequent&&h(a.consequent,c),a.alternate&&h(a.alternate,c)},BinaryExpression(a,o,h){const c={...o,parent:a};h(a.left,c),h(a.right,c)},LogicalExpression(a,o,h){const c={...o,parent:a};h(a.left,c),h(a.right,c)},UnaryExpression(a,o,h){const c={...o,parent:a};h(a.argument,c)},CallExpression(a,o,h){const c=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);le(a,t),a.arguments.forEach(l=>h(l,{parent:a,inNamespaceCall:c||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),s=t.generateParamId(),n={type:"CallExpression",callee:r,arguments:[e,Rt,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=s;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,n);return t.addHoistedStatement(o),v.createIdentifier(a)}return n}function Vt(e,t,i){const r=Ie(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function Ot(e,t,i){switch(e?.type){case"BinaryExpression":e=Dt(e,i,t);break;case"LogicalExpression":e=oi(e,i,t);break;case"ConditionalExpression":return hi(e,i,t);case"UnaryExpression":e=Vt(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(o=>{if(o.type==="Identifier"){if(i.isContextBound(o.name)&&!i.isRootParam(o.name))return o;const[h,c]=i.getVariable(o.name);return v.createContextVariableAccess0(c,h)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?le(e.object,i):e.object.type==="MemberExpression"?ue(e.object,"",i):e.object.type==="BinaryExpression"?e.object=Dt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=oi(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=hi(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Vt(e.object,i,t));const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:Xe(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?Xe(e.property,i):e.property,c=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:c,arguments:[o,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const p=v.createVariableDeclaration(g,f);return i.addHoistedStatement(p),v.createIdentifier(g)}return f}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(o=>{if(o.value.name){if(i.isContextBound(o.value.name)&&!i.isRootParam(o.value.name))return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createIdentifier(o.value.name),kind:"init",method:!1,shorthand:!1,computed:!1};const[h,c]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(c,h),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=Ot(o.value,t,i));return o})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const o=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),h=i.generateParamId(),c={type:"CallExpression",callee:o,arguments:[e,Rt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,c);return i.addHoistedStatement(f),v.createIdentifier(l)}return c}}e?.type==="CallExpression"&&le(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),s=e.type==="Identifier"?Xe(e,i):e,n=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[s,Rt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=n;i.addLocalSeriesVar(o);const h=v.createVariableDeclaration(o,a);return i.addHoistedStatement(h),v.createIdentifier(o)}return a}function le(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(it.includes(e.callee.name)||gs.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=v.createMemberExpression(e.callee,v.createIdentifier("any")));const r=e.callee&&e.callee.type==="MemberExpression"&&e.callee.object&&e.callee.object.type==="Identifier"&&(t.isContextBound(e.callee.object.name)||e.callee.object.name==="math"||e.callee.object.name==="ta");if(r){if(e.callee.object.name===q&&["get","init","param"].includes(e.callee.property.name))return;const s=e.callee.object.name,n=[];e.arguments.forEach(l=>{if(l._isParamCall){n.push(l);return}n.push(Ot(l,s,t))}),e.arguments=n,s==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${s}.${a}`,h=xs.includes(o),c=e._insideAwait===!0;if(h&&!c){const l=Object.assign({},e),f=v.createAwaitExpression(l);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const l=t.generateTempVar();t.addLocalSeriesVar(l);const f=e._insideAwait===!0;let g=Object.assign({},e);f&&(g=v.createAwaitExpression(g));const p=v.createVariableDeclaration(l,g);t.addHoistedStatement(p);const x=v.createIdentifier(l);Object.assign(e,x),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(s=>s._isParamCall?s:Ot(s,q,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&ie(e.callee.object,t),e.arguments.forEach(s=>{H(s,{parent:e},{Identifier(n,a,o){n.parent=a.parent,ie(n,t);const h=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||h)&&(n.type==="MemberExpression"?Ae(n,t):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===q&&n.parent.callee.property.name==="get"||ve(n)))},BinaryExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},LogicalExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},UnaryExpression(n,a,o){const h={...a,parent:n};o(n.argument,h)},CallExpression(n,a,o){n._transformed||le(n,t)},MemberExpression(n,a,o){ue(n,"",t),n.object&&o(n.object,{parent:n})}})})}function cr(e,t){let i=null;if(e.left.type==="Identifier"){const[r,s]=t.getVariable(e.left.name);i=v.createContextVariableReference(s,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[s,n]=t.getVariable(r),a=s!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(n,s))}if(H(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,s,n){r.name=="na"&&(r.name="NaN"),r.parent=s.parent,ie(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",h=t.isContextBound(r.name)&&!t.isRootParam(r.name),c=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,l=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",g=r.name==="NaN",p=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===q&&r.parent.callee.property.name==="get";(h||o||a)&&(r.type==="MemberExpression"?Ae(r,t):r.type==="Identifier"&&!f&&!c&&!l&&!g&&!p&&ve(r))},MemberExpression(r,s,n){ue(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>n(a,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&n(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,n){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);le(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>n(o,{parent:r,inNamespaceCall:a||s.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const n=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:n,left:a,right:e.right,start:e.start,end:e.end}}const s=v.createSetCall(i,r);e.start&&(s.start=e.start),e.end&&(s.end=e.end),Object.assign(e,s)}}function ur(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===q||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===q||i.init.object.object.name==="context2"),n=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.name=q;return}if(s){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.object.name=q;return}n&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,h=t.isArrayPatternElement(i.id.name);i.init&&!n&&!h&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&t.isContextBound(i.init.callee.object.name)?le(i.init,t):H(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,ie(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",E=p.parent&&p.parent.type==="ConditionalExpression",A=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===q&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||E)&&!A&&ve(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),le(p,t),p.type==="CallExpression"&&p.arguments.forEach(w=>y(w,{parent:p}))},BinaryExpression(p,x,y){p.left.type==="Identifier"&&(p.left.parent=p),p.right.type==="Identifier"&&(p.right.parent=p),y(p.left,{parent:p}),y(p.right,{parent:p})},MemberExpression(p,x,y){p.object&&p.object.type==="Identifier"&&(p.object.parent=p),p.property&&p.property.type==="Identifier"&&(p.property.parent=p),ue(p,"",t),p.type==="CallExpression"?p.arguments.forEach(w=>y(w,{parent:p})):p.object&&y(p.object,{parent:p})},AwaitExpression(p,x,y){p.argument&&(p.argument._insideAwait=!0,y(p.argument,{parent:p}),p.argument.type==="Identifier"&&p.argument._wasInsideAwait&&Object.assign(p,p.argument))}}));const c=v.createContextVariableReference(o,a),l=!h&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(Ae(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?n||h?f=i.init:o==="var"?f=v.createInitVarCall(c,i.init):f=v.createInitCall(c,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(c,f));if(h){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),E=i.init.property.value,A={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:E},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[c,A])}n&&(t.pushScope("fn"),H(i.init.body,t,{BlockStatement(p,x,y){p.body.forEach(w=>y(w,x))},IfStatement(p,x,y){x.pushScope("if"),y(p.consequent,x),p.alternate&&(x.pushScope("els"),y(p.alternate,x),x.popScope()),x.popScope()},VariableDeclaration(p,x){ur(p,x)},Identifier(p,x){ie(p,x)},AssignmentExpression(p,x){cr(p,x)}}),t.popScope()),Object.assign(e,g)})}function As(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],s=r.id.name;t.addLoopVariable(s,s),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&H(r.init,t,{Identifier(n,a){t.isLoopVariable(n.name)||(t.pushScope("for"),ie(n,a),t.popScope())},MemberExpression(n){t.pushScope("for"),ue(n,"",t),t.popScope()}})}e.test&&H(e.test,t,{Identifier(r,s){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),ie(r,s),r.type==="Identifier"&&(r.computed=!0,ve(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),ue(r,"",t),t.popScope()}}),e.update&&H(e.update,t,{Identifier(r,s){t.isLoopVariable(r.name)||(t.pushScope("for"),ie(r,s),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Ps(e,t){H(e,t,{MemberExpression(i){ue(i,"",t)},CallExpression(i,r){le(i,r)},Identifier(i,r){ie(i,r);const s=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&s&&ve(i)}})}function Ts(e,t,i){e.test&&(t.pushScope("if"),Ps(e.test,t),t.popScope()),t.pushScope("if"),i(e.consequent,t),t.popScope(),e.alternate&&(t.pushScope("els"),i(e.alternate,t),t.popScope())}function Rs(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createGetCall(r,0);const[s,n]=t.getVariable(r.name);return v.createContextVariableAccess0(n,s)}else if(r.type==="MemberExpression")return r.object&&r.object.type==="MemberExpression"&&r.object.object&&r.object.object.type==="Identifier"&&r.object.object.name==="$"&&r.object.property&&["const","let","var","params"].includes(r.object.property.name)?v.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||ue(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?H(e.argument,t,{Identifier(r,s){ie(r,s),r.type==="Identifier"&&ve(r)},MemberExpression(r){ue(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){if(t.isContextBound(r.value.name))return r;const[s,n]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(n,s),kind:"init",method:!1,shorthand:!1,computed:!1}}if(r.value&&r.value.type==="Identifier"&&!(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name))&&!t.isContextBound(r.value.name)){const[s,n]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(n,s)}return r}):e.argument.type==="Identifier"&&(ie(e.argument,t),e.argument.type==="Identifier"&&ve(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(Ae(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&H(e.argument,t,{Identifier(s,n){ie(s,n),s.type==="Identifier"&&!s._arrayAccessed&&(ve(s),s._arrayAccessed=!0)},MemberExpression(s){ue(s,"",t)},CallExpression(s,n){le(s,n)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Ds(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function Vs(e){const t={...b,LineComment:()=>{}};zt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,n=v.createMathEqCall(r,s);n._transformed=!0,Object.assign(i,n)}}},t)}function Os(e,t,i,r={debug:!1,ln:!1},s=[]){const n=a=>{if(!r.debug||!a.loc||!s.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<s.length){const h=s[o].trim();if(h)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${h}`}}return null};H(e,t,{Program(a,o,h){const c=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&c.push(g),c.push(...f),c.push(l)}),a.body=c},BlockStatement(a,o,h){const c=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&c.push(g),c.push(...f),c.push(l)}),a.body=c},ReturnStatement(a,o){Rs(a,o)},VariableDeclaration(a,o){ur(a,o)},Identifier(a,o){ie(a,o)},CallExpression(a,o){le(a,o)},MemberExpression(a,o){ue(a,i,o)},AssignmentExpression(a,o){cr(a,o)},FunctionDeclaration(a,o,h){Ds(a,o,h)},ForStatement(a,o,h){As(a,o,h)},IfStatement(a,o,h){Ts(a,o,h)},AwaitExpression(a,o,h){a.argument&&(a.argument._insideAwait=!0,h(a.argument,o),a.argument.type==="Identifier"&&a.argument._wasInsideAwait===!0&&(a.type="Identifier",a.name=a.argument.name,a.argument._wasHoisted&&(a._wasHoisted=a.argument._wasHoisted),delete a.argument))}})}const m={NUMBER:"NUMBER",STRING:"STRING",BOOLEAN:"BOOLEAN",IDENTIFIER:"IDENTIFIER",KEYWORD:"KEYWORD",OPERATOR:"OPERATOR",LPAREN:"LPAREN",RPAREN:"RPAREN",LBRACKET:"LBRACKET",RBRACKET:"RBRACKET",LBRACE:"LBRACE",RBRACE:"RBRACE",COMMA:"COMMA",DOT:"DOT",COLON:"COLON",SEMICOLON:"SEMICOLON",INDENT:"INDENT",DEDENT:"DEDENT",NEWLINE:"NEWLINE",COMMENT:"COMMENT",EOF:"EOF"},Ms=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),Ls=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Bs{constructor(t,i,r,s,n=0){this.type=t,this.value=i,this.line=r,this.column=s,this.indent=n}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}var Fs=Object.defineProperty,js=(e,t,i)=>t in e?Fs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ye=(e,t,i)=>js(e,typeof t!="symbol"?t+"":t,i);class $s{constructor(t){ye(this,"source"),ye(this,"pos"),ye(this,"line"),ye(this,"column"),ye(this,"tokens"),ye(this,"indentStack"),ye(this,"atLineStart"),ye(this,"parenDepth"),ye(this,"bracketDepth"),ye(this,"braceDepth"),this.source=t,this.pos=0,this.line=1,this.column=1,this.tokens=[],this.indentStack=[0],this.atLineStart=!0,this.parenDepth=0,this.bracketDepth=0,this.braceDepth=0}tokenize(){for(;this.pos<this.source.length;){const t=this.peek();if(t==="\r"){this.advance();continue}if(t===`
33
+ }`}function As(e){H(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const n={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(t,n)}}),t.body&&t.body.body&&t.body.body.forEach(s=>r(s,i))}})}function Ps(e,t){Ht(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===q||r.init.object.name==="context2"),n=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===q||r.init.object.object.name==="context2");(s||n)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(a=>{a.key.name&&t.addContextBoundVar(a.key.name)}))})}})}function Ts(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function Rs(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function Ds(e,t){let i;return Ht(e,{FunctionDeclaration(r){Rs(r,t)},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=q),Ts(r,t,s)},VariableDeclaration(r){r.declarations.forEach(s=>{if(s.id.type==="ArrayPattern"){const n=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:s.init}]};s.id.elements?.forEach(h=>{h.type==="Identifier"&&t.addArrayPatternElement(h.name)});const o=s.id.elements.map((h,c)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:h,init:{type:"MemberExpression",object:{type:"Identifier",name:n},property:{type:"Literal",value:c},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const Dt={type:"Identifier",name:"undefined"};function Ae(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name)){if(e.object.type==="Identifier"&&!t.isLoopVariable(e.object.name)&&!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name),s=v.createContextVariableReference(r,i),n=v.createGetCall(s,e.property);Object.assign(e,n),e._indexTransformed=!0}return}if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Ae(i,t),i._indexTransformed=!0)}}}function ve(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function ie(e,t){if(e.name!==q){if(e.name==="na"&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e)){e.name="NaN";return}if(e.name==="Math"||e.name==="NaN"||e.name==="undefined"||e.name==="Infinity"||e.name==="null"||e.name.startsWith("'")&&e.name.endsWith("'")||e.name.startsWith('"')&&e.name.endsWith('"')||e.name.startsWith("`")&&e.name.endsWith("`")||t.isLoopVariable(e.name))return;let i=!1;if(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)){const g=e.parent.callee;if(g.type==="MemberExpression"&&g.object&&g.object.name===q&&["get","set","init","param"].includes(g.property.name))e.parent.arguments.indexOf(e)===0&&(i=!0);else{const p=g.type==="MemberExpression"&&g.object&&g.object.type==="Identifier"&&rt.includes(g.object.name);g.type==="MemberExpression"&&!p?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),s=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.property.name==="param";e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left;const n=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,a=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.object===e,o=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.property===e&&e.parent.parent&&e.parent.parent.type==="CallExpression"&&e.parent.parent.callee&&e.parent.parent.callee.type==="MemberExpression"&&t.isContextBound(e.parent.parent.callee.object.name);if(r||s||i||o||n){if(n||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const[g,p]=t.getVariable(e.name),x=v.createContextVariableReference(p,g);Object.assign(e,x);return}const h=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(h&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)))return;if(t.isLocalSeriesVar(e.name)){if(!a){const g=v.createIdentifier(e.name),p=v.createGetCall(g,0);Object.assign(e,p)}return}const[c,l]=t.getVariable(e.name);let f;if(h)f=v.createIdentifier(e.name);else{if(c===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,c)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function ue(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&rt.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const h=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,c=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!h&&!c){const l={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(l.start=e.start),e.end!==void 0&&(l.end=e.end),Object.assign(e,l);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",n=i.getCurrentScopeType()=="for";if(!r&&!s&&!n&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Ae(e,i),e._indexTransformed=!0);const a=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&e.object.object.object.name===q,o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(a||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const h=v.createGetCall(e.object,e.property);e.start&&(h.start=e.start),e.end&&(h.end=e.end),Object.assign(e,h),delete e.object,delete e.property,delete e.computed}}function Xe(e,t){if(e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(t.isLoopVariable(e.name))return e;if(t.isRootParam(e.name)){const[s,n]=t.getVariable(e.name);return v.createContextVariableReference(n,s)}if(t.isContextBound(e.name)||t.isLocalSeriesVar(e.name))return e;const[i,r]=t.getVariable(e.name);return i===e.name&&!t.isContextBound(e.name)?e:v.createContextVariableReference(r,i)}return e}function Ie(e,t,i=""){switch(e.type){case"BinaryExpression":return Vt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?Xe(e.object,t):e.object,property:e.property,computed:e.computed};case"Identifier":{if(t.isLoopVariable(e.name)||e.parent&&e.parent.type==="MemberExpression"&&e.parent.property===e)return e;const r=Xe(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:v.createGetCall(r,0)}case"UnaryExpression":return Ot(e,t,i);case"ConditionalExpression":{const r=Ie(e.test,t,i),s=Ie(e.consequent,t,i),n=Ie(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:n,start:e.start,end:e.end}}}return e}function Vt(e,t,i){const r=Ie(e.left,t,i),s=Ie(e.right,t,i),n={type:"BinaryExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return H(n,t,{CallExpression(a,o){a._transformed||le(a,o)},MemberExpression(a){ue(a,"",t)}}),n}function oi(e,t,i){const r=Ie(e.left,t,i),s=Ie(e.right,t,i),n={type:"LogicalExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return H(n,t,{CallExpression(a,o){a._transformed||le(a,o)}}),n}function hi(e,t,i){H(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,h){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,ie(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?Ae(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===q&&a.parent.callee.property.name==="get"||ve(a)))},MemberExpression(a,o,h){Ae(a,t),a.object&&h(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,h){const c={...o,parent:a};a.test&&h(a.test,c),a.consequent&&h(a.consequent,c),a.alternate&&h(a.alternate,c)},BinaryExpression(a,o,h){const c={...o,parent:a};h(a.left,c),h(a.right,c)},LogicalExpression(a,o,h){const c={...o,parent:a};h(a.left,c),h(a.right,c)},UnaryExpression(a,o,h){const c={...o,parent:a};h(a.argument,c)},CallExpression(a,o,h){const c=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);le(a,t),a.arguments.forEach(l=>h(l,{parent:a,inNamespaceCall:c||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),s=t.generateParamId(),n={type:"CallExpression",callee:r,arguments:[e,Dt,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=s;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,n);return t.addHoistedStatement(o),v.createIdentifier(a)}return n}function Ot(e,t,i){const r=Ie(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function Mt(e,t,i){switch(e?.type){case"BinaryExpression":e=Vt(e,i,t);break;case"LogicalExpression":e=oi(e,i,t);break;case"ConditionalExpression":return hi(e,i,t);case"UnaryExpression":e=Ot(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(o=>{if(o.type==="Identifier"){if(i.isContextBound(o.name)&&!i.isRootParam(o.name))return o;const[h,c]=i.getVariable(o.name);return v.createContextVariableAccess0(c,h)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?le(e.object,i):e.object.type==="MemberExpression"?ue(e.object,"",i):e.object.type==="BinaryExpression"?e.object=Vt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=oi(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=hi(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Ot(e.object,i,t));const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:Xe(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?Xe(e.property,i):e.property,c=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:c,arguments:[o,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const p=v.createVariableDeclaration(g,f);return i.addHoistedStatement(p),v.createIdentifier(g)}return f}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(o=>{if(o.value.name){if(i.isContextBound(o.value.name)&&!i.isRootParam(o.value.name))return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createIdentifier(o.value.name),kind:"init",method:!1,shorthand:!1,computed:!1};const[h,c]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(c,h),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=Mt(o.value,t,i));return o})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const o=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),h=i.generateParamId(),c={type:"CallExpression",callee:o,arguments:[e,Dt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,c);return i.addHoistedStatement(f),v.createIdentifier(l)}return c}}e?.type==="CallExpression"&&le(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),s=e.type==="Identifier"?Xe(e,i):e,n=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[s,Dt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=n;i.addLocalSeriesVar(o);const h=v.createVariableDeclaration(o,a);return i.addHoistedStatement(h),v.createIdentifier(o)}return a}function le(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(rt.includes(e.callee.name)||vs.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=v.createMemberExpression(e.callee,v.createIdentifier("any")));const r=e.callee&&e.callee.type==="MemberExpression"&&e.callee.object&&e.callee.object.type==="Identifier"&&(t.isContextBound(e.callee.object.name)||e.callee.object.name==="math"||e.callee.object.name==="ta");if(r){if(e.callee.object.name===q&&["get","init","param"].includes(e.callee.property.name))return;const s=e.callee.object.name,n=[];e.arguments.forEach(l=>{if(l._isParamCall){n.push(l);return}n.push(Mt(l,s,t))}),e.arguments=n,s==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${s}.${a}`,h=_s.includes(o),c=e._insideAwait===!0;if(h&&!c){const l=Object.assign({},e),f=v.createAwaitExpression(l);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const l=t.generateTempVar();t.addLocalSeriesVar(l);const f=e._insideAwait===!0;let g=Object.assign({},e);f&&(g=v.createAwaitExpression(g));const p=v.createVariableDeclaration(l,g);t.addHoistedStatement(p);const x=v.createIdentifier(l);Object.assign(e,x),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(s=>s._isParamCall?s:Mt(s,q,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&ie(e.callee.object,t),e.arguments.forEach(s=>{H(s,{parent:e},{Identifier(n,a,o){n.parent=a.parent,ie(n,t);const h=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||h)&&(n.type==="MemberExpression"?Ae(n,t):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===q&&n.parent.callee.property.name==="get"||ve(n)))},BinaryExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},LogicalExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},UnaryExpression(n,a,o){const h={...a,parent:n};o(n.argument,h)},CallExpression(n,a,o){n._transformed||le(n,t)},MemberExpression(n,a,o){ue(n,"",t),n.object&&o(n.object,{parent:n})}})})}function cr(e,t){let i=null;if(e.left.type==="Identifier"){const[r,s]=t.getVariable(e.left.name);i=v.createContextVariableReference(s,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[s,n]=t.getVariable(r),a=s!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(n,s))}if(H(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,s,n){r.name=="na"&&(r.name="NaN"),r.parent=s.parent,ie(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",h=t.isContextBound(r.name)&&!t.isRootParam(r.name),c=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,l=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",g=r.name==="NaN",p=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===q&&r.parent.callee.property.name==="get";(h||o||a)&&(r.type==="MemberExpression"?Ae(r,t):r.type==="Identifier"&&!f&&!c&&!l&&!g&&!p&&ve(r))},MemberExpression(r,s,n){ue(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>n(a,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&n(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,n){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);le(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>n(o,{parent:r,inNamespaceCall:a||s.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const n=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:n,left:a,right:e.right,start:e.start,end:e.end}}const s=v.createSetCall(i,r);e.start&&(s.start=e.start),e.end&&(s.end=e.end),Object.assign(e,s)}}function ur(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===q||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===q||i.init.object.object.name==="context2"),n=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.name=q;return}if(s){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.object.name=q;return}n&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,h=t.isArrayPatternElement(i.id.name);i.init&&!n&&!h&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&t.isContextBound(i.init.callee.object.name)?le(i.init,t):H(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,ie(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",E=p.parent&&p.parent.type==="ConditionalExpression",A=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===q&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||E)&&!A&&ve(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),le(p,t),p.type==="CallExpression"&&p.arguments.forEach(w=>y(w,{parent:p}))},BinaryExpression(p,x,y){p.left.type==="Identifier"&&(p.left.parent=p),p.right.type==="Identifier"&&(p.right.parent=p),y(p.left,{parent:p}),y(p.right,{parent:p})},MemberExpression(p,x,y){p.object&&p.object.type==="Identifier"&&(p.object.parent=p),p.property&&p.property.type==="Identifier"&&(p.property.parent=p),ue(p,"",t),p.type==="CallExpression"?p.arguments.forEach(w=>y(w,{parent:p})):p.object&&y(p.object,{parent:p})},AwaitExpression(p,x,y){p.argument&&(p.argument._insideAwait=!0,y(p.argument,{parent:p}),p.argument.type==="Identifier"&&p.argument._wasInsideAwait&&Object.assign(p,p.argument))}}));const c=v.createContextVariableReference(o,a),l=!h&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(Ae(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?n||h?f=i.init:o==="var"?f=v.createInitVarCall(c,i.init):f=v.createInitCall(c,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(c,f));if(h){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),E=i.init.property.value,A={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:E},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[c,A])}n&&(t.pushScope("fn"),H(i.init.body,t,{BlockStatement(p,x,y){p.body.forEach(w=>y(w,x))},IfStatement(p,x,y){x.pushScope("if"),y(p.consequent,x),p.alternate&&(x.pushScope("els"),y(p.alternate,x),x.popScope()),x.popScope()},VariableDeclaration(p,x){ur(p,x)},Identifier(p,x){ie(p,x)},AssignmentExpression(p,x){cr(p,x)}}),t.popScope()),Object.assign(e,g)})}function Vs(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],s=r.id.name;t.addLoopVariable(s,s),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&H(r.init,t,{Identifier(n,a){t.isLoopVariable(n.name)||(t.pushScope("for"),ie(n,a),t.popScope())},MemberExpression(n){t.pushScope("for"),ue(n,"",t),t.popScope()}})}e.test&&H(e.test,t,{Identifier(r,s){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),ie(r,s),r.type==="Identifier"&&(r.computed=!0,ve(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),ue(r,"",t),t.popScope()}}),e.update&&H(e.update,t,{Identifier(r,s){t.isLoopVariable(r.name)||(t.pushScope("for"),ie(r,s),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Os(e,t){H(e,t,{MemberExpression(i){ue(i,"",t)},CallExpression(i,r){le(i,r)},Identifier(i,r){ie(i,r);const s=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&s&&ve(i)}})}function Ms(e,t,i){e.test&&(t.pushScope("if"),Os(e.test,t),t.popScope()),t.pushScope("if"),i(e.consequent,t),t.popScope(),e.alternate&&(t.pushScope("els"),i(e.alternate,t),t.popScope())}function Ls(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createGetCall(r,0);const[s,n]=t.getVariable(r.name);return v.createContextVariableAccess0(n,s)}else if(r.type==="MemberExpression")return r.object&&r.object.type==="MemberExpression"&&r.object.object&&r.object.object.type==="Identifier"&&r.object.object.name==="$"&&r.object.property&&["const","let","var","params"].includes(r.object.property.name)?v.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||ue(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?H(e.argument,t,{Identifier(r,s){ie(r,s),r.type==="Identifier"&&ve(r)},MemberExpression(r){ue(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){if(t.isContextBound(r.value.name))return r;const[s,n]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(n,s),kind:"init",method:!1,shorthand:!1,computed:!1}}if(r.value&&r.value.type==="Identifier"&&!(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name))&&!t.isContextBound(r.value.name)){const[s,n]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(n,s)}return r}):e.argument.type==="Identifier"&&(ie(e.argument,t),e.argument.type==="Identifier"&&ve(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(Ae(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&H(e.argument,t,{Identifier(s,n){ie(s,n),s.type==="Identifier"&&!s._arrayAccessed&&(ve(s),s._arrayAccessed=!0)},MemberExpression(s){ue(s,"",t)},CallExpression(s,n){le(s,n)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Bs(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function Fs(e){const t={...b,LineComment:()=>{}};Ht(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,n=v.createMathEqCall(r,s);n._transformed=!0,Object.assign(i,n)}}},t)}function js(e,t,i,r={debug:!1,ln:!1},s=[]){const n=a=>{if(!r.debug||!a.loc||!s.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<s.length){const h=s[o].trim();if(h)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${h}`}}return null};H(e,t,{Program(a,o,h){const c=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&c.push(g),c.push(...f),c.push(l)}),a.body=c},BlockStatement(a,o,h){const c=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&c.push(g),c.push(...f),c.push(l)}),a.body=c},ReturnStatement(a,o){Ls(a,o)},VariableDeclaration(a,o){ur(a,o)},Identifier(a,o){ie(a,o)},CallExpression(a,o){le(a,o)},MemberExpression(a,o){ue(a,i,o)},AssignmentExpression(a,o){cr(a,o)},FunctionDeclaration(a,o,h){Bs(a,o,h)},ForStatement(a,o,h){Vs(a,o,h)},IfStatement(a,o,h){Ms(a,o,h)},AwaitExpression(a,o,h){a.argument&&(a.argument._insideAwait=!0,h(a.argument,o),a.argument.type==="Identifier"&&a.argument._wasInsideAwait===!0&&(a.type="Identifier",a.name=a.argument.name,a.argument._wasHoisted&&(a._wasHoisted=a.argument._wasHoisted),delete a.argument))}})}const d={NUMBER:"NUMBER",STRING:"STRING",BOOLEAN:"BOOLEAN",IDENTIFIER:"IDENTIFIER",KEYWORD:"KEYWORD",OPERATOR:"OPERATOR",LPAREN:"LPAREN",RPAREN:"RPAREN",LBRACKET:"LBRACKET",RBRACKET:"RBRACKET",LBRACE:"LBRACE",RBRACE:"RBRACE",COMMA:"COMMA",DOT:"DOT",COLON:"COLON",SEMICOLON:"SEMICOLON",INDENT:"INDENT",DEDENT:"DEDENT",NEWLINE:"NEWLINE",COMMENT:"COMMENT",EOF:"EOF"},$s=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),Ws=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class qs{constructor(t,i,r,s,n=0){this.type=t,this.value=i,this.line=r,this.column=s,this.indent=n}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}var Us=Object.defineProperty,Ks=(e,t,i)=>t in e?Us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ye=(e,t,i)=>Ks(e,typeof t!="symbol"?t+"":t,i);class zs{constructor(t){ye(this,"source"),ye(this,"pos"),ye(this,"line"),ye(this,"column"),ye(this,"tokens"),ye(this,"indentStack"),ye(this,"atLineStart"),ye(this,"parenDepth"),ye(this,"bracketDepth"),ye(this,"braceDepth"),this.source=t,this.pos=0,this.line=1,this.column=1,this.tokens=[],this.indentStack=[0],this.atLineStart=!0,this.parenDepth=0,this.bracketDepth=0,this.braceDepth=0}tokenize(){for(;this.pos<this.source.length;){const t=this.peek();if(t==="\r"){this.advance();continue}if(t===`
34
34
  `){this.handleNewline();continue}if(this.atLineStart&&t!==`
35
- `){this.handleIndentation(),this.atLineStart=!1;continue}if(t===" "||t===" "){this.advance();continue}if(this.pos>=this.source.length)break;if(t==="/"&&this.peek(1)==="/"){this.readComment();continue}if(t==='"'||t==="'"){this.readString();continue}if(t==="#"){this.readColorLiteral();continue}if(this.isDigit(t)){this.readNumber();continue}if(this.isIdentifierStart(t)){this.readIdentifier();continue}if(!this.readOperatorOrPunctuation())throw new Error(`Unexpected character '${t}' at ${this.line}:${this.column}`)}for(;this.indentStack.length>1;)this.indentStack.pop(),this.addToken(m.DEDENT,"",this.getCurrentIndent());return this.addToken(m.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(m.NEWLINE,`
35
+ `){this.handleIndentation(),this.atLineStart=!1;continue}if(t===" "||t===" "){this.advance();continue}if(this.pos>=this.source.length)break;if(t==="/"&&this.peek(1)==="/"){this.readComment();continue}if(t==='"'||t==="'"){this.readString();continue}if(t==="#"){this.readColorLiteral();continue}if(this.isDigit(t)){this.readNumber();continue}if(this.isIdentifierStart(t)){this.readIdentifier();continue}if(!this.readOperatorOrPunctuation())throw new Error(`Unexpected character '${t}' at ${this.line}:${this.column}`)}for(;this.indentStack.length>1;)this.indentStack.pop(),this.addToken(d.DEDENT,"",this.getCurrentIndent());return this.addToken(d.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(d.NEWLINE,`
36
36
  `),this.atLineStart=!0),this.advance(),this.line++,this.column=1}handleIndentation(){let t=0,i=0;for(this.pos;this.pos<this.source.length;){const s=this.peek();if(s===" ")i++,this.advance();else if(s===" ")t++,this.advance();else break}if(this.peek()===`
37
- `||this.peek()==="\0")return;t+=Math.floor(i/4);const r=this.indentStack[this.indentStack.length-1];if(t>r)this.indentStack.push(t),this.addToken(m.INDENT,"",t);else if(t<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>t;)this.indentStack.pop(),this.addToken(m.DEDENT,"",this.indentStack[this.indentStack.length-1]);if(this.indentStack[this.indentStack.length-1]!==t)throw new Error(`Indentation error at ${this.line}:${this.column} - misaligned dedent`)}}readComment(){this.column;let t="";for(this.advance(),this.advance();this.pos<this.source.length&&this.peek()!==`
38
- `;)t+=this.advance();this.addToken(m.COMMENT,t.trim())}readString(){const t=this.advance(),i=this.column-1;let r="";for(;this.pos<this.source.length&&this.peek()!==t;)if(this.peek()==="\\"){this.advance();const s=this.advance();switch(s){case"n":r+=`
39
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=s}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(m.STRING,r)}readColorLiteral(){const t=this.column;let i="#";for(this.advance();this.pos<this.source.length&&i.length<9;){const r=this.peek();if(r>="0"&&r<="9"||r>="A"&&r<="F"||r>="a"&&r<="f")i+=this.advance();else break}if(i.length!==7&&i.length!==9)throw new Error(`Invalid color literal '${i}' at ${this.line}:${t}`);this.addToken(m.STRING,i)}readNumber(){this.column;let t="",i=!1;for(;this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}this.addToken(m.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();Ms.has(t)?this.addToken(m.KEYWORD,t):t==="true"||t==="false"?this.addToken(m.BOOLEAN,t==="true"):this.addToken(m.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(Ls.includes(r))return this.advance(),this.advance(),this.addToken(m.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(m.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(m.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(m.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(m.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(m.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(m.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(m.RBRACE,t),!0;case",":return this.advance(),this.addToken(m.COMMA,t),!0;case".":return this.advance(),this.addToken(m.DOT,t),!0;case":":return this.advance(),this.addToken(m.COLON,t),!0;case";":return this.advance(),this.addToken(m.SEMICOLON,t),!0}return!1}peek(t=0){const i=this.pos+t;return i<this.source.length?this.source[i]:"\0"}advance(){const t=this.source[this.pos++];return this.column++,t}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(t){return t>="0"&&t<="9"}isIdentifierStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentifierChar(t){return this.isIdentifierStart(t)||this.isDigit(t)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(t,i,r=null){const s=new Bs(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var Ws=Object.defineProperty,qs=(e,t,i)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,se=(e,t,i)=>qs(e,typeof t!="symbol"?t+"":t,i);class B{constructor(t){this.type=t}}class Us extends B{constructor(t){super("Program"),this.body=t}}class oe extends B{constructor(t){super("ExpressionStatement"),this.expression=t}}var Me=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Me||{});class Te extends B{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Re extends B{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class ci extends B{constructor(t,i,r,s=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=s}}class Ks extends B{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class zs extends B{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,se(this,"_line")}}class ui extends B{constructor(t,i,r,s){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=s,se(this,"isForIn")}}class Hs extends B{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class De extends B{constructor(t){super("BlockStatement"),this.body=t}}class li extends B{constructor(t){super("ReturnStatement"),this.argument=t}}class te extends B{constructor(t){super("Identifier"),this.name=t,se(this,"varType"),se(this,"returnType"),se(this,"isMethod")}}class je extends B{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Ve extends B{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class pi extends B{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Nt extends B{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Gs extends B{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Ys extends B{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,se(this,"arguments"),this.callee=t,this.arguments=i}}class fi extends B{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class Ye extends B{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,se(this,"needsIIFE"),se(this,"consequentStmts"),se(this,"alternateStmts")}}class Qs extends B{constructor(t){super("ArrayExpression"),this.elements=t}}class Xs extends B{constructor(t){super("ObjectExpression"),this.properties=t}}class Zs extends B{constructor(t,i){super("Property"),this.key=t,this.value=i,se(this,"kind"),se(this,"method"),se(this,"shorthand"),se(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class mi extends B{constructor(t){super("ArrayPattern"),this.elements=t}}class di extends B{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class Js extends B{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class en extends B{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}var tn=Object.defineProperty,rn=(e,t,i)=>t in e?tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,gi=(e,t,i)=>rn(e,typeof t!="symbol"?t+"":t,i);class sn{constructor(t){gi(this,"tokens"),gi(this,"pos"),this.tokens=t,this.pos=0}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(t,i=null){const r=this.peek();return!(r.type!==t||i!==null&&r.value!==i)}expect(t,i=null){const r=this.peek();if(r.type!==t)throw new Error(`Expected ${t} but got ${r.type} at ${r.line}:${r.column}`);if(i!==null&&r.value!==i)throw new Error(`Expected '${i}' but got '${r.value}' at ${r.line}:${r.column}`);return this.advance()}skipNewlines(){for(;this.match(m.NEWLINE);)this.advance()}parse(){const t=[];for(;!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.EOF));){const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new Us(t)}parseStatement(){this.skipNewlines();const t=this.peek().line;if(this.match(m.COMMENT))return this.advance(),null;let i;if(this.match(m.KEYWORD,"type"))i=this.parseTypeDefinition();else if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))i=this.parseVarDeclaration();else if(this.match(m.KEYWORD,"method"))i=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())i=this.parseFunctionDeclaration();else if(this.match(m.KEYWORD,"if"))i=this.parseIfStatement();else if(this.match(m.KEYWORD,"for"))i=this.parseForStatement();else if(this.match(m.KEYWORD,"while"))i=this.parseWhileStatement();else if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;i=new oe(new te(r))}else if(this.isTupleDestructuring())i=this.parseTupleDestructuring();else if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;this.peek(r).type===m.OPERATOR&&this.peek(r).value==="="&&(i=this.parseTypedVarDeclaration())}if(!i){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();s==="="&&r.type==="Identifier"?i=new Te([new Re(r,n)],Me.LET):i=new oe(new Nt(s===":="?"=":s,r,n))}else i=new oe(r)}else i=new oe(r)}return i&&(i._line=t),i}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===m.IDENTIFIER&&this.peek(i+1).type===m.IDENTIFIER&&i++,this.peek(i).type!==m.IDENTIFIER||(i++,this.peek(i).type!==m.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==m.EOF;)this.peek(i).type===m.LPAREN&&r++,this.peek(i).type===m.RPAREN&&r--,i++;for(;this.peek(i).type===m.NEWLINE;)i++;return this.peek(i).type===m.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeDefinition(){this.expect(m.KEYWORD,"type");const t=this.expect(m.IDENTIFIER).value;this.match(m.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const r=this.expect(m.IDENTIFIER).value,s=this.expect(m.IDENTIFIER).value;let n=null;this.match(m.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),n=this.parseExpression()),i.push({type:r,name:s,defaultValue:n}),this.skipNewlines()}return this.match(m.DEDENT)&&this.advance(),new Ks(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.LBRACKET&&this.peek(2).type===m.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(m.IDENTIFIER).value;else if(this.peek().type===m.IDENTIFIER&&(this.peek(1).type===m.IDENTIFIER||this.peek(1).type===m.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(m.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(m.OPERATOR,">");)if(this.match(m.IDENTIFIER))i+=this.advance().value;else if(this.match(m.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(m.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(m.IDENTIFIER).value}else if(this.peek().type===m.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"="),this.skipNewlines();const s=this.parseExpression(),n=new te(r);return i&&(n.varType=i),new Te([new Re(n,s,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER;)t+=" "+this.advance().value;const i=this.expect(m.IDENTIFIER).value;this.expect(m.OPERATOR,"="),this.skipNewlines();const r=this.parseExpression(),s=new te(i);return s.varType=t,new Te([new Re(s,r,t)],Me.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new te(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new di(h,c))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new te(i);return t&&(n.returnType=t),new ci(n,r,s,t)}parseMethodDeclaration(){this.expect(m.KEYWORD,"method");let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type===m.LPAREN&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new te(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new di(h,c))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new te(i);return t&&(n.returnType=t),n.isMethod=!0,new ci(n,r,s,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new De([new li(i)])}for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(m.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new li(i.expression))}return new De(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(m.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(m.KEYWORD,"for"))return this.parseForStatement();if(this.match(m.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;return new oe(new te(r))}if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;if(this.peek(r).type===m.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new Te([new Re(r,n)],Me.LET)):i.push(new oe(new Nt(s===":="?"=":s,r,n))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new oe(r));else return new oe(r);break}}else if(this.match(m.COMMA)){i.push(new oe(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new oe(r));else return new oe(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.match(m.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new zs(t,i,r)}parseForStatement(){this.expect(m.KEYWORD,"for");let t=null,i=!1;if(this.match(m.LBRACKET)){this.advance();const r=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),r.push(new te(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new mi(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new te(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),n=new Te([new Re(t,r)],Me.CONST),a=new ui(n,null,null,s);return a.isForIn=!0,a}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"=");const r=this.parseExpression();this.expect(m.KEYWORD,"to");const s=this.parseExpression();let n=null;this.match(m.KEYWORD,"by")&&(this.advance(),n=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new Te([new Re(t,r)],Me.LET),h=new Ve("<=",t,s),c=n?new Nt("+=",t,n):new Gs("++",t);return new ui(o,h,c,a)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Hs(t,i)}parseBlock(){if(!this.match(m.INDENT)){const i=this.parseStatement();return new De(i?[i]:[])}this.advance();const t=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatement();i&&t.push(i)}return this.match(m.DEDENT)&&this.advance(),new De(t)}isTupleDestructuring(){if(!this.match(m.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type!==m.IDENTIFIER)return!1;for(t++;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type===m.RBRACKET){t++;break}else if(this.peek(t).type===m.COMMA){t++;continue}else return!1}for(;this.peek(t).type===m.NEWLINE;)t++;return this.peek(t).type===m.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),t.push(new te(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),this.skipNewlines(),this.expect(m.OPERATOR,"="),this.skipNewlines();const i=this.parseExpression();return new Te([new Re(new mi(t),i)],Me.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.match(m.OPERATOR,"?")){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.COLON),this.skipNewlines();const r=this.parseExpression();return new Ye(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.match(m.KEYWORD,"or")||this.match(m.OPERATOR)&&this.peek().value==="||";){this.advance(),this.skipNewlines();const i=this.parseLogicalAnd();t=new Ve("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.match(m.KEYWORD,"and")||this.match(m.OPERATOR)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new Ve("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseComparison();t=new Ve(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new Ve(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseMultiplicative();t=new Ve(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseUnary();t=new Ve(i,t,r)}return t}parseUnary(){if(this.match(m.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new pi(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new pi("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(m.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(m.EOF);)if(this.match(m.OPERATOR,"<"))r++,this.advance();else if(this.match(m.OPERATOR,">"))r--,this.advance();else if(this.match(m.IDENTIFIER)||this.match(m.COMMA))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(m.LPAREN)){t=this.parseCallExpression(t);continue}else{if(s)continue;break}}else if(this.match(m.LPAREN))t=this.parseCallExpression(t);else if(this.match(m.DOT)){this.advance(),this.skipNewlines();const i=this.expect(m.IDENTIFIER).value;t=new fi(t,new te(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new fi(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(m.LPAREN);const i=[],r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){if((this.peek().type===m.IDENTIFIER||this.peek().type===m.KEYWORD)&&this.peek(1).type===m.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const n=this.parseExpression();r.push(new Zs(new te(s),n))}else i.push(this.parseExpression());this.match(m.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(m.RPAREN),r.length>0&&i.push(new Xs(r)),new Ys(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new je(i.value)}if(this.match(m.STRING)){const i=this.advance();return new je(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new je(i.value)}if(this.match(m.IDENTIFIER)){const i=this.advance();return new te(i.value)}if(this.match(m.LBRACKET))return this.parseArrayLiteral();if(this.match(m.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(m.RPAREN),i}if(this.match(m.KEYWORD,"if"))return this.parseIfExpression();if(this.match(m.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET)&&(this.skipNewlines(),!this.match(m.RBRACKET));)t.push(this.parseExpression()),this.match(m.COMMA)&&this.advance(),this.skipNewlines();return this.expect(m.RBRACKET),new Qs(t)}parseIfExpression(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&i.push(a)}this.advance();let r=[];if(this.match(m.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")){const a=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new Ye(t,new De(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new Ye(t,this.getBlockValue(i),a)}else{for(this.expect(m.INDENT);!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&r.push(a)}this.advance()}if(this.needsIIFE(i,r)){const a=new Ye(t,new De(i),new De(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const s=this.getBlockValue(i),n=r.length>0?this.getBlockValue(r):new je(null);return new Ye(t,s,n)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=s=>s.some(n=>n.type==="IfStatement"||n.type==="ForStatement"||n.type==="WhileStatement"||n.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(m.KEYWORD,"switch");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){let r=null;this.match(m.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(m.INDENT)){for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&s.push(a)}this.advance()}else s.push(new oe(this.parseExpression()));const n=this.getBlockValue(s);i.push(new en(r,n)),this.skipNewlines()}return this.advance(),new Js(t,i)}getBlockValue(t){if(t.length===0)return new je(null);const i=t[t.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new je(null)}}var nn=Object.defineProperty,an=(e,t,i)=>t in e?nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Oe=(e,t,i)=>an(e,typeof t!="symbol"?t+"":t,i);class on{constructor(t={}){Oe(this,"indent"),Oe(this,"indentStr"),Oe(this,"output"),Oe(this,"sourceCode"),Oe(this,"sourceLines"),Oe(this,"lastCommentedLine"),Oe(this,"includeSourceComments"),this.indent=0,this.indentStr=t.indentStr||" ",this.output=[],this.sourceCode=t.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
37
+ `||this.peek()==="\0")return;t+=Math.floor(i/4);const r=this.indentStack[this.indentStack.length-1];if(t>r)this.indentStack.push(t),this.addToken(d.INDENT,"",t);else if(t<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>t;)this.indentStack.pop(),this.addToken(d.DEDENT,"",this.indentStack[this.indentStack.length-1]);if(this.indentStack[this.indentStack.length-1]!==t)throw new Error(`Indentation error at ${this.line}:${this.column} - misaligned dedent`)}}readComment(){this.column;let t="";for(this.advance(),this.advance();this.pos<this.source.length&&this.peek()!==`
38
+ `;)t+=this.advance();this.addToken(d.COMMENT,t.trim())}readString(){const t=this.advance(),i=this.column-1;let r="";for(;this.pos<this.source.length&&this.peek()!==t;)if(this.peek()==="\\"){this.advance();const s=this.advance();switch(s){case"n":r+=`
39
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=s}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(d.STRING,r)}readColorLiteral(){const t=this.column;let i="#";for(this.advance();this.pos<this.source.length&&i.length<9;){const r=this.peek();if(r>="0"&&r<="9"||r>="A"&&r<="F"||r>="a"&&r<="f")i+=this.advance();else break}if(i.length!==7&&i.length!==9)throw new Error(`Invalid color literal '${i}' at ${this.line}:${t}`);this.addToken(d.STRING,i)}readNumber(){this.column;let t="",i=!1;for(;this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}this.addToken(d.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();$s.has(t)?this.addToken(d.KEYWORD,t):t==="true"||t==="false"?this.addToken(d.BOOLEAN,t==="true"):this.addToken(d.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(Ws.includes(r))return this.advance(),this.advance(),this.addToken(d.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(d.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(d.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(d.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(d.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(d.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(d.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(d.RBRACE,t),!0;case",":return this.advance(),this.addToken(d.COMMA,t),!0;case".":return this.advance(),this.addToken(d.DOT,t),!0;case":":return this.advance(),this.addToken(d.COLON,t),!0;case";":return this.advance(),this.addToken(d.SEMICOLON,t),!0}return!1}peek(t=0){const i=this.pos+t;return i<this.source.length?this.source[i]:"\0"}advance(){const t=this.source[this.pos++];return this.column++,t}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(t){return t>="0"&&t<="9"}isIdentifierStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentifierChar(t){return this.isIdentifierStart(t)||this.isDigit(t)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(t,i,r=null){const s=new qs(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var Hs=Object.defineProperty,Gs=(e,t,i)=>t in e?Hs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,se=(e,t,i)=>Gs(e,typeof t!="symbol"?t+"":t,i);class B{constructor(t){this.type=t}}class Ys extends B{constructor(t){super("Program"),this.body=t}}class oe extends B{constructor(t){super("ExpressionStatement"),this.expression=t}}var Me=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Me||{});class Te extends B{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Re extends B{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class ci extends B{constructor(t,i,r,s=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=s}}class Qs extends B{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class Xs extends B{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,se(this,"_line")}}class ui extends B{constructor(t,i,r,s){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=s,se(this,"isForIn")}}class Zs extends B{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class De extends B{constructor(t){super("BlockStatement"),this.body=t}}class li extends B{constructor(t){super("ReturnStatement"),this.argument=t}}class te extends B{constructor(t){super("Identifier"),this.name=t,se(this,"varType"),se(this,"returnType"),se(this,"isMethod")}}class je extends B{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Ve extends B{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class pi extends B{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Ct extends B{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Js extends B{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class en extends B{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,se(this,"arguments"),this.callee=t,this.arguments=i}}class fi extends B{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class Ye extends B{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,se(this,"needsIIFE"),se(this,"consequentStmts"),se(this,"alternateStmts")}}class tn extends B{constructor(t){super("ArrayExpression"),this.elements=t}}class rn extends B{constructor(t){super("ObjectExpression"),this.properties=t}}class sn extends B{constructor(t,i){super("Property"),this.key=t,this.value=i,se(this,"kind"),se(this,"method"),se(this,"shorthand"),se(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class mi extends B{constructor(t){super("ArrayPattern"),this.elements=t}}class di extends B{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class nn extends B{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class an extends B{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}var on=Object.defineProperty,hn=(e,t,i)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,gi=(e,t,i)=>hn(e,typeof t!="symbol"?t+"":t,i);class cn{constructor(t){gi(this,"tokens"),gi(this,"pos"),this.tokens=t,this.pos=0}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(t,i=null){const r=this.peek();return!(r.type!==t||i!==null&&r.value!==i)}expect(t,i=null){const r=this.peek();if(r.type!==t)throw new Error(`Expected ${t} but got ${r.type} at ${r.line}:${r.column}`);if(i!==null&&r.value!==i)throw new Error(`Expected '${i}' but got '${r.value}' at ${r.line}:${r.column}`);return this.advance()}skipNewlines(){for(;this.match(d.NEWLINE);)this.advance()}parse(){const t=[];for(;!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.EOF));){const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new Ys(t)}parseStatement(){this.skipNewlines();const t=this.peek().line;if(this.match(d.COMMENT))return this.advance(),null;let i;if(this.match(d.KEYWORD,"type"))i=this.parseTypeDefinition();else if(this.match(d.KEYWORD,"var")||this.match(d.KEYWORD,"varip"))i=this.parseVarDeclaration();else if(this.match(d.KEYWORD,"method"))i=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())i=this.parseFunctionDeclaration();else if(this.match(d.KEYWORD,"if"))i=this.parseIfStatement();else if(this.match(d.KEYWORD,"for"))i=this.parseForStatement();else if(this.match(d.KEYWORD,"while"))i=this.parseWhileStatement();else if(this.match(d.KEYWORD,"break")||this.match(d.KEYWORD,"continue")){const r=this.advance().value;i=new oe(new te(r))}else if(this.isTupleDestructuring())i=this.parseTupleDestructuring();else if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER){let r=2;for(;this.peek(r).type===d.IDENTIFIER;)r++;this.peek(r).type===d.OPERATOR&&this.peek(r).value==="="&&(i=this.parseTypedVarDeclaration())}if(!i){const r=this.parseExpression();if(this.match(d.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();s==="="&&r.type==="Identifier"?i=new Te([new Re(r,n)],Me.LET):i=new oe(new Ct(s===":="?"=":s,r,n))}else i=new oe(r)}else i=new oe(r)}return i&&(i._line=t),i}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===d.IDENTIFIER&&this.peek(i+1).type===d.IDENTIFIER&&i++,this.peek(i).type!==d.IDENTIFIER||(i++,this.peek(i).type!==d.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==d.EOF;)this.peek(i).type===d.LPAREN&&r++,this.peek(i).type===d.RPAREN&&r--,i++;for(;this.peek(i).type===d.NEWLINE;)i++;return this.peek(i).type===d.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeDefinition(){this.expect(d.KEYWORD,"type");const t=this.expect(d.IDENTIFIER).value;this.match(d.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const r=this.expect(d.IDENTIFIER).value,s=this.expect(d.IDENTIFIER).value;let n=null;this.match(d.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),n=this.parseExpression()),i.push({type:r,name:s,defaultValue:n}),this.skipNewlines()}return this.match(d.DEDENT)&&this.advance(),new Qs(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.LBRACKET&&this.peek(2).type===d.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(d.IDENTIFIER).value;else if(this.peek().type===d.IDENTIFIER&&(this.peek(1).type===d.IDENTIFIER||this.peek(1).type===d.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(d.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(d.OPERATOR,">");)if(this.match(d.IDENTIFIER))i+=this.advance().value;else if(this.match(d.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(d.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(d.IDENTIFIER).value}else if(this.peek().type===d.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.expect(d.OPERATOR,"="),this.skipNewlines();const s=this.parseExpression(),n=new te(r);return i&&(n.varType=i),new Te([new Re(n,s,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER;)t+=" "+this.advance().value;const i=this.expect(d.IDENTIFIER).value;this.expect(d.OPERATOR,"="),this.skipNewlines();const r=this.parseExpression(),s=new te(i);return s.varType=t,new Te([new Re(s,r,t)],Me.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&(t=this.advance().value);const i=this.expect(d.IDENTIFIER).value;this.expect(d.LPAREN);const r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){let a=null;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type!==d.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(d.IDENTIFIER).value,h=new te(o);if(a&&(h.varType=a),this.match(d.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new di(h,c))}else r.push(h);this.match(d.COMMA)&&this.advance()}this.expect(d.RPAREN),this.skipNewlines(),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new te(i);return t&&(n.returnType=t),new ci(n,r,s,t)}parseMethodDeclaration(){this.expect(d.KEYWORD,"method");let t=null;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type===d.LPAREN&&(t=this.advance().value);const i=this.expect(d.IDENTIFIER).value;this.expect(d.LPAREN);const r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){let a=null;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type!==d.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(d.IDENTIFIER).value,h=new te(o);if(a&&(h.varType=a),this.match(d.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new di(h,c))}else r.push(h);this.match(d.COMMA)&&this.advance()}this.expect(d.RPAREN),this.skipNewlines(),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new te(i);return t&&(n.returnType=t),n.isMethod=!0,new ci(n,r,s,t)}parseFunctionBody(){const t=[];if(!this.match(d.INDENT)){const i=this.parseExpression();return new De([new li(i)])}for(this.advance();!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(d.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new li(i.expression))}return new De(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(d.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(d.KEYWORD,"for"))return this.parseForStatement();if(this.match(d.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(d.KEYWORD,"break")||this.match(d.KEYWORD,"continue")){const r=this.advance().value;return new oe(new te(r))}if(this.match(d.KEYWORD,"var")||this.match(d.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER){let r=2;for(;this.peek(r).type===d.IDENTIFIER;)r++;if(this.peek(r).type===d.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(d.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new Te([new Re(r,n)],Me.LET)):i.push(new oe(new Ct(s===":="?"=":s,r,n))),this.match(d.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new oe(r));else return new oe(r);break}}else if(this.match(d.COMMA)){i.push(new oe(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new oe(r));else return new oe(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(d.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.match(d.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(d.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new Xs(t,i,r)}parseForStatement(){this.expect(d.KEYWORD,"for");let t=null,i=!1;if(this.match(d.LBRACKET)){this.advance();const r=[];for(;!this.match(d.RBRACKET);)this.skipNewlines(),r.push(new te(this.expect(d.IDENTIFIER).value)),this.match(d.COMMA)&&this.advance();this.expect(d.RBRACKET),t=new mi(r),i=!0}else{const r=this.expect(d.IDENTIFIER).value;t=new te(r)}if(this.match(d.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),n=new Te([new Re(t,r)],Me.CONST),a=new ui(n,null,null,s);return a.isForIn=!0,a}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(d.OPERATOR,"=");const r=this.parseExpression();this.expect(d.KEYWORD,"to");const s=this.parseExpression();let n=null;this.match(d.KEYWORD,"by")&&(this.advance(),n=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new Te([new Re(t,r)],Me.LET),h=new Ve("<=",t,s),c=n?new Ct("+=",t,n):new Js("++",t);return new ui(o,h,c,a)}}parseWhileStatement(){this.expect(d.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Zs(t,i)}parseBlock(){if(!this.match(d.INDENT)){const i=this.parseStatement();return new De(i?[i]:[])}this.advance();const t=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const i=this.parseStatement();i&&t.push(i)}return this.match(d.DEDENT)&&this.advance(),new De(t)}isTupleDestructuring(){if(!this.match(d.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===d.NEWLINE;)t++;if(this.peek(t).type!==d.IDENTIFIER)return!1;for(t++;this.peek(t).type===d.NEWLINE;)t++;if(this.peek(t).type===d.RBRACKET){t++;break}else if(this.peek(t).type===d.COMMA){t++;continue}else return!1}for(;this.peek(t).type===d.NEWLINE;)t++;return this.peek(t).type===d.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(d.LBRACKET);const t=[];for(;!this.match(d.RBRACKET);)this.skipNewlines(),t.push(new te(this.expect(d.IDENTIFIER).value)),this.match(d.COMMA)&&this.advance();this.expect(d.RBRACKET),this.skipNewlines(),this.expect(d.OPERATOR,"="),this.skipNewlines();const i=this.parseExpression();return new Te([new Re(new mi(t),i)],Me.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.match(d.OPERATOR,"?")){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(d.COLON),this.skipNewlines();const r=this.parseExpression();return new Ye(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.match(d.KEYWORD,"or")||this.match(d.OPERATOR)&&this.peek().value==="||";){this.advance(),this.skipNewlines();const i=this.parseLogicalAnd();t=new Ve("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.match(d.KEYWORD,"and")||this.match(d.OPERATOR)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new Ve("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseComparison();t=new Ve(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new Ve(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseMultiplicative();t=new Ve(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseUnary();t=new Ve(i,t,r)}return t}parseUnary(){if(this.match(d.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new pi(t,this.parseUnary())}return this.match(d.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new pi("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(d.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(d.EOF);)if(this.match(d.OPERATOR,"<"))r++,this.advance();else if(this.match(d.OPERATOR,">"))r--,this.advance();else if(this.match(d.IDENTIFIER)||this.match(d.COMMA))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(d.LPAREN)){t=this.parseCallExpression(t);continue}else{if(s)continue;break}}else if(this.match(d.LPAREN))t=this.parseCallExpression(t);else if(this.match(d.DOT)){this.advance(),this.skipNewlines();const i=this.expect(d.IDENTIFIER).value;t=new fi(t,new te(i),!1)}else if(this.match(d.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(d.RBRACKET),t=new fi(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(d.LPAREN);const i=[],r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){if((this.peek().type===d.IDENTIFIER||this.peek().type===d.KEYWORD)&&this.peek(1).type===d.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const n=this.parseExpression();r.push(new sn(new te(s),n))}else i.push(this.parseExpression());this.match(d.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(d.RPAREN),r.length>0&&i.push(new rn(r)),new en(t,i)}parsePrimary(){const t=this.peek();if(this.match(d.NUMBER)){const i=this.advance();return new je(i.value)}if(this.match(d.STRING)){const i=this.advance();return new je(i.value)}if(this.match(d.BOOLEAN)){const i=this.advance();return new je(i.value)}if(this.match(d.IDENTIFIER)){const i=this.advance();return new te(i.value)}if(this.match(d.LBRACKET))return this.parseArrayLiteral();if(this.match(d.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(d.RPAREN),i}if(this.match(d.KEYWORD,"if"))return this.parseIfExpression();if(this.match(d.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(d.LBRACKET);const t=[];for(;!this.match(d.RBRACKET)&&(this.skipNewlines(),!this.match(d.RBRACKET));)t.push(this.parseExpression()),this.match(d.COMMA)&&this.advance(),this.skipNewlines();return this.expect(d.RBRACKET),new tn(t)}parseIfExpression(){this.expect(d.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&i.push(a)}this.advance();let r=[];if(this.match(d.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(d.KEYWORD,"if")){const a=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new Ye(t,new De(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new Ye(t,this.getBlockValue(i),a)}else{for(this.expect(d.INDENT);!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&r.push(a)}this.advance()}if(this.needsIIFE(i,r)){const a=new Ye(t,new De(i),new De(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const s=this.getBlockValue(i),n=r.length>0?this.getBlockValue(r):new je(null);return new Ye(t,s,n)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=s=>s.some(n=>n.type==="IfStatement"||n.type==="ForStatement"||n.type==="WhileStatement"||n.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(d.KEYWORD,"switch");const t=this.parseExpression();this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){let r=null;this.match(d.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(d.INDENT)){for(this.advance();!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&s.push(a)}this.advance()}else s.push(new oe(this.parseExpression()));const n=this.getBlockValue(s);i.push(new an(r,n)),this.skipNewlines()}return this.advance(),new nn(t,i)}getBlockValue(t){if(t.length===0)return new je(null);const i=t[t.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new je(null)}}var un=Object.defineProperty,ln=(e,t,i)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Oe=(e,t,i)=>ln(e,typeof t!="symbol"?t+"":t,i);class pn{constructor(t={}){Oe(this,"indent"),Oe(this,"indentStr"),Oe(this,"output"),Oe(this,"sourceCode"),Oe(this,"sourceLines"),Oe(this,"lastCommentedLine"),Oe(this,"includeSourceComments"),this.indent=0,this.indentStr=t.indentStr||" ",this.output=[],this.sourceCode=t.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
40
40
  `):[],this.lastCommentedLine=-1,this.includeSourceComments=t.includeSourceComments||!1}generate(t){if(this.output=[],this.indent=0,this.lastCommentedLine=-1,t.type==="Program")this.generateProgram(t);else throw new Error(`Expected Program node, got ${t.type}`);return this.output.join("")}writeSourceComment(t,i=null){if(!this.sourceLines.length)return;const r=i||t,s=[];for(let n=t-1;n<r&&n<this.sourceLines.length;n++)if(n>this.lastCommentedLine){const a=this.sourceLines[n].trim();a&&!a.startsWith("//@")&&!a.startsWith("//")&&s.push(this.sourceLines[n])}if(s.length>0){for(const n of s)this.write(this.indentStr.repeat(this.indent)),this.write("/// "),this.write(n.trimEnd()),this.write(`
41
41
  `);this.lastCommentedLine=Math.max(this.lastCommentedLine,r-1)}}write(t){this.output.push(t)}writeLine(t=""){t?this.output.push(this.indentStr.repeat(this.indent)+t+`
42
42
  `):this.output.push(`
@@ -110,8 +110,8 @@ ${e}
110
110
  `)}else this.write(` else {
111
111
  `),this.indent++,this.write(this.indentStr.repeat(this.indent)),this.write(`return false;
112
112
  `),this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write(`}
113
- `)}generateNestedIfAsExpression(t){if(t.type==="IfStatement"){if(this.write("("),this.generateExpression(t.test),this.write(" ? "),t.consequent.type==="BlockStatement"&&t.consequent.body.length>0){const i=t.consequent.body[t.consequent.body.length-1];i.type==="ExpressionStatement"?this.generateExpression(i.expression):i.type==="IfStatement"&&this.generateNestedIfAsExpression(i)}if(this.write(" : "),t.alternate)if(t.alternate.type==="IfStatement")this.generateNestedIfAsExpression(t.alternate);else if(t.alternate.type==="BlockStatement"&&t.alternate.body.length>0){const i=t.alternate.body[t.alternate.body.length-1];i.type==="ExpressionStatement"&&this.generateExpression(i.expression)}else this.write("false");else this.write("false");this.write(")")}}generateArrayExpression(t){this.write("[");for(let i=0;i<t.elements.length;i++)this.generateExpression(t.elements[i]),i<t.elements.length-1&&this.write(", ");this.write("]")}generateObjectExpression(t){this.write("{");for(let i=0;i<t.properties.length;i++){const r=t.properties[i];r.key.type==="Identifier"?this.write(r.key.name):this.generateExpression(r.key),this.write(": "),this.generateExpression(r.value),i<t.properties.length-1&&this.write(", ")}this.write("}")}generateSwitchExpression(t){this.write("(");for(let i=0;i<t.cases.length;i++){const r=t.cases[i];r.test?(this.generateExpression(t.discriminant),this.write(" == "),this.generateExpression(r.test),this.write(" ? "),this.generateExpression(r.consequent),this.write(" : ")):this.generateExpression(r.consequent)}t.cases.some(i=>!i.test)||this.write("undefined"),this.write(")")}generateSequenceExpression(t){this.write("(");for(let i=0;i<t.expressions.length;i++)this.generateExpression(t.expressions[i]),i<t.expressions.length-1&&this.write(", ");this.write(")")}needsParentheses(t){return!1}}function lr(e){const t=/^\s*\/\/\s*@version\s*=\s*(\d+)\s*$/im,i=e.match(t);return i&&i[1]?parseInt(i[1],10):null}function hn(e,t={}){const i=lr(e);if(i===null)return{success:!1,version:null,error:"Pine Script version not found. Please add //@version=X comment to your script."};if(i<5)return{success:!1,version:i,error:`Pine Script version ${i} is not supported. Only version 5 and above are supported.`};try{const r=new $s(e).tokenize(),s=new sn(r).parse(),n={...t,sourceCode:e},a=new on(n).generate(s);return{success:!0,version:i,code:a,ast:s,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function cn(e){if(typeof e=="function")return e.toString();{const t=lr(e);if(t===null)return e;if(t>=5){const i=hn(e);if(i.success)return i.code;throw new Error(`Failed to transpile Pine Script version ${t}: ${i.error}`)}else throw new Error(`Unsupported Pine Script version ${t}. Only version 5 and above are supported.`)}}function un(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=cn(e);r=Ss(r);const s=i?r.split(`
114
- `):[],n=sr(r,{ecmaVersion:"latest",sourceType:"module",locations:i});Es(n),bs(n),ws(n);const a=new ms;Ns(n,a);const o=Is(n,a)||"";Os(n,a,o,t,s),Vs(n);const h=hs||Kt||void 0,c=Object.assign({},h,{LineComment(f,g){g.write("//"+f.value)}}),l=ar(n,{generator:c,comments:i});return new Function("",`var _r = ${l}
115
- ; return _r;`)(this)}function ln(e){return t=>new F(t.array.map(i=>Math.abs(i)),t.type,e)}function pn(e){return t=>{let i=0,r=0;for(const s of t.array){const n=Number(s);isNaN(n)||(r++,i+=(n-i)/r)}return r===0?NaN:e.precision(i)}}function fn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length-1;for(;s<=n;){const a=Math.floor((s+n)/2),o=r[a];if(o===i)return a;o<i?s=a+1:n=a-1}return-1}}function mn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<i?s=a+1:n=a}return s<r.length&&r[s]===i?s:s-1}}function dn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<=i?s=a+1:n=a}return s>0&&r[s-1]===i?s-1:s}}function gn(e){return t=>{t.array.length=0}}function xn(e){return(t,i)=>(t.array.push(...i.array),t)}function yn(e){return t=>new F([...t.array],t.type,e)}function wn(e){return(t,i,r=!0)=>{const s=t.array,n=i.array;if(s.length!==n.length)return NaN;let a=0,o=0,h=0;const c=[];for(let x=0;x<s.length;x++){const y=Number(s[x]),w=Number(n[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,h++,c.push(x))}if(h===0)return NaN;const l=a/h,f=o/h;let g=0;for(const x of c){const y=Number(s[x]),w=Number(n[x]);g+=(y-l)*(w-f)}const p=r?h:h-1;return p<=0?NaN:e.precision(g/p)}}function bn(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function vn(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?W.int:W.float;if(e.every(t=>typeof t=="string"))return W.string;if(e.every(t=>typeof t=="boolean"))return W.bool;throw new Error("Cannot infer type from values")}function xe(e){if(typeof e=="number")return(e|0)===e?W.int:W.float;if(typeof e=="string")return W.string;if(typeof e=="boolean")return W.bool;throw new Error("Cannot infer type from value")}function rt(e,t){switch(t){case W.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case W.float:return typeof e=="number"||isNaN(e);case W.string:return typeof e=="string";case W.bool:return typeof e=="boolean"}return!1}function _n(e){return(t,i,r=0,s)=>{const n=t.array.length,a=s!==void 0?Math.min(s,n):n;for(let o=r;o<a;o++){if(!rt(i,t.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array[o]=e.precision(i)}}}function Sn(e){return t=>t.array.length>0?t.array[0]:e.NA}function En(e){return(t,i)=>t.array[i]}function Nn(e){return(t,i)=>t.array.includes(i)}function Cn(e){return(t,i)=>t.array.indexOf(i)}function kn(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array.splice(i,0,r)}}function In(e){return(t,i=",")=>t.array.join(i)}function An(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Pn(e){return(t,i)=>t.array.lastIndexOf(i)}function Tn(e){return(t,i=0)=>[...t.array].sort((r,s)=>s-r)[i]??e.NA}function Rn(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((s,n)=>typeof s=="number"&&typeof n=="number"?s-n:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Dn(e){return(t,i=0)=>[...t.array].sort((r,s)=>r-s)[i]??e.NA}function Vn(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const n of t.array){const a=(i.get(n)||0)+1;i.set(n,a),a>r&&(r=a)}const s=[];for(const[n,a]of i)a===r&&s.push(n);return s.sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:typeof n=="string"&&typeof a=="string"?n<a?-1:n>a?1:0:0),s[0]}}function On(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const h of r){const c=Number(h);if(isNaN(c)||c===null||c===void 0)return NaN;s.push(c)}s.sort((h,c)=>h-c),i<0&&(i=0),i>100&&(i=100);const n=i/100*s.length-.5;if(n<=0)return e.precision(s[0]);if(n>=s.length-1)return e.precision(s[s.length-1]);const a=Math.floor(n),o=n-a;return e.precision(s[a]*(1-o)+s[a+1]*o)}}function Mn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const o of r){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&s.push(h)}if(s.length===0)return NaN;s.sort((o,h)=>o-h),i<0&&(i=0),i>100&&(i=100);const n=r.length,a=Math.ceil(i/100*n);return a<=0?s[0]:a>s.length?NaN:s[a-1]}}function Ln(e){return(t,i)=>{if(t.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=t.array.length)return NaN;const s=Number(t.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let n=0;for(const o of t.array){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&h<s&&n++}const a=t.array.length-1;return a<=0?NaN:n/a*100}}function Bn(e){return t=>t.array.pop()}function Fn(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.push(e.precision(i))}}function jn(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function $n(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function Wn(e){return t=>{t.array.reverse()}}function qn(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array[i]=e.precision(r)}}function Un(e){return t=>t.array.shift()}function Kn(e){return t=>t.array.length}function zn(e){return(t,i,r)=>{const s=r!==void 0?r:void 0;return new F(t.array.slice(i,s),t.type,e)}}function Hn(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var We=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(We||{}),pr=(e=>(e.AED="AED",e.ARS="ARS",e.AUD="AUD",e.BDT="BDT",e.BHD="BHD",e.BRL="BRL",e.BTC="BTC",e.CAD="CAD",e.CHF="CHF",e.CLP="CLP",e.CNY="CNY",e.COP="COP",e.CZK="CZK",e.DKK="DKK",e.EGP="EGP",e.ETH="ETH",e.EUR="EUR",e.GBP="GBP",e.HKD="HKD",e.HUF="HUF",e.IDR="IDR",e.ILS="ILS",e.INR="INR",e.ISK="ISK",e.JPY="JPY",e.KES="KES",e.KRW="KRW",e.KWD="KWD",e.LKR="LKR",e.MAD="MAD",e.MXN="MXN",e.MYR="MYR",e.NGN="NGN",e.NOK="NOK",e.NONE="NONE",e.NZD="NZD",e.PEN="PEN",e.PHP="PHP",e.PKR="PKR",e.PLN="PLN",e.QAR="QAR",e.RON="RON",e.RSD="RSD",e.RUB="RUB",e.SAR="SAR",e.SEK="SEK",e.SGD="SGD",e.THB="THB",e.TND="TND",e.TRY="TRY",e.TWD="TWD",e.USD="USD",e.USDT="USDT",e.VES="VES",e.VND="VND",e.ZAR="ZAR",e))(pr||{}),fr=(e=>(e[e.sunday=1]="sunday",e[e.monday=2]="monday",e[e.tuesday=3]="tuesday",e[e.wednesday=4]="wednesday",e[e.thursday=5]="thursday",e[e.friday=6]="friday",e[e.saturday=7]="saturday",e))(fr||{}),mr=(e=>(e.all="all",e.data_window="data_window",e.none="none",e.pane="pane",e.price_scale="price_scale",e.status_line="status_line",e))(mr||{});const Gn={order:We,currency:pr,dayofweek:fr,display:mr};function Yn(e){return(t,i=We.ascending)=>{t.array.sort((r,s)=>{let n=isNaN(r)?1/0:r,a=isNaN(s)?1/0:s;return i===We.ascending?n-a:a-n})}}function Qn(e){return(t,i=We.ascending)=>{const r=t.array.map((s,n)=>n);return r.sort((s,n)=>{const a=isNaN(t.array[s])?1/0:t.array[s],o=isNaN(t.array[n])?1/0:t.array[n];return i===We.ascending?a-o:o-a}),new F(r,W.int,e)}}function Xn(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new F(t.array.map(()=>NaN),W.int,e):r===0?new F(t.array.map(()=>1),W.int,e):new F(t.array.map(s=>(s-i)/r),W.int,e)}}function Zn(e){return(t,i=!0)=>{const r=t.array,s=r.length;if(s===0)return NaN;let n=0,a=0,o=0;for(let l=0;l<s;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(n+=f,a+=f*f,o++)}if(o===0)return NaN;const h=n/o;let c=a/o-h*h;return c<0?NaN:(!i&&o>1&&(c=c*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(c)))}}function Jn(e){return t=>e.precision(t.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function ea(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.unshift(e.precision(i))}}function ta(e){return(t,i=!0)=>{let r=0,s=0;for(const h of t.array){const c=Number(h);!isNaN(c)&&c!==null&&c!==void 0&&(r+=c,s++)}if(s===0)return NaN;const n=r/s;let a=0;for(const h of t.array){const c=Number(h);!isNaN(c)&&c!==null&&c!==void 0&&(a+=(c-n)*(c-n))}const o=i?s:s-1;return o<=0?NaN:e.precision(a/o)}}var ia=Object.defineProperty,ra=(e,t,i)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>ra(e,typeof t!="symbol"?t+"":t,i),W=(e=>(e.any="",e.box="box",e.bool="bool",e.color="color",e.float="float",e.int="int",e.label="label",e.line="line",e.linefill="linefill",e.string="string",e.table="table",e))(W||{});class F{constructor(t,i,r){this.array=t,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=ln(this.context),this._avg=pn(this.context),this._binary_search=fn(this.context),this._binary_search_leftmost=mn(this.context),this._binary_search_rightmost=dn(this.context),this._clear=gn(this.context),this._concat=xn(this.context),this._copy=yn(this.context),this._covariance=wn(this.context),this._every=bn(this.context),this._fill=_n(this.context),this._first=Sn(this.context),this._get=En(this.context),this._includes=Nn(this.context),this._indexof=Cn(this.context),this._insert=kn(this.context),this._join=In(this.context),this._last=An(this.context),this._lastindexof=Pn(this.context),this._max=Tn(this.context),this._median=Rn(this.context),this._min=Dn(this.context),this._mode=Vn(this.context),this._percentile_linear_interpolation=On(this.context),this._percentile_nearest_rank=Mn(this.context),this._percentrank=Ln(this.context),this._pop=Bn(this.context),this._push=Fn(this.context),this._range=jn(this.context),this._remove=$n(this.context),this._reverse=Wn(this.context),this._set=qn(this.context),this._shift=Un(this.context),this._size=Kn(this.context),this._slice=zn(this.context),this._some=Hn(this.context),this._sort=Yn(this.context),this._sort_indices=Qn(this.context),this._standardize=Xn(this.context),this._stdev=Zn(this.context),this._sum=Jn(this.context),this._unshift=ea(this.context),this._variance=ta(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}abs(...t){return this._abs(this,...t)}avg(...t){return this._avg(this,...t)}binary_search(...t){return this._binary_search(this,...t)}binary_search_leftmost(...t){return this._binary_search_leftmost(this,...t)}binary_search_rightmost(...t){return this._binary_search_rightmost(this,...t)}clear(...t){return this._clear(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}covariance(...t){return this._covariance(this,...t)}every(...t){return this._every(this,...t)}fill(...t){return this._fill(this,...t)}first(...t){return this._first(this,...t)}get(...t){return this._get(this,...t)}includes(...t){return this._includes(this,...t)}indexof(...t){return this._indexof(this,...t)}insert(...t){return this._insert(this,...t)}join(...t){return this._join(this,...t)}last(...t){return this._last(this,...t)}lastindexof(...t){return this._lastindexof(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}percentile_linear_interpolation(...t){return this._percentile_linear_interpolation(this,...t)}percentile_nearest_rank(...t){return this._percentile_nearest_rank(this,...t)}percentrank(...t){return this._percentrank(this,...t)}pop(...t){return this._pop(this,...t)}push(...t){return this._push(this,...t)}range(...t){return this._range(this,...t)}remove(...t){return this._remove(this,...t)}reverse(...t){return this._reverse(this,...t)}set(...t){return this._set(this,...t)}shift(...t){return this._shift(this,...t)}size(...t){return this._size(this,...t)}slice(...t){return this._slice(this,...t)}some(...t){return this._some(this,...t)}sort(...t){return this._sort(this,...t)}sort_indices(...t){return this._sort_indices(this,...t)}standardize(...t){return this._standardize(this,...t)}stdev(...t){return this._stdev(this,...t)}sum(...t){return this._sum(this,...t)}unshift(...t){return this._unshift(this,...t)}variance(...t){return this._variance(this,...t)}}function sa(e){return(...t)=>new F([...t],vn(t),e)}function na(e){return(t,i)=>new F(Array(t).fill(e.precision(i||0)),xe(i||0),e)}function aa(e){return(t,i=!1)=>new F(Array(t).fill(i),W.bool,e)}function oa(e){return(t,i=NaN)=>new F(Array(t).fill(e.precision(i)),W.float,e)}function ha(e){return(t,i=0)=>new F(Array(t).fill(e.precision(i)),W.int,e)}function ca(e){return(t,i="")=>new F(Array(t).fill(i),W.string,e)}class d{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof d?t:Array.isArray(t)?new d(t):new d([t])}}function ua(e){return(t,i=0)=>d.from(t).get(i)}class la{constructor(t){this.context=t,this.abs=(i,...r)=>i.abs(...r),this.avg=(i,...r)=>i.avg(...r),this.binary_search=(i,...r)=>i.binary_search(...r),this.binary_search_leftmost=(i,...r)=>i.binary_search_leftmost(...r),this.binary_search_rightmost=(i,...r)=>i.binary_search_rightmost(...r),this.clear=(i,...r)=>i.clear(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.covariance=(i,...r)=>i.covariance(...r),this.every=(i,...r)=>i.every(...r),this.fill=(i,...r)=>i.fill(...r),this.first=(i,...r)=>i.first(...r),this.from=sa(t),this.get=(i,...r)=>i.get(...r),this.includes=(i,...r)=>i.includes(...r),this.indexof=(i,...r)=>i.indexof(...r),this.insert=(i,...r)=>i.insert(...r),this.join=(i,...r)=>i.join(...r),this.last=(i,...r)=>i.last(...r),this.lastindexof=(i,...r)=>i.lastindexof(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.new=na(t),this.new_bool=aa(t),this.new_float=oa(t),this.new_int=ha(t),this.new_string=ca(t),this.param=ua(),this.percentile_linear_interpolation=(i,...r)=>i.percentile_linear_interpolation(...r),this.percentile_nearest_rank=(i,...r)=>i.percentile_nearest_rank(...r),this.percentrank=(i,...r)=>i.percentrank(...r),this.pop=(i,...r)=>i.pop(...r),this.push=(i,...r)=>i.push(...r),this.range=(i,...r)=>i.range(...r),this.remove=(i,...r)=>i.remove(...r),this.reverse=(i,...r)=>i.reverse(...r),this.set=(i,...r)=>i.set(...r),this.shift=(i,...r)=>i.shift(...r),this.size=(i,...r)=>i.size(...r),this.slice=(i,...r)=>i.slice(...r),this.some=(i,...r)=>i.some(...r),this.sort=(i,...r)=>i.sort(...r),this.sort_indices=(i,...r)=>i.sort_indices(...r),this.standardize=(i,...r)=>i.standardize(...r),this.stdev=(i,...r)=>i.stdev(...r),this.sum=(i,...r)=>i.sum(...r),this.unshift=(i,...r)=>i.unshift(...r),this.variance=(i,...r)=>i.variance(...r)}}function pa(e){return t=>{t.map.clear()}}function fa(e){return(t,i)=>t.map.has(i)}function ma(e){return t=>{const i=new dr(e);return i.map=new Map(t.map),i}}function da(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function ga(e){return t=>{const i=Array.from(t.map.keys()),r=xe(i[0]);return new F(i,r,e)}}function xa(e){return(t,i,r)=>{const s=t.map.get(i);return t.map.set(i,r),s===void 0?NaN:s}}function ya(e){return(t,i)=>{for(const[r,s]of i.map)t.map.set(r,s)}}function wa(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function ba(e){return t=>t.map.size}function va(e){return t=>{const i=Array.from(t.map.values()),r=xe(i[0]);return new F(i,r,e)}}var _a=Object.defineProperty,Sa=(e,t,i)=>t in e?_a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,me=(e,t,i)=>Sa(e,typeof t!="symbol"?t+"":t,i);class dr{constructor(t){this.context=t,me(this,"map"),me(this,"_clear"),me(this,"_contains"),me(this,"_copy"),me(this,"_get"),me(this,"_keys"),me(this,"_put"),me(this,"_put_all"),me(this,"_remove"),me(this,"_size"),me(this,"_values"),this.map=new Map,this._clear=pa(this.context),this._contains=fa(this.context),this._copy=ma(this.context),this._get=da(this.context),this._keys=ga(this.context),this._put=xa(this.context),this._put_all=ya(this.context),this._remove=wa(this.context),this._size=ba(this.context),this._values=va(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...t){return this._clear(this,...t)}contains(...t){return this._contains(this,...t)}copy(...t){return this._copy(this,...t)}get(...t){return this._get(this,...t)}keys(...t){return this._keys(this,...t)}put(...t){return this._put(this,...t)}put_all(...t){return this._put_all(this,...t)}remove(...t){return this._remove(this,...t)}size(...t){return this._size(this,...t)}values(...t){return this._values(this,...t)}}function Ea(e){return()=>new dr(e)}function Na(e){return(t,i=0)=>d.from(t).get(i)}class Ca{constructor(t){this.context=t,this.clear=(i,...r)=>i.clear(...r),this.contains=(i,...r)=>i.contains(...r),this.copy=(i,...r)=>i.copy(...r),this.get=(i,...r)=>i.get(...r),this.keys=(i,...r)=>i.keys(...r),this.new=Ea(t),this.param=Na(),this.put=(i,...r)=>i.put(...r),this.put_all=(i,...r)=>i.put_all(...r),this.remove=(i,...r)=>i.remove(...r),this.size=(i,...r)=>i.size(...r),this.values=(i,...r)=>i.values(...r)}}function ka(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r&&(r instanceof F?n=r.array:Array.isArray(r)?n=r:n=[r]),s===0){for(let h=0;h<n.length;h++){let c=n[h];c instanceof d&&(c=c.get(0)),t.matrix.push([c])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let h=0;h<s;h++){let c=h<n.length?n[h]:NaN;c instanceof d&&(c=c.get(0)),t.matrix[h].splice(o,0,c)}}}function Ia(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r)if(r instanceof F)n=r.array;else if(Array.isArray(r))n=r;else if(r instanceof d){const c=r.get(0);Array.isArray(c)?n=c:n=[c]}else n=[r];const a=s>0?t.matrix[0].length:n.length,o=i!==void 0?i:s,h=[];for(let c=0;c<a;c++)if(c<n.length){let l=n[c];l instanceof d&&(l=l.get(0)),h.push(l)}else h.push(NaN);t.matrix.splice(o,0,h)}}function Aa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;if(r===0)return NaN;let s=0,n=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(s+=h,n++)}return n===0?NaN:s/n}}function Pa(e){return(t,i)=>{const r=t.matrix.length,s=[];for(let a=0;a<r;a++)s.push(t.matrix[a][i]);const n=xe(s[0]);return new F(s,n,e)}}function Ta(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Ra(e){return(t,i)=>{const r=t.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]]);return}const n=t.matrix[0].length,a=s>0?i.matrix[0].length:0;if(n!==a&&s>0){console.error(`matrix.concat: Column count mismatch ${n} vs ${a}`);return}for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]])}}function Da(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,s=new L(i,r,NaN,e);return s.matrix=t.matrix.map(n=>[...n]),s}}function Va(e){const t=e.length;if(t===0)return 0;if(t===1)return e[0][0];if(t===2)return e[0][0]*e[1][1]-e[0][1]*e[1][0];const i=e.map(s=>[...s]);let r=1;for(let s=0;s<t;s++){let n=s;for(;n<t&&i[n][s]===0;)n++;if(n===t)return 0;n!==s&&([i[s],i[n]]=[i[n],i[s]],r*=-1),r*=i[s][s];for(let a=s+1;a<t;a++){const o=i[a][s]/i[s][s];for(let h=s;h<t;h++)i[a][h]-=o*i[s][h]}}return r}function Oa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Va(t.matrix)}}function Ma(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new L(0,0,NaN,e);const s=t.matrix[0].length,n=new L(r,s,NaN,e);if(i instanceof L)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],c=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h-c}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]-a}return n}}function La(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],s=e[1][0],n=e[1][1],a=i+n,o=i*n-r*s,h=a*a-4*o;if(h<0)return[NaN,NaN];const c=(a+Math.sqrt(h))/2,l=(a-Math.sqrt(h))/2;return[c,l]}function Ba(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=xe(t.matrix[0][0]);return new F([],a,e)}const s=La(t.matrix),n=xe(s[0]);return new F(s,n,e)}}function Fa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new L(0,0,NaN,e);const s=new L(i,r,0,e);for(let n=0;n<i;n++)s.matrix[n][n]=1;return s}}function ja(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function $a(e){return(t,i,r,s,n,a)=>{const o=t.matrix.length;if(o===0)return;const h=t.matrix[0].length,c=r!==void 0?r:0,l=s!==void 0?s:o,f=n!==void 0?n:0,g=a!==void 0?a:h;for(let p=c;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=h);x++)t.matrix[p][x]=i}}function Wa(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const s=t.matrix[i][r];return s===void 0?NaN:s}}function qa(e){if(e.length!==2)return e.map(i=>i.map(()=>NaN));const t=e[0][0]*e[1][1]-e[0][1]*e[1][0];return t===0?[[NaN,NaN],[NaN,NaN]]:[[e[1][1]/t,-e[0][1]/t],[-e[1][0]/t,e[0][0]/t]]}function Ua(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new L(i,r,NaN,e);const s=qa(t.matrix),n=new L(i,r,NaN,e);return n.matrix=s,n}}function Ka(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s+n!==i-1&&t.matrix[s][n]!==0)return!1;return!0}}function za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[n][s]!==-t.matrix[s][n])return!1;return!0}}function Ha(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++){const a=t.matrix[s][n];if(a!==0&&a!==1)return!1}return!0}}function Ga(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s!==n&&t.matrix[s][n]!==0)return!1;return!0}}function Ya(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s===n){if(t.matrix[s][n]!==1)return!1}else if(t.matrix[s][n]!==0)return!1;return!0}}function Qa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Xa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++){let n=0;for(let a=0;a<r;a++){const o=t.matrix[s][a];if(o<0)return!1;n+=o}if(Math.abs(n-1)>1e-10)return!1}return!0}}function Za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<s;n++)if(t.matrix[s][n]!==t.matrix[n][s])return!1;return!0}}function Ja(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;let s=!0,n=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(s=!1),a<o&&t.matrix[a][o]!==0&&(n=!1);return s||n}}function eo(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[s][n]!==0)return!1;return!0}}function to(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0,n=i.matrix.length,a=n>0?i.matrix[0].length:0,o=r*n,h=s*a,c=new L(o,h,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){const g=t.matrix[l][f];for(let p=0;p<n;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];c.matrix[l*n+p][f*a+x]=g*y}}return c}}function io(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=-1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h>s&&(s=h),n=!0)}return n?s:NaN}}function ro(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||s.push(h)}if(s.length===0)return NaN;s.sort((a,o)=>a-o);const n=Math.floor(s.length/2);return s.length%2!==0?s[n]:(s[n-1]+s[n])/2}}function so(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h<s&&(s=h),n=!0)}return n?s:NaN}}function no(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=new Map;let n=0,a=NaN;for(let o=0;o<i;o++)for(let h=0;h<r;h++){const c=t.matrix[o][h];if(!isNaN(c)){const l=(s.get(c)||0)+1;s.set(c,l),l>n?(n=l,a=c):l===n&&c<a&&(a=c)}}return a}}function ao(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(i instanceof L){const n=i.matrix.length,a=n>0?i.matrix[0].length:0;if(s!==n)return new L(0,0,NaN,e);const o=new L(r,a,0,e);for(let h=0;h<r;h++)for(let c=0;c<a;c++){let l=0;for(let f=0;f<s;f++)l+=t.matrix[h][f]*i.matrix[f][c];o.matrix[h][c]=l}return o}else if(i instanceof F||Array.isArray(i.array||i)){const n=i.array||i;if(s!==n.length)return new L(0,0,NaN,e);const a=new L(r,1,0,e);for(let o=0;o<r;o++){let h=0;for(let c=0;c<s;c++)h+=t.matrix[o][c]*n[c];a.matrix[o][0]=h}return a}else{const n=i,a=new L(r,s,NaN,e);for(let o=0;o<r;o++)for(let h=0;h<s;h++)a.matrix[o][h]=t.matrix[o][h]*n;return a}}}function oo(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new L(i,r,NaN,e):new L(r,i,NaN,e)}}function ho(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(r!==s)return new L(0,0,NaN,e);let n=new L(r,s,0,e);for(let h=0;h<r;h++)n.matrix[h][h]=1;let a=new L(r,s,NaN,e);for(let h=0;h<r;h++)a.matrix[h]=[...t.matrix[h]];let o=Math.floor(i);if(o<0)return new L(r,s,NaN,e);for(;o>0;){if(o%2===1){const c=new L(r,s,0,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){let g=0;for(let p=0;p<r;p++)g+=n.matrix[l][p]*a.matrix[p][f];c.matrix[l][f]=g}n=c}const h=new L(r,s,0,e);for(let c=0;c<r;c++)for(let l=0;l<s;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[c][g]*a.matrix[g][l];h.matrix[c][l]=f}a=h,o=Math.floor(o/2)}return n}}function co(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=t.matrix.map(a=>[...a]);let n=0;for(let a=0;a<r&&n<i;a++){let o=n;for(;o<i&&Math.abs(s[o][a])<1e-10;)o++;if(o<i){[s[n],s[o]]=[s[o],s[n]];const h=s[n][a];for(let c=a;c<r;c++)s[n][c]/=h;for(let c=0;c<i;c++)if(c!==n){const l=s[c][a];for(let f=a;f<r;f++)s[c][f]-=l*s[n][f]}n++}}return n}}function uo(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=xe(t.matrix[0][0]);return new F([],a,e)}const s=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);s.push(o[0])}const n=xe(s[0]);return new F(s,n,e)}}function lo(e){return(t,i)=>{const r=t.matrix.splice(i,1),s=xe(r[0][0]);return new F(r[0]||[],s,e)}}function po(e){return(t,i,r)=>{const s=t.matrix.length,n=s>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<s;l++)for(let f=0;f<n;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const h=[];let c=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[c++]);h.push(f)}t.matrix=h}}function fo(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function mo(e){return(t,i)=>{if(!t.matrix[i]){const s=xe(t.matrix[0][0]);return new F([],s,e)}const r=xe(t.matrix[i][0]);return new F([...t.matrix[i]],r,e)}}function go(e){return t=>t.matrix.length}function xo(e){return(t,i,r,s)=>{t.matrix[i]&&(t.matrix[i][r]=s)}}function yo(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((s,n)=>{const a=s[i],o=n[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function wo(e){return(t,i,r,s,n)=>{const a=r-i,o=n-s,h=new L(a,o,NaN,e);for(let c=0;c<a;c++){const l=i+c;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=s+f;if(g>=t.matrix[l].length)break;h.matrix[c][f]=t.matrix[l][g]}}return h}}function bo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new L(0,0,NaN,e);const s=t.matrix[0].length,n=new L(r,s,NaN,e);if(i instanceof L)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],c=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h+c}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]+a}return n}}function vo(e){return(t,i,r)=>{const s=t.matrix.length;for(let n=0;n<s;n++){const a=t.matrix[n][i];t.matrix[n][i]=t.matrix[n][r],t.matrix[n][r]=a}}}function _o(e){return(t,i,r)=>{const s=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=s}}function So(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=Math.min(i,r);let n=0;for(let a=0;a<s;a++)n+=t.matrix[a][a];return n}}function Eo(e){return t=>{const i=t.matrix.length;if(i===0)return new L(0,0,NaN,e);const r=t.matrix[0].length,s=new L(r,i,NaN,e);for(let n=0;n<i;n++)for(let a=0;a<r;a++)s.matrix[a][n]=t.matrix[n][a];return s}}var No=Object.defineProperty,Co=(e,t,i)=>t in e?No(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,I=(e,t,i)=>Co(e,typeof t!="symbol"?t+"":t,i);class L{constructor(t=0,i=0,r=NaN,s){if(this.context=s,I(this,"matrix"),I(this,"_add_col"),I(this,"_add_row"),I(this,"_avg"),I(this,"_col"),I(this,"_columns"),I(this,"_concat"),I(this,"_copy"),I(this,"_det"),I(this,"_diff"),I(this,"_eigenvalues"),I(this,"_eigenvectors"),I(this,"_elements_count"),I(this,"_fill"),I(this,"_get"),I(this,"_inv"),I(this,"_is_antidiagonal"),I(this,"_is_antisymmetric"),I(this,"_is_binary"),I(this,"_is_diagonal"),I(this,"_is_identity"),I(this,"_is_square"),I(this,"_is_stochastic"),I(this,"_is_symmetric"),I(this,"_is_triangular"),I(this,"_is_zero"),I(this,"_kron"),I(this,"_max"),I(this,"_median"),I(this,"_min"),I(this,"_mode"),I(this,"_mult"),I(this,"_pinv"),I(this,"_pow"),I(this,"_rank"),I(this,"_remove_col"),I(this,"_remove_row"),I(this,"_reshape"),I(this,"_reverse"),I(this,"_row"),I(this,"_rows"),I(this,"_set"),I(this,"_sort"),I(this,"_submatrix"),I(this,"_sum"),I(this,"_swap_columns"),I(this,"_swap_rows"),I(this,"_trace"),I(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let n=0;n<t;n++)this.matrix.push(Array(i).fill(r));this._add_col=ka(this.context),this._add_row=Ia(this.context),this._avg=Aa(this.context),this._col=Pa(this.context),this._columns=Ta(this.context),this._concat=Ra(this.context),this._copy=Da(this.context),this._det=Oa(this.context),this._diff=Ma(this.context),this._eigenvalues=Ba(this.context),this._eigenvectors=Fa(this.context),this._elements_count=ja(this.context),this._fill=$a(this.context),this._get=Wa(this.context),this._inv=Ua(this.context),this._is_antidiagonal=Ka(this.context),this._is_antisymmetric=za(this.context),this._is_binary=Ha(this.context),this._is_diagonal=Ga(this.context),this._is_identity=Ya(this.context),this._is_square=Qa(this.context),this._is_stochastic=Xa(this.context),this._is_symmetric=Za(this.context),this._is_triangular=Ja(this.context),this._is_zero=eo(this.context),this._kron=to(this.context),this._max=io(this.context),this._median=ro(this.context),this._min=so(this.context),this._mode=no(this.context),this._mult=ao(this.context),this._pinv=oo(this.context),this._pow=ho(this.context),this._rank=co(this.context),this._remove_col=uo(this.context),this._remove_row=lo(this.context),this._reshape=po(this.context),this._reverse=fo(this.context),this._row=mo(this.context),this._rows=go(this.context),this._set=xo(this.context),this._sort=yo(this.context),this._submatrix=wo(this.context),this._sum=bo(this.context),this._swap_columns=vo(this.context),this._swap_rows=_o(this.context),this._trace=So(this.context),this._transpose=Eo(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
116
- `,t+="["+this.matrix[i].join(", ")+"]";return t}add_col(...t){return this._add_col(this,...t)}add_row(...t){return this._add_row(this,...t)}avg(...t){return this._avg(this,...t)}col(...t){return this._col(this,...t)}columns(...t){return this._columns(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}det(...t){return this._det(this,...t)}diff(...t){return this._diff(this,...t)}eigenvalues(...t){return this._eigenvalues(this,...t)}eigenvectors(...t){return this._eigenvectors(this,...t)}elements_count(...t){return this._elements_count(this,...t)}fill(...t){return this._fill(this,...t)}get(...t){return this._get(this,...t)}inv(...t){return this._inv(this,...t)}is_antidiagonal(...t){return this._is_antidiagonal(this,...t)}is_antisymmetric(...t){return this._is_antisymmetric(this,...t)}is_binary(...t){return this._is_binary(this,...t)}is_diagonal(...t){return this._is_diagonal(this,...t)}is_identity(...t){return this._is_identity(this,...t)}is_square(...t){return this._is_square(this,...t)}is_stochastic(...t){return this._is_stochastic(this,...t)}is_symmetric(...t){return this._is_symmetric(this,...t)}is_triangular(...t){return this._is_triangular(this,...t)}is_zero(...t){return this._is_zero(this,...t)}kron(...t){return this._kron(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}mult(...t){return this._mult(this,...t)}pinv(...t){return this._pinv(this,...t)}pow(...t){return this._pow(this,...t)}rank(...t){return this._rank(this,...t)}remove_col(...t){return this._remove_col(this,...t)}remove_row(...t){return this._remove_row(this,...t)}reshape(...t){return this._reshape(this,...t)}reverse(...t){return this._reverse(this,...t)}row(...t){return this._row(this,...t)}rows(...t){return this._rows(this,...t)}set(...t){return this._set(this,...t)}sort(...t){return this._sort(this,...t)}submatrix(...t){return this._submatrix(this,...t)}sum(...t){return this._sum(this,...t)}swap_columns(...t){return this._swap_columns(this,...t)}swap_rows(...t){return this._swap_rows(this,...t)}trace(...t){return this._trace(this,...t)}transpose(...t){return this._transpose(this,...t)}}function ko(e){return(t,i,r)=>new L(t,i,r,e)}function Io(e){return(t,i=0)=>d.from(t).get(i)}class Ao{constructor(t){this.context=t,this.add_col=(i,...r)=>i.add_col(...r),this.add_row=(i,...r)=>i.add_row(...r),this.avg=(i,...r)=>i.avg(...r),this.col=(i,...r)=>i.col(...r),this.columns=(i,...r)=>i.columns(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.det=(i,...r)=>i.det(...r),this.diff=(i,...r)=>i.diff(...r),this.eigenvalues=(i,...r)=>i.eigenvalues(...r),this.eigenvectors=(i,...r)=>i.eigenvectors(...r),this.elements_count=(i,...r)=>i.elements_count(...r),this.fill=(i,...r)=>i.fill(...r),this.get=(i,...r)=>i.get(...r),this.inv=(i,...r)=>i.inv(...r),this.is_antidiagonal=(i,...r)=>i.is_antidiagonal(...r),this.is_antisymmetric=(i,...r)=>i.is_antisymmetric(...r),this.is_binary=(i,...r)=>i.is_binary(...r),this.is_diagonal=(i,...r)=>i.is_diagonal(...r),this.is_identity=(i,...r)=>i.is_identity(...r),this.is_square=(i,...r)=>i.is_square(...r),this.is_stochastic=(i,...r)=>i.is_stochastic(...r),this.is_symmetric=(i,...r)=>i.is_symmetric(...r),this.is_triangular=(i,...r)=>i.is_triangular(...r),this.is_zero=(i,...r)=>i.is_zero(...r),this.kron=(i,...r)=>i.kron(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.mult=(i,...r)=>i.mult(...r),this.new=ko(t),this.param=Io(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var Po=Object.defineProperty,To=(e,t,i)=>t in e?Po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ro=(e,t,i)=>To(e,typeof t!="symbol"?t+"":t,i);class Do{constructor(t){this.context=t,Ro(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.data.close.data.length-1}get isfirst(){return this.context.idx===0}get ishistory(){return this.context.idx<this.context.data.close.data.length-1}get isrealtime(){return this.context.idx===this.context.data.close.data.length-1}get isconfirmed(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}get islastconfirmedhistory(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}}const xi={series:e=>e instanceof d||typeof e=="number",string:e=>typeof e=="string",number:e=>typeof e=="number",boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e),object:e=>typeof e=="object",primitive:e=>typeof e===null||typeof e!="object"&&typeof e!="function",function:e=>typeof e=="function",undefined:e=>e===void 0,null:e=>e===null,NaN:e=>isNaN(e),remaining_options:e=>typeof e=="object"&&!(e instanceof d)};function Gt(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let s={};const n=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(xi.remaining_options(o)){s=o;break}const h=t.map((c,l)=>n[l]?c[a]:void 0);for(let c=0;c<h.length;c++){const l=h[c];if(l===void 0){n[c]=!1;continue}const f=xi[i[l]];typeof f=="function"&&f(o)?r[l]=o:n[c]=!1}}return{...s,...r}}var Vo=Object.defineProperty,Oo=(e,t,i)=>t in e?Vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Mo=(e,t,i)=>Oo(e,typeof t!="symbol"?t+"":t,i);const Lo=["title","shorttitle","overlay","format","precision","scale","max_bars_back","timeframe","timeframe_gaps","explicit_plot_zorder","max_lines_count","max_labels_count","max_boxes_count","calc_bars_count","max_polylines_count","dynamic_requests","behind_chart"],Bo={title:"string",shorttitle:"string",overlay:"boolean",format:"string",precision:"number",scale:"string",max_bars_back:"number",timeframe:"string",timeframe_gaps:"boolean",explicit_plot_zorder:"boolean",max_lines_count:"number",max_labels_count:"number",max_boxes_count:"number",calc_bars_count:"number",max_polylines_count:"number",dynamic_requests:"boolean",behind_chart:"boolean"};function Fo(e){return Gt(e,Lo,Bo)}class jo{constructor(t){this.context=t,Mo(this,"color",{param:(i,r=0)=>d.from(i).get(r),rgb:(i,r,s,n)=>n?`rgba(${i}, ${r}, ${s}, ${n})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(i&&i.startsWith("#")){const s=i.slice(1),n=parseInt(s.slice(0,2),16),a=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16);return r?`rgba(${n}, ${a}, ${o}, ${r})`:`rgb(${n}, ${a}, ${o})`}return r?`rgba(${i}, ${r})`:i},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue",yellow:"yellow",orange:"orange",purple:"purple",pink:"pink",brown:"brown",teal:"teal",cyan:"cyan",navy:"navy",indigo:"indigo",violet:"violet",magenta:"magenta",rose:"rose",gold:"gold",silver:"silver",bronze:"bronze"})}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}indicator(...t){const i=Fo(t),r={title:"",shorttitle:"",overlay:!1,format:"inherit",precision:10,scale:"points",max_bars_back:0,timeframe:"",timeframe_gaps:!0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,max_polylines_count:50,dynamic_requests:!1,behind_chart:!0};return this.context.indicator={...r,...i},this.context.indicator}get bar_index(){return this.context.idx}na(t){return isNaN(d.from(t).get(0))}nz(t,i=0){const r=d.from(t).get(0),s=d.from(i).get(0);return isNaN(r)?s:r}fixnan(t){const i=d.from(t);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(t,i,r){}bool(t){const i=d.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "int" with argument "x"="${i}". An argument of "literal string" type was used but a "simple int" is expected.`);return Math.floor(i)}float(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "float" with argument "x"="${i}". An argument of "literal string" type was used but a "const float" is expected.`);return i}string(t){return d.from(t).get(0).toString()}}const $o=[["defval","title","tooltip","inline","group","display"],["defval","title","tooltip","group","confirm","display"],["defval","title","tooltip","inline","group","confirm","display"],["defval","title","options","tooltip","inline","group","confirm","display"],["defval","title","minval","maxval","step","tooltip","inline","group","confirm","display"]],Wo={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function re(e){return Gt(e,$o,Wo)}function qo(e){return(...t)=>re(t).defval}function Uo(e){return(...t)=>re(t).defval}function Ko(e){return(...t)=>re(t).defval}function zo(e){return(...t)=>re(t).defval}function Ho(e){return(...t)=>re(t).defval}function Go(e){return(...t)=>re(t).defval}function Yo(e){return(t,i=0)=>d.from(t).get(i)}function Qo(e){return(...t)=>re(t).defval}function Xo(e){return(...t)=>re(t).defval}function Zo(e){return(...t)=>re(t).defval}function Jo(e){return(...t)=>re(t).defval}function eh(e){return(...t)=>re(t).defval}function th(e){return(...t)=>re(t).defval}function ih(e){return(...t)=>re(t).defval}function rh(e){return(...t)=>re(t).defval}var sh=Object.defineProperty,nh=(e,t,i)=>t in e?sh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t,i)=>nh(e,typeof t!="symbol"?t+"":t,i);const ah={any:qo,bool:Uo,color:Ko,enum:zo,float:Ho,int:Go,param:Yo,price:Qo,session:Xo,source:Zo,string:Jo,symbol:eh,text_area:th,time:ih,timeframe:rh};class oh{constructor(t){this.context=t,Z(this,"any"),Z(this,"bool"),Z(this,"color"),Z(this,"enum"),Z(this,"float"),Z(this,"int"),Z(this,"param"),Z(this,"price"),Z(this,"session"),Z(this,"source"),Z(this,"string"),Z(this,"symbol"),Z(this,"text_area"),Z(this,"time"),Z(this,"timeframe"),Object.entries(ah).forEach(([i,r])=>{this[i]=r(t)})}}function hh(e){return t=>Math.abs(d.from(t).get(0))}function ch(e){return t=>Math.acos(d.from(t).get(0))}function uh(e){return t=>Math.asin(d.from(t).get(0))}function lh(e){return t=>Math.atan(d.from(t).get(0))}function ph(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function fh(e){return t=>Math.ceil(d.from(t).get(0))}function mh(e){return t=>Math.cos(d.from(t).get(0))}function dh(e){return()=>Math.E}function gh(e){return t=>Math.exp(d.from(t).get(0))}function xh(e){return t=>Math.floor(d.from(t).get(0))}function yh(e){return t=>Math.log(d.from(t).get(0))}function wh(e){return t=>Math.log(d.from(t).get(0))}function bh(e){return t=>Math.log10(d.from(t).get(0))}function vh(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.max(...i)}}function _h(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.min(...i)}}function Sh(e){return(t,i,r)=>typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Eh(e){return()=>1.618033988749895}function Nh(e){return()=>Math.PI}function Ch(e){return(t,i)=>Math.pow(d.from(t).get(0),d.from(i).get(0))}function kh(e){return()=>Math.random()}function Ih(e){return t=>Math.round(d.from(t).get(0))}function Ah(e){return t=>e.precision(Math.round(d.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Ph(e){return()=>.6180339887498948}function Th(e){return t=>Math.sign(d.from(t).get(0))}function Rh(e){return t=>Math.sin(d.from(t).get(0))}function Dh(e){return t=>Math.sqrt(d.from(t).get(0))}function Vh(e){return(t,i)=>{const r=d.from(i).get(0),s=d.from(t);let n=0;for(let a=0;a<r;a++){const o=s.get(a);n+=o}return n}}function Oh(e){return t=>Math.tan(d.from(t).get(0))}function Mh(e){return(t,i)=>{const r=d.from(t).get(0),s=d.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)&&isNaN(s)?!0:isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var Lh=Object.defineProperty,Bh=(e,t,i)=>t in e?Lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,M=(e,t,i)=>Bh(e,typeof t!="symbol"?t+"":t,i);const Fh={abs:hh,acos:ch,asin:uh,atan:lh,avg:ph,ceil:fh,cos:mh,e:dh,exp:gh,floor:xh,ln:yh,log:wh,log10:bh,max:vh,min:_h,param:Sh,phi:Eh,pi:Nh,pow:Ch,random:kh,round:Ih,round_to_mintick:Ah,rphi:Ph,sign:Th,sin:Rh,sqrt:Dh,sum:Vh,tan:Oh,__eq:Mh};class jh{constructor(t){this.context=t,M(this,"_cache",{}),M(this,"abs"),M(this,"acos"),M(this,"asin"),M(this,"atan"),M(this,"avg"),M(this,"ceil"),M(this,"cos"),M(this,"e"),M(this,"exp"),M(this,"floor"),M(this,"ln"),M(this,"log"),M(this,"log10"),M(this,"max"),M(this,"min"),M(this,"param"),M(this,"phi"),M(this,"pi"),M(this,"pow"),M(this,"random"),M(this,"round"),M(this,"round_to_mintick"),M(this,"rphi"),M(this,"sign"),M(this,"sin"),M(this,"sqrt"),M(this,"sum"),M(this,"tan"),M(this,"__eq"),Object.entries(Fh).forEach(([i,r])=>{this[i]=r(t)})}}function $h(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let s;if(t instanceof d)s=t.get(i||0);else if(Array.isArray(t)){const n=t.every(o=>o instanceof d),a=t.every(o=>!(o instanceof d)&&!Array.isArray(o));(n||a)&&t.length>=1?n?s=t.map(o=>o.get(0)):s=t:s=d.from(t).get(i||0)}else s=t;return e.params[r].length===0?e.params[r].push(s):e.params[r][e.params[r].length-1]=s,[s,r]}}const pt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function yi(e,t,i,r,s=!1){for(let n=0;n<i.length;n++)if(i[n]<=e&&t<=r[n])return s||t>=r[n]?n:n-1;return-1}function wi(e,t,i,r,s=!1,n,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const h=n&&t>n;if(a&&s)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}if(h&&s&&!a)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}return o}if(r[o]<e)break}return-1}function Wh(e){return async(t,i,r,s=!1,n=!1,a=!1,o=null,h=null)=>{const c=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(s)?s[0]:s,x=Array.isArray(n)?n[0]:n;if(e.isSecondaryContext)return f;const y=pt.indexOf(e.timeframe),w=pt.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const E=y>w,A=d.from(e.data.openTime).get(0),k=d.from(e.data.closeTime).get(0),T=`${c}_${l}_${g}`,C=`${T}_prevIdx`;if(e.cache[T]){const Ge=e.cache[T],st=E?wi(A,k,Ge.data.openTime.data,Ge.data.closeTime.data,x,e.eDate,p):yi(A,k,Ge.data.openTime.data,Ge.data.closeTime.data,x);if(st==-1)return NaN;const Be=Ge.params[g][st];if(!E&&p){const Yt=e.cache[C];return Yt!==void 0&&Yt===st?NaN:(e.cache[C]=st,Array.isArray(Be)?[Be]:Be)}return Array.isArray(Be)?[Be]:Be}const Q=1e3*60*60*24*30,G=e.sDate?e.sDate-Q:void 0,z=e.sDate&&e.eDate?void 0:e.limit||1e3,He=new xr(e.source,c,l,z,G,void 0);He.markAsSecondary();const Ce=await He.run(e.pineTSCode);e.cache[T]=Ce;const wt=E?wi(A,k,Ce.data.openTime.data,Ce.data.closeTime.data,x,e.eDate,p):yi(A,k,Ce.data.openTime.data,Ce.data.closeTime.data,x);if(wt==-1)return NaN;const bt=Ce.params[g][wt];return!E&&p?(e.cache[C]=wt,NaN):Array.isArray(bt)?[bt]:bt}}function qh(e){return async(t,i,r,s=!1,n=null,a=!1,o=0)=>{const h=t[0],c=i[0],l=r[0],f=r[1];Array.isArray(s)&&s[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=pt.indexOf(e.timeframe),x=pt.indexOf(c);if(p===-1||x===-1){if(g)return NaN;throw new Error("Invalid timeframe")}if(x>p){if(g)return NaN;throw new Error(`Timeframe ${c} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${h}_${c}_${f}_lower`;if(!e.cache[y]){const G=e.sDate?e.sDate-2592e6:void 0,z=e.sDate&&e.eDate?void 0:e.limit||1e3,He=new xr(e.source,h,c,z,G,e.eDate);He.markAsSecondary();const Ce=await He.run(e.pineTSCode);e.cache[y]=Ce}const w=e.cache[y],E=d.from(e.data.openTime).get(0),A=d.from(e.data.closeTime).get(0),k=w.data.openTime.data,T=w.data.closeTime.data,C=w.params[f];if(!C)return[];const Q=[];for(let G=0;G<k.length;G++){const z=k[G];if(!(T[G]<=E)){if(z>=A)break;z>=E&&z<A&&Q.push(C[G])}}return[Q]}}var Uh=Object.defineProperty,Kh=(e,t,i)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ot=(e,t,i)=>Kh(e,typeof t!="symbol"?t+"":t,i);const zh={param:$h,security:Wh,security_lower_tf:qh};class Hh{constructor(t){this.context=t,ot(this,"_cache",{}),ot(this,"param"),ot(this,"security"),ot(this,"security_lower_tf"),Object.entries(zh).forEach(([i,r])=>{this[i]=r(t)})}}function Gh(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(s)||isNaN(n)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const h=n-a;let c=0;return h!==0&&(c=(s-a-(n-s))/h*o),r.cumulativeSum+=c,e.precision(r.cumulativeSum)}}function Yh(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0);e.taState||(e.taState={});const c=n||`alma_${a}_${o}_${h}`;if(!e.taState[c]){const p=o*(a-1),x=a/h,y=[];let w=0;for(let E=0;E<a;E++){const A=Math.exp(-Math.pow(E-p,2)/(2*x*x));y.push(A),w+=A}for(let E=0;E<y.length;E++)y[E]/=w;e.taState[c]={window:[],weights:y}}const l=e.taState[c],f=d.from(t).get(0);if(l.window.unshift(f),l.window.length<a)return NaN;l.window.length>a&&l.window.pop();let g=0;for(let p=0;p<a;p++)g+=l.weights[p]*l.window[a-1-p];return e.precision(g)}}function Qh(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`atr_${r}`;e.taState[s]||(e.taState[s]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;let c;if(n.prevClose!==null){const f=a-o,g=Math.abs(a-n.prevClose),p=Math.abs(o-n.prevClose);c=Math.max(f,g,p)}else c=a-o;if(n.prevClose=h,n.initCount<r)return n.initSum+=c,n.initCount++,n.initCount===r?(n.prevAtr=n.initSum/r,e.precision(n.prevAtr)):NaN;const l=(n.prevAtr*(r-1)+c)/r;return n.prevAtr=l,e.precision(l)}}function Xh(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const s=e.taState[r];return d.from(t).get(0)?(s.lastTrueIndex=e.idx,0):s.lastTrueIndex===null?NaN:e.idx-s.lastTrueIndex}}function Zh(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bb_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=d.from(t).get(0);if(isNaN(c))return[[NaN,NaN,NaN]];if(h.window.unshift(c),h.sum+=c,h.window.length<n)return[[NaN,NaN,NaN]];if(h.window.length>n){const y=h.window.pop();h.sum-=y}const l=h.sum/n;let f=0;for(let y=0;y<n;y++)f+=Math.pow(h.window[y]-l,2);const g=Math.sqrt(f/n),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function Jh(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bbw_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=d.from(t).get(0);if(isNaN(c))return NaN;if(h.window.unshift(c),h.sum+=c,h.window.length<n)return NaN;if(h.window.length>n){const w=h.window.pop();h.sum-=w}const l=h.sum/n;let f=0;for(let w=0;w<n;w++){const E=h.window[w]-l;f+=E*E}const g=f/n,p=Math.sqrt(g),x=a*p;if(l===0)return e.precision(0);const y=2*x/l*100;return e.precision(y)}}function ec(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cci_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const g=a.window.pop();a.sum-=g}const h=a.sum/s;let c=0;for(let g=0;g<s;g++)c+=Math.abs(a.window[g]-h);const l=c/s;if(l===0)return 0;const f=(o-h)/(.015*l);return e.precision(f)}}function tc(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`change_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=o-a.window[s];return e.precision(h)}}function ic(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cmo_${s}`;e.taState[n]||(e.taState[n]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1);if(isNaN(o)||isNaN(h))return NaN;const c=o-h,l=c>=0?c:0,f=c>=0?0:-c;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<s)return NaN;if(a.gainsWindow.length>s){const x=a.gainsWindow.pop(),y=a.lossesWindow.pop();a.gainsSum-=x,a.lossesSum-=y}const g=a.gainsSum+a.lossesSum;if(g===0)return e.precision(0);const p=100*(a.gainsSum-a.lossesSum)/g;return e.precision(p)}}function rc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);let a=0,o=!1;for(let l=0;l<s;l++){const f=n.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let h=0;for(let l=0;l<s;l++){const f=n.get(l);h+=f*(l+1)}if(a===0)return NaN;const c=-h/a;return e.precision(c)}}function sc(e){return(t,i,r,s)=>{const n=d.from(r).get(0),a=d.from(t),o=d.from(i);if(e.idx<n-1)return NaN;let h=0,c=0,l=0,f=0,g=0,p=0;for(let A=0;A<n;A++){const k=a.get(A),T=o.get(A);isNaN(k)||isNaN(T)||(h+=k,c+=T,l+=k*T,f+=k*k,g+=T*T,p++)}if(p<2)return NaN;const x=p*l-h*c,y=p*f-h*h,w=p*g-c*c;if(y<=0||w<=0)return e.precision(0);const E=x/Math.sqrt(y*w);return e.precision(E)}}function nc(e){return(t,i,r)=>{const s=d.from(t),n=d.from(i),a=s.get(0),o=n.get(0),h=s.get(1),c=n.get(1);if(isNaN(a)||isNaN(o)||isNaN(h)||isNaN(c))return!1;const l=a>o&&h<=c,f=a<o&&h>=c;return l||f}}function ac(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o<h&&n>a}}function oc(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o>h&&n<a}}function hc(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const s=e.taState[r],n=d.from(t).get(0);return isNaN(n)||(s.cumulativeSum+=n),e.precision(s.cumulativeSum)}}function cc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`dev_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const f=a.window.pop();a.sum-=f}const h=a.sum/s;let c=0;for(let f=0;f<s;f++)c+=Math.abs(a.window[f]-h);const l=c/s;return e.precision(l)}}function uc(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${s}_${n}`;e.taState[a]||(e.taState[a]={prevHigh:NaN,prevLow:NaN,prevClose:NaN,trInitSum:0,plusInitSum:0,minusInitSum:0,initCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,dxInitSum:0,adxInitCount:0,prevADX:NaN});const o=e.taState[a],h=e.get(e.data.high,0),c=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(c)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=h,o.prevLow=c,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(h-c,Math.abs(h-o.prevClose),Math.abs(c-o.prevClose)),g=h-o.prevHigh,p=o.prevLow-c,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=h,o.prevLow=c,o.prevClose=l;let w,E,A;if(o.initCount++,o.initCount<=s)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===s&&(o.prevSmoothedTR=o.trInitSum/s,o.prevSmoothedPlus=o.plusInitSum/s,o.prevSmoothedMinus=o.minusInitSum/s);else{const z=1/s;o.prevSmoothedTR=z*f+(1-z)*o.prevSmoothedTR,o.prevSmoothedPlus=z*x+(1-z)*o.prevSmoothedPlus,o.prevSmoothedMinus=z*y+(1-z)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,E=o.prevSmoothedPlus,A=o.prevSmoothedMinus,o.initCount<s)return[[NaN,NaN,NaN]];const k=w===0?0:100*E/w,T=w===0?0:100*A/w,C=k+T,Q=C===0?0:100*Math.abs(k-T)/C;let G=NaN;if(o.adxInitCount++,o.adxInitCount<=n)o.dxInitSum+=Q,o.adxInitCount===n&&(o.prevADX=o.dxInitSum/n,G=o.prevADX);else{const z=1/n;o.prevADX=z*Q+(1-z)*o.prevADX,G=o.prevADX}return[[e.precision(k),e.precision(T),e.precision(G)]]}}function lc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`ema_${s}`;e.taState[n]||(e.taState[n]={prevEma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevEma=a.initSum/s,e.precision(a.prevEma)):NaN;const h=2/(s+1),c=o*h+a.prevEma*(1-h);return a.prevEma=c,e.precision(c)}}function pc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o>=h)return!1}return!0}}function fc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`highest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=Math.max(...a.window.filter(c=>!isNaN(c)));return e.precision(h)}}function mc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=-1/0,o=NaN;for(let h=0;h<s;h++){const c=n.get(h);isNaN(c)||(isNaN(o)||c>a)&&(a=c,o=-h)}return o}}function dc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=Math.floor(s/2),a=Math.floor(Math.sqrt(s)),o=e.ta.wma,h=o(t,n,r?`${r}_wma1`:void 0),c=o(t,s,r?`${r}_wma2`:void 0);if(isNaN(h)||isNaN(c))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${s}`;e.taState[l]||(e.taState[l]=[]);const f=2*h-c;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${s}`;e.taState[g]||(e.taState[g]={window:[]});const p=e.taState[g];if(p.window.unshift(f),p.window.length<a)return NaN;p.window.length>a&&p.window.pop();let x=0,y=0;for(let E=0;E<a;E++){const A=a-E;x+=p.window[E]*A,y+=A}const w=x/y;return e.precision(w)}}function gc(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),s=e.get(e.data.low,0),n=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n))return NaN;const a=(r-s)*n;if(a===0)return e.precision(0);const o=(2*i-r-s)/a;return e.precision(o)}}function xc(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0));let c;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(h){const T=e.get(e.data.close,1);isNaN(T)?c=NaN:c=Math.max(l-f,Math.abs(l-T),Math.abs(f-T))}else c=l-f;const g=d.from(t).get(0);e.taState||(e.taState={});const p=n||`kc_${a}_${o}_${h}`;e.taState[p]||(e.taState[p]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const x=e.taState[p],y=(T,C,Q)=>{if(isNaN(C))return NaN;if(T.initCount<Q)return T.initSum+=C,T.initCount++,T.initCount===Q?(T.prevEma=T.initSum/Q,T.prevEma):NaN;const G=2/(Q+1);return T.prevEma=C*G+T.prevEma*(1-G),T.prevEma},w=y(x.basisState,g,a),E=y(x.rangeState,c,a);if(isNaN(w)||isNaN(E))return[[NaN,NaN,NaN]];const A=w+E*o,k=w-E*o;return[[e.precision(w),e.precision(A),e.precision(k)]]}}function yc(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0)),e.taState||(e.taState={});const c=n||`kcw_${a}_${o}_${h}`;e.taState[c]||(e.taState[c]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[c],f=(k,T,C)=>{if(isNaN(T))return NaN;if(k.initCount<C)return k.initSum+=T,k.initCount++,k.initCount===C?(k.prevEma=k.initSum/C,k.prevEma):NaN;const Q=2/(C+1);return k.prevEma=T*Q+k.prevEma*(1-Q),k.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(h){const k=e.get(e.data.close,1);isNaN(k)?g=NaN:g=Math.max(p-x,Math.abs(p-k),Math.abs(x-k))}else g=p-x;const y=d.from(t).get(0),w=f(l.basisState,y,a),E=f(l.rangeState,g,a);if(isNaN(w)||isNaN(E))return NaN;if(w===0)return e.precision(0);const A=2*E*o/w;return e.precision(A)}}function wc(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`linreg_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const h=e.taState[o],c=d.from(t).get(0);if(h.window.unshift(c),h.window.length<n)return NaN;h.window.length>n&&h.window.pop();let l=0,f=0,g=0,p=0;const x=n;for(let A=0;A<n;A++){const k=n-1-A,T=h.window[A];l+=k,f+=T,g+=k*T,p+=k*k}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,E=(f-w*l)/x+w*(n-1-a);return e.precision(E)}}function bc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`lowest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.filter(l=>!isNaN(l)&&l!==void 0),c=h.length>0?Math.min(...h):NaN;return e.precision(c)}}function vc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=1/0,o=NaN;for(let h=0;h<s;h++){const c=n.get(h);isNaN(c)||(isNaN(o)||c<a)&&(a=c,o=-h)}return o}}function _c(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0),c=n||`macd_${a}_${o}_${h}`,l=`${c}_fast`,f=`${c}_slow`,g=`${c}_signal`,p=e.ta.ema(t,a,l),x=e.ta.ema(t,o,f);let y=NaN;!isNaN(p)&&!isNaN(x)&&(y=p-x);let w=NaN;isNaN(y)||(w=e.ta.ema(y,h,g));let E=NaN;return!isNaN(y)&&!isNaN(w)&&(E=y-w),[[e.precision(y),e.precision(w),e.precision(E)]]}}function Sc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`median_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.slice().sort((f,g)=>f-g),c=Math.floor(s/2),l=s%2===0?(h[c-1]+h[c])/2:h[c];return e.precision(l)}}function Ec(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`mfi_${s}`;e.taState[n]||(e.taState[n]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1),c=e.get(e.data.volume,0);if(isNaN(o)||isNaN(c))return NaN;const l=isNaN(h)?NaN:o-h;let f=0,g=0;if(f=c*(l<=0?0:o),g=c*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<s)return NaN;if(a.upperWindow.length>s){const x=a.upperWindow.pop(),y=a.lowerWindow.pop();a.upperSum-=x,a.lowerSum-=y}if(a.lowerSum===0)return a.upperSum,e.precision(100);if(a.upperSum===0)return e.precision(0);const p=100-100/(1+a.upperSum/a.lowerSum);return e.precision(p)}}function Nc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;const a=new Map;for(let c=0;c<s;c++){const l=n.get(c);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,h=-1;for(const[c,l]of a.entries())l>h?(h=l,o=c):l===h&&c<o&&(o=c);return o}}function Cc(e){return(t,i,r)=>{const s=d.from(i).get(0);return e.ta.change(t,s)}}function kc(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,c=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||c===0)&&l<f){const g=(h-c)/c;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Ic(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={prevOBV:0});const i=e.taState[t],r=e.get(e.data.close,0),s=e.get(e.data.volume,0),n=e.get(e.data.close,1);if(isNaN(n))return i.prevOBV=0,e.precision(0);let a;return r>n?a=i.prevOBV+s:r<n?a=i.prevOBV-s:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function Ac(e){return(t,i,r)=>t instanceof d?i?new d(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Pc(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let x=0;x<n;x++){const y=o.get(x);if(isNaN(y))return NaN;h.push(y)}h.sort((x,y)=>x-y);let c=a/100*n-.5;c<0&&(c=0),c>n-1&&(c=n-1);const l=Math.floor(c),f=Math.ceil(c);if(l===f)return e.precision(h[l]);const g=c-l,p=h[l]+g*(h[f]-h[l]);return e.precision(p)}}function Tc(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let l=0;l<n;l++){const f=o.get(l);isNaN(f)||h.push(f)}if(h.length===0)return NaN;h.sort((l,f)=>l-f);let c=Math.ceil(a/100*h.length)-1;return c<0&&(c=0),c>=h.length&&(c=h.length-1),e.precision(h[c])}}function Rc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s)return NaN;const a=n.get(0);if(isNaN(a))return NaN;let o=0,h=0;for(let c=1;c<=s;c++){const l=n.get(c);isNaN(l)||(h++,l<=a&&o++)}return h===0?NaN:e.precision(o/h*100)}}function Dc(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]>=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]>=n){a=!1;break}}a&&(r[s]=n)}return r}function Vc(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Dc(o,n,a),c=e.idx;return e.precision(h[c])}}function Oc(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]<=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]<=n){a=!1;break}}a&&(r[s]=n)}return r}function Mc(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Oc(o,n,a),c=e.idx;return e.precision(h[c])}}function Lc(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,c=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||c===0)&&l>f){const g=(h-c)/c;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function Bc(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(s)&&!isNaN(n)&&!isNaN(a)&&n!==0){const o=(s-n)/n*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function Fc(e){return(t,i,r)=>{const s=e.pine.ta.highest(t,i,(r||"range")+"_h"),n=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(s)||isNaN(n)?NaN:e.precision(s-n)}}function jc(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o<=h)return!1}return!0}}function $c(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rma_${s}`;e.taState[n]||(e.taState[n]={prevRma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevRma=a.initSum/s,e.precision(a.prevRma)):NaN;const h=1/s,c=o*h+a.prevRma*(1-h);return a.prevRma=c,e.precision(c)}}function Wc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`roc_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=a.window[s],c=(o-h)/h*100;return e.precision(c)}}function qc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rsi_${s}`;e.taState[n]||(e.taState[n]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.prevValue!==null){const h=o-a.prevValue,c=h>0?h:0,l=h<0?-h:0;if(a.initGains.length<s){if(a.initGains.push(c),a.initLosses.push(l),a.initGains.length===s){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/s,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/s,a.prevValue=o;const g=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return e.precision(g)}return a.prevValue=o,NaN}a.avgGain=(a.avgGain*(s-1)+c)/s,a.avgLoss=(a.avgLoss*(s-1)+l)/s;const f=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return a.prevValue=o,e.precision(f)}return a.prevValue=o,NaN}}function Uc(e){return(t,i,r,s)=>{const n=d.from(t).get(0),a=d.from(i).get(0),o=d.from(r).get(0);e.taState||(e.taState={});const h=s||`sar_${n}_${a}_${o}`;e.taState[h]||(e.taState[h]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const c=e.taState[h],l=e.get(e.data.high,0),f=e.get(e.data.low,0),g=e.get(e.data.close,0),p=e.get(e.data.close,1),x=e.get(e.data.high,1),y=e.get(e.data.low,1),w=e.get(e.data.high,2),E=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let A=!1;return c.barIndex===1&&(g>p?(c.isBelow=!0,c.maxMin=l,c.result=y):(c.isBelow=!1,c.maxMin=f,c.result=x),A=!0,c.acceleration=n),c.barIndex>=1&&(c.result=c.result+c.acceleration*(c.maxMin-c.result),c.isBelow?c.result>f&&(A=!0,c.isBelow=!1,c.result=Math.max(l,c.maxMin),c.maxMin=f,c.acceleration=n):c.result<l&&(A=!0,c.isBelow=!0,c.result=Math.min(f,c.maxMin),c.maxMin=l,c.acceleration=n),A||(c.isBelow?l>c.maxMin&&(c.maxMin=l,c.acceleration=Math.min(c.acceleration+a,o)):f<c.maxMin&&(c.maxMin=f,c.acceleration=Math.min(c.acceleration+a,o))),c.isBelow?(c.result=Math.min(c.result,y),c.barIndex>1&&(c.result=Math.min(c.result,E))):(c.result=Math.max(c.result,x),c.barIndex>1&&(c.result=Math.max(c.result,w)))),c.barIndex++,c.barIndex<=1?NaN:e.precision(c.result)}}function Kc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`sma_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const c=a.window.pop();a.sum-=c}const h=a.sum/s;return e.precision(h)}}function zc(e){return(t,i,r=!0,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`stdev_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=d.from(t).get(0);if(c==null||isNaN(c))return NaN;if(h.window.unshift(c),h.sum+=c,h.window.length<n)return NaN;if(h.window.length>n){const x=h.window.pop();h.sum-=x}const l=h.sum/n;let f=0;for(let x=0;x<n;x++)f+=Math.pow(h.window[x]-l,2);const g=a?n:n-1,p=Math.sqrt(f/g);return e.precision(p)}}function Hc(e){return(t,i,r,s,n)=>{const a=d.from(s).get(0);e.taState||(e.taState={});const o=n||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const h=e.taState[o],c=d.from(t).get(0),l=d.from(i).get(0),f=d.from(r).get(0);if(isNaN(c)||isNaN(l)||isNaN(f))return NaN;if(h.highWindow.unshift(l),h.lowWindow.unshift(f),h.highWindow.length<a)return NaN;h.highWindow.length>a&&(h.highWindow.pop(),h.lowWindow.pop());let g=h.highWindow[0],p=h.lowWindow[0];for(let w=1;w<a;w++)h.highWindow[w]>g&&(g=h.highWindow[w]),h.lowWindow[w]<p&&(p=h.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(c-p)/x;return e.precision(y)}}function Gc(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${s}_${n}`;e.taState[a]||(e.taState[a]={trWindow:[],trSum:0,atrValue:NaN,atrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN});const o=e.taState[a],h=e.get(e.data.high,0),c=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(c)||isNaN(l))return[[NaN,NaN]];const f=(h+c)/2;let g;isNaN(o.prevClose)?g=h-c:g=Math.max(h-c,Math.abs(h-o.prevClose),Math.abs(c-o.prevClose)),o.atrCount++,o.atrCount<=n?(o.trWindow.push(g),o.trSum+=g,o.atrCount===n&&(o.atrValue=o.trSum/n)):o.atrValue=(o.atrValue*(n-1)+g)/n;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+s*p,w=f-s*p;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,A=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>E||x<E||(w=E),isNaN(o.prevUpperBand)||y<A||x>A||(y=A);let k,T;const C=o.prevSuperTrend;return o.atrCount===n?k=1:C===o.prevUpperBand?k=l>y?-1:1:k=l<w?1:-1,T=k===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=T,o.prevDirection=k,[[e.precision(T),k]]}}function Yc(e){return(t,i)=>{const r=[1,2,2,1],s=6;e.taState||(e.taState={});const n=i||"swma";e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<4)return NaN;a.window.length>4&&a.window.pop();let h=0;for(let c=0;c<4;c++)h+=r[c]*a.window[3-c];return h/=s,e.precision(h)}}function Qc(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=d.from(t).get(0));const s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(s-n):NaN;const o=Math.max(s-n,Math.abs(s-a),Math.abs(n-a));return e.precision(o)}}function Xc(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`tsi_${n}_${a}`;e.taState[o]||(e.taState[o]={prevSource:NaN,ema1_pc_multiplier:2/(a+1),ema1_pc_value:NaN,ema1_pc_count:0,ema1_pc_sum:0,ema2_pc_multiplier:2/(n+1),ema2_pc_value:NaN,ema2_pc_count:0,ema2_pc_sum:0,ema1_abs_multiplier:2/(a+1),ema1_abs_value:NaN,ema1_abs_count:0,ema1_abs_sum:0,ema2_abs_multiplier:2/(n+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const h=e.taState[o],c=d.from(t).get(0);if(isNaN(c))return NaN;const l=isNaN(h.prevSource)?NaN:c-h.prevSource;if(h.prevSource=c,isNaN(l))return NaN;const f=Math.abs(l);if(h.ema1_pc_count++,h.ema1_pc_count<=a?(h.ema1_pc_sum+=l,h.ema1_pc_count===a&&(h.ema1_pc_value=h.ema1_pc_sum/a)):h.ema1_pc_value=l*h.ema1_pc_multiplier+h.ema1_pc_value*(1-h.ema1_pc_multiplier),h.ema1_abs_count++,h.ema1_abs_count<=a?(h.ema1_abs_sum+=f,h.ema1_abs_count===a&&(h.ema1_abs_value=h.ema1_abs_sum/a)):h.ema1_abs_value=f*h.ema1_abs_multiplier+h.ema1_abs_value*(1-h.ema1_abs_multiplier),isNaN(h.ema1_pc_value)||isNaN(h.ema1_abs_value))return NaN;if(h.ema2_pc_count++,h.ema2_pc_count<=n?(h.ema2_pc_sum+=h.ema1_pc_value,h.ema2_pc_count===n&&(h.ema2_pc_value=h.ema2_pc_sum/n)):h.ema2_pc_value=h.ema1_pc_value*h.ema2_pc_multiplier+h.ema2_pc_value*(1-h.ema2_pc_multiplier),h.ema2_abs_count++,h.ema2_abs_count<=n?(h.ema2_abs_sum+=h.ema1_abs_value,h.ema2_abs_count===n&&(h.ema2_abs_value=h.ema2_abs_sum/n)):h.ema2_abs_value=h.ema1_abs_value*h.ema2_abs_multiplier+h.ema2_abs_value*(1-h.ema2_abs_multiplier),isNaN(h.ema2_pc_value)||isNaN(h.ema2_abs_value))return NaN;if(h.ema2_abs_value===0)return e.precision(0);const g=h.ema2_pc_value/h.ema2_abs_value;return e.precision(g)}}function Zc(e){return(t,i,r,s)=>{e.taState||(e.taState={});const n=s||"valuewhen";e.taState[n]||(e.taState[n]={values:[]});const a=e.taState[n],o=d.from(t).get(0),h=d.from(i).get(0),c=d.from(r).get(0);if(o&&a.values.push(h),isNaN(c)||c<0)return NaN;const l=a.values.length-1-c;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function Jc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`variance_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,c=0;for(let g=0;g<s;g++)h+=a.window[g],c+=a.window[g]*a.window[g];const l=h/s,f=c/s-l*l;return e.precision(f)}}function eu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={cumulativePV:0,cumulativeVolume:0,lastSessionDate:null});const s=e.taState[r],n=d.from(t).get(0),a=d.from(e.data.volume).get(0),o=d.from(e.data.openTime).get(0),h=new Date(o).toISOString().slice(0,10);if(s.lastSessionDate!==h&&(s.cumulativePV=0,s.cumulativeVolume=0,s.lastSessionDate=h),s.cumulativePV+=n*a,s.cumulativeVolume+=a,s.cumulativeVolume===0)return NaN;const c=s.cumulativePV/s.cumulativeVolume;return e.precision(c)}}function tu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`vwma_${s}`;e.taState[n]||(e.taState[n]={window:[],volumeWindow:[]});const a=e.taState[n],o=d.from(t).get(0),h=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(h),a.window.length<s)return NaN;a.window.length>s&&(a.window.pop(),a.volumeWindow.pop());let c=0,l=0;for(let g=0;g<s;g++)c+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=c/l;return e.precision(f)}}function iu(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(s)||isNaN(n)||isNaN(a))return e.precision(r.cumulativeSum);let h=0;if(!isNaN(o)){const c=Math.max(n,o),l=Math.min(a,o),f=s-o;f>0?h=s-l:f<0&&(h=s-c)}return r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function ru(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`wma_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,c=0;for(let f=0;f<s;f++){const g=s-f;h+=a.window[f]*g,c+=g}const l=h/c;return e.precision(l)}}function su(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`wpr_${r}`;e.taState[s]||(e.taState[s]={highWindow:[],lowWindow:[]});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;if(n.highWindow.unshift(a),n.lowWindow.unshift(o),n.highWindow.length<r)return NaN;n.highWindow.length>r&&(n.highWindow.pop(),n.lowWindow.pop());let c=n.highWindow[0],l=n.lowWindow[0];for(let p=1;p<r;p++)n.highWindow[p]>c&&(c=n.highWindow[p]),n.lowWindow[p]<l&&(l=n.lowWindow[p]);const f=c-l;if(f===0)return e.precision(0);const g=(c-h)/f*-100;return e.precision(g)}}function nu(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n)||isNaN(a))return NaN;const o=s-n;if(o===0)return e.precision(0);const h=(i-r)/o*a;return e.precision(h)}}var au=Object.defineProperty,ou=(e,t,i)=>t in e?au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,_=(e,t,i)=>ou(e,typeof t!="symbol"?t+"":t,i);const hu={accdist:Gh,alma:Yh,atr:Qh,barssince:Xh,bb:Zh,bbw:Jh,cci:ec,change:tc,cmo:ic,cog:rc,correlation:sc,cross:nc,crossover:ac,crossunder:oc,cum:hc,dev:cc,dmi:uc,ema:lc,falling:pc,highest:fc,highestbars:mc,hma:dc,iii:gc,kc:xc,kcw:yc,linreg:wc,lowest:bc,lowestbars:vc,macd:_c,median:Sc,mfi:Ec,mode:Nc,mom:Cc,nvi:kc,obv:Ic,param:Ac,percentile_linear_interpolation:Pc,percentile_nearest_rank:Tc,percentrank:Rc,pivothigh:Vc,pivotlow:Mc,pvi:Lc,pvt:Bc,range:Fc,rising:jc,rma:$c,roc:Wc,rsi:qc,sar:Uc,sma:Kc,stdev:zc,stoch:Hc,supertrend:Gc,swma:Yc,tr:Qc,tsi:Xc,valuewhen:Zc,variance:Jc,vwap:eu,vwma:tu,wad:iu,wma:ru,wpr:su,wvad:nu};class cu{constructor(t){this.context=t,_(this,"accdist"),_(this,"alma"),_(this,"atr"),_(this,"barssince"),_(this,"bb"),_(this,"bbw"),_(this,"cci"),_(this,"change"),_(this,"cmo"),_(this,"cog"),_(this,"correlation"),_(this,"cross"),_(this,"crossover"),_(this,"crossunder"),_(this,"cum"),_(this,"dev"),_(this,"dmi"),_(this,"ema"),_(this,"falling"),_(this,"highest"),_(this,"highestbars"),_(this,"hma"),_(this,"iii"),_(this,"kc"),_(this,"kcw"),_(this,"linreg"),_(this,"lowest"),_(this,"lowestbars"),_(this,"macd"),_(this,"median"),_(this,"mfi"),_(this,"mode"),_(this,"mom"),_(this,"nvi"),_(this,"obv"),_(this,"param"),_(this,"percentile_linear_interpolation"),_(this,"percentile_nearest_rank"),_(this,"percentrank"),_(this,"pivothigh"),_(this,"pivotlow"),_(this,"pvi"),_(this,"pvt"),_(this,"range"),_(this,"rising"),_(this,"rma"),_(this,"roc"),_(this,"rsi"),_(this,"sar"),_(this,"sma"),_(this,"stdev"),_(this,"stoch"),_(this,"supertrend"),_(this,"swma"),_(this,"tr"),_(this,"tsi"),_(this,"valuewhen"),_(this,"variance"),_(this,"vwap"),_(this,"vwma"),_(this,"wad"),_(this,"wma"),_(this,"wpr"),_(this,"wvad"),Object.entries(hu).forEach(([i,r])=>{this[i]=r(t)})}}class uu{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}param(t,i=0,r){return d.from(t).get(i)}warning(t,...i){console.warn(this.logFormat(t,...i))}error(t,...i){console.error(this.logFormat(t,...i))}info(t,...i){console.log(this.logFormat(t,...i))}}class lu{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,s=0){const n=String(t),a=String(i),o=String(r),h=Math.floor(Number(s))||0;if(a==="")return n;let c=0,l=0;for(;;){const f=n.indexOf(a,c);if(f===-1)return n;if(l===h)return n.substring(0,f)+o+n.substring(f+a.length);l++,c=f+a.length}}contains(t,i){return String(t).includes(i)}endswith(t,i){return String(t).endsWith(i)}startswith(t,i){return String(t).startsWith(i)}pos(t,i){const r=String(t).indexOf(i);return r===-1?NaN:r}length(t){return String(t).length}match(t,i){return String(t).match(new RegExp(i))}split(t,i){return[String(t).split(i)]}substring(t,i,r){return String(t).substring(i,r)}format(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}}class pu{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<60*60*24?Math.ceil(t/60):t<=60*60*24*7*52?t%(60*60*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(60*60*24))+"D":"12M"}in_seconds(t){const i=parseInt(t),r=t.slice(-1);return r==="S"?i:r==="D"?i*60*60*24:r==="W"?i*60*60*24*7:r==="M"?i*60*60*24*30:isNaN(i)?0:i*60}}const fu=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],mu={series:"series",title:"string",color:"string",linewidth:"number",style:"string",trackprice:"boolean",histbase:"number",offset:"number",join:"bool",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"};class du{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}plotchar(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const s=d.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:s,options:{...this.extractPlotOptions(r),style:"char"}})}plot(...t){const i=Gt(t,fu,mu),{series:r,title:s,...n}=i,a=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:a,title:s});const o=d.from(r).get(0);this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}}class gu{constructor(t){this.context=t}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(t,i=0,r){return d.from(t).get(i)}any(t,i,r,s,n,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:s,linewidth:n,editable:a,display:o})}}var xu=Object.defineProperty,yu=(e,t,i)=>t in e?xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>yu(e,typeof t!="symbol"?t+"":t,i);const gr=class Mt{constructor({marketData:t,source:i,tickerId:r,timeframe:s,limit:n,sDate:a,eDate:o,fullContext:h}){j(this,"data",{open:new d([]),high:new d([]),low:new d([]),close:new d([]),volume:new d([]),hl2:new d([]),hlc3:new d([]),ohlc4:new d([]),hlcc4:new d([])}),j(this,"indicator"),j(this,"cache",{}),j(this,"taState",{}),j(this,"isSecondaryContext",!1),j(this,"NA",NaN),j(this,"lang"),j(this,"pine"),j(this,"idx",0),j(this,"params",{}),j(this,"const",{}),j(this,"var",{}),j(this,"let",{}),j(this,"result"),j(this,"plots",{}),j(this,"marketData"),j(this,"source"),j(this,"tickerId"),j(this,"timeframe",""),j(this,"limit"),j(this,"sDate"),j(this,"eDate"),j(this,"fullContext"),j(this,"pineTSCode"),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=n,this.sDate=a,this.eDate=o,this.fullContext=h||this;const c=new jo(this),l={na:c.na.bind(c),color:c.color,nz:c.nz.bind(c),indicator:c.indicator.bind(c),fixnan:c.fixnan.bind(c),alertcondition:c.alertcondition.bind(c),bool:c.bool.bind(c)},f=this;this.pine={input:new oh(this),ta:new cu(this),math:new jh(this),request:new Hh(this),array:new la(this),map:new Ca(this),matrix:new Ao(this),syminfo:null,timeframe:new pu(this),barstate:new Do(this),get bar_index(){return f.idx},get last_bar_index(){return f.data.close.length-1},get last_bar_time(){return f.data.openTime.get(f.data.openTime.length-1)},get timenow(){return new Date().getTime()},log:new uu(this),str:new lu(this),...l,...Gn};const g=new du(this),p=new gu(this);this.bindContextObject(g,["plot","plotchar"]),this.bindContextObject(p,["any","style_dashed","style_solid","style_dotted","param"],"hline")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const n of i)typeof t[n]=="function"?s[n]=t[n].bind(t):s[n]=t[n]}init(t,i,r=0){let s;return i instanceof d?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,t?t instanceof d?(t.data[t.data.length-1]=s,t):Array.isArray(t)?(t[t.length-1]=s,new d(t)):new d([s]):new d([s])}initVar(t,i){if(t)return t;let r;return i instanceof d?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new d([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new d(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new d(this.params[r],0)))}get(t,i){if(t instanceof d)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof d){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}get math(){return this._showDeprecationWarning("const math = context.math","const { math, ta, input } = context.pine"),this.pine.math}get ta(){return this._showDeprecationWarning("const ta = context.ta","const { ta, math, input } = context.pine"),this.pine.ta}get input(){return this._showDeprecationWarning("const input = context.input","const { input, math, ta } = context.pine"),this.pine.input}get request(){return this._showDeprecationWarning("const request = context.request","const { request, math, ta } = context.pine"),this.pine.request}get array(){return this._showDeprecationWarning("const array = context.array","const { array, math, ta } = context.pine"),this.pine.array}get core(){return this._showDeprecationWarning("context.core.*","context.pine (e.g., const { na, plotchar, color, plot, nz } = context.pine)"),{na:this.pine.na,plotchar:this.pine.plotchar,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;Mt._deprecationWarningsShown.has(r)||(Mt._deprecationWarningsShown.add(r),typeof window<"u"?console.warn("%c[WARNING]%c %s syntax is deprecated. Use %s instead. This will be removed in a future version.","color: #FFA500; font-weight: bold;","color: #FFA500;",t,i):console.warn(`\x1B[33m[WARNING] ${t} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};j(gr,"_deprecationWarningsShown",new Set);let bi=gr;var wu=Object.defineProperty,bu=(e,t,i)=>t in e?wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,K=(e,t,i)=>bu(e,typeof t!="symbol"?t+"":t,i);class xr{constructor(t,i,r,s,n,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=n,this.eDate=a,K(this,"data",[]),K(this,"open",[]),K(this,"high",[]),K(this,"low",[]),K(this,"close",[]),K(this,"volume",[]),K(this,"hl2",[]),K(this,"hlc3",[]),K(this,"ohlc4",[]),K(this,"hlcc4",[]),K(this,"openTime",[]),K(this,"closeTime",[]),K(this,"_readyPromise",null),K(this,"_ready",!1),K(this,"_debugSettings",{ln:!1,debug:!1}),K(this,"_transpiledCode",null),K(this,"_isSecondaryContext",!1),K(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,s,n,a).then(h=>{const c=h;this.data=c;const l=c.map(C=>C.open),f=c.map(C=>C.close),g=c.map(C=>C.high),p=c.map(C=>C.low),x=c.map(C=>C.volume),y=c.map(C=>(C.high+C.low+C.close)/3),w=c.map(C=>(C.high+C.low)/2),E=c.map(C=>(C.high+C.low+C.open+C.close)/4),A=c.map(C=>(C.high+C.low+C.close+C.close)/4),k=c.map(C=>C.openTime),T=c.map(C=>C.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=E,this.hlcc4=A,this.openTime=k,this.closeTime=T,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(C=>{this._syminfo=C,this._ready=!0,o(!0)}).catch(C=>{console.warn("Failed to get symbol info, using default values:",C),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,s,n,a){return Array.isArray(t)?t:t.getMarketData(i,r,s,n,a)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){if(r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,s)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,s=!1){await this.ready(),i||(i=this.data.length);const n=this._initializeContext(t,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let a=this.data.length-i;for(;;){const o=this.data.length-a;if(o>0){const l=Math.min(o,r),f=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(n,f);continue}if(!s||Array.isArray(this.source))break;const{newCandles:h,updatedLastCandle:c}=await this._updateMarketData();if(h===0&&!c){yield null;continue}this._removeLastResult(n),a=this.data.length-(h+1),n.pine.barstate.setLive()}}_getResultLength(t){if(Array.isArray(t))return t.length;if(typeof t=="object"&&t!==null){const i=Object.keys(t);if(i.length>0&&Array.isArray(t[i[0]]))return t[i[0]].length}return 0}_createPageContext(t,i){const r=new bi({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t});if(r.pineTSCode=t.pineTSCode,r.idx=t.idx,Array.isArray(t.result))r.result=t.result.slice(i);else if(typeof t.result=="object"&&t.result!==null){r.result={};for(let s in t.result)Array.isArray(t.result[s])?r.result[s]=t.result[s].slice(i):r.result[s]=t.result[s]}else r.result=t.result;return r.plots={...t.plots},r}async _updateMarketData(t){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const n=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,t);if(!n||n.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let h=0;h<n.length;h++){const c=n[h];c.openTime===s?(this._replaceCandle(r,c),a=!0):c.openTime>s&&(this._appendCandle(c),o++)}return{newCandles:o,updatedLastCandle:a}}catch(n){return console.error("Error updating market data:",n),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(t,i){this.data[t]=i,this.open[t]=i.open,this.close[t]=i.close,this.high[t]=i.high,this.low[t]=i.low,this.volume[t]=i.volume,this.hl2[t]=(i.high+i.low)/2,this.hlc3[t]=(i.high+i.low+i.close)/3,this.ohlc4[t]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[t]=(i.high+i.low+i.close+i.close)/4,this.openTime[t]=i.openTime,this.closeTime[t]=i.closeTime}_appendCandle(t){this.data.push(t),this.open.push(t.open),this.close.push(t.close),this.high.push(t.high),this.low.push(t.low),this.volume.push(t.volume),this.hl2.push((t.high+t.low)/2),this.hlc3.push((t.high+t.low+t.close)/3),this.ohlc4.push((t.high+t.low+t.open+t.close)/4),this.hlcc4.push((t.high+t.low+t.close+t.close)/4),this.openTime.push(t.openTime),this.closeTime.push(t.closeTime)}_removeLastResult(t){if(Array.isArray(t.result))t.result.pop();else if(typeof t.result=="object"&&t.result!==null)for(let i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.data.pop(),t.data.open.data.pop(),t.data.high.data.pop(),t.data.low.data.pop(),t.data.volume.data.pop(),t.data.hl2.data.pop(),t.data.hlc3.data.pop(),t.data.ohlc4.data.pop(),t.data.hlcc4.data.pop(),t.data.openTime.data.pop(),t.data.closeTime&&t.data.closeTime.data.pop()}_initializeContext(t,i=!1){const r=new bi({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return r.pine.syminfo=this._syminfo,r.pineTSCode=t,r.isSecondaryContext=i,r.data.close=new d([]),r.data.open=new d([]),r.data.high=new d([]),r.data.low=new d([]),r.data.volume=new d([]),r.data.hl2=new d([]),r.data.hlc3=new d([]),r.data.ohlc4=new d([]),r.data.hlcc4=new d([]),r.data.openTime=new d([]),r.data.closeTime=new d([]),r}_transpileCode(t){return un.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,s){const n=["const","var","let","params"];for(let a=r;a<s;a++){t.idx=a,t.data.close.data.push(this.close[a]),t.data.open.data.push(this.open[a]),t.data.high.data.push(this.high[a]),t.data.low.data.push(this.low[a]),t.data.volume.data.push(this.volume[a]),t.data.hl2.data.push(this.hl2[a]),t.data.hlc3.data.push(this.hlc3[a]),t.data.ohlc4.data.push(this.ohlc4[a]),t.data.hlcc4.data.push(this.hlcc4[a]),t.data.openTime.data.push(this.openTime[a]),t.data.closeTime.data.push(this.closeTime[a]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let h in o){t.result[h]===void 0&&(t.result[h]=[]);let c;o[h]instanceof d?c=o[h].get(0):Array.isArray(o[h])?c=o[h][o[h].length-1]:c=o[h],t.result[h].push(c)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let h of n)for(let c in t[h]){const l=t[h][c];if(l instanceof d){const f=l.get(0);l.data.push(f)}else if(Array.isArray(l)){const f=l[l.length-1];l.push(f)}}}}}var vu=Object.defineProperty,_u=(e,t,i)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ft=(e,t,i)=>_u(e,typeof t!="symbol"?t+"":t,i);const Ct="https://api.binance.com/api/v3",vi="https://api.binance.us/api/v3",kt={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",45:null,60:"1h",120:"2h",180:null,240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"};class Su{constructor(t=5*60*1e3){ft(this,"cache"),ft(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=t}generateKey(t){return Object.entries(t).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(t){const i=this.generateKey(t),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(t,i){const r=this.generateKey(t);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const t=Date.now();for(const[i,r]of this.cache.entries())t-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class Eu{constructor(){ft(this,"cacheManager"),ft(this,"activeApiUrl",null),this.cacheManager=new Su(5*60*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Ct}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Ct,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${vi}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=vi,this.activeApiUrl}catch{}return Ct}async getMarketDataInterval(t,i,r,s){try{const n=kt[i.toUpperCase()];if(!n)return console.error(`Unsupported timeframe: ${i}`),[];const a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let o=[],h=r;const c=s,l=a[n];if(!l)return console.error(`Duration not defined for interval: ${n}`),[];for(;h<c;){const f=Math.min(h+1e3*l,c),g=await this.getMarketData(t,i,1e3,h,f);if(g.length===0)break;o=o.concat(g),h=g[g.length-1].closeTime+1}return o}catch(n){return console.error("Error in getMarketDataInterval:",n),[]}}async getMarketData(t,i,r,s,n){try{const a=n!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:s,eDate:n};if(a){const g=this.cacheManager.get(o);if(g)return g}const h=kt[i.toUpperCase()];if(!h)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,n)&&s&&n){const g=await this.getMarketDataInterval(t,i,s,n),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let c=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${h}`;r&&(c+=`&limit=${Math.min(r,1e3)}`),s&&(c+=`&startTime=${s}`),n&&(c+=`&endTime=${n}`);const l=await fetch(c);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const f=(await l.json()).map(g=>({openTime:parseInt(g[0]),open:parseFloat(g[1]),high:parseFloat(g[2]),low:parseFloat(g[3]),close:parseFloat(g[4]),volume:parseFloat(g[5]),closeTime:parseInt(g[6]),quoteAssetVolume:parseFloat(g[7]),numberOfTrades:parseInt(g[8]),takerBuyBaseAssetVolume:parseFloat(g[9]),takerBuyQuoteAssetVolume:parseFloat(g[10]),ignore:g[11]}));return a&&this.cacheManager.set(o,f),f}catch(a){return console.error("Error in binance.klines:",a),[]}}shouldPaginate(t,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const n=kt[t.toUpperCase()],a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[n];if(a)return Math.ceil((s-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),s=t,n="";t.endsWith(".P")?(i="futures",s=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",n="Perpetual"):t.includes("_")&&(i="futures",s=t,r="https://dapi.binance.com/dapi/v1",n="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const h=(await o.json()).symbols;if(!h||h.length===0)return console.error(`Symbol ${t} not found`),null;const c=i==="futures"?h.find(k=>k.symbol===s):h[0];if(!c)return console.error(`Symbol ${s} not found in exchange info`),null;const l=c.filters?.find(k=>k.filterType==="PRICE_FILTER"),f=c.filters?.find(k=>k.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=c.baseAsset,w=c.quoteAsset,E=n?` ${n}`:"",A=`${y} / ${w}${E}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:A,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:c.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:c.deliveryDate||0,employees:0,industry:"",sector:"",shareholders:0,shares_outstanding_float:0,shares_outstanding_total:0,recommendations_buy:0,recommendations_buy_strong:0,recommendations_date:0,recommendations_hold:0,recommendations_sell:0,recommendations_sell_strong:0,recommendations_total:0,target_price_average:0,target_price_date:0,target_price_estimates:0,target_price_high:0,target_price_low:0,target_price_median:0}}catch(i){return console.error("Error in binance.exchangeInfo:",i),null}}}class Nu{async getMarketData(){return[]}}const Cu=typeof process<"u"&&process.versions&&process.versions.node;let mt=null;if(Cu)try{mt=new Nu}catch{mt=null}const ku={Binance:new Eu,...mt?{Mock:mt}:{}};export{bi as Context,xr as PineTS,ku as Provider};
113
+ `)}generateNestedIfAsExpression(t){if(t.type==="IfStatement"){if(this.write("("),this.generateExpression(t.test),this.write(" ? "),t.consequent.type==="BlockStatement"&&t.consequent.body.length>0){const i=t.consequent.body[t.consequent.body.length-1];i.type==="ExpressionStatement"?this.generateExpression(i.expression):i.type==="IfStatement"&&this.generateNestedIfAsExpression(i)}if(this.write(" : "),t.alternate)if(t.alternate.type==="IfStatement")this.generateNestedIfAsExpression(t.alternate);else if(t.alternate.type==="BlockStatement"&&t.alternate.body.length>0){const i=t.alternate.body[t.alternate.body.length-1];i.type==="ExpressionStatement"&&this.generateExpression(i.expression)}else this.write("false");else this.write("false");this.write(")")}}generateArrayExpression(t){this.write("[");for(let i=0;i<t.elements.length;i++)this.generateExpression(t.elements[i]),i<t.elements.length-1&&this.write(", ");this.write("]")}generateObjectExpression(t){this.write("{");for(let i=0;i<t.properties.length;i++){const r=t.properties[i];r.key.type==="Identifier"?this.write(r.key.name):this.generateExpression(r.key),this.write(": "),this.generateExpression(r.value),i<t.properties.length-1&&this.write(", ")}this.write("}")}generateSwitchExpression(t){this.write("(");for(let i=0;i<t.cases.length;i++){const r=t.cases[i];r.test?(this.generateExpression(t.discriminant),this.write(" == "),this.generateExpression(r.test),this.write(" ? "),this.generateExpression(r.consequent),this.write(" : ")):this.generateExpression(r.consequent)}t.cases.some(i=>!i.test)||this.write("undefined"),this.write(")")}generateSequenceExpression(t){this.write("(");for(let i=0;i<t.expressions.length;i++)this.generateExpression(t.expressions[i]),i<t.expressions.length-1&&this.write(", ");this.write(")")}needsParentheses(t){return!1}}function lr(e){const t=/^\s*\/\/\s*@version\s*=\s*(\d+)\s*$/im,i=e.match(t);return i&&i[1]?parseInt(i[1],10):null}function fn(e,t={}){const i=lr(e);if(i===null)return{success:!1,version:null,error:"Pine Script version not found. Please add //@version=X comment to your script."};if(i<5)return{success:!1,version:i,error:`Pine Script version ${i} is not supported. Only version 5 and above are supported.`};try{const r=new zs(e).tokenize(),s=new cn(r).parse(),n={...t,sourceCode:e},a=new pn(n).generate(s);return{success:!0,version:i,code:a,ast:s,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function mn(e){if(typeof e=="function")return e.toString();{const t=lr(e);if(t===null)return e;if(t>=5){const i=fn(e);if(i.success)return i.code;throw new Error(`Failed to transpile Pine Script version ${t}: ${i.error}`)}else throw new Error(`Unsupported Pine Script version ${t}. Only version 5 and above are supported.`)}}function dn(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=mn(e);r=Is(r);const s=i?r.split(`
114
+ `):[],n=sr(r,{ecmaVersion:"latest",sourceType:"module",locations:i});As(n),Ns(n),Es(n);const a=new ws;Ps(n,a);const o=Ds(n,a)||"";js(n,a,o,t,s),Fs(n);const h=fs||zt||void 0,c=Object.assign({},h,{LineComment(f,g){g.write("//"+f.value)}}),l=ar(n,{generator:c,comments:i});return new Function("",`var _r = ${l}
115
+ ; return _r;`)(this)}function gn(e){return t=>new F(t.array.map(i=>Math.abs(i)),t.type,e)}function xn(e){return t=>{let i=0,r=0;for(const s of t.array){const n=Number(s);isNaN(n)||(r++,i+=(n-i)/r)}return r===0?NaN:e.precision(i)}}function yn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length-1;for(;s<=n;){const a=Math.floor((s+n)/2),o=r[a];if(o===i)return a;o<i?s=a+1:n=a-1}return-1}}function wn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<i?s=a+1:n=a}return s<r.length&&r[s]===i?s:s-1}}function bn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<=i?s=a+1:n=a}return s>0&&r[s-1]===i?s-1:s}}function vn(e){return t=>{t.array.length=0}}function _n(e){return(t,i)=>(t.array.push(...i.array),t)}function Sn(e){return t=>new F([...t.array],t.type,e)}function En(e){return(t,i,r=!0)=>{const s=t.array,n=i.array;if(s.length!==n.length)return NaN;let a=0,o=0,h=0;const c=[];for(let x=0;x<s.length;x++){const y=Number(s[x]),w=Number(n[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,h++,c.push(x))}if(h===0)return NaN;const l=a/h,f=o/h;let g=0;for(const x of c){const y=Number(s[x]),w=Number(n[x]);g+=(y-l)*(w-f)}const p=r?h:h-1;return p<=0?NaN:e.precision(g/p)}}function Nn(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function Cn(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?W.int:W.float;if(e.every(t=>typeof t=="string"))return W.string;if(e.every(t=>typeof t=="boolean"))return W.bool;throw new Error("Cannot infer type from values")}function xe(e){if(typeof e=="number")return(e|0)===e?W.int:W.float;if(typeof e=="string")return W.string;if(typeof e=="boolean")return W.bool;throw new Error("Cannot infer type from value")}function st(e,t){switch(t){case W.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case W.float:return typeof e=="number"||isNaN(e);case W.string:return typeof e=="string";case W.bool:return typeof e=="boolean"}return!1}function kn(e){return(t,i,r=0,s)=>{const n=t.array.length,a=s!==void 0?Math.min(s,n):n;for(let o=r;o<a;o++){if(!st(i,t.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array[o]=e.precision(i)}}}function In(e){return t=>t.array.length>0?t.array[0]:e.NA}function An(e){return(t,i)=>t.array[i]}function Pn(e){return(t,i)=>t.array.includes(i)}function Tn(e){return(t,i)=>t.array.indexOf(i)}function Rn(e){return(t,i,r)=>{if(!st(r,t.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array.splice(i,0,r)}}function Dn(e){return(t,i=",")=>t.array.join(i)}function Vn(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function On(e){return(t,i)=>t.array.lastIndexOf(i)}function Mn(e){return(t,i=0)=>[...t.array].sort((r,s)=>s-r)[i]??e.NA}function Ln(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((s,n)=>typeof s=="number"&&typeof n=="number"?s-n:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Bn(e){return(t,i=0)=>[...t.array].sort((r,s)=>r-s)[i]??e.NA}function Fn(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const n of t.array){const a=(i.get(n)||0)+1;i.set(n,a),a>r&&(r=a)}const s=[];for(const[n,a]of i)a===r&&s.push(n);return s.sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:typeof n=="string"&&typeof a=="string"?n<a?-1:n>a?1:0:0),s[0]}}function jn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const h of r){const c=Number(h);if(isNaN(c)||c===null||c===void 0)return NaN;s.push(c)}s.sort((h,c)=>h-c),i<0&&(i=0),i>100&&(i=100);const n=i/100*s.length-.5;if(n<=0)return e.precision(s[0]);if(n>=s.length-1)return e.precision(s[s.length-1]);const a=Math.floor(n),o=n-a;return e.precision(s[a]*(1-o)+s[a+1]*o)}}function $n(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const o of r){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&s.push(h)}if(s.length===0)return NaN;s.sort((o,h)=>o-h),i<0&&(i=0),i>100&&(i=100);const n=r.length,a=Math.ceil(i/100*n);return a<=0?s[0]:a>s.length?NaN:s[a-1]}}function Wn(e){return(t,i)=>{if(t.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=t.array.length)return NaN;const s=Number(t.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let n=0;for(const o of t.array){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&h<s&&n++}const a=t.array.length-1;return a<=0?NaN:n/a*100}}function qn(e){return t=>t.array.pop()}function Un(e){return(t,i)=>{if(!st(i,t.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.push(e.precision(i))}}function Kn(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function zn(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function Hn(e){return t=>{t.array.reverse()}}function Gn(e){return(t,i,r)=>{if(!st(r,t.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array[i]=e.precision(r)}}function Yn(e){return t=>t.array.shift()}function Qn(e){return t=>t.array.length}function Xn(e){return(t,i,r)=>{const s=r!==void 0?r:void 0;return new F(t.array.slice(i,s),t.type,e)}}function Zn(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var We=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(We||{}),pr=(e=>(e.AED="AED",e.ARS="ARS",e.AUD="AUD",e.BDT="BDT",e.BHD="BHD",e.BRL="BRL",e.BTC="BTC",e.CAD="CAD",e.CHF="CHF",e.CLP="CLP",e.CNY="CNY",e.COP="COP",e.CZK="CZK",e.DKK="DKK",e.EGP="EGP",e.ETH="ETH",e.EUR="EUR",e.GBP="GBP",e.HKD="HKD",e.HUF="HUF",e.IDR="IDR",e.ILS="ILS",e.INR="INR",e.ISK="ISK",e.JPY="JPY",e.KES="KES",e.KRW="KRW",e.KWD="KWD",e.LKR="LKR",e.MAD="MAD",e.MXN="MXN",e.MYR="MYR",e.NGN="NGN",e.NOK="NOK",e.NONE="NONE",e.NZD="NZD",e.PEN="PEN",e.PHP="PHP",e.PKR="PKR",e.PLN="PLN",e.QAR="QAR",e.RON="RON",e.RSD="RSD",e.RUB="RUB",e.SAR="SAR",e.SEK="SEK",e.SGD="SGD",e.THB="THB",e.TND="TND",e.TRY="TRY",e.TWD="TWD",e.USD="USD",e.USDT="USDT",e.VES="VES",e.VND="VND",e.ZAR="ZAR",e))(pr||{}),fr=(e=>(e[e.sunday=1]="sunday",e[e.monday=2]="monday",e[e.tuesday=3]="tuesday",e[e.wednesday=4]="wednesday",e[e.thursday=5]="thursday",e[e.friday=6]="friday",e[e.saturday=7]="saturday",e))(fr||{}),mr=(e=>(e.all="all",e.data_window="data_window",e.none="none",e.pane="pane",e.price_scale="price_scale",e.status_line="status_line",e))(mr||{}),dr=(e=>(e.flag="flag",e.arrowdown="arrowdown",e.arrowup="arrowup",e.circle="circle",e.cross="cross",e.diamond="diamond",e.labeldown="labeldown",e.labelup="labelup",e.square="square",e.triangledown="triangledown",e.triangleup="triangleup",e.xcross="xcross",e))(dr||{}),gr=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))(gr||{}),xr=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(xr||{}),yr=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(yr||{}),wr=(e=>(e.linestyle_dashed="linestyle_dashed",e.linestyle_dotted="linestyle_dotted",e.linestyle_solid="linestyle_solid",e.style_area="style_area",e.style_areabr="style_areabr",e.style_circles="style_circles",e.style_columns="style_columns",e.style_cross="style_cross",e.style_histogram="style_histogram",e.style_line="style_line",e.style_linebr="style_linebr",e.style_stepline="style_stepline",e.style_stepline_diamond="style_stepline_diamond",e.style_steplinebr="style_steplinebr",e))(wr||{});const Jn={order:We,currency:pr,dayofweek:fr,display:mr,shape:dr,location:gr,size:xr,format:yr,plot:wr};function ea(e){return(t,i=We.ascending)=>{t.array.sort((r,s)=>{let n=isNaN(r)?1/0:r,a=isNaN(s)?1/0:s;return i===We.ascending?n-a:a-n})}}function ta(e){return(t,i=We.ascending)=>{const r=t.array.map((s,n)=>n);return r.sort((s,n)=>{const a=isNaN(t.array[s])?1/0:t.array[s],o=isNaN(t.array[n])?1/0:t.array[n];return i===We.ascending?a-o:o-a}),new F(r,W.int,e)}}function ia(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new F(t.array.map(()=>NaN),W.int,e):r===0?new F(t.array.map(()=>1),W.int,e):new F(t.array.map(s=>(s-i)/r),W.int,e)}}function ra(e){return(t,i=!0)=>{const r=t.array,s=r.length;if(s===0)return NaN;let n=0,a=0,o=0;for(let l=0;l<s;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(n+=f,a+=f*f,o++)}if(o===0)return NaN;const h=n/o;let c=a/o-h*h;return c<0?NaN:(!i&&o>1&&(c=c*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(c)))}}function sa(e){return t=>e.precision(t.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function na(e){return(t,i)=>{if(!st(i,t.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.unshift(e.precision(i))}}function aa(e){return(t,i=!0)=>{let r=0,s=0;for(const h of t.array){const c=Number(h);!isNaN(c)&&c!==null&&c!==void 0&&(r+=c,s++)}if(s===0)return NaN;const n=r/s;let a=0;for(const h of t.array){const c=Number(h);!isNaN(c)&&c!==null&&c!==void 0&&(a+=(c-n)*(c-n))}const o=i?s:s-1;return o<=0?NaN:e.precision(a/o)}}var oa=Object.defineProperty,ha=(e,t,i)=>t in e?oa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>ha(e,typeof t!="symbol"?t+"":t,i),W=(e=>(e.any="",e.box="box",e.bool="bool",e.color="color",e.float="float",e.int="int",e.label="label",e.line="line",e.linefill="linefill",e.string="string",e.table="table",e))(W||{});class F{constructor(t,i,r){this.array=t,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=gn(this.context),this._avg=xn(this.context),this._binary_search=yn(this.context),this._binary_search_leftmost=wn(this.context),this._binary_search_rightmost=bn(this.context),this._clear=vn(this.context),this._concat=_n(this.context),this._copy=Sn(this.context),this._covariance=En(this.context),this._every=Nn(this.context),this._fill=kn(this.context),this._first=In(this.context),this._get=An(this.context),this._includes=Pn(this.context),this._indexof=Tn(this.context),this._insert=Rn(this.context),this._join=Dn(this.context),this._last=Vn(this.context),this._lastindexof=On(this.context),this._max=Mn(this.context),this._median=Ln(this.context),this._min=Bn(this.context),this._mode=Fn(this.context),this._percentile_linear_interpolation=jn(this.context),this._percentile_nearest_rank=$n(this.context),this._percentrank=Wn(this.context),this._pop=qn(this.context),this._push=Un(this.context),this._range=Kn(this.context),this._remove=zn(this.context),this._reverse=Hn(this.context),this._set=Gn(this.context),this._shift=Yn(this.context),this._size=Qn(this.context),this._slice=Xn(this.context),this._some=Zn(this.context),this._sort=ea(this.context),this._sort_indices=ta(this.context),this._standardize=ia(this.context),this._stdev=ra(this.context),this._sum=sa(this.context),this._unshift=na(this.context),this._variance=aa(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}abs(...t){return this._abs(this,...t)}avg(...t){return this._avg(this,...t)}binary_search(...t){return this._binary_search(this,...t)}binary_search_leftmost(...t){return this._binary_search_leftmost(this,...t)}binary_search_rightmost(...t){return this._binary_search_rightmost(this,...t)}clear(...t){return this._clear(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}covariance(...t){return this._covariance(this,...t)}every(...t){return this._every(this,...t)}fill(...t){return this._fill(this,...t)}first(...t){return this._first(this,...t)}get(...t){return this._get(this,...t)}includes(...t){return this._includes(this,...t)}indexof(...t){return this._indexof(this,...t)}insert(...t){return this._insert(this,...t)}join(...t){return this._join(this,...t)}last(...t){return this._last(this,...t)}lastindexof(...t){return this._lastindexof(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}percentile_linear_interpolation(...t){return this._percentile_linear_interpolation(this,...t)}percentile_nearest_rank(...t){return this._percentile_nearest_rank(this,...t)}percentrank(...t){return this._percentrank(this,...t)}pop(...t){return this._pop(this,...t)}push(...t){return this._push(this,...t)}range(...t){return this._range(this,...t)}remove(...t){return this._remove(this,...t)}reverse(...t){return this._reverse(this,...t)}set(...t){return this._set(this,...t)}shift(...t){return this._shift(this,...t)}size(...t){return this._size(this,...t)}slice(...t){return this._slice(this,...t)}some(...t){return this._some(this,...t)}sort(...t){return this._sort(this,...t)}sort_indices(...t){return this._sort_indices(this,...t)}standardize(...t){return this._standardize(this,...t)}stdev(...t){return this._stdev(this,...t)}sum(...t){return this._sum(this,...t)}unshift(...t){return this._unshift(this,...t)}variance(...t){return this._variance(this,...t)}}function ca(e){return(...t)=>new F([...t],Cn(t),e)}function ua(e){return(t,i)=>new F(Array(t).fill(e.precision(i||0)),xe(i||0),e)}function la(e){return(t,i=!1)=>new F(Array(t).fill(i),W.bool,e)}function pa(e){return(t,i=NaN)=>new F(Array(t).fill(e.precision(i)),W.float,e)}function fa(e){return(t,i=0)=>new F(Array(t).fill(e.precision(i)),W.int,e)}function ma(e){return(t,i="")=>new F(Array(t).fill(i),W.string,e)}class m{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof m?t:Array.isArray(t)?new m(t):new m([t])}}function da(e){return(t,i=0)=>m.from(t).get(i)}class ga{constructor(t){this.context=t,this.abs=(i,...r)=>i.abs(...r),this.avg=(i,...r)=>i.avg(...r),this.binary_search=(i,...r)=>i.binary_search(...r),this.binary_search_leftmost=(i,...r)=>i.binary_search_leftmost(...r),this.binary_search_rightmost=(i,...r)=>i.binary_search_rightmost(...r),this.clear=(i,...r)=>i.clear(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.covariance=(i,...r)=>i.covariance(...r),this.every=(i,...r)=>i.every(...r),this.fill=(i,...r)=>i.fill(...r),this.first=(i,...r)=>i.first(...r),this.from=ca(t),this.get=(i,...r)=>i.get(...r),this.includes=(i,...r)=>i.includes(...r),this.indexof=(i,...r)=>i.indexof(...r),this.insert=(i,...r)=>i.insert(...r),this.join=(i,...r)=>i.join(...r),this.last=(i,...r)=>i.last(...r),this.lastindexof=(i,...r)=>i.lastindexof(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.new=ua(t),this.new_bool=la(t),this.new_float=pa(t),this.new_int=fa(t),this.new_string=ma(t),this.param=da(),this.percentile_linear_interpolation=(i,...r)=>i.percentile_linear_interpolation(...r),this.percentile_nearest_rank=(i,...r)=>i.percentile_nearest_rank(...r),this.percentrank=(i,...r)=>i.percentrank(...r),this.pop=(i,...r)=>i.pop(...r),this.push=(i,...r)=>i.push(...r),this.range=(i,...r)=>i.range(...r),this.remove=(i,...r)=>i.remove(...r),this.reverse=(i,...r)=>i.reverse(...r),this.set=(i,...r)=>i.set(...r),this.shift=(i,...r)=>i.shift(...r),this.size=(i,...r)=>i.size(...r),this.slice=(i,...r)=>i.slice(...r),this.some=(i,...r)=>i.some(...r),this.sort=(i,...r)=>i.sort(...r),this.sort_indices=(i,...r)=>i.sort_indices(...r),this.standardize=(i,...r)=>i.standardize(...r),this.stdev=(i,...r)=>i.stdev(...r),this.sum=(i,...r)=>i.sum(...r),this.unshift=(i,...r)=>i.unshift(...r),this.variance=(i,...r)=>i.variance(...r)}}function xa(e){return t=>{t.map.clear()}}function ya(e){return(t,i)=>t.map.has(i)}function wa(e){return t=>{const i=new br(e);return i.map=new Map(t.map),i}}function ba(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function va(e){return t=>{const i=Array.from(t.map.keys()),r=xe(i[0]);return new F(i,r,e)}}function _a(e){return(t,i,r)=>{const s=t.map.get(i);return t.map.set(i,r),s===void 0?NaN:s}}function Sa(e){return(t,i)=>{for(const[r,s]of i.map)t.map.set(r,s)}}function Ea(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function Na(e){return t=>t.map.size}function Ca(e){return t=>{const i=Array.from(t.map.values()),r=xe(i[0]);return new F(i,r,e)}}var ka=Object.defineProperty,Ia=(e,t,i)=>t in e?ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,me=(e,t,i)=>Ia(e,typeof t!="symbol"?t+"":t,i);class br{constructor(t){this.context=t,me(this,"map"),me(this,"_clear"),me(this,"_contains"),me(this,"_copy"),me(this,"_get"),me(this,"_keys"),me(this,"_put"),me(this,"_put_all"),me(this,"_remove"),me(this,"_size"),me(this,"_values"),this.map=new Map,this._clear=xa(this.context),this._contains=ya(this.context),this._copy=wa(this.context),this._get=ba(this.context),this._keys=va(this.context),this._put=_a(this.context),this._put_all=Sa(this.context),this._remove=Ea(this.context),this._size=Na(this.context),this._values=Ca(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...t){return this._clear(this,...t)}contains(...t){return this._contains(this,...t)}copy(...t){return this._copy(this,...t)}get(...t){return this._get(this,...t)}keys(...t){return this._keys(this,...t)}put(...t){return this._put(this,...t)}put_all(...t){return this._put_all(this,...t)}remove(...t){return this._remove(this,...t)}size(...t){return this._size(this,...t)}values(...t){return this._values(this,...t)}}function Aa(e){return()=>new br(e)}function Pa(e){return(t,i=0)=>m.from(t).get(i)}class Ta{constructor(t){this.context=t,this.clear=(i,...r)=>i.clear(...r),this.contains=(i,...r)=>i.contains(...r),this.copy=(i,...r)=>i.copy(...r),this.get=(i,...r)=>i.get(...r),this.keys=(i,...r)=>i.keys(...r),this.new=Aa(t),this.param=Pa(),this.put=(i,...r)=>i.put(...r),this.put_all=(i,...r)=>i.put_all(...r),this.remove=(i,...r)=>i.remove(...r),this.size=(i,...r)=>i.size(...r),this.values=(i,...r)=>i.values(...r)}}function Ra(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r&&(r instanceof F?n=r.array:Array.isArray(r)?n=r:n=[r]),s===0){for(let h=0;h<n.length;h++){let c=n[h];c instanceof m&&(c=c.get(0)),t.matrix.push([c])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let h=0;h<s;h++){let c=h<n.length?n[h]:NaN;c instanceof m&&(c=c.get(0)),t.matrix[h].splice(o,0,c)}}}function Da(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r)if(r instanceof F)n=r.array;else if(Array.isArray(r))n=r;else if(r instanceof m){const c=r.get(0);Array.isArray(c)?n=c:n=[c]}else n=[r];const a=s>0?t.matrix[0].length:n.length,o=i!==void 0?i:s,h=[];for(let c=0;c<a;c++)if(c<n.length){let l=n[c];l instanceof m&&(l=l.get(0)),h.push(l)}else h.push(NaN);t.matrix.splice(o,0,h)}}function Va(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;if(r===0)return NaN;let s=0,n=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(s+=h,n++)}return n===0?NaN:s/n}}function Oa(e){return(t,i)=>{const r=t.matrix.length,s=[];for(let a=0;a<r;a++)s.push(t.matrix[a][i]);const n=xe(s[0]);return new F(s,n,e)}}function Ma(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function La(e){return(t,i)=>{const r=t.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]]);return}const n=t.matrix[0].length,a=s>0?i.matrix[0].length:0;if(n!==a&&s>0){console.error(`matrix.concat: Column count mismatch ${n} vs ${a}`);return}for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]])}}function Ba(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,s=new L(i,r,NaN,e);return s.matrix=t.matrix.map(n=>[...n]),s}}function Fa(e){const t=e.length;if(t===0)return 0;if(t===1)return e[0][0];if(t===2)return e[0][0]*e[1][1]-e[0][1]*e[1][0];const i=e.map(s=>[...s]);let r=1;for(let s=0;s<t;s++){let n=s;for(;n<t&&i[n][s]===0;)n++;if(n===t)return 0;n!==s&&([i[s],i[n]]=[i[n],i[s]],r*=-1),r*=i[s][s];for(let a=s+1;a<t;a++){const o=i[a][s]/i[s][s];for(let h=s;h<t;h++)i[a][h]-=o*i[s][h]}}return r}function ja(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Fa(t.matrix)}}function $a(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new L(0,0,NaN,e);const s=t.matrix[0].length,n=new L(r,s,NaN,e);if(i instanceof L)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],c=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h-c}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]-a}return n}}function Wa(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],s=e[1][0],n=e[1][1],a=i+n,o=i*n-r*s,h=a*a-4*o;if(h<0)return[NaN,NaN];const c=(a+Math.sqrt(h))/2,l=(a-Math.sqrt(h))/2;return[c,l]}function qa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=xe(t.matrix[0][0]);return new F([],a,e)}const s=Wa(t.matrix),n=xe(s[0]);return new F(s,n,e)}}function Ua(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new L(0,0,NaN,e);const s=new L(i,r,0,e);for(let n=0;n<i;n++)s.matrix[n][n]=1;return s}}function Ka(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function za(e){return(t,i,r,s,n,a)=>{const o=t.matrix.length;if(o===0)return;const h=t.matrix[0].length,c=r!==void 0?r:0,l=s!==void 0?s:o,f=n!==void 0?n:0,g=a!==void 0?a:h;for(let p=c;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=h);x++)t.matrix[p][x]=i}}function Ha(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const s=t.matrix[i][r];return s===void 0?NaN:s}}function Ga(e){if(e.length!==2)return e.map(i=>i.map(()=>NaN));const t=e[0][0]*e[1][1]-e[0][1]*e[1][0];return t===0?[[NaN,NaN],[NaN,NaN]]:[[e[1][1]/t,-e[0][1]/t],[-e[1][0]/t,e[0][0]/t]]}function Ya(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new L(i,r,NaN,e);const s=Ga(t.matrix),n=new L(i,r,NaN,e);return n.matrix=s,n}}function Qa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s+n!==i-1&&t.matrix[s][n]!==0)return!1;return!0}}function Xa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[n][s]!==-t.matrix[s][n])return!1;return!0}}function Za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++){const a=t.matrix[s][n];if(a!==0&&a!==1)return!1}return!0}}function Ja(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s!==n&&t.matrix[s][n]!==0)return!1;return!0}}function eo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s===n){if(t.matrix[s][n]!==1)return!1}else if(t.matrix[s][n]!==0)return!1;return!0}}function to(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function io(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++){let n=0;for(let a=0;a<r;a++){const o=t.matrix[s][a];if(o<0)return!1;n+=o}if(Math.abs(n-1)>1e-10)return!1}return!0}}function ro(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<s;n++)if(t.matrix[s][n]!==t.matrix[n][s])return!1;return!0}}function so(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;let s=!0,n=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(s=!1),a<o&&t.matrix[a][o]!==0&&(n=!1);return s||n}}function no(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[s][n]!==0)return!1;return!0}}function ao(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0,n=i.matrix.length,a=n>0?i.matrix[0].length:0,o=r*n,h=s*a,c=new L(o,h,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){const g=t.matrix[l][f];for(let p=0;p<n;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];c.matrix[l*n+p][f*a+x]=g*y}}return c}}function oo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=-1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h>s&&(s=h),n=!0)}return n?s:NaN}}function ho(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||s.push(h)}if(s.length===0)return NaN;s.sort((a,o)=>a-o);const n=Math.floor(s.length/2);return s.length%2!==0?s[n]:(s[n-1]+s[n])/2}}function co(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h<s&&(s=h),n=!0)}return n?s:NaN}}function uo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=new Map;let n=0,a=NaN;for(let o=0;o<i;o++)for(let h=0;h<r;h++){const c=t.matrix[o][h];if(!isNaN(c)){const l=(s.get(c)||0)+1;s.set(c,l),l>n?(n=l,a=c):l===n&&c<a&&(a=c)}}return a}}function lo(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(i instanceof L){const n=i.matrix.length,a=n>0?i.matrix[0].length:0;if(s!==n)return new L(0,0,NaN,e);const o=new L(r,a,0,e);for(let h=0;h<r;h++)for(let c=0;c<a;c++){let l=0;for(let f=0;f<s;f++)l+=t.matrix[h][f]*i.matrix[f][c];o.matrix[h][c]=l}return o}else if(i instanceof F||Array.isArray(i.array||i)){const n=i.array||i;if(s!==n.length)return new L(0,0,NaN,e);const a=new L(r,1,0,e);for(let o=0;o<r;o++){let h=0;for(let c=0;c<s;c++)h+=t.matrix[o][c]*n[c];a.matrix[o][0]=h}return a}else{const n=i,a=new L(r,s,NaN,e);for(let o=0;o<r;o++)for(let h=0;h<s;h++)a.matrix[o][h]=t.matrix[o][h]*n;return a}}}function po(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new L(i,r,NaN,e):new L(r,i,NaN,e)}}function fo(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(r!==s)return new L(0,0,NaN,e);let n=new L(r,s,0,e);for(let h=0;h<r;h++)n.matrix[h][h]=1;let a=new L(r,s,NaN,e);for(let h=0;h<r;h++)a.matrix[h]=[...t.matrix[h]];let o=Math.floor(i);if(o<0)return new L(r,s,NaN,e);for(;o>0;){if(o%2===1){const c=new L(r,s,0,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){let g=0;for(let p=0;p<r;p++)g+=n.matrix[l][p]*a.matrix[p][f];c.matrix[l][f]=g}n=c}const h=new L(r,s,0,e);for(let c=0;c<r;c++)for(let l=0;l<s;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[c][g]*a.matrix[g][l];h.matrix[c][l]=f}a=h,o=Math.floor(o/2)}return n}}function mo(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=t.matrix.map(a=>[...a]);let n=0;for(let a=0;a<r&&n<i;a++){let o=n;for(;o<i&&Math.abs(s[o][a])<1e-10;)o++;if(o<i){[s[n],s[o]]=[s[o],s[n]];const h=s[n][a];for(let c=a;c<r;c++)s[n][c]/=h;for(let c=0;c<i;c++)if(c!==n){const l=s[c][a];for(let f=a;f<r;f++)s[c][f]-=l*s[n][f]}n++}}return n}}function go(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=xe(t.matrix[0][0]);return new F([],a,e)}const s=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);s.push(o[0])}const n=xe(s[0]);return new F(s,n,e)}}function xo(e){return(t,i)=>{const r=t.matrix.splice(i,1),s=xe(r[0][0]);return new F(r[0]||[],s,e)}}function yo(e){return(t,i,r)=>{const s=t.matrix.length,n=s>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<s;l++)for(let f=0;f<n;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const h=[];let c=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[c++]);h.push(f)}t.matrix=h}}function wo(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function bo(e){return(t,i)=>{if(!t.matrix[i]){const s=xe(t.matrix[0][0]);return new F([],s,e)}const r=xe(t.matrix[i][0]);return new F([...t.matrix[i]],r,e)}}function vo(e){return t=>t.matrix.length}function _o(e){return(t,i,r,s)=>{t.matrix[i]&&(t.matrix[i][r]=s)}}function So(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((s,n)=>{const a=s[i],o=n[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function Eo(e){return(t,i,r,s,n)=>{const a=r-i,o=n-s,h=new L(a,o,NaN,e);for(let c=0;c<a;c++){const l=i+c;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=s+f;if(g>=t.matrix[l].length)break;h.matrix[c][f]=t.matrix[l][g]}}return h}}function No(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new L(0,0,NaN,e);const s=t.matrix[0].length,n=new L(r,s,NaN,e);if(i instanceof L)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],c=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h+c}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]+a}return n}}function Co(e){return(t,i,r)=>{const s=t.matrix.length;for(let n=0;n<s;n++){const a=t.matrix[n][i];t.matrix[n][i]=t.matrix[n][r],t.matrix[n][r]=a}}}function ko(e){return(t,i,r)=>{const s=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=s}}function Io(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=Math.min(i,r);let n=0;for(let a=0;a<s;a++)n+=t.matrix[a][a];return n}}function Ao(e){return t=>{const i=t.matrix.length;if(i===0)return new L(0,0,NaN,e);const r=t.matrix[0].length,s=new L(r,i,NaN,e);for(let n=0;n<i;n++)for(let a=0;a<r;a++)s.matrix[a][n]=t.matrix[n][a];return s}}var Po=Object.defineProperty,To=(e,t,i)=>t in e?Po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,I=(e,t,i)=>To(e,typeof t!="symbol"?t+"":t,i);class L{constructor(t=0,i=0,r=NaN,s){if(this.context=s,I(this,"matrix"),I(this,"_add_col"),I(this,"_add_row"),I(this,"_avg"),I(this,"_col"),I(this,"_columns"),I(this,"_concat"),I(this,"_copy"),I(this,"_det"),I(this,"_diff"),I(this,"_eigenvalues"),I(this,"_eigenvectors"),I(this,"_elements_count"),I(this,"_fill"),I(this,"_get"),I(this,"_inv"),I(this,"_is_antidiagonal"),I(this,"_is_antisymmetric"),I(this,"_is_binary"),I(this,"_is_diagonal"),I(this,"_is_identity"),I(this,"_is_square"),I(this,"_is_stochastic"),I(this,"_is_symmetric"),I(this,"_is_triangular"),I(this,"_is_zero"),I(this,"_kron"),I(this,"_max"),I(this,"_median"),I(this,"_min"),I(this,"_mode"),I(this,"_mult"),I(this,"_pinv"),I(this,"_pow"),I(this,"_rank"),I(this,"_remove_col"),I(this,"_remove_row"),I(this,"_reshape"),I(this,"_reverse"),I(this,"_row"),I(this,"_rows"),I(this,"_set"),I(this,"_sort"),I(this,"_submatrix"),I(this,"_sum"),I(this,"_swap_columns"),I(this,"_swap_rows"),I(this,"_trace"),I(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let n=0;n<t;n++)this.matrix.push(Array(i).fill(r));this._add_col=Ra(this.context),this._add_row=Da(this.context),this._avg=Va(this.context),this._col=Oa(this.context),this._columns=Ma(this.context),this._concat=La(this.context),this._copy=Ba(this.context),this._det=ja(this.context),this._diff=$a(this.context),this._eigenvalues=qa(this.context),this._eigenvectors=Ua(this.context),this._elements_count=Ka(this.context),this._fill=za(this.context),this._get=Ha(this.context),this._inv=Ya(this.context),this._is_antidiagonal=Qa(this.context),this._is_antisymmetric=Xa(this.context),this._is_binary=Za(this.context),this._is_diagonal=Ja(this.context),this._is_identity=eo(this.context),this._is_square=to(this.context),this._is_stochastic=io(this.context),this._is_symmetric=ro(this.context),this._is_triangular=so(this.context),this._is_zero=no(this.context),this._kron=ao(this.context),this._max=oo(this.context),this._median=ho(this.context),this._min=co(this.context),this._mode=uo(this.context),this._mult=lo(this.context),this._pinv=po(this.context),this._pow=fo(this.context),this._rank=mo(this.context),this._remove_col=go(this.context),this._remove_row=xo(this.context),this._reshape=yo(this.context),this._reverse=wo(this.context),this._row=bo(this.context),this._rows=vo(this.context),this._set=_o(this.context),this._sort=So(this.context),this._submatrix=Eo(this.context),this._sum=No(this.context),this._swap_columns=Co(this.context),this._swap_rows=ko(this.context),this._trace=Io(this.context),this._transpose=Ao(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
116
+ `,t+="["+this.matrix[i].join(", ")+"]";return t}add_col(...t){return this._add_col(this,...t)}add_row(...t){return this._add_row(this,...t)}avg(...t){return this._avg(this,...t)}col(...t){return this._col(this,...t)}columns(...t){return this._columns(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}det(...t){return this._det(this,...t)}diff(...t){return this._diff(this,...t)}eigenvalues(...t){return this._eigenvalues(this,...t)}eigenvectors(...t){return this._eigenvectors(this,...t)}elements_count(...t){return this._elements_count(this,...t)}fill(...t){return this._fill(this,...t)}get(...t){return this._get(this,...t)}inv(...t){return this._inv(this,...t)}is_antidiagonal(...t){return this._is_antidiagonal(this,...t)}is_antisymmetric(...t){return this._is_antisymmetric(this,...t)}is_binary(...t){return this._is_binary(this,...t)}is_diagonal(...t){return this._is_diagonal(this,...t)}is_identity(...t){return this._is_identity(this,...t)}is_square(...t){return this._is_square(this,...t)}is_stochastic(...t){return this._is_stochastic(this,...t)}is_symmetric(...t){return this._is_symmetric(this,...t)}is_triangular(...t){return this._is_triangular(this,...t)}is_zero(...t){return this._is_zero(this,...t)}kron(...t){return this._kron(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}mult(...t){return this._mult(this,...t)}pinv(...t){return this._pinv(this,...t)}pow(...t){return this._pow(this,...t)}rank(...t){return this._rank(this,...t)}remove_col(...t){return this._remove_col(this,...t)}remove_row(...t){return this._remove_row(this,...t)}reshape(...t){return this._reshape(this,...t)}reverse(...t){return this._reverse(this,...t)}row(...t){return this._row(this,...t)}rows(...t){return this._rows(this,...t)}set(...t){return this._set(this,...t)}sort(...t){return this._sort(this,...t)}submatrix(...t){return this._submatrix(this,...t)}sum(...t){return this._sum(this,...t)}swap_columns(...t){return this._swap_columns(this,...t)}swap_rows(...t){return this._swap_rows(this,...t)}trace(...t){return this._trace(this,...t)}transpose(...t){return this._transpose(this,...t)}}function Ro(e){return(t,i,r)=>new L(t,i,r,e)}function Do(e){return(t,i=0)=>m.from(t).get(i)}class Vo{constructor(t){this.context=t,this.add_col=(i,...r)=>i.add_col(...r),this.add_row=(i,...r)=>i.add_row(...r),this.avg=(i,...r)=>i.avg(...r),this.col=(i,...r)=>i.col(...r),this.columns=(i,...r)=>i.columns(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.det=(i,...r)=>i.det(...r),this.diff=(i,...r)=>i.diff(...r),this.eigenvalues=(i,...r)=>i.eigenvalues(...r),this.eigenvectors=(i,...r)=>i.eigenvectors(...r),this.elements_count=(i,...r)=>i.elements_count(...r),this.fill=(i,...r)=>i.fill(...r),this.get=(i,...r)=>i.get(...r),this.inv=(i,...r)=>i.inv(...r),this.is_antidiagonal=(i,...r)=>i.is_antidiagonal(...r),this.is_antisymmetric=(i,...r)=>i.is_antisymmetric(...r),this.is_binary=(i,...r)=>i.is_binary(...r),this.is_diagonal=(i,...r)=>i.is_diagonal(...r),this.is_identity=(i,...r)=>i.is_identity(...r),this.is_square=(i,...r)=>i.is_square(...r),this.is_stochastic=(i,...r)=>i.is_stochastic(...r),this.is_symmetric=(i,...r)=>i.is_symmetric(...r),this.is_triangular=(i,...r)=>i.is_triangular(...r),this.is_zero=(i,...r)=>i.is_zero(...r),this.kron=(i,...r)=>i.kron(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.mult=(i,...r)=>i.mult(...r),this.new=Ro(t),this.param=Do(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var Oo=Object.defineProperty,Mo=(e,t,i)=>t in e?Oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Lo=(e,t,i)=>Mo(e,typeof t!="symbol"?t+"":t,i);class Bo{constructor(t){this.context=t,Lo(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.data.close.data.length-1}get isfirst(){return this.context.idx===0}get ishistory(){return this.context.idx<this.context.data.close.data.length-1}get isrealtime(){return this.context.idx===this.context.data.close.data.length-1}get isconfirmed(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}get islastconfirmedhistory(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}}const xi={series:e=>e instanceof m||typeof e=="number",string:e=>typeof e=="string",number:e=>typeof e=="number",boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e),object:e=>typeof e=="object",primitive:e=>typeof e===null||typeof e!="object"&&typeof e!="function",function:e=>typeof e=="function",undefined:e=>e===void 0,null:e=>e===null,NaN:e=>isNaN(e),remaining_options:e=>typeof e=="object"&&!(e instanceof m)};function Ze(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let s={};const n=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(xi.remaining_options(o)){s=o;break}const h=t.map((c,l)=>n[l]?c[a]:void 0);for(let c=0;c<h.length;c++){const l=h[c];if(l===void 0){n[c]=!1;continue}const f=xi[i[l]];typeof f=="function"&&f(o)?r[l]=o:n[c]=!1}}return{...s,...r}}var Fo=Object.defineProperty,jo=(e,t,i)=>t in e?Fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,$o=(e,t,i)=>jo(e,typeof t!="symbol"?t+"":t,i);const Wo=["title","shorttitle","overlay","format","precision","scale","max_bars_back","timeframe","timeframe_gaps","explicit_plot_zorder","max_lines_count","max_labels_count","max_boxes_count","calc_bars_count","max_polylines_count","dynamic_requests","behind_chart"],qo={title:"string",shorttitle:"string",overlay:"boolean",format:"string",precision:"number",scale:"string",max_bars_back:"number",timeframe:"string",timeframe_gaps:"boolean",explicit_plot_zorder:"boolean",max_lines_count:"number",max_labels_count:"number",max_boxes_count:"number",calc_bars_count:"number",max_polylines_count:"number",dynamic_requests:"boolean",behind_chart:"boolean"};function Uo(e){return Ze(e,Wo,qo)}class Ko{constructor(t){this.context=t,$o(this,"color",{param:(i,r=0)=>m.from(i).get(r),rgb:(i,r,s,n)=>n?`rgba(${i}, ${r}, ${s}, ${n})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(i&&i.startsWith("#")){const s=i.slice(1),n=parseInt(s.slice(0,2),16),a=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16);return r?`rgba(${n}, ${a}, ${o}, ${r})`:`rgb(${n}, ${a}, ${o})`}return r?`rgba(${i}, ${r})`:i},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue",yellow:"yellow",orange:"orange",purple:"purple",pink:"pink",brown:"brown",teal:"teal",cyan:"cyan",navy:"navy",indigo:"indigo",violet:"violet",magenta:"magenta",rose:"rose",gold:"gold",silver:"silver",bronze:"bronze"})}extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}indicator(...t){const i=Uo(t),r={title:"",shorttitle:"",overlay:!1,format:"inherit",precision:10,scale:"points",max_bars_back:0,timeframe:"",timeframe_gaps:!0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,max_polylines_count:50,dynamic_requests:!1,behind_chart:!0};return this.context.indicator={...r,...i},this.context.indicator}get bar_index(){return this.context.idx}na(t){return isNaN(m.from(t).get(0))}nz(t,i=0){const r=m.from(t).get(0),s=m.from(i).get(0);return isNaN(r)?s:r}fixnan(t){const i=m.from(t);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(t,i,r){}bool(t){const i=m.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=m.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "int" with argument "x"="${i}". An argument of "literal string" type was used but a "simple int" is expected.`);return Math.floor(i)}float(t){const i=m.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "float" with argument "x"="${i}". An argument of "literal string" type was used but a "const float" is expected.`);return i}string(t){return m.from(t).get(0).toString()}}const zo=[["defval","title","tooltip","inline","group","display"],["defval","title","tooltip","group","confirm","display"],["defval","title","tooltip","inline","group","confirm","display"],["defval","title","options","tooltip","inline","group","confirm","display"],["defval","title","minval","maxval","step","tooltip","inline","group","confirm","display"]],Ho={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function re(e){return Ze(e,zo,Ho)}function Go(e){return(...t)=>re(t).defval}function Yo(e){return(...t)=>re(t).defval}function Qo(e){return(...t)=>re(t).defval}function Xo(e){return(...t)=>re(t).defval}function Zo(e){return(...t)=>re(t).defval}function Jo(e){return(...t)=>re(t).defval}function eh(e){return(t,i=0)=>m.from(t).get(i)}function th(e){return(...t)=>re(t).defval}function ih(e){return(...t)=>re(t).defval}function rh(e){return(...t)=>re(t).defval}function sh(e){return(...t)=>re(t).defval}function nh(e){return(...t)=>re(t).defval}function ah(e){return(...t)=>re(t).defval}function oh(e){return(...t)=>re(t).defval}function hh(e){return(...t)=>re(t).defval}var ch=Object.defineProperty,uh=(e,t,i)=>t in e?ch(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t,i)=>uh(e,typeof t!="symbol"?t+"":t,i);const lh={any:Go,bool:Yo,color:Qo,enum:Xo,float:Zo,int:Jo,param:eh,price:th,session:ih,source:rh,string:sh,symbol:nh,text_area:ah,time:oh,timeframe:hh};class ph{constructor(t){this.context=t,Z(this,"any"),Z(this,"bool"),Z(this,"color"),Z(this,"enum"),Z(this,"float"),Z(this,"int"),Z(this,"param"),Z(this,"price"),Z(this,"session"),Z(this,"source"),Z(this,"string"),Z(this,"symbol"),Z(this,"text_area"),Z(this,"time"),Z(this,"timeframe"),Object.entries(lh).forEach(([i,r])=>{this[i]=r(t)})}}function fh(e){return t=>Math.abs(m.from(t).get(0))}function mh(e){return t=>Math.acos(m.from(t).get(0))}function dh(e){return t=>Math.asin(m.from(t).get(0))}function gh(e){return t=>Math.atan(m.from(t).get(0))}function xh(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function yh(e){return t=>Math.ceil(m.from(t).get(0))}function wh(e){return t=>Math.cos(m.from(t).get(0))}function bh(e){return()=>Math.E}function vh(e){return t=>Math.exp(m.from(t).get(0))}function _h(e){return t=>Math.floor(m.from(t).get(0))}function Sh(e){return t=>Math.log(m.from(t).get(0))}function Eh(e){return t=>Math.log(m.from(t).get(0))}function Nh(e){return t=>Math.log10(m.from(t).get(0))}function Ch(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.max(...i)}}function kh(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.min(...i)}}function Ih(e){return(t,i,r)=>typeof t=="string"?t:t instanceof m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Ah(e){return()=>1.618033988749895}function Ph(e){return()=>Math.PI}function Th(e){return(t,i)=>Math.pow(m.from(t).get(0),m.from(i).get(0))}function Rh(e){return()=>Math.random()}function Dh(e){return t=>Math.round(m.from(t).get(0))}function Vh(e){return t=>e.precision(Math.round(m.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Oh(e){return()=>.6180339887498948}function Mh(e){return t=>Math.sign(m.from(t).get(0))}function Lh(e){return t=>Math.sin(m.from(t).get(0))}function Bh(e){return t=>Math.sqrt(m.from(t).get(0))}function Fh(e){return(t,i)=>{const r=m.from(i).get(0),s=m.from(t);let n=0;for(let a=0;a<r;a++){const o=s.get(a);n+=o}return n}}function jh(e){return t=>Math.tan(m.from(t).get(0))}function $h(e){return(t,i)=>{const r=m.from(t).get(0),s=m.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)&&isNaN(s)?!0:isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var Wh=Object.defineProperty,qh=(e,t,i)=>t in e?Wh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,M=(e,t,i)=>qh(e,typeof t!="symbol"?t+"":t,i);const Uh={abs:fh,acos:mh,asin:dh,atan:gh,avg:xh,ceil:yh,cos:wh,e:bh,exp:vh,floor:_h,ln:Sh,log:Eh,log10:Nh,max:Ch,min:kh,param:Ih,phi:Ah,pi:Ph,pow:Th,random:Rh,round:Dh,round_to_mintick:Vh,rphi:Oh,sign:Mh,sin:Lh,sqrt:Bh,sum:Fh,tan:jh,__eq:$h};class Kh{constructor(t){this.context=t,M(this,"_cache",{}),M(this,"abs"),M(this,"acos"),M(this,"asin"),M(this,"atan"),M(this,"avg"),M(this,"ceil"),M(this,"cos"),M(this,"e"),M(this,"exp"),M(this,"floor"),M(this,"ln"),M(this,"log"),M(this,"log10"),M(this,"max"),M(this,"min"),M(this,"param"),M(this,"phi"),M(this,"pi"),M(this,"pow"),M(this,"random"),M(this,"round"),M(this,"round_to_mintick"),M(this,"rphi"),M(this,"sign"),M(this,"sin"),M(this,"sqrt"),M(this,"sum"),M(this,"tan"),M(this,"__eq"),Object.entries(Uh).forEach(([i,r])=>{this[i]=r(t)})}}function zh(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let s;if(t instanceof m)s=t.get(i||0);else if(Array.isArray(t)){const n=t.every(o=>o instanceof m),a=t.every(o=>!(o instanceof m)&&!Array.isArray(o));(n||a)&&t.length>=1?n?s=t.map(o=>o.get(0)):s=t:s=m.from(t).get(i||0)}else s=t;return e.params[r].length===0?e.params[r].push(s):e.params[r][e.params[r].length-1]=s,[s,r]}}const ft=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function yi(e,t,i,r,s=!1){for(let n=0;n<i.length;n++)if(i[n]<=e&&t<=r[n])return s||t>=r[n]?n:n-1;return-1}function wi(e,t,i,r,s=!1,n,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const h=n&&t>n;if(a&&s)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}if(h&&s&&!a)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}return o}if(r[o]<e)break}return-1}function Hh(e){return async(t,i,r,s=!1,n=!1,a=!1,o=null,h=null)=>{const c=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(s)?s[0]:s,x=Array.isArray(n)?n[0]:n;if(e.isSecondaryContext)return f;const y=ft.indexOf(e.timeframe),w=ft.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const E=y>w,A=m.from(e.data.openTime).get(0),k=m.from(e.data.closeTime).get(0),T=`${c}_${l}_${g}`,C=`${T}_prevIdx`;if(e.cache[T]){const Ge=e.cache[T],nt=E?wi(A,k,Ge.data.openTime.data,Ge.data.closeTime.data,x,e.eDate,p):yi(A,k,Ge.data.openTime.data,Ge.data.closeTime.data,x);if(nt==-1)return NaN;const Be=Ge.params[g][nt];if(!E&&p){const Yt=e.cache[C];return Yt!==void 0&&Yt===nt?NaN:(e.cache[C]=nt,Array.isArray(Be)?[Be]:Be)}return Array.isArray(Be)?[Be]:Be}const Q=1e3*60*60*24*30,G=e.sDate?e.sDate-Q:void 0,z=e.sDate&&e.eDate?void 0:e.limit||1e3,He=new _r(e.source,c,l,z,G,void 0);He.markAsSecondary();const Ce=await He.run(e.pineTSCode);e.cache[T]=Ce;const bt=E?wi(A,k,Ce.data.openTime.data,Ce.data.closeTime.data,x,e.eDate,p):yi(A,k,Ce.data.openTime.data,Ce.data.closeTime.data,x);if(bt==-1)return NaN;const vt=Ce.params[g][bt];return!E&&p?(e.cache[C]=bt,NaN):Array.isArray(vt)?[vt]:vt}}function Gh(e){return async(t,i,r,s=!1,n=null,a=!1,o=0)=>{const h=t[0],c=i[0],l=r[0],f=r[1];Array.isArray(s)&&s[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=ft.indexOf(e.timeframe),x=ft.indexOf(c);if(p===-1||x===-1){if(g)return NaN;throw new Error("Invalid timeframe")}if(x>p){if(g)return NaN;throw new Error(`Timeframe ${c} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${h}_${c}_${f}_lower`;if(!e.cache[y]){const G=e.sDate?e.sDate-2592e6:void 0,z=e.sDate&&e.eDate?void 0:e.limit||1e3,He=new _r(e.source,h,c,z,G,e.eDate);He.markAsSecondary();const Ce=await He.run(e.pineTSCode);e.cache[y]=Ce}const w=e.cache[y],E=m.from(e.data.openTime).get(0),A=m.from(e.data.closeTime).get(0),k=w.data.openTime.data,T=w.data.closeTime.data,C=w.params[f];if(!C)return[];const Q=[];for(let G=0;G<k.length;G++){const z=k[G];if(!(T[G]<=E)){if(z>=A)break;z>=E&&z<A&&Q.push(C[G])}}return[Q]}}var Yh=Object.defineProperty,Qh=(e,t,i)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ht=(e,t,i)=>Qh(e,typeof t!="symbol"?t+"":t,i);const Xh={param:zh,security:Hh,security_lower_tf:Gh};class Zh{constructor(t){this.context=t,ht(this,"_cache",{}),ht(this,"param"),ht(this,"security"),ht(this,"security_lower_tf"),Object.entries(Xh).forEach(([i,r])=>{this[i]=r(t)})}}function Jh(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(s)||isNaN(n)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const h=n-a;let c=0;return h!==0&&(c=(s-a-(n-s))/h*o),r.cumulativeSum+=c,e.precision(r.cumulativeSum)}}function ec(e){return(t,i,r,s,n)=>{const a=m.from(i).get(0),o=m.from(r).get(0),h=m.from(s).get(0);e.taState||(e.taState={});const c=n||`alma_${a}_${o}_${h}`;if(!e.taState[c]){const p=o*(a-1),x=a/h,y=[];let w=0;for(let E=0;E<a;E++){const A=Math.exp(-Math.pow(E-p,2)/(2*x*x));y.push(A),w+=A}for(let E=0;E<y.length;E++)y[E]/=w;e.taState[c]={window:[],weights:y}}const l=e.taState[c],f=m.from(t).get(0);if(l.window.unshift(f),l.window.length<a)return NaN;l.window.length>a&&l.window.pop();let g=0;for(let p=0;p<a;p++)g+=l.weights[p]*l.window[a-1-p];return e.precision(g)}}function tc(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const s=i||`atr_${r}`;e.taState[s]||(e.taState[s]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;let c;if(n.prevClose!==null){const f=a-o,g=Math.abs(a-n.prevClose),p=Math.abs(o-n.prevClose);c=Math.max(f,g,p)}else c=a-o;if(n.prevClose=h,n.initCount<r)return n.initSum+=c,n.initCount++,n.initCount===r?(n.prevAtr=n.initSum/r,e.precision(n.prevAtr)):NaN;const l=(n.prevAtr*(r-1)+c)/r;return n.prevAtr=l,e.precision(l)}}function ic(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const s=e.taState[r];return m.from(t).get(0)?(s.lastTrueIndex=e.idx,0):s.lastTrueIndex===null?NaN:e.idx-s.lastTrueIndex}}function rc(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=s||`bb_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return[[NaN,NaN,NaN]];if(h.window.unshift(c),h.sum+=c,h.window.length<n)return[[NaN,NaN,NaN]];if(h.window.length>n){const y=h.window.pop();h.sum-=y}const l=h.sum/n;let f=0;for(let y=0;y<n;y++)f+=Math.pow(h.window[y]-l,2);const g=Math.sqrt(f/n),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function sc(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=s||`bbw_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return NaN;if(h.window.unshift(c),h.sum+=c,h.window.length<n)return NaN;if(h.window.length>n){const w=h.window.pop();h.sum-=w}const l=h.sum/n;let f=0;for(let w=0;w<n;w++){const E=h.window[w]-l;f+=E*E}const g=f/n,p=Math.sqrt(g),x=a*p;if(l===0)return e.precision(0);const y=2*x/l*100;return e.precision(y)}}function nc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`cci_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=m.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const g=a.window.pop();a.sum-=g}const h=a.sum/s;let c=0;for(let g=0;g<s;g++)c+=Math.abs(a.window[g]-h);const l=c/s;if(l===0)return 0;const f=(o-h)/(.015*l);return e.precision(f)}}function ac(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`change_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=o-a.window[s];return e.precision(h)}}function oc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`cmo_${s}`;e.taState[n]||(e.taState[n]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[n],o=m.from(t).get(0),h=m.from(t).get(1);if(isNaN(o)||isNaN(h))return NaN;const c=o-h,l=c>=0?c:0,f=c>=0?0:-c;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<s)return NaN;if(a.gainsWindow.length>s){const x=a.gainsWindow.pop(),y=a.lossesWindow.pop();a.gainsSum-=x,a.lossesSum-=y}const g=a.gainsSum+a.lossesSum;if(g===0)return e.precision(0);const p=100*(a.gainsSum-a.lossesSum)/g;return e.precision(p)}}function hc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);let a=0,o=!1;for(let l=0;l<s;l++){const f=n.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let h=0;for(let l=0;l<s;l++){const f=n.get(l);h+=f*(l+1)}if(a===0)return NaN;const c=-h/a;return e.precision(c)}}function cc(e){return(t,i,r,s)=>{const n=m.from(r).get(0),a=m.from(t),o=m.from(i);if(e.idx<n-1)return NaN;let h=0,c=0,l=0,f=0,g=0,p=0;for(let A=0;A<n;A++){const k=a.get(A),T=o.get(A);isNaN(k)||isNaN(T)||(h+=k,c+=T,l+=k*T,f+=k*k,g+=T*T,p++)}if(p<2)return NaN;const x=p*l-h*c,y=p*f-h*h,w=p*g-c*c;if(y<=0||w<=0)return e.precision(0);const E=x/Math.sqrt(y*w);return e.precision(E)}}function uc(e){return(t,i,r)=>{const s=m.from(t),n=m.from(i),a=s.get(0),o=n.get(0),h=s.get(1),c=n.get(1);if(isNaN(a)||isNaN(o)||isNaN(h)||isNaN(c))return!1;const l=a>o&&h<=c,f=a<o&&h>=c;return l||f}}function lc(e){return(t,i)=>{const r=m.from(t),s=m.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o<h&&n>a}}function pc(e){return(t,i)=>{const r=m.from(t),s=m.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o>h&&n<a}}function fc(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const s=e.taState[r],n=m.from(t).get(0);return isNaN(n)||(s.cumulativeSum+=n),e.precision(s.cumulativeSum)}}function mc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`dev_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=m.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const f=a.window.pop();a.sum-=f}const h=a.sum/s;let c=0;for(let f=0;f<s;f++)c+=Math.abs(a.window[f]-h);const l=c/s;return e.precision(l)}}function dc(e){return(t,i,r)=>{const s=m.from(t).get(0),n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${s}_${n}`;e.taState[a]||(e.taState[a]={prevHigh:NaN,prevLow:NaN,prevClose:NaN,trInitSum:0,plusInitSum:0,minusInitSum:0,initCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,dxInitSum:0,adxInitCount:0,prevADX:NaN});const o=e.taState[a],h=e.get(e.data.high,0),c=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(c)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=h,o.prevLow=c,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(h-c,Math.abs(h-o.prevClose),Math.abs(c-o.prevClose)),g=h-o.prevHigh,p=o.prevLow-c,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=h,o.prevLow=c,o.prevClose=l;let w,E,A;if(o.initCount++,o.initCount<=s)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===s&&(o.prevSmoothedTR=o.trInitSum/s,o.prevSmoothedPlus=o.plusInitSum/s,o.prevSmoothedMinus=o.minusInitSum/s);else{const z=1/s;o.prevSmoothedTR=z*f+(1-z)*o.prevSmoothedTR,o.prevSmoothedPlus=z*x+(1-z)*o.prevSmoothedPlus,o.prevSmoothedMinus=z*y+(1-z)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,E=o.prevSmoothedPlus,A=o.prevSmoothedMinus,o.initCount<s)return[[NaN,NaN,NaN]];const k=w===0?0:100*E/w,T=w===0?0:100*A/w,C=k+T,Q=C===0?0:100*Math.abs(k-T)/C;let G=NaN;if(o.adxInitCount++,o.adxInitCount<=n)o.dxInitSum+=Q,o.adxInitCount===n&&(o.prevADX=o.dxInitSum/n,G=o.prevADX);else{const z=1/n;o.prevADX=z*Q+(1-z)*o.prevADX,G=o.prevADX}return[[e.precision(k),e.precision(T),e.precision(G)]]}}function gc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`ema_${s}`;e.taState[n]||(e.taState[n]={prevEma:null,initSum:0,initCount:0});const a=e.taState[n],o=m.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevEma=a.initSum/s,e.precision(a.prevEma)):NaN;const h=2/(s+1),c=o*h+a.prevEma*(1-h);return a.prevEma=c,e.precision(c)}}function xc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o>=h)return!1}return!0}}function yc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`highest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=Math.max(...a.window.filter(c=>!isNaN(c)));return e.precision(h)}}function wc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);if(e.idx<s-1)return NaN;let a=-1/0,o=NaN;for(let h=0;h<s;h++){const c=n.get(h);isNaN(c)||(isNaN(o)||c>a)&&(a=c,o=-h)}return o}}function bc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=Math.floor(s/2),a=Math.floor(Math.sqrt(s)),o=e.ta.wma,h=o(t,n,r?`${r}_wma1`:void 0),c=o(t,s,r?`${r}_wma2`:void 0);if(isNaN(h)||isNaN(c))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${s}`;e.taState[l]||(e.taState[l]=[]);const f=2*h-c;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${s}`;e.taState[g]||(e.taState[g]={window:[]});const p=e.taState[g];if(p.window.unshift(f),p.window.length<a)return NaN;p.window.length>a&&p.window.pop();let x=0,y=0;for(let E=0;E<a;E++){const A=a-E;x+=p.window[E]*A,y+=A}const w=x/y;return e.precision(w)}}function vc(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),s=e.get(e.data.low,0),n=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n))return NaN;const a=(r-s)*n;if(a===0)return e.precision(0);const o=(2*i-r-s)/a;return e.precision(o)}}function _c(e){return(t,i,r,s,n)=>{const a=m.from(i).get(0),o=m.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=m.from(s).get(0));let c;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(h){const T=e.get(e.data.close,1);isNaN(T)?c=NaN:c=Math.max(l-f,Math.abs(l-T),Math.abs(f-T))}else c=l-f;const g=m.from(t).get(0);e.taState||(e.taState={});const p=n||`kc_${a}_${o}_${h}`;e.taState[p]||(e.taState[p]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const x=e.taState[p],y=(T,C,Q)=>{if(isNaN(C))return NaN;if(T.initCount<Q)return T.initSum+=C,T.initCount++,T.initCount===Q?(T.prevEma=T.initSum/Q,T.prevEma):NaN;const G=2/(Q+1);return T.prevEma=C*G+T.prevEma*(1-G),T.prevEma},w=y(x.basisState,g,a),E=y(x.rangeState,c,a);if(isNaN(w)||isNaN(E))return[[NaN,NaN,NaN]];const A=w+E*o,k=w-E*o;return[[e.precision(w),e.precision(A),e.precision(k)]]}}function Sc(e){return(t,i,r,s,n)=>{const a=m.from(i).get(0),o=m.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=m.from(s).get(0)),e.taState||(e.taState={});const c=n||`kcw_${a}_${o}_${h}`;e.taState[c]||(e.taState[c]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[c],f=(k,T,C)=>{if(isNaN(T))return NaN;if(k.initCount<C)return k.initSum+=T,k.initCount++,k.initCount===C?(k.prevEma=k.initSum/C,k.prevEma):NaN;const Q=2/(C+1);return k.prevEma=T*Q+k.prevEma*(1-Q),k.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(h){const k=e.get(e.data.close,1);isNaN(k)?g=NaN:g=Math.max(p-x,Math.abs(p-k),Math.abs(x-k))}else g=p-x;const y=m.from(t).get(0),w=f(l.basisState,y,a),E=f(l.rangeState,g,a);if(isNaN(w)||isNaN(E))return NaN;if(w===0)return e.precision(0);const A=2*E*o/w;return e.precision(A)}}function Ec(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=s||`linreg_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const h=e.taState[o],c=m.from(t).get(0);if(h.window.unshift(c),h.window.length<n)return NaN;h.window.length>n&&h.window.pop();let l=0,f=0,g=0,p=0;const x=n;for(let A=0;A<n;A++){const k=n-1-A,T=h.window[A];l+=k,f+=T,g+=k*T,p+=k*k}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,E=(f-w*l)/x+w*(n-1-a);return e.precision(E)}}function Nc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`lowest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.filter(l=>!isNaN(l)&&l!==void 0),c=h.length>0?Math.min(...h):NaN;return e.precision(c)}}function Cc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);if(e.idx<s-1)return NaN;let a=1/0,o=NaN;for(let h=0;h<s;h++){const c=n.get(h);isNaN(c)||(isNaN(o)||c<a)&&(a=c,o=-h)}return o}}function kc(e){return(t,i,r,s,n)=>{const a=m.from(i).get(0),o=m.from(r).get(0),h=m.from(s).get(0),c=n||`macd_${a}_${o}_${h}`,l=`${c}_fast`,f=`${c}_slow`,g=`${c}_signal`,p=e.ta.ema(t,a,l),x=e.ta.ema(t,o,f);let y=NaN;!isNaN(p)&&!isNaN(x)&&(y=p-x);let w=NaN;isNaN(y)||(w=e.ta.ema(y,h,g));let E=NaN;return!isNaN(y)&&!isNaN(w)&&(E=y-w),[[e.precision(y),e.precision(w),e.precision(E)]]}}function Ic(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`median_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.slice().sort((f,g)=>f-g),c=Math.floor(s/2),l=s%2===0?(h[c-1]+h[c])/2:h[c];return e.precision(l)}}function Ac(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`mfi_${s}`;e.taState[n]||(e.taState[n]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[n],o=m.from(t).get(0),h=m.from(t).get(1),c=e.get(e.data.volume,0);if(isNaN(o)||isNaN(c))return NaN;const l=isNaN(h)?NaN:o-h;let f=0,g=0;if(f=c*(l<=0?0:o),g=c*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<s)return NaN;if(a.upperWindow.length>s){const x=a.upperWindow.pop(),y=a.lowerWindow.pop();a.upperSum-=x,a.lowerSum-=y}if(a.lowerSum===0)return a.upperSum,e.precision(100);if(a.upperSum===0)return e.precision(0);const p=100-100/(1+a.upperSum/a.lowerSum);return e.precision(p)}}function Pc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);if(e.idx<s-1)return NaN;const a=new Map;for(let c=0;c<s;c++){const l=n.get(c);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,h=-1;for(const[c,l]of a.entries())l>h?(h=l,o=c):l===h&&c<o&&(o=c);return o}}function Tc(e){return(t,i,r)=>{const s=m.from(i).get(0);return e.ta.change(t,s)}}function Rc(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,c=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||c===0)&&l<f){const g=(h-c)/c;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Dc(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={prevOBV:0});const i=e.taState[t],r=e.get(e.data.close,0),s=e.get(e.data.volume,0),n=e.get(e.data.close,1);if(isNaN(n))return i.prevOBV=0,e.precision(0);let a;return r>n?a=i.prevOBV+s:r<n?a=i.prevOBV-s:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function Vc(e){return(t,i,r)=>t instanceof m?i?new m(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Oc(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t);if(e.idx<n-1)return NaN;const h=[];for(let x=0;x<n;x++){const y=o.get(x);if(isNaN(y))return NaN;h.push(y)}h.sort((x,y)=>x-y);let c=a/100*n-.5;c<0&&(c=0),c>n-1&&(c=n-1);const l=Math.floor(c),f=Math.ceil(c);if(l===f)return e.precision(h[l]);const g=c-l,p=h[l]+g*(h[f]-h[l]);return e.precision(p)}}function Mc(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t);if(e.idx<n-1)return NaN;const h=[];for(let l=0;l<n;l++){const f=o.get(l);isNaN(f)||h.push(f)}if(h.length===0)return NaN;h.sort((l,f)=>l-f);let c=Math.ceil(a/100*h.length)-1;return c<0&&(c=0),c>=h.length&&(c=h.length-1),e.precision(h[c])}}function Lc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);if(e.idx<s)return NaN;const a=n.get(0);if(isNaN(a))return NaN;let o=0,h=0;for(let c=1;c<=s;c++){const l=n.get(c);isNaN(l)||(h++,l<=a&&o++)}return h===0?NaN:e.precision(o/h*100)}}function Bc(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]>=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]>=n){a=!1;break}}a&&(r[s]=n)}return r}function Fc(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const n=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t).toArray(),h=Bc(o,n,a),c=e.idx;return e.precision(h[c])}}function jc(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]<=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]<=n){a=!1;break}}a&&(r[s]=n)}return r}function $c(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const n=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t).toArray(),h=jc(o,n,a),c=e.idx;return e.precision(h[c])}}function Wc(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,c=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||c===0)&&l>f){const g=(h-c)/c;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function qc(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(s)&&!isNaN(n)&&!isNaN(a)&&n!==0){const o=(s-n)/n*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function Uc(e){return(t,i,r)=>{const s=e.pine.ta.highest(t,i,(r||"range")+"_h"),n=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(s)||isNaN(n)?NaN:e.precision(s-n)}}function Kc(e){return(t,i,r)=>{const s=m.from(i).get(0),n=m.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o<=h)return!1}return!0}}function zc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`rma_${s}`;e.taState[n]||(e.taState[n]={prevRma:null,initSum:0,initCount:0});const a=e.taState[n],o=m.from(t).get(0)||0;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevRma=a.initSum/s,e.precision(a.prevRma)):NaN;const h=1/s,c=o*h+a.prevRma*(1-h);return a.prevRma=c,e.precision(c)}}function Hc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`roc_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=a.window[s],c=(o-h)/h*100;return e.precision(c)}}function Gc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`rsi_${s}`;e.taState[n]||(e.taState[n]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.prevValue!==null){const h=o-a.prevValue,c=h>0?h:0,l=h<0?-h:0;if(a.initGains.length<s){if(a.initGains.push(c),a.initLosses.push(l),a.initGains.length===s){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/s,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/s,a.prevValue=o;const g=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return e.precision(g)}return a.prevValue=o,NaN}a.avgGain=(a.avgGain*(s-1)+c)/s,a.avgLoss=(a.avgLoss*(s-1)+l)/s;const f=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return a.prevValue=o,e.precision(f)}return a.prevValue=o,NaN}}function Yc(e){return(t,i,r,s)=>{const n=m.from(t).get(0),a=m.from(i).get(0),o=m.from(r).get(0);e.taState||(e.taState={});const h=s||`sar_${n}_${a}_${o}`;e.taState[h]||(e.taState[h]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const c=e.taState[h],l=e.get(e.data.high,0),f=e.get(e.data.low,0),g=e.get(e.data.close,0),p=e.get(e.data.close,1),x=e.get(e.data.high,1),y=e.get(e.data.low,1),w=e.get(e.data.high,2),E=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let A=!1;return c.barIndex===1&&(g>p?(c.isBelow=!0,c.maxMin=l,c.result=y):(c.isBelow=!1,c.maxMin=f,c.result=x),A=!0,c.acceleration=n),c.barIndex>=1&&(c.result=c.result+c.acceleration*(c.maxMin-c.result),c.isBelow?c.result>f&&(A=!0,c.isBelow=!1,c.result=Math.max(l,c.maxMin),c.maxMin=f,c.acceleration=n):c.result<l&&(A=!0,c.isBelow=!0,c.result=Math.min(f,c.maxMin),c.maxMin=l,c.acceleration=n),A||(c.isBelow?l>c.maxMin&&(c.maxMin=l,c.acceleration=Math.min(c.acceleration+a,o)):f<c.maxMin&&(c.maxMin=f,c.acceleration=Math.min(c.acceleration+a,o))),c.isBelow?(c.result=Math.min(c.result,y),c.barIndex>1&&(c.result=Math.min(c.result,E))):(c.result=Math.max(c.result,x),c.barIndex>1&&(c.result=Math.max(c.result,w)))),c.barIndex++,c.barIndex<=1?NaN:e.precision(c.result)}}function Qc(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`sma_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=m.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const c=a.window.pop();a.sum-=c}const h=a.sum/s;return e.precision(h)}}function Xc(e){return(t,i,r=!0,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=s||`stdev_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],c=m.from(t).get(0);if(c==null||isNaN(c))return NaN;if(h.window.unshift(c),h.sum+=c,h.window.length<n)return NaN;if(h.window.length>n){const x=h.window.pop();h.sum-=x}const l=h.sum/n;let f=0;for(let x=0;x<n;x++)f+=Math.pow(h.window[x]-l,2);const g=a?n:n-1,p=Math.sqrt(f/g);return e.precision(p)}}function Zc(e){return(t,i,r,s,n)=>{const a=m.from(s).get(0);e.taState||(e.taState={});const o=n||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const h=e.taState[o],c=m.from(t).get(0),l=m.from(i).get(0),f=m.from(r).get(0);if(isNaN(c)||isNaN(l)||isNaN(f))return NaN;if(h.highWindow.unshift(l),h.lowWindow.unshift(f),h.highWindow.length<a)return NaN;h.highWindow.length>a&&(h.highWindow.pop(),h.lowWindow.pop());let g=h.highWindow[0],p=h.lowWindow[0];for(let w=1;w<a;w++)h.highWindow[w]>g&&(g=h.highWindow[w]),h.lowWindow[w]<p&&(p=h.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(c-p)/x;return e.precision(y)}}function Jc(e){return(t,i,r)=>{const s=m.from(t).get(0),n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${s}_${n}`;e.taState[a]||(e.taState[a]={trWindow:[],trSum:0,atrValue:NaN,atrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN});const o=e.taState[a],h=e.get(e.data.high,0),c=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(c)||isNaN(l))return[[NaN,NaN]];const f=(h+c)/2;let g;isNaN(o.prevClose)?g=h-c:g=Math.max(h-c,Math.abs(h-o.prevClose),Math.abs(c-o.prevClose)),o.atrCount++,o.atrCount<=n?(o.trWindow.push(g),o.trSum+=g,o.atrCount===n&&(o.atrValue=o.trSum/n)):o.atrValue=(o.atrValue*(n-1)+g)/n;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+s*p,w=f-s*p;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,A=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>E||x<E||(w=E),isNaN(o.prevUpperBand)||y<A||x>A||(y=A);let k,T;const C=o.prevSuperTrend;return o.atrCount===n?k=1:C===o.prevUpperBand?k=l>y?-1:1:k=l<w?1:-1,T=k===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=T,o.prevDirection=k,[[e.precision(T),k]]}}function eu(e){return(t,i)=>{const r=[1,2,2,1],s=6;e.taState||(e.taState={});const n=i||"swma";e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<4)return NaN;a.window.length>4&&a.window.pop();let h=0;for(let c=0;c<4;c++)h+=r[c]*a.window[3-c];return h/=s,e.precision(h)}}function tu(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=m.from(t).get(0));const s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(s-n):NaN;const o=Math.max(s-n,Math.abs(s-a),Math.abs(n-a));return e.precision(o)}}function iu(e){return(t,i,r,s)=>{const n=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=s||`tsi_${n}_${a}`;e.taState[o]||(e.taState[o]={prevSource:NaN,ema1_pc_multiplier:2/(a+1),ema1_pc_value:NaN,ema1_pc_count:0,ema1_pc_sum:0,ema2_pc_multiplier:2/(n+1),ema2_pc_value:NaN,ema2_pc_count:0,ema2_pc_sum:0,ema1_abs_multiplier:2/(a+1),ema1_abs_value:NaN,ema1_abs_count:0,ema1_abs_sum:0,ema2_abs_multiplier:2/(n+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const h=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return NaN;const l=isNaN(h.prevSource)?NaN:c-h.prevSource;if(h.prevSource=c,isNaN(l))return NaN;const f=Math.abs(l);if(h.ema1_pc_count++,h.ema1_pc_count<=a?(h.ema1_pc_sum+=l,h.ema1_pc_count===a&&(h.ema1_pc_value=h.ema1_pc_sum/a)):h.ema1_pc_value=l*h.ema1_pc_multiplier+h.ema1_pc_value*(1-h.ema1_pc_multiplier),h.ema1_abs_count++,h.ema1_abs_count<=a?(h.ema1_abs_sum+=f,h.ema1_abs_count===a&&(h.ema1_abs_value=h.ema1_abs_sum/a)):h.ema1_abs_value=f*h.ema1_abs_multiplier+h.ema1_abs_value*(1-h.ema1_abs_multiplier),isNaN(h.ema1_pc_value)||isNaN(h.ema1_abs_value))return NaN;if(h.ema2_pc_count++,h.ema2_pc_count<=n?(h.ema2_pc_sum+=h.ema1_pc_value,h.ema2_pc_count===n&&(h.ema2_pc_value=h.ema2_pc_sum/n)):h.ema2_pc_value=h.ema1_pc_value*h.ema2_pc_multiplier+h.ema2_pc_value*(1-h.ema2_pc_multiplier),h.ema2_abs_count++,h.ema2_abs_count<=n?(h.ema2_abs_sum+=h.ema1_abs_value,h.ema2_abs_count===n&&(h.ema2_abs_value=h.ema2_abs_sum/n)):h.ema2_abs_value=h.ema1_abs_value*h.ema2_abs_multiplier+h.ema2_abs_value*(1-h.ema2_abs_multiplier),isNaN(h.ema2_pc_value)||isNaN(h.ema2_abs_value))return NaN;if(h.ema2_abs_value===0)return e.precision(0);const g=h.ema2_pc_value/h.ema2_abs_value;return e.precision(g)}}function ru(e){return(t,i,r,s)=>{e.taState||(e.taState={});const n=s||"valuewhen";e.taState[n]||(e.taState[n]={values:[]});const a=e.taState[n],o=m.from(t).get(0),h=m.from(i).get(0),c=m.from(r).get(0);if(o&&a.values.push(h),isNaN(c)||c<0)return NaN;const l=a.values.length-1-c;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function su(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`variance_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,c=0;for(let g=0;g<s;g++)h+=a.window[g],c+=a.window[g]*a.window[g];const l=h/s,f=c/s-l*l;return e.precision(f)}}function nu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={cumulativePV:0,cumulativeVolume:0,lastSessionDate:null});const s=e.taState[r],n=m.from(t).get(0),a=m.from(e.data.volume).get(0),o=m.from(e.data.openTime).get(0),h=new Date(o).toISOString().slice(0,10);if(s.lastSessionDate!==h&&(s.cumulativePV=0,s.cumulativeVolume=0,s.lastSessionDate=h),s.cumulativePV+=n*a,s.cumulativeVolume+=a,s.cumulativeVolume===0)return NaN;const c=s.cumulativePV/s.cumulativeVolume;return e.precision(c)}}function au(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`vwma_${s}`;e.taState[n]||(e.taState[n]={window:[],volumeWindow:[]});const a=e.taState[n],o=m.from(t).get(0),h=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(h),a.window.length<s)return NaN;a.window.length>s&&(a.window.pop(),a.volumeWindow.pop());let c=0,l=0;for(let g=0;g<s;g++)c+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=c/l;return e.precision(f)}}function ou(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(s)||isNaN(n)||isNaN(a))return e.precision(r.cumulativeSum);let h=0;if(!isNaN(o)){const c=Math.max(n,o),l=Math.min(a,o),f=s-o;f>0?h=s-l:f<0&&(h=s-c)}return r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function hu(e){return(t,i,r)=>{const s=m.from(i).get(0);e.taState||(e.taState={});const n=r||`wma_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,c=0;for(let f=0;f<s;f++){const g=s-f;h+=a.window[f]*g,c+=g}const l=h/c;return e.precision(l)}}function cu(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const s=i||`wpr_${r}`;e.taState[s]||(e.taState[s]={highWindow:[],lowWindow:[]});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;if(n.highWindow.unshift(a),n.lowWindow.unshift(o),n.highWindow.length<r)return NaN;n.highWindow.length>r&&(n.highWindow.pop(),n.lowWindow.pop());let c=n.highWindow[0],l=n.lowWindow[0];for(let p=1;p<r;p++)n.highWindow[p]>c&&(c=n.highWindow[p]),n.lowWindow[p]<l&&(l=n.lowWindow[p]);const f=c-l;if(f===0)return e.precision(0);const g=(c-h)/f*-100;return e.precision(g)}}function uu(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n)||isNaN(a))return NaN;const o=s-n;if(o===0)return e.precision(0);const h=(i-r)/o*a;return e.precision(h)}}var lu=Object.defineProperty,pu=(e,t,i)=>t in e?lu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,_=(e,t,i)=>pu(e,typeof t!="symbol"?t+"":t,i);const fu={accdist:Jh,alma:ec,atr:tc,barssince:ic,bb:rc,bbw:sc,cci:nc,change:ac,cmo:oc,cog:hc,correlation:cc,cross:uc,crossover:lc,crossunder:pc,cum:fc,dev:mc,dmi:dc,ema:gc,falling:xc,highest:yc,highestbars:wc,hma:bc,iii:vc,kc:_c,kcw:Sc,linreg:Ec,lowest:Nc,lowestbars:Cc,macd:kc,median:Ic,mfi:Ac,mode:Pc,mom:Tc,nvi:Rc,obv:Dc,param:Vc,percentile_linear_interpolation:Oc,percentile_nearest_rank:Mc,percentrank:Lc,pivothigh:Fc,pivotlow:$c,pvi:Wc,pvt:qc,range:Uc,rising:Kc,rma:zc,roc:Hc,rsi:Gc,sar:Yc,sma:Qc,stdev:Xc,stoch:Zc,supertrend:Jc,swma:eu,tr:tu,tsi:iu,valuewhen:ru,variance:su,vwap:nu,vwma:au,wad:ou,wma:hu,wpr:cu,wvad:uu};class mu{constructor(t){this.context=t,_(this,"accdist"),_(this,"alma"),_(this,"atr"),_(this,"barssince"),_(this,"bb"),_(this,"bbw"),_(this,"cci"),_(this,"change"),_(this,"cmo"),_(this,"cog"),_(this,"correlation"),_(this,"cross"),_(this,"crossover"),_(this,"crossunder"),_(this,"cum"),_(this,"dev"),_(this,"dmi"),_(this,"ema"),_(this,"falling"),_(this,"highest"),_(this,"highestbars"),_(this,"hma"),_(this,"iii"),_(this,"kc"),_(this,"kcw"),_(this,"linreg"),_(this,"lowest"),_(this,"lowestbars"),_(this,"macd"),_(this,"median"),_(this,"mfi"),_(this,"mode"),_(this,"mom"),_(this,"nvi"),_(this,"obv"),_(this,"param"),_(this,"percentile_linear_interpolation"),_(this,"percentile_nearest_rank"),_(this,"percentrank"),_(this,"pivothigh"),_(this,"pivotlow"),_(this,"pvi"),_(this,"pvt"),_(this,"range"),_(this,"rising"),_(this,"rma"),_(this,"roc"),_(this,"rsi"),_(this,"sar"),_(this,"sma"),_(this,"stdev"),_(this,"stoch"),_(this,"supertrend"),_(this,"swma"),_(this,"tr"),_(this,"tsi"),_(this,"valuewhen"),_(this,"variance"),_(this,"vwap"),_(this,"vwma"),_(this,"wad"),_(this,"wma"),_(this,"wpr"),_(this,"wvad"),Object.entries(fu).forEach(([i,r])=>{this[i]=r(t)})}}class du{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}param(t,i=0,r){return m.from(t).get(i)}warning(t,...i){console.warn(this.logFormat(t,...i))}error(t,...i){console.error(this.logFormat(t,...i))}info(t,...i){console.log(this.logFormat(t,...i))}}class gu{constructor(t){this.context=t}param(t,i=0,r){return m.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,s=0){const n=String(t),a=String(i),o=String(r),h=Math.floor(Number(s))||0;if(a==="")return n;let c=0,l=0;for(;;){const f=n.indexOf(a,c);if(f===-1)return n;if(l===h)return n.substring(0,f)+o+n.substring(f+a.length);l++,c=f+a.length}}contains(t,i){return String(t).includes(i)}endswith(t,i){return String(t).endsWith(i)}startswith(t,i){return String(t).startsWith(i)}pos(t,i){const r=String(t).indexOf(i);return r===-1?NaN:r}length(t){return String(t).length}match(t,i){return String(t).match(new RegExp(i))}split(t,i){return[String(t).split(i)]}substring(t,i,r){return String(t).substring(i,r)}format(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}}class xu{constructor(t){this.context=t}param(t,i=0,r){return m.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<60*60*24?Math.ceil(t/60):t<=60*60*24*7*52?t%(60*60*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(60*60*24))+"D":"12M"}in_seconds(t){const i=parseInt(t),r=t.slice(-1);return r==="S"?i:r==="D"?i*60*60*24:r==="W"?i*60*60*24*7:r==="M"?i*60*60*24*30:isNaN(i)?0:i*60}}const yu=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],wu=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],bu=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],vu={series:"series",title:"string",color:"string",linewidth:"number",style:"string",trackprice:"boolean",histbase:"number",offset:"number",join:"bool",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},_u={series:"series",title:"string",style:"string",location:"string",color:"string",offset:"number",text:"string",textcolor:"string",editable:"boolean",size:"string",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Su={series:"series",title:"string",colorup:"string",colordown:"string",offset:"number",minheight:"number",maxheight:"number",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"};class Eu{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}plotchar(...t){this.plot(...t)}plot(...t){const i=Ze(t,yu,vu),{series:r,title:s,...n}=i,a=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:a,title:s});const o=m.from(r).get(0);this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}plotshape(...t){const i=Ze(t,wu,_u),{series:r,title:s,...n}=i,a=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:{...a,style:"shape",shape:a.style},title:s});const o=m.from(r).get(0);this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:a?.location==="absolute"||o?{text:a.text,textcolor:a.textcolor,color:a.color,offset:a.offset,shape:a.style,location:a.location,size:a.size}:void 0})}plotarrow(...t){const i=Ze(t,bu,Su),{series:r,title:s,...n}=i,a=m.from(r).get(0),o=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:{...o,style:"shape"},title:s}),this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:a,options:typeof a=="number"&&!isNaN(a)&&a!==0?{text:void 0,textcolor:void 0,color:a>0?o.colorup:o.colordown,offset:o.offset,shape:a>0?"arrowup":"arrowdown",location:a>0?"belowbar":"abovebar",height:o.maxheight}:void 0})}}class Nu{constructor(t){this.context=t}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(t,i=0,r){return m.from(t).get(i)}any(t,i,r,s,n,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:s,linewidth:n,editable:a,display:o})}}var Cu=Object.defineProperty,ku=(e,t,i)=>t in e?Cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>ku(e,typeof t!="symbol"?t+"":t,i);const vr=class Lt{constructor({marketData:t,source:i,tickerId:r,timeframe:s,limit:n,sDate:a,eDate:o,fullContext:h}){j(this,"data",{open:new m([]),high:new m([]),low:new m([]),close:new m([]),volume:new m([]),hl2:new m([]),hlc3:new m([]),ohlc4:new m([]),hlcc4:new m([])}),j(this,"indicator"),j(this,"cache",{}),j(this,"taState",{}),j(this,"isSecondaryContext",!1),j(this,"NA",NaN),j(this,"lang"),j(this,"pine"),j(this,"idx",0),j(this,"params",{}),j(this,"const",{}),j(this,"var",{}),j(this,"let",{}),j(this,"result"),j(this,"plots",{}),j(this,"marketData"),j(this,"source"),j(this,"tickerId"),j(this,"timeframe",""),j(this,"limit"),j(this,"sDate"),j(this,"eDate"),j(this,"fullContext"),j(this,"pineTSCode"),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=n,this.sDate=a,this.eDate=o,this.fullContext=h||this;const c=new Ko(this),l={na:c.na.bind(c),color:c.color,nz:c.nz.bind(c),indicator:c.indicator.bind(c),fixnan:c.fixnan.bind(c),alertcondition:c.alertcondition.bind(c),bool:c.bool.bind(c)},f=this;this.pine={input:new ph(this),ta:new mu(this),math:new Kh(this),request:new Zh(this),array:new ga(this),map:new Ta(this),matrix:new Vo(this),syminfo:null,timeframe:new xu(this),barstate:new Bo(this),get bar_index(){return f.idx},get last_bar_index(){return f.data.close.length-1},get last_bar_time(){return f.data.openTime.get(f.data.openTime.length-1)},get timenow(){return new Date().getTime()},log:new du(this),str:new gu(this),...l,...Jn};const g=new Eu(this),p=new Nu(this);this.bindContextObject(g,["plot","plotchar","plotshape","plotarrow"]),this.bindContextObject(p,["any","style_dashed","style_solid","style_dotted","param"],"hline")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const n of i)typeof t[n]=="function"?s[n]=t[n].bind(t):s[n]=t[n]}init(t,i,r=0){let s;return i instanceof m?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,t?t instanceof m?(t.data[t.data.length-1]=s,t):Array.isArray(t)?(t[t.length-1]=s,new m(t)):new m([s]):new m([s])}initVar(t,i){if(t)return t;let r;return i instanceof m?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new m([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new m(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new m(this.params[r],0)))}get(t,i){if(t instanceof m)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof m){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}get math(){return this._showDeprecationWarning("const math = context.math","const { math, ta, input } = context.pine"),this.pine.math}get ta(){return this._showDeprecationWarning("const ta = context.ta","const { ta, math, input } = context.pine"),this.pine.ta}get input(){return this._showDeprecationWarning("const input = context.input","const { input, math, ta } = context.pine"),this.pine.input}get request(){return this._showDeprecationWarning("const request = context.request","const { request, math, ta } = context.pine"),this.pine.request}get array(){return this._showDeprecationWarning("const array = context.array","const { array, math, ta } = context.pine"),this.pine.array}get core(){return this._showDeprecationWarning("context.core.*","context.pine (e.g., const { na, plotchar, color, plot, nz } = context.pine)"),{na:this.pine.na,plotchar:this.pine.plotchar,plotshape:this.pine.plotshape,plotarrow:this.pine.plotarrow,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;Lt._deprecationWarningsShown.has(r)||(Lt._deprecationWarningsShown.add(r),typeof window<"u"?console.warn("%c[WARNING]%c %s syntax is deprecated. Use %s instead. This will be removed in a future version.","color: #FFA500; font-weight: bold;","color: #FFA500;",t,i):console.warn(`\x1B[33m[WARNING] ${t} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};j(vr,"_deprecationWarningsShown",new Set);let bi=vr;var Iu=Object.defineProperty,Au=(e,t,i)=>t in e?Iu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,K=(e,t,i)=>Au(e,typeof t!="symbol"?t+"":t,i);class _r{constructor(t,i,r,s,n,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=n,this.eDate=a,K(this,"data",[]),K(this,"open",[]),K(this,"high",[]),K(this,"low",[]),K(this,"close",[]),K(this,"volume",[]),K(this,"hl2",[]),K(this,"hlc3",[]),K(this,"ohlc4",[]),K(this,"hlcc4",[]),K(this,"openTime",[]),K(this,"closeTime",[]),K(this,"_readyPromise",null),K(this,"_ready",!1),K(this,"_debugSettings",{ln:!1,debug:!1}),K(this,"_transpiledCode",null),K(this,"_isSecondaryContext",!1),K(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,s,n,a).then(h=>{const c=h;this.data=c;const l=c.map(C=>C.open),f=c.map(C=>C.close),g=c.map(C=>C.high),p=c.map(C=>C.low),x=c.map(C=>C.volume),y=c.map(C=>(C.high+C.low+C.close)/3),w=c.map(C=>(C.high+C.low)/2),E=c.map(C=>(C.high+C.low+C.open+C.close)/4),A=c.map(C=>(C.high+C.low+C.close+C.close)/4),k=c.map(C=>C.openTime),T=c.map(C=>C.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=E,this.hlcc4=A,this.openTime=k,this.closeTime=T,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(C=>{this._syminfo=C,this._ready=!0,o(!0)}).catch(C=>{console.warn("Failed to get symbol info, using default values:",C),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,s,n,a){return Array.isArray(t)?t:t.getMarketData(i,r,s,n,a)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){if(r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,s)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,s=!1){await this.ready(),i||(i=this.data.length);const n=this._initializeContext(t,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let a=this.data.length-i;for(;;){const o=this.data.length-a;if(o>0){const l=Math.min(o,r),f=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(n,f);continue}if(!s||Array.isArray(this.source))break;const{newCandles:h,updatedLastCandle:c}=await this._updateMarketData();if(h===0&&!c){yield null;continue}this._removeLastResult(n),a=this.data.length-(h+1),n.pine.barstate.setLive()}}_getResultLength(t){if(Array.isArray(t))return t.length;if(typeof t=="object"&&t!==null){const i=Object.keys(t);if(i.length>0&&Array.isArray(t[i[0]]))return t[i[0]].length}return 0}_createPageContext(t,i){const r=new bi({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t});if(r.pineTSCode=t.pineTSCode,r.idx=t.idx,Array.isArray(t.result))r.result=t.result.slice(i);else if(typeof t.result=="object"&&t.result!==null){r.result={};for(let s in t.result)Array.isArray(t.result[s])?r.result[s]=t.result[s].slice(i):r.result[s]=t.result[s]}else r.result=t.result;return r.plots={...t.plots},r}async _updateMarketData(t){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const n=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,t);if(!n||n.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let h=0;h<n.length;h++){const c=n[h];c.openTime===s?(this._replaceCandle(r,c),a=!0):c.openTime>s&&(this._appendCandle(c),o++)}return{newCandles:o,updatedLastCandle:a}}catch(n){return console.error("Error updating market data:",n),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(t,i){this.data[t]=i,this.open[t]=i.open,this.close[t]=i.close,this.high[t]=i.high,this.low[t]=i.low,this.volume[t]=i.volume,this.hl2[t]=(i.high+i.low)/2,this.hlc3[t]=(i.high+i.low+i.close)/3,this.ohlc4[t]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[t]=(i.high+i.low+i.close+i.close)/4,this.openTime[t]=i.openTime,this.closeTime[t]=i.closeTime}_appendCandle(t){this.data.push(t),this.open.push(t.open),this.close.push(t.close),this.high.push(t.high),this.low.push(t.low),this.volume.push(t.volume),this.hl2.push((t.high+t.low)/2),this.hlc3.push((t.high+t.low+t.close)/3),this.ohlc4.push((t.high+t.low+t.open+t.close)/4),this.hlcc4.push((t.high+t.low+t.close+t.close)/4),this.openTime.push(t.openTime),this.closeTime.push(t.closeTime)}_removeLastResult(t){if(Array.isArray(t.result))t.result.pop();else if(typeof t.result=="object"&&t.result!==null)for(let i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.data.pop(),t.data.open.data.pop(),t.data.high.data.pop(),t.data.low.data.pop(),t.data.volume.data.pop(),t.data.hl2.data.pop(),t.data.hlc3.data.pop(),t.data.ohlc4.data.pop(),t.data.hlcc4.data.pop(),t.data.openTime.data.pop(),t.data.closeTime&&t.data.closeTime.data.pop()}_initializeContext(t,i=!1){const r=new bi({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return r.pine.syminfo=this._syminfo,r.pineTSCode=t,r.isSecondaryContext=i,r.data.close=new m([]),r.data.open=new m([]),r.data.high=new m([]),r.data.low=new m([]),r.data.volume=new m([]),r.data.hl2=new m([]),r.data.hlc3=new m([]),r.data.ohlc4=new m([]),r.data.hlcc4=new m([]),r.data.openTime=new m([]),r.data.closeTime=new m([]),r}_transpileCode(t){return dn.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,s){const n=["const","var","let","params"];for(let a=r;a<s;a++){t.idx=a,t.data.close.data.push(this.close[a]),t.data.open.data.push(this.open[a]),t.data.high.data.push(this.high[a]),t.data.low.data.push(this.low[a]),t.data.volume.data.push(this.volume[a]),t.data.hl2.data.push(this.hl2[a]),t.data.hlc3.data.push(this.hlc3[a]),t.data.ohlc4.data.push(this.ohlc4[a]),t.data.hlcc4.data.push(this.hlcc4[a]),t.data.openTime.data.push(this.openTime[a]),t.data.closeTime.data.push(this.closeTime[a]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let h in o){t.result[h]===void 0&&(t.result[h]=[]);let c;o[h]instanceof m?c=o[h].get(0):Array.isArray(o[h])?c=o[h][o[h].length-1]:c=o[h],t.result[h].push(c)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let h of n)for(let c in t[h]){const l=t[h][c];if(l instanceof m){const f=l.get(0);l.data.push(f)}else if(Array.isArray(l)){const f=l[l.length-1];l.push(f)}}}}}var Pu=Object.defineProperty,Tu=(e,t,i)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,mt=(e,t,i)=>Tu(e,typeof t!="symbol"?t+"":t,i);const kt="https://api.binance.com/api/v3",vi="https://api.binance.us/api/v3",It={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",45:null,60:"1h",120:"2h",180:null,240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"};class Ru{constructor(t=5*60*1e3){mt(this,"cache"),mt(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=t}generateKey(t){return Object.entries(t).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(t){const i=this.generateKey(t),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(t,i){const r=this.generateKey(t);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const t=Date.now();for(const[i,r]of this.cache.entries())t-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class Du{constructor(){mt(this,"cacheManager"),mt(this,"activeApiUrl",null),this.cacheManager=new Ru(5*60*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${kt}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=kt,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${vi}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=vi,this.activeApiUrl}catch{}return kt}async getMarketDataInterval(t,i,r,s){try{const n=It[i.toUpperCase()];if(!n)return console.error(`Unsupported timeframe: ${i}`),[];const a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let o=[],h=r;const c=s,l=a[n];if(!l)return console.error(`Duration not defined for interval: ${n}`),[];for(;h<c;){const f=Math.min(h+1e3*l,c),g=await this.getMarketData(t,i,1e3,h,f);if(g.length===0)break;o=o.concat(g),h=g[g.length-1].closeTime+1}return o}catch(n){return console.error("Error in getMarketDataInterval:",n),[]}}async getMarketData(t,i,r,s,n){try{const a=n!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:s,eDate:n};if(a){const g=this.cacheManager.get(o);if(g)return g}const h=It[i.toUpperCase()];if(!h)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,n)&&s&&n){const g=await this.getMarketDataInterval(t,i,s,n),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let c=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${h}`;r&&(c+=`&limit=${Math.min(r,1e3)}`),s&&(c+=`&startTime=${s}`),n&&(c+=`&endTime=${n}`);const l=await fetch(c);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const f=(await l.json()).map(g=>({openTime:parseInt(g[0]),open:parseFloat(g[1]),high:parseFloat(g[2]),low:parseFloat(g[3]),close:parseFloat(g[4]),volume:parseFloat(g[5]),closeTime:parseInt(g[6]),quoteAssetVolume:parseFloat(g[7]),numberOfTrades:parseInt(g[8]),takerBuyBaseAssetVolume:parseFloat(g[9]),takerBuyQuoteAssetVolume:parseFloat(g[10]),ignore:g[11]}));return a&&this.cacheManager.set(o,f),f}catch(a){return console.error("Error in binance.klines:",a),[]}}shouldPaginate(t,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const n=It[t.toUpperCase()],a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[n];if(a)return Math.ceil((s-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),s=t,n="";t.endsWith(".P")?(i="futures",s=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",n="Perpetual"):t.includes("_")&&(i="futures",s=t,r="https://dapi.binance.com/dapi/v1",n="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const h=(await o.json()).symbols;if(!h||h.length===0)return console.error(`Symbol ${t} not found`),null;const c=i==="futures"?h.find(k=>k.symbol===s):h[0];if(!c)return console.error(`Symbol ${s} not found in exchange info`),null;const l=c.filters?.find(k=>k.filterType==="PRICE_FILTER"),f=c.filters?.find(k=>k.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=c.baseAsset,w=c.quoteAsset,E=n?` ${n}`:"",A=`${y} / ${w}${E}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:A,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:c.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:c.deliveryDate||0,employees:0,industry:"",sector:"",shareholders:0,shares_outstanding_float:0,shares_outstanding_total:0,recommendations_buy:0,recommendations_buy_strong:0,recommendations_date:0,recommendations_hold:0,recommendations_sell:0,recommendations_sell_strong:0,recommendations_total:0,target_price_average:0,target_price_date:0,target_price_estimates:0,target_price_high:0,target_price_low:0,target_price_median:0}}catch(i){return console.error("Error in binance.exchangeInfo:",i),null}}}class Vu{async getMarketData(){return[]}}const Ou=typeof process<"u"&&process.versions&&process.versions.node;let dt=null;if(Ou)try{dt=new Vu}catch{dt=null}const Mu={Binance:new Du,...dt?{Mock:dt}:{}};export{bi as Context,_r as PineTS,Mu as Provider};
117
117
  //# sourceMappingURL=pinets.min.browser.es.js.map