pinets 0.3.0 → 0.6.1
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/README.md +50 -3
- package/dist/pinets.dev.browser.js +6429 -1434
- package/dist/pinets.dev.cjs +6525 -1418
- package/dist/pinets.dev.cjs.map +1 -1
- package/dist/pinets.dev.es.js +6527 -1415
- package/dist/pinets.dev.es.js.map +1 -1
- package/dist/pinets.min.browser.js +16 -11
- package/dist/pinets.min.cjs +16 -11
- package/dist/pinets.min.es.js +6 -1
- package/dist/types/Context.class.d.ts +79 -17
- package/dist/types/PineTS.class.d.ts +13 -1
- package/dist/types/marketData/Binance/BinanceProvider.class.d.ts +2 -1
- package/dist/types/marketData/IProvider.d.ts +43 -0
- package/dist/types/marketData/Mock/MockProvider.class.d.ts +13 -1
- package/dist/types/namespaces/Barstate.d.ts +13 -0
- package/dist/types/namespaces/Core.d.ts +16 -0
- package/dist/types/namespaces/Log.d.ts +10 -0
- package/dist/types/namespaces/Str.d.ts +23 -0
- package/dist/types/namespaces/Timeframe.d.ts +17 -0
- package/dist/types/namespaces/Types.d.ts +86 -0
- package/dist/types/namespaces/array/PineArrayObject.d.ts +102 -1
- package/dist/types/namespaces/array/array.index.d.ts +1 -129
- package/dist/types/namespaces/array/methods/avg.d.ts +2 -1
- package/dist/types/namespaces/array/methods/binary_search.d.ts +2 -0
- package/dist/types/namespaces/array/methods/binary_search_leftmost.d.ts +2 -0
- package/dist/types/namespaces/array/methods/binary_search_rightmost.d.ts +2 -0
- package/dist/types/namespaces/array/methods/covariance.d.ts +2 -1
- package/dist/types/namespaces/array/methods/every.d.ts +1 -1
- package/dist/types/namespaces/array/methods/fill.d.ts +2 -1
- package/dist/types/namespaces/array/methods/from.d.ts +1 -1
- package/dist/types/namespaces/array/methods/join.d.ts +5 -0
- package/dist/types/namespaces/array/methods/median.d.ts +2 -0
- package/dist/types/namespaces/array/methods/mode.d.ts +2 -0
- package/dist/types/namespaces/array/methods/new.d.ts +2 -1
- package/dist/types/namespaces/array/methods/new_float.d.ts +2 -1
- package/dist/types/namespaces/array/methods/new_int.d.ts +2 -1
- package/dist/types/namespaces/array/methods/percentile_linear_interpolation.d.ts +3 -0
- package/dist/types/namespaces/array/methods/percentile_nearest_rank.d.ts +2 -0
- package/dist/types/namespaces/array/methods/percentrank.d.ts +2 -0
- package/dist/types/namespaces/array/methods/push.d.ts +2 -1
- package/dist/types/namespaces/array/methods/range.d.ts +2 -1
- package/dist/types/namespaces/array/methods/set.d.ts +2 -1
- package/dist/types/namespaces/array/methods/some.d.ts +1 -1
- package/dist/types/namespaces/array/methods/sort.d.ts +2 -1
- package/dist/types/namespaces/array/methods/sort_indices.d.ts +2 -1
- package/dist/types/namespaces/array/methods/stdev.d.ts +2 -1
- package/dist/types/namespaces/array/methods/sum.d.ts +2 -1
- package/dist/types/namespaces/array/methods/unshift.d.ts +2 -1
- package/dist/types/namespaces/array/methods/variance.d.ts +2 -1
- package/dist/types/namespaces/array/utils.d.ts +5 -0
- package/dist/types/namespaces/input/methods/any.d.ts +1 -2
- package/dist/types/namespaces/input/methods/bool.d.ts +1 -2
- package/dist/types/namespaces/input/methods/color.d.ts +1 -2
- package/dist/types/namespaces/input/methods/enum.d.ts +1 -2
- package/dist/types/namespaces/input/methods/float.d.ts +1 -2
- package/dist/types/namespaces/input/methods/int.d.ts +1 -2
- package/dist/types/namespaces/input/methods/param.d.ts +1 -1
- package/dist/types/namespaces/input/methods/price.d.ts +1 -2
- package/dist/types/namespaces/input/methods/session.d.ts +1 -2
- package/dist/types/namespaces/input/methods/source.d.ts +1 -2
- package/dist/types/namespaces/input/methods/string.d.ts +1 -2
- package/dist/types/namespaces/input/methods/symbol.d.ts +1 -2
- package/dist/types/namespaces/input/methods/text_area.d.ts +1 -2
- package/dist/types/namespaces/input/methods/time.d.ts +1 -2
- package/dist/types/namespaces/input/methods/timeframe.d.ts +1 -2
- package/dist/types/namespaces/input/types.d.ts +12 -1
- package/dist/types/namespaces/input/utils.d.ts +14 -0
- package/dist/types/namespaces/map/PineMapObject.d.ts +26 -0
- package/dist/types/namespaces/map/map.index.d.ts +7 -0
- package/dist/types/namespaces/map/methods/clear.d.ts +3 -0
- package/dist/types/namespaces/map/methods/contains.d.ts +3 -0
- package/dist/types/namespaces/map/methods/copy.d.ts +3 -0
- package/dist/types/namespaces/map/methods/get.d.ts +3 -0
- package/dist/types/namespaces/map/methods/keys.d.ts +4 -0
- package/dist/types/namespaces/map/methods/new.d.ts +3 -0
- package/dist/types/namespaces/map/methods/param.d.ts +1 -0
- package/dist/types/namespaces/map/methods/put.d.ts +3 -0
- package/dist/types/namespaces/map/methods/put_all.d.ts +3 -0
- package/dist/types/namespaces/map/methods/remove.d.ts +3 -0
- package/dist/types/namespaces/map/methods/size.d.ts +3 -0
- package/dist/types/namespaces/map/methods/values.d.ts +4 -0
- package/dist/types/namespaces/math/math.index.d.ts +18 -0
- package/dist/types/namespaces/math/methods/abs.d.ts +2 -1
- package/dist/types/namespaces/math/methods/e.d.ts +5 -0
- package/dist/types/namespaces/math/methods/phi.d.ts +5 -0
- package/dist/types/namespaces/math/methods/pi.d.ts +5 -0
- package/dist/types/namespaces/math/methods/round_to_mintick.d.ts +2 -0
- package/dist/types/namespaces/math/methods/rphi.d.ts +5 -0
- package/dist/types/namespaces/math/methods/sign.d.ts +2 -0
- package/dist/types/namespaces/matrix/PineMatrixObject.d.ts +102 -0
- package/dist/types/namespaces/matrix/matrix.index.d.ts +7 -0
- package/dist/types/namespaces/matrix/methods/add_col.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/add_row.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/avg.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/col.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/columns.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/concat.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/copy.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/det.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/diff.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/eigenvalues.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/eigenvectors.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/elements_count.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/fill.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/get.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/inv.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_antidiagonal.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_antisymmetric.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_binary.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_diagonal.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_identity.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_square.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_stochastic.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_symmetric.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_triangular.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/is_zero.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/kron.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/max.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/median.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/min.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/mode.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/mult.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/new.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/param.d.ts +1 -0
- package/dist/types/namespaces/matrix/methods/pinv.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/pow.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/rank.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/remove_col.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/remove_row.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/reshape.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/reverse.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/row.d.ts +4 -0
- package/dist/types/namespaces/matrix/methods/rows.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/set.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/sort.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/submatrix.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/sum.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/swap_columns.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/swap_rows.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/trace.d.ts +3 -0
- package/dist/types/namespaces/matrix/methods/transpose.d.ts +3 -0
- package/dist/types/namespaces/request/methods/security.d.ts +1 -1
- package/dist/types/namespaces/request/methods/security_lower_tf.d.ts +9 -0
- package/dist/types/namespaces/request/request.index.d.ts +3 -0
- package/dist/types/namespaces/request/types/barmerge.type.d.ts +7 -0
- package/dist/types/namespaces/request/utils/findLTFContextIdx.d.ts +1 -0
- package/dist/types/namespaces/ta/getters/obv.d.ts +12 -0
- package/dist/types/namespaces/ta/methods/accdist.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/alma.d.ts +18 -0
- package/dist/types/namespaces/ta/methods/atr.d.ts +2 -1
- package/dist/types/namespaces/ta/methods/barssince.d.ts +6 -0
- package/dist/types/namespaces/ta/methods/bb.d.ts +17 -0
- package/dist/types/namespaces/ta/methods/bbw.d.ts +9 -0
- package/dist/types/namespaces/ta/methods/cci.d.ts +20 -0
- package/dist/types/namespaces/ta/methods/cmo.d.ts +17 -0
- package/dist/types/namespaces/ta/methods/cog.d.ts +18 -0
- package/dist/types/namespaces/ta/methods/correlation.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/cross.d.ts +15 -0
- package/dist/types/namespaces/ta/methods/cum.d.ts +14 -0
- package/dist/types/namespaces/ta/methods/dmi.d.ts +24 -0
- package/dist/types/namespaces/ta/methods/falling.d.ts +15 -0
- package/dist/types/namespaces/ta/methods/highestbars.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/iii.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/kc.d.ts +12 -0
- package/dist/types/namespaces/ta/methods/kcw.d.ts +11 -0
- package/dist/types/namespaces/ta/methods/lowestbars.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/macd.d.ts +18 -0
- package/dist/types/namespaces/ta/methods/mfi.d.ts +15 -0
- package/dist/types/namespaces/ta/methods/mode.d.ts +6 -0
- package/dist/types/namespaces/ta/methods/nvi.d.ts +10 -0
- package/dist/types/namespaces/ta/methods/obv.d.ts +12 -0
- package/dist/types/namespaces/ta/methods/percentile_linear_interpolation.d.ts +6 -0
- package/dist/types/namespaces/ta/methods/percentile_nearest_rank.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/percentrank.d.ts +6 -0
- package/dist/types/namespaces/ta/methods/pvi.d.ts +10 -0
- package/dist/types/namespaces/ta/methods/pvt.d.ts +12 -0
- package/dist/types/namespaces/ta/methods/range.d.ts +7 -0
- package/dist/types/namespaces/ta/methods/rising.d.ts +15 -0
- package/dist/types/namespaces/ta/methods/sar.d.ts +12 -0
- package/dist/types/namespaces/ta/methods/stoch.d.ts +21 -0
- package/dist/types/namespaces/ta/methods/supertrend.d.ts +23 -0
- package/dist/types/namespaces/ta/methods/swma.d.ts +14 -0
- package/dist/types/namespaces/ta/methods/tr.d.ts +2 -0
- package/dist/types/namespaces/ta/methods/tsi.d.ts +17 -0
- package/dist/types/namespaces/ta/methods/valuewhen.d.ts +6 -0
- package/dist/types/namespaces/ta/methods/vwap.d.ts +14 -0
- package/dist/types/namespaces/ta/methods/wad.d.ts +11 -0
- package/dist/types/namespaces/ta/methods/wpr.d.ts +17 -0
- package/dist/types/namespaces/ta/methods/wvad.d.ts +7 -0
- package/dist/types/namespaces/ta/ta.index.d.ts +120 -5
- package/dist/types/transpiler/analysis/ScopeManager.d.ts +11 -0
- package/dist/types/transpiler/index.d.ts +4 -1
- package/dist/types/transpiler/settings.d.ts +4 -0
- package/dist/types/transpiler/transformers/InjectionTransformer.d.ts +6 -0
- package/dist/types/transpiler/transformers/MainTransformer.d.ts +4 -1
- package/dist/types/transpiler/transformers/NormalizationTransformer.d.ts +15 -0
- package/dist/types/transpiler/transformers/WrapperTransformer.d.ts +9 -0
- package/dist/types/transpiler/utils/ASTFactory.d.ts +2 -0
- package/dist/types/types/PineTypes.d.ts +11 -0
- package/package.json +6 -4
package/dist/pinets.min.cjs
CHANGED
|
@@ -15,17 +15,22 @@
|
|
|
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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ri=require("fs"),ai=require("path"),ni=require("url");function mt(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if(i!=="default"){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var ve=mt(ri),Se=mt(ai),si=[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],dt=[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],oi="\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",xt="\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",Le={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"},Me="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",ui={5:Me,"5module":Me+" export import",6:Me+" const class extends export import super"},ci=/^in(stanceof)?$/,pi=new RegExp("["+xt+"]"),li=new RegExp("["+xt+oi+"]");function je(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 J(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&pi.test(String.fromCharCode(e)):t===!1?!1:je(e,dt)}function ue(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&&li.test(String.fromCharCode(e)):t===!1?!1:je(e,dt)||je(e,si)}var k=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 O(e,t){return new k(e,{beforeExpr:!0,binop:t})}var F={beforeExpr:!0},D={startsExpr:!0},Ge={};function _(e,t){return t===void 0&&(t={}),t.keyword=e,Ge[e]=new k(e,t)}var o={num:new k("num",D),regexp:new k("regexp",D),string:new k("string",D),name:new k("name",D),privateId:new k("privateId",D),eof:new k("eof"),bracketL:new k("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:!0,startsExpr:!0}),braceR:new k("}"),parenL:new k("(",{beforeExpr:!0,startsExpr:!0}),parenR:new k(")"),comma:new k(",",F),semi:new k(";",F),colon:new k(":",F),dot:new k("."),question:new k("?",F),questionDot:new k("?."),arrow:new k("=>",F),template:new k("template"),invalidTemplate:new k("invalidTemplate"),ellipsis:new k("...",F),backQuote:new k("`",D),dollarBraceL:new k("${",{beforeExpr:!0,startsExpr:!0}),eq:new k("=",{beforeExpr:!0,isAssign:!0}),assign:new k("_=",{beforeExpr:!0,isAssign:!0}),incDec:new k("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new k("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:O("||",1),logicalAND:O("&&",2),bitwiseOR:O("|",3),bitwiseXOR:O("^",4),bitwiseAND:O("&",5),equality:O("==/!=/===/!==",6),relational:O("</>/<=/>=",7),bitShift:O("<</>>/>>>",8),plusMin:new k("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:O("%",10),star:O("*",10),slash:O("/",10),starstar:new k("**",{beforeExpr:!0}),coalesce:O("??",1),_break:_("break"),_case:_("case",F),_catch:_("catch"),_continue:_("continue"),_debugger:_("debugger"),_default:_("default",F),_do:_("do",{isLoop:!0,beforeExpr:!0}),_else:_("else",F),_finally:_("finally"),_for:_("for",{isLoop:!0}),_function:_("function",D),_if:_("if"),_return:_("return",F),_switch:_("switch"),_throw:_("throw",F),_try:_("try"),_var:_("var"),_const:_("const"),_while:_("while",{isLoop:!0}),_with:_("with"),_new:_("new",{beforeExpr:!0,startsExpr:!0}),_this:_("this",D),_super:_("super",D),_class:_("class",D),_extends:_("extends",F),_export:_("export"),_import:_("import",D),_null:_("null",D),_true:_("true",D),_false:_("false",D),_in:_("in",{beforeExpr:!0,binop:7}),_instanceof:_("instanceof",{beforeExpr:!0,binop:7}),_typeof:_("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:_("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:_("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},$=/\r\n?|\n|\u2028|\u2029/,hi=new RegExp($.source,"g");function ce(e){return e===10||e===13||e===8232||e===8233}function gt(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var a=e.charCodeAt(r);if(ce(a))return r<i-1&&a===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var yt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,U=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,bt=Object.prototype,fi=bt.hasOwnProperty,mi=bt.toString,pe=Object.hasOwn||function(e,t){return fi.call(e,t)},et=Array.isArray||function(e){return mi.call(e)==="[object Array]"},tt=Object.create(null);function re(e){return tt[e]||(tt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ee(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var di=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,de=function(t,i){this.line=t,this.column=i};de.prototype.offset=function(t){return new de(this.line,this.column+t)};var Pe=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function vt(e,t){for(var i=1,r=0;;){var a=gt(e,r,t);if(a<0)return new de(i,t-r);++i,r=a}}var Oe={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},it=!1;function xi(e){var t={};for(var i in Oe)t[i]=e&&pe(e,i)?e[i]:Oe[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!it&&typeof console=="object"&&console.warn&&(it=!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($).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.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(xe),this.regexpState=null,this.privateNameStack=[]},Y={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}};N.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Y.inFunction.get=function(){return(this.currentVarScope().flags&le)>0};Y.inGenerator.get=function(){return(this.currentVarScope().flags&wt)>0&&!this.currentVarScope().inClassFieldInit};Y.inAsync.get=function(){return(this.currentVarScope().flags&We)>0&&!this.currentVarScope().inClassFieldInit};Y.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&ye)return!1;if(t.flags&le)return(t.flags&We)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Y.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&ze)>0||i||this.options.allowSuperOutsideMethod};Y.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Et)>0};Y.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Y.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(le|ye))>0||i};Y.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ye)>0};N.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,a=0;a<t.length;a++)r=t[a](r);return r};N.parse=function(t,i){return new this(i,t).parse()};N.parseExpressionAt=function(t,i,r){var a=new this(r,t,i);return a.nextToken(),a.parseExpression()};N.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(N.prototype,Y);var M=N.prototype,yi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;M.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){U.lastIndex=e,e+=U.exec(this.input)[0].length;var t=yi.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){U.lastIndex=e+t[0].length;var i=U.exec(this.input),r=i.index+i[0].length,a=this.input.charAt(r);return a===";"||a==="}"||$.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(a)||a==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,U.lastIndex=e,e+=U.exec(this.input)[0].length,this.input[e]===";"&&e++}};M.eat=function(e){return this.type===e?(this.next(),!0):!1};M.isContextual=function(e){return this.type===o.name&&this.value===e&&!this.containsEsc};M.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};M.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};M.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||$.test(this.input.slice(this.lastTokEnd,this.start))};M.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};M.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()};M.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};M.expect=function(e){this.eat(e)||this.unexpected()};M.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ne=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};M.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")}};M.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")};M.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")};M.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var b=N.prototype;b.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==o.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,a=Object.keys(this.undefinedExports);r<a.length;r+=1){var n=a[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ye={kind:"loop"},bi={kind:"switch"};b.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;U.lastIndex=this.pos;var t=U.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(J(r,!0)){for(var a=i+1;ue(r=this.input.charCodeAt(a),!0);)++a;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,a);if(!ci.test(n))return!0}return!1};b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;U.lastIndex=this.pos;var e=U.exec(this.input),t=this.pos+e[0].length,i;return!$.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(ue(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};b.parseStatement=function(e,t,i){var r=this.type,a=this.startNode(),n;switch(this.isLet(e)&&(r=o._var,n="let"),r){case o._break:case o._continue:return this.parseBreakContinueStatement(a,r.keyword);case o._debugger:return this.parseDebuggerStatement(a);case o._do:return this.parseDoStatement(a);case o._for:return this.parseForStatement(a);case o._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case o._class:return e&&this.unexpected(),this.parseClass(a,!0);case o._if:return this.parseIfStatement(a);case o._return:return this.parseReturnStatement(a);case o._switch:return this.parseSwitchStatement(a);case o._throw:return this.parseThrowStatement(a);case o._try:return this.parseTryStatement(a);case o._const:case o._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(a,n);case o._while:return this.parseWhileStatement(a);case o._with:return this.parseWithStatement(a);case o.braceL:return this.parseBlock(!0,a);case o.semi:return this.parseEmptyStatement(a);case o._export:case o._import:if(this.options.ecmaVersion>10&&r===o._import){U.lastIndex=this.pos;var s=U.exec(this.input),u=this.pos+s[0].length,c=this.input.charCodeAt(u);if(c===40||c===46)return this.parseExpressionStatement(a,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===o._import?this.parseImport(a):this.parseExport(a,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var p=this.value,l=this.parseExpression();return r===o.name&&l.type==="Identifier"&&this.eat(o.colon)?this.parseLabeledStatement(a,p,l,e):this.parseExpressionStatement(a,l)}};b.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(o.semi)||this.insertSemicolon()?e.label=null:this.type!==o.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var a=this.labels[r];if((e.label==null||a.name===e.label.name)&&(a.kind!=null&&(i||a.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};b.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};b.parseDoStatement=function(e){return this.next(),this.labels.push(Ye),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};b.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ye),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===o._var||this.type===o._const||i){var r=this.startNode(),a=i?"let":this.value;return this.next(),this.parseVar(r,!0,a),this.finishNode(r,"VariableDeclaration"),(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===o._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),s=!1,u=this.containsEsc,c=new Ne,p=this.start,l=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===o._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===o._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)),n&&s&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,c),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};b.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,fe|(i?0:Fe),!1,t)};b.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};b.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};b.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(o.braceL),this.labels.push(bi),this.enterScope(0);for(var t,i=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var r=this.type===o._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(o.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")};b.parseThrowStatement=function(e){return this.next(),$.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 vi=[];b.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?St:0),this.checkLValPattern(e,t?kt:ie),this.expect(o.parenR),e};b.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===o._catch){var t=this.startNode();this.next(),this.eat(o.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(o._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};b.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};b.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ye),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};b.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")};b.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};b.parseLabeledStatement=function(e,t,i,r){for(var a=0,n=this.labels;a<n.length;a+=1){var s=n[a];s.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===o._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var p=this.labels[c];if(p.statementStart===e.start)p.statementStart=this.start,p.kind=u;else break}return this.labels.push({name:t,kind:u,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")};b.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};b.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(o.braceL),e&&this.enterScope(0);this.type!==o.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};b.parseFor=function(e,t){return e.init=t,this.expect(o.semi),e.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),e.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};b.parseForIn=function(e,t){var i=this.type===o._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(o.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};b.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var a=this.startNode();if(this.parseVarId(a,i),this.eat(o.eq)?a.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&a.id.type!=="Identifier"&&!(t&&(this.type===o._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):a.init=null,e.declarations.push(this.finishNode(a,"VariableDeclarator")),!this.eat(o.comma))break}return e};b.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Qe:ie,!1)};var fe=1,Fe=2,At=4;b.parseFunction=function(e,t,i,r,a){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===o.star&&t&Fe&&this.unexpected(),e.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&fe&&(e.id=t&At&&this.type!==o.name?null:this.parseIdent(),e.id&&!(t&Fe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Qe:ie:_t));var n=this.yieldPos,s=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ke(e.async,e.generator)),t&fe||(e.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,a),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=u,this.finishNode(e,t&fe?"FunctionDeclaration":"FunctionExpression")};b.parseFunctionParams=function(e){this.expect(o.parenL),e.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};b.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),a=this.startNode(),n=!1;for(a.body=[],this.expect(o.braceL);this.type!==o.braceR;){var s=this.parseClassElement(e.superClass!==null);s&&(a.body.push(s),s.type==="MethodDefinition"&&s.kind==="constructor"?(n&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),n=!0):s.key&&s.key.type==="PrivateIdentifier"&&wi(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(a,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};b.parseClassElement=function(e){if(this.eat(o.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",a=!1,n=!1,s="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(o.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===o.star?u=!0:r="static"}if(i.static=u,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===o.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(o.star)&&(a=!0),!r&&!n&&!a){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===o.parenL||s!=="method"||a||n){var p=!i.static&&_e(i,"constructor"),l=p&&e;p&&s!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=p?"constructor":s,this.parseClassMethod(i,a,n,l)}else this.parseClassField(i);return i};b.isClassElementNameStart=function(){return this.type===o.name||this.type===o.privateId||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword};b.parseClassElementName=function(e){this.type===o.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)};b.parseClassMethod=function(e,t,i,r){var a=e.key;e.kind==="constructor"?(t&&this.raise(a.start,"Constructor can't be a generator"),i&&this.raise(a.start,"Constructor can't be an async method")):e.static&&_e(e,"prototype")&&this.raise(a.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};b.parseClassField=function(e){if(_e(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&_e(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(o.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")};b.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ye|ze);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};b.parseClassId=function(e,t){this.type===o.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,ie,!1)):(t===!0&&this.unexpected(),e.id=null)};b.parseClassSuper=function(e){e.superClass=this.eat(o._extends)?this.parseExprSubscripts(null,!1):null};b.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};b.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,a=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var s=i[n];pe(t,s.name)||(a?a.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function wi(e,t){var i=t.key.name,r=e[i],a="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(a=(t.static?"s":"i")+t.kind),r==="iget"&&a==="iset"||r==="iset"&&a==="iget"||r==="sget"&&a==="sset"||r==="sset"&&a==="sget"?(e[i]="true",!1):r?!0:(e[i]=a,!1)}function _e(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}b.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!==o.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};b.parseExport=function(e,t){if(this.next(),this.eat(o.star))return this.parseExportAllDeclaration(e,t);if(this.eat(o._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!==o.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 a=r[i];this.checkUnreserved(a.local),this.checkLocalExport(a.local),a.local.type==="Literal"&&this.raise(a.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};b.parseExportDeclaration=function(e){return this.parseStatement(null)};b.parseExportDefaultDeclaration=function(){var e;if(this.type===o._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,fe|At,!1,e)}else if(this.type===o._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};b.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),pe(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};b.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,a=t.properties;r<a.length;r+=1){var n=a[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var s=0,u=t.elements;s<u.length;s+=1){var c=u[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)};b.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var a=r[i];this.checkPatternExport(e,a.id)}};b.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};b.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")};b.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;t.push(this.parseExportSpecifier(e))}return t};b.parseImport=function(e){return this.next(),this.type===o.string?(e.specifiers=vi,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};b.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,ie),this.finishNode(e,"ImportSpecifier")};b.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ie),this.finishNode(e,"ImportDefaultSpecifier")};b.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,ie),this.finishNode(e,"ImportNamespaceSpecifier")};b.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===o.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(o.comma)))return e;if(this.type===o.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(o.braceL);!this.eat(o.braceR);){if(t)t=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;e.push(this.parseImportSpecifier())}return e};b.parseWithClause=function(){var e=[];if(!this.eat(o._with))return e;this.expect(o.braceL);for(var t={},i=!0;!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var r=this.parseImportAttribute(),a=r.key.type==="Identifier"?r.key.name:r.key.value;pe(t,a)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+a+"'"),t[a]=!0,e.push(r)}return e};b.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===o.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(o.colon),this.type!==o.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===o.string){var e=this.parseLiteral(this.value);return di.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};b.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)};b.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 G=N.prototype;G.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,a=e.properties;r<a.length;r+=1){var n=a[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e};G.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var a=e[r];a&&this.toAssignable(a,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e};G.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};G.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==o.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};G.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()};G.parseBindingList=function(e,t,i,r){for(var a=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(o.comma),t&&this.type===o.comma)a.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===o.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),a.push(s),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else a.push(this.parseAssignableListItem(r))}return a};G.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};G.parseBindingListItem=function(e){return e};G.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};G.checkLValSimple=function(e,t,i){t===void 0&&(t=Ee);var r=t!==Ee;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===ie&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(pe(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==It&&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")}};G.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=Ee),e.type){case"ObjectPattern":for(var r=0,a=e.properties;r<a.length;r+=1){var n=a[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var s=0,u=e.elements;s<u.length;s+=1){var c=u[s];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}};G.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=Ee),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 W=function(t,i,r,a,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=a,this.generator=!!n},P={b_stat:new W("{",!1),b_expr:new W("{",!0),b_tmpl:new W("${",!1),p_stat:new W("(",!1),p_expr:new W("(",!0),q_tmpl:new W("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new W("function",!1),f_expr:new W("function",!0),f_expr_gen:new W("function",!0,!1,null,!0),f_gen:new W("function",!1,!1,null,!0)},he=N.prototype;he.initialContext=function(){return[P.b_stat]};he.curContext=function(){return this.context[this.context.length-1]};he.braceIsBlock=function(e){var t=this.curContext();return t===P.f_expr||t===P.f_stat?!0:e===o.colon&&(t===P.b_stat||t===P.b_expr)?!t.isExpr:e===o._return||e===o.name&&this.exprAllowed?$.test(this.input.slice(this.lastTokEnd,this.start)):e===o._else||e===o.semi||e===o.eof||e===o.parenR||e===o.arrow?!0:e===o.braceL?t===P.b_stat:e===o._var||e===o._const||e===o.name?!1:!this.exprAllowed};he.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};he.updateContext=function(e){var t,i=this.type;i.keyword&&e===o.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};he.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};o.parenR.updateContext=o.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===P.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};o.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?P.b_stat:P.b_expr),this.exprAllowed=!0};o.dollarBraceL.updateContext=function(){this.context.push(P.b_tmpl),this.exprAllowed=!0};o.parenL.updateContext=function(e){var t=e===o._if||e===o._for||e===o._with||e===o._while;this.context.push(t?P.p_stat:P.p_expr),this.exprAllowed=!0};o.incDec.updateContext=function(){};o._function.updateContext=o._class.updateContext=function(e){e.beforeExpr&&e!==o._else&&!(e===o.semi&&this.curContext()!==P.p_stat)&&!(e===o._return&&$.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===o.colon||e===o.braceL)&&this.curContext()===P.b_stat)?this.context.push(P.f_expr):this.context.push(P.f_stat),this.exprAllowed=!1};o.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};o.backQuote.updateContext=function(){this.curContext()===P.q_tmpl?this.context.pop():this.context.push(P.q_tmpl),this.exprAllowed=!1};o.star.updateContext=function(e){if(e===o._function){var t=this.context.length-1;this.context[t]===P.f_expr?this.context[t]=P.f_expr_gen:this.context[t]=P.f_gen}this.exprAllowed=!0};o.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==o.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var w=N.prototype;w.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,a;switch(r.type){case"Identifier":a=r.name;break;case"Literal":a=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){a==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}a="$"+a;var s=t[a];if(s){var u;n==="init"?u=this.strict&&s.init||s.get||s.set:u=s.init||s[n],u&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[a]={init:!1,get:!1,set:!1};s[n]=!0}};w.parseExpression=function(e,t){var i=this.start,r=this.startLoc,a=this.parseMaybeAssign(e,t);if(this.type===o.comma){var n=this.startNodeAt(i,r);for(n.expressions=[a];this.eat(o.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return a};w.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,a=-1,n=-1,s=-1;t?(a=t.parenthesizedAssign,n=t.trailingComma,s=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ne,r=!0);var u=this.start,c=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var p=this.parseMaybeConditional(e,t);if(i&&(p=i.call(this,p,u,c)),this.type.isAssign){var l=this.startNodeAt(u,c);return l.operator=this.value,this.type===o.eq&&(p=this.toAssignable(p,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=p.start&&(t.shorthandAssign=-1),this.type===o.eq?this.checkLValPattern(p):this.checkLValSimple(p),l.left=p,this.next(),l.right=this.parseMaybeAssign(e),s>-1&&(t.doubleProto=s),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return a>-1&&(t.parenthesizedAssign=a),n>-1&&(t.trailingComma=n),p};w.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,a=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return a;if(this.eat(o.question)){var n=this.startNodeAt(i,r);return n.test=a,n.consequent=this.parseMaybeAssign(),this.expect(o.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return a};w.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,a=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||a.start===i&&a.type==="ArrowFunctionExpression"?a:this.parseExprOp(a,i,r,-1,e)};w.parseExprOp=function(e,t,i,r,a){var n=this.type.binop;if(n!=null&&(!a||this.type!==o._in)&&n>r){var s=this.type===o.logicalOR||this.type===o.logicalAND,u=this.type===o.coalesce;u&&(n=o.logicalAND.binop);var c=this.value;this.next();var p=this.start,l=this.startLoc,x=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,a),p,l,n,a),d=this.buildBinary(t,i,e,x,c,s||u);return(s&&this.type===o.coalesce||u&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,i,r,a)}return e};w.buildBinary=function(e,t,i,r,a,n){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=a,s.right=r,this.finishNode(s,n?"LogicalExpression":"BinaryExpression")};w.parseMaybeUnary=function(e,t,i,r){var a=this.start,n=this.startLoc,s;if(this.isContextual("await")&&this.canAwait)s=this.parseAwait(r),t=!0;else if(this.type.prefix){var u=this.startNode(),c=this.type===o.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&Pt(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&Ue(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(u,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===o.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==o._in&&this.unexpected();else{if(s=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var p=this.startNodeAt(a,n);p.operator=this.value,p.prefix=!1,p.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(p,"UpdateExpression")}}if(!i&&this.eat(o.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(a,n,s,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return s};function Pt(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Pt(e.expression)}function Ue(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Ue(e.expression)||e.type==="ParenthesizedExpression"&&Ue(e.expression)}w.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,a=this.parseExprAtom(e,t);if(a.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return a;var n=this.parseSubscripts(a,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};w.parseSubscripts=function(e,t,i,r,a){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,s=!1;;){var u=this.parseSubscript(e,t,i,r,n,s,a);if(u.optional&&(s=!0),u===e||u.type==="ArrowFunctionExpression"){if(s){var c=this.startNodeAt(t,i);c.expression=u,u=this.finishNode(c,"ChainExpression")}return u}e=u}};w.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(o.arrow)};w.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};w.parseSubscript=function(e,t,i,r,a,n,s){var u=this.options.ecmaVersion>=11,c=u&&this.eat(o.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var p=this.eat(o.bracketL);if(p||c&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var l=this.startNodeAt(t,i);l.object=e,p?(l.property=this.parseExpression(),this.expect(o.bracketR)):this.type===o.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!p,u&&(l.optional=c),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(o.parenL)){var x=new Ne,d=this.yieldPos,h=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var C=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,x);if(a&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(x,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=h,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(t,i,C,s);this.checkExpressionErrors(x,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=h||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var S=this.startNodeAt(t,i);S.callee=e,S.arguments=C,u&&(S.optional=c),e=this.finishNode(S,"CallExpression")}else if(this.type===o.backQuote){(c||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var A=this.startNodeAt(t,i);A.tag=e,A.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(A,"TaggedTemplateExpression")}return e};w.parseExprAtom=function(e,t,i){this.type===o.slash&&this.readRegexp();var r,a=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(r,"Super");case o._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case o.name:var n=this.start,s=this.startLoc,u=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(o._function))return this.overrideContext(P.f_expr),this.parseFunction(this.startNodeAt(n,s),0,!1,!0,t);if(a&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(n,s),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===o.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,s),[c],!0,t)}return c;case o.regexp:var p=this.value;return r=this.parseLiteral(p.value),r.regex={pattern:p.pattern,flags:p.flags},r;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return r=this.startNode(),r.value=this.type===o._null?null:this.type===o._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case o.parenL:var l=this.start,x=this.parseParenAndDistinguishExpression(a,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(x)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),x;case o.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(o.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case o.braceL:return this.overrideContext(P.b_expr),this.parseObj(!1,e);case o._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};w.parseExprAtomDefault=function(){this.unexpected()};w.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===o.parenL&&!e)return this.parseDynamicImport(t);if(this.type===o.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()};w.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(o.parenR)?e.options=null:(this.expect(o.comma),this.afterTrailingComma(o.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(o.parenR)||(this.expect(o.comma),this.afterTrailingComma(o.parenR)||this.unexpected())));else if(!this.eat(o.parenR)){var t=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};w.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")};w.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")};w.parseParenExpression=function(){this.expect(o.parenL);var e=this.parseExpression();return this.expect(o.parenR),e};w.shouldParseArrow=function(e){return!this.canInsertSemicolon()};w.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,a,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s=this.start,u=this.startLoc,c=[],p=!0,l=!1,x=new Ne,d=this.yieldPos,h=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;)if(p?p=!1:this.expect(o.comma),n&&this.afterTrailingComma(o.parenR,!0)){l=!0;break}else if(this.type===o.ellipsis){g=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,x,this.parseParenItem));var C=this.lastTokEnd,S=this.lastTokEndLoc;if(this.expect(o.parenR),e&&this.shouldParseArrow(c)&&this.eat(o.arrow))return this.checkPatternErrors(x,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=h,this.parseParenArrowList(i,r,c,t);(!c.length||l)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(x,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=h||this.awaitPos,c.length>1?(a=this.startNodeAt(s,u),a.expressions=c,this.finishNodeAt(a,"SequenceExpression",C,S)):a=c[0]}else a=this.parseParenExpression();if(this.options.preserveParens){var A=this.startNodeAt(i,r);return A.expression=a,this.finishNode(A,"ParenthesizedExpression")}else return a};w.parseParenItem=function(e){return e};w.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Ci=[];w.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===o.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,a=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,a,!0,!1),this.eat(o.parenL)?e.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Ci,this.finishNode(e,"NewExpression")};w.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===o.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
|
|
18
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Ti=require("fs"),Mi=require("path"),Li=require("url");function jt(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if(i!=="default"){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var ye=jt(Ti),Ae=jt(Mi),Di=[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],Ot=[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],Ri="\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",Ft="\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",Je={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"},et="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",Bi={5:et,"5module":et+" export import",6:et+" const class extends export import super"},ji=/^in(stanceof)?$/,Oi=new RegExp("["+Ft+"]"),Fi=new RegExp("["+Ft+Ri+"]");function nt(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 oe(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Oi.test(String.fromCharCode(e)):t===!1?!1:nt(e,Ot)}function ve(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&&Fi.test(String.fromCharCode(e)):t===!1?!1:nt(e,Ot)||nt(e,Di)}var V=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 G(e,t){return new V(e,{beforeExpr:!0,binop:t})}var K={beforeExpr:!0},q={startsExpr:!0},ct={};function P(e,t){return t===void 0&&(t={}),t.keyword=e,ct[e]=new V(e,t)}var l={num:new V("num",q),regexp:new V("regexp",q),string:new V("string",q),name:new V("name",q),privateId:new V("privateId",q),eof:new V("eof"),bracketL:new V("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new V("]"),braceL:new V("{",{beforeExpr:!0,startsExpr:!0}),braceR:new V("}"),parenL:new V("(",{beforeExpr:!0,startsExpr:!0}),parenR:new V(")"),comma:new V(",",K),semi:new V(";",K),colon:new V(":",K),dot:new V("."),question:new V("?",K),questionDot:new V("?."),arrow:new V("=>",K),template:new V("template"),invalidTemplate:new V("invalidTemplate"),ellipsis:new V("...",K),backQuote:new V("`",q),dollarBraceL:new V("${",{beforeExpr:!0,startsExpr:!0}),eq:new V("=",{beforeExpr:!0,isAssign:!0}),assign:new V("_=",{beforeExpr:!0,isAssign:!0}),incDec:new V("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new V("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:G("||",1),logicalAND:G("&&",2),bitwiseOR:G("|",3),bitwiseXOR:G("^",4),bitwiseAND:G("&",5),equality:G("==/!=/===/!==",6),relational:G("</>/<=/>=",7),bitShift:G("<</>>/>>>",8),plusMin:new V("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:G("%",10),star:G("*",10),slash:G("/",10),starstar:new V("**",{beforeExpr:!0}),coalesce:G("??",1),_break:P("break"),_case:P("case",K),_catch:P("catch"),_continue:P("continue"),_debugger:P("debugger"),_default:P("default",K),_do:P("do",{isLoop:!0,beforeExpr:!0}),_else:P("else",K),_finally:P("finally"),_for:P("for",{isLoop:!0}),_function:P("function",q),_if:P("if"),_return:P("return",K),_switch:P("switch"),_throw:P("throw",K),_try:P("try"),_var:P("var"),_const:P("const"),_while:P("while",{isLoop:!0}),_with:P("with"),_new:P("new",{beforeExpr:!0,startsExpr:!0}),_this:P("this",q),_super:P("super",q),_class:P("class",q),_extends:P("extends",K),_export:P("export"),_import:P("import",q),_null:P("null",q),_true:P("true",q),_false:P("false",q),_in:P("in",{beforeExpr:!0,binop:7}),_instanceof:P("instanceof",{beforeExpr:!0,binop:7}),_typeof:P("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:P("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:P("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Y=/\r\n?|\n|\u2028|\u2029/,$i=new RegExp(Y.source,"g");function Se(e){return e===10||e===13||e===8232||e===8233}function $t(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(Se(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Wt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Q=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ut=Object.prototype,Wi=Ut.hasOwnProperty,Ui=Ut.toString,Ne=Object.hasOwn||function(e,t){return Wi.call(e,t)},wt=Array.isArray||function(e){return Ui.call(e)==="[object Array]"},St=Object.create(null);function pe(e){return St[e]||(St[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ue(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var qi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Te=function(t,i){this.line=t,this.column=i};Te.prototype.offset=function(t){return new Te(this.line,this.column+t)};var He=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function qt(e,t){for(var i=1,r=0;;){var n=$t(e,r,t);if(n<0)return new Te(i,t-r);++i,r=n}}var at={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Nt=!1;function zi(e){var t={};for(var i in at)t[i]=e&&Ne(e,i)?e[i]:at[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Nt&&typeof console=="object"&&console.warn&&(Nt=!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),wt(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}return wt(t.onComment)&&(t.onComment=Hi(t,t.onComment)),t}function Hi(e,t){return function(i,r,n,a,s,o){var u={type:i?"Block":"Line",value:r,start:n,end:a};e.locations&&(u.loc=new He(this,s,o)),e.ranges&&(u.range=[n,a]),t.push(u)}}var Me=1,Ce=2,lt=4,zt=8,Ht=16,Gt=32,ht=64,Kt=128,Le=256,pt=Me|Ce|Le;function ft(e,t){return Ce|(e?lt:0)|(t?zt:0)}var Fe=0,mt=1,le=2,Qt=3,Xt=4,Yt=5,B=function(t,i,r){this.options=t=zi(t),this.sourceFile=t.sourceFile,this.keywords=pe(Bi[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=Je[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=pe(n);var a=(n?n+" ":"")+Je.strict;this.reservedWordsStrict=pe(a),this.reservedWordsStrictBind=pe(a+" "+Je.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(Y).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=l.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(Me),this.regexpState=null,this.privateNameStack=[]},ne={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}};B.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};ne.inFunction.get=function(){return(this.currentVarScope().flags&Ce)>0};ne.inGenerator.get=function(){return(this.currentVarScope().flags&zt)>0&&!this.currentVarScope().inClassFieldInit};ne.inAsync.get=function(){return(this.currentVarScope().flags<)>0&&!this.currentVarScope().inClassFieldInit};ne.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Le)return!1;if(t.flags&Ce)return(t.flags<)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};ne.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&ht)>0||i||this.options.allowSuperOutsideMethod};ne.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Kt)>0};ne.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};ne.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Ce|Le))>0||i};ne.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Le)>0};B.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};B.parse=function(t,i){return new this(i,t).parse()};B.parseExpressionAt=function(t,i,r){var n=new this(r,t,i);return n.nextToken(),n.parseExpression()};B.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(B.prototype,ne);var U=B.prototype,Gi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;U.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){Q.lastIndex=e,e+=Q.exec(this.input)[0].length;var t=Gi.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){Q.lastIndex=e+t[0].length;var i=Q.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||Y.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,Q.lastIndex=e,e+=Q.exec(this.input)[0].length,this.input[e]===";"&&e++}};U.eat=function(e){return this.type===e?(this.next(),!0):!1};U.isContextual=function(e){return this.type===l.name&&this.value===e&&!this.containsEsc};U.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};U.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};U.canInsertSemicolon=function(){return this.type===l.eof||this.type===l.braceR||Y.test(this.input.slice(this.lastTokEnd,this.start))};U.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};U.semicolon=function(){!this.eat(l.semi)&&!this.insertSemicolon()&&this.unexpected()};U.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};U.expect=function(e){this.eat(e)||this.unexpected()};U.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Ge=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};U.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")}};U.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")};U.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")};U.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var S=B.prototype;S.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==l.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 dt={kind:"loop"},Ki={kind:"switch"};S.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Q.lastIndex=this.pos;var t=Q.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(oe(r,!0)){for(var n=i+1;ve(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(i,n);if(!ji.test(a))return!0}return!1};S.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Q.lastIndex=this.pos;var e=Q.exec(this.input),t=this.pos+e[0].length,i;return!Y.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(ve(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};S.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),a;switch(this.isLet(e)&&(r=l._var,a="let"),r){case l._break:case l._continue:return this.parseBreakContinueStatement(n,r.keyword);case l._debugger:return this.parseDebuggerStatement(n);case l._do:return this.parseDoStatement(n);case l._for:return this.parseForStatement(n);case l._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case l._class:return e&&this.unexpected(),this.parseClass(n,!0);case l._if:return this.parseIfStatement(n);case l._return:return this.parseReturnStatement(n);case l._switch:return this.parseSwitchStatement(n);case l._throw:return this.parseThrowStatement(n);case l._try:return this.parseTryStatement(n);case l._const:case l._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(n,a);case l._while:return this.parseWhileStatement(n);case l._with:return this.parseWithStatement(n);case l.braceL:return this.parseBlock(!0,n);case l.semi:return this.parseEmptyStatement(n);case l._export:case l._import:if(this.options.ecmaVersion>10&&r===l._import){Q.lastIndex=this.pos;var s=Q.exec(this.input),o=this.pos+s[0].length,u=this.input.charCodeAt(o);if(u===40||u===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===l._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var c=this.value,h=this.parseExpression();return r===l.name&&h.type==="Identifier"&&this.eat(l.colon)?this.parseLabeledStatement(n,c,h,e):this.parseExpressionStatement(n,h)}};S.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(l.semi)||this.insertSemicolon()?e.label=null:this.type!==l.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")};S.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};S.parseDoStatement=function(e){return this.next(),this.labels.push(dt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(l._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(l.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};S.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(dt),this.enterScope(0),this.expect(l.parenL),this.type===l.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===l._var||this.type===l._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===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===l._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,u=new Ge,c=this.start,h=t>-1?this.parseExprSubscripts(u,"await"):this.parseExpression(!0,u);return this.type===l._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===l._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(h.start===c&&!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,u),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))};S.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Pe|(i?0:st),!1,t)};S.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(l._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};S.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(l.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};S.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(l.braceL),this.labels.push(Ki),this.enterScope(0);for(var t,i=!1;this.type!==l.braceR;)if(this.type===l._case||this.type===l._default){var r=this.type===l._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(l.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")};S.parseThrowStatement=function(e){return this.next(),Y.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 Qi=[];S.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Gt:0),this.checkLValPattern(e,t?Xt:le),this.expect(l.parenR),e};S.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===l._catch){var t=this.startNode();this.next(),this.eat(l.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(l._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};S.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};S.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(dt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};S.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")};S.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};S.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===l._switch?"switch":null,u=this.labels.length-1;u>=0;u--){var c=this.labels[u];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};S.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};S.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(l.braceL),e&&this.enterScope(0);this.type!==l.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};S.parseFor=function(e,t){return e.init=t,this.expect(l.semi),e.test=this.type===l.semi?null:this.parseExpression(),this.expect(l.semi),e.update=this.type===l.parenR?null:this.parseExpression(),this.expect(l.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};S.parseForIn=function(e,t){var i=this.type===l._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(l.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};S.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(l.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&n.id.type!=="Identifier"&&!(t&&(this.type===l._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(l.comma))break}return e};S.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?mt:le,!1)};var Pe=1,st=2,Zt=4;S.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===l.star&&t&st&&this.unexpected(),e.generator=this.eat(l.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Pe&&(e.id=t&Zt&&this.type!==l.name?null:this.parseIdent(),e.id&&!(t&st)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?mt:le:Qt));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ft(e.async,e.generator)),t&Pe||(e.id=this.type===l.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&Pe?"FunctionDeclaration":"FunctionExpression")};S.parseFunctionParams=function(e){this.expect(l.parenL),e.params=this.parseBindingList(l.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};S.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(l.braceL);this.type!==l.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"&&Xi(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")};S.parseClassElement=function(e){if(this.eat(l.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(l.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===l.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===l.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(t>=9||!a)&&this.eat(l.star)&&(n=!0),!r&&!a&&!n){var u=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=u:r=u)}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===l.parenL||s!=="method"||n||a){var c=!i.static&&$e(i,"constructor"),h=c&&e;c&&s!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":s,this.parseClassMethod(i,n,a,h)}else this.parseClassField(i);return i};S.isClassElementNameStart=function(){return this.type===l.name||this.type===l.privateId||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword};S.parseClassElementName=function(e){this.type===l.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)};S.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&&$e(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")};S.parseClassField=function(e){if($e(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&$e(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(l.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")};S.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Le|ht);this.type!==l.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};S.parseClassId=function(e,t){this.type===l.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,le,!1)):(t===!0&&this.unexpected(),e.id=null)};S.parseClassSuper=function(e){e.superClass=this.eat(l._extends)?this.parseExprSubscripts(null,!1):null};S.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};S.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];Ne(t,s.name)||(n?n.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}};function Xi(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 $e(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}S.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!==l.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};S.parseExport=function(e,t){if(this.next(),this.eat(l.star))return this.parseExportAllDeclaration(e,t);if(this.eat(l._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!==l.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")};S.parseExportDeclaration=function(e){return this.parseStatement(null)};S.parseExportDefaultDeclaration=function(){var e;if(this.type===l._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Pe|Zt,!1,e)}else if(this.type===l._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};S.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ne(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};S.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 u=o[s];u&&this.checkPatternExport(e,u)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};S.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)}};S.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};S.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")};S.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(l.braceL);!this.eat(l.braceR);){if(i)i=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;t.push(this.parseExportSpecifier(e))}return t};S.parseImport=function(e){return this.next(),this.type===l.string?(e.specifiers=Qi,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===l.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};S.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")};S.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,le),this.finishNode(e,"ImportDefaultSpecifier")};S.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")};S.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===l.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(l.comma)))return e;if(this.type===l.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(l.braceL);!this.eat(l.braceR);){if(t)t=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;e.push(this.parseImportSpecifier())}return e};S.parseWithClause=function(){var e=[];if(!this.eat(l._with))return e;this.expect(l.braceL);for(var t={},i=!0;!this.eat(l.braceR);){if(i)i=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;Ne(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e};S.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(l.colon),this.type!==l.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};S.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===l.string){var e=this.parseLiteral(this.value);return qi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};S.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)};S.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 Z=B.prototype;Z.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};Z.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};Z.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};Z.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==l.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};Z.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case l.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(l.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case l.braceL:return this.parseObj(!0)}return this.parseIdent()};Z.parseBindingList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(l.comma),t&&this.type===l.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===l.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),n.push(s),this.type===l.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};Z.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};Z.parseBindingListItem=function(e){return e};Z.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(l.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};Z.checkLValSimple=function(e,t,i){t===void 0&&(t=Fe);var r=t!==Fe;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&&(Ne(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Yt&&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")}};Z.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=Fe),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 u=o[s];u&&this.checkLValInnerPattern(u,t,i)}break;default:this.checkLValSimple(e,t,i)}};Z.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=Fe),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 J=function(t,i,r,n,a){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!a},L={b_stat:new J("{",!1),b_expr:new J("{",!0),b_tmpl:new J("${",!1),p_stat:new J("(",!1),p_expr:new J("(",!0),q_tmpl:new J("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new J("function",!1),f_expr:new J("function",!0),f_expr_gen:new J("function",!0,!1,null,!0),f_gen:new J("function",!1,!1,null,!0)},Ee=B.prototype;Ee.initialContext=function(){return[L.b_stat]};Ee.curContext=function(){return this.context[this.context.length-1]};Ee.braceIsBlock=function(e){var t=this.curContext();return t===L.f_expr||t===L.f_stat?!0:e===l.colon&&(t===L.b_stat||t===L.b_expr)?!t.isExpr:e===l._return||e===l.name&&this.exprAllowed?Y.test(this.input.slice(this.lastTokEnd,this.start)):e===l._else||e===l.semi||e===l.eof||e===l.parenR||e===l.arrow?!0:e===l.braceL?t===L.b_stat:e===l._var||e===l._const||e===l.name?!1:!this.exprAllowed};Ee.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};Ee.updateContext=function(e){var t,i=this.type;i.keyword&&e===l.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};Ee.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};l.parenR.updateContext=l.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===L.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};l.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?L.b_stat:L.b_expr),this.exprAllowed=!0};l.dollarBraceL.updateContext=function(){this.context.push(L.b_tmpl),this.exprAllowed=!0};l.parenL.updateContext=function(e){var t=e===l._if||e===l._for||e===l._with||e===l._while;this.context.push(t?L.p_stat:L.p_expr),this.exprAllowed=!0};l.incDec.updateContext=function(){};l._function.updateContext=l._class.updateContext=function(e){e.beforeExpr&&e!==l._else&&!(e===l.semi&&this.curContext()!==L.p_stat)&&!(e===l._return&&Y.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===l.colon||e===l.braceL)&&this.curContext()===L.b_stat)?this.context.push(L.f_expr):this.context.push(L.f_stat),this.exprAllowed=!1};l.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};l.backQuote.updateContext=function(){this.curContext()===L.q_tmpl?this.context.pop():this.context.push(L.q_tmpl),this.exprAllowed=!1};l.star.updateContext=function(e){if(e===l._function){var t=this.context.length-1;this.context[t]===L.f_expr?this.context[t]=L.f_expr_gen:this.context[t]=L.f_gen}this.exprAllowed=!0};l.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==l.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var k=B.prototype;k.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}};k.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===l.comma){var a=this.startNodeAt(i,r);for(a.expressions=[n];this.eat(l.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return n};k.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 Ge,r=!0);var o=this.start,u=this.startLoc;(this.type===l.parenL||this.type===l.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var c=this.parseMaybeConditional(e,t);if(i&&(c=i.call(this,c,o,u)),this.type.isAssign){var h=this.startNodeAt(o,u);return h.operator=this.value,this.type===l.eq&&(c=this.toAssignable(c,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===l.eq?this.checkLValPattern(c):this.checkLValSimple(c),h.left=c,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),c};k.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(l.question)){var a=this.startNodeAt(i,r);return a.test=n,a.consequent=this.parseMaybeAssign(),this.expect(l.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return n};k.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)};k.parseExprOp=function(e,t,i,r,n){var a=this.type.binop;if(a!=null&&(!n||this.type!==l._in)&&a>r){var s=this.type===l.logicalOR||this.type===l.logicalAND,o=this.type===l.coalesce;o&&(a=l.logicalAND.binop);var u=this.value;this.next();var c=this.start,h=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),c,h,a,n),d=this.buildBinary(t,i,e,f,u,s||o);return(s&&this.type===l.coalesce||o&&(this.type===l.logicalOR||this.type===l.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,i,r,n)}return e};k.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")};k.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(),u=this.type===l.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,u,r),this.checkExpressionErrors(e,!0),u?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Jt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&ot(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,s=this.finishNode(o,u?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===l.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),s=this.parsePrivateIdent(),this.type!==l._in&&this.unexpected();else{if(s=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(n,a);c.operator=this.value,c.prefix=!1,c.argument=s,this.checkLValSimple(s),this.next(),s=this.finishNode(c,"UpdateExpression")}}if(!i&&this.eat(l.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 Jt(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Jt(e.expression)}function ot(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&ot(e.expression)||e.type==="ParenthesizedExpression"&&ot(e.expression)}k.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};k.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 u=this.startNodeAt(t,i);u.expression=o,o=this.finishNode(u,"ChainExpression")}return o}e=o}};k.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(l.arrow)};k.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};k.parseSubscript=function(e,t,i,r,n,a,s){var o=this.options.ecmaVersion>=11,u=o&&this.eat(l.questionDot);r&&u&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(l.bracketL);if(c||u&&this.type!==l.parenL&&this.type!==l.backQuote||this.eat(l.dot)){var h=this.startNodeAt(t,i);h.object=e,c?(h.property=this.parseExpression(),this.expect(l.bracketR)):this.type===l.privateId&&e.type!=="Super"?h.property=this.parsePrivateIdent():h.property=this.parseIdent(this.options.allowReserved!=="never"),h.computed=!!c,o&&(h.optional=u),e=this.finishNode(h,"MemberExpression")}else if(!r&&this.eat(l.parenL)){var f=new Ge,d=this.yieldPos,p=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var x=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1,f);if(n&&!u&&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=d,this.awaitPos=p,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(t,i,x,s);this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var y=this.startNodeAt(t,i);y.callee=e,y.arguments=x,o&&(y.optional=u),e=this.finishNode(y,"CallExpression")}else if(this.type===l.backQuote){(u||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var w=this.startNodeAt(t,i);w.tag=e,w.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(w,"TaggedTemplateExpression")}return e};k.parseExprAtom=function(e,t,i){this.type===l.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case l._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===l.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==l.dot&&this.type!==l.bracketL&&this.type!==l.parenL&&this.unexpected(),this.finishNode(r,"Super");case l._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case l.name:var a=this.start,s=this.startLoc,o=this.containsEsc,u=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&u.name==="async"&&!this.canInsertSemicolon()&&this.eat(l._function))return this.overrideContext(L.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(l.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[u],!1,t);if(this.options.ecmaVersion>=8&&u.name==="async"&&this.type===l.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return u=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(l.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[u],!0,t)}return u;case l.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case l.num:case l.string:return this.parseLiteral(this.value);case l._null:case l._true:case l._false:return r=this.startNode(),r.value=this.type===l._null?null:this.type===l._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case l.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 l.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(l.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case l.braceL:return this.overrideContext(L.b_expr),this.parseObj(!1,e);case l._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case l._class:return this.parseClass(this.startNode(),!1);case l._new:return this.parseNew();case l.backQuote:return this.parseTemplate();case l._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};k.parseExprAtomDefault=function(){this.unexpected()};k.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===l.parenL&&!e)return this.parseDynamicImport(t);if(this.type===l.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()};k.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(l.parenR)?e.options=null:(this.expect(l.comma),this.afterTrailingComma(l.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(l.parenR)||(this.expect(l.comma),this.afterTrailingComma(l.parenR)||this.unexpected())));else if(!this.eat(l.parenR)){var t=this.start;this.eat(l.comma)&&this.eat(l.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};k.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")};k.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")};k.parseParenExpression=function(){this.expect(l.parenL);var e=this.parseExpression();return this.expect(l.parenR),e};k.shouldParseArrow=function(e){return!this.canInsertSemicolon()};k.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,u=[],c=!0,h=!1,f=new Ge,d=this.yieldPos,p=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==l.parenR;)if(c?c=!1:this.expect(l.comma),a&&this.afterTrailingComma(l.parenR,!0)){h=!0;break}else if(this.type===l.ellipsis){g=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else u.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var x=this.lastTokEnd,y=this.lastTokEndLoc;if(this.expect(l.parenR),e&&this.shouldParseArrow(u)&&this.eat(l.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=p,this.parseParenArrowList(i,r,u,t);(!u.length||h)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,u.length>1?(n=this.startNodeAt(s,o),n.expressions=u,this.finishNodeAt(n,"SequenceExpression",x,y)):n=u[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var w=this.startNodeAt(i,r);return w.expression=n,this.finishNode(w,"ParenthesizedExpression")}else return n};k.parseParenItem=function(e){return e};k.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Yi=[];k.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===l.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(l.parenL)?e.arguments=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Yi,this.finishNode(e,"NewExpression")};k.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===l.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===o.backQuote,this.finishNode(i,"TemplateElement")};w.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===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(o.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};w.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!$.test(this.input.slice(this.lastTokEnd,this.start))};w.parseObj=function(e,t){var i=this.startNode(),r=!0,a={};for(i.properties=[],this.next();!this.eat(o.braceR);){if(r)r=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,a,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};w.parseProperty=function(e,t){var i=this.startNode(),r,a,n,s;if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===o.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===o.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,s=this.startLoc),e||(r=this.eat(o.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(a=!0,r=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(i)):a=!1,this.parsePropertyValue(i,e,r,a,n,s,t,u),this.finishNode(i,"Property")};w.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")};w.parsePropertyValue=function(e,t,i,r,a,n,s,u){(i||r)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===o.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==o.comma&&this.type!==o.braceR&&this.type!==o.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=a),e.kind="init",t?e.value=this.parseMaybeDefault(a,n,this.copyNode(e.key)):this.type===o.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(a,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};w.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(o.bracketR),e.key;e.computed=!1}return e.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};w.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};w.parseMethod=function(e,t,i){var r=this.startNode(),a=this.yieldPos,n=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(Ke(t,r.generator)|ze|(i?Et:0)),this.expect(o.parenL),r.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=a,this.awaitPos=n,this.awaitIdentPos=s,this.finishNode(r,"FunctionExpression")};w.parseArrowExpression=function(e,t,i,r){var a=this.yieldPos,n=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(Ke(i,!1)|Ct),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=a,this.awaitPos=n,this.awaitIdentPos=s,this.finishNode(e,"ArrowFunctionExpression")};w.parseFunctionBody=function(e,t,i,r){var a=t&&this.type!==o.braceL,n=this.strict,s=!1;if(a)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||u)&&(s=this.strictDirective(this.end),s&&u&&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,!n&&!s&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,It),e.body=this.parseBlock(!1,void 0,s&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()};w.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};w.checkParams=function(e,t){for(var i=Object.create(null),r=0,a=e.params;r<a.length;r+=1){var n=a[r];this.checkLValInnerPattern(n,Qe,t?null:i)}};w.parseExprList=function(e,t,i,r){for(var a=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(o.comma),t&&this.afterTrailingComma(e))break;var s=void 0;i&&this.type===o.comma?s=null:this.type===o.ellipsis?(s=this.parseSpread(r),r&&this.type===o.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),a.push(s)}return a};w.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 a=this.strict?this.reservedWordsStrict:this.reservedWords;a.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"))}};w.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};w.parseIdentNode=function(){var e=this.startNode();return this.type===o.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=o.name):this.unexpected(),e};w.parsePrivateIdent=function(){var e=this.startNode();return this.type===o.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};w.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(o.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};w.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 ke=N.prototype;ke.raise=function(e,t){var i=vt(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};ke.raiseRecoverable=ke.raise;ke.curPosition=function(){if(this.options.locations)return new de(this.curLine,this.pos-this.lineStart)};var ne=N.prototype,Si=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};ne.enterScope=function(e){this.scopeStack.push(new Si(e))};ne.exitScope=function(){this.scopeStack.pop()};ne.treatFunctionsAsVarInScope=function(e){return e.flags&le||!this.inModule&&e.flags&xe};ne.declareName=function(e,t,i){var r=!1;if(t===ie){var a=this.currentScope();r=a.lexical.indexOf(e)>-1||a.functions.indexOf(e)>-1||a.var.indexOf(e)>-1,a.lexical.push(e),this.inModule&&a.flags&xe&&delete this.undefinedExports[e]}else if(t===kt){var n=this.currentScope();n.lexical.push(e)}else if(t===_t){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 u=this.scopeStack.length-1;u>=0;--u){var c=this.scopeStack[u];if(c.lexical.indexOf(e)>-1&&!(c.flags&St&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&xe&&delete this.undefinedExports[e],c.flags&He)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};ne.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};ne.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ne.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&He)return t}};ne.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&He&&!(t.flags&Ct))return t}};var Ve=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new Pe(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},be=N.prototype;be.startNode=function(){return new Ve(this,this.start,this.startLoc)};be.startNodeAt=function(e,t){return new Ve(this,e,t)};function Nt(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}be.finishNode=function(e,t){return Nt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};be.finishNodeAt=function(e,t,i,r){return Nt.call(this,e,t,i,r)};be.copyNode=function(e){var t=new Ve(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Ei="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",Vt="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",Tt=Vt+" Extended_Pictographic",Lt=Tt,Mt=Lt+" EBase EComp EMod EPres ExtPict",Dt=Mt,_i=Dt,ki={9:Vt,10:Tt,11:Lt,12:Mt,13:Dt,14:_i},Ii="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ai={9:"",10:"",11:"",12:"",13:"",14:Ii},rt="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",Rt="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",Bt=Rt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",jt=Bt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ot=jt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ft=Ot+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Pi=Ft+" "+Ei,Ni={9:Rt,10:Bt,11:jt,12:Ot,13:Ft,14:Pi},Ut={};function Vi(e){var t=Ut[e]={binary:re(ki[e]+" "+rt),binaryOfStrings:re(Ai[e]),nonBinary:{General_Category:re(rt),Script:re(Ni[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 De=0,at=[9,10,11,12,13,14];De<at.length;De+=1){var Ti=at[De];Vi(Ti)}var y=N.prototype,Ie=function(t,i){this.parent=t,this.base=i||this};Ie.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};Ie.prototype.sibling=function(){return new Ie(this.parent,this.base)};var X=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=Ut[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};X.prototype.reset=function(t,i,r){var a=r.indexOf("v")!==-1,n=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,a&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)};X.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};X.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,a=r.length;if(t>=a)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=a)return n;var s=r.charCodeAt(t+1);return s>=56320&&s<=57343?(n<<10)+s-56613888:n};X.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,a=r.length;if(t>=a)return a;var n=r.charCodeAt(t),s;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=a||(s=r.charCodeAt(t+1))<56320||s>57343?t+1:t+2};X.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};X.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};X.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};X.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};X.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,a=0,n=t;a<n.length;a+=1){var s=n[a],u=this.at(r,i);if(u===-1||u!==s)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};y.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,a=!1,n=0;n<i.length;n++){var s=i.charAt(n);t.indexOf(s)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(s,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),s==="u"&&(r=!0),s==="v"&&(a=!0)}this.options.ecmaVersion>=15&&r&&a&&this.raise(e.start,"Invalid regular expression flag")};function Li(e){for(var t in e)return!0;return!1}y.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Li(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};y.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")}};y.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ie(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")};y.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};y.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};y.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};y.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};y.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};y.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,a=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(a=e.lastIntValue),e.eat(125)))return a!==-1&&a<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1};y.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)};y.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};y.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 a=0;a<i.length;a++){var n=i.charAt(a);i.indexOf(n,a+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 u=0;u<s.length;u++){var c=s.charAt(u);(s.indexOf(c,u+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};y.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};y.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&Mi(i);)t+=ee(i),e.advance();return t};function Mi(e){return e===105||e===109||e===115}y.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)};y.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};y.regexp_eatSyntaxCharacter=function(e){var t=e.current();return qt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function qt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}y.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!qt(i);)e.advance();return e.pos!==t};y.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};y.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,a=i;r<a.length;r+=1){var n=a[r];n.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}};y.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};y.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ee(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ee(e.lastIntValue);return!0}return!1};y.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),Di(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Di(e){return J(e,!0)||e===36||e===95}y.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),Ri(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Ri(e){return ue(e,!0)||e===36||e===95||e===8204||e===8205}y.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)};y.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};y.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};y.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)};y.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};y.regexp_eatZero=function(e){return e.current()===48&&!Te(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};y.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};y.regexp_eatControlLetter=function(e){var t=e.current();return $t(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function $t(e){return e>=65&&e<=90||e>=97&&e<=122}y.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 a=e.lastIntValue;if(r&&a>=55296&&a<=56319){var n=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=(a-55296)*1024+(s-56320)+65536,!0}e.pos=n,e.lastIntValue=a}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Bi(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Bi(e){return e>=0&&e<=1114111}y.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};y.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 Gt=0,te=1,q=2;y.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(ji(t))return e.lastIntValue=-1,e.advance(),te;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===q&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Gt};function ji(e){return e===100||e===68||e===115||e===83||e===119||e===87}y.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),te}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var a=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,a)}return Gt};y.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){pe(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};y.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return te;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return q;e.raise("Invalid property name")};y.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Wt(t=e.current());)e.lastStringValue+=ee(t),e.advance();return e.lastStringValue!==""};function Wt(e){return $t(e)||e===95}y.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Oi(t=e.current());)e.lastStringValue+=ee(t),e.advance();return e.lastStringValue!==""};function Oi(e){return Wt(e)||Te(e)}y.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};y.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===q&&e.raise("Negated character class may contain strings"),!0}return!1};y.regexp_classContents=function(e){return e.current()===93?te:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),te)};y.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")}}};y.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||Kt(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};y.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)};y.regexp_classSetExpression=function(e){var t=te,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===q&&(t=q);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==q&&(t=te);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===q&&(t=q)}};y.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};y.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?te:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};y.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===q&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var a=this.regexp_eatCharacterClassEscape(e);if(a)return a;e.pos=t}return null};y.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};y.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===q&&(t=q);return t};y.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?te:q};y.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()&&Fi(i)||Ui(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Fi(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 Ui(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}y.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return qi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function qi(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}y.regexp_eatClassControlLetter=function(e){var t=e.current();return Te(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};y.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};y.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Te(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function Te(e){return e>=48&&e<=57}y.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;zt(i=e.current());)e.lastIntValue=16*e.lastIntValue+Ht(i),e.advance();return e.pos!==t};function zt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ht(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}y.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};y.regexp_eatOctalDigit=function(e){var t=e.current();return Kt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Kt(e){return e>=48&&e<=55}y.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var a=e.current();if(!zt(a))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Ht(a),e.advance()}return!0};var Xe=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Pe(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},E=N.prototype;E.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 Xe(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};E.getToken=function(){return this.next(),new Xe(this)};typeof Symbol<"u"&&(E[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===o.eof,value:t}}}});E.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(o.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};E.readToken=function(e){return J(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};E.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};E.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,a=t;(r=gt(this.input,a,this.pos))>-1;)++this.curLine,a=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};E.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&&!ce(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())};E.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&&yt.test(String.fromCharCode(e)))++this.pos;else break e}}};E.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)};E.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(o.ellipsis)):(++this.pos,this.finishToken(o.dot))};E.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(o.assign,2):this.finishOp(o.slash,1)};E.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?o.star:o.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=o.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(o.assign,i+1):this.finishOp(r,i)};E.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(o.assign,3)}return this.finishOp(e===124?o.logicalOR:o.logicalAND,2)}return t===61?this.finishOp(o.assign,2):this.finishOp(e===124?o.bitwiseOR:o.bitwiseAND,1)};E.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)};E.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||$.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(o.incDec,2):t===61?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)};E.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(o.assign,i+1):this.finishOp(o.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(o.relational,i))};E.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(o.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(e===61?o.eq:o.prefix,1)};E.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(o.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(o.assign,3)}return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)};E.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),J(t,!0)||t===92))return this.finishToken(o.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ee(t)+"'")};E.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.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(o.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ee(e)+"'")};E.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};E.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($.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 a=this.input.slice(i,this.pos);++this.pos;var n=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new X(this));u.reset(i,a,s),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var c=null;try{c=new RegExp(a,s)}catch{}return this.finishToken(o.regexp,{pattern:a,flags:s,value:c})};E.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,a=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,s=0,u=0,c=0,p=t??1/0;c<p;++c,++this.pos){var l=this.input.charCodeAt(this.pos),x=void 0;if(r&&l===95){a&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===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"),u=l;continue}if(l>=97?x=l-97+10:l>=65?x=l-65+10:l>=48&&l<=57?x=l-48:x=1/0,x>=e)break;u=l,s=s*e+x}return r&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:s};function $i(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Qt(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}E.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=Qt(this.input.slice(t,this.pos)),++this.pos):J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,i)};E.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 a=Qt(this.input.slice(t,this.pos));return++this.pos,J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,a)}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")),J(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=$i(this.input.slice(t,this.pos),i);return this.finishToken(o.num,n)};E.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};E.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)):(ce(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(o.string,t)};var Yt={};E.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Yt)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};E.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Yt;this.raise(e,t)};E.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===o.template||this.type===o.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(o.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(ce(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}};
|
|
22
|
+
`),cooked:this.value},this.next(),i.tail=this.type===l.backQuote,this.finishNode(i,"TemplateElement")};k.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===l.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(l.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(l.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};k.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===l.name||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===l.star)&&!Y.test(this.input.slice(this.lastTokEnd,this.start))};k.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(l.braceR);){if(r)r=!1;else if(this.expect(l.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(l.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")};k.parseProperty=function(e,t){var i=this.startNode(),r,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(l.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===l.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===l.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(l.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(l.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,a,s,t,o),this.finishNode(i,"Property")};k.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")};k.parsePropertyValue=function(e,t,i,r,n,a,s,o){(i||r)&&this.type===l.colon&&this.unexpected(),this.eat(l.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===l.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!==l.comma&&this.type!==l.braceR&&this.type!==l.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===l.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()};k.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(l.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(l.bracketR),e.key;e.computed=!1}return e.key=this.type===l.num||this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};k.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};k.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(ft(t,r.generator)|ht|(i?Kt:0)),this.expect(l.parenL),r.params=this.parseBindingList(l.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")};k.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(ft(i,!1)|Ht),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")};k.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==l.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 u=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,Yt),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=u}this.exitScope()};k.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};k.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,mt,t?null:i)}};k.parseExprList=function(e,t,i,r){for(var n=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(l.comma),t&&this.afterTrailingComma(e))break;var s=void 0;i&&this.type===l.comma?s=null:this.type===l.ellipsis?(s=this.parseSpread(r),r&&this.type===l.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),n.push(s)}return n};k.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"))}};k.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};k.parseIdentNode=function(){var e=this.startNode();return this.type===l.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=l.name):this.unexpected(),e};k.parsePrivateIdent=function(){var e=this.startNode();return this.type===l.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};k.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===l.semi||this.canInsertSemicolon()||this.type!==l.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(l.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};k.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 We=B.prototype;We.raise=function(e,t){var i=qt(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};We.raiseRecoverable=We.raise;We.curPosition=function(){if(this.options.locations)return new Te(this.curLine,this.pos-this.lineStart)};var de=B.prototype,Zi=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};de.enterScope=function(e){this.scopeStack.push(new Zi(e))};de.exitScope=function(){this.scopeStack.pop()};de.treatFunctionsAsVarInScope=function(e){return e.flags&Ce||!this.inModule&&e.flags&Me};de.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&Me&&delete this.undefinedExports[e]}else if(t===Xt){var a=this.currentScope();a.lexical.push(e)}else if(t===Qt){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 u=this.scopeStack[o];if(u.lexical.indexOf(e)>-1&&!(u.flags&Gt&&u.lexical[0]===e)||!this.treatFunctionsAsVarInScope(u)&&u.functions.indexOf(e)>-1){r=!0;break}if(u.var.push(e),this.inModule&&u.flags&Me&&delete this.undefinedExports[e],u.flags&pt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};de.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};de.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};de.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&pt)return t}};de.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&pt&&!(t.flags&Ht))return t}};var Ke=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new He(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},De=B.prototype;De.startNode=function(){return new Ke(this,this.start,this.startLoc)};De.startNodeAt=function(e,t){return new Ke(this,e,t)};function ei(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}De.finishNode=function(e,t){return ei.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};De.finishNodeAt=function(e,t,i,r){return ei.call(this,e,t,i,r)};De.copyNode=function(e){var t=new Ke(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Ji="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",ti="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",ii=ti+" Extended_Pictographic",ri=ii,ni=ri+" EBase EComp EMod EPres ExtPict",ai=ni,er=ai,tr={9:ti,10:ii,11:ri,12:ni,13:ai,14:er},ir="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",rr={9:"",10:"",11:"",12:"",13:"",14:ir},Ct="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",si="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",oi=si+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ui=oi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ci=ui+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",li=ci+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",nr=li+" "+Ji,ar={9:si,10:oi,11:ui,12:ci,13:li,14:nr},hi={};function sr(e){var t=hi[e]={binary:pe(tr[e]+" "+Ct),binaryOfStrings:pe(rr[e]),nonBinary:{General_Category:pe(Ct),Script:pe(ar[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 tt=0,Et=[9,10,11,12,13,14];tt<Et.length;tt+=1){var or=Et[tt];sr(or)}var _=B.prototype,Ue=function(t,i){this.parent=t,this.base=i||this};Ue.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};Ue.prototype.sibling=function(){return new Ue(this.parent,this.base)};var ae=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=hi[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};ae.prototype.reset=function(t,i,r){var n=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};ae.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};ae.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return-1;var a=r.charCodeAt(t);if(!(i||this.switchU)||a<=55295||a>=57344||t+1>=n)return a;var s=r.charCodeAt(t+1);return s>=56320&&s<=57343?(a<<10)+s-56613888:a};ae.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return n;var a=r.charCodeAt(t),s;return!(i||this.switchU)||a<=55295||a>=57344||t+1>=n||(s=r.charCodeAt(t+1))<56320||s>57343?t+1:t+2};ae.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};ae.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};ae.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};ae.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};ae.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,n=0,a=t;n<a.length;n+=1){var s=a[n],o=this.at(r,i);if(o===-1||o!==s)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};_.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 ur(e){for(var t in e)return!0;return!1}_.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&ur(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};_.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")}};_.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ue(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")};_.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};_.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};_.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};_.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};_.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};_.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};_.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)};_.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};_.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 u=s.charAt(o);(s.indexOf(u,o+1)>-1||i.indexOf(u)>-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};_.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};_.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&cr(i);)t+=ue(i),e.advance();return t};function cr(e){return e===105||e===109||e===115}_.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)};_.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};_.regexp_eatSyntaxCharacter=function(e){var t=e.current();return pi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function pi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}_.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!pi(i);)e.advance();return e.pos!==t};_.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};_.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}};_.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};_.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=ue(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ue(e.lastIntValue);return!0}return!1};_.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),lr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function lr(e){return oe(e,!0)||e===36||e===95}_.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),hr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function hr(e){return ve(e,!0)||e===36||e===95||e===8204||e===8205}_.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)};_.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};_.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};_.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)};_.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};_.regexp_eatZero=function(e){return e.current()===48&&!Qe(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};_.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};_.regexp_eatControlLetter=function(e){var t=e.current();return fi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function fi(e){return e>=65&&e<=90||e>=97&&e<=122}_.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)&&pr(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function pr(e){return e>=0&&e<=1114111}_.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};_.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 mi=0,ce=1,X=2;_.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(fr(t))return e.lastIntValue=-1,e.advance(),ce;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===X&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return mi};function fr(e){return e===100||e===68||e===115||e===83||e===119||e===87}_.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),ce}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return mi};_.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ne(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};_.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return ce;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return X;e.raise("Invalid property name")};_.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";di(t=e.current());)e.lastStringValue+=ue(t),e.advance();return e.lastStringValue!==""};function di(e){return fi(e)||e===95}_.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";mr(t=e.current());)e.lastStringValue+=ue(t),e.advance();return e.lastStringValue!==""};function mr(e){return di(e)||Qe(e)}_.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};_.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===X&&e.raise("Negated character class may contain strings"),!0}return!1};_.regexp_classContents=function(e){return e.current()===93?ce:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),ce)};_.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")}}};_.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||yi(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};_.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)};_.regexp_classSetExpression=function(e){var t=ce,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===X&&(t=X);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==X&&(t=ce);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===X&&(t=X)}};_.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};_.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?ce:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};_.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===X&&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};_.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};_.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===X&&(t=X);return t};_.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?ce:X};_.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()&&dr(i)||gr(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function dr(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 gr(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}_.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return xr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function xr(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}_.regexp_eatClassControlLetter=function(e){var t=e.current();return Qe(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};_.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};_.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Qe(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function Qe(e){return e>=48&&e<=57}_.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;gi(i=e.current());)e.lastIntValue=16*e.lastIntValue+xi(i),e.advance();return e.pos!==t};function gi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function xi(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}_.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};_.regexp_eatOctalDigit=function(e){var t=e.current();return yi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function yi(e){return e>=48&&e<=55}_.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var n=e.current();if(!gi(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+xi(n),e.advance()}return!0};var gt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new He(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},A=B.prototype;A.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 gt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};A.getToken=function(){return this.next(),new gt(this)};typeof Symbol<"u"&&(A[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===l.eof,value:t}}}});A.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(l.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};A.readToken=function(e){return oe(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};A.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};A.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=$t(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())};A.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&&!Se(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())};A.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&&Wt.test(String.fromCharCode(e)))++this.pos;else break e}}};A.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)};A.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(l.ellipsis)):(++this.pos,this.finishToken(l.dot))};A.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(l.assign,2):this.finishOp(l.slash,1)};A.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?l.star:l.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=l.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(l.assign,i+1):this.finishOp(r,i)};A.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(l.assign,3)}return this.finishOp(e===124?l.logicalOR:l.logicalAND,2)}return t===61?this.finishOp(l.assign,2):this.finishOp(e===124?l.bitwiseOR:l.bitwiseAND,1)};A.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(l.assign,2):this.finishOp(l.bitwiseXOR,1)};A.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||Y.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(l.incDec,2):t===61?this.finishOp(l.assign,2):this.finishOp(l.plusMin,1)};A.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(l.assign,i+1):this.finishOp(l.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(l.relational,i))};A.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(l.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(l.arrow)):this.finishOp(e===61?l.eq:l.prefix,1)};A.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(l.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(l.assign,3)}return this.finishOp(l.coalesce,2)}}return this.finishOp(l.question,1)};A.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),oe(t,!0)||t===92))return this.finishToken(l.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ue(t)+"'")};A.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(l.parenL);case 41:return++this.pos,this.finishToken(l.parenR);case 59:return++this.pos,this.finishToken(l.semi);case 44:return++this.pos,this.finishToken(l.comma);case 91:return++this.pos,this.finishToken(l.bracketL);case 93:return++this.pos,this.finishToken(l.bracketR);case 123:return++this.pos,this.finishToken(l.braceL);case 125:return++this.pos,this.finishToken(l.braceR);case 58:return++this.pos,this.finishToken(l.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(l.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(l.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ue(e)+"'")};A.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};A.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(Y.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var n=this.input.slice(i,this.pos);++this.pos;var a=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new ae(this));o.reset(i,n,s),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var u=null;try{u=new RegExp(n,s)}catch{}return this.finishToken(l.regexp,{pattern:n,flags:s,value:u})};A.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,u=0,c=t??1/0;u<c;++u,++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"),u===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 yr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function bi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}A.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=bi(this.input.slice(t,this.pos)),++this.pos):oe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.num,i)};A.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=bi(this.input.slice(t,this.pos));return++this.pos,oe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.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")),oe(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=yr(this.input.slice(t,this.pos),i);return this.finishToken(l.num,a)};A.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};A.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)):(Se(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(l.string,t)};var vi={};A.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===vi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};A.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw vi;this.raise(e,t)};A.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===l.template||this.type===l.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(l.dollarBraceL)):(++this.pos,this.finishToken(l.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(l.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Se(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}};A.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(l.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
24
24
|
`&&++this.pos;case`
|
|
25
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};
|
|
26
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return
|
|
27
|
-
`),n
|
|
28
|
-
`,s):(e.write("/*"),Ki(e,s.value,i,r),e.write("*/"+r))}}function Qi(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 Re(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:a}=r;if(a>0){i.VariableDeclarator(r[0],e);for(let n=1;n<a;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}let nt,st,ot,ut,ct,pt;const Yi={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:a}=t;a&&e.comments!=null&&T(t,e.comments,i,r);const n=e.body,{length:s}=n;for(let u=0;u<s;u++){const c=n[u];a&&c.comments!=null&&T(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}a&&e.trailingComments!=null&&T(t,e.trailingComments,i,r)},BlockStatement:pt=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:a}=t,n=i+t.indent;t.write("{");const s=e.body;if(s!=null&&s.length>0){t.write(r),a&&e.comments!=null&&T(t,e.comments,n,r);const{length:u}=s;for(let c=0;c<u;c++){const p=s[c];a&&p.comments!=null&&T(t,p.comments,n,r),t.write(n),this[p.type](p,t),t.write(r)}t.write(i)}else a&&e.comments!=null&&(t.write(r),T(t,e.comments,n,r),t.write(i));a&&e.trailingComments!=null&&T(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:pt,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===z||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:a}=t;t.indentLevel++;const n=i+t.indent,s=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:u}=e,{length:c}=u;for(let p=0;p<c;p++){const l=u[p];a&&l.comments!=null&&T(t,l.comments,n,r),l.test?(t.write(n+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(n+"default:"+r);const{consequent:x}=l,{length:d}=x;for(let h=0;h<d;h++){const g=x[h];a&&g.comments!=null&&T(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"?Re(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:nt=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Re(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:nt,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:st=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),oe(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:st,VariableDeclaration(e,t){Re(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,a=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(a===z||a<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:a}=i;let n=0;if(a>0){for(;n<a;){n>0&&t.write(", ");const s=i[n],u=s.type[6];if(u==="D")t.write(s.local.name,s),n++;else if(u==="N")t.write("* as "+s.local.name,s),n++;else break}if(n<a){for(t.write("{");;){const s=i[n],{name:u}=s.imported;if(t.write(u,s),u!==s.local.name&&t.write(" as "+s.local.name),++n<a)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 a=0;;){const n=i[a],{name:s}=n.local;if(t.write(s,n),s!==n.exported.name&&t.write(" as "+n.exported.name),++a<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 a=0;a<e.attributes.length;a++)this.ImportAttribute(e.attributes[a],t),a<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),oe(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]):oe(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:ot=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:ot,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),Ce(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:a}=r;for(let s=0;s<a;s++){const u=r[s],c=i[s];t.write(c.value.raw,c),t.write("${"),this[u.type](u,t),t.write("}")}const n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){Ce(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:ct=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let a=0;;){const n=i[a];if(n!=null&&this[n.type](n,t),++a<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:ct,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:a}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),a&&e.comments!=null&&T(t,e.comments,n,r);const s=","+r,{properties:u}=e,{length:c}=u;for(let p=0;;){const l=u[p];if(a&&l.comments!=null&&T(t,l.comments,n,r),t.write(n),this[l.type](l,t),++p<c)t.write(s);else break}t.write(r),a&&e.trailingComments!=null&&T(t,e.trailingComments,n,r),t.write(i+"}")}else a?e.comments!=null?(t.write(r),T(t,e.comments,n,r),e.trailingComments!=null&&T(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),T(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){const{properties:i}=e,{length:r}=i;for(let a=0;this[i[a].type](i[a],t),++a<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){oe(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:a}}=e;t.write(i);const n=Xt(t,r,e);!n&&(i.length>1||a[0]==="U"&&(a[1]==="n"||a[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[a](r,t),t.write(")")):this[a](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:ut=function(e,t){const i=e.operator==="in";i&&t.write("("),Ce(t,e.left,e,!1),t.write(" "+e.operator+" "),Ce(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:ut,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===z||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===z||i<t.expressionsPrecedence.CallExpression||Qi(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),oe(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===z||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("?."),oe(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===z||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(zi(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},Xi={};class Zi{constructor(t){const i=t??Xi;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Yi,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:Hi,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
|
|
25
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};A.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 ue(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 Se(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};A.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};A.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(ve(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?oe:ve)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=ue(s),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};A.readWord=function(){var e=this.readWord1(),t=l.name;return this.keywords.test(e)&&(t=ct[e]),this.finishToken(t,e)};var br="8.14.0";B.acorn={Parser:B,version:br,defaultOptions:at,Position:Te,SourceLocation:He,getLineInfo:qt,Node:Ke,TokenType:V,tokTypes:l,keywordTypes:ct,TokContext:J,tokContexts:L,isIdentifierChar:ve,isIdentifierStart:oe,Token:gt,isNewLine:Se,lineBreak:Y,lineBreakG:$i,nonASCIIwhitespace:Wt};function _i(e,t){return B.parse(e,t)}const{stringify:vr}=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 je={"||":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},ee=17,_r={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:ee,ClassExpression:ee,FunctionExpression:ee,ObjectExpression:ee,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function be(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 wi(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===ee)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?je[t.operator]<=je[i.operator]:je[t.operator]<je[i.operator]}function Oe(e,t,i,r){const{generator:n}=e;wi(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function wr(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 W(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("/*"),wr(e,s.value,i,r),e.write("*/"+r))}}function Sr(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 it(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 kt,It,At,Pt,Vt,Tt;const xt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&W(t,e.comments,i,r);const a=e.body,{length:s}=a;for(let o=0;o<s;o++){const u=a[o];n&&u.comments!=null&&W(t,u.comments,i,r),t.write(i),this[u.type](u,t),t.write(r)}n&&e.trailingComments!=null&&W(t,e.trailingComments,i,r)},BlockStatement:Tt=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&&W(t,e.comments,a,r);const{length:o}=s;for(let u=0;u<o;u++){const c=s[u];n&&c.comments!=null&&W(t,c.comments,a,r),t.write(a),this[c.type](c,t),t.write(r)}t.write(i)}else n&&e.comments!=null&&(t.write(r),W(t,e.comments,a,r),t.write(i));n&&e.trailingComments!=null&&W(t,e.trailingComments,a,r),t.write("}"),t.indentLevel--},ClassBody:Tt,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===ee||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:u}=o;for(let c=0;c<u;c++){const h=o[c];n&&h.comments!=null&&W(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:d}=f;for(let p=0;p<d;p++){const g=f[p];n&&g.comments!=null&&W(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"?it(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:kt=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?it(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:kt,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:It=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),be(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:It,VariableDeclaration(e,t){it(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===ee||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),be(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]):be(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:At=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:At,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),Oe(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],u=i[s];t.write(u.value.raw,u),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){Oe(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:Vt=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:Vt,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&&W(t,e.comments,a,r);const s=","+r,{properties:o}=e,{length:u}=o;for(let c=0;;){const h=o[c];if(n&&h.comments!=null&&W(t,h.comments,a,r),t.write(a),this[h.type](h,t),++c<u)t.write(s);else break}t.write(r),n&&e.trailingComments!=null&&W(t,e.trailingComments,a,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),W(t,e.comments,a,r),e.trailingComments!=null&&W(t,e.trailingComments,a,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),W(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){be(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const a=wi(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:Pt=function(e,t){const i=e.operator==="in";i&&t.write("("),Oe(t,e.left,e,!1),t.write(" "+e.operator+" "),Oe(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Pt,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ee||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===ee||i<t.expressionsPrecedence.CallExpression||Sr(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),be(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ee||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("?."),be(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ee||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(vr(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},Nr={},Cr=xt;class Er{constructor(t){const i=t??Nr;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:xt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:_r,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
|
-
`).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:
|
|
31
|
-
`?(u=0,c++):u++;this.column=u,this.line=c;return}}const{length:r}=t,{lineEnd:a}=this;r>0&&(this.lineEndSize>0&&(a.length===1?t[r-1]===a:t.endsWith(a))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Ji(e,t){const i=new Zi(t);return i.generator[e.type](e,i),i.output}class er{scopes=[];scopeTypes=[];scopeCounts=new Map;contextBoundVars=new Set;arrayPatternElements=new Set;rootParams=new Set;varKinds=new Map;loopVars=new Set;loopVarNames=new Map;paramIdCounter=0;cacheIdCounter=0;tempVarCounter=0;taCallIdCounter=0;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++}`}}constructor(){this.pushScope("glb")}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}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 this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],a=this.scopeTypes[this.scopeTypes.length-1],n=this.scopeCounts.get(a)||1,s=`${a}${n}_${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 a=r.get(t),n=this.varKinds.get(a)||"let";return[a,n]}}return[t,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}}function Ze(e,t,i,r,a){i||(i=m),function n(s,u,c){var p=c||s.type;i[p](s,u,n),t[p]&&t[p](s,u)}(e,r,a)}function L(e,t,i,r,a){var n=i?tr(i,r||void 0):r;(function s(u,c,p){n[p||u.type](u,c,s)})(e,t,a)}function tr(e,t){var i=Object.create(t||m);for(var r in e)i[r]=e[r];return i}function Je(e,t,i){i(e,t)}function se(e,t,i){}var m={};m.Program=m.BlockStatement=m.StaticBlock=function(e,t,i){for(var r=0,a=e.body;r<a.length;r+=1){var n=a[r];i(n,t,"Statement")}};m.Statement=Je;m.EmptyStatement=se;m.ExpressionStatement=m.ParenthesizedExpression=m.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")};m.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")};m.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")};m.BreakStatement=m.ContinueStatement=se;m.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")};m.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,a=e.cases;r<a.length;r+=1){var n=a[r];i(n,t)}};m.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,a=e.consequent;r<a.length;r+=1){var n=a[r];i(n,t,"Statement")}};m.ReturnStatement=m.YieldExpression=m.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")};m.ThrowStatement=m.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")};m.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")};m.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")};m.WhileStatement=m.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")};m.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")};m.ForInStatement=m.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")};m.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")};m.DebuggerStatement=se;m.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};m.VariableDeclaration=function(e,t,i){for(var r=0,a=e.declarations;r<a.length;r+=1){var n=a[r];i(n,t)}};m.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")};m.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,a=e.params;r<a.length;r+=1){var n=a[r];i(n,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")};m.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)};m.VariablePattern=se;m.MemberPattern=Je;m.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};m.ArrayPattern=function(e,t,i){for(var r=0,a=e.elements;r<a.length;r+=1){var n=a[r];n&&i(n,t,"Pattern")}};m.ObjectPattern=function(e,t,i){for(var r=0,a=e.properties;r<a.length;r+=1){var n=a[r];n.type==="Property"?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):n.type==="RestElement"&&i(n.argument,t,"Pattern")}};m.Expression=Je;m.ThisExpression=m.Super=m.MetaProperty=se;m.ArrayExpression=function(e,t,i){for(var r=0,a=e.elements;r<a.length;r+=1){var n=a[r];n&&i(n,t,"Expression")}};m.ObjectExpression=function(e,t,i){for(var r=0,a=e.properties;r<a.length;r+=1){var n=a[r];i(n,t)}};m.FunctionExpression=m.ArrowFunctionExpression=m.FunctionDeclaration;m.SequenceExpression=function(e,t,i){for(var r=0,a=e.expressions;r<a.length;r+=1){var n=a[r];i(n,t,"Expression")}};m.TemplateLiteral=function(e,t,i){for(var r=0,a=e.quasis;r<a.length;r+=1){var n=a[r];i(n,t)}for(var s=0,u=e.expressions;s<u.length;s+=1){var c=u[s];i(c,t,"Expression")}};m.TemplateElement=se;m.UnaryExpression=m.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")};m.BinaryExpression=m.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")};m.AssignmentExpression=m.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")};m.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")};m.NewExpression=m.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,a=e.arguments;r<a.length;r+=1){var n=a[r];i(n,t,"Expression")}};m.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")};m.ExportNamedDeclaration=m.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")};m.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")};m.ImportDeclaration=function(e,t,i){for(var r=0,a=e.specifiers;r<a.length;r+=1){var n=a[r];i(n,t)}i(e.source,t,"Expression")};m.ImportExpression=function(e,t,i){i(e.source,t,"Expression")};m.ImportSpecifier=m.ImportDefaultSpecifier=m.ImportNamespaceSpecifier=m.Identifier=m.PrivateIdentifier=m.Literal=se;m.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")};m.ClassDeclaration=m.ClassExpression=function(e,t,i){return i(e,t,"Class")};m.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)};m.ClassBody=function(e,t,i){for(var r=0,a=e.body;r<a.length;r+=1){var n=a[r];i(n,t)}};m.MethodDefinition=m.PropertyDefinition=m.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const V="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(V)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),a=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),a,!1)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createArrayAccess(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),a=[e,t];return i&&a.push(i),this.createCallExpression(r,a)},createGetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof t=="number"?this.createLiteral(t):t;return this.createCallExpression(i,[e,r])},createSetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[e,t])},createMathEqCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}}};function ir(e){L(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(a=>{if(a.init&&a.init.type==="ArrowFunctionExpression"&&a.init.start!==0){const n={type:"FunctionDeclaration",id:a.id,params:a.init.params,body:a.init.body.type==="BlockStatement"?a.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:a.init.body}]},async:a.init.async,generator:!1};Object.assign(t,n)}}),t.body&&t.body.body&&t.body.body.forEach(a=>r(a,i))}})}function rr(e,t){Ze(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const a=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===V||r.init.object.name==="context2"),n=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===V||r.init.object.object.name==="context2");(a||n)&&(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 ar(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function nr(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function sr(e,t){let i;return Ze(e,{FunctionDeclaration(r){nr(r,t)},ArrowFunctionExpression(r){const a=r.start===0;a&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=V),ar(r,t,a)},VariableDeclaration(r){r.declarations.forEach(a=>{if(a.id.type==="ArrayPattern"){const n=t.generateTempVar(),s={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:a.init}]};a.id.elements?.forEach(c=>{c.type==="Identifier"&&t.addArrayPatternElement(c.name)});const u=a.id.elements.map((c,p)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:c,init:{type:"MemberExpression",object:{type:"Identifier",name:n},property:{type:"Literal",value:p},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[s,...u]})}})},ForStatement(r){}}),i}const qe={type:"Identifier",name:"undefined"};function ae(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name))return;if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(ae(i,t),i._indexTransformed=!0)}}}function Z(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function B(e,t){if(e.name!==V){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)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const i=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),r=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.parent.callee.type==="MemberExpression"&&t.isContextBound(e.parent.callee.object.name),n=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed,s=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),u=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e;if(i||r||a||s||u){if(u)return;const[x,d]=t.getVariable(e.name),h=v.createContextVariableReference(d,x);Object.assign(e,h);return}const[c,p]=t.getVariable(e.name),l=v.createContextVariableReference(p,c);if(!(e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.object===e)&&!n){const x=v.createGetCall(l,0);Object.assign(e,x)}else Object.assign(e,l)}}function H(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;const r=i.getCurrentScopeType()=="if",a=i.getCurrentScopeType()=="els",n=i.getCurrentScopeType()=="for";if(!r&&!a&&!n&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(ae(e,i),e._indexTransformed=!0);const s=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&e.object.object.object.name===V,u=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(s||u)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const c=v.createGetCall(e.object,e.property);e.start&&(c.start=e.start),e.end&&(c.end=e.end),Object.assign(e,c)}}function me(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,n]=t.getVariable(e.name);return v.createContextVariableReference(n,a)}if(t.isContextBound(e.name))return e;const[i,r]=t.getVariable(e.name);return v.createContextVariableReference(r,i)}return e}function ge(e,t,i=""){switch(e.type){case"BinaryExpression":return Zt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?me(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=me(e,t);return v.createGetCall(r,0)}case"UnaryExpression":return Jt(e,t,i)}return e}function Zt(e,t,i){const r=ge(e.left,t,i),a=ge(e.right,t,i),n={type:"BinaryExpression",operator:e.operator,left:r,right:a,start:e.start,end:e.end};return L(n,t,{CallExpression(s,u){s._transformed||K(s,u)},MemberExpression(s){H(s,"",t)}}),n}function or(e,t,i){const r=ge(e.left,t,i),a=ge(e.right,t,i),n={type:"LogicalExpression",operator:e.operator,left:r,right:a,start:e.start,end:e.end};return L(n,t,{CallExpression(s,u){s._transformed||K(s,u)}}),n}function ur(e,t,i){return L(e,{parent:e,inNamespaceCall:!1},{Identifier(r,a,n){if(r.name=="NaN")return;if(r.name=="na"){r.name="NaN";return}r.parent=a.parent,B(r,t);const s=r.parent&&r.parent.type==="BinaryExpression";(r.parent&&r.parent.type==="ConditionalExpression"||s)&&(r.type==="MemberExpression"?ae(r,t):r.type==="Identifier"&&(r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===V&&r.parent.callee.property.name==="get"||Z(r)))},MemberExpression(r,a,n){ae(r,t),r.object&&n(r.object,{parent:r,inNamespaceCall:a.inNamespaceCall})},CallExpression(r,a,n){const s=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);K(r,t),r.arguments.forEach(u=>n(u,{parent:r,inNamespaceCall:s||a.inNamespaceCall}))}}),{type:"CallExpression",callee:v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),arguments:[e,qe,t.nextParamIdArg],_transformed:!0,_isParamCall:!0}}function Jt(e,t,i){const r=ge(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function lt(e,t,i){switch(e?.type){case"BinaryExpression":e=Zt(e,i,t);break;case"LogicalExpression":e=or(e,i,t);break;case"ConditionalExpression":return ur(e,i,t);case"UnaryExpression":e=Jt(e,i,t);break}if(e.type==="MemberExpression"&&e.computed&&e.property){const r=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:me(e.object,i),a=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?me(e.property,i):e.property;return{type:"CallExpression",callee:v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),arguments:[r,a,i.nextParamIdArg],_transformed:!0,_isParamCall:!0}}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(r=>{if(r.value.name){const[a,n]=i.getVariable(r.value.name);return{type:"Property",key:{type:"Identifier",name:r.key.name},value:v.createContextVariableReference(n,a),kind:"init",method:!1,shorthand:!1,computed:!1}}return r})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name))return{type:"CallExpression",callee:v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),arguments:[e,qe,i.nextParamIdArg],_transformed:!0,_isParamCall:!0}}return e?.type==="CallExpression"&&K(e,i),{type:"CallExpression",callee:v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),arguments:[e.type==="Identifier"?me(e,i):e,qe,i.nextParamIdArg],_transformed:!0,_isParamCall:!0}}function K(e,t,i){if(!e._transformed){if(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(e.callee.object.name===V&&["get","init","param"].includes(e.callee.property.name))return;const r=e.callee.object.name;e.arguments=e.arguments.map(a=>a._isParamCall?a:lt(a,r,t)),r==="ta"&&e.arguments.push(t.getNextTACallId()),e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(r=>r._isParamCall?r:lt(r,V,t)),e._transformed=!0);e.arguments.forEach(r=>{L(r,t,{Identifier(a,n,s){a.parent=n.parent,B(a,t);const u=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||u)&&(a.type==="MemberExpression"?ae(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===V&&a.parent.callee.property.name==="get"||Z(a)))},CallExpression(a,n,s){a._transformed||K(a,n)},MemberExpression(a,n,s){H(a,"",t),a.object&&s(a.object,{parent:a,inNamespaceCall:n.inNamespaceCall})}})})}}function ei(e,t){let i=null;if(e.left.type==="Identifier"){const[r,a]=t.getVariable(e.left.name);i=v.createContextVariableReference(a,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[a,n]=t.getVariable(r),s=a!==r,u=t.isContextBound(r);(s||u)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(n,a))}if(L(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,a,n){r.name=="na"&&(r.name="NaN"),r.parent=a.parent,B(r,t);const s=r.parent&&r.parent.type==="BinaryExpression",u=r.parent&&r.parent.type==="ConditionalExpression",c=t.isContextBound(r.name)&&!t.isRootParam(r.name),p=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,l=r.parent&&r.parent._isParamCall,x=r.parent&&r.parent.type==="MemberExpression",d=r.name==="NaN",h=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===V&&r.parent.callee.property.name==="get";(c||u||s)&&(r.type==="MemberExpression"?ae(r,t):r.type==="Identifier"&&!x&&!p&&!l&&!d&&!h&&Z(r))},MemberExpression(r,a,n){H(r,"",t),r.type==="CallExpression"?r.arguments.forEach(s=>n(s,{parent:r,inNamespaceCall:a.inNamespaceCall})):r.object&&n(r.object,{parent:r,inNamespaceCall:a.inNamespaceCall})},CallExpression(r,a,n){const s=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);K(r,t),r.arguments.forEach(u=>n(u,{parent:r,inNamespaceCall:s||a.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const n=e.operator.replace("=",""),s=v.createGetCall(i,0);r={type:"BinaryExpression",operator:n,left:s,right:e.right,start:e.start,end:e.end}}const a=v.createSetCall(i,r);e.start&&(a.start=e.start),e.end&&(a.end=e.end),Object.assign(e,a)}}function ti(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===V||i.init.object.name==="context2"),a=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===V||i.init.object.object.name==="context2"),n=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(h=>{h.key.name&&t.addContextBoundVar(h.key.name)}),i.init.object.name=V;return}if(a){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(h=>{h.key.name&&t.addContextBoundVar(h.key.name)}),i.init.object.object.name=V;return}n&&i.init.params.forEach(h=>{h.type==="Identifier"&&t.addContextBoundVar(h.name)});const s=t.addVariable(i.id.name,e.kind),u=e.kind;i.init&&!n&&(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)?K(i.init,t):L(i.init,{parent:i.init},{Identifier(h,g){h.parent=g.parent,B(h,t);const C=h.parent&&h.parent.type==="BinaryExpression",S=h.parent&&h.parent.type==="ConditionalExpression",A=h.parent&&h.parent.type==="CallExpression"&&h.parent.callee&&h.parent.callee.object&&h.parent.callee.object.name===V&&h.parent.callee.property.name==="get";h.type==="Identifier"&&(C||S)&&!A&&Z(h)},CallExpression(h,g,C){h.callee.type==="Identifier"&&(h.callee.parent=h),h.arguments.forEach(S=>{S.type==="Identifier"&&(S.parent=h)}),K(h,t),h.arguments.forEach(S=>C(S,{parent:h}))},BinaryExpression(h,g,C){h.left.type==="Identifier"&&(h.left.parent=h),h.right.type==="Identifier"&&(h.right.parent=h),C(h.left,{parent:h}),C(h.right,{parent:h})},MemberExpression(h,g,C){h.object&&h.object.type==="Identifier"&&(h.object.parent=h),h.property&&h.property.type==="Identifier"&&(h.property.parent=h),H(h,"",t),h.type==="CallExpression"?h.arguments.forEach(S=>C(S,{parent:h})):h.object&&C(h.object,{parent:h})}}));const c=v.createContextVariableReference(u,s),p=t.isArrayPatternElement(i.id.name),l=!p&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(ae(i.init.property,t),i.init.property._indexTransformed=!0));let x;i.init?n||p?x=i.init:x=v.createInitCall(c,l?i.init.object:i.init,l?i.init.property:void 0):x=v.createIdentifier("undefined");const d=v.createExpressionStatement(v.createAssignmentExpression(c,x));if(p){d.expression.right.object.property.name+=`?.[0][${i.init.property.value}]`;const h=d.expression.right.object;d.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[c,h])}n&&(t.pushScope("fn"),L(i.init.body,t,{BlockStatement(h,g,C){h.body.forEach(S=>C(S,g))},IfStatement(h,g,C){g.pushScope("if"),C(h.consequent,g),h.alternate&&(g.pushScope("els"),C(h.alternate,g),g.popScope()),g.popScope()},VariableDeclaration(h,g){ti(h,g)},Identifier(h,g){B(h,g)},AssignmentExpression(h,g){ei(h,g)}}),t.popScope()),Object.assign(e,d)})}function cr(e,t,i){if(e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],a=r.id.name;t.addLoopVariable(a,a),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:r.init}]},r.init&&L(r.init,t,{Identifier(n,s){t.isLoopVariable(n.name)||(t.pushScope("for"),B(n,s),t.popScope())},MemberExpression(n){t.pushScope("for"),H(n,"",t),t.popScope()}})}e.test&&L(e.test,t,{Identifier(r,a){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),B(r,a),r.type==="Identifier"&&(r.computed=!0,Z(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),H(r,"",t),t.popScope()}}),e.update&&L(e.update,t,{Identifier(r,a){t.isLoopVariable(r.name)||(t.pushScope("for"),B(r,a),t.popScope())}}),t.pushScope("for"),i(e.body,t),t.popScope()}function pr(e,t){L(e,t,{MemberExpression(i){H(i,"",t)},CallExpression(i,r){K(i,r)},Identifier(i,r){B(i,r);const a=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&a&&Z(i)}})}function lr(e,t,i){e.test&&(t.pushScope("if"),pr(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 hr(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createArrayAccess(r,0);const[a,n]=t.getVariable(r.name);return v.createContextVariableAccess0(n,a)}else if(r.type==="MemberExpression")return r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||H(r,"",t),r;return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?L(e.argument,t,{Identifier(r,a){B(r,a),r.type==="Identifier"&&Z(r)},MemberExpression(r){H(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){const[a,n]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(n,a),kind:"init",method:!1,shorthand:!1,computed:!1}}return r}):e.argument.type==="Identifier"&&(B(e.argument,t),e.argument.type==="Identifier"&&Z(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(ae(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&L(e.argument,t,{Identifier(a,n){B(a,n),a.type==="Identifier"&&!a._arrayAccessed&&(Z(a),a._arrayAccessed=!0)},MemberExpression(a){H(a,"",t)},CallExpression(a,n){K(a,n)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function fr(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function mr(e){Ze(e,{BinaryExpression(t){if(t.operator==="=="||t.operator==="==="){const i=t.left,r=t.right,a=v.createMathEqCall(i,r);a._transformed=!0,Object.assign(t,a)}}})}function dr(e,t,i){L(e,t,{BlockStatement(r,a,n){r.body.forEach(s=>n(s,a))},ReturnStatement(r,a){hr(r,a)},VariableDeclaration(r,a){ti(r,a)},Identifier(r,a){B(r,a)},CallExpression(r,a){K(r,a)},MemberExpression(r,a){H(r,i,a)},AssignmentExpression(r,a){ei(r,a)},FunctionDeclaration(r,a,n){fr(r,a,n)},ForStatement(r,a,n){cr(r,a,n)},IfStatement(r,a,n){lr(r,a,n)}})}function xr(e){let t=typeof e=="function"?e.toString():e;const i=Wi(t.trim(),{ecmaVersion:"latest",sourceType:"module"});ir(i);const r=new er;rr(i,r);const a=sr(i,r)||"";dr(i,r,a),mr(i);const n=Ji(i);return new Function("",`return ${n}`)(this)}class f{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 f?t:Array.isArray(t)?new f(t):new f([t])}}class gr{constructor(t){this.context=t}color={param:(t,i=0)=>f.from(t).get(i),rgb:(t,i,r,a)=>a?`rgba(${t}, ${i}, ${r}, ${a})`:`rgb(${t}, ${i}, ${r})`,new:(t,i)=>{if(t&&t.startsWith("#")){const r=t.slice(1),a=parseInt(r.slice(0,2),16),n=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return i?`rgba(${a}, ${n}, ${s}, ${i})`:`rgb(${a}, ${n}, ${s})`}return i?`rgba(${t}, ${i})`:t},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue"};extractPlotOptions(t){const i={};for(let r in t)i[r]=f.from(t[r]).get(0);return i}indicator(t,i,r){}plotchar(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const a=f.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:a,options:{...this.extractPlotOptions(r),style:"char"}})}plot(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const a=f.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:a,options:this.extractPlotOptions(r)})}na(t){return isNaN(f.from(t).get(0))}nz(t,i=0){const r=f.from(t).get(0),a=f.from(i).get(0);return isNaN(r)?a:r}}function yr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function br(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function vr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function wr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Cr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Sr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Er(e){return(t,i=0)=>[f.from(t).get(i)]}function _r(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function kr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Ir(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Ar(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Pr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Nr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Vr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}function Tr(e){return(t,{title:i,group:r}={})=>Array.isArray(t)?t[0]:t}const Lr={any:yr,bool:br,color:vr,enum:wr,float:Cr,int:Sr,param:Er,price:_r,session:kr,source:Ir,string:Ar,symbol:Pr,text_area:Nr,time:Vr,timeframe:Tr};class Mr{constructor(t){this.context=t,Object.entries(Lr).forEach(([i,r])=>{this[i]=r(t)})}any;bool;color;enum;float;int;param;price;session;source;string;symbol;text_area;time;timeframe}function Dr(e){return t=>Math.abs(f.from(t).get(0))}function Rr(e){return t=>Math.acos(f.from(t).get(0))}function Br(e){return t=>Math.asin(f.from(t).get(0))}function jr(e){return t=>Math.atan(f.from(t).get(0))}function Or(e){return(...t)=>{const i=t.map(r=>f.from(r).get(0));return i.reduce((r,a)=>r+a,0)/i.length}}function Fr(e){return t=>Math.ceil(f.from(t).get(0))}function Ur(e){return t=>Math.cos(f.from(t).get(0))}function qr(e){return t=>Math.exp(f.from(t).get(0))}function $r(e){return t=>Math.floor(f.from(t).get(0))}function Gr(e){return t=>Math.log(f.from(t).get(0))}function Wr(e){return t=>Math.log(f.from(t).get(0))}function zr(e){return t=>Math.log10(f.from(t).get(0))}function Hr(e){return(...t)=>{const i=t.map(r=>f.from(r).get(0));return Math.max(...i)}}function Kr(e){return(...t)=>{const i=t.map(r=>f.from(r).get(0));return Math.min(...i)}}function Qr(e){return(t,i,r)=>typeof t=="string"?t:t instanceof f?i?new f(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new f(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new f(e.params[r],0)))}function Yr(e){return(t,i)=>Math.pow(f.from(t).get(0),f.from(i).get(0))}function Xr(e){return()=>Math.random()}function Zr(e){return t=>Math.round(f.from(t).get(0))}function Jr(e){return t=>Math.sin(f.from(t).get(0))}function ea(e){return t=>Math.sqrt(f.from(t).get(0))}function ta(e){return(t,i)=>{const r=f.from(i).get(0),a=f.from(t);let n=0;for(let s=0;s<r;s++){const u=a.get(s);isNaN(u)||(n+=u)}return n}}function ia(e){return t=>Math.tan(f.from(t).get(0))}function ra(e){return(t,i)=>{const r=f.from(t).get(0),a=f.from(i).get(0);return isNaN(r)&&isNaN(a)?!0:isNaN(r)||isNaN(a)?!1:Math.abs(r-a)<1e-8}}const aa={abs:Dr,acos:Rr,asin:Br,atan:jr,avg:Or,ceil:Fr,cos:Ur,exp:qr,floor:$r,ln:Gr,log:Wr,log10:zr,max:Hr,min:Kr,param:Qr,pow:Yr,random:Xr,round:Zr,sin:Jr,sqrt:ea,sum:ta,tan:ia,__eq:ra};class na{constructor(t){this.context=t,Object.entries(aa).forEach(([i,r])=>{this[i]=r(t)})}_cache={};abs;acos;asin;atan;avg;ceil;cos;exp;floor;ln;log;log10;max;min;param;pow;random;round;sin;sqrt;sum;tan;__eq}function sa(e){return(t,i,r)=>(e.params[r]||(e.params[r]=[]),t instanceof f||Array.isArray(t)?[f.from(t).get(i||0),r]:(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,[t,r]))}const ht=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function ft(e,t,i,r,a=!1){for(let n=0;n<i.length;n++)if(i[n]<=e&&t<=r[n])return n+(a?1:2);return-1}function oa(e){return async(t,i,r,a=!1,n=!1,s=!1,u=null,c=null)=>{const p=t[0],l=i[0],x=r[0],d=r[1],h=ht.indexOf(e.timeframe),g=ht.indexOf(l);if(h==-1||g==-1)throw new Error("Invalid timeframe");if(h>g)throw new Error("Only higher timeframes are supported for now");if(h===g)return x;const C=e.data.openTime[0],S=e.data.closeTime[0];if(e.cache[d]){const Q=e.cache[d],I=ft(C,S,Q.data.openTime,Q.data.closeTime,n);return I==-1?NaN:Q.params[d][I]}const A=await new ii(e.source,p,l,e.limit||1e3,e.sDate,e.eDate).run(e.pineTSCode);e.cache[d]=A;const j=ft(C,S,A.data.openTime,A.data.closeTime,n);return j==-1?NaN:A.params[d][j]}}const ua={param:sa,security:oa};class ca{constructor(t){this.context=t,Object.entries(ua).forEach(([i,r])=>{this[i]=r(t)})}_cache={};param;security}function pa(e){return()=>{const t=e.get(e.data.high,0),i=e.get(e.data.low,0),r=e.get(e.data.close,1);return isNaN(r)?t-i:Math.max(t-i,Math.abs(t-r),Math.abs(i-r))}}function la(e){return(t,i)=>{const r=f.from(t).get(0);e.taState||(e.taState={});const a=i||`atr_${r}`;e.taState[a]||(e.taState[a]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const n=e.taState[a],s=e.get(e.data.high,0),u=e.get(e.data.low,0),c=e.get(e.data.close,0);let p;if(n.prevClose!==null){const x=s-u,d=Math.abs(s-n.prevClose),h=Math.abs(u-n.prevClose);p=Math.max(x,d,h)}else p=s-u;if(n.prevClose=c,n.initCount<r)return n.initSum+=p,n.initCount++,n.initCount===r?(n.prevAtr=n.initSum/r,e.precision(n.prevAtr)):NaN;const l=(n.prevAtr*(r-1)+p)/r;return n.prevAtr=l,e.precision(l)}}function ha(e){return(t,i=1,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`change_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<=a)return NaN;s.window.length>a+1&&s.window.pop();const c=u-s.window[a];return e.precision(c)}}function fa(e){return(t,i)=>{const r=f.from(t),a=f.from(i),n=r.get(0),s=a.get(0),u=r.get(1),c=a.get(1);return u<c&&n>s}}function ma(e){return(t,i)=>{const r=f.from(t),a=f.from(i),n=r.get(0),s=a.get(0),u=r.get(1),c=a.get(1);return u>c&&n<s}}function da(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`dev_${a}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const s=e.taState[n],u=f.from(t).get(0)||0;if(s.window.unshift(u),s.sum+=u,s.window.length<a)return NaN;if(s.window.length>a){const x=s.window.pop();s.sum-=x}const c=s.sum/a;let p=0;for(let x=0;x<a;x++)p+=Math.abs(s.window[x]-c);const l=p/a;return e.precision(l)}}function xa(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`ema_${a}`;e.taState[n]||(e.taState[n]={prevEma:null,initSum:0,initCount:0});const s=e.taState[n],u=f.from(t).get(0);if(s.initCount<a)return s.initSum+=u,s.initCount++,s.initCount===a?(s.prevEma=s.initSum/a,e.precision(s.prevEma)):NaN;const c=2/(a+1),p=u*c+s.prevEma*(1-c);return s.prevEma=p,e.precision(p)}}function ga(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`highest_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<a)return NaN;s.window.length>a&&s.window.pop();const c=Math.max(...s.window.filter(p=>!isNaN(p)));return e.precision(c)}}function ya(e){return(t,i,r)=>{const a=f.from(i).get(0),n=Math.floor(a/2),s=Math.floor(Math.sqrt(a)),u=e.ta.wma,c=u(t,n,r?`${r}_wma1`:void 0),p=u(t,a,r?`${r}_wma2`:void 0);if(isNaN(c)||isNaN(p))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${a}`;e.taState[l]||(e.taState[l]=[]);const x=2*c-p;e.taState[l].unshift(x);const d=r?`${r}_hma_final`:`hma_final_${a}`;e.taState[d]||(e.taState[d]={window:[]});const h=e.taState[d];if(h.window.unshift(x),h.window.length<s)return NaN;h.window.length>s&&h.window.pop();let g=0,C=0;for(let A=0;A<s;A++){const j=s-A;g+=h.window[A]*j,C+=j}const S=g/C;return e.precision(S)}}function ba(e){return(t,i,r,a)=>{const n=f.from(i).get(0),s=f.from(r).get(0);e.taState||(e.taState={});const u=a||`linreg_${n}_${s}`;e.taState[u]||(e.taState[u]={window:[]});const c=e.taState[u],p=f.from(t).get(0);if(c.window.unshift(p),c.window.length<n)return NaN;c.window.length>n&&c.window.pop();let l=0,x=0,d=0,h=0;const g=n;for(let j=0;j<n;j++){const Q=n-1-j,I=c.window[j];l+=Q,x+=I,d+=Q*I,h+=Q*Q}const C=g*h-l*l;if(C===0)return NaN;const S=(g*d-l*x)/C,A=(x-S*l)/g+S*(n-1-s);return e.precision(A)}}function va(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`lowest_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<a)return NaN;s.window.length>a&&s.window.pop();const c=s.window.filter(l=>!isNaN(l)&&l!==void 0),p=c.length>0?Math.min(...c):NaN;return e.precision(p)}}function wa(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`median_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<a)return NaN;s.window.length>a&&s.window.pop();const c=s.window.slice().sort((x,d)=>x-d),p=Math.floor(a/2),l=a%2===0?(c[p-1]+c[p])/2:c[p];return e.precision(l)}}function Ca(e){return(t,i,r)=>{const a=f.from(i).get(0);return e.ta.change(t,a)}}function Sa(e){return(t,i,r)=>t instanceof f?i?new f(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new f(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new f(e.params[r],0)))}function Ea(e,t,i){const r=new Array(e.length).fill(NaN);for(let a=t+i;a<e.length;a++){const n=e[a-i];let s=!0;for(let u=1;u<=t;u++)if(e[a-i-u]>=n){s=!1;break}if(s){for(let u=1;u<=i;u++)if(e[a-i+u]>=n){s=!1;break}}s&&(r[a]=n)}return r}function _a(e){return(t,i,r)=>{r==null&&(r=i,i=t,t=e.data.high);const a=f.from(i).get(0),n=f.from(r).get(0),s=f.from(t).toArray(),u=Ea(s,a,n),c=e.idx;return e.precision(u[c])}}function ka(e,t,i){const r=new Array(e.length).fill(NaN);for(let a=t+i;a<e.length;a++){const n=e[a-i];let s=!0;for(let u=1;u<=t;u++)if(e[a-i-u]<=n){s=!1;break}if(s){for(let u=1;u<=i;u++)if(e[a-i+u]<=n){s=!1;break}}s&&(r[a]=n)}return r}function Ia(e){return(t,i,r)=>{r==null&&(r=i,i=t,t=e.data.low);const a=f.from(i).get(0),n=f.from(r).get(0),s=f.from(t).toArray(),u=ka(s,a,n),c=e.idx;return e.precision(u[c])}}function Aa(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`rma_${a}`;e.taState[n]||(e.taState[n]={prevRma:null,initSum:0,initCount:0});const s=e.taState[n],u=f.from(t).get(0)||0;if(s.initCount<a)return s.initSum+=u,s.initCount++,s.initCount===a?(s.prevRma=s.initSum/a,e.precision(s.prevRma)):NaN;const c=1/a,p=u*c+s.prevRma*(1-c);return s.prevRma=p,e.precision(p)}}function Pa(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`roc_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<=a)return NaN;s.window.length>a+1&&s.window.pop();const c=s.window[a],p=(u-c)/c*100;return e.precision(p)}}function Na(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`rsi_${a}`;e.taState[n]||(e.taState[n]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.prevValue!==null){const c=u-s.prevValue,p=c>0?c:0,l=c<0?-c:0;if(s.initGains.length<a){if(s.initGains.push(p),s.initLosses.push(l),s.initGains.length===a){s.avgGain=s.initGains.reduce((h,g)=>h+g,0)/a,s.avgLoss=s.initLosses.reduce((h,g)=>h+g,0)/a,s.prevValue=u;const d=s.avgLoss===0?100:100-100/(1+s.avgGain/s.avgLoss);return e.precision(d)}return s.prevValue=u,NaN}s.avgGain=(s.avgGain*(a-1)+p)/a,s.avgLoss=(s.avgLoss*(a-1)+l)/a;const x=s.avgLoss===0?100:100-100/(1+s.avgGain/s.avgLoss);return s.prevValue=u,e.precision(x)}return s.prevValue=u,NaN}}function Va(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`sma_${a}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const s=e.taState[n],u=f.from(t).get(0)||0;if(s.window.unshift(u),s.sum+=u,s.window.length<a)return NaN;if(s.window.length>a){const p=s.window.pop();s.sum-=p}const c=s.sum/a;return e.precision(c)}}function Ta(e){return(t,i,r=!0,a)=>{const n=f.from(i).get(0),s=f.from(r).get(0);e.taState||(e.taState={});const u=a||`stdev_${n}_${s}`;e.taState[u]||(e.taState[u]={window:[],sum:0});const c=e.taState[u],p=f.from(t).get(0);if(c.window.unshift(p),c.sum+=p,c.window.length<n)return NaN;if(c.window.length>n){const g=c.window.pop();c.sum-=g}const l=c.sum/n;let x=0;for(let g=0;g<n;g++)x+=Math.pow(c.window[g]-l,2);const d=s?n:n-1,h=Math.sqrt(x/d);return e.precision(h)}}function La(e){return(t,i,r)=>{const a=f.from(t).get(0),n=f.from(i).get(0);e.taState||(e.taState={});const s=`supertrend_${a}_${n}`;e.taState[s]||(e.taState[s]={prevUpperBand:null,prevLowerBand:null,prevSupertrend:null,prevDirection:null});const u=e.taState[s],c=e.get(e.data.high,0),p=e.get(e.data.low,0),l=e.get(e.data.close,0),x=e.get(e.data.close,1),d=e.ta.atr(n,r?`${r}_atr`:void 0);if(isNaN(d))return[[NaN,0]];const h=(c+p)/2;let g=h+a*d,C=h-a*d;u.prevUpperBand!==null&&(g<u.prevUpperBand||x>u.prevUpperBand?g=g:g=u.prevUpperBand,C>u.prevLowerBand||x<u.prevLowerBand?C=C:C=u.prevLowerBand);let S,A;return u.prevSupertrend===null?(S=l<=g?-1:1,A=S===-1?g:C):u.prevSupertrend===u.prevUpperBand?l>g?(S=1,A=C):(S=-1,A=g):l<C?(S=-1,A=g):(S=1,A=C),u.prevUpperBand=g,u.prevLowerBand=C,u.prevSupertrend=A,u.prevDirection=S,[[e.precision(A),S]]}}function Ma(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`variance_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<a)return NaN;s.window.length>a&&s.window.pop();let c=0,p=0;for(let d=0;d<a;d++)c+=s.window[d],p+=s.window[d]*s.window[d];const l=c/a,x=p/a-l*l;return e.precision(x)}}function Da(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`vwma_${a}`;e.taState[n]||(e.taState[n]={window:[],volumeWindow:[]});const s=e.taState[n],u=f.from(t).get(0),c=e.get(e.data.volume,0);if(s.window.unshift(u),s.volumeWindow.unshift(c),s.window.length<a)return NaN;s.window.length>a&&(s.window.pop(),s.volumeWindow.pop());let p=0,l=0;for(let d=0;d<a;d++)p+=s.window[d]*s.volumeWindow[d],l+=s.volumeWindow[d];const x=p/l;return e.precision(x)}}function Ra(e){return(t,i,r)=>{const a=f.from(i).get(0);e.taState||(e.taState={});const n=r||`wma_${a}`;e.taState[n]||(e.taState[n]={window:[]});const s=e.taState[n],u=f.from(t).get(0);if(s.window.unshift(u),s.window.length<a)return NaN;s.window.length>a&&s.window.pop();let c=0,p=0;for(let x=0;x<a;x++){const d=a-x;c+=s.window[x]*d,p+=d}const l=c/p;return e.precision(l)}}const Ba={tr:pa},ja={atr:la,change:ha,crossover:fa,crossunder:ma,dev:da,ema:xa,highest:ga,hma:ya,linreg:ba,lowest:va,median:wa,mom:Ca,param:Sa,pivothigh:_a,pivotlow:Ia,rma:Aa,roc:Pa,rsi:Na,sma:Va,stdev:Ta,supertrend:La,variance:Ma,vwma:Da,wma:Ra};class Oa{constructor(t){this.context=t,Object.entries(Ba).forEach(([i,r])=>{Object.defineProperty(this,i,{get:r(t),enumerable:!0})}),Object.entries(ja).forEach(([i,r])=>{this[i]=r(t)})}tr;atr;change;crossover;crossunder;dev;ema;highest;hma;linreg;lowest;median;mom;param;pivothigh;pivotlow;rma;roc;rsi;sma;stdev;supertrend;variance;vwma;wma}class R{constructor(t){this.array=t}toString(){return"PineArrayObject:"+this.array.toString()}}function Fa(e){return t=>new R(t.array.map(i=>Math.abs(i)))}function Ua(e){return t=>e.array.sum(t)/t.array.length}function qa(e){return t=>{t.array.length=0}}function $a(e){return(t,i)=>(t.array.push(...i.array),t)}function Ga(e){return t=>new R([...t.array])}function Wa(e){return(t,i,r=!0)=>{if(t.array.length!==i.array.length||t.array.length<2)return NaN;const a=r?t.array.length:t.array.length-1,n=e.array.avg(t),s=e.array.avg(i);let u=0;for(let c=0;c<t.array.length;c++)u+=(t.array[c]-n)*(i.array[c]-s);return u/a}}function za(e){return(t,i)=>t.array.every(i)}function Ha(e){return(t,i,r=0,a)=>{const n=t.array.length,s=a!==void 0?Math.min(a,n):n;for(let u=r;u<s;u++)t.array[u]=i}}function Ka(e){return t=>t.array.length>0?t.array[0]:e.NA}function Qa(e){return t=>new R([...t])}function Ya(e){return(t,i)=>t.array[i]}function Xa(e){return(t,i)=>t.array.includes(i)}function Za(e){return(t,i)=>t.array.indexOf(i)}function Ja(e){return(t,i,r)=>{t.array.splice(i,0,r)}}function en(e){return(t,i=",")=>t.array.join(i)}function tn(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function rn(e){return(t,i)=>t.array.lastIndexOf(i)}function an(e){return(t,i=0)=>[...t.array].sort((r,a)=>a-r)[i]??e.NA}function nn(e){return(t,i=0)=>[...t.array].sort((r,a)=>r-a)[i]??e.NA}function sn(e){return(t,i)=>new R(Array(t).fill(i))}function on(e){return(t,i=!1)=>new R(Array(t).fill(i))}function un(e){return(t,i=NaN)=>new R(Array(t).fill(i))}function cn(e){return(t,i=0)=>new R(Array(t).fill(Math.round(i)))}function pn(e){return(t,i="")=>new R(Array(t).fill(i))}function ln(e){return(t,i=0)=>f.from(t).get(i)}function hn(e){return t=>t.array.pop()}function fn(e){return(t,i)=>{t.array.push(i)}}function mn(e){return t=>e.array.max(t)-e.array.min(t)}function dn(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function xn(e){return t=>{t.array.reverse()}}function gn(e){return(t,i,r)=>{t.array[i]=r}}function yn(e){return t=>t.array.shift()}function bn(e){return t=>t.array.length}function vn(e){return(t,i,r)=>{const a=r!==void 0?r+1:void 0;return new R(t.array.slice(i,a))}}function wn(e){return(t,i)=>t.array.some(i)}function Cn(e){return(t,i="asc")=>{t.array.sort((r,a)=>i==="asc"?r-a:a-r)}}function Sn(e){return(t,i)=>{const r=t.array.map((a,n)=>n);return r.sort((a,n)=>{const s=t.array[a],u=t.array[n];return i?i(s,u):s-u}),new R(r)}}function En(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return r===0?new R(t.array.map(()=>0)):new R(t.array.map(a=>(a-i)/r))}}function _n(e){return(t,i=!0)=>{const r=e.array.avg(t),a=t.array.map(s=>Math.pow(s-r,2)),n=i?t.array.length:t.array.length-1;return Math.sqrt(e.array.sum(new R(a))/n)}}function kn(e){return t=>t.array.reduce((i,r)=>i+(isNaN(r)?0:r),0)}function In(e){return(t,i)=>{t.array.unshift(i)}}function An(e){return(t,i=!0)=>{const r=e.array.avg(t),a=t.array.map(s=>Math.pow(s-r,2)),n=i?t.array.length:t.array.length-1;return e.array.sum(new R(a))/n}}const Pn={abs:Fa,avg:Ua,clear:qa,concat:$a,copy:Ga,covariance:Wa,every:za,fill:Ha,first:Ka,from:Qa,get:Ya,includes:Xa,indexof:Za,insert:Ja,join:en,last:tn,lastindexof:rn,max:an,min:nn,new:sn,new_bool:on,new_float:un,new_int:cn,new_string:pn,param:ln,pop:hn,push:fn,range:mn,remove:dn,reverse:xn,set:gn,shift:yn,size:bn,slice:vn,some:wn,sort:Cn,sort_indices:Sn,standardize:En,stdev:_n,sum:kn,unshift:In,variance:An};class Nn{constructor(t){this.context=t,Object.entries(Pn).forEach(([i,r])=>{this[i]=r(t)})}_cache={};abs;avg;clear;concat;copy;covariance;every;fill;first;from;get;includes;indexof;insert;join;last;lastindexof;max;min;new;new_bool;new_float;new_int;new_string;param;pop;push;range;remove;reverse;set;shift;size;slice;some;sort;sort_indices;standardize;stdev;sum;unshift;variance}class $e{data={open:[],high:[],low:[],close:[],volume:[],hl2:[],hlc3:[],ohlc4:[]};cache={};taState={};NA=NaN;math;ta;input;request;array;core;lang;idx=0;params={};const={};var={};let={};result=void 0;plots={};marketData;source;tickerId;timeframe="";limit;sDate;eDate;pineTSCode;constructor({marketData:t,source:i,tickerId:r,timeframe:a,limit:n,sDate:s,eDate:u}){this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=a,this.limit=n,this.sDate=s,this.eDate=u,this.math=new na(this),this.ta=new Oa(this),this.input=new Mr(this),this.request=new ca(this),this.array=new Nn(this);const c=new gr(this);this.core={plotchar:c.plotchar.bind(c),na:c.na.bind(c),color:c.color,plot:c.plot.bind(c),nz:c.nz.bind(c)}}init(t,i,r=0){return i instanceof f&&(i=i.get(0)),t?!Array.isArray(i)||Array.isArray(i[0])?t[t.length-1]=Array.isArray(i?.[0])?i[0]:this.precision(i):t[t.length-1]=this.precision(i[i.length-1+r]):Array.isArray(i)?t=[this.precision(i[i.length-1+r])]:t=[this.precision(i)],t}precision(t,i=10){return typeof t!="number"||isNaN(t)?t:Number(t.toFixed(i))}param(t,i,r){return typeof t=="string"?t:t instanceof f?i?new f(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new f(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new f(this.params[r],0)))}get(t,i){if(t instanceof f)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 f){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}}class ii{constructor(t,i,r,a,n,s){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=a,this.sDate=n,this.eDate=s,this._readyPromise=new Promise(u=>{this.loadMarketData(t,i,r,a,n,s).then(c=>{const p=c;this.data=p;const l=p.map(I=>I.open),x=p.map(I=>I.close),d=p.map(I=>I.high),h=p.map(I=>I.low),g=p.map(I=>I.volume),C=p.map(I=>(I.high+I.low+I.close)/3),S=p.map(I=>(I.high+I.low)/2),A=p.map(I=>(I.high+I.low+I.open+I.close)/4),j=p.map(I=>I.openTime),Q=p.map(I=>I.closeTime);this.open=l,this.close=x,this.high=d,this.low=h,this.volume=g,this.hl2=S,this.hlc3=C,this.ohlc4=A,this.openTime=j,this.closeTime=Q,this._ready=!0,u(!0)})})}data=[];open=[];high=[];low=[];close=[];volume=[];hl2=[];hlc3=[];ohlc4=[];openTime=[];closeTime=[];_readyPromise=null;_ready=!1;_transpiledCode=null;get transpiledCode(){return this._transpiledCode}async loadMarketData(t,i,r,a,n,s){return Array.isArray(t)?t:t.getMarketData(i,r,a,n,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){if(r&&r>0){const a=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,a)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,a=!1){await this.ready(),i||(i=this.data.length);const n=this._initializeContext(t);this._transpiledCode=this._transpileCode(t);let s=this.data.length-i;for(;;){const u=this.data.length-s;if(u>0){const l=Math.min(u,r),x=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,s,s+l),s+=l,yield this._createPageContext(n,x);continue}if(!a||Array.isArray(this.source))break;const{newCandles:c,updatedLastCandle:p}=await this._updateMarketData();if(c===0&&!p){yield null;continue}this._removeLastResult(n),s=this.data.length-(c+1)}}_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 $e({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});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 a in t.result)Array.isArray(t.result[a])?r.result[a]=t.result[a].slice(i):r.result[a]=t.result[a]}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,a=this.data[r].openTime;try{const n=await i.getMarketData(this.tickerId,this.timeframe,void 0,a,t);if(!n||n.length===0)return{newCandles:0,updatedLastCandle:!1};let s=!1,u=0;for(let c=0;c<n.length;c++){const p=n[c];p.openTime===a?(this._replaceCandle(r,p),s=!0):p.openTime>a&&(this._appendCandle(p),u++)}return{newCandles:u,updatedLastCandle:s}}catch(n){return console.error("Error updating market data:",n),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(t,i){this.data[t]=i,this.open[t]=i.open,this.close[t]=i.close,this.high[t]=i.high,this.low[t]=i.low,this.volume[t]=i.volume,this.hl2[t]=(i.high+i.low)/2,this.hlc3[t]=(i.high+i.low+i.close)/3,this.ohlc4[t]=(i.high+i.low+i.open+i.close)/4,this.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.openTime.push(t.openTime),this.closeTime.push(t.closeTime)}_removeLastResult(t){if(Array.isArray(t.result))t.result.pop();else if(typeof t.result=="object"&&t.result!==null)for(let i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.pop(),t.data.open.pop(),t.data.high.pop(),t.data.low.pop(),t.data.volume.pop(),t.data.hl2.pop(),t.data.hlc3.pop(),t.data.ohlc4.pop(),t.data.openTime.pop(),t.data.closeTime&&t.data.closeTime.pop()}_initializeContext(t){const i=new $e({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return i.pineTSCode=t,i.data.close=[],i.data.open=[],i.data.high=[],i.data.low=[],i.data.volume=[],i.data.hl2=[],i.data.hlc3=[],i.data.ohlc4=[],i.data.openTime=[],i.data.closeTime=[],i}_transpileCode(t){return xr.bind(this)(t)}async _executeIterations(t,i,r,a){const n=["const","var","let","params"];for(let s=r;s<a;s++){t.idx=s,t.data.close.push(this.close[s]),t.data.open.push(this.open[s]),t.data.high.push(this.high[s]),t.data.low.push(this.low[s]),t.data.volume.push(this.volume[s]),t.data.hl2.push(this.hl2[s]),t.data.hlc3.push(this.hlc3[s]),t.data.ohlc4.push(this.ohlc4[s]),t.data.openTime.push(this.openTime[s]);const u=await i(t);if(typeof u=="object"){typeof t.result!="object"&&(t.result={});for(let c in u){t.result[c]===void 0&&(t.result[c]=[]);const p=Array.isArray(u[c])?u[c][u[c].length-1]:u[c];t.result[c].push(p)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(u);for(let c of n)for(let p in t[c])if(Array.isArray(t[c][p])){const l=t[c][p],x=l[l.length-1];l.push(x)}}}}const Vn="https://api.binance.com/api/v3",Be={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 Tn{cache;cacheDuration;constructor(t=5*60*1e3){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 Ln{cacheManager;constructor(){this.cacheManager=new Tn(5*60*1e3)}async getMarketDataInterval(t,i,r,a){try{const n=Be[i.toUpperCase()];if(!n)return console.error(`Unsupported timeframe: ${i}`),[];const s={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let u=[],c=r;const p=a,l=s[n];if(!l)return console.error(`Duration not defined for interval: ${n}`),[];for(;c<p;){const x=Math.min(c+1e3*l,p),d=await this.getMarketData(t,i,1e3,c,x);if(d.length===0)break;u=u.concat(d),c=d[d.length-1].closeTime+1}return u}catch(n){return console.error("Error in getMarketDataInterval:",n),[]}}async getMarketData(t,i,r,a,n){try{const s={tickerId:t,timeframe:i,limit:r,sDate:a,eDate:n},u=this.cacheManager.get(s);if(u)return console.log("cache hit",t,i,r,a,n),u;const c=Be[i.toUpperCase()];if(!c)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,a,n)&&a&&n){const d=await this.getMarketDataInterval(t,i,a,n),h=r?d.slice(0,r):d;return this.cacheManager.set(s,h),h}let p=`${Vn}/klines?symbol=${t}&interval=${c}`;r&&(p+=`&limit=${Math.min(r,1e3)}`),a&&(p+=`&startTime=${a}`),n&&(p+=`&endTime=${n}`);const l=await fetch(p);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const x=(await l.json()).map(d=>({openTime:parseInt(d[0]),open:parseFloat(d[1]),high:parseFloat(d[2]),low:parseFloat(d[3]),close:parseFloat(d[4]),volume:parseFloat(d[5]),closeTime:parseInt(d[6]),quoteAssetVolume:parseFloat(d[7]),numberOfTrades:parseInt(d[8]),takerBuyBaseAssetVolume:parseFloat(d[9]),takerBuyQuoteAssetVolume:parseFloat(d[10]),ignore:d[11]}));return this.cacheManager.set(s,x),x}catch(s){return console.error("Error in binance.klines:",s),[]}}shouldPaginate(t,i,r,a){if(i&&i>1e3)return!0;if(r&&a){const n=Be[t.toUpperCase()],s={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[n];if(s)return Math.ceil((a-r)/s)>1e3}return!1}}const Mn=ni.fileURLToPath(typeof document>"u"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||new URL("pinets.min.cjs",document.baseURI).href),Dn=Se.dirname(Mn);class Rn{dataCache=new Map;dataDirectory;constructor(t){if(t)this.dataDirectory=t;else{const i=Se.resolve(Dn,"../../../");this.dataDirectory=Se.join(i,"tests","compatibility","_data")}}getDataFileName(t,i,r,a){return r&&a?`${t}-${i}-${r}-${a}.json`:null}loadDataFromFile(t){const i=`file:${t}`;if(this.dataCache.has(i))return this.dataCache.get(i);const r=Se.join(this.dataDirectory,t);if(!ve.existsSync(r))throw new Error(`Mock data file not found: ${r}`);const a=ve.readFileSync(r,"utf-8"),n=JSON.parse(a);return this.dataCache.set(i,n),n}findDataFile(t,i,r,a){if(!ve.existsSync(this.dataDirectory))return null;const n=ve.readdirSync(this.dataDirectory).filter(c=>c.endsWith(".json"));if(r&&a){const c=`${t}-${i}-${r}-${a}.json`;if(n.includes(c))return c}const s=new RegExp(`^${t}-${i}-(\\d+)-(\\d+)\\.json$`),u=n.filter(c=>s.test(c)).map(c=>{const p=c.match(s);return{file:c,startTime:parseInt(p[1]),endTime:parseInt(p[2])}}).sort((c,p)=>p.endTime-c.endTime);if(u.length===0)return null;if(r&&a){const c=u.find(p=>p.startTime<=r&&p.endTime>=a);if(c)return c.file}return u[0].file}filterData(t,i,r,a){let n=t;return(i||r)&&(n=t.filter(s=>{const u=!i||s.openTime>=i,c=!r||s.openTime<=r;return u&&c})),n.sort((s,u)=>s.openTime-u.openTime),a&&a>0&&(n=n.slice(0,a)),n}normalizeTimeframe(t){return{1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"}[t.toUpperCase()]||t.toLowerCase()}async getMarketData(t,i,r,a,n){try{const s=this.normalizeTimeframe(i),u=this.findDataFile(t,s,a,n);if(!u)return console.warn(`No mock data file found for ${t} ${s}. Searched in: ${this.dataDirectory}`),[];const c=this.loadDataFromFile(u);return this.filterData(c,a,n,r)}catch(s){return console.error("Error in MockProvider.getMarketData:",s),[]}}clearCache(){this.dataCache.clear()}setDataDirectory(t){this.dataDirectory=t,this.clearCache()}}const Bn=typeof process<"u"&&process.versions&&process.versions.node;let Ae=null;if(Bn)try{Ae=new Rn}catch{Ae=null}const jn={Binance:new Ln,...Ae?{Mock:Ae}:{}};exports.Context=$e;exports.PineTS=ii;exports.Provider=jn;
|
|
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:u}=this;for(let c=0;c<s;c++)t[c]===`
|
|
31
|
+
`?(o=0,u++):o++;this.column=o,this.line=u;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 kr(e,t){const i=new Er(t);return i.generator[e.type](e,i),i.output}const Ir=new Set(["Infinity","NaN","undefined","null","true","false"]),Ar=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 Pr{scopes=[];scopeTypes=[];scopeCounts=new Map;contextBoundVars=new Set;arrayPatternElements=new Set;rootParams=new Set;localSeriesVars=new Set;varKinds=new Map;loopVars=new Set;loopVarNames=new Map;paramIdCounter=0;cacheIdCounter=0;tempVarCounter=0;taCallIdCounter=0;hoistingStack=[];suppressHoisting=!1;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++}`}}constructor(){this.pushScope("glb")}pushScope(t){this.scopes.push(new Map),this.scopeTypes.push(t),this.scopeCounts.set(t,(this.scopeCounts.get(t)||0)+1)}popScope(){this.scopes.pop(),this.scopeTypes.pop()}getCurrentScopeType(){return this.scopeTypes[this.scopeTypes.length-1]}getCurrentScopeCount(){return this.scopeCounts.get(this.getCurrentScopeType())||1}addLocalSeriesVar(t){this.localSeriesVars.add(t)}isLocalSeriesVar(t){return this.localSeriesVars.has(t)}addContextBoundVar(t,i=!1){this.contextBoundVars.add(t),i&&this.rootParams.add(t)}removeContextBoundVar(t){this.contextBoundVars.has(t)&&(this.contextBoundVars.delete(t),this.rootParams.has(t)&&this.rootParams.delete(t))}addArrayPatternElement(t){this.arrayPatternElements.add(t)}isContextBound(t){return Ir.has(t)||Ar.has(t)?!1:this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],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}generateParamId(){return`p${this.paramIdCounter++}`}}function yt(e,t,i,r,n){i||(i=b),function a(s,o,u){var c=u||s.type;i[c](s,o,a),t[c]&&t[c](s,o)}(e,r,n)}function O(e,t,i,r,n){var a=i?Vr(i,r||void 0):r;(function s(o,u,c){a[c||o.type](o,u,s)})(e,t,n)}function Vr(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function bt(e,t,i){i(e,t)}function ge(e,t,i){}var b={};b.Program=b.BlockStatement=b.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")}};b.Statement=bt;b.EmptyStatement=ge;b.ExpressionStatement=b.ParenthesizedExpression=b.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")};b.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")};b.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")};b.BreakStatement=b.ContinueStatement=ge;b.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")};b.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,n=e.cases;r<n.length;r+=1){var a=n[r];i(a,t)}};b.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")}};b.ReturnStatement=b.YieldExpression=b.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")};b.ThrowStatement=b.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")};b.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")};b.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")};b.WhileStatement=b.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")};b.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")};b.ForInStatement=b.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")};b.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")};b.DebuggerStatement=ge;b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};b.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var a=n[r];i(a,t)}};b.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")};b.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,n=e.params;r<n.length;r+=1){var a=n[r];i(a,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")};b.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)};b.VariablePattern=ge;b.MemberPattern=bt;b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};b.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")}};b.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")}};b.Expression=bt;b.ThisExpression=b.Super=b.MetaProperty=ge;b.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")}};b.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var a=n[r];i(a,t)}};b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration;b.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")}};b.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 u=o[s];i(u,t,"Expression")}};b.TemplateElement=ge;b.UnaryExpression=b.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")};b.BinaryExpression=b.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")};b.AssignmentExpression=b.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")};b.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")};b.NewExpression=b.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,n=e.arguments;r<n.length;r+=1){var a=n[r];i(a,t,"Expression")}};b.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")};b.ExportNamedDeclaration=b.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")};b.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")};b.ImportDeclaration=function(e,t,i){for(var r=0,n=e.specifiers;r<n.length;r+=1){var a=n[r];i(a,t)}i(e.source,t,"Expression")};b.ImportExpression=function(e,t,i){i(e.source,t,"Expression")};b.ImportSpecifier=b.ImportDefaultSpecifier=b.ImportNamespaceSpecifier=b.Identifier=b.PrivateIdentifier=b.Literal=ge;b.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")};b.ClassDeclaration=b.ClassExpression=function(e,t,i){return i(e,t,"Class")};b.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)};b.ClassBody=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var a=n[r];i(a,t)}};b.MethodDefinition=b.PropertyDefinition=b.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const R="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(R)},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)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createArrayAccess(e,t){const i=typeof t=="number"?this.createLiteral(t):t;return this.createMemberExpression(e,i,!0)},createCallExpression(e,t){return{type:"CallExpression",callee:e,arguments:t}},createAssignmentExpression(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},createExpressionStatement(e){return{type:"ExpressionStatement",expression:e}},createInitCall(e,t,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),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("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}},createVariableDeclaration(e,t){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(e),init:t}]}}},Xe=["ta","math","request","array","input"],Si=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Ni=["input","ta","math","request","array","na","plotchar","color","plot","nz","strategy","library","str","box","line","label","table","map","matrix","log","map","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","order","currency","display","dayofweek"],Tr=["na","nz","plot","plotchar","color"];function Mr(e){let t=null,i=R;if(e.type==="Program"&&e.body.length>0){const p=e.body[0];if(p.type==="ExpressionStatement"&&(p.expression.type==="ArrowFunctionExpression"||p.expression.type==="FunctionExpression")){const g=p.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=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(g=>a(g.value)):p.type==="ArrayPattern"&&p.elements.forEach(g=>{g&&a(g)})};O(e,{},{VariableDeclarator(p,g,x){a(p.id),p.init&&x(p.init,g)},FunctionDeclaration(p,g,x){a(p.id),x(p.body,g)},Identifier(p,g,x){n.add(p.name)},MemberExpression(p,g,x){x(p.object,g),p.computed&&x(p.property,g)},Property(p,g,x){p.computed&&x(p.key,g),x(p.value,g)}}),t.forEach(p=>{p.type==="VariableDeclaration"?p.declarations.forEach(g=>a(g.id)):p.type==="FunctionDeclaration"&&a(p.id)});const s=Si,o=Ni,u=s.filter(p=>!r.has(p)),c=o.filter(p=>!r.has(p)),h=u.filter(p=>n.has(p)),f=c.filter(p=>n.has(p)),d=[];h.length>0&&d.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&d.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),d.length>0&&t.unshift(...d)}function Lr(e){let t=null,i=R;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 u=o.expression;u.body.type==="BlockStatement"&&(t=u.body.body,u.params.length>0&&u.params[0].type==="Identifier"&&(i=u.params[0].name))}}if(!t)return;const r=new Set(Si),n=new Set(Ni),a=new Set(Tr),s=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(u=>{if(u.init&&u.init.type==="MemberExpression"&&u.init.object.type==="Identifier"&&u.init.object.name===i&&u.init.property.type==="Identifier"){const c=u.init.property.name;let h=null;if(c==="data"?h=r:c==="pine"?h=n:c==="core"&&(h=a),h&&u.id.type==="ObjectPattern")u.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const d=f.key.name,p=f.value.name;h.has(d)&&d!==p&&(s.set(p,d),f.value.name=d,f.shorthand=!0)}});else if(u.id.type==="Identifier"&&Xe.includes(c)){const f=c,d=u.id.name;f!==d&&(s.set(d,f),u.id.name=f)}}})}),s.size>0&&O(e,{},{Identifier(o){s.has(o.name)&&(o.name=s.get(o.name))},MemberExpression(o,u,c){c(o.object,u),o.computed&&c(o.property,u)},Property(o,u,c){o.computed&&c(o.key,u),c(o.value,u)}})}function Dr(e){try{const t=_i(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!0}if(i.type==="FunctionDeclaration")return!0}return!1}catch{return!1}}function Rr(e){return e=e.trim(),Dr(e)?e:`(context) => {
|
|
32
|
+
${e}
|
|
33
|
+
}`}function Br(e){O(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 jr(e,t){yt(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===R||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===R||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 Or(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function Fr(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function $r(e,t){let i;return yt(e,{FunctionDeclaration(r){Fr(r,t)},ArrowFunctionExpression(r){const n=r.start===0;n&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=R),Or(r,t,n)},VariableDeclaration(r){r.declarations.forEach(n=>{if(n.id.type==="ArrayPattern"){const a=t.generateTempVar(),s={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:n.init}]};n.id.elements?.forEach(u=>{u.type==="Identifier"&&t.addArrayPatternElement(u.name)});const o=n.id.elements.map((u,c)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:u,init:{type:"MemberExpression",object:{type:"Identifier",name:a},property:{type:"Literal",value:c},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[s,...o]})}})},ForStatement(r){}}),i}const ut={type:"Identifier",name:"undefined"};function me(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name)){if(e.object.type==="Identifier"&&!t.isLoopVariable(e.object.name)&&!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name),n=v.createContextVariableReference(r,i),a=v.createGetCall(n,e.property);Object.assign(e,a),e._indexTransformed=!0}return}if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(me(i,t),i._indexTransformed=!0)}}}function se(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function z(e,t){if(e.name!==R){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 d=e.parent.callee;if(d.type==="MemberExpression"&&d.object&&d.object.name===R&&["get","set","init","param"].includes(d.property.name))e.parent.arguments.indexOf(e)===0&&(i=!0);else{const p=d.type==="MemberExpression"&&d.object&&d.object.type==="Identifier"&&Xe.includes(d.object.name);d.type==="MemberExpression"&&!p?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||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const[d,p]=t.getVariable(e.name),g=v.createContextVariableReference(p,d);Object.assign(e,g);return}const u=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(u&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)))return;if(t.isLocalSeriesVar(e.name)){if(!s){const d=v.createIdentifier(e.name),p=v.createGetCall(d,0);Object.assign(e,p)}return}const[c,h]=t.getVariable(e.name);let f;if(u)f=v.createIdentifier(e.name);else{if(c===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(h,c)}if(s)Object.assign(e,f);else{const d=v.createGetCall(f,0);Object.assign(e,d)}}}function te(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&Xe.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const u=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,c=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!u&&!c){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||(me(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===R,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 u=v.createGetCall(e.object,e.property);e.start&&(u.start=e.start),e.end&&(u.end=e.end),Object.assign(e,u),delete e.object,delete e.property,delete e.computed}}function Ve(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[n,a]=t.getVariable(e.name);return v.createContextVariableReference(a,n)}if(t.isContextBound(e.name)||t.isLocalSeriesVar(e.name))return e;const[i,r]=t.getVariable(e.name);return i===e.name&&!t.isContextBound(e.name)?e:v.createContextVariableReference(r,i)}return e}function fe(e,t,i=""){switch(e.type){case"BinaryExpression":return Ci(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?Ve(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=Ve(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:v.createGetCall(r,0)}case"UnaryExpression":return Ei(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 Ci(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 O(a,t,{CallExpression(s,o){s._transformed||ie(s,o)},MemberExpression(s){te(s,"",t)}}),a}function Wr(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 O(a,t,{CallExpression(s,o){s._transformed||ie(s,o)}}),a}function Ur(e,t,i){O(e,{parent:e,inNamespaceCall:!1},{Identifier(s,o,u){if(s.name=="NaN")return;if(s.name=="na"){s.name="NaN";return}s.parent=o.parent,z(s,t);const c=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||c)&&(s.type==="MemberExpression"?me(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===R&&s.parent.callee.property.name==="get"||se(s)))},MemberExpression(s,o,u){me(s,t),s.object&&u(s.object,{parent:s,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(s,o,u){const c={...o,parent:s};s.test&&u(s.test,c),s.consequent&&u(s.consequent,c),s.alternate&&u(s.alternate,c)},BinaryExpression(s,o,u){const c={...o,parent:s};u(s.left,c),u(s.right,c)},LogicalExpression(s,o,u){const c={...o,parent:s};u(s.left,c),u(s.right,c)},UnaryExpression(s,o,u){const c={...o,parent:s};u(s.argument,c)},CallExpression(s,o,u){const c=s.callee&&s.callee.type==="MemberExpression"&&s.callee.object&&s.callee.object.type==="Identifier"&&t.isContextBound(s.callee.object.name);ie(s,t),s.arguments.forEach(h=>u(h,{parent:s,inNamespaceCall:c||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),n=t.generateParamId(),a={type:"CallExpression",callee:r,arguments:[e,ut,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const s=n;t.addLocalSeriesVar(s);const o=v.createVariableDeclaration(s,a);return t.addHoistedStatement(o),v.createIdentifier(s)}return a}function Ei(e,t,i){const r=fe(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function Mt(e,t,i){switch(e?.type){case"BinaryExpression":e=Ci(e,i,t);break;case"LogicalExpression":e=Wr(e,i,t);break;case"ConditionalExpression":return Ur(e,i,t);case"UnaryExpression":e=Ei(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(o=>{if(o.type==="Identifier"){if(i.isContextBound(o.name)&&!i.isRootParam(o.name))return o;const[u,c]=i.getVariable(o.name);return v.createContextVariableAccess0(c,u)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:Ve(e.object,i),u=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?Ve(e.property,i):e.property,c=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),h=i.generateParamId(),f={type:"CallExpression",callee:c,arguments:[o,u,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const d=h;i.addLocalSeriesVar(d);const p=v.createVariableDeclaration(d,f);return i.addHoistedStatement(p),v.createIdentifier(d)}return f}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(o=>{if(o.value.name){if(i.isContextBound(o.value.name)&&!i.isRootParam(o.value.name))return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createIdentifier(o.value.name),kind:"init",method:!1,shorthand:!1,computed:!1};const[u,c]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(c,u),kind:"init",method:!1,shorthand:!1,computed:!1}}return o})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const o=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),u=i.generateParamId(),c={type:"CallExpression",callee:o,arguments:[e,ut,{type:"Identifier",name:`'${u}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const h=u;i.addLocalSeriesVar(h);const f=v.createVariableDeclaration(h,c);return i.addHoistedStatement(f),v.createIdentifier(h)}return c}}e?.type==="CallExpression"&&ie(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),n=e.type==="Identifier"?Ve(e,i):e,a=i.generateParamId(),s={type:"CallExpression",callee:r,arguments:[n,ut,{type:"Identifier",name:`'${a}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=a;i.addLocalSeriesVar(o);const u=v.createVariableDeclaration(o,s);return i.addHoistedStatement(u),v.createIdentifier(o)}return s}function ie(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&Xe.includes(e.callee.name)&&t.isContextBound(e.callee.name)&&(e.callee=v.createMemberExpression(e.callee,v.createIdentifier("any")));const r=e.callee&&e.callee.type==="MemberExpression"&&e.callee.object&&e.callee.object.type==="Identifier"&&(t.isContextBound(e.callee.object.name)||e.callee.object.name==="math"||e.callee.object.name==="ta");if(r){if(e.callee.object.name===R&&["get","init","param"].includes(e.callee.property.name))return;const n=e.callee.object.name,a=[];if(e.arguments.forEach(s=>{if(s._isParamCall){a.push(s);return}a.push(Mt(s,n,t))}),e.arguments=a,n==="ta"&&e.arguments.push(t.getNextTACallId()),!t.shouldSuppressHoisting()){const s=t.generateTempVar();t.addLocalSeriesVar(s);const o=v.createVariableDeclaration(s,Object.assign({},e));t.addHoistedStatement(o),Object.assign(e,v.createIdentifier(s));return}e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(n=>n._isParamCall?n:Mt(n,R,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&z(e.callee.object,t),e.arguments.forEach(n=>{O(n,{parent:e},{Identifier(a,s,o){a.parent=s.parent,z(a,t);const u=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||u)&&(a.type==="MemberExpression"?me(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===R&&a.parent.callee.property.name==="get"||se(a)))},BinaryExpression(a,s,o){const u={...s,parent:a};o(a.left,u),o(a.right,u)},LogicalExpression(a,s,o){const u={...s,parent:a};o(a.left,u),o(a.right,u)},UnaryExpression(a,s,o){const u={...s,parent:a};o(a.argument,u)},CallExpression(a,s,o){a._transformed||ie(a,t)},MemberExpression(a,s,o){te(a,"",t),a.object&&o(a.object,{parent:a})}})})}function ki(e,t){let i=null;if(e.left.type==="Identifier"){const[r,n]=t.getVariable(e.left.name);i=v.createContextVariableReference(n,r)}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),s=n!==r,o=t.isContextBound(r);(s||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(a,n))}if(O(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,a){r.name=="na"&&(r.name="NaN"),r.parent=n.parent,z(r,t);const s=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",u=t.isContextBound(r.name)&&!t.isRootParam(r.name),c=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",d=r.name==="NaN",p=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===R&&r.parent.callee.property.name==="get";(u||o||s)&&(r.type==="MemberExpression"?me(r,t):r.type==="Identifier"&&!f&&!c&&!h&&!d&&!p&&se(r))},MemberExpression(r,n,a){te(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);ie(r,t),r.type==="CallExpression"&&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=v.createGetCall(i,0);r={type:"BinaryExpression",operator:a,left:s,right:e.right,start:e.start,end:e.end}}const n=v.createSetCall(i,r);e.start&&(n.start=e.start),e.end&&(n.end=e.end),Object.assign(e,n)}}function Ii(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===R||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===R||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(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.name=R;return}if(n){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.object.name=R;return}a&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const s=t.addVariable(i.id.name,e.kind),o=e.kind,u=t.isArrayPatternElement(i.id.name);i.init&&!a&&!u&&(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)?ie(i.init,t):O(i.init,{parent:i.init},{Identifier(p,g){p.parent=g.parent,z(p,t);const x=p.parent&&p.parent.type==="BinaryExpression",y=p.parent&&p.parent.type==="UnaryExpression",w=p.parent&&p.parent.type==="ConditionalExpression",E=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===R&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(x||y||w)&&!E&&se(p)},CallExpression(p,g,x){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(y=>{y.type==="Identifier"&&(y.parent=p)}),ie(p,t),p.type==="CallExpression"&&p.arguments.forEach(y=>x(y,{parent:p}))},BinaryExpression(p,g,x){p.left.type==="Identifier"&&(p.left.parent=p),p.right.type==="Identifier"&&(p.right.parent=p),x(p.left,{parent:p}),x(p.right,{parent:p})},MemberExpression(p,g,x){p.object&&p.object.type==="Identifier"&&(p.object.parent=p),p.property&&p.property.type==="Identifier"&&(p.property.parent=p),te(p,"",t),p.type==="CallExpression"?p.arguments.forEach(y=>x(y,{parent:p})):p.object&&x(p.object,{parent:p})}}));const c=v.createContextVariableReference(o,s),h=!u&&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||(me(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?a||u?f=i.init:o==="var"?f=v.createInitVarCall(c,i.init):f=v.createInitCall(c,h?i.init.object:i.init,h?i.init.property:void 0):f=v.createIdentifier("undefined");const d=v.createExpressionStatement(v.createAssignmentExpression(c,f));if(u){const p=i.init.object.name,[g,x]=t.getVariable(p),y=v.createContextVariableReference(x,g),w=i.init.property.value,E={type:"MemberExpression",object:v.createGetCall(y,0),property:{type:"Literal",value:w},computed:!0};d.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[c,E])}a&&(t.pushScope("fn"),O(i.init.body,t,{BlockStatement(p,g,x){p.body.forEach(y=>x(y,g))},IfStatement(p,g,x){g.pushScope("if"),x(p.consequent,g),p.alternate&&(g.pushScope("els"),x(p.alternate,g),g.popScope()),g.popScope()},VariableDeclaration(p,g){Ii(p,g)},Identifier(p,g){z(p,g)},AssignmentExpression(p,g){ki(p,g)}}),t.popScope()),Object.assign(e,d)})}function qr(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&&O(r.init,t,{Identifier(a,s){t.isLoopVariable(a.name)||(t.pushScope("for"),z(a,s),t.popScope())},MemberExpression(a){t.pushScope("for"),te(a,"",t),t.popScope()}})}e.test&&O(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),z(r,n),r.type==="Identifier"&&(r.computed=!0,se(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),te(r,"",t),t.popScope()}}),e.update&&O(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),z(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function zr(e,t){O(e,t,{MemberExpression(i){te(i,"",t)},CallExpression(i,r){ie(i,r)},Identifier(i,r){z(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&se(i)}})}function Hr(e,t,i){e.test&&(t.pushScope("if"),zr(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 Gr(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createGetCall(r,0);const[n,a]=t.getVariable(r.name);return v.createContextVariableAccess0(a,n)}else if(r.type==="MemberExpression")return r.object&&r.object.type==="MemberExpression"&&r.object.object&&r.object.object.type==="Identifier"&&r.object.object.name==="$"&&r.object.property&&["const","let","var","params"].includes(r.object.property.name)?v.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||te(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?O(e.argument,t,{Identifier(r,n){z(r,n),r.type==="Identifier"&&se(r)},MemberExpression(r){te(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){if(t.isContextBound(r.value.name))return r;const[n,a]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(a,n),kind:"init",method:!1,shorthand:!1,computed:!1}}if(r.value&&r.value.type==="Identifier"&&!(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name))&&!t.isContextBound(r.value.name)){const[n,a]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(a,n)}return r}):e.argument.type==="Identifier"&&(z(e.argument,t),e.argument.type==="Identifier"&&se(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(me(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&O(e.argument,t,{Identifier(n,a){z(n,a),n.type==="Identifier"&&!n._arrayAccessed&&(se(n),n._arrayAccessed=!0)},MemberExpression(n){te(n,"",t)},CallExpression(n,a){ie(n,a)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Kr(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function Qr(e){const t={...b,LineComment:()=>{}};yt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,n=i.right,a=v.createMathEqCall(r,n);a._transformed=!0,Object.assign(i,a)}}},t)}function Xr(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 u=n[o].trim();if(u)return{type:"LineComment",value:`${r.ln?` [Line ${s.loc.start.line}]`:""} ${u}`}}return null};O(e,t,{Program(s,o,u){const c=[];s.body.forEach(h=>{o.enterHoistingScope(),u(h,o);const f=o.exitHoistingScope(),d=a(h);d&&c.push(d),c.push(...f),c.push(h)}),s.body=c},BlockStatement(s,o,u){const c=[];s.body.forEach(h=>{o.enterHoistingScope(),u(h,o);const f=o.exitHoistingScope(),d=a(h);d&&c.push(d),c.push(...f),c.push(h)}),s.body=c},ReturnStatement(s,o){Gr(s,o)},VariableDeclaration(s,o){Ii(s,o)},Identifier(s,o){z(s,o)},CallExpression(s,o){ie(s,o)},MemberExpression(s,o){te(s,i,o)},AssignmentExpression(s,o){ki(s,o)},FunctionDeclaration(s,o,u){Kr(s,o,u)},ForStatement(s,o,u){qr(s,o,u)},IfStatement(s,o,u){Hr(s,o,u)}})}function Yr(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=typeof e=="function"?e.toString():e;r=r.trim(),r=Rr(r);const n=i?r.split(`
|
|
34
|
+
`):[],a=_i(r,{ecmaVersion:"latest",sourceType:"module",locations:i});Br(a),Lr(a),Mr(a);const s=new Pr;jr(a,s);const o=$r(a,s)||"";Xr(a,s,o,t,n),Qr(a);const u=Cr||xt||void 0,c=Object.assign({},u,{LineComment(f,d){d.write("//"+f.value)}}),h=kr(a,{generator:c,comments:i});return new Function("",`var _r = ${h}
|
|
35
|
+
; return _r;`)(this)}function Zr(e){return t=>new M(t.array.map(i=>Math.abs(i)),t.type,e)}function Jr(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 en(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 tn(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 rn(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 nn(e){return t=>{t.array.length=0}}function an(e){return(t,i)=>(t.array.push(...i.array),t)}function sn(e){return t=>new M([...t.array],t.type,e)}function on(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,u=0;const c=[];for(let g=0;g<n.length;g++){const x=Number(n[g]),y=Number(a[g]);!isNaN(x)&&x!==null&&x!==void 0&&!isNaN(y)&&y!==null&&y!==void 0&&(s+=x,o+=y,u++,c.push(g))}if(u===0)return NaN;const h=s/u,f=o/u;let d=0;for(const g of c){const x=Number(n[g]),y=Number(a[g]);d+=(x-h)*(y-f)}const p=r?u:u-1;return p<=0?NaN:e.precision(d/p)}}function un(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function cn(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?D.int:D.float;if(e.every(t=>typeof t=="string"))return D.string;if(e.every(t=>typeof t=="boolean"))return D.bool;throw new Error("Cannot infer type from values")}function re(e){if(typeof e=="number")return(e|0)===e?D.int:D.float;if(typeof e=="string")return D.string;if(typeof e=="boolean")return D.bool;throw new Error("Cannot infer type from value")}function Re(e,t){switch(t){case D.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case D.float:return typeof e=="number"||isNaN(e);case D.string:return typeof e=="string";case D.bool:return typeof e=="boolean"}return!1}function ln(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(!Re(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 hn(e){return t=>t.array.length>0?t.array[0]:e.NA}function pn(e){return(t,i)=>t.array[i]}function fn(e){return(t,i)=>t.array.includes(i)}function mn(e){return(t,i)=>t.array.indexOf(i)}function dn(e){return(t,i,r)=>{if(!Re(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 gn(e){return(t,i=",")=>t.array.join(i)}function xn(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function yn(e){return(t,i)=>t.array.lastIndexOf(i)}function bn(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function vn(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 _n(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function wn(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 Sn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const u of r){const c=Number(u);if(isNaN(c)||c===null||c===void 0)return NaN;n.push(c)}n.sort((u,c)=>u-c),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 Nn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const o of r){const u=Number(o);!isNaN(u)&&u!==null&&u!==void 0&&n.push(u)}if(n.length===0)return NaN;n.sort((o,u)=>o-u),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 Cn(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 u=Number(o);!isNaN(u)&&u!==null&&u!==void 0&&u<n&&a++}const s=t.array.length-1;return s<=0?NaN:a/s*100}}function En(e){return t=>t.array.pop()}function kn(e){return(t,i)=>{if(!Re(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 In(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function An(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function Pn(e){return t=>{t.array.reverse()}}function Vn(e){return(t,i,r)=>{if(!Re(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 Tn(e){return t=>t.array.shift()}function Mn(e){return t=>t.array.length}function Ln(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new M(t.array.slice(i,n),t.type,e)}}function Dn(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var _e=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(_e||{}),Ai=(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))(Ai||{}),Pi=(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))(Pi||{}),Rn=(e=>(e.all="all",e.data_window="data_window",e.none="none",e.pane="pane",e.pine_screener="pine_screener",e.price_scale="price_scale",e.status_line="status_line",e))(Rn||{});const Bn={order:_e,currency:Ai,dayofweek:Pi};function jn(e){return(t,i=_e.ascending)=>{t.array.sort((r,n)=>{let a=isNaN(r)?1/0:r,s=isNaN(n)?1/0:n;return i===_e.ascending?a-s:s-a})}}function On(e){return(t,i=_e.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===_e.ascending?s-o:o-s}),new M(r,D.int,e)}}function Fn(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new M(t.array.map(()=>NaN),D.int,e):r===0?new M(t.array.map(()=>1),D.int,e):new M(t.array.map(n=>(n-i)/r),D.int,e)}}function $n(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 u=a/o;let c=s/o-u*u;return c<0?NaN:(!i&&o>1&&(c=c*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(c)))}}function Wn(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function Un(e){return(t,i)=>{if(!Re(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 qn(e){return(t,i=!0)=>{let r=0,n=0;for(const u of t.array){const c=Number(u);!isNaN(c)&&c!==null&&c!==void 0&&(r+=c,n++)}if(n===0)return NaN;const a=r/n;let s=0;for(const u of t.array){const c=Number(u);!isNaN(c)&&c!==null&&c!==void 0&&(s+=(c-a)*(c-a))}const o=i?n:n-1;return o<=0?NaN:e.precision(s/o)}}var D=(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))(D||{});class M{constructor(t,i,r){this.array=t,this.type=i,this.context=r,this._abs=Zr(this.context),this._avg=Jr(this.context),this._binary_search=en(this.context),this._binary_search_leftmost=tn(this.context),this._binary_search_rightmost=rn(this.context),this._clear=nn(this.context),this._concat=an(this.context),this._copy=sn(this.context),this._covariance=on(this.context),this._every=un(this.context),this._fill=ln(this.context),this._first=hn(this.context),this._get=pn(this.context),this._includes=fn(this.context),this._indexof=mn(this.context),this._insert=dn(this.context),this._join=gn(this.context),this._last=xn(this.context),this._lastindexof=yn(this.context),this._max=bn(this.context),this._median=vn(this.context),this._min=_n(this.context),this._mode=wn(this.context),this._percentile_linear_interpolation=Sn(this.context),this._percentile_nearest_rank=Nn(this.context),this._percentrank=Cn(this.context),this._pop=En(this.context),this._push=kn(this.context),this._range=In(this.context),this._remove=An(this.context),this._reverse=Pn(this.context),this._set=Vn(this.context),this._shift=Tn(this.context),this._size=Mn(this.context),this._slice=Ln(this.context),this._some=Dn(this.context),this._sort=jn(this.context),this._sort_indices=On(this.context),this._standardize=Fn(this.context),this._stdev=$n(this.context),this._sum=Wn(this.context),this._unshift=Un(this.context),this._variance=qn(this.context)}_abs;_avg;_binary_search;_binary_search_leftmost;_binary_search_rightmost;_clear;_concat;_copy;_covariance;_every;_fill;_first;_get;_includes;_indexof;_insert;_join;_last;_lastindexof;_max;_median;_min;_mode;_percentile_linear_interpolation;_percentile_nearest_rank;_percentrank;_pop;_push;_range;_remove;_reverse;_set;_shift;_size;_slice;_some;_sort;_sort_indices;_standardize;_stdev;_sum;_unshift;_variance;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 zn(e){return(...t)=>new M([...t],cn(t),e)}function Hn(e){return(t,i)=>new M(Array(t).fill(e.precision(i||0)),re(i||0),e)}function Gn(e){return(t,i=!1)=>new M(Array(t).fill(i),D.bool,e)}function Kn(e){return(t,i=NaN)=>new M(Array(t).fill(e.precision(i)),D.float,e)}function Qn(e){return(t,i=0)=>new M(Array(t).fill(e.precision(i)),D.int,e)}function Xn(e){return(t,i="")=>new M(Array(t).fill(i),D.string,e)}class m{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof m?t:Array.isArray(t)?new m(t):new m([t])}}function Yn(e){return(t,i=0)=>m.from(t).get(i)}class Zn{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=zn(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=Hn(t),this.new_bool=Gn(t),this.new_float=Kn(t),this.new_int=Qn(t),this.new_string=Xn(t),this.param=Yn(),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 Jn(e){return t=>{t.map.clear()}}function ea(e){return(t,i)=>t.map.has(i)}function ta(e){return t=>{const i=new Vi(e);return i.map=new Map(t.map),i}}function ia(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function ra(e){return t=>{const i=Array.from(t.map.keys()),r=re(i[0]);return new M(i,r,e)}}function na(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function aa(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function sa(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function oa(e){return t=>t.map.size}function ua(e){return t=>{const i=Array.from(t.map.values()),r=re(i[0]);return new M(i,r,e)}}class Vi{constructor(t){this.context=t,this.map=new Map,this._clear=Jn(this.context),this._contains=ea(this.context),this._copy=ta(this.context),this._get=ia(this.context),this._keys=ra(this.context),this._put=na(this.context),this._put_all=aa(this.context),this._remove=sa(this.context),this._size=oa(this.context),this._values=ua(this.context)}map;_clear;_contains;_copy;_get;_keys;_put;_put_all;_remove;_size;_values;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 ca(e){return()=>new Vi(e)}function la(e){return(t,i=0)=>m.from(t).get(i)}class ha{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=ca(t),this.param=la(),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 pa(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r&&(r instanceof M?a=r.array:Array.isArray(r)?a=r:a=[r]),n===0){for(let u=0;u<a.length;u++){let c=a[u];c instanceof m&&(c=c.get(0)),t.matrix.push([c])}return}const s=t.matrix[0].length,o=i!==void 0?i:s;for(let u=0;u<n;u++){let c=u<a.length?a[u]:NaN;c instanceof m&&(c=c.get(0)),t.matrix[u].splice(o,0,c)}}}function fa(e){return(t,i,r)=>{const n=t.matrix.length;let a=[];if(r)if(r instanceof M)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof m){const c=r.get(0);Array.isArray(c)?a=c:a=[c]}else a=[r];const s=n>0?t.matrix[0].length:a.length,o=i!==void 0?i:n,u=[];for(let c=0;c<s;c++)if(c<a.length){let h=a[c];h instanceof m&&(h=h.get(0)),u.push(h)}else u.push(NaN);t.matrix.splice(o,0,u)}}function ma(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 u=t.matrix[s][o];isNaN(u)||(n+=u,a++)}return a===0?NaN:n/a}}function da(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=re(n[0]);return new M(n,a,e)}}function ga(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function xa(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 ya(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new T(i,r,NaN,e);return n.matrix=t.matrix.map(a=>[...a]),n}}function ba(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 u=n;u<t;u++)i[s][u]-=o*i[n][u]}}return r}function va(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:ba(t.matrix)}}function _a(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new T(0,0,NaN,e);const n=t.matrix[0].length,a=new T(r,n,NaN,e);if(i instanceof T)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const u=t.matrix[s][o],c=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=u-c}else{const s=i;for(let o=0;o<r;o++)for(let u=0;u<n;u++)a.matrix[o][u]=t.matrix[o][u]-s}return a}}function wa(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,u=s*s-4*o;if(u<0)return[NaN,NaN];const c=(s+Math.sqrt(u))/2,h=(s-Math.sqrt(u))/2;return[c,h]}function Sa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const s=re(t.matrix[0][0]);return new M([],s,e)}const n=wa(t.matrix),a=re(n[0]);return new M(n,a,e)}}function Na(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new T(0,0,NaN,e);const n=new T(i,r,0,e);for(let a=0;a<i;a++)n.matrix[a][a]=1;return n}}function Ca(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function Ea(e){return(t,i,r,n,a,s)=>{const o=t.matrix.length;if(o===0)return;const u=t.matrix[0].length,c=r!==void 0?r:0,h=n!==void 0?n:o,f=a!==void 0?a:0,d=s!==void 0?s:u;for(let p=c;p<h&&!(p>=o);p++)for(let g=f;g<d&&!(g>=u);g++)t.matrix[p][g]=i}}function ka(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function Ia(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 Aa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new T(i,r,NaN,e);const n=Ia(t.matrix),a=new T(i,r,NaN,e);return a.matrix=n,a}}function Pa(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 Va(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 Ta(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 Ma(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 La(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 Da(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Ra(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 Ba(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 ja(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;let 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 Oa(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 Fa(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,u=n*s,c=new T(o,u,NaN,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){const d=t.matrix[h][f];for(let p=0;p<a;p++)for(let g=0;g<s;g++){const x=i.matrix[p][g];c.matrix[h*a+p][f*s+g]=d*x}}return c}}function $a(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 u=t.matrix[s][o];isNaN(u)||(u>n&&(n=u),a=!0)}return a?n:NaN}}function Wa(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 u=t.matrix[s][o];isNaN(u)||n.push(u)}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 Ua(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 u=t.matrix[s][o];isNaN(u)||(u<n&&(n=u),a=!0)}return a?n:NaN}}function qa(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 u=0;u<r;u++){const c=t.matrix[o][u];if(!isNaN(c)){const h=(n.get(c)||0)+1;n.set(c,h),h>a?(a=h,s=c):h===a&&c<s&&(s=c)}}return s}}function za(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof T){const a=i.matrix.length,s=a>0?i.matrix[0].length:0;if(n!==a)return new T(0,0,NaN,e);const o=new T(r,s,0,e);for(let u=0;u<r;u++)for(let c=0;c<s;c++){let h=0;for(let f=0;f<n;f++)h+=t.matrix[u][f]*i.matrix[f][c];o.matrix[u][c]=h}return o}else if(i instanceof M||Array.isArray(i.array||i)){const a=i.array||i;if(n!==a.length)return new T(0,0,NaN,e);const s=new T(r,1,0,e);for(let o=0;o<r;o++){let u=0;for(let c=0;c<n;c++)u+=t.matrix[o][c]*a[c];s.matrix[o][0]=u}return s}else{const a=i,s=new T(r,n,NaN,e);for(let o=0;o<r;o++)for(let u=0;u<n;u++)s.matrix[o][u]=t.matrix[o][u]*a;return s}}}function Ha(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new T(i,r,NaN,e):new T(r,i,NaN,e)}}function Ga(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new T(0,0,NaN,e);let a=new T(r,n,0,e);for(let u=0;u<r;u++)a.matrix[u][u]=1;let s=new T(r,n,NaN,e);for(let u=0;u<r;u++)s.matrix[u]=[...t.matrix[u]];let o=Math.floor(i);if(o<0)return new T(r,n,NaN,e);for(;o>0;){if(o%2===1){const c=new T(r,n,0,e);for(let h=0;h<r;h++)for(let f=0;f<n;f++){let d=0;for(let p=0;p<r;p++)d+=a.matrix[h][p]*s.matrix[p][f];c.matrix[h][f]=d}a=c}const u=new T(r,n,0,e);for(let c=0;c<r;c++)for(let h=0;h<n;h++){let f=0;for(let d=0;d<r;d++)f+=s.matrix[c][d]*s.matrix[d][h];u.matrix[c][h]=f}s=u,o=Math.floor(o/2)}return a}}function Ka(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 u=n[a][s];for(let c=s;c<r;c++)n[a][c]/=u;for(let c=0;c<i;c++)if(c!==a){const h=n[c][s];for(let f=s;f<r;f++)n[c][f]-=h*n[a][f]}a++}}return a}}function Qa(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const s=re(t.matrix[0][0]);return new M([],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=re(n[0]);return new M(n,a,e)}}function Xa(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=re(r[0][0]);return new M(r[0]||[],n,e)}}function Ya(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 u=[];let c=0;for(let h=0;h<i;h++){const f=[];for(let d=0;d<r;d++)f.push(o[c++]);u.push(f)}t.matrix=u}}function Za(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Ja(e){return(t,i)=>{if(!t.matrix[i]){const n=re(t.matrix[0][0]);return new M([],n,e)}const r=re(t.matrix[i][0]);return new M([...t.matrix[i]],r,e)}}function es(e){return t=>t.matrix.length}function ts(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function is(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 rs(e){return(t,i,r,n,a)=>{const s=r-i,o=a-n,u=new T(s,o,NaN,e);for(let c=0;c<s;c++){const h=i+c;if(h>=t.matrix.length)break;for(let f=0;f<o;f++){const d=n+f;if(d>=t.matrix[h].length)break;u.matrix[c][f]=t.matrix[h][d]}}return u}}function ns(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new T(0,0,NaN,e);const n=t.matrix[0].length,a=new T(r,n,NaN,e);if(i instanceof T)for(let s=0;s<r;s++)for(let o=0;o<n;o++){const u=t.matrix[s][o],c=i.matrix[s]&&i.matrix[s][o]!==void 0?i.matrix[s][o]:NaN;a.matrix[s][o]=u+c}else{const s=i;for(let o=0;o<r;o++)for(let u=0;u<n;u++)a.matrix[o][u]=t.matrix[o][u]+s}return a}}function as(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 ss(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function os(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 us(e){return t=>{const i=t.matrix.length;if(i===0)return new T(0,0,NaN,e);const r=t.matrix[0].length,n=new T(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}}class T{constructor(t=0,i=0,r=NaN,n){if(this.context=n,this.matrix=[],t>0&&i>0)for(let a=0;a<t;a++)this.matrix.push(Array(i).fill(r));this._add_col=pa(this.context),this._add_row=fa(this.context),this._avg=ma(this.context),this._col=da(this.context),this._columns=ga(this.context),this._concat=xa(this.context),this._copy=ya(this.context),this._det=va(this.context),this._diff=_a(this.context),this._eigenvalues=Sa(this.context),this._eigenvectors=Na(this.context),this._elements_count=Ca(this.context),this._fill=Ea(this.context),this._get=ka(this.context),this._inv=Aa(this.context),this._is_antidiagonal=Pa(this.context),this._is_antisymmetric=Va(this.context),this._is_binary=Ta(this.context),this._is_diagonal=Ma(this.context),this._is_identity=La(this.context),this._is_square=Da(this.context),this._is_stochastic=Ra(this.context),this._is_symmetric=Ba(this.context),this._is_triangular=ja(this.context),this._is_zero=Oa(this.context),this._kron=Fa(this.context),this._max=$a(this.context),this._median=Wa(this.context),this._min=Ua(this.context),this._mode=qa(this.context),this._mult=za(this.context),this._pinv=Ha(this.context),this._pow=Ga(this.context),this._rank=Ka(this.context),this._remove_col=Qa(this.context),this._remove_row=Xa(this.context),this._reshape=Ya(this.context),this._reverse=Za(this.context),this._row=Ja(this.context),this._rows=es(this.context),this._set=ts(this.context),this._sort=is(this.context),this._submatrix=rs(this.context),this._sum=ns(this.context),this._swap_columns=as(this.context),this._swap_rows=ss(this.context),this._trace=os(this.context),this._transpose=us(this.context)}matrix;_add_col;_add_row;_avg;_col;_columns;_concat;_copy;_det;_diff;_eigenvalues;_eigenvectors;_elements_count;_fill;_get;_inv;_is_antidiagonal;_is_antisymmetric;_is_binary;_is_diagonal;_is_identity;_is_square;_is_stochastic;_is_symmetric;_is_triangular;_is_zero;_kron;_max;_median;_min;_mode;_mult;_pinv;_pow;_rank;_remove_col;_remove_row;_reshape;_reverse;_row;_rows;_set;_sort;_submatrix;_sum;_swap_columns;_swap_rows;_trace;_transpose;toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
|
|
36
|
+
`,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 cs(e){return(t,i,r)=>new T(t,i,r,e)}function ls(e){return(t,i=0)=>m.from(t).get(i)}class hs{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=cs(t),this.param=ls(),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)}}class ps{constructor(t){this.context=t}_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 fs{constructor(t){this.context=t}color={param:(t,i=0)=>m.from(t).get(i),rgb:(t,i,r,n)=>n?`rgba(${t}, ${i}, ${r}, ${n})`:`rgb(${t}, ${i}, ${r})`,new:(t,i)=>{if(t&&t.startsWith("#")){const r=t.slice(1),n=parseInt(r.slice(0,2),16),a=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return i?`rgba(${n}, ${a}, ${s}, ${i})`:`rgb(${n}, ${a}, ${s})`}return i?`rgba(${t}, ${i})`:t},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue",yellow:"yellow",orange:"orange",purple:"purple",pink:"pink",brown:"brown",teal:"teal",cyan:"cyan",navy:"navy",indigo:"indigo",violet:"violet",magenta:"magenta",rose:"rose",gold:"gold",silver:"silver",bronze:"bronze"};extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}indicator(t,i,r){}plotchar(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const n=m.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:n,options:{...this.extractPlotOptions(r),style:"char"}})}plot(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const n=m.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:n,options:this.extractPlotOptions(r)})}get bar_index(){return this.context.idx}na(t){return isNaN(m.from(t).get(0))}nz(t,i=0){const r=m.from(t).get(0),n=m.from(i).get(0);return isNaN(r)?n:r}}const Lt=[["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"]],ms={defval:e=>typeof e!="object",title:e=>typeof e=="string",tooltip:e=>typeof e=="string",inline:e=>typeof e=="string",group:e=>typeof e=="string",display:e=>typeof e=="string",confirm:e=>typeof e=="boolean",options:e=>Array.isArray(e),minval:e=>typeof e=="number",maxval:e=>typeof e=="number",step:e=>typeof e=="number"};function H(e){const t={};let i={};const r=new Array(Lt.length).fill(!0);for(let n=0;n<e.length;n++){const a=e[n];if(typeof a=="object"){i=a;break}const s=Lt.map((o,u)=>r[u]?o[n]:void 0);for(let o=0;o<s.length;o++){const u=s[o];if(u===void 0){r[o]=!1;continue}ms[u](a)?t[u]=a:r[o]=!1}}return{...i,...t}}function ds(e){return(...t)=>H(t).defval}function gs(e){return(...t)=>H(t).defval}function xs(e){return(...t)=>H(t).defval}function ys(e){return(...t)=>H(t).defval}function bs(e){return(...t)=>H(t).defval}function vs(e){return(...t)=>H(t).defval}function _s(e){return(t,i=0)=>m.from(t).get(i)}function ws(e){return(...t)=>H(t).defval}function Ss(e){return(...t)=>H(t).defval}function Ns(e){return(...t)=>H(t).defval}function Cs(e){return(...t)=>H(t).defval}function Es(e){return(...t)=>H(t).defval}function ks(e){return(...t)=>H(t).defval}function Is(e){return(...t)=>H(t).defval}function As(e){return(...t)=>H(t).defval}const Ps={any:ds,bool:gs,color:xs,enum:ys,float:bs,int:vs,param:_s,price:ws,session:Ss,source:Ns,string:Cs,symbol:Es,text_area:ks,time:Is,timeframe:As};class Vs{constructor(t){this.context=t,Object.entries(Ps).forEach(([i,r])=>{this[i]=r(t)})}any;bool;color;enum;float;int;param;price;session;source;string;symbol;text_area;time;timeframe}function Ts(e){return t=>Math.abs(m.from(t).get(0))}function Ms(e){return t=>Math.acos(m.from(t).get(0))}function Ls(e){return t=>Math.asin(m.from(t).get(0))}function Ds(e){return t=>Math.atan(m.from(t).get(0))}function Rs(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Bs(e){return t=>Math.ceil(m.from(t).get(0))}function js(e){return t=>Math.cos(m.from(t).get(0))}function Os(e){return()=>Math.E}function Fs(e){return t=>Math.exp(m.from(t).get(0))}function $s(e){return t=>Math.floor(m.from(t).get(0))}function Ws(e){return t=>Math.log(m.from(t).get(0))}function Us(e){return t=>Math.log(m.from(t).get(0))}function qs(e){return t=>Math.log10(m.from(t).get(0))}function zs(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.max(...i)}}function Hs(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.min(...i)}}function Gs(e){return(t,i,r)=>typeof t=="string"?t:t instanceof m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Ks(e){return()=>1.618033988749895}function Qs(e){return()=>Math.PI}function Xs(e){return(t,i)=>Math.pow(m.from(t).get(0),m.from(i).get(0))}function Ys(e){return()=>Math.random()}function Zs(e){return t=>Math.round(m.from(t).get(0))}function Js(e){return t=>e.precision(Math.round(m.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function eo(e){return()=>.6180339887498948}function to(e){return t=>Math.sign(m.from(t).get(0))}function io(e){return t=>Math.sin(m.from(t).get(0))}function ro(e){return t=>Math.sqrt(m.from(t).get(0))}function no(e){return(t,i)=>{const r=m.from(i).get(0),n=m.from(t);let a=0;for(let s=0;s<r;s++){const o=n.get(s);a+=o}return a}}function ao(e){return t=>Math.tan(m.from(t).get(0))}function so(e){return(t,i)=>{const r=m.from(t).get(0),n=m.from(i).get(0);return isNaN(r)&&isNaN(n)?!0:isNaN(r)||isNaN(n)?!1:Math.abs(r-n)<1e-8}}const oo={abs:Ts,acos:Ms,asin:Ls,atan:Ds,avg:Rs,ceil:Bs,cos:js,e:Os,exp:Fs,floor:$s,ln:Ws,log:Us,log10:qs,max:zs,min:Hs,param:Gs,phi:Ks,pi:Qs,pow:Xs,random:Ys,round:Zs,round_to_mintick:Js,rphi:eo,sign:to,sin:io,sqrt:ro,sum:no,tan:ao,__eq:so};class uo{constructor(t){this.context=t,Object.entries(oo).forEach(([i,r])=>{this[i]=r(t)})}_cache={};abs;acos;asin;atan;avg;ceil;cos;e;exp;floor;ln;log;log10;max;min;param;phi;pi;pow;random;round;round_to_mintick;rphi;sign;sin;sqrt;sum;tan;__eq}function co(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof m)n=t.get(i||0);else if(Array.isArray(t)){const a=t.every(o=>o instanceof m),s=t.every(o=>!(o instanceof m)&&!Array.isArray(o));(a||s)&&t.length>=1?a?n=t.map(o=>o.get(0)):n=t:n=m.from(t).get(i||0)}else n=t;return e.params[r].length===0?e.params[r].push(n):e.params[r][e.params[r].length-1]=n,[n,r]}}const qe=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Dt(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 Rt(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 u=a&&t>a;if(s&&n)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}if(u&&n&&!s)for(let c=0;c<i.length;c++){if(i[c]>=e&&i[c]<t)return c;if(i[c]>=t)break}return o}if(r[o]<e)break}return-1}function lo(e){return async(t,i,r,n=!1,a=!1,s=!1,o=null,u=null)=>{const c=t[0],h=i[0],f=r[0],d=r[1],p=Array.isArray(n)?n[0]:n,g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return f;const x=qe.indexOf(e.timeframe),y=qe.indexOf(h);if(x==-1||y==-1)throw new Error("Invalid timeframe");if(x===y)return f;const w=x>y,E=m.from(e.data.openTime).get(0),C=m.from(e.data.closeTime).get(0),I=`${c}_${h}_${d}`,N=`${I}_prevIdx`;if(e.cache[I]){const Ie=e.cache[I],Be=w?Rt(E,C,Ie.data.openTime.data,Ie.data.closeTime.data,g,e.eDate,p):Dt(E,C,Ie.data.openTime.data,Ie.data.closeTime.data,g);if(Be==-1)return NaN;const xe=Ie.params[d][Be];if(!w&&p){const _t=e.cache[N];return _t!==void 0&&_t===Be?NaN:(e.cache[N]=Be,Array.isArray(xe)?[xe]:xe)}return Array.isArray(xe)?[xe]:xe}const $=1e3*60*60*24*30,F=e.sDate?e.sDate-$:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,ke=new vt(e.source,c,h,j,F,void 0);ke.markAsSecondary();const he=await ke.run(e.pineTSCode);e.cache[I]=he;const Ye=w?Rt(E,C,he.data.openTime.data,he.data.closeTime.data,g,e.eDate,p):Dt(E,C,he.data.openTime.data,he.data.closeTime.data,g);if(Ye==-1)return NaN;const Ze=he.params[d][Ye];return!w&&p?(e.cache[N]=Ye,NaN):Array.isArray(Ze)?[Ze]:Ze}}function ho(e){return async(t,i,r,n=!1,a=null,s=!1,o=0)=>{const u=t[0],c=i[0],h=r[0],f=r[1];Array.isArray(n)&&n[0];const d=Array.isArray(s)?s[0]:s;if(e.isSecondaryContext)return Array.isArray(h)?[h]:h;const p=qe.indexOf(e.timeframe),g=qe.indexOf(c);if(p===-1||g===-1){if(d)return NaN;throw new Error("Invalid timeframe")}if(g>p){if(d)return NaN;throw new Error(`Timeframe ${c} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(g===p)return[[h]];const x=`${u}_${c}_${f}_lower`;if(!e.cache[x]){const F=e.sDate?e.sDate-2592e6:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,ke=new vt(e.source,u,c,j,F,e.eDate);ke.markAsSecondary();const he=await ke.run(e.pineTSCode);e.cache[x]=he}const y=e.cache[x],w=m.from(e.data.openTime).get(0),E=m.from(e.data.closeTime).get(0),C=y.data.openTime.data,I=y.data.closeTime.data,N=y.params[f];if(!N)return[];const $=[];for(let F=0;F<C.length;F++){const j=C[F];if(!(I[F]<=w)){if(j>=E)break;j>=w&&j<E&&$.push(N[F])}}return[$]}}const po={param:co,security:lo,security_lower_tf:ho};class fo{constructor(t){this.context=t,Object.entries(po).forEach(([i,r])=>{this[i]=r(t)})}_cache={};param;security;security_lower_tf}function mo(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],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 e.precision(r.cumulativeSum);const u=a-s;let c=0;return u!==0&&(c=(n-s-(a-n))/u*o),r.cumulativeSum+=c,e.precision(r.cumulativeSum)}}function go(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0),u=m.from(n).get(0);e.taState||(e.taState={});const c=a||`alma_${s}_${o}_${u}`;if(!e.taState[c]){const p=o*(s-1),g=s/u,x=[];let y=0;for(let w=0;w<s;w++){const E=Math.exp(-Math.pow(w-p,2)/(2*g*g));x.push(E),y+=E}for(let w=0;w<x.length;w++)x[w]/=y;e.taState[c]={window:[],weights:x}}const h=e.taState[c],f=m.from(t).get(0);if(h.window.unshift(f),h.window.length<s)return NaN;h.window.length>s&&h.window.pop();let d=0;for(let p=0;p<s;p++)d+=h.weights[p]*h.window[s-1-p];return e.precision(d)}}function xo(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`atr_${r}`;e.taState[n]||(e.taState[n]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const a=e.taState[n],s=e.get(e.data.high,0),o=e.get(e.data.low,0),u=e.get(e.data.close,0);let c;if(a.prevClose!==null){const f=s-o,d=Math.abs(s-a.prevClose),p=Math.abs(o-a.prevClose);c=Math.max(f,d,p)}else c=s-o;if(a.prevClose=u,a.initCount<r)return a.initSum+=c,a.initCount++,a.initCount===r?(a.prevAtr=a.initSum/r,e.precision(a.prevAtr)):NaN;const h=(a.prevAtr*(r-1)+c)/r;return a.prevAtr=h,e.precision(h)}}function yo(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const n=e.taState[r];return m.from(t).get(0)?(n.lastTrueIndex=e.idx,0):n.lastTrueIndex===null?NaN:e.idx-n.lastTrueIndex}}function bo(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bb_${a}_${s}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const u=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return[[NaN,NaN,NaN]];if(u.window.unshift(c),u.sum+=c,u.window.length<a)return[[NaN,NaN,NaN]];if(u.window.length>a){const x=u.window.pop();u.sum-=x}const h=u.sum/a;let f=0;for(let x=0;x<a;x++)f+=Math.pow(u.window[x]-h,2);const d=Math.sqrt(f/a),p=h+s*d,g=h-s*d;return[[e.precision(p),e.precision(h),e.precision(g)]]}}function vo(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bbw_${a}_${s}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const u=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return NaN;if(u.window.unshift(c),u.sum+=c,u.window.length<a)return NaN;if(u.window.length>a){const y=u.window.pop();u.sum-=y}const h=u.sum/a;let f=0;for(let y=0;y<a;y++){const w=u.window[y]-h;f+=w*w}const d=f/a,p=Math.sqrt(d),g=s*p;if(h===0)return e.precision(0);const x=2*g/h*100;return e.precision(x)}}function _o(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`cci_${n}`;e.taState[a]||(e.taState[a]={window:[],sum:0});const s=e.taState[a],o=m.from(t).get(0);if(isNaN(o))return NaN;if(s.window.unshift(o),s.sum+=o,s.window.length<n)return NaN;if(s.window.length>n){const d=s.window.pop();s.sum-=d}const u=s.sum/n;let c=0;for(let d=0;d<n;d++)c+=Math.abs(s.window[d]-u);const h=c/n;if(h===0)return 0;const f=(o-u)/(.015*h);return e.precision(f)}}function wo(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`change_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<=n)return NaN;s.window.length>n+1&&s.window.pop();const u=o-s.window[n];return e.precision(u)}}function So(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`cmo_${n}`;e.taState[a]||(e.taState[a]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const s=e.taState[a],o=m.from(t).get(0),u=m.from(t).get(1);if(isNaN(o)||isNaN(u))return NaN;const c=o-u,h=c>=0?c:0,f=c>=0?0:-c;if(s.gainsWindow.unshift(h),s.lossesWindow.unshift(f),s.gainsSum+=h,s.lossesSum+=f,s.gainsWindow.length<n)return NaN;if(s.gainsWindow.length>n){const g=s.gainsWindow.pop(),x=s.lossesWindow.pop();s.gainsSum-=g,s.lossesSum-=x}const d=s.gainsSum+s.lossesSum;if(d===0)return e.precision(0);const p=100*(s.gainsSum-s.lossesSum)/d;return e.precision(p)}}function No(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);let s=0,o=!1;for(let h=0;h<n;h++){const f=a.get(h);if(isNaN(f)){o=!0;break}s+=f}if(o)return NaN;let u=0;for(let h=0;h<n;h++){const f=a.get(h);u+=f*(h+1)}if(s===0)return NaN;const c=-u/s;return e.precision(c)}}function Co(e){return(t,i,r,n)=>{const a=m.from(r).get(0),s=m.from(t),o=m.from(i);if(e.idx<a-1)return NaN;let u=0,c=0,h=0,f=0,d=0,p=0;for(let E=0;E<a;E++){const C=s.get(E),I=o.get(E);isNaN(C)||isNaN(I)||(u+=C,c+=I,h+=C*I,f+=C*C,d+=I*I,p++)}if(p<2)return NaN;const g=p*h-u*c,x=p*f-u*u,y=p*d-c*c;if(x<=0||y<=0)return e.precision(0);const w=g/Math.sqrt(x*y);return e.precision(w)}}function Eo(e){return(t,i,r)=>{const n=m.from(t),a=m.from(i),s=n.get(0),o=a.get(0),u=n.get(1),c=a.get(1);if(isNaN(s)||isNaN(o)||isNaN(u)||isNaN(c))return!1;const h=s>o&&u<=c,f=s<o&&u>=c;return h||f}}function ko(e){return(t,i)=>{const r=m.from(t),n=m.from(i),a=r.get(0),s=n.get(0),o=r.get(1),u=n.get(1);return o<u&&a>s}}function Io(e){return(t,i)=>{const r=m.from(t),n=m.from(i),a=r.get(0),s=n.get(0),o=r.get(1),u=n.get(1);return o>u&&a<s}}function Ao(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const n=e.taState[r],a=m.from(t).get(0);return isNaN(a)||(n.cumulativeSum+=a),e.precision(n.cumulativeSum)}}function Po(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`dev_${n}`;e.taState[a]||(e.taState[a]={window:[],sum:0});const s=e.taState[a],o=m.from(t).get(0)||0;if(s.window.unshift(o),s.sum+=o,s.window.length<n)return NaN;if(s.window.length>n){const f=s.window.pop();s.sum-=f}const u=s.sum/n;let c=0;for(let f=0;f<n;f++)c+=Math.abs(s.window[f]-u);const h=c/n;return e.precision(h)}}function Vo(e){return(t,i,r)=>{const n=m.from(t).get(0),a=m.from(i).get(0);e.taState||(e.taState={});const s=r||`dmi_${n}_${a}`;e.taState[s]||(e.taState[s]={prevHigh:NaN,prevLow:NaN,prevClose:NaN,trInitSum:0,plusInitSum:0,minusInitSum:0,initCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,dxInitSum:0,adxInitCount:0,prevADX:NaN});const o=e.taState[s],u=e.get(e.data.high,0),c=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(u)||isNaN(c)||isNaN(h))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=u,o.prevLow=c,o.prevClose=h,[[NaN,NaN,NaN]];const f=Math.max(u-c,Math.abs(u-o.prevClose),Math.abs(c-o.prevClose)),d=u-o.prevHigh,p=o.prevLow-c,g=d>p&&d>0?d:0,x=p>d&&p>0?p:0;o.prevHigh=u,o.prevLow=c,o.prevClose=h;let y,w,E;if(o.initCount++,o.initCount<=n)o.trInitSum+=f,o.plusInitSum+=g,o.minusInitSum+=x,o.initCount===n&&(o.prevSmoothedTR=o.trInitSum/n,o.prevSmoothedPlus=o.plusInitSum/n,o.prevSmoothedMinus=o.minusInitSum/n);else{const j=1/n;o.prevSmoothedTR=j*f+(1-j)*o.prevSmoothedTR,o.prevSmoothedPlus=j*g+(1-j)*o.prevSmoothedPlus,o.prevSmoothedMinus=j*x+(1-j)*o.prevSmoothedMinus}if(y=o.prevSmoothedTR,w=o.prevSmoothedPlus,E=o.prevSmoothedMinus,o.initCount<n)return[[NaN,NaN,NaN]];const C=y===0?0:100*w/y,I=y===0?0:100*E/y,N=C+I,$=N===0?0:100*Math.abs(C-I)/N;let F=NaN;if(o.adxInitCount++,o.adxInitCount<=a)o.dxInitSum+=$,o.adxInitCount===a&&(o.prevADX=o.dxInitSum/a,F=o.prevADX);else{const j=1/a;o.prevADX=j*$+(1-j)*o.prevADX,F=o.prevADX}return[[e.precision(C),e.precision(I),e.precision(F)]]}}function To(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`ema_${n}`;e.taState[a]||(e.taState[a]={prevEma:null,initSum:0,initCount:0});const s=e.taState[a],o=m.from(t).get(0);if(s.initCount<n)return s.initSum+=o,s.initCount++,s.initCount===n?(s.prevEma=s.initSum/n,e.precision(s.prevEma)):NaN;const u=2/(n+1),c=o*u+s.prevEma*(1-u);return s.prevEma=c,e.precision(c)}}function Mo(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);for(let s=0;s<n;s++){const o=a.get(s),u=a.get(s+1);if(isNaN(o)||isNaN(u)||o>=u)return!1}return!0}}function Lo(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`highest_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<n)return NaN;s.window.length>n&&s.window.pop();const u=Math.max(...s.window.filter(c=>!isNaN(c)));return e.precision(u)}}function Do(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;let s=-1/0,o=NaN;for(let u=0;u<n;u++){const c=a.get(u);isNaN(c)||(isNaN(o)||c>s)&&(s=c,o=-u)}return o}}function Ro(e){return(t,i,r)=>{const n=m.from(i).get(0),a=Math.floor(n/2),s=Math.floor(Math.sqrt(n)),o=e.ta.wma,u=o(t,a,r?`${r}_wma1`:void 0),c=o(t,n,r?`${r}_wma2`:void 0);if(isNaN(u)||isNaN(c))return NaN;e.taState||(e.taState={});const h=r||`hma_raw_${n}`;e.taState[h]||(e.taState[h]=[]);const f=2*u-c;e.taState[h].unshift(f);const d=r?`${r}_hma_final`:`hma_final_${n}`;e.taState[d]||(e.taState[d]={window:[]});const p=e.taState[d];if(p.window.unshift(f),p.window.length<s)return NaN;p.window.length>s&&p.window.pop();let g=0,x=0;for(let w=0;w<s;w++){const E=s-w;g+=p.window[w]*E,x+=E}const y=g/x;return e.precision(y)}}function Bo(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 jo(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0);let u=!0;typeof n=="string"?a=n:n!==void 0&&(u=m.from(n).get(0));let c;const h=e.get(e.data.high,0),f=e.get(e.data.low,0);if(u){const I=e.get(e.data.close,1);isNaN(I)?c=NaN:c=Math.max(h-f,Math.abs(h-I),Math.abs(f-I))}else c=h-f;const d=m.from(t).get(0);e.taState||(e.taState={});const p=a||`kc_${s}_${o}_${u}`;e.taState[p]||(e.taState[p]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const g=e.taState[p],x=(I,N,$)=>{if(isNaN(N))return NaN;if(I.initCount<$)return I.initSum+=N,I.initCount++,I.initCount===$?(I.prevEma=I.initSum/$,I.prevEma):NaN;const F=2/($+1);return I.prevEma=N*F+I.prevEma*(1-F),I.prevEma},y=x(g.basisState,d,s),w=x(g.rangeState,c,s);if(isNaN(y)||isNaN(w))return[[NaN,NaN,NaN]];const E=y+w*o,C=y-w*o;return[[e.precision(y),e.precision(E),e.precision(C)]]}}function Oo(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0);let u=!0;typeof n=="string"?a=n:n!==void 0&&(u=m.from(n).get(0)),e.taState||(e.taState={});const c=a||`kcw_${s}_${o}_${u}`;e.taState[c]||(e.taState[c]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const h=e.taState[c],f=(C,I,N)=>{if(isNaN(I))return NaN;if(C.initCount<N)return C.initSum+=I,C.initCount++,C.initCount===N?(C.prevEma=C.initSum/N,C.prevEma):NaN;const $=2/(N+1);return C.prevEma=I*$+C.prevEma*(1-$),C.prevEma};let d;const p=e.get(e.data.high,0),g=e.get(e.data.low,0);if(u){const C=e.get(e.data.close,1);isNaN(C)?d=NaN:d=Math.max(p-g,Math.abs(p-C),Math.abs(g-C))}else d=p-g;const x=m.from(t).get(0),y=f(h.basisState,x,s),w=f(h.rangeState,d,s);if(isNaN(y)||isNaN(w))return NaN;if(y===0)return e.precision(0);const E=2*w*o/y;return e.precision(E)}}function Fo(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`linreg_${a}_${s}`;e.taState[o]||(e.taState[o]={window:[]});const u=e.taState[o],c=m.from(t).get(0);if(u.window.unshift(c),u.window.length<a)return NaN;u.window.length>a&&u.window.pop();let h=0,f=0,d=0,p=0;const g=a;for(let E=0;E<a;E++){const C=a-1-E,I=u.window[E];h+=C,f+=I,d+=C*I,p+=C*C}const x=g*p-h*h;if(x===0)return NaN;const y=(g*d-h*f)/x,w=(f-y*h)/g+y*(a-1-s);return e.precision(w)}}function $o(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`lowest_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<n)return NaN;s.window.length>n&&s.window.pop();const u=s.window.filter(h=>!isNaN(h)&&h!==void 0),c=u.length>0?Math.min(...u):NaN;return e.precision(c)}}function Wo(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;let s=1/0,o=NaN;for(let u=0;u<n;u++){const c=a.get(u);isNaN(c)||(isNaN(o)||c<s)&&(s=c,o=-u)}return o}}function Uo(e){return(t,i,r,n,a)=>{const s=m.from(i).get(0),o=m.from(r).get(0),u=m.from(n).get(0),c=a||`macd_${s}_${o}_${u}`,h=`${c}_fast`,f=`${c}_slow`,d=`${c}_signal`,p=e.ta.ema(t,s,h),g=e.ta.ema(t,o,f);let x=NaN;!isNaN(p)&&!isNaN(g)&&(x=p-g);let y=NaN;isNaN(x)||(y=e.ta.ema(x,u,d));let w=NaN;return!isNaN(x)&&!isNaN(y)&&(w=x-y),[[e.precision(x),e.precision(y),e.precision(w)]]}}function qo(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`median_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<n)return NaN;s.window.length>n&&s.window.pop();const u=s.window.slice().sort((f,d)=>f-d),c=Math.floor(n/2),h=n%2===0?(u[c-1]+u[c])/2:u[c];return e.precision(h)}}function zo(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`mfi_${n}`;e.taState[a]||(e.taState[a]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const s=e.taState[a],o=m.from(t).get(0),u=m.from(t).get(1),c=e.get(e.data.volume,0);if(isNaN(o)||isNaN(c))return NaN;const h=isNaN(u)?NaN:o-u;let f=0,d=0;if(f=c*(h<=0?0:o),d=c*(h>=0?0:o),s.upperWindow.unshift(f),s.lowerWindow.unshift(d),s.upperSum+=f,s.lowerSum+=d,s.upperWindow.length<n)return NaN;if(s.upperWindow.length>n){const g=s.upperWindow.pop(),x=s.lowerWindow.pop();s.upperSum-=g,s.lowerSum-=x}if(s.lowerSum===0)return s.upperSum,e.precision(100);if(s.upperSum===0)return e.precision(0);const p=100-100/(1+s.upperSum/s.lowerSum);return e.precision(p)}}function Ho(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n-1)return NaN;const s=new Map;for(let c=0;c<n;c++){const h=a.get(c);isNaN(h)||s.set(h,(s.get(h)||0)+1)}if(s.size===0)return NaN;let o=NaN,u=-1;for(const[c,h]of s.entries())h>u?(u=h,o=c):h===u&&c<o&&(o=c);return o}}function Go(e){return(t,i,r)=>{const n=m.from(i).get(0);return e.ta.change(t,n)}}function Ko(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],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),u=isNaN(n)?0:n,c=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;if(!(u===0||c===0)&&h<f){const d=(u-c)/c;r.nvi=r.nvi+d*r.nvi}return e.precision(r.nvi)}}function Qo(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={prevOBV:0});const i=e.taState[t],r=e.get(e.data.close,0),n=e.get(e.data.volume,0),a=e.get(e.data.close,1);if(isNaN(a))return i.prevOBV=0,e.precision(0);let s;return r>a?s=i.prevOBV+n:r<a?s=i.prevOBV-n:s=i.prevOBV,i.prevOBV=s,e.precision(s)}}function Xo(e){return(t,i,r)=>t instanceof m?i?new m(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Yo(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t);if(e.idx<a-1)return NaN;const u=[];for(let g=0;g<a;g++){const x=o.get(g);if(isNaN(x))return NaN;u.push(x)}u.sort((g,x)=>g-x);let c=s/100*a-.5;c<0&&(c=0),c>a-1&&(c=a-1);const h=Math.floor(c),f=Math.ceil(c);if(h===f)return e.precision(u[h]);const d=c-h,p=u[h]+d*(u[f]-u[h]);return e.precision(p)}}function Zo(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0),o=m.from(t);if(e.idx<a-1)return NaN;const u=[];for(let h=0;h<a;h++){const f=o.get(h);isNaN(f)||u.push(f)}if(u.length===0)return NaN;u.sort((h,f)=>h-f);let c=Math.ceil(s/100*u.length)-1;return c<0&&(c=0),c>=u.length&&(c=u.length-1),e.precision(u[c])}}function Jo(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);if(e.idx<n)return NaN;const s=a.get(0);if(isNaN(s))return NaN;let o=0,u=0;for(let c=1;c<=n;c++){const h=a.get(c);isNaN(h)||(u++,h<=s&&o++)}return u===0?NaN:e.precision(o/u*100)}}function eu(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 tu(e){return(t,i,r)=>{r==null&&(r=i,i=t,t=e.data.high);const n=m.from(i).get(0),a=m.from(r).get(0),s=m.from(t).toArray(),o=eu(s,n,a),u=e.idx;return e.precision(o[u])}}function iu(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 ru(e){return(t,i,r)=>{r==null&&(r=i,i=t,t=e.data.low);const n=m.from(i).get(0),a=m.from(r).get(0),s=m.from(t).toArray(),o=iu(s,n,a),u=e.idx;return e.precision(o[u])}}function nu(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],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),u=isNaN(n)?0:n,c=isNaN(a)?0:a,h=isNaN(s)?0:s,f=isNaN(o)?0:o;if(!(u===0||c===0)&&h>f){const d=(u-c)/c;r.pvi=r.pvi+d*r.pvi}return e.precision(r.pvi)}}function au(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),a=e.get(e.data.close,1),s=e.get(e.data.volume,0);if(!isNaN(n)&&!isNaN(a)&&!isNaN(s)&&a!==0){const o=(n-a)/a*s;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function su(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 ou(e){return(t,i,r)=>{const n=m.from(i).get(0),a=m.from(t);for(let s=0;s<n;s++){const o=a.get(s),u=a.get(s+1);if(isNaN(o)||isNaN(u)||o<=u)return!1}return!0}}function uu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`rma_${n}`;e.taState[a]||(e.taState[a]={prevRma:null,initSum:0,initCount:0});const s=e.taState[a],o=m.from(t).get(0)||0;if(s.initCount<n)return s.initSum+=o,s.initCount++,s.initCount===n?(s.prevRma=s.initSum/n,e.precision(s.prevRma)):NaN;const u=1/n,c=o*u+s.prevRma*(1-u);return s.prevRma=c,e.precision(c)}}function cu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`roc_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<=n)return NaN;s.window.length>n+1&&s.window.pop();const u=s.window[n],c=(o-u)/u*100;return e.precision(c)}}function lu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`rsi_${n}`;e.taState[a]||(e.taState[a]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.prevValue!==null){const u=o-s.prevValue,c=u>0?u:0,h=u<0?-u:0;if(s.initGains.length<n){if(s.initGains.push(c),s.initLosses.push(h),s.initGains.length===n){s.avgGain=s.initGains.reduce((p,g)=>p+g,0)/n,s.avgLoss=s.initLosses.reduce((p,g)=>p+g,0)/n,s.prevValue=o;const d=s.avgLoss===0?100:100-100/(1+s.avgGain/s.avgLoss);return e.precision(d)}return s.prevValue=o,NaN}s.avgGain=(s.avgGain*(n-1)+c)/n,s.avgLoss=(s.avgLoss*(n-1)+h)/n;const f=s.avgLoss===0?100:100-100/(1+s.avgGain/s.avgLoss);return s.prevValue=o,e.precision(f)}return s.prevValue=o,NaN}}function hu(e){return(t,i,r,n)=>{const a=m.from(t).get(0),s=m.from(i).get(0),o=m.from(r).get(0);e.taState||(e.taState={});const u=n||`sar_${a}_${s}_${o}`;e.taState[u]||(e.taState[u]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const c=e.taState[u],h=e.get(e.data.high,0),f=e.get(e.data.low,0),d=e.get(e.data.close,0),p=e.get(e.data.close,1),g=e.get(e.data.high,1),x=e.get(e.data.low,1),y=e.get(e.data.high,2),w=e.get(e.data.low,2);if(isNaN(h)||isNaN(f)||isNaN(d))return NaN;let E=!1;return c.barIndex===1&&(d>p?(c.isBelow=!0,c.maxMin=h,c.result=x):(c.isBelow=!1,c.maxMin=f,c.result=g),E=!0,c.acceleration=a),c.barIndex>=1&&(c.result=c.result+c.acceleration*(c.maxMin-c.result),c.isBelow?c.result>f&&(E=!0,c.isBelow=!1,c.result=Math.max(h,c.maxMin),c.maxMin=f,c.acceleration=a):c.result<h&&(E=!0,c.isBelow=!0,c.result=Math.min(f,c.maxMin),c.maxMin=h,c.acceleration=a),E||(c.isBelow?h>c.maxMin&&(c.maxMin=h,c.acceleration=Math.min(c.acceleration+s,o)):f<c.maxMin&&(c.maxMin=f,c.acceleration=Math.min(c.acceleration+s,o))),c.isBelow?(c.result=Math.min(c.result,x),c.barIndex>1&&(c.result=Math.min(c.result,w))):(c.result=Math.max(c.result,g),c.barIndex>1&&(c.result=Math.max(c.result,y)))),c.barIndex++,c.barIndex<=1?NaN:e.precision(c.result)}}function pu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`sma_${n}`;e.taState[a]||(e.taState[a]={window:[],sum:0});const s=e.taState[a],o=m.from(t).get(0)||0;if(s.window.unshift(o),s.sum+=o,s.window.length<n)return NaN;if(s.window.length>n){const c=s.window.pop();s.sum-=c}const u=s.sum/n;return e.precision(u)}}function fu(e){return(t,i,r=!0,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`stdev_${a}_${s}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const u=e.taState[o],c=m.from(t).get(0);if(u.window.unshift(c),u.sum+=c,u.window.length<a)return NaN;if(u.window.length>a){const g=u.window.pop();u.sum-=g}const h=u.sum/a;let f=0;for(let g=0;g<a;g++)f+=Math.pow(u.window[g]-h,2);const d=s?a:a-1,p=Math.sqrt(f/d);return e.precision(p)}}function mu(e){return(t,i,r,n,a)=>{const s=m.from(n).get(0);e.taState||(e.taState={});const o=a||`stoch_${s}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const u=e.taState[o],c=m.from(t).get(0),h=m.from(i).get(0),f=m.from(r).get(0);if(isNaN(c)||isNaN(h)||isNaN(f))return NaN;if(u.highWindow.unshift(h),u.lowWindow.unshift(f),u.highWindow.length<s)return NaN;u.highWindow.length>s&&(u.highWindow.pop(),u.lowWindow.pop());let d=u.highWindow[0],p=u.lowWindow[0];for(let y=1;y<s;y++)u.highWindow[y]>d&&(d=u.highWindow[y]),u.lowWindow[y]<p&&(p=u.lowWindow[y]);const g=d-p;if(g===0)return NaN;const x=100*(c-p)/g;return e.precision(x)}}function du(e){return(t,i,r)=>{const n=m.from(t).get(0),a=m.from(i).get(0);e.taState||(e.taState={});const s=r||`supertrend_${n}_${a}`;e.taState[s]||(e.taState[s]={trWindow:[],trSum:0,atrValue:NaN,atrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN});const o=e.taState[s],u=e.get(e.data.high,0),c=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(u)||isNaN(c)||isNaN(h))return[[NaN,NaN]];const f=(u+c)/2;let d;isNaN(o.prevClose)?d=u-c:d=Math.max(u-c,Math.abs(u-o.prevClose),Math.abs(c-o.prevClose)),o.atrCount++,o.atrCount<=a?(o.trWindow.push(d),o.trSum+=d,o.atrCount===a&&(o.atrValue=o.trSum/a)):o.atrValue=(o.atrValue*(a-1)+d)/a;const p=o.atrValue,g=o.prevClose;if(o.prevClose=h,isNaN(p))return[[NaN,NaN]];let x=f+n*p,y=f-n*p;const w=isNaN(o.prevLowerBand)?0:o.prevLowerBand,E=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||y>w||g<w||(y=w),isNaN(o.prevUpperBand)||x<E||g>E||(x=E);let C,I;const N=o.prevSuperTrend;return o.atrCount===a?C=1:N===o.prevUpperBand?C=h>x?-1:1:C=h<y?1:-1,I=C===-1?y:x,o.prevLowerBand=y,o.prevUpperBand=x,o.prevSuperTrend=I,o.prevDirection=C,[[e.precision(I),C]]}}function gu(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]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<4)return NaN;s.window.length>4&&s.window.pop();let u=0;for(let c=0;c<4;c++)u+=r[c]*s.window[3-c];return u/=n,e.precision(u)}}function xu(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=m.from(t).get(0));const n=e.get(e.data.high,0),a=e.get(e.data.low,0),s=e.get(e.data.close,1);if(isNaN(s))return r?e.precision(n-a):NaN;const o=Math.max(n-a,Math.abs(n-s),Math.abs(a-s));return e.precision(o)}}function yu(e){return(t,i,r,n)=>{const a=m.from(i).get(0),s=m.from(r).get(0);e.taState||(e.taState={});const o=n||`tsi_${a}_${s}`;e.taState[o]||(e.taState[o]={prevSource:NaN,ema1_pc_multiplier:2/(s+1),ema1_pc_value:NaN,ema1_pc_count:0,ema1_pc_sum:0,ema2_pc_multiplier:2/(a+1),ema2_pc_value:NaN,ema2_pc_count:0,ema2_pc_sum:0,ema1_abs_multiplier:2/(s+1),ema1_abs_value:NaN,ema1_abs_count:0,ema1_abs_sum:0,ema2_abs_multiplier:2/(a+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const u=e.taState[o],c=m.from(t).get(0);if(isNaN(c))return NaN;const h=isNaN(u.prevSource)?NaN:c-u.prevSource;if(u.prevSource=c,isNaN(h))return NaN;const f=Math.abs(h);if(u.ema1_pc_count++,u.ema1_pc_count<=s?(u.ema1_pc_sum+=h,u.ema1_pc_count===s&&(u.ema1_pc_value=u.ema1_pc_sum/s)):u.ema1_pc_value=h*u.ema1_pc_multiplier+u.ema1_pc_value*(1-u.ema1_pc_multiplier),u.ema1_abs_count++,u.ema1_abs_count<=s?(u.ema1_abs_sum+=f,u.ema1_abs_count===s&&(u.ema1_abs_value=u.ema1_abs_sum/s)):u.ema1_abs_value=f*u.ema1_abs_multiplier+u.ema1_abs_value*(1-u.ema1_abs_multiplier),isNaN(u.ema1_pc_value)||isNaN(u.ema1_abs_value))return NaN;if(u.ema2_pc_count++,u.ema2_pc_count<=a?(u.ema2_pc_sum+=u.ema1_pc_value,u.ema2_pc_count===a&&(u.ema2_pc_value=u.ema2_pc_sum/a)):u.ema2_pc_value=u.ema1_pc_value*u.ema2_pc_multiplier+u.ema2_pc_value*(1-u.ema2_pc_multiplier),u.ema2_abs_count++,u.ema2_abs_count<=a?(u.ema2_abs_sum+=u.ema1_abs_value,u.ema2_abs_count===a&&(u.ema2_abs_value=u.ema2_abs_sum/a)):u.ema2_abs_value=u.ema1_abs_value*u.ema2_abs_multiplier+u.ema2_abs_value*(1-u.ema2_abs_multiplier),isNaN(u.ema2_pc_value)||isNaN(u.ema2_abs_value))return NaN;if(u.ema2_abs_value===0)return e.precision(0);const d=u.ema2_pc_value/u.ema2_abs_value;return e.precision(d)}}function bu(e){return(t,i,r,n)=>{e.taState||(e.taState={});const a=n||"valuewhen";e.taState[a]||(e.taState[a]={values:[]});const s=e.taState[a],o=m.from(t).get(0),u=m.from(i).get(0),c=m.from(r).get(0);if(o&&s.values.push(u),isNaN(c)||c<0)return NaN;const h=s.values.length-1-c;if(h<0)return NaN;const f=s.values[h];return typeof f=="number"?e.precision(f):f}}function vu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`variance_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<n)return NaN;s.window.length>n&&s.window.pop();let u=0,c=0;for(let d=0;d<n;d++)u+=s.window[d],c+=s.window[d]*s.window[d];const h=u/n,f=c/n-h*h;return e.precision(f)}}function _u(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={cumulativePV:0,cumulativeVolume:0,lastSessionDate:null});const n=e.taState[r],a=m.from(t).get(0),s=m.from(e.data.volume).get(0),o=m.from(e.data.openTime).get(0),u=new Date(o).toISOString().slice(0,10);if(n.lastSessionDate!==u&&(n.cumulativePV=0,n.cumulativeVolume=0,n.lastSessionDate=u),n.cumulativePV+=a*s,n.cumulativeVolume+=s,n.cumulativeVolume===0)return NaN;const c=n.cumulativePV/n.cumulativeVolume;return e.precision(c)}}function wu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`vwma_${n}`;e.taState[a]||(e.taState[a]={window:[],volumeWindow:[]});const s=e.taState[a],o=m.from(t).get(0),u=e.get(e.data.volume,0);if(s.window.unshift(o),s.volumeWindow.unshift(u),s.window.length<n)return NaN;s.window.length>n&&(s.window.pop(),s.volumeWindow.pop());let c=0,h=0;for(let d=0;d<n;d++)c+=s.window[d]*s.volumeWindow[d],h+=s.volumeWindow[d];const f=c/h;return e.precision(f)}}function Su(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],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 e.precision(r.cumulativeSum);let u=0;if(!isNaN(o)){const c=Math.max(a,o),h=Math.min(s,o),f=n-o;f>0?u=n-h:f<0&&(u=n-c)}return r.cumulativeSum+=u,e.precision(r.cumulativeSum)}}function Nu(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const a=r||`wma_${n}`;e.taState[a]||(e.taState[a]={window:[]});const s=e.taState[a],o=m.from(t).get(0);if(s.window.unshift(o),s.window.length<n)return NaN;s.window.length>n&&s.window.pop();let u=0,c=0;for(let f=0;f<n;f++){const d=n-f;u+=s.window[f]*d,c+=d}const h=u/c;return e.precision(h)}}function Cu(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`wpr_${r}`;e.taState[n]||(e.taState[n]={highWindow:[],lowWindow:[]});const a=e.taState[n],s=e.get(e.data.high,0),o=e.get(e.data.low,0),u=e.get(e.data.close,0);if(isNaN(s)||isNaN(o)||isNaN(u))return NaN;if(a.highWindow.unshift(s),a.lowWindow.unshift(o),a.highWindow.length<r)return NaN;a.highWindow.length>r&&(a.highWindow.pop(),a.lowWindow.pop());let c=a.highWindow[0],h=a.lowWindow[0];for(let p=1;p<r;p++)a.highWindow[p]>c&&(c=a.highWindow[p]),a.lowWindow[p]<h&&(h=a.lowWindow[p]);const f=c-h;if(f===0)return e.precision(0);const d=(c-u)/f*-100;return e.precision(d)}}function Eu(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 u=(i-r)/o*s;return e.precision(u)}}const ku={accdist:mo,alma:go,atr:xo,barssince:yo,bb:bo,bbw:vo,cci:_o,change:wo,cmo:So,cog:No,correlation:Co,cross:Eo,crossover:ko,crossunder:Io,cum:Ao,dev:Po,dmi:Vo,ema:To,falling:Mo,highest:Lo,highestbars:Do,hma:Ro,iii:Bo,kc:jo,kcw:Oo,linreg:Fo,lowest:$o,lowestbars:Wo,macd:Uo,median:qo,mfi:zo,mode:Ho,mom:Go,nvi:Ko,obv:Qo,param:Xo,percentile_linear_interpolation:Yo,percentile_nearest_rank:Zo,percentrank:Jo,pivothigh:tu,pivotlow:ru,pvi:nu,pvt:au,range:su,rising:ou,rma:uu,roc:cu,rsi:lu,sar:hu,sma:pu,stdev:fu,stoch:mu,supertrend:du,swma:gu,tr:xu,tsi:yu,valuewhen:bu,variance:vu,vwap:_u,vwma:wu,wad:Su,wma:Nu,wpr:Cu,wvad:Eu};class Iu{constructor(t){this.context=t,Object.entries(ku).forEach(([i,r])=>{this[i]=r(t)})}accdist;alma;atr;barssince;bb;bbw;cci;change;cmo;cog;correlation;cross;crossover;crossunder;cum;dev;dmi;ema;falling;highest;highestbars;hma;iii;kc;kcw;linreg;lowest;lowestbars;macd;median;mfi;mode;mom;nvi;obv;param;percentile_linear_interpolation;percentile_nearest_rank;percentrank;pivothigh;pivotlow;pvi;pvt;range;rising;rma;roc;rsi;sar;sma;stdev;stoch;supertrend;swma;tr;tsi;valuewhen;variance;vwap;vwma;wad;wma;wpr;wvad}class Au{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}param(t,i=0,r){return m.from(t).get(i)}warning(t,...i){console.warn(this.logFormat(t,...i))}error(t,...i){console.error(this.logFormat(t,...i))}info(t,...i){console.log(this.logFormat(t,...i))}}class Pu{constructor(t){this.context=t}param(t,i=0,r){return m.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,n=0){const a=String(t),s=String(i),o=String(r),u=Math.floor(Number(n))||0;if(s==="")return a;let c=0,h=0;for(;;){const f=a.indexOf(s,c);if(f===-1)return a;if(h===u)return a.substring(0,f)+o+a.substring(f+s.length);h++,c=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 Vu{constructor(t){this.context=t}param(t,i=0,r){return m.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<60*60*24?Math.ceil(t/60):t<=60*60*24*7*52?t%(60*60*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(60*60*24))+"D":"12M"}in_seconds(t){const i=parseInt(t),r=t.slice(-1);return r==="S"?i:r==="D"?i*60*60*24:r==="W"?i*60*60*24*7:r==="M"?i*60*60*24*30:isNaN(i)?0:i*60}}class we{data={open:new m([]),high:new m([]),low:new m([]),close:new m([]),volume:new m([]),hl2:new m([]),hlc3:new m([]),ohlc4:new m([]),hlcc4:new m([])};cache={};taState={};isSecondaryContext=!1;NA=NaN;lang;pine;static _deprecationWarningsShown=new Set;idx=0;params={};const={};var={};let={};result=void 0;plots={};marketData;source;tickerId;timeframe="";limit;sDate;eDate;fullContext;pineTSCode;constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:a,sDate:s,eDate:o,fullContext:u}){this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=n,this.limit=a,this.sDate=s,this.eDate=o,this.fullContext=u||this;const c=new fs(this),h={plotchar:c.plotchar.bind(c),na:c.na.bind(c),color:c.color,plot:c.plot.bind(c),nz:c.nz.bind(c)},f=this;this.pine={input:new Vs(this),ta:new Iu(this),math:new uo(this),request:new fo(this),array:new Zn(this),map:new ha(this),matrix:new hs(this),na:h.na,plotchar:h.plotchar,color:h.color,plot:h.plot,nz:h.nz,syminfo:null,timeframe:new Vu(this),barstate:new ps(this),get bar_index(){return f.idx},get last_bar_index(){return f.data.close.length-1},get last_bar_time(){return f.data.openTime.get(f.data.openTime.length-1)},get timenow(){return new Date().getTime()},log:new Au(this),str:new Pu(this),...Bn}}init(t,i,r=0){let n;return i instanceof m?n=i.get(0):Array.isArray(i)?Array.isArray(i[0])?n=i[0]:n=i[i.length-1+r]:n=i,t?t instanceof m?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new m(t)):new m([n]):new m([n])}initVar(t,i){if(t)return t;let r;return i instanceof m?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new m([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new m(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new m(this.params[r],0)))}get(t,i){if(t instanceof m)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof m){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}get math(){return this._showDeprecationWarning("const math = context.math","const { math, ta, input } = context.pine"),this.pine.math}get ta(){return this._showDeprecationWarning("const ta = context.ta","const { ta, math, input } = context.pine"),this.pine.ta}get input(){return this._showDeprecationWarning("const input = context.input","const { input, math, ta } = context.pine"),this.pine.input}get request(){return this._showDeprecationWarning("const request = context.request","const { request, math, ta } = context.pine"),this.pine.request}get array(){return this._showDeprecationWarning("const array = context.array","const { array, math, ta } = context.pine"),this.pine.array}get core(){return this._showDeprecationWarning("context.core.*","context.pine (e.g., const { na, plotchar, color, plot, nz } = context.pine)"),{na:this.pine.na,plotchar:this.pine.plotchar,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;we._deprecationWarningsShown.has(r)||(we._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`))}}class vt{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,this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,n,a,s).then(u=>{const c=u;this.data=c;const h=c.map(N=>N.open),f=c.map(N=>N.close),d=c.map(N=>N.high),p=c.map(N=>N.low),g=c.map(N=>N.volume),x=c.map(N=>(N.high+N.low+N.close)/3),y=c.map(N=>(N.high+N.low)/2),w=c.map(N=>(N.high+N.low+N.open+N.close)/4),E=c.map(N=>(N.high+N.low+N.close+N.close)/4),C=c.map(N=>N.openTime),I=c.map(N=>N.closeTime);this.open=h,this.close=f,this.high=d,this.low=p,this.volume=g,this.hl2=y,this.hlc3=x,this.ohlc4=w,this.hlcc4=E,this.openTime=C,this.closeTime=I,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(N=>{this._syminfo=N,this._ready=!0,o(!0)}).catch(N=>{console.warn("Failed to get symbol info, using default values:",N),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}data=[];open=[];high=[];low=[];close=[];volume=[];hl2=[];hlc3=[];ohlc4=[];hlcc4=[];openTime=[];closeTime=[];_readyPromise=null;_ready=!1;_debugSettings={ln:!1,debug:!1};_transpiledCode=null;get transpiledCode(){return this._transpiledCode}_isSecondaryContext=!1;markAsSecondary(){this._isSecondaryContext=!0}_syminfo;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){if(r&&r>0){const n=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,n)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,n=!1){await this.ready(),i||(i=this.data.length);const a=this._initializeContext(t,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let s=this.data.length-i;for(;;){const o=this.data.length-s;if(o>0){const h=Math.min(o,r),f=this._getResultLength(a.result);await this._executeIterations(a,this._transpiledCode,s,s+h),s+=h,yield this._createPageContext(a,f);continue}if(!n||Array.isArray(this.source))break;const{newCandles:u,updatedLastCandle:c}=await this._updateMarketData();if(u===0&&!c){yield null;continue}this._removeLastResult(a),s=this.data.length-(u+1),a.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 we({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t});if(r.pineTSCode=t.pineTSCode,r.idx=t.idx,Array.isArray(t.result))r.result=t.result.slice(i);else if(typeof t.result=="object"&&t.result!==null){r.result={};for(let 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 u=0;u<a.length;u++){const c=a[u];c.openTime===n?(this._replaceCandle(r,c),s=!0):c.openTime>n&&(this._appendCandle(c),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 i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.data.pop(),t.data.open.data.pop(),t.data.high.data.pop(),t.data.low.data.pop(),t.data.volume.data.pop(),t.data.hl2.data.pop(),t.data.hlc3.data.pop(),t.data.ohlc4.data.pop(),t.data.hlcc4.data.pop(),t.data.openTime.data.pop(),t.data.closeTime&&t.data.closeTime.data.pop()}_initializeContext(t,i=!1){const r=new we({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return r.pine.syminfo=this._syminfo,r.pineTSCode=t,r.isSecondaryContext=i,r.data.close=new m([]),r.data.open=new m([]),r.data.high=new m([]),r.data.low=new m([]),r.data.volume=new m([]),r.data.hl2=new m([]),r.data.hlc3=new m([]),r.data.ohlc4=new m([]),r.data.hlcc4=new m([]),r.data.openTime=new m([]),r.data.closeTime=new m([]),r}_transpileCode(t){return Yr.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 c;o[u]instanceof m?c=o[u].get(0):Array.isArray(o[u])?c=o[u][o[u].length-1]:c=o[u],t.result[u].push(c)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let u of a)for(let c in t[u]){const h=t[u][c];if(h instanceof m){const f=h.get(0);h.data.push(f)}else if(Array.isArray(h)){const f=h[h.length-1];h.push(f)}}}}}const Bt="https://api.binance.com/api/v3",rt={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 Tu{cache;cacheDuration;constructor(t=5*60*1e3){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 Mu{cacheManager;constructor(){this.cacheManager=new Tu(5*60*1e3)}async getMarketDataInterval(t,i,r,n){try{const a=rt[i.toUpperCase()];if(!a)return console.error(`Unsupported timeframe: ${i}`),[];const s={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let o=[],u=r;const c=n,h=s[a];if(!h)return console.error(`Duration not defined for interval: ${a}`),[];for(;u<c;){const f=Math.min(u+1e3*h,c),d=await this.getMarketData(t,i,1e3,u,f);if(d.length===0)break;o=o.concat(d),u=d[d.length-1].closeTime+1}return o}catch(a){return console.error("Error in getMarketDataInterval:",a),[]}}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 d=this.cacheManager.get(o);if(d)return d}const u=rt[i.toUpperCase()];if(!u)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,n,a)&&n&&a){const d=await this.getMarketDataInterval(t,i,n,a),p=r?d.slice(0,r):d;return this.cacheManager.set(o,p),p}let c=`${Bt}/klines?symbol=${t}&interval=${u}`;r&&(c+=`&limit=${Math.min(r,1e3)}`),n&&(c+=`&startTime=${n}`),a&&(c+=`&endTime=${a}`);const h=await fetch(c);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const f=(await h.json()).map(d=>({openTime:parseInt(d[0]),open:parseFloat(d[1]),high:parseFloat(d[2]),low:parseFloat(d[3]),close:parseFloat(d[4]),volume:parseFloat(d[5]),closeTime:parseInt(d[6]),quoteAssetVolume:parseFloat(d[7]),numberOfTrades:parseInt(d[8]),takerBuyBaseAssetVolume:parseFloat(d[9]),takerBuyQuoteAssetVolume:parseFloat(d[10]),ignore:d[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=rt[t.toUpperCase()],s={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[a];if(s)return Math.ceil((n-r)/s)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=Bt,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 u=(await o.json()).symbols;if(!u||u.length===0)return console.error(`Symbol ${t} not found`),null;const c=i==="futures"?u.find(C=>C.symbol===n):u[0];if(!c)return console.error(`Symbol ${n} not found in exchange info`),null;const h=c.filters?.find(C=>C.filterType==="PRICE_FILTER"),f=c.filters?.find(C=>C.filterType==="LOT_SIZE"),d=h?parseFloat(h.tickSize):.01,p=f?parseFloat(f.minQty):0,g=Math.round(1/d),x=c.baseAsset,y=c.quoteAsset,w=a?` ${a}`:"",E=`${x} / ${y}${w}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:x,description:E,type:i,main_tickerid:`BINANCE:${t}`,current_contract:a,isin:"",basecurrency:x,currency:y,timezone:"Etc/UTC",country:"",mintick:d,pricescale:g,minmove:1,pointvalue:c.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:c.deliveryDate||0,employees:0,industry:"",sector:"",shareholders:0,shares_outstanding_float:0,shares_outstanding_total:0,recommendations_buy:0,recommendations_buy_strong:0,recommendations_date:0,recommendations_hold:0,recommendations_sell:0,recommendations_sell_strong:0,recommendations_total:0,target_price_average:0,target_price_date:0,target_price_estimates:0,target_price_high:0,target_price_low:0,target_price_median:0}}catch(i){return console.error("Error in binance.exchangeInfo:",i),null}}}const Lu=Li.fileURLToPath(typeof document>"u"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||new URL("pinets.min.cjs",document.baseURI).href),Du=Ae.dirname(Lu);class Ru{dataCache=new Map;exchangeInfoCache={};dataDirectory;constructor(t){if(t)this.dataDirectory=t;else{const i=Ae.resolve(Du,"../../../");this.dataDirectory=Ae.join(i,"tests","compatibility","_data")}}getDataFileName(t,i,r,n){return r&&n?`${t}-${i}-${r}-${n}.json`:null}loadDataFromFile(t){const i=`file:${t}`;if(this.dataCache.has(i))return this.dataCache.get(i);const r=Ae.join(this.dataDirectory,t);if(!ye.existsSync(r))throw new Error(`Mock data file not found: ${r}`);const n=ye.readFileSync(r,"utf-8"),a=JSON.parse(n);return this.dataCache.set(i,a),a}findDataFile(t,i,r,n){if(!ye.existsSync(this.dataDirectory))return null;const a=ye.readdirSync(this.dataDirectory).filter(u=>u.endsWith(".json"));if(r&&n){const u=`${t}-${i}-${r}-${n}.json`;if(a.includes(u))return u}const s=new RegExp(`^${t}-${i}-(\\d+)-(\\d+)\\.json$`),o=a.filter(u=>s.test(u)).map(u=>{const c=u.match(s);return{file:u,startTime:parseInt(c[1]),endTime:parseInt(c[2])}}).sort((u,c)=>c.endTime-u.endTime);if(o.length===0)return null;if(r&&n){const u=o.find(c=>c.startTime<=r&&c.endTime>=n);if(u)return u.file}return o[0].file}filterData(t,i,r,n){let a=t;return(i||r)&&(a=t.filter(s=>{const o=!i||s.openTime>=i,u=!r||s.openTime<=r;return o&&u})),a.sort((s,o)=>s.openTime-o.openTime),n&&n>0&&(a=a.slice(0,n)),a}normalizeTimeframe(t){return{1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"}[t.toUpperCase()]||t.toLowerCase()}async getMarketData(t,i,r,n,a){try{const s=this.normalizeTimeframe(i),o=this.findDataFile(t,s,n,a);if(!o)return console.warn(`No mock data file found for ${t} ${s}. Searched in: ${this.dataDirectory}`),[];const u=this.loadDataFromFile(o);return this.filterData(u,n,a,r)}catch(s){return console.error("Error in MockProvider.getMarketData:",s),[]}}loadExchangeInfo(t){if(this.exchangeInfoCache[t])return this.exchangeInfoCache[t];const i=t==="spot"?"api-exchangeInfo.json":"fapi-exchangeInfo.json",r=Ae.join(this.dataDirectory,i);if(!ye.existsSync(r))return console.warn(`Exchange info file not found: ${r}`),null;try{const n=ye.readFileSync(r,"utf-8"),a=JSON.parse(n);return this.exchangeInfoCache[t]=a,a}catch(n){return console.error(`Error loading exchange info from ${i}:`,n),null}}async getSymbolInfo(t){try{let i="crypto",r=t,n="";t.endsWith(".P")?(i="futures",r=t.replace(".P",""),n="Perpetual"):t.includes("_")&&(i="futures",r=t,n="Delivery");const a=this.loadExchangeInfo(i==="futures"?"futures":"spot");if(!a||!a.symbols)return console.error(`Exchange info not available for ${i}`),null;const s=a.symbols.find(y=>y.symbol===r);if(!s)return console.error(`Symbol ${r} not found in ${i} exchange info`),null;const o=s.filters?.find(y=>y.filterType==="PRICE_FILTER"),u=s.filters?.find(y=>y.filterType==="LOT_SIZE"),c=o?parseFloat(o.tickSize):.01,h=u?parseFloat(u.minQty):0,f=Math.round(1/c),d=s.baseAsset,p=s.quoteAsset,g=n?` ${n}`:"",x=`${d} / ${p}${g}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:d,description:x,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:d,currency:p,timezone:"Etc/UTC",country:"",mintick:c,pricescale:f,minmove:1,pointvalue:s.contractSize||1,mincontract:h,session:"24x7",volumetype:"base",expiration_date:s.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 MockProvider.getSymbolInfo:",i),null}}clearCache(){this.dataCache.clear(),this.exchangeInfoCache={}}setDataDirectory(t){this.dataDirectory=t,this.clearCache()}}const Bu=typeof process<"u"&&process.versions&&process.versions.node;let ze=null;if(Bu)try{ze=new Ru}catch{ze=null}const ju={Binance:new Mu,...ze?{Mock:ze}:{}};exports.Context=we;exports.PineTS=vt;exports.Provider=ju;
|