pinets 0.8.8 → 0.8.9

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
- (function(Re,nt){typeof exports=="object"&&typeof module<"u"?nt(exports):typeof define=="function"&&define.amd?define(["exports"],nt):(Re=typeof globalThis<"u"?globalThis:Re||self,nt(Re.PineTSLib={}))})(this,(function(Re){"use strict";var nt=[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],si=[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],Mr="\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",ai="\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",At={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"},Pt="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",Or={5:Pt,"5module":Pt+" export import",6:Pt+" const class extends export import super"},Br=/^in(stanceof)?$/,Fr=new RegExp("["+ai+"]"),Wr=new RegExp("["+ai+Mr+"]");function Tt(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 De(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Fr.test(String.fromCharCode(e)):t===!1?!1:Tt(e,si)}function Qe(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&&Wr.test(String.fromCharCode(e)):t===!1?!1:Tt(e,si)||Tt(e,nt)}var M=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 de(e,t){return new M(e,{beforeExpr:!0,binop:t})}var me={beforeExpr:!0},ue={startsExpr:!0},Rt={};function L(e,t){return t===void 0&&(t={}),t.keyword=e,Rt[e]=new M(e,t)}var p={num:new M("num",ue),regexp:new M("regexp",ue),string:new M("string",ue),name:new M("name",ue),privateId:new M("privateId",ue),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",me),semi:new M(";",me),colon:new M(":",me),dot:new M("."),question:new M("?",me),questionDot:new M("?."),arrow:new M("=>",me),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",me),backQuote:new M("`",ue),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:de("||",1),logicalAND:de("&&",2),bitwiseOR:de("|",3),bitwiseXOR:de("^",4),bitwiseAND:de("&",5),equality:de("==/!=/===/!==",6),relational:de("</>/<=/>=",7),bitShift:de("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:de("%",10),star:de("*",10),slash:de("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:de("??",1),_break:L("break"),_case:L("case",me),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",me),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",me),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",ue),_if:L("if"),_return:L("return",me),_switch:L("switch"),_throw:L("throw",me),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",ue),_super:L("super",ue),_class:L("class",ue),_extends:L("extends",me),_export:L("export"),_import:L("import",ue),_null:L("null",ue),_true:L("true",ue),_false:L("false",ue),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},xe=/\r\n?|\n|\u2028|\u2029/,jr=new RegExp(xe.source,"g");function Xe(e){return e===10||e===13||e===8232||e===8233}function oi(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(Xe(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ci=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ui=Object.prototype,$r=ui.hasOwnProperty,qr=ui.toString,Ze=Object.hasOwn||(function(e,t){return $r.call(e,t)}),hi=Array.isArray||(function(e){return qr.call(e)==="[object Array]"}),li=Object.create(null);function Oe(e){return li[e]||(li[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Ve(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Ur=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,st=function(t,i){this.line=t,this.column=i};st.prototype.offset=function(t){return new st(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 pi(e,t){for(var i=1,r=0;;){var n=oi(e,r,t);if(n<0)return new st(i,t-r);++i,r=n}}var Dt={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},fi=!1;function Hr(e){var t={};for(var i in Dt)t[i]=e&&Ze(e,i)?e[i]:Dt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!fi&&typeof console=="object"&&console.warn&&(fi=!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),hi(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}return hi(t.onComment)&&(t.onComment=Kr(t,t.onComment)),t}function Kr(e,t){return function(i,r,n,a,s,o){var c={type:i?"Block":"Line",value:r,start:n,end:a};e.locations&&(c.loc=new dt(this,s,o)),e.ranges&&(c.range=[n,a]),t.push(c)}}var at=1,Je=2,Vt=4,di=8,mi=16,xi=32,Lt=64,gi=128,ot=256,Mt=at|Je|ot;function Ot(e,t){return Je|(e?Vt:0)|(t?di:0)}var mt=0,Bt=1,Le=2,yi=3,vi=4,wi=5,X=function(t,i,r){this.options=t=Hr(t),this.sourceFile=t.sourceFile,this.keywords=Oe(Or[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=At[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=Oe(n);var a=(n?n+" ":"")+At.strict;this.reservedWordsStrict=Oe(a),this.reservedWordsStrictBind=Oe(a+" "+At.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(xe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=p.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(at),this.regexpState=null,this.privateNameStack=[]},ke={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}};X.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},ke.inFunction.get=function(){return(this.currentVarScope().flags&Je)>0},ke.inGenerator.get=function(){return(this.currentVarScope().flags&di)>0&&!this.currentVarScope().inClassFieldInit},ke.inAsync.get=function(){return(this.currentVarScope().flags&Vt)>0&&!this.currentVarScope().inClassFieldInit},ke.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&ot)return!1;if(t.flags&Je)return(t.flags&Vt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ke.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Lt)>0||i||this.options.allowSuperOutsideMethod},ke.allowDirectSuper.get=function(){return(this.currentThisScope().flags&gi)>0},ke.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ke.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Je|ot))>0||i},ke.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ot)>0},X.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,n=0;n<t.length;n++)r=t[n](r);return r},X.parse=function(t,i){return new this(i,t).parse()},X.parseExpressionAt=function(t,i,r){var n=new this(r,t,i);return n.nextToken(),n.parseExpression()},X.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(X.prototype,ke);var re=X.prototype,Gr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;re.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){ge.lastIndex=e,e+=ge.exec(this.input)[0].length;var t=Gr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){ge.lastIndex=e+t[0].length;var i=ge.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||xe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,ge.lastIndex=e,e+=ge.exec(this.input)[0].length,this.input[e]===";"&&e++}},re.eat=function(e){return this.type===e?(this.next(),!0):!1},re.isContextual=function(e){return this.type===p.name&&this.value===e&&!this.containsEsc},re.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},re.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},re.canInsertSemicolon=function(){return this.type===p.eof||this.type===p.braceR||xe.test(this.input.slice(this.lastTokEnd,this.start))},re.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},re.semicolon=function(){!this.eat(p.semi)&&!this.insertSemicolon()&&this.unexpected()},re.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},re.expect=function(e){this.eat(e)||this.unexpected()},re.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};re.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")}},re.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")},re.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")},re.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var A=X.prototype;A.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==p.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,n=Object.keys(this.undefinedExports);r<n.length;r+=1){var a=n[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ft={kind:"loop"},zr={kind:"switch"};A.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ge.lastIndex=this.pos;var t=ge.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(De(r,!0)){for(var n=i+1;Qe(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(i,n);if(!Br.test(a))return!0}return!1},A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ge.lastIndex=this.pos;var e=ge.exec(this.input),t=this.pos+e[0].length,i;return!xe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Qe(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))},A.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),a;switch(this.isLet(e)&&(r=p._var,a="let"),r){case p._break:case p._continue:return this.parseBreakContinueStatement(n,r.keyword);case p._debugger:return this.parseDebuggerStatement(n);case p._do:return this.parseDoStatement(n);case p._for:return this.parseForStatement(n);case p._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case p._class:return e&&this.unexpected(),this.parseClass(n,!0);case p._if:return this.parseIfStatement(n);case p._return:return this.parseReturnStatement(n);case p._switch:return this.parseSwitchStatement(n);case p._throw:return this.parseThrowStatement(n);case p._try:return this.parseTryStatement(n);case p._const:case p._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(n,a);case p._while:return this.parseWhileStatement(n);case p._with:return this.parseWithStatement(n);case p.braceL:return this.parseBlock(!0,n);case p.semi:return this.parseEmptyStatement(n);case p._export:case p._import:if(this.options.ecmaVersion>10&&r===p._import){ge.lastIndex=this.pos;var s=ge.exec(this.input),o=this.pos+s[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(n,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===p._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.value,h=this.parseExpression();return r===p.name&&h.type==="Identifier"&&this.eat(p.colon)?this.parseLabeledStatement(n,u,h,e):this.parseExpressionStatement(n,h)}},A.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(p.semi)||this.insertSemicolon()?e.label=null:this.type!==p.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var n=this.labels[r];if((e.label==null||n.name===e.label.name)&&(n.kind!=null&&(i||n.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},A.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},A.parseDoStatement=function(e){return this.next(),this.labels.push(Ft),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(p._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(p.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},A.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ft),this.enterScope(0),this.expect(p.parenL),this.type===p.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===p._var||this.type===p._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),(this.type===p._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===p._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=this.isContextual("let"),s=!1,o=this.containsEsc,c=new xt,u=this.start,h=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===p._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===p._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(h.start===u&&!o&&h.type==="Identifier"&&h.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&s&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,c),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))},A.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ct|(i?0:Wt),!1,t)},A.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(p._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},A.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(p.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},A.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(p.braceL),this.labels.push(zr),this.enterScope(0);for(var t,i=!1;this.type!==p.braceR;)if(this.type===p._case||this.type===p._default){var r=this.type===p._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(p.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")},A.parseThrowStatement=function(e){return this.next(),xe.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 Yr=[];A.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?xi:0),this.checkLValPattern(e,t?vi:Le),this.expect(p.parenR),e},A.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===p._catch){var t=this.startNode();this.next(),this.eat(p.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(p._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},A.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},A.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ft),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},A.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")},A.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},A.parseLabeledStatement=function(e,t,i,r){for(var n=0,a=this.labels;n<a.length;n+=1){var s=a[n];s.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===p._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var u=this.labels[c];if(u.statementStart===e.start)u.statementStart=this.start,u.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")},A.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},A.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(p.braceL),e&&this.enterScope(0);this.type!==p.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},A.parseFor=function(e,t){return e.init=t,this.expect(p.semi),e.test=this.type===p.semi?null:this.parseExpression(),this.expect(p.semi),e.update=this.type===p.parenR?null:this.parseExpression(),this.expect(p.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},A.parseForIn=function(e,t){var i=this.type===p._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(p.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},A.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(p.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===p._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&n.id.type!=="Identifier"&&!(t&&(this.type===p._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(p.comma))break}return e},A.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Bt:Le,!1)};var ct=1,Wt=2,bi=4;A.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===p.star&&t&Wt&&this.unexpected(),e.generator=this.eat(p.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&ct&&(e.id=t&bi&&this.type!==p.name?null:this.parseIdent(),e.id&&!(t&Wt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Bt:Le:yi));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ot(e.async,e.generator)),t&ct||(e.id=this.type===p.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,n),this.yieldPos=a,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(e,t&ct?"FunctionDeclaration":"FunctionExpression")},A.parseFunctionParams=function(e){this.expect(p.parenL),e.params=this.parseBindingList(p.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},A.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),n=this.startNode(),a=!1;for(n.body=[],this.expect(p.braceL);this.type!==p.braceR;){var s=this.parseClassElement(e.superClass!==null);s&&(n.body.push(s),s.type==="MethodDefinition"&&s.kind==="constructor"?(a&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),a=!0):s.key&&s.key.type==="PrivateIdentifier"&&Qr(r,s)&&this.raiseRecoverable(s.key.start,"Identifier '#"+s.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},A.parseClassElement=function(e){if(this.eat(p.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",n=!1,a=!1,s="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(p.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===p.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===p.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(t>=9||!a)&&this.eat(p.star)&&(n=!0),!r&&!a&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=c:r=c)}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===p.parenL||s!=="method"||n||a){var u=!i.static&&gt(i,"constructor"),h=u&&e;u&&s!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":s,this.parseClassMethod(i,n,a,h)}else this.parseClassField(i);return i},A.isClassElementNameStart=function(){return this.type===p.name||this.type===p.privateId||this.type===p.num||this.type===p.string||this.type===p.bracketL||this.type.keyword},A.parseClassElementName=function(e){this.type===p.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)},A.parseClassMethod=function(e,t,i,r){var n=e.key;e.kind==="constructor"?(t&&this.raise(n.start,"Constructor can't be a generator"),i&&this.raise(n.start,"Constructor can't be an async method")):e.static&&gt(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},A.parseClassField=function(e){if(gt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&gt(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(p.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")},A.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ot|Lt);this.type!==p.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},A.parseClassId=function(e,t){this.type===p.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Le,!1)):(t===!0&&this.unexpected(),e.id=null)},A.parseClassSuper=function(e){e.superClass=this.eat(p._extends)?this.parseExprSubscripts(null,!1):null},A.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},A.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,n=r===0?null:this.privateNameStack[r-1],a=0;a<i.length;++a){var s=i[a];Ze(t,s.name)||(n?n.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function Qr(e,t){var i=t.key.name,r=e[i],n="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(n=(t.static?"s":"i")+t.kind),r==="iget"&&n==="iset"||r==="iset"&&n==="iget"||r==="sget"&&n==="sset"||r==="sset"&&n==="sget"?(e[i]="true",!1):r?!0:(e[i]=n,!1)}function gt(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}A.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!==p.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},A.parseExport=function(e,t){if(this.next(),this.eat(p.star))return this.parseExportAllDeclaration(e,t);if(this.eat(p._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!==p.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 n=r[i];this.checkUnreserved(n.local),this.checkLocalExport(n.local),n.local.type==="Literal"&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},A.parseExportDeclaration=function(e){return this.parseStatement(null)},A.parseExportDefaultDeclaration=function(){var e;if(this.type===p._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ct|bi,!1,e)}else if(this.type===p._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},A.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ze(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},A.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,n=t.properties;r<n.length;r+=1){var a=n[r];this.checkPatternExport(e,a)}else if(i==="ArrayPattern")for(var s=0,o=t.elements;s<o.length;s+=1){var c=o[s];c&&this.checkPatternExport(e,c)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},A.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var n=r[i];this.checkPatternExport(e,n.id)}},A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},A.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")},A.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(p.braceL);!this.eat(p.braceR);){if(i)i=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;t.push(this.parseExportSpecifier(e))}return t},A.parseImport=function(e){return this.next(),this.type===p.string?(e.specifiers=Yr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===p.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},A.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,Le),this.finishNode(e,"ImportSpecifier")},A.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Le),this.finishNode(e,"ImportDefaultSpecifier")},A.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Le),this.finishNode(e,"ImportNamespaceSpecifier")},A.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===p.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(p.comma)))return e;if(this.type===p.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(p.braceL);!this.eat(p.braceR);){if(t)t=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;e.push(this.parseImportSpecifier())}return e},A.parseWithClause=function(){var e=[];if(!this.eat(p._with))return e;this.expect(p.braceL);for(var t={},i=!0;!this.eat(p.braceR);){if(i)i=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;Ze(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e},A.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===p.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(p.colon),this.type!==p.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===p.string){var e=this.parseLiteral(this.value);return Ur.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},A.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)},A.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 ye=X.prototype;ye.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,n=e.properties;r<n.length;r+=1){var a=n[r];this.toAssignable(a,t),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.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},ye.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];n&&this.toAssignable(n,t)}if(i){var a=e[i-1];this.options.ecmaVersion===6&&t&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return e},ye.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ye.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==p.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ye.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case p.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(p.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case p.braceL:return this.parseObj(!0)}return this.parseIdent()},ye.parseBindingList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(p.comma),t&&this.type===p.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===p.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),n.push(s),this.type===p.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else n.push(this.parseAssignableListItem(r))}return n},ye.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ye.parseBindingListItem=function(e){return e},ye.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(p.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ye.checkLValSimple=function(e,t,i){t===void 0&&(t=mt);var r=t!==mt;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===Le&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ze(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==wi&&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")}},ye.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=mt),e.type){case"ObjectPattern":for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];this.checkLValInnerPattern(a,t,i)}break;case"ArrayPattern":for(var s=0,o=e.elements;s<o.length;s+=1){var c=o[s];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}},ye.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=mt),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 Ee=function(t,i,r,n,a){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!a},U={b_stat:new Ee("{",!1),b_expr:new Ee("{",!0),b_tmpl:new Ee("${",!1),p_stat:new Ee("(",!1),p_expr:new Ee("(",!0),q_tmpl:new Ee("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ee("function",!1),f_expr:new Ee("function",!0),f_expr_gen:new Ee("function",!0,!1,null,!0),f_gen:new Ee("function",!1,!1,null,!0)},et=X.prototype;et.initialContext=function(){return[U.b_stat]},et.curContext=function(){return this.context[this.context.length-1]},et.braceIsBlock=function(e){var t=this.curContext();return t===U.f_expr||t===U.f_stat?!0:e===p.colon&&(t===U.b_stat||t===U.b_expr)?!t.isExpr:e===p._return||e===p.name&&this.exprAllowed?xe.test(this.input.slice(this.lastTokEnd,this.start)):e===p._else||e===p.semi||e===p.eof||e===p.parenR||e===p.arrow?!0:e===p.braceL?t===U.b_stat:e===p._var||e===p._const||e===p.name?!1:!this.exprAllowed},et.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},et.updateContext=function(e){var t,i=this.type;i.keyword&&e===p.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},et.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},p.parenR.updateContext=p.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===U.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},p.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?U.b_stat:U.b_expr),this.exprAllowed=!0},p.dollarBraceL.updateContext=function(){this.context.push(U.b_tmpl),this.exprAllowed=!0},p.parenL.updateContext=function(e){var t=e===p._if||e===p._for||e===p._with||e===p._while;this.context.push(t?U.p_stat:U.p_expr),this.exprAllowed=!0},p.incDec.updateContext=function(){},p._function.updateContext=p._class.updateContext=function(e){e.beforeExpr&&e!==p._else&&!(e===p.semi&&this.curContext()!==U.p_stat)&&!(e===p._return&&xe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===p.colon||e===p.braceL)&&this.curContext()===U.b_stat)?this.context.push(U.f_expr):this.context.push(U.f_stat),this.exprAllowed=!1},p.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},p.backQuote.updateContext=function(){this.curContext()===U.q_tmpl?this.context.pop():this.context.push(U.q_tmpl),this.exprAllowed=!1},p.star.updateContext=function(e){if(e===p._function){var t=this.context.length-1;this.context[t]===U.f_expr?this.context[t]=U.f_expr_gen:this.context[t]=U.f_gen}this.exprAllowed=!0},p.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==p.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var T=X.prototype;T.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,n;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){n==="__proto__"&&a==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}n="$"+n;var s=t[n];if(s){var o;a==="init"?o=this.strict&&s.init||s.get||s.set:o=s.init||s[a],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[a]=!0}},T.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===p.comma){var a=this.startNodeAt(i,r);for(a.expressions=[n];this.eat(p.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return n},T.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,n=-1,a=-1,s=-1;t?(n=t.parenthesizedAssign,a=t.trailingComma,s=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xt,r=!0);var o=this.start,c=this.startLoc;(this.type===p.parenL||this.type===p.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,c)),this.type.isAssign){var h=this.startNodeAt(o,c);return h.operator=this.value,this.type===p.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===p.eq?this.checkLValPattern(u):this.checkLValSimple(u),h.left=u,this.next(),h.right=this.parseMaybeAssign(e),s>-1&&(t.doubleProto=s),this.finishNode(h,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return n>-1&&(t.parenthesizedAssign=n),a>-1&&(t.trailingComma=a),u},T.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(p.question)){var a=this.startNodeAt(i,r);return a.test=n,a.consequent=this.parseMaybeAssign(),this.expect(p.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return n},T.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===i&&n.type==="ArrowFunctionExpression"?n:this.parseExprOp(n,i,r,-1,e)},T.parseExprOp=function(e,t,i,r,n){var a=this.type.binop;if(a!=null&&(!n||this.type!==p._in)&&a>r){var s=this.type===p.logicalOR||this.type===p.logicalAND,o=this.type===p.coalesce;o&&(a=p.logicalAND.binop);var c=this.value;this.next();var u=this.start,h=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),u,h,a,n),l=this.buildBinary(t,i,e,f,c,s||o);return(s&&this.type===p.coalesce||o&&(this.type===p.logicalOR||this.type===p.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(l,t,i,r,n)}return e},T.buildBinary=function(e,t,i,r,n,a){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var s=this.startNodeAt(e,t);return s.left=i,s.operator=n,s.right=r,this.finishNode(s,a?"LogicalExpression":"BinaryExpression")},T.parseMaybeUnary=function(e,t,i,r){var n=this.start,a=this.startLoc,s;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===p.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Si(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&jt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===p.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==p._in&&this.unexpected();else{if(s=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(n,a);u.operator=this.value,u.prefix=!1,u.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(u,"UpdateExpression")}}if(!i&&this.eat(p.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(n,a,s,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return s};function Si(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Si(e.expression)}function jt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&jt(e.expression)||e.type==="ParenthesizedExpression"&&jt(e.expression)}T.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprAtom(e,t);if(n.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return n;var a=this.parseSubscripts(n,i,r,!1,t);return e&&a.type==="MemberExpression"&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},T.parseSubscripts=function(e,t,i,r,n){for(var a=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,s=!1;;){var o=this.parseSubscript(e,t,i,r,a,s,n);if(o.optional&&(s=!0),o===e||o.type==="ArrowFunctionExpression"){if(s){var c=this.startNodeAt(t,i);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},T.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(p.arrow)},T.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},T.parseSubscript=function(e,t,i,r,n,a,s){var o=this.options.ecmaVersion>=11,c=o&&this.eat(p.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(p.bracketL);if(u||c&&this.type!==p.parenL&&this.type!==p.backQuote||this.eat(p.dot)){var h=this.startNodeAt(t,i);h.object=e,u?(h.property=this.parseExpression(),this.expect(p.bracketR)):this.type===p.privateId&&e.type!=="Super"?h.property=this.parsePrivateIdent():h.property=this.parseIdent(this.options.allowReserved!=="never"),h.computed=!!u,o&&(h.optional=c),e=this.finishNode(h,"MemberExpression")}else if(!r&&this.eat(p.parenL)){var f=new xt,l=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(p.parenR,this.options.ecmaVersion>=8,!1,f);if(n&&!c&&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=l,this.awaitPos=d,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(t,i,y,s);this.checkExpressionErrors(f,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var v=this.startNodeAt(t,i);v.callee=e,v.arguments=y,o&&(v.optional=c),e=this.finishNode(v,"CallExpression")}else if(this.type===p.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var b=this.startNodeAt(t,i);b.tag=e,b.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(b,"TaggedTemplateExpression")}return e},T.parseExprAtom=function(e,t,i){this.type===p.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case p._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===p.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==p.dot&&this.type!==p.bracketL&&this.type!==p.parenL&&this.unexpected(),this.finishNode(r,"Super");case p._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case p.name:var a=this.start,s=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(p._function))return this.overrideContext(U.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(p.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===p.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(p.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[c],!0,t)}return c;case p.regexp:var u=this.value;return r=this.parseLiteral(u.value),r.regex={pattern:u.pattern,flags:u.flags},r;case p.num:case p.string:return this.parseLiteral(this.value);case p._null:case p._true:case p._false:return r=this.startNode(),r.value=this.type===p._null?null:this.type===p._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case p.parenL:var h=this.start,f=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),f;case p.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(p.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case p.braceL:return this.overrideContext(U.b_expr),this.parseObj(!1,e);case p._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case p._class:return this.parseClass(this.startNode(),!1);case p._new:return this.parseNew();case p.backQuote:return this.parseTemplate();case p._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},T.parseExprAtomDefault=function(){this.unexpected()},T.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===p.parenL&&!e)return this.parseDynamicImport(t);if(this.type===p.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()},T.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(p.parenR)?e.options=null:(this.expect(p.comma),this.afterTrailingComma(p.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(p.parenR)||(this.expect(p.comma),this.afterTrailingComma(p.parenR)||this.unexpected())));else if(!this.eat(p.parenR)){var t=this.start;this.eat(p.comma)&&this.eat(p.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},T.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")},T.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")},T.parseParenExpression=function(){this.expect(p.parenL);var e=this.parseExpression();return this.expect(p.parenR),e},T.shouldParseArrow=function(e){return!this.canInsertSemicolon()},T.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,n,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s=this.start,o=this.startLoc,c=[],u=!0,h=!1,f=new xt,l=this.yieldPos,d=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==p.parenR;)if(u?u=!1:this.expect(p.comma),a&&this.afterTrailingComma(p.parenR,!0)){h=!0;break}else if(this.type===p.ellipsis){g=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===p.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(p.parenR),e&&this.shouldParseArrow(c)&&this.eat(p.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=l,this.awaitPos=d,this.parseParenArrowList(i,r,c,t);(!c.length||h)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(f,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=d||this.awaitPos,c.length>1?(n=this.startNodeAt(s,o),n.expressions=c,this.finishNodeAt(n,"SequenceExpression",y,v)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(i,r);return b.expression=n,this.finishNode(b,"ParenthesizedExpression")}else return n},T.parseParenItem=function(e){return e},T.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Xr=[];T.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===p.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,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,n,!0,!1),this.eat(p.parenL)?e.arguments=this.parseExprList(p.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Xr,this.finishNode(e,"NewExpression")},T.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===p.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
18
+ (function(Re,nt){typeof exports=="object"&&typeof module<"u"?nt(exports):typeof define=="function"&&define.amd?define(["exports"],nt):(Re=typeof globalThis<"u"?globalThis:Re||self,nt(Re.PineTSLib={}))})(this,(function(Re){"use strict";var nt=[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],si=[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],Or="\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",ai="\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",At={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"},Pt="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",Mr={5:Pt,"5module":Pt+" export import",6:Pt+" const class extends export import super"},Br=/^in(stanceof)?$/,Fr=new RegExp("["+ai+"]"),Wr=new RegExp("["+ai+Or+"]");function Tt(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 De(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Fr.test(String.fromCharCode(e)):t===!1?!1:Tt(e,si)}function Qe(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&&Wr.test(String.fromCharCode(e)):t===!1?!1:Tt(e,si)||Tt(e,nt)}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 de(e,t){return new O(e,{beforeExpr:!0,binop:t})}var me={beforeExpr:!0},ue={startsExpr:!0},Rt={};function L(e,t){return t===void 0&&(t={}),t.keyword=e,Rt[e]=new O(e,t)}var p={num:new O("num",ue),regexp:new O("regexp",ue),string:new O("string",ue),name:new O("name",ue),privateId:new O("privateId",ue),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(",",me),semi:new O(";",me),colon:new O(":",me),dot:new O("."),question:new O("?",me),questionDot:new O("?."),arrow:new O("=>",me),template:new O("template"),invalidTemplate:new O("invalidTemplate"),ellipsis:new O("...",me),backQuote:new O("`",ue),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:de("||",1),logicalAND:de("&&",2),bitwiseOR:de("|",3),bitwiseXOR:de("^",4),bitwiseAND:de("&",5),equality:de("==/!=/===/!==",6),relational:de("</>/<=/>=",7),bitShift:de("<</>>/>>>",8),plusMin:new O("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:de("%",10),star:de("*",10),slash:de("/",10),starstar:new O("**",{beforeExpr:!0}),coalesce:de("??",1),_break:L("break"),_case:L("case",me),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",me),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",me),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",ue),_if:L("if"),_return:L("return",me),_switch:L("switch"),_throw:L("throw",me),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",ue),_super:L("super",ue),_class:L("class",ue),_extends:L("extends",me),_export:L("export"),_import:L("import",ue),_null:L("null",ue),_true:L("true",ue),_false:L("false",ue),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},xe=/\r\n?|\n|\u2028|\u2029/,jr=new RegExp(xe.source,"g");function Xe(e){return e===10||e===13||e===8232||e===8233}function oi(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(Xe(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ci=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ui=Object.prototype,$r=ui.hasOwnProperty,qr=ui.toString,Ze=Object.hasOwn||(function(e,t){return $r.call(e,t)}),hi=Array.isArray||(function(e){return qr.call(e)==="[object Array]"}),li=Object.create(null);function Me(e){return li[e]||(li[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Ve(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Ur=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,st=function(t,i){this.line=t,this.column=i};st.prototype.offset=function(t){return new st(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 pi(e,t){for(var i=1,r=0;;){var n=oi(e,r,t);if(n<0)return new st(i,t-r);++i,r=n}}var Dt={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},fi=!1;function Hr(e){var t={};for(var i in Dt)t[i]=e&&Ze(e,i)?e[i]:Dt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!fi&&typeof console=="object"&&console.warn&&(fi=!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),hi(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}return hi(t.onComment)&&(t.onComment=Kr(t,t.onComment)),t}function Kr(e,t){return function(i,r,n,a,s,o){var c={type:i?"Block":"Line",value:r,start:n,end:a};e.locations&&(c.loc=new dt(this,s,o)),e.ranges&&(c.range=[n,a]),t.push(c)}}var at=1,Je=2,Vt=4,di=8,mi=16,xi=32,Lt=64,gi=128,ot=256,Ot=at|Je|ot;function Mt(e,t){return Je|(e?Vt:0)|(t?di:0)}var mt=0,Bt=1,Le=2,yi=3,vi=4,wi=5,Q=function(t,i,r){this.options=t=Hr(t),this.sourceFile=t.sourceFile,this.keywords=Me(Mr[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=At[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=Me(n);var a=(n?n+" ":"")+At.strict;this.reservedWordsStrict=Me(a),this.reservedWordsStrictBind=Me(a+" "+At.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(xe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=p.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(at),this.regexpState=null,this.privateNameStack=[]},ke={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}};Q.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},ke.inFunction.get=function(){return(this.currentVarScope().flags&Je)>0},ke.inGenerator.get=function(){return(this.currentVarScope().flags&di)>0&&!this.currentVarScope().inClassFieldInit},ke.inAsync.get=function(){return(this.currentVarScope().flags&Vt)>0&&!this.currentVarScope().inClassFieldInit},ke.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&ot)return!1;if(t.flags&Je)return(t.flags&Vt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ke.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Lt)>0||i||this.options.allowSuperOutsideMethod},ke.allowDirectSuper.get=function(){return(this.currentThisScope().flags&gi)>0},ke.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ke.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Je|ot))>0||i},ke.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ot)>0},Q.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,n=0;n<t.length;n++)r=t[n](r);return r},Q.parse=function(t,i){return new this(i,t).parse()},Q.parseExpressionAt=function(t,i,r){var n=new this(r,t,i);return n.nextToken(),n.parseExpression()},Q.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(Q.prototype,ke);var re=Q.prototype,Gr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;re.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){ge.lastIndex=e,e+=ge.exec(this.input)[0].length;var t=Gr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){ge.lastIndex=e+t[0].length;var i=ge.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||xe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,ge.lastIndex=e,e+=ge.exec(this.input)[0].length,this.input[e]===";"&&e++}},re.eat=function(e){return this.type===e?(this.next(),!0):!1},re.isContextual=function(e){return this.type===p.name&&this.value===e&&!this.containsEsc},re.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},re.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},re.canInsertSemicolon=function(){return this.type===p.eof||this.type===p.braceR||xe.test(this.input.slice(this.lastTokEnd,this.start))},re.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},re.semicolon=function(){!this.eat(p.semi)&&!this.insertSemicolon()&&this.unexpected()},re.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},re.expect=function(e){this.eat(e)||this.unexpected()},re.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};re.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")}},re.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")},re.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")},re.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var A=Q.prototype;A.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==p.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,n=Object.keys(this.undefinedExports);r<n.length;r+=1){var a=n[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ft={kind:"loop"},zr={kind:"switch"};A.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ge.lastIndex=this.pos;var t=ge.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(De(r,!0)){for(var n=i+1;Qe(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(i,n);if(!Br.test(a))return!0}return!1},A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ge.lastIndex=this.pos;var e=ge.exec(this.input),t=this.pos+e[0].length,i;return!xe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Qe(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))},A.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),a;switch(this.isLet(e)&&(r=p._var,a="let"),r){case p._break:case p._continue:return this.parseBreakContinueStatement(n,r.keyword);case p._debugger:return this.parseDebuggerStatement(n);case p._do:return this.parseDoStatement(n);case p._for:return this.parseForStatement(n);case p._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case p._class:return e&&this.unexpected(),this.parseClass(n,!0);case p._if:return this.parseIfStatement(n);case p._return:return this.parseReturnStatement(n);case p._switch:return this.parseSwitchStatement(n);case p._throw:return this.parseThrowStatement(n);case p._try:return this.parseTryStatement(n);case p._const:case p._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(n,a);case p._while:return this.parseWhileStatement(n);case p._with:return this.parseWithStatement(n);case p.braceL:return this.parseBlock(!0,n);case p.semi:return this.parseEmptyStatement(n);case p._export:case p._import:if(this.options.ecmaVersion>10&&r===p._import){ge.lastIndex=this.pos;var s=ge.exec(this.input),o=this.pos+s[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(n,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===p._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var u=this.value,h=this.parseExpression();return r===p.name&&h.type==="Identifier"&&this.eat(p.colon)?this.parseLabeledStatement(n,u,h,e):this.parseExpressionStatement(n,h)}},A.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(p.semi)||this.insertSemicolon()?e.label=null:this.type!==p.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var n=this.labels[r];if((e.label==null||n.name===e.label.name)&&(n.kind!=null&&(i||n.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},A.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},A.parseDoStatement=function(e){return this.next(),this.labels.push(Ft),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(p._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(p.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},A.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ft),this.enterScope(0),this.expect(p.parenL),this.type===p.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===p._var||this.type===p._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),(this.type===p._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===p._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=this.isContextual("let"),s=!1,o=this.containsEsc,c=new xt,u=this.start,h=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===p._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===p._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(h.start===u&&!o&&h.type==="Identifier"&&h.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&s&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,c),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))},A.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ct|(i?0:Wt),!1,t)},A.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(p._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},A.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(p.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},A.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(p.braceL),this.labels.push(zr),this.enterScope(0);for(var t,i=!1;this.type!==p.braceR;)if(this.type===p._case||this.type===p._default){var r=this.type===p._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(p.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")},A.parseThrowStatement=function(e){return this.next(),xe.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 Yr=[];A.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?xi:0),this.checkLValPattern(e,t?vi:Le),this.expect(p.parenR),e},A.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===p._catch){var t=this.startNode();this.next(),this.eat(p.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(p._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},A.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},A.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ft),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},A.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")},A.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},A.parseLabeledStatement=function(e,t,i,r){for(var n=0,a=this.labels;n<a.length;n+=1){var s=a[n];s.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===p._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var u=this.labels[c];if(u.statementStart===e.start)u.statementStart=this.start,u.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")},A.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},A.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(p.braceL),e&&this.enterScope(0);this.type!==p.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},A.parseFor=function(e,t){return e.init=t,this.expect(p.semi),e.test=this.type===p.semi?null:this.parseExpression(),this.expect(p.semi),e.update=this.type===p.parenR?null:this.parseExpression(),this.expect(p.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},A.parseForIn=function(e,t){var i=this.type===p._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(p.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},A.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(p.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===p._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&n.id.type!=="Identifier"&&!(t&&(this.type===p._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(p.comma))break}return e},A.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Bt:Le,!1)};var ct=1,Wt=2,bi=4;A.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===p.star&&t&Wt&&this.unexpected(),e.generator=this.eat(p.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&ct&&(e.id=t&bi&&this.type!==p.name?null:this.parseIdent(),e.id&&!(t&Wt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Bt:Le:yi));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Mt(e.async,e.generator)),t&ct||(e.id=this.type===p.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,n),this.yieldPos=a,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(e,t&ct?"FunctionDeclaration":"FunctionExpression")},A.parseFunctionParams=function(e){this.expect(p.parenL),e.params=this.parseBindingList(p.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},A.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),n=this.startNode(),a=!1;for(n.body=[],this.expect(p.braceL);this.type!==p.braceR;){var s=this.parseClassElement(e.superClass!==null);s&&(n.body.push(s),s.type==="MethodDefinition"&&s.kind==="constructor"?(a&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),a=!0):s.key&&s.key.type==="PrivateIdentifier"&&Qr(r,s)&&this.raiseRecoverable(s.key.start,"Identifier '#"+s.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},A.parseClassElement=function(e){if(this.eat(p.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",n=!1,a=!1,s="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(p.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===p.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===p.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(t>=9||!a)&&this.eat(p.star)&&(n=!0),!r&&!a&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=c:r=c)}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===p.parenL||s!=="method"||n||a){var u=!i.static&&gt(i,"constructor"),h=u&&e;u&&s!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":s,this.parseClassMethod(i,n,a,h)}else this.parseClassField(i);return i},A.isClassElementNameStart=function(){return this.type===p.name||this.type===p.privateId||this.type===p.num||this.type===p.string||this.type===p.bracketL||this.type.keyword},A.parseClassElementName=function(e){this.type===p.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)},A.parseClassMethod=function(e,t,i,r){var n=e.key;e.kind==="constructor"?(t&&this.raise(n.start,"Constructor can't be a generator"),i&&this.raise(n.start,"Constructor can't be an async method")):e.static&&gt(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},A.parseClassField=function(e){if(gt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&gt(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(p.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")},A.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ot|Lt);this.type!==p.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},A.parseClassId=function(e,t){this.type===p.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Le,!1)):(t===!0&&this.unexpected(),e.id=null)},A.parseClassSuper=function(e){e.superClass=this.eat(p._extends)?this.parseExprSubscripts(null,!1):null},A.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},A.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,n=r===0?null:this.privateNameStack[r-1],a=0;a<i.length;++a){var s=i[a];Ze(t,s.name)||(n?n.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function Qr(e,t){var i=t.key.name,r=e[i],n="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(n=(t.static?"s":"i")+t.kind),r==="iget"&&n==="iset"||r==="iset"&&n==="iget"||r==="sget"&&n==="sset"||r==="sset"&&n==="sget"?(e[i]="true",!1):r?!0:(e[i]=n,!1)}function gt(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}A.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!==p.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},A.parseExport=function(e,t){if(this.next(),this.eat(p.star))return this.parseExportAllDeclaration(e,t);if(this.eat(p._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!==p.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 n=r[i];this.checkUnreserved(n.local),this.checkLocalExport(n.local),n.local.type==="Literal"&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},A.parseExportDeclaration=function(e){return this.parseStatement(null)},A.parseExportDefaultDeclaration=function(){var e;if(this.type===p._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ct|bi,!1,e)}else if(this.type===p._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},A.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ze(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},A.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,n=t.properties;r<n.length;r+=1){var a=n[r];this.checkPatternExport(e,a)}else if(i==="ArrayPattern")for(var s=0,o=t.elements;s<o.length;s+=1){var c=o[s];c&&this.checkPatternExport(e,c)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},A.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var n=r[i];this.checkPatternExport(e,n.id)}},A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},A.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")},A.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(p.braceL);!this.eat(p.braceR);){if(i)i=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;t.push(this.parseExportSpecifier(e))}return t},A.parseImport=function(e){return this.next(),this.type===p.string?(e.specifiers=Yr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===p.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},A.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,Le),this.finishNode(e,"ImportSpecifier")},A.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Le),this.finishNode(e,"ImportDefaultSpecifier")},A.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Le),this.finishNode(e,"ImportNamespaceSpecifier")},A.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===p.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(p.comma)))return e;if(this.type===p.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(p.braceL);!this.eat(p.braceR);){if(t)t=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;e.push(this.parseImportSpecifier())}return e},A.parseWithClause=function(){var e=[];if(!this.eat(p._with))return e;this.expect(p.braceL);for(var t={},i=!0;!this.eat(p.braceR);){if(i)i=!1;else if(this.expect(p.comma),this.afterTrailingComma(p.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;Ze(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e},A.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===p.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(p.colon),this.type!==p.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===p.string){var e=this.parseLiteral(this.value);return Ur.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},A.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)},A.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 ye=Q.prototype;ye.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,n=e.properties;r<n.length;r+=1){var a=n[r];this.toAssignable(a,t),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.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},ye.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];n&&this.toAssignable(n,t)}if(i){var a=e[i-1];this.options.ecmaVersion===6&&t&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return e},ye.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ye.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==p.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ye.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case p.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(p.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case p.braceL:return this.parseObj(!0)}return this.parseIdent()},ye.parseBindingList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(p.comma),t&&this.type===p.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===p.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),n.push(s),this.type===p.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else n.push(this.parseAssignableListItem(r))}return n},ye.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ye.parseBindingListItem=function(e){return e},ye.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(p.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ye.checkLValSimple=function(e,t,i){t===void 0&&(t=mt);var r=t!==mt;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===Le&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ze(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==wi&&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")}},ye.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=mt),e.type){case"ObjectPattern":for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];this.checkLValInnerPattern(a,t,i)}break;case"ArrayPattern":for(var s=0,o=e.elements;s<o.length;s+=1){var c=o[s];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}},ye.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=mt),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 Ee=function(t,i,r,n,a){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!a},U={b_stat:new Ee("{",!1),b_expr:new Ee("{",!0),b_tmpl:new Ee("${",!1),p_stat:new Ee("(",!1),p_expr:new Ee("(",!0),q_tmpl:new Ee("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ee("function",!1),f_expr:new Ee("function",!0),f_expr_gen:new Ee("function",!0,!1,null,!0),f_gen:new Ee("function",!1,!1,null,!0)},et=Q.prototype;et.initialContext=function(){return[U.b_stat]},et.curContext=function(){return this.context[this.context.length-1]},et.braceIsBlock=function(e){var t=this.curContext();return t===U.f_expr||t===U.f_stat?!0:e===p.colon&&(t===U.b_stat||t===U.b_expr)?!t.isExpr:e===p._return||e===p.name&&this.exprAllowed?xe.test(this.input.slice(this.lastTokEnd,this.start)):e===p._else||e===p.semi||e===p.eof||e===p.parenR||e===p.arrow?!0:e===p.braceL?t===U.b_stat:e===p._var||e===p._const||e===p.name?!1:!this.exprAllowed},et.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},et.updateContext=function(e){var t,i=this.type;i.keyword&&e===p.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},et.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},p.parenR.updateContext=p.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===U.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},p.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?U.b_stat:U.b_expr),this.exprAllowed=!0},p.dollarBraceL.updateContext=function(){this.context.push(U.b_tmpl),this.exprAllowed=!0},p.parenL.updateContext=function(e){var t=e===p._if||e===p._for||e===p._with||e===p._while;this.context.push(t?U.p_stat:U.p_expr),this.exprAllowed=!0},p.incDec.updateContext=function(){},p._function.updateContext=p._class.updateContext=function(e){e.beforeExpr&&e!==p._else&&!(e===p.semi&&this.curContext()!==U.p_stat)&&!(e===p._return&&xe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===p.colon||e===p.braceL)&&this.curContext()===U.b_stat)?this.context.push(U.f_expr):this.context.push(U.f_stat),this.exprAllowed=!1},p.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},p.backQuote.updateContext=function(){this.curContext()===U.q_tmpl?this.context.pop():this.context.push(U.q_tmpl),this.exprAllowed=!1},p.star.updateContext=function(e){if(e===p._function){var t=this.context.length-1;this.context[t]===U.f_expr?this.context[t]=U.f_expr_gen:this.context[t]=U.f_gen}this.exprAllowed=!0},p.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==p.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var T=Q.prototype;T.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,n;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){n==="__proto__"&&a==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}n="$"+n;var s=t[n];if(s){var o;a==="init"?o=this.strict&&s.init||s.get||s.set:o=s.init||s[a],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[a]=!0}},T.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===p.comma){var a=this.startNodeAt(i,r);for(a.expressions=[n];this.eat(p.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return n},T.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,n=-1,a=-1,s=-1;t?(n=t.parenthesizedAssign,a=t.trailingComma,s=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xt,r=!0);var o=this.start,c=this.startLoc;(this.type===p.parenL||this.type===p.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,c)),this.type.isAssign){var h=this.startNodeAt(o,c);return h.operator=this.value,this.type===p.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===p.eq?this.checkLValPattern(u):this.checkLValSimple(u),h.left=u,this.next(),h.right=this.parseMaybeAssign(e),s>-1&&(t.doubleProto=s),this.finishNode(h,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return n>-1&&(t.parenthesizedAssign=n),a>-1&&(t.trailingComma=a),u},T.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(p.question)){var a=this.startNodeAt(i,r);return a.test=n,a.consequent=this.parseMaybeAssign(),this.expect(p.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return n},T.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===i&&n.type==="ArrowFunctionExpression"?n:this.parseExprOp(n,i,r,-1,e)},T.parseExprOp=function(e,t,i,r,n){var a=this.type.binop;if(a!=null&&(!n||this.type!==p._in)&&a>r){var s=this.type===p.logicalOR||this.type===p.logicalAND,o=this.type===p.coalesce;o&&(a=p.logicalAND.binop);var c=this.value;this.next();var u=this.start,h=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),u,h,a,n),l=this.buildBinary(t,i,e,f,c,s||o);return(s&&this.type===p.coalesce||o&&(this.type===p.logicalOR||this.type===p.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(l,t,i,r,n)}return e},T.buildBinary=function(e,t,i,r,n,a){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var s=this.startNodeAt(e,t);return s.left=i,s.operator=n,s.right=r,this.finishNode(s,a?"LogicalExpression":"BinaryExpression")},T.parseMaybeUnary=function(e,t,i,r){var n=this.start,a=this.startLoc,s;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===p.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Si(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&jt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===p.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==p._in&&this.unexpected();else{if(s=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(n,a);u.operator=this.value,u.prefix=!1,u.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(u,"UpdateExpression")}}if(!i&&this.eat(p.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(n,a,s,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return s};function Si(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Si(e.expression)}function jt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&jt(e.expression)||e.type==="ParenthesizedExpression"&&jt(e.expression)}T.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprAtom(e,t);if(n.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return n;var a=this.parseSubscripts(n,i,r,!1,t);return e&&a.type==="MemberExpression"&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},T.parseSubscripts=function(e,t,i,r,n){for(var a=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,s=!1;;){var o=this.parseSubscript(e,t,i,r,a,s,n);if(o.optional&&(s=!0),o===e||o.type==="ArrowFunctionExpression"){if(s){var c=this.startNodeAt(t,i);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},T.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(p.arrow)},T.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},T.parseSubscript=function(e,t,i,r,n,a,s){var o=this.options.ecmaVersion>=11,c=o&&this.eat(p.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(p.bracketL);if(u||c&&this.type!==p.parenL&&this.type!==p.backQuote||this.eat(p.dot)){var h=this.startNodeAt(t,i);h.object=e,u?(h.property=this.parseExpression(),this.expect(p.bracketR)):this.type===p.privateId&&e.type!=="Super"?h.property=this.parsePrivateIdent():h.property=this.parseIdent(this.options.allowReserved!=="never"),h.computed=!!u,o&&(h.optional=c),e=this.finishNode(h,"MemberExpression")}else if(!r&&this.eat(p.parenL)){var f=new xt,l=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(p.parenR,this.options.ecmaVersion>=8,!1,f);if(n&&!c&&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=l,this.awaitPos=d,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(t,i,y,s);this.checkExpressionErrors(f,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var v=this.startNodeAt(t,i);v.callee=e,v.arguments=y,o&&(v.optional=c),e=this.finishNode(v,"CallExpression")}else if(this.type===p.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var b=this.startNodeAt(t,i);b.tag=e,b.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(b,"TaggedTemplateExpression")}return e},T.parseExprAtom=function(e,t,i){this.type===p.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case p._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===p.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==p.dot&&this.type!==p.bracketL&&this.type!==p.parenL&&this.unexpected(),this.finishNode(r,"Super");case p._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case p.name:var a=this.start,s=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(p._function))return this.overrideContext(U.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(p.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===p.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(p.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[c],!0,t)}return c;case p.regexp:var u=this.value;return r=this.parseLiteral(u.value),r.regex={pattern:u.pattern,flags:u.flags},r;case p.num:case p.string:return this.parseLiteral(this.value);case p._null:case p._true:case p._false:return r=this.startNode(),r.value=this.type===p._null?null:this.type===p._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case p.parenL:var h=this.start,f=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),f;case p.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(p.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case p.braceL:return this.overrideContext(U.b_expr),this.parseObj(!1,e);case p._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case p._class:return this.parseClass(this.startNode(),!1);case p._new:return this.parseNew();case p.backQuote:return this.parseTemplate();case p._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},T.parseExprAtomDefault=function(){this.unexpected()},T.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===p.parenL&&!e)return this.parseDynamicImport(t);if(this.type===p.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()},T.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(p.parenR)?e.options=null:(this.expect(p.comma),this.afterTrailingComma(p.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(p.parenR)||(this.expect(p.comma),this.afterTrailingComma(p.parenR)||this.unexpected())));else if(!this.eat(p.parenR)){var t=this.start;this.eat(p.comma)&&this.eat(p.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},T.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")},T.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")},T.parseParenExpression=function(){this.expect(p.parenL);var e=this.parseExpression();return this.expect(p.parenR),e},T.shouldParseArrow=function(e){return!this.canInsertSemicolon()},T.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,n,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s=this.start,o=this.startLoc,c=[],u=!0,h=!1,f=new xt,l=this.yieldPos,d=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==p.parenR;)if(u?u=!1:this.expect(p.comma),a&&this.afterTrailingComma(p.parenR,!0)){h=!0;break}else if(this.type===p.ellipsis){g=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===p.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(p.parenR),e&&this.shouldParseArrow(c)&&this.eat(p.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=l,this.awaitPos=d,this.parseParenArrowList(i,r,c,t);(!c.length||h)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(f,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=d||this.awaitPos,c.length>1?(n=this.startNodeAt(s,o),n.expressions=c,this.finishNodeAt(n,"SequenceExpression",y,v)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(i,r);return b.expression=n,this.finishNode(b,"ParenthesizedExpression")}else return n},T.parseParenItem=function(e){return e},T.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Xr=[];T.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===p.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,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,n,!0,!1),this.eat(p.parenL)?e.arguments=this.parseExprList(p.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Xr,this.finishNode(e,"NewExpression")},T.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===p.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===p.backQuote,this.finishNode(i,"TemplateElement")},T.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===p.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(p.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(p.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},T.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===p.name||this.type===p.num||this.type===p.string||this.type===p.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===p.star)&&!xe.test(this.input.slice(this.lastTokEnd,this.start))},T.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(p.braceR);){if(r)r=!1;else if(this.expect(p.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(p.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,n,t),i.properties.push(a)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},T.parseProperty=function(e,t){var i=this.startNode(),r,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(p.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===p.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===p.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)&&(a=this.start,s=this.startLoc),e||(r=this.eat(p.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(p.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,a,s,t,o),this.finishNode(i,"Property")},T.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")},T.parsePropertyValue=function(e,t,i,r,n,a,s,o){(i||r)&&this.type===p.colon&&this.unexpected(),this.eat(p.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===p.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!==p.comma&&this.type!==p.braceR&&this.type!==p.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=n),e.kind="init",t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===p.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()},T.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(p.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(p.bracketR),e.key;e.computed=!1}return e.key=this.type===p.num||this.type===p.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},T.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},T.parseMethod=function(e,t,i){var r=this.startNode(),n=this.yieldPos,a=this.awaitPos,s=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(Ot(t,r.generator)|Lt|(i?gi:0)),this.expect(p.parenL),r.params=this.parseBindingList(p.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(r,"FunctionExpression")},T.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(Ot(i,!1)|mi),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=n,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(e,"ArrowFunctionExpression")},T.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==p.braceL,a=this.strict,s=!1;if(n)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||o)&&(s=this.strictDirective(this.end),s&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],s&&(this.strict=!0),this.checkParams(e,!a&&!s&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,wi),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},T.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},T.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var a=n[r];this.checkLValInnerPattern(a,Bt,t?null:i)}},T.parseExprList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(p.comma),t&&this.afterTrailingComma(e))break;var s=void 0;i&&this.type===p.comma?s=null:this.type===p.ellipsis?(s=this.parseSpread(r),r&&this.type===p.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),n.push(s)}return n},T.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 n=this.strict?this.reservedWordsStrict:this.reservedWords;n.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"))}},T.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},T.parseIdentNode=function(){var e=this.startNode();return this.type===p.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=p.name):this.unexpected(),e},T.parsePrivateIdent=function(){var e=this.startNode();return this.type===p.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},T.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===p.semi||this.canInsertSemicolon()||this.type!==p.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(p.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},T.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 yt=X.prototype;yt.raise=function(e,t){var i=pi(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},yt.raiseRecoverable=yt.raise,yt.curPosition=function(){if(this.options.locations)return new st(this.curLine,this.pos-this.lineStart)};var Be=X.prototype,Zr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Be.enterScope=function(e){this.scopeStack.push(new Zr(e))},Be.exitScope=function(){this.scopeStack.pop()},Be.treatFunctionsAsVarInScope=function(e){return e.flags&Je||!this.inModule&&e.flags&at},Be.declareName=function(e,t,i){var r=!1;if(t===Le){var n=this.currentScope();r=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&at&&delete this.undefinedExports[e]}else if(t===vi){var a=this.currentScope();a.lexical.push(e)}else if(t===yi){var s=this.currentScope();this.treatFunctionsAsVar?r=s.lexical.indexOf(e)>-1:r=s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var c=this.scopeStack[o];if(c.lexical.indexOf(e)>-1&&!(c.flags&xi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&at&&delete this.undefinedExports[e],c.flags&Mt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Be.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Be.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Be.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Mt)return t}},Be.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Mt&&!(t.flags&mi))return t}};var vt=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])},ut=X.prototype;ut.startNode=function(){return new vt(this,this.start,this.startLoc)},ut.startNodeAt=function(e,t){return new vt(this,e,t)};function Ei(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}ut.finishNode=function(e,t){return Ei.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ut.finishNodeAt=function(e,t,i,r){return Ei.call(this,e,t,i,r)},ut.copyNode=function(e){var t=new vt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Jr="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",_i="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",Ni=_i+" Extended_Pictographic",Ii=Ni,Ci=Ii+" EBase EComp EMod EPres ExtPict",ki=Ci,en=ki,tn={9:_i,10:Ni,11:Ii,12:Ci,13:ki,14:en},rn="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",nn={9:"",10:"",11:"",12:"",13:"",14:rn},Ai="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",Pi="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",Ti=Pi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ri=Ti+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Di=Ri+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Vi=Di+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",sn=Vi+" "+Jr,an={9:Pi,10:Ti,11:Ri,12:Di,13:Vi,14:sn},Li={};function on(e){var t=Li[e]={binary:Oe(tn[e]+" "+Ai),binaryOfStrings:Oe(nn[e]),nonBinary:{General_Category:Oe(Ai),Script:Oe(an[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 $t=0,Mi=[9,10,11,12,13,14];$t<Mi.length;$t+=1){var cn=Mi[$t];on(cn)}var C=X.prototype,wt=function(t,i){this.parent=t,this.base=i||this};wt.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},wt.prototype.sibling=function(){return new wt(this.parent,this.base)};var Ae=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=Li[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};Ae.prototype.reset=function(t,i,r){var n=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)},Ae.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Ae.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return-1;var a=r.charCodeAt(t);if(!(i||this.switchU)||a<=55295||a>=57344||t+1>=n)return a;var s=r.charCodeAt(t+1);return s>=56320&&s<=57343?(a<<10)+s-56613888:a},Ae.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return n;var a=r.charCodeAt(t),s;return!(i||this.switchU)||a<=55295||a>=57344||t+1>=n||(s=r.charCodeAt(t+1))<56320||s>57343?t+1:t+2},Ae.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Ae.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Ae.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Ae.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Ae.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,n=0,a=t;n<a.length;n+=1){var s=a[n],o=this.at(r,i);if(o===-1||o!==s)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0},C.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,n=!1,a=0;a<i.length;a++){var s=i.charAt(a);t.indexOf(s)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(s,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),s==="u"&&(r=!0),s==="v"&&(n=!0)}this.options.ecmaVersion>=15&&r&&n&&this.raise(e.start,"Invalid regular expression flag")};function un(e){for(var t in e)return!0;return!1}C.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&un(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},C.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")}},C.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new wt(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")},C.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},C.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},C.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},C.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},C.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},C.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,n=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return n!==-1&&n<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},C.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)},C.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},C.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 n=0;n<i.length;n++){var a=i.charAt(n);i.indexOf(a,n+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var s=this.regexp_eatModifiers(e);!i&&!s&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<s.length;o++){var c=s.charAt(o);(s.indexOf(c,o+1)>-1||i.indexOf(c)>-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},C.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},C.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&hn(i);)t+=Ve(i),e.advance();return t};function hn(e){return e===105||e===109||e===115}C.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)},C.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},C.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Oi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Oi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}C.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Oi(i);)e.advance();return e.pos!==t},C.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},C.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,n=i;r<n.length;r+=1){var a=n[r];a.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}},C.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},C.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Ve(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Ve(e.lastIntValue);return!0}return!1},C.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),ln(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function ln(e){return De(e,!0)||e===36||e===95}C.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),pn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function pn(e){return Qe(e,!0)||e===36||e===95||e===8204||e===8205}C.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)},C.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},C.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},C.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)},C.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},C.regexp_eatZero=function(e){return e.current()===48&&!bt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},C.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},C.regexp_eatControlLetter=function(e){var t=e.current();return Bi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Bi(e){return e>=65&&e<=90||e>=97&&e<=122}C.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 n=e.lastIntValue;if(r&&n>=55296&&n<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=(n-55296)*1024+(s-56320)+65536,!0}e.pos=a,e.lastIntValue=n}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&fn(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function fn(e){return e>=0&&e<=1114111}C.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},C.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 Fi=0,Me=1,ve=2;C.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(dn(t))return e.lastIntValue=-1,e.advance(),Me;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===ve&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Fi};function dn(e){return e===100||e===68||e===115||e===83||e===119||e===87}C.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),Me}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return Fi},C.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ze(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},C.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Me;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ve;e.raise("Invalid property name")},C.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Wi(t=e.current());)e.lastStringValue+=Ve(t),e.advance();return e.lastStringValue!==""};function Wi(e){return Bi(e)||e===95}C.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";mn(t=e.current());)e.lastStringValue+=Ve(t),e.advance();return e.lastStringValue!==""};function mn(e){return Wi(e)||bt(e)}C.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},C.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===ve&&e.raise("Negated character class may contain strings"),!0}return!1},C.regexp_classContents=function(e){return e.current()===93?Me:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Me)},C.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")}}},C.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||qi(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},C.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)},C.regexp_classSetExpression=function(e){var t=Me,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ve&&(t=ve);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ve&&(t=Me);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===ve&&(t=ve)}},C.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},C.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Me:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},C.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===ve&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;e.pos=t}return null},C.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},C.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ve&&(t=ve);return t},C.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Me:ve},C.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()&&xn(i)||gn(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function xn(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 gn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}C.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return yn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function yn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}C.regexp_eatClassControlLetter=function(e){var t=e.current();return bt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},C.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},C.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;bt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function bt(e){return e>=48&&e<=57}C.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ji(i=e.current());)e.lastIntValue=16*e.lastIntValue+$i(i),e.advance();return e.pos!==t};function ji(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function $i(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}C.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},C.regexp_eatOctalDigit=function(e){var t=e.current();return qi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function qi(e){return e>=48&&e<=55}C.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!ji(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+$i(n),e.advance()}return!0};var qt=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])},V=X.prototype;V.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 qt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},V.getToken=function(){return this.next(),new qt(this)},typeof Symbol<"u"&&(V[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===p.eof,value:t}}}}),V.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(p.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},V.readToken=function(e){return De(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},V.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},V.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,n=t;(r=oi(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},V.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&&!Xe(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())},V.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&&ci.test(String.fromCharCode(e)))++this.pos;else break e}}},V.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)},V.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(p.ellipsis)):(++this.pos,this.finishToken(p.dot))},V.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(p.assign,2):this.finishOp(p.slash,1)},V.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?p.star:p.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=p.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(p.assign,i+1):this.finishOp(r,i)},V.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(p.assign,3)}return this.finishOp(e===124?p.logicalOR:p.logicalAND,2)}return t===61?this.finishOp(p.assign,2):this.finishOp(e===124?p.bitwiseOR:p.bitwiseAND,1)},V.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(p.assign,2):this.finishOp(p.bitwiseXOR,1)},V.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||xe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(p.incDec,2):t===61?this.finishOp(p.assign,2):this.finishOp(p.plusMin,1)},V.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(p.assign,i+1):this.finishOp(p.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(p.relational,i))},V.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(p.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(p.arrow)):this.finishOp(e===61?p.eq:p.prefix,1)},V.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(p.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(p.assign,3)}return this.finishOp(p.coalesce,2)}}return this.finishOp(p.question,1)},V.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),De(t,!0)||t===92))return this.finishToken(p.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ve(t)+"'")},V.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(p.parenL);case 41:return++this.pos,this.finishToken(p.parenR);case 59:return++this.pos,this.finishToken(p.semi);case 44:return++this.pos,this.finishToken(p.comma);case 91:return++this.pos,this.finishToken(p.bracketL);case 93:return++this.pos,this.finishToken(p.bracketR);case 123:return++this.pos,this.finishToken(p.braceL);case 125:return++this.pos,this.finishToken(p.braceR);case 58:return++this.pos,this.finishToken(p.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(p.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(p.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ve(e)+"'")},V.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},V.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(xe.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 n=this.input.slice(i,this.pos);++this.pos;var a=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Ae(this));o.reset(i,n,s),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(n,s)}catch{}return this.finishToken(p.regexp,{pattern:n,flags:s,value:c})},V.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,n=i&&this.input.charCodeAt(this.pos)===48,a=this.pos,s=0,o=0,c=0,u=t??1/0;c<u;++c,++this.pos){var h=this.input.charCodeAt(this.pos),f=void 0;if(r&&h===95){n&&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"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;continue}if(h>=97?f=h-97+10:h>=65?f=h-65+10:h>=48&&h<=57?f=h-48:f=1/0,f>=e)break;o=h,s=s*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:s};function vn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ui(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}V.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=Ui(this.input.slice(t,this.pos)),++this.pos):De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(p.num,i)},V.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 n=Ui(this.input.slice(t,this.pos));return++this.pos,De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(p.num,n)}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")),De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=vn(this.input.slice(t,this.pos),i);return this.finishToken(p.num,a)},V.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},V.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)):(Xe(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(p.string,t)};var Hi={};V.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Hi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},V.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Hi;this.raise(e,t)},V.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===p.template||this.type===p.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(p.dollarBraceL)):(++this.pos,this.finishToken(p.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(p.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Xe(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===p.backQuote,this.finishNode(i,"TemplateElement")},T.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===p.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(p.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(p.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},T.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===p.name||this.type===p.num||this.type===p.string||this.type===p.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===p.star)&&!xe.test(this.input.slice(this.lastTokEnd,this.start))},T.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(p.braceR);){if(r)r=!1;else if(this.expect(p.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(p.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,n,t),i.properties.push(a)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},T.parseProperty=function(e,t){var i=this.startNode(),r,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(p.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===p.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===p.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)&&(a=this.start,s=this.startLoc),e||(r=this.eat(p.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(p.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,a,s,t,o),this.finishNode(i,"Property")},T.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")},T.parsePropertyValue=function(e,t,i,r,n,a,s,o){(i||r)&&this.type===p.colon&&this.unexpected(),this.eat(p.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===p.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!==p.comma&&this.type!==p.braceR&&this.type!==p.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=n),e.kind="init",t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===p.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()},T.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(p.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(p.bracketR),e.key;e.computed=!1}return e.key=this.type===p.num||this.type===p.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},T.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},T.parseMethod=function(e,t,i){var r=this.startNode(),n=this.yieldPos,a=this.awaitPos,s=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(Mt(t,r.generator)|Lt|(i?gi:0)),this.expect(p.parenL),r.params=this.parseBindingList(p.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(r,"FunctionExpression")},T.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(Mt(i,!1)|mi),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=n,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(e,"ArrowFunctionExpression")},T.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==p.braceL,a=this.strict,s=!1;if(n)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||o)&&(s=this.strictDirective(this.end),s&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],s&&(this.strict=!0),this.checkParams(e,!a&&!s&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,wi),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},T.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},T.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var a=n[r];this.checkLValInnerPattern(a,Bt,t?null:i)}},T.parseExprList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(p.comma),t&&this.afterTrailingComma(e))break;var s=void 0;i&&this.type===p.comma?s=null:this.type===p.ellipsis?(s=this.parseSpread(r),r&&this.type===p.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),n.push(s)}return n},T.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 n=this.strict?this.reservedWordsStrict:this.reservedWords;n.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"))}},T.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},T.parseIdentNode=function(){var e=this.startNode();return this.type===p.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=p.name):this.unexpected(),e},T.parsePrivateIdent=function(){var e=this.startNode();return this.type===p.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},T.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===p.semi||this.canInsertSemicolon()||this.type!==p.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(p.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},T.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 yt=Q.prototype;yt.raise=function(e,t){var i=pi(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},yt.raiseRecoverable=yt.raise,yt.curPosition=function(){if(this.options.locations)return new st(this.curLine,this.pos-this.lineStart)};var Be=Q.prototype,Zr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Be.enterScope=function(e){this.scopeStack.push(new Zr(e))},Be.exitScope=function(){this.scopeStack.pop()},Be.treatFunctionsAsVarInScope=function(e){return e.flags&Je||!this.inModule&&e.flags&at},Be.declareName=function(e,t,i){var r=!1;if(t===Le){var n=this.currentScope();r=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&at&&delete this.undefinedExports[e]}else if(t===vi){var a=this.currentScope();a.lexical.push(e)}else if(t===yi){var s=this.currentScope();this.treatFunctionsAsVar?r=s.lexical.indexOf(e)>-1:r=s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var c=this.scopeStack[o];if(c.lexical.indexOf(e)>-1&&!(c.flags&xi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&at&&delete this.undefinedExports[e],c.flags&Ot)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Be.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Be.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Be.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Ot)return t}},Be.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Ot&&!(t.flags&mi))return t}};var vt=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])},ut=Q.prototype;ut.startNode=function(){return new vt(this,this.start,this.startLoc)},ut.startNodeAt=function(e,t){return new vt(this,e,t)};function Ei(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}ut.finishNode=function(e,t){return Ei.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ut.finishNodeAt=function(e,t,i,r){return Ei.call(this,e,t,i,r)},ut.copyNode=function(e){var t=new vt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Jr="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",_i="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",Ni=_i+" Extended_Pictographic",Ii=Ni,Ci=Ii+" EBase EComp EMod EPres ExtPict",ki=Ci,en=ki,tn={9:_i,10:Ni,11:Ii,12:Ci,13:ki,14:en},rn="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",nn={9:"",10:"",11:"",12:"",13:"",14:rn},Ai="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",Pi="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",Ti=Pi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ri=Ti+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Di=Ri+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Vi=Di+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",sn=Vi+" "+Jr,an={9:Pi,10:Ti,11:Ri,12:Di,13:Vi,14:sn},Li={};function on(e){var t=Li[e]={binary:Me(tn[e]+" "+Ai),binaryOfStrings:Me(nn[e]),nonBinary:{General_Category:Me(Ai),Script:Me(an[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 $t=0,Oi=[9,10,11,12,13,14];$t<Oi.length;$t+=1){var cn=Oi[$t];on(cn)}var C=Q.prototype,wt=function(t,i){this.parent=t,this.base=i||this};wt.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},wt.prototype.sibling=function(){return new wt(this.parent,this.base)};var Ae=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=Li[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};Ae.prototype.reset=function(t,i,r){var n=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)},Ae.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Ae.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return-1;var a=r.charCodeAt(t);if(!(i||this.switchU)||a<=55295||a>=57344||t+1>=n)return a;var s=r.charCodeAt(t+1);return s>=56320&&s<=57343?(a<<10)+s-56613888:a},Ae.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return n;var a=r.charCodeAt(t),s;return!(i||this.switchU)||a<=55295||a>=57344||t+1>=n||(s=r.charCodeAt(t+1))<56320||s>57343?t+1:t+2},Ae.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Ae.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Ae.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Ae.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Ae.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,n=0,a=t;n<a.length;n+=1){var s=a[n],o=this.at(r,i);if(o===-1||o!==s)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0},C.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,n=!1,a=0;a<i.length;a++){var s=i.charAt(a);t.indexOf(s)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(s,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),s==="u"&&(r=!0),s==="v"&&(n=!0)}this.options.ecmaVersion>=15&&r&&n&&this.raise(e.start,"Invalid regular expression flag")};function un(e){for(var t in e)return!0;return!1}C.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&un(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},C.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")}},C.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new wt(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")},C.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},C.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},C.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},C.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},C.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},C.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,n=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return n!==-1&&n<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},C.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)},C.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},C.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 n=0;n<i.length;n++){var a=i.charAt(n);i.indexOf(a,n+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var s=this.regexp_eatModifiers(e);!i&&!s&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<s.length;o++){var c=s.charAt(o);(s.indexOf(c,o+1)>-1||i.indexOf(c)>-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},C.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},C.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&hn(i);)t+=Ve(i),e.advance();return t};function hn(e){return e===105||e===109||e===115}C.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)},C.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},C.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Mi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Mi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}C.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Mi(i);)e.advance();return e.pos!==t},C.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},C.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,n=i;r<n.length;r+=1){var a=n[r];a.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}},C.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},C.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Ve(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Ve(e.lastIntValue);return!0}return!1},C.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),ln(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function ln(e){return De(e,!0)||e===36||e===95}C.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),pn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function pn(e){return Qe(e,!0)||e===36||e===95||e===8204||e===8205}C.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)},C.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},C.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},C.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)},C.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},C.regexp_eatZero=function(e){return e.current()===48&&!bt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},C.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},C.regexp_eatControlLetter=function(e){var t=e.current();return Bi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Bi(e){return e>=65&&e<=90||e>=97&&e<=122}C.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 n=e.lastIntValue;if(r&&n>=55296&&n<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=(n-55296)*1024+(s-56320)+65536,!0}e.pos=a,e.lastIntValue=n}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&fn(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function fn(e){return e>=0&&e<=1114111}C.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},C.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 Fi=0,Oe=1,ve=2;C.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(dn(t))return e.lastIntValue=-1,e.advance(),Oe;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===ve&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Fi};function dn(e){return e===100||e===68||e===115||e===83||e===119||e===87}C.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),Oe}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return Fi},C.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ze(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},C.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Oe;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ve;e.raise("Invalid property name")},C.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Wi(t=e.current());)e.lastStringValue+=Ve(t),e.advance();return e.lastStringValue!==""};function Wi(e){return Bi(e)||e===95}C.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";mn(t=e.current());)e.lastStringValue+=Ve(t),e.advance();return e.lastStringValue!==""};function mn(e){return Wi(e)||bt(e)}C.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},C.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===ve&&e.raise("Negated character class may contain strings"),!0}return!1},C.regexp_classContents=function(e){return e.current()===93?Oe:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Oe)},C.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")}}},C.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||qi(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},C.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)},C.regexp_classSetExpression=function(e){var t=Oe,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ve&&(t=ve);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ve&&(t=Oe);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===ve&&(t=ve)}},C.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},C.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Oe:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},C.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===ve&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;e.pos=t}return null},C.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},C.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ve&&(t=ve);return t},C.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Oe:ve},C.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()&&xn(i)||gn(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function xn(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 gn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}C.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return yn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function yn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}C.regexp_eatClassControlLetter=function(e){var t=e.current();return bt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},C.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},C.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;bt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function bt(e){return e>=48&&e<=57}C.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ji(i=e.current());)e.lastIntValue=16*e.lastIntValue+$i(i),e.advance();return e.pos!==t};function ji(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function $i(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}C.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},C.regexp_eatOctalDigit=function(e){var t=e.current();return qi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function qi(e){return e>=48&&e<=55}C.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!ji(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+$i(n),e.advance()}return!0};var qt=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])},V=Q.prototype;V.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 qt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},V.getToken=function(){return this.next(),new qt(this)},typeof Symbol<"u"&&(V[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===p.eof,value:t}}}}),V.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(p.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},V.readToken=function(e){return De(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},V.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},V.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,n=t;(r=oi(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},V.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&&!Xe(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())},V.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&&ci.test(String.fromCharCode(e)))++this.pos;else break e}}},V.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)},V.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(p.ellipsis)):(++this.pos,this.finishToken(p.dot))},V.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(p.assign,2):this.finishOp(p.slash,1)},V.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?p.star:p.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=p.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(p.assign,i+1):this.finishOp(r,i)},V.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(p.assign,3)}return this.finishOp(e===124?p.logicalOR:p.logicalAND,2)}return t===61?this.finishOp(p.assign,2):this.finishOp(e===124?p.bitwiseOR:p.bitwiseAND,1)},V.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(p.assign,2):this.finishOp(p.bitwiseXOR,1)},V.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||xe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(p.incDec,2):t===61?this.finishOp(p.assign,2):this.finishOp(p.plusMin,1)},V.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(p.assign,i+1):this.finishOp(p.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(p.relational,i))},V.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(p.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(p.arrow)):this.finishOp(e===61?p.eq:p.prefix,1)},V.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(p.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(p.assign,3)}return this.finishOp(p.coalesce,2)}}return this.finishOp(p.question,1)},V.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),De(t,!0)||t===92))return this.finishToken(p.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ve(t)+"'")},V.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(p.parenL);case 41:return++this.pos,this.finishToken(p.parenR);case 59:return++this.pos,this.finishToken(p.semi);case 44:return++this.pos,this.finishToken(p.comma);case 91:return++this.pos,this.finishToken(p.bracketL);case 93:return++this.pos,this.finishToken(p.bracketR);case 123:return++this.pos,this.finishToken(p.braceL);case 125:return++this.pos,this.finishToken(p.braceR);case 58:return++this.pos,this.finishToken(p.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(p.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(p.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ve(e)+"'")},V.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},V.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(xe.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 n=this.input.slice(i,this.pos);++this.pos;var a=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Ae(this));o.reset(i,n,s),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(n,s)}catch{}return this.finishToken(p.regexp,{pattern:n,flags:s,value:c})},V.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,n=i&&this.input.charCodeAt(this.pos)===48,a=this.pos,s=0,o=0,c=0,u=t??1/0;c<u;++c,++this.pos){var h=this.input.charCodeAt(this.pos),f=void 0;if(r&&h===95){n&&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"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;continue}if(h>=97?f=h-97+10:h>=65?f=h-65+10:h>=48&&h<=57?f=h-48:f=1/0,f>=e)break;o=h,s=s*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:s};function vn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ui(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}V.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=Ui(this.input.slice(t,this.pos)),++this.pos):De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(p.num,i)},V.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 n=Ui(this.input.slice(t,this.pos));return++this.pos,De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(p.num,n)}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")),De(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=vn(this.input.slice(t,this.pos),i);return this.finishToken(p.num,a)},V.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},V.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)):(Xe(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(p.string,t)};var Hi={};V.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Hi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},V.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Hi;this.raise(e,t)},V.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===p.template||this.type===p.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(p.dollarBraceL)):(++this.pos,this.finishToken(p.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(p.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Xe(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}},V.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(p.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")},V.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 Ve(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],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=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(n)}return Xe(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},V.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},V.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Qe(n,r))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(t?De:Qe)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=Ve(s),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},V.readWord=function(){var e=this.readWord1(),t=p.name;return this.keywords.test(e)&&(t=Rt[e]),this.finishToken(t,e)};var wn="8.14.0";X.acorn={Parser:X,version:wn,defaultOptions:Dt,Position:st,SourceLocation:dt,getLineInfo:pi,Node:vt,TokenType:M,tokTypes:p,keywordTypes:Rt,TokContext:Ee,tokContexts:U,isIdentifierChar:Qe,isIdentifierStart:De,Token:qt,isNewLine:Xe,lineBreak:xe,lineBreakG:jr,nonASCIIwhitespace:ci};function Ki(e,t){return X.parse(e,t)}const{stringify:bn}=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 St={"||":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},_e=17,Sn={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:_e,ClassExpression:_e,FunctionExpression:_e,ObjectExpression:_e,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function tt(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 n=1;n<r;n++){const a=t[n];e.write(", "),i[a.type](a,e)}}e.write(")")}function Gi(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===_e)return!0;const a=e.expressionsPrecedence[i.type];return n!==a?!r&&n===15&&a===14&&i.operator==="**"||n<a:n!==13&&n!==14?!1:t.operator==="**"&&i.operator==="**"?!r:n===13&&a===13&&(t.operator==="??"||i.operator==="??")?!0:r?St[t.operator]<=St[i.operator]:St[t.operator]<St[i.operator]}function Et(e,t,i,r){const{generator:n}=e;Gi(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function En(e,t,i,r){const n=t.split(`
26
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ve(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],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=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(n)}return Xe(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},V.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},V.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Qe(n,r))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(t?De:Qe)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=Ve(s),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},V.readWord=function(){var e=this.readWord1(),t=p.name;return this.keywords.test(e)&&(t=Rt[e]),this.finishToken(t,e)};var wn="8.14.0";Q.acorn={Parser:Q,version:wn,defaultOptions:Dt,Position:st,SourceLocation:dt,getLineInfo:pi,Node:vt,TokenType:O,tokTypes:p,keywordTypes:Rt,TokContext:Ee,tokContexts:U,isIdentifierChar:Qe,isIdentifierStart:De,Token:qt,isNewLine:Xe,lineBreak:xe,lineBreakG:jr,nonASCIIwhitespace:ci};function Ki(e,t){return Q.parse(e,t)}const{stringify:bn}=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 St={"||":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},_e=17,Sn={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:_e,ClassExpression:_e,FunctionExpression:_e,ObjectExpression:_e,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function tt(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 n=1;n<r;n++){const a=t[n];e.write(", "),i[a.type](a,e)}}e.write(")")}function Gi(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===_e)return!0;const a=e.expressionsPrecedence[i.type];return n!==a?!r&&n===15&&a===14&&i.operator==="**"||n<a:n!==13&&n!==14?!1:t.operator==="**"&&i.operator==="**"?!r:n===13&&a===13&&(t.operator==="??"||i.operator==="??")?!0:r?St[t.operator]<=St[i.operator]:St[t.operator]<St[i.operator]}function Et(e,t,i,r){const{generator:n}=e;Gi(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function En(e,t,i,r){const n=t.split(`
27
27
  `),a=n.length-1;if(e.write(n[0].trim()),a>0){e.write(r);for(let s=1;s<a;s++)e.write(i+n[s].trim()+r);e.write(i+n[a].trim())}}function ne(e,t,i,r){const{length:n}=t;for(let a=0;a<n;a++){const s=t[a];e.write(i),s.type[0]==="L"?e.write("// "+s.value.trim()+`
28
28
  `,s):(e.write("/*"),En(e,s.value,i,r),e.write("*/"+r))}}function _n(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 Ut(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:n}=r;if(n>0){i.VariableDeclarator(r[0],e);for(let a=1;a<n;a++)e.write(", "),i.VariableDeclarator(r[a],e)}}let zi,Yi,Qi,Xi,Zi,Ji;const Ht={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&ne(t,e.comments,i,r);const a=e.body,{length:s}=a;for(let o=0;o<s;o++){const c=a[o];n&&c.comments!=null&&ne(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}n&&e.trailingComments!=null&&ne(t,e.trailingComments,i,r)},BlockStatement:Ji=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,a=i+t.indent;t.write("{");const s=e.body;if(s!=null&&s.length>0){t.write(r),n&&e.comments!=null&&ne(t,e.comments,a,r);const{length:o}=s;for(let c=0;c<o;c++){const u=s[c];n&&u.comments!=null&&ne(t,u.comments,a,r),t.write(a),this[u.type](u,t),t.write(r)}t.write(i)}else n&&e.comments!=null&&(t.write(r),ne(t,e.comments,a,r),t.write(i));n&&e.trailingComments!=null&&ne(t,e.trailingComments,a,r),t.write("}"),t.indentLevel--},ClassBody:Ji,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===_e||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:n}=t;t.indentLevel++;const a=i+t.indent,s=a+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:c}=o;for(let u=0;u<c;u++){const h=o[u];n&&h.comments!=null&&ne(t,h.comments,a,r),h.test?(t.write(a+"case "),this[h.test.type](h.test,t),t.write(":"+r)):t.write(a+"default:"+r);const{consequent:f}=h,{length:l}=f;for(let d=0;d<l;d++){const g=f[d];n&&g.comments!=null&&ne(t,g.comments,s,r),t.write(s),this[g.type](g,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"?Ut(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:zi=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Ut(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:zi,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:Yi=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),tt(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:Yi,VariableDeclaration(e,t){Ut(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,n=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(n===_e||n<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:n}=i;let a=0;if(n>0){for(;a<n;){a>0&&t.write(", ");const s=i[a],o=s.type[6];if(o==="D")t.write(s.local.name,s),a++;else if(o==="N")t.write("* as "+s.local.name,s),a++;else break}if(a<n){for(t.write("{");;){const s=i[a],{name:o}=s.imported;if(t.write(o,s),o!==s.local.name&&t.write(" as "+s.local.name),++a<n)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let s=0;s<r.length;s++)this.ImportAttribute(r[s],t),s<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 n=0;;){const a=i[n],{name:s}=a.local;if(t.write(s,a),s!==a.exported.name&&t.write(" as "+a.exported.name),++n<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 n=0;n<e.attributes.length;n++)this.ImportAttribute(e.attributes[n],t),n<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),tt(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]):tt(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:Qi=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:Qi,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),Et(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:n}=r;for(let s=0;s<n;s++){const o=r[s],c=i[s];t.write(c.value.raw,c),t.write("${"),this[o.type](o,t),t.write("}")}const a=i[i.length-1];t.write(a.value.raw,a),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){Et(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:Zi=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let n=0;;){const a=i[n];if(a!=null&&this[a.type](a,t),++n<r)t.write(", ");else{a==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:Zi,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,a=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),n&&e.comments!=null&&ne(t,e.comments,a,r);const s=","+r,{properties:o}=e,{length:c}=o;for(let u=0;;){const h=o[u];if(n&&h.comments!=null&&ne(t,h.comments,a,r),t.write(a),this[h.type](h,t),++u<c)t.write(s);else break}t.write(r),n&&e.trailingComments!=null&&ne(t,e.trailingComments,a,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),ne(t,e.comments,a,r),e.trailingComments!=null&&ne(t,e.trailingComments,a,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),ne(t,e.trailingComments,a,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 n=0;this[i[n].type](i[n],t),++n<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){tt(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const a=Gi(t,r,e);!a&&(i.length>1||n[0]==="U"&&(n[1]==="n"||n[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),a?(t.write(i.length>1?" (":"("),this[n](r,t),t.write(")")):this[n](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:Xi=function(e,t){const i=e.operator==="in";i&&t.write("("),Et(t,e.left,e,!1),t.write(" "+e.operator+" "),Et(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Xi,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===_e||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===_e||i<t.expressionsPrecedence.CallExpression||_n(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),tt(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===_e||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("?."),tt(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===_e||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(bn(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},Nn={},In=Ht;class Cn{constructor(t){const i=t??Nn;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Ht,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:Sn,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:a}=i;if(a[0]==="L"&&a[2]==="n"){this.column=0,this.line++;return}if(i.loc!=null){const{mapping:s}=this;s.original=i.loc.start,s.name=i.name,this.sourceMap.addMapping(s)}if(a[0]==="T"&&a[8]==="E"||a[0]==="L"&&a[1]==="i"&&typeof i.value=="string"){const{length:s}=t;let{column:o,line:c}=this;for(let u=0;u<s;u++)t[u]===`
31
- `?(o=0,c++):o++;this.column=o,this.line=c;return}}const{length:r}=t,{lineEnd:n}=this;r>0&&(this.lineEndSize>0&&(n.length===1?t[r-1]===n:t.endsWith(n))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function er(e,t){const i=new Cn(t);return i.generator[e.type](e,i),i.output}var kn=Object.defineProperty,An=(e,t,i)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t,i)=>An(e,typeof t!="symbol"?t+"":t,i);const Pn=new Set(["Infinity","NaN","undefined","null","true","false"]),Tn=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 Rn{constructor(){Z(this,"scopes",[]),Z(this,"scopeTypes",[]),Z(this,"scopeCounts",new Map),Z(this,"contextBoundVars",new Set),Z(this,"arrayPatternElements",new Set),Z(this,"rootParams",new Set),Z(this,"localSeriesVars",new Set),Z(this,"varKinds",new Map),Z(this,"loopVars",new Set),Z(this,"loopVarNames",new Map),Z(this,"paramIdCounter",0),Z(this,"cacheIdCounter",0),Z(this,"tempVarCounter",0),Z(this,"taCallIdCounter",0),Z(this,"userCallIdCounter",0),Z(this,"hoistingStack",[]),Z(this,"suppressHoisting",!1),Z(this,"reservedNames",new Set),Z(this,"userFunctions",new Set),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++}`}}getNextUserCallId(){return{type:"Literal",value:`_fn${this.userCallIdCounter++}`}}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)}removeLocalSeriesVar(t){this.localSeriesVars.delete(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 Pn.has(t)||Tn.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)}addReservedName(t){this.reservedNames.add(t)}addUserFunction(t){this.userFunctions.add(t)}isUserFunction(t){return this.userFunctions.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],n=this.scopeTypes[this.scopeTypes.length-1],a=this.scopeCounts.get(n)||1,s=`${n}${a}_${t}`;return r.set(t,s),this.varKinds.set(s,i),s}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 n=r.get(t),a=this.varKinds.get(n)||"let";return[n,a]}}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}hasVariableInScope(t){if(this.reservedNames.has(t))return!0;for(let i=this.scopes.length-1;i>=0;i--)if(this.scopes[i].has(t))return!0;return!!(this.contextBoundVars.has(t)||this.loopVars.has(t)||this.localSeriesVars.has(t))}generateParamId(){let t=`p${this.paramIdCounter++}`;for(;this.hasVariableInScope(t);)t=`p${this.paramIdCounter++}`;const i=this.scopes[this.scopes.length-1];return i&&i.set(t,t),t}}function tr(e,t,i,r,n){i||(i=S),(function a(s,o,c){var u=c||s.type;i[u](s,o,a),t[u]&&t[u](s,o)})(e,r,n)}function Dn(e,t,i,r,n){var a=[];i||(i=S),(function s(o,c,u){var h=u||o.type,f=o!==a[a.length-1];f&&a.push(o),i[h](o,c,s),t[h]&&t[h](o,c||a,a),f&&a.pop()})(e,r,n)}function ee(e,t,i,r,n){var a=i?Vn(i,r||void 0):r;(function s(o,c,u){a[u||o.type](o,c,s)})(e,t,n)}function Vn(e,t){var i=Object.create(t||S);for(var r in e)i[r]=e[r];return i}function Kt(e,t,i){i(e,t)}function qe(e,t,i){}var S={};S.Program=S.BlockStatement=S.StaticBlock=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t,"Statement")}},S.Statement=Kt,S.EmptyStatement=qe,S.ExpressionStatement=S.ParenthesizedExpression=S.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},S.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},S.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},S.BreakStatement=S.ContinueStatement=qe,S.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},S.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,n=e.cases;r<n.length;r+=1){var a=n[r];i(a,t)}},S.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,n=e.consequent;r<n.length;r+=1){var a=n[r];i(a,t,"Statement")}},S.ReturnStatement=S.YieldExpression=S.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},S.ThrowStatement=S.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},S.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},S.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},S.WhileStatement=S.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},S.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")},S.ForInStatement=S.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},S.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")},S.DebuggerStatement=qe,S.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},S.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var a=n[r];i(a,t)}},S.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},S.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,n=e.params;r<n.length;r+=1){var a=n[r];i(a,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},S.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)},S.VariablePattern=qe,S.MemberPattern=Kt,S.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},S.ArrayPattern=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var a=n[r];a&&i(a,t,"Pattern")}},S.ObjectPattern=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];a.type==="Property"?(a.computed&&i(a.key,t,"Expression"),i(a.value,t,"Pattern")):a.type==="RestElement"&&i(a.argument,t,"Pattern")}},S.Expression=Kt,S.ThisExpression=S.Super=S.MetaProperty=qe,S.ArrayExpression=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var a=n[r];a&&i(a,t,"Expression")}},S.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];i(a,t)}},S.FunctionExpression=S.ArrowFunctionExpression=S.FunctionDeclaration,S.SequenceExpression=function(e,t,i){for(var r=0,n=e.expressions;r<n.length;r+=1){var a=n[r];i(a,t,"Expression")}},S.TemplateLiteral=function(e,t,i){for(var r=0,n=e.quasis;r<n.length;r+=1){var a=n[r];i(a,t)}for(var s=0,o=e.expressions;s<o.length;s+=1){var c=o[s];i(c,t,"Expression")}},S.TemplateElement=qe,S.UnaryExpression=S.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},S.BinaryExpression=S.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},S.AssignmentExpression=S.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},S.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},S.NewExpression=S.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,n=e.arguments;r<n.length;r+=1){var a=n[r];i(a,t,"Expression")}},S.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},S.ExportNamedDeclaration=S.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")},S.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},S.ImportDeclaration=function(e,t,i){for(var r=0,n=e.specifiers;r<n.length;r+=1){var a=n[r];i(a,t)}i(e.source,t,"Expression")},S.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},S.ImportSpecifier=S.ImportDefaultSpecifier=S.ImportNamespaceSpecifier=S.Identifier=S.PrivateIdentifier=S.Literal=qe,S.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},S.ClassDeclaration=S.ClassExpression=function(e,t,i){return i(e,t,"Class")},S.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},S.ClassBody=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t)}},S.MethodDefinition=S.PropertyDefinition=S.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const K="$",w={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("$")},createLocalContextIdentifier(){return this.createIdentifier("$$")},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!1)},createLocalContextVariableReference(e,t){const i=this.createLocalContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!1)},createDynamicContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),t,!0)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createDynamicContextVariableAccess0(e,t){const i=this.createDynamicContextVariableReference(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),n=[e,t];return i&&n.push(i),this.createCallExpression(r,n)},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("pine"),!1),r=this.createMemberExpression(i,this.createIdentifier("math"),!1),n=this.createMemberExpression(r,this.createIdentifier("__eq"),!1);return this.createCallExpression(n,[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}}},ht=["ta","math","request","array","input"],Ln=["hline","plot","fill"],Mn=["request.security","request.security_lower_tf"],ir=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],rr=[...ht,"plotchar","plotshape","plotarrow","plotbar","plotcandle","plot","bgcolor","barcolor","hline","fill","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","Type","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","inputs","order","currency","display","shape","location","size","format","dayofweek"],On=["na","nz","plot","plotchar","color","hline","fill"];function Bn(e){let t=null,i=K;if(e.type==="Program"&&e.body.length>0){const d=e.body[0];if(d.type==="ExpressionStatement"&&(d.expression.type==="ArrowFunctionExpression"||d.expression.type==="FunctionExpression")){const g=d.expression;g.body.type==="BlockStatement"&&(t=g.body.body,g.params.length>0&&g.params[0].type==="Identifier"&&(i=g.params[0].name))}}if(!t)return;const r=new Set,n=new Set,a=d=>{d.type==="Identifier"?r.add(d.name):d.type==="ObjectPattern"?d.properties.forEach(g=>a(g.value)):d.type==="ArrayPattern"&&d.elements.forEach(g=>{g&&a(g)})};ee(e,{},{VariableDeclarator(d,g,y){a(d.id),d.init&&y(d.init,g)},FunctionDeclaration(d,g,y){a(d.id),y(d.body,g)},Identifier(d,g,y){n.add(d.name)},MemberExpression(d,g,y){y(d.object,g),d.computed&&y(d.property,g)},Property(d,g,y){d.computed&&y(d.key,g),y(d.value,g)}}),t.forEach(d=>{d.type==="VariableDeclaration"?d.declarations.forEach(g=>a(g.id)):d.type==="FunctionDeclaration"&&a(d.id)});const s=ir,o=rr,c=s.filter(d=>!r.has(d)),u=o.filter(d=>!r.has(d)),h=c.filter(d=>n.has(d)),f=u.filter(d=>n.has(d)),l=[];h.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(d=>({type:"Property",key:{type:"Identifier",name:d},value:{type:"Identifier",name:d},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(d=>({type:"Property",key:{type:"Identifier",name:d},value:{type:"Identifier",name:d},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),l.length>0&&t.unshift(...l)}function Fn(e){let t=null,i=K;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 c=o.expression;c.body.type==="BlockStatement"&&(t=c.body.body,c.params.length>0&&c.params[0].type==="Identifier"&&(i=c.params[0].name))}}if(!t)return;const r=new Set(ir),n=new Set(rr),a=new Set(On),s=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(c=>{if(c.init&&c.init.type==="MemberExpression"&&c.init.object.type==="Identifier"&&c.init.object.name===i&&c.init.property.type==="Identifier"){const u=c.init.property.name;let h=null;if(u==="data"?h=r:u==="pine"?h=n:u==="core"&&(h=a),h&&c.id.type==="ObjectPattern")c.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const l=f.key.name,d=f.value.name;h.has(l)&&l!==d&&(s.set(d,l),f.value.name=l,f.shorthand=!0)}});else if(c.id.type==="Identifier"&&ht.includes(u)){const f=u,l=c.id.name;f!==l&&(s.set(l,f),c.id.name=f)}}})}),s.size>0&&ee(e,{},{Identifier(o){s.has(o.name)&&(o.name=s.get(o.name))},MemberExpression(o,c,u){u(o.object,c),o.computed&&u(o.property,c)},Property(o,c,u){o.computed&&u(o.key,c),u(o.value,c)}})}function Wn(e){try{const t=Ki(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 jn(e){return e.async=!0,er(e)}function $n(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=Wn(e);return t&&r?i?e:jn(r):`async (context) => {
31
+ `?(o=0,c++):o++;this.column=o,this.line=c;return}}const{length:r}=t,{lineEnd:n}=this;r>0&&(this.lineEndSize>0&&(n.length===1?t[r-1]===n:t.endsWith(n))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function er(e,t){const i=new Cn(t);return i.generator[e.type](e,i),i.output}var kn=Object.defineProperty,An=(e,t,i)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,X=(e,t,i)=>An(e,typeof t!="symbol"?t+"":t,i);const Pn=new Set(["Infinity","NaN","undefined","null","true","false"]),Tn=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 Rn{constructor(){X(this,"scopes",[]),X(this,"scopeTypes",[]),X(this,"scopeCounts",new Map),X(this,"contextBoundVars",new Set),X(this,"arrayPatternElements",new Set),X(this,"rootParams",new Set),X(this,"localSeriesVars",new Set),X(this,"varKinds",new Map),X(this,"loopVars",new Set),X(this,"loopVarNames",new Map),X(this,"paramIdCounter",0),X(this,"cacheIdCounter",0),X(this,"tempVarCounter",0),X(this,"taCallIdCounter",0),X(this,"userCallIdCounter",0),X(this,"hoistingStack",[]),X(this,"suppressHoisting",!1),X(this,"reservedNames",new Set),X(this,"userFunctions",new Set),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++}`}}getNextUserCallId(){return{type:"Literal",value:`_fn${this.userCallIdCounter++}`}}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)}removeLocalSeriesVar(t){this.localSeriesVars.delete(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 Pn.has(t)||Tn.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)}addReservedName(t){this.reservedNames.add(t)}addUserFunction(t){this.userFunctions.add(t)}isUserFunction(t){return this.userFunctions.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],n=this.scopeTypes[this.scopeTypes.length-1],a=this.scopeCounts.get(n)||1,s=`${n}${a}_${t}`;return r.set(t,s),this.varKinds.set(s,i),s}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 n=r.get(t),a=this.varKinds.get(n)||"let";return[n,a]}}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}hasVariableInScope(t){if(this.reservedNames.has(t))return!0;for(let i=this.scopes.length-1;i>=0;i--)if(this.scopes[i].has(t))return!0;return!!(this.contextBoundVars.has(t)||this.loopVars.has(t)||this.localSeriesVars.has(t))}generateParamId(){let t=`p${this.paramIdCounter++}`;for(;this.hasVariableInScope(t);)t=`p${this.paramIdCounter++}`;const i=this.scopes[this.scopes.length-1];return i&&i.set(t,t),t}}function tr(e,t,i,r,n){i||(i=S),(function a(s,o,c){var u=c||s.type;i[u](s,o,a),t[u]&&t[u](s,o)})(e,r,n)}function Dn(e,t,i,r,n){var a=[];i||(i=S),(function s(o,c,u){var h=u||o.type,f=o!==a[a.length-1];f&&a.push(o),i[h](o,c,s),t[h]&&t[h](o,c||a,a),f&&a.pop()})(e,r,n)}function ee(e,t,i,r,n){var a=i?Vn(i,r||void 0):r;(function s(o,c,u){a[u||o.type](o,c,s)})(e,t,n)}function Vn(e,t){var i=Object.create(t||S);for(var r in e)i[r]=e[r];return i}function Kt(e,t,i){i(e,t)}function qe(e,t,i){}var S={};S.Program=S.BlockStatement=S.StaticBlock=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t,"Statement")}},S.Statement=Kt,S.EmptyStatement=qe,S.ExpressionStatement=S.ParenthesizedExpression=S.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},S.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},S.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},S.BreakStatement=S.ContinueStatement=qe,S.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},S.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,n=e.cases;r<n.length;r+=1){var a=n[r];i(a,t)}},S.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,n=e.consequent;r<n.length;r+=1){var a=n[r];i(a,t,"Statement")}},S.ReturnStatement=S.YieldExpression=S.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},S.ThrowStatement=S.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},S.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},S.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},S.WhileStatement=S.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},S.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")},S.ForInStatement=S.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},S.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")},S.DebuggerStatement=qe,S.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},S.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var a=n[r];i(a,t)}},S.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},S.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,n=e.params;r<n.length;r+=1){var a=n[r];i(a,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},S.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)},S.VariablePattern=qe,S.MemberPattern=Kt,S.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},S.ArrayPattern=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var a=n[r];a&&i(a,t,"Pattern")}},S.ObjectPattern=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];a.type==="Property"?(a.computed&&i(a.key,t,"Expression"),i(a.value,t,"Pattern")):a.type==="RestElement"&&i(a.argument,t,"Pattern")}},S.Expression=Kt,S.ThisExpression=S.Super=S.MetaProperty=qe,S.ArrayExpression=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var a=n[r];a&&i(a,t,"Expression")}},S.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];i(a,t)}},S.FunctionExpression=S.ArrowFunctionExpression=S.FunctionDeclaration,S.SequenceExpression=function(e,t,i){for(var r=0,n=e.expressions;r<n.length;r+=1){var a=n[r];i(a,t,"Expression")}},S.TemplateLiteral=function(e,t,i){for(var r=0,n=e.quasis;r<n.length;r+=1){var a=n[r];i(a,t)}for(var s=0,o=e.expressions;s<o.length;s+=1){var c=o[s];i(c,t,"Expression")}},S.TemplateElement=qe,S.UnaryExpression=S.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},S.BinaryExpression=S.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},S.AssignmentExpression=S.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},S.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},S.NewExpression=S.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,n=e.arguments;r<n.length;r+=1){var a=n[r];i(a,t,"Expression")}},S.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},S.ExportNamedDeclaration=S.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")},S.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},S.ImportDeclaration=function(e,t,i){for(var r=0,n=e.specifiers;r<n.length;r+=1){var a=n[r];i(a,t)}i(e.source,t,"Expression")},S.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},S.ImportSpecifier=S.ImportDefaultSpecifier=S.ImportNamespaceSpecifier=S.Identifier=S.PrivateIdentifier=S.Literal=qe,S.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},S.ClassDeclaration=S.ClassExpression=function(e,t,i){return i(e,t,"Class")},S.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},S.ClassBody=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t)}},S.MethodDefinition=S.PropertyDefinition=S.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const H="$",w={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("$")},createLocalContextIdentifier(){return this.createIdentifier("$$")},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!1)},createLocalContextVariableReference(e,t){const i=this.createLocalContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!1)},createDynamicContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),t,!0)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createDynamicContextVariableAccess0(e,t){const i=this.createDynamicContextVariableReference(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),n=[e,t];return i&&n.push(i),this.createCallExpression(r,n)},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("pine"),!1),r=this.createMemberExpression(i,this.createIdentifier("math"),!1),n=this.createMemberExpression(r,this.createIdentifier("__eq"),!1);return this.createCallExpression(n,[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}}},ht=["ta","math","request","array","input"],Ln=["hline","plot","fill"],On=["request.security","request.security_lower_tf"],ir=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],rr=[...ht,"plotchar","plotshape","plotarrow","plotbar","plotcandle","plot","bgcolor","barcolor","hline","fill","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","Type","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","inputs","order","currency","display","shape","location","size","format","dayofweek"],Mn=["na","nz","plot","plotchar","color","hline","fill"];function Bn(e){let t=null,i=H;if(e.type==="Program"&&e.body.length>0){const d=e.body[0];if(d.type==="ExpressionStatement"&&(d.expression.type==="ArrowFunctionExpression"||d.expression.type==="FunctionExpression")){const g=d.expression;g.body.type==="BlockStatement"&&(t=g.body.body,g.params.length>0&&g.params[0].type==="Identifier"&&(i=g.params[0].name))}}if(!t)return;const r=new Set,n=new Set,a=d=>{d.type==="Identifier"?r.add(d.name):d.type==="ObjectPattern"?d.properties.forEach(g=>a(g.value)):d.type==="ArrayPattern"&&d.elements.forEach(g=>{g&&a(g)})};ee(e,{},{VariableDeclarator(d,g,y){a(d.id),d.init&&y(d.init,g)},FunctionDeclaration(d,g,y){a(d.id),y(d.body,g)},Identifier(d,g,y){n.add(d.name)},MemberExpression(d,g,y){y(d.object,g),d.computed&&y(d.property,g)},Property(d,g,y){d.computed&&y(d.key,g),y(d.value,g)}}),t.forEach(d=>{d.type==="VariableDeclaration"?d.declarations.forEach(g=>a(g.id)):d.type==="FunctionDeclaration"&&a(d.id)});const s=ir,o=rr,c=s.filter(d=>!r.has(d)),u=o.filter(d=>!r.has(d)),h=c.filter(d=>n.has(d)),f=u.filter(d=>n.has(d)),l=[];h.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(d=>({type:"Property",key:{type:"Identifier",name:d},value:{type:"Identifier",name:d},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(d=>({type:"Property",key:{type:"Identifier",name:d},value:{type:"Identifier",name:d},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),l.length>0&&t.unshift(...l)}function Fn(e){let t=null,i=H;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 c=o.expression;c.body.type==="BlockStatement"&&(t=c.body.body,c.params.length>0&&c.params[0].type==="Identifier"&&(i=c.params[0].name))}}if(!t)return;const r=new Set(ir),n=new Set(rr),a=new Set(Mn),s=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(c=>{if(c.init&&c.init.type==="MemberExpression"&&c.init.object.type==="Identifier"&&c.init.object.name===i&&c.init.property.type==="Identifier"){const u=c.init.property.name;let h=null;if(u==="data"?h=r:u==="pine"?h=n:u==="core"&&(h=a),h&&c.id.type==="ObjectPattern")c.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const l=f.key.name,d=f.value.name;h.has(l)&&l!==d&&(s.set(d,l),f.value.name=l,f.shorthand=!0)}});else if(c.id.type==="Identifier"&&ht.includes(u)){const f=u,l=c.id.name;f!==l&&(s.set(l,f),c.id.name=f)}}})}),s.size>0&&ee(e,{},{Identifier(o){s.has(o.name)&&(o.name=s.get(o.name))},MemberExpression(o,c,u){u(o.object,c),o.computed&&u(o.property,c)},Property(o,c,u){o.computed&&u(o.key,c),u(o.value,c)}})}function Wn(e){try{const t=Ki(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 jn(e){return e.async=!0,er(e)}function $n(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=Wn(e);return t&&r?i?e:jn(r):`async (context) => {
32
32
  ${e}
33
- }`}function qn(e){ee(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(n=>{if(n.init&&n.init.type==="ArrowFunctionExpression"&&n.init.start!==0){const a={type:"FunctionDeclaration",id:n.id,params:n.init.params,body:n.init.body.type==="BlockStatement"?n.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:n.init.body}]},async:n.init.async,generator:!1};Object.assign(t,a)}}),t.body&&t.body.body&&t.body.body.forEach(n=>r(n,i))}})}function Un(e,t){tr(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const n=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===K||r.init.object.name==="context2"),a=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===K||r.init.object.object.name==="context2");(n||a)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(s=>{s.key.name&&t.addContextBoundVar(s.key.name)}))})}})}function Hn(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&i&&t.addContextBoundVar(r.name,i)})}function Kn(e,t){let i;return Dn(e,{FunctionDeclaration(r){r.id&&r.id.name&&(t.addReservedName(r.id.name),t.addUserFunction(r.id.name))},ArrowFunctionExpression(r){const n=r.start===0;n&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=K),Hn(r,t,n)},VariableDeclaration(r,n){const a=n.length>1?n[n.length-2]:null,s=a&&(a.type==="ForOfStatement"||a.type==="ForInStatement")&&a.left===r;r.declarations.forEach(o=>{if(o.id.type==="Identifier")t.addReservedName(o.id.name);else if(o.id.type==="ObjectPattern")o.id.properties.forEach(c=>{c.key&&c.key.type==="Identifier"&&t.addReservedName(c.key.name)});else if(o.id.type==="ArrayPattern"){if(o.id.elements?.forEach(f=>{f&&f.type==="Identifier"&&t.addReservedName(f.name)}),s)return;const c=t.generateTempVar(),u={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:c},init:o.init}]};o.id.elements?.forEach(f=>{f.type==="Identifier"&&t.addArrayPatternElement(f.name)});const h=o.id.elements.map((f,l)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:f,init:{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Literal",value:l},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[u,...h]})}})},ForStatement(r){}}),i}const Gt={type:"Identifier",name:"undefined"};function te(e,t){const[i,r]=t.getVariable(e);if(i.match(/^fn\d+_/)&&e!=="$$"){const[n]=t.getVariable("$$");if(n)return w.createLocalContextVariableReference(r,i)}return w.createContextVariableReference(r,i)}function nr(e,t){const i=te(e,t);return w.createGetCall(i,0)}function Fe(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)){if(t.isLocalSeriesVar(e.object.name)){const i=w.createIdentifier(e.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0;return}if(!t.isContextBound(e.object.name)){const i=te(e.object.name,t),r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0}}return}t.isContextBound(e.property.name)||(e.property=te(e.property.name,t),e.property=w.createGetCall(e.property,0))}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(t.isLocalSeriesVar(e.object.name)){const i=w.createIdentifier(e.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0;return}if(t.isContextBound(e.object.name)||(e.object=te(e.object.name,t)),e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Fe(i,t),i._indexTransformed=!0)}}}function Pe(e,t){const i=w.createGetCall(w.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 se(e,t){if(!e._skipTransformation&&e.name!==K){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 l=e.parent.callee;if(l.type==="MemberExpression"&&l.object&&l.object.name===K&&["get","set","init","param","call"].includes(l.property.name)){const d=e.parent.arguments.indexOf(e);l.property.name==="call"?d>=2&&(i=!0):d===0&&(i=!0)}else{const d=l.type==="MemberExpression"&&l.object&&l.object.type==="Identifier"&&ht.includes(l.object.name);l.type==="MemberExpression"&&!d?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),n=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 a=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,s=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||n||i||o||a){if(a||e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.object&&e.parent.callee.object.name===K&&e.parent.callee.property.name==="call"&&e.parent.arguments[0]===e||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const l=te(e.name,t);Object.assign(e,l);return}const c=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(c){const l=e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e),d=e.parent&&e.parent.type==="SwitchStatement"&&e.parent.discriminant===e,g=e.parent&&e.parent.type==="SwitchCase"&&e.parent.test===e;if(!l&&!d&&!g)return}if(t.isLocalSeriesVar(e.name)){if(!s){const l=w.createIdentifier(e.name),d=w.createGetCall(l,0);Object.assign(e,d)}return}const[u,h]=t.getVariable(e.name);let f;if(c)f=w.createIdentifier(e.name);else{if(u===e.name&&!t.isContextBound(e.name))return;f=te(e.name,t)}if(s)Object.assign(e,f);else{const l=w.createGetCall(f,0);Object.assign(e,l)}}}function we(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&ht.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const c=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,u=e.parent&&(e.parent.type==="VariableDeclarator"&&(e.parent.id.type==="ArrayPattern"||e.parent.id.type==="ObjectPattern")||e.parent.type==="AssignmentExpression"&&(e.parent.left.type==="ArrayPattern"||e.parent.left.type==="ObjectPattern")||e.parent.type==="Property");if(!c&&!u){const h={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(h.start=e.start),e.end!==void 0&&(h.end=e.end),Object.assign(e,h);return}}const r=i.getCurrentScopeType()=="if",n=i.getCurrentScopeType()=="els",a=i.getCurrentScopeType()=="for";if(!r&&!n&&!a&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Fe(e,i),e._indexTransformed=!0);const s=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&(e.object.object.object.name===K||e.object.object.object.name==="$$"),o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(s||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const c=w.createGetCall(e.object,e.property);e.start&&(c.start=e.start),e.end&&(c.end=e.end),Object.assign(e,c),delete e.object,delete e.property,delete e.computed}}function lt(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[a,s]=t.getVariable(e.name);return w.createContextVariableReference(s,a)}if(t.isContextBound(e.name))return e;const[i,r]=t.getVariable(e.name),n=i!==e.name;return t.isLocalSeriesVar(e.name)&&!n?e:n?te(e.name,t):i===e.name&&!t.isContextBound(e.name)?e:te(e.name,t)}return e}function We(e,t,i=""){switch(e.type){case"BinaryExpression":return zt(e,t,i);case"LogicalExpression":return Yt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?lt(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=lt(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:w.createGetCall(r,0)}case"UnaryExpression":return Qt(e,t,i);case"ConditionalExpression":{const r=We(e.test,t,i),n=We(e.consequent,t,i),a=We(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:n,alternate:a,start:e.start,end:e.end}}}return e}function zt(e,t,i){const r=We(e.left,t,i),n=We(e.right,t,i),a={type:"BinaryExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return ee(a,t,{CallExpression(s,o){s._transformed||he(s,o)},MemberExpression(s){we(s,"",t)}}),a}function Yt(e,t,i){const r=We(e.left,t,i),n=We(e.right,t,i),a={type:"LogicalExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return ee(a,t,{CallExpression(s,o){s._transformed||he(s,o)}}),a}function sr(e,t,i){ee(e,{parent:e,inNamespaceCall:!1},{Identifier(s,o,c){if(s.name=="NaN")return;if(s.name=="na"){s.name="NaN";return}s.parent=o.parent,se(s,t);const u=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||u)&&(s.type==="MemberExpression"?Fe(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===K&&s.parent.callee.property.name==="get"||Pe(s)))},MemberExpression(s,o,c){Fe(s,t),s.object&&c(s.object,{parent:s,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(s,o,c){const u={...o,parent:s};s.test&&c(s.test,u),s.consequent&&c(s.consequent,u),s.alternate&&c(s.alternate,u)},BinaryExpression(s,o,c){const u={...o,parent:s};c(s.left,u),c(s.right,u)},LogicalExpression(s,o,c){const u={...o,parent:s};c(s.left,u),c(s.right,u)},UnaryExpression(s,o,c){const u={...o,parent:s};c(s.argument,u)},CallExpression(s,o,c){const u=s.callee&&s.callee.type==="MemberExpression"&&s.callee.object&&s.callee.object.type==="Identifier"&&t.isContextBound(s.callee.object.name);he(s,t),s.arguments.forEach(h=>c(h,{parent:s,inNamespaceCall:u||o.inNamespaceCall}))}});const r=w.createMemberExpression(w.createIdentifier(i),w.createIdentifier("param")),n=t.generateParamId(),a={type:"CallExpression",callee:r,arguments:[e,Gt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const s=n;t.addLocalSeriesVar(s);const o=w.createVariableDeclaration(s,a);return t.addHoistedStatement(o),w.createIdentifier(s)}return a}function Qt(e,t,i){const r=We(e.argument,t,i),n={type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end};return ee(n,t,{CallExpression(a,s){a._transformed||he(a,s)},MemberExpression(a){we(a,"",t)}}),n}function Ue(e,t,i){switch(e?.type){case"BinaryExpression":e=zt(e,i,t);break;case"LogicalExpression":e=Yt(e,i,t);break;case"ConditionalExpression":return sr(e,i,t);case"UnaryExpression":e=Qt(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(u=>u.type==="Identifier"?i.isContextBound(u.name)&&!i.isRootParam(u.name)?u:nr(u.name,i):u);break}const r=e.type==="MemberExpression"&&e.computed&&e.property,n=e.type==="MemberExpression"&&!e.computed;if(r){e.object.type==="CallExpression"?he(e.object,i):e.object.type==="MemberExpression"?we(e.object,"",i):e.object.type==="BinaryExpression"?e.object=zt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Yt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=sr(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Qt(e.object,i,t));const u=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:lt(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?lt(e.property,i):e.property,f=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),l=i.generateParamId(),d={type:"CallExpression",callee:f,arguments:[u,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const y=w.createVariableDeclaration(g,d);return i.addHoistedStatement(y),w.createIdentifier(g)}return d}if(n)if(e.object.type==="Identifier"){const u=e.object.name,[h,f]=i.getVariable(u);if(h!==u&&!i.isLoopVariable(u)){const l=w.createContextVariableReference(f,h),d=w.createGetCall(l,0);e.object=d}}else e.object.type==="MemberExpression"&&Ue(e.object,t,i);if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(u=>u.value.name?i.isContextBound(u.value.name)&&!i.isRootParam(u.value.name)?{type:"Property",key:{type:"Identifier",name:u.key.name},value:w.createIdentifier(u.value.name),kind:"init",method:!1,shorthand:!1,computed:!1}:{type:"Property",key:{type:"Identifier",name:u.key.name},value:te(u.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(u.value.type!=="Literal"&&(u.value=Ue(u.value,t,i)),u))),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const u=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),h=i.generateParamId(),f={type:"CallExpression",callee:u,arguments:[e,Gt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const d=w.createVariableDeclaration(l,f);return i.addHoistedStatement(d),w.createIdentifier(l)}return f}}e?.type==="CallExpression"&&he(e,i);const a=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),s=e.type==="Identifier"?lt(e,i):e,o=i.generateParamId(),c={type:"CallExpression",callee:a,arguments:[s,Gt,{type:"Identifier",name:`'${o}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const u=o;i.addLocalSeriesVar(u);const h=w.createVariableDeclaration(u,c);return i.addHoistedStatement(h),w.createIdentifier(u)}return c}function he(e,t,i){if(e._transformed)return;e.callee&&e.callee.name,e.callee&&e.callee.type==="Identifier"&&(ht.includes(e.callee.name)||Ln.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=w.createMemberExpression(e.callee,w.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===K&&["get","init","param"].includes(e.callee.property.name))return;const n=e.callee.object.name,a=[];if(e.arguments.forEach(h=>{if(h._isParamCall){a.push(h);return}a.push(Ue(h,n,t))}),e.arguments=a,n==="ta")if(t.getCurrentScopeType()==="fn"){const h=t.getNextTACallId(),[f]=t.getVariable("$$");let l;f?l=w.createMemberExpression(w.createLocalContextIdentifier(),w.createIdentifier("id")):l=w.createLiteral("");const d={type:"BinaryExpression",operator:"+",left:l,right:h};e.arguments.push(d)}else e.arguments.push(t.getNextTACallId());const s=e.callee.property.name,o=`${n}.${s}`,c=Mn.includes(o),u=e._insideAwait===!0;if(c&&!u){const h=Object.assign({},e),f=w.createAwaitExpression(h);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const h=t.generateTempVar();t.addLocalSeriesVar(h);const f=e._insideAwait===!0;let l=Object.assign({},e);f&&(l=w.createAwaitExpression(l));const d=w.createVariableDeclaration(h,l);t.addHoistedStatement(d);const g=w.createIdentifier(h);Object.assign(e,g),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else if(e.callee&&e.callee.type==="Identifier"){if(e.arguments=e.arguments.map(n=>n._isParamCall?n:Ue(n,K,t)),!t.isContextBound(e.callee.name)){const n=t.getNextUserCallId(),a=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),s=[e.callee,n,...e.arguments];e.callee=a,e.arguments=s}e._transformed=!0}if(!r&&e.callee&&e.callee.type==="MemberExpression"){const n=e.callee.property.name;if(t.isUserFunction(n)&&!t.isContextBound(n)){const a=e.callee.object;e.callee.property;const s=e.arguments.map(f=>f._isParamCall?f:Ue(f,K,t));let o=a;a.type==="Identifier"?o=Ue(a,K,t):a.type==="CallExpression"&&(he(a,t),o=Ue(a,K,t));const c=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),u=t.getNextUserCallId(),h=[w.createIdentifier(n),u,o,...s];e.callee=c,e.arguments=h,e._transformed=!0;return}e.callee.object.type==="Identifier"&&se(e.callee.object,t)}e.arguments.forEach(n=>{ee(n,{parent:e},{Identifier(a,s,o){a.parent=s.parent,se(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?Fe(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===K&&a.parent.callee.property.name==="get"||Pe(a)))},BinaryExpression(a,s,o){const c={...s,parent:a};o(a.left,c),o(a.right,c)},LogicalExpression(a,s,o){const c={...s,parent:a};o(a.left,c),o(a.right,c)},UnaryExpression(a,s,o){const c={...s,parent:a};o(a.argument,c)},CallExpression(a,s,o){a._transformed||he(a,t)},MemberExpression(a,s,o){we(a,"",t),a.object&&o(a.object,{parent:a})}})})}function ar(e,t){let i=null;if(e.left.type==="Identifier")i=te(e.left.name,t);else if(e.left.type==="MemberExpression"&&e.left.computed){if(e.left.object.type==="Identifier"){const r=e.left.object.name,[n,a]=t.getVariable(r),s=n!==r,o=t.isContextBound(r);(s||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=te(r,t))}}else if(e.left.type==="MemberExpression"&&!e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[n,a]=t.getVariable(r);if(n!==r&&!t.isLoopVariable(r)){const s=te(r,t),o=w.createGetCall(s,0);e.left.object=o}}if(ee(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,a){r.name=="na"&&(r.name="NaN"),r.parent=n.parent,se(r,t);const s=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",c=t.isContextBound(r.name)&&!t.isRootParam(r.name),u=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,h=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",l=r.name==="NaN",d=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===K&&r.parent.callee.property.name==="get";(c||o||s)&&(r.type==="MemberExpression"?Fe(r,t):r.type==="Identifier"&&!f&&!u&&!h&&!l&&!d&&Pe(r))},MemberExpression(r,n,a){we(r,"",t),r.type==="CallExpression"?r.arguments.forEach(s=>a(s,{parent:r,inNamespaceCall:n.inNamespaceCall})):r.object&&a(r.object,{parent:r,inNamespaceCall:n.inNamespaceCall})},CallExpression(r,n,a){const s=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);he(r,t),r.type==="CallExpression"&&(r.callee.type==="MemberExpression"&&a(r.callee,{parent:r,inNamespaceCall:s||n.inNamespaceCall}),r.arguments.forEach(o=>a(o,{parent:r,inNamespaceCall:s||n.inNamespaceCall})))}}),i){let r=e.right;if(e.operator!=="="){const a=e.operator.replace("=",""),s=w.createGetCall(i,0);r={type:"BinaryExpression",operator:a,left:s,right:e.right,start:e.start,end:e.end}}const n=w.createSetCall(i,r);e.start&&(n.start=e.start),e.end&&(n.end=e.end),Object.assign(e,n)}}function or(e,t){e._skipTransformation||e.declarations.forEach(i=>{i.init&&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===K||i.init.object.name==="context2"),n=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===K||i.init.object.object.name==="context2"),a=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(l=>{l.key.name&&t.addContextBoundVar(l.key.name)}),i.init.object.name=K;return}if(n){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(l=>{l.key.name&&t.addContextBoundVar(l.key.name)}),i.init.object.object.name=K;return}t.addVariable(i.id.name,e.kind);const s=e.kind,o=t.isArrayPatternElement(i.id.name);i.init&&!a&&!o&&(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)?he(i.init,t):ee(i.init,{parent:i.init},{Identifier(l,d){l.parent=d.parent,se(l,t);const g=l.parent&&l.parent.type==="BinaryExpression",y=l.parent&&l.parent.type==="UnaryExpression",v=l.parent&&l.parent.type==="ConditionalExpression",b=l.parent&&l.parent.type==="CallExpression"&&l.parent.callee&&l.parent.callee.object&&l.parent.callee.object.name===K&&l.parent.callee.property.name==="get";l.type==="Identifier"&&(g||y||v)&&!b&&Pe(l)},CallExpression(l,d,g){l.callee.type==="Identifier"&&(l.callee.parent=l),l.arguments.forEach(y=>{y.type==="Identifier"&&(y.parent=l)}),(l.callee.type==="ArrowFunctionExpression"||l.callee.type==="FunctionExpression")&&g(l.callee,{parent:l}),he(l,t),l.type==="CallExpression"&&(l.callee.type==="MemberExpression"&&g(l.callee,{parent:l}),l.arguments.forEach(y=>g(y,{parent:l})))},BinaryExpression(l,d,g){l.left.type==="Identifier"&&(l.left.parent=l),l.right.type==="Identifier"&&(l.right.parent=l),g(l.left,{parent:l}),g(l.right,{parent:l})},MemberExpression(l,d,g){l.object&&l.object.type==="Identifier"&&(l.object.parent=l),l.property&&l.property.type==="Identifier"&&(l.property.parent=l),we(l,"",t),l.type==="CallExpression"?l.arguments.forEach(y=>g(y,{parent:l})):l.object&&g(l.object,{parent:l})},AwaitExpression(l,d,g){l.argument&&(l.argument._insideAwait=!0,g(l.argument,{parent:l}),l.argument.type==="Identifier"&&l.argument._wasInsideAwait&&Object.assign(l,l.argument))},ArrowFunctionExpression(l,d,g){if(l.body)if(l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(v=>{t.enterHoistingScope(),g(v,{parent:l.body});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.body.body=y}else g(l.body,{parent:l})},FunctionExpression(l,d,g){if(l.body&&l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(v=>{t.enterHoistingScope(),g(v,{parent:l.body});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.body.body=y}},SwitchStatement(l,d,g){l.discriminant&&(l.discriminant.parent=l,g(l.discriminant,{parent:l})),l.cases&&l.cases.forEach(y=>{y.parent=l,g(y,{parent:l})})},SwitchCase(l,d,g){if(l.test&&(l.test.parent=l,g(l.test,{parent:l})),l.consequent){const y=[];l.consequent.forEach(v=>{t.enterHoistingScope(),v.parent=l,g(v,{parent:l});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.consequent=y}}}));const c=te(i.id.name,t),u=!o&&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||(Fe(i.init.property,t),i.init.property._indexTransformed=!0));let h;i.init?a||o?h=i.init:s==="var"?h=w.createInitVarCall(c,i.init):h=w.createInitCall(c,u?i.init.object:i.init,u?i.init.property:void 0):h=w.createIdentifier("undefined");const f=w.createExpressionStatement(w.createAssignmentExpression(c,h));if(o){const l=i.init.object.name,d=te(l,t),g=i.init.property.value,y={type:"MemberExpression",object:w.createGetCall(d,0),property:{type:"Literal",value:g},computed:!0};f.expression.right=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("init")),[c,y])}a&&(t.pushScope("fn"),ee(i.init.body,t,{IfStatement(l,d,g){d.pushScope("if"),g(l.consequent,d),l.alternate&&(d.pushScope("els"),g(l.alternate,d),d.popScope()),d.popScope()},VariableDeclaration(l,d){or(l,d)},Identifier(l,d){se(l,d)},AssignmentExpression(l,d){ar(l,d)},SwitchStatement(l,d,g){l.discriminant.parent=l,g(l.discriminant,d),l.cases.forEach(y=>{y.parent=l,g(y,d)})},SwitchCase(l,d,g){l.test&&(l.test.parent=l,g(l.test,d));const y=[];l.consequent.forEach(v=>{d.enterHoistingScope(),g(v,d);const b=d.exitHoistingScope();y.push(...b),y.push(v)}),l.consequent=y},BlockStatement(l,d,g){const y=[];l.body.forEach(v=>{d.enterHoistingScope(),g(v,d);const b=d.exitHoistingScope();y.push(...b),y.push(v)}),l.body=y}}),t.popScope()),Object.assign(e,f)})}function Gn(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],n=r.id.name;t.addLoopVariable(n,n),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:r.init}]},r.init&&ee(r.init,t,{Identifier(a,s){t.isLoopVariable(a.name)||(t.pushScope("for"),se(a,s),t.popScope())},MemberExpression(a){t.pushScope("for"),we(a,"",t),t.popScope()}})}e.test&&ee(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),se(r,n),r.type==="Identifier"&&(r.computed=!0,Pe(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),we(r,"",t),t.popScope()}}),e.update&&ee(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),se(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function zn(e,t){ee(e,t,{MemberExpression(i){we(i,"",t)},CallExpression(i,r){he(i,r)},Identifier(i,r){se(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&Pe(i)}})}function Yn(e,t,i){e.test&&(t.pushScope("if"),zn(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 Qn(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>r.type==="Identifier"?t.isContextBound(r.name)&&!t.isRootParam(r.name)?w.createGetCall(r,0):nr(r.name,t):r.type==="MemberExpression"?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)?w.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||we(r,"",t),r):r),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>r.shorthand?t.isContextBound(r.value.name)?r:(t.getVariable(r.value.name),{type:"Property",key:w.createIdentifier(r.key.name),value:te(r.value.name,t),kind:"init",method:!1,shorthand:!1,computed:!1}):(r.value&&r.value.type==="Identifier"&&(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name)||t.isContextBound(r.value.name)||(r.value=te(r.value.name,t))),r)):e.argument.type==="Identifier"&&(se(e.argument,t),e.argument.type==="Identifier"&&Pe(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=w.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||(Fe(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&ee(e.argument,t,{Identifier(n,a){se(n,a),n.type==="Identifier"&&!n._arrayAccessed&&(Pe(n),n._arrayAccessed=!0)},MemberExpression(n){we(n,"",t)},CallExpression(n,a,s){(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")&&s(n.callee,a),he(n,a),n.type==="CallExpression"&&n.arguments.forEach(o=>s(o,a))},BinaryExpression(n,a,s){s(n.left,a),s(n.right,a)},ArrowFunctionExpression(n,a,s){if(n.body)if(n.body.type==="BlockStatement"){const o=[];n.body.body.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.body.body=o}else s(n.body,a)},FunctionExpression(n,a,s){if(n.body&&n.body.type==="BlockStatement"){const o=[];n.body.body.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.body.body=o}},SwitchStatement(n,a,s){n.discriminant.parent=n,s(n.discriminant,a),n.cases.forEach(o=>{o.parent=n,s(o,a)})},SwitchCase(n,a,s){n.test&&(n.test.parent=n,s(n.test,a));const o=[];n.consequent.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.consequent=o},BlockStatement(n,a,s){const o=[];n.body.forEach(c=>{a.enterHoistingScope(),s(c,a);const u=a.exitHoistingScope();o.push(...u),o.push(c)}),n.body=o}});const r=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("precision")),[e.argument]);e.argument=r}}function Xn(e,t,i){const r=w.createVariableDeclaration("$$",w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("peekCtx")),[]));r._skipTransformation=!0,t.addLoopVariable("$$","$$"),e.body&&e.body.type==="BlockStatement"&&(e.body.body.unshift(r),t.pushScope("fn"),e.params.forEach(n=>{n.type==="Identifier"&&t.addLocalSeriesVar(n.name)}),i(e.body,t),e.params.forEach(n=>{n.type==="Identifier"&&t.removeLocalSeriesVar(n.name)}),t.popScope())}function Zn(e){const t={...S,LineComment:()=>{}};tr(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,n=i.right,a=w.createMathEqCall(r,n);a._transformed=!0,Object.assign(i,a)}}},t)}function Jn(e,t,i,r={debug:!1,ln:!1},n=[]){const a=s=>{if(!r.debug||!s.loc||!n.length)return null;const o=s.loc.start.line-1;if(o>=0&&o<n.length){const c=n[o].trim();if(c)return{type:"LineComment",value:`${r.ln?` [Line ${s.loc.start.line}]`:""} ${c}`}}return null};ee(e,t,{Program(s,o,c){const u=[];s.body.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...f),u.push(h)}),s.body=u},BlockStatement(s,o,c){const u=[];s.body.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...f),u.push(h)}),s.body=u},ReturnStatement(s,o){Qn(s,o)},VariableDeclaration(s,o){or(s,o)},Identifier(s,o){se(s,o)},CallExpression(s,o,c){s.callee&&(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&c(s.callee,o),he(s,o)},ArrowFunctionExpression(s,o,c){s.body&&c(s.body,o)},FunctionExpression(s,o,c){s.body&&c(s.body,o)},ForOfStatement(s,o,c){if(s.left&&s.left.type==="VariableDeclaration"){s.left._skipTransformation=!0;const u=s.left.declarations[0];u.id.type==="Identifier"?o.addLoopVariable(u.id.name,u.id.name):u.id.type==="ArrayPattern"&&u.id.elements.forEach(h=>{h.type==="Identifier"&&o.addLoopVariable(h.name,h.name)})}if(s.right&&s.right.type==="Identifier"){se(s.right,o),Pe(s.right);const u={...s.right};let h=w.createMemberExpression(u,w.createIdentifier("array"),!1);s.left&&s.left.type==="VariableDeclaration"&&s.left.declarations[0].id.type==="ArrayPattern"&&(h=w.createCallExpression(w.createMemberExpression(h,w.createIdentifier("entries"),!1),[])),Object.assign(s.right,h)}else s.right&&c(s.right,o);s.body&&c(s.body,o)},ForInStatement(s,o,c){s.left&&s.left.type==="VariableDeclaration"&&(s.left._skipTransformation=!0),s.right&&s.right.type==="Identifier"?(se(s.right,o),Pe(s.right)):s.right&&c(s.right,o),s.body&&c(s.body,o)},MemberExpression(s,o){we(s,i,o)},AssignmentExpression(s,o){ar(s,o)},FunctionDeclaration(s,o,c){Xn(s,o,c)},ForStatement(s,o,c){Gn(s,o,c)},IfStatement(s,o,c){Yn(s,o,c)},SwitchStatement(s,o,c){s.discriminant.parent=s,c(s.discriminant,o),s.cases.forEach(u=>{u.parent=s,c(u,o)})},SwitchCase(s,o,c){s.test&&(s.test.parent=s,c(s.test,o));const u=[];s.consequent.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope();u.push(...f),u.push(h)}),s.consequent=u},AwaitExpression(s,o,c){s.argument&&(s.argument._insideAwait=!0,c(s.argument,o),s.argument.type==="Identifier"&&s.argument._wasInsideAwait===!0&&(s.type="Identifier",s.name=s.argument.name,s.argument._wasHoisted&&(s._wasHoisted=s.argument._wasHoisted),delete s.argument))}})}const x={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"},es=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),ts=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class is{constructor(t,i,r,n,a=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=a}}var rs=Object.defineProperty,ns=(e,t,i)=>t in e?rs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Te=(e,t,i)=>ns(e,typeof t!="symbol"?t+"":t,i);class ss{constructor(t){Te(this,"source"),Te(this,"pos"),Te(this,"line"),Te(this,"column"),Te(this,"tokens"),Te(this,"indentStack"),Te(this,"atLineStart"),Te(this,"parenDepth"),Te(this,"bracketDepth"),Te(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 qn(e){ee(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(n=>{if(n.init&&n.init.type==="ArrowFunctionExpression"&&n.init.start!==0){const a={type:"FunctionDeclaration",id:n.id,params:n.init.params,body:n.init.body.type==="BlockStatement"?n.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:n.init.body}]},async:n.init.async,generator:!1};Object.assign(t,a)}}),t.body&&t.body.body&&t.body.body.forEach(n=>r(n,i))}})}function Un(e,t){tr(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const n=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===H||r.init.object.name==="context2"),a=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===H||r.init.object.object.name==="context2");(n||a)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(s=>{s.key.name&&t.addContextBoundVar(s.key.name)}))})}})}function Hn(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&i&&t.addContextBoundVar(r.name,i)})}function Kn(e,t){let i;return Dn(e,{FunctionDeclaration(r){r.id&&r.id.name&&(t.addReservedName(r.id.name),t.addUserFunction(r.id.name))},ArrowFunctionExpression(r){const n=r.start===0;n&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=H),Hn(r,t,n)},VariableDeclaration(r,n){const a=n.length>1?n[n.length-2]:null,s=a&&(a.type==="ForOfStatement"||a.type==="ForInStatement")&&a.left===r;r.declarations.forEach(o=>{if(o.id.type==="Identifier")t.addReservedName(o.id.name);else if(o.id.type==="ObjectPattern")o.id.properties.forEach(c=>{c.key&&c.key.type==="Identifier"&&t.addReservedName(c.key.name)});else if(o.id.type==="ArrayPattern"){if(o.id.elements?.forEach(f=>{f&&f.type==="Identifier"&&t.addReservedName(f.name)}),s)return;const c=t.generateTempVar(),u={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:c},init:o.init}]};o.id.elements?.forEach(f=>{f.type==="Identifier"&&t.addArrayPatternElement(f.name)});const h=o.id.elements.map((f,l)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:f,init:{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Literal",value:l},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[u,...h]})}})},ForStatement(r){}}),i}const Gt={type:"Identifier",name:"undefined"};function te(e,t){const[i,r]=t.getVariable(e);if(i.match(/^fn\d+_/)&&e!=="$$"){const[n]=t.getVariable("$$");if(n)return w.createLocalContextVariableReference(r,i)}return w.createContextVariableReference(r,i)}function nr(e,t){const i=te(e,t);return w.createGetCall(i,0)}function Fe(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)){if(t.isLocalSeriesVar(e.object.name)){const i=w.createIdentifier(e.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0;return}if(!t.isContextBound(e.object.name)){const i=te(e.object.name,t),r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0}}return}t.isContextBound(e.property.name)||(e.property=te(e.property.name,t),e.property=w.createGetCall(e.property,0))}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(t.isLocalSeriesVar(e.object.name)){const i=w.createIdentifier(e.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,e.property);Object.assign(e,r),e._indexTransformed=!0;return}if(t.isContextBound(e.object.name)||(e.object=te(e.object.name,t)),e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Fe(i,t),i._indexTransformed=!0)}}}function Pe(e,t){const i=w.createGetCall(w.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 se(e,t){if(!e._skipTransformation&&e.name!==H){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 l=e.parent.callee;if(l.type==="MemberExpression"&&l.object&&l.object.name===H&&["get","set","init","param","call"].includes(l.property.name)){const d=e.parent.arguments.indexOf(e);l.property.name==="call"?d>=2&&(i=!0):d===0&&(i=!0)}else{const d=l.type==="MemberExpression"&&l.object&&l.object.type==="Identifier"&&ht.includes(l.object.name);l.type==="MemberExpression"&&!d?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),n=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 a=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,s=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||n||i||o||a){if(a||e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.object&&e.parent.callee.object.name===H&&e.parent.callee.property.name==="call"&&e.parent.arguments[0]===e||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const l=te(e.name,t);Object.assign(e,l);return}const c=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(c){const l=e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e),d=e.parent&&e.parent.type==="SwitchStatement"&&e.parent.discriminant===e,g=e.parent&&e.parent.type==="SwitchCase"&&e.parent.test===e;if(!l&&!d&&!g)return}if(t.isLocalSeriesVar(e.name)){if(!s){const l=w.createIdentifier(e.name),d=w.createGetCall(l,0);Object.assign(e,d)}return}const[u,h]=t.getVariable(e.name);let f;if(c)f=w.createIdentifier(e.name);else{if(u===e.name&&!t.isContextBound(e.name))return;f=te(e.name,t)}if(s)Object.assign(e,f);else{const l=w.createGetCall(f,0);Object.assign(e,l)}}}function we(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&ht.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const c=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,u=e.parent&&(e.parent.type==="VariableDeclarator"&&(e.parent.id.type==="ArrayPattern"||e.parent.id.type==="ObjectPattern")||e.parent.type==="AssignmentExpression"&&(e.parent.left.type==="ArrayPattern"||e.parent.left.type==="ObjectPattern")||e.parent.type==="Property");if(!c&&!u){const h={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(h.start=e.start),e.end!==void 0&&(h.end=e.end),Object.assign(e,h);return}}const r=i.getCurrentScopeType()=="if",n=i.getCurrentScopeType()=="els",a=i.getCurrentScopeType()=="for";if(!r&&!n&&!a&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Fe(e,i),e._indexTransformed=!0);const s=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&(e.object.object.object.name===H||e.object.object.object.name==="$$"),o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(s||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const c=w.createGetCall(e.object,e.property);e.start&&(c.start=e.start),e.end&&(c.end=e.end),Object.assign(e,c),delete e.object,delete e.property,delete e.computed}}function lt(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[a,s]=t.getVariable(e.name);return w.createContextVariableReference(s,a)}if(t.isContextBound(e.name))return e;const[i,r]=t.getVariable(e.name),n=i!==e.name;return t.isLocalSeriesVar(e.name)&&!n?e:n?te(e.name,t):i===e.name&&!t.isContextBound(e.name)?e:te(e.name,t)}return e}function We(e,t,i=""){switch(e.type){case"BinaryExpression":return zt(e,t,i);case"LogicalExpression":return Yt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?lt(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=lt(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:w.createGetCall(r,0)}case"UnaryExpression":return Qt(e,t,i);case"ConditionalExpression":{const r=We(e.test,t,i),n=We(e.consequent,t,i),a=We(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:n,alternate:a,start:e.start,end:e.end}}}return e}function zt(e,t,i){const r=We(e.left,t,i),n=We(e.right,t,i),a={type:"BinaryExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return ee(a,t,{CallExpression(s,o){s._transformed||he(s,o)},MemberExpression(s){we(s,"",t)}}),a}function Yt(e,t,i){const r=We(e.left,t,i),n=We(e.right,t,i),a={type:"LogicalExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return ee(a,t,{CallExpression(s,o){s._transformed||he(s,o)}}),a}function sr(e,t,i){ee(e,{parent:e,inNamespaceCall:!1},{Identifier(s,o,c){if(s.name=="NaN")return;if(s.name=="na"){s.name="NaN";return}s.parent=o.parent,se(s,t);const u=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||u)&&(s.type==="MemberExpression"?Fe(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===H&&s.parent.callee.property.name==="get"||Pe(s)))},MemberExpression(s,o,c){Fe(s,t),s.object&&c(s.object,{parent:s,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(s,o,c){const u={...o,parent:s};s.test&&c(s.test,u),s.consequent&&c(s.consequent,u),s.alternate&&c(s.alternate,u)},BinaryExpression(s,o,c){const u={...o,parent:s};c(s.left,u),c(s.right,u)},LogicalExpression(s,o,c){const u={...o,parent:s};c(s.left,u),c(s.right,u)},UnaryExpression(s,o,c){const u={...o,parent:s};c(s.argument,u)},CallExpression(s,o,c){const u=s.callee&&s.callee.type==="MemberExpression"&&s.callee.object&&s.callee.object.type==="Identifier"&&t.isContextBound(s.callee.object.name);he(s,t),s.arguments.forEach(h=>c(h,{parent:s,inNamespaceCall:u||o.inNamespaceCall}))}});const r=w.createMemberExpression(w.createIdentifier(i),w.createIdentifier("param")),n=t.generateParamId(),a={type:"CallExpression",callee:r,arguments:[e,Gt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const s=n;t.addLocalSeriesVar(s);const o=w.createVariableDeclaration(s,a);return t.addHoistedStatement(o),w.createIdentifier(s)}return a}function Qt(e,t,i){const r=We(e.argument,t,i),n={type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end};return ee(n,t,{CallExpression(a,s){a._transformed||he(a,s)},MemberExpression(a){we(a,"",t)}}),n}function Ue(e,t,i){switch(e?.type){case"BinaryExpression":e=zt(e,i,t);break;case"LogicalExpression":e=Yt(e,i,t);break;case"ConditionalExpression":return sr(e,i,t);case"UnaryExpression":e=Qt(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(u=>u.type==="Identifier"?i.isContextBound(u.name)&&!i.isRootParam(u.name)?u:nr(u.name,i):u);break}const r=e.type==="MemberExpression"&&e.computed&&e.property,n=e.type==="MemberExpression"&&!e.computed;if(r){e.object.type==="CallExpression"?he(e.object,i):e.object.type==="MemberExpression"?we(e.object,"",i):e.object.type==="BinaryExpression"?e.object=zt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Yt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=sr(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Qt(e.object,i,t));const u=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:lt(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?lt(e.property,i):e.property,f=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),l=i.generateParamId(),d={type:"CallExpression",callee:f,arguments:[u,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const y=w.createVariableDeclaration(g,d);return i.addHoistedStatement(y),w.createIdentifier(g)}return d}if(n)if(e.object.type==="Identifier"){const u=e.object.name,[h,f]=i.getVariable(u);if(h!==u&&!i.isLoopVariable(u)){const l=w.createContextVariableReference(f,h),d=w.createGetCall(l,0);e.object=d}}else e.object.type==="MemberExpression"&&Ue(e.object,t,i);if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(u=>u.value.name?i.isContextBound(u.value.name)&&!i.isRootParam(u.value.name)?{type:"Property",key:{type:"Identifier",name:u.key.name},value:w.createIdentifier(u.value.name),kind:"init",method:!1,shorthand:!1,computed:!1}:{type:"Property",key:{type:"Identifier",name:u.key.name},value:te(u.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(u.value.type!=="Literal"&&(u.value=Ue(u.value,t,i)),u))),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const u=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),h=i.generateParamId(),f={type:"CallExpression",callee:u,arguments:[e,Gt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const d=w.createVariableDeclaration(l,f);return i.addHoistedStatement(d),w.createIdentifier(l)}return f}}e?.type==="CallExpression"&&he(e,i);const a=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),s=e.type==="Identifier"?lt(e,i):e,o=i.generateParamId(),c={type:"CallExpression",callee:a,arguments:[s,Gt,{type:"Identifier",name:`'${o}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const u=o;i.addLocalSeriesVar(u);const h=w.createVariableDeclaration(u,c);return i.addHoistedStatement(h),w.createIdentifier(u)}return c}function he(e,t,i){if(e._transformed)return;e.callee&&e.callee.name,e.callee&&e.callee.type==="Identifier"&&(ht.includes(e.callee.name)||Ln.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=w.createMemberExpression(e.callee,w.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===H&&["get","init","param"].includes(e.callee.property.name))return;const n=e.callee.object.name,a=[];if(e.arguments.forEach(h=>{if(h._isParamCall){a.push(h);return}a.push(Ue(h,n,t))}),e.arguments=a,n==="ta")if(t.getCurrentScopeType()==="fn"){const h=t.getNextTACallId(),[f]=t.getVariable("$$");let l;f?l=w.createMemberExpression(w.createLocalContextIdentifier(),w.createIdentifier("id")):l=w.createLiteral("");const d={type:"BinaryExpression",operator:"+",left:l,right:h};e.arguments.push(d)}else e.arguments.push(t.getNextTACallId());const s=e.callee.property.name,o=`${n}.${s}`,c=On.includes(o),u=e._insideAwait===!0;if(c&&!u){const h=Object.assign({},e),f=w.createAwaitExpression(h);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const h=t.generateTempVar();t.addLocalSeriesVar(h);const f=e._insideAwait===!0;let l=Object.assign({},e);f&&(l=w.createAwaitExpression(l));const d=w.createVariableDeclaration(h,l);t.addHoistedStatement(d);const g=w.createIdentifier(h);Object.assign(e,g),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else if(e.callee&&e.callee.type==="Identifier"){if(e.arguments=e.arguments.map(n=>n._isParamCall?n:Ue(n,H,t)),!t.isContextBound(e.callee.name)){const n=t.getNextUserCallId(),a=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),s=[e.callee,n,...e.arguments];e.callee=a,e.arguments=s}e._transformed=!0}if(!r&&e.callee&&e.callee.type==="MemberExpression"){const n=e.callee.property.name;if(t.isUserFunction(n)&&!t.isContextBound(n)){const a=e.callee.object;e.callee.property;const s=e.arguments.map(f=>f._isParamCall?f:Ue(f,H,t));let o=a;a.type==="Identifier"?o=Ue(a,H,t):a.type==="CallExpression"&&(he(a,t),o=Ue(a,H,t));const c=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),u=t.getNextUserCallId(),h=[w.createIdentifier(n),u,o,...s];e.callee=c,e.arguments=h,e._transformed=!0;return}e.callee.object.type==="Identifier"&&se(e.callee.object,t)}e.arguments.forEach(n=>{ee(n,{parent:e},{Identifier(a,s,o){a.parent=s.parent,se(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?Fe(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===H&&a.parent.callee.property.name==="get"||Pe(a)))},BinaryExpression(a,s,o){const c={...s,parent:a};o(a.left,c),o(a.right,c)},LogicalExpression(a,s,o){const c={...s,parent:a};o(a.left,c),o(a.right,c)},UnaryExpression(a,s,o){const c={...s,parent:a};o(a.argument,c)},CallExpression(a,s,o){a._transformed||he(a,t)},MemberExpression(a,s,o){we(a,"",t),a.object&&o(a.object,{parent:a})}})})}function ar(e,t){let i=null;if(e.left.type==="Identifier")i=te(e.left.name,t);else if(e.left.type==="MemberExpression"&&e.left.computed){if(e.left.object.type==="Identifier"){const r=e.left.object.name,[n,a]=t.getVariable(r),s=n!==r,o=t.isContextBound(r);(s||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=te(r,t))}}else if(e.left.type==="MemberExpression"&&!e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[n,a]=t.getVariable(r);if(n!==r&&!t.isLoopVariable(r)){const s=te(r,t),o=w.createGetCall(s,0);e.left.object=o}}if(ee(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,a){r.name=="na"&&(r.name="NaN"),r.parent=n.parent,se(r,t);const s=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",c=t.isContextBound(r.name)&&!t.isRootParam(r.name),u=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,h=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",l=r.name==="NaN",d=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===H&&r.parent.callee.property.name==="get";(c||o||s)&&(r.type==="MemberExpression"?Fe(r,t):r.type==="Identifier"&&!f&&!u&&!h&&!l&&!d&&Pe(r))},MemberExpression(r,n,a){we(r,"",t),r.type==="CallExpression"?r.arguments.forEach(s=>a(s,{parent:r,inNamespaceCall:n.inNamespaceCall})):r.object&&a(r.object,{parent:r,inNamespaceCall:n.inNamespaceCall})},CallExpression(r,n,a){const s=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);he(r,t),r.type==="CallExpression"&&(r.callee.type==="MemberExpression"&&a(r.callee,{parent:r,inNamespaceCall:s||n.inNamespaceCall}),r.arguments.forEach(o=>a(o,{parent:r,inNamespaceCall:s||n.inNamespaceCall})))}}),i){let r=e.right;if(e.operator!=="="){const a=e.operator.replace("=",""),s=w.createGetCall(i,0);r={type:"BinaryExpression",operator:a,left:s,right:e.right,start:e.start,end:e.end}}const n=w.createSetCall(i,r);e.start&&(n.start=e.start),e.end&&(n.end=e.end),Object.assign(e,n)}}function or(e,t){e._skipTransformation||e.declarations.forEach(i=>{i.init&&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===H||i.init.object.name==="context2"),n=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===H||i.init.object.object.name==="context2"),a=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(l=>{l.key.name&&t.addContextBoundVar(l.key.name)}),i.init.object.name=H;return}if(n){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(l=>{l.key.name&&t.addContextBoundVar(l.key.name)}),i.init.object.object.name=H;return}t.addVariable(i.id.name,e.kind);const s=e.kind,o=t.isArrayPatternElement(i.id.name);i.init&&!a&&!o&&(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)?he(i.init,t):ee(i.init,{parent:i.init},{Identifier(l,d){l.parent=d.parent,se(l,t);const g=l.parent&&l.parent.type==="BinaryExpression",y=l.parent&&l.parent.type==="UnaryExpression",v=l.parent&&l.parent.type==="ConditionalExpression",b=l.parent&&l.parent.type==="CallExpression"&&l.parent.callee&&l.parent.callee.object&&l.parent.callee.object.name===H&&l.parent.callee.property.name==="get";l.type==="Identifier"&&(g||y||v)&&!b&&Pe(l)},CallExpression(l,d,g){l.callee.type==="Identifier"&&(l.callee.parent=l),l.arguments.forEach(y=>{y.type==="Identifier"&&(y.parent=l)}),(l.callee.type==="ArrowFunctionExpression"||l.callee.type==="FunctionExpression")&&g(l.callee,{parent:l}),he(l,t),l.type==="CallExpression"&&(l.callee.type==="MemberExpression"&&g(l.callee,{parent:l}),l.arguments.forEach(y=>g(y,{parent:l})))},BinaryExpression(l,d,g){l.left.type==="Identifier"&&(l.left.parent=l),l.right.type==="Identifier"&&(l.right.parent=l),g(l.left,{parent:l}),g(l.right,{parent:l})},MemberExpression(l,d,g){l.object&&l.object.type==="Identifier"&&(l.object.parent=l),l.property&&l.property.type==="Identifier"&&(l.property.parent=l),we(l,"",t),l.type==="CallExpression"?l.arguments.forEach(y=>g(y,{parent:l})):l.object&&g(l.object,{parent:l})},AwaitExpression(l,d,g){l.argument&&(l.argument._insideAwait=!0,g(l.argument,{parent:l}),l.argument.type==="Identifier"&&l.argument._wasInsideAwait&&Object.assign(l,l.argument))},ArrowFunctionExpression(l,d,g){if(l.body)if(l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(v=>{t.enterHoistingScope(),g(v,{parent:l.body});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.body.body=y}else g(l.body,{parent:l})},FunctionExpression(l,d,g){if(l.body&&l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(v=>{t.enterHoistingScope(),g(v,{parent:l.body});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.body.body=y}},SwitchStatement(l,d,g){l.discriminant&&(l.discriminant.parent=l,g(l.discriminant,{parent:l})),l.cases&&l.cases.forEach(y=>{y.parent=l,g(y,{parent:l})})},SwitchCase(l,d,g){if(l.test&&(l.test.parent=l,g(l.test,{parent:l})),l.consequent){const y=[];l.consequent.forEach(v=>{t.enterHoistingScope(),v.parent=l,g(v,{parent:l});const b=t.exitHoistingScope();y.push(...b),y.push(v)}),l.consequent=y}}}));const c=te(i.id.name,t),u=!o&&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||(Fe(i.init.property,t),i.init.property._indexTransformed=!0));let h;i.init?a||o?h=i.init:s==="var"?h=w.createInitVarCall(c,i.init):h=w.createInitCall(c,u?i.init.object:i.init,u?i.init.property:void 0):h=w.createIdentifier("undefined");const f=w.createExpressionStatement(w.createAssignmentExpression(c,h));if(o){const l=i.init.object.name,d=te(l,t),g=i.init.property.value,y={type:"MemberExpression",object:w.createGetCall(d,0),property:{type:"Literal",value:g},computed:!0};f.expression.right=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("init")),[c,y])}a&&(t.pushScope("fn"),ee(i.init.body,t,{IfStatement(l,d,g){d.pushScope("if"),g(l.consequent,d),l.alternate&&(d.pushScope("els"),g(l.alternate,d),d.popScope()),d.popScope()},VariableDeclaration(l,d){or(l,d)},Identifier(l,d){se(l,d)},AssignmentExpression(l,d){ar(l,d)},SwitchStatement(l,d,g){l.discriminant.parent=l,g(l.discriminant,d),l.cases.forEach(y=>{y.parent=l,g(y,d)})},SwitchCase(l,d,g){l.test&&(l.test.parent=l,g(l.test,d));const y=[];l.consequent.forEach(v=>{d.enterHoistingScope(),g(v,d);const b=d.exitHoistingScope();y.push(...b),y.push(v)}),l.consequent=y},BlockStatement(l,d,g){const y=[];l.body.forEach(v=>{d.enterHoistingScope(),g(v,d);const b=d.exitHoistingScope();y.push(...b),y.push(v)}),l.body=y}}),t.popScope()),Object.assign(e,f)})}function Gn(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],n=r.id.name;t.addLoopVariable(n,n),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:r.init}]},r.init&&ee(r.init,t,{Identifier(a,s){t.isLoopVariable(a.name)||(t.pushScope("for"),se(a,s),t.popScope())},MemberExpression(a){t.pushScope("for"),we(a,"",t),t.popScope()}})}e.test&&ee(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),se(r,n),r.type==="Identifier"&&(r.computed=!0,Pe(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),we(r,"",t),t.popScope()}}),e.update&&ee(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),se(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function zn(e,t){ee(e,t,{MemberExpression(i){we(i,"",t)},CallExpression(i,r){he(i,r)},Identifier(i,r){se(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&Pe(i)}})}function Yn(e,t,i){e.test&&(t.pushScope("if"),zn(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 Qn(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>r.type==="Identifier"?t.isContextBound(r.name)&&!t.isRootParam(r.name)?w.createGetCall(r,0):nr(r.name,t):r.type==="MemberExpression"?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)?w.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||we(r,"",t),r):r),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>r.shorthand?t.isContextBound(r.value.name)?r:(t.getVariable(r.value.name),{type:"Property",key:w.createIdentifier(r.key.name),value:te(r.value.name,t),kind:"init",method:!1,shorthand:!1,computed:!1}):(r.value&&r.value.type==="Identifier"&&(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name)||t.isContextBound(r.value.name)||(r.value=te(r.value.name,t))),r)):e.argument.type==="Identifier"&&(se(e.argument,t),e.argument.type==="Identifier"&&Pe(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=w.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||(Fe(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&ee(e.argument,t,{Identifier(n,a){se(n,a),n.type==="Identifier"&&!n._arrayAccessed&&(Pe(n),n._arrayAccessed=!0)},MemberExpression(n){we(n,"",t)},CallExpression(n,a,s){(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")&&s(n.callee,a),he(n,a),n.type==="CallExpression"&&n.arguments.forEach(o=>s(o,a))},BinaryExpression(n,a,s){s(n.left,a),s(n.right,a)},ArrowFunctionExpression(n,a,s){if(n.body)if(n.body.type==="BlockStatement"){const o=[];n.body.body.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.body.body=o}else s(n.body,a)},FunctionExpression(n,a,s){if(n.body&&n.body.type==="BlockStatement"){const o=[];n.body.body.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.body.body=o}},SwitchStatement(n,a,s){n.discriminant.parent=n,s(n.discriminant,a),n.cases.forEach(o=>{o.parent=n,s(o,a)})},SwitchCase(n,a,s){n.test&&(n.test.parent=n,s(n.test,a));const o=[];n.consequent.forEach(c=>{t.enterHoistingScope(),s(c,a);const u=t.exitHoistingScope();o.push(...u),o.push(c)}),n.consequent=o},BlockStatement(n,a,s){const o=[];n.body.forEach(c=>{a.enterHoistingScope(),s(c,a);const u=a.exitHoistingScope();o.push(...u),o.push(c)}),n.body=o}});const r=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("precision")),[e.argument]);e.argument=r}}function Xn(e,t,i){const r=w.createVariableDeclaration("$$",w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("peekCtx")),[]));r._skipTransformation=!0,t.addLoopVariable("$$","$$"),e.body&&e.body.type==="BlockStatement"&&(e.body.body.unshift(r),t.pushScope("fn"),e.params.forEach(n=>{n.type==="Identifier"&&t.addLocalSeriesVar(n.name)}),i(e.body,t),e.params.forEach(n=>{n.type==="Identifier"&&t.removeLocalSeriesVar(n.name)}),t.popScope())}function Zn(e){const t={...S,LineComment:()=>{}};tr(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,n=i.right,a=w.createMathEqCall(r,n);a._transformed=!0,Object.assign(i,a)}}},t)}function Jn(e,t,i,r={debug:!1,ln:!1},n=[]){const a=s=>{if(!r.debug||!s.loc||!n.length)return null;const o=s.loc.start.line-1;if(o>=0&&o<n.length){const c=n[o].trim();if(c)return{type:"LineComment",value:`${r.ln?` [Line ${s.loc.start.line}]`:""} ${c}`}}return null};ee(e,t,{Program(s,o,c){const u=[];s.body.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...f),u.push(h)}),s.body=u},BlockStatement(s,o,c){const u=[];s.body.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...f),u.push(h)}),s.body=u},ReturnStatement(s,o){Qn(s,o)},VariableDeclaration(s,o){or(s,o)},Identifier(s,o){se(s,o)},CallExpression(s,o,c){s.callee&&(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&c(s.callee,o),he(s,o)},ArrowFunctionExpression(s,o,c){s.body&&c(s.body,o)},FunctionExpression(s,o,c){s.body&&c(s.body,o)},ForOfStatement(s,o,c){if(s.left&&s.left.type==="VariableDeclaration"){s.left._skipTransformation=!0;const u=s.left.declarations[0];u.id.type==="Identifier"?o.addLoopVariable(u.id.name,u.id.name):u.id.type==="ArrayPattern"&&u.id.elements.forEach(h=>{h.type==="Identifier"&&o.addLoopVariable(h.name,h.name)})}if(s.right&&s.right.type==="Identifier"){se(s.right,o),Pe(s.right);const u={...s.right};let h=w.createMemberExpression(u,w.createIdentifier("array"),!1);s.left&&s.left.type==="VariableDeclaration"&&s.left.declarations[0].id.type==="ArrayPattern"&&(h=w.createCallExpression(w.createMemberExpression(h,w.createIdentifier("entries"),!1),[])),Object.assign(s.right,h)}else s.right&&c(s.right,o);s.body&&c(s.body,o)},ForInStatement(s,o,c){s.left&&s.left.type==="VariableDeclaration"&&(s.left._skipTransformation=!0),s.right&&s.right.type==="Identifier"?(se(s.right,o),Pe(s.right)):s.right&&c(s.right,o),s.body&&c(s.body,o)},MemberExpression(s,o){we(s,i,o)},AssignmentExpression(s,o){ar(s,o)},FunctionDeclaration(s,o,c){Xn(s,o,c)},ForStatement(s,o,c){Gn(s,o,c)},IfStatement(s,o,c){Yn(s,o,c)},SwitchStatement(s,o,c){s.discriminant.parent=s,c(s.discriminant,o),s.cases.forEach(u=>{u.parent=s,c(u,o)})},SwitchCase(s,o,c){s.test&&(s.test.parent=s,c(s.test,o));const u=[];s.consequent.forEach(h=>{o.enterHoistingScope(),c(h,o);const f=o.exitHoistingScope();u.push(...f),u.push(h)}),s.consequent=u},AwaitExpression(s,o,c){s.argument&&(s.argument._insideAwait=!0,c(s.argument,o),s.argument.type==="Identifier"&&s.argument._wasInsideAwait===!0&&(s.type="Identifier",s.name=s.argument.name,s.argument._wasHoisted&&(s._wasHoisted=s.argument._wasHoisted),delete s.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"},es=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),ts=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class is{constructor(t,i,r,n,a=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=a}}var rs=Object.defineProperty,ns=(e,t,i)=>t in e?rs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Te=(e,t,i)=>ns(e,typeof t!="symbol"?t+"":t,i);class ss{constructor(t){Te(this,"source"),Te(this,"pos"),Te(this,"line"),Te(this,"column"),Te(this,"tokens"),Te(this,"indentStack"),Te(this,"atLineStart"),Te(this,"parenDepth"),Te(this,"bracketDepth"),Te(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(x.DEDENT,"",this.getCurrentIndent());return this.addToken(x.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(x.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(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,`
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 n=this.peek();if(n===" ")i++,this.advance();else if(n===" ")t++,this.advance();else break}if(this.peek()===`
37
- `||this.peek()==="\r"||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(x.INDENT,"",t);else if(t<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>t;)this.indentStack.pop(),this.addToken(x.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(x.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 n=this.advance();switch(n){case"n":r+=`
39
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=n}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(x.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(x.STRING,i)}readNumber(){this.column;let t="",i=!1;for(this.peek()==="."&&this.isDigit(this.peek(1))&&(i=!0,t+=this.advance());this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const n=this.peek(1);if(this.isDigit(n)||!this.isIdentifierStart(n)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}if(this.pos<this.source.length){const r=this.peek();if(r==="e"||r==="E"){const n=this.peek(1);if(this.isDigit(n))for(t+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)t+=this.advance();else if(n==="+"||n==="-"){const a=this.peek(2);if(this.isDigit(a))for(t+=this.advance(),t+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)t+=this.advance()}}}this.addToken(x.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();es.has(t)?this.addToken(x.KEYWORD,t):t==="true"||t==="false"?this.addToken(x.BOOLEAN,t==="true"):this.addToken(x.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(ts.includes(r))return this.advance(),this.advance(),this.addToken(x.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(x.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(x.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(x.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(x.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(x.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(x.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(x.RBRACE,t),!0;case",":return this.advance(),this.addToken(x.COMMA,t),!0;case".":return this.isDigit(this.peek(1))?(this.readNumber(),!0):(this.advance(),this.addToken(x.DOT,t),!0);case":":return this.advance(),this.addToken(x.COLON,t),!0;case";":return this.advance(),this.addToken(x.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 n=new is(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}var as=Object.defineProperty,os=(e,t,i)=>t in e?as(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,fe=(e,t,i)=>os(e,typeof t!="symbol"?t+"":t,i);class ${constructor(t){this.type=t}}class cs extends ${constructor(t){super("Program"),this.body=t}}class be extends ${constructor(t){super("ExpressionStatement"),this.expression=t}}var He=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(He||{});class Ke extends ${constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Ge extends ${constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class cr extends ${constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class us extends ${constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class hs extends ${constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,fe(this,"_line")}}class ur extends ${constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n,fe(this,"isForIn")}}class ls extends ${constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class je extends ${constructor(t){super("BlockStatement"),this.body=t}}class hr extends ${constructor(t){super("ReturnStatement"),this.argument=t}}class le extends ${constructor(t){super("Identifier"),this.name=t,fe(this,"varType"),fe(this,"returnType"),fe(this,"isMethod")}}class it extends ${constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class ze extends ${constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class lr extends ${constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Xt extends ${constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class ps extends ${constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class fs extends ${constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,fe(this,"arguments"),this.callee=t,this.arguments=i}}class pr extends ${constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class pt extends ${constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,fe(this,"needsIIFE"),fe(this,"consequentStmts"),fe(this,"alternateStmts")}}class ds extends ${constructor(t){super("ArrayExpression"),this.elements=t}}class ms extends ${constructor(t){super("ObjectExpression"),this.properties=t}}class xs extends ${constructor(t,i){super("Property"),this.key=t,this.value=i,fe(this,"kind"),fe(this,"method"),fe(this,"shorthand"),fe(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class fr extends ${constructor(t){super("ArrayPattern"),this.elements=t}}class dr extends ${constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class gs extends ${constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class ys extends ${constructor(t,i,r){super("SwitchCase"),this.test=t,this.consequent=i,this.statements=r,this.statements=r}}var vs=Object.defineProperty,ws=(e,t,i)=>t in e?vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Zt=(e,t,i)=>ws(e,typeof t!="symbol"?t+"":t,i);class bs{constructor(t){Zt(this,"tokens"),Zt(this,"pos"),Zt(this,"functionNames",new Set),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()}matchEx(t,i=null,r=!1){if(!r)return this.match(t,i);let n=0,a=this.peek(n);if(a.type===x.NEWLINE&&(n++,a=this.peek(n),a.type===x.INDENT&&(n++,a=this.peek(n))),a.type!==t||i!==null&&a.value!==i)return!1;for(let s=0;s<n;s++)this.advance();return!0}skipNewlines(t=!1){for(;this.match(x.NEWLINE)||this.match(x.COMMENT);)this.advance();t&&this.match(x.INDENT)&&this.advance()}parse(){const t=[];for(;!this.match(x.EOF);){if(this.skipNewlines(),this.match(x.DEDENT)){this.advance();continue}if(this.match(x.EOF))break;const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new cs(t)}parseStatement(t=!0){this.skipNewlines();const i=this.peek().line;if(this.match(x.COMMENT))return this.advance(),null;let r;if(this.match(x.KEYWORD,"type"))r=this.parseTypeDefinition();else if(this.match(x.KEYWORD,"var")||this.match(x.KEYWORD,"varip"))r=this.parseVarDeclaration();else if(this.match(x.KEYWORD,"method"))r=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())r=this.parseFunctionDeclaration();else if(this.match(x.KEYWORD,"if"))r=this.parseIfStatement();else if(this.match(x.KEYWORD,"for"))r=this.parseForStatement();else if(this.match(x.KEYWORD,"while"))r=this.parseWhileStatement();else if(this.match(x.KEYWORD,"break")||this.match(x.KEYWORD,"continue")){const n=this.advance().value;r=new be(new le(n))}else if(this.isTupleDestructuring())r=this.parseTupleDestructuring();else if(this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER){let n=2;for(;this.peek(n).type===x.IDENTIFIER;)n++;this.peek(n).type===x.OPERATOR&&this.peek(n).value==="="&&(r=this.parseTypedVarDeclaration())}if(!r){const n=this.parseExpression();if(this.match(x.OPERATOR)){const a=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(a)){this.advance(),this.skipNewlines(!0);const s=this.parseExpression();a==="="&&n.type==="Identifier"?r=new Ke([new Ge(n,s)],He.LET):r=new be(new Xt(a===":="?"=":a,n,s))}else r=new be(n)}else r=new be(n)}if(r&&(r._line=i,t&&this.match(x.COMMA)&&this.peek().line===i)){const n=[r];for(;this.match(x.COMMA)&&this.peek().line===i;){this.advance(),this.skipNewlines(!0);const a=this.parseStatement(!1);a&&n.push(a)}return new je(n)}return r}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===x.IDENTIFIER&&this.peek(i+1).type===x.IDENTIFIER&&i++,this.peek(i).type!==x.IDENTIFIER||(i++,this.peek(i).type!==x.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==x.EOF;)this.peek(i).type===x.LPAREN&&r++,this.peek(i).type===x.RPAREN&&r--,i++;for(;this.peek(i).type===x.NEWLINE;)i++;return this.peek(i).type===x.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeExpression(){const t=this.expect(x.IDENTIFIER).value;if(this.match(x.OPERATOR,"<")){this.advance();const i=[];for(i.push(this.parseTypeExpression());this.match(x.COMMA);)this.advance(),this.skipNewlines(),i.push(this.parseTypeExpression());return this.expect(x.OPERATOR,">"),t+"<"+i.join(", ")+">"}return t}parseTypeDefinition(){this.expect(x.KEYWORD,"type");const t=this.expect(x.IDENTIFIER).value;this.match(x.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(x.INDENT);const i=[];for(;!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){const r=this.parseTypeExpression(),n=this.expect(x.IDENTIFIER).value;let a=null;this.match(x.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),a=this.parseExpression()),i.push({type:r,name:n,defaultValue:a}),this.skipNewlines()}return this.match(x.DEDENT)&&this.advance(),new us(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.LBRACKET&&this.peek(2).type===x.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(x.IDENTIFIER).value;else if(this.peek().type===x.IDENTIFIER&&(this.peek(1).type===x.IDENTIFIER||this.peek(1).type===x.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(x.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(x.OPERATOR,">");)if(this.match(x.IDENTIFIER))i+=this.advance().value;else if(this.match(x.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(x.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(x.IDENTIFIER).value}else if(this.peek().type===x.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.functionNames.has(r)&&(r=r+"_var"),this.expect(x.OPERATOR,"="),this.skipNewlines(!0);const n=this.parseExpression(),a=new le(r);return i&&(a.varType=i),new Ke([new Ge(a,n,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER;)t+=" "+this.advance().value;let i=this.expect(x.IDENTIFIER).value;this.functionNames.has(i)&&(i=i+"_var"),this.expect(x.OPERATOR,"="),this.skipNewlines(!0);const r=this.parseExpression(),n=new le(i);return n.varType=t,new Ke([new Ge(n,r,t)],He.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER&&(t=this.advance().value);const i=this.expect(x.IDENTIFIER).value;this.functionNames.add(i),this.expect(x.LPAREN);const r=[];for(;!this.match(x.RPAREN)&&(this.skipNewlines(),!this.match(x.RPAREN));){let s=null;for(;this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER&&this.peek(2).type!==x.LPAREN;)s&&(s+=" "),s=(s||"")+this.advance().value;const o=this.expect(x.IDENTIFIER).value,c=new le(o);if(s&&(c.varType=s),this.match(x.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new dr(c,u))}else r.push(c);this.match(x.COMMA)&&this.advance()}this.expect(x.RPAREN),this.skipNewlines(),this.expect(x.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),a=new le(i);return t&&(a.returnType=t),new cr(a,r,n,t)}parseMethodDeclaration(){this.expect(x.KEYWORD,"method");let t=null;this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER&&this.peek(2).type===x.LPAREN&&(t=this.advance().value);const i=this.expect(x.IDENTIFIER).value;this.expect(x.LPAREN);const r=[];for(;!this.match(x.RPAREN)&&(this.skipNewlines(),!this.match(x.RPAREN));){let s=null;for(;this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER&&this.peek(2).type!==x.LPAREN;)s&&(s+=" "),s=(s||"")+this.advance().value;const o=this.expect(x.IDENTIFIER).value,c=new le(o);if(s&&(c.varType=s),this.match(x.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new dr(c,u))}else r.push(c);this.match(x.COMMA)&&this.advance()}this.expect(x.RPAREN),this.skipNewlines(),this.expect(x.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),a=new le(i);return t&&(a.returnType=t),a.isMethod=!0,new cr(a,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(x.INDENT)){const i=this.parseExpression();return new je([new hr(i)])}for(this.advance();!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(x.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new hr(i.expression))}return new je(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(x.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(x.KEYWORD,"for"))return this.parseForStatement();if(this.match(x.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(x.KEYWORD,"break")||this.match(x.KEYWORD,"continue")){const r=this.advance().value;return new be(new le(r))}if(this.match(x.KEYWORD,"var")||this.match(x.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===x.IDENTIFIER&&this.peek(1).type===x.IDENTIFIER){let r=2;for(;this.peek(r).type===x.IDENTIFIER;)r++;if(this.peek(r).type===x.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(x.OPERATOR)){const n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines(!0);const a=this.parseExpression();if(n==="="&&r.type==="Identifier"?i.push(new Ke([new Ge(r,a)],He.LET)):i.push(new be(new Xt(n===":="?"=":n,r,a))),this.match(x.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new be(r));else return new be(r);break}}else if(this.match(x.COMMA)){i.push(new be(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new be(r));else return new be(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(x.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.skipNewlines(),this.match(x.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(x.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new hs(t,i,r)}parseForStatement(){this.expect(x.KEYWORD,"for");let t=null,i=!1;if(this.match(x.LBRACKET)){this.advance();const r=[];for(;!this.match(x.RBRACKET);)this.skipNewlines(),r.push(new le(this.expect(x.IDENTIFIER).value)),this.match(x.COMMA)&&this.advance();this.expect(x.RBRACKET),t=new fr(r),i=!0}else{const r=this.expect(x.IDENTIFIER).value;t=new le(r)}if(this.match(x.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),a=new Ke([new Ge(t,r)],He.CONST),s=new ur(a,null,null,n);return s.isForIn=!0,s}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(x.OPERATOR,"=");const r=this.parseExpression();this.expect(x.KEYWORD,"to");const n=this.parseExpression();let a=null;this.match(x.KEYWORD,"by")&&(this.advance(),a=this.parseExpression()),this.skipNewlines();const s=this.parseBlock(),o=new Ke([new Ge(t,r)],He.LET),c=new ze("<=",t,n),u=a?new Xt("+=",t,a):new ps("++",t);return new ur(o,c,u,s)}}parseWhileStatement(){this.expect(x.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new ls(t,i)}parseBlock(){if(!this.match(x.INDENT)){const r=this.parseStatement();return new je(r?[r]:[])}const t=this.peek().indent;this.advance();const i=[];for(;!this.match(x.EOF);){if(this.skipNewlines(),this.match(x.DEDENT)){if(this.peek().indent<t)break;this.advance();continue}if(this.match(x.EOF))break;const r=this.parseStatement();r&&i.push(r)}return this.match(x.DEDENT)&&this.peek().indent<t&&this.advance(),new je(i)}isTupleDestructuring(){if(!this.match(x.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===x.NEWLINE;)t++;if(this.peek(t).type!==x.IDENTIFIER)return!1;for(t++;this.peek(t).type===x.NEWLINE;)t++;if(this.peek(t).type===x.RBRACKET){t++;break}else if(this.peek(t).type===x.COMMA){t++;continue}else return!1}for(;this.peek(t).type===x.NEWLINE;)t++;return this.peek(t).type===x.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(x.LBRACKET);const t=[];for(;!this.match(x.RBRACKET);){this.skipNewlines();let r=this.expect(x.IDENTIFIER).value;this.functionNames.has(r)&&(r=r+"_var"),t.push(new le(r)),this.match(x.COMMA)&&this.advance()}this.expect(x.RBRACKET),this.skipNewlines(),this.expect(x.OPERATOR,"="),this.skipNewlines(!0);const i=this.parseExpression();return new Ke([new Ge(new fr(t),i)],He.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.matchEx(x.OPERATOR,"?",!0)){this.advance(),this.skipNewlines(!0);const i=this.parseExpression();this.matchEx(x.COLON,null,!0)?this.advance():this.expect(x.COLON),this.skipNewlines(!0);const r=this.parseExpression();return new pt(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.matchEx(x.KEYWORD,"or",!0)||this.matchEx(x.OPERATOR,null,!0)&&this.peek().value==="||";){this.advance(),this.skipNewlines(!0);const i=this.parseLogicalAnd();t=new ze("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.matchEx(x.KEYWORD,"and",!0)||this.matchEx(x.OPERATOR,null,!0)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new ze("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.matchEx(x.OPERATOR,null,!0);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseComparison();t=new ze(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.matchEx(x.OPERATOR,null,!0);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new ze(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.matchEx(x.OPERATOR,null,!0);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseMultiplicative();t=new ze(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.matchEx(x.OPERATOR,null,!0);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseUnary();t=new ze(i,t,r)}return t}parseUnary(){if(this.match(x.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new lr(t,this.parseUnary())}return this.match(x.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new lr("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(x.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,n=!0;for(;r>0&&!this.match(x.EOF);)if(this.match(x.OPERATOR,"<"))r++,this.advance();else if(this.match(x.OPERATOR,">"))r--,this.advance();else if(this.match(x.IDENTIFIER)||this.match(x.COMMA))this.advance();else{n=!1,this.pos=i;break}if(n&&this.match(x.LPAREN)){t=this.parseCallExpression(t);continue}else{if(n)continue;break}}else if(this.match(x.LPAREN))t=this.parseCallExpression(t);else if(this.match(x.DOT)){this.advance(),this.skipNewlines();const i=this.expect(x.IDENTIFIER).value;t=new pr(t,new le(i),!1)}else if(this.match(x.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(x.RBRACKET),t=new pr(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(x.LPAREN);const i=[],r=[];for(;!this.match(x.RPAREN)&&(this.skipNewlines(),!this.match(x.RPAREN));){if((this.peek().type===x.IDENTIFIER||this.peek().type===x.KEYWORD)&&this.peek(1).type===x.OPERATOR&&this.peek(1).value==="="){const n=this.advance().value;this.advance(),this.skipNewlines();const a=this.parseExpression();r.push(new xs(new le(n),a))}else i.push(this.parseExpression());this.match(x.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(x.RPAREN),r.length>0&&i.push(new ms(r)),new fs(t,i)}parsePrimary(){const t=this.peek();if(this.match(x.NUMBER)){const i=this.advance();return new it(i.value)}if(this.match(x.STRING)){const i=this.advance();return new it(i.value)}if(this.match(x.BOOLEAN)){const i=this.advance();return new it(i.value)}if(this.match(x.IDENTIFIER)){let i=this.advance().value;return this.functionNames.has(i)&&this.peek().type!==x.LPAREN&&(i=i+"_var"),new le(i)}if(this.match(x.LBRACKET))return this.parseArrayLiteral();if(this.match(x.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(x.RPAREN),i}if(this.match(x.KEYWORD,"if"))return this.parseIfExpression();if(this.match(x.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(x.LBRACKET);const t=[];for(;!this.match(x.RBRACKET)&&(this.skipNewlines(),!this.match(x.RBRACKET));)t.push(this.parseExpression()),this.match(x.COMMA)&&this.advance(),this.skipNewlines();return this.expect(x.RBRACKET),new ds(t)}parseIfExpression(){this.expect(x.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(x.INDENT);const i=[];for(;!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){const s=this.parseStatement();s&&i.push(s)}this.advance();let r=[];if(this.match(x.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(x.KEYWORD,"if")){const s=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new pt(t,new je(i),s);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=s,o}else return new pt(t,this.getBlockValue(i),s)}else{for(this.expect(x.INDENT);!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){const s=this.parseStatement();s&&r.push(s)}this.advance()}if(this.needsIIFE(i,r)){const s=new pt(t,new je(i),new je(r));return s.needsIIFE=!0,s.consequentStmts=i,s.alternateStmts=r,s}const n=this.getBlockValue(i),a=r.length>0?this.getBlockValue(r):new it(null);return new pt(t,n,a)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=n=>n.some(a=>a.type==="IfStatement"||a.type==="ForStatement"||a.type==="WhileStatement"||a.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(x.KEYWORD,"switch");let t=null;!this.match(x.NEWLINE)&&!this.match(x.INDENT)&&(t=this.parseExpression()),this.skipNewlines(),this.expect(x.INDENT);const i=[];for(;!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){let r=null;this.match(x.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(x.OPERATOR,"=>"),this.skipNewlines();const n=[];if(this.match(x.INDENT)){for(this.advance();!this.match(x.DEDENT)&&!this.match(x.EOF)&&(this.skipNewlines(),!this.match(x.DEDENT));){const s=this.parseStatement();s&&n.push(s)}this.advance()}else n.push(new be(this.parseExpression()));const a=this.getBlockValue(n);i.push(new ys(r,a,n)),this.skipNewlines()}return this.advance(),new gs(t,i)}getBlockValue(t){if(t.length===0)return new it(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 it(null)}}var Ss=Object.defineProperty,Es=(e,t,i)=>t in e?Ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ye=(e,t,i)=>Es(e,typeof t!="symbol"?t+"":t,i);class _s{constructor(t={}){Ye(this,"indent"),Ye(this,"indentStr"),Ye(this,"output"),Ye(this,"sourceCode"),Ye(this,"sourceLines"),Ye(this,"lastCommentedLine"),Ye(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()==="\r"||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 n=this.advance();switch(n){case"n":r+=`
39
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=n}}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.peek()==="."&&this.isDigit(this.peek(1))&&(i=!0,t+=this.advance());this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const n=this.peek(1);if(this.isDigit(n)||!this.isIdentifierStart(n)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}if(this.pos<this.source.length){const r=this.peek();if(r==="e"||r==="E"){const n=this.peek(1);if(this.isDigit(n))for(t+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)t+=this.advance();else if(n==="+"||n==="-"){const a=this.peek(2);if(this.isDigit(a))for(t+=this.advance(),t+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)t+=this.advance()}}}this.addToken(m.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();es.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(ts.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.isDigit(this.peek(1))?(this.readNumber(),!0):(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 n=new is(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}var as=Object.defineProperty,os=(e,t,i)=>t in e?as(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,fe=(e,t,i)=>os(e,typeof t!="symbol"?t+"":t,i);class ${constructor(t){this.type=t}}class cs extends ${constructor(t){super("Program"),this.body=t}}class be extends ${constructor(t){super("ExpressionStatement"),this.expression=t}}var He=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(He||{});class Ke extends ${constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Ge extends ${constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class cr extends ${constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class us extends ${constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class hs extends ${constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,fe(this,"_line")}}class ur extends ${constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n,fe(this,"isForIn")}}class ls extends ${constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class je extends ${constructor(t){super("BlockStatement"),this.body=t}}class hr extends ${constructor(t){super("ReturnStatement"),this.argument=t}}class le extends ${constructor(t){super("Identifier"),this.name=t,fe(this,"varType"),fe(this,"returnType"),fe(this,"isMethod")}}class it extends ${constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class ze extends ${constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class lr extends ${constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Xt extends ${constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class ps extends ${constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class fs extends ${constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,fe(this,"arguments"),this.callee=t,this.arguments=i}}class pr extends ${constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class pt extends ${constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,fe(this,"needsIIFE"),fe(this,"consequentStmts"),fe(this,"alternateStmts")}}class ds extends ${constructor(t){super("ArrayExpression"),this.elements=t}}class ms extends ${constructor(t){super("ObjectExpression"),this.properties=t}}class xs extends ${constructor(t,i){super("Property"),this.key=t,this.value=i,fe(this,"kind"),fe(this,"method"),fe(this,"shorthand"),fe(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class fr extends ${constructor(t){super("ArrayPattern"),this.elements=t}}class dr extends ${constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class gs extends ${constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class ys extends ${constructor(t,i,r){super("SwitchCase"),this.test=t,this.consequent=i,this.statements=r,this.statements=r}}var vs=Object.defineProperty,ws=(e,t,i)=>t in e?vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Zt=(e,t,i)=>ws(e,typeof t!="symbol"?t+"":t,i);class bs{constructor(t){Zt(this,"tokens"),Zt(this,"pos"),Zt(this,"functionNames",new Set),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()}matchEx(t,i=null,r=!1){if(!r)return this.match(t,i);let n=0,a=this.peek(n);if(a.type===m.NEWLINE&&(n++,a=this.peek(n),a.type===m.INDENT&&(n++,a=this.peek(n))),a.type!==t||i!==null&&a.value!==i)return!1;for(let s=0;s<n;s++)this.advance();return!0}skipNewlines(t=!1){for(;this.match(m.NEWLINE)||this.match(m.COMMENT);)this.advance();t&&this.match(m.INDENT)&&this.advance()}parse(){const t=[];for(;!this.match(m.EOF);){if(this.skipNewlines(),this.match(m.DEDENT)){this.advance();continue}if(this.match(m.EOF))break;const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new cs(t)}parseStatement(t=!0){this.skipNewlines();const i=this.peek().line;if(this.match(m.COMMENT))return this.advance(),null;let r;if(this.match(m.KEYWORD,"type"))r=this.parseTypeDefinition();else if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))r=this.parseVarDeclaration();else if(this.match(m.KEYWORD,"method"))r=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())r=this.parseFunctionDeclaration();else if(this.match(m.KEYWORD,"if"))r=this.parseIfStatement();else if(this.match(m.KEYWORD,"for"))r=this.parseForStatement();else if(this.match(m.KEYWORD,"while"))r=this.parseWhileStatement();else if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const n=this.advance().value;r=new be(new le(n))}else this.isTupleDestructuring()?r=this.parseTupleDestructuring():this.peek().type===m.IDENTIFIER&&this.isTypedVarDeclaration()&&(r=this.parseTypedVarDeclaration());if(!r){const n=this.parseExpression();if(this.match(m.OPERATOR)){const a=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(a)){this.advance(),this.skipNewlines(!0);const s=this.parseExpression();a==="="&&n.type==="Identifier"?r=new Ke([new Ge(n,s)],He.LET):r=new be(new Xt(a===":="?"=":a,n,s))}else r=new be(n)}else r=new be(n)}if(r&&(r._line=i,t&&this.match(m.COMMA)&&this.peek().line===i)){const n=[r];for(;this.match(m.COMMA)&&this.peek().line===i;){this.advance(),this.skipNewlines(!0);const a=this.parseStatement(!1);a&&n.push(a)}return new je(n)}return r}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}}parseTypeExpression(){const t=this.expect(m.IDENTIFIER).value;if(this.match(m.OPERATOR,"<")){this.advance();const i=[];for(i.push(this.parseTypeExpression());this.match(m.COMMA);)this.advance(),this.skipNewlines(),i.push(this.parseTypeExpression());return this.expect(m.OPERATOR,">"),t+"<"+i.join(", ")+">"}return 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.parseTypeExpression(),n=this.expect(m.IDENTIFIER).value;let a=null;this.match(m.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),a=this.parseExpression()),i.push({type:r,name:n,defaultValue:a}),this.skipNewlines()}return this.match(m.DEDENT)&&this.advance(),new us(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.functionNames.has(r)&&(r=r+"_var"),this.expect(m.OPERATOR,"="),this.skipNewlines(!0);const n=this.parseExpression(),a=new le(r);return i&&(a.varType=i),new Ke([new Ge(a,n,i)],t)}isTypedVarDeclaration(){let t=0;if(this.peek(t).type!==m.IDENTIFIER)return!1;if(t++,this.peek(t).type===m.LBRACKET&&this.peek(t+1).type===m.RBRACKET)return t+=2,this.peek(t).type!==m.IDENTIFIER?!1:(t++,this.peek(t).type===m.OPERATOR&&this.peek(t).value==="=");if(this.peek(t).type===m.OPERATOR&&this.peek(t).value==="<"){t++;let i=1;for(;i>0&&this.peek(t).type!==m.EOF;)this.peek(t).type===m.OPERATOR&&this.peek(t).value==="<"?i++:this.peek(t).type===m.OPERATOR&&this.peek(t).value===">"&&i--,t++;return this.peek(t).type!==m.IDENTIFIER?!1:(t++,this.peek(t).type===m.OPERATOR&&this.peek(t).value==="=")}if(this.peek(t).type!==m.IDENTIFIER)return!1;for(t++;this.peek(t).type===m.IDENTIFIER;)t++;return this.peek(t).type===m.OPERATOR&&this.peek(t).value==="="}parseTypedVarDeclaration(){let t=this.advance().value;if(this.match(m.LBRACKET)&&this.peek(1).type===m.RBRACKET)this.advance(),this.advance(),t+="[]";else if(this.match(m.OPERATOR,"<")){for(this.advance(),t+="<";!this.match(m.OPERATOR,">");)if(this.match(m.IDENTIFIER))t+=this.advance().value;else if(this.match(m.COMMA))t+=this.advance().value,this.skipNewlines();else break;this.match(m.OPERATOR,">")&&(t+=">",this.advance())}else for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER;)t+=" "+this.advance().value;let i=this.expect(m.IDENTIFIER).value;this.functionNames.has(i)&&(i=i+"_var"),this.expect(m.OPERATOR,"="),this.skipNewlines(!0);const r=this.parseExpression(),n=new le(i);return n.varType=t,new Ke([new Ge(n,r,t)],He.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.functionNames.add(i),this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let s=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)s&&(s+=" "),s=(s||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,c=new le(o);if(s&&(c.varType=s),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new dr(c,u))}else r.push(c);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),a=new le(i);return t&&(a.returnType=t),new cr(a,r,n,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 s=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)s&&(s+=" "),s=(s||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,c=new le(o);if(s&&(c.varType=s),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new dr(c,u))}else r.push(c);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),a=new le(i);return t&&(a.returnType=t),a.isMethod=!0,new cr(a,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new je([new hr(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 hr(i.expression))}return new je(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 be(new le(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.isTypedVarDeclaration())return this.parseTypedVarDeclaration();const i=[];for(;;){const r=this.parseExpression();if(this.match(m.OPERATOR)){const n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines(!0);const a=this.parseExpression();if(n==="="&&r.type==="Identifier"?i.push(new Ke([new Ge(r,a)],He.LET)):i.push(new be(new Xt(n===":="?"=":n,r,a))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new be(r));else return new be(r);break}}else if(this.match(m.COMMA)){i.push(new be(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new be(r));else return new be(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.skipNewlines(),this.match(m.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new hs(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 le(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new fr(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new le(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),a=new Ke([new Ge(t,r)],He.CONST),s=new ur(a,null,null,n);return s.isForIn=!0,s}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 n=this.parseExpression();let a=null;this.match(m.KEYWORD,"by")&&(this.advance(),a=this.parseExpression()),this.skipNewlines();const s=this.parseBlock(),o=new Ke([new Ge(t,r)],He.LET),c=new ze("<=",t,n),u=a?new Xt("+=",t,a):new ps("++",t);return new ur(o,c,u,s)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new ls(t,i)}parseBlock(){if(!this.match(m.INDENT)){const r=this.parseStatement();return new je(r?[r]:[])}const t=this.peek().indent;this.advance();const i=[];for(;!this.match(m.EOF);){if(this.skipNewlines(),this.match(m.DEDENT)){if(this.peek().indent<t)break;this.advance();continue}if(this.match(m.EOF))break;const r=this.parseStatement();r&&i.push(r)}return this.match(m.DEDENT)&&this.peek().indent<t&&this.advance(),new je(i)}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();let r=this.expect(m.IDENTIFIER).value;this.functionNames.has(r)&&(r=r+"_var"),t.push(new le(r)),this.match(m.COMMA)&&this.advance()}this.expect(m.RBRACKET),this.skipNewlines(),this.expect(m.OPERATOR,"="),this.skipNewlines(!0);const i=this.parseExpression();return new Ke([new Ge(new fr(t),i)],He.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.matchEx(m.OPERATOR,"?",!0)){this.advance(),this.skipNewlines(!0);const i=this.parseExpression();this.matchEx(m.COLON,null,!0)?this.advance():this.expect(m.COLON),this.skipNewlines(!0);const r=this.parseExpression();return new pt(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.matchEx(m.KEYWORD,"or",!0)||this.matchEx(m.OPERATOR,null,!0)&&this.peek().value==="||";){this.advance(),this.skipNewlines(!0);const i=this.parseLogicalAnd();t=new ze("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.matchEx(m.KEYWORD,"and",!0)||this.matchEx(m.OPERATOR,null,!0)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new ze("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.matchEx(m.OPERATOR,null,!0);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseComparison();t=new ze(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.matchEx(m.OPERATOR,null,!0);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new ze(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.matchEx(m.OPERATOR,null,!0);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseMultiplicative();t=new ze(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.matchEx(m.OPERATOR,null,!0);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines(!0);const r=this.parseUnary();t=new ze(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 lr(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new lr("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(m.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,n=!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{n=!1,this.pos=i;break}if(n&&this.match(m.LPAREN)){t=this.parseCallExpression(t);continue}else{if(n)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 pr(t,new le(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new pr(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 n=this.advance().value;this.advance(),this.skipNewlines();const a=this.parseExpression();r.push(new xs(new le(n),a))}else i.push(this.parseExpression());this.match(m.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(m.RPAREN),r.length>0&&i.push(new ms(r)),new fs(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new it(i.value)}if(this.match(m.STRING)){const i=this.advance();return new it(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new it(i.value)}if(this.match(m.IDENTIFIER)){let i=this.advance().value;return this.functionNames.has(i)&&this.peek().type!==m.LPAREN&&(i=i+"_var"),new le(i)}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 ds(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 s=this.parseStatement();s&&i.push(s)}this.advance();let r=[];if(this.match(m.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")){const s=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new pt(t,new je(i),s);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=s,o}else return new pt(t,this.getBlockValue(i),s)}else{for(this.expect(m.INDENT);!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const s=this.parseStatement();s&&r.push(s)}this.advance()}if(this.needsIIFE(i,r)){const s=new pt(t,new je(i),new je(r));return s.needsIIFE=!0,s.consequentStmts=i,s.alternateStmts=r,s}const n=this.getBlockValue(i),a=r.length>0?this.getBlockValue(r):new it(null);return new pt(t,n,a)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=n=>n.some(a=>a.type==="IfStatement"||a.type==="ForStatement"||a.type==="WhileStatement"||a.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(m.KEYWORD,"switch");let t=null;!this.match(m.NEWLINE)&&!this.match(m.INDENT)&&(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 n=[];if(this.match(m.INDENT)){for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const s=this.parseStatement();s&&n.push(s)}this.advance()}else n.push(new be(this.parseExpression()));const a=this.getBlockValue(n);i.push(new ys(r,a,n)),this.skipNewlines()}return this.advance(),new gs(t,i)}getBlockValue(t){if(t.length===0)return new it(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 it(null)}}var Ss=Object.defineProperty,Es=(e,t,i)=>t in e?Ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ye=(e,t,i)=>Es(e,typeof t!="symbol"?t+"":t,i);class _s{constructor(t={}){Ye(this,"indent"),Ye(this,"indentStr"),Ye(this,"output"),Ye(this,"sourceCode"),Ye(this,"sourceLines"),Ye(this,"lastCommentedLine"),Ye(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,n=[];for(let a=t-1;a<r&&a<this.sourceLines.length;a++)if(a>this.lastCommentedLine){const s=this.sourceLines[a].trim();s&&!s.startsWith("//@")&&!s.startsWith("//")&&n.push(this.sourceLines[a])}if(n.length>0){for(const a of n)this.write(this.indentStr.repeat(this.indent)),this.write("/// "),this.write(a.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(`
@@ -121,6 +121,6 @@ ${e}
121
121
  `);this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write("}"),i<t.cases.length-1||this.write(`
122
122
  `)}}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(")")}getPrecedence(t){switch(t.type){case"Literal":case"Identifier":case"ArrayExpression":case"ObjectExpression":return 20;case"CallExpression":case"MemberExpression":return 19;case"UnaryExpression":case"UpdateExpression":return 15;case"BinaryExpression":case"LogicalExpression":switch(t.operator){case"*":case"/":case"%":return 13;case"+":case"-":return 12;case"<":case"<=":case">":case">=":return 10;case"==":case"!=":return 9;case"and":case"&&":return 5;case"or":case"||":return 4;default:return 0}case"ConditionalExpression":return 3;case"AssignmentExpression":case"AssignmentPattern":return 2;case"SequenceExpression":return 1;default:return 0}}}function mr(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 Ns(e,t={}){const i=mr(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 ss(e).tokenize(),n=new bs(r).parse(),a={...t,sourceCode:e},s=new _s(a).generate(n);return{success:!0,version:i,code:s,ast:n,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function Is(e){if(typeof e=="function")return e.toString();{const t=mr(e);if(t===null)return e;if(t>=5){const i=Ns(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 Cs(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=Is(e);r=$n(r);const n=i?r.split(`
123
123
  `):[],a=Ki(r,{ecmaVersion:"latest",sourceType:"module",locations:i});qn(a),Fn(a),Bn(a);const s=new Rn;Un(a,s);const o=Kn(a,s)||"";Jn(a,s,o,t,n),Zn(a);const c=In||Ht||void 0,u=Object.assign({},c,{LineComment(f,l){l.write("//"+f.value)}}),h=er(a,{generator:u,comments:i});return new Function("",`var _r = ${h}
124
- ; return _r;`)(this)}function ks(e){return t=>new q(t.array.map(i=>Math.abs(i)),t.type,e)}function As(e){return t=>{let i=0,r=0;for(const n of t.array){const a=Number(n);isNaN(a)||(r++,i+=(a-i)/r)}return r===0?NaN:e.precision(i)}}function Ps(e){return(t,i)=>{const r=t.array;let n=0,a=r.length-1;for(;n<=a;){const s=Math.floor((n+a)/2),o=r[s];if(o===i)return s;o<i?n=s+1:a=s-1}return-1}}function Ts(e){return(t,i)=>{const r=t.array;let n=0,a=r.length;for(;n<a;){const s=Math.floor((n+a)/2);r[s]<i?n=s+1:a=s}return n<r.length&&r[n]===i?n:n-1}}function Rs(e){return(t,i)=>{const r=t.array;let n=0,a=r.length;for(;n<a;){const s=Math.floor((n+a)/2);r[s]<=i?n=s+1:a=s}return n>0&&r[n-1]===i?n-1:n}}function Ds(e){return t=>{t.array.length=0}}function Vs(e){return(t,i)=>(t.array.push(...i.array),t)}function Ls(e){return t=>new q([...t.array],t.type,e)}function Ms(e){return(t,i,r=!0)=>{const n=t.array,a=i.array;if(n.length!==a.length)return NaN;let s=0,o=0,c=0;const u=[];for(let g=0;g<n.length;g++){const y=Number(n[g]),v=Number(a[g]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(v)&&v!==null&&v!==void 0&&(s+=y,o+=v,c++,u.push(g))}if(c===0)return NaN;const h=s/c,f=o/c;let l=0;for(const g of u){const y=Number(n[g]),v=Number(a[g]);l+=(y-h)*(v-f)}const d=r?c:c-1;return d<=0?NaN:e.precision(l/d)}}function Os(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function Bs(e){return e.every(t=>typeof t=="number")?e.every(t=>(t|0)===t)?G.int:G.float:e.every(t=>typeof t=="string")?G.string:e.every(t=>typeof t=="boolean")?G.bool:G.any}function Ne(e){if(typeof e=="number")return(e|0)===e?G.int:G.float;if(typeof e=="string")return G.string;if(typeof e=="boolean")return G.bool;throw new Error("Cannot infer type from value")}function ft(e,t){switch(t){case G.int:return typeof e=="number"&&((e|0)===e||isNaN(e));case G.float:return typeof e=="number";case G.string:return typeof e=="string";case G.bool:return typeof e=="boolean"}return!1}function Fs(e){return(t,i,r=0,n)=>{const a=t.array.length,s=n!==void 0?Math.min(n,a):a;for(let o=r;o<s;o++){if(!ft(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 Ws(e){return t=>t.array.length>0?t.array[0]:e.NA}function js(e){return(t,i)=>t.array[i]}function $s(e){return(t,i)=>t.array.includes(i)}function qs(e){return(t,i)=>t.array.indexOf(i)}function Us(e){return(t,i,r)=>{if(!ft(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 Hs(e){return(t,i=",")=>t.array.join(i)}function Ks(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Gs(e){return(t,i)=>t.array.lastIndexOf(i)}function zs(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function Ys(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Qs(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function Xs(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const a of t.array){const s=(i.get(a)||0)+1;i.set(a,s),s>r&&(r=s)}const n=[];for(const[a,s]of i)s===r&&n.push(a);return n.sort((a,s)=>typeof a=="number"&&typeof s=="number"?a-s:typeof a=="string"&&typeof s=="string"?a<s?-1:a>s?1:0:0),n[0]}}function Zs(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const c of r){const u=Number(c);if(isNaN(u)||u===null||u===void 0)return NaN;n.push(u)}n.sort((c,u)=>c-u),i<0&&(i=0),i>100&&(i=100);const a=i/100*n.length-.5;if(a<=0)return e.precision(n[0]);if(a>=n.length-1)return e.precision(n[n.length-1]);const s=Math.floor(a),o=a-s;return e.precision(n[s]*(1-o)+n[s+1]*o)}}function Js(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const o of r){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&n.push(c)}if(n.length===0)return NaN;n.sort((o,c)=>o-c),i<0&&(i=0),i>100&&(i=100);const a=r.length,s=Math.ceil(i/100*a);return s<=0?n[0]:s>n.length?NaN:n[s-1]}}function ea(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 n=Number(t.array[r]);if(isNaN(n)||n===null||n===void 0)return NaN;let a=0;for(const o of t.array){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&c<n&&a++}const s=t.array.length-1;return s<=0?NaN:a/s*100}}function ta(e){return t=>t.array.pop()}function ia(e){return(t,i)=>{if(!ft(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 ra(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function na(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function sa(e){return t=>{t.array.reverse()}}function aa(e){return(t,i,r)=>{if(!ft(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 oa(e){return t=>t.array.shift()}function ca(e){return t=>t.array.length}function ua(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new q(t.array.slice(i,n),t.type,e)}}function ha(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var rt=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(rt||{}),xr=(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))(xr||{}),gr=(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))(gr||{}),yr=(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))(yr||{}),vr=(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))(vr||{}),wr=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))(wr||{}),br=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(br||{}),Sr=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(Sr||{}),la=(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))(la||{}),Er=(e=>(e.gaps_on="gaps_on",e.gaps_off="gaps_off",e.lookahead_on="lookahead_on",e.lookahead_off="lookahead_off",e))(Er||{});const pa={order:rt,currency:xr,dayofweek:gr,display:yr,shape:vr,location:wr,size:br,format:Sr,barmerge:Er};function fa(e){return(t,i=rt.ascending)=>{t.array.sort((r,n)=>{let a=isNaN(r)?1/0:r,s=isNaN(n)?1/0:n;return i===rt.ascending?a-s:s-a})}}function da(e){return(t,i=rt.ascending)=>{const r=t.array.map((n,a)=>a);return r.sort((n,a)=>{const s=isNaN(t.array[n])?1/0:t.array[n],o=isNaN(t.array[a])?1/0:t.array[a];return i===rt.ascending?s-o:o-s}),new q(r,G.int,e)}}function ma(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new q(t.array.map(()=>NaN),G.int,e):r===0?new q(t.array.map(()=>1),G.int,e):new q(t.array.map(n=>(n-i)/r),G.int,e)}}function xa(e){return(t,i=!0)=>{const r=t.array,n=r.length;if(n===0)return NaN;let a=0,s=0,o=0;for(let h=0;h<n;h++){const f=Number(r[h]);!isNaN(f)&&f!==null&&f!==void 0&&(a+=f,s+=f*f,o++)}if(o===0)return NaN;const c=a/o;let u=s/o-c*c;return u<0?NaN:(!i&&o>1&&(u=u*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(u)))}}function ga(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function ya(e){return(t,i)=>{if(!ft(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 va(e){return(t,i=!0)=>{let r=0,n=0;for(const c of t.array){const u=Number(c);!isNaN(u)&&u!==null&&u!==void 0&&(r+=u,n++)}if(n===0)return NaN;const a=r/n;let s=0;for(const c of t.array){const u=Number(c);!isNaN(u)&&u!==null&&u!==void 0&&(s+=(u-a)*(u-a))}const o=i?n:n-1;return o<=0?NaN:e.precision(s/o)}}var wa=Object.defineProperty,ba=(e,t,i)=>t in e?wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>ba(e,typeof t!="symbol"?t+"":t,i),G=(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))(G||{});class q{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=ks(this.context),this._avg=As(this.context),this._binary_search=Ps(this.context),this._binary_search_leftmost=Ts(this.context),this._binary_search_rightmost=Rs(this.context),this._clear=Ds(this.context),this._concat=Vs(this.context),this._copy=Ls(this.context),this._covariance=Ms(this.context),this._every=Os(this.context),this._fill=Fs(this.context),this._first=Ws(this.context),this._get=js(this.context),this._includes=$s(this.context),this._indexof=qs(this.context),this._insert=Us(this.context),this._join=Hs(this.context),this._last=Ks(this.context),this._lastindexof=Gs(this.context),this._max=zs(this.context),this._median=Ys(this.context),this._min=Qs(this.context),this._mode=Xs(this.context),this._percentile_linear_interpolation=Zs(this.context),this._percentile_nearest_rank=Js(this.context),this._percentrank=ea(this.context),this._pop=ta(this.context),this._push=ia(this.context),this._range=ra(this.context),this._remove=na(this.context),this._reverse=sa(this.context),this._set=aa(this.context),this._shift=oa(this.context),this._size=ca(this.context),this._slice=ua(this.context),this._some=ha(this.context),this._sort=fa(this.context),this._sort_indices=da(this.context),this._standardize=ma(this.context),this._stdev=xa(this.context),this._sum=ga(this.context),this._unshift=ya(this.context),this._variance=va(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 q([...t],Bs(t),e)}function Ea(e){return(t,i)=>new q(Array(t).fill(e.precision(i||0)),Ne(i||0),e)}function _a(e){return(t,i=!1)=>new q(Array(t).fill(i),G.bool,e)}function Na(e){return(t,i=NaN)=>new q(Array(t).fill(e.precision(i)),G.float,e)}function Ia(e){return(t,i=0)=>new q(Array(t).fill(e.precision(i)),G.int,e)}function Ca(e){return(t,i="")=>new q(Array(t).fill(i),G.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 ka(e){return(t,i=0)=>m.from(t).get(i)}class Aa{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=Ea(t),this.new_bool=_a(t),this.new_float=Na(t),this.new_int=Ia(t),this.new_string=Ca(t),this.param=ka(),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 Ta(e){return(t,i)=>t.map.has(i)}function Ra(e){return t=>{const i=new _r(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 Va(e){return t=>{const i=Array.from(t.map.keys()),r=Ne(i[0]);return new q(i,r,e)}}function La(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function Ma(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function Oa(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 Fa(e){return t=>{const i=Array.from(t.map.values()),r=Ne(i[0]);return new q(i,r,e)}}var Wa=Object.defineProperty,ja=(e,t,i)=>t in e?Wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ie=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);class _r{constructor(t){this.context=t,Ie(this,"map"),Ie(this,"_clear"),Ie(this,"_contains"),Ie(this,"_copy"),Ie(this,"_get"),Ie(this,"_keys"),Ie(this,"_put"),Ie(this,"_put_all"),Ie(this,"_remove"),Ie(this,"_size"),Ie(this,"_values"),this.map=new Map,this._clear=Pa(this.context),this._contains=Ta(this.context),this._copy=Ra(this.context),this._get=Da(this.context),this._keys=Va(this.context),this._put=La(this.context),this._put_all=Ma(this.context),this._remove=Oa(this.context),this._size=Ba(this.context),this._values=Fa(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 $a(e){return()=>new _r(e)}function qa(e){return(t,i=0)=>m.from(t).get(i)}class Ua{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=$a(t),this.param=qa(),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 Ha(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r&&(r instanceof q?a=r.array:Array.isArray(r)?a=r:a=[r]),n===0){for(let c=0;c<a.length;c++){let u=a[c];u instanceof m&&(u=u.get(0)),t.matrix.push([u])}return}const s=t.matrix[0].length,o=i!==void 0?i:s;for(let c=0;c<n;c++){let u=c<a.length?a[c]:NaN;u instanceof m&&(u=u.get(0)),t.matrix[c].splice(o,0,u)}}}function Ka(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r)if(r instanceof q)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof m){const u=r.get(0);Array.isArray(u)?a=u:a=[u]}else a=[r];const s=n>0?t.matrix[0].length:a.length,o=i!==void 0?i:n,c=[];for(let u=0;u<s;u++)if(u<a.length){let h=a[u];h instanceof m&&(h=h.get(0)),c.push(h)}else c.push(NaN);t.matrix.splice(o,0,c)}}function Ga(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 n=0,a=0;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(n+=c,a++)}return a===0?NaN:n/a}}function za(e){return(t,i)=>{const r=t.matrix.length,n=[];for(let s=0;s<r;s++)n.push(t.matrix[s][i]);const a=Ne(n[0]);return new q(n,a,e)}}function Ya(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Qa(e){return(t,i)=>{const r=t.matrix.length,n=i.matrix.length;if(r===0){for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]]);return}const a=t.matrix[0].length,s=n>0?i.matrix[0].length:0;if(a!==s&&n>0){console.error(`matrix.concat: Column count mismatch ${a} vs ${s}`);return}for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]])}}function Xa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new W(i,r,NaN,e);return n.matrix=t.matrix.map(a=>[...a]),n}}function Za(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(n=>[...n]);let r=1;for(let n=0;n<t;n++){let a=n;for(;a<t&&i[a][n]===0;)a++;if(a===t)return 0;a!==n&&([i[n],i[a]]=[i[a],i[n]],r*=-1),r*=i[n][n];for(let s=n+1;s<t;s++){const o=i[s][n]/i[n][n];for(let c=n;c<t;c++)i[s][c]-=o*i[n][c]}}return r}function Ja(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Za(t.matrix)}}function eo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new W(0,0,NaN,e);const n=t.matrix[0].length,a=new W(r,n,NaN,e);if(i instanceof W)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const c=t.matrix[s][o],u=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=c-u}else{const s=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]-s}return a}}function to(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],n=e[1][0],a=e[1][1],s=i+a,o=i*a-r*n,c=s*s-4*o;if(c<0)return[NaN,NaN];const u=(s+Math.sqrt(c))/2,h=(s-Math.sqrt(c))/2;return[u,h]}function io(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const s=Ne(t.matrix[0][0]);return new q([],s,e)}const n=to(t.matrix),a=Ne(n[0]);return new q(n,a,e)}}function ro(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new W(0,0,NaN,e);const n=new W(i,r,0,e);for(let a=0;a<i;a++)n.matrix[a][a]=1;return n}}function no(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function so(e){return(t,i,r,n,a,s)=>{const o=t.matrix.length;if(o===0)return;const c=t.matrix[0].length,u=r!==void 0?r:0,h=n!==void 0?n:o,f=a!==void 0?a:0,l=s!==void 0?s:c;for(let d=u;d<h&&!(d>=o);d++)for(let g=f;g<l&&!(g>=c);g++)t.matrix[d][g]=i}}function ao(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function oo(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 co(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new W(i,r,NaN,e);const n=oo(t.matrix),a=new W(i,r,NaN,e);return a.matrix=n,a}}function uo(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n+a!==i-1&&t.matrix[n][a]!==0)return!1;return!0}}function ho(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(t.matrix[a][n]!==-t.matrix[n][a])return!1;return!0}}function lo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let a=0;a<r;a++){const s=t.matrix[n][a];if(s!==0&&s!==1)return!1}return!0}}function po(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n!==a&&t.matrix[n][a]!==0)return!1;return!0}}function fo(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n===a){if(t.matrix[n][a]!==1)return!1}else if(t.matrix[n][a]!==0)return!1;return!0}}function mo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function xo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++){let a=0;for(let s=0;s<r;s++){const o=t.matrix[n][s];if(o<0)return!1;a+=o}if(Math.abs(a-1)>1e-10)return!1}return!0}}function go(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 n=0;n<i;n++)for(let a=0;a<n;a++)if(t.matrix[n][a]!==t.matrix[a][n])return!1;return!0}}function yo(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 n=!0,a=!0;for(let s=0;s<i;s++)for(let o=0;o<r;o++)s>o&&t.matrix[s][o]!==0&&(n=!1),s<o&&t.matrix[s][o]!==0&&(a=!1);return n||a}}function vo(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let a=0;a<r;a++)if(t.matrix[n][a]!==0)return!1;return!0}}function wo(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0,a=i.matrix.length,s=a>0?i.matrix[0].length:0,o=r*a,c=n*s,u=new W(o,c,NaN,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){const l=t.matrix[h][f];for(let d=0;d<a;d++)for(let g=0;g<s;g++){const y=i.matrix[d][g];u.matrix[h*a+d][f*s+g]=l*y}}return u}}function bo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=-1/0,a=!1;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(c>n&&(n=c),a=!0)}return a?n:NaN}}function So(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=[];for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||n.push(c)}if(n.length===0)return NaN;n.sort((s,o)=>s-o);const a=Math.floor(n.length/2);return n.length%2!==0?n[a]:(n[a-1]+n[a])/2}}function Eo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=1/0,a=!1;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(c<n&&(n=c),a=!0)}return a?n:NaN}}function _o(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=new Map;let a=0,s=NaN;for(let o=0;o<i;o++)for(let c=0;c<r;c++){const u=t.matrix[o][c];if(!isNaN(u)){const h=(n.get(u)||0)+1;n.set(u,h),h>a?(a=h,s=u):h===a&&u<s&&(s=u)}}return s}}function No(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof W){const a=i.matrix.length,s=a>0?i.matrix[0].length:0;if(n!==a)return new W(0,0,NaN,e);const o=new W(r,s,0,e);for(let c=0;c<r;c++)for(let u=0;u<s;u++){let h=0;for(let f=0;f<n;f++)h+=t.matrix[c][f]*i.matrix[f][u];o.matrix[c][u]=h}return o}else if(i instanceof q||Array.isArray(i.array||i)){const a=i.array||i;if(n!==a.length)return new W(0,0,NaN,e);const s=new W(r,1,0,e);for(let o=0;o<r;o++){let c=0;for(let u=0;u<n;u++)c+=t.matrix[o][u]*a[u];s.matrix[o][0]=c}return s}else{const a=i,s=new W(r,n,NaN,e);for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]*a;return s}}}function Io(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new W(i,r,NaN,e):new W(r,i,NaN,e)}}function Co(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new W(0,0,NaN,e);let a=new W(r,n,0,e);for(let c=0;c<r;c++)a.matrix[c][c]=1;let s=new W(r,n,NaN,e);for(let c=0;c<r;c++)s.matrix[c]=[...t.matrix[c]];let o=Math.floor(i);if(o<0)return new W(r,n,NaN,e);for(;o>0;){if(o%2===1){const u=new W(r,n,0,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){let l=0;for(let d=0;d<r;d++)l+=a.matrix[h][d]*s.matrix[d][f];u.matrix[h][f]=l}a=u}const c=new W(r,n,0,e);for(let u=0;u<r;u++)for(let h=0;h<n;h++){let f=0;for(let l=0;l<r;l++)f+=s.matrix[u][l]*s.matrix[l][h];c.matrix[u][h]=f}s=c,o=Math.floor(o/2)}return a}}function ko(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=t.matrix.map(s=>[...s]);let a=0;for(let s=0;s<r&&a<i;s++){let o=a;for(;o<i&&Math.abs(n[o][s])<1e-10;)o++;if(o<i){[n[a],n[o]]=[n[o],n[a]];const c=n[a][s];for(let u=s;u<r;u++)n[a][u]/=c;for(let u=0;u<i;u++)if(u!==a){const h=n[u][s];for(let f=s;f<r;f++)n[u][f]-=h*n[a][f]}a++}}return a}}function Ao(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const s=Ne(t.matrix[0][0]);return new q([],s,e)}const n=[];for(let s=0;s<r;s++){const o=t.matrix[s].splice(i,1);n.push(o[0])}const a=Ne(n[0]);return new q(n,a,e)}}function Po(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=Ne(r[0][0]);return new q(r[0]||[],n,e)}}function To(e){return(t,i,r)=>{const n=t.matrix.length,a=n>0?t.matrix[0].length:0,s=i*r,o=[];for(let h=0;h<n;h++)for(let f=0;f<a;f++)o.push(t.matrix[h][f]);for(;o.length<s;)o.push(NaN);o.length>s&&(o.length=s);const c=[];let u=0;for(let h=0;h<i;h++){const f=[];for(let l=0;l<r;l++)f.push(o[u++]);c.push(f)}t.matrix=c}}function Ro(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Do(e){return(t,i)=>{if(!t.matrix[i]){const n=Ne(t.matrix[0][0]);return new q([],n,e)}const r=Ne(t.matrix[i][0]);return new q([...t.matrix[i]],r,e)}}function Vo(e){return t=>t.matrix.length}function Lo(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Mo(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((n,a)=>{const s=n[i],o=a[i];return s<o?r==="asc"?-1:1:s>o?r==="asc"?1:-1:0})}}function Oo(e){return(t,i,r,n,a)=>{const s=r-i,o=a-n,c=new W(s,o,NaN,e);for(let u=0;u<s;u++){const h=i+u;if(h>=t.matrix.length)break;for(let f=0;f<o;f++){const l=n+f;if(l>=t.matrix[h].length)break;c.matrix[u][f]=t.matrix[h][l]}}return c}}function Bo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new W(0,0,NaN,e);const n=t.matrix[0].length,a=new W(r,n,NaN,e);if(i instanceof W)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const c=t.matrix[s][o],u=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=c+u}else{const s=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]+s}return a}}function Fo(e){return(t,i,r)=>{const n=t.matrix.length;for(let a=0;a<n;a++){const s=t.matrix[a][i];t.matrix[a][i]=t.matrix[a][r],t.matrix[a][r]=s}}}function Wo(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function jo(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=Math.min(i,r);let a=0;for(let s=0;s<n;s++)a+=t.matrix[s][s];return a}}function $o(e){return t=>{const i=t.matrix.length;if(i===0)return new W(0,0,NaN,e);const r=t.matrix[0].length,n=new W(r,i,NaN,e);for(let a=0;a<i;a++)for(let s=0;s<r;s++)n.matrix[s][a]=t.matrix[a][s];return n}}var qo=Object.defineProperty,Uo=(e,t,i)=>t in e?qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,P=(e,t,i)=>Uo(e,typeof t!="symbol"?t+"":t,i);class W{constructor(t=0,i=0,r=NaN,n){if(this.context=n,P(this,"matrix"),P(this,"_add_col"),P(this,"_add_row"),P(this,"_avg"),P(this,"_col"),P(this,"_columns"),P(this,"_concat"),P(this,"_copy"),P(this,"_det"),P(this,"_diff"),P(this,"_eigenvalues"),P(this,"_eigenvectors"),P(this,"_elements_count"),P(this,"_fill"),P(this,"_get"),P(this,"_inv"),P(this,"_is_antidiagonal"),P(this,"_is_antisymmetric"),P(this,"_is_binary"),P(this,"_is_diagonal"),P(this,"_is_identity"),P(this,"_is_square"),P(this,"_is_stochastic"),P(this,"_is_symmetric"),P(this,"_is_triangular"),P(this,"_is_zero"),P(this,"_kron"),P(this,"_max"),P(this,"_median"),P(this,"_min"),P(this,"_mode"),P(this,"_mult"),P(this,"_pinv"),P(this,"_pow"),P(this,"_rank"),P(this,"_remove_col"),P(this,"_remove_row"),P(this,"_reshape"),P(this,"_reverse"),P(this,"_row"),P(this,"_rows"),P(this,"_set"),P(this,"_sort"),P(this,"_submatrix"),P(this,"_sum"),P(this,"_swap_columns"),P(this,"_swap_rows"),P(this,"_trace"),P(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let a=0;a<t;a++)this.matrix.push(Array(i).fill(r));this._add_col=Ha(this.context),this._add_row=Ka(this.context),this._avg=Ga(this.context),this._col=za(this.context),this._columns=Ya(this.context),this._concat=Qa(this.context),this._copy=Xa(this.context),this._det=Ja(this.context),this._diff=eo(this.context),this._eigenvalues=io(this.context),this._eigenvectors=ro(this.context),this._elements_count=no(this.context),this._fill=so(this.context),this._get=ao(this.context),this._inv=co(this.context),this._is_antidiagonal=uo(this.context),this._is_antisymmetric=ho(this.context),this._is_binary=lo(this.context),this._is_diagonal=po(this.context),this._is_identity=fo(this.context),this._is_square=mo(this.context),this._is_stochastic=xo(this.context),this._is_symmetric=go(this.context),this._is_triangular=yo(this.context),this._is_zero=vo(this.context),this._kron=wo(this.context),this._max=bo(this.context),this._median=So(this.context),this._min=Eo(this.context),this._mode=_o(this.context),this._mult=No(this.context),this._pinv=Io(this.context),this._pow=Co(this.context),this._rank=ko(this.context),this._remove_col=Ao(this.context),this._remove_row=Po(this.context),this._reshape=To(this.context),this._reverse=Ro(this.context),this._row=Do(this.context),this._rows=Vo(this.context),this._set=Lo(this.context),this._sort=Mo(this.context),this._submatrix=Oo(this.context),this._sum=Bo(this.context),this._swap_columns=Fo(this.context),this._swap_rows=Wo(this.context),this._trace=jo(this.context),this._transpose=$o(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
125
- `,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 Ho(e){return(t,i,r)=>new W(t,i,r,e)}function Ko(e){return(t,i=0)=>m.from(t).get(i)}class Go{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=Ho(t),this.param=Ko(),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 zo=Object.defineProperty,Yo=(e,t,i)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Qo=(e,t,i)=>Yo(e,typeof t!="symbol"?t+"":t,i);class Xo{constructor(t){this.context=t,Qo(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()}}class _t{constructor(t,i){this._definition=t,this.context=i;for(let r in t)this[r]=t[r]}get __def__(){return this._definition}copy(){return new _t(this.__def__,this.context)}toString(){const t={};for(let i in this.__def__)t[i]=this[i];return JSON.stringify(t)}}function Zo(e){return typeof e=="object"&&e.title!==void 0&&e.data!==void 0&&e.options!==void 0}const Nr={series:e=>e instanceof m||typeof e=="number"||typeof e=="string"||typeof e=="boolean",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)&&!Zo(e)};function Ce(e,t,i,r){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const n={};let a={};const s=new Array(t.length).fill(!0);for(let o=0;o<e.length;o++){const c=e[o];if(Nr.remaining_options(c)){a=c;break}const u=t.map((h,f)=>s[f]?h[o]:void 0);for(let h=0;h<u.length;h++){const f=u[h];if(f===void 0){s[h]=!1;continue}const l=Nr[i[f]];typeof l=="function"&&l(c)?n[f]=c:s[h]=!1}}return{...a,...n,...r}}var Jo=Object.defineProperty,ec=(e,t,i)=>t in e?Jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,tc=(e,t,i)=>ec(e,typeof t!="symbol"?t+"":t,i);const ic=["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"],rc={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"},H={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#F23645",silver:"#B2B5BE",teal:"#089981",white:"#FFFFFF",yellow:"#FDD835"};function nc(e){return Ce(e,ic,rc)}class sc{constructor(t){this.context=t,tc(this,"color",{param:(i,r=0)=>m.from(i).get(r),rgb:(i,r,n,a)=>a?`rgba(${i}, ${r}, ${n}, ${(100-a)/100})`:`rgb(${i}, ${r}, ${n})`,new:(i,r)=>{if(i&&i.startsWith("#")){const n=i.slice(1);return r?`#${n}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${n}`}else{const n=H[i];return n?r?`#${n}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${n}`:r?`rgba(${i}, ${(100-r)/100})`:i}},white:H.white,lime:H.lime,green:H.green,red:H.red,maroon:H.maroon,black:H.black,gray:H.gray,blue:H.blue,yellow:H.yellow,orange:H.orange,purple:H.purple,pink:H.pink,brown:H.brown,teal:H.teal,cyan:H.cyan,navy:H.navy,indigo:H.indigo,violet:H.violet,magenta:H.magenta,rose:H.rose,gold:H.gold,silver:H.silver,bronze:H.bronze})}extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}indicator(...t){const i=nc(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),n=m.from(i).get(0);return isNaN(r)?n:r}fixnan(t){const i=m.from(t);for(let r=0;r<i.length;r++){const n=i.get(r);if(!isNaN(n))return n}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()}Type(t){const i=Object.keys(t);return{new:function(...r){const n={};for(let a=0;a<r.length;a++)n[i[a]]=r[a];return new _t(n,this.context)},copy:function(r){return new _t(r.__def__,this.context)}}}}const ac=[["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"]],oc={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function pe(e){return Ce(e,ac,oc)}function Se(e,t){return t.title&&e.inputs&&e.inputs[t.title]!==void 0?e.inputs[t.title]:t.defval}function cc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function uc(e){return(...t)=>pe(t).defval}function hc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function lc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function pc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function fc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function dc(e){return(t,i=0)=>m.from(t).get(i)}function mc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function xc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function gc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function yc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function vc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function wc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function bc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function Sc(e){return(...t)=>pe(t).defval}var Ec=Object.defineProperty,_c=(e,t,i)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ae=(e,t,i)=>_c(e,typeof t!="symbol"?t+"":t,i);const Nc={any:cc,bool:uc,color:hc,enum:lc,float:pc,int:fc,param:dc,price:mc,session:xc,source:gc,string:yc,symbol:vc,text_area:wc,time:bc,timeframe:Sc};class Ic{constructor(t){this.context=t,ae(this,"any"),ae(this,"bool"),ae(this,"color"),ae(this,"enum"),ae(this,"float"),ae(this,"int"),ae(this,"param"),ae(this,"price"),ae(this,"session"),ae(this,"source"),ae(this,"string"),ae(this,"symbol"),ae(this,"text_area"),ae(this,"time"),ae(this,"timeframe"),Object.entries(Nc).forEach(([i,r])=>{this[i]=r(t)})}}function Cc(e){return t=>Math.abs(m.from(t).get(0))}function kc(e){return t=>Math.acos(m.from(t).get(0))}function Ac(e){return t=>Math.asin(m.from(t).get(0))}function Pc(e){return t=>Math.atan(m.from(t).get(0))}function Tc(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Rc(e){return t=>Math.ceil(m.from(t).get(0))}function Dc(e){return t=>Math.cos(m.from(t).get(0))}function Vc(e){return()=>Math.E}function Lc(e){return t=>Math.exp(m.from(t).get(0))}function Mc(e){return t=>Math.floor(m.from(t).get(0))}function Oc(e){return t=>Math.log(m.from(t).get(0))}function Bc(e){return t=>Math.log(m.from(t).get(0))}function Fc(e){return t=>Math.log10(m.from(t).get(0))}function Wc(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.max(...i)}}function jc(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.min(...i)}}function $c(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 qc(e){return()=>1.618033988749895}function Uc(e){return()=>Math.PI}function Hc(e){return(t,i)=>Math.pow(m.from(t).get(0),m.from(i).get(0))}function Kc(e){return()=>Math.random()}function Gc(e){return(t,i)=>{const r=m.from(t).get(0);if(i==null)return Math.round(r);const n=m.from(i).get(0);if(n===0)return Math.round(r);const a=Math.pow(10,n);return Math.round(r*a)/a}}function zc(e){return t=>e.precision(Math.round(m.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Yc(e){return()=>.6180339887498948}function Qc(e){return t=>Math.sign(m.from(t).get(0))}function Xc(e){return t=>Math.sin(m.from(t).get(0))}function Zc(e){return t=>Math.sqrt(m.from(t).get(0))}function Jc(e){return(t,i)=>{const r=m.from(i).get(0),n=m.from(t);let a=0;for(let s=0;s<r;s++){const o=n.get(s);a+=o}return a}}function eu(e){return t=>Math.tan(m.from(t).get(0))}function tu(e){return t=>{const i=m.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function iu(e){return t=>{const i=m.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function ru(e){return(t,i)=>{const r=m.from(t).get(0),n=m.from(i).get(0);return typeof r=="number"&&typeof n=="number"?isNaN(r)&&isNaN(n)?!0:isNaN(r)||isNaN(n)?!1:Math.abs(r-n)<1e-8:r===n}}var nu=Object.defineProperty,su=(e,t,i)=>t in e?nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,B=(e,t,i)=>su(e,typeof t!="symbol"?t+"":t,i);const au={abs:Cc,acos:kc,asin:Ac,atan:Pc,avg:Tc,ceil:Rc,cos:Dc,e:Vc,exp:Lc,floor:Mc,ln:Oc,log:Bc,log10:Fc,max:Wc,min:jc,param:$c,phi:qc,pi:Uc,pow:Hc,random:Kc,round:Gc,round_to_mintick:zc,rphi:Yc,sign:Qc,sin:Xc,sqrt:Zc,sum:Jc,tan:eu,todegrees:tu,toradians:iu,__eq:ru};class ou{constructor(t){this.context=t,B(this,"_cache",{}),B(this,"abs"),B(this,"acos"),B(this,"asin"),B(this,"atan"),B(this,"avg"),B(this,"ceil"),B(this,"cos"),B(this,"e"),B(this,"exp"),B(this,"floor"),B(this,"ln"),B(this,"log"),B(this,"log10"),B(this,"max"),B(this,"min"),B(this,"param"),B(this,"phi"),B(this,"pi"),B(this,"pow"),B(this,"random"),B(this,"round"),B(this,"round_to_mintick"),B(this,"rphi"),B(this,"sign"),B(this,"sin"),B(this,"sqrt"),B(this,"sum"),B(this,"tan"),B(this,"todegrees"),B(this,"toradians"),B(this,"__eq"),Object.entries(au).forEach(([i,r])=>{this[i]=r(t)})}}function cu(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof m)n=t.get(i||0);else if(Array.isArray(t)){const a=t.every(o=>o instanceof m),s=t.every(o=>!(o instanceof m)&&!Array.isArray(o));(a||s)&&t.length>=1?a?n=t.map(o=>o.get(0)):n=t:n=m.from(t).get(i||0)}else n=t;return e.params[r].length===0?e.params[r].push(n):e.params[r][e.params[r].length-1]=n,[n,r]}}const Nt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Ir(e,t,i,r,n=!1){for(let a=0;a<i.length;a++)if(i[a]<=e&&t<=r[a])return n||t>=r[a]?a:a-1;return-1}function Cr(e,t,i,r,n=!1,a,s=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const c=a&&t>a;if(s&&n)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}if(c&&n&&!s)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}return o}if(r[o]<e)break}return-1}function uu(e){return async(t,i,r,n=!1,a=!1,s=!1,o=null,c=null)=>{const u=t[0],h=i[0],f=r[0],l=r[1],d=Array.isArray(n)?n[0]:n,g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return f;const y=Nt.indexOf(e.timeframe),v=Nt.indexOf(h);if(y==-1||v==-1)throw new Error("Invalid timeframe");if(y===v)return f;const b=y>v,_=m.from(e.data.openTime).get(0),N=m.from(e.data.closeTime).get(0),I=`${u}_${h}_${l}`,E=`${I}_prevIdx`;if(e.cache[I]){const ce=e.cache[I],$e=b?Cr(_,N,ce.data.openTime.data,ce.data.closeTime.data,g,e.eDate,d):Ir(_,N,ce.data.openTime.data,ce.data.closeTime.data,g);if($e==-1)return NaN;const ie=ce.params[l][$e];if(!b&&d){const Lr=e.cache[E];return Lr!==void 0&&Lr===$e?NaN:(e.cache[E]=$e,Array.isArray(ie)?[ie]:ie)}return Array.isArray(ie)?[ie]:ie}const O=1e3*60*60*24*30,D=e.sDate?e.sDate-O:void 0,F=e.sDate&&e.eDate?void 0:e.limit||1e3,Y=new ti(e.source,u,h,F,D,void 0);Y.markAsSecondary();const Q=await Y.run(e.pineTSCode);e.cache[I]=Q;const z=b?Cr(_,N,Q.data.openTime.data,Q.data.closeTime.data,g,e.eDate,d):Ir(_,N,Q.data.openTime.data,Q.data.closeTime.data,g);if(z==-1)return NaN;const oe=Q.params[l][z];return!b&&d?(e.cache[E]=z,NaN):Array.isArray(oe)?[oe]:oe}}function hu(e){return async(t,i,r,n=!1,a=null,s=!1,o=0)=>{const c=t[0],u=i[0],h=r[0],f=r[1];Array.isArray(n)&&n[0];const l=Array.isArray(s)?s[0]:s;if(e.isSecondaryContext)return Array.isArray(h)?[h]:h;const d=Nt.indexOf(e.timeframe),g=Nt.indexOf(u);if(d===-1||g===-1){if(l)return NaN;throw new Error("Invalid timeframe")}if(g>d){if(l)return NaN;throw new Error(`Timeframe ${u} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(g===d)return[[h]];const y=`${c}_${u}_${f}_lower`;if(!e.cache[y]){const D=e.sDate?e.sDate-2592e6:void 0,F=e.sDate&&e.eDate?void 0:e.limit||1e3,Y=new ti(e.source,c,u,F,D,e.eDate);Y.markAsSecondary();const Q=await Y.run(e.pineTSCode);e.cache[y]=Q}const v=e.cache[y],b=m.from(e.data.openTime).get(0),_=m.from(e.data.closeTime).get(0),N=v.data.openTime.data,I=v.data.closeTime.data,E=v.params[f];if(!E)return[];const O=[];for(let D=0;D<N.length;D++){const F=N[D];if(!(I[D]<=b)){if(F>=_)break;F>=b&&F<_&&O.push(E[D])}}return[O]}}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,It=(e,t,i)=>pu(e,typeof t!="symbol"?t+"":t,i);const fu={param:cu,security:uu,security_lower_tf:hu};class du{constructor(t){this.context=t,It(this,"_cache",{}),It(this,"param"),It(this,"security"),It(this,"security_lower_tf"),Object.entries(fu).forEach(([i,r])=>{this[i]=r(t)})}}function mu(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.high,0),s=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(n)||isNaN(a)||isNaN(s)||isNaN(o))return r.currentCumulativeSum=r.prevCumulativeSum,e.precision(r.prevCumulativeSum);const c=a-s;let u=0;c!==0&&(u=(n-s-(a-n))/c*o);const h=r.prevCumulativeSum+u;return r.currentCumulativeSum=h,e.precision(h)}}function xu(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0),c=m.from(n).get(0);e.taState||(e.taState={});const u=a||`alma_${s}_${o}_${c}`;if(!e.taState[u]){const g=o*(s-1),y=s/c,v=[];let b=0;for(let _=0;_<s;_++){const N=Math.exp(-Math.pow(_-g,2)/(2*y*y));v.push(N),b+=N}for(let _=0;_<v.length;_++)v[_]/=b;e.taState[u]={lastIdx:-1,prevWindow:[],currentWindow:[],weights:v}}const h=e.taState[u];e.idx>h.lastIdx&&(h.lastIdx>=0&&(h.prevWindow=[...h.currentWindow]),h.lastIdx=e.idx);const f=m.from(t).get(0),l=[...h.prevWindow];if(l.unshift(f),l.length>s&&l.pop(),h.currentWindow=l,l.length<s)return NaN;let d=0;for(let g=0;g<s;g++)d+=h.weights[g]*l[s-1-g];return e.precision(d)}}function gu(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`atr_${r}`;e.taState[n]||(e.taState[n]={lastIdx:-1,prevAtr:null,prevInitSum:0,prevInitCount:0,prevPrevClose:null,currentAtr:null,currentInitSum:0,currentInitCount:0,currentPrevClose:null});const a=e.taState[n];e.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevAtr=a.currentAtr,a.prevInitSum=a.currentInitSum,a.prevInitCount=a.currentInitCount,a.prevPrevClose=a.currentPrevClose),a.lastIdx=e.idx);const s=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(s)||isNaN(o)||isNaN(c))return NaN;const u=a.prevPrevClose;let h;if(u!==null){const y=s-o,v=Math.abs(s-u),b=Math.abs(o-u);h=Math.max(y,v,b)}else h=s-o;a.currentPrevClose=c;let f=a.prevInitCount,l=a.prevInitSum,d=a.prevAtr;if(f<r){if(l+=h,f++,a.currentInitSum=l,a.currentInitCount=f,f===r){const y=l/r;return a.currentAtr=y,e.precision(y)}return NaN}const g=(d*(r-1)+h)/r;return a.currentAtr=g,e.precision(g)}}function yu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastIdx:-1,prevLastTrueIndex:null,currentLastTrueIndex:null});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevLastTrueIndex=n.currentLastTrueIndex),n.lastIdx=e.idx);const a=m.from(t).get(0);let s=n.prevLastTrueIndex;return a&&(s=e.idx),n.currentLastTrueIndex=s,s===null?NaN:e.idx-s}}function vu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bb_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=m.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,[[NaN,NaN,NaN]];const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length>a){const b=h.pop();f-=b}if(c.currentWindow=h,c.currentSum=f,h.length<a)return[[NaN,NaN,NaN]];const l=f/a;let d=0;for(let b=0;b<a;b++)d+=Math.pow(h[b]-l,2);const g=Math.sqrt(d/a),y=l+s*g,v=l-s*g;return[[e.precision(l),e.precision(y),e.precision(v)]]}}function wu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bbw_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=m.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,NaN;const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length>a){const _=h.pop();f-=_}if(c.currentWindow=h,c.currentSum=f,h.length<a)return NaN;const l=f/a;let d=0;for(let _=0;_<a;_++){const N=h[_]-l;d+=N*N}const g=d/a,y=Math.sqrt(g),v=s*y;if(l===0)return e.precision(0);const b=2*v/l*100;return e.precision(b)}}function bu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`cci_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=m.from(t).get(0);if(isNaN(o))return NaN;const c=[...s.prevWindow];let u=s.prevSum;if(c.unshift(o),u+=o,c.length<n)return s.currentWindow=c,s.currentSum=u,NaN;if(c.length>n){const g=c.pop();u-=g}s.currentWindow=c,s.currentSum=u;const h=u/n;let f=0;for(let g=0;g<n;g++)f+=Math.abs(c[g]-h);const l=f/n;if(l===0)return 0;const d=(o-h)/(.015*l);return e.precision(d)}}function Su(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`change_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<=n)return s.currentWindow=c,NaN;c.length>n+1&&c.pop(),s.currentWindow=c;const u=o-c[n];return e.precision(u)}}function Eu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`cmo_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevGainsWindow:[],prevLossesWindow:[],prevGainsSum:0,prevLossesSum:0,currentGainsWindow:[],currentLossesWindow:[],currentGainsSum:0,currentLossesSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevGainsWindow=[...s.currentGainsWindow],s.prevLossesWindow=[...s.currentLossesWindow],s.prevGainsSum=s.currentGainsSum,s.prevLossesSum=s.currentLossesSum),s.lastIdx=e.idx);const o=m.from(t).get(0),c=m.from(t).get(1);if(isNaN(o)||isNaN(c))return NaN;const u=o-c,h=u>=0?u:0,f=u>=0?0:-u,l=[...s.prevGainsWindow],d=[...s.prevLossesWindow];let g=s.prevGainsSum,y=s.prevLossesSum;if(l.unshift(h),d.unshift(f),g+=h,y+=f,l.length<n)return s.currentGainsWindow=l,s.currentLossesWindow=d,s.currentGainsSum=g,s.currentLossesSum=y,NaN;if(l.length>n){const _=l.pop(),N=d.pop();g-=_,y-=N}s.currentGainsWindow=l,s.currentLossesWindow=d,s.currentGainsSum=g,s.currentLossesSum=y;const v=g+y;if(v===0)return e.precision(0);const b=100*(g-y)/v;return e.precision(b)}}function _u(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);let s=0,o=!1;for(let h=0;h<n;h++){const f=a.get(h);if(isNaN(f)){o=!0;break}s+=f}if(o)return NaN;let c=0;for(let h=0;h<n;h++){const f=a.get(h);c+=f*(h+1)}if(s===0)return NaN;const u=-c/s;return e.precision(u)}}function Nu(e){return(t,i,r,n)=>{const a=m.from(r).get(0),s=m.from(t),o=m.from(i);if(e.idx<a-1)return NaN;let c=0,u=0,h=0,f=0,l=0,d=0;for(let _=0;_<a;_++){const N=s.get(_),I=o.get(_);isNaN(N)||isNaN(I)||(c+=N,u+=I,h+=N*I,f+=N*N,l+=I*I,d++)}if(d<2)return NaN;const g=d*h-c*u,y=d*f-c*c,v=d*l-u*u;if(y<=0||v<=0)return e.precision(0);const b=g/Math.sqrt(y*v);return e.precision(b)}}function Iu(e){return(t,i,r)=>{const n=m.from(t),a=m.from(i),s=n.get(0),o=a.get(0),c=n.get(1),u=a.get(1);if(isNaN(s)||isNaN(o)||isNaN(c)||isNaN(u))return!1;const h=s>o&&c<=u,f=s<o&&c>=u;return h||f}}function Cu(e){return(t,i)=>{const r=m.from(t),n=m.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o<c&&a>s}}function ku(e){return(t,i)=>{const r=m.from(t),n=m.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o>c&&a<s}}function Au(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevCumulativeSum=n.currentCumulativeSum),n.lastIdx=e.idx);const a=m.from(t).get(0);if(isNaN(a))return n.currentCumulativeSum=n.prevCumulativeSum,e.precision(n.prevCumulativeSum);const s=n.prevCumulativeSum+a;return n.currentCumulativeSum=s,e.precision(s)}}function Pu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`dev_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=m.from(t).get(0)||0,c=[...s.prevWindow];let u=s.prevSum;if(c.unshift(o),u+=o,c.length>n){const d=c.pop();u-=d}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const h=u/n;let f=0;for(let d=0;d<n;d++)f+=Math.abs(c[d]-h);const l=f/n;return e.precision(l)}}function Tu(e){return(t,i,r)=>{const n=m.from(t).get(0),a=m.from(i).get(0);e.taState||(e.taState={});const s=r||`dmi_${n}_${a}`;e.taState[s]||(e.taState[s]={lastIdx:-1,prevHigh:NaN,prevLow:NaN,prevClose:NaN,prevTrInitSum:0,prevPlusInitSum:0,prevMinusInitSum:0,prevInitCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,prevDxInitSum:0,prevAdxInitCount:0,prevADX:NaN,currentHigh:NaN,currentLow:NaN,currentClose:NaN,currentTrInitSum:0,currentPlusInitSum:0,currentMinusInitSum:0,currentInitCount:0,currentSmoothedTR:NaN,currentSmoothedPlus:NaN,currentSmoothedMinus:NaN,currentDxInitSum:0,currentAdxInitCount:0,currentADX:NaN});const o=e.taState[s];e.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevHigh=o.currentHigh,o.prevLow=o.currentLow,o.prevClose=o.currentClose,o.prevTrInitSum=o.currentTrInitSum,o.prevPlusInitSum=o.currentPlusInitSum,o.prevMinusInitSum=o.currentMinusInitSum,o.prevInitCount=o.currentInitCount,o.prevSmoothedTR=o.currentSmoothedTR,o.prevSmoothedPlus=o.currentSmoothedPlus,o.prevSmoothedMinus=o.currentSmoothedMinus,o.prevDxInitSum=o.currentDxInitSum,o.prevAdxInitCount=o.currentAdxInitCount,o.prevADX=o.currentADX),o.lastIdx=e.idx);const c=e.get(e.data.high,0),u=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(c)||isNaN(u)||isNaN(h))return[[NaN,NaN,NaN]];if(o.currentHigh=c,o.currentLow=u,o.currentClose=h,isNaN(o.prevHigh))return[[NaN,NaN,NaN]];const f=Math.max(c-u,Math.abs(c-o.prevClose),Math.abs(u-o.prevClose)),l=c-o.prevHigh,d=o.prevLow-u,g=l>d&&l>0?l:0,y=d>l&&d>0?d:0;let v=o.prevInitCount,b=o.prevTrInitSum,_=o.prevPlusInitSum,N=o.prevMinusInitSum,I=o.prevSmoothedTR,E=o.prevSmoothedPlus,O=o.prevSmoothedMinus;if(v++,v<=n)b+=f,_+=g,N+=y,v===n&&(I=b/n,E=_/n,O=N/n);else{const ie=1/n;I=ie*f+(1-ie)*I,E=ie*g+(1-ie)*E,O=ie*y+(1-ie)*O}if(o.currentInitCount=v,o.currentTrInitSum=b,o.currentPlusInitSum=_,o.currentMinusInitSum=N,o.currentSmoothedTR=I,o.currentSmoothedPlus=E,o.currentSmoothedMinus=O,v<n)return[[NaN,NaN,NaN]];const D=I===0?0:100*E/I,F=I===0?0:100*O/I,Y=D+F,Q=Y===0?0:100*Math.abs(D-F)/Y;let z=o.prevAdxInitCount,oe=o.prevDxInitSum,ce=o.prevADX,$e=NaN;if(z++,z<=a)oe+=Q,z===a&&(ce=oe/a,$e=ce);else{const ie=1/a;ce=ie*Q+(1-ie)*ce,$e=ce}return o.currentAdxInitCount=z,o.currentDxInitSum=oe,o.currentADX=ce,[[e.precision(D),e.precision(F),e.precision($e)]]}}function Ru(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`ema_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevEma:null,prevInitSum:0,prevInitCount:0,currentEma:null,currentInitSum:0,currentInitCount:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevEma=s.currentEma,s.prevInitSum=s.currentInitSum,s.prevInitCount=s.currentInitCount),s.lastIdx=e.idx);const o=m.from(t).get(0);if(o==null||isNaN(o))return NaN;let c=s.prevInitCount,u=s.prevInitSum,h=s.prevEma;if(c<n){if(u+=o,c++,s.currentInitSum=u,s.currentInitCount=c,c===n){const d=u/n;return s.currentEma=d,e.precision(d)}return NaN}const f=2/(n+1),l=o*f+h*(1-f);return s.currentEma=l,e.precision(l)}}function Du(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);for(let s=0;s<n;s++){const o=a.get(s),c=a.get(s+1);if(isNaN(o)||isNaN(c)||o>=c)return!1}return!0}}function Vu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`highest_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;const u=c.filter(f=>!isNaN(f)&&f!==void 0);if(u.length===0)return NaN;const h=Math.max(...u);return e.precision(h)}}function Lu(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;let s=-1/0,o=NaN;for(let c=0;c<n;c++){const u=a.get(c);isNaN(u)||(isNaN(o)||u>s)&&(s=u,o=-c)}return o}}function Mu(e){return(t,i,r)=>{const n=m.from(i).get(0),a=Math.floor(n/2),s=Math.floor(Math.sqrt(n)),o=e.pine.ta.wma,c=o(t,a,r?`${r}_wma1`:void 0),u=o(t,n,r?`${r}_wma2`:void 0);if(isNaN(c)||isNaN(u))return NaN;e.taState||(e.taState={});const h=r||`hma_raw_${n}`;e.taState[h]||(e.taState[h]={lastIdx:-1,prevValues:[],currentValues:[]});const f=e.taState[h];e.idx>f.lastIdx&&(f.lastIdx>=0&&(f.prevValues=[...f.currentValues]),f.lastIdx=e.idx);const l=2*c-u,d=[...f.prevValues];d.unshift(l),d.length>s+1&&d.pop(),f.currentValues=d;const g=r?`${r}_hma_final`:`hma_final_${n}`;e.taState[g]||(e.taState[g]={lastIdx:-1,prevWindow:[],currentWindow:[]});const y=e.taState[g];e.idx>y.lastIdx&&(y.lastIdx>=0&&(y.prevWindow=[...y.currentWindow]),y.lastIdx=e.idx);const v=[...y.prevWindow];if(v.unshift(l),v.length<s)return y.currentWindow=v,NaN;v.length>s&&v.pop(),y.currentWindow=v;let b=0,_=0;for(let I=0;I<s;I++){const E=s-I;b+=v[I]*E,_+=E}const N=b/_;return e.precision(N)}}function Ou(e){return t=>{const i=e.get(e.data.close,0),r=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(n)||isNaN(a))return NaN;const s=(r-n)*a;if(s===0)return e.precision(0);const o=(2*i-r-n)/s;return e.precision(o)}}function Bu(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=m.from(n).get(0));let u;const h=e.get(e.data.high,0),f=e.get(e.data.low,0);if(c){const I=e.get(e.data.close,1);isNaN(I)?u=NaN:u=Math.max(h-f,Math.abs(h-I),Math.abs(f-I))}else u=h-f;const l=m.from(t).get(0);e.taState||(e.taState={});const d=a||`kc_${s}_${o}_${c}`;e.taState[d]||(e.taState[d]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const g=e.taState[d];e.idx>g.lastIdx&&(g.lastIdx>=0&&(g.basisState={...g.currentBasisState},g.rangeState={...g.currentRangeState}),g.lastIdx=e.idx);const y=(I,E,O,D)=>{if(isNaN(O))return Object.assign(E,I),E.prevEma!==null?E.prevEma:NaN;let F=I.initCount,Y=I.initSum,Q=I.prevEma;if(F<D){if(Y+=O,F++,E.initSum=Y,E.initCount=F,E.prevEma=Q,F===D){const ce=Y/D;return E.prevEma=ce,ce}return NaN}const z=2/(D+1),oe=O*z+Q*(1-z);return E.prevEma=oe,E.initSum=Y,E.initCount=F,oe},v=y(g.basisState,g.currentBasisState,l,s),b=y(g.rangeState,g.currentRangeState,u,s);if(isNaN(v)||isNaN(b))return[[NaN,NaN,NaN]];const _=v+b*o,N=v-b*o;return[[e.precision(v),e.precision(_),e.precision(N)]]}}function Fu(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=m.from(n).get(0)),e.taState||(e.taState={});const u=a||`kcw_${s}_${o}_${c}`;e.taState[u]||(e.taState[u]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const h=e.taState[u];e.idx>h.lastIdx&&(h.lastIdx>=0&&(h.basisState={...h.currentBasisState},h.rangeState={...h.currentRangeState}),h.lastIdx=e.idx);const f=(N,I,E,O)=>{if(isNaN(E))return Object.assign(I,N),I.prevEma!==null?I.prevEma:NaN;let D=N.initCount,F=N.initSum,Y=N.prevEma;if(D<O){if(F+=E,D++,I.initSum=F,I.initCount=D,I.prevEma=Y,D===O){const oe=F/O;return I.prevEma=oe,oe}return NaN}const Q=2/(O+1),z=E*Q+Y*(1-Q);return I.prevEma=z,I.initSum=F,I.initCount=D,z};let l;const d=e.get(e.data.high,0),g=e.get(e.data.low,0);if(c){const N=e.get(e.data.close,1);isNaN(N)?l=NaN:l=Math.max(d-g,Math.abs(d-N),Math.abs(g-N))}else l=d-g;const y=m.from(t).get(0),v=f(h.basisState,h.currentBasisState,y,s),b=f(h.rangeState,h.currentRangeState,l,s);if(isNaN(v)||isNaN(b))return NaN;if(v===0)return e.precision(0);const _=2*b*o/v;return e.precision(_)}}function Wu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`linreg_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],currentWindow:[]});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow]),c.lastIdx=e.idx);const u=m.from(t).get(0),h=[...c.prevWindow];if(h.unshift(u),h.length>a&&h.pop(),c.currentWindow=h,h.length<a)return NaN;let f=0,l=0,d=0,g=0;const y=a;for(let N=0;N<a;N++){const I=a-1-N,E=h[N];f+=I,l+=E,d+=I*E,g+=I*I}const v=y*g-f*f;if(v===0)return NaN;const b=(y*d-f*l)/v,_=(l-b*f)/y+b*(a-1-s);return e.precision(_)}}function ju(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`lowest_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;const u=c.filter(f=>!isNaN(f)&&f!==void 0),h=u.length>0?Math.min(...u):NaN;return e.precision(h)}}function $u(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;let s=1/0,o=NaN;for(let c=0;c<n;c++){const u=a.get(c);isNaN(u)||(isNaN(o)||u<s)&&(s=u,o=-c)}return o}}function qu(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0),c=m.from(n).get(0),u=a||`macd_${s}_${o}_${c}`,h=`${u}_fast`,f=`${u}_slow`,l=`${u}_signal`,d=e.pine.ta.ema(t,s,h),g=e.pine.ta.ema(t,o,f);let y=NaN;!isNaN(d)&&!isNaN(g)&&(y=d-g);let v=NaN;isNaN(y)||(v=e.pine.ta.ema(y,c,l));let b=NaN;return!isNaN(y)&&!isNaN(v)&&(b=y-v),[[e.precision(y),e.precision(v),e.precision(b)]]}}function Uu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`median_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length>n&&c.pop(),s.currentWindow=c,c.length<n)return NaN;const u=c.slice().sort((l,d)=>l-d),h=Math.floor(n/2),f=n%2===0?(u[h-1]+u[h])/2:u[h];return e.precision(f)}}function Hu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`mfi_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevUpperWindow:[],prevLowerWindow:[],prevUpperSum:0,prevLowerSum:0,currentUpperWindow:[],currentLowerWindow:[],currentUpperSum:0,currentLowerSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevUpperWindow=[...s.currentUpperWindow],s.prevLowerWindow=[...s.currentLowerWindow],s.prevUpperSum=s.currentUpperSum,s.prevLowerSum=s.currentLowerSum),s.lastIdx=e.idx);const o=m.from(t).get(0),c=m.from(t).get(1),u=e.get(e.data.volume,0);if(isNaN(o)||isNaN(u))return NaN;const h=isNaN(c)?NaN:o-c,f=u*(h<=0?0:o),l=u*(h>=0?0:o),d=[...s.prevUpperWindow],g=[...s.prevLowerWindow];let y=s.prevUpperSum,v=s.prevLowerSum;if(d.unshift(f),g.unshift(l),y+=f,v+=l,d.length<n)return s.currentUpperWindow=d,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=v,NaN;if(d.length>n){const _=d.pop(),N=g.pop();y-=_,v-=N}if(s.currentUpperWindow=d,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=v,v===0)return e.precision(100);if(y===0)return e.precision(0);const b=100-100/(1+y/v);return e.precision(b)}}function Ku(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;const s=new Map;for(let u=0;u<n;u++){const h=a.get(u);isNaN(h)||s.set(h,(s.get(h)||0)+1)}if(s.size===0)return NaN;let o=NaN,c=-1;for(const[u,h]of s.entries())h>c?(c=h,o=u):h===c&&u<o&&(o=u);return o}}function Gu(e){return(t,i,r)=>{const n=m.from(i).get(0);return e.pine.ta.change(t,n,r)}}function zu(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={lastIdx:-1,committedNVI:1,tentativeNVI:1});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedNVI=r.tentativeNVI),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,u=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;let l=r.committedNVI;if(!(c===0||u===0)&&h<f){const d=(c-u)/u;l=l+d*l}return r.tentativeNVI=l,e.precision(l)}}function Yu(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={lastIdx:-1,committedOBV:0,tentativeOBV:0});const i=e.taState[t];e.idx>i.lastIdx&&(i.lastIdx>=0&&(i.committedOBV=i.tentativeOBV),i.lastIdx=e.idx);const r=e.get(e.data.close,0),n=e.get(e.data.volume,0),a=e.get(e.data.close,1);if(isNaN(a))return i.tentativeOBV=0,e.precision(0);let s=i.committedOBV;return r>a?s+=n:r<a&&(s-=n),i.tentativeOBV=s,e.precision(s)}}function Qu(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 Xu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t);if(e.idx<a-1)return NaN;const c=[];for(let g=0;g<a;g++){const y=o.get(g);if(isNaN(y))return NaN;c.push(y)}c.sort((g,y)=>g-y);let u=s/100*a-.5;u<0&&(u=0),u>a-1&&(u=a-1);const h=Math.floor(u),f=Math.ceil(u);if(h===f)return e.precision(c[h]);const l=u-h,d=c[h]+l*(c[f]-c[h]);return e.precision(d)}}function Zu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t);if(e.idx<a-1)return NaN;const c=[];for(let h=0;h<a;h++){const f=o.get(h);isNaN(f)||c.push(f)}if(c.length===0)return NaN;c.sort((h,f)=>h-f);let u=Math.ceil(s/100*c.length)-1;return u<0&&(u=0),u>=c.length&&(u=c.length-1),e.precision(c[u])}}function Ju(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n)return NaN;const s=a.get(0);if(isNaN(s))return NaN;let o=0,c=0;for(let u=1;u<=n;u++){const h=a.get(u);isNaN(h)||(c++,h<=s&&o++)}return c===0?NaN:e.precision(o/c*100)}}function eh(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const a=e[n-i];let s=!0;for(let o=1;o<=t;o++)if(e[n-i-o]>=a){s=!1;break}if(s){for(let o=1;o<=i;o++)if(e[n-i+o]>=a){s=!1;break}}s&&(r[n]=a)}return r}function th(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t).toArray(),c=eh(o,a,s),u=e.idx;return e.precision(c[u])}}function ih(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const a=e[n-i];let s=!0;for(let o=1;o<=t;o++)if(e[n-i-o]<=a){s=!1;break}if(s){for(let o=1;o<=i;o++)if(e[n-i+o]<=a){s=!1;break}}s&&(r[n]=a)}return r}function rh(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t).toArray(),c=ih(o,a,s),u=e.idx;return e.precision(c[u])}}function nh(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={lastIdx:-1,committedPVI:1,tentativePVI:1});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedPVI=r.tentativePVI),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,u=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;let l=r.committedPVI;if(!(c===0||u===0)&&h>f){const d=(c-u)/u;l=l+d*l}return r.tentativePVI=l,e.precision(l)}}function sh(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0);let o=r.prevCumulativeSum;if(!isNaN(n)&&!isNaN(a)&&!isNaN(s)&&a!==0){const c=(n-a)/a*s;o+=c}return r.currentCumulativeSum=o,e.precision(o)}}function ah(e){return(t,i,r)=>{const n=e.pine.ta.highest(t,i,(r||"range")+"_h"),a=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(n)||isNaN(a)?NaN:e.precision(n-a)}}function oh(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);for(let s=0;s<n;s++){const o=a.get(s),c=a.get(s+1);if(isNaN(o)||isNaN(c)||o<=c)return!1}return!0}}function ch(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`rma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevRma:null,prevInitSum:0,prevInitCount:0,currentRma:null,currentInitSum:0,currentInitCount:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevRma=s.currentRma,s.prevInitSum=s.currentInitSum,s.prevInitCount=s.currentInitCount),s.lastIdx=e.idx);const o=m.from(t).get(0)||0;let c=s.prevInitCount,u=s.prevInitSum,h=s.prevRma;if(c<n){if(u+=o,c++,s.currentInitSum=u,s.currentInitCount=c,c===n){const d=u/n;return s.currentRma=d,e.precision(d)}return NaN}const f=1/n,l=o*f+h*(1-f);return s.currentRma=l,e.precision(l)}}function uh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`roc_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<=n)return s.currentWindow=c,NaN;c.length>n+1&&c.pop(),s.currentWindow=c;const u=c[n],h=(o-u)/u*100;return e.precision(h)}}function hh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`rsi_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevPrevValue:null,prevAvgGain:0,prevAvgLoss:0,prevInitGains:[],prevInitLosses:[],currentPrevValue:null,currentAvgGain:0,currentAvgLoss:0,currentInitGains:[],currentInitLosses:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevPrevValue=s.currentPrevValue,s.prevAvgGain=s.currentAvgGain,s.prevAvgLoss=s.currentAvgLoss,s.prevInitGains=[...s.currentInitGains],s.prevInitLosses=[...s.currentInitLosses]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=s.prevPrevValue;let u=s.prevAvgGain,h=s.prevAvgLoss;const f=[...s.prevInitGains],l=[...s.prevInitLosses];if(c!==null){const d=o-c,g=d>0?d:0,y=d<0?-d:0;if(f.length<n){if(f.push(g),l.push(y),s.currentInitGains=f,s.currentInitLosses=l,s.currentPrevValue=o,f.length===n){u=f.reduce((_,N)=>_+N,0)/n,h=l.reduce((_,N)=>_+N,0)/n,s.currentAvgGain=u,s.currentAvgLoss=h;const b=h===0?100:100-100/(1+u/h);return e.precision(b)}return NaN}u=(u*(n-1)+g)/n,h=(h*(n-1)+y)/n,s.currentAvgGain=u,s.currentAvgLoss=h,s.currentPrevValue=o;const v=h===0?100:100-100/(1+u/h);return e.precision(v)}return s.currentPrevValue=o,s.currentInitGains=[],s.currentInitLosses=[],NaN}}function lh(e){return(t,i,r,n)=>{const a=m.from(t).get(0),s=m.from(i).get(0),o=m.from(r).get(0);e.taState||(e.taState={});const c=n||`sar_${a}_${s}_${o}`;e.taState[c]||(e.taState[c]={lastIdx:-1,prevResult:NaN,prevMaxMin:NaN,prevAcceleration:NaN,prevIsBelow:!1,prevBarIndex:0,currentResult:NaN,currentMaxMin:NaN,currentAcceleration:NaN,currentIsBelow:!1,currentBarIndex:0});const u=e.taState[c];e.idx>u.lastIdx&&(u.lastIdx>=0&&(u.prevResult=u.currentResult,u.prevMaxMin=u.currentMaxMin,u.prevAcceleration=u.currentAcceleration,u.prevIsBelow=u.currentIsBelow,u.prevBarIndex=u.currentBarIndex),u.lastIdx=e.idx);let h=u.prevResult,f=u.prevMaxMin,l=u.prevAcceleration,d=u.prevIsBelow,g=u.prevBarIndex;const y=e.get(e.data.high,0),v=e.get(e.data.low,0),b=e.get(e.data.close,0),_=e.get(e.data.close,1),N=e.get(e.data.high,1),I=e.get(e.data.low,1),E=e.get(e.data.high,2),O=e.get(e.data.low,2);if(isNaN(y)||isNaN(v)||isNaN(b))return u.currentResult=h,u.currentMaxMin=f,u.currentAcceleration=l,u.currentIsBelow=d,u.currentBarIndex=g,NaN;let D=!1;return g===1&&(b>_?(d=!0,f=y,h=I):(d=!1,f=v,h=N),D=!0,l=a),g>=1&&(h=h+l*(f-h),d?h>v&&(D=!0,d=!1,h=Math.max(y,f),f=v,l=a):h<y&&(D=!0,d=!0,h=Math.min(v,f),f=y,l=a),D||(d?y>f&&(f=y,l=Math.min(l+s,o)):v<f&&(f=v,l=Math.min(l+s,o))),d?(h=Math.min(h,I),g>1&&(h=Math.min(h,O))):(h=Math.max(h,N),g>1&&(h=Math.max(h,E)))),g++,u.currentResult=h,u.currentMaxMin=f,u.currentAcceleration=l,u.currentIsBelow=d,u.currentBarIndex=g,g<=1?NaN:e.precision(h)}}function ph(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`sma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];c.unshift(o),c.length>n&&c.pop();let u;const h=o==null||Number.isNaN(o);let f=!Number.isNaN(s.prevSum)&&!h;if(f){let d=s.prevSum+o;if(s.prevWindow.length>=n){const g=s.prevWindow[s.prevWindow.length-1];g==null||Number.isNaN(g)?f=!1:d-=g}f&&(u=d)}if(!f){u=0;let d=!1;for(const g of c){if(g==null||Number.isNaN(g)){d=!0;break}u+=g}d&&(u=NaN)}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const l=u/n;return e.precision(l)}}function fh(e){return(t,i,r=!0,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`stdev_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=m.from(t).get(0);if(u==null||isNaN(u))return NaN;const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length<a)return c.currentWindow=h,c.currentSum=f,NaN;if(h.length>a){const v=h.pop();f-=v}c.currentWindow=h,c.currentSum=f;const l=f/a;let d=0;for(let v=0;v<a;v++)d+=Math.pow(h[v]-l,2);const g=s?a:a-1,y=Math.sqrt(d/g);return e.precision(y)}}function dh(e){return(t,i,r,n,a)=>{const s=m.from(n).get(0);e.taState||(e.taState={});const o=a||`stoch_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevHighWindow=[...c.currentHighWindow],c.prevLowWindow=[...c.currentLowWindow]),c.lastIdx=e.idx);const u=m.from(t).get(0),h=m.from(i).get(0),f=m.from(r).get(0);if(isNaN(u)||isNaN(h)||isNaN(f))return c.currentHighWindow=[...c.prevHighWindow],c.currentLowWindow=[...c.prevLowWindow],NaN;const l=[...c.prevHighWindow],d=[...c.prevLowWindow];if(l.unshift(h),d.unshift(f),l.length>s&&(l.pop(),d.pop()),c.currentHighWindow=l,c.currentLowWindow=d,l.length<s)return NaN;let g=l[0],y=d[0];for(let _=1;_<s;_++)l[_]>g&&(g=l[_]),d[_]<y&&(y=d[_]);const v=g-y;if(v===0)return NaN;const b=100*(u-y)/v;return e.precision(b)}}function mh(e){return(t,i,r)=>{const n=m.from(t).get(0),a=m.from(i).get(0);e.taState||(e.taState={});const s=r||`supertrend_${n}_${a}`;e.taState[s]||(e.taState[s]={lastIdx:-1,prevTrSum:0,prevAtrValue:NaN,prevAtrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN,currentTrSum:0,currentAtrValue:NaN,currentAtrCount:0,currentLowerBand:NaN,currentUpperBand:NaN,currentSuperTrend:NaN,currentDirection:NaN,currentClose:NaN});const o=e.taState[s];e.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrSum=o.currentTrSum,o.prevAtrValue=o.currentAtrValue,o.prevAtrCount=o.currentAtrCount,o.prevLowerBand=o.currentLowerBand,o.prevUpperBand=o.currentUpperBand,o.prevSuperTrend=o.currentSuperTrend,o.prevDirection=o.currentDirection,o.prevClose=o.currentClose),o.lastIdx=e.idx);const c=e.get(e.data.high,0),u=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(c)||isNaN(u)||isNaN(h))return[[NaN,NaN]];const f=(c+u)/2,l=o.prevClose;let d;isNaN(l)?d=c-u:d=Math.max(c-u,Math.abs(c-l),Math.abs(u-l));let g=o.prevAtrCount,y=o.prevTrSum,v=o.prevAtrValue;g++,g<=a?(y+=d,g===a&&(v=y/a)):v=(v*(a-1)+d)/a;const b=v;if(o.currentAtrCount=g,o.currentTrSum=y,o.currentAtrValue=v,o.currentClose=h,isNaN(b))return[[NaN,NaN]];let _=f+n*b,N=f-n*b;const I=isNaN(o.prevLowerBand)?0:o.prevLowerBand,E=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||N>I||l<I||(N=I),isNaN(o.prevUpperBand)||_<E||l>E||(_=E);let O,D;const F=o.prevSuperTrend;return g===a?O=1:F===o.prevUpperBand?O=h>_?-1:1:O=h<N?1:-1,D=O===-1?N:_,o.currentLowerBand=N,o.currentUpperBand=_,o.currentSuperTrend=D,o.currentDirection=O,[[e.precision(D),O]]}}function xh(e){return(t,i)=>{const r=[1,2,2,1],n=6;e.taState||(e.taState={});const a=i||"swma";e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<4)return s.currentWindow=c,NaN;c.length>4&&c.pop(),s.currentWindow=c;let u=0;for(let h=0;h<4;h++)u+=r[h]*c[3-h];return u/=n,e.precision(u)}}function gh(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=m.from(t).get(0));const n=e.get(e.data.high,0),a=e.get(e.data.low,0),s=e.get(e.data.close,1);if(isNaN(s))return r?e.precision(n-a):NaN;const o=Math.max(n-a,Math.abs(n-s),Math.abs(a-s));return e.precision(o)}}function yh(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`tsi_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevSource:NaN,prevEma1PcValue:NaN,prevEma1PcCount:0,prevEma1PcSum:0,prevEma2PcValue:NaN,prevEma2PcCount:0,prevEma2PcSum:0,prevEma1AbsValue:NaN,prevEma1AbsCount:0,prevEma1AbsSum:0,prevEma2AbsValue:NaN,prevEma2AbsCount:0,prevEma2AbsSum:0,currentSource:NaN,currentEma1PcValue:NaN,currentEma1PcCount:0,currentEma1PcSum:0,currentEma2PcValue:NaN,currentEma2PcCount:0,currentEma2PcSum:0,currentEma1AbsValue:NaN,currentEma1AbsCount:0,currentEma1AbsSum:0,currentEma2AbsValue:NaN,currentEma2AbsCount:0,currentEma2AbsSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevSource=c.currentSource,c.prevEma1PcValue=c.currentEma1PcValue,c.prevEma1PcCount=c.currentEma1PcCount,c.prevEma1PcSum=c.currentEma1PcSum,c.prevEma2PcValue=c.currentEma2PcValue,c.prevEma2PcCount=c.currentEma2PcCount,c.prevEma2PcSum=c.currentEma2PcSum,c.prevEma1AbsValue=c.currentEma1AbsValue,c.prevEma1AbsCount=c.currentEma1AbsCount,c.prevEma1AbsSum=c.currentEma1AbsSum,c.prevEma2AbsValue=c.currentEma2AbsValue,c.prevEma2AbsCount=c.currentEma2AbsCount,c.prevEma2AbsSum=c.currentEma2AbsSum),c.lastIdx=e.idx);const u=m.from(t).get(0);if(isNaN(u))return NaN;const h=isNaN(c.prevSource)?NaN:u-c.prevSource;if(c.currentSource=u,isNaN(h))return NaN;const f=Math.abs(h),l=2/(s+1),d=2/(a+1),g=2/(s+1),y=2/(a+1);let v=c.prevEma1PcCount,b=c.prevEma1PcSum,_=c.prevEma1PcValue;v++,v<=s?(b+=h,v===s&&(_=b/s)):_=h*l+_*(1-l);let N=c.prevEma1AbsCount,I=c.prevEma1AbsSum,E=c.prevEma1AbsValue;if(N++,N<=s?(I+=f,N===s&&(E=I/s)):E=f*g+E*(1-g),isNaN(_)||isNaN(E))return c.currentEma1PcCount=v,c.currentEma1PcSum=b,c.currentEma1PcValue=_,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=E,NaN;let O=c.prevEma2PcCount,D=c.prevEma2PcSum,F=c.prevEma2PcValue;O++,O<=a?(D+=_,O===a&&(F=D/a)):F=_*d+F*(1-d);let Y=c.prevEma2AbsCount,Q=c.prevEma2AbsSum,z=c.prevEma2AbsValue;if(Y++,Y<=a?(Q+=E,Y===a&&(z=Q/a)):z=E*y+z*(1-y),c.currentEma1PcCount=v,c.currentEma1PcSum=b,c.currentEma1PcValue=_,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=E,c.currentEma2PcCount=O,c.currentEma2PcSum=D,c.currentEma2PcValue=F,c.currentEma2AbsCount=Y,c.currentEma2AbsSum=Q,c.currentEma2AbsValue=z,isNaN(F)||isNaN(z))return NaN;if(z===0)return e.precision(0);const oe=F/z;return e.precision(oe)}}function vh(e){return(t,i,r,n)=>{e.taState||(e.taState={});const a=n||"valuewhen";e.taState[a]||(e.taState[a]={lastIdx:-1,prevValues:[],currentValues:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevValues=[...s.currentValues]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=m.from(i).get(0),u=m.from(r).get(0),h=[...s.prevValues];if(o&&h.push(c),s.currentValues=h,isNaN(u)||u<0)return NaN;const f=h.length-1-u;if(f<0)return NaN;const l=h[f];return typeof l=="number"?e.precision(l):l}}function wh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`variance_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length>n&&c.pop(),s.currentWindow=c,c.length<n)return NaN;let u=0,h=0;for(let d=0;d<n;d++)u+=c[d],h+=c[d]*c[d];const f=u/n,l=h/n-f*f;return e.precision(l)}}function bh(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={lastIdx:-1,prevCumulativePV:0,prevCumulativeVolume:0,prevLastSessionDate:null,currentCumulativePV:0,currentCumulativeVolume:0,currentLastSessionDate:null});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevCumulativePV=n.currentCumulativePV,n.prevCumulativeVolume=n.currentCumulativeVolume,n.prevLastSessionDate=n.currentLastSessionDate),n.lastIdx=e.idx);const a=m.from(t).get(0),s=m.from(e.data.volume).get(0),o=m.from(e.data.openTime).get(0),c=new Date(o).toISOString().slice(0,10);let u=n.prevCumulativePV,h=n.prevCumulativeVolume,f=n.prevLastSessionDate;if(f!==c&&(u=0,h=0,f=c),u+=a*s,h+=s,n.currentCumulativePV=u,n.currentCumulativeVolume=h,n.currentLastSessionDate=f,h===0)return NaN;const l=u/h;return e.precision(l)}}function Sh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`vwma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevVolumeWindow:[],currentWindow:[],currentVolumeWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevVolumeWindow=[...s.currentVolumeWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=e.get(e.data.volume,0),u=[...s.prevWindow],h=[...s.prevVolumeWindow];if(u.unshift(o),h.unshift(c),u.length>n&&(u.pop(),h.pop()),s.currentWindow=u,s.currentVolumeWindow=h,u.length<n)return NaN;let f=0,l=0;for(let g=0;g<n;g++)f+=u[g]*h[g],l+=h[g];const d=f/l;return e.precision(d)}}function Eh(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.high,0),s=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(n)||isNaN(a)||isNaN(s))return r.currentCumulativeSum=r.prevCumulativeSum,e.precision(r.prevCumulativeSum);let c=0;if(!isNaN(o)){const h=Math.max(a,o),f=Math.min(s,o),l=n-o;l>0?c=n-f:l<0&&(c=n-h)}const u=r.prevCumulativeSum+c;return r.currentCumulativeSum=u,e.precision(u)}}function _h(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`wma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=m.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;let u=0,h=0;for(let l=0;l<n;l++){const d=n-l;u+=c[l]*d,h+=d}const f=u/h;return e.precision(f)}}function Nh(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`wpr_${r}`;e.taState[n]||(e.taState[n]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const a=e.taState[n];e.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevHighWindow=[...a.currentHighWindow],a.prevLowWindow=[...a.currentLowWindow]),a.lastIdx=e.idx);const s=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(s)||isNaN(o)||isNaN(c))return a.currentHighWindow=[...a.prevHighWindow],a.currentLowWindow=[...a.prevLowWindow],NaN;const u=[...a.prevHighWindow],h=[...a.prevLowWindow];if(u.unshift(s),h.unshift(o),u.length>r&&(u.pop(),h.pop()),a.currentHighWindow=u,a.currentLowWindow=h,u.length<r)return NaN;let f=u[0],l=h[0];for(let y=1;y<r;y++)u[y]>f&&(f=u[y]),h[y]<l&&(l=h[y]);const d=f-l;if(d===0)return e.precision(0);const g=(f-c)/d*-100;return e.precision(g)}}function Ih(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),s=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(a)||isNaN(s))return NaN;const o=n-a;if(o===0)return e.precision(0);const c=(i-r)/o*s;return e.precision(c)}}var Ch=Object.defineProperty,kh=(e,t,i)=>t in e?Ch(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,k=(e,t,i)=>kh(e,typeof t!="symbol"?t+"":t,i);const Ah={accdist:mu,alma:xu,atr:gu,barssince:yu,bb:vu,bbw:wu,cci:bu,change:Su,cmo:Eu,cog:_u,correlation:Nu,cross:Iu,crossover:Cu,crossunder:ku,cum:Au,dev:Pu,dmi:Tu,ema:Ru,falling:Du,highest:Vu,highestbars:Lu,hma:Mu,iii:Ou,kc:Bu,kcw:Fu,linreg:Wu,lowest:ju,lowestbars:$u,macd:qu,median:Uu,mfi:Hu,mode:Ku,mom:Gu,nvi:zu,obv:Yu,param:Qu,percentile_linear_interpolation:Xu,percentile_nearest_rank:Zu,percentrank:Ju,pivothigh:th,pivotlow:rh,pvi:nh,pvt:sh,range:ah,rising:oh,rma:ch,roc:uh,rsi:hh,sar:lh,sma:ph,stdev:fh,stoch:dh,supertrend:mh,swma:xh,tr:gh,tsi:yh,valuewhen:vh,variance:wh,vwap:bh,vwma:Sh,wad:Eh,wma:_h,wpr:Nh,wvad:Ih};class Ph{constructor(t){this.context=t,k(this,"accdist"),k(this,"alma"),k(this,"atr"),k(this,"barssince"),k(this,"bb"),k(this,"bbw"),k(this,"cci"),k(this,"change"),k(this,"cmo"),k(this,"cog"),k(this,"correlation"),k(this,"cross"),k(this,"crossover"),k(this,"crossunder"),k(this,"cum"),k(this,"dev"),k(this,"dmi"),k(this,"ema"),k(this,"falling"),k(this,"highest"),k(this,"highestbars"),k(this,"hma"),k(this,"iii"),k(this,"kc"),k(this,"kcw"),k(this,"linreg"),k(this,"lowest"),k(this,"lowestbars"),k(this,"macd"),k(this,"median"),k(this,"mfi"),k(this,"mode"),k(this,"mom"),k(this,"nvi"),k(this,"obv"),k(this,"param"),k(this,"percentile_linear_interpolation"),k(this,"percentile_nearest_rank"),k(this,"percentrank"),k(this,"pivothigh"),k(this,"pivotlow"),k(this,"pvi"),k(this,"pvt"),k(this,"range"),k(this,"rising"),k(this,"rma"),k(this,"roc"),k(this,"rsi"),k(this,"sar"),k(this,"sma"),k(this,"stdev"),k(this,"stoch"),k(this,"supertrend"),k(this,"swma"),k(this,"tr"),k(this,"tsi"),k(this,"valuewhen"),k(this,"variance"),k(this,"vwap"),k(this,"vwma"),k(this,"wad"),k(this,"wma"),k(this,"wpr"),k(this,"wvad"),Object.entries(Ah).forEach(([i,r])=>{this[i]=r(t)})}}class Th{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}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 Rh{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,n=0){const a=String(t),s=String(i),o=String(r),c=Math.floor(Number(n))||0;if(s==="")return a;let u=0,h=0;for(;;){const f=a.indexOf(s,u);if(f===-1)return a;if(h===c)return a.substring(0,f)+o+a.substring(f+s.length);h++,u=f+s.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,n)=>i[n])}}class Dh{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<3600*24?Math.ceil(t/60):t<=3600*24*7*52?t%(3600*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(3600*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 kr=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Vh=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Lh=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Mh=["open","high","low","close","title","color","editable","show_last","display","format","precision","force_overlay"],Oh=["open","high","low","close","title","color","wickcolor","editable","show_last","bordercolor","display","format","precision","force_overlay"],Ar=["color","offset","editable","show_last","title","display","force_overlay"],Bh=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],Pr={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"},Fh={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"},Wh={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"},jh={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},$h={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",wickcolor:"string",bordercolor:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Tr={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},qh={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class Uh{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}get linestyle_dashed(){return"linestyle_dashed"}get linestyle_dotted(){return"linestyle_dotted"}get linestyle_solid(){return"linestyle_solid"}get style_area(){return"style_area"}get style_areabr(){return"style_areabr"}get style_circles(){return"style_circles"}get style_columns(){return"style_columns"}get style_cross(){return"style_cross"}get style_histogram(){return"style_histogram"}get style_line(){return"style_line"}get style_linebr(){return"style_linebr"}get style_stepline(){return"style_stepline"}get style_stepline_diamond(){return"style_stepline_diamond"}get style_steplinebr(){return"style_steplinebr"}param(t,i=0,r){return m.from(t).get(i)}plotchar(...t){const i=Ce(t,kr,Pr),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);this.context.plots[n]||(this.context.plots[n]={data:[],options:{...s,style:"char"},title:n});const o=m.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o}),this.context.plots[n]}any(...t){const i=Ce(t,kr,Pr),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=s.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...s,overlay:c},title:n}}const o=m.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:s.color,offset:s.offset}}),this.context.plots[n]}plotshape(...t){const i=Ce(t,Vh,Fh),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=s.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...s,style:"shape",shape:s.style,overlay:c},title:n}}const o=m.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o,options:s?.location==="absolute"||o?{text:s.text,textcolor:s.textcolor,color:s.color,offset:s.offset,shape:s.style,location:s.location,size:s.size}:void 0}),this.context.plots[n]}plotarrow(...t){const i=Ce(t,Lh,Wh),{series:r,title:n,...a}=i,s=m.from(r).get(0),o=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...o,style:"shape",overlay:c},title:n}}return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:s,options:typeof s=="number"&&!isNaN(s)&&s!==0?{text:void 0,textcolor:void 0,color:s>0?o.colorup:o.colordown,offset:o.offset,shape:s>0?"arrowup":"arrowdown",location:s>0?"belowbar":"abovebar",height:o.maxheight}:void 0}),this.context.plots[n]}plotbar(...t){const i=Ce(t,Mh,jh),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const f=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"bar",overlay:f},title:o}}const h=[m.from(r).get(0),m.from(n).get(0),m.from(a).get(0),m.from(s).get(0)];this.context.plots[o].data.push({title:o,time:this.context.marketData[this.context.idx].openTime,value:h,options:{color:u.color}})}plotcandle(...t){const i=Ce(t,Oh,$h),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const f=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"candle",overlay:f},title:o}}const h=[m.from(r).get(0),m.from(n).get(0),m.from(a).get(0),m.from(s).get(0)];return this.context.plots[o].data.push({title:o,time:this.context.marketData[this.context.idx].openTime,value:h,options:{color:u.color,wickcolor:u.wickcolor,bordercolor:u.bordercolor}}),this.context.plots[o]}bgcolor(...t){const i=Ce(t,Ar,Tr),{title:r,...n}=i,a=this.extractPlotOptions(n);if(!this.context.plots[r]){const s=a.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[r]={data:[],options:{...a,style:"background",overlay:s},title:r}}this.context.plots[r].data.push({title:r,time:this.context.marketData[this.context.idx].openTime,value:a.color&&a.color!=="na"&&a?.color.toString()!=="NaN",options:{color:a.color}})}barcolor(...t){const i=Ce(t,Ar,Tr),{title:r,...n}=i,a=this.extractPlotOptions(n);return this.context.plots[r]||(this.context.plots[r]={data:[],options:{...a,style:"barcolor"},title:r}),this.context.plots[r].data.push({title:r,time:this.context.marketData[this.context.idx].openTime,value:a.color&&a.color!=="na"&&a?.color.toString()!=="NaN",options:{color:a.color}}),this.context.plots[r]}}class Hh{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,n,a,s,o){return this.context.pine.plot.any(t,{title:i,color:r,linestyle:n,linewidth:a,editable:s,display:o})}}class Kh{constructor(t){this.context=t}param(t,i=0,r){return m.from(t).get(i)}any(...t){const i=Ce(t,Bh,qh),{plot1:r,plot2:n,color:a,title:s,editable:o,show_last:c,fillgaps:u,display:h}=i;this.context.plots[s]||(this.context.plots[s]={title:s,plot1:r.title,plot2:n.title,options:{color:a,editable:o,show_last:c,fillgaps:u,display:h,style:"fill"}})}}var Gh=Object.defineProperty,zh=(e,t,i)=>t in e?Gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>zh(e,typeof t!="symbol"?t+"":t,i);const Rr=class ni{constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:a,sDate:s,eDate:o,fullContext:c,inputs:u}){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,"lctx",new Map),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"),j(this,"inputs",{}),j(this,"_callStack",[]),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=n,this.limit=a,this.sDate=s,this.eDate=o,this.fullContext=c||this,this.inputs=u||{};const h=new sc(this),f={Type:h.Type.bind(h),na:h.na.bind(h),color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),bool:h.bool.bind(h)},l=this;this.pine={input:new Ic(this),ta:new Ph(this),math:new ou(this),request:new du(this),array:new Aa(this),map:new Ua(this),matrix:new Go(this),syminfo:null,timeframe:new Dh(this),barstate:new Xo(this),get bar_index(){return l.idx},get last_bar_index(){return l.data.close.length-1},get last_bar_time(){return l.data.openTime.get(l.data.openTime.length-1)},get timenow(){return new Date().getTime()},get inputs(){return l.inputs},log:new Th(this),str:new Rh(this),...f,...pa};const d=new Uh(this),g=new Hh(this),y=new Kh(this);this.bindContextObject(d,["plotchar","plotshape","plotarrow","plotbar","plotcandle","bgcolor","barcolor"]),this.bindContextObject(d,["any","param","linestyle_dashed","linestyle_dotted","linestyle_solid","style_area","style_areabr","style_circles","style_columns","style_cross","style_histogram","style_line","style_linebr","style_stepline","style_stepline_diamond","style_steplinebr"],"plot"),this.bindContextObject(g,["any","style_dashed","style_solid","style_dotted","param"],"hline"),this.bindContextObject(y,["any","param"],"fill")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const n=r?this.pine[r]:this.pine;for(const a of i)typeof t[a]=="function"?n[a]=t[a].bind(t):n[a]=t[a]}init(t,i,r=0){let n;return i instanceof m?n=i.get(0):Array.isArray(i)?Array.isArray(i[0])?n=i[0]:n=i[i.length-1+r]:n=i,t?t instanceof m?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new m(t)):new m([n]):new m([n])}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}}pushId(t){this._callStack.push(t)}popId(){this._callStack.pop()}peekId(){return this._callStack.length>0?this._callStack[this._callStack.length-1]:""}peekCtx(){const t=this.peekId();if(!t)return this;let i=this.lctx.get(t);return i||(i={id:t,let:{},const:{},var:{}},this.lctx.set(t,i)),i}call(t,i,...r){this.pushId(i);try{return t(...r)}finally{this.popId()}}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,fill:this.pine.fill,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}`;ni._deprecationWarningsShown.has(r)||(ni._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(Rr,"_deprecationWarningsShown",new Set);let Jt=Rr;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,Dr=(e,t,i)=>Qh(e,typeof t!="symbol"?t+"":t,i);class ei{constructor(t,i={}){Dr(this,"source"),Dr(this,"inputs"),this.source=t,this.inputs=i}}var Xh=Object.defineProperty,Zh=(e,t,i)=>t in e?Xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,J=(e,t,i)=>Zh(e,typeof t!="symbol"?t+"":t,i);class ti{constructor(t,i,r,n,a,s){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=n,this.sDate=a,this.eDate=s,J(this,"data",[]),J(this,"open",[]),J(this,"high",[]),J(this,"low",[]),J(this,"close",[]),J(this,"volume",[]),J(this,"hl2",[]),J(this,"hlc3",[]),J(this,"ohlc4",[]),J(this,"hlcc4",[]),J(this,"openTime",[]),J(this,"closeTime",[]),J(this,"_readyPromise",null),J(this,"_ready",!1),J(this,"_debugSettings",{ln:!1,debug:!1}),J(this,"_transpiledCode",null),J(this,"_isSecondaryContext",!1),J(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,n,a,s).then(c=>{const u=c;this.data=u;const h=u.map(E=>E.open),f=u.map(E=>E.close),l=u.map(E=>E.high),d=u.map(E=>E.low),g=u.map(E=>E.volume),y=u.map(E=>(E.high+E.low+E.close)/3),v=u.map(E=>(E.high+E.low)/2),b=u.map(E=>(E.high+E.low+E.open+E.close)/4),_=u.map(E=>(E.high+E.low+E.close+E.close)/4),N=u.map(E=>E.openTime),I=u.map(E=>E.closeTime);this.open=h,this.close=f,this.high=l,this.low=d,this.volume=g,this.hl2=v,this.hlc3=y,this.ohlc4=b,this.hlcc4=_,this.openTime=N,this.closeTime=I,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(E=>{this._syminfo=E,this._ready=!0,o(!0)}).catch(E=>{console.warn("Failed to get symbol info, using default values:",E),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,n,a,s){return Array.isArray(t)?t:t.getMarketData(i,r,n,a,s)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){let n,a={};if(t instanceof ei?(n=t.source,a=t.inputs||{}):n=t,r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(n,a,i,r,s)}else return this._runComplete(n,a,i)}stream(t,i={}){const{live:r=!0,interval:n=1e3}=i,a=i.pageSize||this.data.length;let s,o={};t instanceof ei?(s=t.source,o=t.inputs||{}):s=t;const c={data:[],error:[]};let u=!1;const h=(d,...g)=>{c[d]&&c[d].forEach(y=>y(...g))},f=(d,g)=>{c[d]||(c[d]=[]),c[d].push(g)},l=()=>{u=!0};return(async()=>{try{const d=typeof this.eDate>"u"&&!Array.isArray(this.source)&&r,g=this._runPaginated(s,o,void 0,a,d);for await(const y of g){if(u)break;if(y===null){await new Promise(v=>setTimeout(v,n));continue}if(h("data",y),d&&!u){const v=y.marketData[y.idx];v&&v.closeTime<Date.now()||await new Promise(b=>setTimeout(b,n))}}}catch(d){h("error",d)}})(),{on:f,stop:l}}async _runComplete(t,i,r){await this.ready(),r||(r=this.data.length);const n=this._initializeContext(t,i,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(n,this._transpiledCode,this.data.length-r,this.data.length),n}async*_runPaginated(t,i,r,n,a=!1){await this.ready(),r||(r=this.data.length);const s=this._initializeContext(t,i,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let o=this.data.length-r;for(;;){const c=this.data.length-o;if(c>0){const f=Math.min(c,n),l=this._getResultLength(s.result);await this._executeIterations(s,this._transpiledCode,o,o+f),o+=f,yield this._createPageContext(s,l);continue}if(!a||Array.isArray(this.source))break;const{newCandles:u,updatedLastCandle:h}=await this._updateMarketData();if(u===0&&!h){yield null;continue}this._removeLastResult(s),o=this.data.length-(u+1),s.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 Jt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t,inputs:t.inputs});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 n in t.result)Array.isArray(t.result[n])?r.result[n]=t.result[n].slice(i):r.result[n]=t.result[n]}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,n=this.data[r].openTime;try{const a=await i.getMarketData(this.tickerId,this.timeframe,void 0,n,t);if(!a||a.length===0)return{newCandles:0,updatedLastCandle:!1};let s=!1,o=0;for(let c=0;c<a.length;c++){const u=a[c];u.openTime===n?(this._replaceCandle(r,u),s=!0):u.openTime>n&&(this._appendCandle(u),o++)}return{newCandles:o,updatedLastCandle:s}}catch(a){return console.error("Error updating market data:",a),{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 n in t.result)Array.isArray(t.result[n])&&t.result[n].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();const i=["const","var","let","params"],r=n=>{for(let a of i)if(n[a])for(let s in n[a]){const o=n[a][s];o instanceof m?o.data.pop():Array.isArray(o)&&o.pop()}};r(t),t.lctx&&t.lctx.forEach(n=>r(n))}_initializeContext(t,i={},r=!1){const n=new Jt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,inputs:i});return n.pine.syminfo=this._syminfo,n.pineTSCode=t,n.isSecondaryContext=r,n.data.close=new m([]),n.data.open=new m([]),n.data.high=new m([]),n.data.low=new m([]),n.data.volume=new m([]),n.data.hl2=new m([]),n.data.hlc3=new m([]),n.data.ohlc4=new m([]),n.data.hlcc4=new m([]),n.data.openTime=new m([]),n.data.closeTime=new m([]),n}_transpileCode(t){return Cs.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,n){const a=["const","var","let","params"];for(let s=r;s<n;s++){t.idx=s,t.data.close.data.push(this.close[s]),t.data.open.data.push(this.open[s]),t.data.high.data.push(this.high[s]),t.data.low.data.push(this.low[s]),t.data.volume.data.push(this.volume[s]),t.data.hl2.data.push(this.hl2[s]),t.data.hlc3.data.push(this.hlc3[s]),t.data.ohlc4.data.push(this.ohlc4[s]),t.data.hlcc4.data.push(this.hlcc4[s]),t.data.openTime.data.push(this.openTime[s]),t.data.closeTime.data.push(this.closeTime[s]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let u in o){t.result[u]===void 0&&(t.result[u]=[]);let h;o[u]instanceof m?h=o[u].get(0):Array.isArray(o[u])?h=o[u][o[u].length-1]:h=o[u],t.result[u].push(h)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);const c=u=>{for(let h of a)if(u[h])for(let f in u[h]){const l=u[h][f];if(l instanceof m){const d=l.get(0);l.data.push(d)}else if(Array.isArray(l)){const d=l[l.length-1];l.push(d)}}};c(t),t.lctx&&t.lctx.forEach(u=>c(u))}}}var Jh=Object.defineProperty,el=(e,t,i)=>t in e?Jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ct=(e,t,i)=>el(e,typeof t!="symbol"?t+"":t,i);const ii="https://api.binance.com/api/v3",Vr="https://api.binance.us/api/v3",ri={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 tl{constructor(t=300*1e3){Ct(this,"cache"),Ct(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 il{constructor(){Ct(this,"cacheManager"),Ct(this,"activeApiUrl",null),this.cacheManager=new tl(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${ii}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ii,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Vr}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Vr,this.activeApiUrl}catch{}return ii}async getMarketDataInterval(t,i,r,n){try{const a=ri[i.toUpperCase()];if(!a)return console.error(`Unsupported timeframe: ${i}`),[];const s={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3};let o=[],c=r;const u=n,h=s[a];if(!h)return console.error(`Duration not defined for interval: ${a}`),[];for(;c<u;){const f=Math.min(c+1e3*h,u),l=await this.getMarketData(t,i,1e3,c,f);if(l.length===0)break;o=o.concat(l),c=l[l.length-1].closeTime+1}return o}catch(a){return console.error("Error in getMarketDataInterval:",a),[]}}async getMarketDataBackwards(t,i,r,n){let a=r,s=[],o=n,c=0;const u=Math.ceil(r/1e3)+5;for(;a>0&&c<u;){c++;const h=Math.min(a,1e3),f=await this.getMarketData(t,i,h,void 0,o);if(f.length===0||(s=f.concat(s),a-=f.length,o=f[0].openTime-1,f.length<h))break}return s}async getMarketData(t,i,r,n,a){try{const s=a!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:n,eDate:a};if(s){const l=this.cacheManager.get(o);if(l)return l}const c=ri[i.toUpperCase()];if(!c)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,n,a)){if(n&&a){const l=await this.getMarketDataInterval(t,i,n,a),d=r?l.slice(0,r):l;return this.cacheManager.set(o,d),d}else if(r&&r>1e3){const l=await this.getMarketDataBackwards(t,i,r,a);return this.cacheManager.set(o,l),l}}let u=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${c}`;r&&(u+=`&limit=${Math.min(r,1e3)}`),n&&(u+=`&startTime=${n}`),a&&(u+=`&endTime=${a}`);const h=await fetch(u);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const f=(await h.json()).map(l=>({openTime:parseInt(l[0]),open:parseFloat(l[1]),high:parseFloat(l[2]),low:parseFloat(l[3]),close:parseFloat(l[4]),volume:parseFloat(l[5]),closeTime:parseInt(l[6]),quoteAssetVolume:parseFloat(l[7]),numberOfTrades:parseInt(l[8]),takerBuyBaseAssetVolume:parseFloat(l[9]),takerBuyQuoteAssetVolume:parseFloat(l[10]),ignore:l[11]}));return s&&this.cacheManager.set(o,f),f}catch(s){return console.error("Error in binance.klines:",s),[]}}shouldPaginate(t,i,r,n){if(i&&i>1e3)return!0;if(r&&n){const a=ri[t.toUpperCase()],s={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3}[a];if(s)return Math.ceil((n-r)/s)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),n=t,a="";t.endsWith(".P")?(i="futures",n=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",a="Perpetual"):t.includes("_")&&(i="futures",n=t,r="https://dapi.binance.com/dapi/v1",a="Delivery");const s=i==="crypto"?`${r}/exchangeInfo?symbol=${n}`:`${r}/exchangeInfo`,o=await fetch(s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const c=(await o.json()).symbols;if(!c||c.length===0)return console.error(`Symbol ${t} not found`),null;const u=i==="futures"?c.find(N=>N.symbol===n):c[0];if(!u)return console.error(`Symbol ${n} not found in exchange info`),null;const h=u.filters?.find(N=>N.filterType==="PRICE_FILTER"),f=u.filters?.find(N=>N.filterType==="LOT_SIZE"),l=h?parseFloat(h.tickSize):.01,d=f?parseFloat(f.minQty):0,g=Math.round(1/l),y=u.baseAsset,v=u.quoteAsset,b=a?` ${a}`:"",_=`${y} / ${v}${b}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:_,type:i,main_tickerid:`BINANCE:${t}`,current_contract:a,isin:"",basecurrency:y,currency:v,timezone:"Etc/UTC",country:"",mintick:l,pricescale:g,minmove:1,pointvalue:u.contractSize||1,mincontract:d,session:"24x7",volumetype:"base",expiration_date:u.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 rl{async getMarketData(){return[]}}const nl=typeof process<"u"&&process.versions&&process.versions.node;let kt=null;if(nl)try{kt=new rl}catch{kt=null}const sl={Binance:new il,...kt?{Mock:kt}:{}};Re.Context=Jt,Re.Indicator=ei,Re.PineTS=ti,Re.Provider=sl,Object.defineProperty(Re,"__esModule",{value:!0})}));
124
+ ; return _r;`)(this)}function ks(e){return t=>new q(t.array.map(i=>Math.abs(i)),t.type,e)}function As(e){return t=>{let i=0,r=0;for(const n of t.array){const a=Number(n);isNaN(a)||(r++,i+=(a-i)/r)}return r===0?NaN:e.precision(i)}}function Ps(e){return(t,i)=>{const r=t.array;let n=0,a=r.length-1;for(;n<=a;){const s=Math.floor((n+a)/2),o=r[s];if(o===i)return s;o<i?n=s+1:a=s-1}return-1}}function Ts(e){return(t,i)=>{const r=t.array;let n=0,a=r.length;for(;n<a;){const s=Math.floor((n+a)/2);r[s]<i?n=s+1:a=s}return n<r.length&&r[n]===i?n:n-1}}function Rs(e){return(t,i)=>{const r=t.array;let n=0,a=r.length;for(;n<a;){const s=Math.floor((n+a)/2);r[s]<=i?n=s+1:a=s}return n>0&&r[n-1]===i?n-1:n}}function Ds(e){return t=>{t.array.length=0}}function Vs(e){return(t,i)=>(t.array.push(...i.array),t)}function Ls(e){return t=>new q([...t.array],t.type,e)}function Os(e){return(t,i,r=!0)=>{const n=t.array,a=i.array;if(n.length!==a.length)return NaN;let s=0,o=0,c=0;const u=[];for(let g=0;g<n.length;g++){const y=Number(n[g]),v=Number(a[g]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(v)&&v!==null&&v!==void 0&&(s+=y,o+=v,c++,u.push(g))}if(c===0)return NaN;const h=s/c,f=o/c;let l=0;for(const g of u){const y=Number(n[g]),v=Number(a[g]);l+=(y-h)*(v-f)}const d=r?c:c-1;return d<=0?NaN:e.precision(l/d)}}function Ms(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function Bs(e){return e.every(t=>typeof t=="number")?e.every(t=>(t|0)===t)?K.int:K.float:e.every(t=>typeof t=="string")?K.string:e.every(t=>typeof t=="boolean")?K.bool:K.any}function Ne(e){if(typeof e=="number")return(e|0)===e?K.int:K.float;if(typeof e=="string")return K.string;if(typeof e=="boolean")return K.bool;throw new Error("Cannot infer type from value")}function ft(e,t){switch(t){case K.int:return typeof e=="number"&&((e|0)===e||isNaN(e));case K.float:return typeof e=="number";case K.string:return typeof e=="string";case K.bool:return typeof e=="boolean"}return!1}function Fs(e){return(t,i,r=0,n)=>{const a=t.array.length,s=n!==void 0?Math.min(n,a):a;for(let o=r;o<s;o++){if(!ft(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 Ws(e){return t=>t.array.length>0?t.array[0]:e.NA}function js(e){return(t,i)=>t.array[i]}function $s(e){return(t,i)=>t.array.includes(i)}function qs(e){return(t,i)=>t.array.indexOf(i)}function Us(e){return(t,i,r)=>{if(!ft(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 Hs(e){return(t,i=",")=>t.array.join(i)}function Ks(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Gs(e){return(t,i)=>t.array.lastIndexOf(i)}function zs(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function Ys(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Qs(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function Xs(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const a of t.array){const s=(i.get(a)||0)+1;i.set(a,s),s>r&&(r=s)}const n=[];for(const[a,s]of i)s===r&&n.push(a);return n.sort((a,s)=>typeof a=="number"&&typeof s=="number"?a-s:typeof a=="string"&&typeof s=="string"?a<s?-1:a>s?1:0:0),n[0]}}function Zs(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const c of r){const u=Number(c);if(isNaN(u)||u===null||u===void 0)return NaN;n.push(u)}n.sort((c,u)=>c-u),i<0&&(i=0),i>100&&(i=100);const a=i/100*n.length-.5;if(a<=0)return e.precision(n[0]);if(a>=n.length-1)return e.precision(n[n.length-1]);const s=Math.floor(a),o=a-s;return e.precision(n[s]*(1-o)+n[s+1]*o)}}function Js(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const o of r){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&n.push(c)}if(n.length===0)return NaN;n.sort((o,c)=>o-c),i<0&&(i=0),i>100&&(i=100);const a=r.length,s=Math.ceil(i/100*a);return s<=0?n[0]:s>n.length?NaN:n[s-1]}}function ea(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 n=Number(t.array[r]);if(isNaN(n)||n===null||n===void 0)return NaN;let a=0;for(const o of t.array){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&c<n&&a++}const s=t.array.length-1;return s<=0?NaN:a/s*100}}function ta(e){return t=>t.array.pop()}function ia(e){return(t,i)=>{if(!ft(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 ra(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function na(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function sa(e){return t=>{t.array.reverse()}}function aa(e){return(t,i,r)=>{if(!ft(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 oa(e){return t=>t.array.shift()}function ca(e){return t=>t.array.length}function ua(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new q(t.array.slice(i,n),t.type,e)}}function ha(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var rt=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(rt||{}),xr=(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))(xr||{}),gr=(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))(gr||{}),yr=(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))(yr||{}),vr=(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))(vr||{}),wr=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))(wr||{}),br=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(br||{}),Sr=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(Sr||{}),la=(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))(la||{}),Er=(e=>(e.gaps_on="gaps_on",e.gaps_off="gaps_off",e.lookahead_on="lookahead_on",e.lookahead_off="lookahead_off",e))(Er||{});const pa={order:rt,currency:xr,dayofweek:gr,display:yr,shape:vr,location:wr,size:br,format:Sr,barmerge:Er};function fa(e){return(t,i=rt.ascending)=>{t.array.sort((r,n)=>{let a=isNaN(r)?1/0:r,s=isNaN(n)?1/0:n;return i===rt.ascending?a-s:s-a})}}function da(e){return(t,i=rt.ascending)=>{const r=t.array.map((n,a)=>a);return r.sort((n,a)=>{const s=isNaN(t.array[n])?1/0:t.array[n],o=isNaN(t.array[a])?1/0:t.array[a];return i===rt.ascending?s-o:o-s}),new q(r,K.int,e)}}function ma(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new q(t.array.map(()=>NaN),K.int,e):r===0?new q(t.array.map(()=>1),K.int,e):new q(t.array.map(n=>(n-i)/r),K.int,e)}}function xa(e){return(t,i=!0)=>{const r=t.array,n=r.length;if(n===0)return NaN;let a=0,s=0,o=0;for(let h=0;h<n;h++){const f=Number(r[h]);!isNaN(f)&&f!==null&&f!==void 0&&(a+=f,s+=f*f,o++)}if(o===0)return NaN;const c=a/o;let u=s/o-c*c;return u<0?NaN:(!i&&o>1&&(u=u*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(u)))}}function ga(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function ya(e){return(t,i)=>{if(!ft(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 va(e){return(t,i=!0)=>{let r=0,n=0;for(const c of t.array){const u=Number(c);!isNaN(u)&&u!==null&&u!==void 0&&(r+=u,n++)}if(n===0)return NaN;const a=r/n;let s=0;for(const c of t.array){const u=Number(c);!isNaN(u)&&u!==null&&u!==void 0&&(s+=(u-a)*(u-a))}const o=i?n:n-1;return o<=0?NaN:e.precision(s/o)}}var wa=Object.defineProperty,ba=(e,t,i)=>t in e?wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>ba(e,typeof t!="symbol"?t+"":t,i),K=(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))(K||{});class q{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=ks(this.context),this._avg=As(this.context),this._binary_search=Ps(this.context),this._binary_search_leftmost=Ts(this.context),this._binary_search_rightmost=Rs(this.context),this._clear=Ds(this.context),this._concat=Vs(this.context),this._copy=Ls(this.context),this._covariance=Os(this.context),this._every=Ms(this.context),this._fill=Fs(this.context),this._first=Ws(this.context),this._get=js(this.context),this._includes=$s(this.context),this._indexof=qs(this.context),this._insert=Us(this.context),this._join=Hs(this.context),this._last=Ks(this.context),this._lastindexof=Gs(this.context),this._max=zs(this.context),this._median=Ys(this.context),this._min=Qs(this.context),this._mode=Xs(this.context),this._percentile_linear_interpolation=Zs(this.context),this._percentile_nearest_rank=Js(this.context),this._percentrank=ea(this.context),this._pop=ta(this.context),this._push=ia(this.context),this._range=ra(this.context),this._remove=na(this.context),this._reverse=sa(this.context),this._set=aa(this.context),this._shift=oa(this.context),this._size=ca(this.context),this._slice=ua(this.context),this._some=ha(this.context),this._sort=fa(this.context),this._sort_indices=da(this.context),this._standardize=ma(this.context),this._stdev=xa(this.context),this._sum=ga(this.context),this._unshift=ya(this.context),this._variance=va(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 q([...t],Bs(t),e)}function Ea(e){return(t,i)=>new q(Array(t).fill(e.precision(i||0)),Ne(i||0),e)}function _a(e){return(t,i=!1)=>new q(Array(t).fill(i),K.bool,e)}function Na(e){return(t,i=NaN)=>new q(Array(t).fill(e.precision(i)),K.float,e)}function Ia(e){return(t,i=0)=>new q(Array(t).fill(e.precision(i)),K.int,e)}function Ca(e){return(t,i="")=>new q(Array(t).fill(i),K.string,e)}class x{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 x?t:Array.isArray(t)?new x(t):new x([t])}}function ka(e){return(t,i=0)=>x.from(t).get(i)}class Aa{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=Ea(t),this.new_bool=_a(t),this.new_float=Na(t),this.new_int=Ia(t),this.new_string=Ca(t),this.param=ka(),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 Ta(e){return(t,i)=>t.map.has(i)}function Ra(e){return t=>{const i=new _r(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 Va(e){return t=>{const i=Array.from(t.map.keys()),r=Ne(i[0]);return new q(i,r,e)}}function La(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function Oa(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function Ma(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 Fa(e){return t=>{const i=Array.from(t.map.values()),r=Ne(i[0]);return new q(i,r,e)}}var Wa=Object.defineProperty,ja=(e,t,i)=>t in e?Wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ie=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);class _r{constructor(t){this.context=t,Ie(this,"map"),Ie(this,"_clear"),Ie(this,"_contains"),Ie(this,"_copy"),Ie(this,"_get"),Ie(this,"_keys"),Ie(this,"_put"),Ie(this,"_put_all"),Ie(this,"_remove"),Ie(this,"_size"),Ie(this,"_values"),this.map=new Map,this._clear=Pa(this.context),this._contains=Ta(this.context),this._copy=Ra(this.context),this._get=Da(this.context),this._keys=Va(this.context),this._put=La(this.context),this._put_all=Oa(this.context),this._remove=Ma(this.context),this._size=Ba(this.context),this._values=Fa(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 $a(e){return()=>new _r(e)}function qa(e){return(t,i=0)=>x.from(t).get(i)}class Ua{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=$a(t),this.param=qa(),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 Ha(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r&&(r instanceof q?a=r.array:Array.isArray(r)?a=r:a=[r]),n===0){for(let c=0;c<a.length;c++){let u=a[c];u instanceof x&&(u=u.get(0)),t.matrix.push([u])}return}const s=t.matrix[0].length,o=i!==void 0?i:s;for(let c=0;c<n;c++){let u=c<a.length?a[c]:NaN;u instanceof x&&(u=u.get(0)),t.matrix[c].splice(o,0,u)}}}function Ka(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r)if(r instanceof q)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof x){const u=r.get(0);Array.isArray(u)?a=u:a=[u]}else a=[r];const s=n>0?t.matrix[0].length:a.length,o=i!==void 0?i:n,c=[];for(let u=0;u<s;u++)if(u<a.length){let h=a[u];h instanceof x&&(h=h.get(0)),c.push(h)}else c.push(NaN);t.matrix.splice(o,0,c)}}function Ga(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 n=0,a=0;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(n+=c,a++)}return a===0?NaN:n/a}}function za(e){return(t,i)=>{const r=t.matrix.length,n=[];for(let s=0;s<r;s++)n.push(t.matrix[s][i]);const a=Ne(n[0]);return new q(n,a,e)}}function Ya(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Qa(e){return(t,i)=>{const r=t.matrix.length,n=i.matrix.length;if(r===0){for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]]);return}const a=t.matrix[0].length,s=n>0?i.matrix[0].length:0;if(a!==s&&n>0){console.error(`matrix.concat: Column count mismatch ${a} vs ${s}`);return}for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]])}}function Xa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new W(i,r,NaN,e);return n.matrix=t.matrix.map(a=>[...a]),n}}function Za(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(n=>[...n]);let r=1;for(let n=0;n<t;n++){let a=n;for(;a<t&&i[a][n]===0;)a++;if(a===t)return 0;a!==n&&([i[n],i[a]]=[i[a],i[n]],r*=-1),r*=i[n][n];for(let s=n+1;s<t;s++){const o=i[s][n]/i[n][n];for(let c=n;c<t;c++)i[s][c]-=o*i[n][c]}}return r}function Ja(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Za(t.matrix)}}function eo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new W(0,0,NaN,e);const n=t.matrix[0].length,a=new W(r,n,NaN,e);if(i instanceof W)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const c=t.matrix[s][o],u=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=c-u}else{const s=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]-s}return a}}function to(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],n=e[1][0],a=e[1][1],s=i+a,o=i*a-r*n,c=s*s-4*o;if(c<0)return[NaN,NaN];const u=(s+Math.sqrt(c))/2,h=(s-Math.sqrt(c))/2;return[u,h]}function io(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const s=Ne(t.matrix[0][0]);return new q([],s,e)}const n=to(t.matrix),a=Ne(n[0]);return new q(n,a,e)}}function ro(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new W(0,0,NaN,e);const n=new W(i,r,0,e);for(let a=0;a<i;a++)n.matrix[a][a]=1;return n}}function no(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function so(e){return(t,i,r,n,a,s)=>{const o=t.matrix.length;if(o===0)return;const c=t.matrix[0].length,u=r!==void 0?r:0,h=n!==void 0?n:o,f=a!==void 0?a:0,l=s!==void 0?s:c;for(let d=u;d<h&&!(d>=o);d++)for(let g=f;g<l&&!(g>=c);g++)t.matrix[d][g]=i}}function ao(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function oo(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 co(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new W(i,r,NaN,e);const n=oo(t.matrix),a=new W(i,r,NaN,e);return a.matrix=n,a}}function uo(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n+a!==i-1&&t.matrix[n][a]!==0)return!1;return!0}}function ho(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(t.matrix[a][n]!==-t.matrix[n][a])return!1;return!0}}function lo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let a=0;a<r;a++){const s=t.matrix[n][a];if(s!==0&&s!==1)return!1}return!0}}function po(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n!==a&&t.matrix[n][a]!==0)return!1;return!0}}function fo(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 n=0;n<i;n++)for(let a=0;a<r;a++)if(n===a){if(t.matrix[n][a]!==1)return!1}else if(t.matrix[n][a]!==0)return!1;return!0}}function mo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function xo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++){let a=0;for(let s=0;s<r;s++){const o=t.matrix[n][s];if(o<0)return!1;a+=o}if(Math.abs(a-1)>1e-10)return!1}return!0}}function go(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 n=0;n<i;n++)for(let a=0;a<n;a++)if(t.matrix[n][a]!==t.matrix[a][n])return!1;return!0}}function yo(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 n=!0,a=!0;for(let s=0;s<i;s++)for(let o=0;o<r;o++)s>o&&t.matrix[s][o]!==0&&(n=!1),s<o&&t.matrix[s][o]!==0&&(a=!1);return n||a}}function vo(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let a=0;a<r;a++)if(t.matrix[n][a]!==0)return!1;return!0}}function wo(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0,a=i.matrix.length,s=a>0?i.matrix[0].length:0,o=r*a,c=n*s,u=new W(o,c,NaN,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){const l=t.matrix[h][f];for(let d=0;d<a;d++)for(let g=0;g<s;g++){const y=i.matrix[d][g];u.matrix[h*a+d][f*s+g]=l*y}}return u}}function bo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=-1/0,a=!1;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(c>n&&(n=c),a=!0)}return a?n:NaN}}function So(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=[];for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||n.push(c)}if(n.length===0)return NaN;n.sort((s,o)=>s-o);const a=Math.floor(n.length/2);return n.length%2!==0?n[a]:(n[a-1]+n[a])/2}}function Eo(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=1/0,a=!1;for(let s=0;s<i;s++)for(let o=0;o<r;o++){const c=t.matrix[s][o];isNaN(c)||(c<n&&(n=c),a=!0)}return a?n:NaN}}function _o(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=new Map;let a=0,s=NaN;for(let o=0;o<i;o++)for(let c=0;c<r;c++){const u=t.matrix[o][c];if(!isNaN(u)){const h=(n.get(u)||0)+1;n.set(u,h),h>a?(a=h,s=u):h===a&&u<s&&(s=u)}}return s}}function No(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof W){const a=i.matrix.length,s=a>0?i.matrix[0].length:0;if(n!==a)return new W(0,0,NaN,e);const o=new W(r,s,0,e);for(let c=0;c<r;c++)for(let u=0;u<s;u++){let h=0;for(let f=0;f<n;f++)h+=t.matrix[c][f]*i.matrix[f][u];o.matrix[c][u]=h}return o}else if(i instanceof q||Array.isArray(i.array||i)){const a=i.array||i;if(n!==a.length)return new W(0,0,NaN,e);const s=new W(r,1,0,e);for(let o=0;o<r;o++){let c=0;for(let u=0;u<n;u++)c+=t.matrix[o][u]*a[u];s.matrix[o][0]=c}return s}else{const a=i,s=new W(r,n,NaN,e);for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]*a;return s}}}function Io(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new W(i,r,NaN,e):new W(r,i,NaN,e)}}function Co(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new W(0,0,NaN,e);let a=new W(r,n,0,e);for(let c=0;c<r;c++)a.matrix[c][c]=1;let s=new W(r,n,NaN,e);for(let c=0;c<r;c++)s.matrix[c]=[...t.matrix[c]];let o=Math.floor(i);if(o<0)return new W(r,n,NaN,e);for(;o>0;){if(o%2===1){const u=new W(r,n,0,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){let l=0;for(let d=0;d<r;d++)l+=a.matrix[h][d]*s.matrix[d][f];u.matrix[h][f]=l}a=u}const c=new W(r,n,0,e);for(let u=0;u<r;u++)for(let h=0;h<n;h++){let f=0;for(let l=0;l<r;l++)f+=s.matrix[u][l]*s.matrix[l][h];c.matrix[u][h]=f}s=c,o=Math.floor(o/2)}return a}}function ko(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=t.matrix.map(s=>[...s]);let a=0;for(let s=0;s<r&&a<i;s++){let o=a;for(;o<i&&Math.abs(n[o][s])<1e-10;)o++;if(o<i){[n[a],n[o]]=[n[o],n[a]];const c=n[a][s];for(let u=s;u<r;u++)n[a][u]/=c;for(let u=0;u<i;u++)if(u!==a){const h=n[u][s];for(let f=s;f<r;f++)n[u][f]-=h*n[a][f]}a++}}return a}}function Ao(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const s=Ne(t.matrix[0][0]);return new q([],s,e)}const n=[];for(let s=0;s<r;s++){const o=t.matrix[s].splice(i,1);n.push(o[0])}const a=Ne(n[0]);return new q(n,a,e)}}function Po(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=Ne(r[0][0]);return new q(r[0]||[],n,e)}}function To(e){return(t,i,r)=>{const n=t.matrix.length,a=n>0?t.matrix[0].length:0,s=i*r,o=[];for(let h=0;h<n;h++)for(let f=0;f<a;f++)o.push(t.matrix[h][f]);for(;o.length<s;)o.push(NaN);o.length>s&&(o.length=s);const c=[];let u=0;for(let h=0;h<i;h++){const f=[];for(let l=0;l<r;l++)f.push(o[u++]);c.push(f)}t.matrix=c}}function Ro(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Do(e){return(t,i)=>{if(!t.matrix[i]){const n=Ne(t.matrix[0][0]);return new q([],n,e)}const r=Ne(t.matrix[i][0]);return new q([...t.matrix[i]],r,e)}}function Vo(e){return t=>t.matrix.length}function Lo(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Oo(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((n,a)=>{const s=n[i],o=a[i];return s<o?r==="asc"?-1:1:s>o?r==="asc"?1:-1:0})}}function Mo(e){return(t,i,r,n,a)=>{const s=r-i,o=a-n,c=new W(s,o,NaN,e);for(let u=0;u<s;u++){const h=i+u;if(h>=t.matrix.length)break;for(let f=0;f<o;f++){const l=n+f;if(l>=t.matrix[h].length)break;c.matrix[u][f]=t.matrix[h][l]}}return c}}function Bo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new W(0,0,NaN,e);const n=t.matrix[0].length,a=new W(r,n,NaN,e);if(i instanceof W)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const c=t.matrix[s][o],u=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=c+u}else{const s=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]+s}return a}}function Fo(e){return(t,i,r)=>{const n=t.matrix.length;for(let a=0;a<n;a++){const s=t.matrix[a][i];t.matrix[a][i]=t.matrix[a][r],t.matrix[a][r]=s}}}function Wo(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function jo(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=Math.min(i,r);let a=0;for(let s=0;s<n;s++)a+=t.matrix[s][s];return a}}function $o(e){return t=>{const i=t.matrix.length;if(i===0)return new W(0,0,NaN,e);const r=t.matrix[0].length,n=new W(r,i,NaN,e);for(let a=0;a<i;a++)for(let s=0;s<r;s++)n.matrix[s][a]=t.matrix[a][s];return n}}var qo=Object.defineProperty,Uo=(e,t,i)=>t in e?qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,P=(e,t,i)=>Uo(e,typeof t!="symbol"?t+"":t,i);class W{constructor(t=0,i=0,r=NaN,n){if(this.context=n,P(this,"matrix"),P(this,"_add_col"),P(this,"_add_row"),P(this,"_avg"),P(this,"_col"),P(this,"_columns"),P(this,"_concat"),P(this,"_copy"),P(this,"_det"),P(this,"_diff"),P(this,"_eigenvalues"),P(this,"_eigenvectors"),P(this,"_elements_count"),P(this,"_fill"),P(this,"_get"),P(this,"_inv"),P(this,"_is_antidiagonal"),P(this,"_is_antisymmetric"),P(this,"_is_binary"),P(this,"_is_diagonal"),P(this,"_is_identity"),P(this,"_is_square"),P(this,"_is_stochastic"),P(this,"_is_symmetric"),P(this,"_is_triangular"),P(this,"_is_zero"),P(this,"_kron"),P(this,"_max"),P(this,"_median"),P(this,"_min"),P(this,"_mode"),P(this,"_mult"),P(this,"_pinv"),P(this,"_pow"),P(this,"_rank"),P(this,"_remove_col"),P(this,"_remove_row"),P(this,"_reshape"),P(this,"_reverse"),P(this,"_row"),P(this,"_rows"),P(this,"_set"),P(this,"_sort"),P(this,"_submatrix"),P(this,"_sum"),P(this,"_swap_columns"),P(this,"_swap_rows"),P(this,"_trace"),P(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let a=0;a<t;a++)this.matrix.push(Array(i).fill(r));this._add_col=Ha(this.context),this._add_row=Ka(this.context),this._avg=Ga(this.context),this._col=za(this.context),this._columns=Ya(this.context),this._concat=Qa(this.context),this._copy=Xa(this.context),this._det=Ja(this.context),this._diff=eo(this.context),this._eigenvalues=io(this.context),this._eigenvectors=ro(this.context),this._elements_count=no(this.context),this._fill=so(this.context),this._get=ao(this.context),this._inv=co(this.context),this._is_antidiagonal=uo(this.context),this._is_antisymmetric=ho(this.context),this._is_binary=lo(this.context),this._is_diagonal=po(this.context),this._is_identity=fo(this.context),this._is_square=mo(this.context),this._is_stochastic=xo(this.context),this._is_symmetric=go(this.context),this._is_triangular=yo(this.context),this._is_zero=vo(this.context),this._kron=wo(this.context),this._max=bo(this.context),this._median=So(this.context),this._min=Eo(this.context),this._mode=_o(this.context),this._mult=No(this.context),this._pinv=Io(this.context),this._pow=Co(this.context),this._rank=ko(this.context),this._remove_col=Ao(this.context),this._remove_row=Po(this.context),this._reshape=To(this.context),this._reverse=Ro(this.context),this._row=Do(this.context),this._rows=Vo(this.context),this._set=Lo(this.context),this._sort=Oo(this.context),this._submatrix=Mo(this.context),this._sum=Bo(this.context),this._swap_columns=Fo(this.context),this._swap_rows=Wo(this.context),this._trace=jo(this.context),this._transpose=$o(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
125
+ `,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 Ho(e){return(t,i,r)=>new W(t,i,r,e)}function Ko(e){return(t,i=0)=>x.from(t).get(i)}class Go{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=Ho(t),this.param=Ko(),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 zo=Object.defineProperty,Yo=(e,t,i)=>t in e?zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Qo=(e,t,i)=>Yo(e,typeof t!="symbol"?t+"":t,i);class Xo{constructor(t){this.context=t,Qo(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()}}class _t{constructor(t,i){this._definition=t,this.context=i;for(let r in t)this[r]=t[r]}get __def__(){return this._definition}copy(){return new _t(this.__def__,this.context)}toString(){const t={};for(let i in this.__def__)t[i]=this[i];return JSON.stringify(t)}}function Zo(e){return typeof e=="object"&&e.title!==void 0&&e.data!==void 0&&e.options!==void 0}const Nr={series:e=>e instanceof x||typeof e=="number"||typeof e=="string"||typeof e=="boolean",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 x)&&!Zo(e)};function Ce(e,t,i,r){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const n={};let a={};const s=new Array(t.length).fill(!0);for(let o=0;o<e.length;o++){const c=e[o];if(Nr.remaining_options(c)){a=c;break}const u=t.map((h,f)=>s[f]?h[o]:void 0);for(let h=0;h<u.length;h++){const f=u[h];if(f===void 0){s[h]=!1;continue}const l=Nr[i[f]];typeof l=="function"&&l(c)?n[f]=c:s[h]=!1}}return{...a,...n,...r}}var Jo=Object.defineProperty,ec=(e,t,i)=>t in e?Jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,tc=(e,t,i)=>ec(e,typeof t!="symbol"?t+"":t,i);const ic=["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"],rc={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"},Z={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#F23645",silver:"#B2B5BE",teal:"#089981",white:"#FFFFFF",yellow:"#FDD835"};function nc(e){return Ce(e,ic,rc)}class sc{constructor(t){this.context=t,tc(this,"color",{param:(i,r=0)=>x.from(i).get(r),rgb:(i,r,n,a)=>a?`rgba(${i}, ${r}, ${n}, ${(100-a)/100})`:`rgb(${i}, ${r}, ${n})`,new:(i,r)=>{if(i&&i.startsWith("#")){const n=i.slice(1);return r?`#${n}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${n}`}else{const n=Z[i];return n?r?`#${n}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${n}`:r?`rgba(${i}, ${(100-r)/100})`:i}},aqua:Z.aqua,black:Z.black,blue:Z.blue,fuchsia:Z.fuchsia,gray:Z.gray,green:Z.green,lime:Z.lime,maroon:Z.maroon,navy:Z.navy,olive:Z.olive,orange:Z.orange,purple:Z.purple,red:Z.red,silver:Z.silver,teal:Z.teal,white:Z.white,yellow:Z.yellow})}extractPlotOptions(t){const i={};for(let r in t)i[r]=x.from(t[r]).get(0);return i}indicator(...t){const i=nc(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(x.from(t).get(0))}nz(t,i=0){const r=x.from(t).get(0),n=x.from(i).get(0);return isNaN(r)?n:r}fixnan(t){const i=x.from(t);for(let r=0;r<i.length;r++){const n=i.get(r);if(!isNaN(n))return n}return NaN}alertcondition(t,i,r){}bool(t){const i=x.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=x.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=x.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 x.from(t).get(0).toString()}Type(t){const i=Object.keys(t);return{new:function(...r){const n={};for(let a=0;a<r.length;a++)n[i[a]]=r[a];return new _t(n,this.context)},copy:function(r){return new _t(r.__def__,this.context)}}}}const ac=[["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"]],oc={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function pe(e){return Ce(e,ac,oc)}function Se(e,t){return t.title&&e.inputs&&e.inputs[t.title]!==void 0?e.inputs[t.title]:t.defval}function cc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function uc(e){return(...t)=>pe(t).defval}function hc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function lc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function pc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function fc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function dc(e){return(t,i=0)=>x.from(t).get(i)}function mc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function xc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function gc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function yc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function vc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function wc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function bc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function Sc(e){return(...t)=>pe(t).defval}var Ec=Object.defineProperty,_c=(e,t,i)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ae=(e,t,i)=>_c(e,typeof t!="symbol"?t+"":t,i);const Nc={any:cc,bool:uc,color:hc,enum:lc,float:pc,int:fc,param:dc,price:mc,session:xc,source:gc,string:yc,symbol:vc,text_area:wc,time:bc,timeframe:Sc};class Ic{constructor(t){this.context=t,ae(this,"any"),ae(this,"bool"),ae(this,"color"),ae(this,"enum"),ae(this,"float"),ae(this,"int"),ae(this,"param"),ae(this,"price"),ae(this,"session"),ae(this,"source"),ae(this,"string"),ae(this,"symbol"),ae(this,"text_area"),ae(this,"time"),ae(this,"timeframe"),Object.entries(Nc).forEach(([i,r])=>{this[i]=r(t)})}}function Cc(e){return t=>Math.abs(x.from(t).get(0))}function kc(e){return t=>Math.acos(x.from(t).get(0))}function Ac(e){return t=>Math.asin(x.from(t).get(0))}function Pc(e){return t=>Math.atan(x.from(t).get(0))}function Tc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Rc(e){return t=>Math.ceil(x.from(t).get(0))}function Dc(e){return t=>Math.cos(x.from(t).get(0))}function Vc(e){return()=>Math.E}function Lc(e){return t=>Math.exp(x.from(t).get(0))}function Oc(e){return t=>Math.floor(x.from(t).get(0))}function Mc(e){return t=>Math.log(x.from(t).get(0))}function Bc(e){return t=>Math.log(x.from(t).get(0))}function Fc(e){return t=>Math.log10(x.from(t).get(0))}function Wc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return Math.max(...i)}}function jc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return Math.min(...i)}}function $c(e){return(t,i,r)=>typeof t=="string"?t:t instanceof x?i?new x(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new x(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new x(e.params[r],0)))}function qc(e){return()=>1.618033988749895}function Uc(e){return()=>Math.PI}function Hc(e){return(t,i)=>Math.pow(x.from(t).get(0),x.from(i).get(0))}function Kc(e){return()=>Math.random()}function Gc(e){return(t,i)=>{const r=x.from(t).get(0);if(i==null)return Math.round(r);const n=x.from(i).get(0);if(n===0)return Math.round(r);const a=Math.pow(10,n);return Math.round(r*a)/a}}function zc(e){return t=>e.precision(Math.round(x.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Yc(e){return()=>.6180339887498948}function Qc(e){return t=>Math.sign(x.from(t).get(0))}function Xc(e){return t=>Math.sin(x.from(t).get(0))}function Zc(e){return t=>Math.sqrt(x.from(t).get(0))}function Jc(e){return(t,i)=>{const r=x.from(i).get(0),n=x.from(t);let a=0;for(let s=0;s<r;s++){const o=n.get(s);a+=o}return a}}function eu(e){return t=>Math.tan(x.from(t).get(0))}function tu(e){return t=>{const i=x.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function iu(e){return t=>{const i=x.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function ru(e){return(t,i)=>{const r=x.from(t).get(0),n=x.from(i).get(0);return typeof r=="number"&&typeof n=="number"?isNaN(r)&&isNaN(n)?!0:isNaN(r)||isNaN(n)?!1:Math.abs(r-n)<1e-8:r===n}}var nu=Object.defineProperty,su=(e,t,i)=>t in e?nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,B=(e,t,i)=>su(e,typeof t!="symbol"?t+"":t,i);const au={abs:Cc,acos:kc,asin:Ac,atan:Pc,avg:Tc,ceil:Rc,cos:Dc,e:Vc,exp:Lc,floor:Oc,ln:Mc,log:Bc,log10:Fc,max:Wc,min:jc,param:$c,phi:qc,pi:Uc,pow:Hc,random:Kc,round:Gc,round_to_mintick:zc,rphi:Yc,sign:Qc,sin:Xc,sqrt:Zc,sum:Jc,tan:eu,todegrees:tu,toradians:iu,__eq:ru};class ou{constructor(t){this.context=t,B(this,"_cache",{}),B(this,"abs"),B(this,"acos"),B(this,"asin"),B(this,"atan"),B(this,"avg"),B(this,"ceil"),B(this,"cos"),B(this,"e"),B(this,"exp"),B(this,"floor"),B(this,"ln"),B(this,"log"),B(this,"log10"),B(this,"max"),B(this,"min"),B(this,"param"),B(this,"phi"),B(this,"pi"),B(this,"pow"),B(this,"random"),B(this,"round"),B(this,"round_to_mintick"),B(this,"rphi"),B(this,"sign"),B(this,"sin"),B(this,"sqrt"),B(this,"sum"),B(this,"tan"),B(this,"todegrees"),B(this,"toradians"),B(this,"__eq"),Object.entries(au).forEach(([i,r])=>{this[i]=r(t)})}}function cu(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof x)n=t.get(i||0);else if(Array.isArray(t)){const a=t.every(o=>o instanceof x),s=t.every(o=>!(o instanceof x)&&!Array.isArray(o));(a||s)&&t.length>=1?a?n=t.map(o=>o.get(0)):n=t:n=x.from(t).get(i||0)}else n=t;return e.params[r].length===0?e.params[r].push(n):e.params[r][e.params[r].length-1]=n,[n,r]}}const Nt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Ir(e,t,i,r,n=!1){for(let a=0;a<i.length;a++)if(i[a]<=e&&t<=r[a])return n||t>=r[a]?a:a-1;return-1}function Cr(e,t,i,r,n=!1,a,s=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const c=a&&t>a;if(s&&n)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}if(c&&n&&!s)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}return o}if(r[o]<e)break}return-1}function uu(e){return async(t,i,r,n=!1,a=!1,s=!1,o=null,c=null)=>{const u=t[0],h=i[0],f=r[0],l=r[1],d=Array.isArray(n)?n[0]:n,g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return f;const y=Nt.indexOf(e.timeframe),v=Nt.indexOf(h);if(y==-1||v==-1)throw new Error("Invalid timeframe");if(y===v)return f;const b=y>v,_=x.from(e.data.openTime).get(0),N=x.from(e.data.closeTime).get(0),I=`${u}_${h}_${l}`,E=`${I}_prevIdx`;if(e.cache[I]){const ce=e.cache[I],$e=b?Cr(_,N,ce.data.openTime.data,ce.data.closeTime.data,g,e.eDate,d):Ir(_,N,ce.data.openTime.data,ce.data.closeTime.data,g);if($e==-1)return NaN;const ie=ce.params[l][$e];if(!b&&d){const Lr=e.cache[E];return Lr!==void 0&&Lr===$e?NaN:(e.cache[E]=$e,Array.isArray(ie)?[ie]:ie)}return Array.isArray(ie)?[ie]:ie}const M=1e3*60*60*24*30,D=e.sDate?e.sDate-M:void 0,F=e.sDate&&e.eDate?void 0:e.limit||1e3,z=new ti(e.source,u,h,F,D,void 0);z.markAsSecondary();const Y=await z.run(e.pineTSCode);e.cache[I]=Y;const G=b?Cr(_,N,Y.data.openTime.data,Y.data.closeTime.data,g,e.eDate,d):Ir(_,N,Y.data.openTime.data,Y.data.closeTime.data,g);if(G==-1)return NaN;const oe=Y.params[l][G];return!b&&d?(e.cache[E]=G,NaN):Array.isArray(oe)?[oe]:oe}}function hu(e){return async(t,i,r,n=!1,a=null,s=!1,o=0)=>{const c=t[0],u=i[0],h=r[0],f=r[1];Array.isArray(n)&&n[0];const l=Array.isArray(s)?s[0]:s;if(e.isSecondaryContext)return Array.isArray(h)?[h]:h;const d=Nt.indexOf(e.timeframe),g=Nt.indexOf(u);if(d===-1||g===-1){if(l)return NaN;throw new Error("Invalid timeframe")}if(g>d){if(l)return NaN;throw new Error(`Timeframe ${u} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(g===d)return[[h]];const y=`${c}_${u}_${f}_lower`;if(!e.cache[y]){const D=e.sDate?e.sDate-2592e6:void 0,F=e.sDate&&e.eDate?void 0:e.limit||1e3,z=new ti(e.source,c,u,F,D,e.eDate);z.markAsSecondary();const Y=await z.run(e.pineTSCode);e.cache[y]=Y}const v=e.cache[y],b=x.from(e.data.openTime).get(0),_=x.from(e.data.closeTime).get(0),N=v.data.openTime.data,I=v.data.closeTime.data,E=v.params[f];if(!E)return[];const M=[];for(let D=0;D<N.length;D++){const F=N[D];if(!(I[D]<=b)){if(F>=_)break;F>=b&&F<_&&M.push(E[D])}}return[M]}}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,It=(e,t,i)=>pu(e,typeof t!="symbol"?t+"":t,i);const fu={param:cu,security:uu,security_lower_tf:hu};class du{constructor(t){this.context=t,It(this,"_cache",{}),It(this,"param"),It(this,"security"),It(this,"security_lower_tf"),Object.entries(fu).forEach(([i,r])=>{this[i]=r(t)})}}function mu(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.high,0),s=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(n)||isNaN(a)||isNaN(s)||isNaN(o))return r.currentCumulativeSum=r.prevCumulativeSum,e.precision(r.prevCumulativeSum);const c=a-s;let u=0;c!==0&&(u=(n-s-(a-n))/c*o);const h=r.prevCumulativeSum+u;return r.currentCumulativeSum=h,e.precision(h)}}function xu(e){return(t,i,r,n,a)=>{const s=x.from(i).get(0),o=x.from(r).get(0),c=x.from(n).get(0);e.taState||(e.taState={});const u=a||`alma_${s}_${o}_${c}`;if(!e.taState[u]){const g=o*(s-1),y=s/c,v=[];let b=0;for(let _=0;_<s;_++){const N=Math.exp(-Math.pow(_-g,2)/(2*y*y));v.push(N),b+=N}for(let _=0;_<v.length;_++)v[_]/=b;e.taState[u]={lastIdx:-1,prevWindow:[],currentWindow:[],weights:v}}const h=e.taState[u];e.idx>h.lastIdx&&(h.lastIdx>=0&&(h.prevWindow=[...h.currentWindow]),h.lastIdx=e.idx);const f=x.from(t).get(0),l=[...h.prevWindow];if(l.unshift(f),l.length>s&&l.pop(),h.currentWindow=l,l.length<s)return NaN;let d=0;for(let g=0;g<s;g++)d+=h.weights[g]*l[s-1-g];return e.precision(d)}}function gu(e){return(t,i)=>{const r=x.from(t).get(0);e.taState||(e.taState={});const n=i||`atr_${r}`;e.taState[n]||(e.taState[n]={lastIdx:-1,prevAtr:null,prevInitSum:0,prevInitCount:0,prevPrevClose:null,currentAtr:null,currentInitSum:0,currentInitCount:0,currentPrevClose:null});const a=e.taState[n];e.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevAtr=a.currentAtr,a.prevInitSum=a.currentInitSum,a.prevInitCount=a.currentInitCount,a.prevPrevClose=a.currentPrevClose),a.lastIdx=e.idx);const s=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(s)||isNaN(o)||isNaN(c))return NaN;const u=a.prevPrevClose;let h;if(u!==null){const y=s-o,v=Math.abs(s-u),b=Math.abs(o-u);h=Math.max(y,v,b)}else h=s-o;a.currentPrevClose=c;let f=a.prevInitCount,l=a.prevInitSum,d=a.prevAtr;if(f<r){if(l+=h,f++,a.currentInitSum=l,a.currentInitCount=f,f===r){const y=l/r;return a.currentAtr=y,e.precision(y)}return NaN}const g=(d*(r-1)+h)/r;return a.currentAtr=g,e.precision(g)}}function yu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastIdx:-1,prevLastTrueIndex:null,currentLastTrueIndex:null});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevLastTrueIndex=n.currentLastTrueIndex),n.lastIdx=e.idx);const a=x.from(t).get(0);let s=n.prevLastTrueIndex;return a&&(s=e.idx),n.currentLastTrueIndex=s,s===null?NaN:e.idx-s}}function vu(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0);e.taState||(e.taState={});const o=n||`bb_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=x.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,[[NaN,NaN,NaN]];const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length>a){const b=h.pop();f-=b}if(c.currentWindow=h,c.currentSum=f,h.length<a)return[[NaN,NaN,NaN]];const l=f/a;let d=0;for(let b=0;b<a;b++)d+=Math.pow(h[b]-l,2);const g=Math.sqrt(d/a),y=l+s*g,v=l-s*g;return[[e.precision(l),e.precision(y),e.precision(v)]]}}function wu(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0);e.taState||(e.taState={});const o=n||`bbw_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=x.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,NaN;const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length>a){const _=h.pop();f-=_}if(c.currentWindow=h,c.currentSum=f,h.length<a)return NaN;const l=f/a;let d=0;for(let _=0;_<a;_++){const N=h[_]-l;d+=N*N}const g=d/a,y=Math.sqrt(g),v=s*y;if(l===0)return e.precision(0);const b=2*v/l*100;return e.precision(b)}}function bu(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`cci_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=x.from(t).get(0);if(isNaN(o))return NaN;const c=[...s.prevWindow];let u=s.prevSum;if(c.unshift(o),u+=o,c.length<n)return s.currentWindow=c,s.currentSum=u,NaN;if(c.length>n){const g=c.pop();u-=g}s.currentWindow=c,s.currentSum=u;const h=u/n;let f=0;for(let g=0;g<n;g++)f+=Math.abs(c[g]-h);const l=f/n;if(l===0)return 0;const d=(o-h)/(.015*l);return e.precision(d)}}function Su(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`change_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<=n)return s.currentWindow=c,NaN;c.length>n+1&&c.pop(),s.currentWindow=c;const u=o-c[n];return e.precision(u)}}function Eu(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`cmo_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevGainsWindow:[],prevLossesWindow:[],prevGainsSum:0,prevLossesSum:0,currentGainsWindow:[],currentLossesWindow:[],currentGainsSum:0,currentLossesSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevGainsWindow=[...s.currentGainsWindow],s.prevLossesWindow=[...s.currentLossesWindow],s.prevGainsSum=s.currentGainsSum,s.prevLossesSum=s.currentLossesSum),s.lastIdx=e.idx);const o=x.from(t).get(0),c=x.from(t).get(1);if(isNaN(o)||isNaN(c))return NaN;const u=o-c,h=u>=0?u:0,f=u>=0?0:-u,l=[...s.prevGainsWindow],d=[...s.prevLossesWindow];let g=s.prevGainsSum,y=s.prevLossesSum;if(l.unshift(h),d.unshift(f),g+=h,y+=f,l.length<n)return s.currentGainsWindow=l,s.currentLossesWindow=d,s.currentGainsSum=g,s.currentLossesSum=y,NaN;if(l.length>n){const _=l.pop(),N=d.pop();g-=_,y-=N}s.currentGainsWindow=l,s.currentLossesWindow=d,s.currentGainsSum=g,s.currentLossesSum=y;const v=g+y;if(v===0)return e.precision(0);const b=100*(g-y)/v;return e.precision(b)}}function _u(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);let s=0,o=!1;for(let h=0;h<n;h++){const f=a.get(h);if(isNaN(f)){o=!0;break}s+=f}if(o)return NaN;let c=0;for(let h=0;h<n;h++){const f=a.get(h);c+=f*(h+1)}if(s===0)return NaN;const u=-c/s;return e.precision(u)}}function Nu(e){return(t,i,r,n)=>{const a=x.from(r).get(0),s=x.from(t),o=x.from(i);if(e.idx<a-1)return NaN;let c=0,u=0,h=0,f=0,l=0,d=0;for(let _=0;_<a;_++){const N=s.get(_),I=o.get(_);isNaN(N)||isNaN(I)||(c+=N,u+=I,h+=N*I,f+=N*N,l+=I*I,d++)}if(d<2)return NaN;const g=d*h-c*u,y=d*f-c*c,v=d*l-u*u;if(y<=0||v<=0)return e.precision(0);const b=g/Math.sqrt(y*v);return e.precision(b)}}function Iu(e){return(t,i,r)=>{const n=x.from(t),a=x.from(i),s=n.get(0),o=a.get(0),c=n.get(1),u=a.get(1);if(isNaN(s)||isNaN(o)||isNaN(c)||isNaN(u))return!1;const h=s>o&&c<=u,f=s<o&&c>=u;return h||f}}function Cu(e){return(t,i)=>{const r=x.from(t),n=x.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o<c&&a>s}}function ku(e){return(t,i)=>{const r=x.from(t),n=x.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o>c&&a<s}}function Au(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevCumulativeSum=n.currentCumulativeSum),n.lastIdx=e.idx);const a=x.from(t).get(0);if(isNaN(a))return n.currentCumulativeSum=n.prevCumulativeSum,e.precision(n.prevCumulativeSum);const s=n.prevCumulativeSum+a;return n.currentCumulativeSum=s,e.precision(s)}}function Pu(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`dev_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=x.from(t).get(0)||0,c=[...s.prevWindow];let u=s.prevSum;if(c.unshift(o),u+=o,c.length>n){const d=c.pop();u-=d}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const h=u/n;let f=0;for(let d=0;d<n;d++)f+=Math.abs(c[d]-h);const l=f/n;return e.precision(l)}}function Tu(e){return(t,i,r)=>{const n=x.from(t).get(0),a=x.from(i).get(0);e.taState||(e.taState={});const s=r||`dmi_${n}_${a}`;e.taState[s]||(e.taState[s]={lastIdx:-1,prevHigh:NaN,prevLow:NaN,prevClose:NaN,prevTrInitSum:0,prevPlusInitSum:0,prevMinusInitSum:0,prevInitCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,prevDxInitSum:0,prevAdxInitCount:0,prevADX:NaN,currentHigh:NaN,currentLow:NaN,currentClose:NaN,currentTrInitSum:0,currentPlusInitSum:0,currentMinusInitSum:0,currentInitCount:0,currentSmoothedTR:NaN,currentSmoothedPlus:NaN,currentSmoothedMinus:NaN,currentDxInitSum:0,currentAdxInitCount:0,currentADX:NaN});const o=e.taState[s];e.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevHigh=o.currentHigh,o.prevLow=o.currentLow,o.prevClose=o.currentClose,o.prevTrInitSum=o.currentTrInitSum,o.prevPlusInitSum=o.currentPlusInitSum,o.prevMinusInitSum=o.currentMinusInitSum,o.prevInitCount=o.currentInitCount,o.prevSmoothedTR=o.currentSmoothedTR,o.prevSmoothedPlus=o.currentSmoothedPlus,o.prevSmoothedMinus=o.currentSmoothedMinus,o.prevDxInitSum=o.currentDxInitSum,o.prevAdxInitCount=o.currentAdxInitCount,o.prevADX=o.currentADX),o.lastIdx=e.idx);const c=e.get(e.data.high,0),u=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(c)||isNaN(u)||isNaN(h))return[[NaN,NaN,NaN]];if(o.currentHigh=c,o.currentLow=u,o.currentClose=h,isNaN(o.prevHigh))return[[NaN,NaN,NaN]];const f=Math.max(c-u,Math.abs(c-o.prevClose),Math.abs(u-o.prevClose)),l=c-o.prevHigh,d=o.prevLow-u,g=l>d&&l>0?l:0,y=d>l&&d>0?d:0;let v=o.prevInitCount,b=o.prevTrInitSum,_=o.prevPlusInitSum,N=o.prevMinusInitSum,I=o.prevSmoothedTR,E=o.prevSmoothedPlus,M=o.prevSmoothedMinus;if(v++,v<=n)b+=f,_+=g,N+=y,v===n&&(I=b/n,E=_/n,M=N/n);else{const ie=1/n;I=ie*f+(1-ie)*I,E=ie*g+(1-ie)*E,M=ie*y+(1-ie)*M}if(o.currentInitCount=v,o.currentTrInitSum=b,o.currentPlusInitSum=_,o.currentMinusInitSum=N,o.currentSmoothedTR=I,o.currentSmoothedPlus=E,o.currentSmoothedMinus=M,v<n)return[[NaN,NaN,NaN]];const D=I===0?0:100*E/I,F=I===0?0:100*M/I,z=D+F,Y=z===0?0:100*Math.abs(D-F)/z;let G=o.prevAdxInitCount,oe=o.prevDxInitSum,ce=o.prevADX,$e=NaN;if(G++,G<=a)oe+=Y,G===a&&(ce=oe/a,$e=ce);else{const ie=1/a;ce=ie*Y+(1-ie)*ce,$e=ce}return o.currentAdxInitCount=G,o.currentDxInitSum=oe,o.currentADX=ce,[[e.precision(D),e.precision(F),e.precision($e)]]}}function Ru(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`ema_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevEma:null,prevInitSum:0,prevInitCount:0,currentEma:null,currentInitSum:0,currentInitCount:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevEma=s.currentEma,s.prevInitSum=s.currentInitSum,s.prevInitCount=s.currentInitCount),s.lastIdx=e.idx);const o=x.from(t).get(0);if(o==null||isNaN(o))return NaN;let c=s.prevInitCount,u=s.prevInitSum,h=s.prevEma;if(c<n){if(u+=o,c++,s.currentInitSum=u,s.currentInitCount=c,c===n){const d=u/n;return s.currentEma=d,e.precision(d)}return NaN}const f=2/(n+1),l=o*f+h*(1-f);return s.currentEma=l,e.precision(l)}}function Du(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);for(let s=0;s<n;s++){const o=a.get(s),c=a.get(s+1);if(isNaN(o)||isNaN(c)||o>=c)return!1}return!0}}function Vu(e){return(t,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=t,t=e.data.high);const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`highest_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;const u=c.filter(f=>!isNaN(f)&&f!==void 0);if(u.length===0)return NaN;const h=Math.max(...u);return e.precision(h)}}function Lu(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);if(e.idx<n-1)return NaN;let s=-1/0,o=NaN;for(let c=0;c<n;c++){const u=a.get(c);isNaN(u)||(isNaN(o)||u>s)&&(s=u,o=-c)}return o}}function Ou(e){return(t,i,r)=>{const n=x.from(i).get(0),a=Math.floor(n/2),s=Math.floor(Math.sqrt(n)),o=e.pine.ta.wma,c=o(t,a,r?`${r}_wma1`:void 0),u=o(t,n,r?`${r}_wma2`:void 0);if(isNaN(c)||isNaN(u))return NaN;e.taState||(e.taState={});const h=r||`hma_raw_${n}`;e.taState[h]||(e.taState[h]={lastIdx:-1,prevValues:[],currentValues:[]});const f=e.taState[h];e.idx>f.lastIdx&&(f.lastIdx>=0&&(f.prevValues=[...f.currentValues]),f.lastIdx=e.idx);const l=2*c-u,d=[...f.prevValues];d.unshift(l),d.length>s+1&&d.pop(),f.currentValues=d;const g=r?`${r}_hma_final`:`hma_final_${n}`;e.taState[g]||(e.taState[g]={lastIdx:-1,prevWindow:[],currentWindow:[]});const y=e.taState[g];e.idx>y.lastIdx&&(y.lastIdx>=0&&(y.prevWindow=[...y.currentWindow]),y.lastIdx=e.idx);const v=[...y.prevWindow];if(v.unshift(l),v.length<s)return y.currentWindow=v,NaN;v.length>s&&v.pop(),y.currentWindow=v;let b=0,_=0;for(let I=0;I<s;I++){const E=s-I;b+=v[I]*E,_+=E}const N=b/_;return e.precision(N)}}function Mu(e){return t=>{const i=e.get(e.data.close,0),r=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(n)||isNaN(a))return NaN;const s=(r-n)*a;if(s===0)return e.precision(0);const o=(2*i-r-n)/s;return e.precision(o)}}function Bu(e){return(t,i,r,n,a)=>{const s=x.from(i).get(0),o=x.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=x.from(n).get(0));let u;const h=e.get(e.data.high,0),f=e.get(e.data.low,0);if(c){const I=e.get(e.data.close,1);isNaN(I)?u=NaN:u=Math.max(h-f,Math.abs(h-I),Math.abs(f-I))}else u=h-f;const l=x.from(t).get(0);e.taState||(e.taState={});const d=a||`kc_${s}_${o}_${c}`;e.taState[d]||(e.taState[d]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const g=e.taState[d];e.idx>g.lastIdx&&(g.lastIdx>=0&&(g.basisState={...g.currentBasisState},g.rangeState={...g.currentRangeState}),g.lastIdx=e.idx);const y=(I,E,M,D)=>{if(isNaN(M))return Object.assign(E,I),E.prevEma!==null?E.prevEma:NaN;let F=I.initCount,z=I.initSum,Y=I.prevEma;if(F<D){if(z+=M,F++,E.initSum=z,E.initCount=F,E.prevEma=Y,F===D){const ce=z/D;return E.prevEma=ce,ce}return NaN}const G=2/(D+1),oe=M*G+Y*(1-G);return E.prevEma=oe,E.initSum=z,E.initCount=F,oe},v=y(g.basisState,g.currentBasisState,l,s),b=y(g.rangeState,g.currentRangeState,u,s);if(isNaN(v)||isNaN(b))return[[NaN,NaN,NaN]];const _=v+b*o,N=v-b*o;return[[e.precision(v),e.precision(_),e.precision(N)]]}}function Fu(e){return(t,i,r,n,a)=>{const s=x.from(i).get(0),o=x.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=x.from(n).get(0)),e.taState||(e.taState={});const u=a||`kcw_${s}_${o}_${c}`;e.taState[u]||(e.taState[u]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const h=e.taState[u];e.idx>h.lastIdx&&(h.lastIdx>=0&&(h.basisState={...h.currentBasisState},h.rangeState={...h.currentRangeState}),h.lastIdx=e.idx);const f=(N,I,E,M)=>{if(isNaN(E))return Object.assign(I,N),I.prevEma!==null?I.prevEma:NaN;let D=N.initCount,F=N.initSum,z=N.prevEma;if(D<M){if(F+=E,D++,I.initSum=F,I.initCount=D,I.prevEma=z,D===M){const oe=F/M;return I.prevEma=oe,oe}return NaN}const Y=2/(M+1),G=E*Y+z*(1-Y);return I.prevEma=G,I.initSum=F,I.initCount=D,G};let l;const d=e.get(e.data.high,0),g=e.get(e.data.low,0);if(c){const N=e.get(e.data.close,1);isNaN(N)?l=NaN:l=Math.max(d-g,Math.abs(d-N),Math.abs(g-N))}else l=d-g;const y=x.from(t).get(0),v=f(h.basisState,h.currentBasisState,y,s),b=f(h.rangeState,h.currentRangeState,l,s);if(isNaN(v)||isNaN(b))return NaN;if(v===0)return e.precision(0);const _=2*b*o/v;return e.precision(_)}}function Wu(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0);e.taState||(e.taState={});const o=n||`linreg_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],currentWindow:[]});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow]),c.lastIdx=e.idx);const u=x.from(t).get(0),h=[...c.prevWindow];if(h.unshift(u),h.length>a&&h.pop(),c.currentWindow=h,h.length<a)return NaN;let f=0,l=0,d=0,g=0;const y=a;for(let N=0;N<a;N++){const I=a-1-N,E=h[N];f+=I,l+=E,d+=I*E,g+=I*I}const v=y*g-f*f;if(v===0)return NaN;const b=(y*d-f*l)/v,_=(l-b*f)/y+b*(a-1-s);return e.precision(_)}}function ju(e){return(t,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=t,t=e.data.low);const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`lowest_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;const u=c.filter(f=>!isNaN(f)&&f!==void 0),h=u.length>0?Math.min(...u):NaN;return e.precision(h)}}function $u(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);if(e.idx<n-1)return NaN;let s=1/0,o=NaN;for(let c=0;c<n;c++){const u=a.get(c);isNaN(u)||(isNaN(o)||u<s)&&(s=u,o=-c)}return o}}function qu(e){return(t,i,r,n,a)=>{const s=x.from(i).get(0),o=x.from(r).get(0),c=x.from(n).get(0),u=a||`macd_${s}_${o}_${c}`,h=`${u}_fast`,f=`${u}_slow`,l=`${u}_signal`,d=e.pine.ta.ema(t,s,h),g=e.pine.ta.ema(t,o,f);let y=NaN;!isNaN(d)&&!isNaN(g)&&(y=d-g);let v=NaN;isNaN(y)||(v=e.pine.ta.ema(y,c,l));let b=NaN;return!isNaN(y)&&!isNaN(v)&&(b=y-v),[[e.precision(y),e.precision(v),e.precision(b)]]}}function Uu(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`median_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length>n&&c.pop(),s.currentWindow=c,c.length<n)return NaN;const u=c.slice().sort((l,d)=>l-d),h=Math.floor(n/2),f=n%2===0?(u[h-1]+u[h])/2:u[h];return e.precision(f)}}function Hu(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`mfi_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevUpperWindow:[],prevLowerWindow:[],prevUpperSum:0,prevLowerSum:0,currentUpperWindow:[],currentLowerWindow:[],currentUpperSum:0,currentLowerSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevUpperWindow=[...s.currentUpperWindow],s.prevLowerWindow=[...s.currentLowerWindow],s.prevUpperSum=s.currentUpperSum,s.prevLowerSum=s.currentLowerSum),s.lastIdx=e.idx);const o=x.from(t).get(0),c=x.from(t).get(1),u=e.get(e.data.volume,0);if(isNaN(o)||isNaN(u))return NaN;const h=isNaN(c)?NaN:o-c,f=u*(h<=0?0:o),l=u*(h>=0?0:o),d=[...s.prevUpperWindow],g=[...s.prevLowerWindow];let y=s.prevUpperSum,v=s.prevLowerSum;if(d.unshift(f),g.unshift(l),y+=f,v+=l,d.length<n)return s.currentUpperWindow=d,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=v,NaN;if(d.length>n){const _=d.pop(),N=g.pop();y-=_,v-=N}if(s.currentUpperWindow=d,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=v,v===0)return e.precision(100);if(y===0)return e.precision(0);const b=100-100/(1+y/v);return e.precision(b)}}function Ku(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);if(e.idx<n-1)return NaN;const s=new Map;for(let u=0;u<n;u++){const h=a.get(u);isNaN(h)||s.set(h,(s.get(h)||0)+1)}if(s.size===0)return NaN;let o=NaN,c=-1;for(const[u,h]of s.entries())h>c?(c=h,o=u):h===c&&u<o&&(o=u);return o}}function Gu(e){return(t,i,r)=>{const n=x.from(i).get(0);return e.pine.ta.change(t,n,r)}}function zu(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={lastIdx:-1,committedNVI:1,tentativeNVI:1});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedNVI=r.tentativeNVI),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,u=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;let l=r.committedNVI;if(!(c===0||u===0)&&h<f){const d=(c-u)/u;l=l+d*l}return r.tentativeNVI=l,e.precision(l)}}function Yu(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={lastIdx:-1,committedOBV:0,tentativeOBV:0});const i=e.taState[t];e.idx>i.lastIdx&&(i.lastIdx>=0&&(i.committedOBV=i.tentativeOBV),i.lastIdx=e.idx);const r=e.get(e.data.close,0),n=e.get(e.data.volume,0),a=e.get(e.data.close,1);if(isNaN(a))return i.tentativeOBV=0,e.precision(0);let s=i.committedOBV;return r>a?s+=n:r<a&&(s-=n),i.tentativeOBV=s,e.precision(s)}}function Qu(e){return(t,i,r)=>t instanceof x?i?new x(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new x(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new x(e.params[r],0)))}function Xu(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0),o=x.from(t);if(e.idx<a-1)return NaN;const c=[];for(let g=0;g<a;g++){const y=o.get(g);if(isNaN(y))return NaN;c.push(y)}c.sort((g,y)=>g-y);let u=s/100*a-.5;u<0&&(u=0),u>a-1&&(u=a-1);const h=Math.floor(u),f=Math.ceil(u);if(h===f)return e.precision(c[h]);const l=u-h,d=c[h]+l*(c[f]-c[h]);return e.precision(d)}}function Zu(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0),o=x.from(t);if(e.idx<a-1)return NaN;const c=[];for(let h=0;h<a;h++){const f=o.get(h);isNaN(f)||c.push(f)}if(c.length===0)return NaN;c.sort((h,f)=>h-f);let u=Math.ceil(s/100*c.length)-1;return u<0&&(u=0),u>=c.length&&(u=c.length-1),e.precision(c[u])}}function Ju(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);if(e.idx<n)return NaN;const s=a.get(0);if(isNaN(s))return NaN;let o=0,c=0;for(let u=1;u<=n;u++){const h=a.get(u);isNaN(h)||(c++,h<=s&&o++)}return c===0?NaN:e.precision(o/c*100)}}function eh(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const a=e[n-i];let s=!0;for(let o=1;o<=t;o++)if(e[n-i-o]>=a){s=!1;break}if(s){for(let o=1;o<=i;o++)if(e[n-i+o]>=a){s=!1;break}}s&&(r[n]=a)}return r}function th(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const a=x.from(i).get(0),s=x.from(r).get(0),o=x.from(t).toArray(),c=eh(o,a,s),u=e.idx;return e.precision(c[u])}}function ih(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const a=e[n-i];let s=!0;for(let o=1;o<=t;o++)if(e[n-i-o]<=a){s=!1;break}if(s){for(let o=1;o<=i;o++)if(e[n-i+o]<=a){s=!1;break}}s&&(r[n]=a)}return r}function rh(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const a=x.from(i).get(0),s=x.from(r).get(0),o=x.from(t).toArray(),c=ih(o,a,s),u=e.idx;return e.precision(c[u])}}function nh(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={lastIdx:-1,committedPVI:1,tentativePVI:1});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedPVI=r.tentativePVI),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,u=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;let l=r.committedPVI;if(!(c===0||u===0)&&h>f){const d=(c-u)/u;l=l+d*l}return r.tentativePVI=l,e.precision(l)}}function sh(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0);let o=r.prevCumulativeSum;if(!isNaN(n)&&!isNaN(a)&&!isNaN(s)&&a!==0){const c=(n-a)/a*s;o+=c}return r.currentCumulativeSum=o,e.precision(o)}}function ah(e){return(t,i,r)=>{const n=e.pine.ta.highest(t,i,(r||"range")+"_h"),a=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(n)||isNaN(a)?NaN:e.precision(n-a)}}function oh(e){return(t,i,r)=>{const n=x.from(i).get(0),a=x.from(t);for(let s=0;s<n;s++){const o=a.get(s),c=a.get(s+1);if(isNaN(o)||isNaN(c)||o<=c)return!1}return!0}}function ch(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`rma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevRma:null,prevInitSum:0,prevInitCount:0,currentRma:null,currentInitSum:0,currentInitCount:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevRma=s.currentRma,s.prevInitSum=s.currentInitSum,s.prevInitCount=s.currentInitCount),s.lastIdx=e.idx);const o=x.from(t).get(0)||0;let c=s.prevInitCount,u=s.prevInitSum,h=s.prevRma;if(c<n){if(u+=o,c++,s.currentInitSum=u,s.currentInitCount=c,c===n){const d=u/n;return s.currentRma=d,e.precision(d)}return NaN}const f=1/n,l=o*f+h*(1-f);return s.currentRma=l,e.precision(l)}}function uh(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`roc_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<=n)return s.currentWindow=c,NaN;c.length>n+1&&c.pop(),s.currentWindow=c;const u=c[n],h=(o-u)/u*100;return e.precision(h)}}function hh(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`rsi_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevPrevValue:null,prevAvgGain:0,prevAvgLoss:0,prevInitGains:[],prevInitLosses:[],currentPrevValue:null,currentAvgGain:0,currentAvgLoss:0,currentInitGains:[],currentInitLosses:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevPrevValue=s.currentPrevValue,s.prevAvgGain=s.currentAvgGain,s.prevAvgLoss=s.currentAvgLoss,s.prevInitGains=[...s.currentInitGains],s.prevInitLosses=[...s.currentInitLosses]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=s.prevPrevValue;let u=s.prevAvgGain,h=s.prevAvgLoss;const f=[...s.prevInitGains],l=[...s.prevInitLosses];if(c!==null){const d=o-c,g=d>0?d:0,y=d<0?-d:0;if(f.length<n){if(f.push(g),l.push(y),s.currentInitGains=f,s.currentInitLosses=l,s.currentPrevValue=o,f.length===n){u=f.reduce((_,N)=>_+N,0)/n,h=l.reduce((_,N)=>_+N,0)/n,s.currentAvgGain=u,s.currentAvgLoss=h;const b=h===0?100:100-100/(1+u/h);return e.precision(b)}return NaN}u=(u*(n-1)+g)/n,h=(h*(n-1)+y)/n,s.currentAvgGain=u,s.currentAvgLoss=h,s.currentPrevValue=o;const v=h===0?100:100-100/(1+u/h);return e.precision(v)}return s.currentPrevValue=o,s.currentInitGains=[],s.currentInitLosses=[],NaN}}function lh(e){return(t,i,r,n)=>{const a=x.from(t).get(0),s=x.from(i).get(0),o=x.from(r).get(0);e.taState||(e.taState={});const c=n||`sar_${a}_${s}_${o}`;e.taState[c]||(e.taState[c]={lastIdx:-1,prevResult:NaN,prevMaxMin:NaN,prevAcceleration:NaN,prevIsBelow:!1,prevBarIndex:0,currentResult:NaN,currentMaxMin:NaN,currentAcceleration:NaN,currentIsBelow:!1,currentBarIndex:0});const u=e.taState[c];e.idx>u.lastIdx&&(u.lastIdx>=0&&(u.prevResult=u.currentResult,u.prevMaxMin=u.currentMaxMin,u.prevAcceleration=u.currentAcceleration,u.prevIsBelow=u.currentIsBelow,u.prevBarIndex=u.currentBarIndex),u.lastIdx=e.idx);let h=u.prevResult,f=u.prevMaxMin,l=u.prevAcceleration,d=u.prevIsBelow,g=u.prevBarIndex;const y=e.get(e.data.high,0),v=e.get(e.data.low,0),b=e.get(e.data.close,0),_=e.get(e.data.close,1),N=e.get(e.data.high,1),I=e.get(e.data.low,1),E=e.get(e.data.high,2),M=e.get(e.data.low,2);if(isNaN(y)||isNaN(v)||isNaN(b))return u.currentResult=h,u.currentMaxMin=f,u.currentAcceleration=l,u.currentIsBelow=d,u.currentBarIndex=g,NaN;let D=!1;return g===1&&(b>_?(d=!0,f=y,h=I):(d=!1,f=v,h=N),D=!0,l=a),g>=1&&(h=h+l*(f-h),d?h>v&&(D=!0,d=!1,h=Math.max(y,f),f=v,l=a):h<y&&(D=!0,d=!0,h=Math.min(v,f),f=y,l=a),D||(d?y>f&&(f=y,l=Math.min(l+s,o)):v<f&&(f=v,l=Math.min(l+s,o))),d?(h=Math.min(h,I),g>1&&(h=Math.min(h,M))):(h=Math.max(h,N),g>1&&(h=Math.max(h,E)))),g++,u.currentResult=h,u.currentMaxMin=f,u.currentAcceleration=l,u.currentIsBelow=d,u.currentBarIndex=g,g<=1?NaN:e.precision(h)}}function ph(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`sma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevSum=s.currentSum),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];c.unshift(o),c.length>n&&c.pop();let u;const h=o==null||Number.isNaN(o);let f=!Number.isNaN(s.prevSum)&&!h;if(f){let d=s.prevSum+o;if(s.prevWindow.length>=n){const g=s.prevWindow[s.prevWindow.length-1];g==null||Number.isNaN(g)?f=!1:d-=g}f&&(u=d)}if(!f){u=0;let d=!1;for(const g of c){if(g==null||Number.isNaN(g)){d=!0;break}u+=g}d&&(u=NaN)}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const l=u/n;return e.precision(l)}}function fh(e){return(t,i,r=!0,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0);e.taState||(e.taState={});const o=n||`stdev_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevWindow=[...c.currentWindow],c.prevSum=c.currentSum),c.lastIdx=e.idx);const u=x.from(t).get(0);if(u==null||isNaN(u))return NaN;const h=[...c.prevWindow];let f=c.prevSum;if(h.unshift(u),f+=u,h.length<a)return c.currentWindow=h,c.currentSum=f,NaN;if(h.length>a){const v=h.pop();f-=v}c.currentWindow=h,c.currentSum=f;const l=f/a;let d=0;for(let v=0;v<a;v++)d+=Math.pow(h[v]-l,2);const g=s?a:a-1,y=Math.sqrt(d/g);return e.precision(y)}}function dh(e){return(t,i,r,n,a)=>{const s=x.from(n).get(0);e.taState||(e.taState={});const o=a||`stoch_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevHighWindow=[...c.currentHighWindow],c.prevLowWindow=[...c.currentLowWindow]),c.lastIdx=e.idx);const u=x.from(t).get(0),h=x.from(i).get(0),f=x.from(r).get(0);if(isNaN(u)||isNaN(h)||isNaN(f))return c.currentHighWindow=[...c.prevHighWindow],c.currentLowWindow=[...c.prevLowWindow],NaN;const l=[...c.prevHighWindow],d=[...c.prevLowWindow];if(l.unshift(h),d.unshift(f),l.length>s&&(l.pop(),d.pop()),c.currentHighWindow=l,c.currentLowWindow=d,l.length<s)return NaN;let g=l[0],y=d[0];for(let _=1;_<s;_++)l[_]>g&&(g=l[_]),d[_]<y&&(y=d[_]);const v=g-y;if(v===0)return NaN;const b=100*(u-y)/v;return e.precision(b)}}function mh(e){return(t,i,r)=>{const n=x.from(t).get(0),a=x.from(i).get(0);e.taState||(e.taState={});const s=r||`supertrend_${n}_${a}`;e.taState[s]||(e.taState[s]={lastIdx:-1,prevTrSum:0,prevAtrValue:NaN,prevAtrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN,currentTrSum:0,currentAtrValue:NaN,currentAtrCount:0,currentLowerBand:NaN,currentUpperBand:NaN,currentSuperTrend:NaN,currentDirection:NaN,currentClose:NaN});const o=e.taState[s];e.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrSum=o.currentTrSum,o.prevAtrValue=o.currentAtrValue,o.prevAtrCount=o.currentAtrCount,o.prevLowerBand=o.currentLowerBand,o.prevUpperBand=o.currentUpperBand,o.prevSuperTrend=o.currentSuperTrend,o.prevDirection=o.currentDirection,o.prevClose=o.currentClose),o.lastIdx=e.idx);const c=e.get(e.data.high,0),u=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(c)||isNaN(u)||isNaN(h))return[[NaN,NaN]];const f=(c+u)/2,l=o.prevClose;let d;isNaN(l)?d=c-u:d=Math.max(c-u,Math.abs(c-l),Math.abs(u-l));let g=o.prevAtrCount,y=o.prevTrSum,v=o.prevAtrValue;g++,g<=a?(y+=d,g===a&&(v=y/a)):v=(v*(a-1)+d)/a;const b=v;if(o.currentAtrCount=g,o.currentTrSum=y,o.currentAtrValue=v,o.currentClose=h,isNaN(b))return[[NaN,NaN]];let _=f+n*b,N=f-n*b;const I=isNaN(o.prevLowerBand)?0:o.prevLowerBand,E=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||N>I||l<I||(N=I),isNaN(o.prevUpperBand)||_<E||l>E||(_=E);let M,D;const F=o.prevSuperTrend;return g===a?M=1:F===o.prevUpperBand?M=h>_?-1:1:M=h<N?1:-1,D=M===-1?N:_,o.currentLowerBand=N,o.currentUpperBand=_,o.currentSuperTrend=D,o.currentDirection=M,[[e.precision(D),M]]}}function xh(e){return(t,i)=>{const r=[1,2,2,1],n=6;e.taState||(e.taState={});const a=i||"swma";e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<4)return s.currentWindow=c,NaN;c.length>4&&c.pop(),s.currentWindow=c;let u=0;for(let h=0;h<4;h++)u+=r[h]*c[3-h];return u/=n,e.precision(u)}}function gh(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=x.from(t).get(0));const n=e.get(e.data.high,0),a=e.get(e.data.low,0),s=e.get(e.data.close,1);if(isNaN(s))return r?e.precision(n-a):NaN;const o=Math.max(n-a,Math.abs(n-s),Math.abs(a-s));return e.precision(o)}}function yh(e){return(t,i,r,n)=>{const a=x.from(i).get(0),s=x.from(r).get(0);e.taState||(e.taState={});const o=n||`tsi_${a}_${s}`;e.taState[o]||(e.taState[o]={lastIdx:-1,prevSource:NaN,prevEma1PcValue:NaN,prevEma1PcCount:0,prevEma1PcSum:0,prevEma2PcValue:NaN,prevEma2PcCount:0,prevEma2PcSum:0,prevEma1AbsValue:NaN,prevEma1AbsCount:0,prevEma1AbsSum:0,prevEma2AbsValue:NaN,prevEma2AbsCount:0,prevEma2AbsSum:0,currentSource:NaN,currentEma1PcValue:NaN,currentEma1PcCount:0,currentEma1PcSum:0,currentEma2PcValue:NaN,currentEma2PcCount:0,currentEma2PcSum:0,currentEma1AbsValue:NaN,currentEma1AbsCount:0,currentEma1AbsSum:0,currentEma2AbsValue:NaN,currentEma2AbsCount:0,currentEma2AbsSum:0});const c=e.taState[o];e.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevSource=c.currentSource,c.prevEma1PcValue=c.currentEma1PcValue,c.prevEma1PcCount=c.currentEma1PcCount,c.prevEma1PcSum=c.currentEma1PcSum,c.prevEma2PcValue=c.currentEma2PcValue,c.prevEma2PcCount=c.currentEma2PcCount,c.prevEma2PcSum=c.currentEma2PcSum,c.prevEma1AbsValue=c.currentEma1AbsValue,c.prevEma1AbsCount=c.currentEma1AbsCount,c.prevEma1AbsSum=c.currentEma1AbsSum,c.prevEma2AbsValue=c.currentEma2AbsValue,c.prevEma2AbsCount=c.currentEma2AbsCount,c.prevEma2AbsSum=c.currentEma2AbsSum),c.lastIdx=e.idx);const u=x.from(t).get(0);if(isNaN(u))return NaN;const h=isNaN(c.prevSource)?NaN:u-c.prevSource;if(c.currentSource=u,isNaN(h))return NaN;const f=Math.abs(h),l=2/(s+1),d=2/(a+1),g=2/(s+1),y=2/(a+1);let v=c.prevEma1PcCount,b=c.prevEma1PcSum,_=c.prevEma1PcValue;v++,v<=s?(b+=h,v===s&&(_=b/s)):_=h*l+_*(1-l);let N=c.prevEma1AbsCount,I=c.prevEma1AbsSum,E=c.prevEma1AbsValue;if(N++,N<=s?(I+=f,N===s&&(E=I/s)):E=f*g+E*(1-g),isNaN(_)||isNaN(E))return c.currentEma1PcCount=v,c.currentEma1PcSum=b,c.currentEma1PcValue=_,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=E,NaN;let M=c.prevEma2PcCount,D=c.prevEma2PcSum,F=c.prevEma2PcValue;M++,M<=a?(D+=_,M===a&&(F=D/a)):F=_*d+F*(1-d);let z=c.prevEma2AbsCount,Y=c.prevEma2AbsSum,G=c.prevEma2AbsValue;if(z++,z<=a?(Y+=E,z===a&&(G=Y/a)):G=E*y+G*(1-y),c.currentEma1PcCount=v,c.currentEma1PcSum=b,c.currentEma1PcValue=_,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=E,c.currentEma2PcCount=M,c.currentEma2PcSum=D,c.currentEma2PcValue=F,c.currentEma2AbsCount=z,c.currentEma2AbsSum=Y,c.currentEma2AbsValue=G,isNaN(F)||isNaN(G))return NaN;if(G===0)return e.precision(0);const oe=F/G;return e.precision(oe)}}function vh(e){return(t,i,r,n)=>{e.taState||(e.taState={});const a=n||"valuewhen";e.taState[a]||(e.taState[a]={lastIdx:-1,prevValues:[],currentValues:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevValues=[...s.currentValues]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=x.from(i).get(0),u=x.from(r).get(0),h=[...s.prevValues];if(o&&h.push(c),s.currentValues=h,isNaN(u)||u<0)return NaN;const f=h.length-1-u;if(f<0)return NaN;const l=h[f];return typeof l=="number"?e.precision(l):l}}function wh(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`variance_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length>n&&c.pop(),s.currentWindow=c,c.length<n)return NaN;let u=0,h=0;for(let d=0;d<n;d++)u+=c[d],h+=c[d]*c[d];const f=u/n,l=h/n-f*f;return e.precision(l)}}function bh(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={lastIdx:-1,prevCumulativePV:0,prevCumulativeVolume:0,prevLastSessionDate:null,currentCumulativePV:0,currentCumulativeVolume:0,currentLastSessionDate:null});const n=e.taState[r];e.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevCumulativePV=n.currentCumulativePV,n.prevCumulativeVolume=n.currentCumulativeVolume,n.prevLastSessionDate=n.currentLastSessionDate),n.lastIdx=e.idx);const a=x.from(t).get(0),s=x.from(e.data.volume).get(0),o=x.from(e.data.openTime).get(0),c=new Date(o).toISOString().slice(0,10);let u=n.prevCumulativePV,h=n.prevCumulativeVolume,f=n.prevLastSessionDate;if(f!==c&&(u=0,h=0,f=c),u+=a*s,h+=s,n.currentCumulativePV=u,n.currentCumulativeVolume=h,n.currentLastSessionDate=f,h===0)return NaN;const l=u/h;return e.precision(l)}}function Sh(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`vwma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],prevVolumeWindow:[],currentWindow:[],currentVolumeWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow],s.prevVolumeWindow=[...s.currentVolumeWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=e.get(e.data.volume,0),u=[...s.prevWindow],h=[...s.prevVolumeWindow];if(u.unshift(o),h.unshift(c),u.length>n&&(u.pop(),h.pop()),s.currentWindow=u,s.currentVolumeWindow=h,u.length<n)return NaN;let f=0,l=0;for(let g=0;g<n;g++)f+=u[g]*h[g],l+=h[g];const d=f/l;return e.precision(d)}}function Eh(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=e.taState[i];e.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=e.idx);const n=e.get(e.data.close,0),a=e.get(e.data.high,0),s=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(n)||isNaN(a)||isNaN(s))return r.currentCumulativeSum=r.prevCumulativeSum,e.precision(r.prevCumulativeSum);let c=0;if(!isNaN(o)){const h=Math.max(a,o),f=Math.min(s,o),l=n-o;l>0?c=n-f:l<0&&(c=n-h)}const u=r.prevCumulativeSum+c;return r.currentCumulativeSum=u,e.precision(u)}}function _h(e){return(t,i,r)=>{const n=x.from(i).get(0);e.taState||(e.taState={});const a=r||`wma_${n}`;e.taState[a]||(e.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const s=e.taState[a];e.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevWindow=[...s.currentWindow]),s.lastIdx=e.idx);const o=x.from(t).get(0),c=[...s.prevWindow];if(c.unshift(o),c.length<n)return s.currentWindow=c,NaN;c.length>n&&c.pop(),s.currentWindow=c;let u=0,h=0;for(let l=0;l<n;l++){const d=n-l;u+=c[l]*d,h+=d}const f=u/h;return e.precision(f)}}function Nh(e){return(t,i)=>{const r=x.from(t).get(0);e.taState||(e.taState={});const n=i||`wpr_${r}`;e.taState[n]||(e.taState[n]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const a=e.taState[n];e.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevHighWindow=[...a.currentHighWindow],a.prevLowWindow=[...a.currentLowWindow]),a.lastIdx=e.idx);const s=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(s)||isNaN(o)||isNaN(c))return a.currentHighWindow=[...a.prevHighWindow],a.currentLowWindow=[...a.prevLowWindow],NaN;const u=[...a.prevHighWindow],h=[...a.prevLowWindow];if(u.unshift(s),h.unshift(o),u.length>r&&(u.pop(),h.pop()),a.currentHighWindow=u,a.currentLowWindow=h,u.length<r)return NaN;let f=u[0],l=h[0];for(let y=1;y<r;y++)u[y]>f&&(f=u[y]),h[y]<l&&(l=h[y]);const d=f-l;if(d===0)return e.precision(0);const g=(f-c)/d*-100;return e.precision(g)}}function Ih(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),s=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(a)||isNaN(s))return NaN;const o=n-a;if(o===0)return e.precision(0);const c=(i-r)/o*s;return e.precision(c)}}var Ch=Object.defineProperty,kh=(e,t,i)=>t in e?Ch(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,k=(e,t,i)=>kh(e,typeof t!="symbol"?t+"":t,i);const Ah={accdist:mu,alma:xu,atr:gu,barssince:yu,bb:vu,bbw:wu,cci:bu,change:Su,cmo:Eu,cog:_u,correlation:Nu,cross:Iu,crossover:Cu,crossunder:ku,cum:Au,dev:Pu,dmi:Tu,ema:Ru,falling:Du,highest:Vu,highestbars:Lu,hma:Ou,iii:Mu,kc:Bu,kcw:Fu,linreg:Wu,lowest:ju,lowestbars:$u,macd:qu,median:Uu,mfi:Hu,mode:Ku,mom:Gu,nvi:zu,obv:Yu,param:Qu,percentile_linear_interpolation:Xu,percentile_nearest_rank:Zu,percentrank:Ju,pivothigh:th,pivotlow:rh,pvi:nh,pvt:sh,range:ah,rising:oh,rma:ch,roc:uh,rsi:hh,sar:lh,sma:ph,stdev:fh,stoch:dh,supertrend:mh,swma:xh,tr:gh,tsi:yh,valuewhen:vh,variance:wh,vwap:bh,vwma:Sh,wad:Eh,wma:_h,wpr:Nh,wvad:Ih};class Ph{constructor(t){this.context=t,k(this,"accdist"),k(this,"alma"),k(this,"atr"),k(this,"barssince"),k(this,"bb"),k(this,"bbw"),k(this,"cci"),k(this,"change"),k(this,"cmo"),k(this,"cog"),k(this,"correlation"),k(this,"cross"),k(this,"crossover"),k(this,"crossunder"),k(this,"cum"),k(this,"dev"),k(this,"dmi"),k(this,"ema"),k(this,"falling"),k(this,"highest"),k(this,"highestbars"),k(this,"hma"),k(this,"iii"),k(this,"kc"),k(this,"kcw"),k(this,"linreg"),k(this,"lowest"),k(this,"lowestbars"),k(this,"macd"),k(this,"median"),k(this,"mfi"),k(this,"mode"),k(this,"mom"),k(this,"nvi"),k(this,"obv"),k(this,"param"),k(this,"percentile_linear_interpolation"),k(this,"percentile_nearest_rank"),k(this,"percentrank"),k(this,"pivothigh"),k(this,"pivotlow"),k(this,"pvi"),k(this,"pvt"),k(this,"range"),k(this,"rising"),k(this,"rma"),k(this,"roc"),k(this,"rsi"),k(this,"sar"),k(this,"sma"),k(this,"stdev"),k(this,"stoch"),k(this,"supertrend"),k(this,"swma"),k(this,"tr"),k(this,"tsi"),k(this,"valuewhen"),k(this,"variance"),k(this,"vwap"),k(this,"vwma"),k(this,"wad"),k(this,"wma"),k(this,"wpr"),k(this,"wvad"),Object.entries(Ah).forEach(([i,r])=>{this[i]=r(t)})}}class Th{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}param(t,i=0,r){return x.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 Rh{constructor(t){this.context=t}param(t,i=0,r){return x.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,n=0){const a=String(t),s=String(i),o=String(r),c=Math.floor(Number(n))||0;if(s==="")return a;let u=0,h=0;for(;;){const f=a.indexOf(s,u);if(f===-1)return a;if(h===c)return a.substring(0,f)+o+a.substring(f+s.length);h++,u=f+s.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,n)=>i[n])}}class Dh{constructor(t){this.context=t}param(t,i=0,r){return x.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<3600*24?Math.ceil(t/60):t<=3600*24*7*52?t%(3600*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(3600*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 kr=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Vh=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Lh=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Oh=["open","high","low","close","title","color","editable","show_last","display","format","precision","force_overlay"],Mh=["open","high","low","close","title","color","wickcolor","editable","show_last","bordercolor","display","format","precision","force_overlay"],Ar=["color","offset","editable","show_last","title","display","force_overlay"],Bh=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],Pr={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"},Fh={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"},Wh={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"},jh={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},$h={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",wickcolor:"string",bordercolor:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Tr={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},qh={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class Uh{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=x.from(t[r]).get(0);return i}get linestyle_dashed(){return"linestyle_dashed"}get linestyle_dotted(){return"linestyle_dotted"}get linestyle_solid(){return"linestyle_solid"}get style_area(){return"style_area"}get style_areabr(){return"style_areabr"}get style_circles(){return"style_circles"}get style_columns(){return"style_columns"}get style_cross(){return"style_cross"}get style_histogram(){return"style_histogram"}get style_line(){return"style_line"}get style_linebr(){return"style_linebr"}get style_stepline(){return"style_stepline"}get style_stepline_diamond(){return"style_stepline_diamond"}get style_steplinebr(){return"style_steplinebr"}param(t,i=0,r){return x.from(t).get(i)}plotchar(...t){const i=Ce(t,kr,Pr),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);this.context.plots[n]||(this.context.plots[n]={data:[],options:{...s,style:"char"},title:n});const o=x.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o}),this.context.plots[n]}any(...t){const i=Ce(t,kr,Pr),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=s.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...s,overlay:c},title:n}}const o=x.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:s.color,offset:s.offset}}),this.context.plots[n]}plotshape(...t){const i=Ce(t,Vh,Fh),{series:r,title:n,...a}=i,s=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=s.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...s,style:"shape",shape:s.style,overlay:c},title:n}}const o=x.from(r).get(0);return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:o,options:s?.location==="absolute"||o?{text:s.text,textcolor:s.textcolor,color:s.color,offset:s.offset,shape:s.style,location:s.location,size:s.size}:void 0}),this.context.plots[n]}plotarrow(...t){const i=Ce(t,Lh,Wh),{series:r,title:n,...a}=i,s=x.from(r).get(0),o=this.extractPlotOptions(a);if(!this.context.plots[n]){const c=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[n]={data:[],options:{...o,style:"shape",overlay:c},title:n}}return this.context.plots[n].data.push({title:n,time:this.context.marketData[this.context.idx].openTime,value:s,options:typeof s=="number"&&!isNaN(s)&&s!==0?{text:void 0,textcolor:void 0,color:s>0?o.colorup:o.colordown,offset:o.offset,shape:s>0?"arrowup":"arrowdown",location:s>0?"belowbar":"abovebar",height:o.maxheight}:void 0}),this.context.plots[n]}plotbar(...t){const i=Ce(t,Oh,jh),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const f=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"bar",overlay:f},title:o}}const h=[x.from(r).get(0),x.from(n).get(0),x.from(a).get(0),x.from(s).get(0)];this.context.plots[o].data.push({title:o,time:this.context.marketData[this.context.idx].openTime,value:h,options:{color:u.color}})}plotcandle(...t){const i=Ce(t,Mh,$h),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const f=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"candle",overlay:f},title:o}}const h=[x.from(r).get(0),x.from(n).get(0),x.from(a).get(0),x.from(s).get(0)];return this.context.plots[o].data.push({title:o,time:this.context.marketData[this.context.idx].openTime,value:h,options:{color:u.color,wickcolor:u.wickcolor,bordercolor:u.bordercolor}}),this.context.plots[o]}bgcolor(...t){const i=Ce(t,Ar,Tr),{title:r,...n}=i,a=this.extractPlotOptions(n);if(!this.context.plots[r]){const s=a.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[r]={data:[],options:{...a,style:"background",overlay:s},title:r}}this.context.plots[r].data.push({title:r,time:this.context.marketData[this.context.idx].openTime,value:a.color&&a.color!=="na"&&a?.color.toString()!=="NaN",options:{color:a.color}})}barcolor(...t){const i=Ce(t,Ar,Tr),{title:r,...n}=i,a=this.extractPlotOptions(n);return this.context.plots[r]||(this.context.plots[r]={data:[],options:{...a,style:"barcolor"},title:r}),this.context.plots[r].data.push({title:r,time:this.context.marketData[this.context.idx].openTime,value:a.color&&a.color!=="na"&&a?.color.toString()!=="NaN",options:{color:a.color}}),this.context.plots[r]}}class Hh{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 x.from(t).get(i)}any(t,i,r,n,a,s,o){return this.context.pine.plot.any(t,{title:i,color:r,linestyle:n,linewidth:a,editable:s,display:o})}}class Kh{constructor(t){this.context=t}param(t,i=0,r){return x.from(t).get(i)}any(...t){const i=Ce(t,Bh,qh),{plot1:r,plot2:n,color:a,title:s,editable:o,show_last:c,fillgaps:u,display:h}=i;this.context.plots[s]||(this.context.plots[s]={title:s,plot1:r.title,plot2:n.title,options:{color:a,editable:o,show_last:c,fillgaps:u,display:h,style:"fill"}})}}var Gh=Object.defineProperty,zh=(e,t,i)=>t in e?Gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>zh(e,typeof t!="symbol"?t+"":t,i);const Rr=class ni{constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:a,sDate:s,eDate:o,fullContext:c,inputs:u}){j(this,"data",{open:new x([]),high:new x([]),low:new x([]),close:new x([]),volume:new x([]),hl2:new x([]),hlc3:new x([]),ohlc4:new x([]),hlcc4:new x([])}),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,"lctx",new Map),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"),j(this,"inputs",{}),j(this,"_callStack",[]),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=n,this.limit=a,this.sDate=s,this.eDate=o,this.fullContext=c||this,this.inputs=u||{};const h=new sc(this),f={Type:h.Type.bind(h),na:h.na.bind(h),color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),bool:h.bool.bind(h)},l=this;this.pine={input:new Ic(this),ta:new Ph(this),math:new ou(this),request:new du(this),array:new Aa(this),map:new Ua(this),matrix:new Go(this),syminfo:null,timeframe:new Dh(this),barstate:new Xo(this),get bar_index(){return l.idx},get last_bar_index(){return l.data.close.length-1},get last_bar_time(){return l.data.openTime.get(l.data.openTime.length-1)},get timenow(){return new Date().getTime()},get inputs(){return l.inputs},log:new Th(this),str:new Rh(this),...f,...pa};const d=new Uh(this),g=new Hh(this),y=new Kh(this);this.bindContextObject(d,["plotchar","plotshape","plotarrow","plotbar","plotcandle","bgcolor","barcolor"]),this.bindContextObject(d,["any","param","linestyle_dashed","linestyle_dotted","linestyle_solid","style_area","style_areabr","style_circles","style_columns","style_cross","style_histogram","style_line","style_linebr","style_stepline","style_stepline_diamond","style_steplinebr"],"plot"),this.bindContextObject(g,["any","style_dashed","style_solid","style_dotted","param"],"hline"),this.bindContextObject(y,["any","param"],"fill")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const n=r?this.pine[r]:this.pine;for(const a of i)typeof t[a]=="function"?n[a]=t[a].bind(t):n[a]=t[a]}init(t,i,r=0){let n;return i instanceof x?n=i.get(0):Array.isArray(i)?Array.isArray(i[0])?n=i[0]:n=i[i.length-1+r]:n=i,t?t instanceof x?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new x(t)):new x([n]):new x([n])}initVar(t,i){if(t)return t;let r;return i instanceof x?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 x([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 x?i?new x(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new x(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new x(this.params[r],0)))}get(t,i){if(t instanceof x)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 x){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}pushId(t){this._callStack.push(t)}popId(){this._callStack.pop()}peekId(){return this._callStack.length>0?this._callStack[this._callStack.length-1]:""}peekCtx(){const t=this.peekId();if(!t)return this;let i=this.lctx.get(t);return i||(i={id:t,let:{},const:{},var:{}},this.lctx.set(t,i)),i}call(t,i,...r){this.pushId(i);try{return t(...r)}finally{this.popId()}}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,fill:this.pine.fill,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}`;ni._deprecationWarningsShown.has(r)||(ni._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(Rr,"_deprecationWarningsShown",new Set);let Jt=Rr;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,Dr=(e,t,i)=>Qh(e,typeof t!="symbol"?t+"":t,i);class ei{constructor(t,i={}){Dr(this,"source"),Dr(this,"inputs"),this.source=t,this.inputs=i}}var Xh=Object.defineProperty,Zh=(e,t,i)=>t in e?Xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,J=(e,t,i)=>Zh(e,typeof t!="symbol"?t+"":t,i);class ti{constructor(t,i,r,n,a,s){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=n,this.sDate=a,this.eDate=s,J(this,"data",[]),J(this,"open",[]),J(this,"high",[]),J(this,"low",[]),J(this,"close",[]),J(this,"volume",[]),J(this,"hl2",[]),J(this,"hlc3",[]),J(this,"ohlc4",[]),J(this,"hlcc4",[]),J(this,"openTime",[]),J(this,"closeTime",[]),J(this,"_readyPromise",null),J(this,"_ready",!1),J(this,"_debugSettings",{ln:!1,debug:!1}),J(this,"_transpiledCode",null),J(this,"_isSecondaryContext",!1),J(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,n,a,s).then(c=>{const u=c;this.data=u;const h=u.map(E=>E.open),f=u.map(E=>E.close),l=u.map(E=>E.high),d=u.map(E=>E.low),g=u.map(E=>E.volume),y=u.map(E=>(E.high+E.low+E.close)/3),v=u.map(E=>(E.high+E.low)/2),b=u.map(E=>(E.high+E.low+E.open+E.close)/4),_=u.map(E=>(E.high+E.low+E.close+E.close)/4),N=u.map(E=>E.openTime),I=u.map(E=>E.closeTime);this.open=h,this.close=f,this.high=l,this.low=d,this.volume=g,this.hl2=v,this.hlc3=y,this.ohlc4=b,this.hlcc4=_,this.openTime=N,this.closeTime=I,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(E=>{this._syminfo=E,this._ready=!0,o(!0)}).catch(E=>{console.warn("Failed to get symbol info, using default values:",E),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,n,a,s){return Array.isArray(t)?t:t.getMarketData(i,r,n,a,s)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){let n,a={};if(t instanceof ei?(n=t.source,a=t.inputs||{}):n=t,r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(n,a,i,r,s)}else return this._runComplete(n,a,i)}stream(t,i={}){const{live:r=!0,interval:n=1e3}=i,a=i.pageSize||this.data.length;let s,o={};t instanceof ei?(s=t.source,o=t.inputs||{}):s=t;const c={data:[],error:[]};let u=!1;const h=(d,...g)=>{c[d]&&c[d].forEach(y=>y(...g))},f=(d,g)=>{c[d]||(c[d]=[]),c[d].push(g)},l=()=>{u=!0};return(async()=>{try{const d=typeof this.eDate>"u"&&!Array.isArray(this.source)&&r,g=this._runPaginated(s,o,void 0,a,d);for await(const y of g){if(u)break;if(y===null){await new Promise(v=>setTimeout(v,n));continue}if(h("data",y),d&&!u){const v=y.marketData[y.idx];v&&v.closeTime<Date.now()||await new Promise(b=>setTimeout(b,n))}}}catch(d){h("error",d)}})(),{on:f,stop:l}}async _runComplete(t,i,r){await this.ready(),r||(r=this.data.length);const n=this._initializeContext(t,i,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(n,this._transpiledCode,this.data.length-r,this.data.length),n}async*_runPaginated(t,i,r,n,a=!1){await this.ready(),r||(r=this.data.length);const s=this._initializeContext(t,i,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let o=this.data.length-r;for(;;){const c=this.data.length-o;if(c>0){const f=Math.min(c,n),l=this._getResultLength(s.result);await this._executeIterations(s,this._transpiledCode,o,o+f),o+=f,yield this._createPageContext(s,l);continue}if(!a||Array.isArray(this.source))break;const{newCandles:u,updatedLastCandle:h}=await this._updateMarketData();if(u===0&&!h){yield null;continue}this._removeLastResult(s),o=this.data.length-(u+1),s.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 Jt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t,inputs:t.inputs});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 n in t.result)Array.isArray(t.result[n])?r.result[n]=t.result[n].slice(i):r.result[n]=t.result[n]}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,n=this.data[r].openTime;try{const a=await i.getMarketData(this.tickerId,this.timeframe,void 0,n,t);if(!a||a.length===0)return{newCandles:0,updatedLastCandle:!1};let s=!1,o=0;for(let c=0;c<a.length;c++){const u=a[c];u.openTime===n?(this._replaceCandle(r,u),s=!0):u.openTime>n&&(this._appendCandle(u),o++)}return{newCandles:o,updatedLastCandle:s}}catch(a){return console.error("Error updating market data:",a),{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 n in t.result)Array.isArray(t.result[n])&&t.result[n].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();const i=["const","var","let","params"],r=n=>{for(let a of i)if(n[a])for(let s in n[a]){const o=n[a][s];o instanceof x?o.data.pop():Array.isArray(o)&&o.pop()}};r(t),t.lctx&&t.lctx.forEach(n=>r(n))}_initializeContext(t,i={},r=!1){const n=new Jt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,inputs:i});return n.pine.syminfo=this._syminfo,n.pineTSCode=t,n.isSecondaryContext=r,n.data.close=new x([]),n.data.open=new x([]),n.data.high=new x([]),n.data.low=new x([]),n.data.volume=new x([]),n.data.hl2=new x([]),n.data.hlc3=new x([]),n.data.ohlc4=new x([]),n.data.hlcc4=new x([]),n.data.openTime=new x([]),n.data.closeTime=new x([]),n}_transpileCode(t){return Cs.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,n){const a=["const","var","let","params"];for(let s=r;s<n;s++){t.idx=s,t.data.close.data.push(this.close[s]),t.data.open.data.push(this.open[s]),t.data.high.data.push(this.high[s]),t.data.low.data.push(this.low[s]),t.data.volume.data.push(this.volume[s]),t.data.hl2.data.push(this.hl2[s]),t.data.hlc3.data.push(this.hlc3[s]),t.data.ohlc4.data.push(this.ohlc4[s]),t.data.hlcc4.data.push(this.hlcc4[s]),t.data.openTime.data.push(this.openTime[s]),t.data.closeTime.data.push(this.closeTime[s]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let u in o){t.result[u]===void 0&&(t.result[u]=[]);let h;o[u]instanceof x?h=o[u].get(0):Array.isArray(o[u])?h=o[u][o[u].length-1]:h=o[u],t.result[u].push(h)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);const c=u=>{for(let h of a)if(u[h])for(let f in u[h]){const l=u[h][f];if(l instanceof x){const d=l.get(0);l.data.push(d)}else if(Array.isArray(l)){const d=l[l.length-1];l.push(d)}}};c(t),t.lctx&&t.lctx.forEach(u=>c(u))}}}var Jh=Object.defineProperty,el=(e,t,i)=>t in e?Jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ct=(e,t,i)=>el(e,typeof t!="symbol"?t+"":t,i);const ii="https://api.binance.com/api/v3",Vr="https://api.binance.us/api/v3",ri={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 tl{constructor(t=300*1e3){Ct(this,"cache"),Ct(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 il{constructor(){Ct(this,"cacheManager"),Ct(this,"activeApiUrl",null),this.cacheManager=new tl(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${ii}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ii,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Vr}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Vr,this.activeApiUrl}catch{}return ii}async getMarketDataInterval(t,i,r,n){try{const a=ri[i.toUpperCase()];if(!a)return console.error(`Unsupported timeframe: ${i}`),[];const s={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3};let o=[],c=r;const u=n,h=s[a];if(!h)return console.error(`Duration not defined for interval: ${a}`),[];for(;c<u;){const f=Math.min(c+1e3*h,u),l=await this.getMarketData(t,i,1e3,c,f);if(l.length===0)break;o=o.concat(l),c=l[l.length-1].closeTime+1}return o}catch(a){return console.error("Error in getMarketDataInterval:",a),[]}}async getMarketDataBackwards(t,i,r,n){let a=r,s=[],o=n,c=0;const u=Math.ceil(r/1e3)+5;for(;a>0&&c<u;){c++;const h=Math.min(a,1e3),f=await this.getMarketData(t,i,h,void 0,o);if(f.length===0||(s=f.concat(s),a-=f.length,o=f[0].openTime-1,f.length<h))break}return s}async getMarketData(t,i,r,n,a){try{const s=a!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:n,eDate:a};if(s){const l=this.cacheManager.get(o);if(l)return l}const c=ri[i.toUpperCase()];if(!c)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,n,a)){if(n&&a){const l=await this.getMarketDataInterval(t,i,n,a),d=r?l.slice(0,r):l;return this.cacheManager.set(o,d),d}else if(r&&r>1e3){const l=await this.getMarketDataBackwards(t,i,r,a);return this.cacheManager.set(o,l),l}}let u=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${c}`;r&&(u+=`&limit=${Math.min(r,1e3)}`),n&&(u+=`&startTime=${n}`),a&&(u+=`&endTime=${a}`);const h=await fetch(u);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const f=(await h.json()).map(l=>({openTime:parseInt(l[0]),open:parseFloat(l[1]),high:parseFloat(l[2]),low:parseFloat(l[3]),close:parseFloat(l[4]),volume:parseFloat(l[5]),closeTime:parseInt(l[6]),quoteAssetVolume:parseFloat(l[7]),numberOfTrades:parseInt(l[8]),takerBuyBaseAssetVolume:parseFloat(l[9]),takerBuyQuoteAssetVolume:parseFloat(l[10]),ignore:l[11]}));return s&&this.cacheManager.set(o,f),f}catch(s){return console.error("Error in binance.klines:",s),[]}}shouldPaginate(t,i,r,n){if(i&&i>1e3)return!0;if(r&&n){const a=ri[t.toUpperCase()],s={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3}[a];if(s)return Math.ceil((n-r)/s)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),n=t,a="";t.endsWith(".P")?(i="futures",n=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",a="Perpetual"):t.includes("_")&&(i="futures",n=t,r="https://dapi.binance.com/dapi/v1",a="Delivery");const s=i==="crypto"?`${r}/exchangeInfo?symbol=${n}`:`${r}/exchangeInfo`,o=await fetch(s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const c=(await o.json()).symbols;if(!c||c.length===0)return console.error(`Symbol ${t} not found`),null;const u=i==="futures"?c.find(N=>N.symbol===n):c[0];if(!u)return console.error(`Symbol ${n} not found in exchange info`),null;const h=u.filters?.find(N=>N.filterType==="PRICE_FILTER"),f=u.filters?.find(N=>N.filterType==="LOT_SIZE"),l=h?parseFloat(h.tickSize):.01,d=f?parseFloat(f.minQty):0,g=Math.round(1/l),y=u.baseAsset,v=u.quoteAsset,b=a?` ${a}`:"",_=`${y} / ${v}${b}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:_,type:i,main_tickerid:`BINANCE:${t}`,current_contract:a,isin:"",basecurrency:y,currency:v,timezone:"Etc/UTC",country:"",mintick:l,pricescale:g,minmove:1,pointvalue:u.contractSize||1,mincontract:d,session:"24x7",volumetype:"base",expiration_date:u.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 rl{async getMarketData(){return[]}}const nl=typeof process<"u"&&process.versions&&process.versions.node;let kt=null;if(nl)try{kt=new rl}catch{kt=null}const sl={Binance:new il,...kt?{Mock:kt}:{}};Re.Context=Jt,Re.Indicator=ei,Re.PineTS=ti,Re.Provider=sl,Object.defineProperty(Re,"__esModule",{value:!0})}));
126
126
  ;var PineTS = PineTSLib.PineTS;PineTS.Provider = PineTSLib.Provider;PineTS.Context = PineTSLib.Context;//# sourceMappingURL=pinets.min.browser.js.map