pinets 0.8.9 → 0.8.11
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.
- package/dist/pinets.min.browser.es.js +18 -18
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +19 -19
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +19 -19
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +19 -19
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +1 -0
- package/dist/types/marketData/Binance/BinanceProvider.class.d.ts +1 -0
- package/dist/types/marketData/IProvider.d.ts +1 -0
- package/dist/types/marketData/Mock/MockProvider.class.d.ts +4 -1
- package/dist/types/namespaces/Core.d.ts +28 -0
- package/dist/types/namespaces/Time.d.ts +64 -0
- package/dist/types/namespaces/Types.d.ts +24 -0
- package/dist/types/namespaces/chart/ChartHelper.d.ts +22 -0
- package/dist/types/namespaces/chart/ChartPointObject.d.ts +8 -0
- package/dist/types/namespaces/label/LabelHelper.d.ts +53 -0
- package/dist/types/namespaces/label/LabelObject.d.ts +21 -0
- package/package.json +109 -109
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
var Vr=[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],Ti=[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],Lr="\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",Ri="\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",Ct={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"},kt="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:kt,"5module":kt+" export import",6:kt+" const class extends export import super"},Mr=/^in(stanceof)?$/,Br=new RegExp("["+Ri+"]"),Fr=new RegExp("["+Ri+Lr+"]");function Lt(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 Re(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Br.test(String.fromCharCode(e)):t===!1?!1:Lt(e,Ti)}function Xe(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&&Fr.test(String.fromCharCode(e)):t===!1?!1:Lt(e,Ti)||Lt(e,Vr)}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},Ut={};function L(e,t){return t===void 0&&(t={}),t.keyword=e,Ut[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})},we=/\r\n?|\n|\u2028|\u2029/,Wr=new RegExp(we.source,"g");function Je(e){return e===10||e===13||e===8232||e===8233}function Di(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(Je(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Vi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Li=Object.prototype,jr=Li.hasOwnProperty,$r=Li.toString,et=Object.hasOwn||(function(e,t){return jr.call(e,t)}),ti=Array.isArray||(function(e){return $r.call(e)==="[object Array]"}),ii=Object.create(null);function Be(e){return ii[e]||(ii[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function De(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var qr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,at=function(t,i){this.line=t,this.column=i};at.prototype.offset=function(t){return new at(this.line,this.column+t)};var Et=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function Oi(e,t){for(var i=1,r=0;;){var n=Di(e,r,t);if(n<0)return new at(i,t-r);++i,r=n}}var Ot={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},ri=!1;function Ur(e){var t={};for(var i in Ot)t[i]=e&&et(e,i)?e[i]:Ot[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ri&&typeof console=="object"&&console.warn&&(ri=!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),
|
|
20
|
-
`,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(we).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(ot),this.regexpState=null,this.privateNameStack=[]},Pe={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)};Pe.inFunction.get=function(){return(this.currentVarScope().flags&tt)>0};Pe.inGenerator.get=function(){return(this.currentVarScope().flags&Mi)>0&&!this.currentVarScope().inClassFieldInit};Pe.inAsync.get=function(){return(this.currentVarScope().flags&Ht)>0&&!this.currentVarScope().inClassFieldInit};Pe.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&ct)return!1;if(t.flags&tt)return(t.flags&Ht)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Pe.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Kt)>0||i||this.options.allowSuperOutsideMethod};Pe.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Wi)>0};Pe.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Pe.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(tt|ct))>0||i};Pe.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ct)>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,Pe);var ce=X.prototype,Kr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ce.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){ge.lastIndex=e,e+=ge.exec(this.input)[0].length;var t=Kr.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==="}"||we.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++}};ce.eat=function(e){return this.type===e?(this.next(),!0):!1};ce.isContextual=function(e){return this.type===p.name&&this.value===e&&!this.containsEsc};ce.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};ce.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};ce.canInsertSemicolon=function(){return this.type===p.eof||this.type===p.braceR||we.test(this.input.slice(this.lastTokEnd,this.start))};ce.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};ce.semicolon=function(){!this.eat(p.semi)&&!this.insertSemicolon()&&this.unexpected()};ce.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};ce.expect=function(e){this.eat(e)||this.unexpected()};ce.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var _t=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ce.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")}};ce.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")};ce.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")};ce.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 Qt={kind:"loop"},Gr={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(Re(r,!0)){for(var n=i+1;Xe(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(i,n);if(!Mr.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!we.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Xe(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(Qt),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(Qt),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 _t,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,nt|(i?0:Mt),!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(Gr),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(),we.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 zr=[];A.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Fi:0),this.checkLValPattern(e,t?$i: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(Qt),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"?Yt:Le,!1)};var nt=1,Mt=2,Ui=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&Mt&&this.unexpected(),e.generator=this.eat(p.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&nt&&(e.id=t&Ui&&this.type!==p.name?null:this.parseIdent(),e.id&&!(t&Mt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Yt:Le:ji));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(zt(e.async,e.generator)),t&nt||(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&nt?"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"&&Yr(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&&xt(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&&xt(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(xt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&xt(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(ct|Kt);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];et(t,s.name)||(n?n.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function Yr(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 xt(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,nt|Ui,!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),et(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=zr,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;et(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 qr.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 be=X.prototype;be.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};be.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};be.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};be.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")};be.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()};be.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};be.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};be.parseBindingListItem=function(e){return e};be.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")};be.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&&(et(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==qi&&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")}};be.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)}};be.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 _e=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 _e("{",!1),b_expr:new _e("{",!0),b_tmpl:new _e("${",!1),p_stat:new _e("(",!1),p_expr:new _e("(",!0),q_tmpl:new _e("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new _e("function",!1),f_expr:new _e("function",!0),f_expr_gen:new _e("function",!0,!1,null,!0),f_gen:new _e("function",!1,!1,null,!0)},it=X.prototype;it.initialContext=function(){return[U.b_stat]};it.curContext=function(){return this.context[this.context.length-1]};it.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?we.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};it.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};it.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};it.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&&we.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 _t,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"&&Hi(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Bt(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 Hi(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Hi(e.expression)}function Bt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Bt(e.expression)||e.type==="ParenthesizedExpression"&&Bt(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 _t,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 _t,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 Qr=[];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=Qr,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
|
+
var Jr=[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,78,5,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,199,7,137,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,55,9,266,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,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],qi=[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,7,25,39,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,5,57,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,24,43,261,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,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,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,208,30,2,2,2,1,2,6,3,4,10,1,225,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,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],en="\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-\u1ADD\u1AE0-\u1AEB\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",Hi="\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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\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-\uA7DC\uA7F1-\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",Mt={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"},Bt="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",tn={5:Bt,"5module":Bt+" export import",6:Bt+" const class extends export import super"},zi=/^in(stanceof)?$/,rn=new RegExp("["+Hi+"]"),nn=new RegExp("["+Hi+en+"]");function Kt(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 Pe(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&rn.test(String.fromCharCode(e)):t===!1?!1:Kt(e,qi)}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&&nn.test(String.fromCharCode(e)):t===!1?!1:Kt(e,qi)||Kt(e,Jr)}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 ye(e,t){return new M(e,{beforeExpr:!0,binop:t})}var be={beforeExpr:!0},pe={startsExpr:!0},ii={};function O(e,t){return t===void 0&&(t={}),t.keyword=e,ii[e]=new M(e,t)}var f={num:new M("num",pe),regexp:new M("regexp",pe),string:new M("string",pe),name:new M("name",pe),privateId:new M("privateId",pe),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(",",be),semi:new M(";",be),colon:new M(":",be),dot:new M("."),question:new M("?",be),questionDot:new M("?."),arrow:new M("=>",be),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",be),backQuote:new M("`",pe),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:ye("||",1),logicalAND:ye("&&",2),bitwiseOR:ye("|",3),bitwiseXOR:ye("^",4),bitwiseAND:ye("&",5),equality:ye("==/!=/===/!==",6),relational:ye("</>/<=/>=",7),bitShift:ye("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ye("%",10),star:ye("*",10),slash:ye("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:ye("??",1),_break:O("break"),_case:O("case",be),_catch:O("catch"),_continue:O("continue"),_debugger:O("debugger"),_default:O("default",be),_do:O("do",{isLoop:!0,beforeExpr:!0}),_else:O("else",be),_finally:O("finally"),_for:O("for",{isLoop:!0}),_function:O("function",pe),_if:O("if"),_return:O("return",be),_switch:O("switch"),_throw:O("throw",be),_try:O("try"),_var:O("var"),_const:O("const"),_while:O("while",{isLoop:!0}),_with:O("with"),_new:O("new",{beforeExpr:!0,startsExpr:!0}),_this:O("this",pe),_super:O("super",pe),_class:O("class",pe),_extends:O("extends",be),_export:O("export"),_import:O("import",pe),_null:O("null",pe),_true:O("true",pe),_false:O("false",pe),_in:O("in",{beforeExpr:!0,binop:7}),_instanceof:O("instanceof",{beforeExpr:!0,binop:7}),_typeof:O("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:O("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:O("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},me=/\r\n?|\n|\u2028|\u2029/,sn=new RegExp(me.source,"g");function ot(e){return e===10||e===13||e===8232||e===8233}function Ki(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(ot(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Gi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ie=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Yi=Object.prototype,an=Yi.hasOwnProperty,on=Yi.toString,ct=Object.hasOwn||(function(e,t){return an.call(e,t)}),fi=Array.isArray||(function(e){return on.call(e)==="[object Array]"}),mi=Object.create(null);function $e(e){return mi[e]||(mi[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Oe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var cn=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ft=function(t,i){this.line=t,this.column=i};ft.prototype.offset=function(t){return new ft(this.line,this.column+t)};var Pt=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function Qi(e,t){for(var i=1,r=0;;){var n=Ki(e,r,t);if(n<0)return new ft(i,t-r);++i,r=n}}var Gt={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},di=!1;function un(e){var t={};for(var i in Gt)t[i]=e&&ct(e,i)?e[i]:Gt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!di&&typeof console=="object"&&console.warn&&(di=!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),fi(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}if(fi(t.onComment)&&(t.onComment=hn(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function hn(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 Pt(this,s,o)),e.ranges&&(c.range=[n,a]),t.push(c)}}var et=1,tt=2,ri=4,Xi=8,ni=16,Zi=32,Dt=64,Ji=128,it=256,mt=512,er=1024,Rt=et|tt|it;function si(e,t){return tt|(e?ri:0)|(t?Xi:0)}var wt=0,ai=1,Me=2,tr=3,ir=4,rr=5,X=function(t,i,r){this.options=t=un(t),this.sourceFile=t.sourceFile,this.keywords=$e(tn[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=Mt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=$e(n);var a=(n?n+" ":"")+Mt.strict;this.reservedWordsStrict=$e(a),this.reservedWordsStrictBind=$e(a+" "+Mt.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(me).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=f.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(this.options.sourceType==="commonjs"?tt:et),this.regexpState=null,this.privateNameStack=[]},Se={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};X.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Se.inFunction.get=function(){return(this.currentVarScope().flags&tt)>0};Se.inGenerator.get=function(){return(this.currentVarScope().flags&Xi)>0};Se.inAsync.get=function(){return(this.currentVarScope().flags&ri)>0};Se.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(it|mt))return!1;if(i&tt)return(i&ri)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Se.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&et)};Se.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&Dt)>0||this.options.allowSuperOutsideMethod};Se.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ji)>0};Se.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Se.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(it|mt)||i&tt&&!(i&ni))return!0}return!1};Se.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&er||!this.inModule&&t&et)};Se.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&it)>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,Se);var le=X.prototype,ln=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;le.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){ie.lastIndex=e,e+=ie.exec(this.input)[0].length;var t=ln.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){ie.lastIndex=e+t[0].length;var i=ie.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||me.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,ie.lastIndex=e,e+=ie.exec(this.input)[0].length,this.input[e]===";"&&e++}};le.eat=function(e){return this.type===e?(this.next(),!0):!1};le.isContextual=function(e){return this.type===f.name&&this.value===e&&!this.containsEsc};le.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};le.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};le.canInsertSemicolon=function(){return this.type===f.eof||this.type===f.braceR||me.test(this.input.slice(this.lastTokEnd,this.start))};le.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};le.semicolon=function(){!this.eat(f.semi)&&!this.insertSemicolon()&&this.unexpected()};le.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};le.expect=function(e){this.eat(e)||this.unexpected()};le.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Vt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};le.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")}};le.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")};le.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")};le.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!==f.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==="commonjs"?"script":this.options.sourceType,this.finishNode(e,"Program")};var oi={kind:"loop"},pn={kind:"switch"};A.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ie.lastIndex=this.pos;var t=ie.exec(this.input),i=this.pos+t[0].length,r=this.fullCharCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(Pe(r)){var n=i;do i+=r<=65535?1:2;while(qe(r=this.fullCharCodeAt(i)));if(r===92)return!0;var a=this.input.slice(n,i);if(!zi.test(a))return!0}return!1};A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ie.lastIndex=this.pos;var e=ie.exec(this.input),t=this.pos+e[0].length,i;return!me.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(qe(i=this.fullCharCodeAt(t+8))||i===92))};A.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;ie.lastIndex=this.pos;var i=ie.exec(this.input),r=this.pos+i[0].length;if(me.test(this.input.slice(this.pos,r)))return!1;if(e){var n=r+5,a;if(this.input.slice(r,n)!=="using"||n===this.input.length||qe(a=this.fullCharCodeAt(n))||a===92)return!1;ie.lastIndex=n;var s=ie.exec(this.input);if(r=n+s[0].length,s&&me.test(this.input.slice(n,r)))return!1}var o=this.fullCharCodeAt(r);if(!Pe(o)&&o!==92)return!1;var c=r;do r+=o<=65535?1:2;while(qe(o=this.fullCharCodeAt(r)));if(o===92)return!0;var u=this.input.slice(c,r);return!(zi.test(u)||t&&u==="of")};A.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)};A.isUsing=function(e){return this.isUsingKeyword(!1,e)};A.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),a;switch(this.isLet(e)&&(r=f._var,a="let"),r){case f._break:case f._continue:return this.parseBreakContinueStatement(n,r.keyword);case f._debugger:return this.parseDebuggerStatement(n);case f._do:return this.parseDoStatement(n);case f._for:return this.parseForStatement(n);case f._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case f._class:return e&&this.unexpected(),this.parseClass(n,!0);case f._if:return this.parseIfStatement(n);case f._return:return this.parseReturnStatement(n);case f._switch:return this.parseSwitchStatement(n);case f._throw:return this.parseThrowStatement(n);case f._try:return this.parseTryStatement(n);case f._const:case f._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(n,a);case f._while:return this.parseWhileStatement(n);case f._with:return this.parseWithStatement(n);case f.braceL:return this.parseBlock(!0,n);case f.semi:return this.parseEmptyStatement(n);case f._export:case f._import:if(this.options.ecmaVersion>10&&r===f._import){ie.lastIndex=this.pos;var s=ie.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===f._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.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(u)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),u==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(n,!1,u),this.semicolon(),this.finishNode(n,"VariableDeclaration");var h=this.value,p=this.parseExpression();return r===f.name&&p.type==="Identifier"&&this.eat(f.colon)?this.parseLabeledStatement(n,h,p,e):this.parseExpressionStatement(n,p)}};A.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(f.semi)||this.insertSemicolon()?e.label=null:this.type!==f.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(oi),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(f._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(f.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(oi),this.enterScope(0),this.expect(f.parenL),this.type===f.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===f._var||this.type===f._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(e,r,t)}var a=this.isContextual("let"),s=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var c=this.startNode();return this.next(),o==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(c,!0,o),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(e,c,t)}var u=this.containsEsc,h=new Vt,p=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===f._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===f._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(l.start===p&&!u&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&s&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};A.parseForAfterInit=function(e,t,i){return(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===f._in?i>-1&&this.unexpected(i):e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))};A.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,lt|(i?0:Yt),!1,t)};A.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(f._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};A.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(f.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(f.braceL),this.labels.push(pn),this.enterScope(er);for(var t,i=!1;this.type!==f.braceR;)if(this.type===f._case||this.type===f._default){var r=this.type===f._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(f.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(),me.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 fn=[];A.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Zi:0),this.checkLValPattern(e,t?ir:Me),this.expect(f.parenR),e};A.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===f._catch){var t=this.startNode();this.next(),this.eat(f.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(f._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(oi),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===f._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(f.braceL),e&&this.enterScope(0);this.type!==f.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(f.semi),e.test=this.type===f.semi?null:this.parseExpression(),this.expect(f.semi),e.update=this.type===f.parenR?null:this.parseExpression(),this.expect(f.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};A.parseForIn=function(e,t){var i=this.type===f._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(f.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(f.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==f._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!r&&n.id.type!=="Identifier"&&!(t&&(this.type===f._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(f.comma))break}return e};A.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?ai:Me,!1)};var lt=1,Yt=2,nr=4;A.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===f.star&&t&Yt&&this.unexpected(),e.generator=this.eat(f.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t<&&(e.id=t&nr&&this.type!==f.name?null:this.parseIdent(),e.id&&!(t&Yt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?ai:Me:tr));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(si(e.async,e.generator)),t<||(e.id=this.type===f.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<?"FunctionDeclaration":"FunctionExpression")};A.parseFunctionParams=function(e){this.expect(f.parenL),e.params=this.parseBindingList(f.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(f.braceL);this.type!==f.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"&&mn(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(f.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(f.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===f.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===f.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(t>=9||!a)&&this.eat(f.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===f.parenL||s!=="method"||n||a){var u=!i.static&&_t(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===f.name||this.type===f.privateId||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword};A.parseClassElementName=function(e){this.type===f.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&&_t(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){return _t(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&_t(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(f.eq)?(this.enterScope(mt|Dt),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")};A.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(it|Dt);this.type!==f.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===f.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Me,!1)):(t===!0&&this.unexpected(),e.id=null)};A.parseClassSuper=function(e){e.superClass=this.eat(f._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];ct(t,s.name)||(n?n.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function mn(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 _t(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!==f.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(f.star))return this.parseExportAllDeclaration(e,t);if(this.eat(f._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,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==f.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.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};A.parseExportDeclaration=function(e){return this.parseStatement(null)};A.parseExportDefaultDeclaration=function(){var e;if(this.type===f._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,lt|nr,!1,e)}else if(this.type===f._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),ct(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(f.braceL);!this.eat(f.braceR);){if(i)i=!1;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;t.push(this.parseExportSpecifier(e))}return t};A.parseImport=function(e){return this.next(),this.type===f.string?(e.specifiers=fn,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===f.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,Me),this.finishNode(e,"ImportSpecifier")};A.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Me),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,Me),this.finishNode(e,"ImportNamespaceSpecifier")};A.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===f.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(f.comma)))return e;if(this.type===f.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(f.braceL);!this.eat(f.braceR);){if(t)t=!1;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;e.push(this.parseImportSpecifier())}return e};A.parseWithClause=function(){var e=[];if(!this.eat(f._with))return e;this.expect(f.braceL);for(var t={},i=!0;!this.eat(f.braceR);){if(i)i=!1;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;ct(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===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(f.colon),this.type!==f.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===f.string){var e=this.parseLiteral(this.value);return cn.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 Ee=X.prototype;Ee.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};Ee.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};Ee.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};Ee.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==f.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};Ee.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case f.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(f.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case f.braceL:return this.parseObj(!0)}return this.parseIdent()};Ee.parseBindingList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(f.comma),t&&this.type===f.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===f.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),n.push(s),this.type===f.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};Ee.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};Ee.parseBindingListItem=function(e){return e};Ee.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(f.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};Ee.checkLValSimple=function(e,t,i){t===void 0&&(t=wt);var r=t!==wt;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===Me&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(ct(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==rr&&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")}};Ee.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=wt),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)}};Ee.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=wt),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 Ce=function(t,i,r,n,a){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!a},q={b_stat:new Ce("{",!1),b_expr:new Ce("{",!0),b_tmpl:new Ce("${",!1),p_stat:new Ce("(",!1),p_expr:new Ce("(",!0),q_tmpl:new Ce("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ce("function",!1),f_expr:new Ce("function",!0),f_expr_gen:new Ce("function",!0,!1,null,!0),f_gen:new Ce("function",!1,!1,null,!0)},ut=X.prototype;ut.initialContext=function(){return[q.b_stat]};ut.curContext=function(){return this.context[this.context.length-1]};ut.braceIsBlock=function(e){var t=this.curContext();return t===q.f_expr||t===q.f_stat?!0:e===f.colon&&(t===q.b_stat||t===q.b_expr)?!t.isExpr:e===f._return||e===f.name&&this.exprAllowed?me.test(this.input.slice(this.lastTokEnd,this.start)):e===f._else||e===f.semi||e===f.eof||e===f.parenR||e===f.arrow?!0:e===f.braceL?t===q.b_stat:e===f._var||e===f._const||e===f.name?!1:!this.exprAllowed};ut.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};ut.updateContext=function(e){var t,i=this.type;i.keyword&&e===f.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};ut.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};f.parenR.updateContext=f.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===q.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};f.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?q.b_stat:q.b_expr),this.exprAllowed=!0};f.dollarBraceL.updateContext=function(){this.context.push(q.b_tmpl),this.exprAllowed=!0};f.parenL.updateContext=function(e){var t=e===f._if||e===f._for||e===f._with||e===f._while;this.context.push(t?q.p_stat:q.p_expr),this.exprAllowed=!0};f.incDec.updateContext=function(){};f._function.updateContext=f._class.updateContext=function(e){e.beforeExpr&&e!==f._else&&!(e===f.semi&&this.curContext()!==q.p_stat)&&!(e===f._return&&me.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===f.colon||e===f.braceL)&&this.curContext()===q.b_stat)?this.context.push(q.f_expr):this.context.push(q.f_stat),this.exprAllowed=!1};f.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};f.backQuote.updateContext=function(){this.curContext()===q.q_tmpl?this.context.pop():this.context.push(q.q_tmpl),this.exprAllowed=!1};f.star.updateContext=function(e){if(e===f._function){var t=this.context.length-1;this.context[t]===q.f_expr?this.context[t]=q.f_expr_gen:this.context[t]=q.f_gen}this.exprAllowed=!0};f.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==f.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var P=X.prototype;P.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,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}};P.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===f.comma){var a=this.startNodeAt(i,r);for(a.expressions=[n];this.eat(f.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return n};P.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 Vt,r=!0);var o=this.start,c=this.startLoc;(this.type===f.parenL||this.type===f.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===f.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===f.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};P.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(f.question)){var a=this.startNodeAt(i,r);return a.test=n,a.consequent=this.parseMaybeAssign(),this.expect(f.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return n};P.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)};P.parseExprOp=function(e,t,i,r,n){var a=this.type.binop;if(a!=null&&(!n||this.type!==f._in)&&a>r){var s=this.type===f.logicalOR||this.type===f.logicalAND,o=this.type===f.coalesce;o&&(a=f.logicalAND.binop);var c=this.value;this.next();var u=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),u,h,a,n),l=this.buildBinary(t,i,e,p,c,s||o);return(s&&this.type===f.coalesce||o&&(this.type===f.logicalOR||this.type===f.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};P.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")};P.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===f.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"&&sr(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Qt(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===f.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==f._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(f.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 sr(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&sr(e.expression)}function Qt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Qt(e.expression)||e.type==="ParenthesizedExpression"&&Qt(e.expression)}P.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};P.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}};P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(f.arrow)};P.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};P.parseSubscript=function(e,t,i,r,n,a,s){var o=this.options.ecmaVersion>=11,c=o&&this.eat(f.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(f.bracketL);if(u||c&&this.type!==f.parenL&&this.type!==f.backQuote||this.eat(f.dot)){var h=this.startNodeAt(t,i);h.object=e,u?(h.property=this.parseExpression(),this.expect(f.bracketR)):this.type===f.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(f.parenL)){var p=new Vt,l=this.yieldPos,m=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,!1,p);if(n&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=l,this.awaitPos=m,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(t,i,y,s);this.checkExpressionErrors(p,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var b=this.startNodeAt(t,i);b.callee=e,b.arguments=y,o&&(b.optional=c),e=this.finishNode(b,"CallExpression")}else if(this.type===f.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(t,i);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,"TaggedTemplateExpression")}return e};P.parseExprAtom=function(e,t,i){this.type===f.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case f._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===f.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==f.dot&&this.type!==f.bracketL&&this.type!==f.parenL&&this.unexpected(),this.finishNode(r,"Super");case f._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case f.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(f._function))return this.overrideContext(q.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(f.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===f.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(f.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[c],!0,t)}return c;case f.regexp:var u=this.value;return r=this.parseLiteral(u.value),r.regex={pattern:u.pattern,flags:u.flags},r;case f.num:case f.string:return this.parseLiteral(this.value);case f._null:case f._true:case f._false:return r=this.startNode(),r.value=this.type===f._null?null:this.type===f._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case f.parenL:var h=this.start,p=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(p)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),p;case f.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(f.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case f.braceL:return this.overrideContext(q.b_expr),this.parseObj(!1,e);case f._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case f._class:return this.parseClass(this.startNode(),!1);case f._new:return this.parseNew();case f.backQuote:return this.parseTemplate();case f._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};P.parseExprAtomDefault=function(){this.unexpected()};P.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===f.parenL&&!e)return this.parseDynamicImport(t);if(this.type===f.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};P.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(f.parenR)?e.options=null:(this.expect(f.comma),this.afterTrailingComma(f.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(f.parenR)||(this.expect(f.comma),this.afterTrailingComma(f.parenR)||this.unexpected())));else if(!this.eat(f.parenR)){var t=this.start;this.eat(f.comma)&&this.eat(f.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};P.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};P.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};P.parseParenExpression=function(){this.expect(f.parenL);var e=this.parseExpression();return this.expect(f.parenR),e};P.shouldParseArrow=function(e){return!this.canInsertSemicolon()};P.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,p=new Vt,l=this.yieldPos,m=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==f.parenR;)if(u?u=!1:this.expect(f.comma),a&&this.afterTrailingComma(f.parenR,!0)){h=!0;break}else if(this.type===f.ellipsis){g=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,p,this.parseParenItem));var y=this.lastTokEnd,b=this.lastTokEndLoc;if(this.expect(f.parenR),e&&this.shouldParseArrow(c)&&this.eat(f.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=l,this.awaitPos=m,this.parseParenArrowList(i,r,c,t);(!c.length||h)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(p,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=m||this.awaitPos,c.length>1?(n=this.startNodeAt(s,o),n.expressions=c,this.finishNodeAt(n,"SequenceExpression",y,b)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(i,r);return v.expression=n,this.finishNode(v,"ParenthesizedExpression")}else return n};P.parseParenItem=function(e){return e};P.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var dn=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===f.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(f.parenL)?e.arguments=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,!1):e.arguments=dn,this.finishNode(e,"NewExpression")};P.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===f.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)&&!we.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(zt(t,r.generator)|Kt|(i?Wi: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(zt(i,!1)|Bi),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,qi),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,Yt,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 gt=X.prototype;gt.raise=function(e,t){var i=Oi(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};gt.raiseRecoverable=gt.raise;gt.curPosition=function(){if(this.options.locations)return new at(this.curLine,this.pos-this.lineStart)};var je=X.prototype,Xr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};je.enterScope=function(e){this.scopeStack.push(new Xr(e))};je.exitScope=function(){this.scopeStack.pop()};je.treatFunctionsAsVarInScope=function(e){return e.flags&tt||!this.inModule&&e.flags&ot};je.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&ot&&delete this.undefinedExports[e]}else if(t===$i){var a=this.currentScope();a.lexical.push(e)}else if(t===ji){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&Fi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&ot&&delete this.undefinedExports[e],c.flags&Gt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};je.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};je.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};je.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gt)return t}};je.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Gt&&!(t.flags&Bi))return t}};var Nt=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new Et(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 Nt(this,this.start,this.startLoc)};ut.startNodeAt=function(e,t){return new Nt(this,e,t)};function Ki(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 Ki.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ut.finishNodeAt=function(e,t,i,r){return Ki.call(this,e,t,i,r)};ut.copyNode=function(e){var t=new Nt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Zr="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",Gi="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",zi=Gi+" Extended_Pictographic",Yi=zi,Qi=Yi+" EBase EComp EMod EPres ExtPict",Xi=Qi,Jr=Xi,en={9:Gi,10:zi,11:Yi,12:Qi,13:Xi,14:Jr},tn="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",rn={9:"",10:"",11:"",12:"",13:"",14:tn},ni="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",Zi="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",Ji=Zi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",er=Ji+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",tr=er+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ir=tr+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",nn=ir+" "+Zr,sn={9:Zi,10:Ji,11:er,12:tr,13:ir,14:nn},rr={};function an(e){var t=rr[e]={binary:Be(en[e]+" "+ni),binaryOfStrings:Be(rn[e]),nonBinary:{General_Category:Be(ni),Script:Be(sn[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 At=0,si=[9,10,11,12,13,14];At<si.length;At+=1){var on=si[At];an(on)}var k=X.prototype,yt=function(t,i){this.parent=t,this.base=i||this};yt.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};yt.prototype.sibling=function(){return new yt(this.parent,this.base)};var Te=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=rr[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};Te.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)};Te.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Te.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};Te.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};Te.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};Te.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};Te.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};Te.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};Te.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};k.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 cn(e){for(var t in e)return!0;return!1}k.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&cn(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};k.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")}};k.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new yt(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")};k.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};k.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};k.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};k.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};k.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};k.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};k.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)};k.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};k.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};k.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};k.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&un(i);)t+=De(i),e.advance();return t};function un(e){return e===105||e===109||e===115}k.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)};k.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};k.regexp_eatSyntaxCharacter=function(e){var t=e.current();return nr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function nr(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}k.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!nr(i);)e.advance();return e.pos!==t};k.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};k.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}};k.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};k.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=De(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=De(e.lastIntValue);return!0}return!1};k.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),hn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function hn(e){return Re(e,!0)||e===36||e===95}k.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),ln(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function ln(e){return Xe(e,!0)||e===36||e===95||e===8204||e===8205}k.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)};k.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};k.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};k.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)};k.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};k.regexp_eatZero=function(e){return e.current()===48&&!It(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};k.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};k.regexp_eatControlLetter=function(e){var t=e.current();return sr(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function sr(e){return e>=65&&e<=90||e>=97&&e<=122}k.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)&&pn(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function pn(e){return e>=0&&e<=1114111}k.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};k.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 ar=0,Ve=1,ye=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(fn(t))return e.lastIntValue=-1,e.advance(),Ve;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===ye&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return ar};function fn(e){return e===100||e===68||e===115||e===83||e===119||e===87}k.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),Ve}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return ar};k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){et(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};k.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ve;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ye;e.raise("Invalid property name")};k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";or(t=e.current());)e.lastStringValue+=De(t),e.advance();return e.lastStringValue!==""};function or(e){return sr(e)||e===95}k.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";dn(t=e.current());)e.lastStringValue+=De(t),e.advance();return e.lastStringValue!==""};function dn(e){return or(e)||It(e)}k.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};k.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===ye&&e.raise("Negated character class may contain strings"),!0}return!1};k.regexp_classContents=function(e){return e.current()===93?Ve:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ve)};k.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")}}};k.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||hr(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};k.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)};k.regexp_classSetExpression=function(e){var t=Ve,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ye&&(t=ye);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ye&&(t=Ve);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===ye&&(t=ye)}};k.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};k.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ve:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};k.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===ye&&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};k.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};k.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ye&&(t=ye);return t};k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ve:ye};k.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()&&mn(i)||xn(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function mn(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 xn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}k.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return gn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function gn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}k.regexp_eatClassControlLetter=function(e){var t=e.current();return It(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};k.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};k.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;It(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function It(e){return e>=48&&e<=57}k.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;cr(i=e.current());)e.lastIntValue=16*e.lastIntValue+ur(i),e.advance();return e.pos!==t};function cr(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function ur(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}k.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};k.regexp_eatOctalDigit=function(e){var t=e.current();return hr(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function hr(e){return e>=48&&e<=55}k.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!cr(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+ur(n),e.advance()}return!0};var Xt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Et(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 Xt(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 Xt(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 Re(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=Di(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&&!Je(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&&Vi.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||we.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(),Re(t,!0)||t===92))return this.finishToken(p.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+De(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 '"+De(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(we.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 Te(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 yn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function lr(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=lr(this.input.slice(t,this.pos)),++this.pos):Re(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=lr(this.input.slice(t,this.pos));return++this.pos,Re(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")),Re(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=yn(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)):(Je(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(p.string,t)};var pr={};V.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===pr)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};V.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw pr;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(Je(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
|
-
`;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(
|
|
22
|
+
`),cooked:this.value},this.next(),i.tail=this.type===f.backQuote,this.finishNode(i,"TemplateElement")};P.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===f.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(f.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(f.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};P.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===f.name||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===f.star)&&!me.test(this.input.slice(this.lastTokEnd,this.start))};P.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(f.braceR);){if(r)r=!1;else if(this.expect(f.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(f.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")};P.parseProperty=function(e,t){var i=this.startNode(),r,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(f.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===f.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===f.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(f.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(f.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,a,s,t,o),this.finishNode(i,"Property")};P.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var r=e.value.start;e.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};P.parsePropertyValue=function(e,t,i,r,n,a,s,o){(i||r)&&this.type===f.colon&&this.unexpected(),this.eat(f.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===f.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,r),e.kind="init"):!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==f.comma&&this.type!==f.braceR&&this.type!==f.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),t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===f.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.kind="init",e.shorthand=!0):this.unexpected()};P.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(f.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(f.bracketR),e.key;e.computed=!1}return e.key=this.type===f.num||this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};P.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};P.parseMethod=function(e,t,i){var r=this.startNode(),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(si(t,r.generator)|Dt|(i?Ji:0)),this.expect(f.parenL),r.params=this.parseBindingList(f.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")};P.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(si(i,!1)|ni),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")};P.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==f.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,rr),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()};P.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0};P.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var a=n[r];this.checkLValInnerPattern(a,ai,t?null:i)}};P.parseExprList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(f.comma),t&&this.afterTrailingComma(e))break;var s=void 0;i&&this.type===f.comma?s=null:this.type===f.ellipsis?(s=this.parseSpread(r),r&&this.type===f.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),n.push(s)}return n};P.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Rt)&&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"))}};P.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};P.parseIdentNode=function(){var e=this.startNode();return this.type===f.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=f.name):this.unexpected(),e};P.parsePrivateIdent=function(){var e=this.startNode();return this.type===f.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e};P.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===f.semi||this.canInsertSemicolon()||this.type!==f.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(f.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};P.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var St=X.prototype;St.raise=function(e,t){var i=Qi(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r};St.raiseRecoverable=St.raise;St.curPosition=function(){if(this.options.locations)return new ft(this.curLine,this.pos-this.lineStart)};var ze=X.prototype,gn=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};ze.enterScope=function(e){this.scopeStack.push(new gn(e))};ze.exitScope=function(){this.scopeStack.pop()};ze.treatFunctionsAsVarInScope=function(e){return e.flags&tt||!this.inModule&&e.flags&et};ze.declareName=function(e,t,i){var r=!1;if(t===Me){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&et&&delete this.undefinedExports[e]}else if(t===ir){var a=this.currentScope();a.lexical.push(e)}else if(t===tr){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&Zi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&et&&delete this.undefinedExports[e],c.flags&Rt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};ze.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};ze.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ze.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Rt|mt|it))return t}};ze.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Rt|mt|it)&&!(t.flags&ni))return t}};var Ot=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new Pt(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},dt=X.prototype;dt.startNode=function(){return new Ot(this,this.start,this.startLoc)};dt.startNodeAt=function(e,t){return new Ot(this,e,t)};function ar(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}dt.finishNode=function(e,t){return ar.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};dt.finishNodeAt=function(e,t,i,r){return ar.call(this,e,t,i,r)};dt.copyNode=function(e){var t=new Ot(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var xn="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",or="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",cr=or+" Extended_Pictographic",ur=cr,hr=ur+" EBase EComp EMod EPres ExtPict",lr=hr,yn=lr,bn={9:or,10:cr,11:ur,12:hr,13:lr,14:yn},vn="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",wn={9:"",10:"",11:"",12:"",13:"",14:vn},gi="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",pr="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",fr=pr+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",mr=fr+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",dr=mr+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",gr=dr+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",_n=gr+" "+xn,Sn={9:pr,10:fr,11:mr,12:dr,13:gr,14:_n},xr={};function En(e){var t=xr[e]={binary:$e(bn[e]+" "+gi),binaryOfStrings:$e(wn[e]),nonBinary:{General_Category:$e(gi),Script:$e(Sn[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 jt=0,xi=[9,10,11,12,13,14];jt<xi.length;jt+=1){var Nn=xi[jt];En(Nn)}var k=X.prototype,Et=function(t,i){this.parent=t,this.base=i||this};Et.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};Et.prototype.sibling=function(){return new Et(this.parent,this.base)};var Re=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=xr[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};Re.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)};Re.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Re.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};Re.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};Re.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};Re.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};Re.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};Re.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};Re.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};k.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 In(e){for(var t in e)return!0;return!1}k.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&In(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};k.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")}};k.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Et(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")};k.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};k.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};k.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};k.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};k.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};k.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};k.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)};k.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};k.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};k.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};k.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&Cn(i);)t+=Oe(i),e.advance();return t};function Cn(e){return e===105||e===109||e===115}k.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)};k.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};k.regexp_eatSyntaxCharacter=function(e){var t=e.current();return yr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function yr(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}k.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!yr(i);)e.advance();return e.pos!==t};k.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};k.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}};k.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};k.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Oe(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Oe(e.lastIntValue);return!0}return!1};k.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),kn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function kn(e){return Pe(e,!0)||e===36||e===95}k.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),An(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function An(e){return qe(e,!0)||e===36||e===95||e===8204||e===8205}k.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)};k.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};k.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};k.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)};k.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};k.regexp_eatZero=function(e){return e.current()===48&&!Lt(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};k.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};k.regexp_eatControlLetter=function(e){var t=e.current();return br(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function br(e){return e>=65&&e<=90||e>=97&&e<=122}k.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)&&Tn(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Tn(e){return e>=0&&e<=1114111}k.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};k.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 vr=0,Le=1,we=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Pn(t))return e.lastIntValue=-1,e.advance(),Le;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===we&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return vr};function Pn(e){return e===100||e===68||e===115||e===83||e===119||e===87}k.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),Le}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return vr};k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){ct(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};k.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Le;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return we;e.raise("Invalid property name")};k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";wr(t=e.current());)e.lastStringValue+=Oe(t),e.advance();return e.lastStringValue!==""};function wr(e){return br(e)||e===95}k.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Dn(t=e.current());)e.lastStringValue+=Oe(t),e.advance();return e.lastStringValue!==""};function Dn(e){return wr(e)||Lt(e)}k.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};k.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===we&&e.raise("Negated character class may contain strings"),!0}return!1};k.regexp_classContents=function(e){return e.current()===93?Le:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Le)};k.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")}}};k.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||Er(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};k.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)};k.regexp_classSetExpression=function(e){var t=Le,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===we&&(t=we);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==we&&(t=Le);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===we&&(t=we)}};k.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};k.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Le:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};k.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===we&&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};k.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};k.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===we&&(t=we);return t};k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Le:we};k.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()&&Rn(i)||Vn(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Rn(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 Vn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}k.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return On(t)?(e.lastIntValue=t,e.advance(),!0):!1};function On(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}k.regexp_eatClassControlLetter=function(e){var t=e.current();return Lt(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};k.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};k.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Lt(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function Lt(e){return e>=48&&e<=57}k.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;_r(i=e.current());)e.lastIntValue=16*e.lastIntValue+Sr(i),e.advance();return e.pos!==t};function _r(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Sr(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}k.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};k.regexp_eatOctalDigit=function(e){var t=e.current();return Er(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Er(e){return e>=48&&e<=55}k.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!_r(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Sr(n),e.advance()}return!0};var ci=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Pt(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 ci(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 ci(this)};typeof Symbol<"u"&&(V[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===f.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(f.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};V.readToken=function(e){return Pe(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};V.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888};V.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};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=Ki(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&&!ot(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&&Gi.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(f.ellipsis)):(++this.pos,this.finishToken(f.dot))};V.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(f.assign,2):this.finishOp(f.slash,1)};V.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?f.star:f.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=f.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(f.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(f.assign,3)}return this.finishOp(e===124?f.logicalOR:f.logicalAND,2)}return t===61?this.finishOp(f.assign,2):this.finishOp(e===124?f.bitwiseOR:f.bitwiseAND,1)};V.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(f.assign,2):this.finishOp(f.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||me.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(f.incDec,2):t===61?this.finishOp(f.assign,2):this.finishOp(f.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(f.assign,i+1):this.finishOp(f.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(f.relational,i))};V.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(f.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(f.arrow)):this.finishOp(e===61?f.eq:f.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(f.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(f.assign,3)}return this.finishOp(f.coalesce,2)}}return this.finishOp(f.question,1)};V.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Pe(t,!0)||t===92))return this.finishToken(f.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Oe(t)+"'")};V.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(f.parenL);case 41:return++this.pos,this.finishToken(f.parenR);case 59:return++this.pos,this.finishToken(f.semi);case 44:return++this.pos,this.finishToken(f.comma);case 91:return++this.pos,this.finishToken(f.bracketL);case 93:return++this.pos,this.finishToken(f.bracketR);case 123:return++this.pos,this.finishToken(f.braceL);case 125:return++this.pos,this.finishToken(f.braceR);case 58:return++this.pos,this.finishToken(f.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(f.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(f.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Oe(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(me.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 Re(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(f.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),p=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?p=h-97+10:h>=65?p=h-65+10:h>=48&&h<=57?p=h-48:p=1/0,p>=e)break;o=h,s=s*e+p}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 Ln(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Nr(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=Nr(this.input.slice(t,this.pos)),++this.pos):Pe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.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=Nr(this.input.slice(t,this.pos));return++this.pos,Pe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.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")),Pe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=Ln(this.input.slice(t,this.pos),i);return this.finishToken(f.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)):(ot(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(f.string,t)};var Ir={};V.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ir)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};V.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ir;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===f.template||this.type===f.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(f.dollarBraceL)):(++this.pos,this.finishToken(f.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(f.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ot(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
|
+
`;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(f.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
|
|
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
|
|
28
|
-
`,s):(e.write("/*"),Sn(e,s.value,i,r),e.write("*/"+r))}}function En(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 Pt(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 ai,oi,ci,ui,hi,li;const Zt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&se(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&&se(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}n&&e.trailingComments!=null&&se(t,e.trailingComments,i,r)},BlockStatement:li=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&&se(t,e.comments,a,r);const{length:o}=s;for(let c=0;c<o;c++){const u=s[c];n&&u.comments!=null&&se(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),se(t,e.comments,a,r),t.write(i));n&&e.trailingComments!=null&&se(t,e.trailingComments,a,r),t.write("}"),t.indentLevel--},ClassBody:li,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===Ie||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&&se(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&&se(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"?Pt(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:ai=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Pt(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:ai,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:oi=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Ye(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:oi,VariableDeclaration(e,t){Pt(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===Ie||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),Ye(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]):Ye(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:ci=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:ci,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),ft(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){ft(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:hi=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:hi,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&&se(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&&se(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&&se(t,e.trailingComments,a,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),se(t,e.comments,a,r),e.trailingComments!=null&&se(t,e.trailingComments,a,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),se(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){Ye(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const a=dr(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:ui=function(e,t){const i=e.operator==="in";i&&t.write("("),ft(t,e.left,e,!1),t.write(" "+e.operator+" "),ft(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:ui,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===Ie||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===Ie||i<t.expressionsPrecedence.CallExpression||En(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Ye(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===Ie||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("?."),Ye(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===Ie||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(wn(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},_n={},Nn=Zt;class In{constructor(t){const i=t??_n;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Zt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:bn,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
|
|
26
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Oe(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 ot(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?Pe:qe)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=Oe(s),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};V.readWord=function(){var e=this.readWord1(),t=f.name;return this.keywords.test(e)&&(t=ii[e]),this.finishToken(t,e)};var Mn="8.16.0";X.acorn={Parser:X,version:Mn,defaultOptions:Gt,Position:ft,SourceLocation:Pt,getLineInfo:Qi,Node:Ot,TokenType:M,tokTypes:f,keywordTypes:ii,TokContext:Ce,tokContexts:q,isIdentifierChar:qe,isIdentifierStart:Pe,Token:ci,isNewLine:ot,lineBreak:me,lineBreakG:sn,nonASCIIwhitespace:Gi};function Cr(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 yt={"||":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},ke=17,jn={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:ke,ClassExpression:ke,FunctionExpression:ke,ObjectExpression:ke,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function nt(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 kr(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===ke)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?yt[t.operator]<=yt[i.operator]:yt[t.operator]<yt[i.operator]}function bt(e,t,i,r){const{generator:n}=e;kr(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function Fn(e,t,i,r){const n=t.split(`
|
|
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 ae(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
|
+
`,s):(e.write("/*"),Fn(e,s.value,i,r),e.write("*/"+r))}}function Wn(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 Ft(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 yi,bi,vi,wi,_i,Si;const ui={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&ae(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&&ae(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}n&&e.trailingComments!=null&&ae(t,e.trailingComments,i,r)},BlockStatement:Si=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&&ae(t,e.comments,a,r);const{length:o}=s;for(let c=0;c<o;c++){const u=s[c];n&&u.comments!=null&&ae(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),ae(t,e.comments,a,r),t.write(i));n&&e.trailingComments!=null&&ae(t,e.trailingComments,a,r),t.write("}"),t.indentLevel--},ClassBody:Si,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===ke||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&&ae(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:p}=h,{length:l}=p;for(let m=0;m<l;m++){const g=p[m];n&&g.comments!=null&&ae(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"?Ft(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:yi=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Ft(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:yi,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:bi=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),nt(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:bi,VariableDeclaration(e,t){Ft(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===ke||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),nt(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]):nt(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:vi=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:vi,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),bt(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){bt(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:_i=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:_i,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&&ae(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&&ae(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&&ae(t,e.trailingComments,a,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),ae(t,e.comments,a,r),e.trailingComments!=null&&ae(t,e.trailingComments,a,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),ae(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){nt(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const a=kr(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:wi=function(e,t){const i=e.operator==="in";i&&t.write("("),bt(t,e.left,e,!1),t.write(" "+e.operator+" "),bt(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:wi,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ke||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===ke||i<t.expressionsPrecedence.CallExpression||Wn(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),nt(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ke||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("?."),nt(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ke||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)}},$n={},Un=ui;class qn{constructor(t){const i=t??$n;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:ui,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:jn,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 mr(e,t){const i=new In(t);return i.generator[e.type](e,i),i.output}var Cn=Object.defineProperty,kn=(e,t,i)=>t in e?Cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Q=(e,t,i)=>kn(e,typeof t!="symbol"?t+"":t,i);const An=new Set(["Infinity","NaN","undefined","null","true","false"]),Pn=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 Tn{constructor(){Q(this,"scopes",[]),Q(this,"scopeTypes",[]),Q(this,"scopeCounts",new Map),Q(this,"contextBoundVars",new Set),Q(this,"arrayPatternElements",new Set),Q(this,"rootParams",new Set),Q(this,"localSeriesVars",new Set),Q(this,"varKinds",new Map),Q(this,"loopVars",new Set),Q(this,"loopVarNames",new Map),Q(this,"paramIdCounter",0),Q(this,"cacheIdCounter",0),Q(this,"tempVarCounter",0),Q(this,"taCallIdCounter",0),Q(this,"userCallIdCounter",0),Q(this,"hoistingStack",[]),Q(this,"suppressHoisting",!1),Q(this,"reservedNames",new Set),Q(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 An.has(t)||Pn.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 xr(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 Rn(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?Dn(i,r||void 0):r;(function s(o,c,u){a[u||o.type](o,c,s)})(e,t,n)}function Dn(e,t){var i=Object.create(t||S);for(var r in e)i[r]=e[r];return i}function Jt(e,t,i){i(e,t)}function ze(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=Jt;S.EmptyStatement=ze;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=ze;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=ze;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=ze;S.MemberPattern=Jt;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=Jt;S.ThisExpression=S.Super=S.MetaProperty=ze;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=ze;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=ze;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"],Vn=["hline","plot","fill"],Ln=["request.security","request.security_lower_tf"],gr=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],yr=[...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 Mn(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=gr,o=yr,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 Bn(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(gr),n=new Set(yr),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 Fn(e){try{const t=fr(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 Wn(e){return e.async=!0,mr(e)}function jn(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=Fn(e);return t&&r?i?e:Wn(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 Ar(e,t){const i=new qn(t);return i.generator[e.type](e,i),i.output}var Hn=Object.defineProperty,zn=(e,t,i)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Q=(e,t,i)=>zn(e,typeof t!="symbol"?t+"":t,i);const Kn=new Set(["Infinity","NaN","undefined","null","true","false"]),Gn=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 Yn{constructor(){Q(this,"scopes",[]),Q(this,"scopeTypes",[]),Q(this,"scopeCounts",new Map),Q(this,"contextBoundVars",new Set),Q(this,"arrayPatternElements",new Set),Q(this,"rootParams",new Set),Q(this,"localSeriesVars",new Set),Q(this,"varKinds",new Map),Q(this,"loopVars",new Set),Q(this,"loopVarNames",new Map),Q(this,"paramIdCounter",0),Q(this,"cacheIdCounter",0),Q(this,"tempVarCounter",0),Q(this,"taCallIdCounter",0),Q(this,"userCallIdCounter",0),Q(this,"hoistingStack",[]),Q(this,"suppressHoisting",!1),Q(this,"reservedNames",new Set),Q(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 Kn.has(t)||Gn.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=E),(function a(s,o,c){var u=c||s.type;Pr(i,u,s,o,a),t[u]&&t[u](s,o)})(e,r,n)}function Qn(e,t,i,r,n){var a=[];i||(i=E),(function s(o,c,u){var h=u||o.type,p=o!==a[a.length-1];p&&a.push(o),Pr(i,h,o,c,s),t[h]&&t[h](o,c||a,a),p&&a.pop()})(e,r,n)}function ee(e,t,i,r,n){var a=i?Xn(i,r||void 0):r;(function s(o,c,u){a[u||o.type](o,c,s)})(e,t,n)}function Xn(e,t){var i=Object.create(t||E);for(var r in e)i[r]=e[r];return i}function hi(e,t,i){i(e,t)}function rt(e,t,i){}function Pr(e,t,i,r,n){if(e[t]==null)throw new Error("No walker function defined for node type "+t);e[t](i,r,n)}var E={};E.Program=E.BlockStatement=E.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")}};E.Statement=hi;E.EmptyStatement=rt;E.ExpressionStatement=E.ParenthesizedExpression=E.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")};E.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")};E.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")};E.BreakStatement=E.ContinueStatement=rt;E.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")};E.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)}};E.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")}};E.ReturnStatement=E.YieldExpression=E.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")};E.ThrowStatement=E.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")};E.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")};E.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")};E.WhileStatement=E.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")};E.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")};E.ForInStatement=E.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")};E.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")};E.DebuggerStatement=rt;E.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};E.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var a=n[r];i(a,t)}};E.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")};E.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")};E.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)};E.VariablePattern=rt;E.MemberPattern=hi;E.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};E.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")}};E.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")}};E.Expression=hi;E.ThisExpression=E.Super=E.MetaProperty=rt;E.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")}};E.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];i(a,t)}};E.FunctionExpression=E.ArrowFunctionExpression=E.FunctionDeclaration;E.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")}};E.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")}};E.TemplateElement=rt;E.UnaryExpression=E.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")};E.BinaryExpression=E.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")};E.AssignmentExpression=E.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")};E.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")};E.NewExpression=E.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")}};E.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")};E.ExportNamedDeclaration=E.ExportDefaultDeclaration=function(e,t,i){if(e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression"),e.attributes)for(var r=0,n=e.attributes;r<n.length;r+=1){var a=n[r];i(a,t)}};E.ExportAllDeclaration=function(e,t,i){if(e.exported&&i(e.exported,t),i(e.source,t,"Expression"),e.attributes)for(var r=0,n=e.attributes;r<n.length;r+=1){var a=n[r];i(a,t)}};E.ImportAttribute=function(e,t,i){i(e.value,t,"Expression")};E.ImportDeclaration=function(e,t,i){for(var r=0,n=e.specifiers;r<n.length;r+=1){var a=n[r];i(a,t)}if(i(e.source,t,"Expression"),e.attributes)for(var s=0,o=e.attributes;s<o.length;s+=1){var c=o[s];i(c,t)}};E.ImportExpression=function(e,t,i){i(e.source,t,"Expression"),e.options&&i(e.options,t,"Expression")};E.ImportSpecifier=E.ImportDefaultSpecifier=E.ImportNamespaceSpecifier=E.Identifier=E.PrivateIdentifier=E.Literal=rt;E.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")};E.ClassDeclaration=E.ClassExpression=function(e,t,i){return i(e,t,"Class")};E.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)};E.ClassBody=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t)}};E.MethodDefinition=E.PropertyDefinition=E.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const z="$",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}}},gt=["ta","math","request","array","input"],Ke=["hline","plot","fill","label","na","time","time_close","dayofmonth","dayofweek","hour","minute","month","second","weekofyear","year"],Zn=["request.security","request.security_lower_tf"],Dr=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Rr=[...gt,"plotchar","plotshape","plotarrow","plotbar","plotcandle","plot","bgcolor","barcolor","hline","fill","indicator","strategy","library","alertcondition","fixnan","na","color","nz","timestamp","str","box","line","label","table","chart","map","matrix","log","map","Type","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","inputs","time","time_close","time_tradingday","dayofmonth","hour","minute","month","second","weekofyear","year","order","currency","display","shape","location","size","format","dayofweek","xloc","yloc","text","font"],Jn=["na","nz","plot","plotchar","color","hline","fill"];function es(e){let t=null,i=z;if(e.type==="Program"&&e.body.length>0){const m=e.body[0];if(m.type==="ExpressionStatement"&&(m.expression.type==="ArrowFunctionExpression"||m.expression.type==="FunctionExpression")){const g=m.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=m=>{m.type==="Identifier"?r.add(m.name):m.type==="ObjectPattern"?m.properties.forEach(g=>a(g.value)):m.type==="ArrayPattern"&&m.elements.forEach(g=>{g&&a(g)})};ee(e,{},{VariableDeclarator(m,g,y){a(m.id),m.init&&y(m.init,g)},FunctionDeclaration(m,g,y){a(m.id),y(m.body,g)},Identifier(m,g,y){n.add(m.name)},MemberExpression(m,g,y){y(m.object,g),m.computed&&y(m.property,g)},Property(m,g,y){m.computed&&y(m.key,g),y(m.value,g)}}),t.forEach(m=>{m.type==="VariableDeclaration"?m.declarations.forEach(g=>a(g.id)):m.type==="FunctionDeclaration"&&a(m.id)});const s=Dr,o=Rr,c=s.filter(m=>!r.has(m)),u=o.filter(m=>!r.has(m)),h=c.filter(m=>n.has(m)),p=u.filter(m=>n.has(m)),l=[];h.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(m=>({type:"Property",key:{type:"Identifier",name:m},value:{type:"Identifier",name:m},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),p.length>0&&l.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:p.map(m=>({type:"Property",key:{type:"Identifier",name:m},value:{type:"Identifier",name:m},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 ts(e){let t=null,i=z;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(Dr),n=new Set(Rr),a=new Set(Jn),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(p=>{if(p.type==="Property"&&p.key.type==="Identifier"&&p.value.type==="Identifier"){const l=p.key.name,m=p.value.name;h.has(l)&&l!==m&&(s.set(m,l),p.value.name=l,p.shorthand=!0)}});else if(c.id.type==="Identifier"&>.includes(u)){const p=u,l=c.id.name;p!==l&&(s.set(l,p),c.id.name=p)}}})}),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 is(e){try{const t=Cr(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 rs(e){return e.async=!0,Ar(e)}function ns(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=is(e);return t&&r?i?e:rs(r):`async (context) => {
|
|
32
32
|
${e}
|
|
33
|
-
}`}function $n(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 qn(e,t){xr(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 Un(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&i&&t.addContextBoundVar(r.name,i)})}function Hn(e,t){let i;return Rn(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),Un(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 Ft={type:"Identifier",name:"undefined"};function ie(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 vr(e,t){const i=ie(e,t);return w.createGetCall(i,0)}function We(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=ie(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=ie(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=ie(e.object.name,t)),e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(We(i,t),i._indexTransformed=!0)}}}function Ae(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 oe(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=ie(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=ie(e.name,t)}if(s)Object.assign(e,f);else{const l=w.createGetCall(f,0);Object.assign(e,l)}}}function ve(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||(We(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 st(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?ie(e.name,t):i===e.name&&!t.isContextBound(e.name)?e:ie(e.name,t)}return e}function Fe(e,t,i=""){switch(e.type){case"BinaryExpression":return Wt(e,t,i);case"LogicalExpression":return jt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?st(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=st(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 $t(e,t,i);case"ConditionalExpression":{const r=Fe(e.test,t,i),n=Fe(e.consequent,t,i),a=Fe(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:n,alternate:a,start:e.start,end:e.end}}}return e}function Wt(e,t,i){const r=Fe(e.left,t,i),n=Fe(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||le(s,o)},MemberExpression(s){ve(s,"",t)}}),a}function jt(e,t,i){const r=Fe(e.left,t,i),n=Fe(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||le(s,o)}}),a}function pi(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,oe(s,t);const u=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||u)&&(s.type==="MemberExpression"?We(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"||Ae(s)))},MemberExpression(s,o,c){We(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);le(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,Ft,{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 $t(e,t,i){const r=Fe(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||le(a,s)},MemberExpression(a){ve(a,"",t)}}),n}function Ge(e,t,i){switch(e?.type){case"BinaryExpression":e=Wt(e,i,t);break;case"LogicalExpression":e=jt(e,i,t);break;case"ConditionalExpression":return pi(e,i,t);case"UnaryExpression":e=$t(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(u=>u.type==="Identifier"?i.isContextBound(u.name)&&!i.isRootParam(u.name)?u:vr(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"?le(e.object,i):e.object.type==="MemberExpression"?ve(e.object,"",i):e.object.type==="BinaryExpression"?e.object=Wt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=jt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=pi(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=$t(e.object,i,t));const u=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:st(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?st(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"&&Ge(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:ie(u.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(u.value.type!=="Literal"&&(u.value=Ge(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,Ft,{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"&&le(e,i);const a=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),s=e.type==="Identifier"?st(e,i):e,o=i.generateParamId(),c={type:"CallExpression",callee:a,arguments:[s,Ft,{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 le(e,t,i){if(e._transformed)return;e.callee&&e.callee.name,e.callee&&e.callee.type==="Identifier"&&(ht.includes(e.callee.name)||Vn.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(Ge(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=Ln.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:Ge(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:Ge(f,K,t));let o=a;a.type==="Identifier"?o=Ge(a,K,t):a.type==="CallExpression"&&(le(a,t),o=Ge(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"&&oe(e.callee.object,t)}e.arguments.forEach(n=>{ee(n,{parent:e},{Identifier(a,s,o){a.parent=s.parent,oe(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?We(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"||Ae(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||le(a,t)},MemberExpression(a,s,o){ve(a,"",t),a.object&&o(a.object,{parent:a})}})})}function wr(e,t){let i=null;if(e.left.type==="Identifier")i=ie(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=ie(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=ie(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,oe(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"?We(r,t):r.type==="Identifier"&&!f&&!u&&!h&&!l&&!d&&Ae(r))},MemberExpression(r,n,a){ve(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);le(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 br(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)?le(i.init,t):ee(i.init,{parent:i.init},{Identifier(l,d){l.parent=d.parent,oe(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&&Ae(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}),le(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),ve(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=ie(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||(We(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=ie(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){br(l,d)},Identifier(l,d){oe(l,d)},AssignmentExpression(l,d){wr(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 Kn(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"),oe(a,s),t.popScope())},MemberExpression(a){t.pushScope("for"),ve(a,"",t),t.popScope()}})}e.test&&ee(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),oe(r,n),r.type==="Identifier"&&(r.computed=!0,Ae(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),ve(r,"",t),t.popScope()}}),e.update&&ee(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),oe(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Gn(e,t){ee(e,t,{MemberExpression(i){ve(i,"",t)},CallExpression(i,r){le(i,r)},Identifier(i,r){oe(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&Ae(i)}})}function zn(e,t,i){e.test&&(t.pushScope("if"),Gn(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 Yn(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):vr(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)||ve(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:ie(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=ie(r.value.name,t))),r)):e.argument.type==="Identifier"&&(oe(e.argument,t),e.argument.type==="Identifier"&&Ae(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||(We(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){oe(n,a),n.type==="Identifier"&&!n._arrayAccessed&&(Ae(n),n._arrayAccessed=!0)},MemberExpression(n){ve(n,"",t)},CallExpression(n,a,s){(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")&&s(n.callee,a),le(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 Qn(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 Xn(e){const t={...S,LineComment:()=>{}};xr(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 Zn(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){Yn(s,o)},VariableDeclaration(s,o){br(s,o)},Identifier(s,o){oe(s,o)},CallExpression(s,o,c){s.callee&&(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&c(s.callee,o),le(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"){oe(s.right,o),Ae(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"?(oe(s.right,o),Ae(s.right)):s.right&&c(s.right,o),s.body&&c(s.body,o)},MemberExpression(s,o){ve(s,i,o)},AssignmentExpression(s,o){wr(s,o)},FunctionDeclaration(s,o,c){Qn(s,o,c)},ForStatement(s,o,c){Kn(s,o,c)},IfStatement(s,o,c){zn(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"},Jn=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),es=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class ts{constructor(t,i,r,n,a=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=a}}var is=Object.defineProperty,rs=(e,t,i)=>t in e?is(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ke=(e,t,i)=>rs(e,typeof t!="symbol"?t+"":t,i);class ns{constructor(t){ke(this,"source"),ke(this,"pos"),ke(this,"line"),ke(this,"column"),ke(this,"tokens"),ke(this,"indentStack"),ke(this,"atLineStart"),ke(this,"parenDepth"),ke(this,"bracketDepth"),ke(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 ss(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 as(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===z||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===z||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 os(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&i&&t.addContextBoundVar(r.name,i)})}function cs(e,t){let i;return Qn(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=z),os(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(p=>{p&&p.type==="Identifier"&&t.addReservedName(p.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(p=>{p.type==="Identifier"&&t.addArrayPatternElement(p.name)});const h=o.id.elements.map((p,l)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:p,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 Xt={type:"Identifier",name:"undefined"};function re(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 Vr(e,t){const i=re(e,t);return w.createGetCall(i,0)}function He(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=re(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=re(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=re(e.object.name,t)),e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(He(i,t),i._indexTransformed=!0)}}}function De(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 he(e,t){if(!e._skipTransformation&&e.name!==z){if(Ke.includes(e.name)&&t.isContextBound(e.name)){const l=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,m=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&!e.parent.computed;if(!l&&!m){const g={type:"MemberExpression",object:{type:"Identifier",name:e.name},property:{type:"Identifier",name:"__value"},computed:!1},y=w.createGetCall(g,0);Object.assign(e,y),delete e.name;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===z&&["get","set","init","param","call"].includes(l.property.name)){const m=e.parent.arguments.indexOf(e);l.property.name==="call"?m>=2&&(i=!0):m===0&&(i=!0)}else{const m=l.type==="MemberExpression"&&l.object&&l.object.type==="Identifier"&>.includes(l.object.name);l.type==="MemberExpression"&&!m?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===z&&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=re(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),m=e.parent&&e.parent.type==="SwitchStatement"&&e.parent.discriminant===e,g=e.parent&&e.parent.type==="SwitchCase"&&e.parent.test===e;if(!l&&!m&&!g)return}if(t.isLocalSeriesVar(e.name)){if(!s){const l=w.createIdentifier(e.name),m=w.createGetCall(l,0);Object.assign(e,m)}return}const[u,h]=t.getVariable(e.name);let p;if(c)p=w.createIdentifier(e.name);else{if(u===e.name&&!t.isContextBound(e.name))return;p=re(e.name,t)}if(s)Object.assign(e,p);else{const l=w.createGetCall(p,0);Object.assign(e,l)}}}function _e(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&>.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||(He(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===z||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;e.object.type==="Identifier"&&Ke.includes(e.object.name)&&i.isContextBound(e.object.name)&&(e.object={type:"MemberExpression",object:{type:"Identifier",name:e.object.name},property:{type:"Identifier",name:"__value"},computed:!1});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 pt(e,t){if(e.type==="Identifier"){if(Ke.includes(e.name)&&t.isContextBound(e.name)){const a=e.name;return Object.assign(e,{type:"MemberExpression",object:{type:"Identifier",name:a},property:{type:"Identifier",name:"__value"},computed:!1}),delete e.name,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?re(e.name,t):i===e.name&&!t.isContextBound(e.name)?e:re(e.name,t)}return e}function Ue(e,t,i=""){switch(e.type){case"BinaryExpression":return Zt(e,t,i);case"LogicalExpression":return Jt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?pt(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=pt(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 ei(e,t,i);case"ConditionalExpression":{const r=Ue(e.test,t,i),n=Ue(e.consequent,t,i),a=Ue(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=Ue(e.left,t,i),n=Ue(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||de(s,o)},MemberExpression(s){_e(s,"",t)}}),a}function Jt(e,t,i){const r=Ue(e.left,t,i),n=Ue(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||de(s,o)}}),a}function Ei(e,t,i){ee(e,{parent:e,inNamespaceCall:!1},{Identifier(s,o,c){if(s.name=="NaN")return;if(Ke.includes(s.name)&&t.isContextBound(s.name)){const h={type:"MemberExpression",object:{type:"Identifier",name:s.name},property:{type:"Identifier",name:"__value"},computed:!1},p=w.createGetCall(h,0);Object.assign(s,p),delete s.name;return}s.parent=o.parent,he(s,t);const u=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||u)&&(s.type==="MemberExpression"?He(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===z&&s.parent.callee.property.name==="get"||De(s)))},MemberExpression(s,o,c){He(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);de(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,Xt,{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 ei(e,t,i){const r=Ue(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||de(a,s)},MemberExpression(a){_e(a,"",t)}}),n}function Je(e,t,i){switch(e?.type){case"BinaryExpression":e=Zt(e,i,t);break;case"LogicalExpression":e=Jt(e,i,t);break;case"ConditionalExpression":return Ei(e,i,t);case"UnaryExpression":e=ei(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(u=>u.type==="Identifier"?i.isContextBound(u.name)&&!i.isRootParam(u.name)?u:Vr(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"?de(e.object,i):e.object.type==="MemberExpression"?_e(e.object,"",i):e.object.type==="BinaryExpression"?e.object=Zt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Jt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=Ei(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=ei(e.object,i,t));const u=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:pt(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?w.createGetCall(pt(e.property,i),0):e.property,p=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),l=i.generateParamId(),m={type:"CallExpression",callee:p,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,m);return i.addHoistedStatement(y),w.createIdentifier(g)}return m}if(n)if(e.object.type==="Identifier"){const u=e.object.name,[h,p]=i.getVariable(u);if(h!==u&&!i.isLoopVariable(u)){const l=w.createContextVariableReference(p,h),m=w.createGetCall(l,0);e.object=m}}else e.object.type==="MemberExpression"&&Je(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:re(u.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(u.value.type!=="Literal"&&(u.value=Je(u.value,t,i)),u))),e.type==="Identifier"){if(Ke.includes(e.name)&&i.isContextBound(e.name)){const u=e.name;Object.assign(e,{type:"MemberExpression",object:{type:"Identifier",name:u},property:{type:"Identifier",name:"__value"},computed:!1}),delete e.name}else if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const u=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),h=i.generateParamId(),p={type:"CallExpression",callee:u,arguments:[e,Xt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const m=w.createVariableDeclaration(l,p);return i.addHoistedStatement(m),w.createIdentifier(l)}return p}}e?.type==="CallExpression"&&de(e,i);const a=w.createMemberExpression(w.createIdentifier(t),w.createIdentifier("param")),s=e.type==="Identifier"?pt(e,i):e,o=i.generateParamId(),c={type:"CallExpression",callee:a,arguments:[s,Xt,{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 de(e,t,i){if(e._transformed)return;e.callee&&e.callee.name,e.callee&&e.callee.type==="Identifier"&&(gt.includes(e.callee.name)||Ke.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===z&&["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(Je(h,n,t))}),e.arguments=a,n==="ta")if(t.getCurrentScopeType()==="fn"){const h=t.getNextTACallId(),[p]=t.getVariable("$$");let l;p?l=w.createMemberExpression(w.createLocalContextIdentifier(),w.createIdentifier("id")):l=w.createLiteral("");const m={type:"BinaryExpression",operator:"+",left:l,right:h};e.arguments.push(m)}else e.arguments.push(t.getNextTACallId());const s=e.callee.property.name,o=`${n}.${s}`,c=Zn.includes(o),u=e._insideAwait===!0;if(c&&!u){const h=Object.assign({},e),p=w.createAwaitExpression(h);Object.assign(e,p)}if(!t.shouldSuppressHoisting()){const h=t.generateTempVar();t.addLocalSeriesVar(h);const p=e._insideAwait===!0;let l=Object.assign({},e);p&&(l=w.createAwaitExpression(l));const m=w.createVariableDeclaration(h,l);t.addHoistedStatement(m);const g=w.createIdentifier(h);Object.assign(e,g),e._wasHoisted=!0,e._wasInsideAwait=p;return}e._transformed=!0}else if(e.callee&&e.callee.type==="Identifier"){if(e.arguments=e.arguments.map(n=>n._isParamCall?n:Je(n,z,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(p=>p._isParamCall?p:Je(p,z,t));let o=a;a.type==="Identifier"?o=Je(a,z,t):a.type==="CallExpression"&&(de(a,t),o=Je(a,z,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"&&he(e.callee.object,t)}e.arguments.forEach(n=>{ee(n,{parent:e},{Identifier(a,s,o){a.parent=s.parent,he(a,t);const c=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||c)&&(a.type==="MemberExpression"?He(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===z&&a.parent.callee.property.name==="get"||De(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||de(a,t)},MemberExpression(a,s,o){_e(a,"",t),a.object&&o(a.object,{parent:a})}})})}function Or(e,t){let i=null;if(e.left.type==="Identifier")i=re(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=re(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=re(r,t),o=w.createGetCall(s,0);e.left.object=o}}if(ee(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,a){if(Ke.includes(r.name)&&t.isContextBound(r.name)){const g={type:"MemberExpression",object:{type:"Identifier",name:r.name},property:{type:"Identifier",name:"__value"},computed:!1},y=w.createGetCall(g,0);Object.assign(r,y),delete r.name;return}r.parent=n.parent,he(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,p=r.parent&&r.parent.type==="MemberExpression",l=r.name==="NaN",m=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===z&&r.parent.callee.property.name==="get";(c||o||s)&&(r.type==="MemberExpression"?He(r,t):r.type==="Identifier"&&!p&&!u&&!h&&!l&&!m&&De(r))},MemberExpression(r,n,a){_e(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);de(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 Lr(e,t){e._skipTransformation||e.declarations.forEach(i=>{if(i.init&&i.init.type==="Identifier"&&Ke.includes(i.init.name)&&t.isContextBound(i.init.name)){const l=i.init.name;Object.assign(i.init,{type:"MemberExpression",object:{type:"Identifier",name:l},property:{type:"Identifier",name:"__value"},computed:!1}),delete i.init.name}const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===z||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===z||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=z;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=z;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)?de(i.init,t):ee(i.init,{parent:i.init},{Identifier(l,m){l.parent=m.parent,he(l,t);const g=l.parent&&l.parent.type==="BinaryExpression",y=l.parent&&l.parent.type==="UnaryExpression",b=l.parent&&l.parent.type==="ConditionalExpression",v=l.parent&&l.parent.type==="CallExpression"&&l.parent.callee&&l.parent.callee.object&&l.parent.callee.object.name===z&&l.parent.callee.property.name==="get";l.type==="Identifier"&&(g||y||b)&&!v&&De(l)},CallExpression(l,m,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}),de(l,t),l.type==="CallExpression"&&(l.callee.type==="MemberExpression"&&g(l.callee,{parent:l}),l.arguments.forEach(y=>g(y,{parent:l})))},BinaryExpression(l,m,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,m,g){l.object&&l.object.type==="Identifier"&&(l.object.parent=l),l.property&&l.property.type==="Identifier"&&(l.property.parent=l),_e(l,"",t),l.type==="CallExpression"?l.arguments.forEach(y=>g(y,{parent:l})):l.object&&g(l.object,{parent:l})},AwaitExpression(l,m,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,m,g){if(l.body)if(l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(b=>{t.enterHoistingScope(),g(b,{parent:l.body});const v=t.exitHoistingScope();y.push(...v),y.push(b)}),l.body.body=y}else g(l.body,{parent:l})},FunctionExpression(l,m,g){if(l.body&&l.body.type==="BlockStatement"){const y=[];l.body.body.forEach(b=>{t.enterHoistingScope(),g(b,{parent:l.body});const v=t.exitHoistingScope();y.push(...v),y.push(b)}),l.body.body=y}},SwitchStatement(l,m,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,m,g){if(l.test&&(l.test.parent=l,g(l.test,{parent:l})),l.consequent){const y=[];l.consequent.forEach(b=>{t.enterHoistingScope(),b.parent=l,g(b,{parent:l});const v=t.exitHoistingScope();y.push(...v),y.push(b)}),l.consequent=y}}}));const c=re(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||(He(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 p=w.createExpressionStatement(w.createAssignmentExpression(c,h));if(o){const l=i.init.object.name,m=re(l,t),g=i.init.property.value,y={type:"MemberExpression",object:w.createGetCall(m,0),property:{type:"Literal",value:g},computed:!0};p.expression.right=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("init")),[c,y])}a&&(t.pushScope("fn"),ee(i.init.body,t,{IfStatement(l,m,g){m.pushScope("if"),g(l.consequent,m),l.alternate&&(m.pushScope("els"),g(l.alternate,m),m.popScope()),m.popScope()},VariableDeclaration(l,m){Lr(l,m)},Identifier(l,m){he(l,m)},AssignmentExpression(l,m){Or(l,m)},SwitchStatement(l,m,g){l.discriminant.parent=l,g(l.discriminant,m),l.cases.forEach(y=>{y.parent=l,g(y,m)})},SwitchCase(l,m,g){l.test&&(l.test.parent=l,g(l.test,m));const y=[];l.consequent.forEach(b=>{m.enterHoistingScope(),g(b,m);const v=m.exitHoistingScope();y.push(...v),y.push(b)}),l.consequent=y},BlockStatement(l,m,g){const y=[];l.body.forEach(b=>{m.enterHoistingScope(),g(b,m);const v=m.exitHoistingScope();y.push(...v),y.push(b)}),l.body=y}}),t.popScope()),Object.assign(e,p)})}function us(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"),he(a,s),t.popScope())},MemberExpression(a){t.pushScope("for"),_e(a,"",t),t.popScope()},CallExpression(a,s,o){a.callee.parent=a,o(a.callee,s);for(const c of a.arguments)o(c,s)}})}e.test&&ee(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),he(r,n),r.type==="Identifier"&&(r.computed=!0,De(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),_e(r,"",t),t.popScope()},CallExpression(r,n,a){r.callee.parent=r,a(r.callee,n);for(const s of r.arguments)a(s,n)}}),e.update&&ee(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),he(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function hs(e,t){ee(e,t,{MemberExpression(i){_e(i,"",t)},CallExpression(i,r){de(i,r)},Identifier(i,r){he(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&De(i)}})}function ls(e,t,i){e.test&&(t.pushScope("if"),hs(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 ps(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):Vr(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)||_e(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:re(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=re(r.value.name,t))),r)):e.argument.type==="Identifier"&&(he(e.argument,t),e.argument.type==="Identifier"&&De(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||(He(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){he(n,a),n.type==="Identifier"&&!n._arrayAccessed&&(De(n),n._arrayAccessed=!0)},MemberExpression(n){_e(n,"",t)},CallExpression(n,a,s){(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")&&s(n.callee,a),de(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 fs(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 ms(e){const t={...E,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 ds(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 p=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...p),u.push(h)}),s.body=u},BlockStatement(s,o,c){const u=[];s.body.forEach(h=>{o.enterHoistingScope(),c(h,o);const p=o.exitHoistingScope(),l=a(h);l&&u.push(l),u.push(...p),u.push(h)}),s.body=u},ReturnStatement(s,o){ps(s,o)},VariableDeclaration(s,o){Lr(s,o)},Identifier(s,o){he(s,o)},CallExpression(s,o,c){s.callee&&(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&c(s.callee,o),de(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"){he(s.right,o),De(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"?(he(s.right,o),De(s.right)):s.right&&c(s.right,o),s.body&&c(s.body,o)},MemberExpression(s,o){_e(s,i,o)},AssignmentExpression(s,o){Or(s,o)},FunctionDeclaration(s,o,c){fs(s,o,c)},ForStatement(s,o,c){us(s,o,c)},IfStatement(s,o,c){ls(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 p=o.exitHoistingScope();u.push(...p),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"},gs=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),xs=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class ys{constructor(t,i,r,n,a=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=a}}var bs=Object.defineProperty,vs=(e,t,i)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Te=(e,t,i)=>vs(e,typeof t!="symbol"?t+"":t,i);class ws{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(
|
|
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,`
|
|
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(
|
|
38
|
-
`;)t+=this.advance();this.addToken(
|
|
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();Jn.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(es.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 ts(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}var ss=Object.defineProperty,as=(e,t,i)=>t in e?ss(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,fe=(e,t,i)=>as(e,typeof t!="symbol"?t+"":t,i);class ${constructor(t){this.type=t}}class os extends ${constructor(t){super("Program"),this.body=t}}class xe extends ${constructor(t){super("ExpressionStatement"),this.expression=t}}var Ke=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Ke||{});class $e extends ${constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class qe extends ${constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class fi extends ${constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class cs extends ${constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class us extends ${constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,fe(this,"_line")}}class di extends ${constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n,fe(this,"isForIn")}}class hs extends ${constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class Me extends ${constructor(t){super("BlockStatement"),this.body=t}}class mi extends ${constructor(t){super("ReturnStatement"),this.argument=t}}class he extends ${constructor(t){super("Identifier"),this.name=t,fe(this,"varType"),fe(this,"returnType"),fe(this,"isMethod")}}class Qe extends ${constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Ue extends ${constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class xi extends ${constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Tt extends ${constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class ls extends ${constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class ps extends ${constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,fe(this,"arguments"),this.callee=t,this.arguments=i}}class gi extends ${constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class rt 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 fs extends ${constructor(t){super("ArrayExpression"),this.elements=t}}class ds extends ${constructor(t){super("ObjectExpression"),this.properties=t}}class ms 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 yi extends ${constructor(t){super("ArrayPattern"),this.elements=t}}class vi extends ${constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class xs extends ${constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class gs extends ${constructor(t,i,r){super("SwitchCase"),this.test=t,this.consequent=i,this.statements=r,this.statements=r}}var ys=Object.defineProperty,vs=(e,t,i)=>t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Rt=(e,t,i)=>vs(e,typeof t!="symbol"?t+"":t,i);class ws{constructor(t){Rt(this,"tokens"),Rt(this,"pos"),Rt(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 os(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 xe(new he(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 $e([new qe(n,s)],Ke.LET):r=new xe(new Tt(a===":="?"=":a,n,s))}else r=new xe(n)}else r=new xe(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 Me(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 cs(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 he(r);return i&&(a.varType=i),new $e([new qe(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 he(i);return n.varType=t,new $e([new qe(n,r,t)],Ke.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 he(o);if(s&&(c.varType=s),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new vi(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 he(i);return t&&(a.returnType=t),new fi(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 he(o);if(s&&(c.varType=s),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new vi(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 he(i);return t&&(a.returnType=t),a.isMethod=!0,new fi(a,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new Me([new mi(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 mi(i.expression))}return new Me(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 xe(new he(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 $e([new qe(r,a)],Ke.LET)):i.push(new xe(new Tt(n===":="?"=":n,r,a))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new xe(r));else return new xe(r);break}}else if(this.match(m.COMMA)){i.push(new xe(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new xe(r));else return new xe(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 us(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 he(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new yi(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new he(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),a=new $e([new qe(t,r)],Ke.CONST),s=new di(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 $e([new qe(t,r)],Ke.LET),c=new Ue("<=",t,n),u=a?new Tt("+=",t,a):new ls("++",t);return new di(o,c,u,s)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new hs(t,i)}parseBlock(){if(!this.match(m.INDENT)){const r=this.parseStatement();return new Me(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 Me(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 he(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 $e([new qe(new yi(t),i)],Ke.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 rt(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 Ue("||",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 Ue("&&",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 Ue(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 Ue(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 Ue(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 Ue(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 xi(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new xi("!",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 gi(t,new he(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new gi(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 ms(new he(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 ds(r)),new ps(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new Qe(i.value)}if(this.match(m.STRING)){const i=this.advance();return new Qe(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new Qe(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 he(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 fs(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 rt(t,new Me(i),s);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=s,o}else return new rt(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 rt(t,new Me(i),new Me(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 Qe(null);return new rt(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 xe(this.parseExpression()));const a=this.getBlockValue(n);i.push(new gs(r,a,n)),this.skipNewlines()}return this.advance(),new xs(t,i)}getBlockValue(t){if(t.length===0)return new Qe(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 Qe(null)}}var bs=Object.defineProperty,Ss=(e,t,i)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,He=(e,t,i)=>Ss(e,typeof t!="symbol"?t+"":t,i);class Es{constructor(t={}){He(this,"indent"),He(this,"indentStr"),He(this,"output"),He(this,"sourceCode"),He(this,"sourceLines"),He(this,"lastCommentedLine"),He(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(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();gs.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(xs.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 ys(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}var _s=Object.defineProperty,Ss=(e,t,i)=>t in e?_s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xe=(e,t,i)=>Ss(e,typeof t!="symbol"?t+"":t,i);class ${constructor(t){this.type=t}}class Es extends ${constructor(t){super("Program"),this.body=t}}class ve extends ${constructor(t){super("ExpressionStatement"),this.expression=t}}var Ze=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Ze||{});class Ge extends ${constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Ye extends ${constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class Ni extends ${constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class Ns extends ${constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class Is extends ${constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,xe(this,"_line")}}class Ii extends ${constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n,xe(this,"isForIn")}}class Cs extends ${constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class je extends ${constructor(t){super("BlockStatement"),this.body=t}}class Ci extends ${constructor(t){super("ReturnStatement"),this.argument=t}}class fe extends ${constructor(t){super("Identifier"),this.name=t,xe(this,"varType"),xe(this,"returnType"),xe(this,"isMethod")}}class st extends ${constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Qe extends ${constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class ki extends ${constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Wt extends ${constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class ks extends ${constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class As extends ${constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,xe(this,"arguments"),this.callee=t,this.arguments=i}}class Ai extends ${constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class ht extends ${constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,xe(this,"needsIIFE"),xe(this,"consequentStmts"),xe(this,"alternateStmts")}}class Ts extends ${constructor(t){super("ArrayExpression"),this.elements=t}}class Ps extends ${constructor(t){super("ObjectExpression"),this.properties=t}}class Ds extends ${constructor(t,i){super("Property"),this.key=t,this.value=i,xe(this,"kind"),xe(this,"method"),xe(this,"shorthand"),xe(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class Ti extends ${constructor(t){super("ArrayPattern"),this.elements=t}}class Pi extends ${constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class Rs extends ${constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class Vs extends ${constructor(t,i,r){super("SwitchCase"),this.test=t,this.consequent=i,this.statements=r,this.statements=r}}var Os=Object.defineProperty,Ls=(e,t,i)=>t in e?Os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,$t=(e,t,i)=>Ls(e,typeof t!="symbol"?t+"":t,i);class Ms{constructor(t){$t(this,"tokens"),$t(this,"pos"),$t(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 Es(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 ve(new fe(n))}else this.isTupleDestructuring()?r=this.parseTupleDestructuring():this.peek().type===x.IDENTIFIER&&this.isTypedVarDeclaration()&&(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 Ge([new Ye(n,s)],Ze.LET):r=new ve(new Wt(a===":="?"=":a,n,s))}else r=new ve(n)}else r=new ve(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 Ns(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 fe(r);return i&&(a.varType=i),new Ge([new Ye(a,n,i)],t)}isTypedVarDeclaration(){let t=0;if(this.peek(t).type!==x.IDENTIFIER)return!1;if(t++,this.peek(t).type===x.LBRACKET&&this.peek(t+1).type===x.RBRACKET)return t+=2,this.peek(t).type!==x.IDENTIFIER?!1:(t++,this.peek(t).type===x.OPERATOR&&this.peek(t).value==="=");if(this.peek(t).type===x.OPERATOR&&this.peek(t).value==="<"){t++;let i=1;for(;i>0&&this.peek(t).type!==x.EOF;)this.peek(t).type===x.OPERATOR&&this.peek(t).value==="<"?i++:this.peek(t).type===x.OPERATOR&&this.peek(t).value===">"&&i--,t++;return this.peek(t).type!==x.IDENTIFIER?!1:(t++,this.peek(t).type===x.OPERATOR&&this.peek(t).value==="=")}if(this.peek(t).type!==x.IDENTIFIER)return!1;for(t++;this.peek(t).type===x.IDENTIFIER;)t++;return this.peek(t).type===x.OPERATOR&&this.peek(t).value==="="}parseTypedVarDeclaration(){let t=this.advance().value;if(this.match(x.LBRACKET)&&this.peek(1).type===x.RBRACKET)this.advance(),this.advance(),t+="[]";else if(this.match(x.OPERATOR,"<")){for(this.advance(),t+="<";!this.match(x.OPERATOR,">");)if(this.match(x.IDENTIFIER))t+=this.advance().value;else if(this.match(x.COMMA))t+=this.advance().value,this.skipNewlines();else break;this.match(x.OPERATOR,">")&&(t+=">",this.advance())}else 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 fe(i);return n.varType=t,new Ge([new Ye(n,r,t)],Ze.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 fe(o);if(s&&(c.varType=s),this.match(x.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new Pi(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 fe(i);return t&&(a.returnType=t),new Ni(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 fe(o);if(s&&(c.varType=s),this.match(x.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new Pi(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 fe(i);return t&&(a.returnType=t),a.isMethod=!0,new Ni(a,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(x.INDENT)){const i=this.parseExpression();return new je([new Ci(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 Ci(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 ve(new fe(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.isTypedVarDeclaration())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 Ge([new Ye(r,a)],Ze.LET)):i.push(new ve(new Wt(n===":="?"=":n,r,a))),this.match(x.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new ve(r));else return new ve(r);break}}else if(this.match(x.COMMA)){i.push(new ve(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new ve(r));else return new ve(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 Is(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 fe(this.expect(x.IDENTIFIER).value)),this.match(x.COMMA)&&this.advance();this.expect(x.RBRACKET),t=new Ti(r),i=!0}else{const r=this.expect(x.IDENTIFIER).value;t=new fe(r)}if(this.match(x.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),a=new Ge([new Ye(t,r)],Ze.CONST),s=new Ii(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 Ge([new Ye(t,r)],Ze.LET),c=new Qe("<=",t,n),u=a?new Wt("+=",t,a):new ks("++",t);return new Ii(o,c,u,s)}}parseWhileStatement(){this.expect(x.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Cs(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 fe(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 Ge([new Ye(new Ti(t),i)],Ze.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 ht(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 Qe("||",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 Qe("&&",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 Qe(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 Qe(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 Qe(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 Qe(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 ki(t,this.parseUnary())}return this.match(x.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new ki("!",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 Ai(t,new fe(i),!1)}else if(this.match(x.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(x.RBRACKET),t=new Ai(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 Ds(new fe(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 Ps(r)),new As(t,i)}parsePrimary(){const t=this.peek();if(this.match(x.NUMBER)){const i=this.advance();return new st(i.value)}if(this.match(x.STRING)){const i=this.advance();return new st(i.value)}if(this.match(x.BOOLEAN)){const i=this.advance();return new st(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 fe(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 Ts(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 ht(t,new je(i),s);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=s,o}else return new ht(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 ht(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 st(null);return new ht(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 ve(this.parseExpression()));const a=this.getBlockValue(n);i.push(new Vs(r,a,n)),this.skipNewlines()}return this.advance(),new Rs(t,i)}getBlockValue(t){if(t.length===0)return new st(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 st(null)}}var Bs=Object.defineProperty,js=(e,t,i)=>t in e?Bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Xe=(e,t,i)=>js(e,typeof t!="symbol"?t+"":t,i);class Fs{constructor(t={}){Xe(this,"indent"),Xe(this,"indentStr"),Xe(this,"output"),Xe(this,"sourceCode"),Xe(this,"sourceLines"),Xe(this,"lastCommentedLine"),Xe(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(`
|
|
@@ -119,8 +119,8 @@ ${e}
|
|
|
119
119
|
`):this.write(`{
|
|
120
120
|
`),this.indent++,r.statements&&r.statements.length>0)for(const n of r.statements)this.write(this.indentStr.repeat(this.indent)),this.generateStatement(n);else this.write(this.indentStr.repeat(this.indent)),this.generateExpression(r.consequent),this.write(`;
|
|
121
121
|
`);this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write("}"),i<t.cases.length-1||this.write(`
|
|
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
|
|
123
|
-
`):[],a=
|
|
124
|
-
; return _r;`)(this)}function Cs(e){return t=>new q(t.array.map(i=>Math.abs(i)),t.type,e)}function ks(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 As(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 Ps(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 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>0&&r[n-1]===i?n-1:n}}function Rs(e){return t=>{t.array.length=0}}function Ds(e){return(t,i)=>(t.array.push(...i.array),t)}function Vs(e){return t=>new q([...t.array],t.type,e)}function Ls(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 Ms(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 Ce(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 lt(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 Bs(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(!lt(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 Fs(e){return t=>t.array.length>0?t.array[0]:e.NA}function Ws(e){return(t,i)=>t.array[i]}function js(e){return(t,i)=>t.array.includes(i)}function $s(e){return(t,i)=>t.array.indexOf(i)}function qs(e){return(t,i,r)=>{if(!lt(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 Us(e){return(t,i=",")=>t.array.join(i)}function Hs(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Ks(e){return(t,i)=>t.array.lastIndexOf(i)}function Gs(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function zs(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 Ys(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function Qs(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 Xs(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 Zs(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 Js(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 ea(e){return t=>t.array.pop()}function ta(e){return(t,i)=>{if(!lt(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 ia(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function ra(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function na(e){return t=>{t.array.reverse()}}function sa(e){return(t,i,r)=>{if(!lt(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 aa(e){return t=>t.array.shift()}function oa(e){return t=>t.array.length}function ca(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 ua(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var Ze=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(Ze||{}),Er=(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))(Er||{}),_r=(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))(_r||{}),Nr=(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))(Nr||{}),Ir=(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))(Ir||{}),Cr=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))(Cr||{}),kr=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(kr||{}),Ar=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(Ar||{}),ha=(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))(ha||{}),Pr=(e=>(e.gaps_on="gaps_on",e.gaps_off="gaps_off",e.lookahead_on="lookahead_on",e.lookahead_off="lookahead_off",e))(Pr||{});const la={order:Ze,currency:Er,dayofweek:_r,display:Nr,shape:Ir,location:Cr,size:kr,format:Ar,barmerge:Pr};function pa(e){return(t,i=Ze.ascending)=>{t.array.sort((r,n)=>{let a=isNaN(r)?1/0:r,s=isNaN(n)?1/0:n;return i===Ze.ascending?a-s:s-a})}}function fa(e){return(t,i=Ze.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===Ze.ascending?s-o:o-s}),new q(r,G.int,e)}}function da(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 ma(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 xa(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function ga(e){return(t,i)=>{if(!lt(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 ya(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 va=Object.defineProperty,wa=(e,t,i)=>t in e?va(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>wa(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=Cs(this.context),this._avg=ks(this.context),this._binary_search=As(this.context),this._binary_search_leftmost=Ps(this.context),this._binary_search_rightmost=Ts(this.context),this._clear=Rs(this.context),this._concat=Ds(this.context),this._copy=Vs(this.context),this._covariance=Ls(this.context),this._every=Os(this.context),this._fill=Bs(this.context),this._first=Fs(this.context),this._get=Ws(this.context),this._includes=js(this.context),this._indexof=$s(this.context),this._insert=qs(this.context),this._join=Us(this.context),this._last=Hs(this.context),this._lastindexof=Ks(this.context),this._max=Gs(this.context),this._median=zs(this.context),this._min=Ys(this.context),this._mode=Qs(this.context),this._percentile_linear_interpolation=Xs(this.context),this._percentile_nearest_rank=Zs(this.context),this._percentrank=Js(this.context),this._pop=ea(this.context),this._push=ta(this.context),this._range=ia(this.context),this._remove=ra(this.context),this._reverse=na(this.context),this._set=sa(this.context),this._shift=aa(this.context),this._size=oa(this.context),this._slice=ca(this.context),this._some=ua(this.context),this._sort=pa(this.context),this._sort_indices=fa(this.context),this._standardize=da(this.context),this._stdev=ma(this.context),this._sum=xa(this.context),this._unshift=ga(this.context),this._variance=ya(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 ba(e){return(...t)=>new q([...t],Ms(t),e)}function Sa(e){return(t,i)=>new q(Array(t).fill(e.precision(i||0)),Ce(i||0),e)}function Ea(e){return(t,i=!1)=>new q(Array(t).fill(i),G.bool,e)}function _a(e){return(t,i=NaN)=>new q(Array(t).fill(e.precision(i)),G.float,e)}function Na(e){return(t,i=0)=>new q(Array(t).fill(e.precision(i)),G.int,e)}function Ia(e){return(t,i="")=>new q(Array(t).fill(i),G.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 Ca(e){return(t,i=0)=>x.from(t).get(i)}class ka{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=ba(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=Sa(t),this.new_bool=Ea(t),this.new_float=_a(t),this.new_int=Na(t),this.new_string=Ia(t),this.param=Ca(),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 Aa(e){return t=>{t.map.clear()}}function Pa(e){return(t,i)=>t.map.has(i)}function Ta(e){return t=>{const i=new Tr(e);return i.map=new Map(t.map),i}}function Ra(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function Da(e){return t=>{const i=Array.from(t.map.keys()),r=Ce(i[0]);return new q(i,r,e)}}function Va(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function La(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 Ma(e){return t=>t.map.size}function Ba(e){return t=>{const i=Array.from(t.map.values()),r=Ce(i[0]);return new q(i,r,e)}}var Fa=Object.defineProperty,Wa=(e,t,i)=>t in e?Fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ee=(e,t,i)=>Wa(e,typeof t!="symbol"?t+"":t,i);class Tr{constructor(t){this.context=t,Ee(this,"map"),Ee(this,"_clear"),Ee(this,"_contains"),Ee(this,"_copy"),Ee(this,"_get"),Ee(this,"_keys"),Ee(this,"_put"),Ee(this,"_put_all"),Ee(this,"_remove"),Ee(this,"_size"),Ee(this,"_values"),this.map=new Map,this._clear=Aa(this.context),this._contains=Pa(this.context),this._copy=Ta(this.context),this._get=Ra(this.context),this._keys=Da(this.context),this._put=Va(this.context),this._put_all=La(this.context),this._remove=Oa(this.context),this._size=Ma(this.context),this._values=Ba(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 ja(e){return()=>new Tr(e)}function $a(e){return(t,i=0)=>x.from(t).get(i)}class qa{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=ja(t),this.param=$a(),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 Ua(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 Ha(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 Ka(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 Ga(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=Ce(n[0]);return new q(n,a,e)}}function za(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Ya(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 Qa(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 Xa(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 Za(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Xa(t.matrix)}}function Ja(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 eo(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 to(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const s=Ce(t.matrix[0][0]);return new q([],s,e)}const n=eo(t.matrix),a=Ce(n[0]);return new q(n,a,e)}}function io(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 ro(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function no(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 so(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function ao(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 oo(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=ao(t.matrix),a=new W(i,r,NaN,e);return a.matrix=n,a}}function co(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 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(t.matrix[a][n]!==-t.matrix[n][a])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;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 lo(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 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){if(t.matrix[n][a]!==1)return!1}else if(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;return i===r}}function mo(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 xo(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 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;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 yo(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 vo(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 wo(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 bo(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 So(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 Eo(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 _o(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 No(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 Io(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 Co(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 ko(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const s=Ce(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=Ce(n[0]);return new q(n,a,e)}}function Ao(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=Ce(r[0][0]);return new q(r[0]||[],n,e)}}function Po(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 To(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Ro(e){return(t,i)=>{if(!t.matrix[i]){const n=Ce(t.matrix[0][0]);return new q([],n,e)}const r=Ce(t.matrix[i][0]);return new q([...t.matrix[i]],r,e)}}function Do(e){return t=>t.matrix.length}function Vo(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Lo(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 Mo(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 Bo(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 Fo(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function Wo(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 jo(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 $o=Object.defineProperty,qo=(e,t,i)=>t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,P=(e,t,i)=>qo(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=Ua(this.context),this._add_row=Ha(this.context),this._avg=Ka(this.context),this._col=Ga(this.context),this._columns=za(this.context),this._concat=Ya(this.context),this._copy=Qa(this.context),this._det=Za(this.context),this._diff=Ja(this.context),this._eigenvalues=to(this.context),this._eigenvectors=io(this.context),this._elements_count=ro(this.context),this._fill=no(this.context),this._get=so(this.context),this._inv=oo(this.context),this._is_antidiagonal=co(this.context),this._is_antisymmetric=uo(this.context),this._is_binary=ho(this.context),this._is_diagonal=lo(this.context),this._is_identity=po(this.context),this._is_square=fo(this.context),this._is_stochastic=mo(this.context),this._is_symmetric=xo(this.context),this._is_triangular=go(this.context),this._is_zero=yo(this.context),this._kron=vo(this.context),this._max=wo(this.context),this._median=bo(this.context),this._min=So(this.context),this._mode=Eo(this.context),this._mult=_o(this.context),this._pinv=No(this.context),this._pow=Io(this.context),this._rank=Co(this.context),this._remove_col=ko(this.context),this._remove_row=Ao(this.context),this._reshape=Po(this.context),this._reverse=To(this.context),this._row=Ro(this.context),this._rows=Do(this.context),this._set=Vo(this.context),this._sort=Lo(this.context),this._submatrix=Oo(this.context),this._sum=Mo(this.context),this._swap_columns=Bo(this.context),this._swap_rows=Fo(this.context),this._trace=Wo(this.context),this._transpose=jo(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 Uo(e){return(t,i,r)=>new W(t,i,r,e)}function Ho(e){return(t,i=0)=>x.from(t).get(i)}class Ko{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=Uo(t),this.param=Ho(),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 Go=Object.defineProperty,zo=(e,t,i)=>t in e?Go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Yo=(e,t,i)=>zo(e,typeof t!="symbol"?t+"":t,i);class Qo{constructor(t){this.context=t,Yo(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 vt{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 vt(this.__def__,this.context)}toString(){const t={};for(let i in this.__def__)t[i]=this[i];return JSON.stringify(t)}}function Xo(e){return typeof e=="object"&&e.title!==void 0&&e.data!==void 0&&e.options!==void 0}const wi={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)&&!Xo(e)};function Ne(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(wi.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=wi[i[f]];typeof l=="function"&&l(c)?n[f]=c:s[h]=!1}}return{...a,...n,...r}}var Zo=Object.defineProperty,Jo=(e,t,i)=>t in e?Zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ec=(e,t,i)=>Jo(e,typeof t!="symbol"?t+"":t,i);const tc=["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"],ic={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 rc(e){return Ne(e,tc,ic)}class nc{constructor(t){this.context=t,ec(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=rc(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 vt(n,this.context)},copy:function(r){return new vt(r.__def__,this.context)}}}}const sc=[["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"]],ac={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 Ne(e,sc,ac)}function Se(e,t){return t.title&&e.inputs&&e.inputs[t.title]!==void 0?e.inputs[t.title]:t.defval}function oc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}function cc(e){return(...t)=>pe(t).defval}function uc(e){return(...t)=>{const i=pe(t);return Se(e,i)}}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,i=0)=>x.from(t).get(i)}function dc(e){return(...t)=>{const i=pe(t);return Se(e,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)=>pe(t).defval}var Sc=Object.defineProperty,Ec=(e,t,i)=>t in e?Sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ae=(e,t,i)=>Ec(e,typeof t!="symbol"?t+"":t,i);const _c={any:oc,bool:cc,color:uc,enum:hc,float:lc,int:pc,param:fc,price:dc,session:mc,source:xc,string:gc,symbol:yc,text_area:vc,time:wc,timeframe:bc};class Nc{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(_c).forEach(([i,r])=>{this[i]=r(t)})}}function Ic(e){return t=>Math.abs(x.from(t).get(0))}function Cc(e){return t=>Math.acos(x.from(t).get(0))}function kc(e){return t=>Math.asin(x.from(t).get(0))}function Ac(e){return t=>Math.atan(x.from(t).get(0))}function Pc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Tc(e){return t=>Math.ceil(x.from(t).get(0))}function Rc(e){return t=>Math.cos(x.from(t).get(0))}function Dc(e){return()=>Math.E}function Vc(e){return t=>Math.exp(x.from(t).get(0))}function Lc(e){return t=>Math.floor(x.from(t).get(0))}function Oc(e){return t=>Math.log(x.from(t).get(0))}function Mc(e){return t=>Math.log(x.from(t).get(0))}function Bc(e){return t=>Math.log10(x.from(t).get(0))}function Fc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return Math.max(...i)}}function Wc(e){return(...t)=>{const i=t.map(r=>x.from(r).get(0));return Math.min(...i)}}function jc(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 $c(e){return()=>1.618033988749895}function qc(e){return()=>Math.PI}function Uc(e){return(t,i)=>Math.pow(x.from(t).get(0),x.from(i).get(0))}function Hc(e){return()=>Math.random()}function Kc(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 Gc(e){return t=>e.precision(Math.round(x.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function zc(e){return()=>.6180339887498948}function Yc(e){return t=>Math.sign(x.from(t).get(0))}function Qc(e){return t=>Math.sin(x.from(t).get(0))}function Xc(e){return t=>Math.sqrt(x.from(t).get(0))}function Zc(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 Jc(e){return t=>Math.tan(x.from(t).get(0))}function eu(e){return t=>{const i=x.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function tu(e){return t=>{const i=x.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function iu(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 ru=Object.defineProperty,nu=(e,t,i)=>t in e?ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,B=(e,t,i)=>nu(e,typeof t!="symbol"?t+"":t,i);const su={abs:Ic,acos:Cc,asin:kc,atan:Ac,avg:Pc,ceil:Tc,cos:Rc,e:Dc,exp:Vc,floor:Lc,ln:Oc,log:Mc,log10:Bc,max:Fc,min:Wc,param:jc,phi:$c,pi:qc,pow:Uc,random:Hc,round:Kc,round_to_mintick:Gc,rphi:zc,sign:Yc,sin:Qc,sqrt:Xc,sum:Zc,tan:Jc,todegrees:eu,toradians:tu,__eq:iu};class au{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(su).forEach(([i,r])=>{this[i]=r(t)})}}function ou(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 wt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function bi(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 Si(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 cu(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=wt.indexOf(e.timeframe),v=wt.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 ne=e.cache[I],Oe=b?Si(_,N,ne.data.openTime.data,ne.data.closeTime.data,g,e.eDate,d):bi(_,N,ne.data.openTime.data,ne.data.closeTime.data,g);if(Oe==-1)return NaN;const te=ne.params[l][Oe];if(!b&&d){const ei=e.cache[E];return ei!==void 0&&ei===Oe?NaN:(e.cache[E]=Oe,Array.isArray(te)?[te]:te)}return Array.isArray(te)?[te]:te}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,z=new Dr(e.source,u,h,F,D,void 0);z.markAsSecondary();const Y=await z.run(e.pineTSCode);e.cache[I]=Y;const H=b?Si(_,N,Y.data.openTime.data,Y.data.closeTime.data,g,e.eDate,d):bi(_,N,Y.data.openTime.data,Y.data.closeTime.data,g);if(H==-1)return NaN;const re=Y.params[l][H];return!b&&d?(e.cache[E]=H,NaN):Array.isArray(re)?[re]:re}}function uu(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=wt.indexOf(e.timeframe),g=wt.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 Dr(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 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 hu=Object.defineProperty,lu=(e,t,i)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,dt=(e,t,i)=>lu(e,typeof t!="symbol"?t+"":t,i);const pu={param:ou,security:cu,security_lower_tf:uu};class fu{constructor(t){this.context=t,dt(this,"_cache",{}),dt(this,"param"),dt(this,"security"),dt(this,"security_lower_tf"),Object.entries(pu).forEach(([i,r])=>{this[i]=r(t)})}}function du(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 mu(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 xu(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 gu(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 yu(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 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||`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 wu(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 bu(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 Su(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 Eu(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 _u(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 Nu(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 Iu(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 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)=>{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 Au(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 Pu(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,O=o.prevSmoothedMinus;if(v++,v<=n)b+=f,_+=g,N+=y,v===n&&(I=b/n,E=_/n,O=N/n);else{const te=1/n;I=te*f+(1-te)*I,E=te*g+(1-te)*E,O=te*y+(1-te)*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,z=D+F,Y=z===0?0:100*Math.abs(D-F)/z;let H=o.prevAdxInitCount,re=o.prevDxInitSum,ne=o.prevADX,Oe=NaN;if(H++,H<=a)re+=Y,H===a&&(ne=re/a,Oe=ne);else{const te=1/a;ne=te*Y+(1-te)*ne,Oe=ne}return o.currentAdxInitCount=H,o.currentDxInitSum=re,o.currentADX=ne,[[e.precision(D),e.precision(F),e.precision(Oe)]]}}function Tu(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 Ru(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 Du(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 Vu(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 Lu(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 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 Mu(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,O,D)=>{if(isNaN(O))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+=O,F++,E.initSum=z,E.initCount=F,E.prevEma=Y,F===D){const ne=z/D;return E.prevEma=ne,ne}return NaN}const H=2/(D+1),re=O*H+Y*(1-H);return E.prevEma=re,E.initSum=z,E.initCount=F,re},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 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)),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,z=N.prevEma;if(D<O){if(F+=E,D++,I.initSum=F,I.initCount=D,I.prevEma=z,D===O){const re=F/O;return I.prevEma=re,re}return NaN}const Y=2/(O+1),H=E*Y+z*(1-Y);return I.prevEma=H,I.initSum=F,I.initCount=D,H};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 Fu(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 Wu(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 ju(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 $u(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 qu(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 Uu(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 Hu(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 Ku(e){return(t,i,r)=>{const n=x.from(i).get(0);return e.pine.ta.change(t,n,r)}}function Gu(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 zu(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 Yu(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 Qu(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 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 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 Zu(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 Ju(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 eh(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=Ju(o,a,s),u=e.idx;return e.precision(c[u])}}function th(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 ih(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=th(o,a,s),u=e.idx;return e.precision(c[u])}}function rh(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 nh(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 sh(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 ah(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 oh(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 ch(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 uh(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 hh(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),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 lh(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 ph(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 fh(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 dh(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 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 mh(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 xh(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 gh(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 O=c.prevEma2PcCount,D=c.prevEma2PcSum,F=c.prevEma2PcValue;O++,O<=a?(D+=_,O===a&&(F=D/a)):F=_*d+F*(1-d);let z=c.prevEma2AbsCount,Y=c.prevEma2AbsSum,H=c.prevEma2AbsValue;if(z++,z<=a?(Y+=E,z===a&&(H=Y/a)):H=E*y+H*(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=z,c.currentEma2AbsSum=Y,c.currentEma2AbsValue=H,isNaN(F)||isNaN(H))return NaN;if(H===0)return e.precision(0);const re=F/H;return e.precision(re)}}function yh(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 vh(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 wh(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 bh(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 Sh(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 Eh(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 _h(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 Nh(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 Ih=Object.defineProperty,Ch=(e,t,i)=>t in e?Ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,C=(e,t,i)=>Ch(e,typeof t!="symbol"?t+"":t,i);const kh={accdist:du,alma:mu,atr:xu,barssince:gu,bb:yu,bbw:vu,cci:wu,change:bu,cmo:Su,cog:Eu,correlation:_u,cross:Nu,crossover:Iu,crossunder:Cu,cum:ku,dev:Au,dmi:Pu,ema:Tu,falling:Ru,highest:Du,highestbars:Vu,hma:Lu,iii:Ou,kc:Mu,kcw:Bu,linreg:Fu,lowest:Wu,lowestbars:ju,macd:$u,median:qu,mfi:Uu,mode:Hu,mom:Ku,nvi:Gu,obv:zu,param:Yu,percentile_linear_interpolation:Qu,percentile_nearest_rank:Xu,percentrank:Zu,pivothigh:eh,pivotlow:ih,pvi:rh,pvt:nh,range:sh,rising:ah,rma:oh,roc:ch,rsi:uh,sar:hh,sma:lh,stdev:ph,stoch:fh,supertrend:dh,swma:mh,tr:xh,tsi:gh,valuewhen:yh,variance:vh,vwap:wh,vwma:bh,wad:Sh,wma:Eh,wpr:_h,wvad:Nh};class Ah{constructor(t){this.context=t,C(this,"accdist"),C(this,"alma"),C(this,"atr"),C(this,"barssince"),C(this,"bb"),C(this,"bbw"),C(this,"cci"),C(this,"change"),C(this,"cmo"),C(this,"cog"),C(this,"correlation"),C(this,"cross"),C(this,"crossover"),C(this,"crossunder"),C(this,"cum"),C(this,"dev"),C(this,"dmi"),C(this,"ema"),C(this,"falling"),C(this,"highest"),C(this,"highestbars"),C(this,"hma"),C(this,"iii"),C(this,"kc"),C(this,"kcw"),C(this,"linreg"),C(this,"lowest"),C(this,"lowestbars"),C(this,"macd"),C(this,"median"),C(this,"mfi"),C(this,"mode"),C(this,"mom"),C(this,"nvi"),C(this,"obv"),C(this,"param"),C(this,"percentile_linear_interpolation"),C(this,"percentile_nearest_rank"),C(this,"percentrank"),C(this,"pivothigh"),C(this,"pivotlow"),C(this,"pvi"),C(this,"pvt"),C(this,"range"),C(this,"rising"),C(this,"rma"),C(this,"roc"),C(this,"rsi"),C(this,"sar"),C(this,"sma"),C(this,"stdev"),C(this,"stoch"),C(this,"supertrend"),C(this,"swma"),C(this,"tr"),C(this,"tsi"),C(this,"valuewhen"),C(this,"variance"),C(this,"vwap"),C(this,"vwma"),C(this,"wad"),C(this,"wma"),C(this,"wpr"),C(this,"wvad"),Object.entries(kh).forEach(([i,r])=>{this[i]=r(t)})}}class Ph{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 Th{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 Rh{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 Ei=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Dh=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Vh=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Lh=["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"],_i=["color","offset","editable","show_last","title","display","force_overlay"],Mh=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],Ni={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"},Bh={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"},Fh={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"},Wh={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"},jh={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"},Ii={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},$h={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class qh{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=Ne(t,Ei,Ni),{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=Ne(t,Ei,Ni),{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=Ne(t,Dh,Bh),{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=Ne(t,Vh,Fh),{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=Ne(t,Lh,Wh),{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=Ne(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:"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=Ne(t,_i,Ii),{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=Ne(t,_i,Ii),{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 Uh{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 Hh{constructor(t){this.context=t}param(t,i=0,r){return x.from(t).get(i)}any(...t){const i=Ne(t,Mh,$h),{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 Kh=Object.defineProperty,Gh=(e,t,i)=>t in e?Kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>Gh(e,typeof t!="symbol"?t+"":t,i);const Rr=class qt{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 nc(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 Nc(this),ta:new Ah(this),math:new au(this),request:new fu(this),array:new ka(this),map:new qa(this),matrix:new Ko(this),syminfo:null,timeframe:new Rh(this),barstate:new Qo(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 Ph(this),str:new Th(this),...f,...la};const d=new qh(this),g=new Uh(this),y=new Hh(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}`;qt._deprecationWarningsShown.has(r)||(qt._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 Ci=Rr;var zh=Object.defineProperty,Yh=(e,t,i)=>t in e?zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ki=(e,t,i)=>Yh(e,typeof t!="symbol"?t+"":t,i);class Ai{constructor(t,i={}){ki(this,"source"),ki(this,"inputs"),this.source=t,this.inputs=i}}var Qh=Object.defineProperty,Xh=(e,t,i)=>t in e?Qh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,J=(e,t,i)=>Xh(e,typeof t!="symbol"?t+"":t,i);class Dr{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 Ai?(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 Ai?(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 Ci({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 Ci({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 Is.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 Zh=Object.defineProperty,Jh=(e,t,i)=>t in e?Zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,bt=(e,t,i)=>Jh(e,typeof t!="symbol"?t+"":t,i);const Dt="https://api.binance.com/api/v3",Pi="https://api.binance.us/api/v3",Vt={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 el{constructor(t=300*1e3){bt(this,"cache"),bt(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 tl{constructor(){bt(this,"cacheManager"),bt(this,"activeApiUrl",null),this.cacheManager=new el(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Dt}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Dt,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Pi}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Pi,this.activeApiUrl}catch{}return Dt}async getMarketDataInterval(t,i,r,n){try{const a=Vt[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=Vt[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=Vt[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 il{async getMarketData(){return[]}}const rl=typeof process<"u"&&process.versions&&process.versions.node;let St=null;if(rl)try{St=new il}catch{St=null}const nl={Binance:new tl,...St?{Mock:St}:{}};export{Ci as Context,Ai as Indicator,Dr as PineTS,nl as Provider};
|
|
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 Ws(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 ws(e).tokenize(),n=new Ms(r).parse(),a={...t,sourceCode:e},s=new Fs(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 $s(e){if(typeof e=="function")return e.toString();{const t=Mr(e);if(t===null)return e;if(t>=5){const i=Ws(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 Us(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=$s(e);r=ns(r);const n=i?r.split(`
|
|
123
|
+
`):[],a=Cr(r,{ecmaVersion:"latest",sourceType:"module",locations:i});ss(a),ts(a),es(a);const s=new Yn;as(a,s);const o=cs(a,s)||"";ds(a,s,o,t,n),ms(a);const c=Un||ui||void 0,u=Object.assign({},c,{LineComment(p,l){l.write("//"+p.value)}}),h=Ar(a,{generator:u,comments:i});return new Function("",`var _r = ${h}
|
|
124
|
+
; return _r;`)(this)}function qs(e){return t=>new U(t.array.map(i=>Math.abs(i)),t.type,e)}function Hs(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 zs(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 Ks(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 Gs(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 Ys(e){return t=>{t.array.length=0}}function Qs(e){return(t,i)=>(t.array.push(...i.array),t)}function Xs(e){return t=>new U([...t.array],t.type,e)}function Zs(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]),b=Number(a[g]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(b)&&b!==null&&b!==void 0&&(s+=y,o+=b,c++,u.push(g))}if(c===0)return NaN;const h=s/c,p=o/c;let l=0;for(const g of u){const y=Number(n[g]),b=Number(a[g]);l+=(y-h)*(b-p)}const m=r?c:c-1;return m<=0?NaN:e.precision(l/m)}}function Js(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function ea(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 Ae(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 xt(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 ta(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(!xt(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 ia(e){return t=>t.array.length>0?t.array[0]:e.NA}function ra(e){return(t,i)=>t.array[i]}function na(e){return(t,i)=>t.array.includes(i)}function sa(e){return(t,i)=>t.array.indexOf(i)}function aa(e){return(t,i,r)=>{if(!xt(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 oa(e){return(t,i=",")=>t.array.join(i)}function ca(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function ua(e){return(t,i)=>t.array.lastIndexOf(i)}function ha(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function la(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 pa(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function fa(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 ma(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 da(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 ga(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 xa(e){return t=>t.array.pop()}function ya(e){return(t,i)=>{if(!xt(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 ba(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function va(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function wa(e){return t=>{t.array.reverse()}}function _a(e){return(t,i,r)=>{if(!xt(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 Sa(e){return t=>t.array.shift()}function Ea(e){return t=>t.array.length}function Na(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new U(t.array.slice(i,n),t.type,e)}}function Ia(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var at=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(at||{}),Br=(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))(Br||{}),jr=(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))(jr||{}),Fr=(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))(Fr||{}),Wr=(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))(Wr||{}),$r=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))($r||{}),Ur=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(Ur||{}),qr=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(qr||{}),Ca=(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))(Ca||{}),Hr=(e=>(e.gaps_on="gaps_on",e.gaps_off="gaps_off",e.lookahead_on="lookahead_on",e.lookahead_off="lookahead_off",e))(Hr||{}),zr=(e=>(e.bar_index="bar_index",e.bar_time="bar_time",e))(zr||{}),Kr=(e=>(e.price="price",e.abovebar="abovebar",e.belowbar="belowbar",e))(Kr||{}),Gr=(e=>(e.align_left="align_left",e.align_center="align_center",e.align_right="align_right",e.wrap_auto="wrap_auto",e.wrap_none="wrap_none",e))(Gr||{}),Yr=(e=>(e.family_default="family_default",e.family_monospace="family_monospace",e))(Yr||{});const ka={order:at,currency:Br,dayofweek:jr,display:Fr,shape:Wr,location:$r,size:Ur,format:qr,barmerge:Hr,xloc:zr,yloc:Kr,text:Gr,font:Yr};function Aa(e){return(t,i=at.ascending)=>{t.array.sort((r,n)=>{let a=isNaN(r)?1/0:r,s=isNaN(n)?1/0:n;return i===at.ascending?a-s:s-a})}}function Ta(e){return(t,i=at.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===at.ascending?s-o:o-s}),new U(r,K.int,e)}}function Pa(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new U(t.array.map(()=>NaN),K.int,e):r===0?new U(t.array.map(()=>1),K.int,e):new U(t.array.map(n=>(n-i)/r),K.int,e)}}function Da(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 p=Number(r[h]);!isNaN(p)&&p!==null&&p!==void 0&&(a+=p,s+=p*p,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 Ra(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function Va(e){return(t,i)=>{if(!xt(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 Oa(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 La=Object.defineProperty,Ma=(e,t,i)=>t in e?La(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,D=(e,t,i)=>Ma(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 U{constructor(t,i,r){this.array=t,this.type=i,this.context=r,D(this,"_abs"),D(this,"_avg"),D(this,"_binary_search"),D(this,"_binary_search_leftmost"),D(this,"_binary_search_rightmost"),D(this,"_clear"),D(this,"_concat"),D(this,"_copy"),D(this,"_covariance"),D(this,"_every"),D(this,"_fill"),D(this,"_first"),D(this,"_get"),D(this,"_includes"),D(this,"_indexof"),D(this,"_insert"),D(this,"_join"),D(this,"_last"),D(this,"_lastindexof"),D(this,"_max"),D(this,"_median"),D(this,"_min"),D(this,"_mode"),D(this,"_percentile_linear_interpolation"),D(this,"_percentile_nearest_rank"),D(this,"_percentrank"),D(this,"_pop"),D(this,"_push"),D(this,"_range"),D(this,"_remove"),D(this,"_reverse"),D(this,"_set"),D(this,"_shift"),D(this,"_size"),D(this,"_slice"),D(this,"_some"),D(this,"_sort"),D(this,"_sort_indices"),D(this,"_standardize"),D(this,"_stdev"),D(this,"_sum"),D(this,"_unshift"),D(this,"_variance"),this._abs=qs(this.context),this._avg=Hs(this.context),this._binary_search=zs(this.context),this._binary_search_leftmost=Ks(this.context),this._binary_search_rightmost=Gs(this.context),this._clear=Ys(this.context),this._concat=Qs(this.context),this._copy=Xs(this.context),this._covariance=Zs(this.context),this._every=Js(this.context),this._fill=ta(this.context),this._first=ia(this.context),this._get=ra(this.context),this._includes=na(this.context),this._indexof=sa(this.context),this._insert=aa(this.context),this._join=oa(this.context),this._last=ca(this.context),this._lastindexof=ua(this.context),this._max=ha(this.context),this._median=la(this.context),this._min=pa(this.context),this._mode=fa(this.context),this._percentile_linear_interpolation=ma(this.context),this._percentile_nearest_rank=da(this.context),this._percentrank=ga(this.context),this._pop=xa(this.context),this._push=ya(this.context),this._range=ba(this.context),this._remove=va(this.context),this._reverse=wa(this.context),this._set=_a(this.context),this._shift=Sa(this.context),this._size=Ea(this.context),this._slice=Na(this.context),this._some=Ia(this.context),this._sort=Aa(this.context),this._sort_indices=Ta(this.context),this._standardize=Pa(this.context),this._stdev=Da(this.context),this._sum=Ra(this.context),this._unshift=Va(this.context),this._variance=Oa(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 Ba(e){return(...t)=>new U([...t],ea(t),e)}function ja(e){return(t,i)=>new U(Array(t).fill(e.precision(i||0)),Ae(i||0),e)}function Fa(e){return(t,i=!1)=>new U(Array(t).fill(i),K.bool,e)}function Wa(e){return(t,i=NaN)=>new U(Array(t).fill(e.precision(i)),K.float,e)}function $a(e){return(t,i=0)=>new U(Array(t).fill(e.precision(i)),K.int,e)}function Ua(e){return(t,i="")=>new U(Array(t).fill(i),K.string,e)}class d{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof d?t:Array.isArray(t)?new d(t):new d([t])}}function qa(e){return(t,i=0)=>d.from(t).get(i)}class Ha{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=Ba(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=ja(t),this.new_bool=Fa(t),this.new_float=Wa(t),this.new_int=$a(t),this.new_string=Ua(t),this.param=qa(),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 za(e){return t=>{t.map.clear()}}function Ka(e){return(t,i)=>t.map.has(i)}function Ga(e){return t=>{const i=new Qr(e);return i.map=new Map(t.map),i}}function Ya(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function Qa(e){return t=>{const i=Array.from(t.map.keys()),r=Ae(i[0]);return new U(i,r,e)}}function Xa(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function Za(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function Ja(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function eo(e){return t=>t.map.size}function to(e){return t=>{const i=Array.from(t.map.values()),r=Ae(i[0]);return new U(i,r,e)}}var io=Object.defineProperty,ro=(e,t,i)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ie=(e,t,i)=>ro(e,typeof t!="symbol"?t+"":t,i);class Qr{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=za(this.context),this._contains=Ka(this.context),this._copy=Ga(this.context),this._get=Ya(this.context),this._keys=Qa(this.context),this._put=Xa(this.context),this._put_all=Za(this.context),this._remove=Ja(this.context),this._size=eo(this.context),this._values=to(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 no(e){return()=>new Qr(e)}function so(e){return(t,i=0)=>d.from(t).get(i)}class ao{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=no(t),this.param=so(),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 oo(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r&&(r instanceof U?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 d&&(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 d&&(u=u.get(0)),t.matrix[c].splice(o,0,u)}}}function co(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r)if(r instanceof U)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof d){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 d&&(h=h.get(0)),c.push(h)}else c.push(NaN);t.matrix.splice(o,0,c)}}function uo(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 ho(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=Ae(n[0]);return new U(n,a,e)}}function lo(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function po(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 fo(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new F(i,r,NaN,e);return n.matrix=t.matrix.map(a=>[...a]),n}}function mo(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 go(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:mo(t.matrix)}}function xo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new F(0,0,NaN,e);const n=t.matrix[0].length,a=new F(r,n,NaN,e);if(i instanceof F)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 yo(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 bo(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const s=Ae(t.matrix[0][0]);return new U([],s,e)}const n=yo(t.matrix),a=Ae(n[0]);return new U(n,a,e)}}function vo(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new F(0,0,NaN,e);const n=new F(i,r,0,e);for(let a=0;a<i;a++)n.matrix[a][a]=1;return n}}function wo(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function _o(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,p=a!==void 0?a:0,l=s!==void 0?s:c;for(let m=u;m<h&&!(m>=o);m++)for(let g=p;g<l&&!(g>=c);g++)t.matrix[m][g]=i}}function So(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function Eo(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 No(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new F(i,r,NaN,e);const n=Eo(t.matrix),a=new F(i,r,NaN,e);return a.matrix=n,a}}function Io(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 Co(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 ko(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 Ao(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 To(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 Po(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Do(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 Ro(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let 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 Vo(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 Oo(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 Lo(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 F(o,c,NaN,e);for(let h=0;h<r;h++)for(let p=0;p<n;p++){const l=t.matrix[h][p];for(let m=0;m<a;m++)for(let g=0;g<s;g++){const y=i.matrix[m][g];u.matrix[h*a+m][p*s+g]=l*y}}return u}}function Mo(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 Bo(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 jo(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 Fo(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 Wo(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof F){const a=i.matrix.length,s=a>0?i.matrix[0].length:0;if(n!==a)return new F(0,0,NaN,e);const o=new F(r,s,0,e);for(let c=0;c<r;c++)for(let u=0;u<s;u++){let h=0;for(let p=0;p<n;p++)h+=t.matrix[c][p]*i.matrix[p][u];o.matrix[c][u]=h}return o}else if(i instanceof U||Array.isArray(i.array||i)){const a=i.array||i;if(n!==a.length)return new F(0,0,NaN,e);const s=new F(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 F(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 $o(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new F(i,r,NaN,e):new F(r,i,NaN,e)}}function Uo(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new F(0,0,NaN,e);let a=new F(r,n,0,e);for(let c=0;c<r;c++)a.matrix[c][c]=1;let s=new F(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 F(r,n,NaN,e);for(;o>0;){if(o%2===1){const u=new F(r,n,0,e);for(let h=0;h<r;h++)for(let p=0;p<n;p++){let l=0;for(let m=0;m<r;m++)l+=a.matrix[h][m]*s.matrix[m][p];u.matrix[h][p]=l}a=u}const c=new F(r,n,0,e);for(let u=0;u<r;u++)for(let h=0;h<n;h++){let p=0;for(let l=0;l<r;l++)p+=s.matrix[u][l]*s.matrix[l][h];c.matrix[u][h]=p}s=c,o=Math.floor(o/2)}return a}}function qo(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 p=s;p<r;p++)n[u][p]-=h*n[a][p]}a++}}return a}}function Ho(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const s=Ae(t.matrix[0][0]);return new U([],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=Ae(n[0]);return new U(n,a,e)}}function zo(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=Ae(r[0][0]);return new U(r[0]||[],n,e)}}function Ko(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 p=0;p<a;p++)o.push(t.matrix[h][p]);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 p=[];for(let l=0;l<r;l++)p.push(o[u++]);c.push(p)}t.matrix=c}}function Go(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Yo(e){return(t,i)=>{if(!t.matrix[i]){const n=Ae(t.matrix[0][0]);return new U([],n,e)}const r=Ae(t.matrix[i][0]);return new U([...t.matrix[i]],r,e)}}function Qo(e){return t=>t.matrix.length}function Xo(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Zo(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 Jo(e){return(t,i,r,n,a)=>{const s=r-i,o=a-n,c=new F(s,o,NaN,e);for(let u=0;u<s;u++){const h=i+u;if(h>=t.matrix.length)break;for(let p=0;p<o;p++){const l=n+p;if(l>=t.matrix[h].length)break;c.matrix[u][p]=t.matrix[h][l]}}return c}}function ec(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new F(0,0,NaN,e);const n=t.matrix[0].length,a=new F(r,n,NaN,e);if(i instanceof F)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 tc(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 ic(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function rc(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 nc(e){return t=>{const i=t.matrix.length;if(i===0)return new F(0,0,NaN,e);const r=t.matrix[0].length,n=new F(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 sc=Object.defineProperty,ac=(e,t,i)=>t in e?sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,T=(e,t,i)=>ac(e,typeof t!="symbol"?t+"":t,i);class F{constructor(t=0,i=0,r=NaN,n){if(this.context=n,T(this,"matrix"),T(this,"_add_col"),T(this,"_add_row"),T(this,"_avg"),T(this,"_col"),T(this,"_columns"),T(this,"_concat"),T(this,"_copy"),T(this,"_det"),T(this,"_diff"),T(this,"_eigenvalues"),T(this,"_eigenvectors"),T(this,"_elements_count"),T(this,"_fill"),T(this,"_get"),T(this,"_inv"),T(this,"_is_antidiagonal"),T(this,"_is_antisymmetric"),T(this,"_is_binary"),T(this,"_is_diagonal"),T(this,"_is_identity"),T(this,"_is_square"),T(this,"_is_stochastic"),T(this,"_is_symmetric"),T(this,"_is_triangular"),T(this,"_is_zero"),T(this,"_kron"),T(this,"_max"),T(this,"_median"),T(this,"_min"),T(this,"_mode"),T(this,"_mult"),T(this,"_pinv"),T(this,"_pow"),T(this,"_rank"),T(this,"_remove_col"),T(this,"_remove_row"),T(this,"_reshape"),T(this,"_reverse"),T(this,"_row"),T(this,"_rows"),T(this,"_set"),T(this,"_sort"),T(this,"_submatrix"),T(this,"_sum"),T(this,"_swap_columns"),T(this,"_swap_rows"),T(this,"_trace"),T(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=oo(this.context),this._add_row=co(this.context),this._avg=uo(this.context),this._col=ho(this.context),this._columns=lo(this.context),this._concat=po(this.context),this._copy=fo(this.context),this._det=go(this.context),this._diff=xo(this.context),this._eigenvalues=bo(this.context),this._eigenvectors=vo(this.context),this._elements_count=wo(this.context),this._fill=_o(this.context),this._get=So(this.context),this._inv=No(this.context),this._is_antidiagonal=Io(this.context),this._is_antisymmetric=Co(this.context),this._is_binary=ko(this.context),this._is_diagonal=Ao(this.context),this._is_identity=To(this.context),this._is_square=Po(this.context),this._is_stochastic=Do(this.context),this._is_symmetric=Ro(this.context),this._is_triangular=Vo(this.context),this._is_zero=Oo(this.context),this._kron=Lo(this.context),this._max=Mo(this.context),this._median=Bo(this.context),this._min=jo(this.context),this._mode=Fo(this.context),this._mult=Wo(this.context),this._pinv=$o(this.context),this._pow=Uo(this.context),this._rank=qo(this.context),this._remove_col=Ho(this.context),this._remove_row=zo(this.context),this._reshape=Ko(this.context),this._reverse=Go(this.context),this._row=Yo(this.context),this._rows=Qo(this.context),this._set=Xo(this.context),this._sort=Zo(this.context),this._submatrix=Jo(this.context),this._sum=ec(this.context),this._swap_columns=tc(this.context),this._swap_rows=ic(this.context),this._trace=rc(this.context),this._transpose=nc(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 oc(e){return(t,i,r)=>new F(t,i,r,e)}function cc(e){return(t,i=0)=>d.from(t).get(i)}class uc{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=oc(t),this.param=cc(),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 hc=Object.defineProperty,lc=(e,t,i)=>t in e?hc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,pc=(e,t,i)=>lc(e,typeof t!="symbol"?t+"":t,i);class fc{constructor(t){this.context=t,pc(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.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 Nt{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 Nt(this.__def__,this.context)}toString(){const t={};for(let i in this.__def__)t[i]=this[i];return JSON.stringify(t)}}var mc=Object.defineProperty,dc=(e,t,i)=>t in e?mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ut=(e,t,i)=>dc(e,typeof t!="symbol"?t+"":t,i);class Ve{constructor(t,i,r){Ut(this,"time"),Ut(this,"index"),Ut(this,"price"),this.time=t,this.index=i,this.price=r}copy(){return new Ve(this.time,this.index,this.price)}toString(){return JSON.stringify({time:this.time,index:this.index,price:this.price})}}function gc(e){return typeof e=="object"&&e.title!==void 0&&e.data!==void 0&&e.options!==void 0}const Di={series:e=>e instanceof d||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",point:e=>e instanceof Ve,primitive:e=>typeof e===null||typeof e!="object"&&typeof e!="function",function:e=>typeof e=="function",undefined:e=>e===void 0,null:e=>e===null,NaN:e=>isNaN(e),remaining_options:e=>typeof e=="object"&&!(e instanceof d)&&!(e instanceof Ve)&&!gc(e)};function ue(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(Di.remaining_options(c)){a=c;break}const u=t.map((h,p)=>s[p]?h[o]:void 0);for(let h=0;h<u.length;h++){const p=u[h];if(p===void 0){s[h]=!1;continue}const l=Di[i[p]];typeof l=="function"&&l(c)?n[p]=c:s[h]=!1}}return{...a,...n,...r}}var xc=Object.defineProperty,yc=(e,t,i)=>t in e?xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,bc=(e,t,i)=>yc(e,typeof t!="symbol"?t+"":t,i);const vc=[["dateString"],["year","month","day","hour","minute","second"],["timezone","year","month","day","hour","minute","second"]],wc={dateString:"string",timezone:"string",year:"number",month:"number",day:"number",hour:"number",minute:"number",second:"number"},_c=["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"],Sc={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 Ec(e){return ue(e,_c,Sc)}class Nc{get __value(){return NaN}param(t,i=0){return d.from(t).get(i)}any(t){return isNaN(d.from(t).get(0))}}class Ic{constructor(t){this.context=t,bc(this,"color",{param:(i,r=0)=>d.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]=d.from(t[r]).get(0);return i}indicator(...t){const i=Ec(t),r={title:"",shorttitle:"",overlay:!1,format:"inherit",precision:10,scale:"points",max_bars_back:0,timeframe:"",timeframe_gaps:!0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,max_polylines_count:50,dynamic_requests:!1,behind_chart:!0};return this.context.indicator={...r,...i},this.context.indicator}get bar_index(){return this.context.idx}na(t){return isNaN(d.from(t).get(0))}nz(t,i=0){const r=d.from(t).get(0),n=d.from(i).get(0);return isNaN(r)?n:r}fixnan(t){const i=d.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){}timestamp(...t){const i=t.map(n=>n instanceof d?n.get(0):n),r=ue(i,vc,wc);if(r.year!==void 0){const n=r.year,a=r.month,s=r.day,o=r.hour||0,c=r.minute||0,u=r.second||0,h=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._timestampFromComponents(h,n,a,s,o,c,u)}return r.dateString!==void 0?new Date(r.dateString).getTime():NaN}_timestampFromComponents(t,i,r,n,a,s,o){const c=new Date(Date.UTC(i,r-1,n,a,s,o));i>=0&&i<100&&c.setUTCFullYear(i);const u=t.trim();if(u==="UTC"||u==="GMT")return c.getTime();const h=u.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(h){const p=h[1]==="+"?1:-1,l=parseInt(h[2],10),m=parseInt(h[3]||"0",10),g=p*(l*60+m)*60*1e3;return c.getTime()-g}try{return this._timestampFromIANA(t,i,r,n,a,s,o)}catch{return c.getTime()}}_timestampFromIANA(t,i,r,n,a,s,o){const c=new Date(Date.UTC(i,r-1,n,a,s,o));i>=0&&i<100&&c.setUTCFullYear(i);const u=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(c),h=N=>parseInt(u.find(I=>I.type===N)?.value||"0",10),p=h("year"),l=h("month"),m=h("day");let g=h("hour");g===24&&(g=0);const y=h("minute"),b=h("second"),v=new Date(Date.UTC(p,l-1,m,g,y,b));p>=0&&p<100&&v.setUTCFullYear(p);const S=v.getTime()-c.getTime();return c.getTime()-S}bool(t){const i=d.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "int" with argument "x"="${i}". An argument of "literal string" type was used but a "simple int" is expected.`);return Math.floor(i)}float(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "float" with argument "x"="${i}". An argument of "literal string" type was used but a "const float" is expected.`);return i}string(t){return d.from(t).get(0).toString()}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 Nt(n,this.context)},copy:function(r){return new Nt(r.__def__,this.context)}}}}var Cc=Object.defineProperty,kc=(e,t,i)=>t in e?Cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,It=(e,t,i)=>kc(e,typeof t!="symbol"?t+"":t,i);function Ct(e,t){const i=t.trim();if(i==="UTC"||i==="GMT"){const n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),dayOfWeek:n.getUTCDay()}}const r=i.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(r){const n=r[1]==="+"?1:-1,a=parseInt(r[2],10),s=parseInt(r[3]||"0",10),o=n*(a*60+s)*60*1e3,c=new Date(e+o);return{year:c.getUTCFullYear(),month:c.getUTCMonth()+1,day:c.getUTCDate(),hour:c.getUTCHours(),minute:c.getUTCMinutes(),second:c.getUTCSeconds(),dayOfWeek:c.getUTCDay()}}try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short",hour12:!1}).formatToParts(new Date(e)),a=u=>parseInt(n.find(h=>h.type===u)?.value||"0",10);let s=a("hour");s===24&&(s=0);const o=n.find(u=>u.type==="weekday")?.value||"Sun",c={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return{year:a("year"),month:a("month"),day:a("day"),hour:s,minute:a("minute"),second:a("second"),dayOfWeek:c[o]??0}}catch{const n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),dayOfWeek:n.getUTCDay()}}}function Ac(e,t,i){const r=new Date(Date.UTC(e,t-1,i)),n=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-n);const a=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-a.getTime())/864e5+1)/7)}const Tc=[["timeframe"],["timeframe","bars_back"],["timeframe","session","bars_back"],["timeframe","session","bars_back","timeframe_bars_back"],["timeframe","session","timezone","bars_back","timeframe_bars_back"]],Pc={timeframe:"string",session:"string",timezone:"string",bars_back:"number",timeframe_bars_back:"number"};class Ri{constructor(t,i="openTime"){It(this,"context"),It(this,"dataField"),this.context=t,this.dataField=i}get __value(){return this.context.data[this.dataField]}param(t,i=0){return d.from(t).get(i)}any(...t){const i=t.map(u=>u instanceof d?u.get(0):u),r=ue(i,Tc,Pc),n=r.bars_back??0,a=r.timeframe_bars_back??0,s=n+a,o=this.context.data[this.dataField],c=d.from(o).get(s);if(r.session!==void 0){const u=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._isInSession(c,r.session,u)?c:NaN}return c}_isInSession(t,i,r){const n=i.match(/^(\d{2})(\d{2})-(\d{2})(\d{2})$/);if(!n)return!0;const a=parseInt(n[1],10),s=parseInt(n[2],10),o=parseInt(n[3],10),c=parseInt(n[4],10),u=Ct(t,r),h=u.hour,p=u.minute,l=h*60+p,m=a*60+s,g=o*60+c;return m<=g?l>=m&&l<g:l>=m||l<g}}const Dc=[[],["time"],["time","timezone"]],Rc={time:"number",timezone:"string"};class Fe{constructor(t,i){It(this,"context"),It(this,"extractor"),this.context=t,this.extractor=i}get __value(){const t=d.from(this.context.data.openTime).get(0);if(isNaN(t))return NaN;const i=this.context.pine?.syminfo?.timezone||"UTC",r=Ct(t,i);return this.extractor(r)}param(t,i=0){return d.from(t).get(i)}any(...t){const i=t.map(o=>o instanceof d?o.get(0):o);if(i.length===0)return this.__value;const r=ue(i,Dc,Rc),n=r.time;if(n===void 0||isNaN(n))return NaN;const a=r.timezone||this.context.pine?.syminfo?.timezone||"UTC",s=Ct(n,a);return this.extractor(s)}}const We={dayofmonth:e=>e.day,dayofweek:e=>e.dayOfWeek===0?1:e.dayOfWeek+1,hour:e=>e.hour,minute:e=>e.minute,month:e=>e.month,second:e=>e.second,weekofyear:e=>Ac(e.year,e.month,e.day),year:e=>e.year},Vc=[["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 ge(e){return ue(e,Vc,Oc)}function Ne(e,t){return t.title&&e.inputs&&e.inputs[t.title]!==void 0?e.inputs[t.title]:t.defval}function Lc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Mc(e){return(...t)=>ge(t).defval}function Bc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function jc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Fc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Wc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function $c(e){return(t,i=0)=>d.from(t).get(i)}function Uc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function qc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Hc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function zc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Kc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Gc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Yc(e){return(...t)=>{const i=ge(t);return Ne(e,i)}}function Qc(e){return(...t)=>ge(t).defval}var Xc=Object.defineProperty,Zc=(e,t,i)=>t in e?Xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,oe=(e,t,i)=>Zc(e,typeof t!="symbol"?t+"":t,i);const Jc={any:Lc,bool:Mc,color:Bc,enum:jc,float:Fc,int:Wc,param:$c,price:Uc,session:qc,source:Hc,string:zc,symbol:Kc,text_area:Gc,time:Yc,timeframe:Qc};class eu{constructor(t){this.context=t,oe(this,"any"),oe(this,"bool"),oe(this,"color"),oe(this,"enum"),oe(this,"float"),oe(this,"int"),oe(this,"param"),oe(this,"price"),oe(this,"session"),oe(this,"source"),oe(this,"string"),oe(this,"symbol"),oe(this,"text_area"),oe(this,"time"),oe(this,"timeframe"),Object.entries(Jc).forEach(([i,r])=>{this[i]=r(t)})}}function tu(e){return t=>Math.abs(d.from(t).get(0))}function iu(e){return t=>Math.acos(d.from(t).get(0))}function ru(e){return t=>Math.asin(d.from(t).get(0))}function nu(e){return t=>Math.atan(d.from(t).get(0))}function su(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function au(e){return t=>Math.ceil(d.from(t).get(0))}function ou(e){return t=>Math.cos(d.from(t).get(0))}function cu(e){return()=>Math.E}function uu(e){return t=>Math.exp(d.from(t).get(0))}function hu(e){return t=>Math.floor(d.from(t).get(0))}function lu(e){return t=>Math.log(d.from(t).get(0))}function pu(e){return t=>Math.log(d.from(t).get(0))}function fu(e){return t=>Math.log10(d.from(t).get(0))}function mu(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.max(...i)}}function du(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.min(...i)}}function gu(e){return(t,i,r)=>typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function xu(e){return()=>1.618033988749895}function yu(e){return()=>Math.PI}function bu(e){return(t,i)=>Math.pow(d.from(t).get(0),d.from(i).get(0))}function vu(e){return()=>Math.random()}function wu(e){return(t,i)=>{const r=d.from(t).get(0);if(i==null)return Math.round(r);const n=d.from(i).get(0);if(n===0)return Math.round(r);const a=Math.pow(10,n);return Math.round(r*a)/a}}function _u(e){return t=>e.precision(Math.round(d.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Su(e){return()=>.6180339887498948}function Eu(e){return t=>Math.sign(d.from(t).get(0))}function Nu(e){return t=>Math.sin(d.from(t).get(0))}function Iu(e){return t=>Math.sqrt(d.from(t).get(0))}function Cu(e){return(t,i)=>{const r=d.from(i).get(0),n=d.from(t);let a=0;for(let s=0;s<r;s++){const o=n.get(s);a+=o}return a}}function ku(e){return t=>Math.tan(d.from(t).get(0))}function Au(e){return t=>{const i=d.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function Tu(e){return t=>{const i=d.from(t).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function Pu(e){return(t,i)=>{const r=d.from(t).get(0),n=d.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 Du=Object.defineProperty,Ru=(e,t,i)=>t in e?Du(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,B=(e,t,i)=>Ru(e,typeof t!="symbol"?t+"":t,i);const Vu={abs:tu,acos:iu,asin:ru,atan:nu,avg:su,ceil:au,cos:ou,e:cu,exp:uu,floor:hu,ln:lu,log:pu,log10:fu,max:mu,min:du,param:gu,phi:xu,pi:yu,pow:bu,random:vu,round:wu,round_to_mintick:_u,rphi:Su,sign:Eu,sin:Nu,sqrt:Iu,sum:Cu,tan:ku,todegrees:Au,toradians:Tu,__eq:Pu};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(Vu).forEach(([i,r])=>{this[i]=r(t)})}}function Lu(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof d)n=t.get(i||0);else if(Array.isArray(t)){const a=t.every(o=>o instanceof d),s=t.every(o=>!(o instanceof d)&&!Array.isArray(o));(a||s)&&t.length>=1?a?n=t.map(o=>o.get(0)):n=t:n=d.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 kt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Vi(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 Oi(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 Mu(e){return async(t,i,r,n=!1,a=!1,s=!1,o=null,c=null)=>{const u=t[0],h=i[0],p=r[0],l=r[1],m=Array.isArray(n)?n[0]:n,g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return p;const y=kt.indexOf(e.timeframe),b=kt.indexOf(h);if(y==-1||b==-1)throw new Error("Invalid timeframe");if(y===b)return p;const v=y>b,S=d.from(e.data.openTime).get(0),N=d.from(e.data.closeTime).get(0),I=`${u}_${h}_${l}`,_=`${I}_prevIdx`;if(e.cache[I]){const se=e.cache[I],Be=v?Oi(S,N,se.data.openTime.data,se.data.closeTime.data,g,e.eDate,m):Vi(S,N,se.data.openTime.data,se.data.closeTime.data,g);if(Be==-1)return NaN;const te=se.params[l][Be];if(!v&&m){const pi=e.cache[_];return pi!==void 0&&pi===Be?NaN:(e.cache[_]=Be,Array.isArray(te)?[te]:te)}return Array.isArray(te)?[te]:te}const L=1e3*60*60*24*30,R=e.sDate?e.sDate-L:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,G=new Zr(e.source,u,h,j,R,void 0);G.markAsSecondary();const Y=await G.run(e.pineTSCode);e.cache[I]=Y;const H=v?Oi(S,N,Y.data.openTime.data,Y.data.closeTime.data,g,e.eDate,m):Vi(S,N,Y.data.openTime.data,Y.data.closeTime.data,g);if(H==-1)return NaN;const ne=Y.params[l][H];return!v&&m?(e.cache[_]=H,NaN):Array.isArray(ne)?[ne]:ne}}function Bu(e){return async(t,i,r,n=!1,a=null,s=!1,o=0)=>{const c=t[0],u=i[0],h=r[0],p=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 m=kt.indexOf(e.timeframe),g=kt.indexOf(u);if(m===-1||g===-1){if(l)return NaN;throw new Error("Invalid timeframe")}if(g>m){if(l)return NaN;throw new Error(`Timeframe ${u} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(g===m)return[[h]];const y=`${c}_${u}_${p}_lower`;if(!e.cache[y]){const R=e.sDate?e.sDate-2592e6:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,G=new Zr(e.source,c,u,j,R,e.eDate);G.markAsSecondary();const Y=await G.run(e.pineTSCode);e.cache[y]=Y}const b=e.cache[y],v=d.from(e.data.openTime).get(0),S=d.from(e.data.closeTime).get(0),N=b.data.openTime.data,I=b.data.closeTime.data,_=b.params[p];if(!_)return[];const L=[];for(let R=0;R<N.length;R++){const j=N[R];if(!(I[R]<=v)){if(j>=S)break;j>=v&&j<S&&L.push(_[R])}}return[L]}}var ju=Object.defineProperty,Fu=(e,t,i)=>t in e?ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,vt=(e,t,i)=>Fu(e,typeof t!="symbol"?t+"":t,i);const Wu={param:Lu,security:Mu,security_lower_tf:Bu};class $u{constructor(t){this.context=t,vt(this,"_cache",{}),vt(this,"param"),vt(this,"security"),vt(this,"security_lower_tf"),Object.entries(Wu).forEach(([i,r])=>{this[i]=r(t)})}}function Uu(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 qu(e){return(t,i,r,n,a)=>{const s=d.from(i).get(0),o=d.from(r).get(0),c=d.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,b=[];let v=0;for(let S=0;S<s;S++){const N=Math.exp(-Math.pow(S-g,2)/(2*y*y));b.push(N),v+=N}for(let S=0;S<b.length;S++)b[S]/=v;e.taState[u]={lastIdx:-1,prevWindow:[],currentWindow:[],weights:b}}const h=e.taState[u];e.idx>h.lastIdx&&(h.lastIdx>=0&&(h.prevWindow=[...h.currentWindow]),h.lastIdx=e.idx);const p=d.from(t).get(0),l=[...h.prevWindow];for(l.unshift(p);l.length>s;)l.pop();if(l.length<s&&e.idx>=s-1){const g=d.from(t);for(;l.length<s;)l.push(g.get(l.length))}if(h.currentWindow=l,l.length<s)return NaN;let m=0;for(let g=0;g<s;g++)m+=h.weights[g]*l[s-1-g];return e.precision(m)}}function Hu(e){return(t,i)=>{const r=d.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,b=Math.abs(s-u),v=Math.abs(o-u);h=Math.max(y,b,v)}else h=s-o;a.currentPrevClose=c;let p=a.prevInitCount,l=a.prevInitSum,m=a.prevAtr;if(p<r){if(l+=h,p++,a.currentInitSum=l,a.currentInitCount=p,p===r){const y=l/r;return a.currentAtr=y,e.precision(y)}return NaN}const g=(m*(r-1)+h)/r;return a.currentAtr=g,e.precision(g)}}function zu(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=d.from(t).get(0);let s=n.prevLastTrueIndex;return a&&(s=e.idx),n.currentLastTrueIndex=s,s===null?NaN:e.idx-s}}function Ku(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.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=d.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,[[NaN,NaN,NaN]];const h=[...c.prevWindow];let p=c.prevSum;for(h.unshift(u),p+=u;h.length>a;){const v=h.pop();p-=v}if(h.length<a&&e.idx>=a-1){const v=d.from(t);for(;h.length<a;){const S=v.get(h.length);if(isNaN(S))break;h.push(S),p+=S}}if(c.currentWindow=h,c.currentSum=p,h.length<a)return[[NaN,NaN,NaN]];const l=p/a;let m=0;for(let v=0;v<a;v++)m+=Math.pow(h[v]-l,2);const g=Math.sqrt(m/a),y=l+s*g,b=l-s*g;return[[e.precision(l),e.precision(y),e.precision(b)]]}}function Gu(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.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=d.from(t).get(0);if(isNaN(u))return c.currentWindow=[...c.prevWindow],c.currentSum=c.prevSum,NaN;const h=[...c.prevWindow];let p=c.prevSum;for(h.unshift(u),p+=u;h.length>a;){const S=h.pop();p-=S}if(h.length<a&&e.idx>=a-1){const S=d.from(t);for(;h.length<a;){const N=S.get(h.length);if(isNaN(N))break;h.push(N),p+=N}}if(c.currentWindow=h,c.currentSum=p,h.length<a)return NaN;const l=p/a;let m=0;for(let S=0;S<a;S++){const N=h[S]-l;m+=N*N}const g=m/a,y=Math.sqrt(g),b=s*y;if(l===0)return e.precision(0);const v=2*b/l*100;return e.precision(v)}}function Yu(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0);if(isNaN(o))return NaN;const c=[...s.prevWindow];let u=s.prevSum;for(c.unshift(o),u+=o;c.length>n;){const g=c.pop();u-=g}if(c.length<n&&e.idx>=n-1){const g=d.from(t);for(;c.length<n;){const y=g.get(c.length);if(isNaN(y))break;c.push(y),u+=y}}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const h=u/n;let p=0;for(let g=0;g<n;g++)p+=Math.abs(c[g]-h);const l=p/n;if(l===0)return 0;const m=(o-h)/(.015*l);return e.precision(m)}}function Qu(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n+1;)c.pop();if(c.length<n+1&&e.idx>=n){const h=d.from(t);for(;c.length<n+1;)c.push(h.get(c.length))}if(s.currentWindow=c,c.length<=n)return NaN;const u=o-c[n];return e.precision(u)}}function Xu(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=d.from(t).get(1);if(isNaN(o)||isNaN(c))return NaN;const u=o-c,h=u>=0?u:0,p=u>=0?0:-u,l=[...s.prevGainsWindow],m=[...s.prevLossesWindow];let g=s.prevGainsSum,y=s.prevLossesSum;if(l.unshift(h),m.unshift(p),g+=h,y+=p,l.length<n)return s.currentGainsWindow=l,s.currentLossesWindow=m,s.currentGainsSum=g,s.currentLossesSum=y,NaN;if(l.length>n){const S=l.pop(),N=m.pop();g-=S,y-=N}s.currentGainsWindow=l,s.currentLossesWindow=m,s.currentGainsSum=g,s.currentLossesSum=y;const b=g+y;if(b===0)return e.precision(0);const v=100*(g-y)/b;return e.precision(v)}}function Zu(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.from(t);let s=0,o=!1;for(let h=0;h<n;h++){const p=a.get(h);if(isNaN(p)){o=!0;break}s+=p}if(o)return NaN;let c=0;for(let h=0;h<n;h++){const p=a.get(h);c+=p*(h+1)}if(s===0)return NaN;const u=-c/s;return e.precision(u)}}function Ju(e){return(t,i,r,n)=>{const a=d.from(r).get(0),s=d.from(t),o=d.from(i);if(e.idx<a-1)return NaN;let c=0,u=0,h=0,p=0,l=0,m=0;for(let S=0;S<a;S++){const N=s.get(S),I=o.get(S);isNaN(N)||isNaN(I)||(c+=N,u+=I,h+=N*I,p+=N*N,l+=I*I,m++)}if(m<2)return NaN;const g=m*h-c*u,y=m*p-c*c,b=m*l-u*u;if(y<=0||b<=0)return e.precision(0);const v=g/Math.sqrt(y*b);return e.precision(v)}}function eh(e){return(t,i,r)=>{const n=d.from(t),a=d.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,p=s<o&&c>=u;return h||p}}function th(e){return(t,i)=>{const r=d.from(t),n=d.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o<c&&a>s}}function ih(e){return(t,i)=>{const r=d.from(t),n=d.from(i),a=r.get(0),s=n.get(0),o=r.get(1),c=n.get(1);return o>c&&a<s}}function rh(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=d.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 nh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0)||0,c=[...s.prevWindow];let u=s.prevSum;for(c.unshift(o),u+=o;c.length>n;){const m=c.pop();u-=m}if(c.length<n&&e.idx>=n-1){const m=d.from(t);for(;c.length<n;){const g=m.get(c.length);c.push(g),u+=g}}if(s.currentWindow=c,s.currentSum=u,c.length<n)return NaN;const h=u/n;let p=0;for(let m=0;m<n;m++)p+=Math.abs(c[m]-h);const l=p/n;return e.precision(l)}}function sh(e){return(t,i,r)=>{const n=d.from(t).get(0),a=d.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 p=Math.max(c-u,Math.abs(c-o.prevClose),Math.abs(u-o.prevClose)),l=c-o.prevHigh,m=o.prevLow-u,g=l>m&&l>0?l:0,y=m>l&&m>0?m:0;let b=o.prevInitCount,v=o.prevTrInitSum,S=o.prevPlusInitSum,N=o.prevMinusInitSum,I=o.prevSmoothedTR,_=o.prevSmoothedPlus,L=o.prevSmoothedMinus;if(b++,b<=n)v+=p,S+=g,N+=y,b===n&&(I=v/n,_=S/n,L=N/n);else{const te=1/n;I=te*p+(1-te)*I,_=te*g+(1-te)*_,L=te*y+(1-te)*L}if(o.currentInitCount=b,o.currentTrInitSum=v,o.currentPlusInitSum=S,o.currentMinusInitSum=N,o.currentSmoothedTR=I,o.currentSmoothedPlus=_,o.currentSmoothedMinus=L,b<n)return[[NaN,NaN,NaN]];const R=I===0?0:100*_/I,j=I===0?0:100*L/I,G=R+j,Y=G===0?0:100*Math.abs(R-j)/G;let H=o.prevAdxInitCount,ne=o.prevDxInitSum,se=o.prevADX,Be=NaN;if(H++,H<=a)ne+=Y,H===a&&(se=ne/a,Be=se);else{const te=1/a;se=te*Y+(1-te)*se,Be=se}return o.currentAdxInitCount=H,o.currentDxInitSum=ne,o.currentADX=se,[[e.precision(R),e.precision(j),e.precision(Be)]]}}function ah(e){return(t,i,r)=>{const n=d.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=d.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 m=u/n;return s.currentEma=m,e.precision(m)}return NaN}const p=2/(n+1),l=o*p+h*(1-p);return s.currentEma=l,e.precision(l)}}function oh(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.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)=>{typeof i=="string"&&r===void 0&&(r=i,i=t,t=e.data.high);const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();if(c.length<n&&e.idx>=n-1){const p=d.from(t);for(;c.length<n;)c.push(p.get(c.length))}if(s.currentWindow=c,c.length<n)return NaN;const u=c.filter(p=>!isNaN(p)&&p!==void 0);if(u.length===0)return NaN;const h=Math.max(...u);return e.precision(h)}}function uh(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.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 hh(e){return(t,i,r)=>{const n=d.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 p=e.taState[h];e.idx>p.lastIdx&&(p.lastIdx>=0&&(p.prevValues=[...p.currentValues]),p.lastIdx=e.idx);const l=2*c-u,m=[...p.prevValues];m.unshift(l),m.length>s+1&&m.pop(),p.currentValues=m;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 b=[...y.prevWindow];if(b.unshift(l),b.length<s)return y.currentWindow=b,NaN;for(;b.length>s;)b.pop();y.currentWindow=b;let v=0,S=0;for(let I=0;I<s;I++){const _=s-I;v+=b[I]*_,S+=_}const N=v/S;return e.precision(N)}}function lh(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 ph(e){return(t,i,r,n,a)=>{const s=d.from(i).get(0),o=d.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=d.from(n).get(0));let u;const h=e.get(e.data.high,0),p=e.get(e.data.low,0);if(c){const I=e.get(e.data.close,1);isNaN(I)?u=NaN:u=Math.max(h-p,Math.abs(h-I),Math.abs(p-I))}else u=h-p;const l=d.from(t).get(0);e.taState||(e.taState={});const m=a||`kc_${s}_${o}_${c}`;e.taState[m]||(e.taState[m]={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[m];e.idx>g.lastIdx&&(g.lastIdx>=0&&(g.basisState={...g.currentBasisState},g.rangeState={...g.currentRangeState}),g.lastIdx=e.idx);const y=(I,_,L,R)=>{if(isNaN(L))return Object.assign(_,I),_.prevEma!==null?_.prevEma:NaN;let j=I.initCount,G=I.initSum,Y=I.prevEma;if(j<R){if(G+=L,j++,_.initSum=G,_.initCount=j,_.prevEma=Y,j===R){const se=G/R;return _.prevEma=se,se}return NaN}const H=2/(R+1),ne=L*H+Y*(1-H);return _.prevEma=ne,_.initSum=G,_.initCount=j,ne},b=y(g.basisState,g.currentBasisState,l,s),v=y(g.rangeState,g.currentRangeState,u,s);if(isNaN(b)||isNaN(v))return[[NaN,NaN,NaN]];const S=b+v*o,N=b-v*o;return[[e.precision(b),e.precision(S),e.precision(N)]]}}function fh(e){return(t,i,r,n,a)=>{const s=d.from(i).get(0),o=d.from(r).get(0);let c=!0;typeof n=="string"?a=n:n!==void 0&&(c=d.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 p=(N,I,_,L)=>{if(isNaN(_))return Object.assign(I,N),I.prevEma!==null?I.prevEma:NaN;let R=N.initCount,j=N.initSum,G=N.prevEma;if(R<L){if(j+=_,R++,I.initSum=j,I.initCount=R,I.prevEma=G,R===L){const ne=j/L;return I.prevEma=ne,ne}return NaN}const Y=2/(L+1),H=_*Y+G*(1-Y);return I.prevEma=H,I.initSum=j,I.initCount=R,H};let l;const m=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(m-g,Math.abs(m-N),Math.abs(g-N))}else l=m-g;const y=d.from(t).get(0),b=p(h.basisState,h.currentBasisState,y,s),v=p(h.rangeState,h.currentRangeState,l,s);if(isNaN(b)||isNaN(v))return NaN;if(b===0)return e.precision(0);const S=2*v*o/b;return e.precision(S)}}function mh(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.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=d.from(t).get(0),h=[...c.prevWindow];for(h.unshift(u);h.length>a;)h.pop();if(h.length<a&&e.idx>=a-1){const N=d.from(t);for(;h.length<a;)h.push(N.get(h.length))}if(c.currentWindow=h,h.length<a)return NaN;let p=0,l=0,m=0,g=0;const y=a;for(let N=0;N<a;N++){const I=a-1-N,_=h[N];p+=I,l+=_,m+=I*_,g+=I*I}const b=y*g-p*p;if(b===0)return NaN;const v=(y*m-p*l)/b,S=(l-v*p)/y+v*(a-1-s);return e.precision(S)}}function dh(e){return(t,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=t,t=e.data.low);const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();if(c.length<n&&e.idx>=n-1){const p=d.from(t);for(;c.length<n;)c.push(p.get(c.length))}if(s.currentWindow=c,c.length<n)return NaN;const u=c.filter(p=>!isNaN(p)&&p!==void 0),h=u.length>0?Math.min(...u):NaN;return e.precision(h)}}function gh(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.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 xh(e){return(t,i,r,n,a)=>{const s=d.from(i).get(0),o=d.from(r).get(0),c=d.from(n).get(0),u=a||`macd_${s}_${o}_${c}`,h=`${u}_fast`,p=`${u}_slow`,l=`${u}_signal`,m=e.pine.ta.ema(t,s,h),g=e.pine.ta.ema(t,o,p);let y=NaN;!isNaN(m)&&!isNaN(g)&&(y=m-g);let b=NaN;isNaN(y)||(b=e.pine.ta.ema(y,c,l));let v=NaN;return!isNaN(y)&&!isNaN(b)&&(v=y-b),[[e.precision(y),e.precision(b),e.precision(v)]]}}function yh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();if(c.length<n&&e.idx>=n-1){const l=d.from(t);for(;c.length<n;)c.push(l.get(c.length))}if(s.currentWindow=c,c.length<n)return NaN;const u=c.slice().sort((l,m)=>l-m),h=Math.floor(n/2),p=n%2===0?(u[h-1]+u[h])/2:u[h];return e.precision(p)}}function bh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=d.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,p=u*(h<=0?0:o),l=u*(h>=0?0:o),m=[...s.prevUpperWindow],g=[...s.prevLowerWindow];let y=s.prevUpperSum,b=s.prevLowerSum;if(m.unshift(p),g.unshift(l),y+=p,b+=l,m.length<n)return s.currentUpperWindow=m,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=b,NaN;if(m.length>n){const S=m.pop(),N=g.pop();y-=S,b-=N}if(s.currentUpperWindow=m,s.currentLowerWindow=g,s.currentUpperSum=y,s.currentLowerSum=b,b===0)return e.precision(100);if(y===0)return e.precision(0);const v=100-100/(1+y/b);return e.precision(v)}}function vh(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.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 wh(e){return(t,i,r)=>{const n=d.from(i).get(0);return e.pine.ta.change(t,n,r)}}function _h(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,p=isNaN(o)?0:o;let l=r.committedNVI;if(!(c===0||u===0)&&h<p){const m=(c-u)/u;l=l+m*l}return r.tentativeNVI=l,e.precision(l)}}function Sh(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 Eh(e){return(t,i,r)=>t instanceof d?i?new d(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Nh(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.from(r).get(0),o=d.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),p=Math.ceil(u);if(h===p)return e.precision(c[h]);const l=u-h,m=c[h]+l*(c[p]-c[h]);return e.precision(m)}}function Ih(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.from(r).get(0),o=d.from(t);if(e.idx<a-1)return NaN;const c=[];for(let h=0;h<a;h++){const p=o.get(h);isNaN(p)||c.push(p)}if(c.length===0)return NaN;c.sort((h,p)=>h-p);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 Ch(e){return(t,i,r)=>{const n=d.from(i).get(0),a=d.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 kh(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 Ah(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const a=d.from(i).get(0),s=d.from(r).get(0),o=d.from(t).toArray(),c=kh(o,a,s),u=e.idx;return e.precision(c[u])}}function Th(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 Ph(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const a=d.from(i).get(0),s=d.from(r).get(0),o=d.from(t).toArray(),c=Th(o,a,s),u=e.idx;return e.precision(c[u])}}function Dh(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,p=isNaN(o)?0:o;let l=r.committedPVI;if(!(c===0||u===0)&&h>p){const m=(c-u)/u;l=l+m*l}return r.tentativePVI=l,e.precision(l)}}function Rh(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 Vh(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=d.from(i).get(0),a=d.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 Lh(e){return(t,i,r)=>{const n=d.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=d.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 m=u/n;return s.currentRma=m,e.precision(m)}return NaN}const p=1/n,l=o*p+h*(1-p);return s.currentRma=l,e.precision(l)}}function Mh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n+1;)c.pop();if(c.length<n+1&&e.idx>=n){const p=d.from(t);for(;c.length<n+1;)c.push(p.get(c.length))}if(s.currentWindow=c,c.length<=n)return NaN;const u=c[n],h=(o-u)/u*100;return e.precision(h)}}function Bh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=s.prevPrevValue;let u=s.prevAvgGain,h=s.prevAvgLoss;const p=[...s.prevInitGains],l=[...s.prevInitLosses];if(c!==null){const m=o-c,g=m>0?m:0,y=m<0?-m:0;if(p.length<n){if(p.push(g),l.push(y),s.currentInitGains=p,s.currentInitLosses=l,s.currentPrevValue=o,p.length===n){u=p.reduce((S,N)=>S+N,0)/n,h=l.reduce((S,N)=>S+N,0)/n,s.currentAvgGain=u,s.currentAvgLoss=h;const v=h===0?100:100-100/(1+u/h);return e.precision(v)}return NaN}u=(u*(n-1)+g)/n,h=(h*(n-1)+y)/n,s.currentAvgGain=u,s.currentAvgLoss=h,s.currentPrevValue=o;const b=h===0?100:100-100/(1+u/h);return e.precision(b)}return s.currentPrevValue=o,s.currentInitGains=[],s.currentInitLosses=[],NaN}}function jh(e){return(t,i,r,n)=>{const a=d.from(t).get(0),s=d.from(i).get(0),o=d.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,p=u.prevMaxMin,l=u.prevAcceleration,m=u.prevIsBelow,g=u.prevBarIndex;const y=e.get(e.data.high,0),b=e.get(e.data.low,0),v=e.get(e.data.close,0),S=e.get(e.data.close,1),N=e.get(e.data.high,1),I=e.get(e.data.low,1),_=e.get(e.data.high,2),L=e.get(e.data.low,2);if(isNaN(y)||isNaN(b)||isNaN(v))return u.currentResult=h,u.currentMaxMin=p,u.currentAcceleration=l,u.currentIsBelow=m,u.currentBarIndex=g,NaN;let R=!1;return g===1&&(v>S?(m=!0,p=y,h=I):(m=!1,p=b,h=N),R=!0,l=a),g>=1&&(h=h+l*(p-h),m?h>b&&(R=!0,m=!1,h=Math.max(y,p),p=b,l=a):h<y&&(R=!0,m=!0,h=Math.min(b,p),p=y,l=a),R||(m?y>p&&(p=y,l=Math.min(l+s,o)):b<p&&(p=b,l=Math.min(l+s,o))),m?(h=Math.min(h,I),g>1&&(h=Math.min(h,L))):(h=Math.max(h,N),g>1&&(h=Math.max(h,_)))),g++,u.currentResult=h,u.currentMaxMin=p,u.currentAcceleration=l,u.currentIsBelow=m,u.currentBarIndex=g,g<=1?NaN:e.precision(h)}}function Fh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();let u=!1;if(c.length<n&&e.idx>=n-1){const g=d.from(t);for(;c.length<n;)c.push(g.get(c.length));u=!0}let h;const p=o==null||Number.isNaN(o);let l=!Number.isNaN(s.prevSum)&&!p&&!u;if(l){let g=s.prevSum+o;if(s.prevWindow.length>=n){const y=s.prevWindow[s.prevWindow.length-1];y==null||Number.isNaN(y)?l=!1:g-=y}l&&(h=g)}if(!l){h=0;let g=!1;for(const y of c){if(y==null||Number.isNaN(y)){g=!0;break}h+=y}g&&(h=NaN)}if(s.currentWindow=c,s.currentSum=h,c.length<n)return NaN;const m=h/n;return e.precision(m)}}function Wh(e){return(t,i,r=!0,n)=>{const a=d.from(i).get(0),s=d.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=d.from(t).get(0);if(u==null||isNaN(u))return NaN;const h=[...c.prevWindow];let p=c.prevSum;for(h.unshift(u),p+=u;h.length>a;){const b=h.pop();p-=b}if(h.length<a&&e.idx>=a-1){const b=d.from(t);for(;h.length<a;){const v=b.get(h.length);if(v==null||isNaN(v))break;h.push(v),p+=v}}if(c.currentWindow=h,c.currentSum=p,h.length<a)return NaN;const l=p/a;let m=0;for(let b=0;b<a;b++)m+=Math.pow(h[b]-l,2);const g=s?a:a-1,y=Math.sqrt(m/g);return e.precision(y)}}function $h(e){return(t,i,r,n,a)=>{const s=d.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=d.from(t).get(0),h=d.from(i).get(0),p=d.from(r).get(0);if(isNaN(u)||isNaN(h)||isNaN(p))return c.currentHighWindow=[...c.prevHighWindow],c.currentLowWindow=[...c.prevLowWindow],NaN;const l=[...c.prevHighWindow],m=[...c.prevLowWindow];if(l.unshift(h),m.unshift(p),l.length>s&&(l.pop(),m.pop()),c.currentHighWindow=l,c.currentLowWindow=m,l.length<s)return NaN;let g=l[0],y=m[0];for(let S=1;S<s;S++)l[S]>g&&(g=l[S]),m[S]<y&&(y=m[S]);const b=g-y;if(b===0)return NaN;const v=100*(u-y)/b;return e.precision(v)}}function Uh(e){return(t,i,r)=>{const n=d.from(t).get(0),a=d.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 p=(c+u)/2,l=o.prevClose;let m;isNaN(l)?m=c-u:m=Math.max(c-u,Math.abs(c-l),Math.abs(u-l));let g=o.prevAtrCount,y=o.prevTrSum,b=o.prevAtrValue;g++,g<=a?(y+=m,g===a&&(b=y/a)):b=(b*(a-1)+m)/a;const v=b;if(o.currentAtrCount=g,o.currentTrSum=y,o.currentAtrValue=b,o.currentClose=h,isNaN(v))return[[NaN,NaN]];let S=p+n*v,N=p-n*v;const I=isNaN(o.prevLowerBand)?0:o.prevLowerBand,_=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||N>I||l<I||(N=I),isNaN(o.prevUpperBand)||S<_||l>_||(S=_);let L,R;const j=o.prevSuperTrend;return g===a?L=1:j===o.prevUpperBand?L=h>S?-1:1:L=h<N?1:-1,R=L===-1?N:S,o.currentLowerBand=N,o.currentUpperBand=S,o.currentSuperTrend=R,o.currentDirection=L,[[e.precision(R),L]]}}function qh(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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>4;)c.pop();if(c.length<4&&e.idx>=3){const h=d.from(t);for(;c.length<4;)c.push(h.get(c.length))}if(s.currentWindow=c,c.length<4)return NaN;let u=0;for(let h=0;h<4;h++)u+=r[h]*c[3-h];return u/=n,e.precision(u)}}function Hh(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=d.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 zh(e){return(t,i,r,n)=>{const a=d.from(i).get(0),s=d.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=d.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 p=Math.abs(h),l=2/(s+1),m=2/(a+1),g=2/(s+1),y=2/(a+1);let b=c.prevEma1PcCount,v=c.prevEma1PcSum,S=c.prevEma1PcValue;b++,b<=s?(v+=h,b===s&&(S=v/s)):S=h*l+S*(1-l);let N=c.prevEma1AbsCount,I=c.prevEma1AbsSum,_=c.prevEma1AbsValue;if(N++,N<=s?(I+=p,N===s&&(_=I/s)):_=p*g+_*(1-g),isNaN(S)||isNaN(_))return c.currentEma1PcCount=b,c.currentEma1PcSum=v,c.currentEma1PcValue=S,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=_,NaN;let L=c.prevEma2PcCount,R=c.prevEma2PcSum,j=c.prevEma2PcValue;L++,L<=a?(R+=S,L===a&&(j=R/a)):j=S*m+j*(1-m);let G=c.prevEma2AbsCount,Y=c.prevEma2AbsSum,H=c.prevEma2AbsValue;if(G++,G<=a?(Y+=_,G===a&&(H=Y/a)):H=_*y+H*(1-y),c.currentEma1PcCount=b,c.currentEma1PcSum=v,c.currentEma1PcValue=S,c.currentEma1AbsCount=N,c.currentEma1AbsSum=I,c.currentEma1AbsValue=_,c.currentEma2PcCount=L,c.currentEma2PcSum=R,c.currentEma2PcValue=j,c.currentEma2AbsCount=G,c.currentEma2AbsSum=Y,c.currentEma2AbsValue=H,isNaN(j)||isNaN(H))return NaN;if(H===0)return e.precision(0);const ne=j/H;return e.precision(ne)}}function Kh(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=d.from(t).get(0),c=d.from(i).get(0),u=d.from(r).get(0),h=[...s.prevValues];if(o&&h.push(c),s.currentValues=h,isNaN(u)||u<0)return NaN;const p=h.length-1-u;if(p<0)return NaN;const l=h[p];return typeof l=="number"?e.precision(l):l}}function Gh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();if(c.length<n&&e.idx>=n-1){const m=d.from(t);for(;c.length<n;)c.push(m.get(c.length))}if(s.currentWindow=c,c.length<n)return NaN;let u=0,h=0;for(let m=0;m<n;m++)u+=c[m],h+=c[m]*c[m];const p=u/n,l=h/n-p*p;return e.precision(l)}}function Yh(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=d.from(t).get(0),s=d.from(e.data.volume).get(0),o=d.from(e.data.openTime).get(0),c=new Date(o).toISOString().slice(0,10);let u=n.prevCumulativePV,h=n.prevCumulativeVolume,p=n.prevLastSessionDate;if(p!==c&&(u=0,h=0,p=c),u+=a*s,h+=s,n.currentCumulativePV=u,n.currentCumulativeVolume=h,n.currentLastSessionDate=p,h===0)return NaN;const l=u/h;return e.precision(l)}}function Qh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=e.get(e.data.volume,0),u=[...s.prevWindow],h=[...s.prevVolumeWindow];for(u.unshift(o),h.unshift(c);u.length>n;)u.pop(),h.pop();if(u.length<n&&e.idx>=n-1){const g=d.from(t),y=d.from(e.data.volume);for(;u.length<n;)u.push(g.get(u.length)),h.push(y.get(h.length))}if(s.currentWindow=u,s.currentVolumeWindow=h,u.length<n)return NaN;let p=0,l=0;for(let g=0;g<n;g++)p+=u[g]*h[g],l+=h[g];const m=p/l;return e.precision(m)}}function Xh(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),p=Math.min(s,o),l=n-o;l>0?c=n-p:l<0&&(c=n-h)}const u=r.prevCumulativeSum+c;return r.currentCumulativeSum=u,e.precision(u)}}function Zh(e){return(t,i,r)=>{const n=d.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=d.from(t).get(0),c=[...s.prevWindow];for(c.unshift(o);c.length>n;)c.pop();if(c.length<n&&e.idx>=n-1){const l=d.from(t);for(;c.length<n;)c.push(l.get(c.length))}if(s.currentWindow=c,c.length<n)return NaN;let u=0,h=0;for(let l=0;l<n;l++){const m=n-l;u+=c[l]*m,h+=m}const p=u/h;return e.precision(p)}}function Jh(e){return(t,i)=>{const r=d.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 p=u[0],l=h[0];for(let y=1;y<r;y++)u[y]>p&&(p=u[y]),h[y]<l&&(l=h[y]);const m=p-l;if(m===0)return e.precision(0);const g=(p-c)/m*-100;return e.precision(g)}}function el(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 tl=Object.defineProperty,il=(e,t,i)=>t in e?tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,C=(e,t,i)=>il(e,typeof t!="symbol"?t+"":t,i);const rl={accdist:Uu,alma:qu,atr:Hu,barssince:zu,bb:Ku,bbw:Gu,cci:Yu,change:Qu,cmo:Xu,cog:Zu,correlation:Ju,cross:eh,crossover:th,crossunder:ih,cum:rh,dev:nh,dmi:sh,ema:ah,falling:oh,highest:ch,highestbars:uh,hma:hh,iii:lh,kc:ph,kcw:fh,linreg:mh,lowest:dh,lowestbars:gh,macd:xh,median:yh,mfi:bh,mode:vh,mom:wh,nvi:_h,obv:Sh,param:Eh,percentile_linear_interpolation:Nh,percentile_nearest_rank:Ih,percentrank:Ch,pivothigh:Ah,pivotlow:Ph,pvi:Dh,pvt:Rh,range:Vh,rising:Oh,rma:Lh,roc:Mh,rsi:Bh,sar:jh,sma:Fh,stdev:Wh,stoch:$h,supertrend:Uh,swma:qh,tr:Hh,tsi:zh,valuewhen:Kh,variance:Gh,vwap:Yh,vwma:Qh,wad:Xh,wma:Zh,wpr:Jh,wvad:el};class nl{constructor(t){this.context=t,C(this,"accdist"),C(this,"alma"),C(this,"atr"),C(this,"barssince"),C(this,"bb"),C(this,"bbw"),C(this,"cci"),C(this,"change"),C(this,"cmo"),C(this,"cog"),C(this,"correlation"),C(this,"cross"),C(this,"crossover"),C(this,"crossunder"),C(this,"cum"),C(this,"dev"),C(this,"dmi"),C(this,"ema"),C(this,"falling"),C(this,"highest"),C(this,"highestbars"),C(this,"hma"),C(this,"iii"),C(this,"kc"),C(this,"kcw"),C(this,"linreg"),C(this,"lowest"),C(this,"lowestbars"),C(this,"macd"),C(this,"median"),C(this,"mfi"),C(this,"mode"),C(this,"mom"),C(this,"nvi"),C(this,"obv"),C(this,"param"),C(this,"percentile_linear_interpolation"),C(this,"percentile_nearest_rank"),C(this,"percentrank"),C(this,"pivothigh"),C(this,"pivotlow"),C(this,"pvi"),C(this,"pvt"),C(this,"range"),C(this,"rising"),C(this,"rma"),C(this,"roc"),C(this,"rsi"),C(this,"sar"),C(this,"sma"),C(this,"stdev"),C(this,"stoch"),C(this,"supertrend"),C(this,"swma"),C(this,"tr"),C(this,"tsi"),C(this,"valuewhen"),C(this,"variance"),C(this,"vwap"),C(this,"vwma"),C(this,"wad"),C(this,"wma"),C(this,"wpr"),C(this,"wvad"),Object.entries(rl).forEach(([i,r])=>{this[i]=r(t)})}}function qt(e=new Date,t){const i=t??-e.getTimezoneOffset(),r=i>=0?"+":"-",n=s=>String(Math.floor(Math.abs(s))).padStart(2,"0"),a=r+n(i/60)+":"+n(i%60);return`[${e.toISOString().slice(0,-1)}${a}]`}class sl{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}param(t,i=0,r){return d.from(t).get(i)}warning(t,...i){const r=this.context.data.openTime.data[this.context.idx],n=qt(new Date(r),0);console.warn(`${n} ${this.logFormat(t,...i)}`)}error(t,...i){const r=this.context.data.openTime.data[this.context.idx],n=qt(new Date(r),0);console.error(`${n} ${this.logFormat(t,...i)}`)}info(t,...i){const r=this.context.data.openTime.data[this.context.idx],n=qt(new Date(r),0);console.log(`${n} ${this.logFormat(t,...i)}`)}}class al{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,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 p=a.indexOf(s,u);if(p===-1)return a;if(h===c)return a.substring(0,p)+o+a.substring(p+s.length);h++,u=p+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 ol{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<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 Li=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],cl=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],ul=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],hl=["open","high","low","close","title","color","editable","show_last","display","format","precision","force_overlay"],ll=["open","high","low","close","title","color","wickcolor","editable","show_last","bordercolor","display","format","precision","force_overlay"],Mi=["color","offset","editable","show_last","title","display","force_overlay"],pl=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],Bi={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"},fl={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"},ml={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"},dl={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"},gl={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"},ji={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},xl={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class yl{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.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 d.from(t).get(i)}plotchar(...t){const i=ue(t,Li,Bi),{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=d.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=ue(t,Li,Bi),{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=d.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=ue(t,cl,fl),{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=d.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=ue(t,ul,ml),{series:r,title:n,...a}=i,s=d.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=ue(t,hl,dl),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const p=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"bar",overlay:p},title:o}}const h=[d.from(r).get(0),d.from(n).get(0),d.from(a).get(0),d.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=ue(t,ll,gl),{open:r,high:n,low:a,close:s,title:o,...c}=i,u=this.extractPlotOptions(c);if(!this.context.plots[o]){const p=u.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...u,style:"candle",overlay:p},title:o}}const h=[d.from(r).get(0),d.from(n).get(0),d.from(a).get(0),d.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=ue(t,Mi,ji),{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=ue(t,Mi,ji),{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 bl{constructor(t){this.context=t}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(t,i=0,r){return d.from(t).get(i)}any(t,i,r,n,a,s,o){return this.context.pine.plot.any(t,{title:i,color:r,linestyle:n,linewidth:a,editable:s,display:o})}}class vl{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}any(...t){const i=ue(t,pl,xl),{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 wl=Object.defineProperty,_l=(e,t,i)=>t in e?wl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Sl=(e,t,i)=>_l(e,typeof t!="symbol"?t+"":t,i);class El{constructor(t){this.context=t,Sl(this,"point");const i=this.context;this.point={new(r,n,a){return new Ve(r,n,a??NaN)},from_index(r,n){return new Ve(void 0,r,n)},from_time(r,n){return new Ve(r,void 0,n)},copy(r){return r.copy()},now(r){const n=i.idx,a=i.marketData[n]?.openTime;return new Ve(a,n,r)}}}param(t,i=0,r){return d.from(t).get(i)}bg_color(){return"#1e293b"}fg_color(){return"#ffffff"}is_standard(){return!0}is_heikinashi(){return!1}is_kagi(){return!1}is_linebreak(){return!1}is_pnf(){return!1}is_range(){return!1}is_renko(){return!1}}var Nl=Object.defineProperty,Il=(e,t,i)=>t in e?Nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ce=(e,t,i)=>Il(e,typeof t!="symbol"?t+"":t,i);let Cl=0;class li{constructor(t,i,r="",n="bar_index",a="price",s="",o="style_label_down",c="",u="normal",h="align_center",p="",l="family_default",m=!1){ce(this,"id"),ce(this,"x"),ce(this,"y"),ce(this,"text"),ce(this,"xloc"),ce(this,"yloc"),ce(this,"color"),ce(this,"style"),ce(this,"textcolor"),ce(this,"size"),ce(this,"textalign"),ce(this,"tooltip"),ce(this,"text_font_family"),ce(this,"force_overlay"),ce(this,"_deleted"),this.id=Cl++,this.x=t,this.y=i,this.text=r,this.xloc=n,this.yloc=a,this.color=s,this.style=o,this.textcolor=c,this.size=u,this.textalign=h,this.tooltip=p,this.text_font_family=l,this.force_overlay=m,this._deleted=!1}copy(){return new li(this.x,this.y,this.text,this.xloc,this.yloc,this.color,this.style,this.textcolor,this.size,this.textalign,this.tooltip,this.text_font_family,this.force_overlay)}toPlotData(){return{id:this.id,x:this.x,y:this.y,text:this.text,xloc:this.xloc,yloc:this.yloc,color:this.color,style:this.style,textcolor:this.textcolor,size:this.size,textalign:this.textalign,tooltip:this.tooltip,text_font_family:this.text_font_family,force_overlay:this.force_overlay}}}var kl=Object.defineProperty,Al=(e,t,i)=>t in e?kl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Tl=(e,t,i)=>Al(e,typeof t!="symbol"?t+"":t,i);const Pl=[["x","y","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"],["point","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"]],Dl={x:"number",y:"number",text:"string",xloc:"string",yloc:"string",color:"string",style:"string",textcolor:"string",size:"string",textalign:"string",tooltip:"string",text_font_family:"string",force_overlay:"boolean",point:"point"};class Rl{constructor(t){this.context=t,Tl(this,"_labels",[])}param(t,i=0,r){return d.from(t).get(i)}_ensurePlotsEntry(){this.context.plots.__labels__||(this.context.plots.__labels__={title:"__labels__",data:[],options:{style:"label",overlay:!0}})}_pushLabelData(t){this._ensurePlotsEntry(),this.context.plots.__labels__.data.push({time:this.context.marketData[this.context.idx]?.openTime,value:t,options:{style:"label"}})}_createLabel(t,i,r="",n="bar_index",a="price",s="",o="style_label_down",c="",u="normal",h="align_center",p="",l="family_default",m=!1){const g=new li(t,i,r,n,a,s,o,c,u,h,p,l,m);return this._labels.push(g),this._pushLabelData(g),g}new(...t){const i=ue(t,Pl,Dl);let r,n,a=i.xloc;if(i.point instanceof Ve){const s=i.point;s.index!==void 0?(r=s.index,a=a||"bar_index"):s.time!==void 0?(r=s.time,a=a||"bar_time"):(r=0,a=a||"bar_index"),n=s.price}else r=i.x,n=i.y;return this._createLabel(r,n,i.text,a,i.yloc,i.color,i.style,i.textcolor,i.size,i.textalign,i.tooltip,i.text_font_family,i.force_overlay)}any(...t){return this.new(...t)}set_x(t,i){t&&!t._deleted&&(t.x=i)}set_y(t,i){t&&!t._deleted&&(t.y=i)}set_xy(t,i,r){t&&!t._deleted&&(t.x=i,t.y=r)}set_text(t,i){t&&!t._deleted&&(t.text=i)}set_color(t,i){t&&!t._deleted&&(t.color=i)}set_textcolor(t,i){t&&!t._deleted&&(t.textcolor=i)}set_size(t,i){t&&!t._deleted&&(t.size=i)}set_style(t,i){t&&!t._deleted&&(t.style=i)}set_textalign(t,i){t&&!t._deleted&&(t.textalign=i)}set_tooltip(t,i){t&&!t._deleted&&(t.tooltip=i)}set_xloc(t,i){t&&!t._deleted&&(t.xloc=i)}set_yloc(t,i){t&&!t._deleted&&(t.yloc=i)}set_point(t,i){t&&!t._deleted&&i&&(i.index!==void 0?(t.x=i.index,t.xloc="bar_index"):i.time!==void 0&&(t.x=i.time,t.xloc="bar_time"),t.y=i.price)}get_x(t){return t?t.x:NaN}get_y(t){return t?t.y:NaN}get_text(t){return t?t.text:""}copy(t){if(!t)return;const i=t.copy();return this._labels.push(i),this._pushLabelData(i),i}delete(t){t&&(t._deleted=!0)}get all(){return this._labels.filter(t=>!t._deleted)}get style_label_down(){return"style_label_down"}get style_label_up(){return"style_label_up"}get style_label_left(){return"style_label_left"}get style_label_right(){return"style_label_right"}get style_label_lower_left(){return"style_label_lower_left"}get style_label_lower_right(){return"style_label_lower_right"}get style_label_upper_left(){return"style_label_upper_left"}get style_label_upper_right(){return"style_label_upper_right"}get style_label_center(){return"style_label_center"}get style_circle(){return"style_circle"}get style_square(){return"style_square"}get style_diamond(){return"style_diamond"}get style_flag(){return"style_flag"}get style_arrowup(){return"style_arrowup"}get style_arrowdown(){return"style_arrowdown"}get style_cross(){return"style_cross"}get style_xcross(){return"style_xcross"}get style_triangleup(){return"style_triangleup"}get style_triangledown(){return"style_triangledown"}get style_none(){return"style_none"}get style_text_outline(){return"style_text_outline"}}var Vl=Object.defineProperty,Ol=(e,t,i)=>t in e?Vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,W=(e,t,i)=>Ol(e,typeof t!="symbol"?t+"":t,i);const Xr=class ti{constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:a,sDate:s,eDate:o,fullContext:c,inputs:u}){W(this,"data",{open:new d([]),high:new d([]),low:new d([]),close:new d([]),volume:new d([]),hl2:new d([]),hlc3:new d([]),ohlc4:new d([]),hlcc4:new d([])}),W(this,"indicator"),W(this,"cache",{}),W(this,"taState",{}),W(this,"isSecondaryContext",!1),W(this,"NA",NaN),W(this,"lang"),W(this,"length",0),W(this,"pine"),W(this,"idx",0),W(this,"params",{}),W(this,"const",{}),W(this,"var",{}),W(this,"let",{}),W(this,"lctx",new Map),W(this,"result"),W(this,"plots",{}),W(this,"marketData"),W(this,"source"),W(this,"tickerId"),W(this,"timeframe",""),W(this,"limit"),W(this,"sDate"),W(this,"eDate"),W(this,"fullContext"),W(this,"pineTSCode"),W(this,"inputs",{}),W(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 Ic(this),p={Type:h.Type.bind(h),na:new Nc,color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),timestamp:h.timestamp.bind(h),time:new Ri(this,"openTime"),time_close:new Ri(this,"closeTime"),dayofmonth:new Fe(this,We.dayofmonth),dayofweek:new Fe(this,We.dayofweek),hour:new Fe(this,We.hour),minute:new Fe(this,We.minute),month:new Fe(this,We.month),second:new Fe(this,We.second),weekofyear:new Fe(this,We.weekofyear),year:new Fe(this,We.year),bool:h.bool.bind(h)},l=this;this.pine={input:new eu(this),ta:new nl(this),math:new Ou(this),request:new $u(this),array:new Ha(this),map:new ao(this),matrix:new uc(this),syminfo:null,timeframe:new ol(this),barstate:new fc(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 time_tradingday(){const N=d.from(l.data.openTime).get(0);if(isNaN(N))return NaN;const I=l.pine?.syminfo?.timezone||"UTC",_=Ct(N,I);return Date.UTC(_.year,_.month-1,_.day,0,0,0)},get inputs(){return l.inputs},log:new sl(this),str:new al(this),...p,...ka};const m=p.dayofweek;Object.assign(m,{sunday:1,monday:2,tuesday:3,wednesday:4,thursday:5,friday:6,saturday:7}),this.pine.dayofweek=m;const g=new yl(this),y=new bl(this),b=new vl(this);this.bindContextObject(g,["plotchar","plotshape","plotarrow","plotbar","plotcandle","bgcolor","barcolor"]),this.bindContextObject(g,["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(y,["any","style_dashed","style_solid","style_dotted","param"],"hline"),this.bindContextObject(b,["any","param"],"fill");const v=new El(this);this.pine.chart={param:v.param.bind(v),bg_color:v.bg_color.bind(v),fg_color:v.fg_color.bind(v),is_standard:v.is_standard.bind(v),is_heikinashi:v.is_heikinashi.bind(v),is_kagi:v.is_kagi.bind(v),is_linebreak:v.is_linebreak.bind(v),is_pnf:v.is_pnf.bind(v),is_range:v.is_range.bind(v),is_renko:v.is_renko.bind(v),point:v.point};const S=new Rl(this);this.bindContextObject(S,["any","new","param","set_x","set_y","set_xy","set_text","set_color","set_textcolor","set_size","set_style","set_textalign","set_tooltip","set_point","set_xloc","set_yloc","get_x","get_y","get_text","copy","delete","style_label_down","style_label_up","style_label_left","style_label_right","style_label_lower_left","style_label_lower_right","style_label_upper_left","style_label_upper_right","style_label_center","style_circle","style_square","style_diamond","style_flag","style_arrowup","style_arrowdown","style_cross","style_xcross","style_triangleup","style_triangledown","style_none","style_text_outline"],"label"),Object.defineProperty(this.pine.label,"all",{get:()=>S.all})}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 d?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 d?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new d(t)):new d([n]):new d([n])}initVar(t,i){if(t)return t;let r;return i instanceof d?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new d([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new d(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new d(this.params[r],0)))}get(t,i){if(t instanceof d)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof d){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}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}`;ti._deprecationWarningsShown.has(r)||(ti._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`))}};W(Xr,"_deprecationWarningsShown",new Set);let Fi=Xr;var Ll=Object.defineProperty,Ml=(e,t,i)=>t in e?Ll(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Wi=(e,t,i)=>Ml(e,typeof t!="symbol"?t+"":t,i);class $i{constructor(t,i={}){Wi(this,"source"),Wi(this,"inputs"),this.source=t,this.inputs=i}}var Bl=Object.defineProperty,jl=(e,t,i)=>t in e?Bl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,J=(e,t,i)=>jl(e,typeof t!="symbol"?t+"":t,i);class Zr{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(_=>_.open),p=u.map(_=>_.close),l=u.map(_=>_.high),m=u.map(_=>_.low),g=u.map(_=>_.volume),y=u.map(_=>(_.high+_.low+_.close)/3),b=u.map(_=>(_.high+_.low)/2),v=u.map(_=>(_.high+_.low+_.open+_.close)/4),S=u.map(_=>(_.high+_.low+_.close+_.close)/4),N=u.map(_=>_.openTime),I=u.map(_=>_.closeTime);this.open=h,this.close=p,this.high=l,this.low=m,this.volume=g,this.hl2=b,this.hlc3=y,this.ohlc4=v,this.hlcc4=S,this.openTime=N,this.closeTime=I,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(_=>{this._syminfo=_,this._ready=!0,o(!0)}).catch(_=>{console.warn("Failed to get symbol info, using default values:",_),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 $i?(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 $i?(s=t.source,o=t.inputs||{}):s=t;const c={data:[],error:[]};let u=!1;const h=(m,...g)=>{c[m]&&c[m].forEach(y=>y(...g))},p=(m,g)=>{c[m]||(c[m]=[]),c[m].push(g)},l=()=>{u=!0};return(async()=>{try{const m=typeof this.eDate>"u"&&!Array.isArray(this.source)&&r,g=this._runPaginated(s,o,void 0,a,m);for await(const y of g){if(u)break;if(y===null){await new Promise(b=>setTimeout(b,n));continue}if(h("data",y),m&&!u){const b=y.marketData[y.idx];b&&b.closeTime<Date.now()||await new Promise(v=>setTimeout(v,n))}}}catch(m){h("error",m)}})(),{on:p,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 p=Math.min(c,n),l=this._getResultLength(s.result);await this._executeIterations(s,this._transpiledCode,o,o+p),o+=p,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 Fi({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 d?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 Fi({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 d([]),n.data.open=new d([]),n.data.high=new d([]),n.data.low=new d([]),n.data.volume=new d([]),n.data.hl2=new d([]),n.data.hlc3=new d([]),n.data.ohlc4=new d([]),n.data.hlcc4=new d([]),n.data.openTime=new d([]),n.data.closeTime=new d([]),n.length=this.data.length,n}_transpileCode(t){return Us.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 d?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 p in u[h]){const l=u[h][p];if(l instanceof d){const m=l.get(0);l.data.push(m)}else if(Array.isArray(l)){const m=l[l.length-1];l.push(m)}}};c(t),t.lctx&&t.lctx.forEach(u=>c(u))}}}var Fl=Object.defineProperty,Wl=(e,t,i)=>t in e?Fl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,At=(e,t,i)=>Wl(e,typeof t!="symbol"?t+"":t,i);const Ht="https://api.binance.com/api/v3",Ui="https://api.binance.us/api/v3",zt={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 $l{constructor(t=300*1e3){At(this,"cache"),At(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 Ul{constructor(){At(this,"cacheManager"),At(this,"activeApiUrl",null),this.cacheManager=new $l(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Ht}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Ht,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Ui}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Ui,this.activeApiUrl}catch{}return Ht}async getMarketDataInterval(t,i,r,n){try{const a=zt[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 p=Math.min(c+1e3*h,u),l=await this.getMarketData(t,i,1e3,c,p);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),p=await this.getMarketData(t,i,h,void 0,o);if(p.length===0||(s=p.concat(s),a-=p.length,o=p[0].openTime-1,p.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=zt[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),m=r?l.slice(0,r):l;return this.cacheManager.set(o,m),m}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 p=(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,p),p}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=zt[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"),p=u.filters?.find(N=>N.filterType==="LOT_SIZE"),l=h?parseFloat(h.tickSize):.01,m=p?parseFloat(p.minQty):0,g=Math.round(1/l),y=u.baseAsset,b=u.quoteAsset,v=a?` ${a}`:"",S=`${y} / ${b}${v}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:S,type:i,main_tickerid:`BINANCE:${t}`,current_contract:a,isin:"",basecurrency:y,currency:b,timezone:"Etc/UTC",country:"",mintick:l,pricescale:g,minmove:1,pointvalue:u.contractSize||1,mincontract:m,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}}configure(t){}}class ql{async getMarketData(){return[]}}const Hl=typeof process<"u"&&process.versions&&process.versions.node;let Tt=null;if(Hl)try{Tt=new ql}catch{Tt=null}const zl={Binance:new Ul,...Tt?{Mock:Tt}:{}};export{Fi as Context,$i as Indicator,Zr as PineTS,zl as Provider};
|
|
126
126
|
//# sourceMappingURL=pinets.min.browser.es.js.map
|