1(function() { 2 const ot = Object.freeze({ 3 REGULAR: "regular", 4 EXTENDED: "extended", 5 ALL: "all" 6 }), Z = Object.freeze({ 7 type: ot.REGULAR, 8 timezone: "America/New_York", 9 regularStart: "09:30", 10 regularEnd: "16:00", 11 extendedStart: "04:00", 12 extendedEnd: "20:00" 13 }), Bt = /* @__PURE__ */ new Map(); 14 function ie(t) { 15 return Bt.has(t) || Bt.set(t, new Intl.DateTimeFormat("en-CA", { 16 timeZone: t, 17 year: "numeric", 18 month: "2-digit", 19 day: "2-digit", 20 hour: "2-digit", 21 minute: "2-digit", 22 hourCycle: "h23" 23 })), Bt.get(t); 24 } 25 function St(t, e) { 26 return /^([01]\d|2[0-3]):[0-5]\d$/.test(String(t || "")) ? String(t) : e; 27 } 28 function Dt(t = {}) { 29 const e = t && typeof t == "object" ? t : {}, i = String(e.type || Z.type), s = Object.values(ot).includes(i) ? i : Z.type; 30 let r = String(e.timezone || Z.timezone); 31 try { 32 ie(r).format(/* @__PURE__ */ new Date(0)); 33 } catch { 34 r = Z.timezone; 35 } 36 return Object.freeze({ 37 type: s, 38 timezone: r, 39 regularStart: St(e.regularStart, Z.regularStart), 40 regularEnd: St(e.regularEnd, Z.regularEnd), 41 extendedStart: St(e.extendedStart, Z.extendedStart), 42 extendedEnd: St(e.extendedEnd, Z.extendedEnd) 43 }); 44 } 45 function se(t, e) { 46 const i = ie(e).formatToParts(/* @__PURE__ */ new Date(Number(t) * 1e3)), s = {}; 47 for (const r of i) r.type !== "literal" && (s[r.type] = r.value); 48 return { 49 dayKey: `${s.year}-${s.month}-${s.day}`, 50 minuteOfDay: Number(s.hour) * 60 + Number(s.minute) 51 }; 52 } 53 function bt(t) { 54 const [e, i] = t.split(":").map(Number); 55 return e * 60 + i; 56 } 57 function qt(t, e = {}) { 58 return se(t, Dt(e).timezone).dayKey; 59 } 60 function Xe(t, e = {}) { 61 const i = Dt(e), { dayKey: s, minuteOfDay: r } = se(t, i.timezone), o = bt(i.regularStart), n = bt(i.regularEnd), h = bt(i.extendedStart), l = bt(i.extendedEnd), u = i.type === ot.ALL ? 0 : i.type === ot.REGULAR ? o : h, c = i.type === ot.ALL ? 1440 : i.type === ot.REGULAR ? n : l; 62 return Object.freeze({ 63 unixSeconds: Number(t), 64 timezone: i.timezone, 65 dayKey: s, 66 hour: Math.floor(r / 60), 67 minute: r % 60, 68 minuteOfDay: r, 69 sessionType: i.type, 70 isRegularSession: r >= o && r < n, 71 isExtendedSession: r >= h && r < l, 72 inSelectedSession: r >= u && r < c, 73 minutesFromSessionOpen: r - u, 74 minutesToSessionClose: c - r 75 }); 76 } 77 const re = { 78 1: 1e3, 79 5: 200, 80 10: 100, 81 50: 20 82 }; 83 var Ze = class { 84 constructor(t = {}) { 85 this.candles = [], this.cursor = 0, this.startingEquity = Number(t.startingEquity) || 1e5, this.commissionPerTrade = Number(t.commissionPerTrade) || 0, this.slippageBps = Number(t.slippageBps) || 0, this.spreadBps = Number(t.spreadBps) || 0, this.monteCarloSeed = Number(t.monteCarloSeed) || 1, this.symbol = t.symbol || "", this.timeframe = t.timeframe || "5m", this.sizingMode = t.sizingMode || "fixed_shares", this.sizingValue = Number(t.sizingValue) || 100, this.riskPct = Number(t.riskPct) || 1, this.atrPeriod = Number(t.atrPeriod) || 14, this.maxDailyLossDollar = t.maxDailyLoss ? Number(t.maxDailyLoss) : null, this.maxDrawdownStopPct = t.maxDrawdownStopPct ? Number(t.maxDrawdownStopPct) : null, this.position = null, this.trades = [], this.equityCurve = [], this.drawdownCurve = [], this.cashEquity = this.startingEquity, this.pendingOrders = [], this._nextOrderId = 1, this._peakEquity = this.startingEquity, this._dailyPL = {}, this._tradingHalted = !1, this._haltReason = null, this._atrByIdx = [], this._strategy = null, this._beforeBarStrategy = null, this._timer = null, this._listeners = /* @__PURE__ */ new Set(); 86 } 87 load(t) { 88 this.candles = Array.isArray(t) ? t.filter(Boolean) : [], this.warmupBars = Math.min(50, Math.max(0, this.candles.length - 1)), this.cursor = Math.max(0, this.warmupBars - 1), this.position = null, this.trades = [], this.cashEquity = this.startingEquity, this._peakEquity = this.startingEquity, this.pendingOrders = [], this._dailyPL = {}, this._tradingHalted = !1, this._haltReason = null, this.equityCurve = this.candles[this.cursor] ? [{ 89 time: this.candles[this.cursor].time, 90 equity: this.startingEquity 91 }] : [], this.drawdownCurve = this.candles[this.cursor] ? [{ 92 time: this.candles[this.cursor].time, 93 drawdownPct: 0 94 }] : [], this._buildATRCache(), this._emit(); 95 } 96 _buildATRCache() { 97 if (this._atrByIdx = new Array(this.candles.length).fill(null), this.candles.length <= this.atrPeriod) return; 98 const t = []; 99 for (let i = 1; i < this.candles.length; i++) { 100 const s = this.candles[i], r = this.candles[i - 1]; 101 t.push(Math.max(s.high - s.low, Math.abs(s.high - r.close), Math.abs(s.low - r.close))); 102 } 103 let e = t.slice(0, this.atrPeriod).reduce((i, s) => i + s, 0) / this.atrPeriod; 104 this._atrByIdx[this.atrPeriod] = e; 105 for (let i = this.atrPeriod; i < t.length;
105 i++) e = (e * (this.atrPeriod - 1) + t[i]) / this.atrPeriod, this._atrByIdx[i + 1] = e; 106 for (let i = 0; i <= this.atrPeriod; i++) this._atrByIdx[i] = this._atrByIdx[this.atrPeriod] || null; 107 } 108 _getATR(t = null) { 109 const e = t ?? this.cursor; 110 return this._atrByIdx[e] ?? null; 111 } 112 subscribe(t) { 113 return this._listeners.add(t), () => this._listeners.delete(t); 114 } 115 _emit() { 116 this._listeners.forEach((t) => { 117 try { 118 t(this.snapshot()); 119 } catch {} 120 }); 121 } 122 snapshot() { 123 return { 124 cursor: this.cursor, 125 total: this.candles.length, 126 currentBar: this.candles[this.cursor] || null, 127 position: this.position ? { ...this.position } : null, 128 unrealizedPL: this.unrealizedPL(), 129 equity: this.equity(), 130 tradesCount: this.trades.length, 131 isPlaying: this._timer != null, 132 visibleCandles: this.candles.slice(0, this.cursor + 1), 133 pendingOrders: [...this.pendingOrders], 134 tradingHalted: this._tradingHalted, 135 haltReason: this._haltReason, 136 atr: this._getATR() 137 }; 138 } 139 step(t = 1) { 140 const e = Math.min(this.candles.length - 1, this.cursor + t); 141 if (e === this.cursor) return this.pause(), !1; 142 for (let i = this.cursor + 1; i <= e; i++) this._tickToBar(i); 143 return !0; 144 } 145 stepBack(t = 1) { 146 const e = Math.max(0, this.cursor - t); 147 this.cursor = e, this._emit(); 148 } 149 play(t = 1) { 150 this.pause(); 151 const e = re[t] || re[1]; 152 this._timer = setInterval(() => { 153 this.step(1) || this.pause(); 154 }, e), this._emit(); 155 } 156 pause() { 157 this._timer && (clearInterval(this._timer), this._timer = null, this._emit()); 158 } 159 goToStart() { 160 this.pause(), this.warmupBars = Math.min(50, Math.max(0, this.candles.length - 1)), this.cursor = Math.max(0, this.warmupBars - 1), this.position = null, this.trades = [], this.cashEquity = this.startingEquity, this._peakEquity = this.startingEquity, this.pendingOrders = [], this._dailyPL = {}, this._tradingHalted = !1, this._haltReason = null, this.equityCurve = this.candles[this.cursor] ? [{ 161 time: this.candles[this.cursor].time, 162 equity: this.startingEquity 163 }] : [], this.drawdownCurve = this.candles[this.cursor] ? [{ 164 time: this.candles[this.cursor].time, 165 drawdownPct: 0 166 }] : [], this._emit(); 167 } 168 attachStrategy(t) { 169 this._strategy = t; 170 } 171 detachStrategy() { 172 this._strategy = null; 173 } 174 attachBeforeBar(t) { 175 this._beforeBarStrategy = t; 176 } 177 detachBeforeBar() { 178 this._beforeBarStrategy = null; 179 } 180 placeOrder(t, e, i, s = {}) { 181 if (this._tradingHalted) return { 182 ok: !1, 183 reason: "trading-halted" 184 }; 185 const r = { 186 id: this._nextOrderId++, 187 type: t, 188 side: e, 189 price: Number(i), 190 size: s.size || null, 191 sl: s.sl ?? null, 192 tp: s.tp ?? null, 193 trail: s.trail ?? null 194 }; 195 return this.pendingOrders.push(r), this._emit(), { 196 ok: !0, 197 id: r.id 198 }; 199 } 200 cancelOrder(t) { 201 const e = this.pendingOrders.length; 202 this.pendingOrders = this.pendingOrders.filter((i) => i.id !== t), this.pendingOrders.length < e && this._emit(); 203 } 204 cancelAllOrders() { 205 this.pendingOrders.length && (this.pendingOrders = [], this._emit()); 206 } 207 _checkPendingFills(t) { 208 if (this.position) { 209 this.pendingOrders = []; 210 return; 211 } 212 const e = []; 213 for (const i of this.pendingOrders) { 214 let s = !1; 215 if (i.type === "limit" ? (i.side === "long" && t.low <= i.price && (s = !0), i.side === "short" && t.high >= i.price && (s = !0)) : i.type === "stop" && (i.side === "long" && t.high >= i.price && (s = !0), i.side === "short" && t.low <= i.price && (s = !0)), s && !this.position) { 216 const r = Number(i.price), o = i.type === "stop" ? i.side === "long" ? Math.max(r, Number(t.open)) : Math.min(r, Number(t.open)) : r, n = this._slippedFill(o, i.side, "open"), h = i.size ?? this.calcSize(n), l = { 217 side: i.side, 218 size: h, 219 entryPrice: n, 220 entryTime: t.time, 221 entryBarIndex: this.cursor, 222 requestedEntryPrice: r, 223 entryExecutionCost: Math.abs(n - r) * h, 224 sl: i.sl ?? null, 225 tp: i.tp ?? null, 226 trail: i.trail ?? null, 227 trailStop: null, 228 _mfe: n, 229 _mae: n, 230 riskPerShare: i.sl != null ? Math.abs(n - i.sl) : null 231 }; 232 l.trailStop = this._initTrailStop(l, n), this.position = l, this.cashEquity -= this.commissionPerTrade, e.push(i.id); 233 } 234 } 235 e.length && (this.pendingOrders = this.pendingOrders.filter((i) => !e.includes(i.id))); 236 } 237 _tickToBar(t) { 238 this.cursor = t;
239 const e = this.candles[t]; 240 if (!e) return; 241 if (this._beforeBarStrategy && !this._tradingHalted) try { 242 this._beforeBarStrategy(e, this); 243 } catch {} 244 if (this._checkRiskGuards(e), this._tradingHalted || this._checkPendingFills(e), this.position) { 245 this.position.side === "long" ? (e.high > this.position._mfe && (this.position._mfe = e.high), e.low < this.position._mae && (this.position._mae = e.low)) : (e.low < this.position._mfe && (this.position._mfe = e.low), e.high > this.position._mae && (this.position._mae = e.high)); 246 const r = this._effectiveSL(), { side: o, tp: n } = this.position; 247 o === "long" ? r != null && e.low <= r ? this._closePosition(this._stopFillPrice(e, r), e.time, r === this.position.trailStop ? "trail-stop" : "stop", r) : n != null && e.high >= n && this._closePosition(n, e.time, "target") : r != null && e.high >= r ? this._closePosition(this._stopFillPrice(e, r), e.time, r === this.position.trailStop ? "trail-stop" : "stop", r) : n != null && e.low <= n && this._closePosition(n, e.time, "target"); 248 } 249 if (this.position && this._updateTrailingStop(e), this._strategy && !this._tradingHalted) try { 250 this._strategy(this.snapshot(), this); 251 } catch {} 252 const i = this.equity(); 253 this.equityCurve.push({ 254 time: e.time, 255 equity: i 256 }), i > this._peakEquity && (this._peakEquity = i); 257 const s = this._peakEquity > 0 ? (this._peakEquity - i) / this._peakEquity * 100 : 0; 258 this.drawdownCurve.push({ 259 time: e.time, 260 drawdownPct: s 261 }), this._emit(); 262 } 263 _effectiveSL() { 264 const { sl: t, trailStop: e } = this.position; 265 return t == null && e == null ? null : t == null ? e : e == null ? t : this.position.side === "long" ? Math.max(t, e) : Math.min(t, e); 266 } 267 _checkRiskGuards(t) { 268 if (this._tradingHalted) return; 269 const e = (/* @__PURE__ */ new Date(t.time * 1e3)).toISOString().slice(0, 10); 270 if (this.maxDailyLossDollar != null && (this._dailyPL[e] || 0) <= -Math.abs(this.maxDailyLossDollar)) { 271 this._haltTrading("max-daily-loss"); 272 return; 273 } 274 this.maxDrawdownStopPct != null && this._peakEquity > 0 && (this._peakEquity - this.equity()) / this._peakEquity * 100 >= this.maxDrawdownStopPct && this._haltTrading("max-drawdown"); 275 } 276 _haltTrading(t) { 277 this._tradingHalted = !0, this._haltReason = t, this.pause(), this.position && this._closePosition(this.candles[this.cursor]?.close ?? this.position.entryPrice, this.candles[this.cursor]?.time ?? this.position.entryTime, "halt"), this.cancelAllOrders(); 278 } 279 _initTrailStop(t, e) { 280 if (!t.trail) return null; 281 const { type: i, value: s } = t.trail, r = this._getATR(); 282 if (t.side === "long") { 283 if (i === "atr") return e - (r || 0) * s; 284 if (i === "dollar") return e - s; 285 if (i === "pct") return e * (1 - s / 100); 286 } else { 287 if (i === "atr") return e + (r || 0) * s; 288 if (i === "dollar") return e + s; 289 if (i === "pct") return e * (1 + s / 100); 290 } 291 return null; 292 } 293 _updateTrailingStop(t) { 294 if (!this.position?.trail || this.position.trailStop == null) return; 295 const { type: e, value: i } = this.position.trail, s = this._getATR(); 296 if (this.position.side === "long") { 297 const r = e === "atr" ? t.high - (s || 0) * i : e === "dollar" ? t.high - i : t.high * (1 - i / 100); 298 r > this.position.trailStop && (this.position.trailStop = r); 299 } else { 300 const r = e === "atr" ? t.low + (s || 0) * i : e === "dollar" ? t.low + i : t.low * (1 + i / 100); 301 r < this.position.trailStop && (this.position.trailStop = r); 302 } 303 } 304 calcSize(t) { 305 const e = this.equity(), i = this._getATR(); 306 switch (this.sizingMode) { 307 case "fixed_dollar": return Math.max(1, Math.floor(this.sizingValue / (t || 1))); 308 case "pct_equity": return Math.max(1, Math.floor(e * this.sizingValue / 100 / (t || 1))); 309 case "atr_risk": return !i || !this.sizingValue ? 1 : Math.max(1, Math.floor(e * this.riskPct / 100 / (i * this.sizingValue))); 310 default: return this.sizingValue; 311 } 312 } 313 _slippedFill(t, e, i) { 314 const s = (this.slippageBps + this.spreadBps / 2) / 1e4; 315 return s ? e === "long" && i === "open" || e === "short" && i === "close" ? t * (1 + s) : t * (1 - s) : t; 316 } 317 _stopFillPrice(t, e) { 318 const i = this.position; 319 if (!i) return Number(e); 320 const s = i.side === "long" ? Math.min(Number(e), Number(t.open)) : Math.max(Number(e), Number(t.open)); 321 return this._slippedFill(s, i.side, "close"); 322 } 323 enterLong(t = null, e = null, i = null, s = null) { 324 const r = this.candles[this.cursor]; 325 return this.enterLongAt(r?.close, t, e, i, s); 326 } 327 enterLongAt(t, e = null, i = null, s = null, r = null) { 328 if (this.position) return { 329 ok: !1, 330 reason: "position-already-open" 331 }; 332 if (this._tradingHalted) return { 333 ok: !1, 334 reason: "trading-halted" 335 }; 336 const o = this.candles[this.cursor]; 337 if (!o || !Number.isFinite(Number(t))) return { 338 ok: !1, 339 reason: "no-bar" 340 }; 341 const n = this._slippedFill(Number(t), "long", "open"), h = e != null ? Number(e) : this.calcSize(n); 342 return this.position = { 343 side: "long", 344 size: h, 345 entryPrice: n, 346 entryTime: o.time, 347 entryBarIndex: this.cursor, 348 requestedEntryPrice: Number(t), 349 entryExecutionCost: Math.abs(n - Number(t)) * h, 350 sl: i, 351 tp: s, 352 trail: r, 353 trailStop: null, 354 _mfe: n, 355 _mae: n, 356 riskPerShare: i != null ? Math.abs(n - i) : null 357 }, this.position.trailStop = this._initTrailStop(this.position, n), this.cashEquity -= this.commissionPerTrade, this._emit(), { ok: !0 }; 358 } 359 enterShort(t = null, e = null, i = null, s = null) { 360 const r = this.candles[this.cursor]; 361 return this.enterShortAt(r?.close, t, e, i, s); 362 } 363 enterShortAt(t, e = null, i = null, s = null, r = null) { 364 if (this.position) return { 365 ok: !1, 366 reason: "position-already-open" 367 }; 368 if (this._tradingHalted) return { 369 ok: !1, 370 reason: "trading-halted" 371 }; 372 const o = this.candles[this.cursor]; 373 if (!o || !Number.isFinite(Number(t))) return { 374 ok: !1, 375 reason: "no-bar" 376 }; 377 const n = this._slippedFill(Number(t), "short", "open"), h = e != null ? Number(e) : this.calcSize(n); 378 return this.position = { 379 side: "short", 380 size: h, 381 entryPrice: n, 382 entryTime: o.time, 383 entryBarIndex: this.cursor, 384 requestedEntryPrice: Number(t), 385 entryExecutionCost: Math.abs(n - Number(t)) * h, 386 sl: i, 387 tp: s, 388 trail: r, 389 trailStop: null, 390 _mfe: n, 391 _mae: n, 392 riskPerShare: i != null ? Math.abs(n - i) : null 393 }, this.position.trailStop = this._initTrailStop(this.position, n), this.cashEquity -= this.commissionPerTrade, this._emit(), { ok: !0 }; 394 } 395 exitPosition(t = "manual") { 396 const e = this.candles[this.cursor]; 397 return this.exitPositionAt(e?.close, t); 398 } 399 exitPositionAt(t, e = "manual") { 400 const i = this.candles[this.cursor]; 401 if (!this.position || !i || !Number.isFinite(Number(t))) return { ok: !1 }; 402 const s = this._slippedFill(Number(t), this.position.side, "close"); 403 return this._closePosition(s, i.time, e, Number(t)), { ok: !0 }; 404 } 405 finalizeAtEnd() { 406 const t = this.candles[this.cursor]; 407 if (!t) return; 408 this.position && this.exitPositionAt(t.close, "end-of-data"), this.cancelAllOrders(); 409 const e = this.equity(); 410 this.equityCurve.length && this.equityCurve[this.equityCurve.length - 1].time === t.time && (this.equityCurve[this.equityCurve.length - 1] = { 411 time: t.time, 412 equity: e 413 }), e > this._peakEquity && (this._peakEquity = e); 414 const i = this._peakEquity > 0 ? (this._peakEquity - e) / this._peakEquity * 100 : 0; 415 this.drawdownCurve.length && this.drawdownCurve[this.drawdownCurve.length - 1].time === t.time && (this.drawdownCurve[this.drawdownCurve.length - 1] = { 416 time: t.time, 417 drawdownPct: i 418 }); 419 } 420 modifyPosition(t = {}) { 421 if (!this.position) return { ok: !1 }; 422 if (t.sl !== void 0 && (this.position.sl = t.sl), t.tp !== void 0 && (this.position.tp = t.tp), t.trail !== void 0) { 423 this.position.trail = t.trail; 424 const e = this.candles[this.cursor]; 425 e && (this.position.trailStop = this._initTrailStop(this.position, e.close)); 426 } 427 return this._emit(), { ok: !0 }; 428 } 429 _closePosition(t, e, i, s = t) { 430 const r = this.position; 431 if (!r) return; 432 const o = r.side === "long" ? 1 : -1, n = (t - r.entryPrice) * r.size * o - this.commissionPerTrade, h = n - this.commissionPerTrade; 433 this.cashEquity += n; 434 const l = (r._mfe - r.entryPrice) * r.size * o, u = (r._mae - r.entryPrice) * r.size * o, c = Math.max(0, l), p = Math.min(0, u), x = r.riskPerShare && r.size ? h / (r.riskPerShare * r.size) : null, P = (/* @__PURE__ */ new Date(e * 1e3)).toISOString().slice(0, 10); 435 this._dailyPL[P] = (this._dailyPL[P] || 0) + h, this.trades.push({ 436 tradeNumber: this.trades.length + 1, 437 side: r.side, 438 size: r.size, 439 entryPrice: r.entryPrice, 440 entryTime: r.entryTime, 441 exitPrice: t, 442 exitTime: e, 443 pl: h, 444 reason: i, 445 requestedEntryPrice: r.requestedEntryPrice ?? r.entryPrice, 446 requestedExitPrice: s, 447 entryExecutionCost: r.entryExecutionCost ?? 0, 448 exitExecutionCost: Math.abs(t - s) * r.size, 449 signal: r.signal || null, 450 exitSignal: r.exitSignal || null, 451 holdBars: this.cursor - r.entryBarIndex, 452 sl: r.sl, 453 tp: r.tp, 454 mae: p, 455 mfe: c, 456 rMultiple: x 457 }), this.position = null; 458 } 459 unrealizedPL() { 460 if (!this.position) return 0; 461 const t = this.candles[this.cursor]; 462 if (!t) return 0; 463 const e = this.position.side === "long" ? 1 : -1; 464 return (t.close - this.position.entryPrice) * this.position.size * e; 465 } 466 equity() { 467 return this.cashEquity + this.unrealizedPL(); 468 }
469 serializeState() { 470 return { 471 cursor: this.cursor, 472 position: this.position ? { ...this.position } : null, 473 trades: this.trades.map((t) => ({ ...t })), 474 cashEquity: this.cashEquity, 475 equityCurve: this.equityCurve.map((t) => ({ ...t })), 476 drawdownCurve: this.drawdownCurve.map((t) => ({ ...t })), 477 startingEquity: this.startingEquity, 478 commissionPerTrade: this.commissionPerTrade, 479 slippageBps: this.slippageBps, 480 spreadBps: this.spreadBps, 481 symbol: this.symbol, 482 timeframe: this.timeframe, 483 sizingMode: this.sizingMode, 484 sizingValue: this.sizingValue 485 }; 486 } 487 restoreState(t = {}) { 488 return this.pause(), this.candles.length ? (this.cursor = Math.min(this.candles.length - 1, Math.max(0, Number(t.cursor) || 0)), this.position = t.position ? { ...t.position } : null, this.trades = Array.isArray(t.trades) ? t.trades.map((e) => ({ ...e })) : [], this.cashEquity = Number(t.cashEquity), isFinite(this.cashEquity) || (this.cashEquity = this.startingEquity), this.equityCurve = Array.isArray(t.equityCurve) && t.equityCurve.length ? t.equityCurve.map((e) => ({ ...e })) : [{ 489 time: this.candles[this.cursor].time, 490 equity: this.cashEquity 491 }], this.drawdownCurve = Array.isArray(t.drawdownCurve) && t.drawdownCurve.length ? t.drawdownCurve.map((e) => ({ ...e })) : [{ 492 time: this.candles[this.cursor].time, 493 drawdownPct: 0 494 }], this._emit(), !0) : !1; 495 } 496 getReport() { 497 const t = this.trades, e = t.filter((m) => m.pl > 0), i = t.filter((m) => m.pl < 0), s = e.reduce((m, k) => m + k.pl, 0), r = Math.abs(i.reduce((m, k) => m + k.pl, 0)), o = s - r; 498 let n = this.startingEquity, h = 0, l = 0; 499 for (const m of this.equityCurve) { 500 m.equity > n && (n = m.equity); 501 const k = n - m.equity; 502 k > h && (h = k, l = n > 0 ? k / n * 100 : 0); 503 } 504 const u = []; 505 for (let m = 1; m < this.equityCurve.length; m++) { 506 const k = this.equityCurve[m - 1].equity; 507 k > 0 && u.push((this.equityCurve[m].equity - k) / k); 508 } 509 const c = u.length ? u.reduce((m, k) => m + k, 0) / u.length : 0, p = u.length ? u.reduce((m, k) => m + (k - c) ** 2, 0) / u.length : 0, x = Math.sqrt(p), P = x > 0 ? c / x * Math.sqrt(u.length) : 0, I = u.filter((m) => m < 0), g = I.length ? I.reduce((m, k) => m + k ** 2, 0) / I.length : 0, y = Math.sqrt(g), w = y > 0 ? c / y * Math.sqrt(u.length) : 0, C = this.startingEquity > 0 ? o / this.startingEquity : 0, at = l > 0 ? C * 100 / l : 0, z = t.filter((m) => m.rMultiple != null), X = z.length ? z.reduce((m, k) => m + k.rMultiple, 0) / z.length : null, H = t.length ? e.length / t.length : 0, nt = e.length ? s / e.length : 0, ct = i.length ? -r / i.length : 0, Rt = H * nt + (1 - H) * ct, yt = t.length ? t.reduce((m, k) => m + (k.mae || 0), 0) / t.length : 0, M = t.length ? t.reduce((m, k) => m + (k.mfe || 0), 0) / t.length : 0, et = t.map((m) => m.mfe && m.mae ? (m.pl - m.mae) / (m.mfe - m.mae || 1) : null).filter((m) => m != null), Zi = et.length ? et.reduce((m, k) => m + k, 0) / et.length : null; 510 let te = 0, ee = 0, Ot = 0, Mt = 0; 511 for (const m of t) m.pl > 0 ? (Ot++, Mt = 0) : (Mt++, Ot = 0), Ot > te && (te = Ot), Mt > ee && (ee = Mt); 512 const pt = {}; 513 for (const m of t) { 514 const k = /* @__PURE__ */ new Date(m.exitTime * 1e3), _t = `${k.getFullYear()}-${String(k.getMonth() + 1).padStart(2, "0")}`, is = k.toLocaleDateString("en-US", { 515 month: "short", 516 year: "numeric" 517 }); 518 pt[_t] || (pt[_t] = { 519 month: is, 520 trades: 0, 521 pnl: 0, 522 wins: 0 523 }), pt[_t].trades++, pt[_t].pnl += m.pl, m.pl > 0 && pt[_t].wins++; 524 } 525 const $i = Object.values(pt).map((m) => ({ 526 ...m, 527 winRate: m.trades > 0 ? m.wins / m.trades * 100 : 0 528 })), xt = this._monteCarloSimulation(t, 1e3), Ji = t.length ? t.reduce((m, k) => m + k.holdBars, 0) / t.length : 0, ts = e.length ? Math.max(...e.map((m) => m.pl)) : 0, es = i.length ? Math.min(...i.map((m) => m.pl)) : 0; 529 return { 530 symbol: this.symbol, 531 timeframe: this.timeframe, 532 startingEquity: this.startingEquity, 533 finalEquity: this.equity(), 534 netProfit: o, 535 grossProfit: s, 536 grossLoss: r, 537 profitFactor: r > 0 ? s / r : s > 0 ? Infinity : 0, 538 totalTrades: t.length, 539 winningTrades: e.length, 540 losingTrades: i.length, 541 winRate: H * 100, 542 avgTrade: t.length ? o / t.length : 0, 543 avgWinningTrade: nt, 544 avgLosingTrade: ct, 545 largestWin: ts, 546 largestLoss: es, 547 maxDrawdown: h, 548 maxDrawdownPct: l, 549 sharpe: P, 550 sortino: w, 551 calmar: at, 552 avgR: X, 553 expectancy: Rt, 554 avgMAE: yt, 555 avgMFE: M, 556 avgMaeEfficiency: Zi, 557 maxConsecWins: te, 558 maxConsecLosses: ee, 559 monthlyBreakdown: $i, 560 monteCarloP95MaxDD: xt.p95MaxDD, 561 monteCarloP5NetProfit: xt.p5NetProfit, 562 monteCarloP5MaxDD: xt.p95MaxDD, 563 monteCarloP95NetProfit: xt.p5NetProfit, 564 monteCarloRuinPct: xt.ruinPct, 565 avgHoldBars: Ji, 566 trades: t, 567 equityCurve: this.equityCurve, 568 drawdownCurve: this.drawdownCurve 569 }; 570 } 571 _monteCarloSimulation(t, e = 1e3) { 572 if (!t.length) return { 573 p95MaxDD: 0, 574 p5NetProfit: 0, 575 ruinPct: 0 576 }; 577 const i = t.map((u) => u.pl), s = [], r = []; 578 let o = 0; 579 const n = this.startingEquity * .5; 580 let h = this.monteCarloSeed >>> 0 || 1; 581 const l = () => (h ^= h << 13, h ^= h >>> 17, h ^= h << 5, (h >>> 0) / 4294967296); 582 for (let u = 0; u < e; u++) { 583 const c = Array.from({ length: i.length }
583, () => i[Math.floor(l() * i.length)]); 584 let p = this.startingEquity, x = p, P = 0, I = 0, g = !1; 585 for (const y of c) { 586 p += y, I += y, p > x && (x = p); 587 const w = x - p; 588 w > P && (P = w), p <= n && (g = !0); 589 } 590 g && o++, s.push(P), r.push(I); 591 } 592 return s.sort((u, c) => u - c), r.sort((u, c) => u - c), { 593 p95MaxDD: s[Math.floor(e * .95)] || 0, 594 p5NetProfit: r[Math.floor(e * .05)] || 0, 595 ruinPct: o / e * 100 596 }; 597 } 598 destroy() { 599 this.pause(), this._listeners.clear(); 600 } 601 }; 602 const ae = (t, e) => { 603 const i = []; 604 for (let s = 0; s < t.length; s++) { 605 if (s < e - 1) continue; 606 let r = 0; 607 for (let o = s - e + 1; o <= s; o++) r += t[o].close; 608 i.push({ 609 time: t[s].time, 610 value: r / e 611 }); 612 } 613 return i; 614 }, wt = (t, e) => { 615 const i = []; 616 if (t.length < e) return i; 617 const s = 2 / (e + 1); 618 let r = t.slice(0, e).reduce((o, n) => o + n.close, 0) / e; 619 i.push({ 620 time: t[e - 1].time, 621 value: r 622 }); 623 for (let o = e; o < t.length; o++) r = t[o].close * s + r * (1 - s), i.push({ 624 time: t[o].time, 625 value: r 626 }); 627 return i; 628 }, $e = (t, e = {}) => { 629 const i = []; 630 let s = 0, r = 0, o = null; 631 for (const n of t) { 632 const h = qt(n.time, e); 633 h !== o && (s = 0, r = 0, o = h); 634 const l = (n.high + n.low + n.close) / 3, u = Number(n.volume); 635 if (!Number.isFinite(u) || u <= 0) { 636 i.push({ 637 time: n.time, 638 value: r > 0 ? s / r : l 639 }); 640 continue; 641 } 642 s += l * u, r += u, i.push({ 643 time: n.time, 644 value: s / r 645 }); 646 } 647 return i; 648 }, Je = (t, e = 20, i = 2) => { 649 const s = [], r = [], o = []; 650 for (let n = 0; n < t.length; n++) { 651 if (n < e - 1) continue; 652 const h = t.slice(n - e + 1, n + 1), l = h.reduce((p, x) => p + x.close, 0) / e, u = h.reduce((p, x) => p + (x.close - l) ** 2, 0) / e, c = Math.sqrt(u); 653 r.push({ 654 time: t[n].time, 655 value: l 656 }), s.push({ 657 time: t[n].time, 658 value: l + i * c 659 }), o.push({ 660 time: t[n].time, 661 value: l - i * c 662 }); 663 } 664 return { 665 upper: s, 666 middle: r, 667 lower: o 668 }; 669 }, ti = (t, e = 14) => { 670 const i = []; 671 if (t.length <= e) return i; 672 let s = 0, r = 0; 673 for (let h = 1; h <= e; h++) { 674 const l = t[h].close - t[h - 1].close; 675 l >= 0 ? s += l : r -= l; 676 } 677 let o = s / e, n = r / e; 678 i.push({ 679 time: t[e].time, 680 value: n === 0 ? 100 : 100 - 100 / (1 + o / n) 681 }); 682 for (let h = e + 1; h < t.length; h++) { 683 const l = t[h].close - t[h - 1].close, u = l > 0 ? l : 0, c = l < 0 ? -l : 0; 684 o = (o * (e - 1) + u) / e, n = (n * (e - 1) + c) / e; 685 const p = n === 0 ? Infinity : o / n; 686 i.push({ 687 time: t[h].time, 688 value: n === 0 ? 100 : 100 - 100 / (1 + p) 689 }); 690 } 691 return i; 692 }, ei = (t, e = 12, i = 26, s = 9) => { 693 const r = wt(t, e), o = wt(t, i), n = new Map(o.map((p) => [p.time, p.value])), h = r.filter((p) => n.has(p.time)).map((p) => ({ 694 time: p.time, 695 value: p.value - n.get(p.time) 696 })), l = 2 / (s + 1), u = []; 697 if (h.length >= s) { 698 let p = h.slice(0, s).reduce((x, P) => x + P.value, 0) / s; 699 u.push({ 700 time: h[s - 1].time, 701 value: p 702 }); 703 for (let x = s; x < h.length; x++) p = h[x].value * l + p * (1 - l), u.push({ 704 time: h[x].time, 705 value: p 706 }); 707 } 708 const c = new Map(u.map((p) => [p.time, p.value])); 709 return { 710 macdLine: h, 711 signalLine: u, 712 histogram: h.filter((p) => c.has(p.time)).map((p) => ({ 713 time: p.time, 714 value: p.value - c.get(p.time) 715 })) 716 }; 717 }, ii = (t, e = 14) => { 718 const i = []; 719 if (t.length <= e) return i; 720 const s = []; 721 for (let o = 1; o < t.length; o++) { 722 const n = t[o], h = t[o - 1]; 723 s.push(Math.max(n.high - n.low, Math.abs(n.high - h.close), Math.abs(n.low - h.close))); 724 } 725 let r = s.slice(0, e).reduce((o, n) => o + n, 0) / e; 726 i.push({ 727 time: t[e].time, 728 value: r 729 }); 730 for (let o = e; o < s.length; o++) r = (r * (e - 1) + s[o]) / e, i.push({ 731 time: t[o + 1].time, 732 value: r 733 }); 734 return i; 735 }; 736 var si = [ 737 509, 738 0, 739 227, 740 0, 741 150, 742 4, 743 294, 744 9, 745 1368, 746 2, 747 2, 748 1, 749 6, 750 3, 751 41, 752 2, 753 5, 754 0, 755 166, 756 1, 757 574, 758 3, 759 9, 760 9, 761 7, 762 9, 763 32, 764 4, 765 318,
766 1, 767 78, 768 5, 769 71, 770 10, 771 50, 772 3, 773 123, 774 2, 775 54, 776 14, 777 32, 778 10, 779 3, 780 1, 781 11, 782 3, 783 46, 784 10, 785 8, 786 0, 787 46, 788 9, 789 7, 790 2, 791 37, 792 13, 793 2, 794 9, 795 6, 796 1, 797 45, 798 0, 799 13, 800 2, 801 49, 802 13, 803 9, 804 3, 805 2, 806 11, 807 83, 808 11, 809 7, 810 0, 811 3, 812 0, 813 158, 814 11, 815 6, 816 9, 817 7, 818 3, 819 56, 820 1, 821 2, 822 6, 823 3, 824 1, 825 3, 826 2, 827 10, 828 0, 829 11, 830 1, 831 3, 832 6, 833 4, 834 4, 835 68, 836 8, 837 2, 838 0, 839 3, 840 0, 841 2, 842 3, 843 2, 844 4, 845 2, 846 0, 847 15, 848 1, 849 83, 850 17, 851 10, 852 9, 853 5, 854 0, 855 82, 856 19, 857 13, 858 9, 859 214, 860 6, 861 3, 862 8, 863 28, 864 1, 865 83, 866 16, 867 16, 868 9, 869 82, 870 12, 871 9, 872 9, 873 7, 874 19, 875 58, 876 14, 877 5, 878 9, 879 243, 880 14, 881 166, 882 9, 883 71, 884 5, 885 2, 886 1, 887 3, 888 3, 889 2, 890 0, 891 2, 892 1, 893 13, 894 9, 895 120, 896 6, 897 3, 898 6, 899 4, 900 0, 901 29, 902 9, 903 41, 904 6, 905 2, 906 3, 907 9, 908 0, 909 10, 910 10, 911 47, 912 15, 913 199, 914 7, 915 137, 916 9, 917 54, 918 7, 919 2, 920 7, 921 17, 922 9, 923 57, 924 21, 925 2, 926 13, 927 123, 928 5, 929 4, 930 0, 931 2, 932 1, 933 2, 934 6, 935 2, 936 0, 937 9, 938 9, 939 49, 940 4, 941 2, 942 1, 943 2, 944 4, 945 9, 946 9, 947 55, 948 9, 949 266, 950 3, 951 10, 952 1, 953 2, 954 0, 955 49, 956 6, 957 4, 958 4, 959 14, 960 10, 961 5350, 962 0, 963 7, 964 14, 965 11465, 966 27, 967 2343, 968 9, 969 87, 970 9, 971 39, 972 4, 973 60, 974 6, 975 26, 976 9, 977 535, 978 9, 979 470, 980 0, 981 2, 982 54, 983 8, 984 3, 985 82, 986 0, 987 12, 988 1, 989 19628, 990 1, 991 4178, 992 9, 993 519, 994 45, 995 3, 996 22, 997 543, 998 4, 999 4, 1000 5, 1001 9, 1002 7, 1003 3, 1004 6, 1005 31, 1006 3, 1007 149, 1008 2, 1009 1418, 1010 49, 1011 513, 1012 54, 1013 5, 1014 49, 1015 9, 1016 0, 1017 15, 1018 0, 1019 23, 1020 4, 1021 2, 1022 14, 1023 1361, 1024 6, 1025 2, 1026 16, 1027 3, 1028 6, 1029 2, 1030 1, 1031 2, 1032 4, 1033 101, 1034 0, 1035 161, 1036 6, 1037 10, 1038 9, 1039 357, 1040 0, 1041 62, 1042 13, 1043 499, 1044 13, 1045 245, 1046 1, 1047 2, 1048 9, 1049 233, 1050 0, 1051 3, 1052 0, 1053 8, 1054 1, 1055 6, 1056 0, 1057 475, 1058 6, 1059 110, 1060 6, 1061 6, 1062 9, 1063 4759, 1064 9, 1065 787719, 1066 239 1067 ], ne = [ 1068 0, 1069 11, 1070 2, 1071 25, 1072 2, 1073 18, 1074 2, 1075 1, 1076 2, 1077 14, 1078 3, 1079 13, 1080 35, 1081 122, 1082 70, 1083 52, 1084 268, 1085 28, 1086 4, 1087 48, 1088 48, 1089 31, 1090 14, 1091 29, 1092 6, 1093 37, 1094 11, 1095 29, 1096 3, 1097 35, 1098 5, 1099 7, 1100 2, 1101 4, 1102 43, 1103 157, 1104 19, 1105 35, 1106 5, 1107 35, 1108 5, 1109 39, 1110 9, 1111 51, 1112 13, 1113 10, 1114 2, 1115 14, 1116 2, 1117 6, 1118 2, 1119 1, 1120 2, 1121 10, 1122 2, 1123 14, 1124 2, 1125 6, 1126 2, 1127 1, 1128 4, 1129 51, 1130 13, 1131 310, 1132 10, 1133 21, 1134 11, 1135 7, 1136 25, 1137 5, 1138 2, 1139 41, 1140 2, 1141 8, 1142 70, 1143 5, 1144 3, 1145 0, 1146 2, 1147 43, 1148 2, 1149 1, 1150 4, 1151 0, 1152 3, 1153 22, 1154 11, 1155 22, 1156 10, 1157 30, 1158 66, 1159 18, 1160 2, 1161 1, 1162 11, 1163 21, 1164 11, 1165 25, 1166 7, 1167 25, 1168 39, 1169 55, 1170 7, 1171 1, 1172 65, 1173 0, 1174 16, 1175 3, 1176 2, 1177 2, 1178 2, 1179 28, 1180 43, 1181 28, 1182 4, 1183 28, 1184 36, 1185 7, 1186 2, 1187 27, 1188 28, 1189 53, 1190 11, 1191 21, 1192 11, 1193 18, 1194 14, 1195 17, 1196 111, 1197 72, 1198 56, 1199 50, 1200 14, 1201 50, 1202 14, 1203 35, 1204 39, 1205 27, 1206 10, 1207 22, 1208 251, 1209 41, 1210 7, 1211 1, 1212 17, 1213 5, 1214 57, 1215 28, 1216 11, 1217 0, 1218 9, 1219 21, 1220 43, 1221 17, 1222 47, 1223 20, 1224 28, 1225 22, 1226 13, 1227 52, 1228 58, 1229 1, 1230 3, 1231 0, 1232 14, 1233 44, 1234 33, 1235 24, 1236 27, 1237 35, 1238 30, 1239 0, 1240 3, 1241 0, 1242 9, 1243 34, 1244 4, 1245 0, 1246 13, 1247 47, 1248 15, 1249 3, 1250 22, 1251 0, 1252 2, 1253 0, 1254 36, 1255 17, 1256 2, 1257 24, 1258 20, 1259 1, 1260 64, 1261 6, 1262 2, 1263 0, 1264 2, 1265 3, 1266 2, 1267 14, 1268 2, 1269 9, 1270 8, 1271 46, 1272 39, 1273 7, 1274 3, 1275 1, 1276 3, 1277 21, 1278 2, 1279 6, 1280 2, 1281 1, 1282 2, 1283 4, 1284 4, 1285 0, 1286 19, 1287 0, 1288 13, 1289 4, 1290 31, 1291 9, 1292 2, 1293 0, 1294 3, 1295 0, 1296 2, 1297 37, 1298 2, 1299 0, 1300 26, 1301 0, 1302 2, 1303 0, 1304 45, 1305 52, 1306 19, 1307 3, 1308 21, 1309 2, 1310 31, 1311 47, 1312 21, 1313 1, 1314 2, 1315 0, 1316 185, 1317 46, 1318 42, 1319 3, 1320 37, 1321 47, 1322 21, 1323 0, 1324 60, 1325 42, 1326 14, 1327 0, 1328 72, 1329 26, 1330 38, 1331 6, 1332 186, 1333 43, 1334 117, 1335 63, 1336 32, 1337 7, 1338 3, 1339 0, 1340 3, 1341 7, 1342 2, 1343 1, 1344 2, 1345 23, 1346 16, 1347 0, 1348 2, 1349 0, 1350 95, 1351 7, 1352 3, 1353 38, 1354 17, 1355 0, 1356 2, 1357 0, 1358 29, 1359 0, 1360 11, 1361 39, 1362 8, 1363 0, 1364 22, 1365 0, 1366 12, 1367 45, 1368 20, 1369 0, 1370 19, 1371 72, 1372 200, 1373 32, 1374 32, 1375 8, 1376 2, 1377 36, 1378 18, 1379 0, 1380 50, 1381 29, 1382 113, 1383 6, 1384 2, 1385 1, 1386 2, 1387 37, 1388 22, 1389 0, 1390 26, 1391 5, 1392 2, 1393 1, 1394 2, 1395 31, 1396 15, 1397 0, 1398 24, 1399 43, 1400 261, 1401 18, 1402 16, 1403 0, 1404 2, 1405 12, 1406 2, 1407 33, 1408 125, 1409 0, 1410 80, 1411 921, 1412 103, 1413 110, 1414 18, 1415 195, 1416 2637, 1417 96, 1418 16, 1419 1071, 1420 18, 1421 5, 1422 26, 1423 3994, 1424 6, 1425 582, 1426 6842, 1427 29, 1428 1763, 1429 568, 1430 8, 1431 30, 1432 18, 1433 78, 1434 18, 1435 29, 1436 19, 1437 47, 1438 17, 1439 3, 1440 32, 1441 20, 1442 6, 1443 18, 1444 433, 1445 44, 1446 212, 1447 63, 1448 33, 1449 24, 1450 3, 1451 24, 1452 45, 1453 74, 1454 6, 1455 0, 1456 67, 1457 12, 1458 65, 1459 1, 1460 2, 1461 0, 1462 15, 1463 4, 1464 10, 1465 7381, 1466 42, 1467 31, 1468 98, 1469 114, 1470 8702, 1471 3, 1472 2, 1473 6, 1474 2, 1475 1, 1476 2, 1477 290, 1478 16, 1479 0, 1480 30, 1481 2, 1482 3, 1483 0, 1484 15, 1485 3, 1486 9, 1487 395, 1488 2309, 1489 106, 1490 6, 1491 12, 1492 4, 1493 8, 1494 8, 1495 9, 1496 5991, 1497 84, 1498 2, 1499 70, 1500 2,
1501 1, 1502 3, 1503 0, 1504 3, 1505 1, 1506 3, 1507 3, 1508 2, 1509 11, 1510 2, 1511 0, 1512 2, 1513 6, 1514 2, 1515 64, 1516 2, 1517 3, 1518 3, 1519 7, 1520 2, 1521 6, 1522 2, 1523 27, 1524 2, 1525 3, 1526 2, 1527 4, 1528 2, 1529 0, 1530 4, 1531 6, 1532 2, 1533 339, 1534 3, 1535 24, 1536 2, 1537 24, 1538 2, 1539 30, 1540 2, 1541 24, 1542 2, 1543 30, 1544 2, 1545 24, 1546 2, 1547 30, 1548 2, 1549 24, 1550 2, 1551 30, 1552 2, 1553 24, 1554 2, 1555 7, 1556 1845, 1557 30, 1558 7, 1559 5, 1560 262, 1561 61, 1562 147, 1563 44, 1564 11, 1565 6, 1566 17, 1567 0, 1568 322, 1569 29, 1570 19, 1571 43, 1572 485, 1573 27, 1574 229, 1575 29, 1576 3, 1577 0, 1578 208, 1579 30, 1580 2, 1581 2, 1582 2, 1583 1, 1584 2, 1585 6, 1586 3, 1587 4, 1588 10, 1589 1, 1590 225, 1591 6, 1592 2, 1593 3, 1594 2, 1595 1, 1596 2, 1597 14, 1598 2, 1599 196, 1600 60, 1601 67, 1602 8, 1603 0, 1604 1205, 1605 3, 1606 2, 1607 26, 1608 2, 1609 1, 1610 2, 1611 0, 1612 3, 1613 0, 1614 2, 1615 9, 1616 2, 1617 3, 1618 2, 1619 0, 1620 2, 1621 0, 1622 7, 1623 0, 1624 5, 1625 0, 1626 2, 1627 0, 1628 2, 1629 0, 1630 2, 1631 2, 1632 2, 1633 1, 1634 2, 1635 0, 1636 3, 1637 0, 1638 2, 1639 0, 1640 2, 1641 0, 1642 2, 1643 0, 1644 2, 1645 0, 1646 2, 1647 1, 1648 2, 1649 0, 1650 3, 1651 3, 1652 2, 1653 6, 1654 2, 1655 3, 1656 2, 1657 3, 1658 2, 1659 0, 1660 2, 1661 9, 1662 2, 1663 16, 1664 6, 1665 2, 1666 2, 1667 4, 1668 2, 1669 16, 1670 4421, 1671 42719, 1672 33, 1673 4381, 1674 3, 1675 5773, 1676 3, 1677 7472, 1678 16, 1679 621, 1680 2467, 1681 541, 1682 1507, 1683 4938, 1684 6, 1685 8489 1686 ], ri = "ââ·Ì-ͯÎÒ-ÒÖ-Ö½Ö¿×××× ×Ø-ØÙ-٩ٰÛ-ÛÛ-Û¤Û§Û¨Ûª-ÛÛ°-Û¹Üܰ-ÝÞ¦-Þ°ß-ßß«-߽߳à -à à -à £à ¥-à §à ©-à à¡-à¡à¢-à¢à£-ࣣ࣡-à¤à¤º-़ा-à¥à¥-à¥à¥¢à¥£à¥¦-९à¦-à¦à¦¼à¦¾-à§à§à§à§-à§à§à§¢à§£à§¦-৯৾à¨-à¨à¨¼à¨¾-à©à©à©à©-à©à©à©¦-ੱੵàª-àªàª¼àª¾-à« à«-à«à«-à«à«¢à«£à«¦-૯ૺ-à«¿à¬-à¬à¬¼à¬¾-àààà-àà-àà¢à£à¦-à¯à®à®¾-à¯à¯-à¯à¯-à¯à¯à¯¦-௯à°-à°à°¼à°¾-à±à±-à±à±-à±à±à±à±¢à±£à±¦-౯à²-à²à²¼à²¾-à³à³-à³à³-à³à³à³à³¢à³£à³¦-೯ೳà´-à´à´»à´¼à´¾-àµàµ-àµàµ-àµàµàµ¢àµ£àµ¦-൯à¶-à¶à·à·-à·à·à·-à·à·¦-෯ෲෳัิ-ฺà¹-à¹à¹-à¹àº±àº´-ຼà»-à»à»-à»à¼à¼à¼ -༩༹༵༷༾༿ཱ-à¾à¾à¾à¾-à¾à¾-ྼà¿á«-á¾á-áá-áá-á á¢-á¤á§-áá±-á´á-áá-áá-áá©-á±á-áá²-á´ááá²á³á´-ááá -á©á -á á -á ᢩᤠ-ᤫᤰ-᤻á¥-á¥á§-á§á¨-á¨á©-á©á© -᩿᩼-áªáª-áªáª°-᪽ᪿ-á«á« -á««á¬-á¬á¬´-áá-áá«-á³á®-á®á®¡-á®á®°-᮹᯦-᯳ᰤ-á°·á±-á±á±-á±á³-á³á³-᳨á³á³´á³·-á³¹á·-á·¿âââ¿âââ-ââ¡â¥-â°â³¯-⵿⳱ⷠ-â·¿ãª-ã¯ããã»ê -ê©ê¯ê´-ê½êêê°ê±ê ê ê ê £-ê §ê ¬ê¢ê¢ê¢´-ê£ ê£-ê£ê£ -꣱ꣿ-ê¤ê¤¦-ê¤ê¥-ê¥ê¦-ê¦ê¦³-ê§ê§-ê§ê§¥ê§°-꧹ꨩ-ꨶê©ê©ê©ê©-ê©ê©»-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿ê«ê««-ꫯꫵ꫶ꯣ-ꯪ꯬ê¯ê¯°-꯹ï¬ï¸-ï¸ï¸ -︯︳︴ï¹-ï¹ï¼-ï¼ï¼¿ï½¥", oe = "ªµºÃ-ÃÃ-öø-ËË-ËË -ˤˬˮͰ-ʹͶͷͺ-ͽͿÎÎ-ÎÎÎ-ΡΣ-ϵϷ-ÒÒ-Ô¯Ô±-ÕÕÕ -Ö×-תׯ-×²Ø -Ùٮٯٱ-ÛÛÛ¥Û¦Û®Û¯Ûº-Û¼Û¿ÜÜ-ܯÝ-Þ¥Þ±ß-ߪߴߵߺà -à à à ¤à ¨à¡-à¡à¡ -ࡪࡰ-à¢à¢-à¢à¢ -à£à¤-हऽà¥à¥-ॡॱ-à¦à¦ -à¦à¦à¦à¦-নপ-রলশ-হঽà§à§à§à§-ৡৰৱৼਠ-à¨à¨à¨à¨-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹà©-à©à©à©²-ੴઠ-àªàª-àªàª-નપ-રલળવ-હઽà«à« ૡૹଠ-à¬à¬à¬à¬-ନପ-ରଲଳଵ-ହଽààà-à¡à±à®à® -à®à®-à®à®-à®à®à®à®à®à®à®£à®¤à®¨-பம-ஹà¯à° -à°à°-à°à°-నప-హఽà±-à±à±à±à± ౡà²à² -à²à²-à²à²-ನಪ-ಳವ-ಹಽà³-à³à³ ೡೱೲà´-à´à´-à´à´-ഺഽàµàµ-àµàµ-ൡൺ-ൿච-à¶à¶-නඳ-රලà·-à·à¸-ะาำà¹-à¹àºàºàºàº-àºàº-ຣລວ-ະາຳຽà»-à»à»à»-à»à¼à½-à½à½-ཬà¾-à¾á-áªá¿á-áá-áá¡á¥á¦á®-á°áµ-ááá -á ááá-áºá¼-áá-áá-ááá-áá -áá-áá-á°á²-áµá¸-á¾áá-á á-áá-áá-áá-áá-áá -áµá¸-á½á-á¬á¯-á¿á-áá -áªá®-á¸á-áá-á±á-áá -á¬á®-á°á-á³ááá -ᡸá¢-ᢨᢪᢰ-ᣵá¤-á¤á¥-á¥á¥°-ᥴá¦-ᦫᦰ-á§á¨-á¨á¨ -á©áª§á¬ -ᬳá -áá®-ᮠᮮᮯᮺ-ᯥá°-á°£á±-á±á±-á±½á²-á²á²-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺá´-á¶¿á¸-á¼á¼-á¼á¼ -á½ á½-á½á½-á½á½á½á½á½-á½½á¾-á¾´á¾¶-ᾼιá¿-á¿á¿-á¿á¿-á¿á¿-á¿á¿ -Ῥῲ-á¿´á¿¶-ῼâ±â¿â-ââââ-âââ-ââ¤â¦â¨âª-â¹â¼-â¿â -â â â -ââ°-ⳤⳫ-ⳮⳲⳳâ´-ⴥⴧâ´â´°-ⵧⵯâ¶-â¶â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-â¶¾â·-â·â·-â·â·-â·â·-â·ã -ãã¡-ã©ã±-ãµã¸-ã¼ã-ãã-ãã¡-ãºã¼-ã¿ã -ã¯ã±-ãã -ã¿ã°-ã¿ã-ä¶¿ä¸-êê-ê½ê-êê
1686-êêªê«ê-ê®ê¿-êê -ê¯ê-êê¢-êê-êê±-ê ê -ê ê -ê ê -ê ¢ê¡-ꡳê¢-ꢳꣲ-ꣷꣻꣽꣾê¤-ꤥꤰ-ê¥ê¥ -ꥼê¦-ꦲê§ê§ -ꧤꧦ-ꧯꧺ-ê§¾ê¨-ꨨê©-ê©ê©-ê©ê© -ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽê«ê«ê«-ê«ê« -ꫪꫲ-ê«´ê¬-ê¬ê¬-ê¬ê¬-ê¬ê¬ -ꬦꬨ-ꬮꬰ-êê-ê©ê°-ꯢê°-í£í°-íí-í»ï¤-ï©ï©°-ï«ï¬-ï¬ï¬-ï¬ï¬ï¬-ﬨשׁ-זּטּ-לּמּïïïïï-ï®±ï¯-ï´½ïµ-ï¶ï¶-ï·ï·°-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-ï½ï½¦-ï¾¾ï¿-ï¿ï¿-ï¿ï¿-ï¿ï¿-ï¿", Ft = { 1687 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", 1688 5: "class enum extends super const export import", 1689 6: "enum", 1690 strict: "implements interface let package private protected public static yield", 1691 strictBind: "eval arguments" 1692 }, Ut = "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", ai = { 1693 5: Ut, 1694 "5module": Ut + " export import", 1695 6: Ut + " const class extends export import super" 1696 }, he = /^in(stanceof)?$/, ni = new RegExp("[" + oe + "]"), oi = new RegExp("[" + oe + ri + "]"); 1697 function zt(t, e) { 1698 for (var i = 65536, s = 0; s < e.length; s += 2) { 1699 if (i += e[s], i > t) return !1; 1700 if (i += e[s + 1], i >= t) return !0; 1701 } 1702 return !1; 1703 } 1704 function G(t, e) { 1705 return t < 65 ? t === 36 : t < 91 ? !0 : t < 97 ? t === 95 : t < 123 ? !0 : t <= 65535 ? t >= 170 && ni.test(String.fromCharCode(t)) : e === !1 ? !1 : zt(t, ne); 1706 } 1707 function $(t, e) { 1708 return t < 48 ? t === 36 : t < 58 ? !0 : t < 65 ? !1 : t < 91 ? !0 : t < 97 ? t === 95 : t < 123 ? !0 : t <= 65535 ? t >= 170 && oi.test(String.fromCharCode(t)) : e === !1 ? !1 : zt(t, ne) || zt(t, si); 1709 } 1710 var b = function(e, i) { 1711 i === void 0 && (i = {}), this.label = e, 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; 1712 }; 1713 function B(t, e) { 1714 return new b(t, { 1715 beforeExpr: !0, 1716 binop: e 1717 }); 1718 } 1719 var D = { beforeExpr: !0 }, T = { startsExpr: !0 }, jt = {}; 1720 function S(t, e) { 1721 return e === void 0 && (e = {}), e.keyword = t, jt[t] = new b(t, e); 1722 } 1723 var a = { 1724 num: new b("num", T), 1725 regexp: new b("regexp", T), 1726 string: new b("string", T), 1727 name: new b("name", T), 1728 privateId: new b("privateId", T), 1729 eof: new b("eof"), 1730 bracketL: new b("[", { 1731 beforeExpr: !0, 1732 startsExpr: !0 1733 }), 1734 bracketR: new b("]"), 1735 braceL: new b("{", { 1736 beforeExpr: !0, 1737 startsExpr: !0 1738 }), 1739 braceR: new b("}"), 1740 parenL: new b("(", { 1741 beforeExpr: !0, 1742 startsExpr: !0 1743 }), 1744 parenR: new b(")"), 1745 comma: new b(",", D), 1746 semi: new b(";", D), 1747 colon: new b(":", D), 1748 dot: new b("."), 1749 question: new b("?", D), 1750 questionDot: new b("?."), 1751 arrow: new b("=>", D), 1752 template: new b("template"), 1753 invalidTemplate: new b("invalidTemplate"), 1754 ellipsis: new b("...", D), 1755 backQuote: new b("`", T), 1756 dollarBraceL: new b("${", { 1757 beforeExpr: !0, 1758 startsExpr: !0 1759 }), 1760 eq: new b("=", { 1761 beforeExpr: !0, 1762 isAssign: !0 1763 }), 1764 assign: new b("_=", { 1765 beforeExpr: !0, 1766 isAssign: !0 1767 }), 1768 incDec: new b("++/--", { 1769 prefix: !0, 1770 postfix: !0, 1771 startsExpr: !0 1772 }), 1773 prefix: new b("!/~", { 1774 beforeExpr: !0, 1775 prefix: !0, 1776 startsExpr: !0 1777 }), 1778 logicalOR: B("||", 1), 1779 logicalAND: B("&&", 2), 1780 bitwiseOR: B("|", 3), 1781 bitwiseXOR: B("^", 4), 1782 bitwiseAND: B("&", 5), 1783 equality: B("==/!=/===/!==", 6), 1784 relational: B("</>/<=/>=", 7), 1785 bitShift: B("<</>>/>>>", 8), 1786 plusMin: new b("+/-", { 1787 beforeExpr: !0, 1788 binop: 9, 1789 prefix: !0, 1790 startsExpr: !0 1791 }), 1792 modulo: B("%", 10), 1793 star: B("*", 10), 1794 slash: B("/", 10), 1795 starstar: new b("**", { beforeExpr: !0 }), 1796 coalesce: B("??", 1), 1797 _break: S("break"), 1798 _case: S("case", D), 1799 _catch: S("catch"), 1800 _continue: S("continue"), 1801 _debugger: S("debugger"), 1802 _default: S("default", D), 1803 _do: S("do", { 1804 isLoop: !0,
1805 beforeExpr: !0 1806 }), 1807 _else: S("else", D), 1808 _finally: S("finally"), 1809 _for: S("for", { isLoop: !0 }), 1810 _function: S("function", T), 1811 _if: S("if"), 1812 _return: S("return", D), 1813 _switch: S("switch"), 1814 _throw: S("throw", D), 1815 _try: S("try"), 1816 _var: S("var"), 1817 _const: S("const"), 1818 _while: S("while", { isLoop: !0 }), 1819 _with: S("with"), 1820 _new: S("new", { 1821 beforeExpr: !0, 1822 startsExpr: !0 1823 }), 1824 _this: S("this", T), 1825 _super: S("super", T), 1826 _class: S("class", T), 1827 _extends: S("extends", D), 1828 _export: S("export"), 1829 _import: S("import", T), 1830 _null: S("null", T), 1831 _true: S("true", T), 1832 _false: S("false", T), 1833 _in: S("in", { 1834 beforeExpr: !0, 1835 binop: 7 1836 }), 1837 _instanceof: S("instanceof", { 1838 beforeExpr: !0, 1839 binop: 7 1840 }), 1841 _typeof: S("typeof", { 1842 beforeExpr: !0, 1843 prefix: !0, 1844 startsExpr: !0 1845 }), 1846 _void: S("void", { 1847 beforeExpr: !0, 1848 prefix: !0, 1849 startsExpr: !0 1850 }), 1851 _delete: S("delete", { 1852 beforeExpr: !0, 1853 prefix: !0, 1854 startsExpr: !0 1855 }) 1856 }, V = /\r\n?|\n|\u2028|\u2029/, hi = new RegExp(V.source, "g"); 1857 function ht(t) { 1858 return t === 10 || t === 13 || t === 8232 || t === 8233; 1859 } 1860 function le(t, e, i) { 1861 i === void 0 && (i = t.length); 1862 for (var s = e; s < i; s++) { 1863 var r = t.charCodeAt(s); 1864 if (ht(r)) return s < i - 1 && r === 13 && t.charCodeAt(s + 1) === 10 ? s + 2 : s + 1; 1865 } 1866 return -1; 1867 } 1868 var ue = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, N = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, ce = Object.prototype, li = ce.hasOwnProperty, ui = ce.toString, lt = Object.hasOwn || (function(t, e) { 1869 return li.call(t, e); 1870 }), pe = Array.isArray || (function(t) { 1871 return ui.call(t) === "[object Array]"; 1872 }), fe = Object.create(null); 1873 function J(t) { 1874 return fe[t] || (fe[t] = new RegExp("^(?:" + t.replace(/ /g, "|") + ")$")); 1875 } 1876 function K(t) { 1877 return t <= 65535 ? String.fromCharCode(t) : (t -= 65536, String.fromCharCode((t >> 10) + 55296, (t & 1023) + 56320)); 1878 } 1879 var ci = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, ft = function(e, i) { 1880 this.line = e, this.column = i; 1881 }; 1882 ft.prototype.offset = function(e) { 1883 return new ft(this.line, this.column + e); 1884 }; 1885 var kt = function(e, i, s) { 1886 this.start = i, this.end = s, e.sourceFile !== null && (this.source = e.sourceFile); 1887 }; 1888 function de(t, e) { 1889 for (var i = 1, s = 0;;) { 1890 var r = le(t, s, e); 1891 if (r < 0) return new ft(i, e - s); 1892 ++i, s = r; 1893 } 1894 } 1895 var Ht = { 1896 ecmaVersion: null, 1897 sourceType: "script", 1898 strict: !1, 1899 onInsertedSemicolon: null, 1900 onTrailingComma: null, 1901 allowReserved: null, 1902 allowReturnOutsideFunction: !1, 1903 allowImportExportEverywhere: !1, 1904 allowAwaitOutsideFunction: null, 1905 allowSuperOutsideMethod: null, 1906 allowHashBang: !1, 1907 checkPrivateFields: !0, 1908 locations: !1, 1909 startLocation: null, 1910 onToken: null, 1911 onComment: null, 1912 ranges: !1, 1913 program: null, 1914 sourceFile: null, 1915 directSourceFile: null, 1916 preserveParens: !1 1917 }, me = !1; 1918 function pi(t) { 1919 var e = {}; 1920 for (var i in Ht) e[i] = t && lt(t, i) ? t[i] : Ht[i]; 1921 if (e.ecmaVersion === "latest" ? e.ecmaVersion = 1e8 : e.ecmaVersion == null ? (!me && typeof console == "object" && console.warn && (me = !0, console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. 1922Defaulting to 2020, but this will stop working in the future.`)), e.ecmaVersion = 11) : e.ecmaVersion >= 2015 && (e.ecmaVersion -= 2009), e.allowReserved == null && (e.allowReserved = e.ecmaVersion < 5), (!t || t.allowHashBang == null) && (e.allowHashBang = e.ecmaVersion >= 14), pe(e.onToken)) { 1923 var s = e.onToken; 1924 e.onToken = function(r) { 1925 return s.push(r); 1926 }; 1927 } 1928 if (pe(e.onComment) && (e.onComment = fi(e, e.onComment)), e.sourceType === "commonjs" && e.allowAwaitOutsideFunction) throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs"); 1929 return e; 1930 } 1931 function fi(t, e) { 1932 return function(i, s, r, o, n, h) { 1933 var l = { 1934 type: i ? "Block" : "Line", 1935 value: s, 1936 start: r, 1937 end: o 1938 }; 1939 t.locations && (l.loc = new kt(this, n, h)), t.ranges && (l.range = [r, o]), e.push(l); 1940 }; 1941 } 1942 var it = 1, st = 2, Gt = 4, ge = 8, Wt = 16, ve = 32, Ct = 64, ye = 128, rt = 256, dt = 512, xe = 1024, Et = it | st | rt; 1943 function Kt(t, e) { 1944 return st | (t ? Gt : 0) | (e ? ge : 0); 1945 } 1946 var Pt = 0, Qt = 1, Q = 2, _e = 3, Se = 4, be = 5, A = function(e, i, s) { 1947 this.options = e = pi(e), this.sourceFile = e.sourceFile, this.keywords = J(ai[e.ecmaVersion >= 6 ? 6 : e.sourceType === "module" ? "5module" : 5]); 1948 var r = ""; 1949 e.allowReserved !== !0 && (r = Ft[e.ecmaVersion >= 6 ? 6 : e.ecmaVersion === 5 ? 5 : 3], e.sourceType === "module" && (r += " await")), this.reservedWords = J(r); 1950 var o = (r ? r + " " : "") + Ft.strict; 1951 this.reservedWordsStrict = J(o), this.reservedWordsStrictBind = J(o + " " + Ft.strictBind), this.input = String(i), this.containsEsc = !1, this.pos = s || 0, this.curLine = 1, e.startLocation ? (this.lineStart = this.pos - e.startLocation.column, this.curLine = e.startLocation.line) : s ? (this.lineStart = this.input.lastIndexOf(` 1952`, s - 1) + 1, this.options.locations && (this.curLine = this.input.slice(0, this.lineStart).split(V).length)) : this.lineStart = 0, this.type = a.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 = e.sourceType === "module", this.strict = this.inModule || e.strict === !0 || 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 && e.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ? st : it), this.regexpState = null, this.privateNameStack = []; 1953 }, q = { 1954 inFunction: { configurable: !0 },
1955 inGenerator: { configurable: !0 }, 1956 inAsync: { configurable: !0 }, 1957 canAwait: { configurable: !0 }, 1958 allowReturn: { configurable: !0 }, 1959 allowSuper: { configurable: !0 }, 1960 allowDirectSuper: { configurable: !0 }, 1961 treatFunctionsAsVar: { configurable: !0 }, 1962 allowNewDotTarget: { configurable: !0 }, 1963 allowUsing: { configurable: !0 }, 1964 inClassStaticBlock: { configurable: !0 } 1965 }; 1966 A.prototype.parse = function() { 1967 var e = this, i = this.options.program || this.startNode(); 1968 return this.nextToken(), this.catchStackOverflow(function() { 1969 return e.parseTopLevel(i); 1970 }); 1971 }, q.inFunction.get = function() { 1972 return (this.currentVarScope().flags & st) > 0; 1973 }, q.inGenerator.get = function() { 1974 return (this.currentVarScope().flags & ge) > 0; 1975 }, q.inAsync.get = function() { 1976 return (this.currentVarScope().flags & Gt) > 0; 1977 }, q.canAwait.get = function() { 1978 for (var t = this.scopeStack.length - 1; t >= 0; t--) { 1979 var e = this.scopeStack[t].flags; 1980 if (e & (rt | dt)) return !1; 1981 if (e & st) return (e & Gt) > 0; 1982 } 1983 return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction; 1984 }, q.allowReturn.get = function() { 1985 return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & it); 1986 }, q.allowSuper.get = function() { 1987 return (this.currentThisScope().flags & Ct) > 0 || this.options.allowSuperOutsideMethod; 1988 }, q.allowDirectSuper.get = function() { 1989 return (this.currentThisScope().flags & ye) > 0; 1990 }, q.treatFunctionsAsVar.get = function() { 1991 return this.treatFunctionsAsVarInScope(this.currentScope()); 1992 }, q.allowNewDotTarget.get = function() { 1993 for (var t = this.scopeStack.length - 1; t >= 0; t--) { 1994 var e = this.scopeStack[t].flags; 1995 if (e & (rt | dt) || e & st && !(e & Wt)) return !0; 1996 } 1997 return !1; 1998 }, q.allowUsing.get = function() { 1999 var t = this.currentScope().flags; 2000 return !(t & xe || !this.inModule && t & it); 2001 }, q.inClassStaticBlock.get = function() { 2002 return (this.currentVarScope().flags & rt) > 0; 2003 }, A.extend = function() { 2004 for (var e = [], i = arguments.length; i--;) e[i] = arguments[i]; 2005 for (var s = this, r = 0; r < e.length; r++) s = e[r](s); 2006 return s; 2007 }, A.parse = function(e, i) { 2008 return new this(i, e).parse(); 2009 }, A.parseExpressionAt = function(e, i, s) { 2010 var r = new this(s, e, i); 2011 return r.nextToken(), r.parseExpression(); 2012 }, A.tokenizer = function(e, i) { 2013 return new this(i, e); 2014 }, Object.defineProperties(A.prototype, q); 2015 var L = A.prototype, di = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/; 2016 L.strictDirective = function(t) { 2017 if (this.options.ecmaVersion < 5) return !1; 2018 for (;;) { 2019 N.lastIndex = t, t += N.exec(this.input)[0].length; 2020 var e = di.exec(this.input.slice(t)); 2021 if (!e) return !1; 2022 if ((e[1] || e[2]) === "use strict") { 2023 N.lastIndex = t + e[0].length; 2024 var i = N.exec(this.input), s = i.index + i[0].length, r = this.input.charAt(s); 2025 return r === ";" || r === "}" || V.test(i[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(r) || r === "!" && this.input.charAt(s + 1) === "="); 2026 } 2027 t += e[0].length, N.lastIndex = t, t += N.exec(this.input)[0].length, this.input[t] === ";" && t++; 2028 } 2029 }, L.eat = function(t) { 2030 return this.type === t ? (this.next(), !0) : !1; 2031 }, L.isContextual = function(t) { 2032 return this.type === a.name && this.value === t && !this.containsEsc; 2033 }, L.eatContextual = function(t) { 2034 return this.isContextual(t) ? (this.next(), !0) : !1; 2035 }, L.catchStackOverflow = function(t) { 2036 try { 2037 return t(); 2038 } catch (e) { 2039 if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) this.raise(this.start, "Not enough stack space to parse input"); 2040 else throw e; 2041 } 2042 }, L.expectContextual = function(t) { 2043 this.eatContextual(t) || this.unexpected(); 2044 }, L.canInsertSemicolon = function() { 2045 return this.type === a.eof || this.type === a.braceR || V.test(this.input.slice(this.lastTokEnd, this.start)); 2046 }, L.insertSemicolon = function() { 2047 if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0; 2048 }, L.semicolon = function() { 2049 !this.eat(a.semi) && !this.insertSemicolon() && this.unexpected(); 2050 }, L.afterTrailingComma = function(t, e) {
2051 if (this.type === t) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), e || this.next(), !0; 2052 }, L.expect = function(t) { 2053 this.eat(t) || this.unexpected(); 2054 }, L.unexpected = function(t) { 2055 this.raise(t ?? this.start, "Unexpected token"); 2056 }; 2057 var At = function() { 2058 this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; 2059 }; 2060 L.checkPatternErrors = function(t, e) { 2061 if (t) { 2062 t.trailingComma > -1 && this.raiseRecoverable(t.trailingComma, "Comma is not permitted after the rest element"); 2063 var i = e ? t.parenthesizedAssign : t.parenthesizedBind; 2064 i > -1 && this.raiseRecoverable(i, e ? "Assigning to rvalue" : "Parenthesized pattern"); 2065 } 2066 }, L.checkExpressionErrors = function(t, e) { 2067 if (!t) return !1; 2068 var i = t.shorthandAssign, s = t.doubleProto; 2069 if (!e) return i >= 0 || s >= 0; 2070 i >= 0 && this.raise(i, "Shorthand property assignments are valid only in destructuring patterns"), s >= 0 && this.raiseRecoverable(s, "Redefinition of __proto__ property"); 2071 }, L.checkYieldAwaitInDefaultParams = function() { 2072 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"); 2073 }, L.isSimpleAssignTarget = function(t) { 2074 return t.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(t.expression) : t.type === "Identifier" || t.type === "MemberExpression"; 2075 }; 2076 var d = A.prototype; 2077 d.parseTopLevel = function(t) { 2078 var e = Object.create(null); 2079 for (t.body || (t.body = []); this.type !== a.eof;) { 2080 var i = this.parseStatement(null, !0, e); 2081 t.body.push(i); 2082 } 2083 if (this.inModule) for (var s = 0, r = Object.keys(this.undefinedExports); s < r.length; s += 1) { 2084 var o = r[s]; 2085 this.raiseRecoverable(this.undefinedExports[o].start, "Export '" + o + "' is not defined"); 2086 } 2087 return this.adaptDirectivePrologue(t.body), this.next(), t.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(t, "Program"); 2088 }; 2089 var Yt = { kind: "loop" }, mi = { kind: "switch" }; 2090 d.isLet = function(t) { 2091 if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1; 2092 N.lastIndex = this.pos; 2093 var e = N.exec(this.input), i = this.pos + e[0].length, s = this.fullCharCodeAt(i); 2094 if (s === 91 || s === 92) return !0; 2095 if (t) return !1; 2096 if (s === 123) return !0; 2097 if (G(s)) { 2098 var r = i; 2099 do 2100 i += s <= 65535 ? 1 : 2; 2101 while ($(s = this.fullCharCodeAt(i))); 2102 if (s === 92) return !0; 2103 var o = this.input.slice(r, i); 2104 if (!he.test(o)) return !0; 2105 } 2106 return !1; 2107 }, d.isAsyncFunction = function() { 2108 if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1; 2109 N.lastIndex = this.pos; 2110 var t = N.exec(this.input), e = this.pos + t[0].length, i; 2111 return !V.test(this.input.slice(this.pos, e)) && this.input.slice(e, e + 8) === "function" && (e + 8 === this.input.length || !($(i = this.fullCharCodeAt(e + 8)) || i === 92)); 2112 }, d.isUsingKeyword = function(t, e) { 2113 if (this.options.ecmaVersion < 17 || !this.isContextual(t ? "await" : "using")) return !1; 2114 N.lastIndex = this.pos; 2115 var i = N.exec(this.input), s = this.pos + i[0].length; 2116 if (V.test(this.input.slice(this.pos, s))) return !1; 2117 if (t) { 2118 var r = s + 5, o; 2119 if (this.input.slice(s, r) !== "using" || r === this.input.length || $(o = this.fullCharCodeAt(r)) || o === 92) return !1; 2120 N.lastIndex = r; 2121 var n = N.exec(this.input); 2122 if (s = r + n[0].length, n && V.test(this.input.slice(r, s))) return !1; 2123 } 2124 var h = this.fullCharCodeAt(s); 2125 if (!G(h) && h !== 92) return !1; 2126 var l = s; 2127 do 2128 s += h <= 65535 ? 1 : 2; 2129 while ($(h = this.fullCharCodeAt(s))); 2130 if (h === 92) return !0; 2131 var u = this.input.slice(l, s); 2132 if (he.test(u)) return !1; 2133 if (e && !t && u === "of") { 2134 N.lastIndex = s; 2135 var c = N.exec(this.input); 2136 if (s = s + c[0].length, this.input.charCodeAt(s) !== 61 || (h = this.input.charCodeAt(s + 1)) === 61 || h === 62) return !1; 2137 } 2138 return !0; 2139 }, d.isAwaitUsing = function(t) { 2140 return this.isUsingKeyword(!0, t); 2141 }, d.isUsing = function(t) { 2142 return this.isUsingKeyword(!1, t); 2143 }, d.parseStatement = function(t, e, i) { 2144 var s = this.type, r = this.startNode(), o; 2145 switch (this.isLet(t) && (s = a._var, o = "let"), s) { 2146 case a._break:
2147 case a._continue: return this.parseBreakContinueStatement(r, s.keyword); 2148 case a._debugger: return this.parseDebuggerStatement(r); 2149 case a._do: return this.parseDoStatement(r); 2150 case a._for: return this.parseForStatement(r); 2151 case a._function: return t && (this.strict || t !== "if" && t !== "label") && this.options.ecmaVersion >= 6 && this.unexpected(), this.parseFunctionStatement(r, !1, !t); 2152 case a._class: return t && this.unexpected(), this.parseClass(r, !0); 2153 case a._if: return this.parseIfStatement(r); 2154 case a._return: return this.parseReturnStatement(r); 2155 case a._switch: return this.parseSwitchStatement(r); 2156 case a._throw: return this.parseThrowStatement(r); 2157 case a._try: return this.parseTryStatement(r); 2158 case a._const: 2159 case a._var: return o = o || this.value, t && o !== "var" && this.unexpected(), this.parseVarStatement(r, o); 2160 case a._while: return this.parseWhileStatement(r); 2161 case a._with: return this.parseWithStatement(r); 2162 case a.braceL: return this.parseBlock(!0, r); 2163 case a.semi: return this.parseEmptyStatement(r); 2164 case a._export: 2165 case a._import: 2166 if (this.options.ecmaVersion > 10 && s === a._import) { 2167 N.lastIndex = this.pos; 2168 var n = N.exec(this.input), h = this.pos + n[0].length, l = this.input.charCodeAt(h); 2169 if (l === 40 || l === 46) return this.parseExpressionStatement(r, this.parseExpression()); 2170 } 2171 return this.options.allowImportExportEverywhere || (e || 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'")), s === a._import ? this.parseImport(r) : this.parseExport(r, i); 2172 default: 2173 if (this.isAsyncFunction()) return t && this.unexpected(), this.next(), this.parseFunctionStatement(r, !0, !t); 2174 var u = this.isAwaitUsing(!1) ? "await using" : this.isUsing(!1) ? "using" : null; 2175 if (u) return this.allowUsing || this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"), t && this.raise(this.start, "Using declaration is not allowed in single-statement positions"), u === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.next(), this.parseVar(r, !1, u), this.semicolon(), this.finishNode(r, "VariableDeclaration"); 2176 var c = this.value, p = this.parseExpression(); 2177 return s === a.name && p.type === "Identifier" && this.eat(a.colon) ? this.parseLabeledStatement(r, c, p, t) : this.parseExpressionStatement(r, p); 2178 } 2179 }, d.parseBreakContinueStatement = function(t, e) { 2180 var i = e === "break"; 2181 this.next(), this.eat(a.semi) || this.insertSemicolon() ? t.label = null : this.type !== a.name ? this.unexpected() : (t.label = this.parseIdent(), this.semicolon()); 2182 for (var s = 0; s < this.labels.length; ++s) { 2183 var r = this.labels[s]; 2184 if ((t.label == null || r.name === t.label.name) && (r.kind != null && (i || r.kind === "loop") || t.label && i)) break; 2185 } 2186 return s === this.labels.length && this.raise(t.start, "Unsyntactic " + e), this.finishNode(t, i ? "BreakStatement" : "ContinueStatement"); 2187 }, d.parseDebuggerStatement = function(t) { 2188 return this.next(), this.semicolon(), this.finishNode(t, "DebuggerStatement"); 2189 }, d.parseDoStatement = function(t) { 2190 return this.next(), this.labels.push(Yt), t.body = this.parseStatement("do"), this.labels.pop(), this.expect(a._while), t.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(a.semi) : this.semicolon(), this.finishNode(t, "DoWhileStatement"); 2191 }, d.parseForStatement = function(t) { 2192 this.next(); 2193 var e = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; 2194 if (this.labels.push(Yt), this.enterScope(0), this.expect(a.parenL), this.type === a.semi) return e > -1 && this.unexpected(e), this.parseFor(t, null); 2195 var i = this.isLet(); 2196 if (this.type === a._var || this.type === a._const || i) { 2197 var s = this.startNode(), r = i ? "let" : this.value; 2198 return this.next(), this.parseVar(s, !0, r), this.finishNode(s, "VariableDeclaration"), this.parseForAfterInit(t, s, e); 2199 } 2200 var o = this.isContextual("let"), n = !1, h = this.isUsing(!0) ? "using" : this.isAwaitUsing(!0) ? "await using" : null; 2201 if (h) { 2202 var l = this.startNode(); 2203 return this.next(), h === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.parseVar(l, !0, h), this.finishNode(l, "VariableDeclaration"), this.parseForAfterInit(t, l, e); 2204 } 2205 var u = this.containsEsc, c = new At(), p = this.start, x = e > -1 ? this.parseExprSubscripts(c, "await") : this.parseExpression(!0, c); 2206 return this.type === a._in || (n = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (e >
2206 -1 ? (this.type === a._in && this.unexpected(e), t.await = !0) : n && this.options.ecmaVersion >= 8 && (x.start === p && !u && x.type === "Identifier" && x.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (t.await = !1)), o && n && this.raise(x.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(x, !1, c), this.checkLValPattern(x), this.parseForIn(t, x)) : (this.checkExpressionErrors(c, !0), e > -1 && this.unexpected(e), this.parseFor(t, x)); 2207 }, d.parseForAfterInit = function(t, e, i) { 2208 return (this.type === a._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && e.declarations.length === 1 ? (this.type === a._in ? ((e.kind === "using" || e.kind === "await using") && !e.declarations[0].init && this.raise(this.start, "Using declaration is not allowed in for-in loops"), this.options.ecmaVersion >= 9 && i > -1 && this.unexpected(i)) : this.options.ecmaVersion >= 9 && (t.await = i > -1), this.parseForIn(t, e)) : (i > -1 && this.unexpected(i), this.parseFor(t, e)); 2209 }, d.parseFunctionStatement = function(t, e, i) { 2210 return this.next(), this.parseFunction(t, mt | (i ? 0 : Xt), !1, e); 2211 }, d.parseIfStatement = function(t) { 2212 return this.next(), t.test = this.parseParenExpression(), t.consequent = this.parseStatement("if"), t.alternate = this.eat(a._else) ? this.parseStatement("if") : null, this.finishNode(t, "IfStatement"); 2213 }, d.parseReturnStatement = function(t) { 2214 return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(a.semi) || this.insertSemicolon() ? t.argument = null : (t.argument = this.parseExpression(), this.semicolon()), this.finishNode(t, "ReturnStatement"); 2215 }, d.parseSwitchStatement = function(t) { 2216 this.next(), t.discriminant = this.parseParenExpression(), t.cases = [], this.expect(a.braceL), this.labels.push(mi), this.enterScope(xe); 2217 for (var e, i = !1; this.type !== a.braceR;) if (this.type === a._case || this.type === a._default) { 2218 var s = this.type === a._case; 2219 e && this.finishNode(e, "SwitchCase"), t.cases.push(e = this.startNode()), e.consequent = [], this.next(), s ? e.test = this.parseExpression() : (i && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), i = !0, e.test = null), this.expect(a.colon); 2220 } else e || this.unexpected(), e.consequent.push(this.parseStatement(null)); 2221 return this.exitScope(), e && this.finishNode(e, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(t, "SwitchStatement"); 2222 }, d.parseThrowStatement = function(t) { 2223 return this.next(), V.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), t.argument = this.parseExpression(), this.semicolon(), this.finishNode(t, "ThrowStatement"); 2224 }; 2225 var gi = []; 2226 d.parseCatchClauseParam = function() { 2227 var t = this.parseBindingAtom(), e = t.type === "Identifier"; 2228 return this.enterScope(e ? ve : 0), this.checkLValPattern(t, e ? Se : Q), this.expect(a.parenR), t; 2229 }, d.parseTryStatement = function(t) { 2230 if (this.next(), t.block = this.parseBlock(), t.handler = null, this.type === a._catch) { 2231 var e = this.startNode(); 2232 this.next(), this.eat(a.parenL) ? e.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), e.param = null, this.enterScope(0)), e.body = this.parseBlock(!1), this.exitScope(), t.handler = this.finishNode(e, "CatchClause"); 2233 } 2234 return t.finalizer = this.eat(a._finally) ? this.parseBlock() : null, !t.handler && !t.finalizer && this.raise(t.start, "Missing catch or finally clause"), this.finishNode(t, "TryStatement"); 2235 }, d.parseVarStatement = function(t, e, i) { 2236 return this.next(), this.parseVar(t, !1, e, i), this.semicolon(), this.finishNode(t, "VariableDeclaration"); 2237 }, d.parseWhileStatement = function(t) { 2238 return this.next(), t.test = this.parseParenExpression(), this.labels.push(Yt), t.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(t, "WhileStatement"); 2239 }, d.parseWithStatement = function(t) { 2240 return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), t.object = this.parseParenExpression(), t.body = this.parseStatement
2240("with"), this.finishNode(t, "WithStatement"); 2241 }, d.parseEmptyStatement = function(t) { 2242 return this.next(), this.finishNode(t, "EmptyStatement"); 2243 }, d.parseLabeledStatement = function(t, e, i, s) { 2244 for (var r = 0, o = this.labels; r < o.length; r += 1) o[r].name === e && this.raise(i.start, "Label '" + e + "' is already declared"); 2245 for (var n = this.type.isLoop ? "loop" : this.type === a._switch ? "switch" : null, h = this.labels.length - 1; h >= 0; h--) { 2246 var l = this.labels[h]; 2247 if (l.statementStart === t.start) l.statementStart = this.start, l.kind = n; 2248 else break; 2249 } 2250 return this.labels.push({ 2251 name: e, 2252 kind: n, 2253 statementStart: this.start 2254 }), t.body = this.parseStatement(s ? s.indexOf("label") === -1 ? s + "label" : s : "label"), this.labels.pop(), t.label = i, this.finishNode(t, "LabeledStatement"); 2255 }, d.parseExpressionStatement = function(t, e) { 2256 return t.expression = e, this.semicolon(), this.finishNode(t, "ExpressionStatement"); 2257 }, d.parseBlock = function(t, e, i) { 2258 for (t === void 0 && (t = !0), e === void 0 && (e = this.startNode()), e.body = [], this.expect(a.braceL), t && this.enterScope(0); this.type !== a.braceR;) { 2259 var s = this.parseStatement(null); 2260 e.body.push(s); 2261 } 2262 return i && (this.strict = !1), this.next(), t && this.exitScope(), this.finishNode(e, "BlockStatement"); 2263 }, d.parseFor = function(t, e) { 2264 return t.init = e, this.expect(a.semi), t.test = this.type === a.semi ? null : this.parseExpression(), this.expect(a.semi), t.update = this.type === a.parenR ? null : this.parseExpression(), this.expect(a.parenR), t.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(t, "ForStatement"); 2265 }, d.parseForIn = function(t, e) { 2266 var i = this.type === a._in; 2267 return this.next(), e.type === "VariableDeclaration" && e.declarations[0].init != null && (!i || this.options.ecmaVersion < 8 || this.strict || e.kind !== "var" || e.declarations[0].id.type !== "Identifier") && this.raise(e.start, (i ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"), t.left = e, t.right = i ? this.parseExpression() : this.parseMaybeAssign(), this.expect(a.parenR), t.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(t, i ? "ForInStatement" : "ForOfStatement"); 2268 }, d.parseVar = function(t, e, i, s) { 2269 for (t.declarations = [], t.kind = i;;) { 2270 var r = this.startNode(); 2271 if (this.parseVarId(r, i), this.eat(a.eq) ? r.init = this.parseMaybeAssign(e) : !s && i === "const" && !(this.type === a._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !s && (i === "using" || i === "await using") && this.options.ecmaVersion >= 17 && this.type !== a._in && !this.isContextual("of") ? this.raise(this.lastTokEnd, "Missing initializer in " + i + " declaration") : !s && r.id.type !== "Identifier" && !(e && (this.type === a._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : r.init = null, t.declarations.push(this.finishNode(r, "VariableDeclarator")), !this.eat(a.comma)) break; 2272 } 2273 return t; 2274 }, d.parseVarId = function(t, e) { 2275 t.id = e === "using" || e === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(t.id, e === "var" ? Qt : Q, !1); 2276 }; 2277 var mt = 1, Xt = 2, we = 4; 2278 d.parseFunction = function(t, e, i, s, r) { 2279 this.initFunction(t), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !s) && (this.type === a.star && e & Xt && this.unexpected(), t.generator = this.eat(a.star)), this.options.ecmaVersion >= 8 && (t.async = !!s), e & mt && (t.id = e & we && this.type !== a.name ? null : this.parseIdent(), t.id && !(e & Xt) && this.checkLValSimple(t.id, this.strict || t.generator || t.async ? this.treatFunctionsAsVar ? Qt : Q : _e)); 2280 var o = this.yieldPos, n = this.awaitPos, h = this.awaitIdentPos; 2281 return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Kt(t.async, t.generator)), e & mt || (t.id = this.type === a.name ? this.parseIdent() : null), this.parseFunctionParams(t), this.parseFunctionBody(t, i, !1, r), this.yieldPos = o, this.awaitPos = n, this.awaitIdentPos = h, this.finishNode(t, e & mt ? "FunctionDeclaration" : "FunctionExpression"); 2282 }, d.parseFunctionParams = function(t) { 2283 this.expect(a.parenL), t.params = this.parseBindingList(a.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(); 2284 }, d.parseClass = function(t, e) { 2285 this.next(); 2286 var i = this.strict; 2287 this.strict = !0, this.parseClassId(t, e), this.parseClassSuper(t); 2288 var s = this.enterClassBody(), r = this.startNode(), o = !1; 2289 for (r.body = [], this.expect(a.braceL); this.type !== a.braceR;) { 2290 var n = this.parseClassElement(t.superClass !== null); 2291 n && (r.body.push(n), n.type === "MethodDefinition" && n.kind === "constructor" ? (o && this.raiseRecoverable(n.start, "Duplicate constructor in the same class"), o = !0) : n.key && n.key.type === "PrivateIdentifier" && vi(s, n) && this.raiseRecoverable(n.key.start, "Identifier '#" + n.key.name + "' has already been declared")); 2292 } 2293 return this.strict = i, this.next(), t.body = this.finishNode(r, "ClassBody"), this.exitClassBody(), this.finishNode(t, e ? "ClassDeclaration" : "ClassExpression"); 2294 }, d.parseClassElement = function(t) { 2295 if (this.eat(a.semi)) return null; 2296 var e = this.options.ecmaVersion, i = this.startNode(), s = "", r = !1, o = !1, n = "method", h = !1; 2297 if (this.eatContextual("static")) { 2298 if (e >= 13 && this.eat(a.braceL)) return this.parseClassStaticBlock(i), i; 2299 this.isClassElementNameStart() || this.type === a.star ? h = !0 : s = "static"; 2300 } 2301 if (i.static = h, !s && e >= 8 && this.eatContextual("async") && ((this.isClassElementNameStart() || this.type === a.star) && !this.canInsertSemicolon() ? o = !0 : s = "async"), !s && (e >= 9 || !o) && this.eat(a.star) && (r = !0), !s && !o && !r) { 2302 var l = this.value; 2303 (this.eatContextual("get") || this.eatContextual("set")) && (this.isClassElementNameStart() ? n = l : s = l); 2304 } 2305 if (s ? (i.computed = !1, i.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), i.key.name = s, this.finishNode(i.key, "Identifier")) : this.parseClassElementName(i), e < 13 || this.type === a.parenL || n !== "method" || r || o) { 2306 var u = !i.static && It(i, "constructor"), c = u && t; 2307 u && n !== "method" && this.raise(i.key.start, "Constructor can't have get/set modifier"), i.kind = u ? "constructor" : n, this.parseClassMethod(i, r, o, c); 2308 } else this.parseClassField(i); 2309 return i; 2310 }, d.isClassElementNameStart = function() { 2311 return this.type === a.name || this.type === a.privateId || this.type === a.num || this.type === a.string || this.type === a.bracketL || this.type.keyword; 2312 }, d.parseClassElementName = function(t) { 2313 this.type === a.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), t.computed = !1, t.key = this.parsePrivateIdent()) : this.parsePropertyName(t); 2314 }, d.parseClassMethod = function(t, e, i, s) { 2315 var r = t.key; 2316 t.kind === "constructor" ? (e && this.raise(r.start, "Constructor can't be a generator"), i && this.raise(r.start, "Constructor can't be an async method")) : t.static && It(t, "prototype") && this.raise(r.start, "Classes may not have a static property named prototype"); 2317 var o = t.value = this.parseMethod(e, i, s); 2318 return t.kind === "get" && o.params.length !== 0 && this.raiseRecoverable(o.start, "getter should have no params"), t.kind === "set" && o.params.length !== 1 && this.raiseRecoverable(o.start, "setter should have exactly one param"), t.kind === "set" && o.params[0].type === "RestElement" && this.raiseRecoverable(o.params[0].start, "Setter cannot use rest params"), this.finishNode(t, "MethodDefinition"); 2319 }, d.parseClassField = function(t) { 2320 return It(t, "constructor") ? this.raise(t.key.start, "Classes can't have a field named 'constructor'") : t.static && It(t, "prototype") && this.raise(t.key.start, "Classes can't have a static field named 'prototype'"), this.eat(a.eq) ? (this.enterScope(dt | Ct), t.value = this.parseMaybeAssign(), this.exitScope()) : t.value = null, this.semicolon(), this.finishNode(t, "PropertyDefinition"); 2321 }, d.parseClassStaticBlock = function(t) { 2322 t.body = []; 2323 var e = this.labels; 2324 for (this.labels = [], this.enterScope(rt | Ct); this.type !== a.braceR;) {
2325 var i = this.parseStatement(null); 2326 t.body.push(i); 2327 } 2328 return this.next(), this.exitScope(), this.labels = e, this.finishNode(t, "StaticBlock"); 2329 }, d.parseClassId = function(t, e) { 2330 this.type === a.name ? (t.id = this.parseIdent(), e && this.checkLValSimple(t.id, Q, !1)) : (e === !0 && this.unexpected(), t.id = null); 2331 }, d.parseClassSuper = function(t) { 2332 t.superClass = this.eat(a._extends) ? this.parseExprSubscripts(null, !1) : null; 2333 }, d.enterClassBody = function() { 2334 var t = { 2335 declared: Object.create(null), 2336 used: [] 2337 }; 2338 return this.privateNameStack.push(t), t.declared; 2339 }, d.exitClassBody = function() { 2340 var t = this.privateNameStack.pop(), e = t.declared, i = t.used; 2341 if (this.options.checkPrivateFields) for (var s = this.privateNameStack.length, r = s === 0 ? null : this.privateNameStack[s - 1], o = 0; o < i.length; ++o) { 2342 var n = i[o]; 2343 lt(e, n.name) || (r ? r.used.push(n) : this.raiseRecoverable(n.start, "Private field '#" + n.name + "' must be declared in an enclosing class")); 2344 } 2345 }; 2346 function vi(t, e) { 2347 var i = e.key.name, s = t[i], r = "true"; 2348 return e.type === "MethodDefinition" && (e.kind === "get" || e.kind === "set") && (r = (e.static ? "s" : "i") + e.kind), s === "iget" && r === "iset" || s === "iset" && r === "iget" || s === "sget" && r === "sset" || s === "sset" && r === "sget" ? (t[i] = "true", !1) : s ? !0 : (t[i] = r, !1); 2349 } 2350 function It(t, e) { 2351 var i = t.computed, s = t.key; 2352 return !i && (s.type === "Identifier" && s.name === e || s.type === "Literal" && s.value === e); 2353 } 2354 d.parseExportAllDeclaration = function(t, e) { 2355 return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (t.exported = this.parseModuleExportName(), this.checkExport(e, t.exported, this.lastTokStart)) : t.exported = null), this.expectContextual("from"), this.type !== a.string && this.unexpected(), t.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (t.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(t, "ExportAllDeclaration"); 2356 }, d.parseExport = function(t, e) { 2357 if (this.next(), this.eat(a.star)) return this.parseExportAllDeclaration(t, e); 2358 if (this.eat(a._default)) return this.checkExport(e, "default", this.lastTokStart), t.declaration = this.parseExportDefaultDeclaration(), this.finishNode(t, "ExportDefaultDeclaration"); 2359 if (this.shouldParseExportStatement()) t.declaration = this.parseExportDeclaration(t), t.declaration.type === "VariableDeclaration" ? this.checkVariableExport(e, t.declaration.declarations) : this.checkExport(e, t.declaration.id, t.declaration.id.start), t.specifiers = [], t.source = null, this.options.ecmaVersion >= 16 && (t.attributes = []); 2360 else { 2361 if (t.declaration = null, t.specifiers = this.parseExportSpecifiers(e), this.eatContextual("from")) this.type !== a.string && this.unexpected(), t.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (t.attributes = this.parseWithClause()); 2362 else { 2363 for (var i = 0, s = t.specifiers; i < s.length; i += 1) { 2364 var r = s[i]; 2365 this.checkUnreserved(r.local), this.checkLocalExport(r.local), r.local.type === "Literal" && this.raise(r.local.start, "A string literal cannot be used as an exported binding without `from`."); 2366 } 2367 t.source = null, this.options.ecmaVersion >= 16 && (t.attributes = []); 2368 } 2369 this.semicolon(); 2370 } 2371 return this.finishNode(t, "ExportNamedDeclaration"); 2372 }, d.parseExportDeclaration = function(t) { 2373 return this.parseStatement(null); 2374 }, d.parseExportDefaultDeclaration = function() { 2375 var t; 2376 if (this.type === a._function || (t = this.isAsyncFunction())) { 2377 var e = this.startNode(); 2378 return this.next(), t && this.next(), this.parseFunction(e, mt | we, !1, t); 2379 } else if (this.type === a._class) { 2380 var i = this.startNode(); 2381 return this.parseClass(i, "nullableID"); 2382 } else { 2383 var s = this.parseMaybeAssign(); 2384 return this.semicolon(), s; 2385 } 2386 }, d.checkExport = function(t, e, i) { 2387 t && (typeof e != "string" && (e = e.type === "Identifier" ? e.name : e.value), lt(t, e) && this.raiseRecoverable(i, "Duplicate export '" + e + "'"), t[e] = !0); 2388 }, d.checkPatternExport = function(t, e) { 2389 var i = e.type; 2390 if (i === "Identifier") this.checkExport(t, e, e.start); 2391 else if (i === "ObjectPattern") for (var s = 0, r = e.properties; s < r.length; s += 1) { 2392 var o = r[s]; 2393 this.checkPatternExport(t, o); 2394 } 2395 else if (i === "ArrayPattern") for (var n = 0, h = e.elements; n < h.length; n += 1) { 2396 var l = h[n]; 2397 l && this.checkPatternExport(t, l); 2398 } 2399 else i === "Property" ? this.checkPatternExport(t, e.value) : i === "AssignmentPattern" ? this.checkPatternExport(t, e.left) : i === "RestElement" && this.checkPatternExport(t, e.argument); 2400 }, d.checkVariableExport = function(t, e) { 2401 if (t) for (var i = 0, s = e; i < s.length; i += 1) { 2402 var r = s[i]; 2403 this.checkPatternExport(t, r.id); 2404 } 2405 }, d.shouldParseExportStatement = function() { 2406 return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); 2407 }, d.parseExportSpecifier = function(t) { 2408 var e = this.startNode(); 2409 return e.local = this.parseModuleExportName(), e.exported = this.eatContextual("as") ? this.parseModuleExportName() : e.local, this.checkExport(t, e.exported, e.exported.start), this.finishNode(e, "ExportSpecifier"); 2410 }, d.parseExportSpecifiers = function(t) { 2411 var e = [], i = !0; 2412 for (this.expect(a.braceL); !this.eat(a.braceR);) { 2413 if (i) i = !1; 2414 else if (this.expect(a.comma), this.afterTrailingComma(a.braceR)) break; 2415 e.push(this.parseExportSpecifier(t)); 2416 } 2417 return e; 2418 }, d.parseImport = function(t) { 2419 return this.next(), this.type === a.string ? (t.specifiers = gi, t.source = this.parseExprAtom()) : (t.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), t.source = this.type === a.string ? this.parseExprAtom() : this.unexpected()), this.options.ecmaVersion >= 16 && (t.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(t, "ImportDeclaration"); 2420 }, d.parseImportSpecifier = function() { 2421 var t = this.startNode(); 2422 return t.imported = this.parseModuleExportName(), this.eatContextual("as") ? t.local = this.parseIdent() : (this.checkUnreserved(t.imported), t.local = t.imported), this.checkLValSimple(t.local, Q), this.finishNode(t, "ImportSpecifier"); 2423 }, d.parseImportDefaultSpecifier = function() { 2424 var t = this.startNode(); 2425 return t.local = this.parseIdent(), this.checkLValSimple(t.local, Q), this.finishNode(t, "ImportDefaultSpecifier"); 2426 }, d.parseImportNamespaceSpecifier = function() { 2427 var t = this.startNode(); 2428 return this.next(), this.expectContextual("as"), t.local = this.parseIdent(), this.checkLValSimple(t.local, Q), this.finishNode(t, "ImportNamespaceSpecifier"); 2429 }, d.parseImportSpecifiers = function() { 2430 var t = [], e = !0;
2431 if (this.type === a.name && (t.push(this.parseImportDefaultSpecifier()), !this.eat(a.comma))) return t; 2432 if (this.type === a.star) return t.push(this.parseImportNamespaceSpecifier()), t; 2433 for (this.expect(a.braceL); !this.eat(a.braceR);) { 2434 if (e) e = !1; 2435 else if (this.expect(a.comma), this.afterTrailingComma(a.braceR)) break; 2436 t.push(this.parseImportSpecifier()); 2437 } 2438 return t; 2439 }, d.parseWithClause = function() { 2440 var t = []; 2441 if (!this.eat(a._with)) return t; 2442 this.expect(a.braceL); 2443 for (var e = {}, i = !0; !this.eat(a.braceR);) { 2444 if (i) i = !1; 2445 else if (this.expect(a.comma), this.afterTrailingComma(a.braceR)) break; 2446 var s = this.parseImportAttribute(), r = s.key.type === "Identifier" ? s.key.name : s.key.value; 2447 lt(e, r) && this.raiseRecoverable(s.key.start, "Duplicate attribute key '" + r + "'"), e[r] = !0, t.push(s); 2448 } 2449 return t; 2450 }, d.parseImportAttribute = function() { 2451 var t = this.startNode(); 2452 return t.key = this.type === a.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"), this.expect(a.colon), this.type !== a.string && this.unexpected(), t.value = this.parseExprAtom(), this.finishNode(t, "ImportAttribute"); 2453 }, d.parseModuleExportName = function() { 2454 if (this.options.ecmaVersion >= 13 && this.type === a.string) { 2455 var t = this.parseLiteral(this.value); 2456 return ci.test(t.value) && this.raise(t.start, "An export name cannot include a lone surrogate."), t; 2457 } 2458 return this.parseIdent(!0); 2459 }, d.adaptDirectivePrologue = function(t) { 2460 for (var e = 0; e < t.length && this.isDirectiveCandidate(t[e]); ++e) t[e].directive = t[e].expression.raw.slice(1, -1); 2461 }, d.isDirectiveCandidate = function(t) { 2462 return this.options.ecmaVersion >= 5 && t.type === "ExpressionStatement" && t.expression.type === "Literal" && typeof t.expression.value == "string" && (this.input[t.start] === "\"" || this.input[t.start] === "'"); 2463 }; 2464 var F = A.prototype; 2465 F.toAssignable = function(t, e, i) { 2466 if (this.options.ecmaVersion >= 6 && t) switch (t.type) { 2467 case "Identifier": 2468 this.inAsync && t.name === "await" && this.raise(t.start, "Cannot use 'await' as identifier inside an async function"); 2469 break; 2470 case "ObjectPattern": 2471 case "ArrayPattern": 2472 case "AssignmentPattern": 2473 case "RestElement": break; 2474 case "ObjectExpression": 2475 t.type = "ObjectPattern", i && this.checkPatternErrors(i, !0); 2476 for (var s = 0, r = t.properties; s < r.length; s += 1) { 2477 var o = r[s]; 2478 this.toAssignable(o, e), o.type === "RestElement" && (o.argument.type === "ArrayPattern" || o.argument.type === "ObjectPattern") && this.raise(o.argument.start, "Unexpected token"); 2479 } 2480 break; 2481 case "Property": 2482 t.kind !== "init" && this.raise(t.key.start, "Object pattern can't contain getter or setter"), this.toAssignable(t.value, e); 2483 break; 2484 case "ArrayExpression": 2485 t.type = "ArrayPattern", i && this.checkPatternErrors(i, !0), this.toAssignableList(t.elements, e); 2486 break; 2487 case "SpreadElement": 2488 t.type = "RestElement", this.toAssignable(t.argument, e), t.argument.type === "AssignmentPattern" && this.raise(t.argument.start, "Rest elements cannot have a default value"); 2489 break; 2490 case "AssignmentExpression": 2491 t.operator !== "=" && this.raise(t.left.end, "Only '=' operator can be used for specifying default value."), t.type = "AssignmentPattern", delete t.operator, this.toAssignable(t.left, e); 2492 break; 2493 case "ParenthesizedExpression": 2494 this.toAssignable(t.expression, e, i); 2495 break; 2496 case "ChainExpression": 2497 this.raiseRecoverable(t.start, "Optional chaining cannot appear in left-hand side"); 2498 break; 2499 case "MemberExpression": if (!e) break; 2500 default: this.raise(t.start, "Assigning to rvalue"); 2501 } 2502 else i && this.checkPatternErrors(i, !0); 2503 return t; 2504 }, F.toAssignableList = function(t, e) { 2505 for (var i = t.length, s = 0; s < i; s++) { 2506 var r = t[s]; 2507 r && this.toAssignable(r, e); 2508 } 2509 if (i) { 2510 var o = t[i - 1]; 2511 this.options.ecmaVersion === 6 && e && o && o.type === "RestElement" && o.argument.type !== "Identifier" && this.unexpected(o.argument.start); 2512 } 2513 return t; 2514 }, F.parseSpread = function(t) { 2515 var e = this.startNode(); 2516 return this.next(), e.argument = this.parseMaybeAssign(!1, t), this.finishNode(e, "SpreadElement"); 2517 }, F.parseRestBinding = function() { 2518 var t = this.startNode(); 2519 return this.next(), this.options.ecmaVersion === 6 && this.type !== a.name && this.unexpected(), t.argument = this.parseBindingAtom(), this.finishNode(t, "RestElement"); 2520 }, F.parseBindingAtom = function() { 2521 if (this.options.ecmaVersion >= 6) switch (this.type) { 2522 case a.bracketL: 2523 var t = this.startNode(); 2524 return this.next(), t.elements = this.parseBindingList(a.bracketR, !0, !0), this.finishNode(t, "ArrayPattern"); 2525 case a.braceL: return this.parseObj(!0); 2526 } 2527 return this.parseIdent(); 2528 }, F.parseBindingList = function(t, e, i, s) { 2529 for (var r = [], o = !0; !this.eat(t);) if (o ? o = !1 : this.expect(a.comma), e && this.type === a.comma) r.pu
2529sh(null); 2530 else { 2531 if (i && this.afterTrailingComma(t)) break; 2532 if (this.type === a.ellipsis) { 2533 var n = this.parseRestBinding(); 2534 this.parseBindingListItem(n), r.push(n), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.expect(t); 2535 break; 2536 } else r.push(this.parseAssignableListItem(s)); 2537 } 2538 return r; 2539 }, F.parseAssignableListItem = function(t) { 2540 var e = this.parseMaybeDefault(this.start, this.startLoc); 2541 return this.parseBindingListItem(e), e; 2542 }, F.parseBindingListItem = function(t) { 2543 return t; 2544 }, F.parseMaybeDefault = function(t, e, i) { 2545 if (i = i || this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(a.eq)) return i; 2546 var s = this.startNodeAt(t, e); 2547 return s.left = i, s.right = this.parseMaybeAssign(), this.finishNode(s, "AssignmentPattern"); 2548 }, F.checkLValSimple = function(t, e, i) { 2549 e === void 0 && (e = Pt); 2550 var s = e !== Pt; 2551 switch (t.type) { 2552 case "Identifier": 2553 this.strict && this.reservedWordsStrictBind.test(t.name) && this.raiseRecoverable(t.start, (s ? "Binding " : "Assigning to ") + t.name + " in strict mode"), s && (e === Q && t.name === "let" && this.raiseRecoverable(t.start, "let is disallowed as a lexically bound name"), i && (lt(i, t.name) && this.raiseRecoverable(t.start, "Argument name clash"), i[t.name] = !0), e !== be && this.declareName(t.name, e, t.start)); 2554 break; 2555 case "ChainExpression": 2556 this.raiseRecoverable(t.start, "Optional chaining cannot appear in left-hand side"); 2557 break; 2558 case "MemberExpression": 2559 s && this.raiseRecoverable(t.start, "Binding member expression"); 2560 break; 2561 case "ParenthesizedExpression": return s && this.raiseRecoverable(t.start, "Binding parenthesized expression"), this.checkLValSimple(t.expression, e, i); 2562 default: this.raise(t.start, (s ? "Binding" : "Assigning to") + " rvalue"); 2563 } 2564 }, F.checkLValPattern = function(t, e, i) { 2565 switch (e === void 0 && (e = Pt), t.type) { 2566 case "ObjectPattern": 2567 for (var s = 0, r = t.properties; s < r.length; s += 1) { 2568 var o = r[s]; 2569 this.checkLValInnerPattern(o, e, i); 2570 } 2571 break; 2572 case "ArrayPattern": 2573 for (var n = 0, h = t.elements; n < h.length; n += 1) { 2574 var l = h[n]; 2575 l && this.checkLValInnerPattern(l, e, i); 2576 } 2577 break; 2578 default: this.checkLValSimple(t, e, i); 2579 } 2580 }, F.checkLValInnerPattern = function(t, e, i) { 2581 switch (e === void 0 && (e = Pt), t.type) { 2582 case "Property": 2583 this.checkLValInnerPattern(t.value, e, i); 2584 break; 2585 case "AssignmentPattern": 2586 this.checkLValPattern(t.left, e, i); 2587 break; 2588 case "RestElement": 2589 this.checkLValPattern(t.argument, e, i); 2590 break; 2591 default: this.checkLValPattern(t, e, i); 2592 } 2593 }; 2594 var j = function(e, i, s, r, o) { 2595 this.token = e, this.isExpr = !!i, this.preserveSpace = !!s, this.override = r, this.generator = !!o; 2596 }, E = { 2597 b_stat: new j("{", !1), 2598 b_expr: new j("{", !0), 2599 b_tmpl: new j("${", !1), 2600 p_stat: new j("(", !1), 2601 p_expr: new j("(", !0), 2602 q_tmpl: new j("`", !0, !0, function(t) { 2603 return t.tryReadTemplateToken(); 2604 }), 2605 f_stat: new j("function", !1), 2606 f_expr: new j("function", !0), 2607 f_expr_gen: new j("function", !0, !1, null, !0), 2608 f_gen: new j("function", !1, !1, null, !0) 2609 }, ut = A.prototype; 2610 ut.initialContext = function() { 2611 return [E.b_stat]; 2612 }, ut.curContext = function() { 2613 return this.context[this.context.length - 1]; 2614 }, ut.braceIsBlock = function(t) { 2615 var e = this.curContext(); 2616 return e === E.f_expr || e === E.f_stat ? !0 : t === a.colon && (e === E.b_stat || e === E.b_expr) ? !e.isExpr : t === a._return || t === a.name && this.exprAllowed ? V.test(this.input.slice(this.lastTokEnd, this.start)) : t === a._else || t === a.semi || t === a.eof || t === a.parenR || t === a.arrow ? !0 : t === a.braceL ? e === E.b_stat : t === a._var || t === a._const || t === a.name ? !1 : !this.exprAllowed; 2617 }, ut.inGeneratorContext = function() { 2618 for (var t = this.context.length - 1; t >= 1; t--) { 2619 var e = this.context[t]; 2620 if (e.token === "function") return e.generator; 2621 } 2622 return !1; 2623 }, ut.updateContext = function(t) { 2624 var e, i = this.type; 2625 i.keyword && t === a.dot ? this.exprAllowed = !1 : (e = i.updateContext) ? e.call(this, t) : this.exprAllowed = i.beforeE
2625xpr; 2626 }, ut.overrideContext = function(t) { 2627 this.curContext() !== t && (this.context[this.context.length - 1] = t); 2628 }, a.parenR.updateContext = a.braceR.updateContext = function() { 2629 if (this.context.length === 1) { 2630 this.exprAllowed = !0; 2631 return; 2632 } 2633 var t = this.context.pop(); 2634 t === E.b_stat && this.curContext().token === "function" && (t = this.context.pop()), this.exprAllowed = !t.isExpr; 2635 }, a.braceL.updateContext = function(t) { 2636 this.context.push(this.braceIsBlock(t) ? E.b_stat : E.b_expr), this.exprAllowed = !0; 2637 }, a.dollarBraceL.updateContext = function() { 2638 this.context.push(E.b_tmpl), this.exprAllowed = !0; 2639 }, a.parenL.updateContext = function(t) { 2640 var e = t === a._if || t === a._for || t === a._with || t === a._while; 2641 this.context.push(e ? E.p_stat : E.p_expr), this.exprAllowed = !0; 2642 }, a.incDec.updateContext = function() {}, a._function.updateContext = a._class.updateContext = function(t) { 2643 t.beforeExpr && t !== a._else && !(t === a.semi && this.curContext() !== E.p_stat) && !(t === a._return && V.test(this.input.slice(this.lastTokEnd, this.start))) && !((t === a.colon || t === a.braceL) && this.curContext() === E.b_stat) ? this.context.push(E.f_expr) : this.context.push(E.f_stat), this.exprAllowed = !1; 2644 }, a.colon.updateContext = function() { 2645 this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0; 2646 }, a.backQuote.updateContext = function() { 2647 this.curContext() === E.q_tmpl ? this.context.pop() : this.context.push(E.q_tmpl), this.exprAllowed = !1; 2648 }, a.star.updateContext = function(t) { 2649 if (t === a._function) { 2650 var e = this.context.length - 1; 2651 this.context[e] === E.f_expr ? this.context[e] = E.f_expr_gen : this.context[e] = E.f_gen; 2652 } 2653 this.exprAllowed = !0; 2654 }, a.name.updateContext = function(t) { 2655 var e = !1; 2656 this.options.ecmaVersion >= 6 && t !== a.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (e = !0), this.exprAllowed = e; 2657 }; 2658 var v = A.prototype; 2659 v.checkPropClash = function(t, e, i) { 2660 if (!(this.options.ecmaVersion >= 9 && t.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (t.computed || t.method || t.shorthand))) { 2661 var s = t.key, r; 2662 switch (s.type) { 2663 case "Identifier": 2664 r = s.name; 2665 break; 2666 case "Literal": 2667 r = String(s.value); 2668 break; 2669 default: return; 2670 } 2671 var o = t.kind; 2672 if (this.options.ecmaVersion >= 6) { 2673 r === "__proto__" && o === "init" && (e.proto && (i ? i.doubleProto < 0 && (i.doubleProto = s.start) : this.raiseRecoverable(s.start, "Redefinition of __proto__ property")), e.proto = !0); 2674 return; 2675 } 2676 r = "$" + r; 2677 var n = e[r]; 2678 if (n) { 2679 var h; 2680 o === "init" ? h = this.strict && n.init || n.get || n.set : h = n.init || n[o], h && this.raiseRecoverable(s.start, "Redefinition of property"); 2681 } else n = e[r] = { 2682 init: !1, 2683 get: !1, 2684 set: !1 2685 }; 2686 n[o] = !0; 2687 } 2688 }, v.parseExpression = function(t, e) { 2689 var i = this; 2690 return this.catchStackOverflow(function() { 2691 var s = i.start, r = i.startLoc, o = i.parseMaybeAssign(t, e); 2692 if (i.type === a.comma) { 2693 var n = i.startNodeAt(s, r); 2694 for (n.expressions = [o]; i.eat(a.comma);) n.expressions.push(i.parseMaybeAssign(t, e)); 2695 return i.finishNode(n, "SequenceExpression"); 2696 } 2697 return o; 2698 }); 2699 }, v.parseMaybeAssign = function(t, e, i) { 2700 if (this.isContextual("yield")) { 2701 if (this.inGenerator) return this.parseYield(t); 2702 this.exprAllowed = !1; 2703 } 2704 var s = !1, r = -1, o = -1, n = -1; 2705 e ? (r = e.parenthesizedAssign, o = e.trailingComma, n = e.doubleProto, e.parenthesizedAssign = e.trailingComma = -1) : (e = new At(), s = !0); 2706 var h = this.start, l = this.startLoc; 2707 (this.type === a.parenL || this.type === a.name) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = t === "await"); 2708 var u = this.parseMaybeConditional(t, e); 2709 if (i && (u = i.call(this, u, h, l)), this.type.isAssign) { 2710 var c = this.startNodeAt(h, l); 2711 return c.operator = this.value, this.type === a.eq && (u = this.toAssignable(u, !1, e)), s || (e.parenthesizedAssign = e.trailingComma = e.doubleProto = -1), e.shorthandAssign >
2711= u.start && (e.shorthandAssign = -1), this.type === a.eq ? this.checkLValPattern(u) : this.checkLValSimple(u), c.left = u, this.next(), c.right = this.parseMaybeAssign(t), n > -1 && (e.doubleProto = n), this.finishNode(c, "AssignmentExpression"); 2712 } else s && this.checkExpressionErrors(e, !0); 2713 return r > -1 && (e.parenthesizedAssign = r), o > -1 && (e.trailingComma = o), u; 2714 }, v.parseMaybeConditional = function(t, e) { 2715 var i = this.start, s = this.startLoc, r = this.parseExprOps(t, e); 2716 if (this.checkExpressionErrors(e)) return r; 2717 if (!(r.type === "ArrowFunctionExpression" && r.start === i) && this.eat(a.question)) { 2718 var o = this.startNodeAt(i, s); 2719 return o.test = r, o.consequent = this.parseMaybeAssign(), this.expect(a.colon), o.alternate = this.parseMaybeAssign(t), this.finishNode(o, "ConditionalExpression"); 2720 } 2721 return r; 2722 }, v.parseExprOps = function(t, e) { 2723 var i = this.start, s = this.startLoc, r = this.parseMaybeUnary(e, !1, !1, t); 2724 return this.checkExpressionErrors(e) || r.start === i && r.type === "ArrowFunctionExpression" ? r : this.parseExprOp(r, i, s, -1, t); 2725 }, v.parseExprOp = function(t, e, i, s, r) { 2726 var o = this.type.binop; 2727 if (o != null && (!r || this.type !== a._in) && o > s) { 2728 var n = this.type === a.logicalOR || this.type === a.logicalAND, h = this.type === a.coalesce; 2729 h && (o = a.logicalAND.binop); 2730 var l = this.value; 2731 this.next(); 2732 var u = this.start, c = this.startLoc, p = this.parseExprOp(this.parseMaybeUnary(null, !1, !1, r), u, c, o, r), x = this.buildBinary(e, i, t, p, l, n || h); 2733 return (n && this.type === a.coalesce || h && (this.type === a.logicalOR || this.type === a.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(x, e, i, s, r); 2734 } 2735 return t; 2736 }, v.buildBinary = function(t, e, i, s, r, o) { 2737 s.type === "PrivateIdentifier" && this.raise(s.start, "Private identifier can only be left side of binary expression"); 2738 var n = this.startNodeAt(t, e); 2739 return n.left = i, n.operator = r, n.right = s, this.finishNode(n, o ? "LogicalExpression" : "BinaryExpression"); 2740 }, v.parseMaybeUnary = function(t, e, i, s) { 2741 var r = this.start, o = this.startLoc, n; 2742 if (this.isContextual("await") && this.canAwait) n = this.parseAwait(s), e = !0; 2743 else if (this.type.prefix) { 2744 var h = this.startNode(), l = this.type === a.incDec; 2745 h.operator = this.value, h.prefix = !0, this.next(), h.argument = this.parseMaybeUnary(null, !0, l, s), this.checkExpressionErrors(t, !0), l ? this.checkLValSimple(h.argument) : this.strict && h.operator === "delete" && ke(h.argument) ? this.raiseRecoverable(h.start, "Deleting local variable in strict mode") : h.operator === "delete" && Zt(h.argument) ? this.raiseRecoverable(h.start, "Private fields can not be deleted") : e = !0, n = this.finishNode(h, l ? "UpdateExpression" : "UnaryExpression"); 2746 } else if (!e && this.type === a.privateId) (s || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), n = this.parsePrivateIdent(), this.type !== a._in && this.unexpected(); 2747 else { 2748 if (n = this.parseExprSubscripts(t, s), this.checkExpressionErrors(t)) return n; 2749 for (; this.type.postfix && !this.canInsertSemicolon();) { 2750 var u = this.startNodeAt(r, o); 2751 u.operator = this.value, u.prefix = !1, u.argument = n, this.checkLValSimple(n), this.next(), n = this.finishNode(u, "UpdateExpression"); 2752 } 2753 } 2754 if (!i && !(n.type === "ArrowFunctionExpression" && n.start === r) && this.eat(a.starstar)) if (e) this.unexpected(this.lastTokStart); 2755 else return this.buildBinary(r, o, n, this.parseMaybeUnary(null, !1, !1, s), "**", !1); 2756 else return n; 2757 }; 2758 function ke(t) { 2759 return t.type === "Identifier" || t.type === "ParenthesizedExpression" && ke(t.expression); 2760 } 2761 function Zt(t) { 2762 return t.type === "MemberExpression" && t.property.type === "PrivateIdentifier" || t.type === "ChainExpression" && Zt(t.expression) || t.type === "ParenthesizedExpression" && Zt(t.expression); 2763 } 2764 v.parseExprSubscripts = function(t, e) { 2765 var i = this.start, s = this.startLoc, r = this.parseExprAtom(t, e); 2766 if (r.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return r; 2767 var o = this.parseSubscripts(r, i, s, !1, e); 2768 return t && o.type === "MemberExpression" && (t.parenthesizedAssign >
2768= o.start && (t.parenthesizedAssign = -1), t.parenthesizedBind >= o.start && (t.parenthesizedBind = -1), t.trailingComma >= o.start && (t.trailingComma = -1)), o; 2769 }, v.parseSubscripts = function(t, e, i, s, r) { 2770 for (var o = this.options.ecmaVersion >= 8 && t.type === "Identifier" && t.name === "async" && this.lastTokEnd === t.end && !this.canInsertSemicolon() && t.end - t.start === 5 && this.potentialArrowAt === t.start, n = !1;;) { 2771 var h = this.parseSubscript(t, e, i, s, o, n, r); 2772 if (h.optional && (n = !0), h === t || h.type === "ArrowFunctionExpression") { 2773 if (n) { 2774 var l = this.startNodeAt(e, i); 2775 l.expression = h, h = this.finishNode(l, "ChainExpression"); 2776 } 2777 return h; 2778 } 2779 t = h; 2780 } 2781 }, v.shouldParseAsyncArrow = function() { 2782 return !this.canInsertSemicolon() && this.eat(a.arrow); 2783 }, v.parseSubscriptAsyncArrow = function(t, e, i, s) { 2784 return this.parseArrowExpression(this.startNodeAt(t, e), i, !0, s); 2785 }, v.parseSubscript = function(t, e, i, s, r, o, n) { 2786 var h = this.options.ecmaVersion >= 11, l = h && this.eat(a.questionDot); 2787 s && l && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); 2788 var u = this.eat(a.bracketL); 2789 if (u || l && this.type !== a.parenL && this.type !== a.backQuote || this.eat(a.dot)) { 2790 var c = this.startNodeAt(e, i); 2791 c.object = t, u ? (c.property = this.parseExpression(), this.expect(a.bracketR)) : this.type === a.privateId && t.type !== "Super" ? c.property = this.parsePrivateIdent() : c.property = this.parseIdent(this.options.allowReserved !== "never"), c.computed = !!u, h && (c.optional = l), t = this.finishNode(c, "MemberExpression"); 2792 } else if (!s && this.eat(a.parenL)) { 2793 var p = new At(), x = this.yieldPos, P = this.awaitPos, I = this.awaitIdentPos; 2794 this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0; 2795 var g = this.parseExprList(a.parenR, this.options.ecmaVersion >= 8, !1, p); 2796 if (r && !l && this.shouldParseAsyncArrow()) return this.checkPatternErrors(p, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = x, this.awaitPos = P, this.awaitIdentPos = I, this.parseSubscriptAsyncArrow(e, i, g, n); 2797 this.checkExpressionErrors(p, !0), this.yieldPos = x || this.yieldPos, this.awaitPos = P || this.awaitPos, this.awaitIdentPos = I || this.awaitIdentPos; 2798 var y = this.startNodeAt(e, i); 2799 y.callee = t, y.arguments = g, h && (y.optional = l), t = this.finishNode(y, "CallExpression"); 2800 } else if (this.type === a.backQuote) { 2801 (l || o) && this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); 2802 var w = this.startNodeAt(e, i); 2803 w.tag = t, w.quasi = this.parseTemplate({ isTagged: !0 }), t = this.finishNode(w, "TaggedTemplateExpression"); 2804 } 2805 return t; 2806 }, v.parseExprAtom = function(t, e, i) { 2807 this.type === a.slash && this.readRegexp(); 2808 var s, r = this.potentialArrowAt === this.start; 2809 switch (this.type) { 2810 case a._super: return this.allowSuper || this.raise(this.start, "'super' keyword outside a method"), s = this.startNode(), this.next(), this.type === a.parenL && !this.allowDirectSuper && this.raise(s.start, "super() call outside constructor of a subclass"), this.type !== a.dot && this.type !== a.bracketL && this.type !== a.parenL && this.unexpected(), this.finishNode(s, "Super"); 2811 case a._this: return s = this.startNode(), this.next(), this.finishNode(s, "ThisExpression"); 2812 case a.name: 2813 var o = this.start, n = this.startLoc, h = this.containsEsc, l = this.parseIdent(!1); 2814 if (this.options.ecmaVersion >= 8 && !h && l.name === "async" && !this.canInsertSemicolon() && this.eat(a._function)) return this.overrideContext(E.f_expr), this.parseFunction(this.startNodeAt(o, n), 0, !1, !0, e); 2815 if (r && !this.canInsertSemicolon()) { 2816 if (this.eat(a.arrow)) return this.parseArrowExpression(this.startNodeAt(o, n), [l], !1, e); 2817 if (this.options.ecmaVersion >= 8 && l.name === "async" && this.type === a.name && !h && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return l = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(a.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(o, n), [l], !0, e); 2818 } 2819 return l; 2820 case a.regexp: 2821 var u = this.value; 2822 return s = this.parseLiteral(u.value), s.regex = { 2823 pattern: u.pattern, 2824 flags: u.flags 2825 }, s; 2826 case a.num: 2827 case a.string: return this.parseLiteral(this.value); 2828 case a._null: 2829 case a._true: 2830 case a._false: return s = this.startNode(), s.value = this.type === a._null ? null : this.type === a._true, s.raw
2830= this.type.keyword, this.next(), this.finishNode(s, "Literal"); 2831 case a.parenL: 2832 var c = this.start, p = this.parseParenAndDistinguishExpression(r, e); 2833 return t && (t.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(p) && (t.parenthesizedAssign = c), t.parenthesizedBind < 0 && (t.parenthesizedBind = c)), p; 2834 case a.bracketL: return s = this.startNode(), this.next(), s.elements = this.parseExprList(a.bracketR, !0, !0, t), this.finishNode(s, "ArrayExpression"); 2835 case a.braceL: return this.overrideContext(E.b_expr), this.parseObj(!1, t); 2836 case a._function: return s = this.startNode(), this.next(), this.parseFunction(s, 0); 2837 case a._class: return this.parseClass(this.startNode(), !1); 2838 case a._new: return this.parseNew(); 2839 case a.backQuote: return this.parseTemplate(); 2840 case a._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(i) : this.unexpected(); 2841 default: return this.parseExprAtomDefault(); 2842 } 2843 }, v.parseExprAtomDefault = function() { 2844 this.unexpected(); 2845 }, v.parseExprImport = function(t) { 2846 var e = this.startNode(); 2847 if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === a.parenL && !t) return this.parseDynamicImport(e); 2848 if (this.type === a.dot) { 2849 var i = this.startNodeAt(e.start, e.loc && e.loc.start); 2850 return i.name = "import", e.meta = this.finishNode(i, "Identifier"), this.parseImportMeta(e); 2851 } else this.unexpected(); 2852 }, v.parseDynamicImport = function(t) { 2853 if (this.next(), t.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(a.parenR) ? t.options = null : (this.expect(a.comma), this.afterTrailingComma(a.parenR) ? t.options = null : (t.options = this.parseMaybeAssign(), this.eat(a.parenR) || (this.expect(a.comma), this.afterTrailingComma(a.parenR) || this.unexpected()))); 2854 else if (!this.eat(a.parenR)) { 2855 var e = this.start; 2856 this.eat(a.comma) && this.eat(a.parenR) ? this.raiseRecoverable(e, "Trailing comma is not allowed in import()") : this.unexpected(e); 2857 } 2858 return this.finishNode(t, "ImportExpression"); 2859 }, v.parseImportMeta = function(t) { 2860 this.next(); 2861 var e = this.containsEsc; 2862 return t.property = this.parseIdent(!0), t.property.name !== "meta" && this.raiseRecoverable(t.property.start, "The only valid meta property for import is 'import.meta'"), e && this.raiseRecoverable(t.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(t.start, "Cannot use 'import.meta' outside a module"), this.finishNode(t, "MetaProperty"); 2863 }, v.parseLiteral = function(t) { 2864 var e = this.startNode(); 2865 return e.value = t, e.raw = this.input.slice(this.start, this.end), e.raw.charCodeAt(e.raw.length - 1) === 110 && (e.bigint = e.value != null ? e.value.toString() : e.raw.slice(0, -1).replace(/_/g, "")), this.next(), this.finishNode(e, "Literal"); 2866 }, v.parseParenExpression = function() { 2867 this.expect(a.parenL); 2868 var t = this.parseExpression(); 2869 return this.expect(a.parenR), t; 2870 }, v.shouldParseArrow = function(t) { 2871 return !this.canInsertSemicolon(); 2872 }, v.parseParenAndDistinguishExpression = function(t, e) { 2873 var i = this.start, s = this.startLoc, r, o = this.options.ecmaVersion >= 8; 2874 if (this.options.ecmaVersion >= 6) { 2875 this.next(); 2876 var n = this.start, h = this.startLoc, l = [], u = !0, c = !1, p = new At(), x = this.yieldPos, P = this.awaitPos, I; 2877 for (this.yieldPos = 0, this.awaitPos = 0; this.type !== a.parenR;) if (u ? u = !1 : this.expect(a.comma), o && this.afterTrailingComma(a.parenR, !0)) { 2878 c = !0; 2879 break; 2880 } else if (this.type === a.ellipsis) { 2881 I = this.start, l.push(this.parseParenItem(this.parseRestBinding())), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); 2882 break; 2883 } else l.push(this.parseMaybeAssign(!1, p, this.parseParenItem)); 2884 var g = this.lastTokEnd, y = this.lastTokEndLoc; 2885 if (this.expect(a.parenR), t && this.shouldParseArrow(l) && this.eat(a.arrow)) return this.checkPatternErrors(p, !1), this.checkYieldAwaitInDefaultParams(), this.yieldPos = x, this.awaitPos = P, this.parseParenArrowList(i, s, l, e); 2886 (!l.length || c) && this.unexpected(this.lastTokStart), I && this.unexpected(I), this.checkExpressionErrors(p, !0), this.yieldPos = x || this.yieldPos, this.awaitPos = P || this.awaitPos, l.length > 1 ? (r = this.startNodeAt(n, h), r.expressions = l, this.finishNodeAt(r, "SequenceExpression", g, y)) : r = l[0]; 2887 } else r = this.parseParenExpression(); 2888 if (this.options.preserveParens) { 2889 var w = this.startNodeAt(i, s); 2890 return w.expression = r, this.finishNode(w, "ParenthesizedExpression"); 2891 } else return r; 2892 }, v.parseParenItem = function(t) { 2893 return t; 2894 }, v.parseParenArrowList = function(t, e, i, s) { 2895 return this.parseArrowExpression(this.startNodeAt(t, e), i, !1, s); 2896 }; 2897 var yi = []; 2898 v.parseNew = function() { 2899 this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new"); 2900 var t = this.startNode(); 2901 if (this.next(), this.options.ecmaVersion >= 6 && this.type === a.dot) {
2902 var e = this.startNodeAt(t.start, t.loc && t.loc.start); 2903 e.name = "new", t.meta = this.finishNode(e, "Identifier"), this.next(); 2904 var i = this.containsEsc; 2905 return t.property = this.parseIdent(!0), t.property.name !== "target" && this.raiseRecoverable(t.property.start, "The only valid meta property for new is 'new.target'"), i && this.raiseRecoverable(t.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(t.start, "'new.target' can only be used in functions and class static block"), this.finishNode(t, "MetaProperty"); 2906 } 2907 var s = this.start, r = this.startLoc; 2908 return t.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), s, r, !0, !1), t.callee.type === "Super" && this.raiseRecoverable(s, "Invalid use of 'super'"), this.eat(a.parenL) ? t.arguments = this.parseExprList(a.parenR, this.options.ecmaVersion >= 8, !1) : t.arguments = yi, this.finishNode(t, "NewExpression"); 2909 }, v.parseTemplateElement = function(t) { 2910 var e = t.isTagged, i = this.startNode(); 2911 return this.type === a.invalidTemplate ? (e || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), i.value = { 2912 raw: this.value.replace(/\r\n?/g, ` 2913`), 2914 cooked: null 2915 }) : i.value = { 2916 raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, ` 2917`), 2918 cooked: this.value 2919 }, this.next(), i.tail = this.type === a.backQuote, this.finishNode(i, "TemplateElement"); 2920 }, v.parseTemplate = function(t) { 2921 t === void 0 && (t = {}); 2922 var e = t.isTagged; 2923 e === void 0 && (e = !1); 2924 var i = this.startNode(); 2925 this.next(), i.expressions = []; 2926 var s = this.parseTemplateElement({ isTagged: e }); 2927 for (i.quasis = [s]; !s.tail;) this.type === a.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(a.dollarBraceL), i.expressions.push(this.parseExpression()), this.expect(a.braceR), i.quasis.push(s = this.parseTemplateElement({ isTagged: e })); 2928 return this.next(), this.finishNode(i, "TemplateLiteral"); 2929 }, v.isAsyncProp = function(t) { 2930 return !t.computed && t.key.type === "Identifier" && t.key.name === "async" && (this.t
2930ype === a.name || this.type === a.num || this.type === a.string || this.type === a.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === a.star) && !V.test(this.input.slice(this.lastTokEnd, this.start)); 2931 }, v.parseObj = function(t, e) { 2932 var i = this.startNode(), s = !0, r = {}; 2933 for (i.properties = [], this.next(); !this.eat(a.braceR);) { 2934 if (s) s = !1; 2935 else if (this.expect(a.comma), this.options.ecmaVersion >= 5 && this.afterTrailingComma(a.braceR)) break; 2936 var o = this.parseProperty(t, e); 2937 t || this.checkPropClash(o, r, e), i.properties.push(o); 2938 } 2939 return this.finishNode(i, t ? "ObjectPattern" : "ObjectExpression"); 2940 }, v.parseProperty = function(t, e) { 2941 var i = this.startNode(), s, r, o, n; 2942 if (this.options.ecmaVersion >= 9 && this.eat(a.ellipsis)) return t ? (i.argument = this.parseIdent(!1), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(i, "RestElement")) : (i.argument = this.parseMaybeAssign(!1, e), this.type === a.comma && e && e.trailingComma < 0 && (e.trailingComma = this.start), this.finishNode(i, "SpreadElement")); 2943 this.options.ecmaVersion >= 6 && (i.method = !1, i.shorthand = !1, (t || e) && (o = this.start, n = this.startLoc), t || (s = this.eat(a.star)));
2944 var h = this.containsEsc; 2945 return this.parsePropertyName(i), !t && !h && this.options.ecmaVersion >= 8 && !s && this.isAsyncProp(i) ? (r = !0, s = this.options.ecmaVersion >= 9 && this.eat(a.star), this.parsePropertyName(i)) : r = !1, this.parsePropertyValue(i, t, s, r, o, n, e, h), this.finishNode(i, "Property"); 2946 }, v.parseGetterSetter = function(t) { 2947 var e = t.key.name; 2948 this.parsePropertyName(t), t.value = this.parseMethod(!1), t.kind = e; 2949 var i = t.kind === "get" ? 0 : 1; 2950 if (t.value.params.length !== i) { 2951 var s = t.value.start; 2952 t.kind === "get" ? this.raiseRecoverable(s, "getter should have no params") : this.raiseRecoverable(s, "setter should have exactly one param"); 2953 } else t.kind === "set" && t.value.params[0].type === "RestElement" && this.raiseRecoverable(t.value.params[0].start, "Setter cannot use rest params"); 2954 }, v.parsePropertyValue = function(t, e, i, s, r, o, n, h) { 2955 (i || s) && this.type === a.colon && this.unexpected(), this.eat(a.colon) ? (t.value = e ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, n), t.kind = "init") : this.options.ecmaVersion >= 6 && this.type === a.parenL ? (e && this.unexpected(), t.method = !0, t.value = this.parseMethod(i, s), t.kind = "init") : !e && !h && this.options.ecmaVersion >= 5 && !t.computed && t.key.type === "Identifier" && (t.key.name === "get" || t.key.name === "set") && this.type !== a.comma && this.type !== a.braceR && this.type !== a.eq ? ((i || s) && this.unexpected(), this.parseGetterSetter(t)) : this.options.ecmaVersion >= 6 && !t.computed && t.key.type === "Identifier" ? ((i || s) && this.unexpected(), this.checkUnreserved(t.key), t.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = r), e ? t.value = this.parseMaybeDefault(r, o, this.copyNode(t.key)) : this.type === a.eq && n ? (n.shorthandAssign < 0 && (n.shorthandAssign = this.start), t.value = this.parseMaybeDefault(r, o, this.copyNode(t.key))) : t.value = this.copyNode(t.key), t.kind = "init", t.shorthand = !0) : this.unexpected(); 2956 }, v.parsePropertyName = function(t) { 2957 if (this.options.ecmaVersion >= 6) { 2958 if (this.eat(a.bracketL)) return t.computed = !0, t.key = this.parseMaybeAssign(), this.expect(a.bracketR), t.key; 2959 t.computed = !1; 2960 } 2961 return t.key = this.type === a.num || this.type === a.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); 2962 }, v.initFunction = function(t) { 2963 t.id = null, this.options.ecmaVersion >= 6 && (t.generator = t.expression = !1), this.options.ecmaVersion >= 8 && (t.async = !1); 2964 }, v.parseMethod = function(t, e, i) { 2965 var s = this.startNode(), r = this.yieldPos, o = this.awaitPos, n = this.awaitIdentPos; 2966 return this.initFunction(s), this.options.ecmaVersion >= 6 && (s.generator = t), this.options.ecmaVersion >= 8 && (s.async = !!e), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Kt(e, s.generator) | Ct | (i ? ye : 0)), this.expect(a.parenL), s.params = this.parseBindingList(a.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(s, !1, !0, !1), this.yieldPos = r, this.awaitPos = o, this.awaitIdentPos = n, this.finishNode(s, "FunctionExpression"); 2967 }, v.parseArrowExpression = function(t, e, i, s) { 2968 var r = this.yieldPos, o = this.awaitPos, n = this.awaitIdentPos; 2969 return this.enterScope(Kt(i, !1) | Wt), this.initFunction(t), this.options.ecmaVersion >= 8 && (t.async = !!i), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, t.params = this.toAssignableList(e, !0), this.parseFunctionBody(t, !0, !1, s), this.yieldPos = r, this.awaitPos = o, this.awaitIdentPos = n, this.finishNode(t, "ArrowFunctionExpression"); 2970 }, v.parseFunctionBody = function(t, e, i, s) { 2971 var r = e && this.type !== a.braceL, o = this.strict, n = !1; 2972 if (r) t.body = this.parseMaybeAssign(s), t.expression = !0, this.checkParams(t, !1); 2973 else { 2974 var h = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(t.params); 2975 (!o || h) && (n = this.strictDirective(this.end), n && h && this.raiseRecoverable(t.start, "Illegal 'use strict' directive in function with non-simple parameter list")); 2976 var l = this.labels; 2977 this.labels = [], n && (this.strict = !0), this.checkParams(t, !o && !n && !e && !i && this.isSimpleParamList(t.params)), this.strict && t.id && this.checkLValSimple(t.id, be), t.body = this.parseBlock(!1, void 0, n && !o), t.expression = !1, this.adaptDirectivePrologue(t.body.body), this.labels = l; 2978 } 2979 this.exitScope(); 2980 }, v.isSimpleParamList = function(t) { 2981 for (var e = 0, i = t; e < i.length; e += 1) if (i[e].type !== "Identifier") return !1; 2982 return !0; 2983 }, v.checkParams = function(t, e) { 2984 for (var i = Object.create(null), s = 0, r = t.params; s < r.length; s += 1) { 2985 var o = r[s]; 2986 this.checkLValInnerPattern(o, Qt, e ? null : i); 2987 } 2988 }, v.parseExprList = function(t, e, i, s) { 2989 for (var r = [], o = !0; !this.eat(t);) { 2990 if (o) o = !1; 2991 else if (this.expect(a.comma), e && this.afterTrailingComma(t)) break; 2992 var n = void 0; 2993 i && this.type === a.comma ? n = null : this.type === a.ellipsis ? (n = this.parseSpread(s), s && this.type === a.comma && s.trailingComma < 0 && (s.trailingComma = this.start)) : n = this.parseMaybeAssign(!1, s), r.push(n); 2994 } 2995 return r; 2996 }, v.checkUnreserved = function(t) { 2997 var e = t.start, i = t.end, s = t.name; 2998 this.inGenerator && s === "yield" && this.raiseRecoverable(e, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && s === "await" && this.raiseRecoverable(e, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & Et) && s === "arguments" && this.raiseRecoverable(e, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (s === "arguments" || s === "await") && this.raise(e, "Cannot use " + s + " in class static initialization block"), this.keywords.test(s) && this.raise(e, "Unexpected keyword '" + s + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(e, i).indexOf("\\") !== -1) && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(s) && (!this.inAsync && s === "await" && this.raiseRecoverable(e, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(e, "The keyword '" + s + "' is reserved")); 2999 }, v.parseIdent = function(t) { 3000 var e = this.parseIdentNode(); 3001 return this.next(!!t), this.finishNode(e, "Identifier"), t || (this.checkUnreserved(e), e.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = e.start)), e; 3002 }, v.parseIdentNode = function() { 3003 var t = this.startNode(); 3004 return this.type === a.name ? t.name = this.value : this.type.keyword ? (t.name = this.type.keyword, (t.name === "class" || t.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = a.name) : this.unexpected(), t; 3005 }, v.parsePrivateIdent = function() { 3006 var t = this.startNode(); 3007 return this.type === a.privateId ? t.name = this.value : this.unexpected(), this.next(), this.finishNode(t, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(t.start, "Private field '#" + t.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(t)), t; 3008 }, v.parseYield = function(t) { 3009 this.yieldPos || (this.yieldPos = this.start); 3010 var e = this.startNode(); 3011 return this.next(), this.type === a.semi || this.canInsertSemicolon() || this.type !== a.star && !this.t
3011ype.startsExpr ? (e.delegate = !1, e.argument = null) : (e.delegate = this.eat(a.star), e.argument = this.parseMaybeAssign(t)), this.finishNode(e, "YieldExpression"); 3012 }, v.parseAwait = function(t) { 3013 this.awaitPos || (this.awaitPos = this.start); 3014 var e = this.startNode(); 3015 return this.next(), e.argument = this.parseMaybeUnary(null, !0, !1, t), this.finishNode(e, "AwaitExpression"); 3016 }; 3017 var Nt = A.prototype; 3018 Nt.raise = function(t, e) { 3019 var i = de(this.input, t); 3020 e += " (" + i.line + ":" + i.column + ")", this.sourceFile && (e += " in " + this.sourceFile); 3021 var s = new SyntaxError(e); 3022 throw s.pos = t, s.loc = i, s.raisedAt = this.pos, s; 3023 }, Nt.raiseRecoverable = Nt.raise, Nt.curPosition = function() { 3024 if (this.options.locations) return new ft(this.curLine, this.pos - this.lineStart); 3025 }; 3026 var tt = A.prototype, xi = function(e) { 3027 this.flags = e, this.var = [], this.lexical = [], this.functions = []; 3028 }; 3029 tt.enterScope = function(t) { 3030 this.scopeStack.push(new xi(t)); 3031 }, tt.exitScope = function() { 3032 this.scopeStack.pop(); 3033 }, tt.treatFunctionsAsVarInScope = function(t) { 3034 return t.flags & st || !this.inModule && t.flags & it; 3035 }, tt.declareName = function(t, e, i) { 3036 var s = !1; 3037 if (e === Q) { 3038 var r = this.currentScope(); 3039 s = r.lexical.indexOf(t) > -1 || r.functions.indexOf(t) > -1 || r.var.indexOf(t) > -1, r.lexical.push(t), this.inModule && r.flags & it && delete this.undefinedExports[t]; 3040 } else if (e === Se) this.currentScope().lexical.push(t); 3041 else if (e === _e) { 3042 var o = this.currentScope(); 3043 this.treatFunctionsAsVar ? s = o.lexical.indexOf(t) > -1 : s = o.lexical.indexOf(t) > -1 || o.var.indexOf(t) > -1, o.functions.push(t); 3044 } else for (var n = this.scopeStack.length - 1; n >= 0; --n) { 3045 var h = this.scopeStack[n]; 3046 if (h.lexical.indexOf(t) > -1 && !(h.flags & ve && h.lexical[0] === t) || !this.treatFunctionsAsVarInScope(h) && h.functions.indexOf(t) > -1) { 3047 s = !0; 3048 break; 3049 } 3050 if (h.var.push(t), this.inModule && h.flags & it && delete this.undefinedExports[t], h.flags & Et) break; 3051 } 3052 s && this.raiseRecoverable(i, "Identifier '" + t + "' has already been declared"); 3053 }, tt.checkLocalExport = function(t) { 3054 this.scopeStack[0].lexical.indexOf(t.name) === -1 && this.scopeStack[0].var.indexOf(t.name) === -1 && (this.undefinedExports[t.name] = t); 3055 }, tt.currentScope = function() { 3056 return this.scopeStack[this.scopeStack.length - 1]; 3057 }, tt.currentVarScope = function() { 3058 for (var t = this.scopeStack.length - 1;; t--) { 3059 var e = this.scopeStack[t]; 3060 if (e.flags & (Et | dt | rt)) return e; 3061 } 3062 }, tt.currentThisScope = function() { 3063 for (var t = this.scopeStack.length - 1;; t--) { 3064 var e = this.scopeStack[t]; 3065 if (e.flags & (Et | dt | rt) && !(e.flags & Wt)) return e; 3066 } 3067 }; 3068 var Lt = function(e, i, s) { 3069 this.type = "", this.start = i, this.end = 0, e.options.locations && (this.loc = new kt(e, s)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [i, 0]); 3070 }, gt = A.prototype; 3071 gt.startNode = function() { 3072 return new Lt(this, this.start, this.startLoc); 3073 }, gt.startNodeAt = function(t, e) { 3074 return new Lt(this, t, e); 3075 }; 3076 function Ce(t, e, i, s) { 3077 return t.type = e, t.end = i, this.options.locations && (t.loc.end = s
3077), this.options.ranges && (t.range[1] = i), t; 3078 } 3079 gt.finishNode = function(t, e) { 3080 return Ce.call(this, t, e, this.lastTokEnd, this.lastTokEndLoc); 3081 }, gt.finishNodeAt = function(t, e, i, s) { 3082 return Ce.call(this, t, e, i, s); 3083 }, gt.copyNode = function(t) { 3084 var e = new Lt(this, t.start, this.startLoc); 3085 for (var i in t) e[i] = t[i]; 3086 return e; 3087 }; 3088 var _i = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", Ee = "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", Pe = Ee + " Extended_Pictographic", Ae = Pe, Ie = Ae + " EBase EComp EMod EPres ExtPict", Ne = Ie, Si = { 3089 9: Ee, 3090 10: Pe, 3091 11: Ae, 3092 12: Ie, 3093 13: Ne, 3094 14: Ne 3095 }, bi = { 3096 9: "", 3097 10: "", 3098 11: "", 3099 12: "", 3100 13: "", 3101 14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji" 3102 }, Le = "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", Te = "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 Re
3102jang 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", Ve = Te + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", Re = Ve + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", Oe = Re + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", Me = Oe + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", wi = { 3103 9: Te, 3104 10: Ve, 3105 11: Re, 3106 12: Oe, 3107 13: Me, 3108 14: Me + " " + _i 3109 }, Be = {}; 3110 function ki(t) { 3111 var e = Be[t] = { 3112 binary: J(Si[t] + " " + Le), 3113 binaryOfStrings: J(bi[t]), 3114 nonBinary: { 3115 General_Category: J(Le), 3116 Script: J(wi[t]) 3117 } 3118 }; 3119 e.nonBinary.Script_Extensions = e.nonBinary.Script, e.nonBinary.gc = e.nonBinary.General_Category, e.nonBinary.sc = e.nonBinary.Script, e.nonBinary.scx = e.nonBinary.Script_Extensions; 3120 } 3121 for (var $t = 0, De = [ 3122 9, 3123 10, 3124 11, 3125 12, 3126 13, 3127 14 3128 ]; $t < De.length; $t += 1) { 3129 var Ci = De[$t]; 3130 ki(Ci); 3131 } 3132 var f = A.prototype, Tt = function(e, i) { 3133 this.parent = e, this.base = i || this; 3134 }; 3135 Tt.prototype.separatedFrom = function(e) { 3136 for (var i = this; i; i = i.parent) for (var s = e; s; s = s.parent) if (i.base === s.base && i !== s) return !0; 3137 return !1; 3138 }, Tt.prototype.sibling = function() { 3139 return new Tt(this.parent, this.base); 3140 }; 3141 var W = function(e) { 3142 this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = Be[e.options.ecmaVersion >= 14 ? 14 : e.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; 3143 }; 3144 W.prototype.reset = function(e, i, s) { 3145 var r = s.indexOf("v") !== -1, o = s.indexOf("u") !== -1; 3146 this.start = e | 0, this.source = i + "", this.flags = s, r && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = o && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = o && this.parser.options.ecmaVersion >= 9); 3147 }, W.prototype.raise = function(e) { 3148 this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e); 3149 }, W.prototype.at = function(e, i) { 3150 i === void 0 && (i = !1); 3151 var s = this.source, r = s.length; 3152 if (e >= r) return -1; 3153 var o = s.charCodeAt(e); 3154 if (!(i || this.switchU) || o <= 55295 || o >= 57344 || e + 1 >= r) return o; 3155 var n = s.charCodeAt(e + 1); 3156 return n >= 56320 && n <= 57343 ? (o << 10) + n - 56613888 : o; 3157 }, W.prototype.nextIndex = function(e, i) { 3158 i === void 0 && (i = !1); 3159 var s = this.source, r = s.length; 3160 if (e >= r) return r; 3161 var o = s.charCodeAt(e), n; 3162 return !(i || this.switchU) || o <= 55295 || o >= 57344 || e + 1 >= r || (n = s.charCodeAt(e + 1)) < 56320 || n > 57343 ? e + 1 : e + 2; 3163 }, W.prototype.current = function(e) { 3164 return e === void 0 && (e = !1), this.at(this.pos, e); 3165 }, W.prototype.lookahead = function(e) { 3166 return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e); 3167 }, W.prototype.advance = function(e) { 3168 e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e); 3169 }, W.prototype.eat = function(e, i) { 3170 return i === void 0 && (i = !1), this.current(i) === e ? (this.advance(i), !0) : !1; 3171 }, W.prototype.eatChars = function(e, i) { 3172 i === void 0 && (i = !1); 3173 for (var s = this.pos, r = 0, o = e; r < o.length; r += 1) { 3174 var n = o[r], h = this.at(s, i); 3175 if (h === -1 || h !== n) return !1; 3176 s = this.nextIndex(s, i); 3177 } 3178 return this.pos = s, !0; 3179 }, f.validateRegExpFlags = function(t) { 3180 for (var e = t.validFlags, i = t.flags, s = !1, r = !1, o = 0; o < i.length; o++) { 3181 var n = i.charAt(o); 3182 e.indexOf(n) === -1 && this.raise(t.start, "Invalid regular expression flag"), i.indexOf(n, o + 1) > -1 && this.raise(t.start, "Duplicate regular expression flag"), n === "u" && (s = !0), n === "v" && (r = !0); 3183 } 3184 this.options.ecmaVersion >= 15 && s && r && this.raise(t.start, "Invalid regular expression flag"); 3185 }; 3186 function Ei(t) { 3187 for (var e in t) return !0; 3188 return !1; 3189 } 3190 f.validateRegExpPattern = function(t) { 3191 this.regexp_pattern(t), !t.switchN && this.options.ecmaVersion >= 9 && Ei(t.groupNames) && (t.switchN = !0, this.regexp_pattern(t)); 3192 }, f.regexp_pattern = function(t) { 3193 t.pos = 0, t.lastIntValue = 0, t.lastStringValue = "", t.lastAssertionIsQuantifiable = !1, t.numCapturingParens = 0, t.maxBackReference = 0, t.groupNames = Object.create(null), t.backReferenceNames.length = 0, t.branchID = null, this.regexp_disjunction(t), t.pos !== t.source.length && (t.eat(41) && t.raise("Unmatched ')'"), (t.eat(93) || t.eat(125)) && t.raise("Lone quantifier brackets")), t.maxBackReference > t.numCapturingParens && t.raise("Invalid escape"); 3194 for (var e = 0, i = t.backReferenceNames; e < i.length; e += 1) { 3195 var s = i[e]; 3196 t.groupNames[s] || t.raise("Invalid named capture referenced"); 3197 } 3198 }, f.regexp_disjunction = function(t) { 3199 var e = this.options.ecmaVersion >= 16; 3200 for (e && (t.branchID = new Tt(t.branchID, null)), this.regexp_alternative(t); t.eat(124);) e && (t.branchID = t.branchID.sibling()), this.regexp_alternative(t); 3201 e && (t.branchID = t.branchID.parent), this.regexp_eatQuantifier(t,
3201!0) && t.raise("Nothing to repeat"), t.eat(123) && t.raise("Lone quantifier brackets"); 3202 }, f.regexp_alternative = function(t) { 3203 for (; t.pos < t.source.length && this.regexp_eatTerm(t);); 3204 }, f.regexp_eatTerm = function(t) { 3205 return this.regexp_eatAssertion(t) ? (t.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(t) && t.switchU && t.raise("Invalid quantifier"), !0) : (t.switchU ? this.regexp_eatAtom(t) : this.regexp_eatExtendedAtom(t)) ? (this.regexp_eatQuantifier(t), !0) : !1; 3206 }, f.regexp_eatAssertion = function(t) { 3207 var e = t.pos; 3208 if (t.lastAssertionIsQuantifiable = !1, t.eat(94) || t.eat(36)) return !0; 3209 if (t.eat(92)) { 3210 if (t.eat(66) || t.eat(98)) return !0; 3211 t.pos = e; 3212 } 3213 if (t.eat(40) && t.eat(63)) { 3214 var i = !1; 3215 if (this.options.ecmaVersion >= 9 && (i = t.eat(60)), t.eat(61) || t.eat(33)) return this.regexp_disjunction(t), t.eat(41) || t.raise("Unterminated group"), t.lastAssertionIsQuantifiable = !i, !0; 3216 } 3217 return t.pos = e, !1; 3218 }, f.regexp_eatQuantifier = function(t, e) { 3219 return e === void 0 && (e = !1), this.regexp_eatQuantifierPrefix(t, e) ? (t.eat(63), !0) : !1; 3220 }, f.regexp_eatQuantifierPrefix = function(t, e) { 3221 return t.eat(42) || t.eat(43) || t.eat(63) || this.regexp_eatBracedQuantifier(t, e); 3222 }, f.regexp_eatBracedQuantifier = function(t, e) { 3223 var i = t.pos; 3224 if (t.eat(123)) { 3225 var s = 0, r = -1; 3226 if (this.regexp_eatDecimalDigits(t) && (s = t.lastIntValue, t.eat(44) && this.regexp_eatDecimalDigits(t) && (r = t.lastIntValue), t.eat(125))) return r !== -1 && r < s && !e && t.raise("numbers out of order in {} quantifier"), !0; 3227 t.switchU && !e && t.raise("Incomplete quantifier"), t.pos = i; 3228 } 3229 return !1; 3230 }, f.regexp_eatAtom = function(t) { 3231 return this.regexp_eatPatternCharacters(t) || t.eat(46) || this.regexp_eatReverseSolidusAtomEscape(t) || this.regexp_eatCharacterClass(t) || this.regexp_eatUncapturingGroup(t) || this.regexp_eatCapturingGroup(t); 3232 }, f.regexp_eatReverseSolidusAtomEscape = function(t) { 3233 var e = t.pos; 3234 if (t.eat(92)) { 3235 if (this.regexp_eatAtomEscape(t)) return !0; 3236 t.pos = e; 3237 } 3238 return !1; 3239 }, f.regexp_eatUncapturingGroup = function(t) { 3240 var e = t.pos; 3241 if (t.eat(40)) { 3242 if (t.eat(63)) { 3243 if (this.options.ecmaVersion >= 16) { 3244 var i = this.regexp_eatModifiers(t), s = t.eat(45); 3245 if (i || s) { 3246 for (var r = 0; r < i.length; r++) { 3247 var o = i.charAt(r); 3248 i.indexOf(o, r + 1) > -1 && t.raise("Duplicate regular expression modifiers"); 3249 } 3250 if (s) { 3251 var n = this.regexp_eatModifiers(t); 3252 !i && !n && t.current() === 58 && t.raise("Invalid regular expression modifiers"); 3253 for (var h = 0; h < n.length; h++) { 3254 var l = n.charAt(h); 3255 (n.indexOf(l, h + 1) > -1 || i.indexOf(l) > -1) && t.raise("Duplicate regular expression modifiers"); 3256 } 3257 } 3258 } 3259 } 3260 if (t.eat(58)) { 3261 if (this.regexp_disjunction(t), t.eat(41)) return !0; 3262 t.raise("Unterminated group"); 3263 } 3264 } 3265 t.pos = e; 3266 } 3267 return !1; 3268 }, f.regexp_eatCapturingGroup = function(t) { 3269 if (t.eat(40)) { 3270 if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(t) : t.current() === 63 && t.raise("Invalid group"), this.regexp_disjunction(t), t.eat(41)) return t.numCapturingParens += 1, !0; 3271 t.raise("Unterminated group"); 3272 } 3273 return !1; 3274 }, f.regexp_eatModifiers = function(t) { 3275 for (var e = "", i = 0; (i = t.current()) !== -1 && Pi(i);) e += K(i), t.advance(); 3276 return e; 3277 }; 3278 function Pi(t) { 3279 return t === 105 || t === 109 || t === 115; 3280 } 3281 f.regexp_eatExtendedAtom = function(t) { 3282 return t.eat(46) || this.regexp_eatReverseSolidusAtomEscape(t) || this.regexp_eatCharacterClass(t) || this.regexp_eatUncapturingGroup(t) || this.regexp_eatCapturingGroup(t) || this.regexp_eatInvalidBracedQuantifier(t) || this.regexp_eatExtendedPatternCharacter(t); 3283 }, f.regexp_eatInvalidBracedQuantifier = function(t) { 3284 return this.regexp_eatBracedQuantifier(t, !0) && t.raise("Nothing to repeat"), !1; 3285 }, f.regexp_eatSyntaxCharacter = function(t) { 3286 var e = t.current(); 3287 return qe(e) ? (t.lastIntValue = e, t.advance(), !0) : !1; 3288 }; 3289 function qe(t) { 3290 return t === 36 || t >= 40 && t <= 43 || t === 46 || t === 63 || t >= 91 && t <= 94 || t >= 123 && t <= 125; 3291 } 3292 f.regexp_eatPatternCharacters = function(t) { 3293 for (var e = t.pos, i = 0; (i = t.current()) !== -1 && !qe(i);) t.advance(); 3294 return t.pos !== e; 3295 }, f.regexp_eatExtendedPatternCharacter = function(t) { 3296 var e = t.current(); 3297 return e !== -1 && e !== 36 && !(e >= 40 && e <= 43) && e !== 46 && e !== 63 && e !== 91 && e !== 94 && e !== 124 ? (t.advance(), !0) : !1; 3298 }, f.regexp_groupSpecifier = function(t) { 3299 if (t.eat(63)) { 3300 this.regexp_eatGroupName(t) || t.raise("Invalid group"); 3301 var e = this.options.ecmaVersion >= 16, i = t.groupNames[t.lastStringValue]; 3302 if (i) if (e) for (var s = 0, r = i; s < r.length; s += 1) r[s].separatedFrom(t.branchID) || t.raise("Duplicate capture group name"); 3303 else t.raise("Duplicate capture group name"); 3304 e ? (i || (t.groupNames[t.lastStringValue] = [])).push(t.branchID) : t.groupNames[t.lastStringValue] = !0; 3305 } 3306 }, f.regexp_eatGroupName = function(t) { 3307 if (t.lastStringValue = "", t.eat(60)) { 3308 if (this.regexp_eatRegExpIdentifierName(t) && t.eat(62)) return !0; 3309 t.raise("Invalid capture group name"); 3310 } 3311 return !1; 3312 }, f.regexp_eatRegExpIdentifierName = function(t) { 3313 if (t.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(t)) { 3314 for (t.lastStringValue += K(t.lastIntValue); this.regexp_eatRegExpIdentifierPart(t);) t.lastStringValue += K(t.lastIntValue); 3315 return !0; 3316 } 3317 return !1; 3318 }, f.regexp_eatRegExpIdentifierStart = function(t) { 3319 var e = t.pos, i = this.options.ecmaVersion >= 11, s = t.current(i); 3320 return t.advance(i), s === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(t, i) && (s = t.lastIntValue), Ai(s) ? (t.lastIntValue = s, !0) : (t.pos = e, !1); 3321 }; 3322 function Ai(t) { 3323 return G(t, !0) || t === 36 || t === 95; 3324 } 3325 f.regexp_eatRegExpIdentifierPart = function(t) { 3326 var e = t.pos, i = this.options.ecmaVersion >= 11, s = t.current(i); 3327 return t.advance(i), s === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(t, i) && (s = t.lastIntValue), Ii(s) ? (t.lastIntValue = s, !0) : (t.pos = e, !1); 3328 }; 3329 function Ii(t) { 3330 return $(t, !0) || t === 36 || t === 95 || t === 8204 || t === 8205; 3331 }
3332 f.regexp_eatAtomEscape = function(t) { 3333 return this.regexp_eatBackReference(t) || this.regexp_eatCharacterClassEscape(t) || this.regexp_eatCharacterEscape(t) || t.switchN && this.regexp_eatKGroupName(t) ? !0 : (t.switchU && (t.current() === 99 && t.raise("Invalid unicode escape"), t.raise("Invalid escape")), !1); 3334 }, f.regexp_eatBackReference = function(t) { 3335 var e = t.pos; 3336 if (this.regexp_eatDecimalEscape(t)) { 3337 var i = t.lastIntValue; 3338 if (t.switchU) return i > t.maxBackReference && (t.maxBackReference = i), !0; 3339 if (i <= t.numCapturingParens) return !0; 3340 t.pos = e; 3341 } 3342 return !1; 3343 }, f.regexp_eatKGroupName = function(t) { 3344 if (t.eat(107)) { 3345 if (this.regexp_eatGroupName(t)) return t.backReferenceNames.push(t.lastStringValue), !0; 3346 t.raise("Invalid named reference"); 3347 } 3348 return !1; 3349 }, f.regexp_eatCharacterEscape = function(t) { 3350 return this.regexp_eatControlEscape(t) || this.regexp_eatCControlLetter(t) || this.regexp_eatZero(t) || this.regexp_eatHexEscapeSequence(t) || this.regexp_eatRegExpUnicodeEscapeSequence(t, !1) || !t.switchU && this.regexp_eatLegacyOctalEscapeSequence(t) || this.regexp_eatIdentityEscape(t); 3351 }, f.regexp_eatCControlLetter = function(t) { 3352 var e = t.pos; 3353 if (t.eat(99)) { 3354 if (this.regexp_eatControlLetter(t)) return !0; 3355 t.pos = e; 3356 } 3357 return !1; 3358 }, f.regexp_eatZero = function(t) { 3359 return t.current() === 48 && !Vt(t.lookahead()) ? (t.lastIntValue = 0, t.advance(), !0) : !1; 3360 }, f.regexp_eatControlEscape = function(t) { 3361 var e = t.current(); 3362 return e === 116 ? (t.lastIntValue = 9, t.advance(), !0) : e === 110 ? (t.lastIntValue = 10, t.advance(), !0) : e === 118 ? (t.lastIntValue = 11, t.advance(), !0) : e === 102 ? (t.lastIntValue = 12, t.advance(), !0) : e === 114 ? (t.lastIntValue = 13, t.advance(), !0) : !1; 3363 }, f.regexp_eatControlLetter = function(t) { 3364 var e = t.current(); 3365 return Fe(e) ? (t.lastIntValue = e % 32, t.advance(), !0) : !1; 3366 }; 3367 function Fe(t) { 3368 return t >= 65 && t <= 90 || t >= 97 && t <= 122; 3369 } 3370 f.regexp_eatRegExpUnicodeEscapeSequence = function(t, e) { 3371 e === void 0 && (e = !1); 3372 var i = t.pos, s = e || t.switchU; 3373 if (t.eat(117)) { 3374 if (this.regexp_eatFixedHexDigits(t, 4)) { 3375 var r = t.lastIntValue; 3376 if (s && r >= 55296 && r <= 56319) { 3377 var o = t.pos; 3378 if (t.eat(92) && t.eat(117) && this.regexp_eatFixedHexDigits(t, 4)) { 3379 var n = t.lastIntValue; 3380 if (n >= 56320 && n <= 57343) return t.lastIntValue = (r - 55296) * 1024 + (n - 56320) + 65536, !0; 3381 } 3382 t.pos = o, t.lastIntValue = r; 3383 } 3384 return !0; 3385 } 3386 if (s && t.eat(123) && this.regexp_eatHexDigits(t) && t.eat(125) && Ni(t.lastIntValue)) return !0; 3387 s && t.raise("Invalid unicode escape"), t.pos = i; 3388 } 3389 return !1; 3390 }; 3391 function Ni(t) { 3392 return t >= 0 && t <= 1114111; 3393 } 3394 f.regexp_eatIdentityEscape = function(t) { 3395 if (t.switchU) return this.regexp_eatSyntaxCharacter(t) ? !0 : t.eat(47) ? (t.lastIntValue = 47, !0) : !1; 3396 var e = t.current(); 3397 return e !== 99 && (!t.switchN || e !== 107) ? (t.lastIntValue = e, t.advance(), !0) : !1; 3398 }, f.regexp_eatDecimalEscape = function(t) { 3399 t.lastIntValue = 0; 3400 var e = t.current(); 3401 if (e >= 49 && e <= 57) { 3402 do 3403 t.lastIntValue = 10 * t.lastIntValue + (e - 48), t.advance(); 3404 while ((e = t.current()) >= 48 && e <= 57); 3405 return !0; 3406 } 3407 return !1; 3408 }; 3409 var Ue = 0, Y = 1, U = 2; 3410 f.regexp_eatCharacterClassEscape = function(t) { 3411 var e = t.current(); 3412 if (Li(e)) return t.lastIntValue = -1, t.advance(), Y; 3413 var i = !1; 3414 if (t.switchU && this.options.ecmaVersion >= 9 && ((i = e === 80) || e === 112)) { 3415 t.lastIntValue = -1, t.advance(); 3416 var s; 3417 if (t.eat(123) && (s = this.regexp_eatUnicodePropertyValueExpression(t)) && t.eat(125)) return i && s === U && t.raise("Invalid property name"), s; 3418 t.raise("Invalid property name"); 3419 } 3420 return Ue; 3421 }; 3422 function Li(t) { 3423 return t === 100 || t === 68 || t === 115 || t === 83 || t === 119 || t === 87; 3424 } 3425 f.regexp_eatUnicodePropertyValueExpression = function(t) { 3426 var e = t.pos; 3427 if (this.regexp_eatUnicodePropertyName(t) && t.eat(61)) { 3428 var i = t.lastStringValue; 3429 if (this.regexp_eatUnicodePropertyValue(t)) { 3430 var s = t.lastStringValue; 3431 return this.regexp_validateUnicodePropertyNameAndValue(t, i, s), Y; 3432 } 3433 } 3434 if (t.pos = e, this.regexp_eatLoneUnicodePropertyNameOrValue(t)) { 3435 var r = t.lastStringValue; 3436 return this.regexp_validateUnicodePropertyNameOrValue(t, r); 3437 } 3438 return Ue;
3439 }, f.regexp_validateUnicodePropertyNameAndValue = function(t, e, i) { 3440 lt(t.unicodeProperties.nonBinary, e) || t.raise("Invalid property name"), t.unicodeProperties.nonBinary[e].test(i) || t.raise("Invalid property value"); 3441 }, f.regexp_validateUnicodePropertyNameOrValue = function(t, e) { 3442 if (t.unicodeProperties.binary.test(e)) return Y; 3443 if (t.switchV && t.unicodeProperties.binaryOfStrings.test(e)) return U; 3444 t.raise("Invalid property name"); 3445 }, f.regexp_eatUnicodePropertyName = function(t) { 3446 var e = 0; 3447 for (t.lastStringValue = ""; ze(e = t.current());) t.lastStringValue += K(e), t.advance(); 3448 return t.lastStringValue !== ""; 3449 }; 3450 function ze(t) { 3451 return Fe(t) || t === 95; 3452 } 3453 f.regexp_eatUnicodePropertyValue = function(t) { 3454 var e = 0; 3455 for (t.lastStringValue = ""; Ti(e = t.current());) t.lastStringValue += K(e), t.advance(); 3456 return t.lastStringValue !== ""; 3457 }; 3458 function Ti(t) { 3459 return ze(t) || Vt(t); 3460 } 3461 f.regexp_eatLoneUnicodePropertyNameOrValue = function(t) { 3462 return this.regexp_eatUnicodePropertyValue(t); 3463 }, f.regexp_eatCharacterClass = function(t) { 3464 if (t.eat(91)) { 3465 var e = t.eat(94), i = this.regexp_classContents(t); 3466 return t.eat(93) || t.raise("Unterminated character class"), e && i === U && t.raise("Negated character class may contain strings"), !0; 3467 } 3468 return !1; 3469 }, f.regexp_classContents = function(t) { 3470 return t.current() === 93 ? Y : t.switchV ? this.regexp_classSetExpression(t) : (this.regexp_nonEmptyClassRanges(t), Y); 3471 }, f.regexp_nonEmptyClassRanges = function(t) { 3472 for (; this.regexp_eatClassAtom(t);) { 3473 var e = t.lastIntValue; 3474 if (t.eat(45) && this.regexp_eatClassAtom(t)) { 3475 var i = t.lastIntValue; 3476 t.switchU && (e === -1 || i === -1) && t.raise("Invalid character class"), e !== -1 && i !== -1 && e > i && t.raise("Range out of order in character class"); 3477 } 3478 } 3479 }, f.regexp_eatClassAtom = function(t) { 3480 var e = t.pos; 3481 if (t.eat(92)) { 3482 if (this.regexp_eatClassEscape(t)) return !0; 3483 if (t.switchU) { 3484 var i = t.current(); 3485 (i === 99 || Ge(i)) && t.raise("Invalid class escape"), t.raise("Invalid escape"); 3486 } 3487 t.pos = e; 3488 } 3489 var s = t.current(); 3490 return s !== 93 ? (t.lastIntValue = s, t.advance(), !0) : !1; 3491 }, f.regexp_eatClassEscape = function(t) { 3492 var e = t.pos; 3493 if (t.eat(98)) return t.lastIntValue = 8, !0; 3494 if (t.switchU && t.eat(45)) return t.lastIntValue = 45, !0; 3495 if (!t.switchU && t.eat(99)) { 3496 if (this.regexp_eatClassControlLetter(t)) return !0; 3497 t.pos = e; 3498 } 3499 return this.regexp_eatCharacterClassEscape(t) || this.regexp_eatCharacterEscape(t); 3500 }, f.regexp_classSetExpression = function(t) { 3501 var e = Y, i; 3502 if (!this.regexp_eatClassSetRange(t)) if (i = this.regexp_eatClassSetOperand(t)) { 3503 i === U && (e = U); 3504 for (var s = t.pos; t.eatChars([38, 38]);) { 3505 if (t.current() !== 38 && (i = this.regexp_eatClassSetOperand(t))) { 3506 i !== U && (e = Y); 3507 continue; 3508 } 3509 t.raise("Invalid character in character class"); 3510 } 3511 if (s !== t.pos) return e; 3512 for (; t.eatChars([45, 45]);) this.regexp_eatClassSetOperand(t) || t.raise("Invalid character in character class"); 3513 if (s !== t.pos) return e; 3514 } else t.raise("Invalid character in character class"); 3515 for (;;) if (!this.regexp_eatClassSetRange(t)) { 3516 if (i = this.regexp_eatClassSetOperand(t), !i) return e; 3517 i === U && (e = U); 3518 } 3519 }, f.regexp_eatClassSetRange = function(t) { 3520 var e = t.pos; 3521 if (this.regexp_eatClassSetCharacter(t)) { 3522 var i = t.lastIntValue; 3523 if (t.eat(45) && this.regexp_eatClassSetCharacter(t)) { 3524 var s = t.lastIntValue; 3525 return i !== -1 && s !== -1 && i > s && t.raise("Range out of order in character class"), !0; 3526 } 3527 t.pos = e; 3528 } 3529 return !1; 3530 }, f.regexp_eatClassSetOperand = function(t) { 3531 return this.regexp_eatClassSetCharacter(t) ? Y : this.regexp_eatClassStringDisjunction(t) || this.regexp_eatNestedClass(t); 3532 }, f.regexp_eatNestedClass = function(t) { 3533 var e = t.pos; 3534 if (t.eat(91)) { 3535 var i = t.eat(94), s = this.regexp_classContents(t); 3536 if (t.eat(93)) return i && s === U && t.raise("Negated character class may contain strings"), s; 3537 t.pos = e; 3538 } 3539 if (t.eat(92)) { 3540 var r = this.regexp_eatCharacterClassEscape(t); 3541 if (r) return r; 3542 t.pos = e; 3543 } 3544 return null; 3545 }, f.regexp_eatClassStringDisjunction = function(t) { 3546 var e = t.pos; 3547 if (t.eatChars([92, 113])) { 3548 if (t.eat(123)) { 3549 var i = this.regexp_classStringDisjunctionContents(t); 3550 if (t.eat(125)) return i; 3551 } else t.raise("Invalid escape"); 3552 t.pos = e; 3553 } 3554 return null; 3555 }, f.regexp_classStringDisjunctionContents = function(t) { 3556 for (var e = this.regexp_classString(t); t.eat(124);) this.regexp_classString(t) === U && (e = U); 3557 return e; 3558 }, f.regexp_classString = function(t) { 3559 for (var e = 0; this.regexp_eatClassSetCharacter(t);) e++; 3560 return e === 1 ? Y : U; 3561 }, f.regexp_eatClassSetCharacter = function(t) { 3562 var e = t.pos; 3563 if (t.eat(92)) return this.regexp_eatCharacterEscape(t) || this.regexp_eatClassSetReservedPunctuator(t) ? !0 : t.eat(98) ? (t.lastIntValue = 8,
3563!0) : (t.pos = e, !1); 3564 var i = t.current(); 3565 return i < 0 || i === t.lookahead() && Vi(i) || Ri(i) ? !1 : (t.advance(), t.lastIntValue = i, !0); 3566 }; 3567 function Vi(t) { 3568 return t === 33 || t >= 35 && t <= 38 || t >= 42 && t <= 44 || t === 46 || t >= 58 && t <= 64 || t === 94 || t === 96 || t === 126; 3569 } 3570 function Ri(t) { 3571 return t === 40 || t === 41 || t === 45 || t === 47 || t >= 91 && t <= 93 || t >= 123 && t <= 125; 3572 } 3573 f.regexp_eatClassSetReservedPunctuator = function(t) { 3574 var e = t.current(); 3575 return Oi(e) ? (t.lastIntValue = e, t.advance(), !0) : !1; 3576 }; 3577 function Oi(t) { 3578 return t === 33 || t === 35 || t === 37 || t === 38 || t === 44 || t === 45 || t >= 58 && t <= 62 || t === 64 || t === 96 || t === 126; 3579 } 3580 f.regexp_eatClassControlLetter = function(t) { 3581 var e = t.current(); 3582 return Vt(e) || e === 95 ? (t.lastIntValue = e % 32, t.advance(), !0) : !1; 3583 }, f.regexp_eatHexEscapeSequence = function(t) { 3584 var e = t.pos; 3585 if (t.eat(120)) { 3586 if (this.regexp_eatFixedHexDigits(t, 2)) return !0; 3587 t.switchU && t.raise("Invalid escape"), t.pos = e; 3588 } 3589 return !1; 3590 }, f.regexp_eatDecimalDigits = function(t) { 3591 var e = t.pos, i = 0; 3592 for (t.lastIntValue = 0; Vt(i = t.current());) t.lastIntValue = 10 * t.lastIntValue + (i - 48), t.advance(); 3593 return t.pos !== e; 3594 }; 3595 function Vt(t) { 3596 return t >= 48 && t <= 57; 3597 } 3598 f.regexp_eatHexDigits = function(t) { 3599 var e = t.pos, i = 0; 3600 for (t.lastIntValue = 0; je(i = t.current());) t.lastIntValue = 16 * t.lastIntValue + He(i), t.advance(); 3601 return t.pos !== e; 3602 }; 3603 function je(t) { 3604 return t >= 48 && t <= 57 || t >= 65 && t <= 70 || t >= 97 && t <= 102; 3605 } 3606 function He(t) { 3607 return t >= 65 && t <= 70 ? 10 + (t - 65) : t >= 97 && t <= 102 ? 10 + (t - 97) : t - 48; 3608 } 3609 f.regexp_eatLegacyOctalEscapeSequence = function(t) { 3610 if (this.regexp_eatOctalDigit(t)) { 3611 var e = t.lastIntValue; 3612 if (this.regexp_eatOctalDigit(t)) { 3613 var i = t.lastIntValue; 3614 e <= 3 && this.regexp_eatOctalDigit(t) ? t.lastIntValue = e * 64 + i * 8 + t.lastIntValue : t.lastIntValue = e * 8 + i; 3615 } else t.lastIntValue = e; 3616 return !0; 3617 } 3618 return !1; 3619 }, f.regexp_eatOctalDigit = function(t) { 3620 var e = t.current(); 3621 return Ge(e) ? (t.lastIntValue = e - 48, t.advance(), !0) : (t.lastIntValue = 0, !1); 3622 }; 3623 function Ge(t) { 3624 return t >= 48 && t <= 55; 3625 } 3626 f.regexp_eatFixedHexDigits = function(t, e) { 3627 var i = t.pos; 3628 t.lastIntValue = 0; 3629 for (var s = 0; s < e; ++s) { 3630 var r = t.current(); 3631 if (!je(r)) return t.pos = i, !1; 3632 t.lastIntValue = 16 * t.lastIntValue + He(r), t.advance(); 3633 } 3634 return !0; 3635 }; 3636 var Jt = function(e) { 3637 this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new kt(e, e.startLoc, e.endLoc)), e.options.ranges && (this.range = [e.start, e.end]); 3638 }, _ = A.prototype; 3639 _.next = function(t) { 3640 !t && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new Jt(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken(); 3641 }, _.getToken = function() { 3642 return this.next(), new Jt(this); 3643 }, typeof Symbol < "u" && (_[Symbol.iterator] = function() { 3644 var t = this; 3645 return { next: function() { 3646 var e = t.getToken(); 3647 return { 3648 done: e.type === a.eof, 3649 value: e 3650 }; 3651 } }; 3652 }), _.nextToken = function() { 3653 var t = this.curContext(); 3654 if ((!t || !t.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length) return this.finishToken(a.eof); 3655 if (t.override) return t.override(this); 3656 this.readToken(this.fullCharCodeAtPos()); 3657 }, _.readToken = function(t) { 3658 return G(t, this.options.ecmaVersion >= 6) || t === 92 ? this.readWord() : this.getTokenFromCode(t); 3659 }, _.fullCharCodeAt = function(t) { 3660 var e = this.input.charCodeAt(t); 3661 if (e <= 55295 || e >= 56320) return e; 3662 var i = this.input.charCodeAt(t + 1); 3663 return i <= 56319 || i >= 57344 ? e : (e << 10) + i - 56613888; 3664 }, _.fullCharCodeAtPos = function() { 3665 return this.fullCharCodeAt(this.pos); 3666 }, _.skipBlockComment = function() { 3667 var t = this.options.onComment && this.curPosition(), e = this.pos, i = this.input.indexOf("*/", this.pos += 2); 3668 if (i === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = i + 2, this.options.locations) for (var s = void 0, r = e; (s = le(this.input, r, this.pos)) > -1;) ++this.curLine, r = this.lineStart = s; 3669 this.options.onComment && this.options.onComment(!0, this.input.slice(e + 2, i), e, this.pos, t, this.curPosition()); 3670 }, _.skipLineComment = function(t) { 3671 for (var e = this.pos, i = this.options.onComment && this.curPosition(), s = this.input.charCodeAt(this.pos += t); this.pos < this.input.length && !ht(s);) s = this.input.charCodeAt(++this.pos); 3672 this.options.onComment && this.options.onComment(!1, this.input.slice(e + t, this.pos), e, this.pos, i, this.curPosition()); 3673 }, _.skipSpace = function() { 3674 t: for (; this.pos < this.input.length;) { 3675 var t = this.input.charCodeAt(this.pos); 3676 switch (t) { 3677 case 32: 3678 case 160: 3679 ++this.pos; 3680 break; 3681 case 13: this.input.charCodeAt(this.pos + 1) === 10 && ++this.pos; 3682 case 10: 3683 case 8232: 3684 case 8233: 3685 ++this.pos, this.options.locations && (++this.curLine, this.lineStart = this.pos); 3686 break; 3687 case 47: 3688 switch (this.input.charCodeAt(this.pos + 1)) { 3689 case 42: 3690 this.skipBlockComment(); 3691 break; 3692 case 47: 3693 this.skipLineComment(2); 3694 break; 3695 default: break t; 3696 } 3697 break; 3698 default: if (t > 8 && t < 14 || t >= 5760 && ue.test(String.fromCharCode(t))) ++this.pos; 3699 else break t; 3700 } 3701 } 3702 }, _.finishToken = function(t, e) { 3703 this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition()); 3704 var i = this.type; 3705 this.type = t, this.value = e, this.updateContext(i); 3706 }, _.readToken_dot = function() { 3707 var t = this.input.charCodeAt(this.pos + 1); 3708 if (t >= 48 && t <= 57) return this.readNumber(!0); 3709 var e = this.input.charCodeAt(this.pos + 2); 3710 return this.options.ecmaVersion >= 6 && t === 46 && e === 46 ? (this.pos += 3, this.finishToken(a.ellipsis)) : (++this.pos, this.finishToken(a.dot)); 3711 }, _.readToken_slash = function() { 3712 var t = this.input.charCodeAt(this.pos + 1); 3713 return this.exprAllowed ? (++this.pos, this.readRegexp()) : t === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.slash, 1); 3714 }, _.readToken_mult_modulo_exp = function(t) { 3715 var e = this.input.charCodeAt(this.pos + 1), i = 1, s = t === 42 ? a.star : a.modulo; 3716 return this.options.ecmaVersion >= 7 && t === 42 && e === 42 && (++i, s = a.starstar, e = this.input.charCodeAt(this.pos + 2)), e === 61 ? this.finishOp(a.assign, i + 1) : this.finishOp(s, i); 3717 }, _.readToken_pipe_amp = function(t) { 3718 var e = this.input.charCodeAt(this.pos + 1); 3719 return e === t ? this.options.ecmaVersion >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(a.assign, 3) : this.finishOp(t === 124 ? a.logicalOR : a.logicalAND, 2) : e === 61 ? this.finishOp(a.assign, 2) : this.finishOp(t === 124 ? a.bitwiseOR : a.bitwiseAND, 1); 3720 }, _.readToken_caret = function() { 3721 return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.bitwiseXOR, 1); 3722 }, _.readToken_plus_min = function(t) { 3723 var e = this.input.charCodeAt(this.pos + 1); 3724 return e === t ? e === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || V.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(a.incDec, 2) : e === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.plusMin, 1); 3725 }, _.readToken_lt_gt = function(t) { 3726 var e = this.input.charCodeAt(this.pos + 1), i = 1; 3727 return e === t ? (i = t === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + i) === 61 ? this.finishOp(a.assign, i + 1) : this.finishOp(a.bitShift, i)) : e === 33 && t === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (e === 61 && (i = 2), this.finishOp(a.relational, i)); 3728 }, _.readToken_eq_excl = function(t) { 3729 var e = this.input.charCodeAt(this.pos + 1); 3730 return e === 61 ? this.finishOp(a.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : t === 61 && e === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(a.arrow)) : this.finishOp(t === 61 ? a.eq : a.prefix, 1); 3731 }, _.readToken_question = function() { 3732 var t = this.options.ecmaVersion; 3733 if (t >= 11) { 3734 var e = this.input.charCodeAt(this.pos + 1); 3735 if (e === 46) { 3736 var i = this.input.charCodeAt(this.pos + 2); 3737 if (i < 48 || i > 57) return this.finishOp(a.questionDot, 2); 3738 } 3739 if (e === 63) return t >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(a.assign, 3) : this.finishOp(a.coalesce, 2); 3740 } 3741 return this.finishOp(a.question, 1); 3742 }, _.readToken_numberSign = function() { 3743 var t = this.options.ecmaVersion, e = 35; 3744 if (t >= 13 && (++this.pos, e = this.fullCharCodeAtPos(), G(e, !0) || e === 92)) return this.finishToken(a.privateId, this.readWord1()); 3745 this.raise(this.pos, "Unexpected character '" + K(e) + "'"); 3746 }, _.getTokenFromCode = function(t) { 3747 switch (t) { 3748 case 46: return this.readToken_dot(); 3749 case 40: return ++this.pos, this.finishToken(a.parenL); 3750 case 41: return ++this.pos, this.finishToken(a.parenR); 3751 case 59: return ++this.pos, this.finishToken(a.semi); 3752 case 44: return ++this.pos, this.finishToken(a.comma); 3753 case 91: return ++this.pos, this.finishToken(a.bracketL); 3754 case 93: return ++this.pos, this.finishToken(a.bracketR); 3755 case 123: return ++this.pos, this.finishToken(a.braceL); 3756 case 125: return ++this.pos, this.finishToken(a.braceR); 3757 case 58: return ++this.pos, this.finishToken(a.colon); 3758 case 96: 3759 if (this.options.ecmaVersion < 6) break; 3760 return ++this.pos, this.finishToken(a.backQuote); 3761 case 48: 3762 var e = this.input.charCodeAt(this.pos + 1); 3763 if (e === 120 || e === 88) return this.readRadixNumber(16); 3764 if (this.options.ecmaVersion >= 6) { 3765 if (e === 111 || e === 79) return this.readRadixNumber(8); 3766 if (e === 98 || e === 66) return this.readRadixNumber(2); 3767 } 3768 case 49: 3769 case 50: 3770 case 51: 3771 case 52: 3772 case 53: 3773 case 54: 3774 case 55: 3775 case 56: 3776 case 57: return this.readNumber(!1); 3777 case 34: 3778 case 39: return this.readString(t); 3779 case 47: return this.readToken_slash(); 3780 case 37: 3781 case 42: return this.readToken_mult_modulo_exp(t); 3782 case 124: 3783 case 38: return this.readToken_pipe_amp(t); 3784 case 94: return this.readToken_caret(); 3785 case 43: 3786 case 45: return this.readToken_plus_min(t); 3787 case 60: 3788 case 62: return this.readToken_lt_gt(t); 3789 case 61: 3790 case 33: return this.readToken_eq_excl(t); 3791 case 63: return this.readToken_question(); 3792 case 126: return this.finishOp(a.prefix, 1); 3793 case 35: return this.readToken_numberSign(); 3794 } 3795 this.raise(this.pos, "Unexpected character '" + K(t) + "'"); 3796 }, _.finishOp = function(t, e) { 3797 var i = this.input.slice(this.pos, this.pos + e); 3798 return this.pos += e, this.finishToken(t, i); 3799 }, _.readRegexp = function() { 3800 for (var t, e, i = this.pos;;) { 3801 this.pos >= this.input.length && this.raise(i, "Unterminated regular expression"); 3802 var s = this.input.charAt(this.pos); 3803 if (V.test(s) && this.raise(i, "Unterminated regular expression"), t) t = !1; 3804 else { 3805 if (s === "[") e = !0; 3806 else if (s === "]" && e) e = !1; 3807 else if (s === "/" && !e) break; 3808 t = s === "\\"; 3809 } 3810 ++this.pos; 3811 } 3812 var r = this.input.slice(i, this.pos); 3813 ++this.pos; 3814 var o = this.pos, n = this.readWord1(); 3815 this.containsEsc && this.unexpected(o);
3816 var h = this.regexpState || (this.regexpState = new W(this)); 3817 h.reset(i, r, n), this.validateRegExpFlags(h), this.validateRegExpPattern(h); 3818 var l = null; 3819 try { 3820 l = new RegExp(r, n); 3821 } catch {} 3822 return this.finishToken(a.regexp, { 3823 pattern: r, 3824 flags: n, 3825 value: l 3826 }); 3827 }, _.readInt = function(t, e, i) { 3828 for (var s = this.options.ecmaVersion >= 12 && e === void 0, r = i && this.input.charCodeAt(this.pos) === 48, o = this.pos, n = 0, h = 0, l = 0, u = e ?? Infinity; l < u; ++l, ++this.pos) { 3829 var c = this.input.charCodeAt(this.pos), p = void 0; 3830 if (s && c === 95) { 3831 r && this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"), h === 95 && this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"), l === 0 && this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"), h = c; 3832 continue; 3833 } 3834 if (c >= 97 ? p = c - 97 + 10 : c >= 65 ? p = c - 65 + 10 : c >= 48 && c <= 57 ? p = c - 48 : p = Infinity, p >= t) break; 3835 h = c, n = n * t + p; 3836 } 3837 return s && h === 95 && this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"), this.pos === o || e != null && this.pos - o !== e ? null : n; 3838 }; 3839 function Mi(t, e) { 3840 return e ? parseInt(t, 8) : parseFloat(t.replace(/_/g, "")); 3841 } 3842 function We(t) { 3843 return typeof BigInt != "function" ? null : BigInt(t.replace(/_/g, "")); 3844 } 3845 _.readRadixNumber = function(t) { 3846 var e = this.pos; 3847 this.pos += 2; 3848 var i = this.readInt(t); 3849 return i == null && this.raise(this.start + 2, "Expected number in radix " + t), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (i = We(this.input.slice(e, this.pos)), ++this.pos) : G(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(a.num, i); 3850 }, _.readNumber = function(t) { 3851 var e = this.pos; 3852 !t && this.readInt(10, void 0, !0) === null && this.raise(e, "Invalid number"); 3853 var i = this.pos - e >= 2 && this.input.charCodeAt(e) === 48; 3854 i && this.strict && this.raise(e, "Invalid number"); 3855 var s = this.input.charCodeAt(this.pos); 3856 if (!i && !t && this.options.ecmaVersion >= 11 && s === 110) { 3857 var r = We(this.input.slice(e, this.pos)); 3858 return ++this.pos, G(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(a.num, r); 3859 } 3860 i && /[89]/.test(this.input.slice(e, this.pos)) && (i = !1), s === 46 && !i && (++this.pos, this.readInt(10), s = this.input.charCodeAt(this.pos)), (s === 69 || s === 101) && !i && (s = this.input.charCodeAt(++this.pos), (s === 43 || s === 45) && ++this.pos, this.readInt(10) === null && this.raise(e, "Invalid number")), G(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"); 3861 var o = Mi(this.input.slice(e, this.pos), i); 3862 return this.finishToken(a.num, o); 3863 }, _.readCodePoint = function() { 3864 var t = this.input.charCodeAt(this.pos), e; 3865 if (t === 123) { 3866 this.options.ecmaVersion < 6 && this.unexpected(); 3867 var i = ++this.pos; 3868 e = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, e > 1114111 && this.invalidStringToken(i, "Code point out of bounds"); 3869 } else e = this.readHexChar(4); 3870 return e; 3871 }, _.readString = function(t) { 3872 for (var e = "", i = ++this.pos;;) { 3873 this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant"); 3874 var s = this.input.charCodeAt(this.pos); 3875 if (s === t) break; 3876 s === 92 ? (e += this.input.slice(i, this.pos), e += this.readEscapedChar(!1), i = this.pos) : s === 8232 || s === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (ht(s) && this.raise(this.start, "Unterminated string constant"), ++this.pos); 3877 } 3878 return e += this.input.slice(i, this.pos++), this.finishToken(a.string, e); 3879 }; 3880 var Ke = {}; 3881 _.tryReadTemplateToken = function() { 3882 this.inTemplateElement = !0; 3883 try { 3884 this.readTmplToken(); 3885 } catch (t) {
3886 if (t === Ke) this.readInvalidTemplateToken(); 3887 else throw t; 3888 } 3889 this.inTemplateElement = !1; 3890 }, _.invalidStringToken = function(t, e) { 3891 if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw Ke; 3892 this.raise(t, e); 3893 }, _.readTmplToken = function() { 3894 for (var t = "", e = this.pos;;) { 3895 this.pos >= this.input.length && this.raise(this.start, "Unterminated template"); 3896 var i = this.input.charCodeAt(this.pos); 3897 if (i === 96 || i === 36 && this.input.charCodeAt(this.pos + 1) === 123) return this.pos === this.start && (this.type === a.template || this.type === a.invalidTemplate) ? i === 36 ? (this.pos += 2, this.finishToken(a.dollarBraceL)) : (++this.pos, this.finishToken(a.backQuote)) : (t += this.input.slice(e, this.pos), this.finishToken(a.template, t)); 3898 if (i === 92) t += this.input.slice(e, this.pos), t += this.readEscapedChar(!0), e = this.pos; 3899 else if (ht(i)) { 3900 switch (t += this.input.slice(e, this.pos), ++this.pos, i) { 3901 case 13: this.input.charCodeAt(this.pos) === 10 && ++this.pos; 3902 case 10: 3903 t += ` 3904`; 3905 break; 3906 default: 3907 t += String.fromCharCode(i); 3908 break; 3909 } 3910 this.options.locations && (++this.curLine, this.lineStart = this.pos), e = this.pos; 3911 } else ++this.pos; 3912 } 3913 }, _.readInvalidTemplateToken = function() { 3914 for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) { 3915 case "\\": 3916 ++this.pos; 3917 break; 3918 case "$": if (this.input[this.pos + 1] !== "{") break; 3919 case "`": return this.finishToken(a.invalidTemplate, this.input.slice(this.start, this.pos)); 3920 case "\r": this.input[this.pos + 1] === ` 3921` && ++this.pos; 3922 case ` 3923`: 3924 case "\u2028": 3925 case "\u2029": 3926 ++this.curLine, this.lineStart = this.pos + 1; 3927 break; 3928 } 3929 this.raise(this.start, "Unterminated template"); 3930 }, _.readEscapedChar = function(t) { 3931 var e = this.input.charCodeAt(++this.pos); 3932 switch (++this.pos, e) { 3933 case 110: return ` 3934`; 3935 case 114: return "\r"; 3936 case 120: return String.fromCharCode(this.readHexChar(2)); 3937 case 117: return K(this.readCodePoint()); 3938 case 116: return " "; 3939 case 98: return "\b"; 3940 case 118: return "\v"; 3941 case 102: return "\f"; 3942 case 13: this.input.charCodeAt(this.pos) === 10 && ++this.pos; 3943 case 10: return this.options.locations && (this.lineStart = this.pos, ++this.curLine), ""; 3944 case 56: 3945 case 57: if (this.strict && this.invalidStringToken(this.pos - 1, "Invalid escape sequence"), t) { 3946 var i = this.pos - 1; 3947 this.invalidStringToken(i, "Invalid escape sequence in template string"); 3948 } 3949 default: 3950 if (e >= 48 && e <= 55) { 3951 var s = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0], r = parseInt(s, 8); 3952 return r > 255 && (s = s.slice(0, -1), r = parseInt(s, 8)), this.pos += s.length - 1, e = this.input.charCodeAt(this.pos), (s !== "0" || e === 56 || e === 57) && (this.strict || t) && this.invalidStringToken(this.pos - 1 - s.length, t ? "Octal literal in template string" : "Octal literal in strict mode"), String.fromCharCode(r); 3953 } 3954 return ht(e) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(e); 3955 } 3956 }, _.readHexChar = function(t) { 3957 var e = this.pos, i = this.readInt(16, t); 3958 return i === null && this.invalidStringToken(e, "Bad character escape sequence"), i; 3959 }, _.readWord1 = function() { 3960 this.containsEsc = !1; 3961 for (var t = "", e = !0, i = this.pos, s = this.options.ecmaVersion >= 6; this.pos < this.input.length;) { 3962 var r = this.fullCharCodeAtPos(); 3963 if ($(r, s)) this.pos += r <= 65535 ? 1 : 2; 3964 else if (r === 92) { 3965 this.containsEsc = !0, t += this.input.slice(i, this.pos); 3966 var o = this.pos; 3967 this.input.charCodeAt(++this.pos) !== 117 && this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"), ++this.pos; 3968 var n = this.readCodePoint(); 3969 (e ? G : $)(n, s) || this.invalidStringToken(o, "Invalid Unicode escape"), t += K(n), i = this.pos; 3970 } else break; 3971 e = !1; 3972 } 3973 return t + this.input.slice(i, this.pos); 3974 }, _.readWord = function() { 3975 var t = this.readWord1(), e = a.name; 3976 return this.keywords.test(t) && (e = jt[t]), this.finishToken(e, t); 3977 }; 3978 A.acorn = { 3979 Parser: A, 3980 version: "8.18.0", 3981 defaultOptions: Ht, 3982 Position: ft, 3983 SourceLocation: kt, 3984 getLineInfo: de, 3985 Node: Lt, 3986 TokenType: b, 3987 tokTypes: a, 3988 keywordTypes: jt, 3989 TokContext: j, 3990 tokContexts: E, 3991 isIdentifierChar: $, 3992 isIdentifierStart: G, 3993 Token: Jt, 3994 isNewLine: ht, 3995 lineBreak: V, 3996 lineBreakG: hi, 3997 nonASCIIwhitespace: ue 3998 }; 3999 function Di(t, e) { 4000 return A.parse(t, e); 4001 } 4002 const qi = Object.freeze({ 4003 version: "1.3.0", 4004 canonicalSignature: "function strategy(ctx) { /* ... */ }", 4005 ctxShape: Object.freeze({ 4006 bar: "current CLOSED bar { time, open, high, low, close, volume }; time is a Unix-seconds NUMBER (not a Date)", 4007 clock: "exchange-local clock { timezone, dayKey, hour, minute, minuteOfDay, sessionType, isRegularSession, isExtendedSession, inSelectedSession, minutesFromSessionOpen, minutesToSessionClose }; use this for session/time rules", 4008 index: "integer index of the current bar within the dataset", 4009 history: "array of bars from the start up to AND INCLUDING the current bar", 4010 position: "open position { side, size, entryPrice, ... } or null", 4011 equity: "current account equity (number)", 4012 params: "the strategy parameter object (see parameters[])", 4013 indicators: "scalar indicator values AT the current bar (see indicators[])", 4014 previousIndicators: "the same indicator scalars at the PRIOR closed bar; use these for crossover rules", 4015 actions: "order actions (see actions[])" 4016 }), 4017 indicators: Object.freeze([ 4018 { 4019 name: "rsi", 4020 type: "number|null", 4021 desc: "RSI(14), 0â100" 4022 }, 4023 { 4024 name: "sma20", 4025 type: "number|null", 4026 desc: "Simple moving average, 20" 4027 }, 4028 { 4029 name: "sma50", 4030 type: "number|null", 4031 desc: "Simple moving average, 50" 4032 }, 4033 { 4034 name: "ema9", 4035 type: "number|null", 4036 desc: "Exponential moving average, 9" 4037 }, 4038 { 4039 name: "ema21", 4040 type: "number|null", 4041 desc: "Exponential moving average, 21" 4042 }, 4043 { 4044 name: "vwap", 4045 type: "number|null", 4046 desc: "Session VWAP (resets daily)" 4047 }, 4048 { 4049 name: "atr", 4050 type: "number|null", 4051 desc: "Average True Range(14)" 4052 }, 4053 { 4054 name: "macd", 4055 type: "number|null", 4056 desc: "MACD line (12,26)" 4057 }, 4058 { 4059 name: "macdSignal", 4060 type: "number|null", 4061 desc: "MACD signal line (9)" 4062 }, 4063 { 4064 name: "macdHist", 4065 type: "number|null", 4066 desc: "MACD histogram" 4067 }, 4068 { 4069 name: "bbUpper", 4070 type: "number|null", 4071 desc: "Bollinger upper (20,2)" 4072 }, 4073 { 4074 name: "bbMiddle", 4075 type: "number|null", 4076 desc: "Bollinger middle (SMA20)" 4077 }, 4078 { 4079 name: "bbLower", 4080 type: "number|null", 4081 desc: "Bollinger lower (20,2)" 4082 } 4083 ]), 4084 actions: Object.freeze([ 4085 { 4086 name: "enterLong", 4087 args: "(opts?: { size?, sl?, tp?, trail?, ruleId?, reason? })", 4088 desc: "Queue a long entry for the next bar; ruleId/reason attach runtime intent evidence." 4089 }, 4090 { 4091 name: "enterShort", 4092 args: "(opts?: { size?, sl?, tp?, trail?, ruleId?, reason? })", 4093 desc: "Queue a short entry for the next bar; ruleId/reason attach runtime intent evidence." 4094 }, 4095 { 4096 name: "exit", 4097 args: "(opts?: { ruleId?, reason? })", 4098 desc: "Queue a flat/close for the next bar with optional runtime intent evidence." 4099 }, 4100 { 4101 name: "placeOrder", 4102 args: "(type: 'limit'|'stop', side, price, opts?)", 4103 desc: "Place a pending trigger order." 4104 }, 4105 { 4106 name: "cancelAllOrders", 4107 args: "()", 4108 desc: "Cancel all pending orders." 4109 }, 4110 { 4111 name: "log", 4112 args: "(...args)", 4113 desc: "Append a debug line (capped)." 4114 } 4115 ]), 4116 paramTypes: Object.freeze([ 4117 "number", 4118 "boolean", 4119 "string" 4120 ]) 4121 }); 4122 function Fi(t) { 4123 if (typeof t != "string" || !t.trim()) return { 4124 ok: !1, 4125 error: "Strategy code is empty." 4126 }; 4127 let e; 4128 try { 4129 e = Di(t, { 4130 ecmaVersion: 2022, 4131 sourceType: "script" 4132 }); 4133 } catch (r) { 4134 return { 4135 ok: !1, 4136 error: `Syntax error${r?.loc ? ` (line ${r.loc.line})` : ""}: ${r.message}` 4137 }; 4138 } 4139 const i = e.body || []; 4140 if (i.length !== 1) return { 4141 ok: !1, 4142 error: `Strategy must contain exactly one top-level function \`strategy(ctx)\` and nothing else (found ${i.length} top-level statements).` 4143 }; 4144 const s = i[0]; 4145 return s.type !== "FunctionDeclaration" ? { 4146 ok: !1, 4147 error: "Top-level statement must be a `function strategy(ctx)` declaration (no imports, exports, or loose statements)." 4148 }
4148 : !s.id || s.id.name !== "strategy" ? { 4149 ok: !1, 4150 error: `Function must be named \`strategy\` (found \`${s.id?.name ?? "anonymous"}\`).` 4151 } : s.async ? { 4152 ok: !1, 4153 error: "`strategy` must not be async." 4154 } : s.generator ? { 4155 ok: !1, 4156 error: "`strategy` must not be a generator." 4157 } : s.params.length !== 1 || s.params[0].type !== "Identifier" || s.params[0].name !== "ctx" ? { 4158 ok: !1, 4159 error: "`strategy` must take exactly one parameter named `ctx`." 4160 } : Ui(e, (r) => r.type === "CallExpression" && r.callee?.type === "MemberExpression" && !r.callee.computed && /^(getUTC|setUTC|getHours$|getMinutes$|getDay$|getDate$|getMonth$|getFullYear$)/.test(r.callee.property?.name || "")) ? { 4161 ok: !1, 4162 error: "`ctx.bar.time` is Unix seconds, not a Date. Use `ctx.clock` for exchange-local hour, minute, session, and close-time rules." 4163 } : { 4164 ok: !0, 4165 error: null 4166 }; 4167 } 4168 function Ui(t, e) { 4169 const i = /* @__PURE__ */ new Set(), s = [t]; 4170 for (; s.length;) { 4171 const r = s.pop(); 4172 if (!(!r || typeof r != "object" || i.has(r))) { 4173 if (i.add(r), e(r)) return r; 4174 for (const [o, n] of Object.entries(r)) o === "start" || o === "end" || o === "loc" || (Array.isArray(n) ? s.push(...n) : n && typeof n == "object" && s.push(n)); 4175 } 4176 } 4177 return null; 4178 } 4179 function zi(t) { 4180 const e = Fi(t); 4181 if (!e.ok) return { 4182 ok: !1, 4183 fn: null, 4184 error: e.error 4185 }; 4186 try { 4187 const i = new Function(`"use strict"; 4188${t} 4189return strategy;`)(); 4190 return typeof i != "function" ? { 4191 ok: !1, 4192 fn: null, 4193 error: "Compiled strategy is not a function." 4194 } : { 4195 ok: !0, 4196 fn: i, 4197 error: null 4198 }; 4199 } catch (i) { 4200 return { 4201 ok: !1, 4202 fn: null, 4203 error: `Compile error: ${i.message}` 4204 }; 4205 } 4206 } 4207 function R(t) { 4208 const e = /* @__PURE__ */ new Map(); 4209 for (const i of t) e.set(i.time, i.value); 4210 return e; 4211 } 4212 function ji(t, e = {}) { 4213 const i = ei(t), s = Je(t, 20, 2); 4214 return { 4215 rsi: R(ti(t, 14)), 4216 sma20: R(ae(t, 20)), 4217 sma50: R(ae(t, 50)), 4218 ema9: R(wt(t, 9)), 4219 ema21: R(wt(t, 21)), 4220 vwap: R($e(t, e.marketSession)), 4221 atr: R(ii(t, 14)), 4222 macd: R(i.macdLine), 4223 macdSignal: R(i.signalLine), 4224 macdHist: R(i.histogram), 4225 bbUpper: R(s.upper), 4226 bbMiddle: R(s.middle), 4227 bbLower: R(s.lower) 4228 }; 4229 } 4230 const O = (t) => typeof t == "number" && isFinite(t) ? t : null; 4231 function Qe(t, e) { 4232 return { 4233 rsi: O(t.rsi.get(e)), 4234 sma20: O(t.sma20.get(e)), 4235 sma50: O(t.sma50.get(e)), 4236 ema9: O(t.ema9.get(e)), 4237 ema21: O(t.ema21.get(e)), 4238 vwap: O(t.vwap.get(e)), 4239 atr: O(t.atr.get(e)), 4240 macd: O(t.macd.get(e)), 4241 macdSignal: O(t.macdSignal.get(e)), 4242 macdHist: O(t.macdHist.get(e)), 4243 bbUpper: O(t.bbUpper.get(e)), 4244 bbMiddle: O(t.bbMiddle.get(e)), 4245 bbLower: O(t.bbLower.get(e)) 4246 }; 4247 } 4248 const Hi = 500; 4249 function Gi(t, e, i, s = {}, r = {}) { 4250 const o = r.fillPolicy || "next-bar", n = []; 4251 let h = null, l = null; 4252 const u = { 4253 strategyEvaluations: 0, 4254 entryIntents: 0, 4255 exitIntents: 0, 4256 runtimeErrors: 0, 4257 uniqueRuntimeErrors: 0, 4258 firstRuntimeError: null 4259 }, c = /* @__PURE__ */ new Set(), p = Object.freeze({ ...s }), x = (g = {}) => Object.freeze({ 4260 ...l, 4261 ruleId: typeof g.ruleId == "string" ? g.ruleId.slice(0, 80) : null, 4262 reason: typeof g.reason == "string" ? g.reason.slice(0, 300) : null 4263 }), P = (g = null) => { 4264 if (!h) return; 4265 const y = h; 4266 if (h = null, y.kind === "exit") { 4267 t.position && (t.position.exitSignal = y.signal || null), g != null && t.exitPositionAt ? t.exitPositionAt(g, "strategy-exit") : t.exitPosition("strategy-exit"); 4268 return; 4269 } 4270 if (t.position) return; 4271 const w = y.size != null ? y.size : null; 4272 let C = null; 4273 y.side === "long" ? g != null && t.enterLongAt ? C = t.enterLongAt(g, w, y.sl ?? null, y.tp ?? null, y.trail ?? null) : C = t.enterLong(w, y.sl ?? null, y.tp ?? null, y.trail ?? null) : g != null && t.enterShortAt ? C = t.enterShortAt(g, w, y.sl ?? null, y.tp ?? null, y.trail ?? null) : C = t.enterShort(w, y.sl ?? null, y.tp ?? null, y.trail ?? null), C?.ok && t.position && (t.position.signal = y.signal || null); 4274 }, I = { 4275 enterLong(g = {}) { 4276 t.position || (u.entryIntents += 1, h = { 4277 kind: "enter", 4278 side: "long", 4279 ...g, 4280 signal: x(g) 4281 }); 4282 }, 4283 enterShort(g = {}) { 4284 t.position || (u.entryIntents += 1, h = { 4285 kind: "enter", 4286 side: "short", 4287 ...g, 4288 signal: x(g) 4289 }); 4290 }, 4291 exit(g = {}) { 4292 t.position && (u.exitIntents += 1, h = { 4293 kind: "exit", 4294 signal: x(g) 4295 }); 4296 }, 4297 placeOrder(g, y, w, C = {}) { 4298 return t.placeOrder(g, y, w, C); 4299 }, 4300 cancelAllOrders() { 4301 t.cancelAllOrders(); 4302 }, 4303 log(...g) { 4304 n.length >= Hi || n.push(g.map((y) => typeof y == "object" ? JSON.stringify(y) : String(y)).join(" ")); 4305 } 4306 }; 4307 return o === "next-bar" && t.attachBeforeBar && t.attachBeforeBar((g) => P(g.open)), t.attachStrategy((g) => { 4308 const y = g.currentBar; 4309 if (!y) return;
4310 const w = Qe(i, y.time), C = t.candles?.[g.cursor - 1] || null, at = C ? Qe(i, C.time) : Object.fromEntries(Object.keys(w).map((X) => [X, null])); 4311 l = Object.freeze({ 4312 time: y.time, 4313 index: g.cursor, 4314 close: y.close, 4315 indicators: Object.freeze({ ...w }) 4316 }); 4317 const z = { 4318 bar: y, 4319 clock: Xe(y.time, r.marketSession), 4320 index: g.cursor, 4321 history: g.visibleCandles, 4322 position: g.position, 4323 equity: g.equity, 4324 params: p, 4325 indicators: w, 4326 previousIndicators: at, 4327 actions: I 4328 }; 4329 u.strategyEvaluations += 1; 4330 try { 4331 e(z); 4332 } catch (X) { 4333 const H = X?.message || String(X); 4334 u.runtimeErrors += 1, u.firstRuntimeError || (u.firstRuntimeError = H), c.has(H) || (c.add(H), u.uniqueRuntimeErrors = c.size, I.log(`[error] ${H}`)); 4335 } 4336 o === "signal-close" && P(g.currentBar?.close), l = null; 4337 }), { 4338 logs: n, 4339 diagnostics: u 4340 }; 4341 } 4342 const Wi = "backtest-engine-v5"; 4343 function vt(t) { 4344 let e = 2166136261; 4345 for (let i = 0; i < t.length; i++) e ^= t.charCodeAt(i), e = Math.imul(e, 16777619); 4346 return (e >>> 0).toString(16).padStart(8, "0"); 4347 } 4348 function Ki(t) { 4349 const e = (r) => typeof r == "number" && isFinite(r) ? r : 0; 4350 let i = `${t.length}|`; 4351 const s = []; 4352 for (const r of t) s.push(`${r.time}:${e(r.open)}:${e(r.high)}:${e(r.low)}:${e(r.close)}:${e(r.volume)}`); 4353 return i += vt(s.join(";")), i; 4354 } 4355 function Qi(t) { 4356 if (!t) return null; 4357 const e = (i, s = 2) => typeof i == "number" && isFinite(i) ? parseFloat(i.toFixed(s)) : i; 4358 return { 4359 totalTrades: t.totalTrades, 4360 winRate: e(t.winRate), 4361 profitFactor: e(t.profitFactor === Infinity ? 999 : t.profitFactor, 3), 4362 netProfit: e(t.netProfit), 4363 finalEquity: e(t.finalEquity), 4364 expectancy: e(t.expectancy, 3), 4365 avgR: e(t.avgR, 3), 4366 maxDrawdown: e(t.maxDrawdown), 4367 maxDrawdownPct: e(t.maxDrawdownPct), 4368 sharpe: e(t.sharpe, 3), 4369 sortino: e(t.sortino, 3), 4370 calmar: e(t.calmar, 3), 4371 maxConsecLosses: t.maxConsecLosses 4372 }; 4373 } 4374 function Yi({ code: t, candles: e, params: i = {}, config: s = {} }) { 4375 const r = zi(t); 4376 if (!r.ok) return { 4377 ok: !1, 4378 error: r.error 4379 }; 4380 if (!Array.isArray(e) || e.length < 2) return { 4381 ok: !1, 4382 error: "Not enough candle data to backtest (need ⥠2 bars)." 4383 }; 4384 const o = e.length > 2e4 ? e.slice(-2e4) : e, n = Number(s.commissionPerTrade) || 0, h = Number(s.slippageBps) || 0, l = Number(s.spreadBps) || 0, u = s.fillPolicy || "next-bar", c = Dt(s.marketSession), p = vt(t), x = vt(JSON.stringify(Xi(i))), P = Ki(o), I = parseInt(vt(`${p}|${x}|${P}`), 16) || 1, g = new Ze({ 4385 startingEquity: s.startingEquity, 4386 commissionPerTrade: n, 4387 slippageBps: h, 4388 spreadBps: l, 4389 monteCarloSeed: I, 4390 symbol: s.symbol, 4391 timeframe: s.timeframe, 4392 sizingMode: s.sizingMode, 4393 sizingValue: s.sizingValue, 4394 riskPct: s.riskPct, 4395 maxDailyLoss: s.maxDailyLoss, 4396 maxDrawdownStopPct: s.maxDrawdownStopPct 4397 }); 4398 g.load(o); 4399 const y = ji(o, { marketSession: c }), w = Gi(g, r.fn, y, i, { 4400 fillPolicy: u, 4401 marketSession: c 4402 }); 4403 if (g.step(o.length), w.diagnostics.runtimeErrors > 0) { 4404 const M = w.diagnostics.runtimeErrors, et = w.diagnostics.firstRuntimeError || "Unknown strategy error"; 4405 return { 4406 ok: !1, 4407 error: `Strategy runtime failed on ${M} bar${M === 1 ? "" : "s"}. First error: ${et}`, 4408 logs: w.logs, 4409 diagnostics: { ...w.diagnostics } 4410 }; 4411 } 4412 g.finalizeAtEnd(); 4413 const C = g.getReport(); 4414 if (C.totalTrades !== C.trades?.length) return { 4415 ok: !1, 4416 error: `Backtest integrity check failed: metrics counted ${C.totalTrades} closed trades but the audit log contains ${C.trades?.length ?? 0}.`, 4417 logs: w.logs 4418 }; 4419 const at = g.warmupBars ?? Math.min(50, Math.max(0, o.length - 1)), z = o.slice(at), X = Ye(o, c), H = Ye(z, c), nt = /* @__PURE__ */ new Map(); 4420 for (const M of C.trades || []) { 4421 const et = qt(M.entryTime, c); 4422 nt.set(et, (nt.get(et) || 0) + 1); 4423 } 4424 const ct = [...nt.keys()].sort(), Rt = { 4425 loadedBars: o.length, 4426 warmupBars: at, 4427 evaluatedBars: z.length, 4428 loadedSessions: X.length, 4429 evaluatedSessions: H.length, 4430 tradeSessions: ct.length, 4431 loadedSessionKeys: X, 4432 evaluatedSessionKeys: H, 4433 tradeSessionKeys: ct, 4434 tradesBySession: ct.map((M) => ({ 4435 sessionKey: M, 4436 count: nt.get(M) 4437 })), 4438 firstLoadedTime: o[0]?.time ?? null, 4439 lastLoadedTime: o[o.length - 1]?.time ?? null, 4440 firstEvaluatedTime: z[0]?.time ?? null, 4441 lastEvaluatedTime: z[z.length - 1]?.time ?? null, 4442 firstTradeTime: C.trades?.length ? Math.min(...C.trades.map((M) => M.entryTime)) : null, 4443 lastTradeTime: C.trades?.length ? Math.max(...C.trades.map((M) => M.exitTime)) : null 4444 }; 4445 C.coverage = Rt, C.diagnostics = { 4446 ...w.diagnostics, 4447 barsEvaluated: z.length 4448 }; 4449 const yt = { 4450 codeHash: p, 4451 paramsHash: x, 4452 engineVersion: Wi, 4453 apiContractVersion: qi.version, 4454 candleFingerprint: P, 4455 fees: n, 4456 slippageBps: h, 4457 spreadBps: l, 4458 fillModel: u, 4459 intrabarPolicy: "stop-before-target; trailing-updates-next-bar; gap-aware-stops", 4460 endPolicy: "close-final-bar", 4461 barCount: o.length, 4462 warmupBars: at, 4463 coverage: Rt, 4464 marketSession: c, 4465 monteCarloSeed: I 4466 }; 4467 return yt.runId = vt(JSON.stringify(yt)), C.startDate = o[0]?.time ?? null, C.endDate = o[o.length - 1]?.time ?? null, { 4468 ok: !0, 4469 error: null, 4470 report: C, 4471 reportSummary: Qi(C), 4472 provenance: yt, 4473 logs: w.logs 4474 }; 4475 } 4476 function Ye(t, e) { 4477 return [...new Set((t || []).map((i) => qt(i.time, e)))].sort(); 4478 } 4479 function Xi(t) { 4480 const e = {}; 4481 for (const i of Object.keys(t || {}).sort()) e[i] = t[i]; 4482 return e; 4483 } 4484 for (const t of [ 4485 "fetch", 4486 "XMLHttpRequest", 4487 "WebSocket", 4488 "importScripts", 4489 "indexedDB", 4490 "caches", 4491 "EventSource", 4492 "Notification" 4493 ]) try { 4494 self[t] = void 0; 4495 } catch {} 4496 self.onmessage = (t) => { 4497 const { id: e, code: i, candles: s, params: r, config: o } = t.data || {}; 4498 let n; 4499 try { 4500 n = Yi({ 4501 code: i, 4502 candles: s, 4503 params: r, 4504 config: o 4505 }); 4506 } catch (h) { 4507 n = { 4508 ok: !1, 4509 error: `Sandbox error: ${h?.message || String(h)}` 4510 }; 4511 } 4512 self.postMessage({ 4513 id: e, 4514 ...n 4515 }); 4516 }; 4517})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.